concerto_frontend 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 131caeac83baa46107672d042b27141221569909
4
- data.tar.gz: 76d54e79d2fd321781871b1f1f755ce48d2db313
3
+ metadata.gz: 37bf0d299eb70e6ed4871127c77253989e8b1eec
4
+ data.tar.gz: cf024f18f7c6a38f2abe6c2b8e739a2db77757cc
5
5
  SHA512:
6
- metadata.gz: 9400db546bca3b0d35da22ee0c59c0afeef365bca9f2037eb0a761d1e9efb06f1de6c9e0ee4533595cd48fba84174d0b742f304abbb524da29cf181a80bcfcfc
7
- data.tar.gz: b320b51104567651642d227ab9929db312ca7a697187618ae836ccbe6744372edeba97ba30eba4d2750ad8ae763206f8e687a830f735ececcd7e7650907db32e
6
+ metadata.gz: 89a71937a80ca51b05680a224ccb1a002a2998216ec9587258e49ddd26e076d9159a7c7a0fd0570f53e211119017a8a3fc7b393212aca51231f009a7a1ccbde8
7
+ data.tar.gz: dfc4a0e7fdb443e9dfbd1be090e2d9b23901053dba015a3e773be793e0707c5d7f6c3a499bbef4ea892f68fdfc8712ac2c4ca1f49fdb78e13ff41e352fae7bb4
@@ -7,7 +7,7 @@ d=x+y;if(d>dist){dist=d;points={a:a,b:b}}}}x=Math.abs(points.a.clientX+points.b.
7
7
  var code=char.charCodeAt(0);switch(code){case 91:case 93:case 46:case 34:case 39:case 48:return char;case 95:case 36:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}if(97<=code&&code<=122||65<=code&&code<=90)return"ident";if(49<=code&&code<=57)return"number";return"else"}var pathStateMachine={beforePath:{ws:["beforePath"],ident:["inIdent","append"],"[":["beforeElement"],eof:["afterPath"]},inPath:{ws:["inPath"],".":["beforeIdent"],"[":["beforeElement"],eof:["afterPath"]},beforeIdent:{ws:["beforeIdent"],ident:["inIdent","append"]},inIdent:{ident:["inIdent","append"],0:["inIdent","append"],number:["inIdent","append"],ws:["inPath","push"],".":["beforeIdent","push"],"[":["beforeElement","push"],eof:["afterPath","push"]},beforeElement:{ws:["beforeElement"],0:["afterZero","append"],number:["inIndex","append"],"'":["inSingleQuote","append",""],'"':["inDoubleQuote","append",""]},afterZero:{ws:["afterElement","push"],"]":["inPath","push"]},inIndex:{0:["inIndex","append"],number:["inIndex","append"],ws:["afterElement"],"]":["inPath","push"]},inSingleQuote:{"'":["afterElement"],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.push(key);key=undefined},append:function(){if(key===undefined)key=newChar;else key+=newChar}};function maybeUnescapeQuote(){if(index>=path.length)return;var nextChar=path[index+1];if(mode=="inSingleQuote"&&nextChar=="'"||mode=="inDoubleQuote"&&nextChar=='"'){index++;newChar=nextChar;actions.append();return true}}while(mode){index++;c=path[index];if(c=="\\"&&maybeUnescapeQuote(mode))continue;type=getPathCharType(c);typeMap=pathStateMachine[mode];transition=typeMap[type]||typeMap["else"]||"error";if(transition=="error")return;mode=transition[0];action=actions[transition[1]]||noop;newChar=transition[2]===undefined?c:transition[2];action();if(mode==="afterPath"){return keys}}return}function isIdent(s){return identRegExp.test(s)}var constructorIsPrivate={};function Path(parts,privateToken){if(privateToken!==constructorIsPrivate)throw Error("Use Path.get to retrieve path objects");for(var i=0;i<parts.length;i++){this.push(String(parts[i]))}if(hasEval&&this.length){this.getValueFrom=this.compiledGetValueFromFn()}}var pathCache={};function getPath(pathString){if(pathString instanceof Path)return pathString;if(pathString==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 path;var parts=parsePath(pathString);if(!parts)return invalidPath;var path=new Path(parts,constructorIsPrivate);pathCache[pathString]=path;return path}Path.get=getPath;function formatAccessor(key){if(isIndex(key)){return"["+key+"]"}else{return'["'+key.replace(/"/g,'\\"')+'"]'}}Path.prototype=createObject({__proto__:[],valid:true,toString:function(){var pathString="";for(var i=0;i<this.length;i++){var key=this[i];if(isIdent(key)){pathString+=i?"."+key:key}else{pathString+=formatAccessor(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},iterateObjects:function(obj,observe){for(var i=0;i<this.length;i++){if(i)obj=obj[this[i-1]];if(!isObject(obj))return;observe(obj,this[i])}},compiledGetValueFromFn:function(){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:formatAccessor(key);str+=" &&\n "+pathString+" != null"}str+=")\n";var key=this[i];pathString+=isIdent(key)?"."+key:formatAccessor(key);str+=" return "+pathString+";\nelse\n return undefined;";return new Function("obj",str)},setValueFrom:function(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=function(){};var MAX_DIRTY_CHECK_CYCLES=1e3;function dirtyCheck(observer){var cycles=0;while(cycles<MAX_DIRTY_CHECK_CYCLES&&observer.check_()){cycles++}if(testingExposeCycleCount)global.dirtyCheckCycleCount=cycles;return cycles>0}function objectIsEmpty(object){for(var prop in object)return false;return true}function diffIsEmpty(diff){return objectIsEmpty(diff.added)&&objectIsEmpty(diff.removed)&&objectIsEmpty(diff.changed)}function diffObjectFromOldObject(object,oldObject){var added={};var removed={};var changed={};for(var prop in oldObject){var newValue=object[prop];if(newValue!==undefined&&newValue===oldObject[prop])continue;if(!(prop in object)){removed[prop]=undefined;continue}if(newValue!==oldObject[prop])changed[prop]=newValue}for(var prop in object){if(prop in oldObject)continue;added[prop]=object[prop]}if(Array.isArray(object)&&object.length!==oldObject.length)changed.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=hasObserve?function(){return function(fn){return Promise.resolve().then(fn)}}():function(){return function(fn){eomTasks.push(fn)}}();var observedObjectCache=[];function newObservedObject(){var observer;var object;var discardRecords=false;var first=true;function callback(records){if(observer&&observer.state_===OPENED&&!discardRecords)observer.check_(records)}return{open:function(obs){if(observer)throw Error("ObservedObject in use");if(!first)Object.deliverChangeRecords(callback);observer=obs;first=false},observe:function(obj,arrayObserve){object=obj;if(arrayObserve)Array.observe(object,callback);else Object.observe(object,callback)},deliver:function(discard){discardRecords=discard;Object.deliverChangeRecords(callback);discardRecords=false},close:function(){observer=undefined;Object.unobserve(object,callback);observedObjectCache.push(this)}}}function getObservedObject(observer,object,arrayObserve){var dir=observedObjectCache.pop()||newObservedObject();dir.open(observer);dir.observe(object,arrayObserve);return dir}var observedSetCache=[];function newObservedSet(){var observerCount=0;var observers=[];var objects=[];var rootObj;var rootObjProps;function observe(obj,prop){if(!obj)return;if(obj===rootObj)rootObjProps[prop]=true;if(objects.indexOf(obj)<0){objects.push(obj);Object.observe(obj,callback)}observe(Object.getPrototypeOf(obj),prop)}function 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){observer.check_()}}}var record={objects:objects,get rootObject(){return rootObj},set rootObject(value){rootObj=value;rootObjProps={}},open:function(obs,object){observers.push(obs);observerCount++;obs.iterateObjects_(observe)},close:function(obs){observerCount--;if(observerCount>0){return}for(var i=0;i<objects.length;i++){Object.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 lastObservedSet;function getObservedSet(observer,obj){if(!lastObservedSet||lastObservedSet.rootObject!==obj){lastObservedSet=observedSetCache.pop()||newObservedSet();lastObservedSet.rootObject=obj}lastObservedSet.open(observer,obj);return lastObservedSet}var UNOPENED=0;var OPENED=1;var CLOSED=2;var RESETTING=3;var nextObserverId=1;function Observer(){this.state_=UNOPENED;this.callback_=undefined;this.target_=undefined;this.directObserver_=undefined;this.value_=undefined;this.id_=nextObserverId++}Observer.prototype={open:function(callback,target){if(this.state_!=UNOPENED)throw Error("Observer has already been opened.");addToAll(this);this.callback_=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_=undefined;this.state_=CLOSED},deliver:function(){if(this.state_!=OPENED)return;dirtyCheck(this)},report_:function(changes){try{this.callback_.apply(this.target_,changes)}catch(ex){Observer._errorThrownDuringCallback=true;console.error("Exception caught during observer callback: "+(ex.stack||ex))}},discardChanges:function(){this.check_(undefined,true);return this.value_}};var collectObservers=!hasObserve;var allObservers;Observer._allObserversCount=0;if(collectObservers){allObservers=[]}function addToAll(observer){Observer._allObserversCount++;if(!collectObservers)return;allObservers.push(observer)}function removeFromAll(observer){Observer._allObserversCount--}var runningMicrotaskCheckpoint=false;global.Platform=global.Platform||{};global.Platform.performMicrotaskCheckpoint=function(){if(runningMicrotaskCheckpoint)return;if(!collectObservers)return;runningMicrotaskCheckpoint=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=true;allObservers.push(observer)}if(runEOMTasks())anyChanged=true}while(cycles<MAX_DIRTY_CHECK_CYCLES&&anyChanged);if(testingExposeCycleCount)global.dirtyCheckCycleCount=cycles;runningMicrotaskCheckpoint=false};if(collectObservers){global.Platform.clearObservers=function(){allObservers=[]}}function ObjectObserver(object){Observer.call(this);this.value_=object;this.oldObject_=undefined}ObjectObserver.prototype=createObject({__proto__:Observer.prototype,arrayObserve:false,connect_:function(callback,target){if(hasObserve){this.directObserver_=getObservedObject(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=diffObjectFromChangeRecords(this.value_,changeRecords,oldValues)}else{oldValues=this.oldObject_;diff=diffObjectFromOldObject(this.value_,this.oldObject_)}if(diffIsEmpty(diff))return false;if(!hasObserve)this.oldObject_=this.copyObject(this.value_);this.report_([diff.added||{},diff.removed||{},diff.changed||{},function(property){return oldValues[property]}]);return true},disconnect_:function(){if(hasObserve){this.directObserver_.close();this.directObserver_=undefined}else{this.oldObject_=undefined}},deliver:function(){if(this.state_!=OPENED)return;if(hasObserve)this.directObserver_.deliver(false);else dirtyCheck(this)},discardChanges:function(){if(this.directObserver_)this.directObserver_.deliver(true);else this.oldObject_=this.copyObject(this.value_);return this.value_}});function ArrayObserver(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 arr.slice()},check_:function(changeRecords){var splices;if(hasObserve){if(!changeRecords)return false;splices=projectArraySplices(this.value_,changeRecords)}else{splices=calcSplices(this.value_,0,this.value_.length,this.oldObject_,0,this.oldObject_.length)}if(!splices||!splices.length)return false;if(!hasObserve)this.oldObject_=this.copyObject(this.value_);this.report_([splices]);return true}});ArrayObserver.applySplices=function(previous,current,splices){splices.forEach(function(splice){var spliceArgs=[splice.index,splice.removed.length];var addIndex=splice.index;while(addIndex<splice.index+splice.addedCount){spliceArgs.push(current[addIndex]);addIndex++}Array.prototype.splice.apply(previous,spliceArgs)})};function PathObserver(object,path){Observer.call(this);this.object_=object;this.path_=getPath(path);this.directObserver_=undefined}PathObserver.prototype=createObject({__proto__:Observer.prototype,get path(){return this.path_},connect_:function(){if(hasObserve)this.directObserver_=getObservedSet(this,this.object_);this.check_(undefined,true)},disconnect_:function(){this.value_=undefined;if(this.directObserver_){this.directObserver_.close(this);this.directObserver_=undefined}},iterateObjects_:function(observe){this.path_.iterateObjects(this.object_,observe)},check_:function(changeRecords,skipChanges){var oldValue=this.value_;this.value_=this.path_.getValueFrom(this.object_);if(skipChanges||areSameValue(this.value_,oldValue))return false;this.report_([this.value_,oldValue,this]);return true},setValue:function(newValue){if(this.path_)this.path_.setValueFrom(this.object_,newValue)}});function CompoundObserver(reportChangesOnOpen){Observer.call(this);this.reportChangesOnOpen_=reportChangesOnOpen;this.value_=[];this.directObserver_=undefined;this.observed_=[]}var observerSentinel={};CompoundObserver.prototype=createObject({__proto__:Observer.prototype,connect_:function(){if(hasObserve){var object;var needsDirectObserver=false;for(var i=0;i<this.observed_.length;i+=2){object=this.observed_[i];if(object!==observerSentinel){needsDirectObserver=true;break}}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.observed_[i+1].close()}this.observed_.length=0;this.value_.length=0;if(this.directObserver_){this.directObserver_.close(this);this.directObserver_=undefined}},addPath:function(object,path){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add paths once started.");var path=getPath(path);this.observed_.push(object,path);if(!this.reportChangesOnOpen_)return;var index=this.observed_.length/2-1;this.value_[index]=path.getValueFrom(object)},addObserver:function(observer){if(this.state_!=UNOPENED&&this.state_!=RESETTING)throw Error("Cannot add observers once started.");this.observed_.push(observerSentinel,observer);if(!this.reportChangesOnOpen_)return;var index=this.observed_.length/2-1;this.value_[index]=observer.open(this.deliver,this)},startReset:function(){if(this.state_!=OPENED)throw Error("Can only reset while open");this.state_=RESETTING;this.disconnect_()},finishReset:function(){if(this.state_!=RESETTING)throw Error("Can only finishReset after startReset");this.state_=OPENED;this.connect_();return this.value_},iterateObjects_:function(observe){var object;for(var i=0;i<this.observed_.length;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.observed_[i];var path=this.observed_[i+1];var value;if(object===observerSentinel){var observable=path;value=this.state_===UNOPENED?observable.open(this.deliver,this):observable.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(observable,getValueFn,setValueFn,dontPassThroughSet){this.callback_=undefined;this.target_=undefined;this.value_=undefined;this.observable_=observable;this.getValueFn_=getValueFn||identFn;this.setValueFn_=setValueFn||identFn;this.dontPassThroughSet_=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_},observedCallback_:function(value){value=this.getValueFn_(value);if(areSameValue(value,this.value_))return;var oldValue=this.value_;this.value_=value;this.callback_.call(this.target_,this.value_,oldValue)},discardChanges:function(){this.value_=this.getValueFn_(this.observable_.discardChanges());return this.value_},deliver:function(){return this.observable_.deliver()},setValue:function(value){value=this.setValueFn_(value);if(!this.dontPassThroughSet_&&this.observable_.setValue)return this.observable_.setValue(value)},close:function(){if(this.observable_)this.observable_.close();this.callback_=undefined;this.target_=undefined;this.observable_=undefined;this.value_=undefined;this.getValueFn_=undefined;this.setValueFn_=undefined}};var expectedRecordTypes={add:true,update:true,"delete":true};function diffObjectFromChangeRecords(object,changeRecords,oldValues){var added={};var removed={};for(var i=0;i<changeRecords.length;i++){var record=changeRecords[i];if(!expectedRecordTypes[record.type]){console.error("Unknown changeRecord type: "+record.type);console.error(record);continue}if(!(record.name in oldValues))oldValues[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 oldValues[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 newValue=object[prop];if(oldValues[prop]!==newValue)changed[prop]=newValue}return{added:added,removed:removed,changed:changed}}function newSplice(index,removed,addedCount){return{index:index,removed:removed,addedCount:addedCount}}var EDIT_LEAVE=0;var EDIT_UPDATE=1;var EDIT_ADD=2;var EDIT_DELETE=3;function ArraySplice(){}ArraySplice.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++){distances[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]=distances[i-1][j-1];else{var north=distances[i-1][j]+1;var west=distances[i][j-1]+1;distances[i][j]=north<west?north:west}}}return distances},spliceOperationsFromEditDistances: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 northWest=distances[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: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,currentEnd,old,oldStart,oldEnd){var prefixCount=0;var suffixCount=0;var minLength=Math.min(currentEnd-currentStart,oldEnd-oldStart);if(currentStart==0&&oldStart==0)prefixCount=this.sharedPrefix(current,old,minLength);if(currentEnd==current.length&&oldEnd==old.length)suffixCount=this.sharedSuffix(current,old,minLength-prefixCount);currentStart+=prefixCount;oldStart+=prefixCount;currentEnd-=suffixCount;oldEnd-=suffixCount;if(currentEnd-currentStart==0&&oldEnd-oldStart==0)return[];if(currentStart==currentEnd){var splice=newSplice(currentStart,[],0);while(oldStart<oldEnd)splice.removed.push(old[oldStart++]);return[splice]}else if(oldStart==oldEnd)return[newSplice(currentStart,[],currentEnd-currentStart)];var ops=this.spliceOperationsFromEditDistances(this.calcEditDistances(current,currentStart,currentEnd,old,oldStart,oldEnd));var splice=undefined;var splices=[];var index=currentStart;var oldIndex=oldStart;for(var i=0;i<ops.length;i++){switch(ops[i]){case EDIT_LEAVE: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)splice=newSplice(index,[],0);splice.addedCount++;index++;break;case EDIT_DELETE:if(!splice)splice=newSplice(index,[],0);splice.removed.push(old[oldIndex]);oldIndex++;break}}if(splice){splices.push(splice)}return splices},sharedPrefix:function(current,old,searchLength){for(var i=0;i<searchLength;i++)if(!this.equals(current[i],old[i]))return i;return searchLength},sharedSuffix:function(current,old,searchLength){var index1=current.length;var index2=old.length;var count=0;while(count<searchLength&&this.equals(current[--index1],old[--index2]))count++;return count},calculateSplices:function(current,previous){return this.calcSplices(current,0,current.length,previous,0,previous.length)},equals:function(currentValue,previousValue){return currentValue===previousValue}};var arraySplice=new ArraySplice;function calcSplices(current,currentStart,currentEnd,old,oldStart,oldEnd){return arraySplice.calcSplices(current,currentStart,currentEnd,old,oldStart,oldEnd)}function intersect(start1,end1,start2,end2){if(end1<start2||end2<start1)return-1;if(end1==start2||end2==start1)return 0;if(start1<start2){if(end1<end2)return end1-start2;else return end2-start2}else{if(end2<end1)return end2-start1;else return end1-start1}}function mergeSplice(splices,index,removed,addedCount){var splice=newSplice(index,removed,addedCount);var inserted=false;var insertionOffset=0;for(var i=0;i<splices.length;i++){var current=splices[i];current.index+=insertionOffset;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-current.removed.length;splice.addedCount+=current.addedCount-intersectCount;var deleteCount=splice.removed.length+current.removed.length-intersectCount;if(!splice.addedCount&&!deleteCount){inserted=true}else{var removed=current.removed;if(splice.index<current.index){var prepend=splice.removed.slice(0,current.index-splice.index);Array.prototype.push.apply(prepend,removed);removed=prepend}if(splice.index+splice.removed.length>current.index+current.addedCount){var append=splice.removed.slice(current.index+current.addedCount-splice.index);Array.prototype.push.apply(removed,append)}splice.removed=removed;if(current.index<splice.index){splice.index=current.index}}}else if(splice.index<current.index){inserted=true;splices.splice(i,0,splice);i++;var offset=splice.addedCount-splice.removed.length;current.index+=offset;insertionOffset+=offset}}if(!inserted)splices.push(splice)}function createInitialSplices(array,changeRecords){var splices=[];for(var i=0;i<changeRecords.length;i++){var record=changeRecords[i];switch(record.type){case"splice":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,[record.oldValue],1);break;default:console.error("Unexpected record type: "+JSON.stringify(record));break}}return splices}function projectArraySplices(array,changeRecords){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(calcSplices(array,splice.index,splice.index+splice.addedCount,splice.removed,0,splice.removed.length))});return splices}var expose=global;if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){expose=exports=module.exports}expose=exports}expose.Observer=Observer;expose.Observer.runEOM_=runEOM;expose.Observer.observerSentinel_=observerSentinel;expose.Observer.hasObjectObserve=hasObserve;expose.ArrayObserver=ArrayObserver;expose.ArrayObserver.calculateSplices=function(current,previous){return arraySplice.calculateSplices(current,previous)};expose.ArraySplice=ArraySplice;expose.ObjectObserver=ObjectObserver;expose.PathObserver=PathObserver;expose.CompoundObserver=CompoundObserver;expose.Path=Path;expose.ObserverTransform=ObserverTransform})(typeof global!=="undefined"&&global&&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(name,observable){console.error("Unhandled binding to Node: ",this,name,observable)};Node.prototype.bindFinished=function(){};function updateBindings(node,name,binding){var bindings=node.bindings_;if(!bindings)bindings=node.bindings_={};if(bindings[name])binding[name].close();return bindings[name]=binding}function returnBinding(node,name,binding){return binding}function sanitizeValue(value){return value==null?"":value}function updateText(node,value){node.data=sanitizeValue(value)}function textBinding(node){return function(value){return updateText(node,value)}}var maybeUpdateBindings=returnBinding;Object.defineProperty(Platform,"enableBindingsReflection",{get:function(){return maybeUpdateBindings===updateBindings},set:function(enable){maybeUpdateBindings=enable?updateBindings:returnBinding;return enable},configurable:true});Text.prototype.bind=function(name,value,oneTime){if(name!=="textContent")return Node.prototype.bind.call(this,name,value,oneTime);if(oneTime)return updateText(this,value);var observable=value;updateText(this,observable.open(textBinding(this)));return maybeUpdateBindings(this,name,observable)};function updateAttribute(el,name,conditional,value){if(conditional){if(value)el.setAttribute(name,"");else el.removeAttribute(name);return}el.setAttribute(name,sanitizeValue(value))}function attributeBinding(el,name,conditional){return function(value){updateAttribute(el,name,conditional,value)}}Element.prototype.bind=function(name,value,oneTime){var conditional=name[name.length-1]=="?";if(conditional){this.removeAttribute(name);name=name.slice(0,-1)}if(oneTime)return updateAttribute(this,name,conditional,value);var observable=value;updateAttribute(this,name,conditional,observable.open(attributeBinding(this,name,conditional)));return maybeUpdateBindings(this,name,observable)};var checkboxEventType;(function(){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||"click"});checkbox.addEventListener("change",function(){count++;first=first||"change"});var event=document.createEvent("MouseEvent");event.initMouseEvent("click",true,true,window,0,0,0,0,0,false,false,false,false,0,null);checkbox.dispatchEvent(event);checkboxEventType=count==1?"change":first})();function getEventForInputType(element){switch(element.type){case"checkbox":return checkboxEventType;case"radio":case"select-multiple":case"select-one":return"change";case"range":if(/Trident|MSIE/.test(navigator.userAgent))return"change";default:return"input"}}function updateInput(input,property,value,santizeFn){input[property]=(santizeFn||sanitizeValue)(value)}function inputBinding(input,property,santizeFn){return function(value){return updateInput(input,property,value,santizeFn)}}function noop(){}function bindInputEvent(input,property,observable,postEventFn){var eventType=getEventForInputType(input);function eventHandler(){observable.setValue(input[property]);observable.discardChanges();(postEventFn||noop)(input);Platform.performMicrotaskCheckpoint()}input.addEventListener(eventType,eventHandler);return{close:function(){input.removeEventListener(eventType,eventHandler);observable.close()},observable_:observable}}function booleanSanitize(value){return Boolean(value)}function 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="'+element.name+'"]');return filter(radios,function(el){return el!=element&&!el.form})}}function checkedPostEvent(input){if(input.tagName==="INPUT"&&input.type==="radio"){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,value,oneTime);this.removeAttribute(name);var sanitizeFn=name=="checked"?booleanSanitize:sanitizeValue;var postEventFn=name=="checked"?checkedPostEvent:noop;if(oneTime)return updateInput(this,name,value,sanitizeFn);var observable=value;var binding=bindInputEvent(this,name,observable,postEventFn);updateInput(this,name,observable.open(inputBinding(this,name,sanitizeFn)),sanitizeFn);return updateBindings(this,name,binding)};HTMLTextAreaElement.prototype.bind=function(name,value,oneTime){if(name!=="value")return HTMLElement.prototype.bind.call(this,name,value,oneTime);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",sanitizeValue)));return maybeUpdateBindings(this,name,binding)};function updateOption(option,value){var parentNode=option.parentNode;var select;var selectBinding;var oldValue;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!=oldValue){selectBinding.observable_.setValue(select.value);selectBinding.observable_.discardChanges();Platform.performMicrotaskCheckpoint()}}function optionBinding(option){return function(value){updateOption(option,value)}}HTMLOptionElement.prototype.bind=function(name,value,oneTime){if(name!=="value")return HTMLElement.prototype.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.bind=function(name,value,oneTime){if(name==="selectedindex")name="selectedIndex";if(name!=="selectedIndex"&&name!=="value")return HTMLElement.prototype.bind.call(this,name,value,oneTime);this.removeAttribute(name);if(oneTime)return updateInput(this,name,value);var observable=value;var binding=bindInputEvent(this,name,observable);updateInput(this,name,observable.open(inputBinding(this,name)));return updateBindings(this,name,binding)
