| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 function assert(condition,opt_message){if(!condition){var message="Assertion fai
led";if(opt_message)message=message+": "+opt_message;var error=new Error(message
);var global=function(){return this}();if(global.traceAssertionsForTesting)conso
le.warn(error.stack);throw error}return condition}function assertNotReached(opt_
message){assert(false,opt_message||"Unreachable code hit")}function assertInstan
ceof(value,type,opt_message){if(!(value instanceof type)){assertNotReached(opt_m
essage||"Value "+value+" is not a[n] "+(type.name||typeof type))}return value} | 4 function assert(condition,opt_message){if(!condition){var message="Assertion fai
led";if(opt_message)message=message+": "+opt_message;var error=new Error(message
);var global=function(){return this}();if(global.traceAssertionsForTesting)conso
le.warn(error.stack);throw error}return condition}function assertNotReached(opt_
message){assert(false,opt_message||"Unreachable code hit")}function assertInstan
ceof(value,type,opt_message){if(!(value instanceof type)){assertNotReached(opt_m
essage||"Value "+value+" is not a[n] "+(type.name||typeof type))}return value} |
| 5 // Copyright 2016 The Chromium Authors. All rights reserved. | 5 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 6 // Use of this source code is governed by a BSD-style license that can be | 6 // Use of this source code is governed by a BSD-style license that can be |
| 7 // found in the LICENSE file. | 7 // found in the LICENSE file. |
| 8 function PromiseResolver(){this.resolve_;this.reject_;this.promise_=new Promise(
function(resolve,reject){this.resolve_=resolve;this.reject_=reject}.bind(this))}
PromiseResolver.prototype={get promise(){return this.promise_},set promise(p){as
sertNotReached()},get resolve(){return this.resolve_},set resolve(r){assertNotRe
ached()},get reject(){return this.reject_},set reject(s){assertNotReached()}}; | 8 function PromiseResolver(){this.resolve_;this.reject_;this.promise_=new Promise(
function(resolve,reject){this.resolve_=resolve;this.reject_=reject}.bind(this))}
PromiseResolver.prototype={get promise(){return this.promise_},set promise(p){as
sertNotReached()},get resolve(){return this.resolve_},set resolve(r){assertNotRe
ached()},get reject(){return this.reject_},set reject(s){assertNotReached()}}; |
| 9 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 9 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 10 // Use of this source code is governed by a BSD-style license that can be | 10 // Use of this source code is governed by a BSD-style license that can be |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Copyright 2015 The Chromium Authors. All rights reserved. | 43 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 44 // Use of this source code is governed by a BSD-style license that can be | 44 // Use of this source code is governed by a BSD-style license that can be |
| 45 // found in the LICENSE file. | 45 // found in the LICENSE file. |
| 46 cr.define("downloads",function(){var Item=Polymer({is:"downloads-item",propertie
s:{data:{type:Object},completelyOnDisk_:{computed:"computeCompletelyOnDisk_("+"d
ata.state, data.file_externally_removed)",type:Boolean,value:true},controlledBy_
:{computed:"computeControlledBy_(data.by_ext_id, data.by_ext_name)",type:String,
value:""},isActive_:{computed:"computeIsActive_("+"data.state, data.file_externa
lly_removed)",type:Boolean,value:true},isDangerous_:{computed:"computeIsDangerou
s_(data.state)",type:Boolean,value:false},isMalware_:{computed:"computeIsMalware
_(isDangerous_, data.danger_type)",type:Boolean,value:false},isInProgress_:{comp
uted:"computeIsInProgress_(data.state)",type:Boolean,value:false},pauseOrResumeT
ext_:{computed:"computePauseOrResumeText_(isInProgress_, data.resume)",type:Stri
ng},showCancel_:{computed:"computeShowCancel_(data.state)",type:Boolean,value:fa
lse},showProgress_:{computed:"computeShowProgress_(showCancel_, data.percent)",t
ype:Boolean,value:false}},observers:["observeControlledBy_(controlledBy_)","obse
rveIsDangerous_(isDangerous_, data)"],ready:function(){this.content=this.$.conte
nt},chopUrl_:function(url){return url.slice(0,300)},computeClass_:function(){var
classes=[];if(this.isActive_)classes.push("is-active");if(this.isDangerous_)cla
sses.push("dangerous");if(this.showProgress_)classes.push("show-progress");retur
n classes.join(" ")},computeCompletelyOnDisk_:function(){return this.data.state=
=downloads.States.COMPLETE&&!this.data.file_externally_removed},computeControlle
dBy_:function(){if(!this.data.by_ext_id||!this.data.by_ext_name)return"";var url
="chrome://extensions#"+this.data.by_ext_id;var name=this.data.by_ext_name;retur
n loadTimeData.getStringF("controlledByUrl",url,name)},computeDangerIcon_:functi
on(){if(!this.isDangerous_)return"";switch(this.data.danger_type){case downloads
.DangerType.DANGEROUS_CONTENT:case downloads.DangerType.DANGEROUS_HOST:case down
loads.DangerType.DANGEROUS_URL:case downloads.DangerType.POTENTIALLY_UNWANTED:ca
se downloads.DangerType.UNCOMMON_CONTENT:return"downloads:remove-circle";default
:return"cr:warning"}},computeDate_:function(){assert(typeof this.data.hideDate==
"boolean");if(this.data.hideDate)return"";return assert(this.data.since_string||
this.data.date_string)},computeDescription_:function(){var data=this.data;switch
(data.state){case downloads.States.DANGEROUS:var fileName=data.file_name;switch(
data.danger_type){case downloads.DangerType.DANGEROUS_FILE:return loadTimeData.g
etString("dangerFileDesc");case downloads.DangerType.DANGEROUS_URL:case download
s.DangerType.DANGEROUS_CONTENT:case downloads.DangerType.DANGEROUS_HOST:return l
oadTimeData.getString("dangerDownloadDesc");case downloads.DangerType.UNCOMMON_C
ONTENT:return loadTimeData.getString("dangerUncommonDesc");case downloads.Danger
Type.POTENTIALLY_UNWANTED:return loadTimeData.getString("dangerSettingsDesc")}br
eak;case downloads.States.IN_PROGRESS:case downloads.States.PAUSED:return data.p
rogress_status_text}return""},computeIsActive_:function(){return this.data.state
!=downloads.States.CANCELLED&&this.data.state!=downloads.States.INTERRUPTED&&!th
is.data.file_externally_removed},computeIsDangerous_:function(){return this.data
.state==downloads.States.DANGEROUS},computeIsInProgress_:function(){return this.
data.state==downloads.States.IN_PROGRESS},computeIsMalware_:function(){return th
is.isDangerous_&&(this.data.danger_type==downloads.DangerType.DANGEROUS_CONTENT|
|this.data.danger_type==downloads.DangerType.DANGEROUS_HOST||this.data.danger_ty
pe==downloads.DangerType.DANGEROUS_URL||this.data.danger_type==downloads.DangerT
ype.POTENTIALLY_UNWANTED)},computePauseOrResumeText_:function(){if(this.isInProg
ress_)return loadTimeData.getString("controlPause");if(this.data.resume)return l
oadTimeData.getString("controlResume");return""},computeRemoveStyle_:function(){
var canDelete=loadTimeData.getBoolean("allowDeletingHistory");var hideRemove=thi
s.isDangerous_||this.showCancel_||!canDelete;return hideRemove?"visibility: hidd
en":""},computeShowCancel_:function(){return this.data.state==downloads.States.I
N_PROGRESS||this.data.state==downloads.States.PAUSED},computeShowProgress_:funct
ion(){return this.showCancel_&&this.data.percent>=-1},computeTag_:function(){swi
tch(this.data.state){case downloads.States.CANCELLED:return loadTimeData.getStri
ng("statusCancelled");case downloads.States.INTERRUPTED:return this.data.last_re
ason_text;case downloads.States.COMPLETE:return this.data.file_externally_remove
d?loadTimeData.getString("statusRemoved"):""}return""},isIndeterminate_:function
(){return this.data.percent==-1},observeControlledBy_:function(){this.$["control
led-by"].innerHTML=this.controlledBy_},observeIsDangerous_:function(){if(!this.d
ata)return;if(this.isDangerous_){this.$.url.removeAttribute("href")}else{this.$.
url.href=assert(this.data.url);var filePath=encodeURIComponent(this.data.file_pa
th);var scaleFactor="?scale="+window.devicePixelRatio+"x";this.$["file-icon"].sr
c="chrome://fileicon/"+filePath+scaleFactor}},onCancelTap_:function(){downloads.
ActionService.getInstance().cancel(this.data.id)},onDiscardDangerousTap_:functio
n(){downloads.ActionService.getInstance().discardDangerous(this.data.id)},onDrag
Start_:function(e){e.preventDefault();downloads.ActionService.getInstance().drag
(this.data.id)},onFileLinkTap_:function(e){e.preventDefault();downloads.ActionSe
rvice.getInstance().openFile(this.data.id)},onPauseOrResumeTap_:function(){if(th
is.isInProgress_)downloads.ActionService.getInstance().pause(this.data.id);else
downloads.ActionService.getInstance().resume(this.data.id)},onRemoveTap_:functio
n(){downloads.ActionService.getInstance().remove(this.data.id)},onRetryTap_:func
tion(){downloads.ActionService.getInstance().download(this.data.url)},onSaveDang
erousTap_:function(){downloads.ActionService.getInstance().saveDangerous(this.da
ta.id)},onShowTap_:function(){downloads.ActionService.getInstance().show(this.da
ta.id)}});return{Item:Item}});Polymer.PaperItemBehaviorImpl={hostAttributes:{rol
e:"option",tabindex:"0"}};Polymer.PaperItemBehavior=[Polymer.IronButtonState,Pol
ymer.IronControlState,Polymer.PaperItemBehaviorImpl];Polymer({is:"paper-item",be
haviors:[Polymer.PaperItemBehavior]});Polymer.IronSelection=function(selectCallb
ack){this.selection=[];this.selectCallback=selectCallback};Polymer.IronSelection
.prototype={get:function(){return this.multi?this.selection.slice():this.selecti
on[0]},clear:function(excludes){this.selection.slice().forEach(function(item){if
(!excludes||excludes.indexOf(item)<0){this.setItemSelected(item,false)}},this)},
isSelected:function(item){return this.selection.indexOf(item)>=0},setItemSelecte
d:function(item,isSelected){if(item!=null){if(isSelected!==this.isSelected(item)
){if(isSelected){this.selection.push(item)}else{var i=this.selection.indexOf(ite
m);if(i>=0){this.selection.splice(i,1)}}if(this.selectCallback){this.selectCallb
ack(item,isSelected)}}}},select:function(item){if(this.multi){this.toggle(item)}
else if(this.get()!==item){this.setItemSelected(this.get(),false);this.setItemSe
lected(item,true)}},toggle:function(item){this.setItemSelected(item,!this.isSele
cted(item))}};Polymer.IronSelectableBehavior={properties:{attrForSelected:{type:
String,value:null},selected:{type:String,notify:true},selectedItem:{type:Object,
readOnly:true,notify:true},activateEvent:{type:String,value:"tap",observer:"_act
ivateEventChanged"},selectable:String,selectedClass:{type:String,value:"iron-sel
ected"},selectedAttribute:{type:String,value:null},fallbackSelection:{type:Strin
g,value:null},items:{type:Array,readOnly:true,notify:true,value:function(){retur
n[]}},_excludedLocalNames:{type:Object,value:function(){return{template:1}}}},ob
servers:["_updateAttrForSelected(attrForSelected)","_updateSelected(selected)","
_checkFallback(fallbackSelection)"],created:function(){this._bindFilterItem=this
._filterItem.bind(this);this._selection=new Polymer.IronSelection(this._applySel
ection.bind(this))},attached:function(){this._observer=this._observeItems(this);
this._updateItems();if(!this._shouldUpdateSelection){this._updateSelected()}this
._addListener(this.activateEvent)},detached:function(){if(this._observer){Polyme
r.dom(this).unobserveNodes(this._observer)}this._removeListener(this.activateEve
nt)},indexOf:function(item){return this.items.indexOf(item)},select:function(val
ue){this.selected=value},selectPrevious:function(){var length=this.items.length;
var index=(Number(this._valueToIndex(this.selected))-1+length)%length;this.selec
ted=this._indexToValue(index)},selectNext:function(){var index=(Number(this._val
ueToIndex(this.selected))+1)%this.items.length;this.selected=this._indexToValue(
index)},selectIndex:function(index){this.select(this._indexToValue(index))},forc
eSynchronousItemUpdate:function(){this._updateItems()},get _shouldUpdateSelectio
n(){return this.selected!=null},_checkFallback:function(){if(this._shouldUpdateS
election){this._updateSelected()}},_addListener:function(eventName){this.listen(
this,eventName,"_activateHandler")},_removeListener:function(eventName){this.unl
isten(this,eventName,"_activateHandler")},_activateEventChanged:function(eventNa
me,old){this._removeListener(old);this._addListener(eventName)},_updateItems:fun
ction(){var nodes=Polymer.dom(this).queryDistributedElements(this.selectable||"*
");nodes=Array.prototype.filter.call(nodes,this._bindFilterItem);this._setItems(
nodes)},_updateAttrForSelected:function(){if(this._shouldUpdateSelection){this.s
elected=this._indexToValue(this.indexOf(this.selectedItem))}},_updateSelected:fu
nction(){this._selectSelected(this.selected)},_selectSelected:function(selected)
{this._selection.select(this._valueToItem(this.selected));if(this.fallbackSelect
ion&&this.items.length&&this._selection.get()===undefined){this.selected=this.fa
llbackSelection}},_filterItem:function(node){return!this._excludedLocalNames[nod
e.localName]},_valueToItem:function(value){return value==null?null:this.items[th
is._valueToIndex(value)]},_valueToIndex:function(value){if(this.attrForSelected)
{for(var i=0,item;item=this.items[i];i++){if(this._valueForItem(item)==value){re
turn i}}}else{return Number(value)}},_indexToValue:function(index){if(this.attrF
orSelected){var item=this.items[index];if(item){return this._valueForItem(item)}
}else{return index}},_valueForItem:function(item){var propValue=item[Polymer.Cas
eMap.dashToCamelCase(this.attrForSelected)];return propValue!=undefined?propValu
e:item.getAttribute(this.attrForSelected)},_applySelection:function(item,isSelec
ted){if(this.selectedClass){this.toggleClass(this.selectedClass,isSelected,item)
}if(this.selectedAttribute){this.toggleAttribute(this.selectedAttribute,isSelect
ed,item)}this._selectionChange();this.fire("iron-"+(isSelected?"select":"deselec
t"),{item:item})},_selectionChange:function(){this._setSelectedItem(this._select
ion.get())},_observeItems:function(node){return Polymer.dom(node).observeNodes(f
unction(mutation){this._updateItems();if(this._shouldUpdateSelection){this._upda
teSelected()}this.fire("iron-items-changed",mutation,{bubbles:false,cancelable:f
alse})})},_activateHandler:function(e){var t=e.target;var items=this.items;while
(t&&t!=this){var i=items.indexOf(t);if(i>=0){var value=this._indexToValue(i);thi
s._itemActivate(value,t);return}t=t.parentNode}},_itemActivate:function(value,it
em){if(!this.fire("iron-activate",{selected:value,item:item},{cancelable:true}).
defaultPrevented){this.select(value)}}};Polymer.IronMultiSelectableBehaviorImpl=
{properties:{multi:{type:Boolean,value:false,observer:"multiChanged"},selectedVa
lues:{type:Array,notify:true},selectedItems:{type:Array,readOnly:true,notify:tru
e}},observers:["_updateSelected(selectedValues.splices)"],select:function(value)
{if(this.multi){if(this.selectedValues){this._toggleSelected(value)}else{this.se
lectedValues=[value]}}else{this.selected=value}},multiChanged:function(multi){th
is._selection.multi=multi},get _shouldUpdateSelection(){return this.selected!=nu
ll||this.selectedValues!=null&&this.selectedValues.length},_updateAttrForSelecte
d:function(){if(!this.multi){Polymer.IronSelectableBehavior._updateAttrForSelect
ed.apply(this)}else if(this._shouldUpdateSelection){this.selectedValues=this.sel
ectedItems.map(function(selectedItem){return this._indexToValue(this.indexOf(sel
ectedItem))},this).filter(function(unfilteredValue){return unfilteredValue!=null
},this)}},_updateSelected:function(){if(this.multi){this._selectMulti(this.selec
tedValues)}else{this._selectSelected(this.selected)}},_selectMulti:function(valu
es){if(values){var selectedItems=this._valuesToItems(values);this._selection.cle
ar(selectedItems);for(var i=0;i<selectedItems.length;i++){this._selection.setIte
mSelected(selectedItems[i],true)}if(this.fallbackSelection&&this.items.length&&!
this._selection.get().length){var fallback=this._valueToItem(this.fallbackSelect
ion);if(fallback){this.selectedValues=[this.fallbackSelection]}}}else{this._sele
ction.clear()}},_selectionChange:function(){var s=this._selection.get();if(this.
multi){this._setSelectedItems(s)}else{this._setSelectedItems([s]);this._setSelec
tedItem(s)}},_toggleSelected:function(value){var i=this.selectedValues.indexOf(v
alue);var unselected=i<0;if(unselected){this.push("selectedValues",value)}else{t
his.splice("selectedValues",i,1)}},_valuesToItems:function(values){return values
==null?null:values.map(function(value){return this._valueToItem(value)},this)}};
Polymer.IronMultiSelectableBehavior=[Polymer.IronSelectableBehavior,Polymer.Iron
MultiSelectableBehaviorImpl];Polymer.IronMenuBehaviorImpl={properties:{focusedIt
em:{observer:"_focusedItemChanged",readOnly:true,type:Object},attrForItemTitle:{
type:String}},hostAttributes:{role:"menu",tabindex:"0"},observers:["_updateMulti
selectable(multi)"],listeners:{focus:"_onFocus",keydown:"_onKeydown","iron-items
-changed":"_onIronItemsChanged"},keyBindings:{up:"_onUpKey",down:"_onDownKey",es
c:"_onEscKey","shift+tab:keydown":"_onShiftTabDown"},attached:function(){this._r
esetTabindices()},select:function(value){if(this._defaultFocusAsync){this.cancel
Async(this._defaultFocusAsync);this._defaultFocusAsync=null}var item=this._value
ToItem(value);if(item&&item.hasAttribute("disabled"))return;this._setFocusedItem
(item);Polymer.IronMultiSelectableBehaviorImpl.select.apply(this,arguments)},_re
setTabindices:function(){var selectedItem=this.multi?this.selectedItems&&this.se
lectedItems[0]:this.selectedItem;this.items.forEach(function(item){item.setAttri
bute("tabindex",item===selectedItem?"0":"-1")},this)},_updateMultiselectable:fun
ction(multi){if(multi){this.setAttribute("aria-multiselectable","true")}else{thi
s.removeAttribute("aria-multiselectable")}},_focusWithKeyboardEvent:function(eve
nt){for(var i=0,item;item=this.items[i];i++){var attr=this.attrForItemTitle||"te
xtContent";var title=item[attr]||item.getAttribute(attr);if(!item.hasAttribute("
disabled")&&title&&title.trim().charAt(0).toLowerCase()===String.fromCharCode(ev
ent.keyCode).toLowerCase()){this._setFocusedItem(item);break}}},_focusPrevious:f
unction(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(thi
s.focusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex-i
+length)%length];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).
getOwnerRoot()||document;this._setFocusedItem(item);if(Polymer.dom(owner).active
Element==item){return}}}},_focusNext:function(){var length=this.items.length;var
curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i++
){var item=this.items[(curFocusIndex+i)%length];if(!item.hasAttribute("disabled"
)){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocusedItem(ite
m);if(Polymer.dom(owner).activeElement==item){return}}}},_applySelection:functio
n(item,isSelected){if(isSelected){item.setAttribute("aria-selected","true")}else
{item.removeAttribute("aria-selected")}Polymer.IronSelectableBehavior._applySele
ction.apply(this,arguments)},_focusedItemChanged:function(focusedItem,old){old&&
old.setAttribute("tabindex","-1");if(focusedItem){focusedItem.setAttribute("tabi
ndex","0");focusedItem.focus()}},_onIronItemsChanged:function(event){if(event.de
tail.addedNodes.length){this._resetTabindices()}},_onShiftTabDown:function(event
){var oldTabIndex=this.getAttribute("tabindex");Polymer.IronMenuBehaviorImpl._sh
iftTabPressed=true;this._setFocusedItem(null);this.setAttribute("tabindex","-1")
;this.async(function(){this.setAttribute("tabindex",oldTabIndex);Polymer.IronMen
uBehaviorImpl._shiftTabPressed=false},1)},_onFocus:function(event){if(Polymer.Ir
onMenuBehaviorImpl._shiftTabPressed){return}var rootTarget=Polymer.dom(event).ro
otTarget;if(rootTarget!==this&&typeof rootTarget.tabIndex!=="undefined"&&!this.i
sLightDescendant(rootTarget)){return}this._defaultFocusAsync=this.async(function
(){var selectedItem=this.multi?this.selectedItems&&this.selectedItems[0]:this.se
lectedItem;this._setFocusedItem(null);if(selectedItem){this._setFocusedItem(sele
ctedItem)}else if(this.items[0]){this._focusNext()}})},_onUpKey:function(event){
this._focusPrevious();event.detail.keyboardEvent.preventDefault()},_onDownKey:fu
nction(event){this._focusNext();event.detail.keyboardEvent.preventDefault()},_on
EscKey:function(event){this.focusedItem.blur()},_onKeydown:function(event){if(!t
his.keyboardEventMatchesKeys(event,"up down esc")){this._focusWithKeyboardEvent(
event)}event.stopPropagation()},_activateHandler:function(event){Polymer.IronSel
ectableBehavior._activateHandler.call(this,event);event.stopPropagation()}};Poly
mer.IronMenuBehaviorImpl._shiftTabPressed=false;Polymer.IronMenuBehavior=[Polyme
r.IronMultiSelectableBehavior,Polymer.IronA11yKeysBehavior,Polymer.IronMenuBehav
iorImpl];(function(){Polymer({is:"paper-menu",behaviors:[Polymer.IronMenuBehavio
r]})})();Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,value:fu
nction(){return this}},fitInto:{type:Object,value:window},noOverlap:{type:Boolea
n},positionTarget:{type:Element},horizontalAlign:{type:String},verticalAlign:{ty
pe:String},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,not
ify:true},verticalOffset:{type:Number,value:0,notify:true},autoFitOnAttach:{type
:Boolean,value:false},_fitInfo:{type:Object}},get _fitWidth(){var fitWidth;if(th
is.fitInto===window){fitWidth=this.fitInto.innerWidth}else{fitWidth=this.fitInto
.getBoundingClientRect().width}return fitWidth},get _fitHeight(){var fitHeight;i
f(this.fitInto===window){fitHeight=this.fitInto.innerHeight}else{fitHeight=this.
fitInto.getBoundingClientRect().height}return fitHeight},get _fitLeft(){var fitL
eft;if(this.fitInto===window){fitLeft=0}else{fitLeft=this.fitInto.getBoundingCli
entRect().left}return fitLeft},get _fitTop(){var fitTop;if(this.fitInto===window
){fitTop=0}else{fitTop=this.fitInto.getBoundingClientRect().top}return fitTop},g
et _defaultPositionTarget(){var parent=Polymer.dom(this).parentNode;if(parent&&p
arent.nodeType===Node.DOCUMENT_FRAGMENT_NODE){parent=parent.host}return parent},
get _localeHorizontalAlign(){if(this._isRTL){if(this.horizontalAlign==="right"){
return"left"}if(this.horizontalAlign==="left"){return"right"}}return this.horizo
ntalAlign},attached:function(){this._isRTL=window.getComputedStyle(this).directi
on=="rtl";this.positionTarget=this.positionTarget||this._defaultPositionTarget;i
f(this.autoFitOnAttach){if(window.getComputedStyle(this).display==="none"){setTi
meout(function(){this.fit()}.bind(this))}else{this.fit()}}},fit:function(){this.
position();this.constrain();this.center()},_discoverInfo:function(){if(this._fit
Info){return}var target=window.getComputedStyle(this);var sizer=window.getComput
edStyle(this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top||"",le
ft:this.style.left||"",position:this.style.position||""},sizerInlineStyle:{maxWi
dth:this.sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHe
ight||"",boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{vertical
ly:target.top!=="auto"?"top":target.bottom!=="auto"?"bottom":null,horizontally:t
arget.left!=="auto"?"left":target.right!=="auto"?"right":null},sizedBy:{height:s
izer.maxHeight!=="none",width:sizer.maxWidth!=="none",minWidth:parseInt(sizer.mi
nWidth,10)||0,minHeight:parseInt(sizer.minHeight,10)||0},margin:{top:parseInt(ta
rget.marginTop,10)||0,right:parseInt(target.marginRight,10)||0,bottom:parseInt(t
arget.marginBottom,10)||0,left:parseInt(target.marginLeft,10)||0}};if(this.verti
calOffset){this._fitInfo.margin.top=this._fitInfo.margin.bottom=this.verticalOff
set;this._fitInfo.inlineStyle.marginTop=this.style.marginTop||"";this._fitInfo.i
nlineStyle.marginBottom=this.style.marginBottom||"";this.style.marginTop=this.st
yle.marginBottom=this.verticalOffset+"px"}if(this.horizontalOffset){this._fitInf
o.margin.left=this._fitInfo.margin.right=this.horizontalOffset;this._fitInfo.inl
ineStyle.marginLeft=this.style.marginLeft||"";this._fitInfo.inlineStyle.marginRi
ght=this.style.marginRight||"";this.style.marginLeft=this.style.marginRight=this
.horizontalOffset+"px"}},resetFit:function(){var info=this._fitInfo||{};for(var
property in info.sizerInlineStyle){this.sizingTarget.style[property]=info.sizerI
nlineStyle[property]}for(var property in info.inlineStyle){this.style[property]=
info.inlineStyle[property]}this._fitInfo=null},refit:function(){var scrollLeft=t
his.sizingTarget.scrollLeft;var scrollTop=this.sizingTarget.scrollTop;this.reset
Fit();this.fit();this.sizingTarget.scrollLeft=scrollLeft;this.sizingTarget.scrol
lTop=scrollTop},position:function(){if(!this.horizontalAlign&&!this.verticalAlig
n){return}this._discoverInfo();this.style.position="fixed";this.sizingTarget.sty
le.boxSizing="border-box";this.style.left="0px";this.style.top="0px";var rect=th
is.getBoundingClientRect();var positionRect=this.__getNormalizedRect(this.positi
onTarget);var fitRect=this.__getNormalizedRect(this.fitInto);var margin=this._fi
tInfo.margin;var size={width:rect.width+margin.left+margin.right,height:rect.hei
ght+margin.top+margin.bottom};var position=this.__getPosition(this._localeHorizo
ntalAlign,this.verticalAlign,size,positionRect,fitRect);var left=position.left+m
argin.left;var top=position.top+margin.top;var right=Math.min(fitRect.right-marg
in.right,left+rect.width);var bottom=Math.min(fitRect.bottom-margin.bottom,top+r
ect.height);var minWidth=this._fitInfo.sizedBy.minWidth;var minHeight=this._fitI
nfo.sizedBy.minHeight;if(left<margin.left){left=margin.left;if(right-left<minWid
th){left=right-minWidth}}if(top<margin.top){top=margin.top;if(bottom-top<minHeig
ht){top=bottom-minHeight}}this.sizingTarget.style.maxWidth=right-left+"px";this.
sizingTarget.style.maxHeight=bottom-top+"px";this.style.left=left-rect.left+"px"
;this.style.top=top-rect.top+"px"},constrain:function(){if(this.horizontalAlign|
|this.verticalAlign){return}this._discoverInfo();var info=this._fitInfo;if(!info
.positionedBy.vertically){this.style.position="fixed";this.style.top="0px"}if(!i
nfo.positionedBy.horizontally){this.style.position="fixed";this.style.left="0px"
}this.sizingTarget.style.boxSizing="border-box";var rect=this.getBoundingClientR
ect();if(!info.sizedBy.height){this.__sizeDimension(rect,info.positionedBy.verti
cally,"top","bottom","Height")}if(!info.sizedBy.width){this.__sizeDimension(rect
,info.positionedBy.horizontally,"left","right","Width")}},_sizeDimension:functio
n(rect,positionedBy,start,end,extent){this.__sizeDimension(rect,positionedBy,sta
rt,end,extent)},__sizeDimension:function(rect,positionedBy,start,end,extent){var
info=this._fitInfo;var fitRect=this.__getNormalizedRect(this.fitInto);var max=e
xtent==="Width"?fitRect.width:fitRect.height;var flip=positionedBy===end;var off
set=flip?max-rect[end]:rect[start];var margin=info.margin[flip?start:end];var of
fsetExtent="offset"+extent;var sizingOffset=this[offsetExtent]-this.sizingTarget
[offsetExtent];this.sizingTarget.style["max"+extent]=max-margin-offset-sizingOff
set+"px"},center:function(){if(this.horizontalAlign||this.verticalAlign){return}
this._discoverInfo();var positionedBy=this._fitInfo.positionedBy;if(positionedBy
.vertically&&positionedBy.horizontally){return}this.style.position="fixed";if(!p
ositionedBy.vertically){this.style.top="0px"}if(!positionedBy.horizontally){this
.style.left="0px"}var rect=this.getBoundingClientRect();var fitRect=this.__getNo
rmalizedRect(this.fitInto);if(!positionedBy.vertically){var top=fitRect.top-rect
.top+(fitRect.height-rect.height)/2;this.style.top=top+"px"}if(!positionedBy.hor
izontally){var left=fitRect.left-rect.left+(fitRect.width-rect.width)/2;this.sty
le.left=left+"px"}},__getNormalizedRect:function(target){if(target===document.do
cumentElement||target===window){return{top:0,left:0,width:window.innerWidth,heig
ht:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}}return
target.getBoundingClientRect()},__getCroppedArea:function(position,size,fitRect)
{var verticalCrop=Math.min(0,position.top)+Math.min(0,fitRect.bottom-(position.t
op+size.height));var horizontalCrop=Math.min(0,position.left)+Math.min(0,fitRect
.right-(position.left+size.width));return Math.abs(verticalCrop)*size.width+Math
.abs(horizontalCrop)*size.height},__getPosition:function(hAlign,vAlign,size,posi
tionRect,fitRect){var positions=[{verticalAlign:"top",horizontalAlign:"left",top
:positionRect.top,left:positionRect.left},{verticalAlign:"top",horizontalAlign:"
right",top:positionRect.top,left:positionRect.right-size.width},{verticalAlign:"
bottom",horizontalAlign:"left",top:positionRect.bottom-size.height,left:position
Rect.left},{verticalAlign:"bottom",horizontalAlign:"right",top:positionRect.bott
om-size.height,left:positionRect.right-size.width}];if(this.noOverlap){for(var i
=0,l=positions.length;i<l;i++){var copy={};for(var key in positions[i]){copy[key
]=positions[i][key]}positions.push(copy)}positions[0].top=positions[1].top+=posi
tionRect.height;positions[2].top=positions[3].top-=positionRect.height;positions
[4].left=positions[6].left+=positionRect.width;positions[5].left=positions[7].le
ft-=positionRect.width}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign==="auto"
?null:hAlign;var position;for(var i=0;i<positions.length;i++){var pos=positions[
i];if(!this.dynamicAlign&&!this.noOverlap&&pos.verticalAlign===vAlign&&pos.horiz
ontalAlign===hAlign){position=pos;break}var alignOk=(!vAlign||pos.verticalAlign=
==vAlign)&&(!hAlign||pos.horizontalAlign===hAlign);if(!this.dynamicAlign&&!align
Ok){continue}position=position||pos;pos.croppedArea=this.__getCroppedArea(pos,si
ze,fitRect);var diff=pos.croppedArea-position.croppedArea;if(diff<0||diff===0&&a
lignOk){position=pos}if(position.croppedArea===0&&alignOk){break}}return positio
n}};(function(){"use strict";Polymer({is:"iron-overlay-backdrop",properties:{ope
ned:{reflectToAttribute:true,type:Boolean,value:false,observer:"_openedChanged"}
},listeners:{transitionend:"_onTransitionend"},created:function(){this.__openedR
af=null},attached:function(){this.opened&&this._openedChanged(this.opened)},prep
are:function(){if(this.opened&&!this.parentNode){Polymer.dom(document.body).appe
ndChild(this)}},open:function(){this.opened=true},close:function(){this.opened=f
alse},complete:function(){if(!this.opened&&this.parentNode===document.body){Poly
mer.dom(this.parentNode).removeChild(this)}},_onTransitionend:function(event){if
(event&&event.target===this){this.complete()}},_openedChanged:function(opened){i
f(opened){this.prepare()}else{var cs=window.getComputedStyle(this);if(cs.transit
ionDuration==="0s"||cs.opacity==0){this.complete()}}if(!this.isAttached){return}
if(this.__openedRaf){window.cancelAnimationFrame(this.__openedRaf);this.__opened
Raf=null}this.scrollTop=this.scrollTop;this.__openedRaf=window.requestAnimationF
rame(function(){this.__openedRaf=null;this.toggleClass("opened",this.opened)}.bi
nd(this))}})})();Polymer.IronOverlayManagerClass=function(){this._overlays=[];th
is._minimumZ=101;this._backdropElement=null;Polymer.Gestures.add(document,"tap",
this._onCaptureClick.bind(this));document.addEventListener("focus",this._onCaptu
reFocus.bind(this),true);document.addEventListener("keydown",this._onCaptureKeyD
own.bind(this),true)};Polymer.IronOverlayManagerClass.prototype={constructor:Pol
ymer.IronOverlayManagerClass,get backdropElement(){if(!this._backdropElement){th
is._backdropElement=document.createElement("iron-overlay-backdrop")}return this.
_backdropElement},get deepActiveElement(){var active=document.activeElement||doc
ument.body;while(active.root&&Polymer.dom(active.root).activeElement){active=Pol
ymer.dom(active.root).activeElement}return active},_bringOverlayAtIndexToFront:f
unction(i){var overlay=this._overlays[i];if(!overlay){return}var lastI=this._ove
rlays.length-1;var currentOverlay=this._overlays[lastI];if(currentOverlay&&this.
_shouldBeBehindOverlay(overlay,currentOverlay)){lastI--}if(i>=lastI){return}var
minimumZ=Math.max(this.currentOverlayZ(),this._minimumZ);if(this._getZ(overlay)<
=minimumZ){this._applyOverlayZ(overlay,minimumZ)}while(i<lastI){this._overlays[i
]=this._overlays[i+1];i++}this._overlays[lastI]=overlay},addOrRemoveOverlay:func
tion(overlay){if(overlay.opened){this.addOverlay(overlay)}else{this.removeOverla
y(overlay)}},addOverlay:function(overlay){var i=this._overlays.indexOf(overlay);
if(i>=0){this._bringOverlayAtIndexToFront(i);this.trackBackdrop();return}var ins
ertionIndex=this._overlays.length;var currentOverlay=this._overlays[insertionInd
ex-1];var minimumZ=Math.max(this._getZ(currentOverlay),this._minimumZ);var newZ=
this._getZ(overlay);if(currentOverlay&&this._shouldBeBehindOverlay(overlay,curre
ntOverlay)){this._applyOverlayZ(currentOverlay,minimumZ);insertionIndex--;var pr
eviousOverlay=this._overlays[insertionIndex-1];minimumZ=Math.max(this._getZ(prev
iousOverlay),this._minimumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overlay,mini
mumZ)}this._overlays.splice(insertionIndex,0,overlay);this.trackBackdrop()},remo
veOverlay:function(overlay){var i=this._overlays.indexOf(overlay);if(i===-1){ret
urn}this._overlays.splice(i,1);this.trackBackdrop()},currentOverlay:function(){v
ar i=this._overlays.length-1;return this._overlays[i]},currentOverlayZ:function(
){return this._getZ(this.currentOverlay())},ensureMinimumZ:function(minimumZ){th
is._minimumZ=Math.max(this._minimumZ,minimumZ)},focusOverlay:function(){var curr
ent=this.currentOverlay();if(current){current._applyFocus()}},trackBackdrop:func
tion(){var overlay=this._overlayWithBackdrop();if(!overlay&&!this._backdropEleme
nt){return}this.backdropElement.style.zIndex=this._getZ(overlay)-1;this.backdrop
Element.opened=!!overlay},getBackdrops:function(){var backdrops=[];for(var i=0;i
<this._overlays.length;i++){if(this._overlays[i].withBackdrop){backdrops.push(th
is._overlays[i])}}return backdrops},backdropZ:function(){return this._getZ(this.
_overlayWithBackdrop())-1},_overlayWithBackdrop:function(){for(var i=0;i<this._o
verlays.length;i++){if(this._overlays[i].withBackdrop){return this._overlays[i]}
}},_getZ:function(overlay){var z=this._minimumZ;if(overlay){var z1=Number(overla
y.style.zIndex||window.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1}}retur
n z},_setZ:function(element,z){element.style.zIndex=z},_applyOverlayZ:function(o
verlay,aboveZ){this._setZ(overlay,aboveZ+2)},_overlayInPath:function(path){path=
path||[];for(var i=0;i<path.length;i++){if(path[i]._manager===this){return path[
i]}}},_onCaptureClick:function(event){var overlay=this.currentOverlay();if(overl
ay&&this._overlayInPath(Polymer.dom(event).path)!==overlay){overlay._onCaptureCl
ick(event)}},_onCaptureFocus:function(event){var overlay=this.currentOverlay();i
f(overlay){overlay._onCaptureFocus(event)}},_onCaptureKeyDown:function(event){va
r overlay=this.currentOverlay();if(overlay){if(Polymer.IronA11yKeysBehavior.keyb
oardEventMatchesKeys(event,"esc")){overlay._onCaptureEsc(event)}else if(Polymer.
IronA11yKeysBehavior.keyboardEventMatchesKeys(event,"tab")){overlay._onCaptureTa
b(event)}}},_shouldBeBehindOverlay:function(overlay1,overlay2){return!overlay1.a
lwaysOnTop&&overlay2.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOv
erlayManagerClass;(function(){"use strict";Polymer.IronOverlayBehaviorImpl={prop
erties:{opened:{observer:"_openedChanged",type:Boolean,value:false,notify:true},
canceled:{ | 46 cr.define("downloads",function(){var Item=Polymer({is:"downloads-item",propertie
s:{data:{type:Object},completelyOnDisk_:{computed:"computeCompletelyOnDisk_("+"d
ata.state, data.file_externally_removed)",type:Boolean,value:true},controlledBy_
:{computed:"computeControlledBy_(data.by_ext_id, data.by_ext_name)",type:String,
value:""},isActive_:{computed:"computeIsActive_("+"data.state, data.file_externa
lly_removed)",type:Boolean,value:true},isDangerous_:{computed:"computeIsDangerou
s_(data.state)",type:Boolean,value:false},isMalware_:{computed:"computeIsMalware
_(isDangerous_, data.danger_type)",type:Boolean,value:false},isInProgress_:{comp
uted:"computeIsInProgress_(data.state)",type:Boolean,value:false},pauseOrResumeT
ext_:{computed:"computePauseOrResumeText_(isInProgress_, data.resume)",type:Stri
ng},showCancel_:{computed:"computeShowCancel_(data.state)",type:Boolean,value:fa
lse},showProgress_:{computed:"computeShowProgress_(showCancel_, data.percent)",t
ype:Boolean,value:false}},observers:["observeControlledBy_(controlledBy_)","obse
rveIsDangerous_(isDangerous_, data)"],ready:function(){this.content=this.$.conte
nt},chopUrl_:function(url){return url.slice(0,300)},computeClass_:function(){var
classes=[];if(this.isActive_)classes.push("is-active");if(this.isDangerous_)cla
sses.push("dangerous");if(this.showProgress_)classes.push("show-progress");retur
n classes.join(" ")},computeCompletelyOnDisk_:function(){return this.data.state=
=downloads.States.COMPLETE&&!this.data.file_externally_removed},computeControlle
dBy_:function(){if(!this.data.by_ext_id||!this.data.by_ext_name)return"";var url
="chrome://extensions#"+this.data.by_ext_id;var name=this.data.by_ext_name;retur
n loadTimeData.getStringF("controlledByUrl",url,name)},computeDangerIcon_:functi
on(){if(!this.isDangerous_)return"";switch(this.data.danger_type){case downloads
.DangerType.DANGEROUS_CONTENT:case downloads.DangerType.DANGEROUS_HOST:case down
loads.DangerType.DANGEROUS_URL:case downloads.DangerType.POTENTIALLY_UNWANTED:ca
se downloads.DangerType.UNCOMMON_CONTENT:return"downloads:remove-circle";default
:return"cr:warning"}},computeDate_:function(){assert(typeof this.data.hideDate==
"boolean");if(this.data.hideDate)return"";return assert(this.data.since_string||
this.data.date_string)},computeDescription_:function(){var data=this.data;switch
(data.state){case downloads.States.DANGEROUS:var fileName=data.file_name;switch(
data.danger_type){case downloads.DangerType.DANGEROUS_FILE:return loadTimeData.g
etString("dangerFileDesc");case downloads.DangerType.DANGEROUS_URL:case download
s.DangerType.DANGEROUS_CONTENT:case downloads.DangerType.DANGEROUS_HOST:return l
oadTimeData.getString("dangerDownloadDesc");case downloads.DangerType.UNCOMMON_C
ONTENT:return loadTimeData.getString("dangerUncommonDesc");case downloads.Danger
Type.POTENTIALLY_UNWANTED:return loadTimeData.getString("dangerSettingsDesc")}br
eak;case downloads.States.IN_PROGRESS:case downloads.States.PAUSED:return data.p
rogress_status_text}return""},computeIsActive_:function(){return this.data.state
!=downloads.States.CANCELLED&&this.data.state!=downloads.States.INTERRUPTED&&!th
is.data.file_externally_removed},computeIsDangerous_:function(){return this.data
.state==downloads.States.DANGEROUS},computeIsInProgress_:function(){return this.
data.state==downloads.States.IN_PROGRESS},computeIsMalware_:function(){return th
is.isDangerous_&&(this.data.danger_type==downloads.DangerType.DANGEROUS_CONTENT|
|this.data.danger_type==downloads.DangerType.DANGEROUS_HOST||this.data.danger_ty
pe==downloads.DangerType.DANGEROUS_URL||this.data.danger_type==downloads.DangerT
ype.POTENTIALLY_UNWANTED)},computePauseOrResumeText_:function(){if(this.isInProg
ress_)return loadTimeData.getString("controlPause");if(this.data.resume)return l
oadTimeData.getString("controlResume");return""},computeRemoveStyle_:function(){
var canDelete=loadTimeData.getBoolean("allowDeletingHistory");var hideRemove=thi
s.isDangerous_||this.showCancel_||!canDelete;return hideRemove?"visibility: hidd
en":""},computeShowCancel_:function(){return this.data.state==downloads.States.I
N_PROGRESS||this.data.state==downloads.States.PAUSED},computeShowProgress_:funct
ion(){return this.showCancel_&&this.data.percent>=-1},computeTag_:function(){swi
tch(this.data.state){case downloads.States.CANCELLED:return loadTimeData.getStri
ng("statusCancelled");case downloads.States.INTERRUPTED:return this.data.last_re
ason_text;case downloads.States.COMPLETE:return this.data.file_externally_remove
d?loadTimeData.getString("statusRemoved"):""}return""},isIndeterminate_:function
(){return this.data.percent==-1},observeControlledBy_:function(){this.$["control
led-by"].innerHTML=this.controlledBy_},observeIsDangerous_:function(){if(!this.d
ata)return;if(this.isDangerous_){this.$.url.removeAttribute("href")}else{this.$.
url.href=assert(this.data.url);var filePath=encodeURIComponent(this.data.file_pa
th);var scaleFactor="?scale="+window.devicePixelRatio+"x";this.$["file-icon"].sr
c="chrome://fileicon/"+filePath+scaleFactor}},onCancelTap_:function(){downloads.
ActionService.getInstance().cancel(this.data.id)},onDiscardDangerousTap_:functio
n(){downloads.ActionService.getInstance().discardDangerous(this.data.id)},onDrag
Start_:function(e){e.preventDefault();downloads.ActionService.getInstance().drag
(this.data.id)},onFileLinkTap_:function(e){e.preventDefault();downloads.ActionSe
rvice.getInstance().openFile(this.data.id)},onPauseOrResumeTap_:function(){if(th
is.isInProgress_)downloads.ActionService.getInstance().pause(this.data.id);else
downloads.ActionService.getInstance().resume(this.data.id)},onRemoveTap_:functio
n(){downloads.ActionService.getInstance().remove(this.data.id)},onRetryTap_:func
tion(){downloads.ActionService.getInstance().download(this.data.url)},onSaveDang
erousTap_:function(){downloads.ActionService.getInstance().saveDangerous(this.da
ta.id)},onShowTap_:function(){downloads.ActionService.getInstance().show(this.da
ta.id)}});return{Item:Item}});Polymer.PaperItemBehaviorImpl={hostAttributes:{rol
e:"option",tabindex:"0"}};Polymer.PaperItemBehavior=[Polymer.IronButtonState,Pol
ymer.IronControlState,Polymer.PaperItemBehaviorImpl];Polymer({is:"paper-item",be
haviors:[Polymer.PaperItemBehavior]});Polymer.IronSelection=function(selectCallb
ack){this.selection=[];this.selectCallback=selectCallback};Polymer.IronSelection
.prototype={get:function(){return this.multi?this.selection.slice():this.selecti
on[0]},clear:function(excludes){this.selection.slice().forEach(function(item){if
(!excludes||excludes.indexOf(item)<0){this.setItemSelected(item,false)}},this)},
isSelected:function(item){return this.selection.indexOf(item)>=0},setItemSelecte
d:function(item,isSelected){if(item!=null){if(isSelected!==this.isSelected(item)
){if(isSelected){this.selection.push(item)}else{var i=this.selection.indexOf(ite
m);if(i>=0){this.selection.splice(i,1)}}if(this.selectCallback){this.selectCallb
ack(item,isSelected)}}}},select:function(item){if(this.multi){this.toggle(item)}
else if(this.get()!==item){this.setItemSelected(this.get(),false);this.setItemSe
lected(item,true)}},toggle:function(item){this.setItemSelected(item,!this.isSele
cted(item))}};Polymer.IronSelectableBehavior={properties:{attrForSelected:{type:
String,value:null},selected:{type:String,notify:true},selectedItem:{type:Object,
readOnly:true,notify:true},activateEvent:{type:String,value:"tap",observer:"_act
ivateEventChanged"},selectable:String,selectedClass:{type:String,value:"iron-sel
ected"},selectedAttribute:{type:String,value:null},fallbackSelection:{type:Strin
g,value:null},items:{type:Array,readOnly:true,notify:true,value:function(){retur
n[]}},_excludedLocalNames:{type:Object,value:function(){return{template:1}}}},ob
servers:["_updateAttrForSelected(attrForSelected)","_updateSelected(selected)","
_checkFallback(fallbackSelection)"],created:function(){this._bindFilterItem=this
._filterItem.bind(this);this._selection=new Polymer.IronSelection(this._applySel
ection.bind(this))},attached:function(){this._observer=this._observeItems(this);
this._updateItems();if(!this._shouldUpdateSelection){this._updateSelected()}this
._addListener(this.activateEvent)},detached:function(){if(this._observer){Polyme
r.dom(this).unobserveNodes(this._observer)}this._removeListener(this.activateEve
nt)},indexOf:function(item){return this.items.indexOf(item)},select:function(val
ue){this.selected=value},selectPrevious:function(){var length=this.items.length;
var index=(Number(this._valueToIndex(this.selected))-1+length)%length;this.selec
ted=this._indexToValue(index)},selectNext:function(){var index=(Number(this._val
ueToIndex(this.selected))+1)%this.items.length;this.selected=this._indexToValue(
index)},selectIndex:function(index){this.select(this._indexToValue(index))},forc
eSynchronousItemUpdate:function(){this._updateItems()},get _shouldUpdateSelectio
n(){return this.selected!=null},_checkFallback:function(){if(this._shouldUpdateS
election){this._updateSelected()}},_addListener:function(eventName){this.listen(
this,eventName,"_activateHandler")},_removeListener:function(eventName){this.unl
isten(this,eventName,"_activateHandler")},_activateEventChanged:function(eventNa
me,old){this._removeListener(old);this._addListener(eventName)},_updateItems:fun
ction(){var nodes=Polymer.dom(this).queryDistributedElements(this.selectable||"*
");nodes=Array.prototype.filter.call(nodes,this._bindFilterItem);this._setItems(
nodes)},_updateAttrForSelected:function(){if(this._shouldUpdateSelection){this.s
elected=this._indexToValue(this.indexOf(this.selectedItem))}},_updateSelected:fu
nction(){this._selectSelected(this.selected)},_selectSelected:function(selected)
{this._selection.select(this._valueToItem(this.selected));if(this.fallbackSelect
ion&&this.items.length&&this._selection.get()===undefined){this.selected=this.fa
llbackSelection}},_filterItem:function(node){return!this._excludedLocalNames[nod
e.localName]},_valueToItem:function(value){return value==null?null:this.items[th
is._valueToIndex(value)]},_valueToIndex:function(value){if(this.attrForSelected)
{for(var i=0,item;item=this.items[i];i++){if(this._valueForItem(item)==value){re
turn i}}}else{return Number(value)}},_indexToValue:function(index){if(this.attrF
orSelected){var item=this.items[index];if(item){return this._valueForItem(item)}
}else{return index}},_valueForItem:function(item){var propValue=item[Polymer.Cas
eMap.dashToCamelCase(this.attrForSelected)];return propValue!=undefined?propValu
e:item.getAttribute(this.attrForSelected)},_applySelection:function(item,isSelec
ted){if(this.selectedClass){this.toggleClass(this.selectedClass,isSelected,item)
}if(this.selectedAttribute){this.toggleAttribute(this.selectedAttribute,isSelect
ed,item)}this._selectionChange();this.fire("iron-"+(isSelected?"select":"deselec
t"),{item:item})},_selectionChange:function(){this._setSelectedItem(this._select
ion.get())},_observeItems:function(node){return Polymer.dom(node).observeNodes(f
unction(mutation){this._updateItems();if(this._shouldUpdateSelection){this._upda
teSelected()}this.fire("iron-items-changed",mutation,{bubbles:false,cancelable:f
alse})})},_activateHandler:function(e){var t=e.target;var items=this.items;while
(t&&t!=this){var i=items.indexOf(t);if(i>=0){var value=this._indexToValue(i);thi
s._itemActivate(value,t);return}t=t.parentNode}},_itemActivate:function(value,it
em){if(!this.fire("iron-activate",{selected:value,item:item},{cancelable:true}).
defaultPrevented){this.select(value)}}};Polymer.IronMultiSelectableBehaviorImpl=
{properties:{multi:{type:Boolean,value:false,observer:"multiChanged"},selectedVa
lues:{type:Array,notify:true},selectedItems:{type:Array,readOnly:true,notify:tru
e}},observers:["_updateSelected(selectedValues.splices)"],select:function(value)
{if(this.multi){if(this.selectedValues){this._toggleSelected(value)}else{this.se
lectedValues=[value]}}else{this.selected=value}},multiChanged:function(multi){th
is._selection.multi=multi},get _shouldUpdateSelection(){return this.selected!=nu
ll||this.selectedValues!=null&&this.selectedValues.length},_updateAttrForSelecte
d:function(){if(!this.multi){Polymer.IronSelectableBehavior._updateAttrForSelect
ed.apply(this)}else if(this._shouldUpdateSelection){this.selectedValues=this.sel
ectedItems.map(function(selectedItem){return this._indexToValue(this.indexOf(sel
ectedItem))},this).filter(function(unfilteredValue){return unfilteredValue!=null
},this)}},_updateSelected:function(){if(this.multi){this._selectMulti(this.selec
tedValues)}else{this._selectSelected(this.selected)}},_selectMulti:function(valu
es){if(values){var selectedItems=this._valuesToItems(values);this._selection.cle
ar(selectedItems);for(var i=0;i<selectedItems.length;i++){this._selection.setIte
mSelected(selectedItems[i],true)}if(this.fallbackSelection&&this.items.length&&!
this._selection.get().length){var fallback=this._valueToItem(this.fallbackSelect
ion);if(fallback){this.selectedValues=[this.fallbackSelection]}}}else{this._sele
ction.clear()}},_selectionChange:function(){var s=this._selection.get();if(this.
multi){this._setSelectedItems(s)}else{this._setSelectedItems([s]);this._setSelec
tedItem(s)}},_toggleSelected:function(value){var i=this.selectedValues.indexOf(v
alue);var unselected=i<0;if(unselected){this.push("selectedValues",value)}else{t
his.splice("selectedValues",i,1)}},_valuesToItems:function(values){return values
==null?null:values.map(function(value){return this._valueToItem(value)},this)}};
Polymer.IronMultiSelectableBehavior=[Polymer.IronSelectableBehavior,Polymer.Iron
MultiSelectableBehaviorImpl];Polymer.IronMenuBehaviorImpl={properties:{focusedIt
em:{observer:"_focusedItemChanged",readOnly:true,type:Object},attrForItemTitle:{
type:String}},hostAttributes:{role:"menu",tabindex:"0"},observers:["_updateMulti
selectable(multi)"],listeners:{focus:"_onFocus",keydown:"_onKeydown","iron-items
-changed":"_onIronItemsChanged"},keyBindings:{up:"_onUpKey",down:"_onDownKey",es
c:"_onEscKey","shift+tab:keydown":"_onShiftTabDown"},attached:function(){this._r
esetTabindices()},select:function(value){if(this._defaultFocusAsync){this.cancel
Async(this._defaultFocusAsync);this._defaultFocusAsync=null}var item=this._value
ToItem(value);if(item&&item.hasAttribute("disabled"))return;this._setFocusedItem
(item);Polymer.IronMultiSelectableBehaviorImpl.select.apply(this,arguments)},_re
setTabindices:function(){var selectedItem=this.multi?this.selectedItems&&this.se
lectedItems[0]:this.selectedItem;this.items.forEach(function(item){item.setAttri
bute("tabindex",item===selectedItem?"0":"-1")},this)},_updateMultiselectable:fun
ction(multi){if(multi){this.setAttribute("aria-multiselectable","true")}else{thi
s.removeAttribute("aria-multiselectable")}},_focusWithKeyboardEvent:function(eve
nt){for(var i=0,item;item=this.items[i];i++){var attr=this.attrForItemTitle||"te
xtContent";var title=item[attr]||item.getAttribute(attr);if(!item.hasAttribute("
disabled")&&title&&title.trim().charAt(0).toLowerCase()===String.fromCharCode(ev
ent.keyCode).toLowerCase()){this._setFocusedItem(item);break}}},_focusPrevious:f
unction(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(thi
s.focusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex-i
+length)%length];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).
getOwnerRoot()||document;this._setFocusedItem(item);if(Polymer.dom(owner).active
Element==item){return}}}},_focusNext:function(){var length=this.items.length;var
curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i++
){var item=this.items[(curFocusIndex+i)%length];if(!item.hasAttribute("disabled"
)){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocusedItem(ite
m);if(Polymer.dom(owner).activeElement==item){return}}}},_applySelection:functio
n(item,isSelected){if(isSelected){item.setAttribute("aria-selected","true")}else
{item.removeAttribute("aria-selected")}Polymer.IronSelectableBehavior._applySele
ction.apply(this,arguments)},_focusedItemChanged:function(focusedItem,old){old&&
old.setAttribute("tabindex","-1");if(focusedItem){focusedItem.setAttribute("tabi
ndex","0");focusedItem.focus()}},_onIronItemsChanged:function(event){if(event.de
tail.addedNodes.length){this._resetTabindices()}},_onShiftTabDown:function(event
){var oldTabIndex=this.getAttribute("tabindex");Polymer.IronMenuBehaviorImpl._sh
iftTabPressed=true;this._setFocusedItem(null);this.setAttribute("tabindex","-1")
;this.async(function(){this.setAttribute("tabindex",oldTabIndex);Polymer.IronMen
uBehaviorImpl._shiftTabPressed=false},1)},_onFocus:function(event){if(Polymer.Ir
onMenuBehaviorImpl._shiftTabPressed){return}var rootTarget=Polymer.dom(event).ro
otTarget;if(rootTarget!==this&&typeof rootTarget.tabIndex!=="undefined"&&!this.i
sLightDescendant(rootTarget)){return}this._defaultFocusAsync=this.async(function
(){var selectedItem=this.multi?this.selectedItems&&this.selectedItems[0]:this.se
lectedItem;this._setFocusedItem(null);if(selectedItem){this._setFocusedItem(sele
ctedItem)}else if(this.items[0]){this._focusNext()}})},_onUpKey:function(event){
this._focusPrevious();event.detail.keyboardEvent.preventDefault()},_onDownKey:fu
nction(event){this._focusNext();event.detail.keyboardEvent.preventDefault()},_on
EscKey:function(event){this.focusedItem.blur()},_onKeydown:function(event){if(!t
his.keyboardEventMatchesKeys(event,"up down esc")){this._focusWithKeyboardEvent(
event)}event.stopPropagation()},_activateHandler:function(event){Polymer.IronSel
ectableBehavior._activateHandler.call(this,event);event.stopPropagation()}};Poly
mer.IronMenuBehaviorImpl._shiftTabPressed=false;Polymer.IronMenuBehavior=[Polyme
r.IronMultiSelectableBehavior,Polymer.IronA11yKeysBehavior,Polymer.IronMenuBehav
iorImpl];(function(){Polymer({is:"paper-menu",behaviors:[Polymer.IronMenuBehavio
r]})})();Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,value:fu
nction(){return this}},fitInto:{type:Object,value:window},noOverlap:{type:Boolea
n},positionTarget:{type:Element},horizontalAlign:{type:String},verticalAlign:{ty
pe:String},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,not
ify:true},verticalOffset:{type:Number,value:0,notify:true},autoFitOnAttach:{type
:Boolean,value:false},_fitInfo:{type:Object}},get _fitWidth(){var fitWidth;if(th
is.fitInto===window){fitWidth=this.fitInto.innerWidth}else{fitWidth=this.fitInto
.getBoundingClientRect().width}return fitWidth},get _fitHeight(){var fitHeight;i
f(this.fitInto===window){fitHeight=this.fitInto.innerHeight}else{fitHeight=this.
fitInto.getBoundingClientRect().height}return fitHeight},get _fitLeft(){var fitL
eft;if(this.fitInto===window){fitLeft=0}else{fitLeft=this.fitInto.getBoundingCli
entRect().left}return fitLeft},get _fitTop(){var fitTop;if(this.fitInto===window
){fitTop=0}else{fitTop=this.fitInto.getBoundingClientRect().top}return fitTop},g
et _defaultPositionTarget(){var parent=Polymer.dom(this).parentNode;if(parent&&p
arent.nodeType===Node.DOCUMENT_FRAGMENT_NODE){parent=parent.host}return parent},
get _localeHorizontalAlign(){if(this._isRTL){if(this.horizontalAlign==="right"){
return"left"}if(this.horizontalAlign==="left"){return"right"}}return this.horizo
ntalAlign},attached:function(){this._isRTL=window.getComputedStyle(this).directi
on=="rtl";this.positionTarget=this.positionTarget||this._defaultPositionTarget;i
f(this.autoFitOnAttach){if(window.getComputedStyle(this).display==="none"){setTi
meout(function(){this.fit()}.bind(this))}else{this.fit()}}},fit:function(){this.
position();this.constrain();this.center()},_discoverInfo:function(){if(this._fit
Info){return}var target=window.getComputedStyle(this);var sizer=window.getComput
edStyle(this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top||"",le
ft:this.style.left||"",position:this.style.position||""},sizerInlineStyle:{maxWi
dth:this.sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHe
ight||"",boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{vertical
ly:target.top!=="auto"?"top":target.bottom!=="auto"?"bottom":null,horizontally:t
arget.left!=="auto"?"left":target.right!=="auto"?"right":null},sizedBy:{height:s
izer.maxHeight!=="none",width:sizer.maxWidth!=="none",minWidth:parseInt(sizer.mi
nWidth,10)||0,minHeight:parseInt(sizer.minHeight,10)||0},margin:{top:parseInt(ta
rget.marginTop,10)||0,right:parseInt(target.marginRight,10)||0,bottom:parseInt(t
arget.marginBottom,10)||0,left:parseInt(target.marginLeft,10)||0}};if(this.verti
calOffset){this._fitInfo.margin.top=this._fitInfo.margin.bottom=this.verticalOff
set;this._fitInfo.inlineStyle.marginTop=this.style.marginTop||"";this._fitInfo.i
nlineStyle.marginBottom=this.style.marginBottom||"";this.style.marginTop=this.st
yle.marginBottom=this.verticalOffset+"px"}if(this.horizontalOffset){this._fitInf
o.margin.left=this._fitInfo.margin.right=this.horizontalOffset;this._fitInfo.inl
ineStyle.marginLeft=this.style.marginLeft||"";this._fitInfo.inlineStyle.marginRi
ght=this.style.marginRight||"";this.style.marginLeft=this.style.marginRight=this
.horizontalOffset+"px"}},resetFit:function(){var info=this._fitInfo||{};for(var
property in info.sizerInlineStyle){this.sizingTarget.style[property]=info.sizerI
nlineStyle[property]}for(var property in info.inlineStyle){this.style[property]=
info.inlineStyle[property]}this._fitInfo=null},refit:function(){var scrollLeft=t
his.sizingTarget.scrollLeft;var scrollTop=this.sizingTarget.scrollTop;this.reset
Fit();this.fit();this.sizingTarget.scrollLeft=scrollLeft;this.sizingTarget.scrol
lTop=scrollTop},position:function(){if(!this.horizontalAlign&&!this.verticalAlig
n){return}this._discoverInfo();this.style.position="fixed";this.sizingTarget.sty
le.boxSizing="border-box";this.style.left="0px";this.style.top="0px";var rect=th
is.getBoundingClientRect();var positionRect=this.__getNormalizedRect(this.positi
onTarget);var fitRect=this.__getNormalizedRect(this.fitInto);var margin=this._fi
tInfo.margin;var size={width:rect.width+margin.left+margin.right,height:rect.hei
ght+margin.top+margin.bottom};var position=this.__getPosition(this._localeHorizo
ntalAlign,this.verticalAlign,size,positionRect,fitRect);var left=position.left+m
argin.left;var top=position.top+margin.top;var right=Math.min(fitRect.right-marg
in.right,left+rect.width);var bottom=Math.min(fitRect.bottom-margin.bottom,top+r
ect.height);var minWidth=this._fitInfo.sizedBy.minWidth;var minHeight=this._fitI
nfo.sizedBy.minHeight;if(left<margin.left){left=margin.left;if(right-left<minWid
th){left=right-minWidth}}if(top<margin.top){top=margin.top;if(bottom-top<minHeig
ht){top=bottom-minHeight}}this.sizingTarget.style.maxWidth=right-left+"px";this.
sizingTarget.style.maxHeight=bottom-top+"px";this.style.left=left-rect.left+"px"
;this.style.top=top-rect.top+"px"},constrain:function(){if(this.horizontalAlign|
|this.verticalAlign){return}this._discoverInfo();var info=this._fitInfo;if(!info
.positionedBy.vertically){this.style.position="fixed";this.style.top="0px"}if(!i
nfo.positionedBy.horizontally){this.style.position="fixed";this.style.left="0px"
}this.sizingTarget.style.boxSizing="border-box";var rect=this.getBoundingClientR
ect();if(!info.sizedBy.height){this.__sizeDimension(rect,info.positionedBy.verti
cally,"top","bottom","Height")}if(!info.sizedBy.width){this.__sizeDimension(rect
,info.positionedBy.horizontally,"left","right","Width")}},_sizeDimension:functio
n(rect,positionedBy,start,end,extent){this.__sizeDimension(rect,positionedBy,sta
rt,end,extent)},__sizeDimension:function(rect,positionedBy,start,end,extent){var
info=this._fitInfo;var fitRect=this.__getNormalizedRect(this.fitInto);var max=e
xtent==="Width"?fitRect.width:fitRect.height;var flip=positionedBy===end;var off
set=flip?max-rect[end]:rect[start];var margin=info.margin[flip?start:end];var of
fsetExtent="offset"+extent;var sizingOffset=this[offsetExtent]-this.sizingTarget
[offsetExtent];this.sizingTarget.style["max"+extent]=max-margin-offset-sizingOff
set+"px"},center:function(){if(this.horizontalAlign||this.verticalAlign){return}
this._discoverInfo();var positionedBy=this._fitInfo.positionedBy;if(positionedBy
.vertically&&positionedBy.horizontally){return}this.style.position="fixed";if(!p
ositionedBy.vertically){this.style.top="0px"}if(!positionedBy.horizontally){this
.style.left="0px"}var rect=this.getBoundingClientRect();var fitRect=this.__getNo
rmalizedRect(this.fitInto);if(!positionedBy.vertically){var top=fitRect.top-rect
.top+(fitRect.height-rect.height)/2;this.style.top=top+"px"}if(!positionedBy.hor
izontally){var left=fitRect.left-rect.left+(fitRect.width-rect.width)/2;this.sty
le.left=left+"px"}},__getNormalizedRect:function(target){if(target===document.do
cumentElement||target===window){return{top:0,left:0,width:window.innerWidth,heig
ht:window.innerHeight,right:window.innerWidth,bottom:window.innerHeight}}return
target.getBoundingClientRect()},__getCroppedArea:function(position,size,fitRect)
{var verticalCrop=Math.min(0,position.top)+Math.min(0,fitRect.bottom-(position.t
op+size.height));var horizontalCrop=Math.min(0,position.left)+Math.min(0,fitRect
.right-(position.left+size.width));return Math.abs(verticalCrop)*size.width+Math
.abs(horizontalCrop)*size.height},__getPosition:function(hAlign,vAlign,size,posi
tionRect,fitRect){var positions=[{verticalAlign:"top",horizontalAlign:"left",top
:positionRect.top,left:positionRect.left},{verticalAlign:"top",horizontalAlign:"
right",top:positionRect.top,left:positionRect.right-size.width},{verticalAlign:"
bottom",horizontalAlign:"left",top:positionRect.bottom-size.height,left:position
Rect.left},{verticalAlign:"bottom",horizontalAlign:"right",top:positionRect.bott
om-size.height,left:positionRect.right-size.width}];if(this.noOverlap){for(var i
=0,l=positions.length;i<l;i++){var copy={};for(var key in positions[i]){copy[key
]=positions[i][key]}positions.push(copy)}positions[0].top=positions[1].top+=posi
tionRect.height;positions[2].top=positions[3].top-=positionRect.height;positions
[4].left=positions[6].left+=positionRect.width;positions[5].left=positions[7].le
ft-=positionRect.width}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign==="auto"
?null:hAlign;var position;for(var i=0;i<positions.length;i++){var pos=positions[
i];if(!this.dynamicAlign&&!this.noOverlap&&pos.verticalAlign===vAlign&&pos.horiz
ontalAlign===hAlign){position=pos;break}var alignOk=(!vAlign||pos.verticalAlign=
==vAlign)&&(!hAlign||pos.horizontalAlign===hAlign);if(!this.dynamicAlign&&!align
Ok){continue}position=position||pos;pos.croppedArea=this.__getCroppedArea(pos,si
ze,fitRect);var diff=pos.croppedArea-position.croppedArea;if(diff<0||diff===0&&a
lignOk){position=pos}if(position.croppedArea===0&&alignOk){break}}return positio
n}};(function(){"use strict";Polymer({is:"iron-overlay-backdrop",properties:{ope
ned:{reflectToAttribute:true,type:Boolean,value:false,observer:"_openedChanged"}
},listeners:{transitionend:"_onTransitionend"},created:function(){this.__openedR
af=null},attached:function(){this.opened&&this._openedChanged(this.opened)},prep
are:function(){if(this.opened&&!this.parentNode){Polymer.dom(document.body).appe
ndChild(this)}},open:function(){this.opened=true},close:function(){this.opened=f
alse},complete:function(){if(!this.opened&&this.parentNode===document.body){Poly
mer.dom(this.parentNode).removeChild(this)}},_onTransitionend:function(event){if
(event&&event.target===this){this.complete()}},_openedChanged:function(opened){i
f(opened){this.prepare()}else{var cs=window.getComputedStyle(this);if(cs.transit
ionDuration==="0s"||cs.opacity==0){this.complete()}}if(!this.isAttached){return}
if(this.__openedRaf){window.cancelAnimationFrame(this.__openedRaf);this.__opened
Raf=null}this.scrollTop=this.scrollTop;this.__openedRaf=window.requestAnimationF
rame(function(){this.__openedRaf=null;this.toggleClass("opened",this.opened)}.bi
nd(this))}})})();Polymer.IronOverlayManagerClass=function(){this._overlays=[];th
is._minimumZ=101;this._backdropElement=null;Polymer.Gestures.add(document,"tap",
this._onCaptureClick.bind(this));document.addEventListener("focus",this._onCaptu
reFocus.bind(this),true);document.addEventListener("keydown",this._onCaptureKeyD
own.bind(this),true)};Polymer.IronOverlayManagerClass.prototype={constructor:Pol
ymer.IronOverlayManagerClass,get backdropElement(){if(!this._backdropElement){th
is._backdropElement=document.createElement("iron-overlay-backdrop")}return this.
_backdropElement},get deepActiveElement(){var active=document.activeElement||doc
ument.body;while(active.root&&Polymer.dom(active.root).activeElement){active=Pol
ymer.dom(active.root).activeElement}return active},_bringOverlayAtIndexToFront:f
unction(i){var overlay=this._overlays[i];if(!overlay){return}var lastI=this._ove
rlays.length-1;var currentOverlay=this._overlays[lastI];if(currentOverlay&&this.
_shouldBeBehindOverlay(overlay,currentOverlay)){lastI--}if(i>=lastI){return}var
minimumZ=Math.max(this.currentOverlayZ(),this._minimumZ);if(this._getZ(overlay)<
=minimumZ){this._applyOverlayZ(overlay,minimumZ)}while(i<lastI){this._overlays[i
]=this._overlays[i+1];i++}this._overlays[lastI]=overlay},addOrRemoveOverlay:func
tion(overlay){if(overlay.opened){this.addOverlay(overlay)}else{this.removeOverla
y(overlay)}},addOverlay:function(overlay){var i=this._overlays.indexOf(overlay);
if(i>=0){this._bringOverlayAtIndexToFront(i);this.trackBackdrop();return}var ins
ertionIndex=this._overlays.length;var currentOverlay=this._overlays[insertionInd
ex-1];var minimumZ=Math.max(this._getZ(currentOverlay),this._minimumZ);var newZ=
this._getZ(overlay);if(currentOverlay&&this._shouldBeBehindOverlay(overlay,curre
ntOverlay)){this._applyOverlayZ(currentOverlay,minimumZ);insertionIndex--;var pr
eviousOverlay=this._overlays[insertionIndex-1];minimumZ=Math.max(this._getZ(prev
iousOverlay),this._minimumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overlay,mini
mumZ)}this._overlays.splice(insertionIndex,0,overlay);this.trackBackdrop()},remo
veOverlay:function(overlay){var i=this._overlays.indexOf(overlay);if(i===-1){ret
urn}this._overlays.splice(i,1);this.trackBackdrop()},currentOverlay:function(){v
ar i=this._overlays.length-1;return this._overlays[i]},currentOverlayZ:function(
){return this._getZ(this.currentOverlay())},ensureMinimumZ:function(minimumZ){th
is._minimumZ=Math.max(this._minimumZ,minimumZ)},focusOverlay:function(){var curr
ent=this.currentOverlay();if(current){current._applyFocus()}},trackBackdrop:func
tion(){var overlay=this._overlayWithBackdrop();if(!overlay&&!this._backdropEleme
nt){return}this.backdropElement.style.zIndex=this._getZ(overlay)-1;this.backdrop
Element.opened=!!overlay},getBackdrops:function(){var backdrops=[];for(var i=0;i
<this._overlays.length;i++){if(this._overlays[i].withBackdrop){backdrops.push(th
is._overlays[i])}}return backdrops},backdropZ:function(){return this._getZ(this.
_overlayWithBackdrop())-1},_overlayWithBackdrop:function(){for(var i=0;i<this._o
verlays.length;i++){if(this._overlays[i].withBackdrop){return this._overlays[i]}
}},_getZ:function(overlay){var z=this._minimumZ;if(overlay){var z1=Number(overla
y.style.zIndex||window.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1}}retur
n z},_setZ:function(element,z){element.style.zIndex=z},_applyOverlayZ:function(o
verlay,aboveZ){this._setZ(overlay,aboveZ+2)},_overlayInPath:function(path){path=
path||[];for(var i=0;i<path.length;i++){if(path[i]._manager===this){return path[
i]}}},_onCaptureClick:function(event){var overlay=this.currentOverlay();if(overl
ay&&this._overlayInPath(Polymer.dom(event).path)!==overlay){overlay._onCaptureCl
ick(event)}},_onCaptureFocus:function(event){var overlay=this.currentOverlay();i
f(overlay){overlay._onCaptureFocus(event)}},_onCaptureKeyDown:function(event){va
r overlay=this.currentOverlay();if(overlay){if(Polymer.IronA11yKeysBehavior.keyb
oardEventMatchesKeys(event,"esc")){overlay._onCaptureEsc(event)}else if(Polymer.
IronA11yKeysBehavior.keyboardEventMatchesKeys(event,"tab")){overlay._onCaptureTa
b(event)}}},_shouldBeBehindOverlay:function(overlay1,overlay2){return!overlay1.a
lwaysOnTop&&overlay2.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOv
erlayManagerClass;(function(){"use strict";Polymer.IronOverlayBehaviorImpl={prop
erties:{opened:{observer:"_openedChanged",type:Boolean,value:false,notify:true},
canceled:{ |
| 47 observer:"_canceledChanged",readOnly:true,type:Boolean,value:false},withBackdrop
:{observer:"_withBackdropChanged",type:Boolean},noAutoFocus:{type:Boolean,value:
false},noCancelOnEscKey:{type:Boolean,value:false},noCancelOnOutsideClick:{type:
Boolean,value:false},closingReason:{type:Object},restoreFocusOnClose:{type:Boole
an,value:false},alwaysOnTop:{type:Boolean},_manager:{type:Object,value:Polymer.I
ronOverlayManager},_focusedChild:{type:Object}},listeners:{"iron-resize":"_onIro
nResize"},get backdropElement(){return this._manager.backdropElement},get _focus
Node(){return this._focusedChild||Polymer.dom(this).querySelector("[autofocus]")
||this},get _focusableNodes(){var FOCUSABLE_WITH_DISABLED=["a[href]","area[href]
","iframe","[tabindex]","[contentEditable=true]"];var FOCUSABLE_WITHOUT_DISABLED
=["input","select","textarea","button"];var selector=FOCUSABLE_WITH_DISABLED.joi
n(':not([tabindex="-1"]),')+':not([tabindex="-1"]),'+FOCUSABLE_WITHOUT_DISABLED.
join(':not([disabled]):not([tabindex="-1"]),')+':not([disabled]):not([tabindex="
-1"])';var focusables=Polymer.dom(this).querySelectorAll(selector);if(this.tabIn
dex>=0){focusables.splice(0,0,this)}return focusables.sort(function(a,b){if(a.ta
bIndex===b.tabIndex){return 0}if(a.tabIndex===0||a.tabIndex>b.tabIndex){return 1
}return-1})},ready:function(){this.__isAnimating=false;this.__shouldRemoveTabInd
ex=false;this.__firstFocusableNode=this.__lastFocusableNode=null;this.__raf=null
;this.__restoreFocusNode=null;this._ensureSetup()},attached:function(){if(this.o
pened){this._openedChanged(this.opened)}this._observer=Polymer.dom(this).observe
Nodes(this._onNodesChange)},detached:function(){Polymer.dom(this).unobserveNodes
(this._observer);this._observer=null;if(this.__raf){window.cancelAnimationFrame(
this.__raf);this.__raf=null}this._manager.removeOverlay(this)},toggle:function()
{this._setCanceled(false);this.opened=!this.opened},open:function(){this._setCan
celed(false);this.opened=true},close:function(){this._setCanceled(false);this.op
ened=false},cancel:function(event){var cancelEvent=this.fire("iron-overlay-cance
led",event,{cancelable:true});if(cancelEvent.defaultPrevented){return}this._setC
anceled(true);this.opened=false},_ensureSetup:function(){if(this._overlaySetup){
return}this._overlaySetup=true;this.style.outline="none";this.style.display="non
e"},_openedChanged:function(opened){if(opened){this.removeAttribute("aria-hidden
")}else{this.setAttribute("aria-hidden","true")}if(!this.isAttached){return}this
.__isAnimating=true;this.__onNextAnimationFrame(this.__openedChanged)},_canceled
Changed:function(){this.closingReason=this.closingReason||{};this.closingReason.
canceled=this.canceled},_withBackdropChanged:function(){if(this.withBackdrop&&!t
his.hasAttribute("tabindex")){this.setAttribute("tabindex","-1");this.__shouldRe
moveTabIndex=true}else if(this.__shouldRemoveTabIndex){this.removeAttribute("tab
index");this.__shouldRemoveTabIndex=false}if(this.opened&&this.isAttached){this.
_manager.trackBackdrop()}},_prepareRenderOpened:function(){this.__restoreFocusNo
de=this._manager.deepActiveElement;this._preparePositioning();this.refit();this.
_finishPositioning();if(this.noAutoFocus&&document.activeElement===this._focusNo
de){this._focusNode.blur();this.__restoreFocusNode.focus()}},_renderOpened:funct
ion(){this._finishRenderOpened()},_renderClosed:function(){this._finishRenderClo
sed()},_finishRenderOpened:function(){this.notifyResize();this.__isAnimating=fal
se;var focusableNodes=this._focusableNodes;this.__firstFocusableNode=focusableNo
des[0];this.__lastFocusableNode=focusableNodes[focusableNodes.length-1];this.fir
e("iron-overlay-opened")},_finishRenderClosed:function(){this.style.display="non
e";this.style.zIndex="";this.notifyResize();this.__isAnimating=false;this.fire("
iron-overlay-closed",this.closingReason)},_preparePositioning:function(){this.st
yle.transition=this.style.webkitTransition="none";this.style.transform=this.styl
e.webkitTransform="none";this.style.display=""},_finishPositioning:function(){th
is.style.display="none";this.scrollTop=this.scrollTop;this.style.transition=this
.style.webkitTransition="";this.style.transform=this.style.webkitTransform="";th
is.style.display="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(thi
s.opened){if(!this.noAutoFocus){this._focusNode.focus()}}else{this._focusNode.bl
ur();this._focusedChild=null;if(this.restoreFocusOnClose&&this.__restoreFocusNod
e){this.__restoreFocusNode.focus()}this.__restoreFocusNode=null;var currentOverl
ay=this._manager.currentOverlay();if(currentOverlay&&this!==currentOverlay){curr
entOverlay._applyFocus()}}},_onCaptureClick:function(event){if(!this.noCancelOnO
utsideClick){this.cancel(event)}},_onCaptureFocus:function(event){if(!this.withB
ackdrop){return}var path=Polymer.dom(event).path;if(path.indexOf(this)===-1){eve
nt.stopPropagation();this._applyFocus()}else{this._focusedChild=path[0]}},_onCap
tureEsc:function(event){if(!this.noCancelOnEscKey){this.cancel(event)}},_onCaptu
reTab:function(event){if(!this.withBackdrop){return}var shift=event.shiftKey;var
nodeToCheck=shift?this.__firstFocusableNode:this.__lastFocusableNode;var nodeTo
Set=shift?this.__lastFocusableNode:this.__firstFocusableNode;var shouldWrap=fals
e;if(nodeToCheck===nodeToSet){shouldWrap=true}else{var focusedNode=this._manager
.deepActiveElement;shouldWrap=focusedNode===nodeToCheck||focusedNode===this}if(s
houldWrap){event.preventDefault();this._focusedChild=nodeToSet;this._applyFocus(
)}},_onIronResize:function(){if(this.opened&&!this.__isAnimating){this.__onNextA
nimationFrame(this.refit)}},_onNodesChange:function(){if(this.opened&&!this.__is
Animating){this.notifyResize()}},__openedChanged:function(){if(this.opened){this
._prepareRenderOpened();this._manager.addOverlay(this);this._applyFocus();this._
renderOpened()}else{this._manager.removeOverlay(this);this._applyFocus();this._r
enderClosed()}},__onNextAnimationFrame:function(callback){if(this.__raf){window.
cancelAnimationFrame(this.__raf)}var self=this;this.__raf=window.requestAnimatio
nFrame(function nextAnimationFrame(){self.__raf=null;callback.call(self)})}};Pol
ymer.IronOverlayBehavior=[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,
Polymer.IronOverlayBehaviorImpl]})();Polymer.NeonAnimatableBehavior={properties:
{animationConfig:{type:Object},entryAnimation:{observer:"_entryAnimationChanged"
,type:String},exitAnimation:{observer:"_exitAnimationChanged",type:String}},_ent
ryAnimationChanged:function(){this.animationConfig=this.animationConfig||{};this
.animationConfig["entry"]=[{name:this.entryAnimation,node:this}]},_exitAnimation
Changed:function(){this.animationConfig=this.animationConfig||{};this.animationC
onfig["exit"]=[{name:this.exitAnimation,node:this}]},_copyProperties:function(co
nfig1,config2){for(var property in config2){config1[property]=config2[property]}
},_cloneConfig:function(config){var clone={isClone:true};this._copyProperties(cl
one,config);return clone},_getAnimationConfigRecursive:function(type,map,allConf
igs){if(!this.animationConfig){return}if(this.animationConfig.value&&typeof this
.animationConfig.value==="function"){this._warn(this._logf("playAnimation","Plea
se put 'animationConfig' inside of your components 'properties' object instead o
f outside of it."));return}var thisConfig;if(type){thisConfig=this.animationConf
ig[type]}else{thisConfig=this.animationConfig}if(!Array.isArray(thisConfig)){thi
sConfig=[thisConfig]}if(thisConfig){for(var config,index=0;config=thisConfig[ind
ex];index++){if(config.animatable){config.animatable._getAnimationConfigRecursiv
e(config.type||type,map,allConfigs)}else{if(config.id){var cachedConfig=map[conf
ig.id];if(cachedConfig){if(!cachedConfig.isClone){map[config.id]=this._cloneConf
ig(cachedConfig);cachedConfig=map[config.id]}this._copyProperties(cachedConfig,c
onfig)}else{map[config.id]=config}}else{allConfigs.push(config)}}}}},getAnimatio
nConfig:function(type){var map={};var allConfigs=[];this._getAnimationConfigRecu
rsive(type,map,allConfigs);for(var key in map){allConfigs.push(map[key])}return
allConfigs}};Polymer.NeonAnimationRunnerBehaviorImpl={_configureAnimations:funct
ion(configs){var results=[];if(configs.length>0){for(var config,index=0;config=c
onfigs[index];index++){var neonAnimation=document.createElement(config.name);if(
neonAnimation.isNeonAnimation){var result=null;try{result=neonAnimation.configur
e(config);if(typeof result.cancel!="function"){result=document.timeline.play(res
ult)}}catch(e){result=null;console.warn("Couldnt play","(",config.name,").",e)}i
f(result){results.push({neonAnimation:neonAnimation,config:config,animation:resu
lt})}}else{console.warn(this.is+":",config.name,"not found!")}}}return results},
_shouldComplete:function(activeEntries){var finished=true;for(var i=0;i<activeEn
tries.length;i++){if(activeEntries[i].animation.playState!="finished"){finished=
false;break}}return finished},_complete:function(activeEntries){for(var i=0;i<ac
tiveEntries.length;i++){activeEntries[i].neonAnimation.complete(activeEntries[i]
.config)}for(var i=0;i<activeEntries.length;i++){activeEntries[i].animation.canc
el()}},playAnimation:function(type,cookie){var configs=this.getAnimationConfig(t
ype);if(!configs){return}this._active=this._active||{};if(this._active[type]){th
is._complete(this._active[type]);delete this._active[type]}var activeEntries=thi
s._configureAnimations(configs);if(activeEntries.length==0){this.fire("neon-anim
ation-finish",cookie,{bubbles:false});return}this._active[type]=activeEntries;fo
r(var i=0;i<activeEntries.length;i++){activeEntries[i].animation.onfinish=functi
on(){if(this._shouldComplete(activeEntries)){this._complete(activeEntries);delet
e this._active[type];this.fire("neon-animation-finish",cookie,{bubbles:false})}}
.bind(this)}},cancelAnimation:function(){for(var k in this._animations){this._an
imations[k].cancel()}this._animations={}}};Polymer.NeonAnimationRunnerBehavior=[
Polymer.NeonAnimatableBehavior,Polymer.NeonAnimationRunnerBehaviorImpl];Polymer.
NeonAnimationBehavior={properties:{animationTiming:{type:Object,value:function()
{return{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeo
nAnimation:true,timingFromConfig:function(config){if(config.timing){for(var prop
erty in config.timing){this.animationTiming[property]=config.timing[property]}}r
eturn this.animationTiming},setPrefixedProperty:function(node,property,value){va
r map={transform:["webkitTransform"],transformOrigin:["mozTransformOrigin","webk
itTransformOrigin"]};var prefixes=map[property];for(var prefix,index=0;prefix=pr
efixes[index];index++){node.style[prefix]=value}node.style[property]=value},comp
lete:function(){}};Polymer({is:"opaque-animation",behaviors:[Polymer.NeonAnimati
onBehavior],configure:function(config){var node=config.node;this._effect=new Key
frameEffect(node,[{opacity:"1"},{opacity:"1"}],this.timingFromConfig(config));no
de.style.opacity="0";return this._effect},complete:function(config){config.node.
style.opacity=""}});(function(){"use strict";var LAST_TOUCH_POSITION={pageX:0,pa
geY:0};var ROOT_TARGET=null;var SCROLLABLE_NODES=[];Polymer.IronDropdownScrollMa
nager={get currentLockingElement(){return this._lockingElements[this._lockingEle
ments.length-1]},elementIsScrollLocked:function(element){var currentLockingEleme
nt=this.currentLockingElement;if(currentLockingElement===undefined)return false;
var scrollLocked;if(this._hasCachedLockedElement(element)){return true}if(this._
hasCachedUnlockedElement(element)){return false}scrollLocked=!!currentLockingEle
ment&¤tLockingElement!==element&&!this._composedTreeContains(currentLockin
gElement,element);if(scrollLocked){this._lockedElementCache.push(element)}else{t
his._unlockedElementCache.push(element)}return scrollLocked},pushScrollLock:func
tion(element){if(this._lockingElements.indexOf(element)>=0){return}if(this._lock
ingElements.length===0){this._lockScrollInteractions()}this._lockingElements.pus
h(element);this._lockedElementCache=[];this._unlockedElementCache=[]},removeScro
llLock:function(element){var index=this._lockingElements.indexOf(element);if(ind
ex===-1){return}this._lockingElements.splice(index,1);this._lockedElementCache=[
];this._unlockedElementCache=[];if(this._lockingElements.length===0){this._unloc
kScrollInteractions()}},_lockingElements:[],_lockedElementCache:null,_unlockedEl
ementCache:null,_hasCachedLockedElement:function(element){return this._lockedEle
mentCache.indexOf(element)>-1},_hasCachedUnlockedElement:function(element){retur
n this._unlockedElementCache.indexOf(element)>-1},_composedTreeContains:function
(element,child){var contentElements;var distributedNodes;var contentIndex;var no
deIndex;if(element.contains(child)){return true}contentElements=Polymer.dom(elem
ent).querySelectorAll("content");for(contentIndex=0;contentIndex<contentElements
.length;++contentIndex){distributedNodes=Polymer.dom(contentElements[contentInde
x]).getDistributedNodes();for(nodeIndex=0;nodeIndex<distributedNodes.length;++no
deIndex){if(this._composedTreeContains(distributedNodes[nodeIndex],child)){retur
n true}}}return false},_scrollInteractionHandler:function(event){if(event.cancel
able&&this._shouldPreventScrolling(event)){event.preventDefault()}if(event.targe
tTouches){var touch=event.targetTouches[0];LAST_TOUCH_POSITION.pageX=touch.pageX
;LAST_TOUCH_POSITION.pageY=touch.pageY}},_lockScrollInteractions:function(){this
._boundScrollHandler=this._boundScrollHandler||this._scrollInteractionHandler.bi
nd(this);document.addEventListener("wheel",this._boundScrollHandler,true);docume
nt.addEventListener("mousewheel",this._boundScrollHandler,true);document.addEven
tListener("DOMMouseScroll",this._boundScrollHandler,true);document.addEventListe
ner("touchstart",this._boundScrollHandler,true);document.addEventListener("touch
move",this._boundScrollHandler,true)},_unlockScrollInteractions:function(){docum
ent.removeEventListener("wheel",this._boundScrollHandler,true);document.removeEv
entListener("mousewheel",this._boundScrollHandler,true);document.removeEventList
ener("DOMMouseScroll",this._boundScrollHandler,true);document.removeEventListene
r("touchstart",this._boundScrollHandler,true);document.removeEventListener("touc
hmove",this._boundScrollHandler,true)},_shouldPreventScrolling:function(event){v
ar target=Polymer.dom(event).rootTarget;if(event.type!=="touchmove"&&ROOT_TARGET
!==target){ROOT_TARGET=target;SCROLLABLE_NODES=this._getScrollableNodes(Polymer.
dom(event).path)}if(!SCROLLABLE_NODES.length){return true}if(event.type==="touch
start"){return false}var info=this._getScrollInfo(event);return!this._getScrolli
ngNode(SCROLLABLE_NODES,info.deltaX,info.deltaY)},_getScrollableNodes:function(n
odes){var scrollables=[];var lockingIndex=nodes.indexOf(this.currentLockingEleme
nt);for(var i=0;i<=lockingIndex;i++){var node=nodes[i];if(node.nodeType===11){co
ntinue}var style=node.style;if(style.overflow!=="scroll"&&style.overflow!=="auto
"){style=window.getComputedStyle(node)}if(style.overflow==="scroll"||style.overf
low==="auto"){scrollables.push(node)}}return scrollables},_getScrollingNode:func
tion(nodes,deltaX,deltaY){if(!deltaX&&!deltaY){return}var verticalScroll=Math.ab
s(deltaY)>=Math.abs(deltaX);for(var i=0;i<nodes.length;i++){var node=nodes[i];va
r canScroll=false;if(verticalScroll){canScroll=deltaY<0?node.scrollTop>0:node.sc
rollTop<node.scrollHeight-node.clientHeight}else{canScroll=deltaX<0?node.scrollL
eft>0:node.scrollLeft<node.scrollWidth-node.clientWidth}if(canScroll){return nod
e}}},_getScrollInfo:function(event){var info={deltaX:event.deltaX,deltaY:event.d
eltaY};if("deltaX"in event){}else if("wheelDeltaX"in event){info.deltaX=-event.w
heelDeltaX;info.deltaY=-event.wheelDeltaY}else if("axis"in event){info.deltaX=ev
ent.axis===1?event.detail:0;info.deltaY=event.axis===2?event.detail:0}else if(ev
ent.targetTouches){var touch=event.targetTouches[0];info.deltaX=LAST_TOUCH_POSIT
ION.pageX-touch.pageX;info.deltaY=LAST_TOUCH_POSITION.pageY-touch.pageY}return i
nfo}}})();(function(){"use strict";Polymer({is:"iron-dropdown",behaviors:[Polyme
r.IronControlState,Polymer.IronA11yKeysBehavior,Polymer.IronOverlayBehavior,Poly
mer.NeonAnimationRunnerBehavior],properties:{horizontalAlign:{type:String,value:
"left",reflectToAttribute:true},verticalAlign:{type:String,value:"top",reflectTo
Attribute:true},openAnimationConfig:{type:Object},closeAnimationConfig:{type:Obj
ect},focusTarget:{type:Object},noAnimations:{type:Boolean,value:false},allowOuts
ideScroll:{type:Boolean,value:false},_boundOnCaptureScroll:{type:Function,value:
function(){return this._onCaptureScroll.bind(this)}}},listeners:{"neon-animation
-finish":"_onNeonAnimationFinish"},observers:["_updateOverlayPosition(positionTa
rget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)"],get co
ntainedElement(){return Polymer.dom(this.$.content).getDistributedNodes()[0]},ge
t _focusTarget(){return this.focusTarget||this.containedElement},ready:function(
){this._scrollTop=0;this._scrollLeft=0;this._refitOnScrollRAF=null},attached:fun
ction(){if(!this.sizingTarget||this.sizingTarget===this){this.sizingTarget=this.
containedElement}},detached:function(){this.cancelAnimation();document.removeEve
ntListener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrollManage
r.removeScrollLock(this)},_openedChanged:function(){if(this.opened&&this.disable
d){this.cancel()}else{this.cancelAnimation();this._updateAnimationConfig();this.
_saveScrollPosition();if(this.opened){document.addEventListener("scroll",this._b
oundOnCaptureScroll);!this.allowOutsideScroll&&Polymer.IronDropdownScrollManager
.pushScrollLock(this)}else{document.removeEventListener("scroll",this._boundOnCa
ptureScroll);Polymer.IronDropdownScrollManager.removeScrollLock(this)}Polymer.Ir
onOverlayBehaviorImpl._openedChanged.apply(this,arguments)}},_renderOpened:funct
ion(){if(!this.noAnimations&&this.animationConfig.open){this.$.contentWrapper.cl
assList.add("animating");this.playAnimation("open")}else{Polymer.IronOverlayBeha
viorImpl._renderOpened.apply(this,arguments)}},_renderClosed:function(){if(!this
.noAnimations&&this.animationConfig.close){this.$.contentWrapper.classList.add("
animating");this.playAnimation("close")}else{Polymer.IronOverlayBehaviorImpl._re
nderClosed.apply(this,arguments)}},_onNeonAnimationFinish:function(){this.$.cont
entWrapper.classList.remove("animating");if(this.opened){this._finishRenderOpene
d()}else{this._finishRenderClosed()}},_onCaptureScroll:function(){if(!this.allow
OutsideScroll){this._restoreScrollPosition()}else{this._refitOnScrollRAF&&window
.cancelAnimationFrame(this._refitOnScrollRAF);this._refitOnScrollRAF=window.requ
estAnimationFrame(this.refit.bind(this))}},_saveScrollPosition:function(){if(doc
ument.scrollingElement){this._scrollTop=document.scrollingElement.scrollTop;this
._scrollLeft=document.scrollingElement.scrollLeft}else{this._scrollTop=Math.max(
document.documentElement.scrollTop,document.body.scrollTop);this._scrollLeft=Mat
h.max(document.documentElement.scrollLeft,document.body.scrollLeft)}},_restoreSc
rollPosition:function(){if(document.scrollingElement){document.scrollingElement.
scrollTop=this._scrollTop;document.scrollingElement.scrollLeft=this._scrollLeft}
else{document.documentElement.scrollTop=this._scrollTop;document.documentElement
.scrollLeft=this._scrollLeft;document.body.scrollTop=this._scrollTop;document.bo
dy.scrollLeft=this._scrollLeft}},_updateAnimationConfig:function(){var animation
s=(this.openAnimationConfig||[]).concat(this.closeAnimationConfig||[]);for(var i
=0;i<animations.length;i++){animations[i].node=this.containedElement}this.animat
ionConfig={open:this.openAnimationConfig,close:this.closeAnimationConfig}},_upda
teOverlayPosition:function(){if(this.isAttached){this.notifyResize()}},_applyFoc
us:function(){var focusTarget=this.focusTarget||this.containedElement;if(focusTa
rget&&this.opened&&!this.noAutoFocus){focusTarget.focus()}else{Polymer.IronOverl
ayBehaviorImpl._applyFocus.apply(this,arguments)}}})})();Polymer({is:"fade-in-an
imation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config){va
r node=config.node;this._effect=new KeyframeEffect(node,[{opacity:"0"},{opacity:
"1"}],this.timingFromConfig(config));return this._effect}});Polymer({is:"fade-ou
t-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config
){var node=config.node;this._effect=new KeyframeEffect(node,[{opacity:"1"},{opac
ity:"0"}],this.timingFromConfig(config));return this._effect}});Polymer({is:"pap
er-menu-grow-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configu
re:function(config){var node=config.node;var rect=node.getBoundingClientRect();v
ar height=rect.height;this._effect=new KeyframeEffect(node,[{height:height/2+"px
"},{height:height+"px"}],this.timingFromConfig(config));return this._effect}});P
olymer({is:"paper-menu-grow-width-animation",behaviors:[Polymer.NeonAnimationBeh
avior],configure:function(config){var node=config.node;var rect=node.getBounding
ClientRect();var width=rect.width;this._effect=new KeyframeEffect(node,[{width:w
idth/2+"px"},{width:width+"px"}],this.timingFromConfig(config));return this._eff
ect}});Polymer({is:"paper-menu-shrink-width-animation",behaviors:[Polymer.NeonAn
imationBehavior],configure:function(config){var node=config.node;var rect=node.g
etBoundingClientRect();var width=rect.width;this._effect=new KeyframeEffect(node
,[{width:width+"px"},{width:width-width/20+"px"}],this.timingFromConfig(config))
;return this._effect}});Polymer({is:"paper-menu-shrink-height-animation",behavio
rs:[Polymer.NeonAnimationBehavior],configure:function(config){var node=config.no
de;var rect=node.getBoundingClientRect();var height=rect.height;var top=rect.top
;this.setPrefixedProperty(node,"transformOrigin","0 0");this._effect=new Keyfram
eEffect(node,[{height:height+"px",transform:"translateY(0)"},{height:height/2+"p
x",transform:"translateY(-20px)"}],this.timingFromConfig(config));return this._e
ffect}});(function(){"use strict";var config={ANIMATION_CUBIC_BEZIER:"cubic-bezi
er(.3,.95,.5,1)",MAX_ANIMATION_TIME_MS:400};var PaperMenuButton=Polymer({is:"pap
er-menu-button",behaviors:[Polymer.IronA11yKeysBehavior,Polymer.IronControlState
],properties:{opened:{type:Boolean,value:false,notify:true,observer:"_openedChan
ged"},horizontalAlign:{type:String,value:"left",reflectToAttribute:true},vertica
lAlign:{type:String,value:"top",reflectToAttribute:true},dynamicAlign:{type:Bool
ean},horizontalOffset:{type:Number,value:0,notify:true},verticalOffset:{type:Num
ber,value:0,notify:true},noOverlap:{type:Boolean},noAnimations:{type:Boolean,val
ue:false},ignoreSelect:{type:Boolean,value:false},closeOnActivate:{type:Boolean,
value:false},openAnimationConfig:{type:Object,value:function(){return[{name:"fad
e-in-animation",timing:{delay:100,duration:200}},{name:"paper-menu-grow-width-an
imation",timing:{delay:100,duration:150,easing:config.ANIMATION_CUBIC_BEZIER}},{
name:"paper-menu-grow-height-animation",timing:{delay:100,duration:275,easing:co
nfig.ANIMATION_CUBIC_BEZIER}}]}},closeAnimationConfig:{type:Object,value:functio
n(){return[{name:"fade-out-animation",timing:{duration:150}},{name:"paper-menu-s
hrink-width-animation",timing:{delay:100,duration:50,easing:config.ANIMATION_CUB
IC_BEZIER}},{name:"paper-menu-shrink-height-animation",timing:{duration:200,easi
ng:"ease-in"}}]}},allowOutsideScroll:{type:Boolean,value:false},restoreFocusOnCl
ose:{type:Boolean,value:true},_dropdownContent:{type:Object}},hostAttributes:{ro
le:"group","aria-haspopup":"true"},listeners:{"iron-activate":"_onIronActivate",
"iron-select":"_onIronSelect"},get contentElement(){return Polymer.dom(this.$.co
ntent).getDistributedNodes()[0]},toggle:function(){if(this.opened){this.close()}
else{this.open()}},open:function(){if(this.disabled){return}this.$.dropdown.open
()},close:function(){this.$.dropdown.close()},_onIronSelect:function(event){if(!
this.ignoreSelect){this.close()}},_onIronActivate:function(event){if(this.closeO
nActivate){this.close()}},_openedChanged:function(opened,oldOpened){if(opened){t
his._dropdownContent=this.contentElement;this.fire("paper-dropdown-open")}else i
f(oldOpened!=null){this.fire("paper-dropdown-close")}},_disabledChanged:function
(disabled){Polymer.IronControlState._disabledChanged.apply(this,arguments);if(di
sabled&&this.opened){this.close()}},__onIronOverlayCanceled:function(event){var
uiEvent=event.detail;var target=Polymer.dom(uiEvent).rootTarget;var trigger=this
.$.trigger;var path=Polymer.dom(uiEvent).path;if(path.indexOf(trigger)>-1){event
.preventDefault()}}});Object.keys(config).forEach(function(key){PaperMenuButton[
key]=config[key]});Polymer.PaperMenuButton=PaperMenuButton})();Polymer.PaperInky
FocusBehaviorImpl={observers:["_focusedChanged(receivedFocusFromKeyboard)"],_foc
usedChanged:function(receivedFocusFromKeyboard){if(receivedFocusFromKeyboard){th
is.ensureRipple()}if(this.hasRipple()){this._ripple.holdDown=receivedFocusFromKe
yboard}},_createRipple:function(){var ripple=Polymer.PaperRippleBehavior._create
Ripple();ripple.id="ink";ripple.setAttribute("center","");ripple.classList.add("
circle");return ripple}};Polymer.PaperInkyFocusBehavior=[Polymer.IronButtonState
,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperInkyFocusBeha
viorImpl];Polymer({is:"paper-icon-button",hostAttributes:{role:"button",tabindex
:"0"},behaviors:[Polymer.PaperInkyFocusBehavior],properties:{src:{type:String},i
con:{type:String},alt:{type:String,observer:"_altChanged"}},_altChanged:function
(newValue,oldValue){var label=this.getAttribute("aria-label");if(!label||oldValu
e==label){this.setAttribute("aria-label",newValue)}}});Polymer({is:"iron-media-q
uery",properties:{queryMatches:{type:Boolean,value:false,readOnly:true,notify:tr
ue},query:{type:String,observer:"queryChanged"},full:{type:Boolean,value:false},
_boundMQHandler:{value:function(){return this.queryHandler.bind(this)}},_mq:{val
ue:null}},attached:function(){this.style.display="none";this.queryChanged()},det
ached:function(){this._remove()},_add:function(){if(this._mq){this._mq.addListen
er(this._boundMQHandler)}},_remove:function(){if(this._mq){this._mq.removeListen
er(this._boundMQHandler)}this._mq=null},queryChanged:function(){this._remove();v
ar query=this.query;if(!query){return}if(!this.full&&query[0]!=="("){query="("+q
uery+")"}this._mq=window.matchMedia(query);this._add();this.queryHandler(this._m
q)},queryHandler:function(mq){this._setQueryMatches(mq.matches)}});(function(){"
use strict";Polymer.IronA11yAnnouncer=Polymer({is:"iron-a11y-announcer",properti
es:{mode:{type:String,value:"polite"},_text:{type:String,value:""}},created:func
tion(){if(!Polymer.IronA11yAnnouncer.instance){Polymer.IronA11yAnnouncer.instanc
e=this}document.body.addEventListener("iron-announce",this._onIronAnnounce.bind(
this))},announce:function(text){this._text="";this.async(function(){this._text=t
ext},100)},_onIronAnnounce:function(event){if(event.detail&&event.detail.text){t
his.announce(event.detail.text)}}});Polymer.IronA11yAnnouncer.instance=null;Poly
mer.IronA11yAnnouncer.requestAvailability=function(){if(!Polymer.IronA11yAnnounc
er.instance){Polymer.IronA11yAnnouncer.instance=document.createElement("iron-a11
y-announcer")}document.body.appendChild(Polymer.IronA11yAnnouncer.instance)}})()
;Polymer.IronValidatableBehaviorMeta=null;Polymer.IronValidatableBehavior={prope
rties:{validator:{type:String},invalid:{notify:true,reflectToAttribute:true,type
:Boolean,value:false},_validatorMeta:{type:Object},validatorType:{type:String,va
lue:"validator"},_validator:{type:Object,computed:"__computeValidator(validator)
"}},observers:["_invalidChanged(invalid)"],registered:function(){Polymer.IronVal
idatableBehaviorMeta=new Polymer.IronMeta({type:"validator"})},_invalidChanged:f
unction(){if(this.invalid){this.setAttribute("aria-invalid","true")}else{this.re
moveAttribute("aria-invalid")}},hasValidator:function(){return this._validator!=
null},validate:function(value){this.invalid=!this._getValidity(value);return!thi
s.invalid},_getValidity:function(value){if(this.hasValidator()){return this._val
idator.validate(value)}return true},__computeValidator:function(){return Polymer
.IronValidatableBehaviorMeta&&Polymer.IronValidatableBehaviorMeta.byKey(this.val
idator)}};Polymer({is:"iron-input","extends":"input",behaviors:[Polymer.IronVali
datableBehavior],properties:{bindValue:{observer:"_bindValueChanged",type:String
},preventInvalidInput:{type:Boolean},allowedPattern:{type:String,observer:"_allo
wedPatternChanged"},_previousValidInput:{type:String,value:""},_patternAlreadyCh
ecked:{type:Boolean,value:false}},listeners:{input:"_onInput",keypress:"_onKeypr
ess"},registered:function(){if(!this._canDispatchEventOnDisabled()){this._origDi
spatchEvent=this.dispatchEvent;this.dispatchEvent=this._dispatchEventFirefoxIE}}
,created:function(){Polymer.IronA11yAnnouncer.requestAvailability()},_canDispatc
hEventOnDisabled:function(){var input=document.createElement("input");var canDis
patch=false;input.disabled=true;input.addEventListener("feature-check-dispatch-e
vent",function(){canDispatch=true});try{input.dispatchEvent(new Event("feature-c
heck-dispatch-event"))}catch(e){}return canDispatch},_dispatchEventFirefoxIE:fun
ction(){var disabled=this.disabled;this.disabled=false;this._origDispatchEvent.a
pply(this,arguments);this.disabled=disabled},get _patternRegExp(){var pattern;if
(this.allowedPattern){pattern=new RegExp(this.allowedPattern)}else{switch(this.t
ype){case"number":pattern=/[0-9.,e-]/;break}}return pattern},ready:function(){th
is.bindValue=this.value},_bindValueChanged:function(){if(this.value!==this.bindV
alue){this.value=!(this.bindValue||this.bindValue===0||this.bindValue===false)?"
":this.bindValue}this.fire("bind-value-changed",{value:this.bindValue})},_allowe
dPatternChanged:function(){this.preventInvalidInput=this.allowedPattern?true:fal
se},_onInput:function(){if(this.preventInvalidInput&&!this._patternAlreadyChecke
d){var valid=this._checkPatternValidity();if(!valid){this._announceInvalidCharac
ter("Invalid string of characters not entered.");this.value=this._previousValidI
nput}}this.bindValue=this.value;this._previousValidInput=this.value;this._patter
nAlreadyChecked=false},_isPrintable:function(event){var anyNonPrintable=event.ke
yCode==8||event.keyCode==9||event.keyCode==13||event.keyCode==27;var mozNonPrint
able=event.keyCode==19||event.keyCode==20||event.keyCode==45||event.keyCode==46|
|event.keyCode==144||event.keyCode==145||event.keyCode>32&&event.keyCode<41||eve
nt.keyCode>111&&event.keyCode<124;return!anyNonPrintable&&!(event.charCode==0&&m
ozNonPrintable)},_onKeypress:function(event){if(!this.preventInvalidInput&&this.
type!=="number"){return}var regexp=this._patternRegExp;if(!regexp){return}if(eve
nt.metaKey||event.ctrlKey||event.altKey)return;this._patternAlreadyChecked=true;
var thisChar=String.fromCharCode(event.charCode);if(this._isPrintable(event)&&!r
egexp.test(thisChar)){event.preventDefault();this._announceInvalidCharacter("Inv
alid character "+thisChar+" not entered.")}},_checkPatternValidity:function(){va
r regexp=this._patternRegExp;if(!regexp){return true}for(var i=0;i<this.value.le
ngth;i++){if(!regexp.test(this.value[i])){return false}}return true},validate:fu
nction(){var valid=this.checkValidity();if(valid){if(this.required&&this.value==
=""){valid=false}else if(this.hasValidator()){valid=Polymer.IronValidatableBehav
ior.validate.call(this,this.value)}}this.invalid=!valid;this.fire("iron-input-va
lidate");return valid},_announceInvalidCharacter:function(message){this.fire("ir
on-announce",{text:message})}});Polymer({is:"paper-input-container",properties:{
noLabelFloat:{type:Boolean,value:false},alwaysFloatLabel:{type:Boolean,value:fal
se},attrForValue:{type:String,value:"bind-value"},autoValidate:{type:Boolean,val
ue:false},invalid:{observer:"_invalidChanged",type:Boolean,value:false},focused:
{readOnly:true,type:Boolean,value:false,notify:true},_addons:{type:Array},_input
HasContent:{type:Boolean,value:false},_inputSelector:{type:String,value:"input,t
extarea,.paper-input-input"},_boundOnFocus:{type:Function,value:function(){retur
n this._onFocus.bind(this)}},_boundOnBlur:{type:Function,value:function(){return
this._onBlur.bind(this)}},_boundOnInput:{type:Function,value:function(){return
this._onInput.bind(this); | 47 observer:"_canceledChanged",readOnly:true,type:Boolean,value:false},withBackdrop
:{observer:"_withBackdropChanged",type:Boolean},noAutoFocus:{type:Boolean,value:
false},noCancelOnEscKey:{type:Boolean,value:false},noCancelOnOutsideClick:{type:
Boolean,value:false},closingReason:{type:Object},restoreFocusOnClose:{type:Boole
an,value:false},alwaysOnTop:{type:Boolean},_manager:{type:Object,value:Polymer.I
ronOverlayManager},_focusedChild:{type:Object}},listeners:{"iron-resize":"_onIro
nResize"},get backdropElement(){return this._manager.backdropElement},get _focus
Node(){return this._focusedChild||Polymer.dom(this).querySelector("[autofocus]")
||this},get _focusableNodes(){var FOCUSABLE_WITH_DISABLED=["a[href]","area[href]
","iframe","[tabindex]","[contentEditable=true]"];var FOCUSABLE_WITHOUT_DISABLED
=["input","select","textarea","button"];var selector=FOCUSABLE_WITH_DISABLED.joi
n(':not([tabindex="-1"]),')+':not([tabindex="-1"]),'+FOCUSABLE_WITHOUT_DISABLED.
join(':not([disabled]):not([tabindex="-1"]),')+':not([disabled]):not([tabindex="
-1"])';var focusables=Polymer.dom(this).querySelectorAll(selector);if(this.tabIn
dex>=0){focusables.splice(0,0,this)}return focusables.sort(function(a,b){if(a.ta
bIndex===b.tabIndex){return 0}if(a.tabIndex===0||a.tabIndex>b.tabIndex){return 1
}return-1})},ready:function(){this.__isAnimating=false;this.__shouldRemoveTabInd
ex=false;this.__firstFocusableNode=this.__lastFocusableNode=null;this.__raf=null
;this.__restoreFocusNode=null;this._ensureSetup()},attached:function(){if(this.o
pened){this._openedChanged(this.opened)}this._observer=Polymer.dom(this).observe
Nodes(this._onNodesChange)},detached:function(){Polymer.dom(this).unobserveNodes
(this._observer);this._observer=null;if(this.__raf){window.cancelAnimationFrame(
this.__raf);this.__raf=null}this._manager.removeOverlay(this)},toggle:function()
{this._setCanceled(false);this.opened=!this.opened},open:function(){this._setCan
celed(false);this.opened=true},close:function(){this._setCanceled(false);this.op
ened=false},cancel:function(event){var cancelEvent=this.fire("iron-overlay-cance
led",event,{cancelable:true});if(cancelEvent.defaultPrevented){return}this._setC
anceled(true);this.opened=false},_ensureSetup:function(){if(this._overlaySetup){
return}this._overlaySetup=true;this.style.outline="none";this.style.display="non
e"},_openedChanged:function(opened){if(opened){this.removeAttribute("aria-hidden
")}else{this.setAttribute("aria-hidden","true")}if(!this.isAttached){return}this
.__isAnimating=true;this.__onNextAnimationFrame(this.__openedChanged)},_canceled
Changed:function(){this.closingReason=this.closingReason||{};this.closingReason.
canceled=this.canceled},_withBackdropChanged:function(){if(this.withBackdrop&&!t
his.hasAttribute("tabindex")){this.setAttribute("tabindex","-1");this.__shouldRe
moveTabIndex=true}else if(this.__shouldRemoveTabIndex){this.removeAttribute("tab
index");this.__shouldRemoveTabIndex=false}if(this.opened&&this.isAttached){this.
_manager.trackBackdrop()}},_prepareRenderOpened:function(){this.__restoreFocusNo
de=this._manager.deepActiveElement;this._preparePositioning();this.refit();this.
_finishPositioning();if(this.noAutoFocus&&document.activeElement===this._focusNo
de){this._focusNode.blur();this.__restoreFocusNode.focus()}},_renderOpened:funct
ion(){this._finishRenderOpened()},_renderClosed:function(){this._finishRenderClo
sed()},_finishRenderOpened:function(){this.notifyResize();this.__isAnimating=fal
se;var focusableNodes=this._focusableNodes;this.__firstFocusableNode=focusableNo
des[0];this.__lastFocusableNode=focusableNodes[focusableNodes.length-1];this.fir
e("iron-overlay-opened")},_finishRenderClosed:function(){this.style.display="non
e";this.style.zIndex="";this.notifyResize();this.__isAnimating=false;this.fire("
iron-overlay-closed",this.closingReason)},_preparePositioning:function(){this.st
yle.transition=this.style.webkitTransition="none";this.style.transform=this.styl
e.webkitTransform="none";this.style.display=""},_finishPositioning:function(){th
is.style.display="none";this.scrollTop=this.scrollTop;this.style.transition=this
.style.webkitTransition="";this.style.transform=this.style.webkitTransform="";th
is.style.display="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(thi
s.opened){if(!this.noAutoFocus){this._focusNode.focus()}}else{this._focusNode.bl
ur();this._focusedChild=null;if(this.restoreFocusOnClose&&this.__restoreFocusNod
e){this.__restoreFocusNode.focus()}this.__restoreFocusNode=null;var currentOverl
ay=this._manager.currentOverlay();if(currentOverlay&&this!==currentOverlay){curr
entOverlay._applyFocus()}}},_onCaptureClick:function(event){if(!this.noCancelOnO
utsideClick){this.cancel(event)}},_onCaptureFocus:function(event){if(!this.withB
ackdrop){return}var path=Polymer.dom(event).path;if(path.indexOf(this)===-1){eve
nt.stopPropagation();this._applyFocus()}else{this._focusedChild=path[0]}},_onCap
tureEsc:function(event){if(!this.noCancelOnEscKey){this.cancel(event)}},_onCaptu
reTab:function(event){if(!this.withBackdrop){return}var shift=event.shiftKey;var
nodeToCheck=shift?this.__firstFocusableNode:this.__lastFocusableNode;var nodeTo
Set=shift?this.__lastFocusableNode:this.__firstFocusableNode;var shouldWrap=fals
e;if(nodeToCheck===nodeToSet){shouldWrap=true}else{var focusedNode=this._manager
.deepActiveElement;shouldWrap=focusedNode===nodeToCheck||focusedNode===this}if(s
houldWrap){event.preventDefault();this._focusedChild=nodeToSet;this._applyFocus(
)}},_onIronResize:function(){if(this.opened&&!this.__isAnimating){this.__onNextA
nimationFrame(this.refit)}},_onNodesChange:function(){if(this.opened&&!this.__is
Animating){this.notifyResize()}},__openedChanged:function(){if(this.opened){this
._prepareRenderOpened();this._manager.addOverlay(this);this._applyFocus();this._
renderOpened()}else{this._manager.removeOverlay(this);this._applyFocus();this._r
enderClosed()}},__onNextAnimationFrame:function(callback){if(this.__raf){window.
cancelAnimationFrame(this.__raf)}var self=this;this.__raf=window.requestAnimatio
nFrame(function nextAnimationFrame(){self.__raf=null;callback.call(self)})}};Pol
ymer.IronOverlayBehavior=[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,
Polymer.IronOverlayBehaviorImpl]})();Polymer.NeonAnimatableBehavior={properties:
{animationConfig:{type:Object},entryAnimation:{observer:"_entryAnimationChanged"
,type:String},exitAnimation:{observer:"_exitAnimationChanged",type:String}},_ent
ryAnimationChanged:function(){this.animationConfig=this.animationConfig||{};this
.animationConfig["entry"]=[{name:this.entryAnimation,node:this}]},_exitAnimation
Changed:function(){this.animationConfig=this.animationConfig||{};this.animationC
onfig["exit"]=[{name:this.exitAnimation,node:this}]},_copyProperties:function(co
nfig1,config2){for(var property in config2){config1[property]=config2[property]}
},_cloneConfig:function(config){var clone={isClone:true};this._copyProperties(cl
one,config);return clone},_getAnimationConfigRecursive:function(type,map,allConf
igs){if(!this.animationConfig){return}if(this.animationConfig.value&&typeof this
.animationConfig.value==="function"){this._warn(this._logf("playAnimation","Plea
se put 'animationConfig' inside of your components 'properties' object instead o
f outside of it."));return}var thisConfig;if(type){thisConfig=this.animationConf
ig[type]}else{thisConfig=this.animationConfig}if(!Array.isArray(thisConfig)){thi
sConfig=[thisConfig]}if(thisConfig){for(var config,index=0;config=thisConfig[ind
ex];index++){if(config.animatable){config.animatable._getAnimationConfigRecursiv
e(config.type||type,map,allConfigs)}else{if(config.id){var cachedConfig=map[conf
ig.id];if(cachedConfig){if(!cachedConfig.isClone){map[config.id]=this._cloneConf
ig(cachedConfig);cachedConfig=map[config.id]}this._copyProperties(cachedConfig,c
onfig)}else{map[config.id]=config}}else{allConfigs.push(config)}}}}},getAnimatio
nConfig:function(type){var map={};var allConfigs=[];this._getAnimationConfigRecu
rsive(type,map,allConfigs);for(var key in map){allConfigs.push(map[key])}return
allConfigs}};Polymer.NeonAnimationRunnerBehaviorImpl={_configureAnimations:funct
ion(configs){var results=[];if(configs.length>0){for(var config,index=0;config=c
onfigs[index];index++){var neonAnimation=document.createElement(config.name);if(
neonAnimation.isNeonAnimation){var result=null;try{result=neonAnimation.configur
e(config);if(typeof result.cancel!="function"){result=document.timeline.play(res
ult)}}catch(e){result=null;console.warn("Couldnt play","(",config.name,").",e)}i
f(result){results.push({neonAnimation:neonAnimation,config:config,animation:resu
lt})}}else{console.warn(this.is+":",config.name,"not found!")}}}return results},
_shouldComplete:function(activeEntries){var finished=true;for(var i=0;i<activeEn
tries.length;i++){if(activeEntries[i].animation.playState!="finished"){finished=
false;break}}return finished},_complete:function(activeEntries){for(var i=0;i<ac
tiveEntries.length;i++){activeEntries[i].neonAnimation.complete(activeEntries[i]
.config)}for(var i=0;i<activeEntries.length;i++){activeEntries[i].animation.canc
el()}},playAnimation:function(type,cookie){var configs=this.getAnimationConfig(t
ype);if(!configs){return}this._active=this._active||{};if(this._active[type]){th
is._complete(this._active[type]);delete this._active[type]}var activeEntries=thi
s._configureAnimations(configs);if(activeEntries.length==0){this.fire("neon-anim
ation-finish",cookie,{bubbles:false});return}this._active[type]=activeEntries;fo
r(var i=0;i<activeEntries.length;i++){activeEntries[i].animation.onfinish=functi
on(){if(this._shouldComplete(activeEntries)){this._complete(activeEntries);delet
e this._active[type];this.fire("neon-animation-finish",cookie,{bubbles:false})}}
.bind(this)}},cancelAnimation:function(){for(var k in this._animations){this._an
imations[k].cancel()}this._animations={}}};Polymer.NeonAnimationRunnerBehavior=[
Polymer.NeonAnimatableBehavior,Polymer.NeonAnimationRunnerBehaviorImpl];Polymer.
NeonAnimationBehavior={properties:{animationTiming:{type:Object,value:function()
{return{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeo
nAnimation:true,timingFromConfig:function(config){if(config.timing){for(var prop
erty in config.timing){this.animationTiming[property]=config.timing[property]}}r
eturn this.animationTiming},setPrefixedProperty:function(node,property,value){va
r map={transform:["webkitTransform"],transformOrigin:["mozTransformOrigin","webk
itTransformOrigin"]};var prefixes=map[property];for(var prefix,index=0;prefix=pr
efixes[index];index++){node.style[prefix]=value}node.style[property]=value},comp
lete:function(){}};Polymer({is:"opaque-animation",behaviors:[Polymer.NeonAnimati
onBehavior],configure:function(config){var node=config.node;this._effect=new Key
frameEffect(node,[{opacity:"1"},{opacity:"1"}],this.timingFromConfig(config));no
de.style.opacity="0";return this._effect},complete:function(config){config.node.
style.opacity=""}});(function(){"use strict";var LAST_TOUCH_POSITION={pageX:0,pa
geY:0};var ROOT_TARGET=null;var SCROLLABLE_NODES=[];Polymer.IronDropdownScrollMa
nager={get currentLockingElement(){return this._lockingElements[this._lockingEle
ments.length-1]},elementIsScrollLocked:function(element){var currentLockingEleme
nt=this.currentLockingElement;if(currentLockingElement===undefined)return false;
var scrollLocked;if(this._hasCachedLockedElement(element)){return true}if(this._
hasCachedUnlockedElement(element)){return false}scrollLocked=!!currentLockingEle
ment&¤tLockingElement!==element&&!this._composedTreeContains(currentLockin
gElement,element);if(scrollLocked){this._lockedElementCache.push(element)}else{t
his._unlockedElementCache.push(element)}return scrollLocked},pushScrollLock:func
tion(element){if(this._lockingElements.indexOf(element)>=0){return}if(this._lock
ingElements.length===0){this._lockScrollInteractions()}this._lockingElements.pus
h(element);this._lockedElementCache=[];this._unlockedElementCache=[]},removeScro
llLock:function(element){var index=this._lockingElements.indexOf(element);if(ind
ex===-1){return}this._lockingElements.splice(index,1);this._lockedElementCache=[
];this._unlockedElementCache=[];if(this._lockingElements.length===0){this._unloc
kScrollInteractions()}},_lockingElements:[],_lockedElementCache:null,_unlockedEl
ementCache:null,_hasCachedLockedElement:function(element){return this._lockedEle
mentCache.indexOf(element)>-1},_hasCachedUnlockedElement:function(element){retur
n this._unlockedElementCache.indexOf(element)>-1},_composedTreeContains:function
(element,child){var contentElements;var distributedNodes;var contentIndex;var no
deIndex;if(element.contains(child)){return true}contentElements=Polymer.dom(elem
ent).querySelectorAll("content");for(contentIndex=0;contentIndex<contentElements
.length;++contentIndex){distributedNodes=Polymer.dom(contentElements[contentInde
x]).getDistributedNodes();for(nodeIndex=0;nodeIndex<distributedNodes.length;++no
deIndex){if(this._composedTreeContains(distributedNodes[nodeIndex],child)){retur
n true}}}return false},_scrollInteractionHandler:function(event){if(event.cancel
able&&this._shouldPreventScrolling(event)){event.preventDefault()}if(event.targe
tTouches){var touch=event.targetTouches[0];LAST_TOUCH_POSITION.pageX=touch.pageX
;LAST_TOUCH_POSITION.pageY=touch.pageY}},_lockScrollInteractions:function(){this
._boundScrollHandler=this._boundScrollHandler||this._scrollInteractionHandler.bi
nd(this);document.addEventListener("wheel",this._boundScrollHandler,true);docume
nt.addEventListener("mousewheel",this._boundScrollHandler,true);document.addEven
tListener("DOMMouseScroll",this._boundScrollHandler,true);document.addEventListe
ner("touchstart",this._boundScrollHandler,true);document.addEventListener("touch
move",this._boundScrollHandler,true)},_unlockScrollInteractions:function(){docum
ent.removeEventListener("wheel",this._boundScrollHandler,true);document.removeEv
entListener("mousewheel",this._boundScrollHandler,true);document.removeEventList
ener("DOMMouseScroll",this._boundScrollHandler,true);document.removeEventListene
r("touchstart",this._boundScrollHandler,true);document.removeEventListener("touc
hmove",this._boundScrollHandler,true)},_shouldPreventScrolling:function(event){v
ar target=Polymer.dom(event).rootTarget;if(event.type!=="touchmove"&&ROOT_TARGET
!==target){ROOT_TARGET=target;SCROLLABLE_NODES=this._getScrollableNodes(Polymer.
dom(event).path)}if(!SCROLLABLE_NODES.length){return true}if(event.type==="touch
start"){return false}var info=this._getScrollInfo(event);return!this._getScrolli
ngNode(SCROLLABLE_NODES,info.deltaX,info.deltaY)},_getScrollableNodes:function(n
odes){var scrollables=[];var lockingIndex=nodes.indexOf(this.currentLockingEleme
nt);for(var i=0;i<=lockingIndex;i++){var node=nodes[i];if(node.nodeType===11){co
ntinue}var style=node.style;if(style.overflow!=="scroll"&&style.overflow!=="auto
"){style=window.getComputedStyle(node)}if(style.overflow==="scroll"||style.overf
low==="auto"){scrollables.push(node)}}return scrollables},_getScrollingNode:func
tion(nodes,deltaX,deltaY){if(!deltaX&&!deltaY){return}var verticalScroll=Math.ab
s(deltaY)>=Math.abs(deltaX);for(var i=0;i<nodes.length;i++){var node=nodes[i];va
r canScroll=false;if(verticalScroll){canScroll=deltaY<0?node.scrollTop>0:node.sc
rollTop<node.scrollHeight-node.clientHeight}else{canScroll=deltaX<0?node.scrollL
eft>0:node.scrollLeft<node.scrollWidth-node.clientWidth}if(canScroll){return nod
e}}},_getScrollInfo:function(event){var info={deltaX:event.deltaX,deltaY:event.d
eltaY};if("deltaX"in event){}else if("wheelDeltaX"in event){info.deltaX=-event.w
heelDeltaX;info.deltaY=-event.wheelDeltaY}else if("axis"in event){info.deltaX=ev
ent.axis===1?event.detail:0;info.deltaY=event.axis===2?event.detail:0}else if(ev
ent.targetTouches){var touch=event.targetTouches[0];info.deltaX=LAST_TOUCH_POSIT
ION.pageX-touch.pageX;info.deltaY=LAST_TOUCH_POSITION.pageY-touch.pageY}return i
nfo}}})();(function(){"use strict";Polymer({is:"iron-dropdown",behaviors:[Polyme
r.IronControlState,Polymer.IronA11yKeysBehavior,Polymer.IronOverlayBehavior,Poly
mer.NeonAnimationRunnerBehavior],properties:{horizontalAlign:{type:String,value:
"left",reflectToAttribute:true},verticalAlign:{type:String,value:"top",reflectTo
Attribute:true},openAnimationConfig:{type:Object},closeAnimationConfig:{type:Obj
ect},focusTarget:{type:Object},noAnimations:{type:Boolean,value:false},allowOuts
ideScroll:{type:Boolean,value:false},_boundOnCaptureScroll:{type:Function,value:
function(){return this._onCaptureScroll.bind(this)}}},listeners:{"neon-animation
-finish":"_onNeonAnimationFinish"},observers:["_updateOverlayPosition(positionTa
rget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)"],get co
ntainedElement(){return Polymer.dom(this.$.content).getDistributedNodes()[0]},ge
t _focusTarget(){return this.focusTarget||this.containedElement},ready:function(
){this._scrollTop=0;this._scrollLeft=0;this._refitOnScrollRAF=null},attached:fun
ction(){if(!this.sizingTarget||this.sizingTarget===this){this.sizingTarget=this.
containedElement}},detached:function(){this.cancelAnimation();document.removeEve
ntListener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrollManage
r.removeScrollLock(this)},_openedChanged:function(){if(this.opened&&this.disable
d){this.cancel()}else{this.cancelAnimation();this._updateAnimationConfig();this.
_saveScrollPosition();if(this.opened){document.addEventListener("scroll",this._b
oundOnCaptureScroll);!this.allowOutsideScroll&&Polymer.IronDropdownScrollManager
.pushScrollLock(this)}else{document.removeEventListener("scroll",this._boundOnCa
ptureScroll);Polymer.IronDropdownScrollManager.removeScrollLock(this)}Polymer.Ir
onOverlayBehaviorImpl._openedChanged.apply(this,arguments)}},_renderOpened:funct
ion(){if(!this.noAnimations&&this.animationConfig.open){this.$.contentWrapper.cl
assList.add("animating");this.playAnimation("open")}else{Polymer.IronOverlayBeha
viorImpl._renderOpened.apply(this,arguments)}},_renderClosed:function(){if(!this
.noAnimations&&this.animationConfig.close){this.$.contentWrapper.classList.add("
animating");this.playAnimation("close")}else{Polymer.IronOverlayBehaviorImpl._re
nderClosed.apply(this,arguments)}},_onNeonAnimationFinish:function(){this.$.cont
entWrapper.classList.remove("animating");if(this.opened){this._finishRenderOpene
d()}else{this._finishRenderClosed()}},_onCaptureScroll:function(){if(!this.allow
OutsideScroll){this._restoreScrollPosition()}else{this._refitOnScrollRAF&&window
.cancelAnimationFrame(this._refitOnScrollRAF);this._refitOnScrollRAF=window.requ
estAnimationFrame(this.refit.bind(this))}},_saveScrollPosition:function(){if(doc
ument.scrollingElement){this._scrollTop=document.scrollingElement.scrollTop;this
._scrollLeft=document.scrollingElement.scrollLeft}else{this._scrollTop=Math.max(
document.documentElement.scrollTop,document.body.scrollTop);this._scrollLeft=Mat
h.max(document.documentElement.scrollLeft,document.body.scrollLeft)}},_restoreSc
rollPosition:function(){if(document.scrollingElement){document.scrollingElement.
scrollTop=this._scrollTop;document.scrollingElement.scrollLeft=this._scrollLeft}
else{document.documentElement.scrollTop=this._scrollTop;document.documentElement
.scrollLeft=this._scrollLeft;document.body.scrollTop=this._scrollTop;document.bo
dy.scrollLeft=this._scrollLeft}},_updateAnimationConfig:function(){var animation
s=(this.openAnimationConfig||[]).concat(this.closeAnimationConfig||[]);for(var i
=0;i<animations.length;i++){animations[i].node=this.containedElement}this.animat
ionConfig={open:this.openAnimationConfig,close:this.closeAnimationConfig}},_upda
teOverlayPosition:function(){if(this.isAttached){this.notifyResize()}},_applyFoc
us:function(){var focusTarget=this.focusTarget||this.containedElement;if(focusTa
rget&&this.opened&&!this.noAutoFocus){focusTarget.focus()}else{Polymer.IronOverl
ayBehaviorImpl._applyFocus.apply(this,arguments)}}})})();Polymer({is:"fade-in-an
imation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config){va
r node=config.node;this._effect=new KeyframeEffect(node,[{opacity:"0"},{opacity:
"1"}],this.timingFromConfig(config));return this._effect}});Polymer({is:"fade-ou
t-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config
){var node=config.node;this._effect=new KeyframeEffect(node,[{opacity:"1"},{opac
ity:"0"}],this.timingFromConfig(config));return this._effect}});Polymer({is:"pap
er-menu-grow-height-animation",behaviors:[Polymer.NeonAnimationBehavior],configu
re:function(config){var node=config.node;var rect=node.getBoundingClientRect();v
ar height=rect.height;this._effect=new KeyframeEffect(node,[{height:height/2+"px
"},{height:height+"px"}],this.timingFromConfig(config));return this._effect}});P
olymer({is:"paper-menu-grow-width-animation",behaviors:[Polymer.NeonAnimationBeh
avior],configure:function(config){var node=config.node;var rect=node.getBounding
ClientRect();var width=rect.width;this._effect=new KeyframeEffect(node,[{width:w
idth/2+"px"},{width:width+"px"}],this.timingFromConfig(config));return this._eff
ect}});Polymer({is:"paper-menu-shrink-width-animation",behaviors:[Polymer.NeonAn
imationBehavior],configure:function(config){var node=config.node;var rect=node.g
etBoundingClientRect();var width=rect.width;this._effect=new KeyframeEffect(node
,[{width:width+"px"},{width:width-width/20+"px"}],this.timingFromConfig(config))
;return this._effect}});Polymer({is:"paper-menu-shrink-height-animation",behavio
rs:[Polymer.NeonAnimationBehavior],configure:function(config){var node=config.no
de;var rect=node.getBoundingClientRect();var height=rect.height;var top=rect.top
;this.setPrefixedProperty(node,"transformOrigin","0 0");this._effect=new Keyfram
eEffect(node,[{height:height+"px",transform:"translateY(0)"},{height:height/2+"p
x",transform:"translateY(-20px)"}],this.timingFromConfig(config));return this._e
ffect}});(function(){"use strict";var config={ANIMATION_CUBIC_BEZIER:"cubic-bezi
er(.3,.95,.5,1)",MAX_ANIMATION_TIME_MS:400};var PaperMenuButton=Polymer({is:"pap
er-menu-button",behaviors:[Polymer.IronA11yKeysBehavior,Polymer.IronControlState
],properties:{opened:{type:Boolean,value:false,notify:true,observer:"_openedChan
ged"},horizontalAlign:{type:String,value:"left",reflectToAttribute:true},vertica
lAlign:{type:String,value:"top",reflectToAttribute:true},dynamicAlign:{type:Bool
ean},horizontalOffset:{type:Number,value:0,notify:true},verticalOffset:{type:Num
ber,value:0,notify:true},noOverlap:{type:Boolean},noAnimations:{type:Boolean,val
ue:false},ignoreSelect:{type:Boolean,value:false},closeOnActivate:{type:Boolean,
value:false},openAnimationConfig:{type:Object,value:function(){return[{name:"fad
e-in-animation",timing:{delay:100,duration:200}},{name:"paper-menu-grow-width-an
imation",timing:{delay:100,duration:150,easing:config.ANIMATION_CUBIC_BEZIER}},{
name:"paper-menu-grow-height-animation",timing:{delay:100,duration:275,easing:co
nfig.ANIMATION_CUBIC_BEZIER}}]}},closeAnimationConfig:{type:Object,value:functio
n(){return[{name:"fade-out-animation",timing:{duration:150}},{name:"paper-menu-s
hrink-width-animation",timing:{delay:100,duration:50,easing:config.ANIMATION_CUB
IC_BEZIER}},{name:"paper-menu-shrink-height-animation",timing:{duration:200,easi
ng:"ease-in"}}]}},allowOutsideScroll:{type:Boolean,value:false},restoreFocusOnCl
ose:{type:Boolean,value:true},_dropdownContent:{type:Object}},hostAttributes:{ro
le:"group","aria-haspopup":"true"},listeners:{"iron-activate":"_onIronActivate",
"iron-select":"_onIronSelect"},get contentElement(){return Polymer.dom(this.$.co
ntent).getDistributedNodes()[0]},toggle:function(){if(this.opened){this.close()}
else{this.open()}},open:function(){if(this.disabled){return}this.$.dropdown.open
()},close:function(){this.$.dropdown.close()},_onIronSelect:function(event){if(!
this.ignoreSelect){this.close()}},_onIronActivate:function(event){if(this.closeO
nActivate){this.close()}},_openedChanged:function(opened,oldOpened){if(opened){t
his._dropdownContent=this.contentElement;this.fire("paper-dropdown-open")}else i
f(oldOpened!=null){this.fire("paper-dropdown-close")}},_disabledChanged:function
(disabled){Polymer.IronControlState._disabledChanged.apply(this,arguments);if(di
sabled&&this.opened){this.close()}},__onIronOverlayCanceled:function(event){var
uiEvent=event.detail;var target=Polymer.dom(uiEvent).rootTarget;var trigger=this
.$.trigger;var path=Polymer.dom(uiEvent).path;if(path.indexOf(trigger)>-1){event
.preventDefault()}}});Object.keys(config).forEach(function(key){PaperMenuButton[
key]=config[key]});Polymer.PaperMenuButton=PaperMenuButton})();Polymer.PaperInky
FocusBehaviorImpl={observers:["_focusedChanged(receivedFocusFromKeyboard)"],_foc
usedChanged:function(receivedFocusFromKeyboard){if(receivedFocusFromKeyboard){th
is.ensureRipple()}if(this.hasRipple()){this._ripple.holdDown=receivedFocusFromKe
yboard}},_createRipple:function(){var ripple=Polymer.PaperRippleBehavior._create
Ripple();ripple.id="ink";ripple.setAttribute("center","");ripple.classList.add("
circle");return ripple}};Polymer.PaperInkyFocusBehavior=[Polymer.IronButtonState
,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperInkyFocusBeha
viorImpl];Polymer({is:"paper-icon-button",hostAttributes:{role:"button",tabindex
:"0"},behaviors:[Polymer.PaperInkyFocusBehavior],properties:{src:{type:String},i
con:{type:String},alt:{type:String,observer:"_altChanged"}},_altChanged:function
(newValue,oldValue){var label=this.getAttribute("aria-label");if(!label||oldValu
e==label){this.setAttribute("aria-label",newValue)}}});Polymer({is:"iron-media-q
uery",properties:{queryMatches:{type:Boolean,value:false,readOnly:true,notify:tr
ue},query:{type:String,observer:"queryChanged"},full:{type:Boolean,value:false},
_boundMQHandler:{value:function(){return this.queryHandler.bind(this)}},_mq:{val
ue:null}},attached:function(){this.style.display="none";this.queryChanged()},det
ached:function(){this._remove()},_add:function(){if(this._mq){this._mq.addListen
er(this._boundMQHandler)}},_remove:function(){if(this._mq){this._mq.removeListen
er(this._boundMQHandler)}this._mq=null},queryChanged:function(){this._remove();v
ar query=this.query;if(!query){return}if(!this.full&&query[0]!=="("){query="("+q
uery+")"}this._mq=window.matchMedia(query);this._add();this.queryHandler(this._m
q)},queryHandler:function(mq){this._setQueryMatches(mq.matches)}});(function(){"
use strict";Polymer.IronA11yAnnouncer=Polymer({is:"iron-a11y-announcer",properti
es:{mode:{type:String,value:"polite"},_text:{type:String,value:""}},created:func
tion(){if(!Polymer.IronA11yAnnouncer.instance){Polymer.IronA11yAnnouncer.instanc
e=this}document.body.addEventListener("iron-announce",this._onIronAnnounce.bind(
this))},announce:function(text){this._text="";this.async(function(){this._text=t
ext},100)},_onIronAnnounce:function(event){if(event.detail&&event.detail.text){t
his.announce(event.detail.text)}}});Polymer.IronA11yAnnouncer.instance=null;Poly
mer.IronA11yAnnouncer.requestAvailability=function(){if(!Polymer.IronA11yAnnounc
er.instance){Polymer.IronA11yAnnouncer.instance=document.createElement("iron-a11
y-announcer")}document.body.appendChild(Polymer.IronA11yAnnouncer.instance)}})()
;Polymer.IronValidatableBehaviorMeta=null;Polymer.IronValidatableBehavior={prope
rties:{validator:{type:String},invalid:{notify:true,reflectToAttribute:true,type
:Boolean,value:false},_validatorMeta:{type:Object},validatorType:{type:String,va
lue:"validator"},_validator:{type:Object,computed:"__computeValidator(validator)
"}},observers:["_invalidChanged(invalid)"],registered:function(){Polymer.IronVal
idatableBehaviorMeta=new Polymer.IronMeta({type:"validator"})},_invalidChanged:f
unction(){if(this.invalid){this.setAttribute("aria-invalid","true")}else{this.re
moveAttribute("aria-invalid")}},hasValidator:function(){return this._validator!=
null},validate:function(value){this.invalid=!this._getValidity(value);return!thi
s.invalid},_getValidity:function(value){if(this.hasValidator()){return this._val
idator.validate(value)}return true},__computeValidator:function(){return Polymer
.IronValidatableBehaviorMeta&&Polymer.IronValidatableBehaviorMeta.byKey(this.val
idator)}};Polymer({is:"iron-input","extends":"input",behaviors:[Polymer.IronVali
datableBehavior],properties:{bindValue:{observer:"_bindValueChanged",type:String
},preventInvalidInput:{type:Boolean},allowedPattern:{type:String,observer:"_allo
wedPatternChanged"},_previousValidInput:{type:String,value:""},_patternAlreadyCh
ecked:{type:Boolean,value:false}},listeners:{input:"_onInput",keypress:"_onKeypr
ess"},registered:function(){if(!this._canDispatchEventOnDisabled()){this._origDi
spatchEvent=this.dispatchEvent;this.dispatchEvent=this._dispatchEventFirefoxIE}}
,created:function(){Polymer.IronA11yAnnouncer.requestAvailability()},_canDispatc
hEventOnDisabled:function(){var input=document.createElement("input");var canDis
patch=false;input.disabled=true;input.addEventListener("feature-check-dispatch-e
vent",function(){canDispatch=true});try{input.dispatchEvent(new Event("feature-c
heck-dispatch-event"))}catch(e){}return canDispatch},_dispatchEventFirefoxIE:fun
ction(){var disabled=this.disabled;this.disabled=false;this._origDispatchEvent.a
pply(this,arguments);this.disabled=disabled},get _patternRegExp(){var pattern;if
(this.allowedPattern){pattern=new RegExp(this.allowedPattern)}else{switch(this.t
ype){case"number":pattern=/[0-9.,e-]/;break}}return pattern},ready:function(){th
is.bindValue=this.value},_bindValueChanged:function(){if(this.value!==this.bindV
alue){this.value=!(this.bindValue||this.bindValue===0||this.bindValue===false)?"
":this.bindValue}this.fire("bind-value-changed",{value:this.bindValue})},_allowe
dPatternChanged:function(){this.preventInvalidInput=this.allowedPattern?true:fal
se},_onInput:function(){if(this.preventInvalidInput&&!this._patternAlreadyChecke
d){var valid=this._checkPatternValidity();if(!valid){this._announceInvalidCharac
ter("Invalid string of characters not entered.");this.value=this._previousValidI
nput}}this.bindValue=this.value;this._previousValidInput=this.value;this._patter
nAlreadyChecked=false},_isPrintable:function(event){var anyNonPrintable=event.ke
yCode==8||event.keyCode==9||event.keyCode==13||event.keyCode==27;var mozNonPrint
able=event.keyCode==19||event.keyCode==20||event.keyCode==45||event.keyCode==46|
|event.keyCode==144||event.keyCode==145||event.keyCode>32&&event.keyCode<41||eve
nt.keyCode>111&&event.keyCode<124;return!anyNonPrintable&&!(event.charCode==0&&m
ozNonPrintable)},_onKeypress:function(event){if(!this.preventInvalidInput&&this.
type!=="number"){return}var regexp=this._patternRegExp;if(!regexp){return}if(eve
nt.metaKey||event.ctrlKey||event.altKey)return;this._patternAlreadyChecked=true;
var thisChar=String.fromCharCode(event.charCode);if(this._isPrintable(event)&&!r
egexp.test(thisChar)){event.preventDefault();this._announceInvalidCharacter("Inv
alid character "+thisChar+" not entered.")}},_checkPatternValidity:function(){va
r regexp=this._patternRegExp;if(!regexp){return true}for(var i=0;i<this.value.le
ngth;i++){if(!regexp.test(this.value[i])){return false}}return true},validate:fu
nction(){var valid=this.checkValidity();if(valid){if(this.required&&this.value==
=""){valid=false}else if(this.hasValidator()){valid=Polymer.IronValidatableBehav
ior.validate.call(this,this.value)}}this.invalid=!valid;this.fire("iron-input-va
lidate");return valid},_announceInvalidCharacter:function(message){this.fire("ir
on-announce",{text:message})}});Polymer({is:"paper-input-container",properties:{
noLabelFloat:{type:Boolean,value:false},alwaysFloatLabel:{type:Boolean,value:fal
se},attrForValue:{type:String,value:"bind-value"},autoValidate:{type:Boolean,val
ue:false},invalid:{observer:"_invalidChanged",type:Boolean,value:false},focused:
{readOnly:true,type:Boolean,value:false,notify:true},_addons:{type:Array},_input
HasContent:{type:Boolean,value:false},_inputSelector:{type:String,value:"input,t
extarea,.paper-input-input"},_boundOnFocus:{type:Function,value:function(){retur
n this._onFocus.bind(this)}},_boundOnBlur:{type:Function,value:function(){return
this._onBlur.bind(this)}},_boundOnInput:{type:Function,value:function(){return
this._onInput.bind(this); |
| 48 | 48 |
| 49 }},_boundValueChanged:{type:Function,value:function(){return this._onValueChange
d.bind(this)}}},listeners:{"addon-attached":"_onAddonAttached","iron-input-valid
ate":"_onIronInputValidate"},get _valueChangedEvent(){return this.attrForValue+"
-changed"},get _propertyForValue(){return Polymer.CaseMap.dashToCamelCase(this.a
ttrForValue)},get _inputElement(){return Polymer.dom(this).querySelector(this._i
nputSelector)},get _inputElementValue(){return this._inputElement[this._property
ForValue]||this._inputElement.value},ready:function(){if(!this._addons){this._ad
dons=[]}this.addEventListener("focus",this._boundOnFocus,true);this.addEventList
ener("blur",this._boundOnBlur,true)},attached:function(){if(this.attrForValue){t
his._inputElement.addEventListener(this._valueChangedEvent,this._boundValueChang
ed)}else{this.addEventListener("input",this._onInput)}if(this._inputElementValue
!=""){this._handleValueAndAutoValidate(this._inputElement)}else{this._handleValu
e(this._inputElement)}},_onAddonAttached:function(event){if(!this._addons){this.
_addons=[]}var target=event.target;if(this._addons.indexOf(target)===-1){this._a
ddons.push(target);if(this.isAttached){this._handleValue(this._inputElement)}}},
_onFocus:function(){this._setFocused(true)},_onBlur:function(){this._setFocused(
false);this._handleValueAndAutoValidate(this._inputElement)},_onInput:function(e
vent){this._handleValueAndAutoValidate(event.target)},_onValueChanged:function(e
vent){this._handleValueAndAutoValidate(event.target)},_handleValue:function(inpu
tElement){var value=this._inputElementValue;if(value||value===0||inputElement.ty
pe==="number"&&!inputElement.checkValidity()){this._inputHasContent=true}else{th
is._inputHasContent=false}this.updateAddons({inputElement:inputElement,value:val
ue,invalid:this.invalid})},_handleValueAndAutoValidate:function(inputElement){if
(this.autoValidate){var valid;if(inputElement.validate){valid=inputElement.valid
ate(this._inputElementValue)}else{valid=inputElement.checkValidity()}this.invali
d=!valid}this._handleValue(inputElement)},_onIronInputValidate:function(event){t
his.invalid=this._inputElement.invalid},_invalidChanged:function(){if(this._addo
ns){this.updateAddons({invalid:this.invalid})}},updateAddons:function(state){for
(var addon,index=0;addon=this._addons[index];index++){addon.update(state)}},_com
puteInputContentClass:function(noLabelFloat,alwaysFloatLabel,focused,invalid,_in
putHasContent){var cls="input-content";if(!noLabelFloat){var label=this.querySel
ector("label");if(alwaysFloatLabel||_inputHasContent){cls+=" label-is-floating";
this.$.labelAndInputContainer.style.position="static";if(invalid){cls+=" is-inva
lid"}else if(focused){cls+=" label-is-highlighted"}}else{if(label){this.$.labelA
ndInputContainer.style.position="relative"}}}else{if(_inputHasContent){cls+=" la
bel-is-hidden"}}return cls},_computeUnderlineClass:function(focused,invalid){var
cls="underline";if(invalid){cls+=" is-invalid"}else if(focused){cls+=" is-highl
ighted"}return cls},_computeAddOnContentClass:function(focused,invalid){var cls=
"add-on-content";if(invalid){cls+=" is-invalid"}else if(focused){cls+=" is-highl
ighted"}return cls}});Polymer.PaperSpinnerBehavior={listeners:{animationend:"__r
eset",webkitAnimationEnd:"__reset"},properties:{active:{type:Boolean,value:false
,reflectToAttribute:true,observer:"__activeChanged"},alt:{type:String,value:"loa
ding",observer:"__altChanged"},__coolingDown:{type:Boolean,value:false}},__compu
teContainerClasses:function(active,coolingDown){return[active||coolingDown?"acti
ve":"",coolingDown?"cooldown":""].join(" ")},__activeChanged:function(active,old
){this.__setAriaHidden(!active);this.__coolingDown=!active&&old},__altChanged:fu
nction(alt){if(alt===this.getPropertyInfo("alt").value){this.alt=this.getAttribu
te("aria-label")||alt}else{this.__setAriaHidden(alt==="");this.setAttribute("ari
a-label",alt)}},__setAriaHidden:function(hidden){var attr="aria-hidden";if(hidde
n){this.setAttribute(attr,"true")}else{this.removeAttribute(attr)}},__reset:func
tion(){this.active=false;this.__coolingDown=false}};Polymer({is:"paper-spinner-l
ite",behaviors:[Polymer.PaperSpinnerBehavior]}); | 49 }},_boundValueChanged:{type:Function,value:function(){return this._onValueChange
d.bind(this)}}},listeners:{"addon-attached":"_onAddonAttached","iron-input-valid
ate":"_onIronInputValidate"},get _valueChangedEvent(){return this.attrForValue+"
-changed"},get _propertyForValue(){return Polymer.CaseMap.dashToCamelCase(this.a
ttrForValue)},get _inputElement(){return Polymer.dom(this).querySelector(this._i
nputSelector)},get _inputElementValue(){return this._inputElement[this._property
ForValue]||this._inputElement.value},ready:function(){if(!this._addons){this._ad
dons=[]}this.addEventListener("focus",this._boundOnFocus,true);this.addEventList
ener("blur",this._boundOnBlur,true)},attached:function(){if(this.attrForValue){t
his._inputElement.addEventListener(this._valueChangedEvent,this._boundValueChang
ed)}else{this.addEventListener("input",this._onInput)}if(this._inputElementValue
!=""){this._handleValueAndAutoValidate(this._inputElement)}else{this._handleValu
e(this._inputElement)}},_onAddonAttached:function(event){if(!this._addons){this.
_addons=[]}var target=event.target;if(this._addons.indexOf(target)===-1){this._a
ddons.push(target);if(this.isAttached){this._handleValue(this._inputElement)}}},
_onFocus:function(){this._setFocused(true)},_onBlur:function(){this._setFocused(
false);this._handleValueAndAutoValidate(this._inputElement)},_onInput:function(e
vent){this._handleValueAndAutoValidate(event.target)},_onValueChanged:function(e
vent){this._handleValueAndAutoValidate(event.target)},_handleValue:function(inpu
tElement){var value=this._inputElementValue;if(value||value===0||inputElement.ty
pe==="number"&&!inputElement.checkValidity()){this._inputHasContent=true}else{th
is._inputHasContent=false}this.updateAddons({inputElement:inputElement,value:val
ue,invalid:this.invalid})},_handleValueAndAutoValidate:function(inputElement){if
(this.autoValidate){var valid;if(inputElement.validate){valid=inputElement.valid
ate(this._inputElementValue)}else{valid=inputElement.checkValidity()}this.invali
d=!valid}this._handleValue(inputElement)},_onIronInputValidate:function(event){t
his.invalid=this._inputElement.invalid},_invalidChanged:function(){if(this._addo
ns){this.updateAddons({invalid:this.invalid})}},updateAddons:function(state){for
(var addon,index=0;addon=this._addons[index];index++){addon.update(state)}},_com
puteInputContentClass:function(noLabelFloat,alwaysFloatLabel,focused,invalid,_in
putHasContent){var cls="input-content";if(!noLabelFloat){var label=this.querySel
ector("label");if(alwaysFloatLabel||_inputHasContent){cls+=" label-is-floating";
this.$.labelAndInputContainer.style.position="static";if(invalid){cls+=" is-inva
lid"}else if(focused){cls+=" label-is-highlighted"}}else{if(label){this.$.labelA
ndInputContainer.style.position="relative"}}}else{if(_inputHasContent){cls+=" la
bel-is-hidden"}}return cls},_computeUnderlineClass:function(focused,invalid){var
cls="underline";if(invalid){cls+=" is-invalid"}else if(focused){cls+=" is-highl
ighted"}return cls},_computeAddOnContentClass:function(focused,invalid){var cls=
"add-on-content";if(invalid){cls+=" is-invalid"}else if(focused){cls+=" is-highl
ighted"}return cls}});Polymer.PaperSpinnerBehavior={listeners:{animationend:"__r
eset",webkitAnimationEnd:"__reset"},properties:{active:{type:Boolean,value:false
,reflectToAttribute:true,observer:"__activeChanged"},alt:{type:String,value:"loa
ding",observer:"__altChanged"},__coolingDown:{type:Boolean,value:false}},__compu
teContainerClasses:function(active,coolingDown){return[active||coolingDown?"acti
ve":"",coolingDown?"cooldown":""].join(" ")},__activeChanged:function(active,old
){this.__setAriaHidden(!active);this.__coolingDown=!active&&old},__altChanged:fu
nction(alt){if(alt===this.getPropertyInfo("alt").value){this.alt=this.getAttribu
te("aria-label")||alt}else{this.__setAriaHidden(alt==="");this.setAttribute("ari
a-label",alt)}},__setAriaHidden:function(hidden){var attr="aria-hidden";if(hidde
n){this.setAttribute(attr,"true")}else{this.removeAttribute(attr)}},__reset:func
tion(){this.active=false;this.__coolingDown=false}};Polymer({is:"paper-spinner-l
ite",behaviors:[Polymer.PaperSpinnerBehavior]}); |
| 50 // Copyright 2016 The Chromium Authors. All rights reserved. | 50 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 51 // Use of this source code is governed by a BSD-style license that can be | 51 // Use of this source code is governed by a BSD-style license that can be |
| 52 // found in the LICENSE file. | 52 // found in the LICENSE file. |
| 53 var CrSearchFieldBehavior={properties:{label:{type:String,value:""},clearLabel:{
type:String,value:""},showingSearch:{type:Boolean,value:false,notify:true,observ
er:"showingSearchChanged_",reflectToAttribute:true},lastValue_:{type:String,valu
e:""}},getSearchInput:function(){},getValue:function(){return this.getSearchInpu
t().value},setValue:function(value){this.getSearchInput().bindValue=value;this.o
nValueChanged_(value)},showAndFocus:function(){this.showingSearch=true;this.focu
s_()},focus_:function(){this.getSearchInput().focus()},onSearchTermSearch:functi
on(){this.onValueChanged_(this.getValue())},onValueChanged_:function(newValue){i
f(newValue==this.lastValue_)return;this.lastValue_=newValue;this.fire("search-ch
anged",newValue)},onSearchTermKeydown:function(e){if(e.key=="Escape")this.showin
gSearch=false},showingSearchChanged_:function(){if(this.showingSearch){this.focu
s_();return}this.setValue("");this.getSearchInput().blur()}}; | 53 var CrSearchFieldBehavior={properties:{label:{type:String,value:""},clearLabel:{
type:String,value:""},showingSearch:{type:Boolean,value:false,notify:true,observ
er:"showingSearchChanged_",reflectToAttribute:true},lastValue_:{type:String,valu
e:""}},getSearchInput:function(){},getValue:function(){return this.getSearchInpu
t().value},setValue:function(value){this.getSearchInput().bindValue=value;this.o
nValueChanged_(value)},showAndFocus:function(){this.showingSearch=true;this.focu
s_()},focus_:function(){this.getSearchInput().focus()},onSearchTermSearch:functi
on(){this.onValueChanged_(this.getValue())},onValueChanged_:function(newValue){i
f(newValue==this.lastValue_)return;this.lastValue_=newValue;this.fire("search-ch
anged",newValue)},onSearchTermKeydown:function(e){if(e.key=="Escape")this.showin
gSearch=false},showingSearchChanged_:function(current,previous){if(previous==und
efined)return;if(this.showingSearch){this.focus_();return}this.setValue("");this
.getSearchInput().blur()}}; |
| 54 // Copyright 2016 The Chromium Authors. All rights reserved. | 54 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 55 // Use of this source code is governed by a BSD-style license that can be | 55 // Use of this source code is governed by a BSD-style license that can be |
| 56 // found in the LICENSE file. | 56 // found in the LICENSE file. |
| 57 Polymer({is:"cr-toolbar-search-field",behaviors:[CrSearchFieldBehavior],properti
es:{narrow:{type:Boolean,reflectToAttribute:true},label:String,clearLabel:String
,spinnerActive:{type:Boolean,reflectToAttribute:true},hasSearchText_:Boolean,isS
pinnerShown_:{type:Boolean,computed:"computeIsSpinnerShown_(spinnerActive, showi
ngSearch)"}},listeners:{tap:"showSearch_","searchInput.bind-value-changed":"onBi
ndValueChanged_"},getSearchInput:function(){return this.$.searchInput},isSearchF
ocused:function(){return this.$.searchTerm.focused},computeIconTabIndex_:functio
n(narrow){return narrow?0:-1},computeIsSpinnerShown_:function(){return this.spin
nerActive&&this.showingSearch},onInputBlur_:function(){if(!this.hasSearchText_)t
his.showingSearch=false},onBindValueChanged_:function(){var newValue=this.$.sear
chInput.bindValue;this.hasSearchText_=newValue!="";if(newValue!="")this.showingS
earch=true},showSearch_:function(e){if(e.target!=this.$.clearSearch)this.showing
Search=true},clearSearch_:function(e){this.setValue("");this.getSearchInput().fo
cus()}}); | 57 Polymer({is:"cr-toolbar-search-field",behaviors:[CrSearchFieldBehavior],properti
es:{narrow:{type:Boolean,reflectToAttribute:true},label:String,clearLabel:String
,spinnerActive:{type:Boolean,reflectToAttribute:true},hasSearchText_:Boolean,isS
pinnerShown_:{type:Boolean,computed:"computeIsSpinnerShown_(spinnerActive, showi
ngSearch)"}},listeners:{tap:"showSearch_","searchInput.bind-value-changed":"onBi
ndValueChanged_"},getSearchInput:function(){return this.$.searchInput},isSearchF
ocused:function(){return this.$.searchTerm.focused},computeIconTabIndex_:functio
n(narrow){return narrow?0:-1},computeIsSpinnerShown_:function(){return this.spin
nerActive&&this.showingSearch},onInputBlur_:function(){if(!this.hasSearchText_)t
his.showingSearch=false},onBindValueChanged_:function(){var newValue=this.$.sear
chInput.bindValue;this.hasSearchText_=newValue!="";if(newValue!="")this.showingS
earch=true},showSearch_:function(e){if(e.target!=this.$.clearSearch)this.showing
Search=true},clearSearch_:function(e){this.setValue("");this.getSearchInput().fo
cus()}}); |
| 58 // Copyright 2016 The Chromium Authors. All rights reserved. | 58 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 59 // Use of this source code is governed by a BSD-style license that can be | 59 // Use of this source code is governed by a BSD-style license that can be |
| 60 // found in the LICENSE file. | 60 // found in the LICENSE file. |
| 61 Polymer({is:"cr-toolbar",properties:{pageName:String,searchPrompt:String,clearLa
bel:String,menuLabel:String,menuPromo:String,spinnerActive:Boolean,showMenu:{typ
e:Boolean,value:false},showMenuPromo:{type:Boolean,value:false},closeMenuPromo:S
tring,narrow_:{type:Boolean,reflectToAttribute:true},showingSearch_:{type:Boolea
n,reflectToAttribute:true}},observers:["possiblyShowMenuPromo_(showMenu, showMen
uPromo, showingSearch_)"],getSearchField:function(){return this.$.search},onClos
ePromoTap_:function(){this.fire("cr-toolbar-menu-promo-close")},onMenuTap_:funct
ion(){this.fire("cr-toolbar-menu-tap")},possiblyShowMenuPromo_:function(){Polyme
r.RenderStatus.afterNextRender(this,function(){if(this.showMenu&&this.showMenuPr
omo&&!this.showingSearch_){this.$$("#menuPromo").animate({opacity:[0,.9]},{durat
ion:500,fill:"forwards"});this.fire("cr-toolbar-menu-promo-shown")}}.bind(this))
},titleIfNotShowMenuPromo_:function(title,showMenuPromo){return showMenuPromo?""
:title}}); | 61 Polymer({is:"cr-toolbar",properties:{pageName:String,searchPrompt:String,clearLa
bel:String,menuLabel:String,menuPromo:String,spinnerActive:Boolean,showMenu:{typ
e:Boolean,value:false},showMenuPromo:{type:Boolean,value:false},closeMenuPromo:S
tring,narrow_:{type:Boolean,reflectToAttribute:true},showingSearch_:{type:Boolea
n,reflectToAttribute:true}},observers:["possiblyShowMenuPromo_(showMenu, showMen
uPromo, showingSearch_)"],getSearchField:function(){return this.$.search},onClos
ePromoTap_:function(){this.fire("cr-toolbar-menu-promo-close")},onMenuTap_:funct
ion(){this.fire("cr-toolbar-menu-tap")},possiblyShowMenuPromo_:function(){Polyme
r.RenderStatus.afterNextRender(this,function(){if(this.showMenu&&this.showMenuPr
omo&&!this.showingSearch_){this.$$("#menuPromo").animate({opacity:[0,.9]},{durat
ion:500,fill:"forwards"});this.fire("cr-toolbar-menu-promo-shown")}}.bind(this))
},titleIfNotShowMenuPromo_:function(title,showMenuPromo){return showMenuPromo?""
:title}}); |
| 62 // Copyright 2015 The Chromium Authors. All rights reserved. | 62 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 63 // Use of this source code is governed by a BSD-style license that can be | 63 // Use of this source code is governed by a BSD-style license that can be |
| 64 // found in the LICENSE file. | 64 // found in the LICENSE file. |
| 65 cr.define("downloads",function(){var Toolbar=Polymer({is:"downloads-toolbar",pro
perties:{downloadsShowing:{reflectToAttribute:true,type:Boolean,value:false,obse
rver:"downloadsShowingChanged_"},spinnerActive:{type:Boolean,notify:true}},liste
ners:{"paper-dropdown-close":"onPaperDropdownClose_","paper-dropdown-open":"onPa
perDropdownOpen_"},canUndo:function(){return!this.$.toolbar.getSearchField().isS
earchFocused()},canClearAll:function(){return!this.$.toolbar.getSearchField().ge
tValue()&&this.downloadsShowing},onFindCommand:function(){this.$.toolbar.getSear
chField().showAndFocus()},closeMoreActions_:function(){this.$.more.close()},down
loadsShowingChanged_:function(){this.updateClearAll_()},onClearAllTap_:function(
){assert(this.canClearAll());downloads.ActionService.getInstance().clearAll()},o
nPaperDropdownClose_:function(){window.removeEventListener("resize",assert(this.
boundClose_))},onItemBlur_:function(e){var menu=this.$$("paper-menu");if(menu.it
ems.indexOf(e.relatedTarget)>=0)return;this.$.more.restoreFocusOnClose=false;thi
s.closeMoreActions_();this.$.more.restoreFocusOnClose=true},onPaperDropdownOpen_
:function(){this.boundClose_=this.boundClose_||this.closeMoreActions_.bind(this)
;window.addEventListener("resize",this.boundClose_)},onSearchChanged_:function(e
vent){var actionService=downloads.ActionService.getInstance();if(actionService.s
earch(event.detail))this.spinnerActive=actionService.isSearching();this.updateCl
earAll_()},onOpenDownloadsFolderTap_:function(){downloads.ActionService.getInsta
nce().openDownloadsFolder()},updateClearAll_:function(){this.$$("paper-menu .cle
ar-all").hidden=!this.canClearAll()}});return{Toolbar:Toolbar}}); | 65 cr.define("downloads",function(){var Toolbar=Polymer({is:"downloads-toolbar",pro
perties:{downloadsShowing:{reflectToAttribute:true,type:Boolean,value:false,obse
rver:"downloadsShowingChanged_"},spinnerActive:{type:Boolean,notify:true}},liste
ners:{"paper-dropdown-close":"onPaperDropdownClose_","paper-dropdown-open":"onPa
perDropdownOpen_"},canUndo:function(){return!this.$.toolbar.getSearchField().isS
earchFocused()},canClearAll:function(){return!this.$.toolbar.getSearchField().ge
tValue()&&this.downloadsShowing},onFindCommand:function(){this.$.toolbar.getSear
chField().showAndFocus()},closeMoreActions_:function(){this.$.more.close()},down
loadsShowingChanged_:function(){this.updateClearAll_()},onClearAllTap_:function(
){assert(this.canClearAll());downloads.ActionService.getInstance().clearAll()},o
nPaperDropdownClose_:function(){window.removeEventListener("resize",assert(this.
boundClose_))},onItemBlur_:function(e){var menu=this.$$("paper-menu");if(menu.it
ems.indexOf(e.relatedTarget)>=0)return;this.$.more.restoreFocusOnClose=false;thi
s.closeMoreActions_();this.$.more.restoreFocusOnClose=true},onPaperDropdownOpen_
:function(){this.boundClose_=this.boundClose_||this.closeMoreActions_.bind(this)
;window.addEventListener("resize",this.boundClose_)},onSearchChanged_:function(e
vent){var actionService=downloads.ActionService.getInstance();if(actionService.s
earch(event.detail))this.spinnerActive=actionService.isSearching();this.updateCl
earAll_()},onOpenDownloadsFolderTap_:function(){downloads.ActionService.getInsta
nce().openDownloadsFolder()},updateClearAll_:function(){this.$$("paper-menu .cle
ar-all").hidden=!this.canClearAll()}});return{Toolbar:Toolbar}}); |
| 66 // Copyright 2015 The Chromium Authors. All rights reserved. | 66 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 67 // Use of this source code is governed by a BSD-style license that can be | 67 // Use of this source code is governed by a BSD-style license that can be |
| 68 // found in the LICENSE file. | 68 // found in the LICENSE file. |
| 69 cr.define("downloads",function(){var Manager=Polymer({is:"downloads-manager",pro
perties:{hasDownloads_:{observer:"hasDownloadsChanged_",type:Boolean},hasShadow_
:{type:Boolean,value:false,reflectToAttribute:true},inSearchMode_:{type:Boolean,
value:false},items_:{type:Array,value:function(){return[]}},spinnerActive_:{type
:Boolean,notify:true}},hostAttributes:{loading:true},listeners:{"downloads-list.
scroll":"onListScroll_","toolbar.search-changed":"onSearchChanged_"},observers:[
"itemsChanged_(items_.*)"],clearAll_:function(){this.set("items_",[])},hasDownlo
adsChanged_:function(){if(loadTimeData.getBoolean("allowDeletingHistory"))this.$
.toolbar.downloadsShowing=this.hasDownloads_;if(this.hasDownloads_)this.$["downl
oads-list"].fire("iron-resize")},insertItems_:function(index,list){this.splice.a
pply(this,["items_",index,0].concat(list));this.updateHideDates_(index,index+lis
t.length);this.removeAttribute("loading");this.spinnerActive_=false},itemsChange
d_:function(){this.hasDownloads_=this.items_.length>0},noDownloadsText_:function
(){return loadTimeData.getString(this.inSearchMode_?"noSearchResults":"noDownloa
ds")},onCanExecute_:function(e){e=e;switch(e.command.id){case"undo-command":e.ca
nExecute=this.$.toolbar.canUndo();break;case"clear-all-command":e.canExecute=thi
s.$.toolbar.canClearAll();break;case"find-command":e.canExecute=true;break}},onC
ommand_:function(e){if(e.command.id=="clear-all-command")downloads.ActionService
.getInstance().clearAll();else if(e.command.id=="undo-command")downloads.ActionS
ervice.getInstance().undo();else if(e.command.id=="find-command")this.$.toolbar.
onFindCommand()},onListScroll_:function(){var list=this.$["downloads-list"];if(l
ist.scrollHeight-list.scrollTop-list.offsetHeight<=100){downloads.ActionService.
getInstance().loadMore()}this.hasShadow_=list.scrollTop>0},onLoad_:function(){cr
.ui.decorate("command",cr.ui.Command);document.addEventListener("canExecute",thi
s.onCanExecute_.bind(this));document.addEventListener("command",this.onCommand_.
bind(this));downloads.ActionService.getInstance().loadMore()},onSearchChanged_:f
unction(){this.inSearchMode_=downloads.ActionService.getInstance().isSearching()
},removeItem_:function(index){this.splice("items_",index,1);this.updateHideDates
_(index,index);this.onListScroll_()},updateHideDates_:function(start,end){for(va
r i=start;i<=end;++i){var current=this.items_[i];if(!current)continue;var prev=t
his.items_[i-1];var hideDate=!!prev&&prev.date_string==current.date_string;this.
set("items_."+i+".hideDate",hideDate)}},updateItem_:function(index,data){this.se
t("items_."+index,data);this.updateHideDates_(index,index);var list=this.$["down
loads-list"];list.updateSizeForItem(index)}});Manager.clearAll=function(){Manage
r.get().clearAll_()};Manager.get=function(){return queryRequiredElement("downloa
ds-manager")};Manager.insertItems=function(index,list){Manager.get().insertItems
_(index,list)};Manager.onLoad=function(){Manager.get().onLoad_()};Manager.remove
Item=function(index){Manager.get().removeItem_(index)};Manager.updateItem=functi
on(index,data){Manager.get().updateItem_(index,data)};return{Manager:Manager}}); | 69 cr.define("downloads",function(){var Manager=Polymer({is:"downloads-manager",pro
perties:{hasDownloads_:{observer:"hasDownloadsChanged_",type:Boolean},hasShadow_
:{type:Boolean,value:false,reflectToAttribute:true},inSearchMode_:{type:Boolean,
value:false},items_:{type:Array,value:function(){return[]}},spinnerActive_:{type
:Boolean,notify:true}},hostAttributes:{loading:true},listeners:{"downloads-list.
scroll":"onListScroll_","toolbar.search-changed":"onSearchChanged_"},observers:[
"itemsChanged_(items_.*)"],clearAll_:function(){this.set("items_",[])},hasDownlo
adsChanged_:function(){if(loadTimeData.getBoolean("allowDeletingHistory"))this.$
.toolbar.downloadsShowing=this.hasDownloads_;if(this.hasDownloads_)this.$["downl
oads-list"].fire("iron-resize")},insertItems_:function(index,list){this.splice.a
pply(this,["items_",index,0].concat(list));this.updateHideDates_(index,index+lis
t.length);this.removeAttribute("loading");this.spinnerActive_=false},itemsChange
d_:function(){this.hasDownloads_=this.items_.length>0},noDownloadsText_:function
(){return loadTimeData.getString(this.inSearchMode_?"noSearchResults":"noDownloa
ds")},onCanExecute_:function(e){e=e;switch(e.command.id){case"undo-command":e.ca
nExecute=this.$.toolbar.canUndo();break;case"clear-all-command":e.canExecute=thi
s.$.toolbar.canClearAll();break;case"find-command":e.canExecute=true;break}},onC
ommand_:function(e){if(e.command.id=="clear-all-command")downloads.ActionService
.getInstance().clearAll();else if(e.command.id=="undo-command")downloads.ActionS
ervice.getInstance().undo();else if(e.command.id=="find-command")this.$.toolbar.
onFindCommand()},onListScroll_:function(){var list=this.$["downloads-list"];if(l
ist.scrollHeight-list.scrollTop-list.offsetHeight<=100){downloads.ActionService.
getInstance().loadMore()}this.hasShadow_=list.scrollTop>0},onLoad_:function(){cr
.ui.decorate("command",cr.ui.Command);document.addEventListener("canExecute",thi
s.onCanExecute_.bind(this));document.addEventListener("command",this.onCommand_.
bind(this));downloads.ActionService.getInstance().loadMore()},onSearchChanged_:f
unction(){this.inSearchMode_=downloads.ActionService.getInstance().isSearching()
},removeItem_:function(index){this.splice("items_",index,1);this.updateHideDates
_(index,index);this.onListScroll_()},updateHideDates_:function(start,end){for(va
r i=start;i<=end;++i){var current=this.items_[i];if(!current)continue;var prev=t
his.items_[i-1];var hideDate=!!prev&&prev.date_string==current.date_string;this.
set("items_."+i+".hideDate",hideDate)}},updateItem_:function(index,data){this.se
t("items_."+index,data);this.updateHideDates_(index,index);var list=this.$["down
loads-list"];list.updateSizeForItem(index)}});Manager.clearAll=function(){Manage
r.get().clearAll_()};Manager.get=function(){return queryRequiredElement("downloa
ds-manager")};Manager.insertItems=function(index,list){Manager.get().insertItems
_(index,list)};Manager.onLoad=function(){Manager.get().onLoad_()};Manager.remove
Item=function(index){Manager.get().removeItem_(index)};Manager.updateItem=functi
on(index,data){Manager.get().updateItem_(index,data)};return{Manager:Manager}}); |
| 70 // Copyright 2015 The Chromium Authors. All rights reserved. | 70 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 71 // Use of this source code is governed by a BSD-style license that can be | 71 // Use of this source code is governed by a BSD-style license that can be |
| 72 // found in the LICENSE file. | 72 // found in the LICENSE file. |
| 73 window.addEventListener("load",function(){downloads.Manager.onLoad();document.fo
nts.load("bold 12px Roboto")}); | 73 window.addEventListener("load",function(){downloads.Manager.onLoad();document.fo
nts.load("bold 12px Roboto")}); |
| OLD | NEW |