/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-master-2b98560 */ !function(t,e,n){"use strict";function a(t,n){return{restrict:"E",transclude:!0,controller:r,controllerAs:"ctrl",bindToController:!0,scope:{mdSelectedNavItem:"=?",navBarAriaLabel:"@?"},template:'
',link:function(a,r,o,i){n(r),i.navBarAriaLabel||t.expectAsync(r,"aria-label",e.noop)}}}function r(t,e,n,a){this._$timeout=n,this._$scope=e,this._$mdConstant=a,this.mdSelectedNavItem,this.navBarAriaLabel,this._navBarEl=t[0],this._inkbar;var r=this,o=this._$scope.$watch(function(){return r._navBarEl.querySelectorAll("._md-nav-button").length},function(t){t>0&&(r._initTabs(),o())})}function o(t){return{restrict:"E",require:["mdNavItem","^mdNavBar"],controller:i,bindToController:!0,controllerAs:"ctrl",replace:!0,transclude:!0,template:'
  • ',scope:{mdNavClick:"&?",mdNavHref:"@?",mdNavSref:"@?",name:"@"},link:function(n,a,r,o){var i=o[0],s=o[1];t(function(){i.name||(i.name=e.element(a[0].querySelector("._md-nav-button-text")).text().trim());var t=e.element(a[0].querySelector("._md-nav-button"));t.on("click",function(){s.mdSelectedNavItem=i.name,n.$apply()})})}}}function i(t){this._$element=t,this.mdNavClick,this.mdNavHref,this.name,this._selected=!1,this._focused=!1;var e=!!t.attr("md-nav-click"),n=!!t.attr("md-nav-href"),a=!!t.attr("md-nav-sref");if((e?1:0)+(n?1:0)+(a?1:0)>1)throw Error("Must specify exactly one of md-nav-click, md-nav-href, md-nav-sref for nav-item directive")}r.$inject=["$element","$scope","$timeout","$mdConstant"],o.$inject=["$$rAF"],i.$inject=["$element"],a.$inject=["$mdAria","$mdTheming"],e.module("material.components.navBar",["material.core"]).controller("MdNavBarController",r).directive("mdNavBar",a).controller("MdNavItemController",i).directive("mdNavItem",o),r.prototype._initTabs=function(){this._inkbar=e.element(this._navBarEl.getElementsByTagName("md-nav-ink-bar")[0]);var t=this;this._$timeout(function(){t._updateTabs(t.mdSelectedNavItem,n)}),this._$scope.$watch("ctrl.mdSelectedNavItem",function(e,n){t._$timeout(function(){t._updateTabs(e,n)})})},r.prototype._updateTabs=function(t,e){var n=this,a=this._getTabs(),r=-1,o=-1,i=this._getTabByName(t),s=this._getTabByName(e);s&&(s.setSelected(!1),r=a.indexOf(s)),i&&(i.setSelected(!0),o=a.indexOf(i)),this._$timeout(function(){n._updateInkBarStyles(i,o,r)})},r.prototype._updateInkBarStyles=function(t,e,n){if(this._inkbar.toggleClass("_md-left",en),this._inkbar.css({display:e<0?"none":""}),t){var a=t.getButtonEl(),r=a.offsetLeft;this._inkbar.css({left:r+"px",width:a.offsetWidth+"px"})}},r.prototype._getTabs=function(){var t=Array.prototype.slice.call(this._navBarEl.querySelectorAll(".md-nav-item"));return t.map(function(t){return e.element(t).controller("mdNavItem")})},r.prototype._getTabByName=function(t){return this._findTab(function(e){return e.getName()==t})},r.prototype._getSelectedTab=function(){return this._findTab(function(t){return t.isSelected()})},r.prototype.getFocusedTab=function(){return this._findTab(function(t){return t.hasFocus()})},r.prototype._findTab=function(t){for(var e=this._getTabs(),n=0;n0&&this._moveFocus(a,n[r-1]);break;case e.DOWN_ARROW:case e.RIGHT_ARROW:r