8
8
  }})(this);(function(global){"use strict";function assert(v){if(!v)throw new Error("Assertion failed")}var forEach=Array.prototype.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;var ref;var selector="#"+id;while(!ref){node=getFragmentRoot(node);if(node.protoContent_)ref=node.protoContent_.querySelector(selector);else if(node.getElementById)ref=node.getElementById(id);if(ref||!node.templateCreator_)break;node=node.templateCreator_}return ref}function getInstanceRoot(node){while(node.parentNode){node=node.parentNode}return node.templateCreator_?node:null}var Map;if(global.Map&&typeof global.Map.prototype.forEach==="function"){Map=global.Map}else{Map=function(){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(value)}else{this.values[index]=value}},get:function(key){var index=this.keys.indexOf(key);if(index<0)return;return this.values[index]},"delete":function(key,value){var index=this.keys.indexOf(key);if(index<0)return false;this.keys.splice(index,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(newObject,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 templateAttributeDirectives={template:true,repeat:true,bind:true,ref:true};var semanticTemplateElements={THEAD:true,TBODY:true,TFOOT:true,TH:true,TR:true,TD:true,COLGROUP:true,COL:true,CAPTION:true,OPTION:true,OPTGROUP:true};var hasTemplateElement=typeof HTMLTemplateElement!=="undefined";if(hasTemplateElement){(function(){var t=document.createElement("template");var d=t.content.ownerDocument;var html=d.appendChild(d.createElement("html"));var head=html.appendChild(d.createElement("head"));var base=d.createElement("base");base.href=document.baseURI;head.appendChild(base)})()}var allTemplatesSelectors="template, "+Object.keys(semanticTemplateElements).map(function(tagName){return tagName.toLowerCase()+"[template]"}).join(", ");function isSVGTemplate(el){return el.tagName=="template"&&el.namespaceURI=="http://www.w3.org/2000/svg"}function isHTMLTemplate(el){return el.tagName=="TEMPLATE"&&el.namespaceURI=="http://www.w3.org/1999/xhtml"}function isAttributeTemplate(el){return Boolean(semanticTemplateElements[el.tagName]&&el.hasAttribute("template"))}function isTemplate(el){if(el.isTemplate_===undefined)el.isTemplate_=el.tagName=="TEMPLATE"||isAttributeTemplate(el);return el.isTemplate_}document.addEventListener("DOMContentLoaded",function(e){bootstrapTemplatesRecursivelyFrom(document);Platform.performMicrotaskCheckpoint()},false);function forAllTemplatesFrom(node,fn){var subTemplates=node.querySelectorAll(allTemplatesSelectors);if(isTemplate(node))fn(node);forEach(subTemplates,fn)}function bootstrapTemplatesRecursivelyFrom(node){function bootstrap(template){if(!HTMLTemplateElement.decorate(template))bootstrapTemplatesRecursivelyFrom(template.content)}forAllTemplatesFrom(node,bootstrap)}if(!hasTemplateElement){global.HTMLTemplateElement=function(){throw TypeError("Illegal constructor")}}var hasProto="__proto__"in{};function mixin(to,from){Object.getOwnPropertyNames(from).forEach(function(name){Object.defineProperty(to,name,Object.getOwnPropertyDescriptor(from,name))})}function getOrCreateTemplateContentsOwner(template){var doc=template.ownerDocument;if(!doc.defaultView)return doc;var d=doc.templateContentsOwner_;if(!d){d=doc.implementation.createHTMLDocument("");while(d.lastChild){d.removeChild(d.lastChild)}doc.templateContentsOwner_=d}return d}function getTemplateStagingDocument(template){if(!template.stagingDocument_){var owner=template.ownerDocument;if(!owner.stagingDocument_){owner.stagingDocument_=owner.implementation.createHTMLDocument("");owner.stagingDocument_.isStagingDocument=true;var base=owner.stagingDocument_.createElement("base");base.href=document.baseURI;owner.stagingDocument_.head.appendChild(base);owner.stagingDocument_.stagingDocument_=owner.stagingDocument_}template.stagingDocument_=owner.stagingDocument_}return template.stagingDocument_}function extractTemplateFromAttributeTemplate(el){var template=el.ownerDocument.createElement("template");el.parentNode.insertBefore(template,el);var attribs=el.attributes;var count=attribs.length;while(count-->0){var attrib=attribs[count];if(templateAttributeDirectives[attrib.name]){if(attrib.name!=="template")template.setAttribute(attrib.name,attrib.value);el.removeAttribute(attrib.name)}}return template}function extractTemplateFromSVGTemplate(el){var template=el.ownerDocument.createElement("template");el.parentNode.insertBefore(template,el);var attribs=el.attributes;var count=attribs.length;while(count-->0){var attrib=attribs[count];template.setAttribute(attrib.name,attrib.value);el.removeAttribute(attrib.name)}el.parentNode.removeChild(el);return template}function liftNonNativeTemplateChildrenIntoContent(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"){templateObserver=new MutationObserver(function(records){for(var i=0;i<records.length;i++){records[i].target.refChanged_()}})}HTMLTemplateElement.decorate=function(el,opt_instanceRef){if(el.templateIsDecorated_)return false;var templateElement=el;templateElement.templateIsDecorated_=true;var isNativeHTMLTemplate=isHTMLTemplate(templateElement)&&hasTemplateElement;var bootstrapContents=isNativeHTMLTemplate;var liftContents=!isNativeHTMLTemplate;var liftRoot=false;if(!isNativeHTMLTemplate){if(isAttributeTemplate(templateElement)){assert(!opt_instanceRef);templateElement=extractTemplateFromAttributeTemplate(el);templateElement.templateIsDecorated_=true;isNativeHTMLTemplate=hasTemplateElement;liftRoot=true}else if(isSVGTemplate(templateElement)){templateElement=extractTemplateFromSVGTemplate(el);templateElement.templateIsDecorated_=true;isNativeHTMLTemplate=hasTemplateElement}}if(!isNativeHTMLTemplate){fixTemplateElementPrototype(templateElement);var doc=getOrCreateTemplateContentsOwner(templateElement);templateElement.content_=doc.createDocumentFragment()}if(opt_instanceRef){templateElement.instanceRef_=opt_instanceRef}else if(liftContents){liftNonNativeTemplateChildrenIntoContent(templateElement,el,liftRoot)}else if(bootstrapContents){bootstrapTemplatesRecursivelyFrom(templateElement.content)}return true};HTMLTemplateElement.bootstrap=bootstrapTemplatesRecursivelyFrom;var htmlElement=global.HTMLUnknownElement||HTMLElement;var contentDescriptor={get:function(){return this.content_},enumerable:true,configurable:true};if(!hasTemplateElement){HTMLTemplateElement.prototype=Object.create(htmlElement.prototype);Object.defineProperty(HTMLTemplateElement.prototype,"content",contentDescriptor)}function fixTemplateElementPrototype(el){if(hasProto)el.__proto__=HTMLTemplateElement.prototype;else mixin(el,HTMLTemplateElement.prototype)}function ensureSetModelScheduled(template){if(!template.setModelFn_){template.setModelFn_=function(){template.setModelFnScheduled_=false;var map=getBindings(template,template.delegate_&&template.delegate_.prepareBinding);processBindings(template,map,template.model_)}}if(!template.setModelFnScheduled_){template.setModelFnScheduled_=true;Observer.runEOM_(template.setModelFn_)}}mixin(HTMLTemplateElement.prototype,{bind:function(name,value,oneTime){if(name!="ref")return Element.prototype.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},processBindingDirectives_:function(directives){if(this.iterator_)this.iterator_.closeDeps();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(directives,this.model_);if(templateObserver){templateObserver.observe(this,{attributes:true,attributeFilter:["ref"]})}return this.iterator_},createInstance:function(model,bindingDelegate,delegate_){if(bindingDelegate)delegate_=this.newDelegate_(bindingDelegate);else if(!delegate_)delegate_=this.delegate_;if(!this.refContent_)this.refContent_=this.ref_.content;var content=this.refContent_;if(content.firstChild===null)return emptyInstance;var map=getInstanceBindingMap(content,delegate_);var stagingDocument=getTemplateStagingDocument(this);var instance=stagingDocument.createDocumentFragment();instance.templateCreator_=this;instance.protoContent_=content;instance.bindings_=[];instance.terminator_=null;var instanceRecord=instance.templateInstance_={firstNode:null,lastNode:null,model:model};var i=0;var collectTerminator=false;for(var child=content.firstChild;child;child=child.nextSibling){if(child.nextSibling===null)collectTerminator=true;var clone=cloneAndBindInstance(child,instance,stagingDocument,map.children[i++],model,delegate_,instance.bindings_);clone.templateInstance_=instanceRecord;if(collectTerminator)instance.terminator_=clone}instanceRecord.firstNode=instance.firstChild;instanceRecord.lastNode=instance.lastChild;instance.templateCreator_=undefined;instance.protoContent_=undefined;return instance},get model(){return this.model_},set model(model){this.model_=model;ensureSetModelScheduled(this)},get bindingDelegate(){return this.delegate_&&this.delegate_.raw},refChanged_:function(){if(!this.iterator_||this.refContent_===this.ref_.content)return;this.refContent_=undefined;this.iterator_.valueChanged();this.iterator_.updateIteratedValue(this.iterator_.getUpdatedValue())},clear:function(){this.model_=undefined;this.delegate_=undefined;if(this.bindings_&&this.bindings_.ref)this.bindings_.ref.close();this.refContent_=undefined;if(!this.iterator_)return;this.iterator_.valueChanged();this.iterator_.close();this.iterator_=undefined},setDelegate_:function(delegate){this.delegate_=delegate;this.bindingMap_=undefined;if(this.iterator_){this.iterator_.instancePositionChangedFn_=undefined;this.iterator_.instanceModelFn_=undefined}},newDelegate_:function(bindingDelegate){if(!bindingDelegate)return;function delegateFn(name){var fn=bindingDelegate&&bindingDelegate[name];if(typeof fn!="function")return;return function(){return fn.apply(bindingDelegate,arguments)}}return{bindingMaps:{},raw:bindingDelegate,prepareBinding:delegateFn("prepareBinding"),prepareInstanceModel:delegateFn("prepareInstanceModel"),prepareInstancePositionChanged:delegateFn("prepareInstancePositionChanged")}},set bindingDelegate(bindingDelegate){if(this.delegate_){throw Error("Template must be cleared before a new bindingDelegate "+"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:ref}});function parseMustaches(s,name,node,prepareBindingFn){if(!s||!s.length)return;var tokens;var length=s.length;var startIndex=0,lastIndex=0,endIndex=0;var onlyOneTime=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=oneTimeStart;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 pathString=s.slice(startIndex+2,endIndex).trim();tokens.push(oneTime);onlyOneTime=onlyOneTime&&oneTime;var delegateFn=prepareBindingFn&&prepareBindingFn(pathString,name,node);if(delegateFn==null){tokens.push(Path.get(pathString))}else{tokens.push(null)}tokens.push(delegateFn);lastIndex=endIndex+2}if(lastIndex===length)tokens.push("");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 value=tokens.hasOnePath?values:values[(i-1)/4];if(value!==undefined)newValue+=value;newValue+=tokens[i+3]}return newValue};return tokens}function processOneTimeBinding(name,tokens,node,model){if(tokens.hasOnePath){var delegateFn=tokens[3];var value=delegateFn?delegateFn(model,node,true):tokens[2].getValueFrom(model);return 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?delegateFn(model,node):tokens[i+1].getValueFrom(model)}return tokens.combinator(values)}function processSinglePathBinding(name,tokens,node,model){var delegateFn=tokens[3];var observer=delegateFn?delegateFn(model,node,false):new PathObserver(model,tokens[2]);return tokens.isSimplePath?observer:new ObserverTransform(observer,tokens.combinator)}function processBinding(name,tokens,node,model){if(tokens.onlyOneTime)return processOneTimeBinding(name,tokens,node,model);if(tokens.hasOnePath)return processSinglePathBinding(name,tokens,node,model);var observer=new CompoundObserver;for(var i=1;i<tokens.length;i+=4){var oneTime=tokens[i];var delegateFn=tokens[i+2];if(delegateFn){var value=delegateFn(model,node,oneTime);if(oneTime)observer.addPath(value);else observer.addObserver(value);continue}var path=tokens[i+1];if(oneTime)observer.addPath(path.getValueFrom(model));else observer.addPath(model,path)}return new ObserverTransform(observer,tokens.combinator)}function processBindings(node,bindings,model,instanceBindings){for(var i=0;i<bindings.length;i+=2){var name=bindings[i];var tokens=bindings[i+1];var value=processBinding(name,tokens,node,model);var binding=node.bind(name,value,tokens.onlyOneTime);if(binding&&instanceBindings)instanceBindings.push(binding)}node.bindFinished();if(!bindings.isTemplate)return;node.model_=model;var iter=node.processBindingDirectives_(bindings);if(instanceBindings&&iter)instanceBindings.push(iter)}function parseWithDefault(el,name,prepareBindingFn){var v=el.getAttribute(name);return parseMustaches(v==""?"{{}}":v,name,el,prepareBindingFn)}function parseAttributeBindings(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,prepareBindingFn);if(!tokens)continue;bindings.push(name,tokens)}if(isTemplate(element)){bindings.isTemplate=true;bindings.if=parseWithDefault(element,IF,prepareBindingFn);bindings.bind=parseWithDefault(element,BIND,prepareBindingFn);bindings.repeat=parseWithDefault(element,REPEAT,prepareBindingFn);if(bindings.if&&!bindings.bind&&!bindings.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",node,prepareBindingFn);if(tokens)return["textContent",tokens]}return[]}function cloneAndBindInstance(node,parent,stagingDocument,bindings,model,delegate,instanceBindings,instanceRecord){var clone=parent.appendChild(stagingDocument.importNode(node,false));var i=0;for(var child=node.firstChild;child;child=child.nextSibling){cloneAndBindInstance(child,clone,stagingDocument,bindings.children[i++],model,delegate,instanceBindings)}if(bindings.isTemplate){HTMLTemplateElement.decorate(clone,node);if(delegate)clone.setDelegate_(delegate)}processBindings(clone,bindings,model,instanceBindings);return clone}function createInstanceBindingMap(node,prepareBindingFn){var map=getBindings(node,prepareBindingFn);map.children={};var index=0;for(var child=node.firstChild;child;child=child.nextSibling){map.children[index++]=createInstanceBindingMap(child,prepareBindingFn)}return map}var contentUidCounter=1;function getContentUid(content){var id=content.id_;if(!id)id=content.id_=contentUidCounter++;return id}function getInstanceBindingMap(content,delegate_){var contentId=getContentUid(content);if(delegate_){var map=delegate_.bindingMaps[contentId];if(!map){map=delegate_.bindingMaps[contentId]=createInstanceBindingMap(content,delegate_.prepareBinding)||[]}return map}var map=content.bindingMap_;if(!map){map=content.bindingMap_=createInstanceBindingMap(content,undefined)||[]}return map}Object.defineProperty(Node.prototype,"templateInstance",{get:function(){var instance=this.templateInstance_;return instance?instance:this.parentNode?this.parentNode.templateInstance:undefined}});var emptyInstance=document.createDocumentFragment();emptyInstance.bindings_=[];emptyInstance.terminator_=null;function TemplateIterator(templateElement){this.closed=false;this.templateElement_=templateElement;this.instances=[];this.deps=undefined;this.iteratedValue=[];this.presentValue=undefined;this.arrayObserver=undefined}TemplateIterator.prototype={closeDeps:function(){var deps=this.deps;if(deps){if(deps.ifOneTime===false)deps.ifValue.close();if(deps.oneTime===false)deps.value.close()}},updateDependencies:function(directives,model){this.closeDeps();var deps=this.deps={};var template=this.templateElement_;var ifValue=true;if(directives.if){deps.hasIf=true;deps.ifOneTime=directives.if.onlyOneTime;deps.ifValue=processBinding(IF,directives.if,template,model);ifValue=deps.ifValue;if(deps.ifOneTime&&!ifValue){this.valueChanged();return}if(!deps.ifOneTime)ifValue=ifValue.open(this.updateIfValue,this)}if(directives.repeat){deps.repeat=true;deps.oneTime=directives.repeat.onlyOneTime;deps.value=processBinding(REPEAT,directives.repeat,template,model)}else{deps.repeat=false;deps.oneTime=directives.bind.onlyOneTime;deps.value=processBinding(BIND,directives.bind,template,model)}var value=deps.value;if(!deps.oneTime)value=value.open(this.updateIteratedValue,this);if(!ifValue){this.valueChanged();return}this.updateValue(value)},getUpdatedValue:function(){var value=this.deps.value;if(!this.deps.oneTime)value=value.discardChanges();return value},updateIfValue:function(ifValue){if(!ifValue){this.valueChanged();return}this.updateValue(this.getUpdatedValue())},updateIteratedValue:function(value){if(this.deps.hasIf){var ifValue=this.deps.ifValue;if(!this.deps.ifOneTime)ifValue=ifValue.discardChanges();if(!ifValue){this.valueChanged();return}}this.updateValue(value)},updateValue:function(value){if(!this.deps.repeat)value=[value];var observe=this.deps.repeat&&!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(observeValue){this.arrayObserver=new ArrayObserver(this.presentValue);this.arrayObserver.open(this.handleSplices,this)}this.handleSplices(ArrayObserver.calculateSplices(this.presentValue,this.iteratedValue))},getLastInstanceNode:function(index){if(index==-1)return this.templateElement_;var instance=this.instances[index];var terminator=instance.terminator_;if(!terminator)return this.getLastInstanceNode(index-1);if(terminator.nodeType!==Node.ELEMENT_NODE||this.templateElement_===terminator){return terminator}var subtemplateIterator=terminator.iterator_;if(!subtemplateIterator)return terminator;return subtemplateIterator.getLastTemplateNode()},getLastTemplateNode:function(){return this.getLastInstanceNode(this.instances.length-1)},insertInstanceAt:function(index,fragment){var previousInstanceLast=this.getLastInstanceNode(index-1);var parent=this.templateElement_.parentNode;this.instances.splice(index,0,fragment);parent.insertBefore(fragment,previousInstanceLast.nextSibling)},extractInstanceAt:function(index){var previousInstanceLast=this.getLastInstanceNode(index-1);var lastNode=this.getLastInstanceNode(index);var parent=this.templateElement_.parentNode;var instance=this.instances.splice(index,1)[0];while(lastNode!==previousInstanceLast){var node=previousInstanceLast.nextSibling;if(node==lastNode)lastNode=previousInstanceLast;instance.appendChild(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.templateElement_;if(!template.parentNode){this.close();return}ArrayObserver.applySplices(this.iteratedValue,this.presentValue,splices);var delegate=template.delegate_;if(this.instanceModelFn_===undefined){this.instanceModelFn_=this.getDelegateFn(delegate&&delegate.prepareInstanceModel)}if(this.instancePositionChangedFn_===undefined){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;for(var j=0;j<removed.length;j++){var model=removed[j];var instance=this.extractInstanceAt(splice.index+removeDelta);if(instance!==emptyInstance){instanceCache.set(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 instance=instanceCache.get(model);if(instance){instanceCache.delete(model)}else{if(this.instanceModelFn_){model=this.instanceModelFn_(model)}if(model===undefined){instance=emptyInstance}else{instance=template.createInstance(model,undefined,delegate)}}this.insertInstanceAt(addIndex,instance)}}instanceCache.forEach(function(instance){this.closeInstanceBindings(instance)},this);if(this.instancePositionChangedFn_)this.reportInstancesMoved(splices)},reportInstanceMoved:function(index){var instance=this.instances[index];if(instance===emptyInstance)return;this.instancePositionChangedFn_(instance.templateInstance_,index)},reportInstancesMoved:function(splices){var index=0;var offset=0;for(var i=0;i<splices.length;i++){var splice=splices[i];if(offset!=0){while(index<splice.index){this.reportInstanceMoved(index);index++}}else{index=splice.index}while(index<splice.index+splice.addedCount){this.reportInstanceMoved(index);index++}offset+=splice.addedCount-splice.removed.length}if(offset==0)return;var length=this.instances.length;while(index<length){this.reportInstanceMoved(index);index++}},closeInstanceBindings:function(instance){var bindings=instance.bindings_;for(var i=0;i<bindings.length;i++){bindings[i].close()}},unobserve:function(){if(!this.arrayObserver)return;this.arrayObserver.close();this.arrayObserver=undefined},close:function(){if(this.closed)return;this.unobserve();for(var i=0;i<this.instances.length;i++){this.closeInstanceBindings(this.instances[i])}this.instances.length=0;this.closeDeps();this.templateElement_.iterator_=undefined;this.closed=true}};HTMLTemplateElement.forAllTemplatesFrom_=forAllTemplatesFrom})(this);(function(scope){"use strict";var hasWorkingUrl=false;if(!scope.forceJURL){try{var u=new URL("b","http://a");hasWorkingUrl=u.href==="http://a/b"}catch(e){}}if(hasWorkingUrl)return;var relative=Object.create(null);relative["ftp"]=21;relative["file"]=0;relative["gopher"]=70;relative["http"]=80;relative["https"]=443;relative["ws"]=80;relative["wss"]=443;var relativePathDotMapping=Object.create(null);relativePathDotMapping["%2e"]=".";relativePathDotMapping[".%2e"]="..";relativePathDotMapping["%2e."]="..";relativePathDotMapping["%2e%2e"]="..";function isRelativeScheme(scheme){return relative[scheme]!==undefined}function invalid(){clear.call(this);this._isInvalid=true}function IDNAToASCII(h){if(""==h){invalid.call(this)}return h.toLowerCase()}function percentEscape(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 percentEscapeQuery(c){var unicode=c.charCodeAt(0);if(unicode>32&&unicode<127&&[34,35,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=stateOverride||"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.toLowerCase();state="scheme"}else if(!stateOverride){buffer="";state="no scheme";continue}else{err("Invalid scheme.");break loop}break;case"scheme":if(c&&ALPHANUMERIC.test(c)){buffer+=c.toLowerCase()}else if(":"==c){this._scheme=buffer;buffer="";if(stateOverride){break loop}if(isRelativeScheme(this._scheme)){this._isRelative=true}if("file"==this._scheme){state="relative"}else if(this._isRelative&&base&&base._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":if("?"==c){query="?";state="query"}else if("#"==c){this._fragment="#";state="fragment"}else{if(EOF!=c&&" "!=c&&"\n"!=c&&"\r"!=c){this._schemeData+=percentEscape(c)}}break;case"no scheme":if(!base||!isRelativeScheme(base._scheme)){err("Missing scheme.");invalid.call(this)}else{state="relative";continue}break;case"relative 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();this._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=base._path.slice();this._query=base._query;this._fragment="#";state="fragment"}else{var nextC=input[cursor+1];var nextNextC=input[cursor+2];if("file"!=this._scheme||!ALPHA.test(c)||nextC!=":"&&nextC!="|"||EOF!=nextNextC&&"/"!=nextNextC&&"\\"!=nextNextC&&"?"!=nextNextC&&"#"!=nextNextC){this._host=base._host;this._port=base._port;this._path=base._path.slice();this._path.pop()}state="relative path";continue}break;case"relative slash":if("/"==c||"\\"==c){if("\\"==c){err("\\ is an invalid code point.")}if("file"==this._scheme){state="file host"}else{state="authority ignore slashes"}}else{if("file"!=this._scheme){this._host=base._host;this._port=base._port}state="relative path";continue}break;case"authority first slash":if("/"==c){state="authority second slash"}else{err("Expected '/', got: "+c);state="authority ignore slashes";continue}break;case"authority second slash":state="authority ignore slashes";if("/"!=c){err("Expected '/', got: "+c);continue}break;case"authority ignore slashes":if("/"!=c&&"\\"!=c){state="authority";continue}else{err("Expected authority, got: "+c)}break;case"authority":if("@"==c){if(seenAt){err("@ already seen.");buffer+="%40"}seenAt=true;for(var i=0;i<buffer.length;i++){var cp=buffer[i];if(" "==cp||"\n"==cp||"\r"==cp){err("Invalid whitespace in authority.");continue}if(":"==cp&&null===this._password){this._password="";continue}var tempC=percentEscape(cp);null!==this._password?this._password+=tempC:this._username+=tempC}buffer=""}else if(EOF==c||"/"==c||"\\"==c||"?"==c||"#"==c){cursor-=buffer.length;buffer="";state="host";continue}else{buffer+=c}break;case"file host":if(EOF==c||"/"==c||"\\"==c||"?"==c||"#"==c){if(buffer.length==2&&ALPHA.test(buffer[0])&&(buffer[1]==":"||buffer[1]=="|")){state="relative path"}else 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}break;case"host":case"hostname":if(":"==c&&!seenBracket){this._host=IDNAToASCII.call(this,buffer);buffer="";state="port";if("hostname"==stateOverride){break loop}}else if(EOF==c||"/"==c||"\\"==c||"?"==c||"#"==c){this._host=IDNAToASCII.call(this,buffer);buffer="";state="relative path start";if(stateOverride){break loop}continue}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/hostname: "+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(buffer,10);if(temp!=relative[this._scheme]){this._port=temp+""}buffer=""}if(stateOverride){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)}break;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 allowed in relative path.")}var tmp;if(tmp=relativePathDotMapping[buffer.toLowerCase()]){buffer=tmp}if(".."==buffer){this._path.pop();if("/"!=c&&"\\"!=c){this._path.push("")}}else if("."==buffer&&"/"!=c&&"\\"!=c){this._path.push("")}else if("."!=buffer){if("file"==this._scheme&&this._path.length==0&&buffer.length==2&&ALPHA.test(buffer[0])&&buffer[1]=="|"){buffer=buffer[0]+":"}this._path.push(buffer)}buffer="";if("?"==c){this._query="?";state="query"}else if("#"==c){this._fragment="#";state="fragment"}}else if(" "!=c&&"\n"!=c&&"\r"!=c){buffer+=percentEscape(c)}break;case"query":if(!stateOverride&&"#"==c){this._fragment="#";state="fragment"}else if(EOF!=c&&" "!=c&&"\n"!=c&&"\r"!=c){this._query+=percentEscapeQuery(c)}break;case"fragment":if(EOF!=c&&" "!=c&&"\n"!=c&&"\r"!=c){this._fragment+=c}break}cursor++}}function clear(){this._scheme="";this._schemeData="";this._username="";this._password=null;this._host="";this._port="";this._path=[];this._query="";this._fragment="";this._isInvalid=false;this._isRelative=false}function 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||null!=this._password){authority=this._username+(null!=this._password?":"+this._password:"")+"@"}return this.protocol+(this._isRelative?"//"+authority+this.host:"")+this.pathname+this._query+this._fragment},set href(href){clear.call(this);parse.call(this,href)},get protocol(){return this._scheme+":"},set protocol(protocol){if(this._isInvalid)return;parse.call(this,protocol+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(host){if(this._isInvalid||!this._isRelative)return;
9
9
  parse.call(this,host,"host")},get hostname(){return this._host},set hostname(hostname){if(this._isInvalid||!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._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(pathname){if(this._isInvalid||!this._isRelative)return;this._path=[];parse.call(this,pathname,"relative path start")},get search(){return this._isInvalid||!this._query||"?"==this._query?"":this._query},set search(search){if(this._isInvalid||!this._isRelative)return;this._query="?";if("?"==search[0])search=search.slice(1);parse.call(this,search,"query")},get hash(){return this._isInvalid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(hash){if(this._isInvalid)return;this._fragment="#";if("#"==hash[0])hash=hash.slice(1);parse.call(this,hash,"fragment")},get origin(){var host;if(this._isInvalid||!this._scheme){return""}switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}host=this.host;if(!host){return""}return this._scheme+"://"+host}};var OriginalURL=scope.URL;if(OriginalURL){jURL.createObjectURL=function(blob){return OriginalURL.createObjectURL.apply(OriginalURL,arguments)};jURL.revokeObjectURL=function(url){OriginalURL.revokeObjectURL(url)}}scope.URL=jURL})(this);(function(scope){var iterations=0;var callbacks=[];var twiddle=document.createTextNode("");function endOfMicrotask(callback){twiddle.textContent=iterations++;callbacks.push(callback)}function atEndOfMicrotask(){while(callbacks.length){callbacks.shift()()}}new(window.MutationObserver||JsMutationObserver)(atEndOfMicrotask).observe(twiddle,{characterData:true});scope.endOfMicrotask=endOfMicrotask;Platform.endOfMicrotask=endOfMicrotask})(Polymer);(function(scope){var endOfMicrotask=scope.endOfMicrotask;var log=window.WebComponents?WebComponents.flags.log:{};var style=document.createElement("style");style.textContent="template {display: none !important;} /* injected by platform.js */";var head=document.querySelector("head");head.insertBefore(style,head.firstChild);var flushing;function flush(){if(!flushing){flushing=true;endOfMicrotask(function(){flushing=false;log.data&&console.group("flush");Platform.performMicrotaskCheckpoint();log.data&&console.groupEnd()})}}if(!Observer.hasObjectObserve){var FLUSH_POLL_INTERVAL=125;window.addEventListener("WebComponentsReady",function(){flush();var visibilityHandler=function(){if(document.visibilityState==="hidden"){if(scope.flushPoll){clearInterval(scope.flushPoll)}}else{scope.flushPoll=setInterval(flush,FLUSH_POLL_INTERVAL)}};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(imported);return imported}}scope.flush=flush;Platform.flush=flush})(window.Polymer);(function(scope){var urlResolver={resolveDom:function(root,url){url=url||baseUrl(root);this.resolveAttributes(root,url);this.resolveStyles(root,url);var templates=root.querySelectorAll("template");if(templates){for(var i=0,l=templates.length,t;i<l&&(t=templates[i]);i++){if(t.content){this.resolveDom(t.content,url)}}}},resolveTemplate:function(template){this.resolveDom(template.content,baseUrl(template))},resolveStyles:function(root,url){var styles=root.querySelectorAll("style");if(styles){for(var i=0,l=styles.length,s;i<l&&(s=styles[i]);i++){this.resolveStyle(s,url)}}},resolveStyle:function(style,url){url=url||baseUrl(style);style.textContent=this.resolveCssText(style.textContent,url)},resolveCssText:function(cssText,baseUrl,keepAbsolute){cssText=replaceUrlsInCssText(cssText,baseUrl,keepAbsolute,CSS_URL_REGEXP);return replaceUrlsInCssText(cssText,baseUrl,keepAbsolute,CSS_IMPORT_REGEXP)},resolveAttributes:function(root,url){if(root.hasAttributes&&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)}}},resolveElementAttributes: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(value&&value.search(URL_TEMPLATE_SEARCH)<0){if(v==="style"){replacement=replaceUrlsInCssText(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","src","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 replaceUrlsInCssText(cssText,baseUrl,keepAbsolute,regexp){return cssText.replace(regexp,function(m,pre,url,post){var urlPath=url.replace(/["']/g,"");urlPath=resolveRelativeUrl(baseUrl,urlPath,keepAbsolute);return pre+"'"+urlPath+"'"+post})}function resolveRelativeUrl(baseUrl,url,keepAbsolute){if(url&&url[0]==="/"){return url}var u=new URL(url,baseUrl);return keepAbsolute?u.href:makeDocumentRelPath(u.href)}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 makeRelPath(sourceUrl,targetUrl){var source=sourceUrl.pathname;var target=targetUrl.pathname;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=targetUrl.href.slice(-1)===URL_HASH?URL_HASH:targetUrl.hash;return t.join("/")+targetUrl.search+hash}scope.urlResolver=urlResolver})(Polymer);(function(scope){var endOfMicrotask=Polymer.endOfMicrotask;function Loader(regex){this.cache=Object.create(null);this.map=Object.create(null);this.requests=0;this.regex=regex}Loader.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){var matches=this.extractUrls(text,root);var done=callback.bind(null,this.map);this.fetch(matches,done)},fetch:function(matches,callback){var inflight=matches.length;if(!inflight){return callback()}var done=function(){if(--inflight===0){callback()}};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;var response=request.response||request.responseText||"";this.map[url]=response;this.fetch(this.extractUrls(response,url),request.resolve)},xhr:function(url){this.requests++;var request=new XMLHttpRequest;request.open("GET",url,true);request.send();request.onerror=request.onload=this.handleXhr.bind(this,request);request.pending=[];request.resolve=function(){var pending=request.pending;for(var i=0;i<pending.length;i++){pending[i]()}request.pending=null};request.wait=function(fn){if(request.pending){request.pending.push(fn)}else{endOfMicrotask(fn)}};return request}};scope.Loader=Loader})(Polymer);(function(scope){var urlResolver=scope.urlResolver;var Loader=scope.Loader;function StyleResolver(){this.loader=new Loader(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)},resolveNode:function(style,url,callback){var text=style.textContent;var done=function(text){style.textContent=text;callback(style)};this.resolve(text,url,done)},flatten: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=match.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.length;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)}}};var styleResolver=new StyleResolver;scope.styleResolver=styleResolver})(Polymer);(function(scope){function extend(prototype,api){if(prototype&&api){Object.getOwnPropertyNames(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){copyProperty(n,p,obj)}}catch(x){}}return obj}function copyProperty(inName,inSource,inTarget){var pd=getPropertyDescriptor(inSource,inName);Object.defineProperty(inTarget,inName,pd)}function getPropertyDescriptor(inObject,inName){if(inObject){var pd=Object.getOwnPropertyDescriptor(inObject,inName);return pd||getPropertyDescriptor(Object.getPrototypeOf(inObject),inName)}}scope.extend=extend;scope.mixin=mixin;Platform.mixin=mixin})(Polymer);(function(scope){var Job=function(inContext){this.context=inContext;this.boundComplete=this.complete.bind(this)};Job.prototype={go:function(callback,wait){this.callback=callback;var h;if(!wait){h=requestAnimationFrame(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:function(){if(this.handle){this.stop();this.callback.call(this.context)}}};function job(job,callback,wait){if(job){job.stop()}else{job=new Job(this)}job.go(callback,wait);return job}scope.job=job})(Polymer);(function(scope){var registry={};HTMLElement.register=function(tag,prototype){registry[tag]=prototype};HTMLElement.getPrototypeForTag=function(tag){var prototype=!tag?HTMLElement.prototype:registry[tag];return prototype||Object.getPrototypeOf(document.createElement(tag))};var originalStopPropagation=Event.prototype.stopPropagation;Event.prototype.stopPropagation=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.prototype.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 ArraySlice=function(){return Array.prototype.slice.call(this)};var namedNodeMap=window.NamedNodeMap||window.MozNamedAttrMap||{};NodeList.prototype.array=ArraySlice;namedNodeMap.prototype.array=ArraySlice;HTMLCollection.prototype.array=ArraySlice;function createDOM(inTagOrNode,inHTML,inAttrs){var dom=typeof inTagOrNode=="string"?document.createElement(inTagOrNode):inTagOrNode.cloneNode(true);dom.innerHTML=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._super;if(!_super){if(!nom){nom=caller.nom=nameInThis.call(this,caller)}if(!nom){console.warn("called super() on a method not installed declaratively (has no .nom property)")}_super=memoizeSuper(caller,nom,getPrototypeOf(this))}var fn=_super[nom];if(fn){if(!fn._super){memoizeSuper(fn,nom,_super)}return fn.apply(this,arrayOfArgs||[])}}function nameInThis(value){var p=this.__proto__;while(p&&p!==HTMLElement.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(method,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(proto[name]!==caller&&proto[name]){return proto}proto=getPrototypeOf(proto)}return Object}function getPrototypeOf(prototype){return prototype.__proto__}function hintSuper(prototype){for(var n in prototype){var pd=Object.getOwnPropertyDescriptor(prototype,n);if(pd&&typeof pd.value==="function"){pd.value.nom=n}}}scope.super=$super})(Polymer);(function(scope){function noopHandler(value){return value}var typeHandlers={string:noopHandler,undefined:noopHandler,date:function(value){return 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},object: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,currentValue){var inferredType=typeof currentValue;if(currentValue instanceof Date){inferredType="date"}return typeHandlers[inferredType](value,currentValue)}scope.deserializeValue=deserializeValue})(Polymer);(function(scope){var extend=scope.extend;var api={};api.declaration={};api.instance={};api.publish=function(apis,prototype){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).apply(this,args)}.bind(this);var handle=timeout?setTimeout(fn,timeout):requestAnimationFrame(fn);return timeout?handle:~handle},cancelAsync:function(handle){if(handle<0){cancelAnimationFrame(~handle)}else{clearTimeout(handle)}},fire:function(type,detail,onNode,bubbles,cancelable){var node=onNode||this;var detail=detail===null||detail===undefined?{}:detail;var event=new CustomEvent(type,{bubbles:bubbles!==undefined?bubbles:true,cancelable:cancelable!==undefined?cancelable:true,detail:detail});node.dispatchEvent(event);return event},asyncFire:function(){this.async("fire",arguments)},classFollows:function(anew,old,className){if(old){old.classList.remove(className)}if(anew){anew.classList.add(className)}},injectBoundHTML:function(html,element){var template=document.createElement("template");template.innerHTML=html;var fragment=this.instanceTemplate(template);if(element){element.textContent="";element.appendChild(fragment)}return fragment}};var nop=function(){};var nob={};utils.asyncMethod=utils.async;scope.api.instance.utils=utils;scope.nop=nop;scope.nob=nob})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var EVENT_PREFIX="on-";var events={EVENT_PREFIX:EVENT_PREFIX,addHostListeners:function(){var events=this.eventDelegates;log.events&&Object.keys(events).length>0&&console.log("[%s] addHostListeners:",this.localName,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.groupEnd();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,eventType,handlerFn,capture){PolymerGestures.removeEventListener(wrap(node),eventType,handlerFn,capture)}})(Polymer);(function(scope){var attributes={copyInstanceAttributes:function(){var a$=this._instanceAttributes;for(var k in a$){if(!this.hasAttribute(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++){this.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.deserializeValue(value,currentValue);if(value!==currentValue){this[name]=value}}},propertyForAttribute:function(name){var match=this._publishLC&&this._publishLC[name];return match},deserializeValue:function(stringValue,currentValue){return scope.deserializeValue(stringValue,currentValue)},serializeValue:function(value,inferredType){if(inferredType==="boolean"){return value?"":undefined}else if(inferredType!=="object"&&inferredType!=="function"&&value!==undefined){return value}},reflectPropertyToAttribute:function(name){var inferredType=typeof this[name];var serializedValue=this.serializeValue(this[name],inferredType);if(serializedValue!==undefined){this.setAttribute(name,serializedValue)}else if(inferredType==="boolean"){this.removeAttribute(name)}}};scope.api.instance.attributes=attributes})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var OBSERVE_SUFFIX="Changed";var empty=[];var updateRecord={object:undefined,type:"update",name:undefined,oldValue:undefined};var numberIsNaN=Number.isNaN||function(value){return typeof value==="number"&&isNaN(value)};function areSameValue(left,right){if(left===right)return left!==0||1/left===1/right;if(numberIsNaN(left)&&numberIsNaN(right))return true;return left!==left&&right!==right}function resolveBindingValue(oldValue,value){if(value===undefined&&oldValue===null){return value}return value===null||value===undefined?oldValue:value}var properties={createPropertyObserver: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,this[n],null)}}},openPropertyObserver:function(){if(this._propertyObserver){this._propertyObserver.open(this.notifyPropertyChanges,this)}},notifyPropertyChanges:function(newValues,oldValues,paths){var name,method,called={};for(var i in oldValues){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!==undefined&&ov!==null||nv!==undefined&&nv!==null){called[method]=true;this.invokeMethod(method,[ov,nv,arguments])}}}}},invokeMethod:function(method,args){var fn=this[method]||method;if(typeof fn==="function"){fn.apply(this,args)}},deliverChanges:function(){if(this._propertyObserver){this._propertyObserver.deliver()}},observeArrayValue:function(name,value,old){var callbackName=this.observe[name];if(callbackName){if(Array.isArray(old)){log.observe&&console.log("[%s] observeArrayValue: unregister observer [%s]",this.localName,name);this.closeNamedObserver(name+"__array")}if(Array.isArray(value)){log.observe&&console.log("[%s] observeArrayValue: register observer [%s]",this.localName,name,value);var observer=new ArrayObserver(value);observer.open(function(splices){this.invokeMethod(callbackName,[splices])},this);this.registerNamedObserver(name+"__array",observer)}}},emitPropertyChangeRecord: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){notifier=this._objectNotifier=Object.getNotifier(this)}updateRecord.object=this;updateRecord.name=name;updateRecord.oldValue=oldValue;notifier.notify(updateRecord)},_propertyChanged:function(name,value,oldValue){if(this.reflect[name]){this.reflectPropertyToAttribute(name)}},bindProperty:function(property,observable,oneTime){if(oneTime){this[property]=observable;return}var computed=this.element.prototype.computed;if(computed&&computed[property]){var privateComputedBoundValue=property+"ComputedBoundObservable_";this[privateComputedBoundValue]=observable;return}return this.bindToAccessor(property,observable,resolveBindingValue)},bindToAccessor:function(name,observable,resolveFn){var privateName=name+"_";var privateObservable=name+"Observable_";var privateComputedBoundValue=name+"ComputedBoundObservable_";this[privateObservable]=observable;var oldValue=this[privateName];var self=this;function updateValue(value,oldValue){self[privateName]=value;var setObserveable=self[privateComputedBoundValue];if(setObserveable&&typeof setObserveable.setValue=="function"){setObserveable.setValue(value)}self.emitPropertyChangeRecord(name,value,oldValue)}var value=observable.open(updateValue);if(resolveFn&&!areSameValue(oldValue,value)){var resolvedValue=resolveFn(oldValue,value);if(!areSameValue(value,resolvedValue)){value=resolvedValue;if(observable.setValue){observable.setValue(value)}}}updateValue(value,oldValue);var observer={close:function(){observable.close();self[privateObservable]=undefined;self[privateComputedBoundValue]=undefined}};this.registerObserver(observer);return observer},createComputedProperties:function(){if(!this._computedNames){return}for(var i=0;i<this._computedNames.length;i++){var name=this._computedNames[i];var expressionText=this.computed[name];try{var expression=PolymerExpressions.getExpression(expressionText);var observable=expression.getBinding(this,this.element.syntax);this.bindToAccessor(name,observable)}catch(ex){console.error("Failed to create computed property",ex)}}},registerObserver:function(observer){if(!this._observers){this._observers=[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=="function"){observer.close()}}this._observers=[]},registerNamedObserver:function(name,observer){var o$=this._namedObservers||(this._namedObservers={});o$[name]=observer},closeNamedObserver:function(name){var o$=this._namedObservers;if(o$&&o$[name]){o$[name].close();o$[name]=null;return true}},closeNamedObservers:function(){if(this._namedObservers){for(var i in this._namedObservers){this.closeNamedObserver(i)}this._namedObservers={}}}};var LOG_OBSERVE="[%s] watching [%s]";var LOG_OBSERVED="[%s#%s] watch: [%s] now [%s] was [%s]";var LOG_CHANGED="[%s#%s] propertyChanged: [%s] now [%s] was [%s]";scope.api.instance.properties=properties})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var 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:function(name,observable,oneTime){var property=this.propertyForAttribute(name);if(!property){return this.mixinSuper(arguments)}else{var observer=this.bindProperty(property,observable,oneTime);if(Platform.enableBindingsReflection&&observer){observer.path=observable.path_;this._recordBinding(property,observer)}if(this.reflect[property]){this.reflectPropertyToAttribute(property)}return observer}},_recordBinding: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)}},unbindAll:function(){if(!this._unbound){this.closeObservers();this.closeNamedObservers();this._unbound=true}},cancelUnbindAll:function(){if(this._unbound){log.unbind&&console.warn("[%s] already unbound, cannot cancel unbindAll",this.localName);return}log.unbind&&console.log("[%s] cancelUnbindAll",this.localName);if(this._unbindAllJob){this._unbindAllJob=this._unbindAllJob.stop()}}};function unbindNodeTree(node){forNodeTree(node,_nodeUnbindAll)}function _nodeUnbindAll(node){node.unbindAll()}function forNodeTree(node,callback){if(node){callback(node);for(var child=node.firstChild;child;child=child.nextSibling){forNodeTree(child,callback)}}}var mustachePattern=/\{\{([^{}]*)}}/;scope.bindPattern=mustachePattern;scope.api.instance.mdv=mdv})(Polymer);(function(scope){var base={PolymerBase:true,job: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,job,callback,wait)}},"super":Polymer.super,created:function(){},ready:function(){},createdCallback:function(){if(this.templateInstance&&this.templateInstance.model){console.warn("Attributes on "+this.localName+" were data bound "+"prior to Polymer upgrading the element. This may result in "+"incorrect binding types.")}this.created();this.prepareElement();if(!this.ownerDocument.isStagingDocument){this.makeElementReady()}},prepareElement:function(){if(this._elementPrepared){console.warn("Element already prepared",this.localName);return}this._elementPrepared=true;this.shadowRoots={};this.createPropertyObserver();this.openPropertyObserver();this.copyInstanceAttributes();this.takeAttributes();this.addHostListeners()},makeElementReady:function(){if(this._readied){return}this._readied=true;this.createComputedProperties();this.parseDeclarations(this.__proto__);this.removeAttribute("unresolved");this.ready()},attributeChangedCallback:function(name,oldValue){if(name!=="class"&&name!=="style"){this.attributeToProperty(name,this.getAttribute(name))}if(this.attributeChanged){this.attributeChanged.apply(this,arguments)}},attachedCallback:function(){this.cancelUnbindAll();if(this.attached){this.attached()}if(!this.hasBeenAttached){this.hasBeenAttached=true;if(this.domReady){this.async("domReady")}}},detachedCallback:function(){if(!this.preventDispose){this.asyncUnbindAll()}if(this.detached){this.detached()}if(this.leftView){this.leftView()}},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){var root=this.shadowFromTemplate(template);this.shadowRoots[elementElement.name]=root}},fetchTemplate:function(elementElement){return elementElement.querySelector("template")},shadowFromTemplate:function(template){if(template){var root=this.createShadowRoot();var dom=this.instanceTemplate(template);root.appendChild(dom);this.shadowRootReady(root,template);return root}},lightFromTemplate:function(template,refNode){if(template){this.eventController=this;var dom=this.instanceTemplate(template);if(refNode){this.insertBefore(dom,refNode)}else{this.appendChild(dom)}this.shadowRootReady(this);return dom}},shadowRootReady:function(root){this.marshalNodeReferences(root)},marshalNodeReferences:function(root){var $=this.$=this.$||{};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 observer=new MutationObserver(function(mutations){listener.call(this,observer,mutations);observer.disconnect()}.bind(this));observer.observe(node,{childList:true,subtree: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})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var STYLE_SCOPE_ATTRIBUTE="element";var STYLE_CONTROLLER_SCOPE="controller";var styles={STYLE_SCOPE_ATTRIBUTE:STYLE_SCOPE_ATTRIBUTE,installControllerStyles:function(){var scope=this.findStyleScope();if(scope&&!this.scopeHasNamedStyle(scope,this.localName)){var proto=getPrototypeOf(this),cssText="";while(proto&&proto.element){cssText+=proto.element.cssTextForScope(STYLE_CONTROLLER_SCOPE);proto=getPrototypeOf(proto)}if(cssText){this.installScopeCssText(cssText,scope)}}},installScopeStyle:function(style,name,scope){var scope=scope||this.findStyleScope(),name=name||"";if(scope&&!this.scopeHasNamedStyle(scope,this.localName+name)){var cssText="";if(style instanceof Array){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.findStyleScope();name=name||"";if(!scope){return}if(hasShadowDOMPolyfill){cssText=shimCssText(cssText,scope.host)}var style=this.element.cssTextToScopeStyle(cssText,STYLE_CONTROLLER_SCOPE);Polymer.applyStyleToScope(style,scope);this.styleCacheForScope(scope)[this.localName+name]=true},findStyleScope:function(node){var n=node||this;while(n.parentNode){n=n.parentNode}return n},scopeHasNamedStyle:function(scope,name){var cache=this.styleCacheForScope(scope);return cache[name]},styleCacheForScope:function(scope){if(hasShadowDOMPolyfill){var scopeName=scope.host?scope.host.localName:scope.localName;return polyfillScopeStyleCache[scopeName]||(polyfillScopeStyleCache[scopeName]={})}else{return scope._scopeStyles=scope._scopeStyles||{}}}};var polyfillScopeStyleCache={};function getPrototypeOf(prototype){return prototype.__proto__}function shimCssText(cssText,host){var name="",is=false;if(host){name=host.localName;is=host.hasAttribute("is")}var selector=WebComponents.ShadowCSS.makeScopeSelector(name,is);return WebComponents.ShadowCSS.shimCssText(cssText,selector)}scope.api.instance.styles=styles})(Polymer);(function(scope){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.parentNode.getAttribute("name"):"";if(!name){throw"Element name could not be inferred."}}if(getRegisteredPrototype(name)){throw"Already registered (Polymer) prototype for element "+name}registerPrototype(name,prototype);notifyPrototype(name)}function waitingForPrototype(name,client){waitPrototype[name]=client}var waitPrototype={};function notifyPrototype(name){if(waitPrototype[name]){waitPrototype[name].registerWhenReady();delete waitPrototype[name]}}var prototypesByName={};function registerPrototype(name,prototype){return prototypesByName[name]=prototype||{}}function getRegisteredPrototype(name){return prototypesByName[name]}function instanceOfType(element,type){if(typeof type!=="string"){return false}var proto=HTMLElement.getPrototypeForTag(type);var ctor=proto&&proto.constructor;if(!ctor){return false}if(CustomElements.instanceof){return CustomElements.instanceof(element,ctor)}return element instanceof ctor}scope.getRegisteredPrototype=getRegisteredPrototype;scope.waitingForPrototype=waitingForPrototype;scope.instanceOfType=instanceOfType;window.Polymer=element;extend(Polymer,scope);if(WebComponents.consumeDeclarations){WebComponents.consumeDeclarations(function(declarations){if(declarations){for(var i=0,l=declarations.length,d;i<l&&(d=declarations[i]);i++){element.apply(null,d)}}})}})(Polymer);(function(scope){var path={resolveElementPaths:function(node){Polymer.urlResolver.resolveDom(node)},addResolvePathApi:function(){var assetPath=this.getAttribute("assetpath")||"";var root=new URL(assetPath,this.ownerDocument.baseURI);
10
- this.prototype.resolvePath=function(urlPath,base){var u=new URL(urlPath,base||root);return u.href}}};scope.api.declaration.path=path})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var api=scope.api.instance.styles;var STYLE_SCOPE_ATTRIBUTE=api.STYLE_SCOPE_ATTRIBUTE;var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var STYLE_SELECTOR="style";var STYLE_LOADABLE_MATCH="@import";var SHEET_SELECTOR="link[rel=stylesheet]";var STYLE_GLOBAL_SCOPE="global";var SCOPE_ATTR="polymer-scope";var styles={loadStyles:function(callback){var template=this.fetchTemplate();var content=template&&this.templateContent();if(content){this.convertSheetsToStyles(content);var styles=this.findLoadableStyles(content);if(styles.length){var templateUrl=template.ownerDocument.baseURI;return Polymer.styleResolver.loadStyles(styles,templateUrl,callback)}}if(callback){callback()}},convertSheetsToStyles:function(root){var s$=root.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.ownerDocument);this.copySheetAttributes(c,s);s.parentNode.replaceChild(c,s)}},copySheetAttributes: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.sheets=this.findNodes(SHEET_SELECTOR);this.sheets.forEach(function(s){if(s.parentNode){s.parentNode.removeChild(s)}})},cacheStyles:function(){this.styles=this.findNodes(STYLE_SELECTOR+"["+SCOPE_ATTR+"]");this.styles.forEach(function(s){if(s.parentNode){s.parentNode.removeChild(s)}})},installLocalSheets:function(){var sheets=this.sheets.filter(function(s){return!s.hasAttribute(SCOPE_ATTR)});var content=this.templateContent();if(content){var cssText="";sheets.forEach(function(sheet){cssText+=cssTextFromSheet(sheet)+"\n"});if(cssText){var style=createStyleElement(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=content.querySelectorAll(selector).array();nodes=nodes.concat(templateNodes)}return matcher?nodes.filter(matcher):nodes},installGlobalStyles:function(){var style=this.styleForScope(STYLE_GLOBAL_SCOPE);applyStyleToScope(style,document.head)},cssTextForScope:function(scopeDescriptor){var cssText="";var selector="["+SCOPE_ATTR+"="+scopeDescriptor+"]";var matcher=function(s){return matchesSelector(s,selector)};var sheets=this.sheets.filter(matcher);sheets.forEach(function(sheet){cssText+=cssTextFromSheet(sheet)+"\n\n"});var styles=this.styles.filter(matcher);styles.forEach(function(style){cssText+=style.textContent+"\n\n"});return cssText},styleForScope:function(scopeDescriptor){var cssText=this.cssTextForScope(scopeDescriptor);return this.cssTextToScopeStyle(cssText,scopeDescriptor)},cssTextToScopeStyle: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=createStyleElement(style.textContent);var attr=style.getAttribute(STYLE_SCOPE_ATTRIBUTE);if(attr){clone.setAttribute(STYLE_SCOPE_ATTRIBUTE,attr)}var refNode=scope.firstElementChild;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 createStyleElement(cssText,scope){scope=scope||document;scope=scope.createElement?scope:scope.ownerDocument;var style=scope.createElement("style");style.textContent=cssText;return style}function cssTextFromSheet(sheet){return sheet&&sheet.__resource||""}function matchesSelector(node,inSelector){if(matches){return matches.call(node,inSelector)}}var p=HTMLElement.prototype;var matches=p.matches||p.matchesSelector||p.webkitMatchesSelector||p.mozMatchesSelector;scope.api.declaration.styles=styles;scope.applyStyleToScope=applyStyleToScope})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var api=scope.api.instance.events;var EVENT_PREFIX=api.EVENT_PREFIX;var mixedCaseEventTypes={};["webkitAnimationStart","webkitAnimationEnd","webkitTransitionEnd","DOMFocusOut","DOMFocusIn","DOMMouseScroll"].forEach(function(e){mixedCaseEventTypes[e.toLowerCase()]=e});var events={parseHostEvents:function(){var delegates=this.prototype.eventDelegates;this.addAttributeDelegates(delegates)},addAttributeDelegates:function(delegates){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)},findController:function(node){while(node.parentNode){if(node.eventController){return node.eventController}node=node.parentNode}return node.host},getEventHandler:function(controller,target,method){var events=this;return function(e){if(!controller||!controller.PolymerBase){controller=events.findController(target)}var args=[e,e.detail,e.currentTarget];controller.dispatchMethod(controller,method,args)}},prepareEventBinding:function(pathString,name,node){if(!this.hasEventPrefix(name))return;var eventType=this.removeEventPrefix(name);eventType=mixedCaseEventTypes[eventType]||eventType;var events=this;return function(model,node,oneTime){var handler=events.getEventHandler(undefined,node,pathString);PolymerGestures.addEventListener(node,eventType,handler);if(oneTime)return;function bindingValue(){return"{{ "+pathString+" }}"}return{open:bindingValue,discardChanges:bindingValue,close:function(){PolymerGestures.removeEventListener(node,eventType,handler)}}}}};var prefixLength=EVENT_PREFIX.length;scope.api.declaration.events=events})(Polymer);(function(scope){var observationBlacklist=["attribute"];var properties={inferObservers:function(prototype){var observe=prototype.observe,property;for(var n in prototype){if(n.slice(-7)==="Changed"){property=n.slice(0,-7);if(this.canObserveProperty(property)){if(!observe){observe=prototype.observe={}}observe[property]=observe[property]||n}}}},canObserveProperty:function(property){return observationBlacklist.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}},optimizePropertyMaps:function(prototype){if(prototype.observe){var a=prototype._observeNames=[];for(var n in prototype.observe){var names=n.split(" ");for(var i=0,ni;ni=names[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=prototype._computedNames=[];for(var n in prototype.computed){a.push(n)}}},publishProperties:function(prototype,base){var publish=prototype.publish;if(publish){this.requireProperties(publish,prototype,base);this.filterInvalidAccessorNames(publish);prototype._publishLC=this.lowerCaseMap(publish)}var computed=prototype.computed;if(computed){this.filterInvalidAccessorNames(computed)}},filterInvalidAccessorNames:function(propertyNames){for(var name in propertyNames){if(this.propertyNameBlacklist[name]){console.warn('Cannot define property "'+name+'" for element "'+this.name+'" because it has the same name as an HTMLElement '+"property, and not all browsers support overriding that. "+"Consider giving it a different name.");delete propertyNames[name]}}},requireProperties:function(propertyInfos,prototype,base){prototype.reflect=prototype.reflect||{};for(var n in propertyInfos){var value=propertyInfos[n];if(value&&value.reflect!==undefined){prototype.reflect[n]=Boolean(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+"Observable_";proto[privateName]=proto[name];Object.defineProperty(proto,name,{get:function(){var observable=this[privateObservable];if(observable)observable.deliver();return this[privateName]},set:function(value){if(ignoreWrites){return this[privateName]}var observable=this[privateObservable];if(observable){observable.setValue(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.createPropertyAccessor(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.computed[n]){this.createPropertyAccessor(n)}}}},propertyNameBlacklist:{children:1,"class":1,id:1,hidden:1,style:1,title:1}};scope.api.declaration.properties=properties})(Polymer);(function(scope){var ATTRIBUTES_ATTRIBUTE="attributes";var ATTRIBUTES_REGEX=/\s|,/;var attributes={inheritAttributesObjects:function(prototype){this.inheritObject(prototype,"publishLC");this.inheritObject(prototype,"_instanceAttributes")},publishAttributes:function(prototype,base){var attributes=this.getAttribute(ATTRIBUTES_ATTRIBUTE);if(attributes){var publish=prototype.publish||(prototype.publish={});var names=attributes.split(ATTRIBUTES_REGEX);for(var i=0,l=names.length,n;i<l;i++){n=names[i].trim();if(n&&publish[n]===undefined){publish[n]=undefined}}}},accumulateInstanceAttributes:function(){var clonable=this.prototype._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}}},isInstanceAttribute: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.declaration.events;var syntax=new PolymerExpressions;var prepareBinding=syntax.prepareBinding;syntax.prepareBinding=function(pathString,name,node){return events.prepareEventBinding(pathString,name,node)||prepareBinding.call(syntax,pathString,name,node)};var mdv={syntax:syntax,fetchTemplate:function(){return this.querySelector("template")},templateContent:function(){var template=this.fetchTemplate();return template&&template.content},installBindingDelegate:function(template){if(template){template.bindingDelegate=this.syntax}}};scope.api.declaration.mdv=mdv})(Polymer);(function(scope){var api=scope.api;var isBase=scope.isBase;var extend=scope.extend;var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var prototype={register:function(name,extendeeName){this.buildPrototype(name,extendeeName);this.registerPrototype(name,extendeeName);this.publishConstructor()},buildPrototype:function(name,extendeeName){var extension=scope.getRegisteredPrototype(name);var base=this.generateBasePrototype(extendeeName);this.desugarBeforeChaining(extension,base);this.prototype=this.chainPrototypes(extension,base);this.desugarAfterChaining(name,extendeeName)},desugarBeforeChaining:function(prototype,base){prototype.element=this;this.publishAttributes(prototype,base);this.publishProperties(prototype,base);this.inferObservers(prototype);this.explodeObservers(prototype)},chainPrototypes:function(prototype,base){this.inheritMetaData(prototype,base);var chained=this.chainObject(prototype,base);ensurePrototypeTraversal(chained);return chained},inheritMetaData:function(prototype,base){this.inheritObject("observe",prototype,base);this.inheritObject("publish",prototype,base);this.inheritObject("reflect",prototype,base);this.inheritObject("_publishLC",prototype,base);this.inheritObject("_instanceAttributes",prototype,base);this.inheritObject("eventDelegates",prototype,base)},desugarAfterChaining:function(name,extendee){this.optimizePropertyMaps(this.prototype);this.createPropertyAccessors(this.prototype);this.installBindingDelegate(this.fetchTemplate());this.installSheets();this.resolveElementPaths(this);this.accumulateInstanceAttributes();this.parseHostEvents();this.addResolvePathApi();if(hasShadowDOMPolyfill){WebComponents.ShadowCSS.shimStyling(this.templateContent(),name,extendee)}if(this.prototype.registerCallback){this.prototype.registerCallback(this)}},publishConstructor:function(){var symbol=this.getAttribute("constructor");if(symbol){window[symbol]=this.ctor}},generateBasePrototype:function(extnds){var prototype=this.findBasePrototype(extnds);if(!prototype){var prototype=HTMLElement.getPrototypeForTag(extnds);prototype=this.ensureBaseApi(prototype);memoizedBases[extnds]=prototype}return prototype},findBasePrototype:function(name){return memoizedBases[name]},ensureBaseApi:function(prototype){if(prototype.PolymerBase){return prototype}var extended=Object.create(prototype);api.publish(api.instance,extended);this.mixinMethod(extended,prototype,api.instance.mdv,"bind");return extended},mixinMethod:function(extended,prototype,api,name){var $super=function(args){return prototype[name].apply(this,args)};extended[name]=function(){this.mixinSuper=$super;return api[name].apply(this,arguments)}},inheritObject:function(name,prototype,base){var source=prototype[name]||{};prototype[name]=this.chainObject(source,base[name])},registerPrototype:function(name,extendee){var info={prototype:this.prototype};var typeExtension=this.findTypeExtension(extendee);if(typeExtension){info.extends=typeExtension}HTMLElement.register(name,this.prototype);this.ctor=document.registerElement(name,info)},findTypeExtension:function(name){if(name&&name.indexOf("-")<0){return name}else{var p=this.findBasePrototype(name);if(p.element){return this.findTypeExtension(p.element.extends)}}}};var memoizedBases={};if(Object.__proto__){prototype.chainObject=function(object,inherited){if(object&&inherited&&object!==inherited){object.__proto__=inherited}return object}}else{prototype.chainObject=function(object,inherited){if(object&&inherited&&object!==inherited){var chained=Object.create(inherited);object=extend(chained,object)}return object}}function ensurePrototypeTraversal(prototype){if(!Object.__proto__){var ancestor=Object.getPrototypeOf(prototype);prototype.__proto__=ancestor;if(isBase(ancestor)){ancestor.__proto__=Object.getPrototypeOf(ancestor)}}}api.declaration.prototype=prototype})(Polymer);(function(scope){var queue={wait:function(element){if(!element.__queue){element.__queue={};elements.push(element)}},enqueue:function(element,check,go){var shouldAdd=element.__queue&&!element.__queue.check;if(shouldAdd){queueForElement(element).push(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||HTMLImports.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 element=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){flushQueue.push(element)},flush:function(){if(this.flushing){return}this.flushing=true;var element;while(flushQueue.length){element=flushQueue.shift();element.__queue.go.call(element);element.__queue=null}this.flushing=false},ready:function(){var polyfillWasReady=CustomElements.ready;CustomElements.ready=false;this.flush();if(!CustomElements.useNative){CustomElements.upgradeDocumentTree(document)}CustomElements.ready=polyfillWasReady;Polymer.flush();requestAnimationFrame(this.flushReadyCallbacks)},addReadyCallback:function(callback){if(callback){readyCallbacks.push(callback)}},flushReadyCallbacks:function(){if(readyCallbacks){var fn;while(readyCallbacks.length){fn=readyCallbacks.shift();fn()}}},waitingFor:function(){var 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=[];var flushQueue=[];var importQueue=[];var mainQueue=[];var readyCallbacks=[];function queueForElement(element){return document.contains(element)?mainQueue:importQueue}function nextQueued(){return importQueue.length?importQueue[0]:mainQueue[0]}function whenReady(callback){queue.waitToReady=true;Polymer.endOfMicrotask(function(){HTMLImports.whenReady(function(){queue.addReadyCallback(callback);queue.waitToReady=false;queue.check()})})}function forceReady(timeout){if(timeout===undefined){queue.ready();return}var handle=setTimeout(function(){queue.ready()},timeout);Polymer.whenReady(function(){clearTimeout(handle)})}scope.elements=elements;scope.waitingFor=queue.waitingFor.bind(queue);scope.forceReady=forceReady;scope.queue=queue;scope.whenReady=scope.whenPolymerReady=whenReady})(Polymer);(function(scope){var extend=scope.extend;var api=scope.api;var queue=scope.queue;var whenReady=scope.whenReady;var getRegisteredPrototype=scope.getRegisteredPrototype;var waitingForPrototype=scope.waitingForPrototype;var prototype=extend(Object.create(HTMLElement.prototype),{createdCallback:function(){if(this.getAttribute("name")){this.init()}},init:function(){this.name=this.getAttribute("name");this.extends=this.getAttribute("extends");queue.wait(this);this.loadResources();this.registerWhenReady()},registerWhenReady:function(){if(this.registered||this.waitingForPrototype(this.name)||this.waitingForQueue()||this.waitingForResources()){return}queue.go(this)},_register:function(){if(isCustomTag(this.extends)&&!isRegistered(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},waitingForPrototype: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)}},waitingForResources:function(){return this._needsResources},waitingForQueue:function(){return queue.enqueue(this,this.registerWhenReady,this._register)},loadResources:function(){this._needsResources=true;this.loadStyles(function(){this._needsResources=false;this.registerWhenReady()}.bind(this))}});api.publish(api.declaration,prototype);function isRegistered(name){return Boolean(HTMLElement.getPrototypeForTag(name))}function isCustomTag(name){return name&&name.indexOf("-")>=0}whenReady(function(){document.body.removeAttribute("unresolved");document.dispatchEvent(new CustomEvent("polymer-ready",{bubbles:true}))});document.registerElement("polymer-element",{prototype:prototype})})(Polymer);(function(scope){var whenReady=scope.whenReady;function importElements(node,callback){if(node){document.head.appendChild(node);whenReady(callback)}else if(callback){callback()}}function _import(urls,callback){if(urls&&urls.length){var frag=document.createDocumentFragment();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)}importElements(frag,callback)}else if(callback){callback()}}scope.import=_import;scope.importElements=importElements})(Polymer);(function(){var element=document.createElement("polymer-element");element.setAttribute("name","auto-binding");element.setAttribute("extends","template");element.init();Polymer("auto-binding",{createdCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax();Polymer.whenPolymerReady(function(){this.model=this;this.setAttribute("bind","");this.async(function(){this.marshalNodeReferences(this.parentNode);this.fire("template-bound")})}.bind(this))},makeSyntax:function(){var events=Object.create(Polymer.api.declaration.events);var self=this;events.findController=function(){return self.model};var syntax=new PolymerExpressions;var prepareBinding=syntax.prepareBinding;syntax.prepareBinding=function(pathString,name,node){return events.prepareEventBinding(pathString,name,node)||prepareBinding.call(syntax,pathString,name,node)};return syntax}})})();</script><script>var concerto=concerto||{};concerto.contentFactory=function(){var types={};var normalizeTypeName=function(typeName){var basicName=typeName.replace(/\W/g,"");return basicName.toLowerCase()};return{getType:function(typeName){typeName=normalizeTypeName(typeName);return types[typeName]?new types[typeName]:undefined},registerType:function(typeName,ContentType){if(!ContentType){return}var proto=ContentType.prototype;if("contentId"in proto&&"title"in proto){typeName=normalizeTypeName(typeName);types[typeName]=ContentType}}}}();</script><script>PolymerExpressions.prototype.resolveURL=function(url,base){var r=new RegExp("^(?:[a-z]+:)?//","i");if(!url||!base||r.test(url)){return url}return base+url};</script><script>PolymerExpressions.prototype.resolveURL=function(url,base){var r=new RegExp("^(?:[a-z]+:)?//","i");if(!url||!base||r.test(url)){return url}return base+url};</script></head><body><div hidden=""><polymer-element name="concerto-content" attributes="contentId title duration autoLoad baseURL cssText" assetpath="contents/"><template><style> :host { position: absolute; } </style></template><script>Polymer("concerto-content",{contentId:0,title:"",duration:0,autoLoad:true,cssText:"",baseURL:"",domReady:function(){if(this.autoLoad){this.loaded()}},loaded:function(){this.fire("load",this)},fromJSON:function(data){Object.keys(data).forEach(function(key){if(key in this){this.setAttribute(key,data[key])}}.bind(this));if(this.autoLoad){this.loaded()}},cssTextChanged:function(){this.style.cssText=this.cssText}});</script></polymer-element><script>function registerContentType(contentName,klass){window.addEventListener("polymer-ready",function(){if(concerto&&concerto.contentFactory){var name=contentName.replace(/^concerto-/,"");concerto.contentFactory.registerType(name,window[klass])}})}</script><polymer-element name="concerto-ticker" attributes="data" constructor="ConcertoTicker" extends="concerto-content" assetpath="contents/"><template><div id="ticker" class="ticker"></div></template><script>Polymer("concerto-ticker",{data:"",dataChanged:function(){this.$.ticker.innerHTML=this.data}});</script></polymer-element><script>registerContentType("concerto-ticker","ConcertoTicker");</script><polymer-element name="concerto-graphic" attributes="path" constructor="ConcertoGraphic" extends="concerto-content" autoload="false" assetpath="contents/"><template><style> :host { display: block; width: 100%; height: 100%; text-align: center; } .portrait { width: 100%; } .landscape { height: 100%; } img { position: relative; top: 50%; transform: translateY(-50%); } </style><img id="graphic" src="{{path | resolveURL(baseURL)}}"></template><script>Polymer("concerto-graphic",{path:"",created:function(){this.handleGraphicLoadBound=this.handleGraphicLoad.bind(this)},ready:function(){this.$.graphic.addEventListener("load",this.handleGraphicLoadBound)},handleGraphicLoad:function(){this.$.graphic.removeEventListener("load",this.handleGraphicLoadBound);this.loaded();this.resize()},resize:function(){var containerRatio=this.offsetWidth/this.offsetHeight;if(!containerRatio){return}var imgRatio=this.$.graphic.naturalWidth/this.$.graphic.naturalHeight;this.$.graphic.classList.toggle("portrait",imgRatio>=containerRatio);this.$.graphic.classList.toggle("landscape",imgRatio<=containerRatio)},cssTextChanged:function(){this.$.graphic.style.cssText=this.cssText}});</script></polymer-element><script>registerContentType("concerto-graphic","ConcertoGraphic");</script><polymer-element name="concerto-htmltext" attributes="data" constructor="ConcertoHtmlText" extends="concerto-content" assetpath="contents/"><template><div id="htmltext" class="htmltext"></div></template><script>Polymer("concerto-htmltext",{data:"",dataChanged:function(){this.$.htmltext.innerHTML=this.data}});</script></polymer-element><script>registerContentType("concerto-htmltext","ConcertoHtmlText");</script><polymer-element name="concerto-client-time" attributes="path" constructor="ConcertoClientTime" extends="concerto-content" assetpath="contents/"><template><div id="clientTime" class="clientTime"></div></template><script>Polymer("concerto-client-time",{dateObj:null,domReady:function(){this.dateObj=new Date;var date=this.prepareDate();var time=this.prepareTime();this.$.clientTime.innerHTML=date+"<br />"+time},prepareDate:function(){return this.dateObj.toLocaleDateString()},prepareTime:function(){var rawTime=this.dateObj.toLocaleTimeString();var amPm=rawTime.slice(-2);var hours=this.dateObj.getHours();hours=(hours+11)%12+1;var minutes=this.dateObj.getMinutes();if(minutes<10){minutes="0"+minutes}return hours+":"+minutes+" "+amPm}});</script></polymer-element><script>registerContentType("concerto-client-time","ConcertoClientTime");</script><polymer-element name="core-xhr" hidden="" assetpath="bower_components/core-ajax/"><script>Polymer("core-xhr",{request:function(options){var xhr=new XMLHttpRequest;var url=options.url;var method=options.method||"GET";var async=!options.sync;var params=this.toQueryString(options.params);if(params&&method=="GET"){url+=(url.indexOf("?")>0?"&":"?")+params}var xhrParams=this.isBodyMethod(method)?options.body||params:null;xhr.open(method,url,async);if(options.responseType){xhr.responseType=options.responseType}if(options.withCredentials){xhr.withCredentials=true}this.makeReadyStateHandler(xhr,options.callback);this.setRequestHeaders(xhr,options.headers);xhr.send(xhrParams);if(!async){xhr.onreadystatechange(xhr)}return xhr},toQueryString:function(params){var r=[];for(var n in params){var v=params[n];n=encodeURIComponent(n);r.push(v==null?n:n+"="+encodeURIComponent(v))}return r.join("&")},isBodyMethod:function(method){return this.bodyMethods[(method||"").toUpperCase()]},bodyMethods:{POST:1,PUT:1,DELETE:1},makeReadyStateHandler:function(xhr,callback){xhr.onreadystatechange=function(){if(xhr.readyState==4){callback&&callback.call(null,xhr.response,xhr)}}},setRequestHeaders:function(xhr,headers){if(headers){for(var name in headers){xhr.setRequestHeader(name,headers[name])}}}});</script></polymer-element><polymer-element name="core-ajax" hidden="" attributes="url handleAs auto params response error method headers body contentType withCredentials" assetpath="bower_components/core-ajax/"><script>Polymer("core-ajax",{url:"",handleAs:"",auto:false,params:"",response:null,error:null,method:"",headers:null,body:null,contentType:"application/x-www-form-urlencoded",withCredentials:false,xhrArgs:null,ready:function(){this.xhr=document.createElement("core-xhr")},receive:function(response,xhr){if(this.isSuccess(xhr)){this.processResponse(xhr)}else{this.processError(xhr)}this.complete(xhr)},isSuccess:function(xhr){var status=xhr.status||0;return!status||status>=200&&status<300},processResponse:function(xhr){var response=this.evalResponse(xhr);if(xhr===this.activeRequest){this.response=response}this.fire("core-response",{response:response,xhr:xhr})},processError:function(xhr){var response=xhr.status+": "+xhr.responseText;if(xhr===this.activeRequest){this.error=response}this.fire("core-error",{response:response,xhr:xhr})},complete:function(xhr){this.fire("core-complete",{response:xhr.status,xhr:xhr})},evalResponse:function(xhr){return this[(this.handleAs||"text")+"Handler"](xhr)},xmlHandler:function(xhr){return xhr.responseXML},textHandler:function(xhr){return xhr.responseText},jsonHandler:function(xhr){var r=xhr.responseText;try{return JSON.parse(r)}catch(x){console.warn("core-ajax caught an exception trying to parse response as JSON:");console.warn("url:",this.url);console.warn(x);return r}},documentHandler:function(xhr){return xhr.response},blobHandler:function(xhr){return xhr.response},arraybufferHandler:function(xhr){return xhr.response},urlChanged:function(){if(!this.handleAs){var ext=String(this.url).split(".").pop();switch(ext){case"json":this.handleAs="json";break}}this.autoGo()},paramsChanged:function(){this.autoGo()},autoChanged:function(){this.autoGo()},autoGo:function(){if(this.auto){this.goJob=this.job(this.goJob,this.go,0)}},go:function(){var args=this.xhrArgs||{};args.body=this.body||args.body;args.params=this.params||args.params;if(args.params&&typeof args.params=="string"){args.params=JSON.parse(args.params)}args.headers=this.headers||args.headers||{};if(args.headers&&typeof args.headers=="string"){args.headers=JSON.parse(args.headers)}var hasContentType=Object.keys(args.headers).some(function(header){return header.toLowerCase()==="content-type"});if(!hasContentType&&this.contentType){args.headers["Content-Type"]=this.contentType}if(this.handleAs==="arraybuffer"||this.handleAs==="blob"||this.handleAs==="document"){args.responseType=this.handleAs}args.withCredentials=this.withCredentials;args.callback=this.receive.bind(this);args.url=this.url;args.method=this.method;this.response=this.error=null;this.activeRequest=args.url&&this.xhr.request(args);return this.activeRequest}});</script></polymer-element><polymer-element name="core-meta" attributes="label type" hidden="" assetpath="bower_components/core-meta/"><script>(function(){var SKIP_ID="meta";var metaData={},metaArray={};Polymer("core-meta",{type:"default",alwaysPrepare:true,ready:function(){this.register(this.id)},get metaArray(){var t=this.type;if(!metaArray[t]){metaArray[t]=[]}return metaArray[t]},get metaData(){var t=this.type;if(!metaData[t]){metaData[t]={}}return metaData[t]},register:function(id,old){if(id&&id!==SKIP_ID){this.unregister(this,old);this.metaData[id]=this;this.metaArray.push(this)}},unregister:function(meta,id){delete this.metaData[id||meta.id];var i=this.metaArray.indexOf(meta);if(i>=0){this.metaArray.splice(i,1)}},get list(){return this.metaArray},byId:function(id){return this.metaData[id]}})})();</script></polymer-element><polymer-element name="core-transition" extends="core-meta" assetpath="bower_components/core-transition/"><script>Polymer("core-transition",{type:"transition",go:function(node,state){this.complete(node)},setup:function(node){},teardown:function(node){},complete:function(node){this.fire("core-transitionend",null,node)},listenOnce:function(node,event,fn,args){var self=this;var listener=function(){fn.apply(self,args);node.removeEventListener(event,listener,false)};node.addEventListener(event,listener,false)}});</script></polymer-element><polymer-element name="core-transition-css" extends="core-transition" attributes="transitionType" assetpath="bower_components/core-transition/"><template><style no-shim="">:host(.core-transition) { outline: none; overflow: auto; opacity: 0; transition: transform 0.2s ease-in-out, opacity 0.2s ease-in; -webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in;}:host(.core-transition.core-opened) { opacity: 1; transform: translateZ(0); -webkit-transform: translateZ(0);}:host(.core-transition-center) { transform: scale(0.5); -webkit-transform: scale(0.5);}:host(.core-transition-top) { transform: translateY(-200%); -webkit-transform: translateY(-200%);}:host(.core-transition-bottom) { transform: translateY(200%); -webkit-transform: translateY(200%);}:host(.core-transition-left) { transform: translateX(-200%); -webkit-transform: translateX(-200%);}:host(.core-transition-right) { transform: translateX(200%); -webkit-transform: translateX(200%);}</style></template><script>Polymer("core-transition-css",{baseClass:"core-transition",openedClass:"core-opened",closedClass:"core-closed",completeEventName:"transitionend",publish:{transitionType:null},registerCallback:function(element){this.transitionStyle=element.templateContent().firstElementChild},fetchTemplate:function(){return null},go:function(node,state){if(state.opened!==undefined){this.transitionOpened(node,state.opened)}},setup:function(node){if(!node._hasTransitionStyle){if(!node.shadowRoot){node.createShadowRoot().innerHTML="<content></content>"}this.installScopeStyle(this.transitionStyle,"transition",node.shadowRoot);node._hasTransitionStyle=true}node.classList.add(this.baseClass);if(this.transitionType){node.classList.add(this.baseClass+"-"+this.transitionType)}},teardown:function(node){node.classList.remove(this.baseClass);if(this.transitionType){node.classList.remove(this.baseClass+"-"+this.transitionType)}},transitionOpened:function(node,opened){this.listenOnce(node,this.completeEventName,function(){node.classList.toggle(this.revealedClass,opened);if(!opened){node.classList.remove(this.closedClass)}this.complete(node)});node.classList.toggle(this.openedClass,opened);node.classList.toggle(this.closedClass,!opened)}});</script></polymer-element><core-transition-css id="core-transition-fade"></core-transition-css><core-transition-css id="core-transition-center" transitiontype="center"></core-transition-css><core-transition-css id="core-transition-top" transitiontype="top"></core-transition-css><core-transition-css id="core-transition-bottom" transitiontype="bottom"></core-transition-css><core-transition-css id="core-transition-left" transitiontype="left"></core-transition-css><core-transition-css id="core-transition-right" transitiontype="right"></core-transition-css><polymer-element name="concerto-field" attributes="screenId fieldId fieldName baseURL contentStyle" assetpath=""><template><style> :host { display: block; width: 100%; height: 100%; } #content { width: 100%; height: 100%; } </style><core-ajax id="contentsData" url="{{baseURL}}/frontend/{{screenId}}/fields/{{fieldId}}/contents.json" handleas="json" on-core-response="{{handleContents}}" on-core-error="{{handleContentsError}}"></core-ajax><div id="content"></div></template><script>Polymer("concerto-field",{screenId:0,fieldId:0,fieldName:"",baseURL:"",contentStyle:"",currentContent:undefined,contentErrorCount:0,created:function(){this.contentQueue=[];var meta=document.createElement("core-meta");meta.type="transition";this.transition=meta.byId("core-transition-fade");this.handleContentLoadedBound=this.handleContentLoaded.bind(this)},domReady:function(){this.loadNextContent()},fetchContent:function(){this.$.contentsData.go()},handleContents:function(event,response){Array.prototype.push.apply(this.contentQueue,response.response);if(!this.currentContent&&this.contentQueue.length>=1){console.log("Urgent content update for field "+this.fieldId);this.scheduleNextContent(1)}},handleContentsError:function(event,xhr){console.log("Error retrieving content data for field "+this.fieldId)},loadNextContent:function(){var contentData=this.contentQueue.shift();if(!contentData||this.contentQueue.length<1){this.fetchContent()}if(this.fieldName=="Time"){var contentData={duration:15,id:0,name:"System Time",type:"ClientTime",render_details:{data:null}}}if(!contentData){console.log("No content available for field "+this.fieldId);this.scheduleNextContent(10*1e3)}else{if(!this.loadContent(contentData)){console.log("Unable to load "+contentData.type+" content for field "+this.fieldId);this.contentErrorCount++;if(this.contentErrorCount<=5){this.loadNextContent()}else{var retryDuration=Math.min((this.contentErrorCount-1)*30,600);console.log("Retrying in "+retryDuration+" seconds.");this.scheduleNextContent(retryDuration*1e3)}}else{this.contentErrorCount=0}}},loadContent:function(contentData){if(!contentData){console.log("Missing contentData for field "+this.fieldId);return false}var simpleContentData={title:contentData.name,contentId:contentData.id,duration:contentData.duration};Object.keys(contentData.render_details).forEach(function(key){simpleContentData[key]=contentData.render_details[key]});var contentType=contentData.type;var content=concerto.contentFactory.getType(contentType);if(!content){console.log("No content type registered for "+contentType);return false}content.baseURL=this.baseURL;content.cssText=this.contentStyle;content.addEventListener("load",this.handleContentLoadedBound);content.fromJSON(simpleContentData);return true},handleContentLoaded:function(event){var content=event.detail;content.removeEventListener("load",this.handleContentLoadedBound);this.displayContent(content)},displayContent:function(content){if(this.currentContent!=content){content.style.zIndex="100";if(this.currentContent){this.transition.setup(this.currentContent);this.currentContent.addEventListener("core-transitionend",this.handleTransitionOutComplete);this.transition.go(this.currentContent,{opened:false});var zIndex=parseInt(this.currentContent.style.zIndex);if(zIndex<2147483647){content.style.zIndex=zIndex+1}}this.transition.setup(content);this.$.content.appendChild(content);this.transition.go(content,{opened:true});this.currentContent=content}this.scheduleNextContent(content.duration*1e3)},handleTransitionOutComplete:function(event){var oldContent=event.target;oldContent.removeEventListener("core-transitionend",this.handleTransitionOutComplete);if(oldContent.parentNode){oldContent.parentNode.removeChild(event.target)}},scheduleNextContent:function(msToWait){this.job("updateFieldContent"+this.fieldId,function(){this.loadNextContent()},msToWait)}});</script></polymer-element><polymer-element name="concerto-screen" attributes="screenId baseURL" assetpath=""><template><style> :host { display: block; position: relative; width: 100%; height: 100%; } .position { position: absolute; overflow: hidden; } .template { width: 100%; height: 100%; background-size: 100% 100%; background-repeat: no-repeat; } </style><core-ajax id="screenData" url="{{baseURL}}/frontend/{{screenId}}/setup.json" handleas="json" auto="" on-core-response="{{handleScreenData}}"></core-ajax><template bind="" if="{{template.id}}"><div id="template_{{template.id}}" class="template" style="background-image: url('{{template.path | resolveURL(baseURL)}}');"><template repeat="{{position in template.positions}}"><div class="position" id="position_{{position.id}}" style="left: {{position.left * 100}}%;
10
+ this.prototype.resolvePath=function(urlPath,base){var u=new URL(urlPath,base||root);return u.href}}};scope.api.declaration.path=path})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var api=scope.api.instance.styles;var STYLE_SCOPE_ATTRIBUTE=api.STYLE_SCOPE_ATTRIBUTE;var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var STYLE_SELECTOR="style";var STYLE_LOADABLE_MATCH="@import";var SHEET_SELECTOR="link[rel=stylesheet]";var STYLE_GLOBAL_SCOPE="global";var SCOPE_ATTR="polymer-scope";var styles={loadStyles:function(callback){var template=this.fetchTemplate();var content=template&&this.templateContent();if(content){this.convertSheetsToStyles(content);var styles=this.findLoadableStyles(content);if(styles.length){var templateUrl=template.ownerDocument.baseURI;return Polymer.styleResolver.loadStyles(styles,templateUrl,callback)}}if(callback){callback()}},convertSheetsToStyles:function(root){var s$=root.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.ownerDocument);this.copySheetAttributes(c,s);s.parentNode.replaceChild(c,s)}},copySheetAttributes: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.sheets=this.findNodes(SHEET_SELECTOR);this.sheets.forEach(function(s){if(s.parentNode){s.parentNode.removeChild(s)}})},cacheStyles:function(){this.styles=this.findNodes(STYLE_SELECTOR+"["+SCOPE_ATTR+"]");this.styles.forEach(function(s){if(s.parentNode){s.parentNode.removeChild(s)}})},installLocalSheets:function(){var sheets=this.sheets.filter(function(s){return!s.hasAttribute(SCOPE_ATTR)});var content=this.templateContent();if(content){var cssText="";sheets.forEach(function(sheet){cssText+=cssTextFromSheet(sheet)+"\n"});if(cssText){var style=createStyleElement(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=content.querySelectorAll(selector).array();nodes=nodes.concat(templateNodes)}return matcher?nodes.filter(matcher):nodes},installGlobalStyles:function(){var style=this.styleForScope(STYLE_GLOBAL_SCOPE);applyStyleToScope(style,document.head)},cssTextForScope:function(scopeDescriptor){var cssText="";var selector="["+SCOPE_ATTR+"="+scopeDescriptor+"]";var matcher=function(s){return matchesSelector(s,selector)};var sheets=this.sheets.filter(matcher);sheets.forEach(function(sheet){cssText+=cssTextFromSheet(sheet)+"\n\n"});var styles=this.styles.filter(matcher);styles.forEach(function(style){cssText+=style.textContent+"\n\n"});return cssText},styleForScope:function(scopeDescriptor){var cssText=this.cssTextForScope(scopeDescriptor);return this.cssTextToScopeStyle(cssText,scopeDescriptor)},cssTextToScopeStyle: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=createStyleElement(style.textContent);var attr=style.getAttribute(STYLE_SCOPE_ATTRIBUTE);if(attr){clone.setAttribute(STYLE_SCOPE_ATTRIBUTE,attr)}var refNode=scope.firstElementChild;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 createStyleElement(cssText,scope){scope=scope||document;scope=scope.createElement?scope:scope.ownerDocument;var style=scope.createElement("style");style.textContent=cssText;return style}function cssTextFromSheet(sheet){return sheet&&sheet.__resource||""}function matchesSelector(node,inSelector){if(matches){return matches.call(node,inSelector)}}var p=HTMLElement.prototype;var matches=p.matches||p.matchesSelector||p.webkitMatchesSelector||p.mozMatchesSelector;scope.api.declaration.styles=styles;scope.applyStyleToScope=applyStyleToScope})(Polymer);(function(scope){var log=window.WebComponents?WebComponents.flags.log:{};var api=scope.api.instance.events;var EVENT_PREFIX=api.EVENT_PREFIX;var mixedCaseEventTypes={};["webkitAnimationStart","webkitAnimationEnd","webkitTransitionEnd","DOMFocusOut","DOMFocusIn","DOMMouseScroll"].forEach(function(e){mixedCaseEventTypes[e.toLowerCase()]=e});var events={parseHostEvents:function(){var delegates=this.prototype.eventDelegates;this.addAttributeDelegates(delegates)},addAttributeDelegates:function(delegates){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)},findController:function(node){while(node.parentNode){if(node.eventController){return node.eventController}node=node.parentNode}return node.host},getEventHandler:function(controller,target,method){var events=this;return function(e){if(!controller||!controller.PolymerBase){controller=events.findController(target)}var args=[e,e.detail,e.currentTarget];controller.dispatchMethod(controller,method,args)}},prepareEventBinding:function(pathString,name,node){if(!this.hasEventPrefix(name))return;var eventType=this.removeEventPrefix(name);eventType=mixedCaseEventTypes[eventType]||eventType;var events=this;return function(model,node,oneTime){var handler=events.getEventHandler(undefined,node,pathString);PolymerGestures.addEventListener(node,eventType,handler);if(oneTime)return;function bindingValue(){return"{{ "+pathString+" }}"}return{open:bindingValue,discardChanges:bindingValue,close:function(){PolymerGestures.removeEventListener(node,eventType,handler)}}}}};var prefixLength=EVENT_PREFIX.length;scope.api.declaration.events=events})(Polymer);(function(scope){var observationBlacklist=["attribute"];var properties={inferObservers:function(prototype){var observe=prototype.observe,property;for(var n in prototype){if(n.slice(-7)==="Changed"){property=n.slice(0,-7);if(this.canObserveProperty(property)){if(!observe){observe=prototype.observe={}}observe[property]=observe[property]||n}}}},canObserveProperty:function(property){return observationBlacklist.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}},optimizePropertyMaps:function(prototype){if(prototype.observe){var a=prototype._observeNames=[];for(var n in prototype.observe){var names=n.split(" ");for(var i=0,ni;ni=names[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=prototype._computedNames=[];for(var n in prototype.computed){a.push(n)}}},publishProperties:function(prototype,base){var publish=prototype.publish;if(publish){this.requireProperties(publish,prototype,base);this.filterInvalidAccessorNames(publish);prototype._publishLC=this.lowerCaseMap(publish)}var computed=prototype.computed;if(computed){this.filterInvalidAccessorNames(computed)}},filterInvalidAccessorNames:function(propertyNames){for(var name in propertyNames){if(this.propertyNameBlacklist[name]){console.warn('Cannot define property "'+name+'" for element "'+this.name+'" because it has the same name as an HTMLElement '+"property, and not all browsers support overriding that. "+"Consider giving it a different name.");delete propertyNames[name]}}},requireProperties:function(propertyInfos,prototype,base){prototype.reflect=prototype.reflect||{};for(var n in propertyInfos){var value=propertyInfos[n];if(value&&value.reflect!==undefined){prototype.reflect[n]=Boolean(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+"Observable_";proto[privateName]=proto[name];Object.defineProperty(proto,name,{get:function(){var observable=this[privateObservable];if(observable)observable.deliver();return this[privateName]},set:function(value){if(ignoreWrites){return this[privateName]}var observable=this[privateObservable];if(observable){observable.setValue(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.createPropertyAccessor(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.computed[n]){this.createPropertyAccessor(n)}}}},propertyNameBlacklist:{children:1,"class":1,id:1,hidden:1,style:1,title:1}};scope.api.declaration.properties=properties})(Polymer);(function(scope){var ATTRIBUTES_ATTRIBUTE="attributes";var ATTRIBUTES_REGEX=/\s|,/;var attributes={inheritAttributesObjects:function(prototype){this.inheritObject(prototype,"publishLC");this.inheritObject(prototype,"_instanceAttributes")},publishAttributes:function(prototype,base){var attributes=this.getAttribute(ATTRIBUTES_ATTRIBUTE);if(attributes){var publish=prototype.publish||(prototype.publish={});var names=attributes.split(ATTRIBUTES_REGEX);for(var i=0,l=names.length,n;i<l;i++){n=names[i].trim();if(n&&publish[n]===undefined){publish[n]=undefined}}}},accumulateInstanceAttributes:function(){var clonable=this.prototype._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}}},isInstanceAttribute: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.declaration.events;var syntax=new PolymerExpressions;var prepareBinding=syntax.prepareBinding;syntax.prepareBinding=function(pathString,name,node){return events.prepareEventBinding(pathString,name,node)||prepareBinding.call(syntax,pathString,name,node)};var mdv={syntax:syntax,fetchTemplate:function(){return this.querySelector("template")},templateContent:function(){var template=this.fetchTemplate();return template&&template.content},installBindingDelegate:function(template){if(template){template.bindingDelegate=this.syntax}}};scope.api.declaration.mdv=mdv})(Polymer);(function(scope){var api=scope.api;var isBase=scope.isBase;var extend=scope.extend;var hasShadowDOMPolyfill=window.ShadowDOMPolyfill;var prototype={register:function(name,extendeeName){this.buildPrototype(name,extendeeName);this.registerPrototype(name,extendeeName);this.publishConstructor()},buildPrototype:function(name,extendeeName){var extension=scope.getRegisteredPrototype(name);var base=this.generateBasePrototype(extendeeName);this.desugarBeforeChaining(extension,base);this.prototype=this.chainPrototypes(extension,base);this.desugarAfterChaining(name,extendeeName)},desugarBeforeChaining:function(prototype,base){prototype.element=this;this.publishAttributes(prototype,base);this.publishProperties(prototype,base);this.inferObservers(prototype);this.explodeObservers(prototype)},chainPrototypes:function(prototype,base){this.inheritMetaData(prototype,base);var chained=this.chainObject(prototype,base);ensurePrototypeTraversal(chained);return chained},inheritMetaData:function(prototype,base){this.inheritObject("observe",prototype,base);this.inheritObject("publish",prototype,base);this.inheritObject("reflect",prototype,base);this.inheritObject("_publishLC",prototype,base);this.inheritObject("_instanceAttributes",prototype,base);this.inheritObject("eventDelegates",prototype,base)},desugarAfterChaining:function(name,extendee){this.optimizePropertyMaps(this.prototype);this.createPropertyAccessors(this.prototype);this.installBindingDelegate(this.fetchTemplate());this.installSheets();this.resolveElementPaths(this);this.accumulateInstanceAttributes();this.parseHostEvents();this.addResolvePathApi();if(hasShadowDOMPolyfill){WebComponents.ShadowCSS.shimStyling(this.templateContent(),name,extendee)}if(this.prototype.registerCallback){this.prototype.registerCallback(this)}},publishConstructor:function(){var symbol=this.getAttribute("constructor");if(symbol){window[symbol]=this.ctor}},generateBasePrototype:function(extnds){var prototype=this.findBasePrototype(extnds);if(!prototype){var prototype=HTMLElement.getPrototypeForTag(extnds);prototype=this.ensureBaseApi(prototype);memoizedBases[extnds]=prototype}return prototype},findBasePrototype:function(name){return memoizedBases[name]},ensureBaseApi:function(prototype){if(prototype.PolymerBase){return prototype}var extended=Object.create(prototype);api.publish(api.instance,extended);this.mixinMethod(extended,prototype,api.instance.mdv,"bind");return extended},mixinMethod:function(extended,prototype,api,name){var $super=function(args){return prototype[name].apply(this,args)};extended[name]=function(){this.mixinSuper=$super;return api[name].apply(this,arguments)}},inheritObject:function(name,prototype,base){var source=prototype[name]||{};prototype[name]=this.chainObject(source,base[name])},registerPrototype:function(name,extendee){var info={prototype:this.prototype};var typeExtension=this.findTypeExtension(extendee);if(typeExtension){info.extends=typeExtension}HTMLElement.register(name,this.prototype);this.ctor=document.registerElement(name,info)},findTypeExtension:function(name){if(name&&name.indexOf("-")<0){return name}else{var p=this.findBasePrototype(name);if(p.element){return this.findTypeExtension(p.element.extends)}}}};var memoizedBases={};if(Object.__proto__){prototype.chainObject=function(object,inherited){if(object&&inherited&&object!==inherited){object.__proto__=inherited}return object}}else{prototype.chainObject=function(object,inherited){if(object&&inherited&&object!==inherited){var chained=Object.create(inherited);object=extend(chained,object)}return object}}function ensurePrototypeTraversal(prototype){if(!Object.__proto__){var ancestor=Object.getPrototypeOf(prototype);prototype.__proto__=ancestor;if(isBase(ancestor)){ancestor.__proto__=Object.getPrototypeOf(ancestor)}}}api.declaration.prototype=prototype})(Polymer);(function(scope){var queue={wait:function(element){if(!element.__queue){element.__queue={};elements.push(element)}},enqueue:function(element,check,go){var shouldAdd=element.__queue&&!element.__queue.check;if(shouldAdd){queueForElement(element).push(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||HTMLImports.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 element=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){flushQueue.push(element)},flush:function(){if(this.flushing){return}this.flushing=true;var element;while(flushQueue.length){element=flushQueue.shift();element.__queue.go.call(element);element.__queue=null}this.flushing=false},ready:function(){var polyfillWasReady=CustomElements.ready;CustomElements.ready=false;this.flush();if(!CustomElements.useNative){CustomElements.upgradeDocumentTree(document)}CustomElements.ready=polyfillWasReady;Polymer.flush();requestAnimationFrame(this.flushReadyCallbacks)},addReadyCallback:function(callback){if(callback){readyCallbacks.push(callback)}},flushReadyCallbacks:function(){if(readyCallbacks){var fn;while(readyCallbacks.length){fn=readyCallbacks.shift();fn()}}},waitingFor:function(){var 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=[];var flushQueue=[];var importQueue=[];var mainQueue=[];var readyCallbacks=[];function queueForElement(element){return document.contains(element)?mainQueue:importQueue}function nextQueued(){return importQueue.length?importQueue[0]:mainQueue[0]}function whenReady(callback){queue.waitToReady=true;Polymer.endOfMicrotask(function(){HTMLImports.whenReady(function(){queue.addReadyCallback(callback);queue.waitToReady=false;queue.check()})})}function forceReady(timeout){if(timeout===undefined){queue.ready();return}var handle=setTimeout(function(){queue.ready()},timeout);Polymer.whenReady(function(){clearTimeout(handle)})}scope.elements=elements;scope.waitingFor=queue.waitingFor.bind(queue);scope.forceReady=forceReady;scope.queue=queue;scope.whenReady=scope.whenPolymerReady=whenReady})(Polymer);(function(scope){var extend=scope.extend;var api=scope.api;var queue=scope.queue;var whenReady=scope.whenReady;var getRegisteredPrototype=scope.getRegisteredPrototype;var waitingForPrototype=scope.waitingForPrototype;var prototype=extend(Object.create(HTMLElement.prototype),{createdCallback:function(){if(this.getAttribute("name")){this.init()}},init:function(){this.name=this.getAttribute("name");this.extends=this.getAttribute("extends");queue.wait(this);this.loadResources();this.registerWhenReady()},registerWhenReady:function(){if(this.registered||this.waitingForPrototype(this.name)||this.waitingForQueue()||this.waitingForResources()){return}queue.go(this)},_register:function(){if(isCustomTag(this.extends)&&!isRegistered(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},waitingForPrototype: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)}},waitingForResources:function(){return this._needsResources},waitingForQueue:function(){return queue.enqueue(this,this.registerWhenReady,this._register)},loadResources:function(){this._needsResources=true;this.loadStyles(function(){this._needsResources=false;this.registerWhenReady()}.bind(this))}});api.publish(api.declaration,prototype);function isRegistered(name){return Boolean(HTMLElement.getPrototypeForTag(name))}function isCustomTag(name){return name&&name.indexOf("-")>=0}whenReady(function(){document.body.removeAttribute("unresolved");document.dispatchEvent(new CustomEvent("polymer-ready",{bubbles:true}))});document.registerElement("polymer-element",{prototype:prototype})})(Polymer);(function(scope){var whenReady=scope.whenReady;function importElements(node,callback){if(node){document.head.appendChild(node);whenReady(callback)}else if(callback){callback()}}function _import(urls,callback){if(urls&&urls.length){var frag=document.createDocumentFragment();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)}importElements(frag,callback)}else if(callback){callback()}}scope.import=_import;scope.importElements=importElements})(Polymer);(function(){var element=document.createElement("polymer-element");element.setAttribute("name","auto-binding");element.setAttribute("extends","template");element.init();Polymer("auto-binding",{createdCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax();Polymer.whenPolymerReady(function(){this.model=this;this.setAttribute("bind","");this.async(function(){this.marshalNodeReferences(this.parentNode);this.fire("template-bound")})}.bind(this))},makeSyntax:function(){var events=Object.create(Polymer.api.declaration.events);var self=this;events.findController=function(){return self.model};var syntax=new PolymerExpressions;var prepareBinding=syntax.prepareBinding;syntax.prepareBinding=function(pathString,name,node){return events.prepareEventBinding(pathString,name,node)||prepareBinding.call(syntax,pathString,name,node)};return syntax}})})();</script><script>var concerto=concerto||{};concerto.contentFactory=function(){var types={};var normalizeTypeName=function(typeName){var basicName=typeName.replace(/\W/g,"");return basicName.toLowerCase()};return{getType:function(typeName){typeName=normalizeTypeName(typeName);return types[typeName]?new types[typeName]:undefined},registerType:function(typeName,ContentType){if(!ContentType){return}var proto=ContentType.prototype;if("contentId"in proto&&"title"in proto){typeName=normalizeTypeName(typeName);types[typeName]=ContentType}}}}();</script><script>PolymerExpressions.prototype.resolveURL=function(url,base){var r=new RegExp("^(?:[a-z]+:)?//","i");if(!url||!base||r.test(url)){return url}return base+url};PolymerExpressions.prototype.optimalFontSize=function(element,content){var maxSize=200;var minSize=4;var maxWidth=element.parentNode.offsetWidth;var maxHeight=element.parentNode.offsetHeight;while(maxSize>minSize+1){midSize=Math.floor((maxSize-minSize)/2)+minSize;content.style.fontSize=midSize+"px";if(!(content.offsetHeight<=maxHeight&&content.offsetWidth<=maxWidth)){maxSize=midSize}else{minSize=midSize}}content.style.fontSize=minSize+"px"};</script><script>PolymerExpressions.prototype.resolveURL=function(url,base){var r=new RegExp("^(?:[a-z]+:)?//","i");if(!url||!base||r.test(url)){return url}return base+url};PolymerExpressions.prototype.optimalFontSize=function(element,content){var maxSize=200;var minSize=4;var maxWidth=element.parentNode.offsetWidth;var maxHeight=element.parentNode.offsetHeight;while(maxSize>minSize+1){midSize=Math.floor((maxSize-minSize)/2)+minSize;content.style.fontSize=midSize+"px";if(!(content.offsetHeight<=maxHeight&&content.offsetWidth<=maxWidth)){maxSize=midSize}else{minSize=midSize}}content.style.fontSize=minSize+"px"};</script></head><body><div hidden=""><polymer-element name="concerto-content" attributes="contentId title duration autoLoad baseURL cssText" assetpath="../../../../contents/"><template><style> :host { position: absolute; } </style></template><script>Polymer("concerto-content",{contentId:0,title:"",duration:0,autoLoad:true,cssText:"",baseURL:"",domReady:function(){if(this.autoLoad){this.loaded()}},loaded:function(){this.fire("load",this)},fromJSON:function(data){Object.keys(data).forEach(function(key){if(key in this){this.setAttribute(key,data[key])}}.bind(this));if(this.autoLoad){this.loaded()}},cssTextChanged:function(){this.style.cssText=this.cssText}});</script></polymer-element><script>function registerContentType(contentName,klass){window.addEventListener("polymer-ready",function(){if(concerto&&concerto.contentFactory){var name=contentName.replace(/^concerto-/,"");concerto.contentFactory.registerType(name,window[klass])}})}</script><polymer-element name="concerto-ticker" attributes="data" constructor="ConcertoTicker" extends="concerto-content" assetpath="../../../../contents/"><template><style> #ticker * { margin: 0; } </style><div id="ticker" class="ticker"></div></template><script>Polymer("concerto-ticker",{data:"",domReady:function(){PolymerExpressions.prototype.optimalFontSize(this,this.$.ticker)},dataChanged:function(){this.$.ticker.innerHTML=this.data}});</script></polymer-element><script>registerContentType("concerto-ticker","ConcertoTicker");</script><polymer-element name="concerto-graphic" attributes="path" constructor="ConcertoGraphic" extends="concerto-content" autoload="false" assetpath="../../../../contents/"><template><style> :host { display: block; width: 100%; height: 100%; text-align: center; } :host(.core-transition) { overflow: hidden; } .portrait { width: 100%; } .landscape { height: 100%; } img { position: relative; top: 50%; transform: translateY(-50%); } </style><img id="graphic" src="{{path | resolveURL(baseURL)}}"></template><script>Polymer("concerto-graphic",{path:"",created:function(){this.handleGraphicLoadBound=this.handleGraphicLoad.bind(this)},ready:function(){this.$.graphic.addEventListener("load",this.handleGraphicLoadBound)},handleGraphicLoad:function(){this.$.graphic.removeEventListener("load",this.handleGraphicLoadBound);this.loaded();this.resize()},resize:function(){var containerRatio=this.offsetWidth/this.offsetHeight;if(!containerRatio){return}var imgRatio=this.$.graphic.naturalWidth/this.$.graphic.naturalHeight;this.$.graphic.classList.toggle("portrait",imgRatio>=containerRatio);this.$.graphic.classList.toggle("landscape",imgRatio<=containerRatio)},cssTextChanged:function(){this.$.graphic.style.cssText=this.cssText}});</script></polymer-element><script>registerContentType("concerto-graphic","ConcertoGraphic");</script><polymer-element name="concerto-htmltext" attributes="data" constructor="ConcertoHtmlText" extends="concerto-content" assetpath="../../../../contents/"><template><style> #htmltext * { margin: 0; } </style><div id="htmltext" class="htmltext"></div></template><script>Polymer("concerto-htmltext",{data:"",domReady:function(){PolymerExpressions.prototype.optimalFontSize(this,this.$.htmltext)},dataChanged:function(){this.$.htmltext.innerHTML=this.data}});</script></polymer-element><script>registerContentType("concerto-htmltext","ConcertoHtmlText");</script><polymer-element name="concerto-client-time" attributes="path" constructor="ConcertoClientTime" extends="concerto-content" assetpath="../../../../contents/"><template><style> #clientTime * { margin: 0; } </style><div id="clientTime" class="clientTime"></div></template><script>Polymer("concerto-client-time",{dateObj:null,domReady:function(){this.dateObj=new Date;var date=this.prepareDate();var time=this.prepareTime();this.$.clientTime.innerHTML="<p>"+date+"<br />"+time+"</p>";PolymerExpressions.prototype.optimalFontSize(this,this.$.clientTime)},prepareDate:function(){return this.dateObj.toLocaleDateString()},prepareTime:function(){var rawTime=this.dateObj.toLocaleTimeString();var amPm=rawTime.slice(-2);var hours=this.dateObj.getHours();hours=(hours+11)%12+1;var minutes=this.dateObj.getMinutes();if(minutes<10){minutes="0"+minutes}return hours+":"+minutes+" "+amPm}});</script></polymer-element><script>registerContentType("concerto-client-time","ConcertoClientTime");</script><polymer-element name="core-xhr" hidden="" assetpath="../../../../bower_components/core-ajax/"><script>Polymer("core-xhr",{request:function(options){var xhr=new XMLHttpRequest;var url=options.url;var method=options.method||"GET";var async=!options.sync;var params=this.toQueryString(options.params);if(params&&method=="GET"){url+=(url.indexOf("?")>0?"&":"?")+params}var xhrParams=this.isBodyMethod(method)?options.body||params:null;xhr.open(method,url,async);if(options.responseType){xhr.responseType=options.responseType}if(options.withCredentials){xhr.withCredentials=true}this.makeReadyStateHandler(xhr,options.callback);this.setRequestHeaders(xhr,options.headers);xhr.send(xhrParams);if(!async){xhr.onreadystatechange(xhr)}return xhr},toQueryString:function(params){var r=[];for(var n in params){var v=params[n];n=encodeURIComponent(n);r.push(v==null?n:n+"="+encodeURIComponent(v))}return r.join("&")},isBodyMethod:function(method){return this.bodyMethods[(method||"").toUpperCase()]},bodyMethods:{POST:1,PUT:1,DELETE:1},makeReadyStateHandler:function(xhr,callback){xhr.onreadystatechange=function(){if(xhr.readyState==4){callback&&callback.call(null,xhr.response,xhr)}}},setRequestHeaders:function(xhr,headers){if(headers){for(var name in headers){xhr.setRequestHeader(name,headers[name])}}}});</script></polymer-element><polymer-element name="core-ajax" hidden="" attributes="url handleAs auto params response error method headers body contentType withCredentials" assetpath="../../../../bower_components/core-ajax/"><script>Polymer("core-ajax",{url:"",handleAs:"",auto:false,params:"",response:null,error:null,method:"",headers:null,body:null,contentType:"application/x-www-form-urlencoded",withCredentials:false,xhrArgs:null,ready:function(){this.xhr=document.createElement("core-xhr")},receive:function(response,xhr){if(this.isSuccess(xhr)){this.processResponse(xhr)}else{this.processError(xhr)}this.complete(xhr)},isSuccess:function(xhr){var status=xhr.status||0;return!status||status>=200&&status<300},processResponse:function(xhr){var response=this.evalResponse(xhr);if(xhr===this.activeRequest){this.response=response}this.fire("core-response",{response:response,xhr:xhr})},processError:function(xhr){var response=xhr.status+": "+xhr.responseText;if(xhr===this.activeRequest){this.error=response}this.fire("core-error",{response:response,xhr:xhr})},complete:function(xhr){this.fire("core-complete",{response:xhr.status,xhr:xhr})},evalResponse:function(xhr){return this[(this.handleAs||"text")+"Handler"](xhr)},xmlHandler:function(xhr){return xhr.responseXML},textHandler:function(xhr){return xhr.responseText},jsonHandler:function(xhr){var r=xhr.responseText;try{return JSON.parse(r)}catch(x){console.warn("core-ajax caught an exception trying to parse response as JSON:");console.warn("url:",this.url);console.warn(x);return r}},documentHandler:function(xhr){return xhr.response},blobHandler:function(xhr){return xhr.response},arraybufferHandler:function(xhr){return xhr.response},urlChanged:function(){if(!this.handleAs){var ext=String(this.url).split(".").pop();switch(ext){case"json":this.handleAs="json";break}}this.autoGo()},paramsChanged:function(){this.autoGo()},autoChanged:function(){this.autoGo()},autoGo:function(){if(this.auto){this.goJob=this.job(this.goJob,this.go,0)}},go:function(){var args=this.xhrArgs||{};args.body=this.body||args.body;args.params=this.params||args.params;if(args.params&&typeof args.params=="string"){args.params=JSON.parse(args.params)}args.headers=this.headers||args.headers||{};if(args.headers&&typeof args.headers=="string"){args.headers=JSON.parse(args.headers)}var hasContentType=Object.keys(args.headers).some(function(header){return header.toLowerCase()==="content-type"});if(!hasContentType&&this.contentType){args.headers["Content-Type"]=this.contentType}if(this.handleAs==="arraybuffer"||this.handleAs==="blob"||this.handleAs==="document"){args.responseType=this.handleAs}args.withCredentials=this.withCredentials;args.callback=this.receive.bind(this);args.url=this.url;args.method=this.method;this.response=this.error=null;this.activeRequest=args.url&&this.xhr.request(args);return this.activeRequest}});</script></polymer-element><polymer-element name="core-meta" attributes="label type" hidden="" assetpath="../../../../bower_components/core-meta/"><script>(function(){var SKIP_ID="meta";var metaData={},metaArray={};Polymer("core-meta",{type:"default",alwaysPrepare:true,ready:function(){this.register(this.id)},get metaArray(){var t=this.type;if(!metaArray[t]){metaArray[t]=[]}return metaArray[t]},get metaData(){var t=this.type;if(!metaData[t]){metaData[t]={}}return metaData[t]},register:function(id,old){if(id&&id!==SKIP_ID){this.unregister(this,old);this.metaData[id]=this;this.metaArray.push(this)}},unregister:function(meta,id){delete this.metaData[id||meta.id];var i=this.metaArray.indexOf(meta);if(i>=0){this.metaArray.splice(i,1)}},get list(){return this.metaArray},byId:function(id){return this.metaData[id]}})})();</script></polymer-element><polymer-element name="core-transition" extends="core-meta" assetpath="../../../../bower_components/core-transition/"><script>Polymer("core-transition",{type:"transition",go:function(node,state){this.complete(node)},setup:function(node){},teardown:function(node){},complete:function(node){this.fire("core-transitionend",null,node)},listenOnce:function(node,event,fn,args){var self=this;var listener=function(){fn.apply(self,args);node.removeEventListener(event,listener,false)};node.addEventListener(event,listener,false)}});</script></polymer-element><polymer-element name="core-transition-css" extends="core-transition" attributes="transitionType" assetpath="../../../../bower_components/core-transition/"><template><style no-shim="">:host(.core-transition) { outline: none; overflow: auto; opacity: 0; transition: transform 0.2s ease-in-out, opacity 0.2s ease-in; -webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in;}:host(.core-transition.core-opened) { opacity: 1; transform: translateZ(0); -webkit-transform: translateZ(0);}:host(.core-transition-center) { transform: scale(0.5); -webkit-transform: scale(0.5);}:host(.core-transition-top) { transform: translateY(-200%); -webkit-transform: translateY(-200%);}:host(.core-transition-bottom) { transform: translateY(200%); -webkit-transform: translateY(200%);}:host(.core-transition-left) { transform: translateX(-200%); -webkit-transform: translateX(-200%);}:host(.core-transition-right) { transform: translateX(200%); -webkit-transform: translateX(200%);}</style></template><script>Polymer("core-transition-css",{baseClass:"core-transition",openedClass:"core-opened",closedClass:"core-closed",completeEventName:"transitionend",publish:{transitionType:null},registerCallback:function(element){this.transitionStyle=element.templateContent().firstElementChild},fetchTemplate:function(){return null},go:function(node,state){if(state.opened!==undefined){this.transitionOpened(node,state.opened)}},setup:function(node){if(!node._hasTransitionStyle){if(!node.shadowRoot){node.createShadowRoot().innerHTML="<content></content>"}this.installScopeStyle(this.transitionStyle,"transition",node.shadowRoot);node._hasTransitionStyle=true}node.classList.add(this.baseClass);if(this.transitionType){node.classList.add(this.baseClass+"-"+this.transitionType)}},teardown:function(node){node.classList.remove(this.baseClass);if(this.transitionType){node.classList.remove(this.baseClass+"-"+this.transitionType)}},transitionOpened:function(node,opened){this.listenOnce(node,this.completeEventName,function(){node.classList.toggle(this.revealedClass,opened);if(!opened){node.classList.remove(this.closedClass)}this.complete(node)});node.classList.toggle(this.openedClass,opened);node.classList.toggle(this.closedClass,!opened)}});</script></polymer-element><core-transition-css id="core-transition-fade"></core-transition-css><core-transition-css id="core-transition-center" transitiontype="center"></core-transition-css><core-transition-css id="core-transition-top" transitiontype="top"></core-transition-css><core-transition-css id="core-transition-bottom" transitiontype="bottom"></core-transition-css><core-transition-css id="core-transition-left" transitiontype="left"></core-transition-css><core-transition-css id="core-transition-right" transitiontype="right"></core-transition-css><polymer-element name="concerto-field" attributes="screenId fieldId fieldName baseURL contentStyle" assetpath="../../../../"><template><style> :host { display: block; width: 100%; height: 100%; } #content { width: 100%; height: 100%; } </style><core-ajax id="contentsData" url="{{baseURL}}/frontend/{{screenId}}/fields/{{fieldId}}/contents.json" handleas="json" on-core-response="{{handleContents}}" on-core-error="{{handleContentsError}}"></core-ajax><div id="content"></div></template><script>Polymer("concerto-field",{screenId:0,fieldId:0,fieldName:"",baseURL:"",contentStyle:"",currentContent:undefined,contentErrorCount:0,created:function(){this.contentQueue=[];var meta=document.createElement("core-meta");meta.type="transition";this.transition=meta.byId("core-transition-fade");this.handleContentLoadedBound=this.handleContentLoaded.bind(this)},domReady:function(){this.loadNextContent()},fetchContent:function(){this.$.contentsData.go()},handleContents:function(event,response){Array.prototype.push.apply(this.contentQueue,response.response);if(!this.currentContent&&this.contentQueue.length>=1){console.log("Urgent content update for field "+this.fieldId);this.scheduleNextContent(1)}},handleContentsError:function(event,xhr){console.log("Error retrieving content data for field "+this.fieldId)},loadNextContent:function(){var contentData=this.contentQueue.shift();if(!contentData||this.contentQueue.length<1){this.fetchContent()}if(this.fieldName=="Time"){var contentData={duration:15,id:0,name:"System Time",type:"ClientTime",render_details:{data:null}}}if(!contentData){console.log("No content available for field "+this.fieldId);this.scheduleNextContent(10*1e3)}else{if(!this.loadContent(contentData)){console.log("Unable to load "+contentData.type+" content for field "+this.fieldId);this.contentErrorCount++;if(this.contentErrorCount<=5){this.loadNextContent()}else{var retryDuration=Math.min((this.contentErrorCount-1)*30,600);console.log("Retrying in "+retryDuration+" seconds.");this.scheduleNextContent(retryDuration*1e3)}}else{this.contentErrorCount=0}}},loadContent:function(contentData){if(!contentData){console.log("Missing contentData for field "+this.fieldId);return false}var simpleContentData={title:contentData.name,contentId:contentData.id,duration:contentData.duration};Object.keys(contentData.render_details).forEach(function(key){simpleContentData[key]=contentData.render_details[key]});var contentType=contentData.type;var content=concerto.contentFactory.getType(contentType);if(!content){console.log("No content type registered for "+contentType);return false}content.baseURL=this.baseURL;content.cssText=this.contentStyle;content.addEventListener("load",this.handleContentLoadedBound);content.fromJSON(simpleContentData);return true},handleContentLoaded:function(event){var content=event.detail;content.removeEventListener("load",this.handleContentLoadedBound);this.displayContent(content)},displayContent:function(content){if(this.currentContent!=content){content.style.zIndex="100";if(this.currentContent){this.transition.setup(this.currentContent);this.currentContent.addEventListener("core-transitionend",this.handleTransitionOutComplete);this.transition.go(this.currentContent,{opened:false});var zIndex=parseInt(this.currentContent.style.zIndex);if(zIndex<2147483647){content.style.zIndex=zIndex+1}}this.transition.setup(content);this.$.content.appendChild(content);this.transition.go(content,{opened:true});this.currentContent=content}this.scheduleNextContent(content.duration*1e3)},handleTransitionOutComplete:function(event){var oldContent=event.target;oldContent.removeEventListener("core-transitionend",this.handleTransitionOutComplete);if(oldContent.parentNode){oldContent.parentNode.removeChild(event.target)}},scheduleNextContent:function(msToWait){this.job("updateFieldContent"+this.fieldId,function(){this.loadNextContent()},msToWait)}});</script></polymer-element><polymer-element name="concerto-screen" attributes="screenId baseURL" assetpath="../../../../"><template><style> :host { display: block; position: relative; width: 100%; height: 100%; } .position { position: absolute; overflow: hidden; } .template { width: 100%; height: 100%; background-size: 100% 100%; background-repeat: no-repeat; } </style><core-ajax id="screenData" url="{{baseURL}}/frontend/{{screenId}}/setup.json" handleas="json" auto="" on-core-response="{{handleScreenData}}"></core-ajax><template bind="" if="{{template.id}}"><div id="template_{{template.id}}" class="template" style="background-image: url('{{template.path | resolveURL(baseURL)}}');"><template repeat="{{position in template.positions}}"><div class="position" id="position_{{position.id}}" style="left: {{position.left * 100}}%;
11
11
  top: {{position.top * 100}}%;
12
12
  width: {{(position.right - position.left) * 100}}%;
13
- height: {{(position.bottom - position.top) * 100}}%;"><concerto-field screenid="{{screenId}}" fieldid="{{position.field.id}}" fieldname="{{position.field.name}}" baseurl="{{baseURL}}" contentstyle="{{position.style}}"></concerto-field></div></template></div></template></template><script>Polymer("concerto-screen",{screenId:0,baseURL:"",publish:{name:{value:"",reflect:true}},created:function(){this.template={}},handleScreenData:function(event,response){var data=response.response;this.name=data.name;this.template=data.template}});</script></polymer-element></div><concerto-screen screenid="<%= params[:id] %>"></concerto-screen></body></html>
13
+ height: {{(position.bottom - position.top) * 100}}%;"><concerto-field screenid="{{screenId}}" fieldid="{{position.field.id}}" fieldname="{{position.field.name}}" baseurl="{{baseURL}}" contentstyle="{{position.style}}"></concerto-field></div></template></div></template><core-ajax id="updateScreenData" url="{{baseURL}}/frontend/{{screenId}}/setup.json" handleas="json" on-core-response="{{refreshScreen}}"></core-ajax></template><script>Polymer("concerto-screen",{screenId:0,baseURL:"",publish:{name:{value:"",reflect:true}},created:function(){this.template={}},handleScreenData:function(event,response){var data=response.response;this.name=data.name;this.template=data.template;setInterval(this.checkScreenData,1e3,this.$.updateScreenData)},checkScreenData:function(ajax){ajax.go()},refreshScreen:function(event,response){var template=this.template;var response=response.response;if(template.name!=response.template.name){location.reload()}for(var position in this.template.positions){if(!(position in response.template.positions)){location.reload()}}}});</script></polymer-element></div><concerto-screen screenid="<%= params[:id] %>"></concerto-screen></body></html>
@@ -1,3 +1,3 @@
1
1
  module ConcertoFrontend
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concerto_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Perez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -45,8 +45,6 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - LICENSE
49
- - README.md
50
48
  - Rakefile
51
49
  - app/views/concerto_frontend/_frontend.html
52
50
  - config/routes.rb
@@ -54,7 +52,8 @@ files:
54
52
  - lib/concerto_frontend/engine.rb
55
53
  - lib/concerto_frontend/version.rb
56
54
  homepage: https://concerto-signage.org
57
- licenses: []
55
+ licenses:
56
+ - Apache-2.0
58
57
  metadata: {}
59
58
  post_install_message:
60
59
  rdoc_options: []
data/LICENSE DELETED
@@ -1,13 +0,0 @@
1
- Copyright 2014 Concerto Authors
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
data/README.md DELETED
@@ -1,6 +0,0 @@
1
- Concerto Frontend Plugin
2
- ========================
3
-
4
- Concerto plugin containing the vulcanized Polymer frontend.
5
-
6
- After following the steps from our [Concerto Frontend Polymer Repository](https://github.com/concerto/concerto-frontend), copy the vulcanized frontend.html output file to this gem under app/views/concerto_frontend and rename it to _frontend.html.