Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: tools/perf/page_sets/key_hit_test_cases/paper-calculator-no-rendering.html

Issue 789003002: Add telemetry test for paper calculator hit testing performance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add line after header Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/key_hit_test_cases.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!--
2 @license
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polym er.github.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS .txt
6 The complete set of contributors may be found at http://polymer.github.io/CO NTRIBUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/P ATENTS.txt
9 --><!DOCTYPE html><html><head><title>Paper Calculator</title><meta charset="UTF- 8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum -scale=1.0"><meta name="mobile-web-app-capable" content="yes"><meta name="apple- mobile-web-app-capable" content="yes"><script>window.WebComponents=window.WebCom ponents||{};(function(scope){var flags=scope.flags||{};var file="webcomponents.j s";var script=document.querySelector('script[src*="'+file+'"]');var flags={};if( !flags.noOpts){location.search.slice(1).split("&").forEach(function(o){o=o.split ("=");o[0]&&(flags[o[0]]=o[1]||true)});if(script){for(var i=0,a;a=script.attribu tes[i];i++){if(a.name!=="src"){flags[a.name]=a.value||true}}}if(flags.log){var p arts=flags.log.split(",");flags.log={};parts.forEach(function(f){flags.log[f]=tr ue})}else{flags.log={}}}flags.shadow=flags.shadow||flags.shadowdom||flags.polyfi ll;if(flags.shadow==="native"){flags.shadow=false}else{flags.shadow=flags.shadow ||!HTMLElement.prototype.createShadowRoot}if(flags.register){window.CustomElemen ts=window.CustomElements||{flags:{}};window.CustomElements.flags.register=flags. register}scope.flags=flags})(WebComponents);if(WebComponents.flags.shadow){if(ty peof WeakMap==="undefined"){(function(){var defineProperty=Object.defineProperty ;var counter=Date.now()%1e9;var WeakMap=function(){this.name="__st"+(Math.random ()*1e9>>>0)+(counter++ +"__")};WeakMap.prototype={set:function(key,value){var en try=key[this.name];if(entry&&entry[0]===key)entry[1]=value;else defineProperty(k ey,this.name,{value:[key,value],writable:true});return this},get:function(key){v ar entry;return(entry=key[this.name])&&entry[0]===key?entry[1]:undefined},"delet e":function(key){var entry=key[this.name];if(!entry||entry[0]!==key)return false ;entry[0]=entry[1]=undefined;return true},has:function(key){var entry=key[this.n ame];if(!entry)return false;return entry[0]===key}};window.WeakMap=WeakMap})()}w indow.ShadowDOMPolyfill={};(function(scope){"use strict";var constructorTable=ne w WeakMap;var nativePrototypeTable=new WeakMap;var wrappers=Object.create(null); function detectEval(){if(typeof chrome!=="undefined"&&chrome.app&&chrome.app.run time){return false}if(navigator.getDeviceStorage){return false}try{var f=new Fun ction("return true;");return f()}catch(ex){return false}}var hasEval=detectEval( );function assert(b){if(!b)throw new Error("Assertion failed")}var definePropert y=Object.defineProperty;var getOwnPropertyNames=Object.getOwnPropertyNames;var g etOwnPropertyDescriptor=Object.getOwnPropertyDescriptor;function mixin(to,from){ var names=getOwnPropertyNames(from);for(var i=0;i<names.length;i++){var name=nam es[i];defineProperty(to,name,getOwnPropertyDescriptor(from,name))}return to}func tion mixinStatics(to,from){var names=getOwnPropertyNames(from);for(var i=0;i<nam es.length;i++){var name=names[i];switch(name){case"arguments":case"caller":case" length":case"name":case"prototype":case"toString":continue}defineProperty(to,nam e,getOwnPropertyDescriptor(from,name))}return to}function oneOf(object,propertyN ames){for(var i=0;i<propertyNames.length;i++){if(propertyNames[i]in object)retur n propertyNames[i]}}var nonEnumerableDataDescriptor={value:undefined,configurabl e:true,enumerable:false,writable:true};function defineNonEnumerableDataProperty( object,name,value){nonEnumerableDataDescriptor.value=value;defineProperty(object ,name,nonEnumerableDataDescriptor)}getOwnPropertyNames(window);function getWrapp erConstructor(node){var nativePrototype=node.__proto__||Object.getPrototypeOf(no de);var wrapperConstructor=constructorTable.get(nativePrototype);if(wrapperConst ructor)return wrapperConstructor;var parentWrapperConstructor=getWrapperConstruc tor(nativePrototype);var GeneratedWrapper=createWrapperConstructor(parentWrapper Constructor);registerInternal(nativePrototype,GeneratedWrapper,node);return Gene ratedWrapper}function addForwardingProperties(nativePrototype,wrapperPrototype){ installProperty(nativePrototype,wrapperPrototype,true)}function registerInstance Properties(wrapperPrototype,instanceObject){installProperty(instanceObject,wrapp erPrototype,false)}var isFirefox=/Firefox/.test(navigator.userAgent);var dummyDe scriptor={get:function(){},set:function(v){},configurable:true,enumerable:true}; function isEventHandlerName(name){return/^on[a-z]+$/.test(name)}function isIdent ifierName(name){return/^\w[a-zA-Z_0-9]*$/.test(name)}function getGetter(name){re turn hasEval&&isIdentifierName(name)?new Function("return this.__impl4cf1e782hg_ _."+name):function(){return this.__impl4cf1e782hg__[name]}}function getSetter(na me){return hasEval&&isIdentifierName(name)?new Function("v","this.__impl4cf1e782 hg__."+name+" = v"):function(v){this.__impl4cf1e782hg__[name]=v}}function getMet hod(name){return hasEval&&isIdentifierName(name)?new Function("return this.__imp l4cf1e782hg__."+name+".apply(this.__impl4cf1e782hg__, arguments)"):function(){re turn this.__impl4cf1e782hg__[name].apply(this.__impl4cf1e782hg__,arguments)}}fun ction getDescriptor(source,name){try{return Object.getOwnPropertyDescriptor(sour ce,name)}catch(ex){return dummyDescriptor}}var isBrokenSafari=function(){var des cr=Object.getOwnPropertyDescriptor(Node.prototype,"nodeType");return descr&&!des cr.get&&!descr.set}();function installProperty(source,target,allowMethod,opt_bla cklist){var names=getOwnPropertyNames(source);for(var i=0;i<names.length;i++){va r name=names[i];if(name==="polymerBlackList_")continue;if(name in target)continu e;if(source.polymerBlackList_&&source.polymerBlackList_[name])continue;if(isFire fox){source.__lookupGetter__(name)}var descriptor=getDescriptor(source,name);var getter,setter;if(allowMethod&&typeof descriptor.value==="function"){target[name ]=getMethod(name);continue}var isEvent=isEventHandlerName(name);if(isEvent)gette r=scope.getEventHandlerGetter(name);else getter=getGetter(name);if(descriptor.wr itable||descriptor.set||isBrokenSafari){if(isEvent)setter=scope.getEventHandlerS etter(name);else setter=getSetter(name)}defineProperty(target,name,{get:getter,s et:setter,configurable:descriptor.configurable,enumerable:descriptor.enumerable} )}}function register(nativeConstructor,wrapperConstructor,opt_instance){var nati vePrototype=nativeConstructor.prototype;registerInternal(nativePrototype,wrapper Constructor,opt_instance);mixinStatics(wrapperConstructor,nativeConstructor)}fun ction registerInternal(nativePrototype,wrapperConstructor,opt_instance){var wrap perPrototype=wrapperConstructor.prototype;assert(constructorTable.get(nativeProt otype)===undefined);constructorTable.set(nativePrototype,wrapperConstructor);nat ivePrototypeTable.set(wrapperPrototype,nativePrototype);addForwardingProperties( nativePrototype,wrapperPrototype);if(opt_instance)registerInstanceProperties(wra pperPrototype,opt_instance);defineNonEnumerableDataProperty(wrapperPrototype,"co nstructor",wrapperConstructor);wrapperConstructor.prototype=wrapperPrototype}fun ction isWrapperFor(wrapperConstructor,nativeConstructor){return constructorTable .get(nativeConstructor.prototype)===wrapperConstructor}function registerObject(o bject){var nativePrototype=Object.getPrototypeOf(object);var superWrapperConstru ctor=getWrapperConstructor(nativePrototype);var GeneratedWrapper=createWrapperCo nstructor(superWrapperConstructor);registerInternal(nativePrototype,GeneratedWra pper,object);return GeneratedWrapper}function createWrapperConstructor(superWrap perConstructor){function GeneratedWrapper(node){superWrapperConstructor.call(thi s,node)}var p=Object.create(superWrapperConstructor.prototype);p.constructor=Gen eratedWrapper;GeneratedWrapper.prototype=p;return GeneratedWrapper}function isWr apper(object){return object&&object.__impl4cf1e782hg__}function isNative(object) {return!isWrapper(object)}function wrap(impl){if(impl===null)return null;assert( isNative(impl));return impl.__wrapper8e3dd93a60__||(impl.__wrapper8e3dd93a60__=n ew(getWrapperConstructor(impl))(impl))}function unwrap(wrapper){if(wrapper===nul l)return null;assert(isWrapper(wrapper));return wrapper.__impl4cf1e782hg__}funct ion unsafeUnwrap(wrapper){return wrapper.__impl4cf1e782hg__}function setWrapper( impl,wrapper){wrapper.__impl4cf1e782hg__=impl;impl.__wrapper8e3dd93a60__=wrapper }function unwrapIfNeeded(object){return object&&isWrapper(object)?unwrap(object) :object}function wrapIfNeeded(object){return object&&!isWrapper(object)?wrap(obj ect):object}function rewrap(node,wrapper){if(wrapper===null)return;assert(isNati ve(node));assert(wrapper===undefined||isWrapper(wrapper));node.__wrapper8e3dd93a 60__=wrapper}var getterDescriptor={get:undefined,configurable:true,enumerable:tr ue};function defineGetter(constructor,name,getter){getterDescriptor.get=getter;d efineProperty(constructor.prototype,name,getterDescriptor)}function defineWrapGe tter(constructor,name){defineGetter(constructor,name,function(){return wrap(this .__impl4cf1e782hg__[name])})}function forwardMethodsToWrapper(constructors,names ){constructors.forEach(function(constructor){names.forEach(function(name){constr uctor.prototype[name]=function(){var w=wrapIfNeeded(this);return w[name].apply(w ,arguments)}})})}scope.assert=assert;scope.constructorTable=constructorTable;sco pe.defineGetter=defineGetter;scope.defineWrapGetter=defineWrapGetter;scope.forwa rdMethodsToWrapper=forwardMethodsToWrapper;scope.isWrapper=isWrapper;scope.isWra pperFor=isWrapperFor;scope.mixin=mixin;scope.nativePrototypeTable=nativePrototyp eTable;scope.oneOf=oneOf;scope.registerObject=registerObject;scope.registerWrapp er=register;scope.rewrap=rewrap;scope.setWrapper=setWrapper;scope.unsafeUnwrap=u nsafeUnwrap;scope.unwrap=unwrap;scope.unwrapIfNeeded=unwrapIfNeeded;scope.wrap=w rap;scope.wrapIfNeeded=wrapIfNeeded;scope.wrappers=wrappers})(window.ShadowDOMPo lyfill);(function(scope){"use strict";function newSplice(index,removed,addedCoun t){return{index:index,removed:removed,addedCount:addedCount}}var EDIT_LEAVE=0;va r EDIT_UPDATE=1;var EDIT_ADD=2;var EDIT_DELETE=3;function ArraySplice(){}ArraySp lice.prototype={calcEditDistances:function(current,currentStart,currentEnd,old,o ldStart,oldEnd){var rowCount=oldEnd-oldStart+1;var columnCount=currentEnd-curren tStart+1;var distances=new Array(rowCount);for(var i=0;i<rowCount;i++){distances [i]=new Array(columnCount);distances[i][0]=i}for(var j=0;j<columnCount;j++)dista nces[0][j]=j;for(var i=1;i<rowCount;i++){for(var j=1;j<columnCount;j++){if(this. equals(current[currentStart+j-1],old[oldStart+i-1]))distances[i][j]=distances[i- 1][j-1];else{var north=distances[i-1][j]+1;var west=distances[i][j-1]+1;distance s[i][j]=north<west?north:west}}}return distances},spliceOperationsFromEditDistan ces:function(distances){var i=distances.length-1;var j=distances[0].length-1;var current=distances[i][j];var edits=[];while(i>0||j>0){if(i==0){edits.push(EDIT_A DD);j--;continue}if(j==0){edits.push(EDIT_DELETE);i--;continue}var northWest=dis tances[i-1][j-1];var west=distances[i-1][j];var north=distances[i][j-1];var min; if(west<north)min=west<northWest?west:northWest;else min=north<northWest?north:n orthWest;if(min==northWest){if(northWest==current){edits.push(EDIT_LEAVE)}else{e dits.push(EDIT_UPDATE);current=northWest}i--;j--}else if(min==west){edits.push(E DIT_DELETE);i--;current=west}else{edits.push(EDIT_ADD);j--;current=north}}edits. reverse();return edits},calcSplices:function(current,currentStart,currentEnd,old ,oldStart,oldEnd){var prefixCount=0;var suffixCount=0;var minLength=Math.min(cur rentEnd-currentStart,oldEnd-oldStart);if(currentStart==0&&oldStart==0)prefixCoun t=this.sharedPrefix(current,old,minLength);if(currentEnd==current.length&&oldEnd ==old.length)suffixCount=this.sharedSuffix(current,old,minLength-prefixCount);cu rrentStart+=prefixCount;oldStart+=prefixCount;currentEnd-=suffixCount;oldEnd-=su ffixCount;if(currentEnd-currentStart==0&&oldEnd-oldStart==0)return[];if(currentS tart==currentEnd){var splice=newSplice(currentStart,[],0);while(oldStart<oldEnd) splice.removed.push(old[oldStart++]);return[splice]}else if(oldStart==oldEnd)ret urn[newSplice(currentStart,[],currentEnd-currentStart)];var ops=this.spliceOpera tionsFromEditDistances(this.calcEditDistances(current,currentStart,currentEnd,ol d,oldStart,oldEnd));var splice=undefined;var splices=[];var index=currentStart;v ar oldIndex=oldStart;for(var i=0;i<ops.length;i++){switch(ops[i]){case EDIT_LEAV E:if(splice){splices.push(splice);splice=undefined}index++;oldIndex++;break;case EDIT_UPDATE:if(!splice)splice=newSplice(index,[],0);splice.addedCount++;index++ ;splice.removed.push(old[oldIndex]);oldIndex++;break;case EDIT_ADD:if(!splice)sp lice=newSplice(index,[],0);splice.addedCount++;index++;break;case EDIT_DELETE:if (!splice)splice=newSplice(index,[],0);splice.removed.push(old[oldIndex]);oldInde x++;break}}if(splice){splices.push(splice)}return splices},sharedPrefix:function (current,old,searchLength){for(var i=0;i<searchLength;i++)if(!this.equals(curren t[i],old[i]))return i;return searchLength},sharedSuffix:function(current,old,sea rchLength){var index1=current.length;var index2=old.length;var count=0;while(cou nt<searchLength&&this.equals(current[--index1],old[--index2]))count++;return cou nt},calculateSplices:function(current,previous){return this.calcSplices(current, 0,current.length,previous,0,previous.length)},equals:function(currentValue,previ ousValue){return currentValue===previousValue}};scope.ArraySplice=ArraySplice})( window.ShadowDOMPolyfill);(function(context){"use strict";var OriginalMutationOb server=window.MutationObserver;var callbacks=[];var pending=false;var timerFunc; function handle(){pending=false;var copies=callbacks.slice(0);callbacks=[];for(v ar i=0;i<copies.length;i++){(0,copies[i])()}}if(OriginalMutationObserver){var co unter=1;var observer=new OriginalMutationObserver(handle);var textNode=document. createTextNode(counter);observer.observe(textNode,{characterData:true});timerFun c=function(){counter=(counter+1)%2;textNode.data=counter}}else{timerFunc=window. setTimeout}function setEndOfMicrotask(func){callbacks.push(func);if(pending)retu rn;pending=true;timerFunc(handle,0)}context.setEndOfMicrotask=setEndOfMicrotask} )(window.ShadowDOMPolyfill);(function(scope){"use strict";var setEndOfMicrotask= scope.setEndOfMicrotask;var wrapIfNeeded=scope.wrapIfNeeded;var wrappers=scope.w rappers;var registrationsTable=new WeakMap;var globalMutationObservers=[];var is Scheduled=false;function scheduleCallback(observer){if(observer.scheduled_)retur n;observer.scheduled_=true;globalMutationObservers.push(observer);if(isScheduled )return;setEndOfMicrotask(notifyObservers);isScheduled=true}function notifyObser vers(){isScheduled=false;while(globalMutationObservers.length){var notifyList=gl obalMutationObservers;globalMutationObservers=[];notifyList.sort(function(x,y){r eturn x.uid_-y.uid_});for(var i=0;i<notifyList.length;i++){var mo=notifyList[i]; mo.scheduled_=false;var queue=mo.takeRecords();removeTransientObserversFor(mo);i f(queue.length){mo.callback_(queue,mo)}}}}function MutationRecord(type,target){t his.type=type;this.target=target;this.addedNodes=new wrappers.NodeList;this.remo vedNodes=new wrappers.NodeList;this.previousSibling=null;this.nextSibling=null;t his.attributeName=null;this.attributeNamespace=null;this.oldValue=null}function registerTransientObservers(ancestor,node){for(;ancestor;ancestor=ancestor.parent Node){var registrations=registrationsTable.get(ancestor);if(!registrations)conti nue;for(var i=0;i<registrations.length;i++){var registration=registrations[i];if (registration.options.subtree)registration.addTransientObserver(node)}}}function removeTransientObserversFor(observer){for(var i=0;i<observer.nodes_.length;i++) {var node=observer.nodes_[i];var registrations=registrationsTable.get(node);if(! registrations)return;for(var j=0;j<registrations.length;j++){var registration=re gistrations[j];if(registration.observer===observer)registration.removeTransientO bservers()}}}function enqueueMutation(target,type,data){var interestedObservers= Object.create(null);var associatedStrings=Object.create(null);for(var node=targe t;node;node=node.parentNode){var registrations=registrationsTable.get(node);if(! registrations)continue;for(var j=0;j<registrations.length;j++){var registration= registrations[j];var options=registration.options;if(node!==target&&!options.sub tree)continue;if(type==="attributes"&&!options.attributes)continue;if(type==="at tributes"&&options.attributeFilter&&(data.namespace!==null||options.attributeFil ter.indexOf(data.name)===-1)){continue}if(type==="characterData"&&!options.chara cterData)continue;if(type==="childList"&&!options.childList)continue;var observe r=registration.observer;interestedObservers[observer.uid_]=observer;if(type==="a ttributes"&&options.attributeOldValue||type==="characterData"&&options.character DataOldValue){associatedStrings[observer.uid_]=data.oldValue}}}for(var uid in in terestedObservers){var observer=interestedObservers[uid];var record=new Mutation Record(type,target);if("name"in data&&"namespace"in data){record.attributeName=d ata.name;record.attributeNamespace=data.namespace}if(data.addedNodes)record.adde dNodes=data.addedNodes;if(data.removedNodes)record.removedNodes=data.removedNode s;if(data.previousSibling)record.previousSibling=data.previousSibling;if(data.ne xtSibling)record.nextSibling=data.nextSibling;if(associatedStrings[uid]!==undefi ned)record.oldValue=associatedStrings[uid];scheduleCallback(observer);observer.r ecords_.push(record)}}var slice=Array.prototype.slice;function MutationObserverO ptions(options){this.childList=!!options.childList;this.subtree=!!options.subtre e;if(!("attributes"in options)&&("attributeOldValue"in options||"attributeFilter "in options)){this.attributes=true}else{this.attributes=!!options.attributes}if( "characterDataOldValue"in options&&!("characterData"in options))this.characterDa ta=true;else this.characterData=!!options.characterData;if(!this.attributes&&(op tions.attributeOldValue||"attributeFilter"in options)||!this.characterData&&opti ons.characterDataOldValue){throw new TypeError}this.characterData=!!options.char acterData;this.attributeOldValue=!!options.attributeOldValue;this.characterDataO ldValue=!!options.characterDataOldValue;if("attributeFilter"in options){if(optio ns.attributeFilter==null||typeof options.attributeFilter!=="object"){throw new T ypeError}this.attributeFilter=slice.call(options.attributeFilter)}else{this.attr ibuteFilter=null}}var uidCounter=0;function MutationObserver(callback){this.call back_=callback;this.nodes_=[];this.records_=[];this.uid_=++uidCounter;this.sched uled_=false}MutationObserver.prototype={constructor:MutationObserver,observe:fun ction(target,options){target=wrapIfNeeded(target);var newOptions=new MutationObs erverOptions(options);var registration;var registrations=registrationsTable.get( target);if(!registrations)registrationsTable.set(target,registrations=[]);for(va r i=0;i<registrations.length;i++){if(registrations[i].observer===this){registrat ion=registrations[i];registration.removeTransientObservers();registration.option s=newOptions}}if(!registration){registration=new Registration(this,target,newOpt ions);registrations.push(registration);this.nodes_.push(target)}},disconnect:fun ction(){this.nodes_.forEach(function(node){var registrations=registrationsTable. get(node);for(var i=0;i<registrations.length;i++){var registration=registrations [i];if(registration.observer===this){registrations.splice(i,1);break}}},this);th is.records_=[]},takeRecords:function(){var copyOfRecords=this.records_;this.reco rds_=[];return copyOfRecords}};function Registration(observer,target,options){th is.observer=observer;this.target=target;this.options=options;this.transientObser vedNodes=[]}Registration.prototype={addTransientObserver:function(node){if(node= ==this.target)return;scheduleCallback(this.observer);this.transientObservedNodes .push(node);var registrations=registrationsTable.get(node);if(!registrations)reg istrationsTable.set(node,registrations=[]);registrations.push(this)},removeTrans ientObservers:function(){var transientObservedNodes=this.transientObservedNodes; this.transientObservedNodes=[];for(var i=0;i<transientObservedNodes.length;i++){ var node=transientObservedNodes[i];var registrations=registrationsTable.get(node );for(var j=0;j<registrations.length;j++){if(registrations[j]===this){registrati ons.splice(j,1);break}}}}};scope.enqueueMutation=enqueueMutation;scope.registerT ransientObservers=registerTransientObservers;scope.wrappers.MutationObserver=Mut ationObserver;scope.wrappers.MutationRecord=MutationRecord})(window.ShadowDOMPol yfill);(function(scope){"use strict";function TreeScope(root,parent){this.root=r oot;this.parent=parent}TreeScope.prototype={get renderer(){if(this.root instance of scope.wrappers.ShadowRoot){return scope.getRendererForHost(this.root.host)}re turn null},contains:function(treeScope){for(;treeScope;treeScope=treeScope.paren t){if(treeScope===this)return true}return false}};function setTreeScope(node,tre eScope){if(node.treeScope_!==treeScope){node.treeScope_=treeScope;for(var sr=nod e.shadowRoot;sr;sr=sr.olderShadowRoot){sr.treeScope_.parent=treeScope}for(var ch ild=node.firstChild;child;child=child.nextSibling){setTreeScope(child,treeScope) }}}function getTreeScope(node){if(node instanceof scope.wrappers.Window){debugge r}if(node.treeScope_)return node.treeScope_;var parent=node.parentNode;var treeS cope;if(parent)treeScope=getTreeScope(parent);else treeScope=new TreeScope(node, null);return node.treeScope_=treeScope}scope.TreeScope=TreeScope;scope.getTreeSc ope=getTreeScope;scope.setTreeScope=setTreeScope})(window.ShadowDOMPolyfill);(fu nction(scope){"use strict";var forwardMethodsToWrapper=scope.forwardMethodsToWra pper;var getTreeScope=scope.getTreeScope;var mixin=scope.mixin;var registerWrapp er=scope.registerWrapper;var setWrapper=scope.setWrapper;var unsafeUnwrap=scope. unsafeUnwrap;var unwrap=scope.unwrap;var wrap=scope.wrap;var wrappers=scope.wrap pers;var wrappedFuns=new WeakMap;var listenersTable=new WeakMap;var handledEvent sTable=new WeakMap;var currentlyDispatchingEvents=new WeakMap;var targetTable=ne w WeakMap;var currentTargetTable=new WeakMap;var relatedTargetTable=new WeakMap; var eventPhaseTable=new WeakMap;var stopPropagationTable=new WeakMap;var stopImm ediatePropagationTable=new WeakMap;var eventHandlersTable=new WeakMap;var eventP athTable=new WeakMap;function isShadowRoot(node){return node instanceof wrappers .ShadowRoot}function rootOfNode(node){return getTreeScope(node).root}function ge tEventPath(node,event){var path=[];var current=node;path.push(current);while(cur rent){var destinationInsertionPoints=getDestinationInsertionPoints(current);if(d estinationInsertionPoints&&destinationInsertionPoints.length>0){for(var i=0;i<de stinationInsertionPoints.length;i++){var insertionPoint=destinationInsertionPoin ts[i];if(isShadowInsertionPoint(insertionPoint)){var shadowRoot=rootOfNode(inser tionPoint);var olderShadowRoot=shadowRoot.olderShadowRoot;if(olderShadowRoot)pat h.push(olderShadowRoot)}path.push(insertionPoint)}current=destinationInsertionPo ints[destinationInsertionPoints.length-1]}else{if(isShadowRoot(current)){if(inSa meTree(node,current)&&eventMustBeStopped(event)){break}current=current.host;path .push(current)}else{current=current.parentNode;if(current)path.push(current)}}}r eturn path}function eventMustBeStopped(event){if(!event)return false;switch(even t.type){case"abort":case"error":case"select":case"change":case"load":case"reset" :case"resize":case"scroll":case"selectstart":return true}return false}function i sShadowInsertionPoint(node){return node instanceof HTMLShadowElement}function ge tDestinationInsertionPoints(node){return scope.getDestinationInsertionPoints(nod e)}function eventRetargetting(path,currentTarget){if(path.length===0)return curr entTarget;if(currentTarget instanceof wrappers.Window)currentTarget=currentTarge t.document;var currentTargetTree=getTreeScope(currentTarget);var originalTarget= path[0];var originalTargetTree=getTreeScope(originalTarget);var relativeTargetTr ee=lowestCommonInclusiveAncestor(currentTargetTree,originalTargetTree);for(var i =0;i<path.length;i++){var node=path[i];if(getTreeScope(node)===relativeTargetTre e)return node}return path[path.length-1]}function getTreeScopeAncestors(treeScop e){var ancestors=[];for(;treeScope;treeScope=treeScope.parent){ancestors.push(tr eeScope)}return ancestors}function lowestCommonInclusiveAncestor(tsA,tsB){var an cestorsA=getTreeScopeAncestors(tsA);var ancestorsB=getTreeScopeAncestors(tsB);va r result=null;while(ancestorsA.length>0&&ancestorsB.length>0){var a=ancestorsA.p op();var b=ancestorsB.pop();if(a===b)result=a;else break}return result}function getTreeScopeRoot(ts){if(!ts.parent)return ts;return getTreeScopeRoot(ts.parent)} function relatedTargetResolution(event,currentTarget,relatedTarget){if(currentTa rget instanceof wrappers.Window)currentTarget=currentTarget.document;var current TargetTree=getTreeScope(currentTarget);var relatedTargetTree=getTreeScope(relate dTarget);var relatedTargetEventPath=getEventPath(relatedTarget,event);var lowest CommonAncestorTree;var lowestCommonAncestorTree=lowestCommonInclusiveAncestor(cu rrentTargetTree,relatedTargetTree);if(!lowestCommonAncestorTree)lowestCommonAnce storTree=relatedTargetTree.root;for(var commonAncestorTree=lowestCommonAncestorT ree;commonAncestorTree;commonAncestorTree=commonAncestorTree.parent){var adjuste dRelatedTarget;for(var i=0;i<relatedTargetEventPath.length;i++){var node=related TargetEventPath[i];if(getTreeScope(node)===commonAncestorTree)return node}}retur n null}function inSameTree(a,b){return getTreeScope(a)===getTreeScope(b)}var NON E=0;var CAPTURING_PHASE=1;var AT_TARGET=2;var BUBBLING_PHASE=3;var pendingError; function dispatchOriginalEvent(originalEvent){if(handledEventsTable.get(original Event))return;handledEventsTable.set(originalEvent,true);dispatchEvent(wrap(orig inalEvent),wrap(originalEvent.target));if(pendingError){var err=pendingError;pen dingError=null;throw err}}function isLoadLikeEvent(event){switch(event.type){cas e"load":case"beforeunload":case"unload":return true}return false}function dispat chEvent(event,originalWrapperTarget){if(currentlyDispatchingEvents.get(event))th row new Error("InvalidStateError");currentlyDispatchingEvents.set(event,true);sc ope.renderAllPending();var eventPath;var overrideTarget;var win;if(isLoadLikeEve nt(event)&&!event.bubbles){var doc=originalWrapperTarget;if(doc instanceof wrapp ers.Document&&(win=doc.defaultView)){overrideTarget=doc;eventPath=[]}}if(!eventP ath){if(originalWrapperTarget instanceof wrappers.Window){win=originalWrapperTar get;eventPath=[]}else{eventPath=getEventPath(originalWrapperTarget,event);if(!is LoadLikeEvent(event)){var doc=eventPath[eventPath.length-1];if(doc instanceof wr appers.Document)win=doc.defaultView}}}eventPathTable.set(event,eventPath);if(dis patchCapturing(event,eventPath,win,overrideTarget)){if(dispatchAtTarget(event,ev entPath,win,overrideTarget)){dispatchBubbling(event,eventPath,win,overrideTarget )}}eventPhaseTable.set(event,NONE);currentTargetTable.delete(event,null);current lyDispatchingEvents.delete(event);return event.defaultPrevented}function dispatc hCapturing(event,eventPath,win,overrideTarget){var phase=CAPTURING_PHASE;if(win) {if(!invoke(win,event,phase,eventPath,overrideTarget))return false}for(var i=eve ntPath.length-1;i>0;i--){if(!invoke(eventPath[i],event,phase,eventPath,overrideT arget))return false}return true}function dispatchAtTarget(event,eventPath,win,ov errideTarget){var phase=AT_TARGET;var currentTarget=eventPath[0]||win;return inv oke(currentTarget,event,phase,eventPath,overrideTarget)}function dispatchBubblin g(event,eventPath,win,overrideTarget){var phase=BUBBLING_PHASE;for(var i=1;i<eve ntPath.length;i++){if(!invoke(eventPath[i],event,phase,eventPath,overrideTarget) )return}if(win&&eventPath.length>0){invoke(win,event,phase,eventPath,overrideTar get)}}function invoke(currentTarget,event,phase,eventPath,overrideTarget){var li steners=listenersTable.get(currentTarget);if(!listeners)return true;var target=o verrideTarget||eventRetargetting(eventPath,currentTarget);if(target===currentTar get){if(phase===CAPTURING_PHASE)return true;if(phase===BUBBLING_PHASE)phase=AT_T ARGET}else if(phase===BUBBLING_PHASE&&!event.bubbles){return true}if("relatedTar get"in event){var originalEvent=unwrap(event);var unwrappedRelatedTarget=origina lEvent.relatedTarget;if(unwrappedRelatedTarget){if(unwrappedRelatedTarget instan ceof Object&&unwrappedRelatedTarget.addEventListener){var relatedTarget=wrap(unw rappedRelatedTarget);var adjusted=relatedTargetResolution(event,currentTarget,re latedTarget);if(adjusted===target)return true}else{adjusted=null}relatedTargetTa ble.set(event,adjusted)}}eventPhaseTable.set(event,phase);var type=event.type;va r anyRemoved=false;targetTable.set(event,target);currentTargetTable.set(event,cu rrentTarget);listeners.depth++;for(var i=0,len=listeners.length;i<len;i++){var l istener=listeners[i];if(listener.removed){anyRemoved=true;continue}if(listener.t ype!==type||!listener.capture&&phase===CAPTURING_PHASE||listener.capture&&phase= ==BUBBLING_PHASE){continue}try{if(typeof listener.handler==="function")listener. handler.call(currentTarget,event);else listener.handler.handleEvent(event);if(st opImmediatePropagationTable.get(event))return false}catch(ex){if(!pendingError)p endingError=ex}}listeners.depth--;if(anyRemoved&&listeners.depth===0){var copy=l isteners.slice();listeners.length=0;for(var i=0;i<copy.length;i++){if(!copy[i].r emoved)listeners.push(copy[i])}}return!stopPropagationTable.get(event)}function Listener(type,handler,capture){this.type=type;this.handler=handler;this.capture= Boolean(capture)}Listener.prototype={equals:function(that){return this.handler== =that.handler&&this.type===that.type&&this.capture===that.capture},get removed() {return this.handler===null},remove:function(){this.handler=null}};var OriginalE vent=window.Event;OriginalEvent.prototype.polymerBlackList_={returnValue:true,ke yLocation:true};function Event(type,options){if(type instanceof OriginalEvent){v ar impl=type;if(!OriginalBeforeUnloadEvent&&impl.type==="beforeunload"&&!(this i nstanceof BeforeUnloadEvent)){return new BeforeUnloadEvent(impl)}setWrapper(impl ,this)}else{return wrap(constructEvent(OriginalEvent,"Event",type,options))}}Eve nt.prototype={get target(){return targetTable.get(this)},get currentTarget(){ret urn currentTargetTable.get(this)},get eventPhase(){return eventPhaseTable.get(th is)},get path(){var eventPath=eventPathTable.get(this);if(!eventPath)return[];re turn eventPath.slice()},stopPropagation:function(){stopPropagationTable.set(this ,true)},stopImmediatePropagation:function(){stopPropagationTable.set(this,true); stopImmediatePropagationTable.set(this,true)}};registerWrapper(OriginalEvent,Eve nt,document.createEvent("Event"));function unwrapOptions(options){if(!options||! options.relatedTarget)return options;return Object.create(options,{relatedTarget :{value:unwrap(options.relatedTarget)}})}function registerGenericEvent(name,Supe rEvent,prototype){var OriginalEvent=window[name];var GenericEvent=function(type, options){if(type instanceof OriginalEvent)setWrapper(type,this);else return wrap (constructEvent(OriginalEvent,name,type,options))};GenericEvent.prototype=Object .create(SuperEvent.prototype);if(prototype)mixin(GenericEvent.prototype,prototyp e);if(OriginalEvent){try{registerWrapper(OriginalEvent,GenericEvent,new Original Event("temp"))}catch(ex){registerWrapper(OriginalEvent,GenericEvent,document.cre ateEvent(name))}}return GenericEvent}var UIEvent=registerGenericEvent("UIEvent", Event);var CustomEvent=registerGenericEvent("CustomEvent",Event);var relatedTarg etProto={get relatedTarget(){var relatedTarget=relatedTargetTable.get(this);if(r elatedTarget!==undefined)return relatedTarget;return wrap(unwrap(this).relatedTa rget)}};function getInitFunction(name,relatedTargetIndex){return function(){argu ments[relatedTargetIndex]=unwrap(arguments[relatedTargetIndex]);var impl=unwrap( this);impl[name].apply(impl,arguments)}}var mouseEventProto=mixin({initMouseEven t:getInitFunction("initMouseEvent",14)},relatedTargetProto);var focusEventProto= mixin({initFocusEvent:getInitFunction("initFocusEvent",5)},relatedTargetProto);v ar MouseEvent=registerGenericEvent("MouseEvent",UIEvent,mouseEventProto);var Foc usEvent=registerGenericEvent("FocusEvent",UIEvent,focusEventProto);var defaultIn itDicts=Object.create(null);var supportsEventConstructors=function(){try{new win dow.FocusEvent("focus")}catch(ex){return false}return true
10 }();function constructEvent(OriginalEvent,name,type,options){if(supportsEventCon structors)return new OriginalEvent(type,unwrapOptions(options));var event=unwrap (document.createEvent(name));var defaultDict=defaultInitDicts[name];var args=[ty pe];Object.keys(defaultDict).forEach(function(key){var v=options!=null&&key in o ptions?options[key]:defaultDict[key];if(key==="relatedTarget")v=unwrap(v);args.p ush(v)});event["init"+name].apply(event,args);return event}if(!supportsEventCons tructors){var configureEventConstructor=function(name,initDict,superName){if(sup erName){var superDict=defaultInitDicts[superName];initDict=mixin(mixin({},superD ict),initDict)}defaultInitDicts[name]=initDict};configureEventConstructor("Event ",{bubbles:false,cancelable:false});configureEventConstructor("CustomEvent",{det ail:null},"Event");configureEventConstructor("UIEvent",{view:null,detail:0},"Eve nt");configureEventConstructor("MouseEvent",{screenX:0,screenY:0,clientX:0,clien tY:0,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false,button:0,relatedTar get:null},"UIEvent");configureEventConstructor("FocusEvent",{relatedTarget:null} ,"UIEvent")}var OriginalBeforeUnloadEvent=window.BeforeUnloadEvent;function Befo reUnloadEvent(impl){Event.call(this,impl)}BeforeUnloadEvent.prototype=Object.cre ate(Event.prototype);mixin(BeforeUnloadEvent.prototype,{get returnValue(){return unsafeUnwrap(this).returnValue},set returnValue(v){unsafeUnwrap(this).returnVal ue=v}});if(OriginalBeforeUnloadEvent)registerWrapper(OriginalBeforeUnloadEvent,B eforeUnloadEvent);function isValidListener(fun){if(typeof fun==="function")retur n true;return fun&&fun.handleEvent}function isMutationEvent(type){switch(type){c ase"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified ":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocu ment":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModif ied":return true}return false}var OriginalEventTarget=window.EventTarget;functio n EventTarget(impl){setWrapper(impl,this)}var methodNames=["addEventListener","r emoveEventListener","dispatchEvent"];[Node,Window].forEach(function(constructor) {var p=constructor.prototype;methodNames.forEach(function(name){Object.definePro perty(p,name+"_",{value:p[name]})})});function getTargetToListenAt(wrapper){if(w rapper instanceof wrappers.ShadowRoot)wrapper=wrapper.host;return unwrap(wrapper )}EventTarget.prototype={addEventListener:function(type,fun,capture){if(!isValid Listener(fun)||isMutationEvent(type))return;var listener=new Listener(type,fun,c apture);var listeners=listenersTable.get(this);if(!listeners){listeners=[];liste ners.depth=0;listenersTable.set(this,listeners)}else{for(var i=0;i<listeners.len gth;i++){if(listener.equals(listeners[i]))return}}listeners.push(listener);var t arget=getTargetToListenAt(this);target.addEventListener_(type,dispatchOriginalEv ent,true)},removeEventListener:function(type,fun,capture){capture=Boolean(captur e);var listeners=listenersTable.get(this);if(!listeners)return;var count=0,found =false;for(var i=0;i<listeners.length;i++){if(listeners[i].type===type&&listener s[i].capture===capture){count++;if(listeners[i].handler===fun){found=true;listen ers[i].remove()}}}if(found&&count===1){var target=getTargetToListenAt(this);targ et.removeEventListener_(type,dispatchOriginalEvent,true)}},dispatchEvent:functio n(event){var nativeEvent=unwrap(event);var eventType=nativeEvent.type;handledEve ntsTable.set(nativeEvent,false);scope.renderAllPending();var tempListener;if(!ha sListenerInAncestors(this,eventType)){tempListener=function(){};this.addEventLis tener(eventType,tempListener,true)}try{return unwrap(this).dispatchEvent_(native Event)}finally{if(tempListener)this.removeEventListener(eventType,tempListener,t rue)}}};function hasListener(node,type){var listeners=listenersTable.get(node);i f(listeners){for(var i=0;i<listeners.length;i++){if(!listeners[i].removed&&liste ners[i].type===type)return true}}return false}function hasListenerInAncestors(ta rget,type){for(var node=unwrap(target);node;node=node.parentNode){if(hasListener (wrap(node),type))return true}return false}if(OriginalEventTarget)registerWrappe r(OriginalEventTarget,EventTarget);function wrapEventTargetMethods(constructors) {forwardMethodsToWrapper(constructors,methodNames)}var originalElementFromPoint= document.elementFromPoint;function elementFromPoint(self,document,x,y){scope.ren derAllPending();var element=wrap(originalElementFromPoint.call(unsafeUnwrap(docu ment),x,y));if(!element)return null;var path=getEventPath(element,null);var idx= path.lastIndexOf(self);if(idx==-1)return null;else path=path.slice(0,idx);return eventRetargetting(path,self)}function getEventHandlerGetter(name){return functi on(){var inlineEventHandlers=eventHandlersTable.get(this);return inlineEventHand lers&&inlineEventHandlers[name]&&inlineEventHandlers[name].value||null}}function getEventHandlerSetter(name){var eventType=name.slice(2);return function(value){ var inlineEventHandlers=eventHandlersTable.get(this);if(!inlineEventHandlers){in lineEventHandlers=Object.create(null);eventHandlersTable.set(this,inlineEventHan dlers)}var old=inlineEventHandlers[name];if(old)this.removeEventListener(eventTy pe,old.wrapped,false);if(typeof value==="function"){var wrapped=function(e){var rv=value.call(this,e);if(rv===false)e.preventDefault();else if(name==="onbeforeu nload"&&typeof rv==="string")e.returnValue=rv};this.addEventListener(eventType,w rapped,false);inlineEventHandlers[name]={value:value,wrapped:wrapped}}}}scope.el ementFromPoint=elementFromPoint;scope.getEventHandlerGetter=getEventHandlerGette r;scope.getEventHandlerSetter=getEventHandlerSetter;scope.wrapEventTargetMethods =wrapEventTargetMethods;scope.wrappers.BeforeUnloadEvent=BeforeUnloadEvent;scope .wrappers.CustomEvent=CustomEvent;scope.wrappers.Event=Event;scope.wrappers.Even tTarget=EventTarget;scope.wrappers.FocusEvent=FocusEvent;scope.wrappers.MouseEve nt=MouseEvent;scope.wrappers.UIEvent=UIEvent})(window.ShadowDOMPolyfill);(functi on(scope){"use strict";var UIEvent=scope.wrappers.UIEvent;var mixin=scope.mixin; var registerWrapper=scope.registerWrapper;var setWrapper=scope.setWrapper;var un safeUnwrap=scope.unsafeUnwrap;var wrap=scope.wrap;var OriginalTouchEvent=window. TouchEvent;if(!OriginalTouchEvent)return;var nativeEvent;try{nativeEvent=documen t.createEvent("TouchEvent")}catch(ex){return}var nonEnumDescriptor={enumerable:f alse};function nonEnum(obj,prop){Object.defineProperty(obj,prop,nonEnumDescripto r)}function Touch(impl){setWrapper(impl,this)}Touch.prototype={get target(){retu rn wrap(unsafeUnwrap(this).target)}};var descr={configurable:true,enumerable:tru e,get:null};["clientX","clientY","screenX","screenY","pageX","pageY","identifier ","webkitRadiusX","webkitRadiusY","webkitRotationAngle","webkitForce"].forEach(f unction(name){descr.get=function(){return unsafeUnwrap(this)[name]};Object.defin eProperty(Touch.prototype,name,descr)});function TouchList(){this.length=0;nonEn um(this,"length")}TouchList.prototype={item:function(index){return this[index]}} ;function wrapTouchList(nativeTouchList){var list=new TouchList;for(var i=0;i<na tiveTouchList.length;i++){list[i]=new Touch(nativeTouchList[i])}list.length=i;re turn list}function TouchEvent(impl){UIEvent.call(this,impl)}TouchEvent.prototype =Object.create(UIEvent.prototype);mixin(TouchEvent.prototype,{get touches(){retu rn wrapTouchList(unsafeUnwrap(this).touches)},get targetTouches(){return wrapTou chList(unsafeUnwrap(this).targetTouches)},get changedTouches(){return wrapTouchL ist(unsafeUnwrap(this).changedTouches)},initTouchEvent:function(){throw new Erro r("Not implemented")}});registerWrapper(OriginalTouchEvent,TouchEvent,nativeEven t);scope.wrappers.Touch=Touch;scope.wrappers.TouchEvent=TouchEvent;scope.wrapper s.TouchList=TouchList})(window.ShadowDOMPolyfill);(function(scope){"use strict"; var unsafeUnwrap=scope.unsafeUnwrap;var wrap=scope.wrap;var nonEnumDescriptor={e numerable:false};function nonEnum(obj,prop){Object.defineProperty(obj,prop,nonEn umDescriptor)}function NodeList(){this.length=0;nonEnum(this,"length")}NodeList. prototype={item:function(index){return this[index]}};nonEnum(NodeList.prototype, "item");function wrapNodeList(list){if(list==null)return list;var wrapperList=ne w NodeList;for(var i=0,length=list.length;i<length;i++){wrapperList[i]=wrap(list [i])}wrapperList.length=length;return wrapperList}function addWrapNodeListMethod (wrapperConstructor,name){wrapperConstructor.prototype[name]=function(){return w rapNodeList(unsafeUnwrap(this)[name].apply(unsafeUnwrap(this),arguments))}}scope .wrappers.NodeList=NodeList;scope.addWrapNodeListMethod=addWrapNodeListMethod;sc ope.wrapNodeList=wrapNodeList})(window.ShadowDOMPolyfill);(function(scope){"use strict";scope.wrapHTMLCollection=scope.wrapNodeList;scope.wrappers.HTMLCollectio n=scope.wrappers.NodeList})(window.ShadowDOMPolyfill);(function(scope){"use stri ct";var EventTarget=scope.wrappers.EventTarget;var NodeList=scope.wrappers.NodeL ist;var TreeScope=scope.TreeScope;var assert=scope.assert;var defineWrapGetter=s cope.defineWrapGetter;var enqueueMutation=scope.enqueueMutation;var getTreeScope =scope.getTreeScope;var isWrapper=scope.isWrapper;var mixin=scope.mixin;var regi sterTransientObservers=scope.registerTransientObservers;var registerWrapper=scop e.registerWrapper;var setTreeScope=scope.setTreeScope;var unsafeUnwrap=scope.uns afeUnwrap;var unwrap=scope.unwrap;var unwrapIfNeeded=scope.unwrapIfNeeded;var wr ap=scope.wrap;var wrapIfNeeded=scope.wrapIfNeeded;var wrappers=scope.wrappers;fu nction assertIsNodeWrapper(node){assert(node instanceof Node)}function createOne ElementNodeList(node){var nodes=new NodeList;nodes[0]=node;nodes.length=1;return nodes}var surpressMutations=false;function enqueueRemovalForInsertedNodes(node, parent,nodes){enqueueMutation(parent,"childList",{removedNodes:nodes,previousSib ling:node.previousSibling,nextSibling:node.nextSibling})}function enqueueRemoval ForInsertedDocumentFragment(df,nodes){enqueueMutation(df,"childList",{removedNod es:nodes})}function collectNodes(node,parentNode,previousNode,nextNode){if(node instanceof DocumentFragment){var nodes=collectNodesForDocumentFragment(node);sur pressMutations=true;for(var i=nodes.length-1;i>=0;i--){node.removeChild(nodes[i] );nodes[i].parentNode_=parentNode}surpressMutations=false;for(var i=0;i<nodes.le ngth;i++){nodes[i].previousSibling_=nodes[i-1]||previousNode;nodes[i].nextSiblin g_=nodes[i+1]||nextNode}if(previousNode)previousNode.nextSibling_=nodes[0];if(ne xtNode)nextNode.previousSibling_=nodes[nodes.length-1];return nodes}var nodes=cr eateOneElementNodeList(node);var oldParent=node.parentNode;if(oldParent){oldPare nt.removeChild(node)}node.parentNode_=parentNode;node.previousSibling_=previousN ode;node.nextSibling_=nextNode;if(previousNode)previousNode.nextSibling_=node;if (nextNode)nextNode.previousSibling_=node;return nodes}function collectNodesNativ e(node){if(node instanceof DocumentFragment)return collectNodesForDocumentFragme nt(node);var nodes=createOneElementNodeList(node);var oldParent=node.parentNode; if(oldParent)enqueueRemovalForInsertedNodes(node,oldParent,nodes);return nodes}f unction collectNodesForDocumentFragment(node){var nodes=new NodeList;var i=0;for (var child=node.firstChild;child;child=child.nextSibling){nodes[i++]=child}nodes .length=i;enqueueRemovalForInsertedDocumentFragment(node,nodes);return nodes}fun ction snapshotNodeList(nodeList){return nodeList}function nodeWasAdded(node,tree Scope){setTreeScope(node,treeScope);node.nodeIsInserted_()}function nodesWereAdd ed(nodes,parent){var treeScope=getTreeScope(parent);for(var i=0;i<nodes.length;i ++){nodeWasAdded(nodes[i],treeScope)}}function nodeWasRemoved(node){setTreeScope (node,new TreeScope(node,null))}function nodesWereRemoved(nodes){for(var i=0;i<n odes.length;i++){nodeWasRemoved(nodes[i])}}function ensureSameOwnerDocument(pare nt,child){var ownerDoc=parent.nodeType===Node.DOCUMENT_NODE?parent:parent.ownerD ocument;if(ownerDoc!==child.ownerDocument)ownerDoc.adoptNode(child)}function ado ptNodesIfNeeded(owner,nodes){if(!nodes.length)return;var ownerDoc=owner.ownerDoc ument;if(ownerDoc===nodes[0].ownerDocument)return;for(var i=0;i<nodes.length;i++ ){scope.adoptNodeNoRemove(nodes[i],ownerDoc)}}function unwrapNodesForInsertion(o wner,nodes){adoptNodesIfNeeded(owner,nodes);var length=nodes.length;if(length=== 1)return unwrap(nodes[0]);var df=unwrap(owner.ownerDocument.createDocumentFragme nt());for(var i=0;i<length;i++){df.appendChild(unwrap(nodes[i]))}return df}funct ion clearChildNodes(wrapper){if(wrapper.firstChild_!==undefined){var child=wrapp er.firstChild_;while(child){var tmp=child;child=child.nextSibling_;tmp.parentNod e_=tmp.previousSibling_=tmp.nextSibling_=undefined}}wrapper.firstChild_=wrapper. lastChild_=undefined}function removeAllChildNodes(wrapper){if(wrapper.invalidate ShadowRenderer()){var childWrapper=wrapper.firstChild;while(childWrapper){assert (childWrapper.parentNode===wrapper);var nextSibling=childWrapper.nextSibling;var childNode=unwrap(childWrapper);var parentNode=childNode.parentNode;if(parentNod e)originalRemoveChild.call(parentNode,childNode);childWrapper.previousSibling_=c hildWrapper.nextSibling_=childWrapper.parentNode_=null;childWrapper=nextSibling} wrapper.firstChild_=wrapper.lastChild_=null}else{var node=unwrap(wrapper);var ch ild=node.firstChild;var nextSibling;while(child){nextSibling=child.nextSibling;o riginalRemoveChild.call(node,child);child=nextSibling}}}function invalidateParen t(node){var p=node.parentNode;return p&&p.invalidateShadowRenderer()}function cl eanupNodes(nodes){for(var i=0,n;i<nodes.length;i++){n=nodes[i];n.parentNode.remo veChild(n)}}var originalImportNode=document.importNode;var originalCloneNode=win dow.Node.prototype.cloneNode;function cloneNode(node,deep,opt_doc){var clone;if( opt_doc)clone=wrap(originalImportNode.call(opt_doc,unsafeUnwrap(node),false));el se clone=wrap(originalCloneNode.call(unsafeUnwrap(node),false));if(deep){for(var child=node.firstChild;child;child=child.nextSibling){clone.appendChild(cloneNod e(child,true,opt_doc))}if(node instanceof wrappers.HTMLTemplateElement){var clon eContent=clone.content;for(var child=node.content.firstChild;child;child=child.n extSibling){cloneContent.appendChild(cloneNode(child,true,opt_doc))}}}return clo ne}function contains(self,child){if(!child||getTreeScope(self)!==getTreeScope(ch ild))return false;for(var node=child;node;node=node.parentNode){if(node===self)r eturn true}return false}var OriginalNode=window.Node;function Node(original){ass ert(original instanceof OriginalNode);EventTarget.call(this,original);this.paren tNode_=undefined;this.firstChild_=undefined;this.lastChild_=undefined;this.nextS ibling_=undefined;this.previousSibling_=undefined;this.treeScope_=undefined}var OriginalDocumentFragment=window.DocumentFragment;var originalAppendChild=Origina lNode.prototype.appendChild;var originalCompareDocumentPosition=OriginalNode.pro totype.compareDocumentPosition;var originalInsertBefore=OriginalNode.prototype.i nsertBefore;var originalRemoveChild=OriginalNode.prototype.removeChild;var origi nalReplaceChild=OriginalNode.prototype.replaceChild;var isIe=/Trident/.test(navi gator.userAgent);var removeChildOriginalHelper=isIe?function(parent,child){try{o riginalRemoveChild.call(parent,child)}catch(ex){if(!(parent instanceof OriginalD ocumentFragment))throw ex}}:function(parent,child){originalRemoveChild.call(pare nt,child)};Node.prototype=Object.create(EventTarget.prototype);mixin(Node.protot ype,{appendChild:function(childWrapper){return this.insertBefore(childWrapper,nu ll)},insertBefore:function(childWrapper,refWrapper){assertIsNodeWrapper(childWra pper);var refNode;if(refWrapper){if(isWrapper(refWrapper)){refNode=unwrap(refWra pper)}else{refNode=refWrapper;refWrapper=wrap(refNode)}}else{refWrapper=null;ref Node=null}refWrapper&&assert(refWrapper.parentNode===this);var nodes;var previou sNode=refWrapper?refWrapper.previousSibling:this.lastChild;var useNative=!this.i nvalidateShadowRenderer()&&!invalidateParent(childWrapper);if(useNative)nodes=co llectNodesNative(childWrapper);else nodes=collectNodes(childWrapper,this,previou sNode,refWrapper);if(useNative){ensureSameOwnerDocument(this,childWrapper);clear ChildNodes(this);originalInsertBefore.call(unsafeUnwrap(this),unwrap(childWrappe r),refNode)}else{if(!previousNode)this.firstChild_=nodes[0];if(!refWrapper){this .lastChild_=nodes[nodes.length-1];if(this.firstChild_===undefined)this.firstChil d_=this.firstChild}var parentNode=refNode?refNode.parentNode:unsafeUnwrap(this); if(parentNode){originalInsertBefore.call(parentNode,unwrapNodesForInsertion(this ,nodes),refNode)}else{adoptNodesIfNeeded(this,nodes)}}enqueueMutation(this,"chil dList",{addedNodes:nodes,nextSibling:refWrapper,previousSibling:previousNode});n odesWereAdded(nodes,this);return childWrapper},removeChild:function(childWrapper ){assertIsNodeWrapper(childWrapper);if(childWrapper.parentNode!==this){var found =false;var childNodes=this.childNodes;for(var ieChild=this.firstChild;ieChild;ie Child=ieChild.nextSibling){if(ieChild===childWrapper){found=true;break}}if(!foun d){throw new Error("NotFoundError")}}var childNode=unwrap(childWrapper);var chil dWrapperNextSibling=childWrapper.nextSibling;var childWrapperPreviousSibling=chi ldWrapper.previousSibling;if(this.invalidateShadowRenderer()){var thisFirstChild =this.firstChild;var thisLastChild=this.lastChild;var parentNode=childNode.paren tNode;if(parentNode)removeChildOriginalHelper(parentNode,childNode);if(thisFirst Child===childWrapper)this.firstChild_=childWrapperNextSibling;if(thisLastChild== =childWrapper)this.lastChild_=childWrapperPreviousSibling;if(childWrapperPreviou sSibling)childWrapperPreviousSibling.nextSibling_=childWrapperNextSibling;if(chi ldWrapperNextSibling){childWrapperNextSibling.previousSibling_=childWrapperPrevi ousSibling}childWrapper.previousSibling_=childWrapper.nextSibling_=childWrapper. parentNode_=undefined}else{clearChildNodes(this);removeChildOriginalHelper(unsaf eUnwrap(this),childNode)}if(!surpressMutations){enqueueMutation(this,"childList" ,{removedNodes:createOneElementNodeList(childWrapper),nextSibling:childWrapperNe xtSibling,previousSibling:childWrapperPreviousSibling})}registerTransientObserve rs(this,childWrapper);return childWrapper},replaceChild:function(newChildWrapper ,oldChildWrapper){assertIsNodeWrapper(newChildWrapper);var oldChildNode;if(isWra pper(oldChildWrapper)){oldChildNode=unwrap(oldChildWrapper)}else{oldChildNode=ol dChildWrapper;oldChildWrapper=wrap(oldChildNode)}if(oldChildWrapper.parentNode!= =this){throw new Error("NotFoundError")}var nextNode=oldChildWrapper.nextSibling ;var previousNode=oldChildWrapper.previousSibling;var nodes;var useNative=!this. invalidateShadowRenderer()&&!invalidateParent(newChildWrapper);if(useNative){nod es=collectNodesNative(newChildWrapper)}else{if(nextNode===newChildWrapper)nextNo de=newChildWrapper.nextSibling;nodes=collectNodes(newChildWrapper,this,previousN ode,nextNode)}if(!useNative){if(this.firstChild===oldChildWrapper)this.firstChil d_=nodes[0];if(this.lastChild===oldChildWrapper)this.lastChild_=nodes[nodes.leng th-1];oldChildWrapper.previousSibling_=oldChildWrapper.nextSibling_=oldChildWrap per.parentNode_=undefined;if(oldChildNode.parentNode){originalReplaceChild.call( oldChildNode.parentNode,unwrapNodesForInsertion(this,nodes),oldChildNode)}}else{ ensureSameOwnerDocument(this,newChildWrapper);clearChildNodes(this);originalRepl aceChild.call(unsafeUnwrap(this),unwrap(newChildWrapper),oldChildNode)}enqueueMu tation(this,"childList",{addedNodes:nodes,removedNodes:createOneElementNodeList( oldChildWrapper),nextSibling:nextNode,previousSibling:previousNode});nodeWasRemo ved(oldChildWrapper);nodesWereAdded(nodes,this);return oldChildWrapper},nodeIsIn serted_:function(){for(var child=this.firstChild;child;child=child.nextSibling){ child.nodeIsInserted_()}},hasChildNodes:function(){return this.firstChild!==null },get parentNode(){return this.parentNode_!==undefined?this.parentNode_:wrap(uns afeUnwrap(this).parentNode)},get firstChild(){return this.firstChild_!==undefine d?this.firstChild_:wrap(unsafeUnwrap(this).firstChild)},get lastChild(){return t his.lastChild_!==undefined?this.lastChild_:wrap(unsafeUnwrap(this).lastChild)},g et nextSibling(){return this.nextSibling_!==undefined?this.nextSibling_:wrap(uns afeUnwrap(this).nextSibling)},get previousSibling(){return this.previousSibling_ !==undefined?this.previousSibling_:wrap(unsafeUnwrap(this).previousSibling)},get parentElement(){var p=this.parentNode;while(p&&p.nodeType!==Node.ELEMENT_NODE){ p=p.parentNode}return p},get textContent(){var s="";for(var child=this.firstChil d;child;child=child.nextSibling){if(child.nodeType!=Node.COMMENT_NODE){s+=child. textContent}}return s},set textContent(textContent){if(textContent==null)textCon tent="";var removedNodes=snapshotNodeList(this.childNodes);if(this.invalidateSha dowRenderer()){removeAllChildNodes(this);if(textContent!==""){var textNode=unsaf eUnwrap(this).ownerDocument.createTextNode(textContent);this.appendChild(textNod e)}}else{clearChildNodes(this);unsafeUnwrap(this).textContent=textContent}var ad dedNodes=snapshotNodeList(this.childNodes);enqueueMutation(this,"childList",{add edNodes:addedNodes,removedNodes:removedNodes});nodesWereRemoved(removedNodes);no desWereAdded(addedNodes,this)},get childNodes(){var wrapperList=new NodeList;var i=0;for(var child=this.firstChild;child;child=child.nextSibling){wrapperList[i+ +]=child}wrapperList.length=i;return wrapperList},cloneNode:function(deep){retur n cloneNode(this,deep)},contains:function(child){return contains(this,wrapIfNeed ed(child))},compareDocumentPosition:function(otherNode){return originalCompareDo cumentPosition.call(unsafeUnwrap(this),unwrapIfNeeded(otherNode))},normalize:fun ction(){var nodes=snapshotNodeList(this.childNodes);var remNodes=[];var s="";var modNode;for(var i=0,n;i<nodes.length;i++){n=nodes[i];if(n.nodeType===Node.TEXT_ NODE){if(!modNode&&!n.data.length)this.removeNode(n);else if(!modNode)modNode=n; else{s+=n.data;remNodes.push(n)}}else{if(modNode&&remNodes.length){modNode.data+ =s;cleanupNodes(remNodes)}remNodes=[];s="";modNode=null;if(n.childNodes.length)n .normalize()}}if(modNode&&remNodes.length){modNode.data+=s;cleanupNodes(remNodes )}}});defineWrapGetter(Node,"ownerDocument");registerWrapper(OriginalNode,Node,d ocument.createDocumentFragment());delete Node.prototype.querySelector;delete Nod e.prototype.querySelectorAll;Node.prototype=mixin(Object.create(EventTarget.prot otype),Node.prototype);scope.cloneNode=cloneNode;scope.nodeWasAdded=nodeWasAdded ;scope.nodeWasRemoved=nodeWasRemoved;scope.nodesWereAdded=nodesWereAdded;scope.n odesWereRemoved=nodesWereRemoved;scope.originalInsertBefore=originalInsertBefore ;scope.originalRemoveChild=originalRemoveChild;scope.snapshotNodeList=snapshotNo deList;scope.wrappers.Node=Node})(window.ShadowDOMPolyfill);(function(scope){"us e strict";var HTMLCollection=scope.wrappers.HTMLCollection;var NodeList=scope.wr appers.NodeList;var getTreeScope=scope.getTreeScope;var unsafeUnwrap=scope.unsaf eUnwrap;var wrap=scope.wrap;var originalDocumentQuerySelector=document.querySele ctor;var originalElementQuerySelector=document.documentElement.querySelector;var originalDocumentQuerySelectorAll=document.querySelectorAll;var originalElementQ uerySelectorAll=document.documentElement.querySelectorAll;var originalDocumentGe tElementsByTagName=document.getElementsByTagName;var originalElementGetElementsB yTagName=document.documentElement.getElementsByTagName;var originalDocumentGetEl ementsByTagNameNS=document.getElementsByTagNameNS;var originalElementGetElements ByTagNameNS=document.documentElement.getElementsByTagNameNS;var OriginalElement= window.Element;var OriginalDocument=window.HTMLDocument||window.Document;functio n filterNodeList(list,index,result,deep){var wrappedItem=null;var root=null;for( var i=0,length=list.length;i<length;i++){wrappedItem=wrap(list[i]);if(!deep&&(ro ot=getTreeScope(wrappedItem).root)){if(root instanceof scope.wrappers.ShadowRoot ){continue}}result[index++]=wrappedItem}return index}function shimSelector(selec tor){return String(selector).replace(/\/deep\//g," ")}function findOne(node,sele ctor){var m,el=node.firstElementChild;while(el){if(el.matches(selector))return e l;m=findOne(el,selector);if(m)return m;el=el.nextElementSibling}return null}func tion matchesSelector(el,selector){return el.matches(selector)}var XHTML_NS="http ://www.w3.org/1999/xhtml";function matchesTagName(el,localName,localNameLowerCas e){var ln=el.localName;return ln===localName||ln===localNameLowerCase&&el.namesp aceURI===XHTML_NS}function matchesEveryThing(){return true}function matchesLocal NameOnly(el,ns,localName){return el.localName===localName}function matchesNameSp ace(el,ns){return el.namespaceURI===ns}function matchesLocalNameNS(el,ns,localNa me){return el.namespaceURI===ns&&el.localName===localName}function findElements( node,index,result,p,arg0,arg1){var el=node.firstElementChild;while(el){if(p(el,a rg0,arg1))result[index++]=el;index=findElements(el,index,result,p,arg0,arg1);el= el.nextElementSibling}return index}function querySelectorAllFiltered(p,index,res ult,selector,deep){var target=unsafeUnwrap(this);var list;var root=getTreeScope( this).root;if(root instanceof scope.wrappers.ShadowRoot){return findElements(thi s,index,result,p,selector,null)}else if(target instanceof OriginalElement){list= originalElementQuerySelectorAll.call(target,selector)}else if(target instanceof OriginalDocument){list=originalDocumentQuerySelectorAll.call(target,selector)}el se{return findElements(this,index,result,p,selector,null)}return filterNodeList( list,index,result,deep)}var SelectorsInterface={querySelector:function(selector) {var shimmed=shimSelector(selector);var deep=shimmed!==selector;selector=shimmed ;var target=unsafeUnwrap(this);var wrappedItem;var root=getTreeScope(this).root; if(root instanceof scope.wrappers.ShadowRoot){return findOne(this,selector)}else if(target instanceof OriginalElement){wrappedItem=wrap(originalElementQuerySele ctor.call(target,selector))}else if(target instanceof OriginalDocument){wrappedI tem=wrap(originalDocumentQuerySelector.call(target,selector))}else{return findOn e(this,selector)}if(!wrappedItem){return wrappedItem}else if(!deep&&(root=getTre eScope(wrappedItem).root)){if(root instanceof scope.wrappers.ShadowRoot){return findOne(this,selector)}}return wrappedItem},querySelectorAll:function(selector){ var shimmed=shimSelector(selector);var deep=shimmed!==selector;selector=shimmed; var result=new NodeList;result.length=querySelectorAllFiltered.call(this,matches Selector,0,result,selector,deep);return result}};function getElementsByTagNameFi ltered(p,index,result,localName,lowercase){var target=unsafeUnwrap(this);var lis t;var root=getTreeScope(this).root;if(root instanceof scope.wrappers.ShadowRoot) {return findElements(this,index,result,p,localName,lowercase)}else if(target ins tanceof OriginalElement){list=originalElementGetElementsByTagName.call(target,lo calName,lowercase)}else if(target instanceof OriginalDocument){list=originalDocu mentGetElementsByTagName.call(target,localName,lowercase)}else{return findElemen ts(this,index,result,p,localName,lowercase)}return filterNodeList(list,index,res ult,false)}function getElementsByTagNameNSFiltered(p,index,result,ns,localName){ var target=unsafeUnwrap(this);var list;var root=getTreeScope(this).root;if(root instanceof scope.wrappers.ShadowRoot){return findElements(this,index,result,p,ns ,localName)}else if(target instanceof OriginalElement){list=originalElementGetEl ementsByTagNameNS.call(target,ns,localName)}else if(target instanceof OriginalDo cument){list=originalDocumentGetElementsByTagNameNS.call(target,ns,localName)}el se{return findElements(this,index,result,p,ns,localName)}return filterNodeList(l ist,index,result,false)}var GetElementsByInterface={getElementsByTagName:functio n(localName){var result=new HTMLCollection;var match=localName==="*"?matchesEver yThing:matchesTagName;result.length=getElementsByTagNameFiltered.call(this,match ,0,result,localName,localName.toLowerCase());return result},getElementsByClassNa me:function(className){return this.querySelectorAll("."+className)},getElementsB yTagNameNS:function(ns,localName){var result=new HTMLCollection;var match=null;i f(ns==="*"){match=localName==="*"?matchesEveryThing:matchesLocalNameOnly}else{ma tch=localName==="*"?matchesNameSpace:matchesLocalNameNS}result.length=getElement sByTagNameNSFiltered.call(this,match,0,result,ns||null,localName);return result} };scope.GetElementsByInterface=GetElementsByInterface;scope.SelectorsInterface=S electorsInterface})(window.ShadowDOMPolyfill);(function(scope){"use strict";var NodeList=scope.wrappers.NodeList;function forwardElement(node){while(node&&node. nodeType!==Node.ELEMENT_NODE){node=node.nextSibling}return node}function backwar dsElement(node){while(node&&node.nodeType!==Node.ELEMENT_NODE){node=node.previou sSibling}return node}var ParentNodeInterface={get firstElementChild(){return for wardElement(this.firstChild)},get lastElementChild(){return backwardsElement(thi s.lastChild)},get childElementCount(){var count=0;for(var child=this.firstElemen tChild;child;child=child.nextElementSibling){count++}return count},get children( ){var wrapperList=new NodeList;var i=0;for(var child=this.firstElementChild;chil d;child=child.nextElementSibling){wrapperList[i++]=child}wrapperList.length=i;re turn wrapperList},remove:function(){var p=this.parentNode;if(p)p.removeChild(thi s)}};var ChildNodeInterface={get nextElementSibling(){return forwardElement(this .nextSibling)},get previousElementSibling(){return backwardsElement(this.previou sSibling)}};scope.ChildNodeInterface=ChildNodeInterface;scope.ParentNodeInterfac e=ParentNodeInterface})(window.ShadowDOMPolyfill);(function(scope){"use strict"; var ChildNodeInterface=scope.ChildNodeInterface;var Node=scope.wrappers.Node;var enqueueMutation=scope.enqueueMutation;var mixin=scope.mixin;var registerWrapper =scope.registerWrapper;var unsafeUnwrap=scope.unsafeUnwrap;var OriginalCharacter Data=window.CharacterData;function CharacterData(node){Node.call(this,node)}Char acterData.prototype=Object.create(Node.prototype);mixin(CharacterData.prototype, {get textContent(){return this.data},set textContent(value){this.data=value},get data(){return unsafeUnwrap(this).data},set data(value){var oldValue=unsafeUnwra p(this).data;enqueueMutation(this,"characterData",{oldValue:oldValue});unsafeUnw rap(this).data=value}});mixin(CharacterData.prototype,ChildNodeInterface);regist erWrapper(OriginalCharacterData,CharacterData,document.createTextNode(""));scope .wrappers.CharacterData=CharacterData})(window.ShadowDOMPolyfill);(function(scop e){"use strict";var CharacterData=scope.wrappers.CharacterData;var enqueueMutati on=scope.enqueueMutation;var mixin=scope.mixin;var registerWrapper=scope.registe rWrapper;function toUInt32(x){return x>>>0}var OriginalText=window.Text;function Text(node){CharacterData.call(this,node)}Text.prototype=Object.create(Character Data.prototype);mixin(Text.prototype,{splitText:function(offset){offset=toUInt32 (offset);var s=this.data;if(offset>s.length)throw new Error("IndexSizeError");va r head=s.slice(0,offset);var tail=s.slice(offset);this.data=head;var newTextNode =this.ownerDocument.createTextNode(tail);if(this.parentNode)this.parentNode.inse rtBefore(newTextNode,this.nextSibling);return newTextNode}});registerWrapper(Ori ginalText,Text,document.createTextNode(""));scope.wrappers.Text=Text})(window.Sh adowDOMPolyfill);(function(scope){"use strict";var setWrapper=scope.setWrapper;v ar unsafeUnwrap=scope.unsafeUnwrap;function invalidateClass(el){scope.invalidate RendererBasedOnAttribute(el,"class")}function DOMTokenList(impl,ownerElement){se tWrapper(impl,this);this.ownerElement_=ownerElement}DOMTokenList.prototype={cons tructor:DOMTokenList,get length(){return unsafeUnwrap(this).length},item:functio n(index){return unsafeUnwrap(this).item(index)},contains:function(token){return unsafeUnwrap(this).contains(token)},add:function(){unsafeUnwrap(this).add.apply( unsafeUnwrap(this),arguments);invalidateClass(this.ownerElement_)},remove:functi on(){unsafeUnwrap(this).remove.apply(unsafeUnwrap(this),arguments);
11 invalidateClass(this.ownerElement_)},toggle:function(token){var rv=unsafeUnwrap( this).toggle.apply(unsafeUnwrap(this),arguments);invalidateClass(this.ownerEleme nt_);return rv},toString:function(){return unsafeUnwrap(this).toString()}};scope .wrappers.DOMTokenList=DOMTokenList})(window.ShadowDOMPolyfill);(function(scope) {"use strict";var ChildNodeInterface=scope.ChildNodeInterface;var GetElementsByI nterface=scope.GetElementsByInterface;var Node=scope.wrappers.Node;var DOMTokenL ist=scope.wrappers.DOMTokenList;var ParentNodeInterface=scope.ParentNodeInterfac e;var SelectorsInterface=scope.SelectorsInterface;var addWrapNodeListMethod=scop e.addWrapNodeListMethod;var enqueueMutation=scope.enqueueMutation;var mixin=scop e.mixin;var oneOf=scope.oneOf;var registerWrapper=scope.registerWrapper;var unsa feUnwrap=scope.unsafeUnwrap;var wrappers=scope.wrappers;var OriginalElement=wind ow.Element;var matchesNames=["matches","mozMatchesSelector","msMatchesSelector", "webkitMatchesSelector"].filter(function(name){return OriginalElement.prototype[ name]});var matchesName=matchesNames[0];var originalMatches=OriginalElement.prot otype[matchesName];function invalidateRendererBasedOnAttribute(element,name){var p=element.parentNode;if(!p||!p.shadowRoot)return;var renderer=scope.getRenderer ForHost(p);if(renderer.dependsOnAttribute(name))renderer.invalidate()}function e nqueAttributeChange(element,name,oldValue){enqueueMutation(element,"attributes", {name:name,namespace:null,oldValue:oldValue})}var classListTable=new WeakMap;fun ction Element(node){Node.call(this,node)}Element.prototype=Object.create(Node.pr ototype);mixin(Element.prototype,{createShadowRoot:function(){var newShadowRoot= new wrappers.ShadowRoot(this);unsafeUnwrap(this).polymerShadowRoot_=newShadowRoo t;var renderer=scope.getRendererForHost(this);renderer.invalidate();return newSh adowRoot},get shadowRoot(){return unsafeUnwrap(this).polymerShadowRoot_||null},s etAttribute:function(name,value){var oldValue=unsafeUnwrap(this).getAttribute(na me);unsafeUnwrap(this).setAttribute(name,value);enqueAttributeChange(this,name,o ldValue);invalidateRendererBasedOnAttribute(this,name)},removeAttribute:function (name){var oldValue=unsafeUnwrap(this).getAttribute(name);unsafeUnwrap(this).rem oveAttribute(name);enqueAttributeChange(this,name,oldValue);invalidateRendererBa sedOnAttribute(this,name)},matches:function(selector){return originalMatches.cal l(unsafeUnwrap(this),selector)},get classList(){var list=classListTable.get(this );if(!list){classListTable.set(this,list=new DOMTokenList(unsafeUnwrap(this).cla ssList,this))}return list},get className(){return unsafeUnwrap(this).className}, set className(v){this.setAttribute("class",v)},get id(){return unsafeUnwrap(this ).id},set id(v){this.setAttribute("id",v)}});matchesNames.forEach(function(name) {if(name!=="matches"){Element.prototype[name]=function(selector){return this.mat ches(selector)}}});if(OriginalElement.prototype.webkitCreateShadowRoot){Element. prototype.webkitCreateShadowRoot=Element.prototype.createShadowRoot}mixin(Elemen t.prototype,ChildNodeInterface);mixin(Element.prototype,GetElementsByInterface); mixin(Element.prototype,ParentNodeInterface);mixin(Element.prototype,SelectorsIn terface);registerWrapper(OriginalElement,Element,document.createElementNS(null," x"));scope.invalidateRendererBasedOnAttribute=invalidateRendererBasedOnAttribute ;scope.matchesNames=matchesNames;scope.wrappers.Element=Element})(window.ShadowD OMPolyfill);(function(scope){"use strict";var Element=scope.wrappers.Element;var defineGetter=scope.defineGetter;var enqueueMutation=scope.enqueueMutation;var m ixin=scope.mixin;var nodesWereAdded=scope.nodesWereAdded;var nodesWereRemoved=sc ope.nodesWereRemoved;var registerWrapper=scope.registerWrapper;var snapshotNodeL ist=scope.snapshotNodeList;var unsafeUnwrap=scope.unsafeUnwrap;var unwrap=scope. unwrap;var wrap=scope.wrap;var wrappers=scope.wrappers;var escapeAttrRegExp=/[&\ u00A0"]/g;var escapeDataRegExp=/[&\u00A0<>]/g;function escapeReplace(c){switch(c ){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return "&quot;";case" ":return"&nbsp;"}}function escapeAttr(s){return s.replace(escapeA ttrRegExp,escapeReplace)}function escapeData(s){return s.replace(escapeDataRegEx p,escapeReplace)}function makeSet(arr){var set={};for(var i=0;i<arr.length;i++){ set[arr[i]]=true}return set}var voidElements=makeSet(["area","base","br","col"," command","embed","hr","img","input","keygen","link","meta","param","source","tra ck","wbr"]);var plaintextParents=makeSet(["style","script","xmp","iframe","noemb ed","noframes","plaintext","noscript"]);function getOuterHTML(node,parentNode){s witch(node.nodeType){case Node.ELEMENT_NODE:var tagName=node.tagName.toLowerCase ();var s="<"+tagName;var attrs=node.attributes;for(var i=0,attr;attr=attrs[i];i+ +){s+=" "+attr.name+'="'+escapeAttr(attr.value)+'"'}s+=">";if(voidElements[tagNa me])return s;return s+getInnerHTML(node)+"</"+tagName+">";case Node.TEXT_NODE:va r data=node.data;if(parentNode&&plaintextParents[parentNode.localName])return da ta;return escapeData(data);case Node.COMMENT_NODE:return"<!--"+node.data+"-->";d efault:console.error(node);throw new Error("not implemented")}}function getInner HTML(node){if(node instanceof wrappers.HTMLTemplateElement)node=node.content;var s="";for(var child=node.firstChild;child;child=child.nextSibling){s+=getOuterHT ML(child,node)}return s}function setInnerHTML(node,value,opt_tagName){var tagNam e=opt_tagName||"div";node.textContent="";var tempElement=unwrap(node.ownerDocume nt.createElement(tagName));tempElement.innerHTML=value;var firstChild;while(firs tChild=tempElement.firstChild){node.appendChild(wrap(firstChild))}}var oldIe=/MS IE/.test(navigator.userAgent);var OriginalHTMLElement=window.HTMLElement;var Ori ginalHTMLTemplateElement=window.HTMLTemplateElement;function HTMLElement(node){E lement.call(this,node)}HTMLElement.prototype=Object.create(Element.prototype);mi xin(HTMLElement.prototype,{get innerHTML(){return getInnerHTML(this)},set innerH TML(value){if(oldIe&&plaintextParents[this.localName]){this.textContent=value;re turn}var removedNodes=snapshotNodeList(this.childNodes);if(this.invalidateShadow Renderer()){if(this instanceof wrappers.HTMLTemplateElement)setInnerHTML(this.co ntent,value);else setInnerHTML(this,value,this.tagName)}else if(!OriginalHTMLTem plateElement&&this instanceof wrappers.HTMLTemplateElement){setInnerHTML(this.co ntent,value)}else{unsafeUnwrap(this).innerHTML=value}var addedNodes=snapshotNode List(this.childNodes);enqueueMutation(this,"childList",{addedNodes:addedNodes,re movedNodes:removedNodes});nodesWereRemoved(removedNodes);nodesWereAdded(addedNod es,this)},get outerHTML(){return getOuterHTML(this,this.parentNode)},set outerHT ML(value){var p=this.parentNode;if(p){p.invalidateShadowRenderer();var df=frag(p ,value);p.replaceChild(df,this)}},insertAdjacentHTML:function(position,text){var contextElement,refNode;switch(String(position).toLowerCase()){case"beforebegin" :contextElement=this.parentNode;refNode=this;break;case"afterend":contextElement =this.parentNode;refNode=this.nextSibling;break;case"afterbegin":contextElement= this;refNode=this.firstChild;break;case"beforeend":contextElement=this;refNode=n ull;break;default:return}var df=frag(contextElement,text);contextElement.insertB efore(df,refNode)},get hidden(){return this.hasAttribute("hidden")},set hidden(v ){if(v){this.setAttribute("hidden","")}else{this.removeAttribute("hidden")}}});f unction frag(contextElement,html){var p=unwrap(contextElement.cloneNode(false)); p.innerHTML=html;var df=unwrap(document.createDocumentFragment());var c;while(c= p.firstChild){df.appendChild(c)}return wrap(df)}function getter(name){return fun ction(){scope.renderAllPending();return unsafeUnwrap(this)[name]}}function gette rRequiresRendering(name){defineGetter(HTMLElement,name,getter(name))}["clientHei ght","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetT op","offsetWidth","scrollHeight","scrollWidth"].forEach(getterRequiresRendering) ;function getterAndSetterRequiresRendering(name){Object.defineProperty(HTMLEleme nt.prototype,name,{get:getter(name),set:function(v){scope.renderAllPending();uns afeUnwrap(this)[name]=v},configurable:true,enumerable:true})}["scrollLeft","scro llTop"].forEach(getterAndSetterRequiresRendering);function methodRequiresRenderi ng(name){Object.defineProperty(HTMLElement.prototype,name,{value:function(){scop e.renderAllPending();return unsafeUnwrap(this)[name].apply(unsafeUnwrap(this),ar guments)},configurable:true,enumerable:true})}["getBoundingClientRect","getClien tRects","scrollIntoView"].forEach(methodRequiresRendering);registerWrapper(Origi nalHTMLElement,HTMLElement,document.createElement("b"));scope.wrappers.HTMLEleme nt=HTMLElement;scope.getInnerHTML=getInnerHTML;scope.setInnerHTML=setInnerHTML}) (window.ShadowDOMPolyfill);(function(scope){"use strict";var HTMLElement=scope.w rappers.HTMLElement;var mixin=scope.mixin;var registerWrapper=scope.registerWrap per;var unsafeUnwrap=scope.unsafeUnwrap;var wrap=scope.wrap;var OriginalHTMLCanv asElement=window.HTMLCanvasElement;function HTMLCanvasElement(node){HTMLElement. call(this,node)}HTMLCanvasElement.prototype=Object.create(HTMLElement.prototype) ;mixin(HTMLCanvasElement.prototype,{getContext:function(){var context=unsafeUnwr ap(this).getContext.apply(unsafeUnwrap(this),arguments);return context&&wrap(con text)}});registerWrapper(OriginalHTMLCanvasElement,HTMLCanvasElement,document.cr eateElement("canvas"));scope.wrappers.HTMLCanvasElement=HTMLCanvasElement})(wind ow.ShadowDOMPolyfill);(function(scope){"use strict";var HTMLElement=scope.wrappe rs.HTMLElement;var mixin=scope.mixin;var registerWrapper=scope.registerWrapper;v ar OriginalHTMLContentElement=window.HTMLContentElement;function HTMLContentElem ent(node){HTMLElement.call(this,node)}HTMLContentElement.prototype=Object.create (HTMLElement.prototype);mixin(HTMLContentElement.prototype,{constructor:HTMLCont entElement,get select(){return this.getAttribute("select")},set select(value){th is.setAttribute("select",value)},setAttribute:function(n,v){HTMLElement.prototyp e.setAttribute.call(this,n,v);if(String(n).toLowerCase()==="select")this.invalid ateShadowRenderer(true)}});if(OriginalHTMLContentElement)registerWrapper(Origina lHTMLContentElement,HTMLContentElement);scope.wrappers.HTMLContentElement=HTMLCo ntentElement})(window.ShadowDOMPolyfill);(function(scope){"use strict";var HTMLE lement=scope.wrappers.HTMLElement;var mixin=scope.mixin;var registerWrapper=scop e.registerWrapper;var wrapHTMLCollection=scope.wrapHTMLCollection;var unwrap=sco pe.unwrap;var OriginalHTMLFormElement=window.HTMLFormElement;function HTMLFormEl ement(node){HTMLElement.call(this,node)}HTMLFormElement.prototype=Object.create( HTMLElement.prototype);mixin(HTMLFormElement.prototype,{get elements(){return wr apHTMLCollection(unwrap(this).elements)}});registerWrapper(OriginalHTMLFormEleme nt,HTMLFormElement,document.createElement("form"));scope.wrappers.HTMLFormElemen t=HTMLFormElement})(window.ShadowDOMPolyfill);(function(scope){"use strict";var HTMLElement=scope.wrappers.HTMLElement;var registerWrapper=scope.registerWrapper ;var unwrap=scope.unwrap;var rewrap=scope.rewrap;var OriginalHTMLImageElement=wi ndow.HTMLImageElement;function HTMLImageElement(node){HTMLElement.call(this,node )}HTMLImageElement.prototype=Object.create(HTMLElement.prototype);registerWrappe r(OriginalHTMLImageElement,HTMLImageElement,document.createElement("img"));funct ion Image(width,height){if(!(this instanceof Image)){throw new TypeError("DOM ob ject constructor cannot be called as a function.")}var node=unwrap(document.crea teElement("img"));HTMLElement.call(this,node);rewrap(node,this);if(width!==undef ined)node.width=width;if(height!==undefined)node.height=height}Image.prototype=H TMLImageElement.prototype;scope.wrappers.HTMLImageElement=HTMLImageElement;scope .wrappers.Image=Image})(window.ShadowDOMPolyfill);(function(scope){"use strict"; var HTMLElement=scope.wrappers.HTMLElement;var mixin=scope.mixin;var NodeList=sc ope.wrappers.NodeList;var registerWrapper=scope.registerWrapper;var OriginalHTML ShadowElement=window.HTMLShadowElement;function HTMLShadowElement(node){HTMLElem ent.call(this,node)}HTMLShadowElement.prototype=Object.create(HTMLElement.protot ype);HTMLShadowElement.prototype.constructor=HTMLShadowElement;if(OriginalHTMLSh adowElement)registerWrapper(OriginalHTMLShadowElement,HTMLShadowElement);scope.w rappers.HTMLShadowElement=HTMLShadowElement})(window.ShadowDOMPolyfill);(functio n(scope){"use strict";var HTMLElement=scope.wrappers.HTMLElement;var mixin=scope .mixin;var registerWrapper=scope.registerWrapper;var unsafeUnwrap=scope.unsafeUn wrap;var unwrap=scope.unwrap;var wrap=scope.wrap;var contentTable=new WeakMap;va r templateContentsOwnerTable=new WeakMap;function getTemplateContentsOwner(doc){ if(!doc.defaultView)return doc;var d=templateContentsOwnerTable.get(doc);if(!d){ d=doc.implementation.createHTMLDocument("");while(d.lastChild){d.removeChild(d.l astChild)}templateContentsOwnerTable.set(doc,d)}return d}function extractContent (templateElement){var doc=getTemplateContentsOwner(templateElement.ownerDocument );var df=unwrap(doc.createDocumentFragment());var child;while(child=templateElem ent.firstChild){df.appendChild(child)}return df}var OriginalHTMLTemplateElement= window.HTMLTemplateElement;function HTMLTemplateElement(node){HTMLElement.call(t his,node);if(!OriginalHTMLTemplateElement){var content=extractContent(node);cont entTable.set(this,wrap(content))}}HTMLTemplateElement.prototype=Object.create(HT MLElement.prototype);mixin(HTMLTemplateElement.prototype,{constructor:HTMLTempla teElement,get content(){if(OriginalHTMLTemplateElement)return wrap(unsafeUnwrap( this).content);return contentTable.get(this)}});if(OriginalHTMLTemplateElement)r egisterWrapper(OriginalHTMLTemplateElement,HTMLTemplateElement);scope.wrappers.H TMLTemplateElement=HTMLTemplateElement})(window.ShadowDOMPolyfill);(function(sco pe){"use strict";var HTMLElement=scope.wrappers.HTMLElement;var registerWrapper= scope.registerWrapper;var OriginalHTMLMediaElement=window.HTMLMediaElement;if(!O riginalHTMLMediaElement)return;function HTMLMediaElement(node){HTMLElement.call( this,node)}HTMLMediaElement.prototype=Object.create(HTMLElement.prototype);regis terWrapper(OriginalHTMLMediaElement,HTMLMediaElement,document.createElement("aud io"));scope.wrappers.HTMLMediaElement=HTMLMediaElement})(window.ShadowDOMPolyfil l);(function(scope){"use strict";var HTMLMediaElement=scope.wrappers.HTMLMediaEl ement;var registerWrapper=scope.registerWrapper;var unwrap=scope.unwrap;var rewr ap=scope.rewrap;var OriginalHTMLAudioElement=window.HTMLAudioElement;if(!Origina lHTMLAudioElement)return;function HTMLAudioElement(node){HTMLMediaElement.call(t his,node)}HTMLAudioElement.prototype=Object.create(HTMLMediaElement.prototype);r egisterWrapper(OriginalHTMLAudioElement,HTMLAudioElement,document.createElement( "audio"));function Audio(src){if(!(this instanceof Audio)){throw new TypeError(" DOM object constructor cannot be called as a function.")}var node=unwrap(documen t.createElement("audio"));HTMLMediaElement.call(this,node);rewrap(node,this);nod e.setAttribute("preload","auto");if(src!==undefined)node.setAttribute("src",src) }Audio.prototype=HTMLAudioElement.prototype;scope.wrappers.HTMLAudioElement=HTML AudioElement;scope.wrappers.Audio=Audio})(window.ShadowDOMPolyfill);(function(sc ope){"use strict";var HTMLElement=scope.wrappers.HTMLElement;var mixin=scope.mix in;var registerWrapper=scope.registerWrapper;var rewrap=scope.rewrap;var unwrap= scope.unwrap;var wrap=scope.wrap;var OriginalHTMLOptionElement=window.HTMLOption Element;function trimText(s){return s.replace(/\s+/g," ").trim()}function HTMLOp tionElement(node){HTMLElement.call(this,node)}HTMLOptionElement.prototype=Object .create(HTMLElement.prototype);mixin(HTMLOptionElement.prototype,{get text(){ret urn trimText(this.textContent)},set text(value){this.textContent=trimText(String (value))},get form(){return wrap(unwrap(this).form)}});registerWrapper(OriginalH TMLOptionElement,HTMLOptionElement,document.createElement("option"));function Op tion(text,value,defaultSelected,selected){if(!(this instanceof Option)){throw ne w TypeError("DOM object constructor cannot be called as a function.")}var node=u nwrap(document.createElement("option"));HTMLElement.call(this,node);rewrap(node, this);if(text!==undefined)node.text=text;if(value!==undefined)node.setAttribute( "value",value);if(defaultSelected===true)node.setAttribute("selected","");node.s elected=selected===true}Option.prototype=HTMLOptionElement.prototype;scope.wrapp ers.HTMLOptionElement=HTMLOptionElement;scope.wrappers.Option=Option})(window.Sh adowDOMPolyfill);(function(scope){"use strict";var HTMLElement=scope.wrappers.HT MLElement;var mixin=scope.mixin;var registerWrapper=scope.registerWrapper;var un wrap=scope.unwrap;var wrap=scope.wrap;var OriginalHTMLSelectElement=window.HTMLS electElement;function HTMLSelectElement(node){HTMLElement.call(this,node)}HTMLSe lectElement.prototype=Object.create(HTMLElement.prototype);mixin(HTMLSelectEleme nt.prototype,{add:function(element,before){if(typeof before==="object")before=un wrap(before);unwrap(this).add(unwrap(element),before)},remove:function(indexOrNo de){if(indexOrNode===undefined){HTMLElement.prototype.remove.call(this);return}i f(typeof indexOrNode==="object")indexOrNode=unwrap(indexOrNode);unwrap(this).rem ove(indexOrNode)},get form(){return wrap(unwrap(this).form)}});registerWrapper(O riginalHTMLSelectElement,HTMLSelectElement,document.createElement("select"));sco pe.wrappers.HTMLSelectElement=HTMLSelectElement})(window.ShadowDOMPolyfill);(fun ction(scope){"use strict";var HTMLElement=scope.wrappers.HTMLElement;var mixin=s cope.mixin;var registerWrapper=scope.registerWrapper;var unwrap=scope.unwrap;var wrap=scope.wrap;var wrapHTMLCollection=scope.wrapHTMLCollection;var OriginalHTM LTableElement=window.HTMLTableElement;function HTMLTableElement(node){HTMLElemen t.call(this,node)}HTMLTableElement.prototype=Object.create(HTMLElement.prototype );mixin(HTMLTableElement.prototype,{get caption(){return wrap(unwrap(this).capti on)},createCaption:function(){return wrap(unwrap(this).createCaption())},get tHe ad(){return wrap(unwrap(this).tHead)},createTHead:function(){return wrap(unwrap( this).createTHead())},createTFoot:function(){return wrap(unwrap(this).createTFoo t())},get tFoot(){return wrap(unwrap(this).tFoot)},get tBodies(){return wrapHTML Collection(unwrap(this).tBodies)},createTBody:function(){return wrap(unwrap(this ).createTBody())},get rows(){return wrapHTMLCollection(unwrap(this).rows)},inser tRow:function(index){return wrap(unwrap(this).insertRow(index))}});registerWrapp er(OriginalHTMLTableElement,HTMLTableElement,document.createElement("table"));sc ope.wrappers.HTMLTableElement=HTMLTableElement})(window.ShadowDOMPolyfill);(func tion(scope){"use strict";var HTMLElement=scope.wrappers.HTMLElement;var mixin=sc ope.mixin;var registerWrapper=scope.registerWrapper;var wrapHTMLCollection=scope .wrapHTMLCollection;var unwrap=scope.unwrap;var wrap=scope.wrap;var OriginalHTML TableSectionElement=window.HTMLTableSectionElement;function HTMLTableSectionElem ent(node){HTMLElement.call(this,node)}HTMLTableSectionElement.prototype=Object.c reate(HTMLElement.prototype);mixin(HTMLTableSectionElement.prototype,{constructo r:HTMLTableSectionElement,get rows(){return wrapHTMLCollection(unwrap(this).rows )},insertRow:function(index){return wrap(unwrap(this).insertRow(index))}});regis terWrapper(OriginalHTMLTableSectionElement,HTMLTableSectionElement,document.crea teElement("thead"));scope.wrappers.HTMLTableSectionElement=HTMLTableSectionEleme nt})(window.ShadowDOMPolyfill);(function(scope){"use strict";var HTMLElement=sco pe.wrappers.HTMLElement;var mixin=scope.mixin;var registerWrapper=scope.register Wrapper;var wrapHTMLCollection=scope.wrapHTMLCollection;var unwrap=scope.unwrap; var wrap=scope.wrap;var OriginalHTMLTableRowElement=window.HTMLTableRowElement;f unction HTMLTableRowElement(node){HTMLElement.call(this,node)}HTMLTableRowElemen t.prototype=Object.create(HTMLElement.prototype);mixin(HTMLTableRowElement.proto type,{get cells(){return wrapHTMLCollection(unwrap(this).cells)},insertCell:func tion(index){return wrap(unwrap(this).insertCell(index))}});registerWrapper(Origi nalHTMLTableRowElement,HTMLTableRowElement,document.createElement("tr"));scope.w rappers.HTMLTableRowElement=HTMLTableRowElement})(window.ShadowDOMPolyfill);(fun ction(scope){"use strict";var HTMLContentElement=scope.wrappers.HTMLContentEleme nt;var HTMLElement=scope.wrappers.HTMLElement;var HTMLShadowElement=scope.wrappe rs.HTMLShadowElement;var HTMLTemplateElement=scope.wrappers.HTMLTemplateElement; var mixin=scope.mixin;var registerWrapper=scope.registerWrapper;var OriginalHTML UnknownElement=window.HTMLUnknownElement;function HTMLUnknownElement(node){switc h(node.localName){case"content":return new HTMLContentElement(node);case"shadow" :return new HTMLShadowElement(node);case"template":return new HTMLTemplateElemen t(node)}HTMLElement.call(this,node)}HTMLUnknownElement.prototype=Object.create(H TMLElement.prototype);registerWrapper(OriginalHTMLUnknownElement,HTMLUnknownElem ent);scope.wrappers.HTMLUnknownElement=HTMLUnknownElement})(window.ShadowDOMPoly fill);(function(scope){"use strict";var Element=scope.wrappers.Element;var HTMLE lement=scope.wrappers.HTMLElement;var registerObject=scope.registerObject;var SV G_NS="http://www.w3.org/2000/svg";var svgTitleElement=document.createElementNS(S VG_NS,"title");var SVGTitleElement=registerObject(svgTitleElement);var SVGElemen t=Object.getPrototypeOf(SVGTitleElement.prototype).constructor;if(!("classList"i n svgTitleElement)){var descr=Object.getOwnPropertyDescriptor(Element.prototype, "classList");Object.defineProperty(HTMLElement.prototype,"classList",descr);dele te Element.prototype.classList}scope.wrappers.SVGElement=SVGElement})(window.Sha dowDOMPolyfill);(function(scope){"use strict";var mixin=scope.mixin;var register Wrapper=scope.registerWrapper;var unwrap=scope.unwrap;var wrap=scope.wrap;var Or iginalSVGUseElement=window.SVGUseElement;var SVG_NS="http://www.w3.org/2000/svg" ;var gWrapper=wrap(document.createElementNS(SVG_NS,"g"));var useElement=document .createElementNS(SVG_NS,"use");var SVGGElement=gWrapper.constructor;var parentIn terfacePrototype=Object.getPrototypeOf(SVGGElement.prototype);var parentInterfac e=parentInterfacePrototype.constructor;function SVGUseElement(impl){parentInterf ace.call(this,impl)}SVGUseElement.prototype=Object.create(parentInterfacePrototy pe);if("instanceRoot"in useElement){mixin(SVGUseElement.prototype,{get instanceR oot(){return wrap(unwrap(this).instanceRoot)},get animatedInstanceRoot(){return wrap(unwrap(this).animatedInstanceRoot)}})}registerWrapper(OriginalSVGUseElement ,SVGUseElement,useElement);scope.wrappers.SVGUseElement=SVGUseElement})(window.S hadowDOMPolyfill);(function(scope){"use strict";var EventTarget=scope.wrappers.E ventTarget;var mixin=scope.mixin;var registerWrapper=scope.registerWrapper;var u nsafeUnwrap=scope.unsafeUnwrap;var wrap=scope.wrap;var OriginalSVGElementInstanc e=window.SVGElementInstance;if(!OriginalSVGElementInstance)return;function SVGEl ementInstance(impl){EventTarget.call(this,impl)}SVGElementInstance.prototype=Obj ect.create(EventTarget.prototype);mixin(SVGElementInstance.prototype,{get corres pondingElement(){return wrap(unsafeUnwrap(this).correspondingElement)},get corre spondingUseElement(){return wrap(unsafeUnwrap(this).correspondingUseElement)},ge t parentNode(){return wrap(unsafeUnwrap(this).parentNode)},get childNodes(){thro w new Error("Not implemented")},get firstChild(){return wrap(unsafeUnwrap(this). firstChild)},get lastChild(){return wrap(unsafeUnwrap(this).lastChild)},get prev iousSibling(){return wrap(unsafeUnwrap(this).previousSibling)},get nextSibling() {return wrap(unsafeUnwrap(this).nextSibling)}});registerWrapper(OriginalSVGEleme ntInstance,SVGElementInstance);scope.wrappers.SVGElementInstance=SVGElementInsta nce})(window.ShadowDOMPolyfill);(function(scope){"use strict";var mixin=scope.mi xin;var registerWrapper=scope.registerWrapper;var setWrapper=scope.setWrapper;va r unsafeUnwrap=scope.unsafeUnwrap;var unwrap=scope.unwrap;var unwrapIfNeeded=sco pe.unwrapIfNeeded;var wrap=scope.wrap;var OriginalCanvasRenderingContext2D=windo w.CanvasRenderingContext2D;function CanvasRenderingContext2D(impl){setWrapper(im pl,this)}mixin(CanvasRenderingContext2D.prototype,{get canvas(){return wrap(unsa feUnwrap(this).canvas)},drawImage:function(){arguments[0]=unwrapIfNeeded(argumen ts[0]);unsafeUnwrap(this).drawImage.apply(unsafeUnwrap(this),arguments)},createP attern:function(){arguments[0]=unwrap(arguments[0]);return unsafeUnwrap(this).cr eatePattern.apply(unsafeUnwrap(this),arguments)}});registerWrapper(OriginalCanva sRenderingContext2D,CanvasRenderingContext2D,document.createElement("canvas").ge tContext("2d"));scope.wrappers.CanvasRenderingContext2D=CanvasRenderingContext2D })(window.ShadowDOMPolyfill);(function(scope){"use strict";var mixin=scope.mixin ;var registerWrapper=scope.registerWrapper;var setWrapper=scope.setWrapper;var u nsafeUnwrap=scope.unsafeUnwrap;var unwrapIfNeeded=scope.unwrapIfNeeded;var wrap= scope.wrap;var OriginalWebGLRenderingContext=window.WebGLRenderingContext;if(!Or iginalWebGLRenderingContext)return;function WebGLRenderingContext(impl){setWrapp er(impl,this)}mixin(WebGLRenderingContext.prototype,{get canvas(){return wrap(un safeUnwrap(this).canvas)},texImage2D:function(){arguments[5]=unwrapIfNeeded(argu ments[5]);unsafeUnwrap(this).texImage2D.apply(unsafeUnwrap(this),arguments)},tex SubImage2D:function(){arguments[6]=unwrapIfNeeded(arguments[6]);unsafeUnwrap(thi s).texSubImage2D.apply(unsafeUnwrap(this),arguments)}});var instanceProperties=/ WebKit/.test(navigator.userAgent)?{drawingBufferHeight:null,drawingBufferWidth:n ull}:{};registerWrapper(OriginalWebGLRenderingContext,WebGLRenderingContext,inst anceProperties);scope.wrappers.WebGLRenderingContext=WebGLRenderingContext})(win dow.ShadowDOMPolyfill);(function(scope){"use strict";var registerWrapper=scope.r egisterWrapper;var setWrapper=scope.setWrapper;var unsafeUnwrap=scope.unsafeUnwr ap;var unwrap=scope.unwrap;var unwrapIfNeeded=scope.unwrapIfNeeded;var wrap=scop e.wrap;var OriginalRange=window.Range;function Range(impl){setWrapper(impl,this) }Range.prototype={get startContainer(){return wrap(unsafeUnwrap(this).startConta iner)},get endContainer(){return wrap(unsafeUnwrap(this).endContainer)},get comm onAncestorContainer(){return wrap(unsafeUnwrap(this).commonAncestorContainer)},s etStart:function(refNode,offset){unsafeUnwrap(this).setStart(unwrapIfNeeded(refN ode),offset)},setEnd:function(refNode,offset){unsafeUnwrap(this).setEnd(unwrapIf Needed(refNode),offset)},setStartBefore:function(refNode){unsafeUnwrap(this).set StartBefore(unwrapIfNeeded(refNode))},setStartAfter:function(refNode){unsafeUnwr ap(this).setStartAfter(unwrapIfNeeded(refNode))},setEndBefore:function(refNode){ unsafeUnwrap(this).setEndBefore(unwrapIfNeeded(refNode))},setEndAfter:function(r efNode){unsafeUnwrap(this).setEndAfter(unwrapIfNeeded(refNode))},selectNode:func tion(refNode){unsafeUnwrap(this).selectNode(unwrapIfNeeded(refNode))},selectNode Contents:function(refNode){unsafeUnwrap(this).selectNodeContents(unwrapIfNeeded( refNode))},compareBoundaryPoints:function(how,sourceRange){return unsafeUnwrap(t his).compareBoundaryPoints(how,unwrap(sourceRange))},extractContents:function(){ return wrap(unsafeUnwrap(this).extractContents())},cloneContents:function(){retu rn wrap(unsafeUnwrap(this).cloneContents())},insertNode:function(node){unsafeUnw rap(this).insertNode(unwrapIfNeeded(node))},surroundContents:function(newParent) {unsafeUnwrap(this).surroundContents(unwrapIfNeeded(newParent))},cloneRange:func tion(){return wrap(unsafeUnwrap(this).cloneRange())},isPointInRange:function(nod e,offset){return unsafeUnwrap(this).isPointInRange(unwrapIfNeeded(node),offset)} ,comparePoint:function(node,offset){return unsafeUnwrap(this).comparePoint(unwra pIfNeeded(node),offset)},intersectsNode:function(node){return unsafeUnwrap(this) .intersectsNode(unwrapIfNeeded(node))},toString:function(){return unsafeUnwrap(t his).toString()}};if(OriginalRange.prototype.createContextualFragment){Range.pro totype.createContextualFragment=function(html){return wrap(unsafeUnwrap(this).cr eateContextualFragment(html))}}registerWrapper(window.Range,Range,document.creat eRange());scope.wrappers.Range=Range})(window.ShadowDOMPolyfill);(function(scope ){"use strict";var GetElementsByInterface=scope.GetElementsByInterface;var Paren tNodeInterface=scope.ParentNodeInterface;var SelectorsInterface=scope.SelectorsI nterface;var mixin=scope.mixin;var registerObject=scope.registerObject;var Docum entFragment=registerObject(document.createDocumentFragment());mixin(DocumentFrag ment.prototype,ParentNodeInterface);mixin(DocumentFragment.prototype,SelectorsIn terface);mixin(DocumentFragment.prototype,GetElementsByInterface);var Comment=re gisterObject(document.createComment(""));scope.wrappers.Comment=Comment;scope.wr appers.DocumentFragment=DocumentFragment})(window.ShadowDOMPolyfill);(function(s cope){"use strict";var DocumentFragment=scope.wrappers.DocumentFragment;var Tree Scope=scope.TreeScope;var elementFromPoint=scope.elementFromPoint;var getInnerHT ML=scope.getInnerHTML;var getTreeScope=scope.getTreeScope;var mixin=scope.mixin; var rewrap=scope.rewrap;var setInnerHTML=scope.setInnerHTML;var unsafeUnwrap=sco pe.unsafeUnwrap;var unwrap=scope.unwrap;var shadowHostTable=new WeakMap;var next OlderShadowTreeTable=new WeakMap;var spaceCharRe=/[ \t\n\r\f]/;function ShadowRo ot(hostWrapper){var node=unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDo cumentFragment());DocumentFragment.call(this,node);rewrap(node,this);var oldShad owRoot=hostWrapper.shadowRoot;nextOlderShadowTreeTable.set(this,oldShadowRoot);t his.treeScope_=new TreeScope(this,getTreeScope(oldShadowRoot||hostWrapper));shad owHostTable.set(this,hostWrapper)}ShadowRoot.prototype=Object.create(DocumentFra gment.prototype);mixin(ShadowRoot.prototype,{constructor:ShadowRoot,get innerHTM L(){return getInnerHTML(this)},set innerHTML(value){setInnerHTML(this,value);thi s.invalidateShadowRenderer()},get olderShadowRoot(){return nextOlderShadowTreeTa ble.get(this)||null},get host(){return shadowHostTable.get(this)||null},invalida teShadowRenderer:function(){return shadowHostTable.get(this).invalidateShadowRen derer()},elementFromPoint:function(x,y){return elementFromPoint(this,this.ownerD ocument,x,y)},getElementById:function(id){if(spaceCharRe.test(id))return null;re turn this.querySelector('[id="'+id+'"]')}});scope.wrappers.ShadowRoot=ShadowRoot })(window.ShadowDOMPolyfill);(function(scope){"use strict";var Element=scope.wra ppers.Element;var HTMLContentElement=scope.wrappers.HTMLContentElement;var HTMLS hadowElement=scope.wrappers.HTMLShadowElement;var Node=scope.wrappers.Node;var S hadowRoot=scope.wrappers.ShadowRoot;var assert=scope.assert;var getTreeScope=sco pe.getTreeScope;var mixin=scope.mixin;var oneOf=scope.oneOf;var unsafeUnwrap=sco pe.unsafeUnwrap;var unwrap=scope.unwrap;var wrap=scope.wrap;var ArraySplice=scop e.ArraySplice;function updateWrapperUpAndSideways(wrapper){wrapper.previousSibli ng_=wrapper.previousSibling;wrapper.nextSibling_=wrapper.nextSibling;wrapper.par entNode_=wrapper.parentNode}function updateWrapperDown(wrapper){wrapper.firstChi ld_=wrapper.firstChild;wrapper.lastChild_=wrapper.lastChild}function updateAllCh ildNodes(parentNodeWrapper){assert(parentNodeWrapper instanceof Node);for(var ch ildWrapper=parentNodeWrapper.firstChild;childWrapper;childWrapper=childWrapper.n extSibling){updateWrapperUpAndSideways(childWrapper)}updateWrapperDown(parentNod eWrapper)}function insertBefore(parentNodeWrapper,newChildWrapper,refChildWrappe r){var parentNode=unwrap(parentNodeWrapper);var newChild=unwrap(newChildWrapper) ;var refChild=refChildWrapper?unwrap(refChildWrapper):null;remove(newChildWrappe r);updateWrapperUpAndSideways(newChildWrapper);if(!refChildWrapper){parentNodeWr apper.lastChild_=parentNodeWrapper.lastChild;if(parentNodeWrapper.lastChild===pa rentNodeWrapper.firstChild)parentNodeWrapper.firstChild_=parentNodeWrapper.first Child;
12 var lastChildWrapper=wrap(parentNode.lastChild);if(lastChildWrapper)lastChildWra pper.nextSibling_=lastChildWrapper.nextSibling}else{if(parentNodeWrapper.firstCh ild===refChildWrapper)parentNodeWrapper.firstChild_=refChildWrapper;refChildWrap per.previousSibling_=refChildWrapper.previousSibling}scope.originalInsertBefore. call(parentNode,newChild,refChild)}function remove(nodeWrapper){var node=unwrap( nodeWrapper);var parentNode=node.parentNode;if(!parentNode)return;var parentNode Wrapper=wrap(parentNode);updateWrapperUpAndSideways(nodeWrapper);if(nodeWrapper. previousSibling)nodeWrapper.previousSibling.nextSibling_=nodeWrapper;if(nodeWrap per.nextSibling)nodeWrapper.nextSibling.previousSibling_=nodeWrapper;if(parentNo deWrapper.lastChild===nodeWrapper)parentNodeWrapper.lastChild_=nodeWrapper;if(pa rentNodeWrapper.firstChild===nodeWrapper)parentNodeWrapper.firstChild_=nodeWrapp er;scope.originalRemoveChild.call(parentNode,node)}var distributedNodesTable=new WeakMap;var destinationInsertionPointsTable=new WeakMap;var rendererForHostTabl e=new WeakMap;function resetDistributedNodes(insertionPoint){distributedNodesTab le.set(insertionPoint,[])}function getDistributedNodes(insertionPoint){var rv=di stributedNodesTable.get(insertionPoint);if(!rv)distributedNodesTable.set(inserti onPoint,rv=[]);return rv}function getChildNodesSnapshot(node){var result=[],i=0; for(var child=node.firstChild;child;child=child.nextSibling){result[i++]=child}r eturn result}var request=oneOf(window,["requestAnimationFrame","mozRequestAnimat ionFrame","webkitRequestAnimationFrame","setTimeout"]);var pendingDirtyRenderers =[];var renderTimer;function renderAllPending(){for(var i=0;i<pendingDirtyRender ers.length;i++){var renderer=pendingDirtyRenderers[i];var parentRenderer=rendere r.parentRenderer;if(parentRenderer&&parentRenderer.dirty)continue;renderer.rende r()}pendingDirtyRenderers=[]}function handleRequestAnimationFrame(){renderTimer= null;renderAllPending()}function getRendererForHost(host){var renderer=rendererF orHostTable.get(host);if(!renderer){renderer=new ShadowRenderer(host);rendererFo rHostTable.set(host,renderer)}return renderer}function getShadowRootAncestor(nod e){var root=getTreeScope(node).root;if(root instanceof ShadowRoot)return root;re turn null}function getRendererForShadowRoot(shadowRoot){return getRendererForHos t(shadowRoot.host)}var spliceDiff=new ArraySplice;spliceDiff.equals=function(ren derNode,rawNode){return unwrap(renderNode.node)===rawNode};function RenderNode(n ode){this.skip=false;this.node=node;this.childNodes=[]}RenderNode.prototype={app end:function(node){var rv=new RenderNode(node);this.childNodes.push(rv);return r v},sync:function(opt_added){if(this.skip)return;var nodeWrapper=this.node;var ne wChildren=this.childNodes;var oldChildren=getChildNodesSnapshot(unwrap(nodeWrapp er));var added=opt_added||new WeakMap;var splices=spliceDiff.calculateSplices(ne wChildren,oldChildren);var newIndex=0,oldIndex=0;var lastIndex=0;for(var i=0;i<s plices.length;i++){var splice=splices[i];for(;lastIndex<splice.index;lastIndex++ ){oldIndex++;newChildren[newIndex++].sync(added)}var removedCount=splice.removed .length;for(var j=0;j<removedCount;j++){var wrapper=wrap(oldChildren[oldIndex++] );if(!added.get(wrapper))remove(wrapper)}var addedCount=splice.addedCount;var re fNode=oldChildren[oldIndex]&&wrap(oldChildren[oldIndex]);for(var j=0;j<addedCoun t;j++){var newChildRenderNode=newChildren[newIndex++];var newChildWrapper=newChi ldRenderNode.node;insertBefore(nodeWrapper,newChildWrapper,refNode);added.set(ne wChildWrapper,true);newChildRenderNode.sync(added)}lastIndex+=addedCount}for(var i=lastIndex;i<newChildren.length;i++){newChildren[i].sync(added)}}};function Sh adowRenderer(host){this.host=host;this.dirty=false;this.invalidateAttributes();t his.associateNode(host)}ShadowRenderer.prototype={render:function(opt_renderNode ){if(!this.dirty)return;this.invalidateAttributes();var host=this.host;this.dist ribution(host);var renderNode=opt_renderNode||new RenderNode(host);this.buildRen derTree(renderNode,host);var topMostRenderer=!opt_renderNode;if(topMostRenderer) renderNode.sync();this.dirty=false},get parentRenderer(){return getTreeScope(thi s.host).renderer},invalidate:function(){if(!this.dirty){this.dirty=true;var pare ntRenderer=this.parentRenderer;if(parentRenderer)parentRenderer.invalidate();pen dingDirtyRenderers.push(this);if(renderTimer)return;renderTimer=window[request]( handleRequestAnimationFrame,0)}},distribution:function(root){this.resetAllSubtre es(root);this.distributionResolution(root)},resetAll:function(node){if(isInserti onPoint(node))resetDistributedNodes(node);else resetDestinationInsertionPoints(n ode);this.resetAllSubtrees(node)},resetAllSubtrees:function(node){for(var child= node.firstChild;child;child=child.nextSibling){this.resetAll(child)}if(node.shad owRoot)this.resetAll(node.shadowRoot);if(node.olderShadowRoot)this.resetAll(node .olderShadowRoot)},distributionResolution:function(node){if(isShadowHost(node)){ var shadowHost=node;var pool=poolPopulation(shadowHost);var shadowTrees=getShado wTrees(shadowHost);for(var i=0;i<shadowTrees.length;i++){this.poolDistribution(s hadowTrees[i],pool)}for(var i=shadowTrees.length-1;i>=0;i--){var shadowTree=shad owTrees[i];var shadow=getShadowInsertionPoint(shadowTree);if(shadow){var olderSh adowRoot=shadowTree.olderShadowRoot;if(olderShadowRoot){pool=poolPopulation(olde rShadowRoot)}for(var j=0;j<pool.length;j++){destributeNodeInto(pool[j],shadow)}} this.distributionResolution(shadowTree)}}for(var child=node.firstChild;child;chi ld=child.nextSibling){this.distributionResolution(child)}},poolDistribution:func tion(node,pool){if(node instanceof HTMLShadowElement)return;if(node instanceof H TMLContentElement){var content=node;this.updateDependentAttributes(content.getAt tribute("select"));var anyDistributed=false;for(var i=0;i<pool.length;i++){var n ode=pool[i];if(!node)continue;if(matches(node,content)){destributeNodeInto(node, content);pool[i]=undefined;anyDistributed=true}}if(!anyDistributed){for(var chil d=content.firstChild;child;child=child.nextSibling){destributeNodeInto(child,con tent)}}return}for(var child=node.firstChild;child;child=child.nextSibling){this. poolDistribution(child,pool)}},buildRenderTree:function(renderNode,node){var chi ldren=this.compose(node);for(var i=0;i<children.length;i++){var child=children[i ];var childRenderNode=renderNode.append(child);this.buildRenderTree(childRenderN ode,child)}if(isShadowHost(node)){var renderer=getRendererForHost(node);renderer .dirty=false}},compose:function(node){var children=[];var p=node.shadowRoot||nod e;for(var child=p.firstChild;child;child=child.nextSibling){if(isInsertionPoint( child)){this.associateNode(p);var distributedNodes=getDistributedNodes(child);fo r(var j=0;j<distributedNodes.length;j++){var distributedNode=distributedNodes[j] ;if(isFinalDestination(child,distributedNode))children.push(distributedNode)}}el se{children.push(child)}}return children},invalidateAttributes:function(){this.a ttributes=Object.create(null)},updateDependentAttributes:function(selector){if(! selector)return;var attributes=this.attributes;if(/\.\w+/.test(selector))attribu tes["class"]=true;if(/#\w+/.test(selector))attributes["id"]=true;selector.replac e(/\[\s*([^\s=\|~\]]+)/g,function(_,name){attributes[name]=true})},dependsOnAttr ibute:function(name){return this.attributes[name]},associateNode:function(node){ unsafeUnwrap(node).polymerShadowRenderer_=this}};function poolPopulation(node){v ar pool=[];for(var child=node.firstChild;child;child=child.nextSibling){if(isIns ertionPoint(child)){pool.push.apply(pool,getDistributedNodes(child))}else{pool.p ush(child)}}return pool}function getShadowInsertionPoint(node){if(node instanceo f HTMLShadowElement)return node;if(node instanceof HTMLContentElement)return nul l;for(var child=node.firstChild;child;child=child.nextSibling){var res=getShadow InsertionPoint(child);if(res)return res}return null}function destributeNodeInto( child,insertionPoint){getDistributedNodes(insertionPoint).push(child);var points =destinationInsertionPointsTable.get(child);if(!points)destinationInsertionPoint sTable.set(child,[insertionPoint]);else points.push(insertionPoint)}function get DestinationInsertionPoints(node){return destinationInsertionPointsTable.get(node )}function resetDestinationInsertionPoints(node){destinationInsertionPointsTable .set(node,undefined)}var selectorStartCharRe=/^(:not\()?[*.#[a-zA-Z_|]/;function matches(node,contentElement){var select=contentElement.getAttribute("select");i f(!select)return true;select=select.trim();if(!select)return true;if(!(node inst anceof Element))return false;if(!selectorStartCharRe.test(select))return false;t ry{return node.matches(select)}catch(ex){return false}}function isFinalDestinati on(insertionPoint,node){var points=getDestinationInsertionPoints(node);return po ints&&points[points.length-1]===insertionPoint}function isInsertionPoint(node){r eturn node instanceof HTMLContentElement||node instanceof HTMLShadowElement}func tion isShadowHost(shadowHost){return shadowHost.shadowRoot}function getShadowTre es(host){var trees=[];for(var tree=host.shadowRoot;tree;tree=tree.olderShadowRoo t){trees.push(tree)}return trees}function render(host){new ShadowRenderer(host). render()}Node.prototype.invalidateShadowRenderer=function(force){var renderer=un safeUnwrap(this).polymerShadowRenderer_;if(renderer){renderer.invalidate();retur n true}return false};HTMLContentElement.prototype.getDistributedNodes=HTMLShadow Element.prototype.getDistributedNodes=function(){renderAllPending();return getDi stributedNodes(this)};Element.prototype.getDestinationInsertionPoints=function() {renderAllPending();return getDestinationInsertionPoints(this)||[]};HTMLContentE lement.prototype.nodeIsInserted_=HTMLShadowElement.prototype.nodeIsInserted_=fun ction(){this.invalidateShadowRenderer();var shadowRoot=getShadowRootAncestor(thi s);var renderer;if(shadowRoot)renderer=getRendererForShadowRoot(shadowRoot);unsa feUnwrap(this).polymerShadowRenderer_=renderer;if(renderer)renderer.invalidate() };scope.getRendererForHost=getRendererForHost;scope.getShadowTrees=getShadowTree s;scope.renderAllPending=renderAllPending;scope.getDestinationInsertionPoints=ge tDestinationInsertionPoints;scope.visual={insertBefore:insertBefore,remove:remov e}})(window.ShadowDOMPolyfill);(function(scope){"use strict";var HTMLElement=sco pe.wrappers.HTMLElement;var assert=scope.assert;var mixin=scope.mixin;var regist erWrapper=scope.registerWrapper;var unwrap=scope.unwrap;var wrap=scope.wrap;var elementsWithFormProperty=["HTMLButtonElement","HTMLFieldSetElement","HTMLInputEl ement","HTMLKeygenElement","HTMLLabelElement","HTMLLegendElement","HTMLObjectEle ment","HTMLOutputElement","HTMLTextAreaElement"];function createWrapperConstruct or(name){if(!window[name])return;assert(!scope.wrappers[name]);var GeneratedWrap per=function(node){HTMLElement.call(this,node)};GeneratedWrapper.prototype=Objec t.create(HTMLElement.prototype);mixin(GeneratedWrapper.prototype,{get form(){ret urn wrap(unwrap(this).form)}});registerWrapper(window[name],GeneratedWrapper,doc ument.createElement(name.slice(4,-7)));scope.wrappers[name]=GeneratedWrapper}ele mentsWithFormProperty.forEach(createWrapperConstructor)})(window.ShadowDOMPolyfi ll);(function(scope){"use strict";var registerWrapper=scope.registerWrapper;var setWrapper=scope.setWrapper;var unsafeUnwrap=scope.unsafeUnwrap;var unwrap=scope .unwrap;var unwrapIfNeeded=scope.unwrapIfNeeded;var wrap=scope.wrap;var Original Selection=window.Selection;function Selection(impl){setWrapper(impl,this)}Select ion.prototype={get anchorNode(){return wrap(unsafeUnwrap(this).anchorNode)},get focusNode(){return wrap(unsafeUnwrap(this).focusNode)},addRange:function(range){ unsafeUnwrap(this).addRange(unwrap(range))},collapse:function(node,index){unsafe Unwrap(this).collapse(unwrapIfNeeded(node),index)},containsNode:function(node,al lowPartial){return unsafeUnwrap(this).containsNode(unwrapIfNeeded(node),allowPar tial)},extend:function(node,offset){unsafeUnwrap(this).extend(unwrapIfNeeded(nod e),offset)},getRangeAt:function(index){return wrap(unsafeUnwrap(this).getRangeAt (index))},removeRange:function(range){unsafeUnwrap(this).removeRange(unwrap(rang e))},selectAllChildren:function(node){unsafeUnwrap(this).selectAllChildren(unwra pIfNeeded(node))},toString:function(){return unsafeUnwrap(this).toString()}};reg isterWrapper(window.Selection,Selection,window.getSelection());scope.wrappers.Se lection=Selection})(window.ShadowDOMPolyfill);(function(scope){"use strict";var GetElementsByInterface=scope.GetElementsByInterface;var Node=scope.wrappers.Node ;var ParentNodeInterface=scope.ParentNodeInterface;var Selection=scope.wrappers. Selection;var SelectorsInterface=scope.SelectorsInterface;var ShadowRoot=scope.w rappers.ShadowRoot;var TreeScope=scope.TreeScope;var cloneNode=scope.cloneNode;v ar defineWrapGetter=scope.defineWrapGetter;var elementFromPoint=scope.elementFro mPoint;var forwardMethodsToWrapper=scope.forwardMethodsToWrapper;var matchesName s=scope.matchesNames;var mixin=scope.mixin;var registerWrapper=scope.registerWra pper;var renderAllPending=scope.renderAllPending;var rewrap=scope.rewrap;var set Wrapper=scope.setWrapper;var unsafeUnwrap=scope.unsafeUnwrap;var unwrap=scope.un wrap;var wrap=scope.wrap;var wrapEventTargetMethods=scope.wrapEventTargetMethods ;var wrapNodeList=scope.wrapNodeList;var implementationTable=new WeakMap;functio n Document(node){Node.call(this,node);this.treeScope_=new TreeScope(this,null)}D ocument.prototype=Object.create(Node.prototype);defineWrapGetter(Document,"docum entElement");defineWrapGetter(Document,"body");defineWrapGetter(Document,"head") ;function wrapMethod(name){var original=document[name];Document.prototype[name]= function(){return wrap(original.apply(unsafeUnwrap(this),arguments))}}["createCo mment","createDocumentFragment","createElement","createElementNS","createEvent", "createEventNS","createRange","createTextNode","getElementById"].forEach(wrapMet hod);var originalAdoptNode=document.adoptNode;function adoptNodeNoRemove(node,do c){originalAdoptNode.call(unsafeUnwrap(doc),unwrap(node));adoptSubtree(node,doc) }function adoptSubtree(node,doc){if(node.shadowRoot)doc.adoptNode(node.shadowRoo t);if(node instanceof ShadowRoot)adoptOlderShadowRoots(node,doc);for(var child=n ode.firstChild;child;child=child.nextSibling){adoptSubtree(child,doc)}}function adoptOlderShadowRoots(shadowRoot,doc){var oldShadowRoot=shadowRoot.olderShadowRo ot;if(oldShadowRoot)doc.adoptNode(oldShadowRoot)}var originalGetSelection=docume nt.getSelection;mixin(Document.prototype,{adoptNode:function(node){if(node.paren tNode)node.parentNode.removeChild(node);adoptNodeNoRemove(node,this);return node },elementFromPoint:function(x,y){return elementFromPoint(this,this,x,y)},importN ode:function(node,deep){return cloneNode(node,deep,unsafeUnwrap(this))},getSelec tion:function(){renderAllPending();return new Selection(originalGetSelection.cal l(unwrap(this)))},getElementsByName:function(name){return SelectorsInterface.que rySelectorAll.call(this,"[name="+JSON.stringify(String(name))+"]")}});if(documen t.registerElement){var originalRegisterElement=document.registerElement;Document .prototype.registerElement=function(tagName,object){var prototype,extendsOption; if(object!==undefined){prototype=object.prototype;extendsOption=object.extends}i f(!prototype)prototype=Object.create(HTMLElement.prototype);if(scope.nativeProto typeTable.get(prototype)){throw new Error("NotSupportedError")}var proto=Object. getPrototypeOf(prototype);var nativePrototype;var prototypes=[];while(proto){nat ivePrototype=scope.nativePrototypeTable.get(proto);if(nativePrototype)break;prot otypes.push(proto);proto=Object.getPrototypeOf(proto)}if(!nativePrototype){throw new Error("NotSupportedError")}var newPrototype=Object.create(nativePrototype); for(var i=prototypes.length-1;i>=0;i--){newPrototype=Object.create(newPrototype) }["createdCallback","attachedCallback","detachedCallback","attributeChangedCallb ack"].forEach(function(name){var f=prototype[name];if(!f)return;newPrototype[nam e]=function(){if(!(wrap(this)instanceof CustomElementConstructor)){rewrap(this)} f.apply(wrap(this),arguments)}});var p={prototype:newPrototype};if(extendsOption )p.extends=extendsOption;function CustomElementConstructor(node){if(!node){if(ex tendsOption){return document.createElement(extendsOption,tagName)}else{return do cument.createElement(tagName)}}setWrapper(node,this)}CustomElementConstructor.pr ototype=prototype;CustomElementConstructor.prototype.constructor=CustomElementCo nstructor;scope.constructorTable.set(newPrototype,CustomElementConstructor);scop e.nativePrototypeTable.set(prototype,newPrototype);var nativeConstructor=origina lRegisterElement.call(unwrap(this),tagName,p);return CustomElementConstructor};f orwardMethodsToWrapper([window.HTMLDocument||window.Document],["registerElement" ])}forwardMethodsToWrapper([window.HTMLBodyElement,window.HTMLDocument||window.D ocument,window.HTMLHeadElement,window.HTMLHtmlElement],["appendChild","compareDo cumentPosition","contains","getElementsByClassName","getElementsByTagName","getE lementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChi ld","replaceChild"].concat(matchesNames));forwardMethodsToWrapper([window.HTMLDo cument||window.Document],["adoptNode","importNode","contains","createComment","c reateDocumentFragment","createElement","createElementNS","createEvent","createEv entNS","createRange","createTextNode","elementFromPoint","getElementById","getEl ementsByName","getSelection"]);mixin(Document.prototype,GetElementsByInterface); mixin(Document.prototype,ParentNodeInterface);mixin(Document.prototype,Selectors Interface);mixin(Document.prototype,{get implementation(){var implementation=imp lementationTable.get(this);if(implementation)return implementation;implementatio n=new DOMImplementation(unwrap(this).implementation);implementationTable.set(thi s,implementation);return implementation},get defaultView(){return wrap(unwrap(th is).defaultView)}});registerWrapper(window.Document,Document,document.implementa tion.createHTMLDocument(""));if(window.HTMLDocument)registerWrapper(window.HTMLD ocument,Document);wrapEventTargetMethods([window.HTMLBodyElement,window.HTMLDocu ment||window.Document,window.HTMLHeadElement]);function DOMImplementation(impl){ setWrapper(impl,this)}function wrapImplMethod(constructor,name){var original=doc ument.implementation[name];constructor.prototype[name]=function(){return wrap(or iginal.apply(unsafeUnwrap(this),arguments))}}function forwardImplMethod(construc tor,name){var original=document.implementation[name];constructor.prototype[name] =function(){return original.apply(unsafeUnwrap(this),arguments)}}wrapImplMethod( DOMImplementation,"createDocumentType");wrapImplMethod(DOMImplementation,"create Document");wrapImplMethod(DOMImplementation,"createHTMLDocument");forwardImplMet hod(DOMImplementation,"hasFeature");registerWrapper(window.DOMImplementation,DOM Implementation);forwardMethodsToWrapper([window.DOMImplementation],["createDocum entType","createDocument","createHTMLDocument","hasFeature"]);scope.adoptNodeNoR emove=adoptNodeNoRemove;scope.wrappers.DOMImplementation=DOMImplementation;scope .wrappers.Document=Document})(window.ShadowDOMPolyfill);(function(scope){"use st rict";var EventTarget=scope.wrappers.EventTarget;var Selection=scope.wrappers.Se lection;var mixin=scope.mixin;var registerWrapper=scope.registerWrapper;var rend erAllPending=scope.renderAllPending;var unwrap=scope.unwrap;var unwrapIfNeeded=s cope.unwrapIfNeeded;var wrap=scope.wrap;var OriginalWindow=window.Window;var ori ginalGetComputedStyle=window.getComputedStyle;var originalGetDefaultComputedStyl e=window.getDefaultComputedStyle;var originalGetSelection=window.getSelection;fu nction Window(impl){EventTarget.call(this,impl)}Window.prototype=Object.create(E ventTarget.prototype);OriginalWindow.prototype.getComputedStyle=function(el,pseu do){return wrap(this||window).getComputedStyle(unwrapIfNeeded(el),pseudo)};if(or iginalGetDefaultComputedStyle){OriginalWindow.prototype.getDefaultComputedStyle= function(el,pseudo){return wrap(this||window).getDefaultComputedStyle(unwrapIfNe eded(el),pseudo)}}OriginalWindow.prototype.getSelection=function(){return wrap(t his||window).getSelection()};delete window.getComputedStyle;delete window.getDef aultComputedStyle;delete window.getSelection;["addEventListener","removeEventLis tener","dispatchEvent"].forEach(function(name){OriginalWindow.prototype[name]=fu nction(){var w=wrap(this||window);return w[name].apply(w,arguments)};delete wind ow[name]});mixin(Window.prototype,{getComputedStyle:function(el,pseudo){renderAl lPending();return originalGetComputedStyle.call(unwrap(this),unwrapIfNeeded(el), pseudo)},getSelection:function(){renderAllPending();return new Selection(origina lGetSelection.call(unwrap(this)))},get document(){return wrap(unwrap(this).docum ent)}});if(originalGetDefaultComputedStyle){Window.prototype.getDefaultComputedS tyle=function(el,pseudo){renderAllPending();return originalGetDefaultComputedSty le.call(unwrap(this),unwrapIfNeeded(el),pseudo)}}registerWrapper(OriginalWindow, Window,window);scope.wrappers.Window=Window})(window.ShadowDOMPolyfill);(functio n(scope){"use strict";var unwrap=scope.unwrap;var OriginalDataTransfer=window.Da taTransfer||window.Clipboard;var OriginalDataTransferSetDragImage=OriginalDataTr ansfer.prototype.setDragImage;if(OriginalDataTransferSetDragImage){OriginalDataT ransfer.prototype.setDragImage=function(image,x,y){OriginalDataTransferSetDragIm age.call(this,unwrap(image),x,y)}}})(window.ShadowDOMPolyfill);(function(scope){ "use strict";var registerWrapper=scope.registerWrapper;var setWrapper=scope.setW rapper;var unwrap=scope.unwrap;var OriginalFormData=window.FormData;if(!Original FormData)return;function FormData(formElement){var impl;if(formElement instanceo f OriginalFormData){impl=formElement}else{impl=new OriginalFormData(formElement& &unwrap(formElement))}setWrapper(impl,this)}registerWrapper(OriginalFormData,For mData,new OriginalFormData);scope.wrappers.FormData=FormData})(window.ShadowDOMP olyfill);(function(scope){"use strict";var unwrapIfNeeded=scope.unwrapIfNeeded;v ar originalSend=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=func tion(obj){return originalSend.call(this,unwrapIfNeeded(obj))}})(window.ShadowDOM Polyfill);(function(scope){"use strict";var isWrapperFor=scope.isWrapperFor;var elements={a:"HTMLAnchorElement",area:"HTMLAreaElement",audio:"HTMLAudioElement", base:"HTMLBaseElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLBut tonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",col:"HT MLTableColElement",content:"HTMLContentElement",data:"HTMLDataElement",datalist: "HTMLDataListElement",del:"HTMLModElement",dir:"HTMLDirectoryElement",div:"HTMLD ivElement",dl:"HTMLDListElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSet Element",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement", frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",head:"HTMLHeadElement",hr :"HTMLHRElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",img:"HTMLImag eElement",input:"HTMLInputElement",keygen:"HTMLKeygenElement",label:"HTMLLabelEl ement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",map: "HTMLMapElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",menuitem:"H TMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",object:"HTML ObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTML OptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLPa ramElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElem ent",script:"HTMLScriptElement",select:"HTMLSelectElement",shadow:"HTMLShadowEle ment",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement" ,table:"HTMLTableElement",tbody:"HTMLTableSectionElement",template:"HTMLTemplate Element",textarea:"HTMLTextAreaElement",thead:"HTMLTableSectionElement",time:"HT MLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrac kElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};function overrideConst ructor(tagName){var nativeConstructorName=elements[tagName];var nativeConstructo r=window[nativeConstructorName];if(!nativeConstructor)return;var element=documen t.createElement(tagName);var wrapperConstructor=element.constructor;window[nativ eConstructorName]=wrapperConstructor}Object.keys(elements).forEach(overrideConst ructor);Object.getOwnPropertyNames(scope.wrappers).forEach(function(name){window [name]=scope.wrappers[name]})})(window.ShadowDOMPolyfill);(function(scope){var S hadowCSS={strictStyling:false,registry:{},shimStyling:function(root,name,extends Name){var scopeStyles=this.prepareRoot(root,name,extendsName);var typeExtension= this.isTypeExtension(extendsName);var scopeSelector=this.makeScopeSelector(name, typeExtension);var cssText=stylesToCssText(scopeStyles,true);cssText=this.scopeC ssText(cssText,scopeSelector);if(root){root.shimmedStyle=cssText}this.addCssToDo cument(cssText,name)},shimStyle:function(style,selector){return this.shimCssText (style.textContent,selector)},shimCssText:function(cssText,selector){cssText=thi s.insertDirectives(cssText);return this.scopeCssText(cssText,selector)},makeScop eSelector:function(name,typeExtension){if(name){return typeExtension?"[is="+name +"]":name}return""},isTypeExtension:function(extendsName){return extendsName&&ex tendsName.indexOf("-")<0},prepareRoot:function(root,name,extendsName){var def=th is.registerRoot(root,name,extendsName);this.replaceTextInStyles(def.rootStyles,t his.insertDirectives);this.removeStyles(root,def.rootStyles);if(this.strictStyli ng){this.applyScopeToContent(root,name)}return def.scopeStyles},removeStyles:fun ction(root,styles){for(var i=0,l=styles.length,s;i<l&&(s=styles[i]);i++){s.paren tNode.removeChild(s)}},registerRoot:function(root,name,extendsName){var def=this .registry[name]={root:root,name:name,extendsName:extendsName};var styles=this.fi ndStyles(root);def.rootStyles=styles;def.scopeStyles=def.rootStyles;var extendee =this.registry[def.extendsName];if(extendee){def.scopeStyles=extendee.scopeStyle s.concat(def.scopeStyles)}return def},findStyles:function(root){if(!root){return []}var styles=root.querySelectorAll("style");return Array.prototype.filter.call( styles,function(s){return!s.hasAttribute(NO_SHIM_ATTRIBUTE)})},applyScopeToConte nt:function(root,name){if(root){Array.prototype.forEach.call(root.querySelectorA ll("*"),function(node){node.setAttribute(name,"")});Array.prototype.forEach.call (root.querySelectorAll("template"),function(template){this.applyScopeToContent(t emplate.content,name)},this)}},insertDirectives:function(cssText){cssText=this.i nsertPolyfillDirectivesInCssText(cssText);return this.insertPolyfillRulesInCssTe xt(cssText)},insertPolyfillDirectivesInCssText:function(cssText){cssText=cssText .replace(cssCommentNextSelectorRe,function(match,p1){return p1.slice(0,-2)+"{"}) ;return cssText.replace(cssContentNextSelectorRe,function(match,p1){return p1+" {"})},insertPolyfillRulesInCssText:function(cssText){cssText=cssText.replace(css CommentRuleRe,function(match,p1){return p1.slice(0,-1)});return cssText.replace( cssContentRuleRe,function(match,p1,p2,p3){var rule=match.replace(p1,"").replace( p2,"");return p3+rule})},scopeCssText:function(cssText,scopeSelector){var unscop ed=this.extractUnscopedRulesFromCssText(cssText);cssText=this.insertPolyfillHost InCssText(cssText);cssText=this.convertColonHost(cssText);cssText=this.convertCo lonHostContext(cssText);cssText=this.convertShadowDOMSelectors(cssText);if(scope Selector){var self=this,cssText;withCssRules(cssText,function(rules){cssText=sel f.scopeRules(rules,scopeSelector)})}cssText=cssText+"\n"+unscoped;return cssText .trim()},extractUnscopedRulesFromCssText:function(cssText){var r="",m;while(m=cs sCommentUnscopedRuleRe.exec(cssText)){r+=m[1].slice(0,-1)+"\n\n"}while(m=cssCont entUnscopedRuleRe.exec(cssText)){r+=m[0].replace(m[2],"").replace(m[1],m[3])+"\n \n"}return r},convertColonHost:function(cssText){return this.convertColonRule(cs sText,cssColonHostRe,this.colonHostPartReplacer)},convertColonHostContext:functi on(cssText){return this.convertColonRule(cssText,cssColonHostContextRe,this.colo nHostContextPartReplacer)},convertColonRule:function(cssText,regExp,partReplacer ){return cssText.replace(regExp,function(m,p1,p2,p3){p1=polyfillHostNoCombinator ;if(p2){var parts=p2.split(","),r=[];for(var i=0,l=parts.length,p;i<l&&(p=parts[ i]);i++){p=p.trim();r.push(partReplacer(p1,p,p3))}return r.join(",")}else{return p1+p3}})},colonHostContextPartReplacer:function(host,part,suffix){if(part.match (polyfillHost)){return this.colonHostPartReplacer(host,part,suffix)}else{return host+part+suffix+", "+part+" "+host+suffix}},colonHostPartReplacer:function(host ,part,suffix){return host+part.replace(polyfillHost,"")+suffix},convertShadowDOM Selectors:function(cssText){for(var i=0;i<shadowDOMSelectorsRe.length;i++){cssTe xt=cssText.replace(shadowDOMSelectorsRe[i]," ")}return cssText},scopeRules:funct ion(cssRules,scopeSelector){var cssText="";if(cssRules){Array.prototype.forEach. call(cssRules,function(rule){if(rule.selectorText&&(rule.style&&rule.style.cssTe xt!==undefined)){cssText+=this.scopeSelector(rule.selectorText,scopeSelector,thi s.strictStyling)+" {\n ";cssText+=this.propertiesFromRule(rule)+"\n}\n\n"}else if(rule.type===CSSRule.MEDIA_RULE){cssText+="@media "+rule.media.mediaText+" {\n ";cssText+=this.scopeRules(rule.cssRules,scopeSelector);cssText+="\n}\n\n"}else{ try{if(rule.cssText){cssText+=rule.cssText+"\n\n"}}catch(x){if(rule.type===CSSRu le.KEYFRAMES_RULE&&rule.cssRules){cssText+=this.ieSafeCssTextFromKeyFrameRule(ru le)}}}},this)}return cssText},ieSafeCssTextFromKeyFrameRule:function(rule){var c ssText="@keyframes "+rule.name+" {";Array.prototype.forEach.call(rule.cssRules,f unction(rule){cssText+=" "+rule.keyText+" {"+rule.style.cssText+"}"});cssText+=" }";return cssText},scopeSelector:function(selector,scopeSelector,strict){var r= [],parts=selector.split(",");parts.forEach(function(p){p=p.trim();if(this.select orNeedsScoping(p,scopeSelector)){p=strict&&!p.match(polyfillHostNoCombinator)?th is.applyStrictSelectorScope(p,scopeSelector):this.applySelectorScope(p,scopeSele ctor)}r.push(p)},this);return r.join(", ")},selectorNeedsScoping:function(select or,scopeSelector){if(Array.isArray(scopeSelector)){return true}var re=this.makeS copeMatcher(scopeSelector);return!selector.match(re)},makeScopeMatcher:function( scopeSelector){scopeSelector=scopeSelector.replace(/\[/g,"\\[").replace(/\[/g,"\ \]");return new RegExp("^("+scopeSelector+")"+selectorReSuffix,"m")},applySelect orScope:function(selector,selectorScope){return Array.isArray(selectorScope)?thi s.applySelectorScopeList(selector,selectorScope):this.applySimpleSelectorScope(s elector,selectorScope)},applySelectorScopeList:function(selector,scopeSelectorLi st){var r=[];for(var i=0,s;s=scopeSelectorList[i];i++){r.push(this.applySimpleSe lectorScope(selector,s))}return r.join(", ")},applySimpleSelectorScope:function( selector,scopeSelector){if(selector.match(polyfillHostRe)){selector=selector.rep lace(polyfillHostNoCombinator,scopeSelector);return selector.replace(polyfillHos tRe,scopeSelector+" ")}else{return scopeSelector+" "+selector}},applyStrictSelec torScope:function(selector,scopeSelector){scopeSelector=scopeSelector.replace(/\ [is=([^\]]*)\]/g,"$1");var splits=[" ",">","+","~"],scoped=selector,attrName="[" +scopeSelector+"]";splits.forEach(function(sep){var parts=scoped.split(sep);scop ed=parts.map(function(p){var t=p.trim().replace(polyfillHostRe,"");if(t&&splits. indexOf(t)<0&&t.indexOf(attrName)<0){p=t.replace(/([^:]*)(:*)(.*)/,"$1"+attrName +"$2$3")}return p}).join(sep)});return scoped},insertPolyfillHostInCssText:funct ion(selector){return selector.replace(colonHostContextRe,polyfillHostContext).re place(colonHostRe,polyfillHost)},propertiesFromRule:function(rule){var cssText=r ule.style.cssText;if(rule.style.content&&!rule.style.content.match(/['"]+|attr/) ){cssText=cssText.replace(/content:[^;]*;/g,"content: '"+rule.style.content+"';" )}var style=rule.style;
13 for(var i in style){if(style[i]==="initial"){cssText+=i+": initial; "}}return cs sText},replaceTextInStyles:function(styles,action){if(styles&&action){if(!(style s instanceof Array)){styles=[styles]}Array.prototype.forEach.call(styles,functio n(s){s.textContent=action.call(this,s.textContent)},this)}},addCssToDocument:fun ction(cssText,name){if(cssText.match("@import")){addOwnSheet(cssText,name)}else{ addCssToDocument(cssText)}}};var selectorRe=/([^{]*)({[\s\S]*?})/gim,cssCommentR e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,cssCommentNextSelectorRe=/\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim,cssContentNextSelectorRe=/polyfill-ne xt-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,cssCommentRuleR e=/\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim,cssContentRuleRe=/(polyf ill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,cssCommentUnscopedRu leRe=/\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim,cssContentUn scopedRuleRe=/(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^ }]*}/gim,cssPseudoRe=/::(x-[^\s{,(]*)/gim,cssPartRe=/::part\(([^)]*)\)/gim,polyf illHost="-shadowcsshost",polyfillHostContext="-shadowcsscontext",parenSuffix=")( ?:\\(("+"(?:\\([^)(]*\\)|[^)(]*)+?"+")\\))?([^,{]*)";var cssColonHostRe=new RegE xp("("+polyfillHost+parenSuffix,"gim"),cssColonHostContextRe=new RegExp("("+poly fillHostContext+parenSuffix,"gim"),selectorReSuffix="([>\\s~+[.,{:][\\s\\S]*)?$" ,colonHostRe=/\:host/gim,colonHostContextRe=/\:host-context/gim,polyfillHostNoCo mbinator=polyfillHost+"-no-combinator",polyfillHostRe=new RegExp(polyfillHost,"g im"),polyfillHostContextRe=new RegExp(polyfillHostContext,"gim"),shadowDOMSelect orsRe=[/\^\^/g,/\^/g,/\/shadow\//g,/\/shadow-deep\//g,/::shadow/g,/\/deep\//g,/: :content/g];function stylesToCssText(styles,preserveComments){var cssText="";Arr ay.prototype.forEach.call(styles,function(s){cssText+=s.textContent+"\n\n"});if( !preserveComments){cssText=cssText.replace(cssCommentRe,"")}return cssText}funct ion cssTextToStyle(cssText){var style=document.createElement("style");style.text Content=cssText;return style}function cssToRules(cssText){var style=cssTextToSty le(cssText);document.head.appendChild(style);var rules=[];if(style.sheet){try{ru les=style.sheet.cssRules}catch(e){}}else{console.warn("sheet not found",style)}s tyle.parentNode.removeChild(style);return rules}var frame=document.createElement ("iframe");frame.style.display="none";function initFrame(){frame.initialized=tru e;document.body.appendChild(frame);var doc=frame.contentDocument;var base=doc.cr eateElement("base");base.href=document.baseURI;doc.head.appendChild(base)}functi on inFrame(fn){if(!frame.initialized){initFrame()}document.body.appendChild(fram e);fn(frame.contentDocument);document.body.removeChild(frame)}var isChrome=navig ator.userAgent.match("Chrome");function withCssRules(cssText,callback){if(!callb ack){return}var rules;if(cssText.match("@import")&&isChrome){var style=cssTextTo Style(cssText);inFrame(function(doc){doc.head.appendChild(style.impl);rules=Arra y.prototype.slice.call(style.sheet.cssRules,0);callback(rules)})}else{rules=cssT oRules(cssText);callback(rules)}}function rulesToCss(cssRules){for(var i=0,css=[ ];i<cssRules.length;i++){css.push(cssRules[i].cssText)}return css.join("\n\n")}f unction addCssToDocument(cssText){if(cssText){getSheet().appendChild(document.cr eateTextNode(cssText))}}function addOwnSheet(cssText,name){var style=cssTextToSt yle(cssText);style.setAttribute(name,"");style.setAttribute(SHIMMED_ATTRIBUTE,"" );document.head.appendChild(style)}var SHIM_ATTRIBUTE="shim-shadowdom";var SHIMM ED_ATTRIBUTE="shim-shadowdom-css";var NO_SHIM_ATTRIBUTE="no-shim";var sheet;func tion getSheet(){if(!sheet){sheet=document.createElement("style");sheet.setAttrib ute(SHIMMED_ATTRIBUTE,"");sheet[SHIMMED_ATTRIBUTE]=true}return sheet}if(window.S hadowDOMPolyfill){addCssToDocument("style { display: none !important; }\n");var doc=ShadowDOMPolyfill.wrap(document);var head=doc.querySelector("head");head.ins ertBefore(getSheet(),head.childNodes[0]);document.addEventListener("DOMContentLo aded",function(){var urlResolver=scope.urlResolver;if(window.HTMLImports&&!HTMLI mports.useNative){var SHIM_SHEET_SELECTOR="link[rel=stylesheet]"+"["+SHIM_ATTRIB UTE+"]";var SHIM_STYLE_SELECTOR="style["+SHIM_ATTRIBUTE+"]";HTMLImports.importer .documentPreloadSelectors+=","+SHIM_SHEET_SELECTOR;HTMLImports.importer.importsP reloadSelectors+=","+SHIM_SHEET_SELECTOR;HTMLImports.parser.documentSelectors=[H TMLImports.parser.documentSelectors,SHIM_SHEET_SELECTOR,SHIM_STYLE_SELECTOR].joi n(",");var originalParseGeneric=HTMLImports.parser.parseGeneric;HTMLImports.pars er.parseGeneric=function(elt){if(elt[SHIMMED_ATTRIBUTE]){return}var style=elt.__ importElement||elt;if(!style.hasAttribute(SHIM_ATTRIBUTE)){originalParseGeneric. call(this,elt);return}if(elt.__resource){style=elt.ownerDocument.createElement(" style");style.textContent=elt.__resource}HTMLImports.path.resolveUrlsInStyle(sty le);style.textContent=ShadowCSS.shimStyle(style);style.removeAttribute(SHIM_ATTR IBUTE,"");style.setAttribute(SHIMMED_ATTRIBUTE,"");style[SHIMMED_ATTRIBUTE]=true ;if(style.parentNode!==head){if(elt.parentNode===head){head.replaceChild(style,e lt)}else{this.addElementToDocument(style)}}style.__importParsed=true;this.markPa rsingComplete(elt);this.parseNext()};var hasResource=HTMLImports.parser.hasResou rce;HTMLImports.parser.hasResource=function(node){if(node.localName==="link"&&no de.rel==="stylesheet"&&node.hasAttribute(SHIM_ATTRIBUTE)){return node.__resource }else{return hasResource.call(this,node)}}}})}scope.ShadowCSS=ShadowCSS})(window .WebComponents)}(function(scope){if(window.ShadowDOMPolyfill){window.wrap=Shadow DOMPolyfill.wrapIfNeeded;window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded}else{win dow.wrap=window.unwrap=function(n){return n}}})(window.WebComponents);(function( global){var registrationsTable=new WeakMap;var setImmediate;if(/Trident/.test(na vigator.userAgent)){setImmediate=setTimeout}else if(window.setImmediate){setImme diate=window.setImmediate}else{var setImmediateQueue=[];var sentinel=String(Math .random());window.addEventListener("message",function(e){if(e.data===sentinel){v ar queue=setImmediateQueue;setImmediateQueue=[];queue.forEach(function(func){fun c()})}});setImmediate=function(func){setImmediateQueue.push(func);window.postMes sage(sentinel,"*")}}var isScheduled=false;var scheduledObservers=[];function sch eduleCallback(observer){scheduledObservers.push(observer);if(!isScheduled){isSch eduled=true;setImmediate(dispatchCallbacks)}}function wrapIfNeeded(node){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(node)||node}func tion dispatchCallbacks(){isScheduled=false;var observers=scheduledObservers;sche duledObservers=[];observers.sort(function(o1,o2){return o1.uid_-o2.uid_});var an yNonEmpty=false;observers.forEach(function(observer){var queue=observer.takeReco rds();removeTransientObserversFor(observer);if(queue.length){observer.callback_( queue,observer);anyNonEmpty=true}});if(anyNonEmpty)dispatchCallbacks()}function removeTransientObserversFor(observer){observer.nodes_.forEach(function(node){var registrations=registrationsTable.get(node);if(!registrations)return;registratio ns.forEach(function(registration){if(registration.observer===observer)registrati on.removeTransientObservers()})})}function forEachAncestorAndObserverEnqueueReco rd(target,callback){for(var node=target;node;node=node.parentNode){var registrat ions=registrationsTable.get(node);if(registrations){for(var j=0;j<registrations. length;j++){var registration=registrations[j];var options=registration.options;i f(node!==target&&!options.subtree)continue;var record=callback(options);if(recor d)registration.enqueue(record)}}}}var uidCounter=0;function JsMutationObserver(c allback){this.callback_=callback;this.nodes_=[];this.records_=[];this.uid_=++uid Counter}JsMutationObserver.prototype={observe:function(target,options){target=wr apIfNeeded(target);if(!options.childList&&!options.attributes&&!options.characte rData||options.attributeOldValue&&!options.attributes||options.attributeFilter&& options.attributeFilter.length&&!options.attributes||options.characterDataOldVal ue&&!options.characterData){throw new SyntaxError}var registrations=registration sTable.get(target);if(!registrations)registrationsTable.set(target,registrations =[]);var registration;for(var i=0;i<registrations.length;i++){if(registrations[i ].observer===this){registration=registrations[i];registration.removeListeners(); registration.options=options;break}}if(!registration){registration=new Registrat ion(this,target,options);registrations.push(registration);this.nodes_.push(targe t)}registration.addListeners()},disconnect:function(){this.nodes_.forEach(functi on(node){var registrations=registrationsTable.get(node);for(var i=0;i<registrati ons.length;i++){var registration=registrations[i];if(registration.observer===thi s){registration.removeListeners();registrations.splice(i,1);break}}},this);this. records_=[]},takeRecords:function(){var copyOfRecords=this.records_;this.records _=[];return copyOfRecords}};function MutationRecord(type,target){this.type=type; this.target=target;this.addedNodes=[];this.removedNodes=[];this.previousSibling= null;this.nextSibling=null;this.attributeName=null;this.attributeNamespace=null; this.oldValue=null}function copyMutationRecord(original){var record=new Mutation Record(original.type,original.target);record.addedNodes=original.addedNodes.slic e();record.removedNodes=original.removedNodes.slice();record.previousSibling=ori ginal.previousSibling;record.nextSibling=original.nextSibling;record.attributeNa me=original.attributeName;record.attributeNamespace=original.attributeNamespace; record.oldValue=original.oldValue;return record}var currentRecord,recordWithOldV alue;function getRecord(type,target){return currentRecord=new MutationRecord(typ e,target)}function getRecordWithOldValue(oldValue){if(recordWithOldValue)return recordWithOldValue;recordWithOldValue=copyMutationRecord(currentRecord);recordWi thOldValue.oldValue=oldValue;return recordWithOldValue}function clearRecords(){c urrentRecord=recordWithOldValue=undefined}function recordRepresentsCurrentMutati on(record){return record===recordWithOldValue||record===currentRecord}function s electRecord(lastRecord,newRecord){if(lastRecord===newRecord)return lastRecord;if (recordWithOldValue&&recordRepresentsCurrentMutation(lastRecord))return recordWi thOldValue;return null}function Registration(observer,target,options){this.obser ver=observer;this.target=target;this.options=options;this.transientObservedNodes =[]}Registration.prototype={enqueue:function(record){var records=this.observer.r ecords_;var length=records.length;if(records.length>0){var lastRecord=records[le ngth-1];var recordToReplaceLast=selectRecord(lastRecord,record);if(recordToRepla ceLast){records[length-1]=recordToReplaceLast;return}}else{scheduleCallback(this .observer)}records[length]=record},addListeners:function(){this.addListeners_(th is.target)},addListeners_:function(node){var options=this.options;if(options.att ributes)node.addEventListener("DOMAttrModified",this,true);if(options.characterD ata)node.addEventListener("DOMCharacterDataModified",this,true);if(options.child List)node.addEventListener("DOMNodeInserted",this,true);if(options.childList||op tions.subtree)node.addEventListener("DOMNodeRemoved",this,true)},removeListeners :function(){this.removeListeners_(this.target)},removeListeners_:function(node){ var options=this.options;if(options.attributes)node.removeEventListener("DOMAttr Modified",this,true);if(options.characterData)node.removeEventListener("DOMChara cterDataModified",this,true);if(options.childList)node.removeEventListener("DOMN odeInserted",this,true);if(options.childList||options.subtree)node.removeEventLi stener("DOMNodeRemoved",this,true)},addTransientObserver:function(node){if(node= ==this.target)return;this.addListeners_(node);this.transientObservedNodes.push(n ode);var registrations=registrationsTable.get(node);if(!registrations)registrati onsTable.set(node,registrations=[]);registrations.push(this)},removeTransientObs ervers:function(){var transientObservedNodes=this.transientObservedNodes;this.tr ansientObservedNodes=[];transientObservedNodes.forEach(function(node){this.remov eListeners_(node);var registrations=registrationsTable.get(node);for(var i=0;i<r egistrations.length;i++){if(registrations[i]===this){registrations.splice(i,1);b reak}}},this)},handleEvent:function(e){e.stopImmediatePropagation();switch(e.typ e){case"DOMAttrModified":var name=e.attrName;var namespace=e.relatedNode.namespa ceURI;var target=e.target;var record=new getRecord("attributes",target);record.a ttributeName=name;record.attributeNamespace=namespace;var oldValue=e.attrChange= ==MutationEvent.ADDITION?null:e.prevValue;forEachAncestorAndObserverEnqueueRecor d(target,function(options){if(!options.attributes)return;if(options.attributeFil ter&&options.attributeFilter.length&&options.attributeFilter.indexOf(name)===-1& &options.attributeFilter.indexOf(namespace)===-1){return}if(options.attributeOld Value)return getRecordWithOldValue(oldValue);return record});break;case"DOMChara cterDataModified":var target=e.target;var record=getRecord("characterData",targe t);var oldValue=e.prevValue;forEachAncestorAndObserverEnqueueRecord(target,funct ion(options){if(!options.characterData)return;if(options.characterDataOldValue)r eturn getRecordWithOldValue(oldValue);return record});break;case"DOMNodeRemoved" :this.addTransientObserver(e.target);case"DOMNodeInserted":var target=e.relatedN ode;var changedNode=e.target;var addedNodes,removedNodes;if(e.type==="DOMNodeIns erted"){addedNodes=[changedNode];removedNodes=[]}else{addedNodes=[];removedNodes =[changedNode]}var previousSibling=changedNode.previousSibling;var nextSibling=c hangedNode.nextSibling;var record=getRecord("childList",target);record.addedNode s=addedNodes;record.removedNodes=removedNodes;record.previousSibling=previousSib ling;record.nextSibling=nextSibling;forEachAncestorAndObserverEnqueueRecord(targ et,function(options){if(!options.childList)return;return record})}clearRecords() }};global.JsMutationObserver=JsMutationObserver;if(!global.MutationObserver)glob al.MutationObserver=JsMutationObserver})(this);window.HTMLImports=window.HTMLImp orts||{flags:{}};(function(scope){var IMPORT_LINK_TYPE="import";var useNative=Bo olean(IMPORT_LINK_TYPE in document.createElement("link"));var hasShadowDOMPolyfi ll=Boolean(window.ShadowDOMPolyfill);var wrap=function(node){return hasShadowDOM Polyfill?ShadowDOMPolyfill.wrapIfNeeded(node):node};var rootDocument=wrap(docume nt);var currentScriptDescriptor={get:function(){var script=HTMLImports.currentSc ript||document.currentScript||(document.readyState!=="complete"?document.scripts [document.scripts.length-1]:null);return wrap(script)},configurable:true};Object .defineProperty(document,"_currentScript",currentScriptDescriptor);Object.define Property(rootDocument,"_currentScript",currentScriptDescriptor);var isIE=/Triden t/.test(navigator.userAgent);function whenReady(callback,doc){doc=doc||rootDocum ent;whenDocumentReady(function(){watchImportsLoad(callback,doc)},doc)}var requir edReadyState=isIE?"complete":"interactive";var READY_EVENT="readystatechange";fu nction isDocumentReady(doc){return doc.readyState==="complete"||doc.readyState== =requiredReadyState}function whenDocumentReady(callback,doc){if(!isDocumentReady (doc)){var checkReady=function(){if(doc.readyState==="complete"||doc.readyState= ==requiredReadyState){doc.removeEventListener(READY_EVENT,checkReady);whenDocume ntReady(callback,doc)}};doc.addEventListener(READY_EVENT,checkReady)}else if(cal lback){callback()}}function markTargetLoaded(event){event.target.__loaded=true}f unction watchImportsLoad(callback,doc){var imports=doc.querySelectorAll("link[re l=import]");var loaded=0,l=imports.length;function checkDone(d){if(loaded==l&&ca llback){callback()}}function loadedImport(e){markTargetLoaded(e);loaded++;checkD one()}if(l){for(var i=0,imp;i<l&&(imp=imports[i]);i++){if(isImportLoaded(imp)){l oadedImport.call(imp,{target:imp})}else{imp.addEventListener("load",loadedImport );imp.addEventListener("error",loadedImport)}}}else{checkDone()}}function isImpo rtLoaded(link){return useNative?link.__loaded||link.import&&link.import.readySta te!=="loading":link.__importParsed}if(useNative){new MutationObserver(function(m xns){for(var i=0,l=mxns.length,m;i<l&&(m=mxns[i]);i++){if(m.addedNodes){handleIm ports(m.addedNodes)}}}).observe(document.head,{childList:true});function handleI mports(nodes){for(var i=0,l=nodes.length,n;i<l&&(n=nodes[i]);i++){if(isImport(n) ){handleImport(n)}}}function isImport(element){return element.localName==="link" &&element.rel==="import"}function handleImport(element){var loaded=element.impor t;if(loaded){markTargetLoaded({target:element})}else{element.addEventListener("l oad",markTargetLoaded);element.addEventListener("error",markTargetLoaded)}}(func tion(){if(document.readyState==="loading"){var imports=document.querySelectorAll ("link[rel=import]");for(var i=0,l=imports.length,imp;i<l&&(imp=imports[i]);i++) {handleImport(imp)}}})()}whenReady(function(){HTMLImports.ready=true;HTMLImports .readyTime=(new Date).getTime();rootDocument.dispatchEvent(new CustomEvent("HTML ImportsLoaded",{bubbles:true}))});scope.IMPORT_LINK_TYPE=IMPORT_LINK_TYPE;scope. useNative=useNative;scope.rootDocument=rootDocument;scope.whenReady=whenReady;sc ope.isIE=isIE})(HTMLImports);(function(scope){var modules=[];var addModule=funct ion(module){modules.push(module)};var initializeModules=function(){modules.forEa ch(function(module){module(scope)})};scope.addModule=addModule;scope.initializeM odules=initializeModules})(HTMLImports);HTMLImports.addModule(function(scope){va r CSS_URL_REGEXP=/(url\()([^)]*)(\))/g;var CSS_IMPORT_REGEXP=/(@import[\s]+(?!ur l\())([^;]*)(;)/g;var path={resolveUrlsInStyle:function(style){var doc=style.own erDocument;var resolver=doc.createElement("a");style.textContent=this.resolveUrl sInCssText(style.textContent,resolver);return style},resolveUrlsInCssText:functi on(cssText,urlObj){var r=this.replaceUrls(cssText,urlObj,CSS_URL_REGEXP);r=this. replaceUrls(r,urlObj,CSS_IMPORT_REGEXP);return r},replaceUrls:function(text,urlO bj,regexp){return text.replace(regexp,function(m,pre,url,post){var urlPath=url.r eplace(/["']/g,"");urlObj.href=urlPath;urlPath=urlObj.href;return pre+"'"+urlPat h+"'"+post})}};scope.path=path});HTMLImports.addModule(function(scope){xhr={asyn c:true,ok:function(request){return request.status>=200&&request.status<300||requ est.status===304||request.status===0},load:function(url,next,nextContext){var re quest=new XMLHttpRequest;if(scope.flags.debug||scope.flags.bust){url+="?"+Math.r andom()}request.open("GET",url,xhr.async);request.addEventListener("readystatech ange",function(e){if(request.readyState===4){var locationHeader=request.getRespo nseHeader("Location");var redirectedUrl=null;if(locationHeader){var redirectedUr l=locationHeader.substr(0,1)==="/"?location.origin+locationHeader:locationHeader }next.call(nextContext,!xhr.ok(request)&&request,request.response||request.respo nseText,redirectedUrl)}});request.send();return request},loadDocument:function(u rl,next,nextContext){this.load(url,next,nextContext).responseType="document"}};s cope.xhr=xhr});HTMLImports.addModule(function(scope){var xhr=scope.xhr;var flags =scope.flags;var Loader=function(onLoad,onComplete){this.cache={};this.onload=on Load;this.oncomplete=onComplete;this.inflight=0;this.pending={}};Loader.prototyp e={addNodes:function(nodes){this.inflight+=nodes.length;for(var i=0,l=nodes.leng th,n;i<l&&(n=nodes[i]);i++){this.require(n)}this.checkDone()},addNode:function(n ode){this.inflight++;this.require(node);this.checkDone()},require:function(elt){ var url=elt.src||elt.href;elt.__nodeUrl=url;if(!this.dedupe(url,elt)){this.fetch (url,elt)}},dedupe:function(url,elt){if(this.pending[url]){this.pending[url].pus h(elt);return true}var resource;if(this.cache[url]){this.onload(url,elt,this.cac he[url]);this.tail();return true}this.pending[url]=[elt];return false},fetch:fun ction(url,elt){flags.load&&console.log("fetch",url,elt);if(url.match(/^data:/)){ var pieces=url.split(",");var header=pieces[0];var body=pieces[1];if(header.inde xOf(";base64")>-1){body=atob(body)}else{body=decodeURIComponent(body)}setTimeout (function(){this.receive(url,elt,null,body)}.bind(this),0)}else{var receiveXhr=f unction(err,resource,redirectedUrl){this.receive(url,elt,err,resource,redirected Url)}.bind(this);xhr.load(url,receiveXhr)}},receive:function(url,elt,err,resourc e,redirectedUrl){this.cache[url]=resource;var $p=this.pending[url];for(var i=0,l =$p.length,p;i<l&&(p=$p[i]);i++){this.onload(url,p,resource,err,redirectedUrl);t his.tail()}this.pending[url]=null},tail:function(){--this.inflight;this.checkDon e()},checkDone:function(){if(!this.inflight){this.oncomplete()}}};scope.Loader=L oader});HTMLImports.addModule(function(scope){var Observer=function(addCallback) {this.addCallback=addCallback;this.mo=new MutationObserver(this.handler.bind(thi s))};Observer.prototype={handler:function(mutations){for(var i=0,l=mutations.len gth,m;i<l&&(m=mutations[i]);i++){if(m.type==="childList"&&m.addedNodes.length){t his.addedNodes(m.addedNodes)}}},addedNodes:function(nodes){if(this.addCallback){ this.addCallback(nodes)}for(var i=0,l=nodes.length,n,loading;i<l&&(n=nodes[i]);i ++){if(n.children&&n.children.length){this.addedNodes(n.children)}}},observe:fun ction(root){this.mo.observe(root,{childList:true,subtree:true})}};scope.Observer =Observer});HTMLImports.addModule(function(scope){var path=scope.path;var rootDo cument=scope.rootDocument;var flags=scope.flags;var isIE=scope.isIE;var IMPORT_L INK_TYPE=scope.IMPORT_LINK_TYPE;var IMPORT_SELECTOR="link[rel="+IMPORT_LINK_TYPE +"]";var importParser={documentSelectors:IMPORT_SELECTOR,importsSelectors:[IMPOR T_SELECTOR,"link[rel=stylesheet]","style","script:not([type])",'script[type="tex t/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"par seStyle"},dynamicElements:[],parseNext:function(){var next=this.nextToParse();if (next){this.parse(next)}},parse:function(elt){if(this.isParsed(elt)){flags.parse &&console.log("[%s] is already parsed",elt.localName);return}var fn=this[this.ma p[elt.localName]];if(fn){this.markParsing(elt);fn.call(this,elt)}},parseDynamic: function(elt,quiet){this.dynamicElements.push(elt);if(!quiet){this.parseNext()}} ,markParsing:function(elt){flags.parse&&console.log("parsing",elt);this.parsingE lement=elt},markParsingComplete:function(elt){elt.__importParsed=true;this.markD ynamicParsingComplete(elt);if(elt.__importElement){elt.__importElement.__importP arsed=true;this.markDynamicParsingComplete(elt.__importElement)}this.parsingElem ent=null;flags.parse&&console.log("completed",elt)},markDynamicParsingComplete:f unction(elt){var i=this.dynamicElements.indexOf(elt);if(i>=0){this.dynamicElemen ts.splice(i,1)}},parseImport:function(elt){if(HTMLImports.__importsParsingHook){ HTMLImports.__importsParsingHook(elt)}if(elt.import){elt.import.__importParsed=t rue}this.markParsingComplete(elt);if(elt.__resource&&!elt.__error){elt.dispatchE vent(new CustomEvent("load",{bubbles:false}))}else{elt.dispatchEvent(new CustomE vent("error",{bubbles:false}))}if(elt.__pending){var fn;while(elt.__pending.leng th){fn=elt.__pending.shift();if(fn){fn({target:elt})}}}this.parseNext()},parseLi nk:function(linkElt){if(nodeIsImport(linkElt)){this.parseImport(linkElt)}else{li nkElt.href=linkElt.href;this.parseGeneric(linkElt)}},parseStyle:function(elt){va r src=elt;elt=cloneStyle(elt);elt.__importElement=src;this.parseGeneric(elt)},pa rseGeneric:function(elt){this.trackElement(elt);this.addElementToDocument(elt)}, rootImportForElement:function(elt){var n=elt;while(n.ownerDocument.__importLink) {n=n.ownerDocument.__importLink}return n},addElementToDocument:function(elt){var port=this.rootImportForElement(elt.__importElement||elt);var l=port.__insertedE lements=port.__insertedElements||0;var refNode=port.nextElementSibling;for(var i =0;i<l;i++){refNode=refNode&&refNode.nextElementSibling}port.parentNode.insertBe fore(elt,refNode)},trackElement:function(elt,callback){var self=this;var done=fu nction(e){if(callback){callback(e)}self.markParsingComplete(elt);self.parseNext( )};elt.addEventListener("load",done);elt.addEventListener("error",done);if(isIE& &elt.localName==="style"){var fakeLoad=false;if(elt.textContent.indexOf("@import ")==-1){fakeLoad=true}else if(elt.sheet){fakeLoad=true;var csr=elt.sheet.cssRule s;var len=csr?csr.length:0;for(var i=0,r;i<len&&(r=csr[i]);i++){if(r.type===CSSR ule.IMPORT_RULE){fakeLoad=fakeLoad&&Boolean(r.styleSheet)}}}if(fakeLoad){elt.dis patchEvent(new CustomEvent("load",{bubbles:false}))}}},parseScript:function(scri ptElt){var script=document.createElement("script");script.__importElement=script Elt;script.src=scriptElt.src?scriptElt.src:generateScriptDataUrl(scriptElt);scop e.currentScript=scriptElt;this.trackElement(script,function(e){script.parentNode .removeChild(script);scope.currentScript=null});this.addElementToDocument(script )},nextToParse:function(){this._mayParse=[];return!this.parsingElement&&(this.ne xtToParseInDoc(rootDocument)||this.nextToParseDynamic())},nextToParseInDoc:funct ion(doc,link){if(doc&&this._mayParse.indexOf(doc)<0){this._mayParse.push(doc);va r nodes=doc.querySelectorAll(this.parseSelectorsForNode(doc));for(var i=0,l=node s.length,p=0,n;i<l&&(n=nodes[i]);i++){if(!this.isParsed(n)){if(this.hasResource( n)){return nodeIsImport(n)?this.nextToParseInDoc(n.import,n):n}else{return}}}}re turn link},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSe lectorsForNode:function(node){var doc=node.ownerDocument||node;return doc===root Document?this.documentSelectors:this.importsSelectors},isParsed:function(node){r eturn node.__importParsed},needsDynamicParsing:function(elt){return this.dynamic Elements.indexOf(elt)>=0},hasResource:function(node){if(nodeIsImport(node)&&node .import===undefined){return false}return true}};function nodeIsImport(elt){retur n elt.localName==="link"&&elt.rel===IMPORT_LINK_TYPE}function generateScriptData Url(script){var scriptContent=generateScriptContent(script);return"data:text/jav ascript;charset=utf-8,"+encodeURIComponent(scriptContent)}function generateScrip tContent(script){return script.textContent+generateSourceMapHint(script)}functio n generateSourceMapHint(script){var owner=script.ownerDocument;owner.__importedS cripts=owner.__importedScripts||0;var moniker=script.ownerDocument.baseURI;var n um=owner.__importedScripts?"-"+owner.__importedScripts:"";owner.__importedScript s++;return"\n//# sourceURL="+moniker+num+".js\n"}function cloneStyle(style){var clone=style.ownerDocument.createElement("style");clone.textContent=style.textCon tent;path.resolveUrlsInStyle(clone);return clone}scope.parser=importParser;scope .IMPORT_SELECTOR=IMPORT_SELECTOR});HTMLImports.addModule(function(scope){var fla gs=scope.flags;var IMPORT_LINK_TYPE=scope.IMPORT_LINK_TYPE;var IMPORT_SELECTOR=s cope.IMPORT_SELECTOR;var rootDocument=scope.rootDocument;var Loader=scope.Loader ;var Observer=scope.Observer;var parser=scope.parser;var importer={documents:{}, documentPreloadSelectors:IMPORT_SELECTOR,importsPreloadSelectors:[IMPORT_SELECTO R].join(","),loadNode:function(node){importLoader.addNode(node)},loadSubtree:fun ction(parent){var nodes=this.marshalNodes(parent);importLoader.addNodes(nodes)}, marshalNodes:function(parent){return parent.querySelectorAll(this.loadSelectorsF orNode(parent))},loadSelectorsForNode:function(node){var doc=node.ownerDocument| |node;return doc===rootDocument?this.documentPreloadSelectors:this.importsPreloa dSelectors},loaded:function(url,elt,resource,err,redirectedUrl){flags.load&&cons ole.log("loaded",url,elt);elt.__resource=resource;elt.__error=err;if(isImportLin k(elt)){var doc=this.documents[url];if(doc===undefined){doc=err?null:makeDocumen t(resource,redirectedUrl||url);if(doc){doc.__importLink=elt;this.bootDocument(do c)}this.documents[url]=doc}elt.import=doc}parser.parseNext()},bootDocument:funct ion(doc){this.loadSubtree(doc);this.observer.observe(doc);parser.parseNext()},lo adedAll:function(){parser.parseNext()}};var importLoader=new Loader(importer.loa ded.bind(importer),importer.loadedAll.bind(importer));importer.observer=new Obse rver;function isImportLink(elt){return isLinkRel(elt,IMPORT_LINK_TYPE)}function isLinkRel(elt,rel){return elt.localName==="link"&&elt.getAttribute("rel")===rel} function makeDocument(resource,url){var doc=document.implementation.createHTMLDo cument(IMPORT_LINK_TYPE);doc._URL=url;var base=doc.createElement("base");base.se tAttribute("href",url);if(!doc.baseURI){doc.baseURI=url}var meta=doc.createEleme nt("meta");meta.setAttribute("charset","utf-8");doc.head.appendChild(meta);doc.h ead.appendChild(base);doc.body.innerHTML=resource;if(window.HTMLTemplateElement& &HTMLTemplateElement.bootstrap){HTMLTemplateElement.bootstrap(doc)}return doc}if (!document.baseURI){var baseURIDescriptor={get:function(){var base=document.quer ySelector("base");return base?base.href:window.location.href},configurable:true} ;Object.defineProperty(document,"baseURI",baseURIDescriptor);Object.defineProper ty(rootDocument,"baseURI",baseURIDescriptor)}scope.importer=importer;scope.impor tLoader=importLoader});HTMLImports.addModule(function(scope){var parser=scope.pa rser;var importer=scope.importer;var dynamic={added:function(nodes){var owner,pa rsed;for(var i=0,l=nodes.length,n;i<l&&(n=nodes[i]);i++){if(!owner){owner=n.owne rDocument;parsed=parser.isParsed(owner)}loading=this.shouldLoadNode(n);if(loadin g){importer.loadNode(n)}if(this.shouldParseNode(n)&&parsed){parser.parseDynamic( n,loading)}}},shouldLoadNode:function(node){return node.nodeType===1&&matches.ca ll(node,importer.loadSelectorsForNode(node))},shouldParseNode:function(node){ret urn node.nodeType===1&&matches.call(node,parser.parseSelectorsForNode(node))}};i mporter.observer.addCallback=dynamic.added.bind(dynamic);var matches=HTMLElement .prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype .webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.pr ototype.msMatchesSelector});(function(scope){initializeModules=scope.initializeM odules;if(scope.useNative){return}if(typeof window.CustomEvent!=="function"){win dow.CustomEvent=function(inType,dictionary){var e=document.createEvent("HTMLEven ts");e.initEvent(inType,dictionary.bubbles===false?false:true,dictionary.cancela ble===false?false:true,dictionary.detail);return e}}initializeModules();var root Document=scope.rootDocument;function bootstrap(){HTMLImports.importer.bootDocume nt(rootDocument)}if(document.readyState==="complete"||document.readyState==="int eractive"&&!window.attachEvent){bootstrap()}else{document.addEventListener("DOMC ontentLoaded",bootstrap)}})(HTMLImports);window.CustomElements=window.CustomElem ents||{flags:{}};(function(scope){var flags=scope.flags;var modules=[];var addMo dule=function(module){modules.push(module)};var initializeModules=function(){mod ules.forEach(function(module){module(scope)})};scope.addModule=addModule;scope.i nitializeModules=initializeModules;scope.hasNative=Boolean(document.registerElem ent);scope.useNative=!flags.register&&scope.hasNative&&!window.ShadowDOMPolyfill &&(!window.HTMLImports||HTMLImports.useNative)})(CustomElements);CustomElements. addModule(function(scope){var IMPORT_LINK_TYPE=window.HTMLImports?HTMLImports.IM PORT_LINK_TYPE:"none";function forSubtree(node,cb){findAllElements(node,function (e){if(cb(e)){return true}forRoots(e,cb)});forRoots(node,cb)}function findAllEle ments(node,find,data){var e=node.firstElementChild;if(!e){e=node.firstChild;whil e(e&&e.nodeType!==Node.ELEMENT_NODE){e=e.nextSibling}}while(e){if(find(e,data)!= =true){findAllElements(e,find,data)}e=e.nextElementSibling}return null}function forRoots(node,cb){var root=node.shadowRoot;while(root){forSubtree(root,cb);root= root.olderShadowRoot}}var processingDocuments;function forDocumentTree(doc,cb){p rocessingDocuments=[];_forDocumentTree(doc,cb);processingDocuments=null}function _forDocumentTree(doc,cb){doc=wrap(doc);if(processingDocuments.indexOf(doc)>=0){ return
14 }processingDocuments.push(doc);var imports=doc.querySelectorAll("link[rel="+IMPO RT_LINK_TYPE+"]");for(var i=0,l=imports.length,n;i<l&&(n=imports[i]);i++){if(n.i mport){_forDocumentTree(n.import,cb)}}cb(doc)}scope.forDocumentTree=forDocumentT ree;scope.forSubtree=forSubtree});CustomElements.addModule(function(scope){var f lags=scope.flags;var forSubtree=scope.forSubtree;var forDocumentTree=scope.forDo cumentTree;function addedNode(node){return added(node)||addedSubtree(node)}funct ion added(node){if(scope.upgrade(node)){return true}attached(node)}function adde dSubtree(node){forSubtree(node,function(e){if(added(e)){return true}})}function attachedNode(node){attached(node);if(inDocument(node)){forSubtree(node,function( e){attached(e)})}}var hasPolyfillMutations=!window.MutationObserver||window.Muta tionObserver===window.JsMutationObserver;scope.hasPolyfillMutations=hasPolyfillM utations;var isPendingMutations=false;var pendingMutations=[];function deferMuta tion(fn){pendingMutations.push(fn);if(!isPendingMutations){isPendingMutations=tr ue;setTimeout(takeMutations)}}function takeMutations(){isPendingMutations=false; var $p=pendingMutations;for(var i=0,l=$p.length,p;i<l&&(p=$p[i]);i++){p()}pendin gMutations=[]}function attached(element){if(hasPolyfillMutations){deferMutation( function(){_attached(element)})}else{_attached(element)}}function _attached(elem ent){if(element.__upgraded__&&(element.attachedCallback||element.detachedCallbac k)){if(!element.__attached&&inDocument(element)){element.__attached=true;if(elem ent.attachedCallback){element.attachedCallback()}}}}function detachedNode(node){ detached(node);forSubtree(node,function(e){detached(e)})}function detached(eleme nt){if(hasPolyfillMutations){deferMutation(function(){_detached(element)})}else{ _detached(element)}}function _detached(element){if(element.__upgraded__&&(elemen t.attachedCallback||element.detachedCallback)){if(element.__attached&&!inDocumen t(element)){element.__attached=false;if(element.detachedCallback){element.detach edCallback()}}}}function inDocument(element){var p=element;var doc=wrap(document );while(p){if(p==doc){return true}p=p.parentNode||p.host}}function watchShadow(n ode){if(node.shadowRoot&&!node.shadowRoot.__watched){flags.dom&&console.log("wat ching shadow-root for: ",node.localName);var root=node.shadowRoot;while(root){ob serve(root);root=root.olderShadowRoot}}}function handler(mutations){if(flags.dom ){var mx=mutations[0];if(mx&&mx.type==="childList"&&mx.addedNodes){if(mx.addedNo des){var d=mx.addedNodes[0];while(d&&d!==document&&!d.host){d=d.parentNode}var u =d&&(d.URL||d._URL||d.host&&d.host.localName)||"";u=u.split("/?").shift().split( "/").pop()}}console.group("mutations (%d) [%s]",mutations.length,u||"")}mutation s.forEach(function(mx){if(mx.type==="childList"){forEach(mx.addedNodes,function( n){if(!n.localName){return}addedNode(n)});forEach(mx.removedNodes,function(n){if (!n.localName){return}detachedNode(n)})}});flags.dom&&console.groupEnd()}functio n takeRecords(node){node=wrap(node);if(!node){node=wrap(document)}while(node.par entNode){node=node.parentNode}var observer=node.__observer;if(observer){handler( observer.takeRecords());takeMutations()}}var forEach=Array.prototype.forEach.cal l.bind(Array.prototype.forEach);function observe(inRoot){if(inRoot.__observer){r eturn}var observer=new MutationObserver(handler);observer.observe(inRoot,{childL ist:true,subtree:true});inRoot.__observer=observer}function upgradeDocument(doc) {doc=wrap(doc);flags.dom&&console.group("upgradeDocument: ",doc.baseURI.split("/ ").pop());addedNode(doc);observe(doc);flags.dom&&console.groupEnd()}function upg radeDocumentTree(doc){forDocumentTree(doc,upgradeDocument)}var originalCreateSha dowRoot=Element.prototype.createShadowRoot;Element.prototype.createShadowRoot=fu nction(){var root=originalCreateShadowRoot.call(this);CustomElements.watchShadow (this);return root};scope.watchShadow=watchShadow;scope.upgradeDocumentTree=upgr adeDocumentTree;scope.upgradeSubtree=addedSubtree;scope.upgradeAll=addedNode;sco pe.attachedNode=attachedNode;scope.takeRecords=takeRecords});CustomElements.addM odule(function(scope){var flags=scope.flags;function upgrade(node){if(!node.__up graded__&&node.nodeType===Node.ELEMENT_NODE){var is=node.getAttribute("is");var definition=scope.getRegisteredDefinition(is||node.localName);if(definition){if(i s&&definition.tag==node.localName){return upgradeWithDefinition(node,definition) }else if(!is&&!definition.extends){return upgradeWithDefinition(node,definition) }}}}function upgradeWithDefinition(element,definition){flags.upgrade&&console.gr oup("upgrade:",element.localName);if(definition.is){element.setAttribute("is",de finition.is)}implementPrototype(element,definition);element.__upgraded__=true;cr eated(element);scope.attachedNode(element);scope.upgradeSubtree(element);flags.u pgrade&&console.groupEnd();return element}function implementPrototype(element,de finition){if(Object.__proto__){element.__proto__=definition.prototype}else{custo mMixin(element,definition.prototype,definition.native);element.__proto__=definit ion.prototype}}function customMixin(inTarget,inSrc,inNative){var used={};var p=i nSrc;while(p!==inNative&&p!==HTMLElement.prototype){var keys=Object.getOwnProper tyNames(p);for(var i=0,k;k=keys[i];i++){if(!used[k]){Object.defineProperty(inTar get,k,Object.getOwnPropertyDescriptor(p,k));used[k]=1}}p=Object.getPrototypeOf(p )}}function created(element){if(element.createdCallback){element.createdCallback ()}}scope.upgrade=upgrade;scope.upgradeWithDefinition=upgradeWithDefinition;scop e.implementPrototype=implementPrototype});CustomElements.addModule(function(scop e){var upgradeDocumentTree=scope.upgradeDocumentTree;var upgrade=scope.upgrade;v ar upgradeWithDefinition=scope.upgradeWithDefinition;var implementPrototype=scop e.implementPrototype;var useNative=scope.useNative;function register(name,option s){var definition=options||{};if(!name){throw new Error("document.registerElemen t: first argument `name` must not be empty")}if(name.indexOf("-")<0){throw new E rror("document.registerElement: first argument ('name') must contain a dash ('-' ). Argument provided was '"+String(name)+"'.")}if(isReservedTag(name)){throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed f or type '"+String(name)+"'. The type name is invalid.")}if(getRegisteredDefiniti on(name)){throw new Error("DuplicateDefinitionError: a type with name '"+String( name)+"' is already registered")}if(!definition.prototype){definition.prototype= Object.create(HTMLElement.prototype)}definition.__name=name.toLowerCase();defini tion.lifecycle=definition.lifecycle||{};definition.ancestry=ancestry(definition. extends);resolveTagName(definition);resolvePrototypeChain(definition);overrideAt tributeApi(definition.prototype);registerDefinition(definition.__name,definition );definition.ctor=generateConstructor(definition);definition.ctor.prototype=defi nition.prototype;definition.prototype.constructor=definition.ctor;if(scope.ready ){upgradeDocumentTree(document)}return definition.ctor}function overrideAttribut eApi(prototype){if(prototype.setAttribute._polyfilled){return}var setAttribute=p rototype.setAttribute;prototype.setAttribute=function(name,value){changeAttribut e.call(this,name,value,setAttribute)};var removeAttribute=prototype.removeAttrib ute;prototype.removeAttribute=function(name){changeAttribute.call(this,name,null ,removeAttribute)};prototype.setAttribute._polyfilled=true}function changeAttrib ute(name,value,operation){name=name.toLowerCase();var oldValue=this.getAttribute (name);operation.apply(this,arguments);var newValue=this.getAttribute(name);if(t his.attributeChangedCallback&&newValue!==oldValue){this.attributeChangedCallback (name,oldValue,newValue)}}function isReservedTag(name){for(var i=0;i<reservedTag List.length;i++){if(name===reservedTagList[i]){return true}}}var reservedTagList =["annotation-xml","color-profile","font-face","font-face-src","font-face-uri"," font-face-format","font-face-name","missing-glyph"];function ancestry(extnds){va r extendee=getRegisteredDefinition(extnds);if(extendee){return ancestry(extendee .extends).concat([extendee])}return[]}function resolveTagName(definition){var ba seTag=definition.extends;for(var i=0,a;a=definition.ancestry[i];i++){baseTag=a.i s&&a.tag}definition.tag=baseTag||definition.__name;if(baseTag){definition.is=def inition.__name}}function resolvePrototypeChain(definition){if(!Object.__proto__) {var nativePrototype=HTMLElement.prototype;if(definition.is){var inst=document.c reateElement(definition.tag);var expectedPrototype=Object.getPrototypeOf(inst);i f(expectedPrototype===definition.prototype){nativePrototype=expectedPrototype}}v ar proto=definition.prototype,ancestor;while(proto&&proto!==nativePrototype){anc estor=Object.getPrototypeOf(proto);proto.__proto__=ancestor;proto=ancestor}defin ition.native=nativePrototype}}function instantiate(definition){return upgradeWit hDefinition(domCreateElement(definition.tag),definition)}var registry={};functio n getRegisteredDefinition(name){if(name){return registry[name.toLowerCase()]}}fu nction registerDefinition(name,definition){registry[name]=definition}function ge nerateConstructor(definition){return function(){return instantiate(definition)}} var HTML_NAMESPACE="http://www.w3.org/1999/xhtml";function createElementNS(names pace,tag,typeExtension){if(namespace===HTML_NAMESPACE){return createElement(tag, typeExtension)}else{return domCreateElementNS(namespace,tag)}}function createEle ment(tag,typeExtension){var definition=getRegisteredDefinition(typeExtension||ta g);if(definition){if(tag==definition.tag&&typeExtension==definition.is){return n ew definition.ctor}if(!typeExtension&&!definition.is){return new definition.ctor }}var element;if(typeExtension){element=createElement(tag);element.setAttribute( "is",typeExtension);return element}element=domCreateElement(tag);if(tag.indexOf( "-")>=0){implementPrototype(element,HTMLElement)}return element}function cloneNo de(deep){var n=domCloneNode.call(this,deep);upgrade(n);return n}var domCreateEle ment=document.createElement.bind(document);var domCreateElementNS=document.creat eElementNS.bind(document);var domCloneNode=Node.prototype.cloneNode;var isInstan ce;if(!Object.__proto__&&!useNative){isInstance=function(obj,ctor){var p=obj;whi le(p){if(p===ctor.prototype){return true}p=p.__proto__}return false}}else{isInst ance=function(obj,base){return obj instanceof base}}document.registerElement=reg ister;document.createElement=createElement;document.createElementNS=createElemen tNS;Node.prototype.cloneNode=cloneNode;scope.registry=registry;scope.instanceof= isInstance;scope.reservedTagList=reservedTagList;scope.getRegisteredDefinition=g etRegisteredDefinition;document.register=document.registerElement});(function(sc ope){var useNative=scope.useNative;var initializeModules=scope.initializeModules ;if(useNative){var nop=function(){};scope.watchShadow=nop;scope.upgrade=nop;scop e.upgradeAll=nop;scope.upgradeDocumentTree=nop;scope.upgradeSubtree=nop;scope.ta keRecords=nop;scope.instanceof=function(obj,base){return obj instanceof base}}el se{initializeModules()}var upgradeDocumentTree=scope.upgradeDocumentTree;if(!win dow.wrap){if(window.ShadowDOMPolyfill){window.wrap=ShadowDOMPolyfill.wrapIfNeede d;window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded}else{window.wrap=window.unwrap= function(node){return node}}}function bootstrap(){upgradeDocumentTree(wrap(docum ent));if(window.HTMLImports){HTMLImports.__importsParsingHook=function(elt){upgr adeDocumentTree(wrap(elt.import))}}CustomElements.ready=true;setTimeout(function (){CustomElements.readyTime=Date.now();if(window.HTMLImports){CustomElements.ela psed=CustomElements.readyTime-HTMLImports.readyTime}document.dispatchEvent(new C ustomEvent("WebComponentsReady",{bubbles:true}))})}if(typeof window.CustomEvent! =="function"){window.CustomEvent=function(inType,params){params=params||{};var e =document.createEvent("CustomEvent");e.initCustomEvent(inType,Boolean(params.bub bles),Boolean(params.cancelable),params.detail);return e};window.CustomEvent.pro totype=window.Event.prototype}if(document.readyState==="complete"||scope.flags.e ager){bootstrap()}else if(document.readyState==="interactive"&&!window.attachEve nt&&(!window.HTMLImports||window.HTMLImports.ready)){bootstrap()}else{var loadEv ent=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded ";window.addEventListener(loadEvent,bootstrap)}})(window.CustomElements);(functi on(scope){if(!Function.prototype.bind){Function.prototype.bind=function(scope){v ar self=this;var args=Array.prototype.slice.call(arguments,1);return function(){ var args2=args.slice();args2.push.apply(args2,arguments);return self.apply(scope ,args2)}}}})(window.WebComponents);(function(scope){"use strict";if(!window.perf ormance){var start=Date.now();window.performance={now:function(){return Date.now ()-start}}}if(!window.requestAnimationFrame){window.requestAnimationFrame=functi on(){var nativeRaf=window.webkitRequestAnimationFrame||window.mozRequestAnimatio nFrame;return nativeRaf?function(callback){return nativeRaf(function(){callback( performance.now())})}:function(callback){return window.setTimeout(callback,1e3/6 0)}}()}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(){r eturn window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||functio n(id){clearTimeout(id)}}()}var elementDeclarations=[];var polymerStub=function(n ame,dictionary){if(typeof name!=="string"&&arguments.length===1){Array.prototype .push.call(arguments,document._currentScript)}elementDeclarations.push(arguments )};window.Polymer=polymerStub;scope.consumeDeclarations=function(callback){scope .consumeDeclarations=function(){throw"Possible attempt to load Polymer twice"};i f(callback){callback(elementDeclarations)}elementDeclarations=null};function ins tallPolymerWarning(){if(window.Polymer===polymerStub){window.Polymer=function(){ throw new Error("You tried to use polymer without loading it first. To "+'load p olymer, <link rel="import" href="'+'components/polymer/polymer.html">')}}}if(HTM LImports.useNative){installPolymerWarning()}else{addEventListener("DOMContentLoa ded",installPolymerWarning)}})(window.WebComponents);(function(scope){var style= document.createElement("style");style.textContent=""+"body {"+"transition: opaci ty ease-in 0.2s;"+" } \n"+"body[unresolved] {"+"opacity: 0; display: block; over flow: hidden; position: relative;"+" } \n";var head=document.querySelector("head ");head.insertBefore(style,head.firstChild)})(window.WebComponents);(function(sc ope){window.Platform=scope})(window.WebComponents);</script><style shim-shadowdo m="">html /deep/ [layout][horizontal],html /deep/ [layout][vertical]{display:-ms -flexbox;display:-webkit-flex;display:flex}html /deep/ [layout][horizontal][inli ne],html /deep/ [layout][vertical][inline]{display:-ms-inline-flexbox;display:-w ebkit-inline-flex;display:inline-flex}html /deep/ [layout][horizontal]{-ms-flex- direction:row;-webkit-flex-direction:row;flex-direction:row}html /deep/ [layout] [horizontal][reverse]{-ms-flex-direction:row-reverse;-webkit-flex-direction:row- reverse;flex-direction:row-reverse}html /deep/ [layout][vertical]{-ms-flex-direc tion:column;-webkit-flex-direction:column;flex-direction:column}html /deep/ [lay out][vertical][reverse]{-ms-flex-direction:column-reverse;-webkit-flex-direction :column-reverse;flex-direction:column-reverse}html /deep/ [layout][wrap]{-ms-fle x-wrap:wrap;-webkit-flex-wrap:wrap;flex-wrap:wrap}html /deep/ [layout][wrap-reve rse]{-ms-flex-wrap:wrap-reverse;-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-re verse}html /deep/ [flex]{-ms-flex:1 1 0;-webkit-flex:1;flex:1;-webkit-flex-basis :0;flex-basis:0}html /deep/ [vertical][layout]>[flex][auto-vertical],html /deep/ [vertical][layout]::shadow [flex][auto-vertical]{-ms-flex:1 1 auto;-webkit-flex -basis:auto;flex-basis:auto}html /deep/ [flex][auto]{-ms-flex:1 1 auto;-webkit-f lex-basis:auto;flex-basis:auto}html /deep/ [flex][none]{-ms-flex:none;-webkit-fl ex:none;flex:none}html /deep/ [flex][one]{-ms-flex:1;-webkit-flex:1;flex:1}html /deep/ [flex][two]{-ms-flex:2;-webkit-flex:2;flex:2}html /deep/ [flex][three]{-m s-flex:3;-webkit-flex:3;flex:3}html /deep/ [flex][four]{-ms-flex:4;-webkit-flex: 4;flex:4}html /deep/ [flex][five]{-ms-flex:5;-webkit-flex:5;flex:5}html /deep/ [ flex][six]{-ms-flex:6;-webkit-flex:6;flex:6}html /deep/ [flex][seven]{-ms-flex:7 ;-webkit-flex:7;flex:7}html /deep/ [flex][eight]{-ms-flex:8;-webkit-flex:8;flex: 8}html /deep/ [flex][nine]{-ms-flex:9;-webkit-flex:9;flex:9}html /deep/ [flex][t en]{-ms-flex:10;-webkit-flex:10;flex:10}html /deep/ [flex][eleven]{-ms-flex:11;- webkit-flex:11;flex:11}html /deep/ [flex][twelve]{-ms-flex:12;-webkit-flex:12;fl ex:12}html /deep/ [layout][start]{-ms-flex-align:start;-webkit-align-items:flex- start;align-items:flex-start}html /deep/ [layout][center],html /deep/ [layout][c enter-center]{-ms-flex-align:center;-webkit-align-items:center;align-items:cente r}html /deep/ [layout][end]{-ms-flex-align:end;-webkit-align-items:flex-end;alig n-items:flex-end}html /deep/ [layout][start-justified]{-ms-flex-pack:start;-webk it-justify-content:flex-start;justify-content:flex-start}html /deep/ [layout][ce nter-justified],html /deep/ [layout][center-center]{-ms-flex-pack:center;-webkit -justify-content:center;justify-content:center}html /deep/ [layout][end-justifie d]{-ms-flex-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}h tml /deep/ [layout][around-justified]{-ms-flex-pack:distribute;-webkit-justify-c ontent:space-around;justify-content:space-around}html /deep/ [layout][justified] {-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:spa ce-between}html /deep/ [self-start]{-ms-align-self:flex-start;-webkit-align-self :flex-start;align-self:flex-start}html /deep/ [self-center]{-ms-align-self:cente r;-webkit-align-self:center;align-self:center}html /deep/ [self-end]{-ms-align-s elf:flex-end;-webkit-align-self:flex-end;align-self:flex-end}html /deep/ [self-s tretch]{-ms-align-self:stretch;-webkit-align-self:stretch;align-self:stretch}htm l /deep/ [block]{display:block}html /deep/ [hidden]{display:none!important}html /deep/ [relative]{position:relative}html /deep/ [fit]{position:absolute;top:0;ri ght:0;bottom:0;left:0}body[fullbleed]{margin:0;height:100vh}html /deep/ [segment ],html /deep/ segment{display:block;position:relative;-webkit-box-sizing:border- box;-ms-box-sizing:border-box;box-sizing:border-box;margin:1em .5em;padding:1em; background-color:#fff;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.1);box-shadow:0 0 0 1px rgba(0,0,0,.1);border-radius:5px 5px 5px 5px}</style><script>window.Polym erGestures={};(function(scope){var HAS_FULL_PATH=false;var pathTest=document.cre ateElement("meta");if(pathTest.createShadowRoot){var sr=pathTest.createShadowRoo t();var s=document.createElement("span");sr.appendChild(s);pathTest.addEventList ener("testpath",function(ev){if(ev.path){HAS_FULL_PATH=ev.path[0]===s}ev.stopPro pagation()});var ev=new CustomEvent("testpath",{bubbles:true});document.head.app endChild(pathTest);s.dispatchEvent(ev);pathTest.parentNode.removeChild(pathTest) ;sr=s=null}pathTest=null;var target={shadow:function(inEl){if(inEl){return inEl. shadowRoot||inEl.webkitShadowRoot}},canTarget:function(shadow){return shadow&&Bo olean(shadow.elementFromPoint)},targetingShadow:function(inEl){var s=this.shadow (inEl);if(this.canTarget(s)){return s}},olderShadow:function(shadow){var os=shad ow.olderShadowRoot;if(!os){var se=shadow.querySelector("shadow");if(se){os=se.ol derShadowRoot}}return os},allShadows:function(element){var shadows=[],s=this.sha dow(element);while(s){shadows.push(s);s=this.olderShadow(s)}return shadows},sear chRoot:function(inRoot,x,y){var t,st,sr,os;if(inRoot){t=inRoot.elementFromPoint( x,y);if(t){sr=this.targetingShadow(t)}else if(inRoot!==document){sr=this.olderSh adow(inRoot)}return this.searchRoot(sr,x,y)||t}},owner:function(element){if(!ele ment){return document}var s=element;while(s.parentNode){s=s.parentNode}if(s.node Type!=Node.DOCUMENT_NODE&&s.nodeType!=Node.DOCUMENT_FRAGMENT_NODE){s=document}re turn s},findTarget:function(inEvent){if(HAS_FULL_PATH&&inEvent.path&&inEvent.pat h.length){return inEvent.path[0]}var x=inEvent.clientX,y=inEvent.clientY;var s=t his.owner(inEvent.target);if(!s.elementFromPoint(x,y)){s=document}return this.se archRoot(s,x,y)},findTouchAction:function(inEvent){var n;if(HAS_FULL_PATH&&inEve nt.path&&inEvent.path.length){var path=inEvent.path;for(var i=0;i<path.length;i+ +){n=path[i];if(n.nodeType===Node.ELEMENT_NODE&&n.hasAttribute("touch-action")){ return n.getAttribute("touch-action")}}}else{n=inEvent.target;while(n){if(n.node Type===Node.ELEMENT_NODE&&n.hasAttribute("touch-action")){return n.getAttribute( "touch-action")}n=n.parentNode||n.host}}return"auto"},LCA:function(a,b){if(a===b ){return a}if(a&&!b){return a}if(b&&!a){return b}if(!b&&!a){return document}if(a .contains&&a.contains(b)){return a}if(b.contains&&b.contains(a)){return b}var ad epth=this.depth(a);var bdepth=this.depth(b);var d=adepth-bdepth;if(d>=0){a=this. walk(a,d)}else{b=this.walk(b,-d)}while(a&&b&&a!==b){a=a.parentNode||a.host;b=b.p arentNode||b.host}return a},walk:function(n,u){for(var i=0;n&&i<u;i++){n=n.paren tNode||n.host}return n},depth:function(n){var d=0;while(n){d++;n=n.parentNode||n .host}return d},deepContains:function(a,b){var common=this.LCA(a,b);return commo n===a},insideNode:function(node,x,y){var rect=node.getBoundingClientRect();retur n rect.left<=x&&x<=rect.right&&rect.top<=y&&y<=rect.bottom},path:function(event) {var p;if(HAS_FULL_PATH&&event.path&&event.path.length){p=event.path}else{p=[];v ar n=this.findTarget(event);while(n){p.push(n);n=n.parentNode||n.host}}return p} };scope.targetFinding=target;scope.findTarget=target.findTarget.bind(target);sco pe.deepContains=target.deepContains.bind(target);scope.insideNode=target.insideN ode})(window.PolymerGestures);(function(){function shadowSelector(v){return"html /deep/ "+selector(v)}function selector(v){return'[touch-action="'+v+'"]'}functi on rule(v){return"{ -ms-touch-action: "+v+"; touch-action: "+v+";}"}var attrib2c ss=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y"," pan-y pan-x"]},"manipulation"];var styles="";var hasTouchAction=typeof document. head.style.touchAction==="string";var hasShadowRoot=!window.ShadowDOMPolyfill&&d ocument.head.createShadowRoot;if(hasTouchAction){attrib2css.forEach(function(r){ if(String(r)===r){styles+=selector(r)+rule(r)+"\n";if(hasShadowRoot){styles+=sha dowSelector(r)+rule(r)+"\n"}}else{styles+=r.selectors.map(selector)+rule(r.rule) +"\n";if(hasShadowRoot){styles+=r.selectors.map(shadowSelector)+rule(r.rule)+"\n "}}});var el=document.createElement("style");el.textContent=styles;document.head .appendChild(el)}})();(function(scope){var MOUSE_PROPS=["bubbles","cancelable"," view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shift Key","metaKey","button","relatedTarget","pageX","pageY"];var MOUSE_DEFAULTS=[fal se,false,null,null,0,0,0,0,false,false,false,false,0,null,0,0];var NOP_FACTORY=f unction(){return function(){}};var eventFactory={preventTap:NOP_FACTORY,makeBase Event:function(inType,inDict){var e=document.createEvent("Event");e.initEvent(in Type,inDict.bubbles||false,inDict.cancelable||false);e.preventTap=eventFactory.p reventTap(e);return e},makeGestureEvent:function(inType,inDict){inDict=inDict||O bject.create(null);var e=this.makeBaseEvent(inType,inDict);for(var i=0,keys=Obje ct.keys(inDict),k;i<keys.length;i++){k=keys[i];e[k]=inDict[k]}return e},makePoin terEvent:function(inType,inDict){inDict=inDict||Object.create(null);var e=this.m akeBaseEvent(inType,inDict);for(var i=0,p;i<MOUSE_PROPS.length;i++){p=MOUSE_PROP S[i];e[p]=inDict[p]||MOUSE_DEFAULTS[i]}e.buttons=inDict.buttons||0;var pressure= 0;if(inDict.pressure){pressure=inDict.pressure}else{pressure=e.buttons?.5:0}e.x= e.clientX;e.y=e.clientY;e.pointerId=inDict.pointerId||0;e.width=inDict.width||0; e.height=inDict.height||0;e.pressure=pressure;e.tiltX=inDict.tiltX||0;e.tiltY=in Dict.tiltY||0;e.pointerType=inDict.pointerType||"";e.hwTimestamp=inDict.hwTimest amp||0;e.isPrimary=inDict.isPrimary||false;e._source=inDict._source||"";return e }};scope.eventFactory=eventFactory})(window.PolymerGestures);(function(scope){va r USE_MAP=window.Map&&window.Map.prototype.forEach;var POINTERS_FN=function(){re turn this.size};function PointerMap(){if(USE_MAP){var m=new Map;m.pointers=POINT ERS_FN;return m}else{this.keys=[];this.values=[]}}PointerMap.prototype={set:func tion(inId,inEvent){var i=this.keys.indexOf(inId);if(i>-1){this.values[i]=inEvent }else{this.keys.push(inId);this.values.push(inEvent)}},has:function(inId){return this.keys.indexOf(inId)>-1},"delete":function(inId){var i=this.keys.indexOf(inI d);if(i>-1){this.keys.splice(i,1);this.values.splice(i,1)}},get:function(inId){v ar i=this.keys.indexOf(inId);return this.values[i]},clear:function(){this.keys.l ength=0;this.values.length=0},forEach:function(callback,thisArg){this.values.for Each(function(v,i){callback.call(thisArg,v,this.keys[i],this)},this)},pointers:f unction(){return this.keys.length}};scope.PointerMap=PointerMap})(window.Polymer Gestures);(function(scope){var CLONE_PROPS=["bubbles","cancelable","view","detai l","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKe y","button","relatedTarget","buttons","pointerId","width","height","pressure","t iltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTa rget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"] ;var CLONE_DEFAULTS=[false,false,null,null,0,0,0,0,false,false,false,false,0,nul l,0,0,0,0,0,0,0,"",0,false,"",null,null,0,0,0,0,function(){},false];var HAS_SVG_ INSTANCE=typeof SVGElementInstance!=="undefined";var eventFactory=scope.eventFac tory;var currentGestures;var dispatcher={IS_IOS:false,pointermap:new scope.Point erMap,requiredGestures:new scope.PointerMap,eventMap:Object.create(null),eventSo urces:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{li steners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:fu nction(name,source){var s=source;var newEvents=s.events;if(newEvents){newEvents. forEach(function(e){if(s[e]){this.eventMap[e]=s[e].bind(s)}},this);this.eventSou rces[name]=s;this.eventSourceList.push(s)}},registerGesture:function(name,source ){var obj=Object.create(null);obj.listeners=0;obj.index=this.gestures.length;for (var i=0,g;i<source.exposes.length;i++){g=source.exposes[i].toLowerCase();this.d ependencyMap[g]=obj}this.gestures.push(source)},register:function(element,initia l){var l=this.eventSourceList.length;for(var i=0,es;i<l&&(es=this.eventSourceLis t[i]);i++){es.register.call(es,element,initial)}},unregister:function(element){v ar l=this.eventSourceList.length;for(var i=0,es;i<l&&(es=this.eventSourceList[i] );i++){es.unregister.call(es,element)}},down:function(inEvent){this.requiredGest ures.set(inEvent.pointerId,currentGestures);this.fireEvent("down",inEvent)},move :function(inEvent){inEvent.type="move";this.fillGestureQueue(inEvent)},up:functi on(inEvent){this.fireEvent("up",inEvent);this.requiredGestures.delete(inEvent.po interId)},cancel:function(inEvent){inEvent.tapPrevented=true;this.fireEvent("up" ,inEvent);this.requiredGestures.delete(inEvent.pointerId)},addGestureDependency: function(node,currentGestures){var gesturesWanted=node._pgEvents;if(gesturesWant ed&&currentGestures){var gk=Object.keys(gesturesWanted);for(var i=0,r,ri,g;i<gk. length;i++){g=gk[i];if(gesturesWanted[g]>0){r=this.dependencyMap[g];ri=r?r.index :-1;currentGestures[ri]=true}}}},eventHandler:function(inEvent){var type=inEvent .type;if(type==="touchstart"||type==="mousedown"||type==="pointerdown"||type===" MSPointerDown"){if(!inEvent._handledByPG){currentGestures={}}if(this.IS_IOS){var ev=inEvent;if(type==="touchstart"){var ct=inEvent.changedTouches[0];ev={target: inEvent.target,clientX:ct.clientX,clientY:ct.clientY,path:inEvent.path}}var node s=inEvent.path||scope.targetFinding.path(ev);for(var i=0,n;i<nodes.length;i++){n =nodes[i];this.addGestureDependency(n,currentGestures)}}else{this.addGestureDepe ndency(inEvent.currentTarget,currentGestures)}}if(inEvent._handledByPG){return}v ar fn=this.eventMap&&this.eventMap[type];if(fn){fn(inEvent)}inEvent._handledByPG =true},listen:function(target,events){for(var i=0,l=events.length,e;i<l&&(e=even ts[i]);i++){this.addEvent(target,e)}},unlisten:function(target,events){for(var i =0,l=events.length,e;i<l&&(e=events[i]);i++){this.removeEvent(target,e)}},addEve nt:function(target,eventName){target.addEventListener(eventName,this.boundHandle r)},removeEvent:function(target,eventName){target.removeEventListener(eventName, this.boundHandler)},makeEvent:function(inType,inEvent){var e=eventFactory.makePo interEvent(inType,inEvent);e.preventDefault=inEvent.preventDefault;e.tapPrevente d=inEvent.tapPrevented;e._target=e._target||inEvent.target;return e},fireEvent:f unction(inType,inEvent){var e=this.makeEvent(inType,inEvent);return this.dispatc hEvent(e)},cloneEvent:function(inEvent){var eventCopy=Object.create(null),p;for( var i=0;i<CLONE_PROPS.length;i++){p=CLONE_PROPS[i];eventCopy[p]=inEvent[p]||CLON E_DEFAULTS[i];if(p==="target"||p==="relatedTarget"){if(HAS_SVG_INSTANCE&&eventCo py[p]instanceof SVGElementInstance){eventCopy[p]=eventCopy[p].correspondingUseEl ement}}}eventCopy.preventDefault=function(){inEvent.preventDefault()};return eve ntCopy},dispatchEvent:function(inEvent){var t=inEvent._target;if(t){t.dispatchEv ent(inEvent);var clone=this.cloneEvent(inEvent);clone.target=t;this.fillGestureQ ueue(clone)}},gestureTrigger:function(){for(var i=0,e,rg;i<this.gestureQueue.len gth;i++){e=this.gestureQueue[i];rg=e._requiredGestures;if(rg){for(var j=0,g,fn;j <this.gestures.length;j++){if(rg[j]){g=this.gestures[j];fn=g[e.type];if(fn){fn.c all(g,e)}}}}}this.gestureQueue.length=0},fillGestureQueue:function(ev){if(!this. gestureQueue.length){requestAnimationFrame(this.boundGestureTrigger)}ev._require dGestures=this.requiredGestures.get(ev.pointerId);this.gestureQueue.push(ev)}};d ispatcher.boundHandler=dispatcher.eventHandler.bind(dispatcher);dispatcher.bound GestureTrigger=dispatcher.gestureTrigger.bind(dispatcher);scope.dispatcher=dispa tcher;scope.activateGesture=function(node,gesture){var g=gesture.toLowerCase();v ar dep=dispatcher.dependencyMap[g];if(dep){var recognizer=dispatcher.gestures[de p.index];if(!node._pgListeners){dispatcher.register(node);node._pgListeners=0}if (recognizer){var touchAction=recognizer.defaultActions&&recognizer.defaultAction s[g];var actionNode;switch(node.nodeType){case Node.ELEMENT_NODE:actionNode=node ;break;case Node.DOCUMENT_FRAGMENT_NODE:actionNode=node.host;break;default:actio nNode=null;break}if(touchAction&&actionNode&&!actionNode.hasAttribute("touch-act ion")){actionNode.setAttribute("touch-action",touchAction)}}if(!node._pgEvents){ node._pgEvents={}}node._pgEvents[g]=(node._pgEvents[g]||0)+1;node._pgListeners++ }return Boolean(dep)};scope.addEventListener=function(node,gesture,handler,captu re){if(handler){scope.activateGesture(node,gesture);node.addEventListener(gestur e,handler,capture)}};scope.deactivateGesture=function(node,gesture){var g=gestur e.toLowerCase();var dep=dispatcher.dependencyMap[g];if(dep){if(node._pgListeners >0){node._pgListeners--}if(node._pgListeners===0){dispatcher.unregister(node)}if (node._pgEvents){if(node._pgEvents[g]>0){node._pgEvents[g]--}else{node._pgEvents [g]=0}}}return Boolean(dep)};scope.removeEventListener=function(node,gesture,han dler,capture){if(handler){scope.deactivateGesture(node,gesture);node.removeEvent Listener(gesture,handler,capture)}}})(window.PolymerGestures);(function(scope){v ar dispatcher=scope.dispatcher;var pointermap=dispatcher.pointermap;var DEDUP_DI ST=25;var WHICH_TO_BUTTONS=[0,1,4,2];var CURRENT_BUTTONS=0;var HAS_BUTTONS=false ;try{HAS_BUTTONS=new MouseEvent("test",{buttons:1}).buttons===1}catch(e){}var mo useEvents={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mo useup"],exposes:["down","up","move"],register:function(target){dispatcher.listen (target,this.events)},unregister:function(target){if(target===document){return}d ispatcher.unlisten(target,this.events)},lastTouches:[],isEventSimulatedFromTouch :function(inEvent){var lts=this.lastTouches;var x=inEvent.clientX,y=inEvent.clie ntY;for(var i=0,l=lts.length,t;i<l&&(t=lts[i]);i++){var dx=Math.abs(x-t.x),dy=Ma th.abs(y-t.y);if(dx<=DEDUP_DIST&&dy<=DEDUP_DIST){return true}}},prepareEvent:fun ction(inEvent){var e=dispatcher.cloneEvent(inEvent);e.pointerId=this.POINTER_ID; e.isPrimary=true;e.pointerType=this.POINTER_TYPE;e._source="mouse";if(!HAS_BUTTO NS){var type=inEvent.type;var bit=WHICH_TO_BUTTONS[inEvent.which]||0;if(type===" mousedown"){CURRENT_BUTTONS|=bit}else if(type==="mouseup"){CURRENT_BUTTONS&=~bit }e.buttons=CURRENT_BUTTONS}return e},mousedown:function(inEvent){if(!this.isEven tSimulatedFromTouch(inEvent)){var p=pointermap.has(this.POINTER_ID);var e=this.p repareEvent(inEvent);e.target=scope.findTarget(inEvent);pointermap.set(this.POIN TER_ID,e.target);dispatcher.down(e)}},mousemove:function(inEvent){if(!this.isEve ntSimulatedFromTouch(inEvent)){var target=pointermap.get(this.POINTER_ID);if(tar get){var e=this.prepareEvent(inEvent);e.target=target;if((HAS_BUTTONS?e.buttons: e.which)===0){if(!HAS_BUTTONS){CURRENT_BUTTONS=e.buttons=0}dispatcher.cancel(e); this.cleanupMouse(e.buttons)}else{dispatcher.move(e)}}}},mouseup:function(inEven t){if(!this.isEventSimulatedFromTouch(inEvent)){var e=this.prepareEvent(inEvent) ;e.relatedTarget=scope.findTarget(inEvent);e.target=pointermap.get(this.POINTER_ ID);dispatcher.up(e);this.cleanupMouse(e.buttons)}},cleanupMouse:function(button s){if(buttons===0){pointermap.delete(this.POINTER_ID)}}};scope.mouseEvents=mouse Events})(window.PolymerGestures);(function(scope){var dispatcher=scope.dispatche r;var allShadows=scope.targetFinding.allShadows.bind(scope.targetFinding);var po intermap=dispatcher.pointermap;var touchMap=Array.prototype.map.call.bind(Array. prototype.map);var DEDUP_TIMEOUT=2500;var DEDUP_DIST=25;var CLICK_COUNT_TIMEOUT= 200;var HYSTERESIS=20;var ATTRIB="touch-action";var HAS_TOUCH_ACTION=false;var t ouchEvents={IS_IOS:false,events:["touchstart","touchmove","touchend","touchcance l"],exposes:["down","up","move"],register:function(target,initial){if(this.IS_IO S?initial:!initial){dispatcher.listen(target,this.events)}},unregister:function( target){if(!this.IS_IOS){dispatcher.unlisten(target,this.events)}},scrollTypes:{ EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:func tion(touchAction){var t=touchAction;var st=this.scrollTypes;if(t===st.EMITTER){r eturn"none"}else if(t===st.XSCROLLER){return"X"}else if(t===st.YSCROLLER){return "Y"}else{return"XY"}},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:functi on(inTouch){return this.firstTouch===inTouch.identifier},setPrimaryTouch:functio n(inTouch){if(pointermap.pointers()===0||pointermap.pointers()===1&&pointermap.h as(1)){this.firstTouch=inTouch.identifier;this.firstXY={X:inTouch.clientX,Y:inTo uch.clientY};this.firstTarget=inTouch.target;this.scrolling=null;this.cancelRese tClickCount()}},removePrimaryPointer:function(inPointer){if(inPointer.isPrimary) {this.firstTouch=null;this.firstXY=null;this.resetClickCount()}},clickCount:0,re setId:null,resetClickCount:function(){var fn=function(){this.clickCount=0;this.r esetId=null}.bind(this);this.resetId=setTimeout(fn,CLICK_COUNT_TIMEOUT)},cancelR esetClickCount:function(){if(this.resetId){clearTimeout(this.resetId)}},typeToBu ttons:function(type){var ret=0;if(type==="touchstart"||type==="touchmove"){ret=1 }return ret},findTarget:function(touch,id){if(this.currentTouchEvent.type==="tou chstart"){if(this.isPrimaryTouch(touch)){var fastPath={clientX:touch.clientX,cli entY:touch.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEven t.target};return scope.findTarget(fastPath)}else{return scope.findTarget(touch)} }return pointermap.get(id)},touchToPointer:function(inTouch){var cte=this.curren tTouchEvent;var e=dispatcher.cloneEvent(inTouch);var id=e.pointerId=inTouch.iden tifier+2;e.target=this.findTarget(inTouch,id);e.bubbles=true;e.cancelable=true;e .detail=this.clickCount;e.buttons=this.typeToButtons(cte.type);e.width=inTouch.w ebkitRadiusX||inTouch.radiusX||0;e.height=inTouch.webkitRadiusY||inTouch.radiusY ||0;e.pressure=inTouch.webkitForce||inTouch.force||.5;e.isPrimary=this.isPrimary Touch(inTouch);e.pointerType=this.POINTER_TYPE;e._source="touch";var self=this;e .preventDefault=function(){self.scrolling=false;self.firstXY=null;cte.preventDef ault()};return e},processTouches:function(inEvent,inFunction){var tl=inEvent.cha ngedTouches;this.currentTouchEvent=inEvent;for(var i=0,t,p;i<tl.length;i++){t=tl [i];p=this.touchToPointer(t);if(inEvent.type==="touchstart"){pointermap.set(p.po interId,p.target)}if(pointermap.has(p.pointerId)){inFunction.call(this,p)}if(inE vent.type==="touchend"||inEvent._cancel){this.cleanUpPointer(p)}}},shouldScroll: function(inEvent){if(this.firstXY){var ret;var touchAction=scope.targetFinding.f indTouchAction(inEvent);var scrollAxis=this.touchActionToScrollType(touchAction) ;if(scrollAxis==="none"){ret=false}else if(scrollAxis==="XY"){ret=true}else{var t=inEvent.changedTouches[0];var a=scrollAxis;var oa=scrollAxis==="Y"?"X":"Y";var da=Math.abs(t["client"+a]-this.firstXY[a]);var doa=Math.abs(t["client"+oa]-this .firstXY[oa]);ret=da>=doa}return ret}},findTouch:function(inTL,inId){for(var i=0 ,l=inTL.length,t;i<l&&(t=inTL[i]);i++){if(t.identifier===inId){return true}}},va cuumTouches:function(inEvent){var tl=inEvent.touches;if(pointermap.pointers()>=t l.length){var d=[];pointermap.forEach(function(value,key){if(key!==1&&!this.find Touch(tl,key-2)){var p=value;d.push(p)}},this);d.forEach(function(p){this.cancel (p);pointermap.delete(p.pointerId)})}},touchstart:function(inEvent){this.vacuumT ouches(inEvent);this.setPrimaryTouch(inEvent.changedTouches[0]);this.dedupSynthM ouse(inEvent);if(!this.scrolling){this.clickCount++;this.processTouches(inEvent, this.down)}},down:function(inPointer){dispatcher.down(inPointer)},touchmove:func tion(inEvent){if(HAS_TOUCH_ACTION){if(inEvent.cancelable){this.processTouches(in Event,this.move)}}else{if(!this.scrolling){if(this.scrolling===null&&this.should Scroll(inEvent)){this.scrolling=true}else{this.scrolling=false;inEvent.preventDe fault();this.processTouches(inEvent,this.move)}}else if(this.firstXY){var t=inEv ent.changedTouches[0];var dx=t.clientX-this.firstXY.X;var dy=t.clientY-this.firs tXY.Y;var dd=Math.sqrt(dx*dx+dy*dy);if(dd>=HYSTERESIS){this.touchcancel(inEvent) ;this.scrolling=true;this.firstXY=null}}}},move:function(inPointer){dispatcher.m ove(inPointer)},touchend:function(inEvent){this.dedupSynthMouse(inEvent);this.pr ocessTouches(inEvent,this.up)},up:function(inPointer){inPointer.relatedTarget=sc ope.findTarget(inPointer);dispatcher.up(inPointer)},cancel:function(inPointer){d ispatcher.cancel(inPointer)},touchcancel:function(inEvent){inEvent._cancel=true; this.processTouches(inEvent,this.cancel)},cleanUpPointer:function(inPointer){poi ntermap["delete"](inPointer.pointerId);this.removePrimaryPointer(inPointer)},ded upSynthMouse:function(inEvent){var lts=scope.mouseEvents.lastTouches;var t=inEve nt.changedTouches[0];if(this.isPrimaryTouch(t)){var lt={x:t.clientX,y:t.clientY} ;lts.push(lt);var fn=function(lts,lt){var i=lts.indexOf(lt);if(i>-1){lts.splice( i,1)}}.bind(null,lts,lt);setTimeout(fn,DEDUP_TIMEOUT)}}};var STOP_PROP_FN=Event. prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.add EventListener("click",function(ev){var x=ev.clientX,y=ev.clientY;var closeTo=fun ction(touch){var dx=Math.abs(x-touch.x),dy=Math.abs(y-touch.y);return dx<=DEDUP_ DIST&&dy<=DEDUP_DIST};var wasTouched=scope.mouseEvents.lastTouches.some(closeTo) ;var path=scope.targetFinding.path(ev);if(wasTouched){for(var i=0;i<path.length; i++){if(path[i]===touchEvents.firstTarget){return}}ev.preventDefault();STOP_PROP _FN.call(ev)}},true);scope.touchEvents=touchEvents})(window.PolymerGestures);(fu nction(scope){var dispatcher=scope.dispatcher;var pointermap=dispatcher.pointerm ap;var HAS_BITMAP_TYPE=window.MSPointerEvent&&typeof window.MSPointerEvent.MSPOI NTER_TYPE_MOUSE==="number";var msEvents={events:["MSPointerDown","MSPointerMove" ,"MSPointerUp","MSPointerCancel"],register:function(target){dispatcher.listen(ta rget,this.events)},unregister:function(target){if(target===document){return}disp atcher.unlisten(target,this.events)},POINTER_TYPES:["","unavailable","touch","pe n","mouse"],prepareEvent:function(inEvent){var e=inEvent;e=dispatcher.cloneEvent (inEvent);if(HAS_BITMAP_TYPE){e.pointerType=this.POINTER_TYPES[inEvent.pointerTy pe]}e._source="ms";return e},cleanup:function(id){pointermap["delete"](id)},MSPo interDown:function(inEvent){var e=this.prepareEvent(inEvent);e.target=scope.find Target(inEvent);pointermap.set(inEvent.pointerId,e.target);dispatcher.down(e)},M SPointerMove:function(inEvent){var target=pointermap.get(inEvent.pointerId);if(t arget){var e=this.prepareEvent(inEvent);e.target=target;dispatcher.move(e)}},MSP ointerUp:function(inEvent){var e=this.prepareEvent(inEvent);e.relatedTarget=scop e.findTarget(inEvent);e.target=pointermap.get(e.pointerId);dispatcher.up(e);this .cleanup(inEvent.pointerId)},MSPointerCancel:function(inEvent){var e=this.prepar eEvent(inEvent);e.relatedTarget=scope.findTarget(inEvent);e.target=pointermap.ge t(e.pointerId);dispatcher.cancel(e);this.cleanup(inEvent.pointerId)}};scope.msEv ents=msEvents})(window.PolymerGestures);(function(scope){var dispatcher=scope.di spatcher;var pointermap=dispatcher.pointermap;var pointerEvents={events:["pointe rdown","pointermove","pointerup","pointercancel"],prepareEvent:function(inEvent) {var e=dispatcher.cloneEvent(inEvent);e._source="pointer";return e},register:fun ction(target){dispatcher.listen(target,this.events)},unregister:function(target) {if(target===document){return}dispatcher.unlisten(target,this.events)},cleanup:f unction(id){pointermap["delete"](id)},pointerdown:function(inEvent){var e=this.p repareEvent(inEvent);e.target=scope.findTarget(inEvent);pointermap.set(e.pointer Id,e.target);dispatcher.down(e)},pointermove:function(inEvent){var target=pointe rmap.get(inEvent.pointerId);if(target){var e=this.prepareEvent(inEvent);e.target =target;dispatcher.move(e)}},pointerup:function(inEvent){var e=this.prepareEvent (inEvent);e.relatedTarget=scope.findTarget(inEvent);e.target=pointermap.get(e.po interId);dispatcher.up(e);this.cleanup(inEvent.pointerId)},pointercancel:functio n(inEvent){var e=this.prepareEvent(inEvent);e.relatedTarget=scope.findTarget(inE vent);e.target=pointermap.get(e.pointerId);dispatcher.cancel(e);this.cleanup(inE vent.pointerId)}};scope.pointerEvents=pointerEvents})(window.PolymerGestures);(f unction(scope){var dispatcher=scope.dispatcher;var nav=window.navigator;if(windo w.PointerEvent){dispatcher.registerSource("pointer",scope.pointerEvents)}else if (nav.msPointerEnabled){dispatcher.registerSource("ms",scope.msEvents)}else{dispa tcher.registerSource("mouse",scope.mouseEvents);if(window.ontouchstart!==undefin ed){dispatcher.registerSource("touch",scope.touchEvents)}}var ua=navigator.userA gent;var IS_IOS=ua.match(/iPad|iPhone|iPod/)&&"ontouchstart"in window;dispatcher .IS_IOS=IS_IOS;scope.touchEvents.IS_IOS=IS_IOS;dispatcher.register(document,true )})(window.PolymerGestures);(function(scope){var dispatcher=scope.dispatcher;var eventFactory=scope.eventFactory;var pointermap=new scope.PointerMap;var track={ events:["down","move","up"],exposes:["trackstart","track","trackx","tracky","tra ckend"],defaultActions:{track:"none",trackx:"pan-y",tracky:"pan-x"},WIGGLE_THRES HOLD:4,clampDir:function(inDelta){return inDelta>0?1:-1},calcPositionDelta:funct ion(inA,inB){var x=0,y=0;if(inA&&inB){x=inB.pageX-inA.pageX;y=inB.pageY-inA.page Y}return{x:x,y:y}},fireTrack:function(inType,inEvent,inTrackingData){var t=inTra ckingData;var d=this.calcPositionDelta(t.downEvent,inEvent);var dd=this.calcPosi tionDelta(t.lastMoveEvent,inEvent);if(dd.x){t.xDirection=this.clampDir(dd.x)}els e if(inType==="trackx"){return}if(dd.y){t.yDirection=this.clampDir(dd.y)}else if (inType==="tracky"){return}var gestureProto={bubbles:true,cancelable:true,trackI nfo:t.trackInfo,relatedTarget:inEvent.relatedTarget,pointerType:inEvent.pointerT ype,pointerId:inEvent.pointerId,_source:"track"};if(inType!=="tracky"){gesturePr oto.x=inEvent.x;gestureProto.dx=d.x;gestureProto.ddx=dd.x;gestureProto.clientX=i nEvent.clientX;gestureProto.pageX=inEvent.pageX;gestureProto.screenX=inEvent.scr eenX;gestureProto.xDirection=t.xDirection}if(inType!=="trackx"){gestureProto.dy= d.y;gestureProto.ddy=dd.y;gestureProto.y=inEvent.y;gestureProto.clientY=inEvent. clientY;gestureProto.pageY=inEvent.pageY;gestureProto.screenY=inEvent.screenY;ge stureProto.yDirection=t.yDirection}var e=eventFactory.makeGestureEvent(inType,ge stureProto);t.downTarget.dispatchEvent(e)},down:function(inEvent){if(inEvent.isP rimary&&(inEvent.pointerType==="mouse"?inEvent.buttons===1:true)){var p={downEve nt:inEvent,downTarget:inEvent.target,trackInfo:{},lastMoveEvent:null,xDirection: 0,yDirection:0,tracking:false};pointermap.set(inEvent.pointerId,p)}},move:functi on(inEvent){var p=pointermap.get(inEvent.pointerId);if(p){if(!p.tracking){var d= this.calcPositionDelta(p.downEvent,inEvent);var move=d.x*d.x+d.y*d.y;if(move>thi s.WIGGLE_THRESHOLD){p.tracking=true;p.lastMoveEvent=p.downEvent;this.fireTrack(" trackstart",inEvent,p)}}if(p.tracking){this.fireTrack("track",inEvent,p);this.fi reTrack("trackx",inEvent,p);this.fireTrack("tracky",inEvent,p)}p.lastMoveEvent=i nEvent}},up:function(inEvent){var p=pointermap.get(inEvent.pointerId);if(p){if(p .tracking){this.fireTrack("trackend",inEvent,p)}pointermap.delete(inEvent.pointe rId)}}};dispatcher.registerGesture("track",track)})(window.PolymerGestures);(fun ction(scope){var dispatcher=scope.dispatcher;var eventFactory=scope.eventFactory ;var hold={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],expose s:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){ var hold=Date.now()-this.heldPointer.timeStamp;var type=this.held?"holdpulse":"h old";this.fireHold(type,hold);this.held=true},cancel:function(){clearInterval(th is.holdJob);if(this.held){this.fireHold("release")}this.held=false;this.heldPoin ter=null;this.target=null;this.holdJob=null},down:function(inEvent){if(inEvent.i sPrimary&&!this.heldPointer){this.heldPointer=inEvent;this.target=inEvent.target ;this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY)}},up:function(i nEvent){if(this.heldPointer&&this.heldPointer.pointerId===inEvent.pointerId){thi s.cancel()}},move:function(inEvent){if(this.heldPointer&&this.heldPointer.pointe rId===inEvent.pointerId){var x=inEvent.clientX-this.heldPointer.clientX;var y=in Event.clientY-this.heldPointer.clientY;if(x*x+y*y>this.WIGGLE_THRESHOLD){this.ca ncel()}}},fireHold:function(inType,inHoldTime){var p={bubbles:true,cancelable:tr ue,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId ,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};if(inHold Time){p.holdTime=inHoldTime}var e=eventFactory.makeGestureEvent(inType,p);this.t arget.dispatchEvent(e)}};dispatcher.registerGesture("hold",hold)})(window.Polyme rGestures);(function(scope){var dispatcher=scope.dispatcher;var eventFactory=sco pe.eventFactory;var pointermap=new scope.PointerMap;var tap={events:["down","up" ],exposes:["tap"],down:function(inEvent){if(inEvent.isPrimary&&!inEvent.tapPreve nted){pointermap.set(inEvent.pointerId,{target:inEvent.target,buttons:inEvent.bu ttons,x:inEvent.clientX,y:inEvent.clientY})}},shouldTap:function(e,downState){va r tap=true;if(e.pointerType==="mouse"){tap=e.buttons^1&&downState.buttons&1}retu rn tap&&!e.tapPrevented},up:function(inEvent){var start=pointermap.get(inEvent.p ointerId);if(start&&this.shouldTap(inEvent,start)){var t=scope.targetFinding.LCA (start.target,inEvent.relatedTarget);if(t){var e=eventFactory.makeGestureEvent(" tap",{bubbles:true,cancelable:true,x:inEvent.clientX,y:inEvent.clientY,detail:in Event.detail,pointerType:inEvent.pointerType,pointerId:inEvent.pointerId,altKey: inEvent.altKey,ctrlKey:inEvent.ctrlKey,metaKey:inEvent.metaKey,shiftKey:inEvent. shiftKey,_source:"tap"});t.dispatchEvent(e)}}pointermap.delete(inEvent.pointerId )}};eventFactory.preventTap=function(e){return function(){e.tapPrevented=true;po intermap.delete(e.pointerId)}};dispatcher.registerGesture("tap",tap)})(window.Po lymerGestures);(function(scope){var dispatcher=scope.dispatcher;var eventFactory =scope.eventFactory;var pointermap=new scope.PointerMap;var RAD_TO_DEG=180/Math. PI;var pinch={events:["down","up","move","cancel"],exposes:["pinch","rotate"],de faultActions:{pinch:"none",rotate:"none"},reference:{},down:function(inEvent){po intermap.set(inEvent.pointerId,inEvent);if(pointermap.pointers()==2){var points= this.calcChord();var angle=this.calcAngle(points);this.reference={angle:angle,di ameter:points.diameter,target:scope.targetFinding.LCA(points.a.target,points.b.t arget)}}},up:function(inEvent){var p=pointermap.get(inEvent.pointerId);if(p){poi ntermap.delete(inEvent.pointerId)}},move:function(inEvent){if(pointermap.has(inE vent.pointerId)){pointermap.set(inEvent.pointerId,inEvent);if(pointermap.pointer s()>1){this.calcPinchRotate()}}},cancel:function(inEvent){this.up(inEvent)},fire Pinch:function(diameter,points){var zoom=diameter/this.reference.diameter;var e= eventFactory.makeGestureEvent("pinch",{bubbles:true,cancelable:true,scale:zoom,c enterX:points.center.x,centerY:points.center.y,_source:"pinch"});this.reference. target.dispatchEvent(e)},fireRotate:function(angle,points){var diff=Math.round(( angle-this.reference.angle)%360);var e=eventFactory.makeGestureEvent("rotate",{b ubbles:true,cancelable:true,angle:diff,centerX:points.center.x,centerY:points.ce nter.y,_source:"pinch"});this.reference.target.dispatchEvent(e)},calcPinchRotate :function(){var points=this.calcChord();var diameter=points.diameter;var angle=t his.calcAngle(points);if(diameter!=this.reference.diameter){this.firePinch(diame ter,points)}if(angle!=this.reference.angle){this.fireRotate(angle,points)}},calc Chord:function(){var pointers=[];pointermap.forEach(function(p){pointers.push(p) });var dist=0;var points={a:pointers[0],b:pointers[1]};var x,y,d;for(var i=0;i<p ointers.length;i++){var a=pointers[i];for(var j=i+1;j<pointers.length;j++){var b =pointers[j];x=Math.abs(a.clientX-b.clientX);y=Math.abs(a.clientY-b.clientY);d=x +y;if(d>dist){dist=d;points={a:a,b:b}}}}x=Math.abs(points.a.clientX+points.b.cli entX)/2;y=Math.abs(points.a.clientY+points.b.clientY)/2;points.center={x:x,y:y}; points.diameter=dist;return points},calcAngle:function(points){var x=points.a.cl ientX-points.b.clientX;var y=points.a.clientY-points.b.clientY;return(360+Math.a tan2(y,x)*RAD_TO_DEG)%360
15 }};dispatcher.registerGesture("pinch",pinch)})(window.PolymerGestures);(function (global){"use strict";var Token,TokenName,Syntax,Messages,source,index,length,de legate,lookahead,state;Token={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,Null Literal:5,NumericLiteral:6,Punctuator:7,StringLiteral:8};TokenName={};TokenName[ Token.BooleanLiteral]="Boolean";TokenName[Token.EOF]="<end>";TokenName[Token.Ide ntifier]="Identifier";TokenName[Token.Keyword]="Keyword";TokenName[Token.NullLit eral]="Null";TokenName[Token.NumericLiteral]="Numeric";TokenName[Token.Punctuato r]="Punctuator";TokenName[Token.StringLiteral]="String";Syntax={ArrayExpression: "ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpres sion",ConditionalExpression:"ConditionalExpression",EmptyStatement:"EmptyStateme nt",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"L iteral",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression ",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Progra m:"Program",Property:"Property",ThisExpression:"ThisExpression",UnaryExpression: "UnaryExpression"};Messages={UnexpectedToken:"Unexpected token %0",UnknownLabel: "Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared"};functi on assert(condition,message){if(!condition){throw new Error("ASSERT: "+message)} }function isDecimalDigit(ch){return ch>=48&&ch<=57}function isWhiteSpace(ch){ret urn ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&" ᠎              ".i ndexOf(String.fromCharCode(ch))>0}function isLineTerminator(ch){return ch===10|| ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch===36||ch= ==95||ch>=65&&ch<=90||ch>=97&&ch<=122}function isIdentifierPart(ch){return ch=== 36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57}function isKeyword( id){return id==="this"}function skipWhitespace(){while(index<length&&isWhiteSpac e(source.charCodeAt(index))){++index}}function getIdentifier(){var start,ch;star t=index++;while(index<length){ch=source.charCodeAt(index);if(isIdentifierPart(ch )){++index}else{break}}return source.slice(start,index)}function scanIdentifier( ){var start,id,type;start=index;id=getIdentifier();if(id.length===1){type=Token. Identifier}else if(isKeyword(id)){type=Token.Keyword}else if(id==="null"){type=T oken.NullLiteral}else if(id==="true"||id==="false"){type=Token.BooleanLiteral}el se{type=Token.Identifier}return{type:type,value:id,range:[start,index]}}function scanPunctuator(){var start=index,code=source.charCodeAt(index),code2,ch1=source [index],ch2;switch(code){case 46:case 40:case 41:case 59:case 44:case 123:case 1 25:case 91:case 93:case 58:case 63:++index;return{type:Token.Punctuator,value:St ring.fromCharCode(code),range:[start,index]};default:code2=source.charCodeAt(ind ex+1);if(code2===61){switch(code){case 37:case 38:case 42:case 43:case 45:case 4 7:case 60:case 62:case 124:index+=2;return{type:Token.Punctuator,value:String.fr omCharCode(code)+String.fromCharCode(code2),range:[start,index]};case 33:case 61 :index+=2;if(source.charCodeAt(index)===61){++index}return{type:Token.Punctuator ,value:source.slice(start,index),range:[start,index]};default:break}}break}ch2=s ource[index+1];if(ch1===ch2&&"&|".indexOf(ch1)>=0){index+=2;return{type:Token.Pu nctuator,value:ch1+ch2,range:[start,index]}}if("<>=!+-*%&|^/".indexOf(ch1)>=0){+ +index;return{type:Token.Punctuator,value:ch1,range:[start,index]}}throwError({} ,Messages.UnexpectedToken,"ILLEGAL")}function scanNumericLiteral(){var number,st art,ch;ch=source[index];assert(isDecimalDigit(ch.charCodeAt(0))||ch===".","Numer ic literal must start with a decimal digit or a decimal point");start=index;numb er="";if(ch!=="."){number=source[index++];ch=source[index];if(number==="0"){if(c h&&isDecimalDigit(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILL EGAL")}}while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]} ch=source[index]}if(ch==="."){number+=source[index++];while(isDecimalDigit(sourc e.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="e"||ch== ="E"){number+=source[index++];ch=source[index];if(ch==="+"||ch==="-"){number+=so urce[index++]}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit( source.charCodeAt(index))){number+=source[index++]}}else{throwError({},Messages. UnexpectedToken,"ILLEGAL")}}if(isIdentifierStart(source.charCodeAt(index))){thro wError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,v alue:parseFloat(number),range:[start,index]}}function scanStringLiteral(){var st r="",quote,start,ch,octal=false;quote=source[index];assert(quote==="'"||quote=== '"',"String literal must starts with a quote");start=index;++index;while(index<l ength){ch=source[index++];if(ch===quote){quote="";break}else if(ch==="\\"){ch=so urce[index++];if(!ch||!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"n":st r+="\n";break;case"r":str+="\r";break;case"t":str+=" ";break;case"b":str+="\b ";break;case"f":str+="\f";break;case"v":str+=" ";break;default:str+=ch;break}}el se{if(ch==="\r"&&source[index]==="\n"){++index}}}else if(isLineTerminator(ch.cha rCodeAt(0))){break}else{str+=ch}}if(quote!==""){throwError({},Messages.Unexpecte dToken,"ILLEGAL")}return{type:Token.StringLiteral,value:str,octal:octal,range:[s tart,index]}}function isIdentifierName(token){return token.type===Token.Identifi er||token.type===Token.Keyword||token.type===Token.BooleanLiteral||token.type=== Token.NullLiteral}function advance(){var ch;skipWhitespace();if(index>=length){r eturn{type:Token.EOF,range:[index,index]}}ch=source.charCodeAt(index);if(ch===40 ||ch===41||ch===58){return scanPunctuator()}if(ch===39||ch===34){return scanStri ngLiteral()}if(isIdentifierStart(ch)){return scanIdentifier()}if(ch===46){if(isD ecimalDigit(source.charCodeAt(index+1))){return scanNumericLiteral()}return scan Punctuator()}if(isDecimalDigit(ch)){return scanNumericLiteral()}return scanPunct uator()}function lex(){var token;token=lookahead;index=token.range[1];lookahead= advance();index=token.range[1];return token}function peek(){var pos;pos=index;lo okahead=advance();index=pos}function throwError(token,messageFormat){var error,a rgs=Array.prototype.slice.call(arguments,2),msg=messageFormat.replace(/%(\d)/g,f unction(whole,index){assert(index<args.length,"Message reference must be in rang e");return args[index]});error=new Error(msg);error.index=index;error.descriptio n=msg;throw error}function throwUnexpected(token){throwError(token,Messages.Unex pectedToken,token.value)}function expect(value){var token=lex();if(token.type!== Token.Punctuator||token.value!==value){throwUnexpected(token)}}function match(va lue){return lookahead.type===Token.Punctuator&&lookahead.value===value}function matchKeyword(keyword){return lookahead.type===Token.Keyword&&lookahead.value===k eyword}function consumeSemicolon(){if(source.charCodeAt(index)===59){lex();retur n}skipWhitespace();if(match(";")){lex();return}if(lookahead.type!==Token.EOF&&!m atch("}")){throwUnexpected(lookahead)}}function parseArrayInitialiser(){var elem ents=[];expect("[");while(!match("]")){if(match(",")){lex();elements.push(null)} else{elements.push(parseExpression());if(!match("]")){expect(",")}}}expect("]"); return delegate.createArrayExpression(elements)}function parseObjectPropertyKey( ){var token;skipWhitespace();token=lex();if(token.type===Token.StringLiteral||to ken.type===Token.NumericLiteral){return delegate.createLiteral(token)}return del egate.createIdentifier(token.value)}function parseObjectProperty(){var token,key ;token=lookahead;skipWhitespace();if(token.type===Token.EOF||token.type===Token. Punctuator){throwUnexpected(token)}key=parseObjectPropertyKey();expect(":");retu rn delegate.createProperty("init",key,parseExpression())}function parseObjectIni tialiser(){var properties=[];expect("{");while(!match("}")){properties.push(pars eObjectProperty());if(!match("}")){expect(",")}}expect("}");return delegate.crea teObjectExpression(properties)}function parseGroupExpression(){var expr;expect(" (");expr=parseExpression();expect(")");return expr}function parsePrimaryExpressi on(){var type,token,expr;if(match("(")){return parseGroupExpression()}type=looka head.type;if(type===Token.Identifier){expr=delegate.createIdentifier(lex().value )}else if(type===Token.StringLiteral||type===Token.NumericLiteral){expr=delegate .createLiteral(lex())}else if(type===Token.Keyword){if(matchKeyword("this")){lex ();expr=delegate.createThisExpression()}}else if(type===Token.BooleanLiteral){to ken=lex();token.value=token.value==="true";expr=delegate.createLiteral(token)}el se if(type===Token.NullLiteral){token=lex();token.value=null;expr=delegate.creat eLiteral(token)}else if(match("[")){expr=parseArrayInitialiser()}else if(match(" {")){expr=parseObjectInitialiser()}if(expr){return expr}throwUnexpected(lex())}f unction parseArguments(){var args=[];expect("(");if(!match(")")){while(index<len gth){args.push(parseExpression());if(match(")")){break}expect(",")}}expect(")"); return args}function parseNonComputedProperty(){var token;token=lex();if(!isIden tifierName(token)){throwUnexpected(token)}return delegate.createIdentifier(token .value)}function parseNonComputedMember(){expect(".");return parseNonComputedPro perty()}function parseComputedMember(){var expr;expect("[");expr=parseExpression ();expect("]");return expr}function parseLeftHandSideExpression(){var expr,args, property;expr=parsePrimaryExpression();while(true){if(match("[")){property=parse ComputedMember();expr=delegate.createMemberExpression("[",expr,property)}else if (match(".")){property=parseNonComputedMember();expr=delegate.createMemberExpress ion(".",expr,property)}else if(match("(")){args=parseArguments();expr=delegate.c reateCallExpression(expr,args)}else{break}}return expr}var parsePostfixExpressio n=parseLeftHandSideExpression;function parseUnaryExpression(){var token,expr;if( lookahead.type!==Token.Punctuator&&lookahead.type!==Token.Keyword){expr=parsePos tfixExpression()}else if(match("+")||match("-")||match("!")){token=lex();expr=pa rseUnaryExpression();expr=delegate.createUnaryExpression(token.value,expr)}else if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){throwEr ror({},Messages.UnexpectedToken)}else{expr=parsePostfixExpression()}return expr} function binaryPrecedence(token){var prec=0;if(token.type!==Token.Punctuator&&to ken.type!==Token.Keyword){return 0}switch(token.value){case"||":prec=1;break;cas e"&&":prec=2;break;case"==":case"!=":case"===":case"!==":prec=6;break;case"<":ca se">":case"<=":case">=":case"instanceof":prec=7;break;case"in":prec=7;break;case "+":case"-":prec=9;break;case"*":case"/":case"%":prec=11;break;default:break}ret urn prec}function parseBinaryExpression(){var expr,token,prec,stack,right,operat or,left,i;left=parseUnaryExpression();token=lookahead;prec=binaryPrecedence(toke n);if(prec===0){return left}token.prec=prec;lex();right=parseUnaryExpression();s tack=[left,token,right];while((prec=binaryPrecedence(lookahead))>0){while(stack. length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();operator=stack.pop ().value;left=stack.pop();expr=delegate.createBinaryExpression(operator,left,rig ht);stack.push(expr)}token=lex();token.prec=prec;stack.push(token);expr=parseUna ryExpression();stack.push(expr)}i=stack.length-1;expr=stack[i];while(i>1){expr=d elegate.createBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2}return exp r}function parseConditionalExpression(){var expr,consequent,alternate;expr=parse BinaryExpression();if(match("?")){lex();consequent=parseConditionalExpression(); expect(":");alternate=parseConditionalExpression();expr=delegate.createCondition alExpression(expr,consequent,alternate)}return expr}var parseExpression=parseCon ditionalExpression;function parseFilter(){var identifier,args;identifier=lex();i f(identifier.type!==Token.Identifier){throwUnexpected(identifier)}args=match("(" )?parseArguments():[];return delegate.createFilter(identifier.value,args)}functi on parseFilters(){while(match("|")){lex();parseFilter()}}function parseTopLevel( ){skipWhitespace();peek();var expr=parseExpression();if(expr){if(lookahead.value ===","||lookahead.value=="in"&&expr.type===Syntax.Identifier){parseInExpression( expr)}else{parseFilters();if(lookahead.value==="as"){parseAsExpression(expr)}els e{delegate.createTopLevel(expr)}}}if(lookahead.type!==Token.EOF){throwUnexpected (lookahead)}}function parseAsExpression(expr){lex();var identifier=lex().value;d elegate.createAsExpression(expr,identifier)}function parseInExpression(identifie r){var indexName;if(lookahead.value===","){lex();if(lookahead.type!==Token.Ident ifier)throwUnexpected(lookahead);indexName=lex().value}lex();var expr=parseExpre ssion();parseFilters();delegate.createInExpression(identifier.name,indexName,exp r)}function parse(code,inDelegate){delegate=inDelegate;source=code;index=0;lengt h=source.length;lookahead=null;state={labelSet:{}};return parseTopLevel()}global .esprima={parse:parse}})(this);(function(global){"use strict";function prepareBi nding(expressionText,name,node,filterRegistry){var expression;try{expression=get Expression(expressionText);if(expression.scopeIdent&&(node.nodeType!==Node.ELEME NT_NODE||node.tagName!=="TEMPLATE"||name!=="bind"&&name!=="repeat")){throw Error ("as and in can only be used within <template bind/repeat>")}}catch(ex){console. error("Invalid expression syntax: "+expressionText,ex);return}return function(mo del,node,oneTime){var binding=expression.getBinding(model,filterRegistry,oneTime );if(expression.scopeIdent&&binding){node.polymerExpressionScopeIdent_=expressio n.scopeIdent;if(expression.indexIdent)node.polymerExpressionIndexIdent_=expressi on.indexIdent}return binding}}var expressionParseCache=Object.create(null);funct ion getExpression(expressionText){var expression=expressionParseCache[expression Text];if(!expression){var delegate=new ASTDelegate;esprima.parse(expressionText, delegate);expression=new Expression(delegate);expressionParseCache[expressionTex t]=expression}return expression}function Literal(value){this.value=value;this.va lueFn_=undefined}Literal.prototype={valueFn:function(){if(!this.valueFn_){var va lue=this.value;this.valueFn_=function(){return value}}return this.valueFn_}};fun ction IdentPath(name){this.name=name;this.path=Path.get(name)}IdentPath.prototyp e={valueFn:function(){if(!this.valueFn_){var name=this.name;var path=this.path;t his.valueFn_=function(model,observer){if(observer)observer.addPath(model,path);r eturn path.getValueFrom(model)}}return this.valueFn_},setValue:function(model,ne wValue){if(this.path.length==1);model=findScope(model,this.path[0]);return this. path.setValueFrom(model,newValue)}};function MemberExpression(object,property,ac cessor){this.computed=accessor=="[";this.dynamicDeps=typeof object=="function"|| object.dynamicDeps||this.computed&&!(property instanceof Literal);this.simplePat h=!this.dynamicDeps&&(property instanceof IdentPath||property instanceof Literal )&&(object instanceof MemberExpression||object instanceof IdentPath);this.object =this.simplePath?object:getFn(object);this.property=!this.computed||this.simpleP ath?property:getFn(property)}MemberExpression.prototype={get fullPath(){if(!this .fullPath_){var parts=this.object instanceof MemberExpression?this.object.fullPa th.slice():[this.object.name];parts.push(this.property instanceof IdentPath?this .property.name:this.property.value);this.fullPath_=Path.get(parts)}return this.f ullPath_},valueFn:function(){if(!this.valueFn_){var object=this.object;if(this.s implePath){var path=this.fullPath;this.valueFn_=function(model,observer){if(obse rver)observer.addPath(model,path);return path.getValueFrom(model)}}else if(!this .computed){var path=Path.get(this.property.name);this.valueFn_=function(model,ob server,filterRegistry){var context=object(model,observer,filterRegistry);if(obse rver)observer.addPath(context,path);return path.getValueFrom(context)}}else{var property=this.property;this.valueFn_=function(model,observer,filterRegistry){var context=object(model,observer,filterRegistry);var propName=property(model,obser ver,filterRegistry);if(observer)observer.addPath(context,[propName]);return cont ext?context[propName]:undefined}}}return this.valueFn_},setValue:function(model, newValue){if(this.simplePath){this.fullPath.setValueFrom(model,newValue);return newValue}var object=this.object(model);var propName=this.property instanceof Ide ntPath?this.property.name:this.property(model);return object[propName]=newValue} };function Filter(name,args){this.name=name;this.args=[];for(var i=0;i<args.leng th;i++){this.args[i]=getFn(args[i])}}Filter.prototype={transform:function(model, observer,filterRegistry,toModelDirection,initialArgs){var fn=filterRegistry[this .name];var context=model;if(fn){context=undefined}else{fn=context[this.name];if( !fn){console.error("Cannot find function or filter: "+this.name);return}}if(toMo delDirection){fn=fn.toModel}else if(typeof fn.toDOM=="function"){fn=fn.toDOM}if( typeof fn!="function"){console.error("Cannot find function or filter: "+this.nam e);return}var args=initialArgs||[];for(var i=0;i<this.args.length;i++){args.push (getFn(this.args[i])(model,observer,filterRegistry))}return fn.apply(context,arg s)}};function notImplemented(){throw Error("Not Implemented")}var unaryOperators ={"+":function(v){return+v},"-":function(v){return-v},"!":function(v){return!v}} ;var binaryOperators={"+":function(l,r){return l+r},"-":function(l,r){return l-r },"*":function(l,r){return l*r},"/":function(l,r){return l/r},"%":function(l,r){ return l%r},"<":function(l,r){return l<r},">":function(l,r){return l>r},"<=":fun ction(l,r){return l<=r},">=":function(l,r){return l>=r},"==":function(l,r){retur n l==r},"!=":function(l,r){return l!=r},"===":function(l,r){return l===r},"!==": function(l,r){return l!==r},"&&":function(l,r){return l&&r},"||":function(l,r){r eturn l||r}};function getFn(arg){return typeof arg=="function"?arg:arg.valueFn() }function ASTDelegate(){this.expression=null;this.filters=[];this.deps={};this.c urrentPath=undefined;this.scopeIdent=undefined;this.indexIdent=undefined;this.dy namicDeps=false}ASTDelegate.prototype={createUnaryExpression:function(op,argumen t){if(!unaryOperators[op])throw Error("Disallowed operator: "+op);argument=getFn (argument);return function(model,observer,filterRegistry){return unaryOperators[ op](argument(model,observer,filterRegistry))}},createBinaryExpression:function(o p,left,right){if(!binaryOperators[op])throw Error("Disallowed operator: "+op);le ft=getFn(left);right=getFn(right);switch(op){case"||":this.dynamicDeps=true;retu rn function(model,observer,filterRegistry){return left(model,observer,filterRegi stry)||right(model,observer,filterRegistry)};case"&&":this.dynamicDeps=true;retu rn function(model,observer,filterRegistry){return left(model,observer,filterRegi stry)&&right(model,observer,filterRegistry)}}return function(model,observer,filt erRegistry){return binaryOperators[op](left(model,observer,filterRegistry),right (model,observer,filterRegistry))}},createConditionalExpression:function(test,con sequent,alternate){test=getFn(test);consequent=getFn(consequent);alternate=getFn (alternate);this.dynamicDeps=true;return function(model,observer,filterRegistry) {return test(model,observer,filterRegistry)?consequent(model,observer,filterRegi stry):alternate(model,observer,filterRegistry)}},createIdentifier:function(name) {var ident=new IdentPath(name);ident.type="Identifier";return ident},createMembe rExpression:function(accessor,object,property){var ex=new MemberExpression(objec t,property,accessor);if(ex.dynamicDeps)this.dynamicDeps=true;return ex},createCa llExpression:function(expression,args){if(!(expression instanceof IdentPath))thr ow Error("Only identifier function invocations are allowed");var filter=new Filt er(expression.name,args);return function(model,observer,filterRegistry){return f ilter.transform(model,observer,filterRegistry,false)}},createLiteral:function(to ken){return new Literal(token.value)},createArrayExpression:function(elements){f or(var i=0;i<elements.length;i++)elements[i]=getFn(elements[i]);return function( model,observer,filterRegistry){var arr=[];for(var i=0;i<elements.length;i++)arr. push(elements[i](model,observer,filterRegistry));return arr}},createProperty:fun ction(kind,key,value){return{key:key instanceof IdentPath?key.name:key.value,val ue:value}},createObjectExpression:function(properties){for(var i=0;i<properties. length;i++)properties[i].value=getFn(properties[i].value);return function(model, observer,filterRegistry){var obj={};for(var i=0;i<properties.length;i++)obj[prop erties[i].key]=properties[i].value(model,observer,filterRegistry);return obj}},c reateFilter:function(name,args){this.filters.push(new Filter(name,args))},create AsExpression:function(expression,scopeIdent){this.expression=expression;this.sco peIdent=scopeIdent},createInExpression:function(scopeIdent,indexIdent,expression ){this.expression=expression;this.scopeIdent=scopeIdent;this.indexIdent=indexIde nt},createTopLevel:function(expression){this.expression=expression},createThisEx pression:notImplemented};function ConstantObservable(value){this.value_=value}Co nstantObservable.prototype={open:function(){return this.value_},discardChanges:f unction(){return this.value_},deliver:function(){},close:function(){}};function Expression(delegate){this.scopeIdent=delegate.scopeIdent;this.indexIdent=delegat e.indexIdent;if(!delegate.expression)throw Error("No expression found.");this.ex pression=delegate.expression;getFn(this.expression);this.filters=delegate.filter s;this.dynamicDeps=delegate.dynamicDeps}Expression.prototype={getBinding:functio n(model,filterRegistry,oneTime){if(oneTime)return this.getValue(model,undefined, filterRegistry);var observer=new CompoundObserver;var firstValue=this.getValue(m odel,observer,filterRegistry);var firstTime=true;var self=this;function valueFn( ){if(firstTime){firstTime=false;return firstValue}if(self.dynamicDeps)observer.s tartReset();var value=self.getValue(model,self.dynamicDeps?observer:undefined,fi lterRegistry);if(self.dynamicDeps)observer.finishReset();return value}function s etValueFn(newValue){self.setValue(model,newValue,filterRegistry);return newValue }return new ObserverTransform(observer,valueFn,setValueFn,true)},getValue:functi on(model,observer,filterRegistry){var value=getFn(this.expression)(model,observe r,filterRegistry);for(var i=0;i<this.filters.length;i++){value=this.filters[i].t ransform(model,observer,filterRegistry,false,[value])}return value},setValue:fun ction(model,newValue,filterRegistry){var count=this.filters?this.filters.length: 0;while(count-->0){newValue=this.filters[count].transform(model,undefined,filter Registry,true,[newValue])}if(this.expression.setValue)return this.expression.set Value(model,newValue)}};function convertStylePropertyName(name){return String(na me).replace(/[A-Z]/g,function(c){return"-"+c.toLowerCase()})}var parentScopeName ="@"+Math.random().toString(36).slice(2);function findScope(model,prop){while(mo del[parentScopeName]&&!Object.prototype.hasOwnProperty.call(model,prop)){model=m odel[parentScopeName]}return model}function isLiteralExpression(pathString){swit ch(pathString){case"":return false;case"false":case"null":case"true":return true }if(!isNaN(Number(pathString)))return true;return false}function PolymerExpressi ons(){}PolymerExpressions.prototype={styleObject:function(value){var parts=[];fo r(var key in value){parts.push(convertStylePropertyName(key)+": "+value[key])}re turn parts.join("; ")},tokenList:function(value){var tokens=[];for(var key in va lue){if(value[key])tokens.push(key)}return tokens.join(" ")},prepareInstancePosi tionChanged:function(template){var indexIdent=template.polymerExpressionIndexIde nt_;if(!indexIdent)return;return function(templateInstance,index){templateInstan ce.model[indexIdent]=index}},prepareBinding:function(pathString,name,node){var p ath=Path.get(pathString);if(!isLiteralExpression(pathString)&&path.valid){if(pat h.length==1){return function(model,node,oneTime){if(oneTime)return path.getValue From(model);var scope=findScope(model,path[0]);return new PathObserver(scope,pat h)}}return}return prepareBinding(pathString,name,node,this)},prepareInstanceMode l:function(template){var scopeName=template.polymerExpressionScopeIdent_;if(!sco peName)return;var parentScope=template.templateInstance?template.templateInstanc e.model:template.model;var indexName=template.polymerExpressionIndexIdent_;retur n function(model){return createScopeObject(parentScope,model,scopeName,indexName )}}};var createScopeObject="__proto__"in{}?function(parentScope,model,scopeName, indexName){var scope={};scope[scopeName]=model;scope[indexName]=undefined;scope[ parentScopeName]=parentScope;scope.__proto__=parentScope;return scope}:function( parentScope,model,scopeName,indexName){var scope=Object.create(parentScope);Obje ct.defineProperty(scope,scopeName,{value:model,configurable:true,writable:true}) ;Object.defineProperty(scope,indexName,{value:undefined,configurable:true,writab le:true});Object.defineProperty(scope,parentScopeName,{value:parentScope,configu rable:true,writable:true});return scope};global.PolymerExpressions=PolymerExpres sions;PolymerExpressions.getExpression=getExpression})(this);Polymer={version:"0 .5.1"};if(typeof window.Polymer==="function"){Polymer={}}(function(scope){functi on withDependencies(task,depends){depends=depends||[];if(!depends.map){depends=[ depends]}return task.apply(this,depends.map(marshal))}function module(name,depen dsOrFactory,moduleFactory){var module;switch(arguments.length){case 0:return;cas e 1:module=null;break;case 2:module=dependsOrFactory.apply(this);break;default:m odule=withDependencies(moduleFactory,dependsOrFactory);break}modules[name]=modul e}function marshal(name){return modules[name]}var modules={};function using(depe nds,task){HTMLImports.whenImportsReady(function(){withDependencies(task,depends) })}scope.marshal=marshal;scope.modularize=module;scope.using=using})(window);if( !window.WebComponents){if(!window.WebComponents){WebComponents={flush:function() {},flags:{log:{}}};Platform=WebComponents;CustomElements={useNative:true,ready:t rue,takeRecords:function(){},"instanceof":function(obj,base){return obj instance of base}};HTMLImports={useNative:true};addEventListener("HTMLImportsLoaded",func tion(){document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:true }))});ShadowDOMPolyfill=null;wrap=unwrap=function(n){return n}}window.HTMLImport s=window.HTMLImports||{flags:{}};(function(scope){var IMPORT_LINK_TYPE="import"; var useNative=Boolean(IMPORT_LINK_TYPE in document.createElement("link"));var ha sShadowDOMPolyfill=Boolean(window.ShadowDOMPolyfill);var wrap=function(node){ret urn hasShadowDOMPolyfill?ShadowDOMPolyfill.wrapIfNeeded(node):node};var rootDocu ment=wrap(document);var currentScriptDescriptor={get:function(){var script=HTMLI mports.currentScript||document.currentScript||(document.readyState!=="complete"? document.scripts[document.scripts.length-1]:null);return wrap(script)},configura ble:true};Object.defineProperty(document,"_currentScript",currentScriptDescripto r);Object.defineProperty(rootDocument,"_currentScript",currentScriptDescriptor); var isIE=/Trident/.test(navigator.userAgent);function whenReady(callback,doc){do c=doc||rootDocument;whenDocumentReady(function(){watchImportsLoad(callback,doc)} ,doc)}var requiredReadyState=isIE?"complete":"interactive";var READY_EVENT="read ystatechange";function isDocumentReady(doc){return doc.readyState==="complete"|| doc.readyState===requiredReadyState}function whenDocumentReady(callback,doc){if( !isDocumentReady(doc)){var checkReady=function(){if(doc.readyState==="complete"| |doc.readyState===requiredReadyState){doc.removeEventListener(READY_EVENT,checkR eady);whenDocumentReady(callback,doc)}};doc.addEventListener(READY_EVENT,checkRe ady)}else if(callback){callback()}}function markTargetLoaded(event){event.target .__loaded=true}function watchImportsLoad(callback,doc){var imports=doc.querySele ctorAll("link[rel=import]");var loaded=0,l=imports.length;function checkDone(d){ if(loaded==l&&callback){callback()}}function loadedImport(e){markTargetLoaded(e) ;loaded++;checkDone()}if(l){for(var i=0,imp;i<l&&(imp=imports[i]);i++){if(isImpo rtLoaded(imp)){loadedImport.call(imp,{target:imp})}else{imp.addEventListener("lo ad",loadedImport);imp.addEventListener("error",loadedImport)}}}else{checkDone()} }function isImportLoaded(link){return useNative?link.__loaded||link.import&&link .import.readyState!=="loading":link.__importParsed}if(useNative){new MutationObs erver(function(mxns){for(var i=0,l=mxns.length,m;i<l&&(m=mxns[i]);i++){if(m.adde dNodes){handleImports(m.addedNodes)}}}).observe(document.head,{childList:true}); function handleImports(nodes){for(var i=0,l=nodes.length,n;i<l&&(n=nodes[i]);i++ ){if(isImport(n)){handleImport(n)}}}function isImport(element){return element.lo calName==="link"&&element.rel==="import"}function handleImport(element){var load ed=element.import;if(loaded){markTargetLoaded({target:element})}else{element.add EventListener("load",markTargetLoaded);element.addEventListener("error",markTarg etLoaded)}}(function(){if(document.readyState==="loading"){var imports=document. querySelectorAll("link[rel=import]");for(var i=0,l=imports.length,imp;i<l&&(imp= imports[i]);i++){handleImport(imp)}}})()}whenReady(function(){HTMLImports.ready= true;HTMLImports.readyTime=(new Date).getTime();rootDocument.dispatchEvent(new C ustomEvent("HTMLImportsLoaded",{bubbles:true}))});scope.IMPORT_LINK_TYPE=IMPORT_ LINK_TYPE;scope.useNative=useNative;scope.rootDocument=rootDocument;scope.whenRe ady=whenReady;scope.isIE=isIE})(HTMLImports);(function(scope){var style=document .createElement("style");style.textContent=""+"body {"+"transition: opacity ease- in 0.2s;"+" } \n"+"body[unresolved] {"+"opacity: 0; display: block; overflow: hi dden;"+" } \n";var head=document.querySelector("head");head.insertBefore(style,h ead.firstChild)})(Platform)}(function(global){"use strict";var testingExposeCycl eCount=global.testingExposeCycleCount;function detectObjectObserve(){if(typeof O bject.observe!=="function"||typeof Array.observe!=="function"){return false}var records=[];function callback(recs){records=recs}var test={};var arr=[];Object.ob serve(test,callback);Array.observe(arr,callback);test.id=1;test.id=2;delete test .id;arr.push(1,2);arr.length=0;Object.deliverChangeRecords(callback);if(records. length!==5)return false;if(records[0].type!="add"||records[1].type!="update"||re cords[2].type!="delete"||records[3].type!="splice"||records[4].type!="splice"){r eturn false}Object.unobserve(test,callback);Array.unobserve(arr,callback);return true}var hasObserve=detectObjectObserve();function detectEval(){if(typeof chrom e!=="undefined"&&chrome.app&&chrome.app.runtime){return false}if(typeof navigato r!="undefined"&&navigator.getDeviceStorage){return false}try{var f=new Function( "","return true;");return f()}catch(ex){return false}}var hasEval=detectEval();f unction isIndex(s){return+s===s>>>0&&s!==""}function toNumber(s){return+s}functi on isObject(obj){return obj===Object(obj)}var numberIsNaN=global.Number.isNaN||f unction(value){return typeof value==="number"&&global.isNaN(value)};function are SameValue(left,right){if(left===right)return left!==0||1/left===1/right;if(numbe rIsNaN(left)&&numberIsNaN(right))return true;return left!==left&&right!==right}v ar createObject="__proto__"in{}?function(obj){return obj}:function(obj){var prot o=obj.__proto__;if(!proto)return obj;var newObject=Object.create(proto);Object.g etOwnPropertyNames(obj).forEach(function(name){Object.defineProperty(newObject,n ame,Object.getOwnPropertyDescriptor(obj,name))});return newObject};var identStar t="[$_a-zA-Z]";var identPart="[$_a-zA-Z0-9]";var identRegExp=new RegExp("^"+iden tStart+"+"+identPart+"*"+"$");function getPathCharType(char){if(char===undefined )return"eof";var code=char.charCodeAt(0);switch(code){case 91:case 93:case 46:ca se 34:case 39:case 48:return char;case 95:case 36:return"ident";case 32:case 9:c ase 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}if(97<=code&&c ode<=122||65<=code&&code<=90)return"ident";if(49<=code&&code<=57)return"number"; return"else"
16 }var pathStateMachine={beforePath:{ws:["beforePath"],ident:["inIdent","append"], "[":["beforeElement"],eof:["afterPath"]},inPath:{ws:["inPath"],".":["beforeIdent "],"[":["beforeElement"],eof:["afterPath"]},beforeIdent:{ws:["beforeIdent"],iden t:["inIdent","append"]},inIdent:{ident:["inIdent","append"],0:["inIdent","append "],number:["inIdent","append"],ws:["inPath","push"],".":["beforeIdent","push"]," [":["beforeElement","push"],eof:["afterPath","push"]},beforeElement:{ws:["before Element"],0:["afterZero","append"],number:["inIndex","append"],"'":["inSingleQuo te","append",""],'"':["inDoubleQuote","append",""]},afterZero:{ws:["afterElement ","push"],"]":["inPath","push"]},inIndex:{0:["inIndex","append"],number:["inInde x","append"],ws:["afterElement"],"]":["inPath","push"]},inSingleQuote:{"'":["aft erElement"],eof:["error"],"else":["inSingleQuote","append"]},inDoubleQuote:{'"': ["afterElement"],eof:["error"],"else":["inDoubleQuote","append"]},afterElement:{ ws:["afterElement"],"]":["inPath","push"]}};function noop(){}function parsePath( path){var keys=[];var index=-1;var c,newChar,key,type,transition,action,typeMap, mode="beforePath";var actions={push:function(){if(key===undefined)return;keys.pu sh(key);key=undefined},append:function(){if(key===undefined)key=newChar;else key +=newChar}};function maybeUnescapeQuote(){if(index>=path.length)return;var nextC har=path[index+1];if(mode=="inSingleQuote"&&nextChar=="'"||mode=="inDoubleQuote" &&nextChar=='"'){index++;newChar=nextChar;actions.append();return true}}while(mo de){index++;c=path[index];if(c=="\\"&&maybeUnescapeQuote(mode))continue;type=get PathCharType(c);typeMap=pathStateMachine[mode];transition=typeMap[type]||typeMap ["else"]||"error";if(transition=="error")return;mode=transition[0];action=action s[transition[1]]||noop;newChar=transition[2]===undefined?c:transition[2];action( );if(mode==="afterPath"){return keys}}return}function isIdent(s){return identReg Exp.test(s)}var constructorIsPrivate={};function Path(parts,privateToken){if(pri vateToken!==constructorIsPrivate)throw Error("Use Path.get to retrieve path obje cts");for(var i=0;i<parts.length;i++){this.push(String(parts[i]))}if(hasEval&&th is.length){this.getValueFrom=this.compiledGetValueFromFn()}}var pathCache={};fun ction getPath(pathString){if(pathString instanceof Path)return pathString;if(pat hString==null||pathString.length==0)pathString="";if(typeof pathString!="string" ){if(isIndex(pathString.length)){return new Path(pathString,constructorIsPrivate )}pathString=String(pathString)}var path=pathCache[pathString];if(path)return pa th;var parts=parsePath(pathString);if(!parts)return invalidPath;var path=new Pat h(parts,constructorIsPrivate);pathCache[pathString]=path;return path}Path.get=ge tPath;function formatAccessor(key){if(isIndex(key)){return"["+key+"]"}else{retur n'["'+key.replace(/"/g,'\\"')+'"]'}}Path.prototype=createObject({__proto__:[],va lid:true,toString:function(){var pathString="";for(var i=0;i<this.length;i++){va r key=this[i];if(isIdent(key)){pathString+=i?"."+key:key}else{pathString+=format Accessor(key)}}return pathString},getValueFrom:function(obj,directObserver){for( var i=0;i<this.length;i++){if(obj==null)return;obj=obj[this[i]]}return obj},iter ateObjects:function(obj,observe){for(var i=0;i<this.length;i++){if(i)obj=obj[thi s[i-1]];if(!isObject(obj))return;observe(obj,this[i])}},compiledGetValueFromFn:f unction(){var str="";var pathString="obj";str+="if (obj != null";var i=0;var key ;for(;i<this.length-1;i++){key=this[i];pathString+=isIdent(key)?"."+key:formatAc cessor(key);str+=" &&\n "+pathString+" != null"}str+=")\n";var key=this[i];p athString+=isIdent(key)?"."+key:formatAccessor(key);str+=" return "+pathString+ ";\nelse\n return undefined;";return new Function("obj",str)},setValueFrom:func tion(obj,value){if(!this.length)return false;for(var i=0;i<this.length-1;i++){if (!isObject(obj))return false;obj=obj[this[i]]}if(!isObject(obj))return false;obj [this[i]]=value;return true}});var invalidPath=new Path("",constructorIsPrivate) ;invalidPath.valid=false;invalidPath.getValueFrom=invalidPath.setValueFrom=funct ion(){};var MAX_DIRTY_CHECK_CYCLES=1e3;function dirtyCheck(observer){var cycles= 0;while(cycles<MAX_DIRTY_CHECK_CYCLES&&observer.check_()){cycles++}if(testingExp oseCycleCount)global.dirtyCheckCycleCount=cycles;return cycles>0}function object IsEmpty(object){for(var prop in object)return false;return true}function diffIsE mpty(diff){return objectIsEmpty(diff.added)&&objectIsEmpty(diff.removed)&&object IsEmpty(diff.changed)}function diffObjectFromOldObject(object,oldObject){var add ed={};var removed={};var changed={};for(var prop in oldObject){var newValue=obje ct[prop];if(newValue!==undefined&&newValue===oldObject[prop])continue;if(!(prop in object)){removed[prop]=undefined;continue}if(newValue!==oldObject[prop])chang ed[prop]=newValue}for(var prop in object){if(prop in oldObject)continue;added[pr op]=object[prop]}if(Array.isArray(object)&&object.length!==oldObject.length)chan ged.length=object.length;return{added:added,removed:removed,changed:changed}}var eomTasks=[];function runEOMTasks(){if(!eomTasks.length)return false;for(var i=0 ;i<eomTasks.length;i++){eomTasks[i]()}eomTasks.length=0;return true}var runEOM=h asObserve?function(){return function(fn){return Promise.resolve().then(fn)}}():f unction(){return function(fn){eomTasks.push(fn)}}();var observedObjectCache=[];f unction newObservedObject(){var observer;var object;var discardRecords=false;var first=true;function callback(records){if(observer&&observer.state_===OPENED&&!d iscardRecords)observer.check_(records)}return{open:function(obs){if(observer)thr ow Error("ObservedObject in use");if(!first)Object.deliverChangeRecords(callback );observer=obs;first=false},observe:function(obj,arrayObserve){object=obj;if(arr ayObserve)Array.observe(object,callback);else Object.observe(object,callback)},d eliver:function(discard){discardRecords=discard;Object.deliverChangeRecords(call back);discardRecords=false},close:function(){observer=undefined;Object.unobserve (object,callback);observedObjectCache.push(this)}}}function getObservedObject(ob server,object,arrayObserve){var dir=observedObjectCache.pop()||newObservedObject ();dir.open(observer);dir.observe(object,arrayObserve);return dir}var observedSe tCache=[];function newObservedSet(){var observerCount=0;var observers=[];var obj ects=[];var rootObj;var rootObjProps;function observe(obj,prop){if(!obj)return;i f(obj===rootObj)rootObjProps[prop]=true;if(objects.indexOf(obj)<0){objects.push( obj);Object.observe(obj,callback)}observe(Object.getPrototypeOf(obj),prop)}funct ion allRootObjNonObservedProps(recs){for(var i=0;i<recs.length;i++){var rec=recs [i];if(rec.object!==rootObj||rootObjProps[rec.name]||rec.type==="setPrototype"){ return false}}return true}function callback(recs){if(allRootObjNonObservedProps( recs))return;var observer;for(var i=0;i<observers.length;i++){observer=observers [i];if(observer.state_==OPENED){observer.iterateObjects_(observe)}}for(var i=0;i <observers.length;i++){observer=observers[i];if(observer.state_==OPENED){observe r.check_()}}}var record={objects:objects,get rootObject(){return rootObj},set ro otObject(value){rootObj=value;rootObjProps={}},open:function(obs,object){observe rs.push(obs);observerCount++;obs.iterateObjects_(observe)},close:function(obs){o bserverCount--;if(observerCount>0){return}for(var i=0;i<objects.length;i++){Obje ct.unobserve(objects[i],callback);Observer.unobservedCount++}observers.length=0; objects.length=0;rootObj=undefined;rootObjProps=undefined;observedSetCache.push( this);if(lastObservedSet===this)lastObservedSet=null}};return record}var lastObs ervedSet;function getObservedSet(observer,obj){if(!lastObservedSet||lastObserved Set.rootObject!==obj){lastObservedSet=observedSetCache.pop()||newObservedSet();l astObservedSet.rootObject=obj}lastObservedSet.open(observer,obj);return lastObse rvedSet}var UNOPENED=0;var OPENED=1;var CLOSED=2;var RESETTING=3;var nextObserve rId=1;function Observer(){this.state_=UNOPENED;this.callback_=undefined;this.tar get_=undefined;this.directObserver_=undefined;this.value_=undefined;this.id_=nex tObserverId++}Observer.prototype={open:function(callback,target){if(this.state_! =UNOPENED)throw Error("Observer has already been opened.");addToAll(this);this.c allback_=callback;this.target_=target;this.connect_();this.state_=OPENED;return this.value_},close:function(){if(this.state_!=OPENED)return;removeFromAll(this); this.disconnect_();this.value_=undefined;this.callback_=undefined;this.target_=u ndefined;this.state_=CLOSED},deliver:function(){if(this.state_!=OPENED)return;di rtyCheck(this)},report_:function(changes){try{this.callback_.apply(this.target_, changes)}catch(ex){Observer._errorThrownDuringCallback=true;console.error("Excep tion caught during observer callback: "+(ex.stack||ex))}},discardChanges:functio n(){this.check_(undefined,true);return this.value_}};var collectObservers=!hasOb serve;var allObservers;Observer._allObserversCount=0;if(collectObservers){allObs ervers=[]}function addToAll(observer){Observer._allObserversCount++;if(!collectO bservers)return;allObservers.push(observer)}function removeFromAll(observer){Obs erver._allObserversCount--}var runningMicrotaskCheckpoint=false;global.Platform= global.Platform||{};global.Platform.performMicrotaskCheckpoint=function(){if(run ningMicrotaskCheckpoint)return;if(!collectObservers)return;runningMicrotaskCheck point=true;var cycles=0;var anyChanged,toCheck;do{cycles++;toCheck=allObservers; allObservers=[];anyChanged=false;for(var i=0;i<toCheck.length;i++){var observer= toCheck[i];if(observer.state_!=OPENED)continue;if(observer.check_())anyChanged=t rue;allObservers.push(observer)}if(runEOMTasks())anyChanged=true}while(cycles<MA X_DIRTY_CHECK_CYCLES&&anyChanged);if(testingExposeCycleCount)global.dirtyCheckCy cleCount=cycles;runningMicrotaskCheckpoint=false};if(collectObservers){global.Pl atform.clearObservers=function(){allObservers=[]}}function ObjectObserver(object ){Observer.call(this);this.value_=object;this.oldObject_=undefined}ObjectObserve r.prototype=createObject({__proto__:Observer.prototype,arrayObserve:false,connec t_:function(callback,target){if(hasObserve){this.directObserver_=getObservedObje ct(this,this.value_,this.arrayObserve)}else{this.oldObject_=this.copyObject(this .value_)}},copyObject:function(object){var copy=Array.isArray(object)?[]:{};for( var prop in object){copy[prop]=object[prop]}if(Array.isArray(object))copy.length =object.length;return copy},check_:function(changeRecords,skipChanges){var diff; var oldValues;if(hasObserve){if(!changeRecords)return false;oldValues={};diff=di ffObjectFromChangeRecords(this.value_,changeRecords,oldValues)}else{oldValues=th is.oldObject_;diff=diffObjectFromOldObject(this.value_,this.oldObject_)}if(diffI sEmpty(diff))return false;if(!hasObserve)this.oldObject_=this.copyObject(this.va lue_);this.report_([diff.added||{},diff.removed||{},diff.changed||{},function(pr operty){return oldValues[property]}]);return true},disconnect_:function(){if(has Observe){this.directObserver_.close();this.directObserver_=undefined}else{this.o ldObject_=undefined}},deliver:function(){if(this.state_!=OPENED)return;if(hasObs erve)this.directObserver_.deliver(false);else dirtyCheck(this)},discardChanges:f unction(){if(this.directObserver_)this.directObserver_.deliver(true);else this.o ldObject_=this.copyObject(this.value_);return this.value_}});function ArrayObser ver(array){if(!Array.isArray(array))throw Error("Provided object is not an Array ");ObjectObserver.call(this,array)}ArrayObserver.prototype=createObject({__proto __:ObjectObserver.prototype,arrayObserve:true,copyObject:function(arr){return ar r.slice()},check_:function(changeRecords){var splices;if(hasObserve){if(!changeR ecords)return false;splices=projectArraySplices(this.value_,changeRecords)}else{ splices=calcSplices(this.value_,0,this.value_.length,this.oldObject_,0,this.oldO bject_.length)}if(!splices||!splices.length)return false;if(!hasObserve)this.old Object_=this.copyObject(this.value_);this.report_([splices]);return true}});Arra yObserver.applySplices=function(previous,current,splices){splices.forEach(functi on(splice){var spliceArgs=[splice.index,splice.removed.length];var addIndex=spli ce.index;while(addIndex<splice.index+splice.addedCount){spliceArgs.push(current[ addIndex]);addIndex++}Array.prototype.splice.apply(previous,spliceArgs)})};funct ion PathObserver(object,path){Observer.call(this);this.object_=object;this.path_ =getPath(path);this.directObserver_=undefined}PathObserver.prototype=createObjec t({__proto__:Observer.prototype,get path(){return this.path_},connect_:function( ){if(hasObserve)this.directObserver_=getObservedSet(this,this.object_);this.chec k_(undefined,true)},disconnect_:function(){this.value_=undefined;if(this.directO bserver_){this.directObserver_.close(this);this.directObserver_=undefined}},iter ateObjects_:function(observe){this.path_.iterateObjects(this.object_,observe)},c heck_:function(changeRecords,skipChanges){var oldValue=this.value_;this.value_=t his.path_.getValueFrom(this.object_);if(skipChanges||areSameValue(this.value_,ol dValue))return false;this.report_([this.value_,oldValue,this]);return true},setV alue:function(newValue){if(this.path_)this.path_.setValueFrom(this.object_,newVa lue)}});function CompoundObserver(reportChangesOnOpen){Observer.call(this);this. reportChangesOnOpen_=reportChangesOnOpen;this.value_=[];this.directObserver_=und efined;this.observed_=[]}var observerSentinel={};CompoundObserver.prototype=crea teObject({__proto__:Observer.prototype,connect_:function(){if(hasObserve){var ob ject;var needsDirectObserver=false;for(var i=0;i<this.observed_.length;i+=2){obj ect=this.observed_[i];if(object!==observerSentinel){needsDirectObserver=true;bre ak}}if(needsDirectObserver)this.directObserver_=getObservedSet(this,object)}this .check_(undefined,!this.reportChangesOnOpen_)},disconnect_:function(){for(var i= 0;i<this.observed_.length;i+=2){if(this.observed_[i]===observerSentinel)this.obs erved_[i+1].close()}this.observed_.length=0;this.value_.length=0;if(this.directO bserver_){this.directObserver_.close(this);this.directObserver_=undefined}},addP ath:function(object,path){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add paths once started.");var path=getPath(path);this.observed_.p ush(object,path);if(!this.reportChangesOnOpen_)return;var index=this.observed_.l ength/2-1;this.value_[index]=path.getValueFrom(object)},addObserver:function(obs erver){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add observers once started.");this.observed_.push(observerSentinel,observer);if(!thi s.reportChangesOnOpen_)return;var index=this.observed_.length/2-1;this.value_[in dex]=observer.open(this.deliver,this)},startReset:function(){if(this.state_!=OPE NED)throw Error("Can only reset while open");this.state_=RESETTING;this.disconne ct_()},finishReset:function(){if(this.state_!=RESETTING)throw Error("Can only fi nishReset after startReset");this.state_=OPENED;this.connect_();return this.valu e_},iterateObjects_:function(observe){var object;for(var i=0;i<this.observed_.le ngth;i+=2){object=this.observed_[i];if(object!==observerSentinel)this.observed_[ i+1].iterateObjects(object,observe)}},check_:function(changeRecords,skipChanges) {var oldValues;for(var i=0;i<this.observed_.length;i+=2){var object=this.observe d_[i];var path=this.observed_[i+1];var value;if(object===observerSentinel){var o bservable=path;value=this.state_===UNOPENED?observable.open(this.deliver,this):o bservable.discardChanges()}else{value=path.getValueFrom(object)}if(skipChanges){ this.value_[i/2]=value;continue}if(areSameValue(value,this.value_[i/2]))continue ;oldValues=oldValues||[];oldValues[i/2]=this.value_[i/2];this.value_[i/2]=value} if(!oldValues)return false;this.report_([this.value_,oldValues,this.observed_]); return true}});function identFn(value){return value}function ObserverTransform(o bservable,getValueFn,setValueFn,dontPassThroughSet){this.callback_=undefined;thi s.target_=undefined;this.value_=undefined;this.observable_=observable;this.getVa lueFn_=getValueFn||identFn;this.setValueFn_=setValueFn||identFn;this.dontPassThr oughSet_=dontPassThroughSet}ObserverTransform.prototype={open:function(callback, target){this.callback_=callback;this.target_=target;this.value_=this.getValueFn_ (this.observable_.open(this.observedCallback_,this));return this.value_},observe dCallback_:function(value){value=this.getValueFn_(value);if(areSameValue(value,t his.value_))return;var oldValue=this.value_;this.value_=value;this.callback_.cal l(this.target_,this.value_,oldValue)},discardChanges:function(){this.value_=this .getValueFn_(this.observable_.discardChanges());return this.value_},deliver:func tion(){return this.observable_.deliver()},setValue:function(value){value=this.se tValueFn_(value);if(!this.dontPassThroughSet_&&this.observable_.setValue)return this.observable_.setValue(value)},close:function(){if(this.observable_)this.obse rvable_.close();this.callback_=undefined;this.target_=undefined;this.observable_ =undefined;this.value_=undefined;this.getValueFn_=undefined;this.setValueFn_=und efined}};var expectedRecordTypes={add:true,update:true,"delete":true};function d iffObjectFromChangeRecords(object,changeRecords,oldValues){var added={};var remo ved={};for(var i=0;i<changeRecords.length;i++){var record=changeRecords[i];if(!e xpectedRecordTypes[record.type]){console.error("Unknown changeRecord type: "+rec ord.type);console.error(record);continue}if(!(record.name in oldValues))oldValue s[record.name]=record.oldValue;if(record.type=="update")continue;if(record.type= ="add"){if(record.name in removed)delete removed[record.name];else added[record. name]=true;continue}if(record.name in added){delete added[record.name];delete ol dValues[record.name]}else{removed[record.name]=true}}for(var prop in added)added [prop]=object[prop];for(var prop in removed)removed[prop]=undefined;var changed= {};for(var prop in oldValues){if(prop in added||prop in removed)continue;var new Value=object[prop];if(oldValues[prop]!==newValue)changed[prop]=newValue}return{a dded:added,removed:removed,changed:changed}}function newSplice(index,removed,add edCount){return{index:index,removed:removed,addedCount:addedCount}}var EDIT_LEAV E=0;var EDIT_UPDATE=1;var EDIT_ADD=2;var EDIT_DELETE=3;function ArraySplice(){}A rraySplice.prototype={calcEditDistances:function(current,currentStart,currentEnd ,old,oldStart,oldEnd){var rowCount=oldEnd-oldStart+1;var columnCount=currentEnd- currentStart+1;var distances=new Array(rowCount);for(var i=0;i<rowCount;i++){dis tances[i]=new Array(columnCount);distances[i][0]=i}for(var j=0;j<columnCount;j++ )distances[0][j]=j;for(var i=1;i<rowCount;i++){for(var j=1;j<columnCount;j++){if (this.equals(current[currentStart+j-1],old[oldStart+i-1]))distances[i][j]=distan ces[i-1][j-1];else{var north=distances[i-1][j]+1;var west=distances[i][j-1]+1;di stances[i][j]=north<west?north:west}}}return distances},spliceOperationsFromEdit Distances:function(distances){var i=distances.length-1;var j=distances[0].length -1;var current=distances[i][j];var edits=[];while(i>0||j>0){if(i==0){edits.push( EDIT_ADD);j--;continue}if(j==0){edits.push(EDIT_DELETE);i--;continue}var northWe st=distances[i-1][j-1];var west=distances[i-1][j];var north=distances[i][j-1];va r min;if(west<north)min=west<northWest?west:northWest;else min=north<northWest?n orth:northWest;if(min==northWest){if(northWest==current){edits.push(EDIT_LEAVE)} else{edits.push(EDIT_UPDATE);current=northWest}i--;j--}else if(min==west){edits. push(EDIT_DELETE);i--;current=west}else{edits.push(EDIT_ADD);j--;current=north}} edits.reverse();return edits},calcSplices:function(current,currentStart,currentE nd,old,oldStart,oldEnd){var prefixCount=0;var suffixCount=0;var minLength=Math.m in(currentEnd-currentStart,oldEnd-oldStart);if(currentStart==0&&oldStart==0)pref ixCount=this.sharedPrefix(current,old,minLength);if(currentEnd==current.length&& oldEnd==old.length)suffixCount=this.sharedSuffix(current,old,minLength-prefixCou nt);currentStart+=prefixCount;oldStart+=prefixCount;currentEnd-=suffixCount;oldE nd-=suffixCount;if(currentEnd-currentStart==0&&oldEnd-oldStart==0)return[];if(cu rrentStart==currentEnd){var splice=newSplice(currentStart,[],0);while(oldStart<o ldEnd)splice.removed.push(old[oldStart++]);return[splice]}else if(oldStart==oldE nd)return[newSplice(currentStart,[],currentEnd-currentStart)];var ops=this.splic eOperationsFromEditDistances(this.calcEditDistances(current,currentStart,current End,old,oldStart,oldEnd));var splice=undefined;var splices=[];var index=currentS tart;var oldIndex=oldStart;for(var i=0;i<ops.length;i++){switch(ops[i]){case EDI T_LEAVE:if(splice){splices.push(splice);splice=undefined}index++;oldIndex++;brea k;case EDIT_UPDATE:if(!splice)splice=newSplice(index,[],0);splice.addedCount++;i ndex++;splice.removed.push(old[oldIndex]);oldIndex++;break;case EDIT_ADD:if(!spl ice)splice=newSplice(index,[],0);splice.addedCount++;index++;break;case EDIT_DEL ETE:if(!splice)splice=newSplice(index,[],0);splice.removed.push(old[oldIndex]);o ldIndex++;break}}if(splice){splices.push(splice)}return splices},sharedPrefix:fu nction(current,old,searchLength){for(var i=0;i<searchLength;i++)if(!this.equals( current[i],old[i]))return i;return searchLength},sharedSuffix:function(current,o ld,searchLength){var index1=current.length;var index2=old.length;var count=0;whi le(count<searchLength&&this.equals(current[--index1],old[--index2]))count++;retu rn count},calculateSplices:function(current,previous){return this.calcSplices(cu rrent,0,current.length,previous,0,previous.length)},equals:function(currentValue ,previousValue){return currentValue===previousValue}};var arraySplice=new ArrayS plice;function calcSplices(current,currentStart,currentEnd,old,oldStart,oldEnd){ return arraySplice.calcSplices(current,currentStart,currentEnd,old,oldStart,oldE nd)}function intersect(start1,end1,start2,end2){if(end1<start2||end2<start1)retu rn-1;if(end1==start2||end2==start1)return 0;if(start1<start2){if(end1<end2)retur n end1-start2;else return end2-start2}else{if(end2<end1)return end2-start1;else return end1-start1}}function mergeSplice(splices,index,removed,addedCount){var s plice=newSplice(index,removed,addedCount);var inserted=false;var insertionOffset =0;for(var i=0;i<splices.length;i++){var current=splices[i];current.index+=inser tionOffset;if(inserted)continue;var intersectCount=intersect(splice.index,splice .index+splice.removed.length,current.index,current.index+current.addedCount);if( intersectCount>=0){splices.splice(i,1);i--;insertionOffset-=current.addedCount-c urrent.removed.length;splice.addedCount+=current.addedCount-intersectCount;var d eleteCount=splice.removed.length+current.removed.length-intersectCount;if(!splic e.addedCount&&!deleteCount){inserted=true}else{var removed=current.removed;if(sp lice.index<current.index){var prepend=splice.removed.slice(0,current.index-splic e.index);Array.prototype.push.apply(prepend,removed);removed=prepend}if(splice.i ndex+splice.removed.length>current.index+current.addedCount){var append=splice.r emoved.slice(current.index+current.addedCount-splice.index);Array.prototype.push .apply(removed,append)}splice.removed=removed;if(current.index<splice.index){spl ice.index=current.index}}}else if(splice.index<current.index){inserted=true;spli ces.splice(i,0,splice);i++;var offset=splice.addedCount-splice.removed.length;cu rrent.index+=offset;insertionOffset+=offset}}if(!inserted)splices.push(splice)}f unction createInitialSplices(array,changeRecords){var splices=[];for(var i=0;i<c hangeRecords.length;i++){var record=changeRecords[i];switch(record.type){case"sp lice":mergeSplice(splices,record.index,record.removed.slice(),record.addedCount) ;break;case"add":case"update":case"delete":if(!isIndex(record.name))continue;var index=toNumber(record.name);if(index<0)continue;mergeSplice(splices,index,[reco rd.oldValue],1);break;default:console.error("Unexpected record type: "+JSON.stri ngify(record));break}}return splices}function projectArraySplices(array,changeRe cords){var splices=[];createInitialSplices(array,changeRecords).forEach(function (splice){if(splice.addedCount==1&&splice.removed.length==1){if(splice.removed[0] !==array[splice.index])splices.push(splice);return}splices=splices.concat(calcSp lices(array,splice.index,splice.index+splice.addedCount,splice.removed,0,splice. removed.length))});return splices}var expose=global;if(typeof exports!=="undefin ed"){if(typeof module!=="undefined"&&module.exports){expose=exports=module.expor ts}expose=exports}expose.Observer=Observer;expose.Observer.runEOM_=runEOM;expose .Observer.observerSentinel_=observerSentinel;expose.Observer.hasObjectObserve=ha sObserve;expose.ArrayObserver=ArrayObserver;expose.ArrayObserver.calculateSplice s=function(current,previous){return arraySplice.calculateSplices(current,previou s)};expose.ArraySplice=ArraySplice;expose.ObjectObserver=ObjectObserver;expose.P athObserver=PathObserver;expose.CompoundObserver=CompoundObserver;expose.Path=Pa th;expose.ObserverTransform=ObserverTransform})(typeof global!=="undefined"&&glo bal&&typeof module!=="undefined"&&module?global:this||window);(function(global){ "use strict";var filter=Array.prototype.filter.call.bind(Array.prototype.filter) ;function getTreeScope(node){while(node.parentNode){node=node.parentNode}return typeof node.getElementById==="function"?node:null}Node.prototype.bind=function(n ame,observable){console.error("Unhandled binding to Node: ",this,name,observable )};Node.prototype.bindFinished=function(){};function updateBindings(node,name,bi nding){var bindings=node.bindings_;if(!bindings)bindings=node.bindings_={};if(bi ndings[name])binding[name].close();return bindings[name]=binding}function return Binding(node,name,binding){return binding}function sanitizeValue(value){return v alue==null?"":value}function updateText(node,value){node.data=sanitizeValue(valu e)}function textBinding(node){return function(value){return updateText(node,valu e)}}var maybeUpdateBindings=returnBinding;Object.defineProperty(Platform,"enable BindingsReflection",{get:function(){return maybeUpdateBindings===updateBindings} ,set:function(enable){maybeUpdateBindings=enable?updateBindings:returnBinding;re turn enable},configurable:true});Text.prototype.bind=function(name,value,oneTime ){if(name!=="textContent")return Node.prototype.bind.call(this,name,value,oneTim e);if(oneTime)return updateText(this,value);var observable=value;updateText(this ,observable.open(textBinding(this)));return maybeUpdateBindings(this,name,observ able)};function updateAttribute(el,name,conditional,value){if(conditional){if(va lue)el.setAttribute(name,"");else el.removeAttribute(name);return}el.setAttribut e(name,sanitizeValue(value))}function attributeBinding(el,name,conditional){retu rn function(value){updateAttribute(el,name,conditional,value)}}Element.prototype .bind=function(name,value,oneTime){var conditional=name[name.length-1]=="?";if(c onditional){this.removeAttribute(name);name=name.slice(0,-1)}if(oneTime)return u pdateAttribute(this,name,conditional,value);var observable=value;updateAttribute (this,name,conditional,observable.open(attributeBinding(this,name,conditional))) ;return maybeUpdateBindings(this,name,observable)};var checkboxEventType;(functi on(){var div=document.createElement("div");var checkbox=div.appendChild(document .createElement("input"));checkbox.setAttribute("type","checkbox");var first;var count=0;checkbox.addEventListener("click",function(e){count++;first=first||"clic k"});checkbox.addEventListener("change",function(){count++;first=first||"change" });var event=document.createEvent("MouseEvent");event.initMouseEvent("click",tru e,true,window,0,0,0,0,0,false,false,false,false,0,null);checkbox.dispatchEvent(e vent);checkboxEventType=count==1?"change":first})();function getEventForInputTyp e(element){switch(element.type){case"checkbox":return checkboxEventType;case"rad io":case"select-multiple":case"select-one":return"change";case"range":if(/Triden t|MSIE/.test(navigator.userAgent))return"change";default:return"input"}}function updateInput(input,property,value,santizeFn){input[property]=(santizeFn||sanitiz eValue)(value)}function inputBinding(input,property,santizeFn){return function(v alue){return updateInput(input,property,value,santizeFn)}}function noop(){}funct ion bindInputEvent(input,property,observable,postEventFn){var eventType=getEvent ForInputType(input);function eventHandler(){observable.setValue(input[property]) ;observable.discardChanges();(postEventFn||noop)(input);Platform.performMicrotas kCheckpoint()}input.addEventListener(eventType,eventHandler);return{close:functi on(){input.removeEventListener(eventType,eventHandler);observable.close()},obser vable_:observable}}function booleanSanitize(value){return Boolean(value)}functio n getAssociatedRadioButtons(element){if(element.form){return filter(element.form .elements,function(el){return el!=element&&el.tagName=="INPUT"&&el.type=="radio" &&el.name==element.name})}else{var treeScope=getTreeScope(element);if(!treeScope )return[];var radios=treeScope.querySelectorAll('input[type="radio"][name="'+ele ment.name+'"]');return filter(radios,function(el){return el!=element&&!el.form}) }}function checkedPostEvent(input){if(input.tagName==="INPUT"&&input.type==="rad io"){getAssociatedRadioButtons(input).forEach(function(radio){var checkedBinding =radio.bindings_.checked;if(checkedBinding){checkedBinding.observable_.setValue( false)}})}}HTMLInputElement.prototype.bind=function(name,value,oneTime){if(name! =="value"&&name!=="checked")return HTMLElement.prototype.bind.call(this,name,val ue,oneTime);this.removeAttribute(name);var sanitizeFn=name=="checked"?booleanSan itize:sanitizeValue;var postEventFn=name=="checked"?checkedPostEvent:noop;if(one Time)return updateInput(this,name,value,sanitizeFn);var observable=value;var bin ding=bindInputEvent(this,name,observable,postEventFn);updateInput(this,name,obse rvable.open(inputBinding(this,name,sanitizeFn)),sanitizeFn);return updateBinding s(this,name,binding)};HTMLTextAreaElement.prototype.bind=function(name,value,one Time){if(name!=="value")return HTMLElement.prototype.bind.call(this,name,value,o neTime);this.removeAttribute("value");if(oneTime)return updateInput(this,"value" ,value);var observable=value;var binding=bindInputEvent(this,"value",observable) ;updateInput(this,"value",observable.open(inputBinding(this,"value",sanitizeValu e)));return maybeUpdateBindings(this,name,binding)};function updateOption(option ,value){var parentNode=option.parentNode;var select;var selectBinding;var oldVal ue;if(parentNode instanceof HTMLSelectElement&&parentNode.bindings_&&parentNode. bindings_.value){select=parentNode;selectBinding=select.bindings_.value;oldValue =select.value}option.value=sanitizeValue(value);if(select&&select.value!=oldValu e){selectBinding.observable_.setValue(select.value);selectBinding.observable_.di scardChanges();Platform.performMicrotaskCheckpoint()}}function optionBinding(opt ion){return function(value){updateOption(option,value)}}HTMLOptionElement.protot ype.bind=function(name,value,oneTime){if(name!=="value")return HTMLElement.proto type.bind.call(this,name,value,oneTime);this.removeAttribute("value");if(oneTime )return updateOption(this,value);var observable=value;var binding=bindInputEvent (this,"value",observable);updateOption(this,observable.open(optionBinding(this)) );return maybeUpdateBindings(this,name,binding)};HTMLSelectElement.prototype.bin d=function(name,value,oneTime){if(name==="selectedindex")name="selectedIndex";if (name!=="selectedIndex"&&name!=="value")return HTMLElement.prototype.bind.call(t his,name,value,oneTime);this.removeAttribute(name);if(oneTime)return updateInput (this,name,value);var observable=value;var binding=bindInputEvent(this,name,obse rvable);updateInput(this,name,observable.open(inputBinding(this,name)));return u pdateBindings(this,name,binding)}})(this);(function(global){"use strict";functio n assert(v){if(!v)throw new Error("Assertion failed")}var forEach=Array.prototyp e.forEach.call.bind(Array.prototype.forEach);function getFragmentRoot(node){var p;while(p=node.parentNode){node=p}return node}function searchRefId(node,id){if(! id)return;
17 var ref;var selector="#"+id;while(!ref){node=getFragmentRoot(node);if(node.proto Content_)ref=node.protoContent_.querySelector(selector);else if(node.getElementB yId)ref=node.getElementById(id);if(ref||!node.templateCreator_)break;node=node.t emplateCreator_}return ref}function getInstanceRoot(node){while(node.parentNode) {node=node.parentNode}return node.templateCreator_?node:null}var Map;if(global.M ap&&typeof global.Map.prototype.forEach==="function"){Map=global.Map}else{Map=fu nction(){this.keys=[];this.values=[]};Map.prototype={set:function(key,value){var index=this.keys.indexOf(key);if(index<0){this.keys.push(key);this.values.push(v alue)}else{this.values[index]=value}},get:function(key){var index=this.keys.inde xOf(key);if(index<0)return;return this.values[index]},"delete":function(key,valu e){var index=this.keys.indexOf(key);if(index<0)return false;this.keys.splice(ind ex,1);this.values.splice(index,1);return true},forEach:function(f,opt_this){for( var i=0;i<this.keys.length;i++)f.call(opt_this||this,this.values[i],this.keys[i] ,this)}}}var createObject="__proto__"in{}?function(obj){return obj}:function(obj ){var proto=obj.__proto__;if(!proto)return obj;var newObject=Object.create(proto );Object.getOwnPropertyNames(obj).forEach(function(name){Object.defineProperty(n ewObject,name,Object.getOwnPropertyDescriptor(obj,name))});return newObject};if( typeof document.contains!="function"){Document.prototype.contains=function(node) {if(node===this||node.parentNode===this)return true;return this.documentElement. contains(node)}}var BIND="bind";var REPEAT="repeat";var IF="if";var templateAttr ibuteDirectives={template:true,repeat:true,bind:true,ref:true};var semanticTempl ateElements={THEAD:true,TBODY:true,TFOOT:true,TH:true,TR:true,TD:true,COLGROUP:t rue,COL:true,CAPTION:true,OPTION:true,OPTGROUP:true};var hasTemplateElement=type of HTMLTemplateElement!=="undefined";if(hasTemplateElement){(function(){var t=do cument.createElement("template");var d=t.content.ownerDocument;var html=d.append Child(d.createElement("html"));var head=html.appendChild(d.createElement("head") );var base=d.createElement("base");base.href=document.baseURI;head.appendChild(b ase)})()}var allTemplatesSelectors="template, "+Object.keys(semanticTemplateElem ents).map(function(tagName){return tagName.toLowerCase()+"[template]"}).join(", ");function isSVGTemplate(el){return el.tagName=="template"&&el.namespaceURI=="h ttp://www.w3.org/2000/svg"}function isHTMLTemplate(el){return el.tagName=="TEMPL ATE"&&el.namespaceURI=="http://www.w3.org/1999/xhtml"}function isAttributeTempla te(el){return Boolean(semanticTemplateElements[el.tagName]&&el.hasAttribute("tem plate"))}function isTemplate(el){if(el.isTemplate_===undefined)el.isTemplate_=el .tagName=="TEMPLATE"||isAttributeTemplate(el);return el.isTemplate_}document.add EventListener("DOMContentLoaded",function(e){bootstrapTemplatesRecursivelyFrom(d ocument);Platform.performMicrotaskCheckpoint()},false);function forAllTemplatesF rom(node,fn){var subTemplates=node.querySelectorAll(allTemplatesSelectors);if(is Template(node))fn(node);forEach(subTemplates,fn)}function bootstrapTemplatesRecu rsivelyFrom(node){function bootstrap(template){if(!HTMLTemplateElement.decorate( template))bootstrapTemplatesRecursivelyFrom(template.content)}forAllTemplatesFro m(node,bootstrap)}if(!hasTemplateElement){global.HTMLTemplateElement=function(){ throw TypeError("Illegal constructor")}}var hasProto="__proto__"in{};function mi xin(to,from){Object.getOwnPropertyNames(from).forEach(function(name){Object.defi neProperty(to,name,Object.getOwnPropertyDescriptor(from,name))})}function getOrC reateTemplateContentsOwner(template){var doc=template.ownerDocument;if(!doc.defa ultView)return doc;var d=doc.templateContentsOwner_;if(!d){d=doc.implementation. createHTMLDocument("");while(d.lastChild){d.removeChild(d.lastChild)}doc.templat eContentsOwner_=d}return d}function getTemplateStagingDocument(template){if(!tem plate.stagingDocument_){var owner=template.ownerDocument;if(!owner.stagingDocume nt_){owner.stagingDocument_=owner.implementation.createHTMLDocument("");owner.st agingDocument_.isStagingDocument=true;var base=owner.stagingDocument_.createElem ent("base");base.href=document.baseURI;owner.stagingDocument_.head.appendChild(b ase);owner.stagingDocument_.stagingDocument_=owner.stagingDocument_}template.sta gingDocument_=owner.stagingDocument_}return template.stagingDocument_}function e xtractTemplateFromAttributeTemplate(el){var template=el.ownerDocument.createElem ent("template");el.parentNode.insertBefore(template,el);var attribs=el.attribute s;var count=attribs.length;while(count-->0){var attrib=attribs[count];if(templat eAttributeDirectives[attrib.name]){if(attrib.name!=="template")template.setAttri bute(attrib.name,attrib.value);el.removeAttribute(attrib.name)}}return template} function extractTemplateFromSVGTemplate(el){var template=el.ownerDocument.create Element("template");el.parentNode.insertBefore(template,el);var attribs=el.attri butes;var count=attribs.length;while(count-->0){var attrib=attribs[count];templa te.setAttribute(attrib.name,attrib.value);el.removeAttribute(attrib.name)}el.par entNode.removeChild(el);return template}function liftNonNativeTemplateChildrenIn toContent(template,el,useRoot){var content=template.content;if(useRoot){content. appendChild(el);return}var child;while(child=el.firstChild){content.appendChild( child)}}var templateObserver;if(typeof MutationObserver=="function"){templateObs erver=new MutationObserver(function(records){for(var i=0;i<records.length;i++){r ecords[i].target.refChanged_()}})}HTMLTemplateElement.decorate=function(el,opt_i nstanceRef){if(el.templateIsDecorated_)return false;var templateElement=el;templ ateElement.templateIsDecorated_=true;var isNativeHTMLTemplate=isHTMLTemplate(tem plateElement)&&hasTemplateElement;var bootstrapContents=isNativeHTMLTemplate;var liftContents=!isNativeHTMLTemplate;var liftRoot=false;if(!isNativeHTMLTemplate) {if(isAttributeTemplate(templateElement)){assert(!opt_instanceRef);templateEleme nt=extractTemplateFromAttributeTemplate(el);templateElement.templateIsDecorated_ =true;isNativeHTMLTemplate=hasTemplateElement;liftRoot=true}else if(isSVGTemplat e(templateElement)){templateElement=extractTemplateFromSVGTemplate(el);templateE lement.templateIsDecorated_=true;isNativeHTMLTemplate=hasTemplateElement}}if(!is NativeHTMLTemplate){fixTemplateElementPrototype(templateElement);var doc=getOrCr eateTemplateContentsOwner(templateElement);templateElement.content_=doc.createDo cumentFragment()}if(opt_instanceRef){templateElement.instanceRef_=opt_instanceRe f}else if(liftContents){liftNonNativeTemplateChildrenIntoContent(templateElement ,el,liftRoot)}else if(bootstrapContents){bootstrapTemplatesRecursivelyFrom(templ ateElement.content)}return true};HTMLTemplateElement.bootstrap=bootstrapTemplate sRecursivelyFrom;var htmlElement=global.HTMLUnknownElement||HTMLElement;var cont entDescriptor={get:function(){return this.content_},enumerable:true,configurable :true};if(!hasTemplateElement){HTMLTemplateElement.prototype=Object.create(htmlE lement.prototype);Object.defineProperty(HTMLTemplateElement.prototype,"content", contentDescriptor)}function fixTemplateElementPrototype(el){if(hasProto)el.__pro to__=HTMLTemplateElement.prototype;else mixin(el,HTMLTemplateElement.prototype)} function ensureSetModelScheduled(template){if(!template.setModelFn_){template.se tModelFn_=function(){template.setModelFnScheduled_=false;var map=getBindings(tem plate,template.delegate_&&template.delegate_.prepareBinding);processBindings(tem plate,map,template.model_)}}if(!template.setModelFnScheduled_){template.setModel FnScheduled_=true;Observer.runEOM_(template.setModelFn_)}}mixin(HTMLTemplateElem ent.prototype,{bind:function(name,value,oneTime){if(name!="ref")return Element.p rototype.bind.call(this,name,value,oneTime);var self=this;var ref=oneTime?value: value.open(function(ref){self.setAttribute("ref",ref);self.refChanged_()});this. setAttribute("ref",ref);this.refChanged_();if(oneTime)return;if(!this.bindings_) {this.bindings_={ref:value}}else{this.bindings_.ref=value}return value},processB indingDirectives_:function(directives){if(this.iterator_)this.iterator_.closeDep s();if(!directives.if&&!directives.bind&&!directives.repeat){if(this.iterator_){ this.iterator_.close();this.iterator_=undefined}return}if(!this.iterator_){this. iterator_=new TemplateIterator(this)}this.iterator_.updateDependencies(directive s,this.model_);if(templateObserver){templateObserver.observe(this,{attributes:tr ue,attributeFilter:["ref"]})}return this.iterator_},createInstance:function(mode l,bindingDelegate,delegate_){if(bindingDelegate)delegate_=this.newDelegate_(bind ingDelegate);else if(!delegate_)delegate_=this.delegate_;if(!this.refContent_)th is.refContent_=this.ref_.content;var content=this.refContent_;if(content.firstCh ild===null)return emptyInstance;var map=getInstanceBindingMap(content,delegate_) ;var stagingDocument=getTemplateStagingDocument(this);var instance=stagingDocume nt.createDocumentFragment();instance.templateCreator_=this;instance.protoContent _=content;instance.bindings_=[];instance.terminator_=null;var instanceRecord=ins tance.templateInstance_={firstNode:null,lastNode:null,model:model};var i=0;var c ollectTerminator=false;for(var child=content.firstChild;child;child=child.nextSi bling){if(child.nextSibling===null)collectTerminator=true;var clone=cloneAndBind Instance(child,instance,stagingDocument,map.children[i++],model,delegate_,instan ce.bindings_);clone.templateInstance_=instanceRecord;if(collectTerminator)instan ce.terminator_=clone}instanceRecord.firstNode=instance.firstChild;instanceRecord .lastNode=instance.lastChild;instance.templateCreator_=undefined;instance.protoC ontent_=undefined;return instance},get model(){return this.model_},set model(mod el){this.model_=model;ensureSetModelScheduled(this)},get bindingDelegate(){retur n this.delegate_&&this.delegate_.raw},refChanged_:function(){if(!this.iterator_| |this.refContent_===this.ref_.content)return;this.refContent_=undefined;this.ite rator_.valueChanged();this.iterator_.updateIteratedValue(this.iterator_.getUpdat edValue())},clear:function(){this.model_=undefined;this.delegate_=undefined;if(t his.bindings_&&this.bindings_.ref)this.bindings_.ref.close();this.refContent_=un defined;if(!this.iterator_)return;this.iterator_.valueChanged();this.iterator_.c lose();this.iterator_=undefined},setDelegate_:function(delegate){this.delegate_= delegate;this.bindingMap_=undefined;if(this.iterator_){this.iterator_.instancePo sitionChangedFn_=undefined;this.iterator_.instanceModelFn_=undefined}},newDelega te_:function(bindingDelegate){if(!bindingDelegate)return;function delegateFn(nam e){var fn=bindingDelegate&&bindingDelegate[name];if(typeof fn!="function")return ;return function(){return fn.apply(bindingDelegate,arguments)}}return{bindingMap s:{},raw:bindingDelegate,prepareBinding:delegateFn("prepareBinding"),prepareInst anceModel:delegateFn("prepareInstanceModel"),prepareInstancePositionChanged:dele gateFn("prepareInstancePositionChanged")}},set bindingDelegate(bindingDelegate){ if(this.delegate_){throw Error("Template must be cleared before a new bindingDel egate "+"can be assigned")}this.setDelegate_(this.newDelegate_(bindingDelegate)) },get ref_(){var ref=searchRefId(this,this.getAttribute("ref"));if(!ref)ref=this .instanceRef_;if(!ref)return this;var nextRef=ref.ref_;return nextRef?nextRef:re f}});function parseMustaches(s,name,node,prepareBindingFn){if(!s||!s.length)retu rn;var tokens;var length=s.length;var startIndex=0,lastIndex=0,endIndex=0;var on lyOneTime=true;while(lastIndex<length){var startIndex=s.indexOf("{{",lastIndex); var oneTimeStart=s.indexOf("[[",lastIndex);var oneTime=false;var terminator="}}" ;if(oneTimeStart>=0&&(startIndex<0||oneTimeStart<startIndex)){startIndex=oneTime Start;oneTime=true;terminator="]]"}endIndex=startIndex<0?-1:s.indexOf(terminator ,startIndex+2);if(endIndex<0){if(!tokens)return;tokens.push(s.slice(lastIndex)); break}tokens=tokens||[];tokens.push(s.slice(lastIndex,startIndex));var pathStrin g=s.slice(startIndex+2,endIndex).trim();tokens.push(oneTime);onlyOneTime=onlyOne Time&&oneTime;var delegateFn=prepareBindingFn&&prepareBindingFn(pathString,name, node);if(delegateFn==null){tokens.push(Path.get(pathString))}else{tokens.push(nu ll)}tokens.push(delegateFn);lastIndex=endIndex+2}if(lastIndex===length)tokens.pu sh("");tokens.hasOnePath=tokens.length===5;tokens.isSimplePath=tokens.hasOnePath &&tokens[0]==""&&tokens[4]=="";tokens.onlyOneTime=onlyOneTime;tokens.combinator= function(values){var newValue=tokens[0];for(var i=1;i<tokens.length;i+=4){var va lue=tokens.hasOnePath?values:values[(i-1)/4];if(value!==undefined)newValue+=valu e;newValue+=tokens[i+3]}return newValue};return tokens}function processOneTimeBi nding(name,tokens,node,model){if(tokens.hasOnePath){var delegateFn=tokens[3];var value=delegateFn?delegateFn(model,node,true):tokens[2].getValueFrom(model);retu rn tokens.isSimplePath?value:tokens.combinator(value)}var values=[];for(var i=1; i<tokens.length;i+=4){var delegateFn=tokens[i+2];values[(i-1)/4]=delegateFn?dele gateFn(model,node):tokens[i+1].getValueFrom(model)}return tokens.combinator(valu es)}function processSinglePathBinding(name,tokens,node,model){var delegateFn=tok ens[3];var observer=delegateFn?delegateFn(model,node,false):new PathObserver(mod el,tokens[2]);return tokens.isSimplePath?observer:new ObserverTransform(observer ,tokens.combinator)}function processBinding(name,tokens,node,model){if(tokens.on lyOneTime)return processOneTimeBinding(name,tokens,node,model);if(tokens.hasOneP ath)return processSinglePathBinding(name,tokens,node,model);var observer=new Com poundObserver;for(var i=1;i<tokens.length;i+=4){var oneTime=tokens[i];var delega teFn=tokens[i+2];if(delegateFn){var value=delegateFn(model,node,oneTime);if(oneT ime)observer.addPath(value);else observer.addObserver(value);continue}var path=t okens[i+1];if(oneTime)observer.addPath(path.getValueFrom(model));else observer.a ddPath(model,path)}return new ObserverTransform(observer,tokens.combinator)}func tion processBindings(node,bindings,model,instanceBindings){for(var i=0;i<binding s.length;i+=2){var name=bindings[i];var tokens=bindings[i+1];var value=processBi nding(name,tokens,node,model);var binding=node.bind(name,value,tokens.onlyOneTim e);if(binding&&instanceBindings)instanceBindings.push(binding)}node.bindFinished ();if(!bindings.isTemplate)return;node.model_=model;var iter=node.processBinding Directives_(bindings);if(instanceBindings&&iter)instanceBindings.push(iter)}func tion parseWithDefault(el,name,prepareBindingFn){var v=el.getAttribute(name);retu rn parseMustaches(v==""?"{{}}":v,name,el,prepareBindingFn)}function parseAttribu teBindings(element,prepareBindingFn){assert(element);var bindings=[];var ifFound =false;var bindFound=false;for(var i=0;i<element.attributes.length;i++){var attr =element.attributes[i];var name=attr.name;var value=attr.value;while(name[0]===" _"){name=name.substring(1)}if(isTemplate(element)&&(name===IF||name===BIND||name ===REPEAT)){continue}var tokens=parseMustaches(value,name,element,prepareBinding Fn);if(!tokens)continue;bindings.push(name,tokens)}if(isTemplate(element)){bindi ngs.isTemplate=true;bindings.if=parseWithDefault(element,IF,prepareBindingFn);bi ndings.bind=parseWithDefault(element,BIND,prepareBindingFn);bindings.repeat=pars eWithDefault(element,REPEAT,prepareBindingFn);if(bindings.if&&!bindings.bind&&!b indings.repeat)bindings.bind=parseMustaches("{{}}",BIND,element,prepareBindingFn )}return bindings}function getBindings(node,prepareBindingFn){if(node.nodeType== =Node.ELEMENT_NODE)return parseAttributeBindings(node,prepareBindingFn);if(node. nodeType===Node.TEXT_NODE){var tokens=parseMustaches(node.data,"textContent",nod e,prepareBindingFn);if(tokens)return["textContent",tokens]}return[]}function clo neAndBindInstance(node,parent,stagingDocument,bindings,model,delegate,instanceBi ndings,instanceRecord){var clone=parent.appendChild(stagingDocument.importNode(n ode,false));var i=0;for(var child=node.firstChild;child;child=child.nextSibling) {cloneAndBindInstance(child,clone,stagingDocument,bindings.children[i++],model,d elegate,instanceBindings)}if(bindings.isTemplate){HTMLTemplateElement.decorate(c lone,node);if(delegate)clone.setDelegate_(delegate)}processBindings(clone,bindin gs,model,instanceBindings);return clone}function createInstanceBindingMap(node,p repareBindingFn){var map=getBindings(node,prepareBindingFn);map.children={};var index=0;for(var child=node.firstChild;child;child=child.nextSibling){map.childre n[index++]=createInstanceBindingMap(child,prepareBindingFn)}return map}var conte ntUidCounter=1;function getContentUid(content){var id=content.id_;if(!id)id=cont ent.id_=contentUidCounter++;return id}function getInstanceBindingMap(content,del egate_){var contentId=getContentUid(content);if(delegate_){var map=delegate_.bin dingMaps[contentId];if(!map){map=delegate_.bindingMaps[contentId]=createInstance BindingMap(content,delegate_.prepareBinding)||[]}return map}var map=content.bind ingMap_;if(!map){map=content.bindingMap_=createInstanceBindingMap(content,undefi ned)||[]}return map}Object.defineProperty(Node.prototype,"templateInstance",{get :function(){var instance=this.templateInstance_;return instance?instance:this.pa rentNode?this.parentNode.templateInstance:undefined}});var emptyInstance=documen t.createDocumentFragment();emptyInstance.bindings_=[];emptyInstance.terminator_= null;function TemplateIterator(templateElement){this.closed=false;this.templateE lement_=templateElement;this.instances=[];this.deps=undefined;this.iteratedValue =[];this.presentValue=undefined;this.arrayObserver=undefined}TemplateIterator.pr ototype={closeDeps:function(){var deps=this.deps;if(deps){if(deps.ifOneTime===fa lse)deps.ifValue.close();if(deps.oneTime===false)deps.value.close()}},updateDepe ndencies:function(directives,model){this.closeDeps();var deps=this.deps={};var t emplate=this.templateElement_;var ifValue=true;if(directives.if){deps.hasIf=true ;deps.ifOneTime=directives.if.onlyOneTime;deps.ifValue=processBinding(IF,directi ves.if,template,model);ifValue=deps.ifValue;if(deps.ifOneTime&&!ifValue){this.va lueChanged();return}if(!deps.ifOneTime)ifValue=ifValue.open(this.updateIfValue,t his)}if(directives.repeat){deps.repeat=true;deps.oneTime=directives.repeat.onlyO neTime;deps.value=processBinding(REPEAT,directives.repeat,template,model)}else{d eps.repeat=false;deps.oneTime=directives.bind.onlyOneTime;deps.value=processBind ing(BIND,directives.bind,template,model)}var value=deps.value;if(!deps.oneTime)v alue=value.open(this.updateIteratedValue,this);if(!ifValue){this.valueChanged(); return}this.updateValue(value)},getUpdatedValue:function(){var value=this.deps.v alue;if(!this.deps.oneTime)value=value.discardChanges();return value},updateIfVa lue:function(ifValue){if(!ifValue){this.valueChanged();return}this.updateValue(t his.getUpdatedValue())},updateIteratedValue:function(value){if(this.deps.hasIf){ var ifValue=this.deps.ifValue;if(!this.deps.ifOneTime)ifValue=ifValue.discardCha nges();if(!ifValue){this.valueChanged();return}}this.updateValue(value)},updateV alue:function(value){if(!this.deps.repeat)value=[value];var observe=this.deps.re peat&&!this.deps.oneTime&&Array.isArray(value);this.valueChanged(value,observe)} ,valueChanged:function(value,observeValue){if(!Array.isArray(value))value=[];if( value===this.iteratedValue)return;this.unobserve();this.presentValue=value;if(ob serveValue){this.arrayObserver=new ArrayObserver(this.presentValue);this.arrayOb server.open(this.handleSplices,this)}this.handleSplices(ArrayObserver.calculateS plices(this.presentValue,this.iteratedValue))},getLastInstanceNode:function(inde x){if(index==-1)return this.templateElement_;var instance=this.instances[index]; var terminator=instance.terminator_;if(!terminator)return this.getLastInstanceNo de(index-1);if(terminator.nodeType!==Node.ELEMENT_NODE||this.templateElement_=== terminator){return terminator}var subtemplateIterator=terminator.iterator_;if(!s ubtemplateIterator)return terminator;return subtemplateIterator.getLastTemplateN ode()},getLastTemplateNode:function(){return this.getLastInstanceNode(this.insta nces.length-1)},insertInstanceAt:function(index,fragment){var previousInstanceLa st=this.getLastInstanceNode(index-1);var parent=this.templateElement_.parentNode ;this.instances.splice(index,0,fragment);parent.insertBefore(fragment,previousIn stanceLast.nextSibling)},extractInstanceAt:function(index){var previousInstanceL ast=this.getLastInstanceNode(index-1);var lastNode=this.getLastInstanceNode(inde x);var parent=this.templateElement_.parentNode;var instance=this.instances.splic e(index,1)[0];while(lastNode!==previousInstanceLast){var node=previousInstanceLa st.nextSibling;if(node==lastNode)lastNode=previousInstanceLast;instance.appendCh ild(parent.removeChild(node))}return instance},getDelegateFn:function(fn){fn=fn& &fn(this.templateElement_);return typeof fn==="function"?fn:null},handleSplices: function(splices){if(this.closed||!splices.length)return;var template=this.templ ateElement_;if(!template.parentNode){this.close();return}ArrayObserver.applySpli ces(this.iteratedValue,this.presentValue,splices);var delegate=template.delegate _;if(this.instanceModelFn_===undefined){this.instanceModelFn_=this.getDelegateFn (delegate&&delegate.prepareInstanceModel)}if(this.instancePositionChangedFn_===u ndefined){this.instancePositionChangedFn_=this.getDelegateFn(delegate&&delegate. prepareInstancePositionChanged)}var instanceCache=new Map;var removeDelta=0;for( var i=0;i<splices.length;i++){var splice=splices[i];var removed=splice.removed;f or(var j=0;j<removed.length;j++){var model=removed[j];var instance=this.extractI nstanceAt(splice.index+removeDelta);if(instance!==emptyInstance){instanceCache.s et(model,instance)}}removeDelta-=splice.addedCount}for(var i=0;i<splices.length; i++){var splice=splices[i];var addIndex=splice.index;for(;addIndex<splice.index+ splice.addedCount;addIndex++){var model=this.iteratedValue[addIndex];var instanc e=instanceCache.get(model);if(instance){instanceCache.delete(model)}else{if(this .instanceModelFn_){model=this.instanceModelFn_(model)}if(model===undefined){inst ance=emptyInstance}else{instance=template.createInstance(model,undefined,delegat e)}}this.insertInstanceAt(addIndex,instance)}}instanceCache.forEach(function(ins tance){this.closeInstanceBindings(instance)},this);if(this.instancePositionChang edFn_)this.reportInstancesMoved(splices)},reportInstanceMoved:function(index){va r instance=this.instances[index];if(instance===emptyInstance)return;this.instanc ePositionChangedFn_(instance.templateInstance_,index)},reportInstancesMoved:func tion(splices){var index=0;var offset=0;for(var i=0;i<splices.length;i++){var spl ice=splices[i];if(offset!=0){while(index<splice.index){this.reportInstanceMoved( index);index++}}else{index=splice.index}while(index<splice.index+splice.addedCou nt){this.reportInstanceMoved(index);index++}offset+=splice.addedCount-splice.rem oved.length}if(offset==0)return;var length=this.instances.length;while(index<len gth){this.reportInstanceMoved(index);index++}},closeInstanceBindings:function(in stance){var bindings=instance.bindings_;for(var i=0;i<bindings.length;i++){bindi ngs[i].close()}},unobserve:function(){if(!this.arrayObserver)return;this.arrayOb server.close();this.arrayObserver=undefined},close:function(){if(this.closed)ret urn;this.unobserve();for(var i=0;i<this.instances.length;i++){this.closeInstance Bindings(this.instances[i])}this.instances.length=0;this.closeDeps();this.templa teElement_.iterator_=undefined;this.closed=true}};HTMLTemplateElement.forAllTemp latesFrom_=forAllTemplatesFrom})(this);(function(scope){"use strict";var hasWork ingUrl=false;if(!scope.forceJURL){try{var u=new URL("b","http://a");hasWorkingUr l=u.href==="http://a/b"}catch(e){}}if(hasWorkingUrl)return;var relative=Object.c reate(null);relative["ftp"]=21;relative["file"]=0;relative["gopher"]=70;relative ["http"]=80;relative["https"]=443;relative["ws"]=80;relative["wss"]=443;var rela tivePathDotMapping=Object.create(null);relativePathDotMapping["%2e"]=".";relativ ePathDotMapping[".%2e"]="..";relativePathDotMapping["%2e."]="..";relativePathDot Mapping["%2e%2e"]="..";function isRelativeScheme(scheme){return relative[scheme] !==undefined}function invalid(){clear.call(this);this._isInvalid=true}function I DNAToASCII(h){if(""==h){invalid.call(this)}return h.toLowerCase()}function perce ntEscape(c){var unicode=c.charCodeAt(0);if(unicode>32&&unicode<127&&[34,35,60,62 ,63,96].indexOf(unicode)==-1){return c}return encodeURIComponent(c)}function per centEscapeQuery(c){var unicode=c.charCodeAt(0);if(unicode>32&&unicode<127&&[34,3 5,60,62,96].indexOf(unicode)==-1){return c}return encodeURIComponent(c)}var EOF= undefined,ALPHA=/[a-zA-Z]/,ALPHANUMERIC=/[a-zA-Z0-9\+\-\.]/;function parse(input ,stateOverride,base){function err(message){errors.push(message)}var state=stateO verride||"scheme start",cursor=0,buffer="",seenAt=false,seenBracket=false,errors =[];loop:while((input[cursor-1]!=EOF||cursor==0)&&!this._isInvalid){var c=input[ cursor];switch(state){case"scheme start":if(c&&ALPHA.test(c)){buffer+=c.toLowerC ase();state="scheme"}else if(!stateOverride){buffer="";state="no scheme";continu e}else{err("Invalid scheme.");break loop}break;case"scheme":if(c&&ALPHANUMERIC.t est(c)){buffer+=c.toLowerCase()}else if(":"==c){this._scheme=buffer;buffer="";if (stateOverride){break loop}if(isRelativeScheme(this._scheme)){this._isRelative=t rue}if("file"==this._scheme){state="relative"}else if(this._isRelative&&base&&ba se._scheme==this._scheme){state="relative or authority"}else if(this._isRelative ){state="authority first slash"}else{state="scheme data"}}else if(!stateOverride ){buffer="";cursor=0;state="no scheme";continue}else if(EOF==c){break loop}else{ err("Code point not allowed in scheme: "+c);break loop}break;case"scheme data":i f("?"==c){query="?";state="query"}else if("#"==c){this._fragment="#";state="frag ment"}else{if(EOF!=c&&" "!=c&&"\n"!=c&&"\r"!=c){this._schemeData+=percentEscape( c)}}break;case"no scheme":if(!base||!isRelativeScheme(base._scheme)){err("Missin g scheme.");invalid.call(this)}else{state="relative";continue}break;case"relativ e or authority":if("/"==c&&"/"==input[cursor+1]){state="authority ignore slashes "}else{err("Expected /, got: "+c);state="relative";continue}break;case"relative" :this._isRelative=true;if("file"!=this._scheme)this._scheme=base._scheme;if(EOF= =c){this._host=base._host;this._port=base._port;this._path=base._path.slice();th is._query=base._query;break loop}else if("/"==c||"\\"==c){if("\\"==c)err("\\ is an invalid code point.");state="relative slash"}else if("?"==c){this._host=base. _host;this._port=base._port;this._path=base._path.slice();this._query="?";state= "query"}else if("#"==c){this._host=base._host;this._port=base._port;this._path=b ase._path.slice();this._query=base._query;this._fragment="#";state="fragment"}el se{var nextC=input[cursor+1];var nextNextC=input[cursor+2];if("file"!=this._sche me||!ALPHA.test(c)||nextC!=":"&&nextC!="|"||EOF!=nextNextC&&"/"!=nextNextC&&"\\" !=nextNextC&&"?"!=nextNextC&&"#"!=nextNextC){this._host=base._host;this._port=ba se._port;this._path=base._path.slice();this._path.pop()}state="relative path";co ntinue}break;case"relative slash":if("/"==c||"\\"==c){if("\\"==c){err("\\ is an invalid code point.")}if("file"==this._scheme){state="file host"}else{state="aut hority ignore slashes"}}else{if("file"!=this._scheme){this._host=base._host;this ._port=base._port}state="relative path";continue}break;case"authority first slas h":if("/"==c){state="authority second slash"}else{err("Expected '/', got: "+c);s tate="authority ignore slashes";continue}break;case"authority second slash":stat e="authority ignore slashes";if("/"!=c){err("Expected '/', got: "+c);continue}br eak;case"authority ignore slashes":if("/"!=c&&"\\"!=c){state="authority";continu e}else{err("Expected authority, got: "+c)}break;case"authority":if("@"==c){if(se enAt){err("@ already seen.");buffer+="%40"}seenAt=true;for(var i=0;i<buffer.leng th;i++){var cp=buffer[i];if(" "==cp||"\n"==cp||"\r"==cp){err("Invalid whitespa ce in authority.");continue}if(":"==cp&&null===this._password){this._password="" ;continue}var tempC=percentEscape(cp);null!==this._password?this._password+=temp C:this._username+=tempC}buffer=""}else if(EOF==c||"/"==c||"\\"==c||"?"==c||"#"== c){cursor-=buffer.length;buffer="";state="host";continue}else{buffer+=c}break;ca se"file host":if(EOF==c||"/"==c||"\\"==c||"?"==c||"#"==c){if(buffer.length==2&&A LPHA.test(buffer[0])&&(buffer[1]==":"||buffer[1]=="|")){state="relative path"}el se if(buffer.length==0){state="relative path start"}else{this._host=IDNAToASCII. call(this,buffer);buffer="";state="relative path start"}continue}else if(" "==c||"\n"==c||"\r"==c){err("Invalid whitespace in file host.")}else{buffer+=c}b reak;case"host":case"hostname":if(":"==c&&!seenBracket){this._host=IDNAToASCII.c all(this,buffer);buffer="";state="port";if("hostname"==stateOverride){break loop }}else if(EOF==c||"/"==c||"\\"==c||"?"==c||"#"==c){this._host=IDNAToASCII.call(t his,buffer);buffer="";state="relative path start";if(stateOverride){break loop}c ontinue}else if(" "!=c&&"\n"!=c&&"\r"!=c){if("["==c){seenBracket=true}else if("]"==c){seenBracket=false}buffer+=c}else{err("Invalid code point in host/hos tname: "+c)}break;case"port":if(/[0-9]/.test(c)){buffer+=c}else if(EOF==c||"/"== c||"\\"==c||"?"==c||"#"==c||stateOverride){if(""!=buffer){var temp=parseInt(buff er,10);if(temp!=relative[this._scheme]){this._port=temp+""}buffer=""}if(stateOve rride){break loop}state="relative path start";continue}else if(" "==c||"\ n"==c||"\r"==c){err("Invalid code point in port: "+c)}else{invalid.call(this)}br eak;case"relative path start":if("\\"==c)err("'\\' not allowed in path.");state= "relative path";if("/"!=c&&"\\"!=c){continue}break;case"relative path":if(EOF==c ||"/"==c||"\\"==c||!stateOverride&&("?"==c||"#"==c)){if("\\"==c){err("\\ not all owed in relative path.")}var tmp;if(tmp=relativePathDotMapping[buffer.toLowerCas e()]){buffer=tmp}if(".."==buffer){this._path.pop();if("/"!=c&&"\\"!=c){this._pat h.push("")}}else if("."==buffer&&"/"!=c&&"\\"!=c){this._path.push("")}else if(". "!=buffer){if("file"==this._scheme&&this._path.length==0&&buffer.length==2&&ALPH A.test(buffer[0])&&buffer[1]=="|"){buffer=buffer[0]+":"}this._path.push(buffer)} buffer="";if("?"==c){this._query="?";state="query"}else if("#"==c){this._fragmen t="#";state="fragment"}}else if(" "!=c&&"\n"!=c&&"\r"!=c){buffer+=percentE scape(c)}break;case"query":if(!stateOverride&&"#"==c){this._fragment="#";state=" fragment"}else if(EOF!=c&&" "!=c&&"\n"!=c&&"\r"!=c){this._query+=percentEsca peQuery(c)}break;case"fragment":if(EOF!=c&&" "!=c&&"\n"!=c&&"\r"!=c){this._fr agment+=c}break}cursor++}}function clear(){this._scheme="";this._schemeData="";t his._username="";this._password=null;this._host="";this._port="";this._path=[];t his._query="";this._fragment="";this._isInvalid=false;this._isRelative=false}fun ction jURL(url,base){if(base!==undefined&&!(base instanceof jURL))base=new jURL( String(base));this._url=url;clear.call(this);var input=url.replace(/^[ \t\r\n\f] +|[ \t\r\n\f]+$/g,"");parse.call(this,input,null,base)}jURL.prototype={get href( ){if(this._isInvalid)return this._url;var authority="";if(""!=this._username||nu ll!=this._password){authority=this._username+(null!=this._password?":"+this._pas sword:"")+"@"}return this.protocol+(this._isRelative?"//"+authority+this.host:"" )+this.pathname+this._query+this._fragment},set href(href){clear.call(this);pars e.call(this,href)},get protocol(){return this._scheme+":"},set protocol(protocol ){if(this._isInvalid)return;parse.call(this,protocol+":","scheme start")},get ho st(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host}, set host(host){if(this._isInvalid||!this._isRelative)return;parse.call(this,host ,"host")},get hostname(){return this._host},set hostname(hostname){if(this._isIn valid||!this._isRelative)return;parse.call(this,hostname,"hostname")},get port() {return this._port},set port(port){if(this._isInvalid||!this._isRelative)return; parse.call(this,port,"port")},get pathname(){return this._isInvalid?"":this._isR elative?"/"+this._path.join("/"):this._schemeData
18 },set pathname(pathname){if(this._isInvalid||!this._isRelative)return;this._path =[];parse.call(this,pathname,"relative path start")},get search(){return this._i sInvalid||!this._query||"?"==this._query?"":this._query},set search(search){if(t his._isInvalid||!this._isRelative)return;this._query="?";if("?"==search[0])searc h=search.slice(1);parse.call(this,search,"query")},get hash(){return this._isInv alid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(hash){if( this._isInvalid)return;this._fragment="#";if("#"==hash[0])hash=hash.slice(1);par se.call(this,hash,"fragment")},get origin(){var host;if(this._isInvalid||!this._ scheme){return""}switch(this._scheme){case"data":case"file":case"javascript":cas e"mailto":return"null"}host=this.host;if(!host){return""}return this._scheme+":/ /"+host}};var OriginalURL=scope.URL;if(OriginalURL){jURL.createObjectURL=functio n(blob){return OriginalURL.createObjectURL.apply(OriginalURL,arguments)};jURL.re vokeObjectURL=function(url){OriginalURL.revokeObjectURL(url)}}scope.URL=jURL})(t his);(function(scope){var iterations=0;var callbacks=[];var twiddle=document.cre ateTextNode("");function endOfMicrotask(callback){twiddle.textContent=iterations ++;callbacks.push(callback)}function atEndOfMicrotask(){while(callbacks.length){ callbacks.shift()()}}new(window.MutationObserver||JsMutationObserver)(atEndOfMic rotask).observe(twiddle,{characterData:true});scope.endOfMicrotask=endOfMicrotas k;Platform.endOfMicrotask=endOfMicrotask})(Polymer);(function(scope){var endOfMi crotask=scope.endOfMicrotask;var log=window.WebComponents?WebComponents.flags.lo g:{};var style=document.createElement("style");style.textContent="template {disp lay: none !important;} /* injected by platform.js */";var head=document.querySel ector("head");head.insertBefore(style,head.firstChild);var flushing;function flu sh(){if(!flushing){flushing=true;endOfMicrotask(function(){flushing=false;log.da ta&&console.group("flush");Platform.performMicrotaskCheckpoint();log.data&&conso le.groupEnd()})}}if(!Observer.hasObjectObserve){var FLUSH_POLL_INTERVAL=125;wind ow.addEventListener("WebComponentsReady",function(){flush();var visibilityHandle r=function(){if(document.visibilityState==="hidden"){if(scope.flushPoll){clearIn terval(scope.flushPoll)}}else{scope.flushPoll=setInterval(flush,FLUSH_POLL_INTER VAL)}};if(typeof document.visibilityState==="string"){document.addEventListener( "visibilitychange",visibilityHandler)}visibilityHandler()})}else{flush=function( ){}}if(window.CustomElements&&!CustomElements.useNative){var originalImportNode= Document.prototype.importNode;Document.prototype.importNode=function(node,deep){ var imported=originalImportNode.call(this,node,deep);CustomElements.upgradeAll(i mported);return imported}}scope.flush=flush;Platform.flush=flush})(window.Polyme r);(function(scope){var urlResolver={resolveDom:function(root,url){url=url||base Url(root);this.resolveAttributes(root,url);this.resolveStyles(root,url);var temp lates=root.querySelectorAll("template");if(templates){for(var i=0,l=templates.le ngth,t;i<l&&(t=templates[i]);i++){if(t.content){this.resolveDom(t.content,url)}} }},resolveTemplate:function(template){this.resolveDom(template.content,baseUrl(t emplate))},resolveStyles:function(root,url){var styles=root.querySelectorAll("st yle");if(styles){for(var i=0,l=styles.length,s;i<l&&(s=styles[i]);i++){this.reso lveStyle(s,url)}}},resolveStyle:function(style,url){url=url||baseUrl(style);styl e.textContent=this.resolveCssText(style.textContent,url)},resolveCssText:functio n(cssText,baseUrl,keepAbsolute){cssText=replaceUrlsInCssText(cssText,baseUrl,kee pAbsolute,CSS_URL_REGEXP);return replaceUrlsInCssText(cssText,baseUrl,keepAbsolu te,CSS_IMPORT_REGEXP)},resolveAttributes:function(root,url){if(root.hasAttribute s&&root.hasAttributes()){this.resolveElementAttributes(root,url)}var nodes=root& &root.querySelectorAll(URL_ATTRS_SELECTOR);if(nodes){for(var i=0,l=nodes.length, n;i<l&&(n=nodes[i]);i++){this.resolveElementAttributes(n,url)}}},resolveElementA ttributes:function(node,url){url=url||baseUrl(node);URL_ATTRS.forEach(function(v ){var attr=node.attributes[v];var value=attr&&attr.value;var replacement;if(valu e&&value.search(URL_TEMPLATE_SEARCH)<0){if(v==="style"){replacement=replaceUrlsI nCssText(value,url,false,CSS_URL_REGEXP)}else{replacement=resolveRelativeUrl(url ,value)}attr.value=replacement}})}};var CSS_URL_REGEXP=/(url\()([^)]*)(\))/g;var CSS_IMPORT_REGEXP=/(@import[\s]+(?!url\())([^;]*)(;)/g;var URL_ATTRS=["href","s rc","action","style","url"];var URL_ATTRS_SELECTOR="["+URL_ATTRS.join("],[")+"]" ;var URL_TEMPLATE_SEARCH="{{.*}}";var URL_HASH="#";function baseUrl(node){var u= new URL(node.ownerDocument.baseURI);u.search="";u.hash="";return u}function repl aceUrlsInCssText(cssText,baseUrl,keepAbsolute,regexp){return cssText.replace(reg exp,function(m,pre,url,post){var urlPath=url.replace(/["']/g,"");urlPath=resolve RelativeUrl(baseUrl,urlPath,keepAbsolute);return pre+"'"+urlPath+"'"+post})}func tion resolveRelativeUrl(baseUrl,url,keepAbsolute){if(url&&url[0]==="/"){return u rl}var u=new URL(url,baseUrl);return keepAbsolute?u.href:makeDocumentRelPath(u.h ref)}function makeDocumentRelPath(url){var root=baseUrl(document.documentElement );var u=new URL(url,root);if(u.host===root.host&&u.port===root.port&&u.protocol= ==root.protocol){return makeRelPath(root,u)}else{return url}}function makeRelPat h(sourceUrl,targetUrl){var source=sourceUrl.pathname;var target=targetUrl.pathna me;var s=source.split("/");var t=target.split("/");while(s.length&&s[0]===t[0]){ s.shift();t.shift()}for(var i=0,l=s.length-1;i<l;i++){t.unshift("..")}var hash=t argetUrl.href.slice(-1)===URL_HASH?URL_HASH:targetUrl.hash;return t.join("/")+ta rgetUrl.search+hash}scope.urlResolver=urlResolver})(Polymer);(function(scope){va r endOfMicrotask=Polymer.endOfMicrotask;function Loader(regex){this.cache=Object .create(null);this.map=Object.create(null);this.requests=0;this.regex=regex}Load er.prototype={extractUrls:function(text,base){var matches=[];var matched,u;while (matched=this.regex.exec(text)){u=new URL(matched[1],base);matches.push({matched :matched[0],url:u.href})}return matches},process:function(text,root,callback){va r matches=this.extractUrls(text,root);var done=callback.bind(null,this.map);this .fetch(matches,done)},fetch:function(matches,callback){var inflight=matches.leng th;if(!inflight){return callback()}var done=function(){if(--inflight===0){callba ck()}};var m,req,url;for(var i=0;i<inflight;i++){m=matches[i];url=m.url;req=this .cache[url];if(!req){req=this.xhr(url);req.match=m;this.cache[url]=req}req.wait( done)}},handleXhr:function(request){var match=request.match;var url=match.url;va r response=request.response||request.responseText||"";this.map[url]=response;thi s.fetch(this.extractUrls(response,url),request.resolve)},xhr:function(url){this. requests++;var request=new XMLHttpRequest;request.open("GET",url,true);request.s end();request.onerror=request.onload=this.handleXhr.bind(this,request);request.p ending=[];request.resolve=function(){var pending=request.pending;for(var i=0;i<p ending.length;i++){pending[i]()}request.pending=null};request.wait=function(fn){ if(request.pending){request.pending.push(fn)}else{endOfMicrotask(fn)}};return re quest}};scope.Loader=Loader})(Polymer);(function(scope){var urlResolver=scope.ur lResolver;var Loader=scope.Loader;function StyleResolver(){this.loader=new Loade r(this.regex)}StyleResolver.prototype={regex:/@import\s+(?:url)?["'\(]*([^'"\)]* )['"\)]*;/g,resolve:function(text,url,callback){var done=function(map){callback( this.flatten(text,url,map))}.bind(this);this.loader.process(text,url,done)},reso lveNode:function(style,url,callback){var text=style.textContent;var done=functio n(text){style.textContent=text;callback(style)};this.resolve(text,url,done)},fla tten:function(text,base,map){var matches=this.loader.extractUrls(text,base);var match,url,intermediate;for(var i=0;i<matches.length;i++){match=matches[i];url=ma tch.url;intermediate=urlResolver.resolveCssText(map[url],url,true);intermediate= this.flatten(intermediate,base,map);text=text.replace(match.matched,intermediate )}return text},loadStyles:function(styles,base,callback){var loaded=0,l=styles.l ength;function loadedStyle(style){loaded++;if(loaded===l&&callback){callback()}} for(var i=0,s;i<l&&(s=styles[i]);i++){this.resolveNode(s,base,loadedStyle)}}};va r styleResolver=new StyleResolver;scope.styleResolver=styleResolver})(Polymer);( function(scope){function extend(prototype,api){if(prototype&&api){Object.getOwnP ropertyNames(api).forEach(function(n){var pd=Object.getOwnPropertyDescriptor(api ,n);if(pd){Object.defineProperty(prototype,n,pd);if(typeof pd.value=="function") {pd.value.nom=n}}})}return prototype}function mixin(inObj){var obj=inObj||{};for (var i=1;i<arguments.length;i++){var p=arguments[i];try{for(var n in p){copyProp erty(n,p,obj)}}catch(x){}}return obj}function copyProperty(inName,inSource,inTar get){var pd=getPropertyDescriptor(inSource,inName);Object.defineProperty(inTarge t,inName,pd)}function getPropertyDescriptor(inObject,inName){if(inObject){var pd =Object.getOwnPropertyDescriptor(inObject,inName);return pd||getPropertyDescript or(Object.getPrototypeOf(inObject),inName)}}scope.extend=extend;scope.mixin=mixi n;Platform.mixin=mixin})(Polymer);(function(scope){var Job=function(inContext){t his.context=inContext;this.boundComplete=this.complete.bind(this)};Job.prototype ={go:function(callback,wait){this.callback=callback;var h;if(!wait){h=requestAni mationFrame(this.boundComplete);this.handle=function(){cancelAnimationFrame(h)}} else{h=setTimeout(this.boundComplete,wait);this.handle=function(){clearTimeout(h )}}},stop:function(){if(this.handle){this.handle();this.handle=null}},complete:f unction(){if(this.handle){this.stop();this.callback.call(this.context)}}};functi on job(job,callback,wait){if(job){job.stop()}else{job=new Job(this)}job.go(callb ack,wait);return job}scope.job=job})(Polymer);(function(scope){var registry={};H TMLElement.register=function(tag,prototype){registry[tag]=prototype};HTMLElement .getPrototypeForTag=function(tag){var prototype=!tag?HTMLElement.prototype:regis try[tag];return prototype||Object.getPrototypeOf(document.createElement(tag))};v ar originalStopPropagation=Event.prototype.stopPropagation;Event.prototype.stopP ropagation=function(){this.cancelBubble=true;originalStopPropagation.apply(this, arguments)};var add=DOMTokenList.prototype.add;var remove=DOMTokenList.prototype .remove;DOMTokenList.prototype.add=function(){for(var i=0;i<arguments.length;i++ ){add.call(this,arguments[i])}};DOMTokenList.prototype.remove=function(){for(var i=0;i<arguments.length;i++){remove.call(this,arguments[i])}};DOMTokenList.proto type.toggle=function(name,bool){if(arguments.length==1){bool=!this.contains(name )}bool?this.add(name):this.remove(name)};DOMTokenList.prototype.switch=function( oldName,newName){oldName&&this.remove(oldName);newName&&this.add(newName)};var A rraySlice=function(){return Array.prototype.slice.call(this)};var namedNodeMap=w indow.NamedNodeMap||window.MozNamedAttrMap||{};NodeList.prototype.array=ArraySli ce;namedNodeMap.prototype.array=ArraySlice;HTMLCollection.prototype.array=ArrayS lice;function createDOM(inTagOrNode,inHTML,inAttrs){var dom=typeof inTagOrNode== "string"?document.createElement(inTagOrNode):inTagOrNode.cloneNode(true);dom.inn erHTML=inHTML;if(inAttrs){for(var n in inAttrs){dom.setAttribute(n,inAttrs[n])}} return dom}scope.createDOM=createDOM})(Polymer);(function(scope){function $super (arrayOfArgs){var caller=$super.caller;var nom=caller.nom;var _super=caller._sup er;if(!_super){if(!nom){nom=caller.nom=nameInThis.call(this,caller)}if(!nom){con sole.warn("called super() on a method not installed declaratively (has no .nom p roperty)")}_super=memoizeSuper(caller,nom,getPrototypeOf(this))}var fn=_super[no m];if(fn){if(!fn._super){memoizeSuper(fn,nom,_super)}return fn.apply(this,arrayO fArgs||[])}}function nameInThis(value){var p=this.__proto__;while(p&&p!==HTMLEle ment.prototype){var n$=Object.getOwnPropertyNames(p);for(var i=0,l=n$.length,n;i <l&&(n=n$[i]);i++){var d=Object.getOwnPropertyDescriptor(p,n);if(typeof d.value= =="function"&&d.value===value){return n}}p=p.__proto__}}function memoizeSuper(me thod,name,proto){var s=nextSuper(proto,name,method);if(s[name]){s[name].nom=name }return method._super=s}function nextSuper(proto,name,caller){while(proto){if(pr oto[name]!==caller&&proto[name]){return proto}proto=getPrototypeOf(proto)}return Object}function getPrototypeOf(prototype){return prototype.__proto__}function h intSuper(prototype){for(var n in prototype){var pd=Object.getOwnPropertyDescript or(prototype,n);if(pd&&typeof pd.value==="function"){pd.value.nom=n}}}scope.supe r=$super})(Polymer);(function(scope){function noopHandler(value){return value}va r typeHandlers={string:noopHandler,undefined:noopHandler,date:function(value){re turn new Date(Date.parse(value)||Date.now())},"boolean":function(value){if(value ===""){return true}return value==="false"?false:!!value},number:function(value){ var n=parseFloat(value);if(n===0){n=parseInt(value)}return isNaN(n)?value:n},obj ect:function(value,currentValue){if(currentValue===null){return value}try{return JSON.parse(value.replace(/'/g,'"'))}catch(e){return value}},"function":function (value,currentValue){return currentValue}};function deserializeValue(value,curre ntValue){var inferredType=typeof currentValue;if(currentValue instanceof Date){i nferredType="date"}return typeHandlers[inferredType](value,currentValue)}scope.d eserializeValue=deserializeValue})(Polymer);(function(scope){var extend=scope.ex tend;var api={};api.declaration={};api.instance={};api.publish=function(apis,pro totype){for(var n in apis){extend(prototype,apis[n])}};scope.api=api})(Polymer); (function(scope){var utils={async:function(method,args,timeout){Polymer.flush(); args=args&&args.length?args:[args];var fn=function(){(this[method]||method).appl y(this,args)}.bind(this);var handle=timeout?setTimeout(fn,timeout):requestAnimat ionFrame(fn);return timeout?handle:~handle},cancelAsync:function(handle){if(hand le<0){cancelAnimationFrame(~handle)}else{clearTimeout(handle)}},fire:function(ty pe,detail,onNode,bubbles,cancelable){var node=onNode||this;var detail=detail===n ull||detail===undefined?{}:detail;var event=new CustomEvent(type,{bubbles:bubble s!==undefined?bubbles:true,cancelable:cancelable!==undefined?cancelable:true,det ail:detail});node.dispatchEvent(event);return event},asyncFire:function(){this.a sync("fire",arguments)},classFollows:function(anew,old,className){if(old){old.cl assList.remove(className)}if(anew){anew.classList.add(className)}},injectBoundHT ML:function(html,element){var template=document.createElement("template");templa te.innerHTML=html;var fragment=this.instanceTemplate(template);if(element){eleme nt.textContent="";element.appendChild(fragment)}return fragment}};var nop=functi on(){};var nob={};utils.asyncMethod=utils.async;scope.api.instance.utils=utils;s cope.nop=nop;scope.nob=nob})(Polymer);(function(scope){var log=window.WebCompone nts?WebComponents.flags.log:{};var EVENT_PREFIX="on-";var events={EVENT_PREFIX:E VENT_PREFIX,addHostListeners:function(){var events=this.eventDelegates;log.event s&&Object.keys(events).length>0&&console.log("[%s] addHostListeners:",this.local Name,events);for(var type in events){var methodName=events[type];PolymerGestures .addEventListener(this,type,this.element.getEventHandler(this,this,methodName))} },dispatchMethod:function(obj,method,args){if(obj){log.events&&console.group("[% s] dispatch [%s]",obj.localName,method);var fn=typeof method==="function"?method :obj[method];if(fn){fn[args?"apply":"call"](obj,args)}log.events&&console.groupE nd();Polymer.flush()}}};scope.api.instance.events=events;scope.addEventListener= function(node,eventType,handlerFn,capture){PolymerGestures.addEventListener(wrap (node),eventType,handlerFn,capture)};scope.removeEventListener=function(node,eve ntType,handlerFn,capture){PolymerGestures.removeEventListener(wrap(node),eventTy pe,handlerFn,capture)}})(Polymer);(function(scope){var attributes={copyInstanceA ttributes:function(){var a$=this._instanceAttributes;for(var k in a$){if(!this.h asAttribute(k)){this.setAttribute(k,a$[k])}}},takeAttributes:function(){if(this. _publishLC){for(var i=0,a$=this.attributes,l=a$.length,a;(a=a$[i])&&i<l;i++){thi s.attributeToProperty(a.name,a.value)}}},attributeToProperty:function(name,value ){var name=this.propertyForAttribute(name);if(name){if(value&&value.search(scope .bindPattern)>=0){return}var currentValue=this[name];var value=this.deserializeV alue(value,currentValue);if(value!==currentValue){this[name]=value}}},propertyFo rAttribute:function(name){var match=this._publishLC&&this._publishLC[name];retur n match},deserializeValue:function(stringValue,currentValue){return scope.deseri alizeValue(stringValue,currentValue)},serializeValue:function(value,inferredType ){if(inferredType==="boolean"){return value?"":undefined}else if(inferredType!== "object"&&inferredType!=="function"&&value!==undefined){return value}},reflectPr opertyToAttribute:function(name){var inferredType=typeof this[name];var serializ edValue=this.serializeValue(this[name],inferredType);if(serializedValue!==undefi ned){this.setAttribute(name,serializedValue)}else if(inferredType==="boolean"){t his.removeAttribute(name)}}};scope.api.instance.attributes=attributes})(Polymer) ;(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var OB SERVE_SUFFIX="Changed";var empty=[];var updateRecord={object:undefined,type:"upd ate",name:undefined,oldValue:undefined};var numberIsNaN=Number.isNaN||function(v alue){return typeof value==="number"&&isNaN(value)};function areSameValue(left,r ight){if(left===right)return left!==0||1/left===1/right;if(numberIsNaN(left)&&nu mberIsNaN(right))return true;return left!==left&&right!==right}function resolveB indingValue(oldValue,value){if(value===undefined&&oldValue===null){return value} return value===null||value===undefined?oldValue:value}var properties={createProp ertyObserver:function(){var n$=this._observeNames;if(n$&&n$.length){var o=this._ propertyObserver=new CompoundObserver(true);this.registerObserver(o);for(var i=0 ,l=n$.length,n;i<l&&(n=n$[i]);i++){o.addPath(this,n);this.observeArrayValue(n,th is[n],null)}}},openPropertyObserver:function(){if(this._propertyObserver){this._ propertyObserver.open(this.notifyPropertyChanges,this)}},notifyPropertyChanges:f unction(newValues,oldValues,paths){var name,method,called={};for(var i in oldVal ues){name=paths[2*i+1];method=this.observe[name];if(method){var ov=oldValues[i], nv=newValues[i];this.observeArrayValue(name,nv,ov);if(!called[method]){if(ov!==u ndefined&&ov!==null||nv!==undefined&&nv!==null){called[method]=true;this.invokeM ethod(method,[ov,nv,arguments])}}}}},invokeMethod:function(method,args){var fn=t his[method]||method;if(typeof fn==="function"){fn.apply(this,args)}},deliverChan ges:function(){if(this._propertyObserver){this._propertyObserver.deliver()}},obs erveArrayValue:function(name,value,old){var callbackName=this.observe[name];if(c allbackName){if(Array.isArray(old)){log.observe&&console.log("[%s] observeArrayV alue: unregister observer [%s]",this.localName,name);this.closeNamedObserver(nam e+"__array")}if(Array.isArray(value)){log.observe&&console.log("[%s] observeArra yValue: register observer [%s]",this.localName,name,value);var observer=new Arra yObserver(value);observer.open(function(splices){this.invokeMethod(callbackName, [splices])},this);this.registerNamedObserver(name+"__array",observer)}}},emitPro pertyChangeRecord:function(name,value,oldValue){var object=this;if(areSameValue( value,oldValue)){return}this._propertyChanged(name,value,oldValue);if(!Observer. hasObjectObserve){return}var notifier=this._objectNotifier;if(!notifier){notifie r=this._objectNotifier=Object.getNotifier(this)}updateRecord.object=this;updateR ecord.name=name;updateRecord.oldValue=oldValue;notifier.notify(updateRecord)},_p ropertyChanged:function(name,value,oldValue){if(this.reflect[name]){this.reflect PropertyToAttribute(name)}},bindProperty:function(property,observable,oneTime){i f(oneTime){this[property]=observable;return}var computed=this.element.prototype. computed;if(computed&&computed[property]){var privateComputedBoundValue=property +"ComputedBoundObservable_";this[privateComputedBoundValue]=observable;return}re turn this.bindToAccessor(property,observable,resolveBindingValue)},bindToAccesso r:function(name,observable,resolveFn){var privateName=name+"_";var privateObserv able=name+"Observable_";var privateComputedBoundValue=name+"ComputedBoundObserva ble_";this[privateObservable]=observable;var oldValue=this[privateName];var self =this;function updateValue(value,oldValue){self[privateName]=value;var setObserv eable=self[privateComputedBoundValue];if(setObserveable&&typeof setObserveable.s etValue=="function"){setObserveable.setValue(value)}self.emitPropertyChangeRecor d(name,value,oldValue)}var value=observable.open(updateValue);if(resolveFn&&!are SameValue(oldValue,value)){var resolvedValue=resolveFn(oldValue,value);if(!areSa meValue(value,resolvedValue)){value=resolvedValue;if(observable.setValue){observ able.setValue(value)}}}updateValue(value,oldValue);var observer={close:function( ){observable.close();self[privateObservable]=undefined;self[privateComputedBound Value]=undefined}};this.registerObserver(observer);return observer},createComput edProperties:function(){if(!this._computedNames){return}for(var i=0;i<this._comp utedNames.length;i++){var name=this._computedNames[i];var expressionText=this.co mputed[name];try{var expression=PolymerExpressions.getExpression(expressionText) ;var observable=expression.getBinding(this,this.element.syntax);this.bindToAcces sor(name,observable)}catch(ex){console.error("Failed to create computed property ",ex)}}},registerObserver:function(observer){if(!this._observers){this._observer s=[observer];return}this._observers.push(observer)},closeObservers:function(){if (!this._observers){return}var observers=this._observers;for(var i=0;i<observers. length;i++){var observer=observers[i];if(observer&&typeof observer.close=="funct ion"){observer.close()}}this._observers=[]},registerNamedObserver:function(name, observer){var o$=this._namedObservers||(this._namedObservers={});o$[name]=observ er},closeNamedObserver:function(name){var o$=this._namedObservers;if(o$&&o$[name ]){o$[name].close();o$[name]=null;return true}},closeNamedObservers:function(){i f(this._namedObservers){for(var i in this._namedObservers){this.closeNamedObserv er(i)}this._namedObservers={}}}};var LOG_OBSERVE="[%s] watching [%s]";var LOG_OB SERVED="[%s#%s] watch: [%s] now [%s] was [%s]";var LOG_CHANGED="[%s#%s] property Changed: [%s] now [%s] was [%s]";scope.api.instance.properties=properties})(Poly mer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};va r mdv={instanceTemplate:function(template){HTMLTemplateElement.decorate(template );var syntax=this.syntax||!template.bindingDelegate&&this.element.syntax;var dom =template.createInstance(this,syntax);var observers=dom.bindings_;for(var i=0;i< observers.length;i++){this.registerObserver(observers[i])}return dom},bind:funct ion(name,observable,oneTime){var property=this.propertyForAttribute(name);if(!pr operty){return this.mixinSuper(arguments)}else{var observer=this.bindProperty(pr operty,observable,oneTime);if(Platform.enableBindingsReflection&&observer){obser ver.path=observable.path_;this._recordBinding(property,observer)}if(this.reflect [property]){this.reflectPropertyToAttribute(property)}return observer}},_recordB inding:function(name,observer){this.bindings_=this.bindings_||{};this.bindings_[ name]=observer},bindFinished:function(){this.makeElementReady()},asyncUnbindAll: function(){if(!this._unbound){log.unbind&&console.log("[%s] asyncUnbindAll",this .localName);this._unbindAllJob=this.job(this._unbindAllJob,this.unbindAll,0)}},u nbindAll:function(){if(!this._unbound){this.closeObservers();this.closeNamedObse rvers();this._unbound=true}},cancelUnbindAll:function(){if(this._unbound){log.un bind&&console.warn("[%s] already unbound, cannot cancel unbindAll",this.localNam e);return}log.unbind&&console.log("[%s] cancelUnbindAll",this.localName);if(this ._unbindAllJob){this._unbindAllJob=this._unbindAllJob.stop()}}};function unbindN odeTree(node){forNodeTree(node,_nodeUnbindAll)}function _nodeUnbindAll(node){nod e.unbindAll()}function forNodeTree(node,callback){if(node){callback(node);for(va r child=node.firstChild;child;child=child.nextSibling){forNodeTree(child,callbac k)}}}var mustachePattern=/\{\{([^{}]*)}}/;scope.bindPattern=mustachePattern;scop e.api.instance.mdv=mdv})(Polymer);(function(scope){var base={PolymerBase:true,jo b:function(job,callback,wait){if(typeof job==="string"){var n="___"+job;this[n]= Polymer.job.call(this,this[n],callback,wait)}else{return Polymer.job.call(this,j ob,callback,wait)}},"super":Polymer.super,created:function(){},ready:function(){ },createdCallback:function(){if(this.templateInstance&&this.templateInstance.mod el){console.warn("Attributes on "+this.localName+" were data bound "+"prior to P olymer upgrading the element. This may result in "+"incorrect binding types.")}t his.created();this.prepareElement();if(!this.ownerDocument.isStagingDocument){th is.makeElementReady()}},prepareElement:function(){if(this._elementPrepared){cons ole.warn("Element already prepared",this.localName);return}this._elementPrepared =true;this.shadowRoots={};this.createPropertyObserver();this.openPropertyObserve r();this.copyInstanceAttributes();this.takeAttributes();this.addHostListeners()} ,makeElementReady:function(){if(this._readied){return}this._readied=true;this.cr eateComputedProperties();this.parseDeclarations(this.__proto__);this.removeAttri bute("unresolved");this.ready()},attributeChangedCallback:function(name,oldValue ){if(name!=="class"&&name!=="style"){this.attributeToProperty(name,this.getAttri bute(name))}if(this.attributeChanged){this.attributeChanged.apply(this,arguments )}},attachedCallback:function(){this.cancelUnbindAll();if(this.attached){this.at tached()}if(!this.hasBeenAttached){this.hasBeenAttached=true;if(this.domReady){t his.async("domReady")}}},detachedCallback:function(){if(!this.preventDispose){th is.asyncUnbindAll()}if(this.detached){this.detached()}if(this.leftView){this.lef tView()}},parseDeclarations:function(p){if(p&&p.element){this.parseDeclarations( p.__proto__);p.parseDeclaration.call(this,p.element)}},parseDeclaration:function (elementElement){var template=this.fetchTemplate(elementElement);if(template){va r root=this.shadowFromTemplate(template);this.shadowRoots[elementElement.name]=r oot}},fetchTemplate:function(elementElement){return elementElement.querySelector ("template")},shadowFromTemplate:function(template){if(template){var root=this.c reateShadowRoot();var dom=this.instanceTemplate(template);root.appendChild(dom); this.shadowRootReady(root,template);return root}},lightFromTemplate:function(tem plate,refNode){if(template){this.eventController=this;var dom=this.instanceTempl ate(template);if(refNode){this.insertBefore(dom,refNode)}else{this.appendChild(d om)}this.shadowRootReady(this);return dom}},shadowRootReady:function(root){this. marshalNodeReferences(root)},marshalNodeReferences:function(root){var $=this.$=t his.$||{};if(root){var n$=root.querySelectorAll("[id]");for(var i=0,l=n$.length, n;i<l&&(n=n$[i]);i++){$[n.id]=n}}},onMutation:function(node,listener){var observ er=new MutationObserver(function(mutations){listener.call(this,observer,mutation s);observer.disconnect()}.bind(this));observer.observe(node,{childList:true,subt ree:true})}};function isBase(object){return object.hasOwnProperty("PolymerBase") }function PolymerBase(){}PolymerBase.prototype=base;base.constructor=PolymerBase ;scope.Base=PolymerBase;scope.isBase=isBase;scope.api.instance.base=base})(Polym er);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var STYLE_SCOPE_ATTRIBUTE="elemen t";var STYLE_CONTROLLER_SCOPE="controller";var styles={STYLE_SCOPE_ATTRIBUTE:STY LE_SCOPE_ATTRIBUTE,installControllerStyles:function(){var scope=this.findStyleSc ope();if(scope&&!this.scopeHasNamedStyle(scope,this.localName)){var proto=getPro totypeOf(this),cssText="";while(proto&&proto.element){cssText+=proto.element.css TextForScope(STYLE_CONTROLLER_SCOPE);proto=getPrototypeOf(proto)}if(cssText){thi s.installScopeCssText(cssText,scope)}}},installScopeStyle:function(style,name,sc ope){var scope=scope||this.findStyleScope(),name=name||"";if(scope&&!this.scopeH asNamedStyle(scope,this.localName+name)){var cssText="";if(style instanceof Arra y){for(var i=0,l=style.length,s;i<l&&(s=style[i]);i++){cssText+=s.textContent+"\ n\n"}}else{cssText=style.textContent}this.installScopeCssText(cssText,scope,name )}},installScopeCssText:function(cssText,scope,name){scope=scope||this.findStyle Scope();name=name||"";if(!scope){return}if(hasShadowDOMPolyfill){cssText=shimCss Text(cssText,scope.host)}var style=this.element.cssTextToScopeStyle(cssText,STYL E_CONTROLLER_SCOPE);Polymer.applyStyleToScope(style,scope);this.styleCacheForSco pe(scope)[this.localName+name]=true},findStyleScope:function(node){var n=node||t his;while(n.parentNode){n=n.parentNode}return n},scopeHasNamedStyle:function(sco pe,name){var cache=this.styleCacheForScope(scope);return cache[name]},styleCache ForScope:function(scope){if(hasShadowDOMPolyfill){var scopeName=scope.host?scope .host.localName:scope.localName;return polyfillScopeStyleCache[scopeName]||(poly fillScopeStyleCache[scopeName]={})}else{return scope._scopeStyles=scope._scopeSt yles||{}}}};var polyfillScopeStyleCache={};function getPrototypeOf(prototype){re turn prototype.__proto__}function shimCssText(cssText,host){var name="",is=false ;if(host){name=host.localName;is=host.hasAttribute("is")}var selector=WebCompone nts.ShadowCSS.makeScopeSelector(name,is);return WebComponents.ShadowCSS.shimCssT ext(cssText,selector)}scope.api.instance.styles=styles})(Polymer);(function(scop e){var extend=scope.extend;var api=scope.api;function element(name,prototype){if (typeof name!=="string"){var script=prototype||document._currentScript;prototype =name;name=script&&script.parentNode&&script.parentNode.getAttribute?script.pare ntNode.getAttribute("name"):"";if(!name){throw"Element name could not be inferre d."}}if(getRegisteredPrototype(name)){throw"Already registered (Polymer) prototy pe for element "+name}registerPrototype(name,prototype);notifyPrototype(name)}fu nction waitingForPrototype(name,client){waitPrototype[name]=client}var waitProto type={};function notifyPrototype(name){if(waitPrototype[name]){waitPrototype[nam e].registerWhenReady();delete waitPrototype[name]}}var prototypesByName={};funct ion registerPrototype(name,prototype){return prototypesByName[name]=prototype||{ }}function getRegisteredPrototype(name){return prototypesByName[name]}function i nstanceOfType(element,type){if(typeof type!=="string"){return false}var proto=HT MLElement.getPrototypeForTag(type);var ctor=proto&&proto.constructor;if(!ctor){r eturn false}if(CustomElements.instanceof){return CustomElements.instanceof(eleme nt,ctor)}return element instanceof ctor}scope.getRegisteredPrototype=getRegister edPrototype;scope.waitingForPrototype=waitingForPrototype;scope.instanceOfType=i nstanceOfType;window.Polymer=element;extend(Polymer,scope);if(WebComponents.cons umeDeclarations){WebComponents.consumeDeclarations(function(declarations){if(dec larations){for(var i=0,l=declarations.length,d;i<l&&(d=declarations[i]);i++){ele ment.apply(null,d)}}})}})(Polymer);(function(scope){var path={resolveElementPath s:function(node){Polymer.urlResolver.resolveDom(node)},addResolvePathApi:functio n(){var assetPath=this.getAttribute("assetpath")||"";var root=new URL(assetPath, this.ownerDocument.baseURI);this.prototype.resolvePath=function(urlPath,base){va r u=new URL(urlPath,base||root);return u.href}}};scope.api.declaration.path=path })(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.lo g:{};var api=scope.api.instance.styles;var STYLE_SCOPE_ATTRIBUTE=api.STYLE_SCOPE _ATTRIBUTE;var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var STYLE_SELECTOR= "style";
19 var STYLE_LOADABLE_MATCH="@import";var SHEET_SELECTOR="link[rel=stylesheet]";var STYLE_GLOBAL_SCOPE="global";var SCOPE_ATTR="polymer-scope";var styles={loadStyl es:function(callback){var template=this.fetchTemplate();var content=template&&th is.templateContent();if(content){this.convertSheetsToStyles(content);var styles= this.findLoadableStyles(content);if(styles.length){var templateUrl=template.owne rDocument.baseURI;return Polymer.styleResolver.loadStyles(styles,templateUrl,cal lback)}}if(callback){callback()}},convertSheetsToStyles:function(root){var s$=ro ot.querySelectorAll(SHEET_SELECTOR);for(var i=0,l=s$.length,s,c;i<l&&(s=s$[i]);i ++){c=createStyleElement(importRuleForSheet(s,this.ownerDocument.baseURI),this.o wnerDocument);this.copySheetAttributes(c,s);s.parentNode.replaceChild(c,s)}},cop ySheetAttributes:function(style,link){for(var i=0,a$=link.attributes,l=a$.length ,a;(a=a$[i])&&i<l;i++){if(a.name!=="rel"&&a.name!=="href"){style.setAttribute(a. name,a.value)}}},findLoadableStyles:function(root){var loadables=[];if(root){var s$=root.querySelectorAll(STYLE_SELECTOR);for(var i=0,l=s$.length,s;i<l&&(s=s$[i ]);i++){if(s.textContent.match(STYLE_LOADABLE_MATCH)){loadables.push(s)}}}return loadables},installSheets:function(){this.cacheSheets();this.cacheStyles();this. installLocalSheets();this.installGlobalStyles()},cacheSheets:function(){this.she ets=this.findNodes(SHEET_SELECTOR);this.sheets.forEach(function(s){if(s.parentNo de){s.parentNode.removeChild(s)}})},cacheStyles:function(){this.styles=this.find Nodes(STYLE_SELECTOR+"["+SCOPE_ATTR+"]");this.styles.forEach(function(s){if(s.pa rentNode){s.parentNode.removeChild(s)}})},installLocalSheets:function(){var shee ts=this.sheets.filter(function(s){return!s.hasAttribute(SCOPE_ATTR)});var conten t=this.templateContent();if(content){var cssText="";sheets.forEach(function(shee t){cssText+=cssTextFromSheet(sheet)+"\n"});if(cssText){var style=createStyleElem ent(cssText,this.ownerDocument);content.insertBefore(style,content.firstChild)}} },findNodes:function(selector,matcher){var nodes=this.querySelectorAll(selector) .array();var content=this.templateContent();if(content){var templateNodes=conten t.querySelectorAll(selector).array();nodes=nodes.concat(templateNodes)}return ma tcher?nodes.filter(matcher):nodes},installGlobalStyles:function(){var style=this .styleForScope(STYLE_GLOBAL_SCOPE);applyStyleToScope(style,document.head)},cssTe xtForScope:function(scopeDescriptor){var cssText="";var selector="["+SCOPE_ATTR+ "="+scopeDescriptor+"]";var matcher=function(s){return matchesSelector(s,selecto r)};var sheets=this.sheets.filter(matcher);sheets.forEach(function(sheet){cssTex t+=cssTextFromSheet(sheet)+"\n\n"});var styles=this.styles.filter(matcher);style s.forEach(function(style){cssText+=style.textContent+"\n\n"});return cssText},st yleForScope:function(scopeDescriptor){var cssText=this.cssTextForScope(scopeDesc riptor);return this.cssTextToScopeStyle(cssText,scopeDescriptor)},cssTextToScope Style:function(cssText,scopeDescriptor){if(cssText){var style=createStyleElement (cssText);style.setAttribute(STYLE_SCOPE_ATTRIBUTE,this.getAttribute("name")+"-" +scopeDescriptor);return style}}};function importRuleForSheet(sheet,baseUrl){var href=new URL(sheet.getAttribute("href"),baseUrl).href;return"@import '"+href+"' ;"}function applyStyleToScope(style,scope){if(style){if(scope===document){scope= document.head}if(hasShadowDOMPolyfill){scope=document.head}var clone=createStyle Element(style.textContent);var attr=style.getAttribute(STYLE_SCOPE_ATTRIBUTE);if (attr){clone.setAttribute(STYLE_SCOPE_ATTRIBUTE,attr)}var refNode=scope.firstEle mentChild;if(scope===document.head){var selector="style["+STYLE_SCOPE_ATTRIBUTE+ "]";var s$=document.head.querySelectorAll(selector);if(s$.length){refNode=s$[s$. length-1].nextElementSibling}}scope.insertBefore(clone,refNode)}}function create StyleElement(cssText,scope){scope=scope||document;scope=scope.createElement?scop e:scope.ownerDocument;var style=scope.createElement("style");style.textContent=c ssText;return style}function cssTextFromSheet(sheet){return sheet&&sheet.__resou rce||""}function matchesSelector(node,inSelector){if(matches){return matches.cal l(node,inSelector)}}var p=HTMLElement.prototype;var matches=p.matches||p.matches Selector||p.webkitMatchesSelector||p.mozMatchesSelector;scope.api.declaration.st yles=styles;scope.applyStyleToScope=applyStyleToScope})(Polymer);(function(scope ){var log=window.WebComponents?WebComponents.flags.log:{};var api=scope.api.inst ance.events;var EVENT_PREFIX=api.EVENT_PREFIX;var mixedCaseEventTypes={};["webki tAnimationStart","webkitAnimationEnd","webkitTransitionEnd","DOMFocusOut","DOMFo cusIn","DOMMouseScroll"].forEach(function(e){mixedCaseEventTypes[e.toLowerCase() ]=e});var events={parseHostEvents:function(){var delegates=this.prototype.eventD elegates;this.addAttributeDelegates(delegates)},addAttributeDelegates:function(d elegates){for(var i=0,a;a=this.attributes[i];i++){if(this.hasEventPrefix(a.name) ){delegates[this.removeEventPrefix(a.name)]=a.value.replace("{{","").replace("}} ","").trim()}}},hasEventPrefix:function(n){return n&&n[0]==="o"&&n[1]==="n"&&n[2 ]==="-"},removeEventPrefix:function(n){return n.slice(prefixLength)},findControl ler:function(node){while(node.parentNode){if(node.eventController){return node.e ventController}node=node.parentNode}return node.host},getEventHandler:function(c ontroller,target,method){var events=this;return function(e){if(!controller||!con troller.PolymerBase){controller=events.findController(target)}var args=[e,e.deta il,e.currentTarget];controller.dispatchMethod(controller,method,args)}},prepareE ventBinding:function(pathString,name,node){if(!this.hasEventPrefix(name))return; var eventType=this.removeEventPrefix(name);eventType=mixedCaseEventTypes[eventTy pe]||eventType;var events=this;return function(model,node,oneTime){var handler=e vents.getEventHandler(undefined,node,pathString);PolymerGestures.addEventListene r(node,eventType,handler);if(oneTime)return;function bindingValue(){return"{{ "+ pathString+" }}"}return{open:bindingValue,discardChanges:bindingValue,close:func tion(){PolymerGestures.removeEventListener(node,eventType,handler)}}}}};var pref ixLength=EVENT_PREFIX.length;scope.api.declaration.events=events})(Polymer);(fun ction(scope){var observationBlacklist=["attribute"];var properties={inferObserve rs:function(prototype){var observe=prototype.observe,property;for(var n in proto type){if(n.slice(-7)==="Changed"){property=n.slice(0,-7);if(this.canObservePrope rty(property)){if(!observe){observe=prototype.observe={}}observe[property]=obser ve[property]||n}}}},canObserveProperty:function(property){return observationBlac klist.indexOf(property)<0},explodeObservers:function(prototype){var o=prototype. observe;if(o){var exploded={};for(var n in o){var names=n.split(" ");for(var i=0 ,ni;ni=names[i];i++){exploded[ni]=o[n]}}prototype.observe=exploded}},optimizePro pertyMaps:function(prototype){if(prototype.observe){var a=prototype._observeName s=[];for(var n in prototype.observe){var names=n.split(" ");for(var i=0,ni;ni=na mes[i];i++){a.push(ni)}}}if(prototype.publish){var a=prototype._publishNames=[]; for(var n in prototype.publish){a.push(n)}}if(prototype.computed){var a=prototyp e._computedNames=[];for(var n in prototype.computed){a.push(n)}}},publishPropert ies:function(prototype,base){var publish=prototype.publish;if(publish){this.requ ireProperties(publish,prototype,base);this.filterInvalidAccessorNames(publish);p rototype._publishLC=this.lowerCaseMap(publish)}var computed=prototype.computed;i f(computed){this.filterInvalidAccessorNames(computed)}},filterInvalidAccessorNam es:function(propertyNames){for(var name in propertyNames){if(this.propertyNameBl acklist[name]){console.warn('Cannot define property "'+name+'" for element "'+th is.name+'" because it has the same name as an HTMLElement '+"property, and not a ll browsers support overriding that. "+"Consider giving it a different name.");d elete propertyNames[name]}}},requireProperties:function(propertyInfos,prototype, base){prototype.reflect=prototype.reflect||{};for(var n in propertyInfos){var va lue=propertyInfos[n];if(value&&value.reflect!==undefined){prototype.reflect[n]=B oolean(value.reflect);value=value.value}if(value!==undefined){prototype[n]=value }}},lowerCaseMap:function(properties){var map={};for(var n in properties){map[n. toLowerCase()]=n}return map},createPropertyAccessor:function(name,ignoreWrites){ var proto=this.prototype;var privateName=name+"_";var privateObservable=name+"Ob servable_";proto[privateName]=proto[name];Object.defineProperty(proto,name,{get: function(){var observable=this[privateObservable];if(observable)observable.deliv er();return this[privateName]},set:function(value){if(ignoreWrites){return this[ privateName]}var observable=this[privateObservable];if(observable){observable.se tValue(value);return}var oldValue=this[privateName];this[privateName]=value;this .emitPropertyChangeRecord(name,value,oldValue);return value},configurable:true}) },createPropertyAccessors:function(prototype){var n$=prototype._computedNames;if (n$&&n$.length){for(var i=0,l=n$.length,n,fn;i<l&&(n=n$[i]);i++){this.createProp ertyAccessor(n,true)}}var n$=prototype._publishNames;if(n$&&n$.length){for(var i =0,l=n$.length,n,fn;i<l&&(n=n$[i]);i++){if(!prototype.computed||!prototype.compu ted[n]){this.createPropertyAccessor(n)}}}},propertyNameBlacklist:{children:1,"cl ass":1,id:1,hidden:1,style:1,title:1}};scope.api.declaration.properties=properti es})(Polymer);(function(scope){var ATTRIBUTES_ATTRIBUTE="attributes";var ATTRIBU TES_REGEX=/\s|,/;var attributes={inheritAttributesObjects:function(prototype){th is.inheritObject(prototype,"publishLC");this.inheritObject(prototype,"_instanceA ttributes")},publishAttributes:function(prototype,base){var attributes=this.getA ttribute(ATTRIBUTES_ATTRIBUTE);if(attributes){var publish=prototype.publish||(pr ototype.publish={});var names=attributes.split(ATTRIBUTES_REGEX);for(var i=0,l=n ames.length,n;i<l;i++){n=names[i].trim();if(n&&publish[n]===undefined){publish[n ]=undefined}}}},accumulateInstanceAttributes:function(){var clonable=this.protot ype._instanceAttributes;var a$=this.attributes;for(var i=0,l=a$.length,a;i<l&&(a =a$[i]);i++){if(this.isInstanceAttribute(a.name)){clonable[a.name]=a.value}}},is InstanceAttribute:function(name){return!this.blackList[name]&&name.slice(0,3)!== "on-"},blackList:{name:1,"extends":1,constructor:1,noscript:1,assetpath:1,"cache -csstext":1}};attributes.blackList[ATTRIBUTES_ATTRIBUTE]=1;scope.api.declaration .attributes=attributes})(Polymer);(function(scope){var events=scope.api.declarat ion.events;var syntax=new PolymerExpressions;var prepareBinding=syntax.prepareBi nding;syntax.prepareBinding=function(pathString,name,node){return events.prepare EventBinding(pathString,name,node)||prepareBinding.call(syntax,pathString,name,n ode)};var mdv={syntax:syntax,fetchTemplate:function(){return this.querySelector( "template")},templateContent:function(){var template=this.fetchTemplate();return template&&template.content},installBindingDelegate:function(template){if(templa te){template.bindingDelegate=this.syntax}}};scope.api.declaration.mdv=mdv})(Poly mer);(function(scope){var api=scope.api;var isBase=scope.isBase;var extend=scope .extend;var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var prototype={registe r:function(name,extendeeName){this.buildPrototype(name,extendeeName);this.regist erPrototype(name,extendeeName);this.publishConstructor()},buildPrototype:functio n(name,extendeeName){var extension=scope.getRegisteredPrototype(name);var base=t his.generateBasePrototype(extendeeName);this.desugarBeforeChaining(extension,bas e);this.prototype=this.chainPrototypes(extension,base);this.desugarAfterChaining (name,extendeeName)},desugarBeforeChaining:function(prototype,base){prototype.el ement=this;this.publishAttributes(prototype,base);this.publishProperties(prototy pe,base);this.inferObservers(prototype);this.explodeObservers(prototype)},chainP rototypes:function(prototype,base){this.inheritMetaData(prototype,base);var chai ned=this.chainObject(prototype,base);ensurePrototypeTraversal(chained);return ch ained},inheritMetaData:function(prototype,base){this.inheritObject("observe",pro totype,base);this.inheritObject("publish",prototype,base);this.inheritObject("re flect",prototype,base);this.inheritObject("_publishLC",prototype,base);this.inhe ritObject("_instanceAttributes",prototype,base);this.inheritObject("eventDelegat es",prototype,base)},desugarAfterChaining:function(name,extendee){this.optimizeP ropertyMaps(this.prototype);this.createPropertyAccessors(this.prototype);this.in stallBindingDelegate(this.fetchTemplate());this.installSheets();this.resolveElem entPaths(this);this.accumulateInstanceAttributes();this.parseHostEvents();this.a ddResolvePathApi();if(hasShadowDOMPolyfill){WebComponents.ShadowCSS.shimStyling( this.templateContent(),name,extendee)}if(this.prototype.registerCallback){this.p rototype.registerCallback(this)}},publishConstructor:function(){var symbol=this. getAttribute("constructor");if(symbol){window[symbol]=this.ctor}},generateBasePr ototype:function(extnds){var prototype=this.findBasePrototype(extnds);if(!protot ype){var prototype=HTMLElement.getPrototypeForTag(extnds);prototype=this.ensureB aseApi(prototype);memoizedBases[extnds]=prototype}return prototype},findBaseProt otype:function(name){return memoizedBases[name]},ensureBaseApi:function(prototyp e){if(prototype.PolymerBase){return prototype}var extended=Object.create(prototy pe);api.publish(api.instance,extended);this.mixinMethod(extended,prototype,api.i nstance.mdv,"bind");return extended},mixinMethod:function(extended,prototype,api ,name){var $super=function(args){return prototype[name].apply(this,args)};extend ed[name]=function(){this.mixinSuper=$super;return api[name].apply(this,arguments )}},inheritObject:function(name,prototype,base){var source=prototype[name]||{};p rototype[name]=this.chainObject(source,base[name])},registerPrototype:function(n ame,extendee){var info={prototype:this.prototype};var typeExtension=this.findTyp eExtension(extendee);if(typeExtension){info.extends=typeExtension}HTMLElement.re gister(name,this.prototype);this.ctor=document.registerElement(name,info)},findT ypeExtension:function(name){if(name&&name.indexOf("-")<0){return name}else{var p =this.findBasePrototype(name);if(p.element){return this.findTypeExtension(p.elem ent.extends)}}}};var memoizedBases={};if(Object.__proto__){prototype.chainObject =function(object,inherited){if(object&&inherited&&object!==inherited){object.__p roto__=inherited}return object}}else{prototype.chainObject=function(object,inher ited){if(object&&inherited&&object!==inherited){var chained=Object.create(inheri ted);object=extend(chained,object)}return object}}function ensurePrototypeTraver sal(prototype){if(!Object.__proto__){var ancestor=Object.getPrototypeOf(prototyp e);prototype.__proto__=ancestor;if(isBase(ancestor)){ancestor.__proto__=Object.g etPrototypeOf(ancestor)}}}api.declaration.prototype=prototype})(Polymer);(functi on(scope){var queue={wait:function(element){if(!element.__queue){element.__queue ={};elements.push(element)}},enqueue:function(element,check,go){var shouldAdd=el ement.__queue&&!element.__queue.check;if(shouldAdd){queueForElement(element).pus h(element);element.__queue.check=check;element.__queue.go=go}return this.indexOf (element)!==0},indexOf:function(element){var i=queueForElement(element).indexOf( element);if(i>=0&&document.contains(element)){i+=HTMLImports.useNative||HTMLImpo rts.ready?importQueue.length:1e9}return i},go:function(element){var readied=this .remove(element);if(readied){element.__queue.flushable=true;this.addToFlushQueue (readied);this.check()}},remove:function(element){var i=this.indexOf(element);if (i!==0){return}return queueForElement(element).shift()},check:function(){var ele ment=this.nextElement();if(element){element.__queue.check.call(element)}if(this. canReady()){this.ready();return true}},nextElement:function(){return nextQueued( )},canReady:function(){return!this.waitToReady&&this.isEmpty()},isEmpty:function (){for(var i=0,l=elements.length,e;i<l&&(e=elements[i]);i++){if(e.__queue&&!e.__ queue.flushable){return}}return true},addToFlushQueue:function(element){flushQue ue.push(element)},flush:function(){if(this.flushing){return}this.flushing=true;v ar element;while(flushQueue.length){element=flushQueue.shift();element.__queue.g o.call(element);element.__queue=null}this.flushing=false},ready:function(){var p olyfillWasReady=CustomElements.ready;CustomElements.ready=false;this.flush();if( !CustomElements.useNative){CustomElements.upgradeDocumentTree(document)}CustomEl ements.ready=polyfillWasReady;Polymer.flush();requestAnimationFrame(this.flushRe adyCallbacks)},addReadyCallback:function(callback){if(callback){readyCallbacks.p ush(callback)}},flushReadyCallbacks:function(){if(readyCallbacks){var fn;while(r eadyCallbacks.length){fn=readyCallbacks.shift();fn()}}},waitingFor:function(){va r e$=[];for(var i=0,l=elements.length,e;i<l&&(e=elements[i]);i++){if(e.__queue&& !e.__queue.flushable){e$.push(e)}}return e$},waitToReady:true};var elements=[];v ar flushQueue=[];var importQueue=[];var mainQueue=[];var readyCallbacks=[];funct ion queueForElement(element){return document.contains(element)?mainQueue:importQ ueue}function nextQueued(){return importQueue.length?importQueue[0]:mainQueue[0] }function whenReady(callback){queue.waitToReady=true;Polymer.endOfMicrotask(func tion(){HTMLImports.whenReady(function(){queue.addReadyCallback(callback);queue.w aitToReady=false;queue.check()})})}function forceReady(timeout){if(timeout===und efined){queue.ready();return}var handle=setTimeout(function(){queue.ready()},tim eout);Polymer.whenReady(function(){clearTimeout(handle)})}scope.elements=element s;scope.waitingFor=queue.waitingFor.bind(queue);scope.forceReady=forceReady;scop e.queue=queue;scope.whenReady=scope.whenPolymerReady=whenReady})(Polymer);(funct ion(scope){var extend=scope.extend;var api=scope.api;var queue=scope.queue;var w henReady=scope.whenReady;var getRegisteredPrototype=scope.getRegisteredPrototype ;var waitingForPrototype=scope.waitingForPrototype;var prototype=extend(Object.c reate(HTMLElement.prototype),{createdCallback:function(){if(this.getAttribute("n ame")){this.init()}},init:function(){this.name=this.getAttribute("name");this.ex tends=this.getAttribute("extends");queue.wait(this);this.loadResources();this.re gisterWhenReady()},registerWhenReady:function(){if(this.registered||this.waiting ForPrototype(this.name)||this.waitingForQueue()||this.waitingForResources()){ret urn}queue.go(this)},_register:function(){if(isCustomTag(this.extends)&&!isRegist ered(this.extends)){console.warn("%s is attempting to extend %s, an unregistered element "+"or one that was not registered with Polymer.",this.name,this.extends )}this.register(this.name,this.extends);this.registered=true},waitingForPrototyp e:function(name){if(!getRegisteredPrototype(name)){waitingForPrototype(name,this );this.handleNoScript(name);return true}},handleNoScript:function(name){if(this. hasAttribute("noscript")&&!this.noscript){this.noscript=true;Polymer(name)}},wai tingForResources:function(){return this._needsResources},waitingForQueue:functio n(){return queue.enqueue(this,this.registerWhenReady,this._register)},loadResour ces:function(){this._needsResources=true;this.loadStyles(function(){this._needsR esources=false;this.registerWhenReady()}.bind(this))}});api.publish(api.declarat ion,prototype);function isRegistered(name){return Boolean(HTMLElement.getPrototy peForTag(name))}function isCustomTag(name){return name&&name.indexOf("-")>=0}whe nReady(function(){document.body.removeAttribute("unresolved");document.dispatchE vent(new CustomEvent("polymer-ready",{bubbles:true}))});document.registerElement ("polymer-element",{prototype:prototype})})(Polymer);(function(scope){var whenRe ady=scope.whenReady;function importElements(node,callback){if(node){document.hea d.appendChild(node);whenReady(callback)}else if(callback){callback()}}function _ import(urls,callback){if(urls&&urls.length){var frag=document.createDocumentFrag ment();for(var i=0,l=urls.length,url,link;i<l&&(url=urls[i]);i++){link=document. createElement("link");link.rel="import";link.href=url;frag.appendChild(link)}imp ortElements(frag,callback)}else if(callback){callback()}}scope.import=_import;sc ope.importElements=importElements})(Polymer);(function(){var element=document.cr eateElement("polymer-element");element.setAttribute("name","auto-binding");eleme nt.setAttribute("extends","template");element.init();Polymer("auto-binding",{cre atedCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax();Polym er.whenPolymerReady(function(){this.model=this;this.setAttribute("bind","");this .async(function(){this.marshalNodeReferences(this.parentNode);this.fire("templat e-bound")})}.bind(this))},makeSyntax:function(){var events=Object.create(Polymer .api.declaration.events);var self=this;events.findController=function(){return s elf.model};var syntax=new PolymerExpressions;var prepareBinding=syntax.prepareBi nding;syntax.prepareBinding=function(pathString,name,node){return events.prepare EventBinding(pathString,name,node)||prepareBinding.call(syntax,pathString,name,n ode)};return syntax}})})();</script><style>body,html{height:100%}body{font-famil y:RobotoDraft,'Helvetica Neue',Helvetica,Arial;margin:0}paper-calculator{width:1 00%;height:100%}@media screen and (max-height:400px){body{font-size:13px}}</styl e></head><body unresolved=""><div hidden=""><polymer-element name="core-media-qu ery" attributes="query queryMatches" assetpath="../core-media-query/"><template>
20 <style>:host{display:none}</style>
21 </template><script>Polymer("core-media-query",{queryMatches:false,query:"",rea dy:function(){this._mqHandler=this.queryHandler.bind(this);this._mq=null},queryC hanged:function(){if(this._mq){this._mq.removeListener(this._mqHandler)}var quer y=this.query;if(query[0]!=="("){query="("+this.query+")"}this._mq=window.matchMe dia(query);this._mq.addListener(this._mqHandler);this.queryHandler(this._mq)},qu eryHandler:function(mq){this.queryMatches=mq.matches;this.asyncFire("core-media- change",mq)}});</script></polymer-element><polymer-element name="paper-calculato r-output" attributes="expression result error" assetpath=""><template>
22
23 <style>:host{display:block}.output{position:relative;width:100%;height:100%; padding-right:30px;box-sizing:border-box;-moz-box-sizing:border-box;background-c olor:transparent;color:#b3b3b3;overflow:hidden}.output.show-result{color:#eee}.e xpression-outer{width:100%;height:100%;font-size:5.625em;font-weight:100;text-al ign:right;overflow:hidden}.show-result>.expression-outer{height:38%;font-size:2. 5em;font-weight:400}#expression{white-space:nowrap}.output.error #expression{dis play:none}#error{display:none;color:#eee}.output.error #error{display:block}.res ult{visibility:hidden}.show-result>.result{visibility:visible;height:62%;font-we ight:400}.result-equal{padding:0 30px;font-size:2.5em}.result-value{font-size:5e m;overflow:hidden}</style>
24
25 <div class="output {{ {error: error, 'show-result': result &amp;&amp; !error } | tokenList }}">
26
27 <div class="expression-outer" horizontal="" end-justified="" center="" lay out="">
28 <div id="expression">{{expression}}</div>
29 <div id="error">{{error}}</div>
30 </div>
31
32 <div class="result" horizontal="" center="" layout="">
33
34 <div class="result-equal">=</div>
35 <div class="result-value" flex="" horizontal="" end-justified="" layout= "">{{result}}</div>
36
37 </div>
38
39 </div>
40
41 </template><script>Polymer("paper-calculator-output");</script></polymer-eleme nt><polymer-element name="paper-ripple" attributes="initialOpacity opacityDecayV elocity" assetpath="../paper-ripple/"><template>
42
43 <style>:host{display:block;position:relative;border-radius:inherit;overflow:hi dden}:host-context([noink]){pointer-events:none}#bg,#waves,.wave-container,.wave {pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%}#bg,. wave{opacity:0}#waves,.wave{overflow:hidden}.wave-container,.wave{border-radius: 50%}:host(.circle) #bg,:host(.circle) #waves{border-radius:50%}:host(.circle) .w ave-container{overflow:hidden}</style>
44
45 <div id="bg"></div>
46 <div id="waves">
47 </div>
48
49 </template><script>(function(){var waveMaxRadius=150;function waveRadiusFn(touch DownMs,touchUpMs,anim){var touchDown=touchDownMs/1e3;var touchUp=touchUpMs/1e3;v ar totalElapsed=touchDown+touchUp;var ww=anim.width,hh=anim.height;var waveRadiu s=Math.min(Math.sqrt(ww*ww+hh*hh),waveMaxRadius)*1.1+5;var duration=1.1-.2*(wave Radius/waveMaxRadius);var tt=totalElapsed/duration;var size=waveRadius*(1-Math.p ow(80,-tt));return Math.abs(size)}function waveOpacityFn(td,tu,anim){var touchDo wn=td/1e3;var touchUp=tu/1e3;var totalElapsed=touchDown+touchUp;if(tu<=0){return anim.initialOpacity}return Math.max(0,anim.initialOpacity-touchUp*anim.opacityD ecayVelocity)}function waveOuterOpacityFn(td,tu,anim){var touchDown=td/1e3;var t ouchUp=tu/1e3;var outerOpacity=touchDown*.3;var waveOpacity=waveOpacityFn(td,tu, anim);return Math.max(0,Math.min(outerOpacity,waveOpacity))}function waveDidFini sh(wave,radius,anim){var waveOpacity=waveOpacityFn(wave.tDown,wave.tUp,anim);ret urn waveOpacity<.01&&radius>=Math.min(wave.maxRadius,waveMaxRadius)}function wav eAtMaximum(wave,radius,anim){var waveOpacity=waveOpacityFn(wave.tDown,wave.tUp,a nim);return waveOpacity>=anim.initialOpacity&&radius>=Math.min(wave.maxRadius,wa veMaxRadius)}function drawRipple(ctx,x,y,radius,innerAlpha,outerAlpha){if(outerA lpha!==undefined){ctx.bg.style.opacity=outerAlpha}ctx.wave.style.opacity=innerAl pha;var s=radius/(ctx.containerSize/2);var dx=x-ctx.containerWidth/2;var dy=y-ct x.containerHeight/2;ctx.wc.style.webkitTransform="translate3d("+dx+"px,"+dy+"px, 0)";ctx.wc.style.transform="translate3d("+dx+"px,"+dy+"px,0)";ctx.wave.style.web kitTransform="scale("+s+","+s+")";ctx.wave.style.transform="scale3d("+s+","+s+", 1)"}function createWave(elem){var elementStyle=window.getComputedStyle(elem);var fgColor=elementStyle.color;var inner=document.createElement("div");inner.style. backgroundColor=fgColor;inner.classList.add("wave");var outer=document.createEle ment("div");outer.classList.add("wave-container");outer.appendChild(inner);var c ontainer=elem.$.waves;container.appendChild(outer);elem.$.bg.style.backgroundCol or=fgColor;var wave={bg:elem.$.bg,wc:outer,wave:inner,waveColor:fgColor,maxRadiu s:0,isMouseDown:false,mouseDownStart:0,mouseUpStart:0,tDown:0,tUp:0};return wave }function removeWaveFromScope(scope,wave){if(scope.waves){var pos=scope.waves.in dexOf(wave);scope.waves.splice(pos,1);wave.wc.remove()}}var pow=Math.pow;var now =Date.now;if(window.performance&&performance.now){now=performance.now.bind(perfo rmance)}function cssColorWithAlpha(cssColor,alpha){var parts=cssColor.match(/^rg b\((\d+),\s*(\d+),\s*(\d+)\)$/);if(typeof alpha=="undefined"){alpha=1}if(!parts) {return"rgba(255, 255, 255, "+alpha+")"}return"rgba("+parts[1]+", "+parts[2]+", "+parts[3]+", "+alpha+")"}function dist(p1,p2){return Math.sqrt(pow(p1.x-p2.x,2) +pow(p1.y-p2.y,2))}function distanceFromPointToFurthestCorner(point,size){var tl _d=dist(point,{x:0,y:0});var tr_d=dist(point,{x:size.w,y:0});var bl_d=dist(point ,{x:0,y:size.h});var br_d=dist(point,{x:size.w,y:size.h});return Math.max(tl_d,t r_d,bl_d,br_d)}Polymer("paper-ripple",{initialOpacity:.25,opacityDecayVelocity:. 8,backgroundFill:true,pixelDensity:2,eventDelegates:{down:"downAction",up:"upAct ion"},ready:function(){this.waves=[]},downAction:function(e){var wave=createWave (this);this.cancelled=false;wave.isMouseDown=true;wave.tDown=0;wave.tUp=0;wave.m ouseUpStart=0;wave.mouseDownStart=now();var rect=this.getBoundingClientRect();va r width=rect.width;var height=rect.height;var touchX=e.x-rect.left;var touchY=e. y-rect.top;wave.startPosition={x:touchX,y:touchY};if(this.classList.contains("re centeringTouch")){wave.endPosition={x:width/2,y:height/2};wave.slideDistance=dis t(wave.startPosition,wave.endPosition)}wave.containerSize=Math.max(width,height) ;wave.containerWidth=width;wave.containerHeight=height;wave.maxRadius=distanceFr omPointToFurthestCorner(wave.startPosition,{w:width,h:height});wave.wc.style.top =(wave.containerHeight-wave.containerSize)/2+"px";wave.wc.style.left=(wave.conta inerWidth-wave.containerSize)/2+"px";wave.wc.style.width=wave.containerSize+"px" ;wave.wc.style.height=wave.containerSize+"px";this.waves.push(wave);if(!this._lo op){this._loop=this.animate.bind(this,{width:width,height:height});requestAnimat ionFrame(this._loop)}},upAction:function(){for(var i=0;i<this.waves.length;i++){ var wave=this.waves[i];if(wave.isMouseDown){wave.isMouseDown=false;wave.mouseUpS tart=now();wave.mouseDownStart=0;wave.tUp=0;break}}this._loop&&requestAnimationF rame(this._loop)},cancel:function(){this.cancelled=true},animate:function(ctx){v ar shouldRenderNextFrame=false;var deleteTheseWaves=[];var longestTouchDownDurat ion=0;var longestTouchUpDuration=0;var lastWaveColor=null;var anim={initialOpaci ty:this.initialOpacity,opacityDecayVelocity:this.opacityDecayVelocity,height:ctx .height,width:ctx.width};for(var i=0;i<this.waves.length;i++){var wave=this.wave s[i];if(wave.mouseDownStart>0){wave.tDown=now()-wave.mouseDownStart}if(wave.mous eUpStart>0){wave.tUp=now()-wave.mouseUpStart}var tUp=wave.tUp;var tDown=wave.tDo wn;longestTouchDownDuration=Math.max(longestTouchDownDuration,tDown);longestTouc hUpDuration=Math.max(longestTouchUpDuration,tUp);var radius=waveRadiusFn(tDown,t Up,anim);var waveAlpha=waveOpacityFn(tDown,tUp,anim);var waveColor=cssColorWithA lpha(wave.waveColor,waveAlpha);lastWaveColor=wave.waveColor;var x=wave.startPosi tion.x;var y=wave.startPosition.y;if(wave.endPosition){var translateFraction=Mat h.min(1,radius/wave.containerSize*2/Math.sqrt(2));x+=translateFraction*(wave.end Position.x-wave.startPosition.x);y+=translateFraction*(wave.endPosition.y-wave.s tartPosition.y)}var bgFillColor=null;if(this.backgroundFill){var bgFillAlpha=wav eOuterOpacityFn(tDown,tUp,anim);bgFillColor=cssColorWithAlpha(wave.waveColor,bgF illAlpha)}drawRipple(wave,x,y,radius,waveAlpha,bgFillAlpha);var maximumWave=wave AtMaximum(wave,radius,anim);var waveDissipated=waveDidFinish(wave,radius,anim);v ar shouldKeepWave=!waveDissipated||maximumWave;var shouldRenderWaveAgain=wave.mo useUpStart?!waveDissipated:!maximumWave;shouldRenderNextFrame=shouldRenderNextFr ame||shouldRenderWaveAgain;if(!shouldKeepWave||this.cancelled){deleteTheseWaves. push(wave)}}if(shouldRenderNextFrame){requestAnimationFrame(this._loop)}for(var i=0;i<deleteTheseWaves.length;++i){var wave=deleteTheseWaves[i];removeWaveFromSc ope(this,wave)}if(!this.waves.length&&this._loop){this.$.bg.style.backgroundColo r=null;this._loop=null;this.fire("core-transitionend")}}})})();</script></polyme r-element><polymer-element name="paper-calculator-key" assetpath=""><template>
50
51 <style>:host{display:block;position:relative}#keyLabel,.ink-container{positi on:absolute;top:0;right:0;bottom:0;left:0}#keyLabel{pointer-events:none}.ink-cen ter{position:relative;width:0;height:0}#ink{position:absolute;top:-30px;left:-30 px;width:60px;height:60px;color:#f1fa41;pointer-events:none}.small{font-size:sma ller}</style>
52
53 <div class="ink-container" horizontal="" center-justified="" center="" layou t="">
54 <div class="ink-center">
55 <paper-ripple id="ink" class="circle recenteringTouch" initialopacity="0 .85" opacitydecayvelocity="2"></paper-ripple>
56 </div>
57 </div>
58
59 <div id="keyLabel" horizontal="" center-justified="" center="" layout="">{{l abel}}</div>
60
61 </template><script>Polymer("paper-calculator-key",{publish:{label:{reflect:tru e}},labelChanged:function(){this.$.keyLabel.classList.toggle("small",this.label= =="DEL")},downAction:function(e){this.$.ink.downAction(e)},upAction:function(){t his.$.ink.upAction()},cancelKey:function(e){e.preventTap();this.resetInk()},rese tInk:function(){this.$.ink.cancel()}});</script></polymer-element><polymer-eleme nt name="paper-calculator-keygrid" attributes="keys" assetpath=""><template>
62
63 <style>:host{position:relative}#keys{width:100%;height:100%}.handle-bar{posi tion:absolute;top:0;left:0;bottom:0;width:24px}</style>
64
65 <div id="keys" horizontal="" layout="">
66
67 <template repeat="{{col in keys}}">
68
69 <div flex="" vertical="" layout="">
70
71 <template repeat="{{col}}">
72
73 <paper-calculator-key flex="" label="{{}}"></paper-calculator-key>
74
75 </template>
76
77 </div>
78
79 </template>
80
81 </div>
82
83 <div class="handle-bar" on-tap="{{handleBarTap}}"></div>
84
85 </template><script>Polymer("paper-calculator-keygrid",{keyTap:function(e){this .fire("cal-keytap",{key:e.target.templateInstance.model})},handleBarTap:function (e){e.preventDefault()},findKey:function(label){return this.$.keys.querySelector ('[label="'+label+'"]')}});</script></polymer-element><polymer-element name="pap er-calculator-panels" attributes="drawerWidthRatio opened margin wideMode respon siveWidth" assetpath=""><template>
86
87 <style>:host{display:block;overflow:hidden}#panelContainer{display:block;pos ition:relative;height:100%}#main{position:absolute;top:0;right:0;bottom:0;left:0 }#panelContainer.wide-layout>#main{right:auto}#drawer{position:absolute;top:0;bo ttom:0;left:100%;transform:translate3d(0,0,0);-webkit-transform:translate3d(0,0, 0);transition:-webkit-transform .13s linear;transition:transform .13s linear}#dr awer.dragging{transition:none}polyfill-next-selector{content:'#main > *, #drawer > *'}::content>*{position:absolute;top:0;right:0;bottom:0;left:0}</style>
88
89 <div id="panelContainer" class="{{wideMode ? 'wide-layout' : ''}}">
90
91 <div id="main">
92 <content select="[main]"></content>
93 </div>
94
95 <div id="drawer" on-trackstart="{{trackStart}}" on-trackx="{{trackx}}" on- trackend="{{trackEnd}}">
96 <content select="[drawer]"></content>
97 </div>
98
99 </div>
100
101 <core-media-query query="min-width: {{responsiveWidth}}" querymatches="{{wid eMode}}"></core-media-query>
102
103 </template><script>Polymer("paper-calculator-panels",{wideMode:false,responsiv eWidth:"",margin:10,drawerWidthRatio:0,opened:false,observe:{wideMode:"updateSiz e",drawerWidthRatio:"updateSize"},marginChanged:function(){this.$.panelContainer .style.width="calc(100% - "+(this.wideMode?0:this.margin)+"px)"},updateSize:func tion(){var w=1/(1+this.drawerWidthRatio)*100;this.$.main.style.width=this.$.draw er.style.left=this.wideMode?w+"%":"";this.$.drawer.style.width=this.wideMode?100 -w+"%":this.drawerWidthRatio*100+"%";this.opened=false;this.marginChanged()},ope nedChanged:function(){this.positionDrawer(this.opened?"calc("+this.margin+"px - 100%)":null)},positionDrawer:function(x){var s=this.$.drawer.style;s.webkitTrans form=s.transform=x?"translate3d("+x+", 0, 0)":""},trackStart:function(e){if(this .wideMode){return}var w=this.$.drawer.offsetWidth;var m=this.margin;this._startx =this.opened?m-w:0;this._min=this.opened?0:m-w;this._max=this.opened?w-m:0;this. $.drawer.classList.add("dragging");e.preventTap();e.stopPropagation()},trackx:fu nction(e){if(this.wideMode){return}var x=Math.max(this._min,Math.min(this._max,e .dx));this.positionDrawer(this._startx+x+"px");e.stopPropagation()},trackEnd:fun ction(e){if(this.wideMode){return}this.$.drawer.classList.remove("dragging");var old=this.opened;this.opened=e.xDirection===-1;if(old==this.opened){this.openedC hanged()}e.stopPropagation()}});</script></polymer-element><polymer-element name ="paper-calculator-keypad" attributes="wideMode standardKeys advancedKeys modeKe ys" assetpath=""><template>
104
105 <style>:host{display:block;position:relative;cursor:pointer}#outerPanels{wid th:100%;height:100%}#standard{background-color:#4c4c4c;font-weight:300;font-size :2em;color:#fff}#standard::shadow #keys>div:nth-of-type(4){background-color:#666 ;border-left:1px solid #444}.narrow #standard,.narrow #standard::shadow #keys>di v:nth-of-type(4){box-shadow:inset 0 12px 12px rgba(0,0,0,.25)}#innerPanels{backg round-color:#40bd9e}[drawer]{-webkit-transform:translateZ(0);transform:translate Z(0)}.narrow #innerPanels{box-shadow:-4px 0 4px rgba(0,0,0,.2)}#advanced{backgro und-color:#40bd9e;font-weight:400;font-size:1.125em;color:#f7f7f7}.narrow #advan ced{box-shadow:inset 0 7px 7px rgba(0,0,0,.25)}#mode{background-color:#1de9b6;fo nt-weight:400;font-size:1em;color:#777}.narrow #mode{box-shadow:-4px 0 4px rgba( 0,0,0,.2),inset 0 5px 5px rgba(0,0,0,.25)}</style>
106
107 <paper-calculator-panels id="outerPanels" class="{{ {narrow : !wideMode} | t okenList}}" margin="{{margin}}" widemode="{{wideMode}}" drawerwidthratio="0.8">
108
109 <paper-calculator-keygrid id="standard" main="" keys="{{standardKeys}}"></ paper-calculator-keygrid>
110
111 <paper-calculator-panels id="innerPanels" drawer="" margin="{{margin}}" wi demode="{{wideMode}}" drawerwidthratio="0.3">
112
113 <paper-calculator-keygrid id="advanced" main="" keys="{{advancedKeys}}"> </paper-calculator-keygrid>
114
115 <paper-calculator-keygrid id="mode" drawer="" keys="{{modeKeys}}"></pape r-calculator-keygrid>
116
117 </paper-calculator-panels>
118
119 </paper-calculator-panels>
120
121 </template><script>Polymer("paper-calculator-keypad",{margin:24,findKey:functi on(label){var ps=[this.$.standard,this.$.advanced,this.$.mode];for(var i=0,p;p=p s[i];i++){var key=p.findKey(label);if(key){return key}}},get equalKey(){return t his.$.standard.findKey("=")}});</script></polymer-element><polymer-element name= "paper-calculator-math" attributes="expression result" assetpath=""><script>Poly mer("paper-calculator-math",{eval:function(){var s=this.expression;s=s.replace(/ \u00D7/g,"*").replace(/\u00F7/g,"/");try{this.result=eval(s)}catch(x){this.resul t="?"}}});</script></polymer-element><polymer-element name="paper-calculator" at tributes="expression result wideMode responsiveWidth" tabindex="0" assetpath=""> <template>
122
123 <style>:host{display:block;position:relative;background-color:#eee;overflow: hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user- select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;- webkit-font-smoothing:antialiased}#output{position:absolute;top:0;left:0;width:1 00%;height:38%;z-index:1}#output.wide{box-shadow:0 5px 4px rgba(0,0,0,.3)}#keypa d{position:absolute;top:38%;bottom:0;width:100%}#resultInk{position:absolute;bor der-radius:50%;background-color:#73daeb;-webkit-transform:translateZ(0) scale(0) ;transform:translateZ(0) scale(0)}#resultInk.error{background-color:#f50057}#res ultInk.spill{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) sc ale(1);-webkit-transition:-webkit-transform .38s ease-out;transition:transform . 38s ease-out}</style>
124
125 <div id="resultInk" class="{{ {spill : result, error : error} | tokenList }} "></div>
126
127 <paper-calculator-output id="output" class="{{ {wide : wideMatches || wideMo de} | tokenList}}" expression="{{expression}}" result="{{result}}" error="{{erro r}}"></paper-calculator-output>
128
129 <paper-calculator-keypad id="keypad" widemode="{{wideMatches || wideMode}}" standardkeys="{{standardKeys}}" advancedkeys="{{advancedKeys}}" modekeys="{{mode Keys}}"></paper-calculator-keypad>
130
131 <paper-calculator-math id="math" expression="{{expression}}" result="{{resul t}}" error="{{error}}"></paper-calculator-math>
132
133 <core-media-query query="min-width: {{responsiveWidth}}" querymatches="{{wid eMatches}}"></core-media-query>
134
135 </template><script>Polymer("paper-calculator",{domReady:function(){this.update ResultInk();window.addEventListener("resize",this.updateResultInk.bind(this))},s tandardKeys:[["7","4","1","."],["8","5","2","0"],["9","6","3","="],["DEL","+","- ","÷","×"]],advancedKeys:[["2nd","1/x","x!","sin","sinh","EXP"],["(","x²","√","c os","cosh","Π"],[")","x³","ⁿ √y","tan","tanh","EE"],["%","yⁿ","log","ln","eⁿ","R and"]],modeKeys:[["Deg","Rad","func","Table","Graph",""]],errorMsgs:["error...", "umm...",":-("],wideMode:false,responsiveWidth:"",expression:"",result:"",eventD elegates:{},clear:function(){this.expression="";this.result="";this.error=""},de l:function(){this.expression=this.expression.slice(0,-1)},eval:function(){this.$ .math.eval()},keyTap:function(e){var k=e.detail.key;if(this.modeKeys[0].indexOf( k)<0){this.processKey(k)}},keyDown:function(e){if(e.keyCode===8){this.del();e.pr eventDefault()}},keyPress:function(e){var c=e.keyCode,k;if(c===13){k="="}else{k= String.fromCharCode(c)}var key=this.$.keypad.findKey(k);this.processKey(k);e.pre ventDefault()},processKey:function(k){if(this.result&&k!=="="){this.clear()}if(k ==="="){this.async(this.eval)}else if(k==="DEL"){this.del()}else{this.expression +=k}},updateResultInk:function(){var rect=this.getBoundingClientRect();var keyRe ct=this.$.keypad.equalKey.getBoundingClientRect();var s=this.$.resultInk.style;v ar t=keyRect.top-rect.top+keyRect.height/2;s.top=-t+"px";s.left=-t*2+(keyRect.le ft-rect.left+keyRect.width/2)+"px";s.width=s.height=4*t+"px"},resultChanged:func tion(){if(this.result==="?"){this.error=this.errorMsgs[Math.floor(Math.random()* this.errorMsgs.length)]}}});</script></polymer-element></div><paper-calculator r esponsivewidth="800px"></paper-calculator></body></html>
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_hit_test_cases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698