OLD | NEW |
1 Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties
:{horizontal:{type:Boolean,value:false,observer:"_horizontalChanged"},opened:{ty
pe:Boolean,value:false,notify:true,observer:"_openedChanged"},noAnimation:{type:
Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizo
ntal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"ma
xHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":"max-height"
},hostAttributes:{role:"group","aria-hidden":"true","aria-expanded":"false"},lis
teners:{transitionend:"_transitionEnd"},attached:function(){this._transitionEnd(
)},toggle:function(){this.opened=!this.opened},show:function(){this.opened=true}
,hide:function(){this.opened=false},updateSize:function(size,animated){size=size
==="auto"?"":size;if(this._desiredSize===size){return}this._desiredSize=size;thi
s._updateTransition(false);var willAnimate=animated&&!this.noAnimation&&this._is
Displayed;if(willAnimate){var startSize=this._calcSize();if(size===""){this.styl
e[this._dimensionMax]="";size=this._calcSize()}this.style[this._dimensionMax]=st
artSize;this.scrollTop=this.scrollTop;this._updateTransition(true);willAnimate=s
ize!==startSize}this.style[this._dimensionMax]=size;if(!willAnimate){this._trans
itionEnd()}},enableTransition:function(enabled){Polymer.Base._warn("`enableTrans
ition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!enabled},
_updateTransition:function(enabled){this.style.transitionDuration=enabled&&!this
.noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionPropert
y=this._dimensionMaxCss;var otherDimension=this._dimensionMax==="maxWidth"?"maxH
eight":"maxWidth";this.style[otherDimension]="";this.updateSize(this.opened?"aut
o":"0px",false)},_openedChanged:function(){this.setAttribute("aria-expanded",thi
s.opened);this.setAttribute("aria-hidden",!this.opened);this.toggleClass("iron-c
ollapse-closed",false);this.toggleClass("iron-collapse-opened",false);this.updat
eSize(this.opened?"auto":"0px",true);if(this.opened){this.focus()}},_transitionE
nd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass(
"iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",thi
s.opened);this._updateTransition(false);this.notifyResize()},get _isDisplayed(){
var rect=this.getBoundingClientRect();for(var prop in rect){if(rect[prop]!==0)re
turn true}return false},_calcSize:function(){return this.getBoundingClientRect()
[this.dimension]+"px"}}); | 1 Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties
:{horizontal:{type:Boolean,value:false,observer:"_horizontalChanged"},opened:{ty
pe:Boolean,value:false,notify:true,observer:"_openedChanged"},noAnimation:{type:
Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizo
ntal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"ma
xHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":"max-height"
},hostAttributes:{role:"group","aria-hidden":"true","aria-expanded":"false"},lis
teners:{transitionend:"_transitionEnd"},attached:function(){this._transitionEnd(
)},toggle:function(){this.opened=!this.opened},show:function(){this.opened=true}
,hide:function(){this.opened=false},updateSize:function(size,animated){size=size
==="auto"?"":size;if(this._desiredSize===size){return}this._desiredSize=size;thi
s._updateTransition(false);var willAnimate=animated&&!this.noAnimation&&this._is
Displayed;if(willAnimate){var startSize=this._calcSize();if(size===""){this.styl
e[this._dimensionMax]="";size=this._calcSize()}this.style[this._dimensionMax]=st
artSize;this.scrollTop=this.scrollTop;this._updateTransition(true);willAnimate=s
ize!==startSize}this.style[this._dimensionMax]=size;if(!willAnimate){this._trans
itionEnd()}},enableTransition:function(enabled){Polymer.Base._warn("`enableTrans
ition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!enabled},
_updateTransition:function(enabled){this.style.transitionDuration=enabled&&!this
.noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionPropert
y=this._dimensionMaxCss;var otherDimension=this._dimensionMax==="maxWidth"?"maxH
eight":"maxWidth";this.style[otherDimension]="";this.updateSize(this.opened?"aut
o":"0px",false)},_openedChanged:function(){this.setAttribute("aria-expanded",thi
s.opened);this.setAttribute("aria-hidden",!this.opened);this.toggleClass("iron-c
ollapse-closed",false);this.toggleClass("iron-collapse-opened",false);this.updat
eSize(this.opened?"auto":"0px",true);if(this.opened){this.focus()}},_transitionE
nd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass(
"iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",thi
s.opened);this._updateTransition(false);this.notifyResize()},get _isDisplayed(){
var rect=this.getBoundingClientRect();for(var prop in rect){if(rect[prop]!==0)re
turn true}return false},_calcSize:function(){return this.getBoundingClientRect()
[this.dimension]+"px"}}); |
2 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors:
[HistoryListBehavior],properties:{searchedTerm:{type:String,value:""},groupedHis
toryData_:Array,historyData:Array,queryStartTime:String,queryEndTime:String,rang
e:Number},observers:["updateGroupedHistoryData_(range, historyData)"],addNewResu
lts:function(results,incremental,finished){this.historyData=results},createHisto
ryDomains_:function(visits){var domainIndexes={};var domains=[];for(var i=0,visi
t;visit=visits[i];i++){var domain=visit.domain;if(domainIndexes[domain]==undefin
ed){domainIndexes[domain]=domains.length;domains.push({domain:domain,visits:[],e
xpanded:false,rendered:false})}domains[domainIndexes[domain]].visits.push(visit)
}var sortByVisits=function(a,b){return b.visits.length-a.visits.length};domains.
sort(sortByVisits);return domains},updateGroupedHistoryData_:function(){if(this.
historyData.length==0){this.groupedHistoryData_=[];return}if(this.range==History
Range.WEEK){var days=[];var currentDayVisits=[this.historyData[0]];var pushCurre
ntDay=function(){days.push({title:this.searchedTerm?currentDayVisits[0].dateShor
t:currentDayVisits[0].dateRelativeDay,domains:this.createHistoryDomains_(current
DayVisits)})}.bind(this);var visitsSameDay=function(a,b){if(this.searchedTerm)re
turn a.dateShort==b.dateShort;return a.dateRelativeDay==b.dateRelativeDay}.bind(
this);for(var i=1;i<this.historyData.length;i++){var visit=this.historyData[i];i
f(!visitsSameDay(visit,currentDayVisits[0])){pushCurrentDay();currentDayVisits=[
]}currentDayVisits.push(visit)}pushCurrentDay();this.groupedHistoryData_=days}el
se if(this.range==HistoryRange.MONTH){this.groupedHistoryData_=[{title:this.quer
yStartTime+" – "+this.queryEndTime,domains:this.createHistoryDomains_(this.histo
ryData)}]}},toggleDomainExpanded_:function(e){var collapse=e.currentTarget.paren
tNode.querySelector("iron-collapse");e.model.set("domain.rendered",true);setTime
out(function(){collapse.toggle()},0)},needsTimeGap_:function(groupIndex,domainIn
dex,itemIndex){var visits=this.groupedHistoryData_[groupIndex].domains[domainInd
ex].visits;return md_history.HistoryItem.needsTimeGap(visits,itemIndex,this.sear
chedTerm)},pathForItem_:function(groupIndex,domainIndex,itemIndex){return["group
edHistoryData_",groupIndex,"domains",domainIndex,"visits",itemIndex].join(".")},
getWebsiteIconStyle_:function(domain){return"background-image: "+cr.icon.getFavi
con(domain.visits[0].url)},getDropdownIcon_:function(expanded){return expanded?"
cr:expand-less":"cr:expand-more"}}); | 5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors:
[HistoryListBehavior],properties:{searchedTerm:{type:String,value:""},groupedHis
toryData_:Array,historyData:Array,queryInterval:String,range:Number},observers:[
"updateGroupedHistoryData_(range, historyData)"],addNewResults:function(results,
incremental,finished){this.historyData=results},createHistoryDomains_:function(v
isits){var domainIndexes={};var domains=[];for(var i=0,visit;visit=visits[i];i++
){var domain=visit.domain;if(domainIndexes[domain]==undefined){domainIndexes[dom
ain]=domains.length;domains.push({domain:domain,visits:[],expanded:false,rendere
d:false})}domains[domainIndexes[domain]].visits.push(visit)}var sortByVisits=fun
ction(a,b){return b.visits.length-a.visits.length};domains.sort(sortByVisits);re
turn domains},updateGroupedHistoryData_:function(){if(this.historyData.length==0
){this.groupedHistoryData_=[];return}if(this.range==HistoryRange.WEEK){var days=
[];var currentDayVisits=[this.historyData[0]];var pushCurrentDay=function(){days
.push({title:this.searchedTerm?currentDayVisits[0].dateShort:currentDayVisits[0]
.dateRelativeDay,domains:this.createHistoryDomains_(currentDayVisits)})}.bind(th
is);var visitsSameDay=function(a,b){if(this.searchedTerm)return a.dateShort==b.d
ateShort;return a.dateRelativeDay==b.dateRelativeDay}.bind(this);for(var i=1;i<t
his.historyData.length;i++){var visit=this.historyData[i];if(!visitsSameDay(visi
t,currentDayVisits[0])){pushCurrentDay();currentDayVisits=[]}currentDayVisits.pu
sh(visit)}pushCurrentDay();this.groupedHistoryData_=days}else if(this.range==His
toryRange.MONTH){this.groupedHistoryData_=[{title:this.queryInterval,domains:thi
s.createHistoryDomains_(this.historyData)}]}},toggleDomainExpanded_:function(e){
var collapse=e.currentTarget.parentNode.querySelector("iron-collapse");e.model.s
et("domain.rendered",true);setTimeout(function(){collapse.toggle()},0)},needsTim
eGap_:function(groupIndex,domainIndex,itemIndex){var visits=this.groupedHistoryD
ata_[groupIndex].domains[domainIndex].visits;return md_history.HistoryItem.needs
TimeGap(visits,itemIndex,this.searchedTerm)},pathForItem_:function(groupIndex,do
mainIndex,itemIndex){return["groupedHistoryData_",groupIndex,"domains",domainInd
ex,"visits",itemIndex].join(".")},getWebsiteIconStyle_:function(domain){return"b
ackground-image: "+cr.icon.getFavicon(domain.visits[0].url)},getDropdownIcon_:fu
nction(expanded){return expanded?"cr:expand-less":"cr:expand-more"}}); |
6 // Copyright 2014 The Chromium Authors. All rights reserved. | 6 // Copyright 2014 The Chromium Authors. All rights reserved. |
7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
9 cr.define("cr.ui",function(){function FocusGrid(){this.rows=[]}FocusGrid.prototy
pe={ignoreFocusChange_:false,onFocus:function(row,e){if(this.ignoreFocusChange_)
this.ignoreFocusChange_=false;else this.lastFocused_=e.currentTarget;this.rows.f
orEach(function(r){r.makeActive(r==row)})},onKeydown:function(row,e){var rowInde
x=this.rows.indexOf(row);assert(rowIndex>=0);var newRow=-1;if(e.key=="ArrowUp")n
ewRow=rowIndex-1;else if(e.key=="ArrowDown")newRow=rowIndex+1;else if(e.key=="Pa
geUp")newRow=0;else if(e.key=="PageDown")newRow=this.rows.length-1;var rowToFocu
s=this.rows[newRow];if(rowToFocus){this.ignoreFocusChange_=true;rowToFocus.getEq
uivalentElement(this.lastFocused_).focus();e.preventDefault();return true}return
false},destroy:function(){this.rows.forEach(function(row){row.destroy()});this.
rows.length=0},getRowIndexForTarget:function(target){for(var i=0;i<this.rows.len
gth;++i){if(this.rows[i].getElements().indexOf(target)>=0)return i}return-1},get
RowForRoot:function(root){for(var i=0;i<this.rows.length;++i){if(this.rows[i].ro
ot==root)return this.rows[i]}return null},addRow:function(row){this.addRowBefore
(row,null)},addRowBefore:function(row,nextRow){row.delegate=row.delegate||this;v
ar nextRowIndex=nextRow?this.rows.indexOf(nextRow):-1;if(nextRowIndex==-1)this.r
ows.push(row);else this.rows.splice(nextRowIndex,0,row)},removeRow:function(row)
{var nextRowIndex=row?this.rows.indexOf(row):-1;if(nextRowIndex>-1)this.rows.spl
ice(nextRowIndex,1)},ensureRowActive:function(){if(this.rows.length==0)return;fo
r(var i=0;i<this.rows.length;++i){if(this.rows[i].isActive())return}this.rows[0]
.makeActive(true)}};return{FocusGrid:FocusGrid}});Polymer.PaperButtonBehaviorImp
l={properties:{elevation:{type:Number,reflectToAttribute:true,readOnly:true}},ob
servers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusF
romKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAttributes
:{role:"button",tabindex:"0",animated:true},_calculateElevation:function(){var e
=1;if(this.disabled){e=0}else if(this.active||this.pressed){e=4}else if(this.rec
eivedFocusFromKeyboard){e=3}this._setElevation(e)},_computeKeyboardClass:functio
n(receivedFocusFromKeyboard){this.toggleClass("keyboard-focus",receivedFocusFrom
Keyboard)},_spaceKeyDownHandler:function(event){Polymer.IronButtonStateImpl._spa
ceKeyDownHandler.call(this,event);if(this.hasRipple()&&this.getRipple().ripples.
length<1){this._ripple.uiDownAction()}},_spaceKeyUpHandler:function(event){Polym
er.IronButtonStateImpl._spaceKeyUpHandler.call(this,event);if(this.hasRipple()){
this._ripple.uiUpAction()}}};Polymer.PaperButtonBehavior=[Polymer.IronButtonStat
e,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperButtonBehavi
orImpl];Polymer({is:"paper-button",behaviors:[Polymer.PaperButtonBehavior],prope
rties:{raised:{type:Boolean,reflectToAttribute:true,value:false,observer:"_calcu
lateElevation"}},_calculateElevation:function(){if(!this.raised){this._setElevat
ion(0)}else{Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this)}}});
Polymer.PaperItemBehaviorImpl={hostAttributes:{role:"option",tabindex:"0"}};Poly
mer.PaperItemBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.
PaperItemBehaviorImpl];Polymer({is:"paper-item",behaviors:[Polymer.PaperItemBeha
vior]}); | 9 cr.define("cr.ui",function(){function FocusGrid(){this.rows=[]}FocusGrid.prototy
pe={ignoreFocusChange_:false,onFocus:function(row,e){if(this.ignoreFocusChange_)
this.ignoreFocusChange_=false;else this.lastFocused_=e.currentTarget;this.rows.f
orEach(function(r){r.makeActive(r==row)})},onKeydown:function(row,e){var rowInde
x=this.rows.indexOf(row);assert(rowIndex>=0);var newRow=-1;if(e.key=="ArrowUp")n
ewRow=rowIndex-1;else if(e.key=="ArrowDown")newRow=rowIndex+1;else if(e.key=="Pa
geUp")newRow=0;else if(e.key=="PageDown")newRow=this.rows.length-1;var rowToFocu
s=this.rows[newRow];if(rowToFocus){this.ignoreFocusChange_=true;rowToFocus.getEq
uivalentElement(this.lastFocused_).focus();e.preventDefault();return true}return
false},destroy:function(){this.rows.forEach(function(row){row.destroy()});this.
rows.length=0},getRowIndexForTarget:function(target){for(var i=0;i<this.rows.len
gth;++i){if(this.rows[i].getElements().indexOf(target)>=0)return i}return-1},get
RowForRoot:function(root){for(var i=0;i<this.rows.length;++i){if(this.rows[i].ro
ot==root)return this.rows[i]}return null},addRow:function(row){this.addRowBefore
(row,null)},addRowBefore:function(row,nextRow){row.delegate=row.delegate||this;v
ar nextRowIndex=nextRow?this.rows.indexOf(nextRow):-1;if(nextRowIndex==-1)this.r
ows.push(row);else this.rows.splice(nextRowIndex,0,row)},removeRow:function(row)
{var nextRowIndex=row?this.rows.indexOf(row):-1;if(nextRowIndex>-1)this.rows.spl
ice(nextRowIndex,1)},ensureRowActive:function(){if(this.rows.length==0)return;fo
r(var i=0;i<this.rows.length;++i){if(this.rows[i].isActive())return}this.rows[0]
.makeActive(true)}};return{FocusGrid:FocusGrid}});Polymer.PaperButtonBehaviorImp
l={properties:{elevation:{type:Number,reflectToAttribute:true,readOnly:true}},ob
servers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusF
romKeyboard)","_computeKeyboardClass(receivedFocusFromKeyboard)"],hostAttributes
:{role:"button",tabindex:"0",animated:true},_calculateElevation:function(){var e
=1;if(this.disabled){e=0}else if(this.active||this.pressed){e=4}else if(this.rec
eivedFocusFromKeyboard){e=3}this._setElevation(e)},_computeKeyboardClass:functio
n(receivedFocusFromKeyboard){this.toggleClass("keyboard-focus",receivedFocusFrom
Keyboard)},_spaceKeyDownHandler:function(event){Polymer.IronButtonStateImpl._spa
ceKeyDownHandler.call(this,event);if(this.hasRipple()&&this.getRipple().ripples.
length<1){this._ripple.uiDownAction()}},_spaceKeyUpHandler:function(event){Polym
er.IronButtonStateImpl._spaceKeyUpHandler.call(this,event);if(this.hasRipple()){
this._ripple.uiUpAction()}}};Polymer.PaperButtonBehavior=[Polymer.IronButtonStat
e,Polymer.IronControlState,Polymer.PaperRippleBehavior,Polymer.PaperButtonBehavi
orImpl];Polymer({is:"paper-button",behaviors:[Polymer.PaperButtonBehavior],prope
rties:{raised:{type:Boolean,reflectToAttribute:true,value:false,observer:"_calcu
lateElevation"}},_calculateElevation:function(){if(!this.raised){this._setElevat
ion(0)}else{Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this)}}});
Polymer.PaperItemBehaviorImpl={hostAttributes:{role:"option",tabindex:"0"}};Poly
mer.PaperItemBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.
PaperItemBehaviorImpl];Polymer({is:"paper-item",behaviors:[Polymer.PaperItemBeha
vior]}); |
10 // Copyright 2016 The Chromium Authors. All rights reserved. | 10 // Copyright 2016 The Chromium Authors. All rights reserved. |
11 // Use of this source code is governed by a BSD-style license that can be | 11 // Use of this source code is governed by a BSD-style license that can be |
12 // found in the LICENSE file. | 12 // found in the LICENSE file. |
13 Polymer({is:"cr-action-menu","extends":"dialog",options_:null,anchorElement_:nul
l,onWindowResize_:null,hostAttributes:{tabindex:0},listeners:{keydown:"onKeyDown
_",tap:"onTap_"},attached:function(){this.options_=this.querySelectorAll(".dropd
own-item")},detached:function(){this.removeResizeListener_()},removeResizeListen
er_:function(){window.removeEventListener("resize",this.onWindowResize_)},onTap_
:function(e){if(e.target==this){this.close();e.stopPropagation()}},onKeyDown_:fu
nction(e){if(e.key=="Tab"||e.key=="Escape"){this.close();e.preventDefault();retu
rn}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;var nextOption=this.getNextO
ption_(e.key=="ArrowDown"?1:-1);if(nextOption)nextOption.focus();e.preventDefaul
t()},getNextOption_:function(step){var counter=0;var nextOption=null;var numOpti
ons=this.options_.length;var focusedIndex=Array.prototype.indexOf.call(this.opti
ons_,this.root.activeElement);do{focusedIndex=(numOptions+focusedIndex+step)%num
Options;nextOption=this.options_[focusedIndex];if(nextOption.disabled||nextOptio
n.hidden)nextOption=null;counter++}while(!nextOption&&counter<numOptions);return
nextOption},close:function(){this.removeResizeListener_();HTMLDialogElement.pro
totype.close.call(this);this.anchorElement_.focus();this.anchorElement_=null},sh
owAt:function(anchorElement){this.anchorElement_=anchorElement;this.onWindowResi
ze_=this.onWindowResize_||function(){if(this.open)this.close()}.bind(this);windo
w.addEventListener("resize",this.onWindowResize_);this.showModal();var rect=this
.anchorElement_.getBoundingClientRect();if(getComputedStyle(this.anchorElement_)
.direction=="rtl"){var right=window.innerWidth-rect.left-this.offsetWidth;this.s
tyle.right=right+"px"}else{var left=rect.right-this.offsetWidth;this.style.left=
left+"px"}var top=rect.top+this.offsetHeight<=window.innerHeight?rect.top:rect.b
ottom-this.offsetHeight-Math.max(rect.bottom-window.innerHeight,0);this.style.to
p=top+"px"}});Polymer({is:"paper-icon-button-light","extends":"button",behaviors
:[Polymer.PaperRippleBehavior],listeners:{down:"_rippleDown",up:"_rippleUp",focu
s:"_rippleDown",blur:"_rippleUp"},_rippleDown:function(){this.getRipple().downAc
tion()},_rippleUp:function(){this.getRipple().upAction()},ensureRipple:function(
var_args){var lastRipple=this._ripple;Polymer.PaperRippleBehavior.ensureRipple.a
pply(this,arguments);if(this._ripple&&this._ripple!==lastRipple){this._ripple.ce
nter=true;this._ripple.classList.add("circle")}}}); | 13 Polymer({is:"cr-action-menu","extends":"dialog",options_:null,anchorElement_:nul
l,onWindowResize_:null,hostAttributes:{tabindex:0},listeners:{keydown:"onKeyDown
_",tap:"onTap_"},attached:function(){this.options_=this.querySelectorAll(".dropd
own-item")},detached:function(){this.removeResizeListener_()},removeResizeListen
er_:function(){window.removeEventListener("resize",this.onWindowResize_)},onTap_
:function(e){if(e.target==this){this.close();e.stopPropagation()}},onKeyDown_:fu
nction(e){if(e.key=="Tab"||e.key=="Escape"){this.close();e.preventDefault();retu
rn}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;var nextOption=this.getNextO
ption_(e.key=="ArrowDown"?1:-1);if(nextOption)nextOption.focus();e.preventDefaul
t()},getNextOption_:function(step){var counter=0;var nextOption=null;var numOpti
ons=this.options_.length;var focusedIndex=Array.prototype.indexOf.call(this.opti
ons_,this.root.activeElement);do{focusedIndex=(numOptions+focusedIndex+step)%num
Options;nextOption=this.options_[focusedIndex];if(nextOption.disabled||nextOptio
n.hidden)nextOption=null;counter++}while(!nextOption&&counter<numOptions);return
nextOption},close:function(){this.removeResizeListener_();HTMLDialogElement.pro
totype.close.call(this);this.anchorElement_.focus();this.anchorElement_=null},sh
owAt:function(anchorElement){this.anchorElement_=anchorElement;this.onWindowResi
ze_=this.onWindowResize_||function(){if(this.open)this.close()}.bind(this);windo
w.addEventListener("resize",this.onWindowResize_);this.showModal();var rect=this
.anchorElement_.getBoundingClientRect();if(getComputedStyle(this.anchorElement_)
.direction=="rtl"){var right=window.innerWidth-rect.left-this.offsetWidth;this.s
tyle.right=right+"px"}else{var left=rect.right-this.offsetWidth;this.style.left=
left+"px"}var top=rect.top+this.offsetHeight<=window.innerHeight?rect.top:rect.b
ottom-this.offsetHeight-Math.max(rect.bottom-window.innerHeight,0);this.style.to
p=top+"px"}});Polymer({is:"paper-icon-button-light","extends":"button",behaviors
:[Polymer.PaperRippleBehavior],listeners:{down:"_rippleDown",up:"_rippleUp",focu
s:"_rippleDown",blur:"_rippleUp"},_rippleDown:function(){this.getRipple().downAc
tion()},_rippleUp:function(){this.getRipple().upAction()},ensureRipple:function(
var_args){var lastRipple=this._ripple;Polymer.PaperRippleBehavior.ensureRipple.a
pply(this,arguments);if(this._ripple&&this._ripple!==lastRipple){this._ripple.ce
nter=true;this._ripple.classList.add("circle")}}}); |
14 // Copyright 2016 The Chromium Authors. All rights reserved. | 14 // Copyright 2016 The Chromium Authors. All rights reserved. |
15 // Use of this source code is governed by a BSD-style license that can be | 15 // Use of this source code is governed by a BSD-style license that can be |
16 // found in the LICENSE file. | 16 // found in the LICENSE file. |
17 Polymer({is:"history-synced-device-card",properties:{tabs:{type:Array,value:func
tion(){return[]},observer:"updateIcons_"},device:String,lastUpdateTime:String,op
ened:Boolean,searchTerm:String,separatorIndexes:Array,sessionTag:String},listene
rs:{"dom-change":"notifyFocusUpdate_"},createFocusRows:function(){var titleRow=n
ew cr.ui.FocusRow(this.$["card-heading"],null);titleRow.addItem("menu","#menu-bu
tton");titleRow.addItem("collapse","#collapse-button");var rows=[titleRow];if(th
is.opened){Polymer.dom(this.root).querySelectorAll(".item-container").forEach(fu
nction(el){var row=new cr.ui.FocusRow(el,null);row.addItem("title",".website-tit
le");rows.push(row)})}return rows},openTab_:function(e){var tab=e.model.tab;var
browserService=md_history.BrowserService.getInstance();browserService.recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_CLICKED,SyncedTabsHist
ogram.LIMIT);browserService.openForeignSessionTab(this.sessionTag,tab.windowId,t
ab.sessionId,e);e.preventDefault()},toggleTabCard:function(){var histogramValue=
this.$.collapse.opened?SyncedTabsHistogram.COLLAPSE_SESSION:SyncedTabsHistogram.
EXPAND_SESSION;md_history.BrowserService.getInstance().recordHistogram(SYNCED_TA
BS_HISTOGRAM_NAME,histogramValue,SyncedTabsHistogram.LIMIT);this.$.collapse.togg
le();this.$["dropdown-indicator"].icon=this.$.collapse.opened?"cr:expand-less":"
cr:expand-more";this.fire("update-focus-grid")},notifyFocusUpdate_:function(){th
is.fire("update-focus-grid")},updateIcons_:function(){this.async(function(){var
icons=Polymer.dom(this.root).querySelectorAll(".website-icon");for(var i=0;i<thi
s.tabs.length;i++){icons[i].style.backgroundImage=cr.icon.getFavicon(this.tabs[i
].url)}})},isWindowSeparatorIndex_:function(index,separatorIndexes){return this.
separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:function(opened){return op
ened?"cr:expand-less":"cr:expand-more"},getCollapseTitle_:function(opened){retur
n opened?loadTimeData.getString("collapseSessionButton"):loadTimeData.getString(
"expandSessionButton")},onMenuButtonTap_:function(e){this.fire("open-menu",{targ
et:Polymer.dom(e).localTarget,tag:this.sessionTag});e.stopPropagation()},onLinkR
ightClick_:function(){md_history.BrowserService.getInstance().recordHistogram(SY
NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIGHT_CLICKED,SyncedTabsHistog
ram.LIMIT)}}); | 17 Polymer({is:"history-synced-device-card",properties:{tabs:{type:Array,value:func
tion(){return[]},observer:"updateIcons_"},device:String,lastUpdateTime:String,op
ened:Boolean,searchTerm:String,separatorIndexes:Array,sessionTag:String},listene
rs:{"dom-change":"notifyFocusUpdate_"},createFocusRows:function(){var titleRow=n
ew cr.ui.FocusRow(this.$["card-heading"],null);titleRow.addItem("menu","#menu-bu
tton");titleRow.addItem("collapse","#collapse-button");var rows=[titleRow];if(th
is.opened){Polymer.dom(this.root).querySelectorAll(".item-container").forEach(fu
nction(el){var row=new cr.ui.FocusRow(el,null);row.addItem("title",".website-tit
le");rows.push(row)})}return rows},openTab_:function(e){var tab=e.model.tab;var
browserService=md_history.BrowserService.getInstance();browserService.recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_CLICKED,SyncedTabsHist
ogram.LIMIT);browserService.openForeignSessionTab(this.sessionTag,tab.windowId,t
ab.sessionId,e);e.preventDefault()},toggleTabCard:function(){var histogramValue=
this.$.collapse.opened?SyncedTabsHistogram.COLLAPSE_SESSION:SyncedTabsHistogram.
EXPAND_SESSION;md_history.BrowserService.getInstance().recordHistogram(SYNCED_TA
BS_HISTOGRAM_NAME,histogramValue,SyncedTabsHistogram.LIMIT);this.$.collapse.togg
le();this.$["dropdown-indicator"].icon=this.$.collapse.opened?"cr:expand-less":"
cr:expand-more";this.fire("update-focus-grid")},notifyFocusUpdate_:function(){th
is.fire("update-focus-grid")},updateIcons_:function(){this.async(function(){var
icons=Polymer.dom(this.root).querySelectorAll(".website-icon");for(var i=0;i<thi
s.tabs.length;i++){icons[i].style.backgroundImage=cr.icon.getFavicon(this.tabs[i
].url)}})},isWindowSeparatorIndex_:function(index,separatorIndexes){return this.
separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:function(opened){return op
ened?"cr:expand-less":"cr:expand-more"},getCollapseTitle_:function(opened){retur
n opened?loadTimeData.getString("collapseSessionButton"):loadTimeData.getString(
"expandSessionButton")},onMenuButtonTap_:function(e){this.fire("open-menu",{targ
et:Polymer.dom(e).localTarget,tag:this.sessionTag});e.stopPropagation()},onLinkR
ightClick_:function(){md_history.BrowserService.getInstance().recordHistogram(SY
NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIGHT_CLICKED,SyncedTabsHistog
ram.LIMIT)}}); |
18 // Copyright 2016 The Chromium Authors. All rights reserved. | 18 // Copyright 2016 The Chromium Authors. All rights reserved. |
19 // Use of this source code is governed by a BSD-style license that can be | 19 // Use of this source code is governed by a BSD-style license that can be |
20 // found in the LICENSE file. | 20 // found in the LICENSE file. |
21 var ForeignDeviceInternal;Polymer({is:"history-synced-device-manager",properties
:{sessionList:{type:Array,observer:"updateSyncedDevices"},searchTerm:{type:Strin
g,observer:"searchTermChanged"},syncedDevices_:{type:Array,value:function(){retu
rn[]}},signInState:{type:Boolean,observer:"signInStateChanged_"},guestSession_:{
type:Boolean,value:loadTimeData.getBoolean("isGuestSession")},fetchingSyncedTabs
_:{type:Boolean,value:false},hasSeenForeignData_:Boolean,actionMenuModel_:String
},listeners:{"open-menu":"onOpenMenu_","update-focus-grid":"updateFocusGrid_"},f
ocusGrid_:null,attached:function(){this.focusGrid_=new cr.ui.FocusGrid;chrome.se
nd("otherDevicesInitialized");md_history.BrowserService.getInstance().recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHisto
gram.LIMIT)},detached:function(){this.focusGrid_.destroy()},getContentScrollTarg
et:function(){return this},createInternalDevice_:function(session){var tabs=[];v
ar separatorIndexes=[];for(var i=0;i<session.windows.length;i++){var windowId=se
ssion.windows[i].sessionId;var newTabs=session.windows[i].tabs;if(newTabs.length
==0)continue;newTabs.forEach(function(tab){tab.windowId=windowId});var windowAdd
ed=false;if(!this.searchTerm){tabs=tabs.concat(newTabs);windowAdded=true}else{va
r searchText=this.searchTerm.toLowerCase();for(var j=0;j<newTabs.length;j++){var
tab=newTabs[j];if(tab.title.toLowerCase().indexOf(searchText)!=-1){tabs.push(ta
b);windowAdded=true}}}if(windowAdded&&i!=session.windows.length-1)separatorIndex
es.push(tabs.length-1)}return{device:session.name,lastUpdateTime:"– "+session.mo
difiedTime,opened:true,separatorIndexes:separatorIndexes,timestamp:session.times
tamp,tabs:tabs,tag:session.tag}},onSignInTap_:function(){chrome.send("startSignI
nFlow")},onOpenMenu_:function(e){var menu=this.$.menu.get();this.actionMenuModel
_=e.detail.tag;menu.showAt(e.detail.target);md_history.BrowserService.getInstanc
e().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.SHOW_SESSION_
MENU,SyncedTabsHistogram.LIMIT)},onOpenAllTap_:function(){var menu=assert(this.$
.menu.getIfExists());var browserService=md_history.BrowserService.getInstance();
browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.OP
EN_ALL,SyncedTabsHistogram.LIMIT);browserService.openForeignSessionAllTabs(asser
t(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},updateFocusGr
id_:function(){if(!this.focusGrid_)return;this.focusGrid_.destroy();this.debounc
e("updateFocusGrid",function(){Polymer.dom(this.root).querySelectorAll("history-
synced-device-card").reduce(function(prev,cur){return prev.concat(cur.createFocu
sRows())},[]).forEach(function(row){this.focusGrid_.addRow(row)}.bind(this));thi
s.focusGrid_.ensureRowActive()})},onDeleteSessionTap_:function(){var menu=assert
(this.$.menu.getIfExists());var browserService=md_history.BrowserService.getInst
ance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHisto
gram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browserService.deleteForeignSession
(assert(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},clearDi
splayedSyncedDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:fun
ction(signInState,syncedDevicesLength,guestSession){if(guestSession)return true;
return signInState&&syncedDevicesLength==0},showSignInGuide:function(signInState
,guestSession){var show=!signInState&&!guestSession;if(show){md_history.BrowserS
ervice.getInstance().recordAction("Signin_Impression_FromRecentTabs")}return sho
w},noSyncedTabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"loadi
ng":"noSyncedResults";if(this.searchTerm!=="")stringName="noSearchResults";retur
n loadTimeData.getString(stringName)},updateSyncedDevices:function(sessionList){
this.fetchingSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&&!
this.hasSeenForeignData_){this.hasSeenForeignData_=true;md_history.BrowserServic
e.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.H
AS_FOREIGN_DATA,SyncedTabsHistogram.LIMIT)}var devices=[];sessionList.forEach(fu
nction(session){var device=this.createInternalDevice_(session);if(device.tabs.le
ngth!=0)devices.push(device)}.bind(this));this.syncedDevices_=devices},signInSta
teChanged_:function(){this.fire("history-view-changed");if(!this.signInState){th
is.clearDisplayedSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchTe
rmChanged:function(searchTerm){this.clearDisplayedSyncedDevices_();this.updateSy
ncedDevices(this.sessionList)}}); | 21 var ForeignDeviceInternal;Polymer({is:"history-synced-device-manager",properties
:{sessionList:{type:Array,observer:"updateSyncedDevices"},searchTerm:{type:Strin
g,observer:"searchTermChanged"},syncedDevices_:{type:Array,value:function(){retu
rn[]}},signInState:{type:Boolean,observer:"signInStateChanged_"},guestSession_:{
type:Boolean,value:loadTimeData.getBoolean("isGuestSession")},fetchingSyncedTabs
_:{type:Boolean,value:false},hasSeenForeignData_:Boolean,actionMenuModel_:String
},listeners:{"open-menu":"onOpenMenu_","update-focus-grid":"updateFocusGrid_"},f
ocusGrid_:null,attached:function(){this.focusGrid_=new cr.ui.FocusGrid;chrome.se
nd("otherDevicesInitialized");md_history.BrowserService.getInstance().recordHist
ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHisto
gram.LIMIT)},detached:function(){this.focusGrid_.destroy()},getContentScrollTarg
et:function(){return this},createInternalDevice_:function(session){var tabs=[];v
ar separatorIndexes=[];for(var i=0;i<session.windows.length;i++){var windowId=se
ssion.windows[i].sessionId;var newTabs=session.windows[i].tabs;if(newTabs.length
==0)continue;newTabs.forEach(function(tab){tab.windowId=windowId});var windowAdd
ed=false;if(!this.searchTerm){tabs=tabs.concat(newTabs);windowAdded=true}else{va
r searchText=this.searchTerm.toLowerCase();for(var j=0;j<newTabs.length;j++){var
tab=newTabs[j];if(tab.title.toLowerCase().indexOf(searchText)!=-1){tabs.push(ta
b);windowAdded=true}}}if(windowAdded&&i!=session.windows.length-1)separatorIndex
es.push(tabs.length-1)}return{device:session.name,lastUpdateTime:"– "+session.mo
difiedTime,opened:true,separatorIndexes:separatorIndexes,timestamp:session.times
tamp,tabs:tabs,tag:session.tag}},onSignInTap_:function(){chrome.send("startSignI
nFlow")},onOpenMenu_:function(e){var menu=this.$.menu.get();this.actionMenuModel
_=e.detail.tag;menu.showAt(e.detail.target);md_history.BrowserService.getInstanc
e().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.SHOW_SESSION_
MENU,SyncedTabsHistogram.LIMIT)},onOpenAllTap_:function(){var menu=assert(this.$
.menu.getIfExists());var browserService=md_history.BrowserService.getInstance();
browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.OP
EN_ALL,SyncedTabsHistogram.LIMIT);browserService.openForeignSessionAllTabs(asser
t(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},updateFocusGr
id_:function(){if(!this.focusGrid_)return;this.focusGrid_.destroy();this.debounc
e("updateFocusGrid",function(){Polymer.dom(this.root).querySelectorAll("history-
synced-device-card").reduce(function(prev,cur){return prev.concat(cur.createFocu
sRows())},[]).forEach(function(row){this.focusGrid_.addRow(row)}.bind(this));thi
s.focusGrid_.ensureRowActive()})},onDeleteSessionTap_:function(){var menu=assert
(this.$.menu.getIfExists());var browserService=md_history.BrowserService.getInst
ance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHisto
gram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browserService.deleteForeignSession
(assert(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},clearDi
splayedSyncedDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:fun
ction(signInState,syncedDevicesLength,guestSession){if(guestSession)return true;
return signInState&&syncedDevicesLength==0},showSignInGuide:function(signInState
,guestSession){var show=!signInState&&!guestSession;if(show){md_history.BrowserS
ervice.getInstance().recordAction("Signin_Impression_FromRecentTabs")}return sho
w},noSyncedTabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"loadi
ng":"noSyncedResults";if(this.searchTerm!=="")stringName="noSearchResults";retur
n loadTimeData.getString(stringName)},updateSyncedDevices:function(sessionList){
this.fetchingSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&&!
this.hasSeenForeignData_){this.hasSeenForeignData_=true;md_history.BrowserServic
e.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.H
AS_FOREIGN_DATA,SyncedTabsHistogram.LIMIT)}var devices=[];sessionList.forEach(fu
nction(session){var device=this.createInternalDevice_(session);if(device.tabs.le
ngth!=0)devices.push(device)}.bind(this));this.syncedDevices_=devices},signInSta
teChanged_:function(){this.fire("history-view-changed");if(!this.signInState){th
is.clearDisplayedSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchTe
rmChanged:function(searchTerm){this.clearDisplayedSyncedDevices_();this.updateSy
ncedDevices(this.sessionList)}}); |
22 // Copyright 2016 The Chromium Authors. All rights reserved. | 22 // Copyright 2016 The Chromium Authors. All rights reserved. |
23 // Use of this source code is governed by a BSD-style license that can be | 23 // Use of this source code is governed by a BSD-style license that can be |
24 // found in the LICENSE file. | 24 // found in the LICENSE file. |
25 Polymer({is:"cr-dialog","extends":"dialog",properties:{closeText:String,ignorePo
pstate:{type:Boolean,value:false}},ready:function(){window.addEventListener("pop
state",function(){if(!this.ignorePopstate&&this.open)this.cancel()}.bind(this))}
,cancel:function(){this.fire("cancel");HTMLDialogElement.prototype.close.call(th
is,"")},close:function(opt_returnValue){HTMLDialogElement.prototype.close.call(t
his,"success")},getCloseButton:function(){return this.$.close}});Polymer({is:"ap
p-drawer",properties:{opened:{type:Boolean,value:false,notify:true,reflectToAttr
ibute:true},persistent:{type:Boolean,value:false,reflectToAttribute:true},align:
{type:String,value:"left"},position:{type:String,readOnly:true,value:"left",refl
ectToAttribute:true},swipeOpen:{type:Boolean,value:false,reflectToAttribute:true
},noFocusTrap:{type:Boolean,value:false}},observers:["resetLayout(position)","_r
esetPosition(align, isAttached)"],_translateOffset:0,_trackDetails:null,_drawerS
tate:0,_boundEscKeydownHandler:null,_firstTabStop:null,_lastTabStop:null,ready:f
unction(){this.setScrollDirection("y");this._setTransitionDuration("0s")},attach
ed:function(){Polymer.RenderStatus.afterNextRender(this,function(){this._setTran
sitionDuration("");this._boundEscKeydownHandler=this._escKeydownHandler.bind(thi
s);this._resetDrawerState();this.listen(this,"track","_track");this.addEventList
ener("transitionend",this._transitionend.bind(this));this.addEventListener("keyd
own",this._tabKeydownHandler.bind(this))})},detached:function(){document.removeE
ventListener("keydown",this._boundEscKeydownHandler)},open:function(){this.opene
d=true},close:function(){this.opened=false},toggle:function(){this.opened=!this.
opened},getWidth:function(){return this.$.contentContainer.offsetWidth},resetLay
out:function(){this.debounce("_resetLayout",function(){this.fire("app-drawer-res
et-layout")},1)},_isRTL:function(){return window.getComputedStyle(this).directio
n==="rtl"},_resetPosition:function(){switch(this.align){case"start":this._setPos
ition(this._isRTL()?"right":"left");return;case"end":this._setPosition(this._isR
TL()?"left":"right");return}this._setPosition(this.align)},_escKeydownHandler:fu
nction(event){var ESC_KEYCODE=27;if(event.keyCode===ESC_KEYCODE){event.preventDe
fault();this.close()}},_track:function(event){if(this.persistent){return}event.p
reventDefault();switch(event.detail.state){case"start":this._trackStart(event);b
reak;case"track":this._trackMove(event);break;case"end":this._trackEnd(event);br
eak}},_trackStart:function(event){this._drawerState=this._DRAWER_STATE.TRACKING;
this._setTransitionDuration("0s");this.style.visibility="visible";var rect=this.
$.contentContainer.getBoundingClientRect();if(this.position==="left"){this._tran
slateOffset=rect.left}else{this._translateOffset=rect.right-window.innerWidth}th
is._trackDetails=[]},_trackMove:function(event){this._translateDrawer(event.deta
il.dx+this._translateOffset);this._trackDetails.push({dx:event.detail.dx,timeSta
mp:Date.now()})},_trackEnd:function(event){var x=event.detail.dx+this._translate
Offset;var drawerWidth=this.getWidth();var isPositionLeft=this.position==="left"
;var isInEndState=isPositionLeft?x>=0||x<=-drawerWidth:x<=0||x>=drawerWidth;if(!
isInEndState){var trackDetails=this._trackDetails;this._trackDetails=null;this._
flingDrawer(event,trackDetails);if(this._drawerState===this._DRAWER_STATE.FLINGI
NG){return}}var halfWidth=drawerWidth/2;if(event.detail.dx<-halfWidth){this.open
ed=this.position==="right"}else if(event.detail.dx>halfWidth){this.opened=this.p
osition==="left"}if(isInEndState){this._resetDrawerState()}this._setTransitionDu
ration("");this._resetDrawerTranslate();this.style.visibility=""},_calculateVelo
city:function(event,trackDetails){var now=Date.now();var timeLowerBound=now-100;
var trackDetail;var min=0;var max=trackDetails.length-1;while(min<=max){var mid=
min+max>>1;var d=trackDetails[mid];if(d.timeStamp>=timeLowerBound){trackDetail=d
;max=mid-1}else{min=mid+1}}if(trackDetail){var dx=event.detail.dx-trackDetail.dx
;var dt=now-trackDetail.timeStamp||1;return dx/dt}return 0},_flingDrawer:functio
n(event,trackDetails){var velocity=this._calculateVelocity(event,trackDetails);i
f(Math.abs(velocity)<this._MIN_FLING_THRESHOLD){return}this._drawerState=this._D
RAWER_STATE.FLINGING;var x=event.detail.dx+this._translateOffset;var drawerWidth
=this.getWidth();var isPositionLeft=this.position==="left";var isVelocityPositiv
e=velocity>0;var isClosingLeft=!isVelocityPositive&&isPositionLeft;var isClosing
Right=isVelocityPositive&&!isPositionLeft;var dx;if(isClosingLeft){dx=-(x+drawer
Width)}else if(isClosingRight){dx=drawerWidth-x}else{dx=-x}if(isVelocityPositive
){velocity=Math.max(velocity,this._MIN_TRANSITION_VELOCITY);this.opened=this.pos
ition==="left"}else{velocity=Math.min(velocity,-this._MIN_TRANSITION_VELOCITY);t
his.opened=this.position==="right"}this._setTransitionDuration(this._FLING_INITI
AL_SLOPE*dx/velocity+"ms");this._setTransitionTimingFunction(this._FLING_TIMING_
FUNCTION);this._resetDrawerTranslate()},_transitionend:function(event){var targe
t=Polymer.dom(event).rootTarget;if(target===this.$.contentContainer||target===th
is.$.scrim){if(this._drawerState===this._DRAWER_STATE.FLINGING){this._setTransit
ionDuration("");this._setTransitionTimingFunction("");this.style.visibility=""}t
his._resetDrawerState()}},_setTransitionDuration:function(duration){this.$.conte
ntContainer.style.transitionDuration=duration;this.$.scrim.style.transitionDurat
ion=duration},_setTransitionTimingFunction:function(timingFunction){this.$.conte
ntContainer.style.transitionTimingFunction=timingFunction;this.$.scrim.style.tra
nsitionTimingFunction=timingFunction},_translateDrawer:function(x){var drawerWid
th=this.getWidth();if(this.position==="left"){x=Math.max(-drawerWidth,Math.min(x
,0));this.$.scrim.style.opacity=1+x/drawerWidth}else{x=Math.max(0,Math.min(x,dra
werWidth));this.$.scrim.style.opacity=1-x/drawerWidth}this.translate3d(x+"px","0
","0",this.$.contentContainer)},_resetDrawerTranslate:function(){this.$.scrim.st
yle.opacity="";this.transform("",this.$.contentContainer)},_resetDrawerState:fun
ction(){var oldState=this._drawerState;if(this.opened){this._drawerState=this.pe
rsistent?this._DRAWER_STATE.OPENED_PERSISTENT:this._DRAWER_STATE.OPENED}else{thi
s._drawerState=this._DRAWER_STATE.CLOSED}if(oldState!==this._drawerState){if(thi
s._drawerState===this._DRAWER_STATE.OPENED){this._setKeyboardFocusTrap();documen
t.addEventListener("keydown",this._boundEscKeydownHandler);document.body.style.o
verflow="hidden"}else{document.removeEventListener("keydown",this._boundEscKeydo
wnHandler);document.body.style.overflow=""}if(oldState!==this._DRAWER_STATE.INIT
){this.fire("app-drawer-transitioned")}}},_setKeyboardFocusTrap:function(){if(th
is.noFocusTrap){return}var focusableElementsSelector=['a[href]:not([tabindex="-1
"])','area[href]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"
])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not(
[tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','iframe:not([tab
index="-1"])','[tabindex]:not([tabindex="-1"])','[contentEditable=true]:not([tab
index="-1"])'].join(",");var focusableElements=Polymer.dom(this).querySelectorAl
l(focusableElementsSelector);if(focusableElements.length>0){this._firstTabStop=f
ocusableElements[0];this._lastTabStop=focusableElements[focusableElements.length
-1]}else{this._firstTabStop=null;this._lastTabStop=null}var tabindex=this.getAtt
ribute("tabindex");if(tabindex&&parseInt(tabindex,10)>-1){this.focus()}else if(t
his._firstTabStop){this._firstTabStop.focus()}},_tabKeydownHandler:function(even
t){if(this.noFocusTrap){return}var TAB_KEYCODE=9;if(this._drawerState===this._DR
AWER_STATE.OPENED&&event.keyCode===TAB_KEYCODE){if(event.shiftKey){if(this._firs
tTabStop&&Polymer.dom(event).localTarget===this._firstTabStop){event.preventDefa
ult();this._lastTabStop.focus()}}else{if(this._lastTabStop&&Polymer.dom(event).l
ocalTarget===this._lastTabStop){event.preventDefault();this._firstTabStop.focus(
)}}}},_MIN_FLING_THRESHOLD:.2,_MIN_TRANSITION_VELOCITY:1.2,_FLING_TIMING_FUNCTIO
N:"cubic-bezier(0.667, 1, 0.667, 1)",_FLING_INITIAL_SLOPE:1.5,_DRAWER_STATE:{INI
T:0,OPENED:1,OPENED_PERSISTENT:2,CLOSED:3,TRACKING:4,FLINGING:5}});Polymer.IronF
itBehavior={properties:{sizingTarget:{type:Object,value:function(){return this}}
,fitInto:{type:Object,value:window},noOverlap:{type:Boolean},positionTarget:{typ
e:Element},horizontalAlign:{type:String},verticalAlign:{type:String},dynamicAlig
n:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:true},verticalOffs
et:{type:Number,value:0,notify:true},autoFitOnAttach:{type:Boolean,value:false},
_fitInfo:{type:Object}},get _fitWidth(){var fitWidth;if(this.fitInto===window){f
itWidth=this.fitInto.innerWidth}else{fitWidth=this.fitInto.getBoundingClientRect
().width}return fitWidth},get _fitHeight(){var fitHeight;if(this.fitInto===windo
w){fitHeight=this.fitInto.innerHeight}else{fitHeight=this.fitInto.getBoundingCli
entRect().height}return fitHeight},get _fitLeft(){var fitLeft;if(this.fitInto===
window){fitLeft=0}else{fitLeft=this.fitInto.getBoundingClientRect().left}return
fitLeft},get _fitTop(){var fitTop;if(this.fitInto===window){fitTop=0}else{fitTop
=this.fitInto.getBoundingClientRect().top}return fitTop},get _defaultPositionTar
get(){var parent=Polymer.dom(this).parentNode;if(parent&&parent.nodeType===Node.
DOCUMENT_FRAGMENT_NODE){parent=parent.host}return parent},get _localeHorizontalA
lign(){if(this._isRTL){if(this.horizontalAlign==="right"){return"left"}if(this.h
orizontalAlign==="left"){return"right"}}return this.horizontalAlign},attached:fu
nction(){this._isRTL=window.getComputedStyle(this).direction=="rtl";this.positio
nTarget=this.positionTarget||this._defaultPositionTarget;if(this.autoFitOnAttach
){if(window.getComputedStyle(this).display==="none"){setTimeout(function(){this.
fit()}.bind(this))}else{this.fit()}}},fit:function(){this.position();this.constr
ain();this.center()},_discoverInfo:function(){if(this._fitInfo){return}var targe
t=window.getComputedStyle(this);var sizer=window.getComputedStyle(this.sizingTar
get);this._fitInfo={inlineStyle:{top:this.style.top||"",left:this.style.left||""
,position:this.style.position||""},sizerInlineStyle:{maxWidth:this.sizingTarget.
style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHeight||"",boxSizing:thi
s.sizingTarget.style.boxSizing||""},positionedBy:{vertically:target.top!=="auto"
?"top":target.bottom!=="auto"?"bottom":null,horizontally:target.left!=="auto"?"l
eft":target.right!=="auto"?"right":null},sizedBy:{height:sizer.maxHeight!=="none
",width:sizer.maxWidth!=="none",minWidth:parseInt(sizer.minWidth,10)||0,minHeigh
t:parseInt(sizer.minHeight,10)||0},margin:{top:parseInt(target.marginTop,10)||0,
right:parseInt(target.marginRight,10)||0,bottom:parseInt(target.marginBottom,10)
||0,left:parseInt(target.marginLeft,10)||0}};if(this.verticalOffset){this._fitIn
fo.margin.top=this._fitInfo.margin.bottom=this.verticalOffset;this._fitInfo.inli
neStyle.marginTop=this.style.marginTop||"";this._fitInfo.inlineStyle.marginBotto
m=this.style.marginBottom||"";this.style.marginTop=this.style.marginBottom=this.
verticalOffset+"px"}if(this.horizontalOffset){this._fitInfo.margin.left=this._fi
tInfo.margin.right=this.horizontalOffset;this._fitInfo.inlineStyle.marginLeft=th
is.style.marginLeft||"";this._fitInfo.inlineStyle.marginRight=this.style.marginR
ight||"";this.style.marginLeft=this.style.marginRight=this.horizontalOffset+"px"
}},resetFit:function(){var info=this._fitInfo||{};for(var property in info.sizer
InlineStyle){this.sizingTarget.style[property]=info.sizerInlineStyle[property]}f
or(var property in info.inlineStyle){this.style[property]=info.inlineStyle[prope
rty]}this._fitInfo=null},refit:function(){var scrollLeft=this.sizingTarget.scrol
lLeft;var scrollTop=this.sizingTarget.scrollTop;this.resetFit();this.fit();this.
sizingTarget.scrollLeft=scrollLeft;this.sizingTarget.scrollTop=scrollTop},positi
on:function(){if(!this.horizontalAlign&&!this.verticalAlign){return}this._discov
erInfo();this.style.position="fixed";this.sizingTarget.style.boxSizing="border-b
ox";this.style.left="0px";this.style.top="0px";var rect=this.getBoundingClientRe
ct();var positionRect=this.__getNormalizedRect(this.positionTarget);var fitRect=
this.__getNormalizedRect(this.fitInto);var margin=this._fitInfo.margin;var size=
{width:rect.width+margin.left+margin.right,height:rect.height+margin.top+margin.
bottom};var position=this.__getPosition(this._localeHorizontalAlign,this.vertica
lAlign,size,positionRect,fitRect);var left=position.left+margin.left;var top=pos
ition.top+margin.top;var right=Math.min(fitRect.right-margin.right,left+rect.wid
th);var bottom=Math.min(fitRect.bottom-margin.bottom,top+rect.height);var minWid
th=this._fitInfo.sizedBy.minWidth;var minHeight=this._fitInfo.sizedBy.minHeight;
if(left<margin.left){left=margin.left;if(right-left<minWidth){left=right-minWidt
h}}if(top<margin.top){top=margin.top;if(bottom-top<minHeight){top=bottom-minHeig
ht}}this.sizingTarget.style.maxWidth=right-left+"px";this.sizingTarget.style.max
Height=bottom-top+"px";this.style.left=left-rect.left+"px";this.style.top=top-re
ct.top+"px"},constrain:function(){if(this.horizontalAlign||this.verticalAlign){r
eturn}this._discoverInfo();var info=this._fitInfo;if(!info.positionedBy.vertical
ly){this.style.position="fixed";this.style.top="0px"}if(!info.positionedBy.horiz
ontally){this.style.position="fixed";this.style.left="0px"}this.sizingTarget.sty
le.boxSizing="border-box";var rect=this.getBoundingClientRect();if(!info.sizedBy
.height){this.__sizeDimension(rect,info.positionedBy.vertically,"top","bottom","
Height")}if(!info.sizedBy.width){this.__sizeDimension(rect,info.positionedBy.hor
izontally,"left","right","Width")}},_sizeDimension:function(rect,positionedBy,st
art,end,extent){this.__sizeDimension(rect,positionedBy,start,end,extent)},__size
Dimension:function(rect,positionedBy,start,end,extent){var info=this._fitInfo;va
r fitRect=this.__getNormalizedRect(this.fitInto);var max=extent==="Width"?fitRec
t.width:fitRect.height;var flip=positionedBy===end;var offset=flip?max-rect[end]
:rect[start];var margin=info.margin[flip?start:end];var offsetExtent="offset"+ex
tent;var sizingOffset=this[offsetExtent]-this.sizingTarget[offsetExtent];this.si
zingTarget.style["max"+extent]=max-margin-offset-sizingOffset+"px"},center:funct
ion(){if(this.horizontalAlign||this.verticalAlign){return}this._discoverInfo();v
ar positionedBy=this._fitInfo.positionedBy;if(positionedBy.vertically&&positione
dBy.horizontally){return}this.style.position="fixed";if(!positionedBy.vertically
){this.style.top="0px"}if(!positionedBy.horizontally){this.style.left="0px"}var
rect=this.getBoundingClientRect();var fitRect=this.__getNormalizedRect(this.fitI
nto);if(!positionedBy.vertically){var top=fitRect.top-rect.top+(fitRect.height-r
ect.height)/2;this.style.top=top+"px"}if(!positionedBy.horizontally){var left=fi
tRect.left-rect.left+(fitRect.width-rect.width)/2;this.style.left=left+"px"}},__
getNormalizedRect:function(target){if(target===document.documentElement||target=
==window){return{top:0,left:0,width:window.innerWidth,height:window.innerHeight,
right:window.innerWidth,bottom:window.innerHeight}}return target.getBoundingClie
ntRect()},__getCroppedArea:function(position,size,fitRect){var verticalCrop=Math
.min(0,position.top)+Math.min(0,fitRect.bottom-(position.top+size.height));var h
orizontalCrop=Math.min(0,position.left)+Math.min(0,fitRect.right-(position.left+
size.width));return Math.abs(verticalCrop)*size.width+Math.abs(horizontalCrop)*s
ize.height},__getPosition:function(hAlign,vAlign,size,positionRect,fitRect){var
positions=[{verticalAlign:"top",horizontalAlign:"left",top:positionRect.top,left
:positionRect.left},{verticalAlign:"top",horizontalAlign:"right",top:positionRec
t.top,left:positionRect.right-size.width},{verticalAlign:"bottom",horizontalAlig
n:"left",top:positionRect.bottom-size.height,left:positionRect.left},{verticalAl
ign:"bottom",horizontalAlign:"right",top:positionRect.bottom-size.height,left:po
sitionRect.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]}po
sitions.push(copy)}positions[0].top=positions[1].top+=positionRect.height;positi
ons[2].top=positions[3].top-=positionRect.height;positions[4].left=positions[6].
left+=positionRect.width;positions[5].left=positions[7].left-=positionRect.width
}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign==="auto"?null:hAlign;var posit
ion;for(var i=0;i<positions.length;i++){var pos=positions[i];if(!this.dynamicAli
gn&&!this.noOverlap&&pos.verticalAlign===vAlign&&pos.horizontalAlign===hAlign){p
osition=pos;break}var alignOk=(!vAlign||pos.verticalAlign===vAlign)&&(!hAlign||p
os.horizontalAlign===hAlign);if(!this.dynamicAlign&&!alignOk){continue}position=
position||pos;pos.croppedArea=this.__getCroppedArea(pos,size,fitRect);var diff=p
os.croppedArea-position.croppedArea;if(diff<0||diff===0&&alignOk){position=pos}i
f(position.croppedArea===0&&alignOk){break}}return position}};(function(){"use s
trict";Polymer({is:"iron-overlay-backdrop",properties:{opened:{reflectToAttribut
e:true,type:Boolean,value:false,observer:"_openedChanged"}},listeners:{transitio
nend:"_onTransitionend"},created:function(){this.__openedRaf=null},attached:func
tion(){this.opened&&this._openedChanged(this.opened)},prepare:function(){if(this
.opened&&!this.parentNode){Polymer.dom(document.body).appendChild(this)}},open:f
unction(){this.opened=true},close:function(){this.opened=false},complete:functio
n(){if(!this.opened&&this.parentNode===document.body){Polymer.dom(this.parentNod
e).removeChild(this)}},_onTransitionend:function(event){if(event&&event.target==
=this){this.complete()}},_openedChanged:function(opened){if(opened){this.prepare
()}else{var cs=window.getComputedStyle(this);if(cs.transitionDuration==="0s"||cs
.opacity==0){this.complete()}}if(!this.isAttached){return}if(this.__openedRaf){w
indow.cancelAnimationFrame(this.__openedRaf);this.__openedRaf=null}this.scrollTo
p=this.scrollTop;this.__openedRaf=window.requestAnimationFrame(function(){this._
_openedRaf=null;this.toggleClass("opened",this.opened)}.bind(this))}})})();Polym
er.IronOverlayManagerClass=function(){this._overlays=[];this._minimumZ=101;this.
_backdropElement=null;Polymer.Gestures.add(document,"tap",this._onCaptureClick.b
ind(this));document.addEventListener("focus",this._onCaptureFocus.bind(this),tru
e);document.addEventListener("keydown",this._onCaptureKeyDown.bind(this),true)};
Polymer.IronOverlayManagerClass.prototype={constructor:Polymer.IronOverlayManage
rClass,get backdropElement(){if(!this._backdropElement){this._backdropElement=do
cument.createElement("iron-overlay-backdrop")}return this._backdropElement},get
deepActiveElement(){var active=document.activeElement||document.body;while(activ
e.root&&Polymer.dom(active.root).activeElement){active=Polymer.dom(active.root).
activeElement}return active},_bringOverlayAtIndexToFront:function(i){var overlay
=this._overlays[i];if(!overlay){return}var lastI=this._overlays.length-1;var cur
rentOverlay=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._apply
OverlayZ(overlay,minimumZ)}while(i<lastI){this._overlays[i]=this._overlays[i+1];
i++}this._overlays[lastI]=overlay},addOrRemoveOverlay:function(overlay){if(overl
ay.opened){this.addOverlay(overlay)}else{this.removeOverlay(overlay)}},addOverla
y:function(overlay){var i=this._overlays.indexOf(overlay);if(i>=0){this._bringOv
erlayAtIndexToFront(i);this.trackBackdrop();return}var insertionIndex=this._over
lays.length;var currentOverlay=this._overlays[insertionIndex-1];var minimumZ=Mat
h.max(this._getZ(currentOverlay),this._minimumZ);var newZ=this._getZ(overlay);if
(currentOverlay&&this._shouldBeBehindOverlay(overlay,currentOverlay)){this._appl
yOverlayZ(currentOverlay,minimumZ);insertionIndex--;var previousOverlay=this._ov
erlays[insertionIndex-1];minimumZ=Math.max(this._getZ(previousOverlay),this._min
imumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overlay,minimumZ)}this._overlays.s
plice(insertionIndex,0,overlay);this.trackBackdrop()},removeOverlay:function(ove
rlay){var i=this._overlays.indexOf(overlay);if(i===-1){return}this._overlays.spl
ice(i,1);this.trackBackdrop()},currentOverlay:function(){var i=this._overlays.le
ngth-1;return this._overlays[i]},currentOverlayZ:function(){return this._getZ(th
is.currentOverlay())},ensureMinimumZ:function(minimumZ){this._minimumZ=Math.max(
this._minimumZ,minimumZ)},focusOverlay:function(){var current=this.currentOverla
y();if(current){current._applyFocus()}},trackBackdrop:function(){var overlay=thi
s._overlayWithBackdrop();if(!overlay&&!this._backdropElement){return}this.backdr
opElement.style.zIndex=this._getZ(overlay)-1;this.backdropElement.opened=!!overl
ay},getBackdrops:function(){var backdrops=[];for(var i=0;i<this._overlays.length
;i++){if(this._overlays[i].withBackdrop){backdrops.push(this._overlays[i])}}retu
rn backdrops},backdropZ:function(){return this._getZ(this._overlayWithBackdrop()
)-1},_overlayWithBackdrop:function(){for(var i=0;i<this._overlays.length;i++){if
(this._overlays[i].withBackdrop){return this._overlays[i]}}},_getZ:function(over
lay){var z=this._minimumZ;if(overlay){var z1=Number(overlay.style.zIndex||window
.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1}}return z},_setZ:function(el
ement,z){element.style.zIndex=z},_applyOverlayZ:function(overlay,aboveZ){this._s
etZ(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(overlay&&this._overlayInPat
h(Polymer.dom(event).path)!==overlay){overlay._onCaptureClick(event)}},_onCaptur
eFocus:function(event){var overlay=this.currentOverlay();if(overlay){overlay._on
CaptureFocus(event)}},_onCaptureKeyDown:function(event){var overlay=this.current
Overlay();if(overlay){if(Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(e
vent,"esc")){overlay._onCaptureEsc(event)}else if(Polymer.IronA11yKeysBehavior.k
eyboardEventMatchesKeys(event,"tab")){overlay._onCaptureTab(event)}}},_shouldBeB
ehindOverlay:function(overlay1,overlay2){return!overlay1.alwaysOnTop&&overlay2.a
lwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOverlayManagerClass;(fun
ction(){"use strict";Polymer.IronOverlayBehaviorImpl={properties:{opened:{observ
er:"_openedChanged",type:Boolean,value:false,notify:true},canceled:{observer:"_c
anceledChanged",readOnly:true,type:Boolean,value:false},withBackdrop:{observer:"
_withBackdropChanged",type:Boolean},noAutoFocus:{type:Boolean,value:false},noCan
celOnEscKey:{type:Boolean,value:false},noCancelOnOutsideClick:{type:Boolean,valu
e:false},closingReason:{type:Object},restoreFocusOnClose:{type:Boolean,value:fal
se},alwaysOnTop:{type:Boolean},_manager:{type:Object,value:Polymer.IronOverlayMa
nager},_focusedChild:{type:Object}},listeners:{"iron-resize":"_onIronResize"},ge
t backdropElement(){return this._manager.backdropElement},get _focusNode(){retur
n 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","s
elect","textarea","button"];var selector=FOCUSABLE_WITH_DISABLED.join(':not([tab
index="-1"]),')+':not([tabindex="-1"]),'+FOCUSABLE_WITHOUT_DISABLED.join(':not([
disabled]):not([tabindex="-1"]),')+':not([disabled]):not([tabindex="-1"])';var f
ocusables=Polymer.dom(this).querySelectorAll(selector);if(this.tabIndex>=0){focu
sables.splice(0,0,this)}return focusables.sort(function(a,b){if(a.tabIndex===b.t
abIndex){return 0}if(a.tabIndex===0||a.tabIndex>b.tabIndex){return 1}return-1})}
,ready:function(){this.__isAnimating=false;this.__shouldRemoveTabIndex=false;thi
s.__firstFocusableNode=this.__lastFocusableNode=null;this.__raf=null;this.__rest
oreFocusNode=null;this._ensureSetup()},attached:function(){if(this.opened){this.
_openedChanged(this.opened)}this._observer=Polymer.dom(this).observeNodes(this._
onNodesChange)},detached:function(){Polymer.dom(this).unobserveNodes(this._obser
ver);this._observer=null;if(this.__raf){window.cancelAnimationFrame(this.__raf);
this.__raf=null}this._manager.removeOverlay(this)},toggle:function(){this._setCa
nceled(false);this.opened=!this.opened},open:function(){this._setCanceled(false)
;this.opened=true},close:function(){this._setCanceled(false);this.opened=false},
cancel:function(event){var cancelEvent=this.fire("iron-overlay-canceled",event,{
cancelable:true});if(cancelEvent.defaultPrevented){return}this._setCanceled(true
);this.opened=false},_ensureSetup:function(){if(this._overlaySetup){return}this.
_overlaySetup=true;this.style.outline="none";this.style.display="none"},_openedC
hanged:function(opened){if(opened){this.removeAttribute("aria-hidden")}else{this
.setAttribute("aria-hidden","true")}if(!this.isAttached){return}this.__isAnimati
ng=true;this.__onNextAnimationFrame(this.__openedChanged)},_canceledChanged:func
tion(){this.closingReason=this.closingReason||{};this.closingReason.canceled=thi
s.canceled},_withBackdropChanged:function(){if(this.withBackdrop&&!this.hasAttri
bute("tabindex")){this.setAttribute("tabindex","-1");this.__shouldRemoveTabIndex
=true}else if(this.__shouldRemoveTabIndex){this.removeAttribute("tabindex");this
.__shouldRemoveTabIndex=false}if(this.opened&&this.isAttached){this._manager.tra
ckBackdrop()}},_prepareRenderOpened:function(){this.__restoreFocusNode=this._man
ager.deepActiveElement;this._preparePositioning();this.refit();this._finishPosit
ioning();if(this.noAutoFocus&&document.activeElement===this._focusNode){this._fo
cusNode.blur();this.__restoreFocusNode.focus()}},_renderOpened:function(){this._
finishRenderOpened()},_renderClosed:function(){this._finishRenderClosed()},_fini
shRenderOpened:function(){this.notifyResize();this.__isAnimating=false;var focus
ableNodes=this._focusableNodes;this.__firstFocusableNode=focusableNodes[0];this.
__lastFocusableNode=focusableNodes[focusableNodes.length-1];this.fire("iron-over
lay-opened")},_finishRenderClosed:function(){this.style.display="none";this.styl
e.zIndex="";this.notifyResize();this.__isAnimating=false;this.fire("iron-overlay
-closed",this.closingReason)},_preparePositioning:function(){this.style.transiti
on=this.style.webkitTransition="none";this.style.transform=this.style.webkitTran
sform="none";this.style.display=""},_finishPositioning:function(){this.style.dis
play="none";this.scrollTop=this.scrollTop;this.style.transition=this.style.webki
tTransition="";this.style.transform=this.style.webkitTransform="";this.style.dis
play="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(this.opened){if
(!this.noAutoFocus){this._focusNode.focus()}}else{this._focusNode.blur();this._f
ocusedChild=null;if(this.restoreFocusOnClose&&this.__restoreFocusNode){this.__re
storeFocusNode.focus()}this.__restoreFocusNode=null;var currentOverlay=this._man
ager.currentOverlay();if(currentOverlay&&this!==currentOverlay){currentOverlay._
applyFocus()}}},_onCaptureClick:function(event){if(!this.noCancelOnOutsideClick)
{this.cancel(event)}},_onCaptureFocus:function(event){if(!this.withBackdrop){ret
urn}var path=Polymer.dom(event).path;if(path.indexOf(this)===-1){event.stopPropa
gation();this._applyFocus()}else{this._focusedChild=path[0]}},_onCaptureEsc:func
tion(event){if(!this.noCancelOnEscKey){this.cancel(event)}},_onCaptureTab:functi
on(event){if(!this.withBackdrop){return}var shift=event.shiftKey;var nodeToCheck
=shift?this.__firstFocusableNode:this.__lastFocusableNode;var nodeToSet=shift?th
is.__lastFocusableNode:this.__firstFocusableNode;var shouldWrap=false;if(nodeToC
heck===nodeToSet){shouldWrap=true}else{var focusedNode=this._manager.deepActiveE
lement;shouldWrap=focusedNode===nodeToCheck||focusedNode===this}if(shouldWrap){e
vent.preventDefault();this._focusedChild=nodeToSet;this._applyFocus()}},_onIronR
esize:function(){if(this.opened&&!this.__isAnimating){this.__onNextAnimationFram
e(this.refit)}},_onNodesChange:function(){if(this.opened&&!this.__isAnimating){t
his.notifyResize()}},__openedChanged:function(){if(this.opened){this._prepareRen
derOpened();this._manager.addOverlay(this);this._applyFocus();this._renderOpened
()}else{this._manager.removeOverlay(this);this._applyFocus();this._renderClosed(
)}},__onNextAnimationFrame:function(callback){if(this.__raf){window.cancelAnimat
ionFrame(this.__raf)}var self=this;this.__raf=window.requestAnimationFrame(funct
ion nextAnimationFrame(){self.__raf=null;callback.call(self)})}};Polymer.IronOve
rlayBehavior=[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,Polymer.Iron
OverlayBehaviorImpl]})();Polymer.NeonAnimatableBehavior={properties:{animationCo
nfig:{type:Object},entryAnimation:{observer:"_entryAnimationChanged",type:String
},exitAnimation:{observer:"_exitAnimationChanged",type:String}},_entryAnimationC
hanged:function(){this.animationConfig=this.animationConfig||{};this.animationCo
nfig["entry"]=[{name:this.entryAnimation,node:this}]},_exitAnimationChanged:func
tion(){this.animationConfig=this.animationConfig||{};this.animationConfig["exit"
]=[{name:this.exitAnimation,node:this}]},_copyProperties:function(config1,config
2){for(var property in config2){config1[property]=config2[property]}},_cloneConf
ig:function(config){var clone={isClone:true};this._copyProperties(clone,config);
return clone},_getAnimationConfigRecursive:function(type,map,allConfigs){if(!thi
s.animationConfig){return}if(this.animationConfig.value&&typeof this.animationCo
nfig.value==="function"){this._warn(this._logf("playAnimation","Please put 'anim
ationConfig' inside of your components 'properties' object instead of outside of
it."));return}var thisConfig;if(type){thisConfig=this.animationConfig[type]}els
e{thisConfig=this.animationConfig}if(!Array.isArray(thisConfig)){thisConfig=[thi
sConfig]}if(thisConfig){for(var config,index=0;config=thisConfig[index];index++)
{if(config.animatable){config.animatable._getAnimationConfigRecursive(config.typ
e||type,map,allConfigs)}else{if(config.id){var cachedConfig=map[config.id];if(ca
chedConfig){if(!cachedConfig.isClone){map[config.id]=this._cloneConfig(cachedCon
fig);cachedConfig=map[config.id]}this._copyProperties(cachedConfig,config)}else{
map[config.id]=config}}else{allConfigs.push(config)}}}}},getAnimationConfig:func
tion(type){var map={};var allConfigs=[];this._getAnimationConfigRecursive(type,m
ap,allConfigs);for(var key in map){allConfigs.push(map[key])}return allConfigs}}
;Polymer.NeonAnimationRunnerBehaviorImpl={_configureAnimations:function(configs)
{var results=[];if(configs.length>0){for(var config,index=0;config=configs[index
];index++){var neonAnimation=document.createElement(config.name);if(neonAnimatio
n.isNeonAnimation){var result=null;try{result=neonAnimation.configure(config);if
(typeof result.cancel!="function"){result=document.timeline.play(result)}}catch(
e){result=null;console.warn("Couldnt play","(",config.name,").",e)}if(result){re
sults.push({neonAnimation:neonAnimation,config:config,animation:result})}}else{c
onsole.warn(this.is+":",config.name,"not found!")}}}return results},_shouldCompl
ete:function(activeEntries){var finished=true;for(var i=0;i<activeEntries.length
;i++){if(activeEntries[i].animation.playState!="finished"){finished=false;break}
}return finished},_complete:function(activeEntries){for(var i=0;i<activeEntries.
length;i++){activeEntries[i].neonAnimation.complete(activeEntries[i].config)}for
(var i=0;i<activeEntries.length;i++){activeEntries[i].animation.cancel()}},playA
nimation:function(type,cookie){var configs=this.getAnimationConfig(type);if(!con
figs){return}this._active=this._active||{};if(this._active[type]){this._complete
(this._active[type]);delete this._active[type]}var activeEntries=this._configure
Animations(configs);if(activeEntries.length==0){this.fire("neon-animation-finish
",cookie,{bubbles:false});return}this._active[type]=activeEntries;for(var i=0;i<
activeEntries.length;i++){ | 25 Polymer({is:"cr-dialog","extends":"dialog",properties:{closeText:String,ignorePo
pstate:{type:Boolean,value:false}},ready:function(){window.addEventListener("pop
state",function(){if(!this.ignorePopstate&&this.open)this.cancel()}.bind(this))}
,cancel:function(){this.fire("cancel");HTMLDialogElement.prototype.close.call(th
is,"")},close:function(opt_returnValue){HTMLDialogElement.prototype.close.call(t
his,"success")},getCloseButton:function(){return this.$.close}});Polymer({is:"ap
p-drawer",properties:{opened:{type:Boolean,value:false,notify:true,reflectToAttr
ibute:true},persistent:{type:Boolean,value:false,reflectToAttribute:true},align:
{type:String,value:"left"},position:{type:String,readOnly:true,value:"left",refl
ectToAttribute:true},swipeOpen:{type:Boolean,value:false,reflectToAttribute:true
},noFocusTrap:{type:Boolean,value:false}},observers:["resetLayout(position)","_r
esetPosition(align, isAttached)"],_translateOffset:0,_trackDetails:null,_drawerS
tate:0,_boundEscKeydownHandler:null,_firstTabStop:null,_lastTabStop:null,ready:f
unction(){this.setScrollDirection("y");this._setTransitionDuration("0s")},attach
ed:function(){Polymer.RenderStatus.afterNextRender(this,function(){this._setTran
sitionDuration("");this._boundEscKeydownHandler=this._escKeydownHandler.bind(thi
s);this._resetDrawerState();this.listen(this,"track","_track");this.addEventList
ener("transitionend",this._transitionend.bind(this));this.addEventListener("keyd
own",this._tabKeydownHandler.bind(this))})},detached:function(){document.removeE
ventListener("keydown",this._boundEscKeydownHandler)},open:function(){this.opene
d=true},close:function(){this.opened=false},toggle:function(){this.opened=!this.
opened},getWidth:function(){return this.$.contentContainer.offsetWidth},resetLay
out:function(){this.debounce("_resetLayout",function(){this.fire("app-drawer-res
et-layout")},1)},_isRTL:function(){return window.getComputedStyle(this).directio
n==="rtl"},_resetPosition:function(){switch(this.align){case"start":this._setPos
ition(this._isRTL()?"right":"left");return;case"end":this._setPosition(this._isR
TL()?"left":"right");return}this._setPosition(this.align)},_escKeydownHandler:fu
nction(event){var ESC_KEYCODE=27;if(event.keyCode===ESC_KEYCODE){event.preventDe
fault();this.close()}},_track:function(event){if(this.persistent){return}event.p
reventDefault();switch(event.detail.state){case"start":this._trackStart(event);b
reak;case"track":this._trackMove(event);break;case"end":this._trackEnd(event);br
eak}},_trackStart:function(event){this._drawerState=this._DRAWER_STATE.TRACKING;
this._setTransitionDuration("0s");this.style.visibility="visible";var rect=this.
$.contentContainer.getBoundingClientRect();if(this.position==="left"){this._tran
slateOffset=rect.left}else{this._translateOffset=rect.right-window.innerWidth}th
is._trackDetails=[]},_trackMove:function(event){this._translateDrawer(event.deta
il.dx+this._translateOffset);this._trackDetails.push({dx:event.detail.dx,timeSta
mp:Date.now()})},_trackEnd:function(event){var x=event.detail.dx+this._translate
Offset;var drawerWidth=this.getWidth();var isPositionLeft=this.position==="left"
;var isInEndState=isPositionLeft?x>=0||x<=-drawerWidth:x<=0||x>=drawerWidth;if(!
isInEndState){var trackDetails=this._trackDetails;this._trackDetails=null;this._
flingDrawer(event,trackDetails);if(this._drawerState===this._DRAWER_STATE.FLINGI
NG){return}}var halfWidth=drawerWidth/2;if(event.detail.dx<-halfWidth){this.open
ed=this.position==="right"}else if(event.detail.dx>halfWidth){this.opened=this.p
osition==="left"}if(isInEndState){this._resetDrawerState()}this._setTransitionDu
ration("");this._resetDrawerTranslate();this.style.visibility=""},_calculateVelo
city:function(event,trackDetails){var now=Date.now();var timeLowerBound=now-100;
var trackDetail;var min=0;var max=trackDetails.length-1;while(min<=max){var mid=
min+max>>1;var d=trackDetails[mid];if(d.timeStamp>=timeLowerBound){trackDetail=d
;max=mid-1}else{min=mid+1}}if(trackDetail){var dx=event.detail.dx-trackDetail.dx
;var dt=now-trackDetail.timeStamp||1;return dx/dt}return 0},_flingDrawer:functio
n(event,trackDetails){var velocity=this._calculateVelocity(event,trackDetails);i
f(Math.abs(velocity)<this._MIN_FLING_THRESHOLD){return}this._drawerState=this._D
RAWER_STATE.FLINGING;var x=event.detail.dx+this._translateOffset;var drawerWidth
=this.getWidth();var isPositionLeft=this.position==="left";var isVelocityPositiv
e=velocity>0;var isClosingLeft=!isVelocityPositive&&isPositionLeft;var isClosing
Right=isVelocityPositive&&!isPositionLeft;var dx;if(isClosingLeft){dx=-(x+drawer
Width)}else if(isClosingRight){dx=drawerWidth-x}else{dx=-x}if(isVelocityPositive
){velocity=Math.max(velocity,this._MIN_TRANSITION_VELOCITY);this.opened=this.pos
ition==="left"}else{velocity=Math.min(velocity,-this._MIN_TRANSITION_VELOCITY);t
his.opened=this.position==="right"}this._setTransitionDuration(this._FLING_INITI
AL_SLOPE*dx/velocity+"ms");this._setTransitionTimingFunction(this._FLING_TIMING_
FUNCTION);this._resetDrawerTranslate()},_transitionend:function(event){var targe
t=Polymer.dom(event).rootTarget;if(target===this.$.contentContainer||target===th
is.$.scrim){if(this._drawerState===this._DRAWER_STATE.FLINGING){this._setTransit
ionDuration("");this._setTransitionTimingFunction("");this.style.visibility=""}t
his._resetDrawerState()}},_setTransitionDuration:function(duration){this.$.conte
ntContainer.style.transitionDuration=duration;this.$.scrim.style.transitionDurat
ion=duration},_setTransitionTimingFunction:function(timingFunction){this.$.conte
ntContainer.style.transitionTimingFunction=timingFunction;this.$.scrim.style.tra
nsitionTimingFunction=timingFunction},_translateDrawer:function(x){var drawerWid
th=this.getWidth();if(this.position==="left"){x=Math.max(-drawerWidth,Math.min(x
,0));this.$.scrim.style.opacity=1+x/drawerWidth}else{x=Math.max(0,Math.min(x,dra
werWidth));this.$.scrim.style.opacity=1-x/drawerWidth}this.translate3d(x+"px","0
","0",this.$.contentContainer)},_resetDrawerTranslate:function(){this.$.scrim.st
yle.opacity="";this.transform("",this.$.contentContainer)},_resetDrawerState:fun
ction(){var oldState=this._drawerState;if(this.opened){this._drawerState=this.pe
rsistent?this._DRAWER_STATE.OPENED_PERSISTENT:this._DRAWER_STATE.OPENED}else{thi
s._drawerState=this._DRAWER_STATE.CLOSED}if(oldState!==this._drawerState){if(thi
s._drawerState===this._DRAWER_STATE.OPENED){this._setKeyboardFocusTrap();documen
t.addEventListener("keydown",this._boundEscKeydownHandler);document.body.style.o
verflow="hidden"}else{document.removeEventListener("keydown",this._boundEscKeydo
wnHandler);document.body.style.overflow=""}if(oldState!==this._DRAWER_STATE.INIT
){this.fire("app-drawer-transitioned")}}},_setKeyboardFocusTrap:function(){if(th
is.noFocusTrap){return}var focusableElementsSelector=['a[href]:not([tabindex="-1
"])','area[href]:not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"
])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not(
[tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','iframe:not([tab
index="-1"])','[tabindex]:not([tabindex="-1"])','[contentEditable=true]:not([tab
index="-1"])'].join(",");var focusableElements=Polymer.dom(this).querySelectorAl
l(focusableElementsSelector);if(focusableElements.length>0){this._firstTabStop=f
ocusableElements[0];this._lastTabStop=focusableElements[focusableElements.length
-1]}else{this._firstTabStop=null;this._lastTabStop=null}var tabindex=this.getAtt
ribute("tabindex");if(tabindex&&parseInt(tabindex,10)>-1){this.focus()}else if(t
his._firstTabStop){this._firstTabStop.focus()}},_tabKeydownHandler:function(even
t){if(this.noFocusTrap){return}var TAB_KEYCODE=9;if(this._drawerState===this._DR
AWER_STATE.OPENED&&event.keyCode===TAB_KEYCODE){if(event.shiftKey){if(this._firs
tTabStop&&Polymer.dom(event).localTarget===this._firstTabStop){event.preventDefa
ult();this._lastTabStop.focus()}}else{if(this._lastTabStop&&Polymer.dom(event).l
ocalTarget===this._lastTabStop){event.preventDefault();this._firstTabStop.focus(
)}}}},_MIN_FLING_THRESHOLD:.2,_MIN_TRANSITION_VELOCITY:1.2,_FLING_TIMING_FUNCTIO
N:"cubic-bezier(0.667, 1, 0.667, 1)",_FLING_INITIAL_SLOPE:1.5,_DRAWER_STATE:{INI
T:0,OPENED:1,OPENED_PERSISTENT:2,CLOSED:3,TRACKING:4,FLINGING:5}});Polymer.IronF
itBehavior={properties:{sizingTarget:{type:Object,value:function(){return this}}
,fitInto:{type:Object,value:window},noOverlap:{type:Boolean},positionTarget:{typ
e:Element},horizontalAlign:{type:String},verticalAlign:{type:String},dynamicAlig
n:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:true},verticalOffs
et:{type:Number,value:0,notify:true},autoFitOnAttach:{type:Boolean,value:false},
_fitInfo:{type:Object}},get _fitWidth(){var fitWidth;if(this.fitInto===window){f
itWidth=this.fitInto.innerWidth}else{fitWidth=this.fitInto.getBoundingClientRect
().width}return fitWidth},get _fitHeight(){var fitHeight;if(this.fitInto===windo
w){fitHeight=this.fitInto.innerHeight}else{fitHeight=this.fitInto.getBoundingCli
entRect().height}return fitHeight},get _fitLeft(){var fitLeft;if(this.fitInto===
window){fitLeft=0}else{fitLeft=this.fitInto.getBoundingClientRect().left}return
fitLeft},get _fitTop(){var fitTop;if(this.fitInto===window){fitTop=0}else{fitTop
=this.fitInto.getBoundingClientRect().top}return fitTop},get _defaultPositionTar
get(){var parent=Polymer.dom(this).parentNode;if(parent&&parent.nodeType===Node.
DOCUMENT_FRAGMENT_NODE){parent=parent.host}return parent},get _localeHorizontalA
lign(){if(this._isRTL){if(this.horizontalAlign==="right"){return"left"}if(this.h
orizontalAlign==="left"){return"right"}}return this.horizontalAlign},attached:fu
nction(){this._isRTL=window.getComputedStyle(this).direction=="rtl";this.positio
nTarget=this.positionTarget||this._defaultPositionTarget;if(this.autoFitOnAttach
){if(window.getComputedStyle(this).display==="none"){setTimeout(function(){this.
fit()}.bind(this))}else{this.fit()}}},fit:function(){this.position();this.constr
ain();this.center()},_discoverInfo:function(){if(this._fitInfo){return}var targe
t=window.getComputedStyle(this);var sizer=window.getComputedStyle(this.sizingTar
get);this._fitInfo={inlineStyle:{top:this.style.top||"",left:this.style.left||""
,position:this.style.position||""},sizerInlineStyle:{maxWidth:this.sizingTarget.
style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHeight||"",boxSizing:thi
s.sizingTarget.style.boxSizing||""},positionedBy:{vertically:target.top!=="auto"
?"top":target.bottom!=="auto"?"bottom":null,horizontally:target.left!=="auto"?"l
eft":target.right!=="auto"?"right":null},sizedBy:{height:sizer.maxHeight!=="none
",width:sizer.maxWidth!=="none",minWidth:parseInt(sizer.minWidth,10)||0,minHeigh
t:parseInt(sizer.minHeight,10)||0},margin:{top:parseInt(target.marginTop,10)||0,
right:parseInt(target.marginRight,10)||0,bottom:parseInt(target.marginBottom,10)
||0,left:parseInt(target.marginLeft,10)||0}};if(this.verticalOffset){this._fitIn
fo.margin.top=this._fitInfo.margin.bottom=this.verticalOffset;this._fitInfo.inli
neStyle.marginTop=this.style.marginTop||"";this._fitInfo.inlineStyle.marginBotto
m=this.style.marginBottom||"";this.style.marginTop=this.style.marginBottom=this.
verticalOffset+"px"}if(this.horizontalOffset){this._fitInfo.margin.left=this._fi
tInfo.margin.right=this.horizontalOffset;this._fitInfo.inlineStyle.marginLeft=th
is.style.marginLeft||"";this._fitInfo.inlineStyle.marginRight=this.style.marginR
ight||"";this.style.marginLeft=this.style.marginRight=this.horizontalOffset+"px"
}},resetFit:function(){var info=this._fitInfo||{};for(var property in info.sizer
InlineStyle){this.sizingTarget.style[property]=info.sizerInlineStyle[property]}f
or(var property in info.inlineStyle){this.style[property]=info.inlineStyle[prope
rty]}this._fitInfo=null},refit:function(){var scrollLeft=this.sizingTarget.scrol
lLeft;var scrollTop=this.sizingTarget.scrollTop;this.resetFit();this.fit();this.
sizingTarget.scrollLeft=scrollLeft;this.sizingTarget.scrollTop=scrollTop},positi
on:function(){if(!this.horizontalAlign&&!this.verticalAlign){return}this._discov
erInfo();this.style.position="fixed";this.sizingTarget.style.boxSizing="border-b
ox";this.style.left="0px";this.style.top="0px";var rect=this.getBoundingClientRe
ct();var positionRect=this.__getNormalizedRect(this.positionTarget);var fitRect=
this.__getNormalizedRect(this.fitInto);var margin=this._fitInfo.margin;var size=
{width:rect.width+margin.left+margin.right,height:rect.height+margin.top+margin.
bottom};var position=this.__getPosition(this._localeHorizontalAlign,this.vertica
lAlign,size,positionRect,fitRect);var left=position.left+margin.left;var top=pos
ition.top+margin.top;var right=Math.min(fitRect.right-margin.right,left+rect.wid
th);var bottom=Math.min(fitRect.bottom-margin.bottom,top+rect.height);var minWid
th=this._fitInfo.sizedBy.minWidth;var minHeight=this._fitInfo.sizedBy.minHeight;
if(left<margin.left){left=margin.left;if(right-left<minWidth){left=right-minWidt
h}}if(top<margin.top){top=margin.top;if(bottom-top<minHeight){top=bottom-minHeig
ht}}this.sizingTarget.style.maxWidth=right-left+"px";this.sizingTarget.style.max
Height=bottom-top+"px";this.style.left=left-rect.left+"px";this.style.top=top-re
ct.top+"px"},constrain:function(){if(this.horizontalAlign||this.verticalAlign){r
eturn}this._discoverInfo();var info=this._fitInfo;if(!info.positionedBy.vertical
ly){this.style.position="fixed";this.style.top="0px"}if(!info.positionedBy.horiz
ontally){this.style.position="fixed";this.style.left="0px"}this.sizingTarget.sty
le.boxSizing="border-box";var rect=this.getBoundingClientRect();if(!info.sizedBy
.height){this.__sizeDimension(rect,info.positionedBy.vertically,"top","bottom","
Height")}if(!info.sizedBy.width){this.__sizeDimension(rect,info.positionedBy.hor
izontally,"left","right","Width")}},_sizeDimension:function(rect,positionedBy,st
art,end,extent){this.__sizeDimension(rect,positionedBy,start,end,extent)},__size
Dimension:function(rect,positionedBy,start,end,extent){var info=this._fitInfo;va
r fitRect=this.__getNormalizedRect(this.fitInto);var max=extent==="Width"?fitRec
t.width:fitRect.height;var flip=positionedBy===end;var offset=flip?max-rect[end]
:rect[start];var margin=info.margin[flip?start:end];var offsetExtent="offset"+ex
tent;var sizingOffset=this[offsetExtent]-this.sizingTarget[offsetExtent];this.si
zingTarget.style["max"+extent]=max-margin-offset-sizingOffset+"px"},center:funct
ion(){if(this.horizontalAlign||this.verticalAlign){return}this._discoverInfo();v
ar positionedBy=this._fitInfo.positionedBy;if(positionedBy.vertically&&positione
dBy.horizontally){return}this.style.position="fixed";if(!positionedBy.vertically
){this.style.top="0px"}if(!positionedBy.horizontally){this.style.left="0px"}var
rect=this.getBoundingClientRect();var fitRect=this.__getNormalizedRect(this.fitI
nto);if(!positionedBy.vertically){var top=fitRect.top-rect.top+(fitRect.height-r
ect.height)/2;this.style.top=top+"px"}if(!positionedBy.horizontally){var left=fi
tRect.left-rect.left+(fitRect.width-rect.width)/2;this.style.left=left+"px"}},__
getNormalizedRect:function(target){if(target===document.documentElement||target=
==window){return{top:0,left:0,width:window.innerWidth,height:window.innerHeight,
right:window.innerWidth,bottom:window.innerHeight}}return target.getBoundingClie
ntRect()},__getCroppedArea:function(position,size,fitRect){var verticalCrop=Math
.min(0,position.top)+Math.min(0,fitRect.bottom-(position.top+size.height));var h
orizontalCrop=Math.min(0,position.left)+Math.min(0,fitRect.right-(position.left+
size.width));return Math.abs(verticalCrop)*size.width+Math.abs(horizontalCrop)*s
ize.height},__getPosition:function(hAlign,vAlign,size,positionRect,fitRect){var
positions=[{verticalAlign:"top",horizontalAlign:"left",top:positionRect.top,left
:positionRect.left},{verticalAlign:"top",horizontalAlign:"right",top:positionRec
t.top,left:positionRect.right-size.width},{verticalAlign:"bottom",horizontalAlig
n:"left",top:positionRect.bottom-size.height,left:positionRect.left},{verticalAl
ign:"bottom",horizontalAlign:"right",top:positionRect.bottom-size.height,left:po
sitionRect.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]}po
sitions.push(copy)}positions[0].top=positions[1].top+=positionRect.height;positi
ons[2].top=positions[3].top-=positionRect.height;positions[4].left=positions[6].
left+=positionRect.width;positions[5].left=positions[7].left-=positionRect.width
}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign==="auto"?null:hAlign;var posit
ion;for(var i=0;i<positions.length;i++){var pos=positions[i];if(!this.dynamicAli
gn&&!this.noOverlap&&pos.verticalAlign===vAlign&&pos.horizontalAlign===hAlign){p
osition=pos;break}var alignOk=(!vAlign||pos.verticalAlign===vAlign)&&(!hAlign||p
os.horizontalAlign===hAlign);if(!this.dynamicAlign&&!alignOk){continue}position=
position||pos;pos.croppedArea=this.__getCroppedArea(pos,size,fitRect);var diff=p
os.croppedArea-position.croppedArea;if(diff<0||diff===0&&alignOk){position=pos}i
f(position.croppedArea===0&&alignOk){break}}return position}};(function(){"use s
trict";Polymer({is:"iron-overlay-backdrop",properties:{opened:{reflectToAttribut
e:true,type:Boolean,value:false,observer:"_openedChanged"}},listeners:{transitio
nend:"_onTransitionend"},created:function(){this.__openedRaf=null},attached:func
tion(){this.opened&&this._openedChanged(this.opened)},prepare:function(){if(this
.opened&&!this.parentNode){Polymer.dom(document.body).appendChild(this)}},open:f
unction(){this.opened=true},close:function(){this.opened=false},complete:functio
n(){if(!this.opened&&this.parentNode===document.body){Polymer.dom(this.parentNod
e).removeChild(this)}},_onTransitionend:function(event){if(event&&event.target==
=this){this.complete()}},_openedChanged:function(opened){if(opened){this.prepare
()}else{var cs=window.getComputedStyle(this);if(cs.transitionDuration==="0s"||cs
.opacity==0){this.complete()}}if(!this.isAttached){return}if(this.__openedRaf){w
indow.cancelAnimationFrame(this.__openedRaf);this.__openedRaf=null}this.scrollTo
p=this.scrollTop;this.__openedRaf=window.requestAnimationFrame(function(){this._
_openedRaf=null;this.toggleClass("opened",this.opened)}.bind(this))}})})();Polym
er.IronOverlayManagerClass=function(){this._overlays=[];this._minimumZ=101;this.
_backdropElement=null;Polymer.Gestures.add(document,"tap",this._onCaptureClick.b
ind(this));document.addEventListener("focus",this._onCaptureFocus.bind(this),tru
e);document.addEventListener("keydown",this._onCaptureKeyDown.bind(this),true)};
Polymer.IronOverlayManagerClass.prototype={constructor:Polymer.IronOverlayManage
rClass,get backdropElement(){if(!this._backdropElement){this._backdropElement=do
cument.createElement("iron-overlay-backdrop")}return this._backdropElement},get
deepActiveElement(){var active=document.activeElement||document.body;while(activ
e.root&&Polymer.dom(active.root).activeElement){active=Polymer.dom(active.root).
activeElement}return active},_bringOverlayAtIndexToFront:function(i){var overlay
=this._overlays[i];if(!overlay){return}var lastI=this._overlays.length-1;var cur
rentOverlay=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._apply
OverlayZ(overlay,minimumZ)}while(i<lastI){this._overlays[i]=this._overlays[i+1];
i++}this._overlays[lastI]=overlay},addOrRemoveOverlay:function(overlay){if(overl
ay.opened){this.addOverlay(overlay)}else{this.removeOverlay(overlay)}},addOverla
y:function(overlay){var i=this._overlays.indexOf(overlay);if(i>=0){this._bringOv
erlayAtIndexToFront(i);this.trackBackdrop();return}var insertionIndex=this._over
lays.length;var currentOverlay=this._overlays[insertionIndex-1];var minimumZ=Mat
h.max(this._getZ(currentOverlay),this._minimumZ);var newZ=this._getZ(overlay);if
(currentOverlay&&this._shouldBeBehindOverlay(overlay,currentOverlay)){this._appl
yOverlayZ(currentOverlay,minimumZ);insertionIndex--;var previousOverlay=this._ov
erlays[insertionIndex-1];minimumZ=Math.max(this._getZ(previousOverlay),this._min
imumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overlay,minimumZ)}this._overlays.s
plice(insertionIndex,0,overlay);this.trackBackdrop()},removeOverlay:function(ove
rlay){var i=this._overlays.indexOf(overlay);if(i===-1){return}this._overlays.spl
ice(i,1);this.trackBackdrop()},currentOverlay:function(){var i=this._overlays.le
ngth-1;return this._overlays[i]},currentOverlayZ:function(){return this._getZ(th
is.currentOverlay())},ensureMinimumZ:function(minimumZ){this._minimumZ=Math.max(
this._minimumZ,minimumZ)},focusOverlay:function(){var current=this.currentOverla
y();if(current){current._applyFocus()}},trackBackdrop:function(){var overlay=thi
s._overlayWithBackdrop();if(!overlay&&!this._backdropElement){return}this.backdr
opElement.style.zIndex=this._getZ(overlay)-1;this.backdropElement.opened=!!overl
ay},getBackdrops:function(){var backdrops=[];for(var i=0;i<this._overlays.length
;i++){if(this._overlays[i].withBackdrop){backdrops.push(this._overlays[i])}}retu
rn backdrops},backdropZ:function(){return this._getZ(this._overlayWithBackdrop()
)-1},_overlayWithBackdrop:function(){for(var i=0;i<this._overlays.length;i++){if
(this._overlays[i].withBackdrop){return this._overlays[i]}}},_getZ:function(over
lay){var z=this._minimumZ;if(overlay){var z1=Number(overlay.style.zIndex||window
.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1}}return z},_setZ:function(el
ement,z){element.style.zIndex=z},_applyOverlayZ:function(overlay,aboveZ){this._s
etZ(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(overlay&&this._overlayInPat
h(Polymer.dom(event).path)!==overlay){overlay._onCaptureClick(event)}},_onCaptur
eFocus:function(event){var overlay=this.currentOverlay();if(overlay){overlay._on
CaptureFocus(event)}},_onCaptureKeyDown:function(event){var overlay=this.current
Overlay();if(overlay){if(Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(e
vent,"esc")){overlay._onCaptureEsc(event)}else if(Polymer.IronA11yKeysBehavior.k
eyboardEventMatchesKeys(event,"tab")){overlay._onCaptureTab(event)}}},_shouldBeB
ehindOverlay:function(overlay1,overlay2){return!overlay1.alwaysOnTop&&overlay2.a
lwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOverlayManagerClass;(fun
ction(){"use strict";Polymer.IronOverlayBehaviorImpl={properties:{opened:{observ
er:"_openedChanged",type:Boolean,value:false,notify:true},canceled:{observer:"_c
anceledChanged",readOnly:true,type:Boolean,value:false},withBackdrop:{observer:"
_withBackdropChanged",type:Boolean},noAutoFocus:{type:Boolean,value:false},noCan
celOnEscKey:{type:Boolean,value:false},noCancelOnOutsideClick:{type:Boolean,valu
e:false},closingReason:{type:Object},restoreFocusOnClose:{type:Boolean,value:fal
se},alwaysOnTop:{type:Boolean},_manager:{type:Object,value:Polymer.IronOverlayMa
nager},_focusedChild:{type:Object}},listeners:{"iron-resize":"_onIronResize"},ge
t backdropElement(){return this._manager.backdropElement},get _focusNode(){retur
n 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","s
elect","textarea","button"];var selector=FOCUSABLE_WITH_DISABLED.join(':not([tab
index="-1"]),')+':not([tabindex="-1"]),'+FOCUSABLE_WITHOUT_DISABLED.join(':not([
disabled]):not([tabindex="-1"]),')+':not([disabled]):not([tabindex="-1"])';var f
ocusables=Polymer.dom(this).querySelectorAll(selector);if(this.tabIndex>=0){focu
sables.splice(0,0,this)}return focusables.sort(function(a,b){if(a.tabIndex===b.t
abIndex){return 0}if(a.tabIndex===0||a.tabIndex>b.tabIndex){return 1}return-1})}
,ready:function(){this.__isAnimating=false;this.__shouldRemoveTabIndex=false;thi
s.__firstFocusableNode=this.__lastFocusableNode=null;this.__raf=null;this.__rest
oreFocusNode=null;this._ensureSetup()},attached:function(){if(this.opened){this.
_openedChanged(this.opened)}this._observer=Polymer.dom(this).observeNodes(this._
onNodesChange)},detached:function(){Polymer.dom(this).unobserveNodes(this._obser
ver);this._observer=null;if(this.__raf){window.cancelAnimationFrame(this.__raf);
this.__raf=null}this._manager.removeOverlay(this)},toggle:function(){this._setCa
nceled(false);this.opened=!this.opened},open:function(){this._setCanceled(false)
;this.opened=true},close:function(){this._setCanceled(false);this.opened=false},
cancel:function(event){var cancelEvent=this.fire("iron-overlay-canceled",event,{
cancelable:true});if(cancelEvent.defaultPrevented){return}this._setCanceled(true
);this.opened=false},_ensureSetup:function(){if(this._overlaySetup){return}this.
_overlaySetup=true;this.style.outline="none";this.style.display="none"},_openedC
hanged:function(opened){if(opened){this.removeAttribute("aria-hidden")}else{this
.setAttribute("aria-hidden","true")}if(!this.isAttached){return}this.__isAnimati
ng=true;this.__onNextAnimationFrame(this.__openedChanged)},_canceledChanged:func
tion(){this.closingReason=this.closingReason||{};this.closingReason.canceled=thi
s.canceled},_withBackdropChanged:function(){if(this.withBackdrop&&!this.hasAttri
bute("tabindex")){this.setAttribute("tabindex","-1");this.__shouldRemoveTabIndex
=true}else if(this.__shouldRemoveTabIndex){this.removeAttribute("tabindex");this
.__shouldRemoveTabIndex=false}if(this.opened&&this.isAttached){this._manager.tra
ckBackdrop()}},_prepareRenderOpened:function(){this.__restoreFocusNode=this._man
ager.deepActiveElement;this._preparePositioning();this.refit();this._finishPosit
ioning();if(this.noAutoFocus&&document.activeElement===this._focusNode){this._fo
cusNode.blur();this.__restoreFocusNode.focus()}},_renderOpened:function(){this._
finishRenderOpened()},_renderClosed:function(){this._finishRenderClosed()},_fini
shRenderOpened:function(){this.notifyResize();this.__isAnimating=false;var focus
ableNodes=this._focusableNodes;this.__firstFocusableNode=focusableNodes[0];this.
__lastFocusableNode=focusableNodes[focusableNodes.length-1];this.fire("iron-over
lay-opened")},_finishRenderClosed:function(){this.style.display="none";this.styl
e.zIndex="";this.notifyResize();this.__isAnimating=false;this.fire("iron-overlay
-closed",this.closingReason)},_preparePositioning:function(){this.style.transiti
on=this.style.webkitTransition="none";this.style.transform=this.style.webkitTran
sform="none";this.style.display=""},_finishPositioning:function(){this.style.dis
play="none";this.scrollTop=this.scrollTop;this.style.transition=this.style.webki
tTransition="";this.style.transform=this.style.webkitTransform="";this.style.dis
play="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(this.opened){if
(!this.noAutoFocus){this._focusNode.focus()}}else{this._focusNode.blur();this._f
ocusedChild=null;if(this.restoreFocusOnClose&&this.__restoreFocusNode){this.__re
storeFocusNode.focus()}this.__restoreFocusNode=null;var currentOverlay=this._man
ager.currentOverlay();if(currentOverlay&&this!==currentOverlay){currentOverlay._
applyFocus()}}},_onCaptureClick:function(event){if(!this.noCancelOnOutsideClick)
{this.cancel(event)}},_onCaptureFocus:function(event){if(!this.withBackdrop){ret
urn}var path=Polymer.dom(event).path;if(path.indexOf(this)===-1){event.stopPropa
gation();this._applyFocus()}else{this._focusedChild=path[0]}},_onCaptureEsc:func
tion(event){if(!this.noCancelOnEscKey){this.cancel(event)}},_onCaptureTab:functi
on(event){if(!this.withBackdrop){return}var shift=event.shiftKey;var nodeToCheck
=shift?this.__firstFocusableNode:this.__lastFocusableNode;var nodeToSet=shift?th
is.__lastFocusableNode:this.__firstFocusableNode;var shouldWrap=false;if(nodeToC
heck===nodeToSet){shouldWrap=true}else{var focusedNode=this._manager.deepActiveE
lement;shouldWrap=focusedNode===nodeToCheck||focusedNode===this}if(shouldWrap){e
vent.preventDefault();this._focusedChild=nodeToSet;this._applyFocus()}},_onIronR
esize:function(){if(this.opened&&!this.__isAnimating){this.__onNextAnimationFram
e(this.refit)}},_onNodesChange:function(){if(this.opened&&!this.__isAnimating){t
his.notifyResize()}},__openedChanged:function(){if(this.opened){this._prepareRen
derOpened();this._manager.addOverlay(this);this._applyFocus();this._renderOpened
()}else{this._manager.removeOverlay(this);this._applyFocus();this._renderClosed(
)}},__onNextAnimationFrame:function(callback){if(this.__raf){window.cancelAnimat
ionFrame(this.__raf)}var self=this;this.__raf=window.requestAnimationFrame(funct
ion nextAnimationFrame(){self.__raf=null;callback.call(self)})}};Polymer.IronOve
rlayBehavior=[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,Polymer.Iron
OverlayBehaviorImpl]})();Polymer.NeonAnimatableBehavior={properties:{animationCo
nfig:{type:Object},entryAnimation:{observer:"_entryAnimationChanged",type:String
},exitAnimation:{observer:"_exitAnimationChanged",type:String}},_entryAnimationC
hanged:function(){this.animationConfig=this.animationConfig||{};this.animationCo
nfig["entry"]=[{name:this.entryAnimation,node:this}]},_exitAnimationChanged:func
tion(){this.animationConfig=this.animationConfig||{};this.animationConfig["exit"
]=[{name:this.exitAnimation,node:this}]},_copyProperties:function(config1,config
2){for(var property in config2){config1[property]=config2[property]}},_cloneConf
ig:function(config){var clone={isClone:true};this._copyProperties(clone,config);
return clone},_getAnimationConfigRecursive:function(type,map,allConfigs){if(!thi
s.animationConfig){return}if(this.animationConfig.value&&typeof this.animationCo
nfig.value==="function"){this._warn(this._logf("playAnimation","Please put 'anim
ationConfig' inside of your components 'properties' object instead of outside of
it."));return}var thisConfig;if(type){thisConfig=this.animationConfig[type]}els
e{thisConfig=this.animationConfig}if(!Array.isArray(thisConfig)){thisConfig=[thi
sConfig]}if(thisConfig){for(var config,index=0;config=thisConfig[index];index++)
{if(config.animatable){config.animatable._getAnimationConfigRecursive(config.typ
e||type,map,allConfigs)}else{if(config.id){var cachedConfig=map[config.id];if(ca
chedConfig){if(!cachedConfig.isClone){map[config.id]=this._cloneConfig(cachedCon
fig);cachedConfig=map[config.id]}this._copyProperties(cachedConfig,config)}else{
map[config.id]=config}}else{allConfigs.push(config)}}}}},getAnimationConfig:func
tion(type){var map={};var allConfigs=[];this._getAnimationConfigRecursive(type,m
ap,allConfigs);for(var key in map){allConfigs.push(map[key])}return allConfigs}}
;Polymer.NeonAnimationRunnerBehaviorImpl={_configureAnimations:function(configs)
{var results=[];if(configs.length>0){for(var config,index=0;config=configs[index
];index++){var neonAnimation=document.createElement(config.name);if(neonAnimatio
n.isNeonAnimation){var result=null;try{result=neonAnimation.configure(config);if
(typeof result.cancel!="function"){result=document.timeline.play(result)}}catch(
e){result=null;console.warn("Couldnt play","(",config.name,").",e)}if(result){re
sults.push({neonAnimation:neonAnimation,config:config,animation:result})}}else{c
onsole.warn(this.is+":",config.name,"not found!")}}}return results},_shouldCompl
ete:function(activeEntries){var finished=true;for(var i=0;i<activeEntries.length
;i++){if(activeEntries[i].animation.playState!="finished"){finished=false;break}
}return finished},_complete:function(activeEntries){for(var i=0;i<activeEntries.
length;i++){activeEntries[i].neonAnimation.complete(activeEntries[i].config)}for
(var i=0;i<activeEntries.length;i++){activeEntries[i].animation.cancel()}},playA
nimation:function(type,cookie){var configs=this.getAnimationConfig(type);if(!con
figs){return}this._active=this._active||{};if(this._active[type]){this._complete
(this._active[type]);delete this._active[type]}var activeEntries=this._configure
Animations(configs);if(activeEntries.length==0){this.fire("neon-animation-finish
",cookie,{bubbles:false});return}this._active[type]=activeEntries;for(var i=0;i<
activeEntries.length;i++){ |
26 activeEntries[i].animation.onfinish=function(){if(this._shouldComplete(activeEnt
ries)){this._complete(activeEntries);delete this._active[type];this.fire("neon-a
nimation-finish",cookie,{bubbles:false})}}.bind(this)}},cancelAnimation:function
(){for(var k in this._animations){this._animations[k].cancel()}this._animations=
{}}};Polymer.NeonAnimationRunnerBehavior=[Polymer.NeonAnimatableBehavior,Polymer
.NeonAnimationRunnerBehaviorImpl];Polymer.NeonAnimationBehavior={properties:{ani
mationTiming:{type:Object,value:function(){return{duration:500,easing:"cubic-bez
ier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeonAnimation:true,timingFromConfig:funct
ion(config){if(config.timing){for(var property in config.timing){this.animationT
iming[property]=config.timing[property]}}return this.animationTiming},setPrefixe
dProperty:function(node,property,value){var map={transform:["webkitTransform"],t
ransformOrigin:["mozTransformOrigin","webkitTransformOrigin"]};var prefixes=map[
property];for(var prefix,index=0;prefix=prefixes[index];index++){node.style[pref
ix]=value}node.style[property]=value},complete:function(){}};Polymer({is:"opaque
-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config)
{var node=config.node;this._effect=new KeyframeEffect(node,[{opacity:"1"},{opaci
ty:"1"}],this.timingFromConfig(config));node.style.opacity="0";return this._effe
ct},complete:function(config){config.node.style.opacity=""}});(function(){"use s
trict";var LAST_TOUCH_POSITION={pageX:0,pageY:0};var ROOT_TARGET=null;var SCROLL
ABLE_NODES=[];Polymer.IronDropdownScrollManager={get currentLockingElement(){ret
urn this._lockingElements[this._lockingElements.length-1]},elementIsScrollLocked
:function(element){var currentLockingElement=this.currentLockingElement;if(curre
ntLockingElement===undefined)return false;var scrollLocked;if(this._hasCachedLoc
kedElement(element)){return true}if(this._hasCachedUnlockedElement(element)){ret
urn false}scrollLocked=!!currentLockingElement&¤tLockingElement!==element&
&!this._composedTreeContains(currentLockingElement,element);if(scrollLocked){thi
s._lockedElementCache.push(element)}else{this._unlockedElementCache.push(element
)}return scrollLocked},pushScrollLock:function(element){if(this._lockingElements
.indexOf(element)>=0){return}if(this._lockingElements.length===0){this._lockScro
llInteractions()}this._lockingElements.push(element);this._lockedElementCache=[]
;this._unlockedElementCache=[]},removeScrollLock:function(element){var index=thi
s._lockingElements.indexOf(element);if(index===-1){return}this._lockingElements.
splice(index,1);this._lockedElementCache=[];this._unlockedElementCache=[];if(thi
s._lockingElements.length===0){this._unlockScrollInteractions()}},_lockingElemen
ts:[],_lockedElementCache:null,_unlockedElementCache:null,_hasCachedLockedElemen
t:function(element){return this._lockedElementCache.indexOf(element)>-1},_hasCac
hedUnlockedElement:function(element){return this._unlockedElementCache.indexOf(e
lement)>-1},_composedTreeContains:function(element,child){var contentElements;va
r distributedNodes;var contentIndex;var nodeIndex;if(element.contains(child)){re
turn true}contentElements=Polymer.dom(element).querySelectorAll("content");for(c
ontentIndex=0;contentIndex<contentElements.length;++contentIndex){distributedNod
es=Polymer.dom(contentElements[contentIndex]).getDistributedNodes();for(nodeInde
x=0;nodeIndex<distributedNodes.length;++nodeIndex){if(this._composedTreeContains
(distributedNodes[nodeIndex],child)){return true}}}return false},_scrollInteract
ionHandler:function(event){if(event.cancelable&&this._shouldPreventScrolling(eve
nt)){event.preventDefault()}if(event.targetTouches){var touch=event.targetTouche
s[0];LAST_TOUCH_POSITION.pageX=touch.pageX;LAST_TOUCH_POSITION.pageY=touch.pageY
}},_lockScrollInteractions:function(){this._boundScrollHandler=this._boundScroll
Handler||this._scrollInteractionHandler.bind(this);document.addEventListener("wh
eel",this._boundScrollHandler,true);document.addEventListener("mousewheel",this.
_boundScrollHandler,true);document.addEventListener("DOMMouseScroll",this._bound
ScrollHandler,true);document.addEventListener("touchstart",this._boundScrollHand
ler,true);document.addEventListener("touchmove",this._boundScrollHandler,true)},
_unlockScrollInteractions:function(){document.removeEventListener("wheel",this._
boundScrollHandler,true);document.removeEventListener("mousewheel",this._boundSc
rollHandler,true);document.removeEventListener("DOMMouseScroll",this._boundScrol
lHandler,true);document.removeEventListener("touchstart",this._boundScrollHandle
r,true);document.removeEventListener("touchmove",this._boundScrollHandler,true)}
,_shouldPreventScrolling:function(event){var target=Polymer.dom(event).rootTarge
t;if(event.type!=="touchmove"&&ROOT_TARGET!==target){ROOT_TARGET=target;SCROLLAB
LE_NODES=this._getScrollableNodes(Polymer.dom(event).path)}if(!SCROLLABLE_NODES.
length){return true}if(event.type==="touchstart"){return false}var info=this._ge
tScrollInfo(event);return!this._getScrollingNode(SCROLLABLE_NODES,info.deltaX,in
fo.deltaY)},_getScrollableNodes:function(nodes){var scrollables=[];var lockingIn
dex=nodes.indexOf(this.currentLockingElement);for(var i=0;i<=lockingIndex;i++){v
ar node=nodes[i];if(node.nodeType===11){continue}var style=node.style;if(style.o
verflow!=="scroll"&&style.overflow!=="auto"){style=window.getComputedStyle(node)
}if(style.overflow==="scroll"||style.overflow==="auto"){scrollables.push(node)}}
return scrollables},_getScrollingNode:function(nodes,deltaX,deltaY){if(!deltaX&&
!deltaY){return}var verticalScroll=Math.abs(deltaY)>=Math.abs(deltaX);for(var i=
0;i<nodes.length;i++){var node=nodes[i];var canScroll=false;if(verticalScroll){c
anScroll=deltaY<0?node.scrollTop>0:node.scrollTop<node.scrollHeight-node.clientH
eight}else{canScroll=deltaX<0?node.scrollLeft>0:node.scrollLeft<node.scrollWidth
-node.clientWidth}if(canScroll){return node}}},_getScrollInfo:function(event){va
r info={deltaX:event.deltaX,deltaY:event.deltaY};if("deltaX"in event){}else if("
wheelDeltaX"in event){info.deltaX=-event.wheelDeltaX;info.deltaY=-event.wheelDel
taY}else if("axis"in event){info.deltaX=event.axis===1?event.detail:0;info.delta
Y=event.axis===2?event.detail:0}else if(event.targetTouches){var touch=event.tar
getTouches[0];info.deltaX=LAST_TOUCH_POSITION.pageX-touch.pageX;info.deltaY=LAST
_TOUCH_POSITION.pageY-touch.pageY}return info}}})();(function(){"use strict";Pol
ymer({is:"iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKey
sBehavior,Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],prope
rties:{horizontalAlign:{type:String,value:"left",reflectToAttribute:true},vertic
alAlign:{type:String,value:"top",reflectToAttribute:true},openAnimationConfig:{t
ype:Object},closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnima
tions:{type:Boolean,value:false},allowOutsideScroll:{type:Boolean,value:false},_
boundOnCaptureScroll:{type:Function,value:function(){return this._onCaptureScrol
l.bind(this)}}},listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},obs
ervers:["_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign,
verticalOffset, horizontalOffset)"],get containedElement(){return Polymer.dom(th
is.$.content).getDistributedNodes()[0]},get _focusTarget(){return this.focusTarg
et||this.containedElement},ready:function(){this._scrollTop=0;this._scrollLeft=0
;this._refitOnScrollRAF=null},attached:function(){if(!this.sizingTarget||this.si
zingTarget===this){this.sizingTarget=this.containedElement}},detached:function()
{this.cancelAnimation();document.removeEventListener("scroll",this._boundOnCaptu
reScroll);Polymer.IronDropdownScrollManager.removeScrollLock(this)},_openedChang
ed:function(){if(this.opened&&this.disabled){this.cancel()}else{this.cancelAnima
tion();this._updateAnimationConfig();this._saveScrollPosition();if(this.opened){
document.addEventListener("scroll",this._boundOnCaptureScroll);!this.allowOutsid
eScroll&&Polymer.IronDropdownScrollManager.pushScrollLock(this)}else{document.re
moveEventListener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrol
lManager.removeScrollLock(this)}Polymer.IronOverlayBehaviorImpl._openedChanged.a
pply(this,arguments)}},_renderOpened:function(){if(!this.noAnimations&&this.anim
ationConfig.open){this.$.contentWrapper.classList.add("animating");this.playAnim
ation("open")}else{Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,argu
ments)}},_renderClosed:function(){if(!this.noAnimations&&this.animationConfig.cl
ose){this.$.contentWrapper.classList.add("animating");this.playAnimation("close"
)}else{Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)}},_on
NeonAnimationFinish:function(){this.$.contentWrapper.classList.remove("animating
");if(this.opened){this._finishRenderOpened()}else{this._finishRenderClosed()}},
_onCaptureScroll:function(){if(!this.allowOutsideScroll){this._restoreScrollPosi
tion()}else{this._refitOnScrollRAF&&window.cancelAnimationFrame(this._refitOnScr
ollRAF);this._refitOnScrollRAF=window.requestAnimationFrame(this.refit.bind(this
))}},_saveScrollPosition:function(){if(document.scrollingElement){this._scrollTo
p=document.scrollingElement.scrollTop;this._scrollLeft=document.scrollingElement
.scrollLeft}else{this._scrollTop=Math.max(document.documentElement.scrollTop,doc
ument.body.scrollTop);this._scrollLeft=Math.max(document.documentElement.scrollL
eft,document.body.scrollLeft)}},_restoreScrollPosition:function(){if(document.sc
rollingElement){document.scrollingElement.scrollTop=this._scrollTop;document.scr
ollingElement.scrollLeft=this._scrollLeft}else{document.documentElement.scrollTo
p=this._scrollTop;document.documentElement.scrollLeft=this._scrollLeft;document.
body.scrollTop=this._scrollTop;document.body.scrollLeft=this._scrollLeft}},_upda
teAnimationConfig:function(){var animations=(this.openAnimationConfig||[]).conca
t(this.closeAnimationConfig||[]);for(var i=0;i<animations.length;i++){animations
[i].node=this.containedElement}this.animationConfig={open:this.openAnimationConf
ig,close:this.closeAnimationConfig}},_updateOverlayPosition:function(){if(this.i
sAttached){this.notifyResize()}},_applyFocus:function(){var focusTarget=this.foc
usTarget||this.containedElement;if(focusTarget&&this.opened&&!this.noAutoFocus){
focusTarget.focus()}else{Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this,
arguments)}}})})();Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,P
olymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boole
an,value:false,reflectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{
down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _
parentNoink(){var parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.n
oink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onT
ap:function(event){if(this.link){var anchor=this.queryEffectiveChildren("a");if(
!anchor){return}if(event.target===anchor){return}anchor.click()}}});Polymer.Iron
MenuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOn
ly:true,type:Object},attrForItemTitle:{type:String}},hostAttributes:{role:"menu"
,tabindex:"0"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_on
Focus",keydown:"_onKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindi
ngs:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShi
ftTabDown"},attached:function(){this._resetTabindices()},select:function(value){
if(this._defaultFocusAsync){this.cancelAsync(this._defaultFocusAsync);this._defa
ultFocusAsync=null}var item=this._valueToItem(value);if(item&&item.hasAttribute(
"disabled"))return;this._setFocusedItem(item);Polymer.IronMultiSelectableBehavio
rImpl.select.apply(this,arguments)},_resetTabindices:function(){var selectedItem
=this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.ite
ms.forEach(function(item){item.setAttribute("tabindex",item===selectedItem?"0":"
-1")},this)},_updateMultiselectable:function(multi){if(multi){this.setAttribute(
"aria-multiselectable","true")}else{this.removeAttribute("aria-multiselectable")
}},_focusWithKeyboardEvent:function(event){for(var i=0,item;item=this.items[i];i
++){var attr=this.attrForItemTitle||"textContent";var title=item[attr]||item.get
Attribute(attr);if(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0)
.toLowerCase()===String.fromCharCode(event.keyCode).toLowerCase()){this._setFocu
sedItem(item);break}}},_focusPrevious:function(){var length=this.items.length;va
r curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i+
+){var item=this.items[(curFocusIndex-i+length)%length];if(!item.hasAttribute("d
isabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocused
Item(item);if(Polymer.dom(owner).activeElement==item){return}}}},_focusNext:func
tion(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.f
ocusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%l
ength];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRo
ot()||document;this._setFocusedItem(item);if(Polymer.dom(owner).activeElement==i
tem){return}}}},_applySelection:function(item,isSelected){if(isSelected){item.se
tAttribute("aria-selected","true")}else{item.removeAttribute("aria-selected")}Po
lymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItem
Changed:function(focusedItem,old){old&&old.setAttribute("tabindex","-1");if(focu
sedItem){focusedItem.setAttribute("tabindex","0");focusedItem.focus()}},_onIronI
temsChanged:function(event){if(event.detail.addedNodes.length){this._resetTabind
ices()}},_onShiftTabDown:function(event){var oldTabIndex=this.getAttribute("tabi
ndex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(n
ull);this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute(
"tabindex",oldTabIndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)}
,_onFocus:function(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){retu
rn}var rootTarget=Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof roo
tTarget.tabIndex!=="undefined"&&!this.isLightDescendant(rootTarget)){return}this
._defaultFocusAsync=this.async(function(){var selectedItem=this.multi?this.selec
tedItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);if(
selectedItem){this._setFocusedItem(selectedItem)}else if(this.items[0]){this._fo
cusNext()}})},_onUpKey:function(event){this._focusPrevious();event.detail.keyboa
rdEvent.preventDefault()},_onDownKey:function(event){this._focusNext();event.det
ail.keyboardEvent.preventDefault()},_onEscKey:function(event){this.focusedItem.b
lur()},_onKeydown:function(event){if(!this.keyboardEventMatchesKeys(event,"up do
wn esc")){this._focusWithKeyboardEvent(event)}event.stopPropagation()},_activate
Handler:function(event){Polymer.IronSelectableBehavior._activateHandler.call(thi
s,event);event.stopPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed
=false;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.Iro
nA11yKeysBehavior,Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl=
{hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightK
ey"},_onUpKey:function(event){this.focusedItem.click();event.detail.keyboardEven
t.preventDefault()},_onDownKey:function(event){this.focusedItem.click();event.de
tail.keyboardEvent.preventDefault()},get _isRTL(){return window.getComputedStyle
(this)["direction"]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._fo
cusNext()}else{this._focusPrevious()}event.detail.keyboardEvent.preventDefault()
},_onRightKey:function(event){if(this._isRTL){this._focusPrevious()}else{this._f
ocusNext()}event.detail.keyboardEvent.preventDefault()},_onKeydown:function(even
t){if(this.keyboardEventMatchesKeys(event,"up down left right esc")){return}this
._focusWithKeyboardEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuB
ehavior,Polymer.IronMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Pol
ymer.IronResizableBehavior,Polymer.IronMenubarBehavior],properties:{noink:{type:
Boolean,value:false,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},n
oSlide:{type:Boolean,value:false},scrollable:{type:Boolean,value:false},fitConta
iner:{type:Boolean,value:false},disableDrag:{type:Boolean,value:false},hideScrol
lButtons:{type:Boolean,value:false},alignBottom:{type:Boolean,value:false},selec
table:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:false},auto
selectDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:
Number,value:1},_leftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolea
n,value:false},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},liste
ners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChan
ged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBinding
s:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=nu
ll;this._pendingActivationItem=undefined;this._pendingActivationTimeout=undefine
d;this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this);t
his.addEventListener("blur",this._onBlurCapture.bind(this),true)},ready:function
(){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._
cancelPendingActivation()},_noinkChanged:function(noink){var childTabs=Polymer.d
om(this).querySelectorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAtt
ribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(element){element
.setAttribute("noink","")},_removeNoinkAttribute:function(element){element.remov
eAttribute("noink")},_computeScrollButtonClass:function(hideThisButton,scrollabl
e,hideScrollButtons){if(!scrollable||hideScrollButtons){return"hidden"}if(hideTh
isButton){return"not-visible"}return""},_computeTabsContentClass:function(scroll
able,fitContainer){return scrollable?"scrollable"+(fitContainer?" fit-container"
:""):" fit-container"},_computeSelectionBarClass:function(noBar,alignBottom){if(
noBar){return"hidden"}else if(alignBottom){return"align-bottom"}return""},_onTab
SizingChanged:function(){this.debounce("_onTabSizingChanged",function(){this._sc
roll();this._tabChanged(this.selectedItem)},10)},_onIronSelect:function(event){t
his._tabChanged(event.detail.item,this._previousTab);this._previousTab=event.det
ail.item;this.cancelDebouncer("tab-changed")},_onIronDeselect:function(event){th
is.debounce("tab-changed",function(){this._tabChanged(null,this._previousTab);th
is._previousTab=null},1)},_activateHandler:function(){this._cancelPendingActivat
ion();Polymer.IronMenuBehaviorImpl._activateHandler.apply(this,arguments)},_sche
duleActivation:function(item,delay){this._pendingActivationItem=item;this._pendi
ngActivationTimeout=this.async(this._bindDelayedActivationHandler,delay)},_delay
edActivationHandler:function(){var item=this._pendingActivationItem;this._pendin
gActivationItem=undefined;this._pendingActivationTimeout=undefined;item.fire(thi
s.activateEvent,null,{bubbles:true,cancelable:true})},_cancelPendingActivation:f
unction(){if(this._pendingActivationTimeout!==undefined){this.cancelAsync(this._
pendingActivationTimeout);this._pendingActivationItem=undefined;this._pendingAct
ivationTimeout=undefined}},_onArrowKeyup:function(event){if(this.autoselect){thi
s._scheduleActivation(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:fu
nction(event){if(event.target===this._pendingActivationItem){this._cancelPending
Activation()}},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContai
ner.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(e,detail){if
(!this.scrollable){return}var ddx=detail&&-detail.ddx||0;this._affectScroll(ddx)
},_down:function(e){this.async(function(){if(this._defaultFocusAsync){this.cance
lAsync(this._defaultFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll
:function(dx){this.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsCont
ainer.scrollLeft;this._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft===
this._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToL
eft();this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},
_onRightScrollButtonDown:function(){this._scrollToRight();this._holdJob=setInter
val(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function(
){clearInterval(this._holdJob);this._holdJob=null},_scrollToLeft:function(){this
._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._
step)},_tabChanged:function(tab,old){if(!tab){this.$.selectionBar.classList.remo
ve("expand");this.$.selectionBar.classList.remove("contract");this._positionBar(
0,0);return}var r=this.$.tabsContent.getBoundingClientRect();var w=r.width;var t
abRect=tab.getBoundingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._p
os={width:this._calcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLef
t,w)};if(this.noSlide||old==null){this.$.selectionBar.classList.remove("expand")
;this.$.selectionBar.classList.remove("contract");this._positionBar(this._pos.wi
dth,this._pos.left);return}var oldRect=old.getBoundingClientRect();var oldIndex=
this.items.indexOf(old);var index=this.items.indexOf(tab);var m=5;this.$.selecti
onBar.classList.add("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL
;if(isRTL){moveRight=!moveRight}if(moveRight){this._positionBar(this._calcPercen
t(tabRect.left+tabRect.width-oldRect.left,w)-m,this._left)}else{this._positionBa
r(this._calcPercent(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPerce
nt(tabOffsetLeft,w)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRec
t.width,tabOffsetLeft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLe
ft){var l=tabOffsetLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsConta
iner.scrollLeft+=l}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){thi
s.$.tabsContainer.scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0},
_positionBar:function(width,left){width=width||0;left=left||0;this._width=width;
this._left=left;this.transform("translateX("+left+"%) scaleX("+width/100+")",thi
s.$.selectionBar)},_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.cl
assList;if(cl.contains("expand")){cl.remove("expand");cl.add("contract");this._p
ositionBar(this._pos.width,this._pos.left)}else if(cl.contains("contract")){cl.r
emove("contract")}}}); | 26 activeEntries[i].animation.onfinish=function(){if(this._shouldComplete(activeEnt
ries)){this._complete(activeEntries);delete this._active[type];this.fire("neon-a
nimation-finish",cookie,{bubbles:false})}}.bind(this)}},cancelAnimation:function
(){for(var k in this._animations){this._animations[k].cancel()}this._animations=
{}}};Polymer.NeonAnimationRunnerBehavior=[Polymer.NeonAnimatableBehavior,Polymer
.NeonAnimationRunnerBehaviorImpl];Polymer.NeonAnimationBehavior={properties:{ani
mationTiming:{type:Object,value:function(){return{duration:500,easing:"cubic-bez
ier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeonAnimation:true,timingFromConfig:funct
ion(config){if(config.timing){for(var property in config.timing){this.animationT
iming[property]=config.timing[property]}}return this.animationTiming},setPrefixe
dProperty:function(node,property,value){var map={transform:["webkitTransform"],t
ransformOrigin:["mozTransformOrigin","webkitTransformOrigin"]};var prefixes=map[
property];for(var prefix,index=0;prefix=prefixes[index];index++){node.style[pref
ix]=value}node.style[property]=value},complete:function(){}};Polymer({is:"opaque
-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:function(config)
{var node=config.node;this._effect=new KeyframeEffect(node,[{opacity:"1"},{opaci
ty:"1"}],this.timingFromConfig(config));node.style.opacity="0";return this._effe
ct},complete:function(config){config.node.style.opacity=""}});(function(){"use s
trict";var LAST_TOUCH_POSITION={pageX:0,pageY:0};var ROOT_TARGET=null;var SCROLL
ABLE_NODES=[];Polymer.IronDropdownScrollManager={get currentLockingElement(){ret
urn this._lockingElements[this._lockingElements.length-1]},elementIsScrollLocked
:function(element){var currentLockingElement=this.currentLockingElement;if(curre
ntLockingElement===undefined)return false;var scrollLocked;if(this._hasCachedLoc
kedElement(element)){return true}if(this._hasCachedUnlockedElement(element)){ret
urn false}scrollLocked=!!currentLockingElement&¤tLockingElement!==element&
&!this._composedTreeContains(currentLockingElement,element);if(scrollLocked){thi
s._lockedElementCache.push(element)}else{this._unlockedElementCache.push(element
)}return scrollLocked},pushScrollLock:function(element){if(this._lockingElements
.indexOf(element)>=0){return}if(this._lockingElements.length===0){this._lockScro
llInteractions()}this._lockingElements.push(element);this._lockedElementCache=[]
;this._unlockedElementCache=[]},removeScrollLock:function(element){var index=thi
s._lockingElements.indexOf(element);if(index===-1){return}this._lockingElements.
splice(index,1);this._lockedElementCache=[];this._unlockedElementCache=[];if(thi
s._lockingElements.length===0){this._unlockScrollInteractions()}},_lockingElemen
ts:[],_lockedElementCache:null,_unlockedElementCache:null,_hasCachedLockedElemen
t:function(element){return this._lockedElementCache.indexOf(element)>-1},_hasCac
hedUnlockedElement:function(element){return this._unlockedElementCache.indexOf(e
lement)>-1},_composedTreeContains:function(element,child){var contentElements;va
r distributedNodes;var contentIndex;var nodeIndex;if(element.contains(child)){re
turn true}contentElements=Polymer.dom(element).querySelectorAll("content");for(c
ontentIndex=0;contentIndex<contentElements.length;++contentIndex){distributedNod
es=Polymer.dom(contentElements[contentIndex]).getDistributedNodes();for(nodeInde
x=0;nodeIndex<distributedNodes.length;++nodeIndex){if(this._composedTreeContains
(distributedNodes[nodeIndex],child)){return true}}}return false},_scrollInteract
ionHandler:function(event){if(event.cancelable&&this._shouldPreventScrolling(eve
nt)){event.preventDefault()}if(event.targetTouches){var touch=event.targetTouche
s[0];LAST_TOUCH_POSITION.pageX=touch.pageX;LAST_TOUCH_POSITION.pageY=touch.pageY
}},_lockScrollInteractions:function(){this._boundScrollHandler=this._boundScroll
Handler||this._scrollInteractionHandler.bind(this);document.addEventListener("wh
eel",this._boundScrollHandler,true);document.addEventListener("mousewheel",this.
_boundScrollHandler,true);document.addEventListener("DOMMouseScroll",this._bound
ScrollHandler,true);document.addEventListener("touchstart",this._boundScrollHand
ler,true);document.addEventListener("touchmove",this._boundScrollHandler,true)},
_unlockScrollInteractions:function(){document.removeEventListener("wheel",this._
boundScrollHandler,true);document.removeEventListener("mousewheel",this._boundSc
rollHandler,true);document.removeEventListener("DOMMouseScroll",this._boundScrol
lHandler,true);document.removeEventListener("touchstart",this._boundScrollHandle
r,true);document.removeEventListener("touchmove",this._boundScrollHandler,true)}
,_shouldPreventScrolling:function(event){var target=Polymer.dom(event).rootTarge
t;if(event.type!=="touchmove"&&ROOT_TARGET!==target){ROOT_TARGET=target;SCROLLAB
LE_NODES=this._getScrollableNodes(Polymer.dom(event).path)}if(!SCROLLABLE_NODES.
length){return true}if(event.type==="touchstart"){return false}var info=this._ge
tScrollInfo(event);return!this._getScrollingNode(SCROLLABLE_NODES,info.deltaX,in
fo.deltaY)},_getScrollableNodes:function(nodes){var scrollables=[];var lockingIn
dex=nodes.indexOf(this.currentLockingElement);for(var i=0;i<=lockingIndex;i++){v
ar node=nodes[i];if(node.nodeType===11){continue}var style=node.style;if(style.o
verflow!=="scroll"&&style.overflow!=="auto"){style=window.getComputedStyle(node)
}if(style.overflow==="scroll"||style.overflow==="auto"){scrollables.push(node)}}
return scrollables},_getScrollingNode:function(nodes,deltaX,deltaY){if(!deltaX&&
!deltaY){return}var verticalScroll=Math.abs(deltaY)>=Math.abs(deltaX);for(var i=
0;i<nodes.length;i++){var node=nodes[i];var canScroll=false;if(verticalScroll){c
anScroll=deltaY<0?node.scrollTop>0:node.scrollTop<node.scrollHeight-node.clientH
eight}else{canScroll=deltaX<0?node.scrollLeft>0:node.scrollLeft<node.scrollWidth
-node.clientWidth}if(canScroll){return node}}},_getScrollInfo:function(event){va
r info={deltaX:event.deltaX,deltaY:event.deltaY};if("deltaX"in event){}else if("
wheelDeltaX"in event){info.deltaX=-event.wheelDeltaX;info.deltaY=-event.wheelDel
taY}else if("axis"in event){info.deltaX=event.axis===1?event.detail:0;info.delta
Y=event.axis===2?event.detail:0}else if(event.targetTouches){var touch=event.tar
getTouches[0];info.deltaX=LAST_TOUCH_POSITION.pageX-touch.pageX;info.deltaY=LAST
_TOUCH_POSITION.pageY-touch.pageY}return info}}})();(function(){"use strict";Pol
ymer({is:"iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKey
sBehavior,Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],prope
rties:{horizontalAlign:{type:String,value:"left",reflectToAttribute:true},vertic
alAlign:{type:String,value:"top",reflectToAttribute:true},openAnimationConfig:{t
ype:Object},closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnima
tions:{type:Boolean,value:false},allowOutsideScroll:{type:Boolean,value:false},_
boundOnCaptureScroll:{type:Function,value:function(){return this._onCaptureScrol
l.bind(this)}}},listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},obs
ervers:["_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign,
verticalOffset, horizontalOffset)"],get containedElement(){return Polymer.dom(th
is.$.content).getDistributedNodes()[0]},get _focusTarget(){return this.focusTarg
et||this.containedElement},ready:function(){this._scrollTop=0;this._scrollLeft=0
;this._refitOnScrollRAF=null},attached:function(){if(!this.sizingTarget||this.si
zingTarget===this){this.sizingTarget=this.containedElement}},detached:function()
{this.cancelAnimation();document.removeEventListener("scroll",this._boundOnCaptu
reScroll);Polymer.IronDropdownScrollManager.removeScrollLock(this)},_openedChang
ed:function(){if(this.opened&&this.disabled){this.cancel()}else{this.cancelAnima
tion();this._updateAnimationConfig();this._saveScrollPosition();if(this.opened){
document.addEventListener("scroll",this._boundOnCaptureScroll);!this.allowOutsid
eScroll&&Polymer.IronDropdownScrollManager.pushScrollLock(this)}else{document.re
moveEventListener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrol
lManager.removeScrollLock(this)}Polymer.IronOverlayBehaviorImpl._openedChanged.a
pply(this,arguments)}},_renderOpened:function(){if(!this.noAnimations&&this.anim
ationConfig.open){this.$.contentWrapper.classList.add("animating");this.playAnim
ation("open")}else{Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,argu
ments)}},_renderClosed:function(){if(!this.noAnimations&&this.animationConfig.cl
ose){this.$.contentWrapper.classList.add("animating");this.playAnimation("close"
)}else{Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)}},_on
NeonAnimationFinish:function(){this.$.contentWrapper.classList.remove("animating
");if(this.opened){this._finishRenderOpened()}else{this._finishRenderClosed()}},
_onCaptureScroll:function(){if(!this.allowOutsideScroll){this._restoreScrollPosi
tion()}else{this._refitOnScrollRAF&&window.cancelAnimationFrame(this._refitOnScr
ollRAF);this._refitOnScrollRAF=window.requestAnimationFrame(this.refit.bind(this
))}},_saveScrollPosition:function(){if(document.scrollingElement){this._scrollTo
p=document.scrollingElement.scrollTop;this._scrollLeft=document.scrollingElement
.scrollLeft}else{this._scrollTop=Math.max(document.documentElement.scrollTop,doc
ument.body.scrollTop);this._scrollLeft=Math.max(document.documentElement.scrollL
eft,document.body.scrollLeft)}},_restoreScrollPosition:function(){if(document.sc
rollingElement){document.scrollingElement.scrollTop=this._scrollTop;document.scr
ollingElement.scrollLeft=this._scrollLeft}else{document.documentElement.scrollTo
p=this._scrollTop;document.documentElement.scrollLeft=this._scrollLeft;document.
body.scrollTop=this._scrollTop;document.body.scrollLeft=this._scrollLeft}},_upda
teAnimationConfig:function(){var animations=(this.openAnimationConfig||[]).conca
t(this.closeAnimationConfig||[]);for(var i=0;i<animations.length;i++){animations
[i].node=this.containedElement}this.animationConfig={open:this.openAnimationConf
ig,close:this.closeAnimationConfig}},_updateOverlayPosition:function(){if(this.i
sAttached){this.notifyResize()}},_applyFocus:function(){var focusTarget=this.foc
usTarget||this.containedElement;if(focusTarget&&this.opened&&!this.noAutoFocus){
focusTarget.focus()}else{Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this,
arguments)}}})})();Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,P
olymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boole
an,value:false,reflectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{
down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _
parentNoink(){var parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.n
oink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onT
ap:function(event){if(this.link){var anchor=this.queryEffectiveChildren("a");if(
!anchor){return}if(event.target===anchor){return}anchor.click()}}});Polymer.Iron
MenuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOn
ly:true,type:Object},attrForItemTitle:{type:String}},hostAttributes:{role:"menu"
,tabindex:"0"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_on
Focus",keydown:"_onKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindi
ngs:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShi
ftTabDown"},attached:function(){this._resetTabindices()},select:function(value){
if(this._defaultFocusAsync){this.cancelAsync(this._defaultFocusAsync);this._defa
ultFocusAsync=null}var item=this._valueToItem(value);if(item&&item.hasAttribute(
"disabled"))return;this._setFocusedItem(item);Polymer.IronMultiSelectableBehavio
rImpl.select.apply(this,arguments)},_resetTabindices:function(){var selectedItem
=this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.ite
ms.forEach(function(item){item.setAttribute("tabindex",item===selectedItem?"0":"
-1")},this)},_updateMultiselectable:function(multi){if(multi){this.setAttribute(
"aria-multiselectable","true")}else{this.removeAttribute("aria-multiselectable")
}},_focusWithKeyboardEvent:function(event){for(var i=0,item;item=this.items[i];i
++){var attr=this.attrForItemTitle||"textContent";var title=item[attr]||item.get
Attribute(attr);if(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0)
.toLowerCase()===String.fromCharCode(event.keyCode).toLowerCase()){this._setFocu
sedItem(item);break}}},_focusPrevious:function(){var length=this.items.length;va
r curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i+
+){var item=this.items[(curFocusIndex-i+length)%length];if(!item.hasAttribute("d
isabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocused
Item(item);if(Polymer.dom(owner).activeElement==item){return}}}},_focusNext:func
tion(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.f
ocusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%l
ength];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRo
ot()||document;this._setFocusedItem(item);if(Polymer.dom(owner).activeElement==i
tem){return}}}},_applySelection:function(item,isSelected){if(isSelected){item.se
tAttribute("aria-selected","true")}else{item.removeAttribute("aria-selected")}Po
lymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItem
Changed:function(focusedItem,old){old&&old.setAttribute("tabindex","-1");if(focu
sedItem){focusedItem.setAttribute("tabindex","0");focusedItem.focus()}},_onIronI
temsChanged:function(event){if(event.detail.addedNodes.length){this._resetTabind
ices()}},_onShiftTabDown:function(event){var oldTabIndex=this.getAttribute("tabi
ndex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(n
ull);this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute(
"tabindex",oldTabIndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)}
,_onFocus:function(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){retu
rn}var rootTarget=Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof roo
tTarget.tabIndex!=="undefined"&&!this.isLightDescendant(rootTarget)){return}this
._defaultFocusAsync=this.async(function(){var selectedItem=this.multi?this.selec
tedItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);if(
selectedItem){this._setFocusedItem(selectedItem)}else if(this.items[0]){this._fo
cusNext()}})},_onUpKey:function(event){this._focusPrevious();event.detail.keyboa
rdEvent.preventDefault()},_onDownKey:function(event){this._focusNext();event.det
ail.keyboardEvent.preventDefault()},_onEscKey:function(event){this.focusedItem.b
lur()},_onKeydown:function(event){if(!this.keyboardEventMatchesKeys(event,"up do
wn esc")){this._focusWithKeyboardEvent(event)}event.stopPropagation()},_activate
Handler:function(event){Polymer.IronSelectableBehavior._activateHandler.call(thi
s,event);event.stopPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed
=false;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.Iro
nA11yKeysBehavior,Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl=
{hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightK
ey"},_onUpKey:function(event){this.focusedItem.click();event.detail.keyboardEven
t.preventDefault()},_onDownKey:function(event){this.focusedItem.click();event.de
tail.keyboardEvent.preventDefault()},get _isRTL(){return window.getComputedStyle
(this)["direction"]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._fo
cusNext()}else{this._focusPrevious()}event.detail.keyboardEvent.preventDefault()
},_onRightKey:function(event){if(this._isRTL){this._focusPrevious()}else{this._f
ocusNext()}event.detail.keyboardEvent.preventDefault()},_onKeydown:function(even
t){if(this.keyboardEventMatchesKeys(event,"up down left right esc")){return}this
._focusWithKeyboardEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuB
ehavior,Polymer.IronMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Pol
ymer.IronResizableBehavior,Polymer.IronMenubarBehavior],properties:{noink:{type:
Boolean,value:false,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},n
oSlide:{type:Boolean,value:false},scrollable:{type:Boolean,value:false},fitConta
iner:{type:Boolean,value:false},disableDrag:{type:Boolean,value:false},hideScrol
lButtons:{type:Boolean,value:false},alignBottom:{type:Boolean,value:false},selec
table:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:false},auto
selectDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:
Number,value:1},_leftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolea
n,value:false},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},liste
ners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChan
ged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBinding
s:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=nu
ll;this._pendingActivationItem=undefined;this._pendingActivationTimeout=undefine
d;this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this);t
his.addEventListener("blur",this._onBlurCapture.bind(this),true)},ready:function
(){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._
cancelPendingActivation()},_noinkChanged:function(noink){var childTabs=Polymer.d
om(this).querySelectorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAtt
ribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(element){element
.setAttribute("noink","")},_removeNoinkAttribute:function(element){element.remov
eAttribute("noink")},_computeScrollButtonClass:function(hideThisButton,scrollabl
e,hideScrollButtons){if(!scrollable||hideScrollButtons){return"hidden"}if(hideTh
isButton){return"not-visible"}return""},_computeTabsContentClass:function(scroll
able,fitContainer){return scrollable?"scrollable"+(fitContainer?" fit-container"
:""):" fit-container"},_computeSelectionBarClass:function(noBar,alignBottom){if(
noBar){return"hidden"}else if(alignBottom){return"align-bottom"}return""},_onTab
SizingChanged:function(){this.debounce("_onTabSizingChanged",function(){this._sc
roll();this._tabChanged(this.selectedItem)},10)},_onIronSelect:function(event){t
his._tabChanged(event.detail.item,this._previousTab);this._previousTab=event.det
ail.item;this.cancelDebouncer("tab-changed")},_onIronDeselect:function(event){th
is.debounce("tab-changed",function(){this._tabChanged(null,this._previousTab);th
is._previousTab=null},1)},_activateHandler:function(){this._cancelPendingActivat
ion();Polymer.IronMenuBehaviorImpl._activateHandler.apply(this,arguments)},_sche
duleActivation:function(item,delay){this._pendingActivationItem=item;this._pendi
ngActivationTimeout=this.async(this._bindDelayedActivationHandler,delay)},_delay
edActivationHandler:function(){var item=this._pendingActivationItem;this._pendin
gActivationItem=undefined;this._pendingActivationTimeout=undefined;item.fire(thi
s.activateEvent,null,{bubbles:true,cancelable:true})},_cancelPendingActivation:f
unction(){if(this._pendingActivationTimeout!==undefined){this.cancelAsync(this._
pendingActivationTimeout);this._pendingActivationItem=undefined;this._pendingAct
ivationTimeout=undefined}},_onArrowKeyup:function(event){if(this.autoselect){thi
s._scheduleActivation(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:fu
nction(event){if(event.target===this._pendingActivationItem){this._cancelPending
Activation()}},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContai
ner.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(e,detail){if
(!this.scrollable){return}var ddx=detail&&-detail.ddx||0;this._affectScroll(ddx)
},_down:function(e){this.async(function(){if(this._defaultFocusAsync){this.cance
lAsync(this._defaultFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll
:function(dx){this.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsCont
ainer.scrollLeft;this._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft===
this._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToL
eft();this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},
_onRightScrollButtonDown:function(){this._scrollToRight();this._holdJob=setInter
val(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function(
){clearInterval(this._holdJob);this._holdJob=null},_scrollToLeft:function(){this
._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._
step)},_tabChanged:function(tab,old){if(!tab){this.$.selectionBar.classList.remo
ve("expand");this.$.selectionBar.classList.remove("contract");this._positionBar(
0,0);return}var r=this.$.tabsContent.getBoundingClientRect();var w=r.width;var t
abRect=tab.getBoundingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._p
os={width:this._calcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLef
t,w)};if(this.noSlide||old==null){this.$.selectionBar.classList.remove("expand")
;this.$.selectionBar.classList.remove("contract");this._positionBar(this._pos.wi
dth,this._pos.left);return}var oldRect=old.getBoundingClientRect();var oldIndex=
this.items.indexOf(old);var index=this.items.indexOf(tab);var m=5;this.$.selecti
onBar.classList.add("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL
;if(isRTL){moveRight=!moveRight}if(moveRight){this._positionBar(this._calcPercen
t(tabRect.left+tabRect.width-oldRect.left,w)-m,this._left)}else{this._positionBa
r(this._calcPercent(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPerce
nt(tabOffsetLeft,w)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRec
t.width,tabOffsetLeft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLe
ft){var l=tabOffsetLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsConta
iner.scrollLeft+=l}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){thi
s.$.tabsContainer.scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0},
_positionBar:function(width,left){width=width||0;left=left||0;this._width=width;
this._left=left;this.transform("translateX("+left+"%) scaleX("+width/100+")",thi
s.$.selectionBar)},_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.cl
assList;if(cl.contains("expand")){cl.remove("expand");cl.add("contract");this._p
ositionBar(this._pos.width,this._pos.left)}else if(cl.contains("contract")){cl.r
emove("contract")}}}); |
OLD | NEW |