/*!
 * Angular Material Design
 * https://github.com/angular/material
 * @license MIT
 * v1.1.0-rc4-master-c81f9f1
 */
goog.provide("ng.material.components.fabShared"),goog.require("ng.material.core"),function(){"use strict";function n(n,e,t,a,i,r){function o(){I.direction=I.direction||"down",I.isOpen=I.isOpen||!1,s(),e.addClass("_md-animations-waiting")}function c(){var t=["click","focusin","focusout"];angular.forEach(t,function(n){e.on(n,l)}),n.$on("$destroy",function(){angular.forEach(t,function(n){e.off(n,l)}),m()})}function l(n){"click"==n.type&&x(n),"focusout"!=n.type||k||(k=r(function(){I.close()},100,!1)),"focusin"==n.type&&k&&(r.cancel(k),k=null)}function s(){I.currentActionIndex=-1}function u(){n.$watch("vm.direction",function(n,a){t.removeClass(e,"md-"+a),t.addClass(e,"md-"+n),s()});var a,i;n.$watch("vm.isOpen",function(n){s(),a&&i||(a=$(),i=D()),n?f():m();var r=n?"md-is-open":"",o=n?"":"md-is-open";a.attr("aria-haspopup",!0),a.attr("aria-expanded",n),i.attr("aria-hidden",!n),t.setClass(e,r,o)})}function d(){e[0].scrollHeight>0?t.addClass(e,"_md-animations-ready").then(function(){e.removeClass("_md-animations-waiting")}):10>_&&(r(d,100),_+=1)}function f(){e.on("keydown",p),a.nextTick(function(){angular.element(document).on("click touchend",g)})}function m(){e.off("keydown",p),angular.element(document).off("click touchend",g)}function g(n){if(n.target){var e=a.getClosest(n.target,"md-fab-trigger"),t=a.getClosest(n.target,"md-fab-actions");e||t||I.close()}}function p(n){switch(n.which){case i.KEY_CODE.ESCAPE:return I.close(),n.preventDefault(),!1;case i.KEY_CODE.LEFT_ARROW:return y(n),!1;case i.KEY_CODE.UP_ARROW:return A(n),!1;case i.KEY_CODE.RIGHT_ARROW:return O(n),!1;case i.KEY_CODE.DOWN_ARROW:return S(n),!1}}function h(n){b(n,-1)}function v(n){b(n,1)}function b(n,e){var t=C();I.currentActionIndex=I.currentActionIndex+e,I.currentActionIndex=Math.min(t.length-1,I.currentActionIndex),I.currentActionIndex=Math.max(0,I.currentActionIndex);var a=angular.element(t[I.currentActionIndex]).children()[0];angular.element(a).attr("tabindex",0),a.focus(),n.preventDefault(),n.stopImmediatePropagation()}function C(){var n=D()[0].querySelectorAll(".md-fab-action-item");return angular.forEach(n,function(n){angular.element(angular.element(n).children()[0]).attr("tabindex",-1)}),n}function y(n){"left"===I.direction?v(n):h(n)}function A(n){"down"===I.direction?h(n):v(n)}function O(n){"left"===I.direction?h(n):v(n)}function S(n){"up"===I.direction?h(n):v(n)}function w(n){return a.getClosest(n,"md-fab-trigger")}function E(n){return a.getClosest(n,"md-fab-actions")}function x(n){w(n.target)&&I.toggle(),E(n.target)&&I.close()}function $(){return e.find("md-fab-trigger")}function D(){return e.find("md-fab-actions")}var I=this;I.open=function(){n.$evalAsync("vm.isOpen = true")},I.close=function(){n.$evalAsync("vm.isOpen = false"),e.find("md-fab-trigger")[0].focus()},I.toggle=function(){n.$evalAsync("vm.isOpen = !vm.isOpen")},o(),c(),u();var _=0;d();var k}angular.module("material.components.fabShared",["material.core"]).controller("MdFabController",n),n.$inject=["$scope","$element","$animate","$mdUtil","$mdConstant","$timeout"]}(),function(){"use strict";function n(){function n(n,e){e.prepend('<div class="_md-css-variables"></div>')}return{restrict:"E",scope:{direction:"@?mdDirection",isOpen:"=?mdOpen"},bindToController:!0,controller:"MdFabController",controllerAs:"vm",link:n}}function e(n){function e(e){n(e,a,!1)}function t(n){if(!n.hasClass("_md-animations-waiting")||n.hasClass("_md-animations-ready")){var e=n[0],t=n.controller("mdFabSpeedDial"),a=e.querySelectorAll(".md-fab-action-item"),i=e.querySelector("md-fab-trigger"),r=e.querySelector("._md-css-variables"),o=parseInt(window.getComputedStyle(r).zIndex);angular.forEach(a,function(n,e){var t=n.style;t.transform=t.webkitTransform="",t.transitionDelay="",t.opacity=1,t.zIndex=a.length-e+o}),i.style.zIndex=o+a.length+1,t.isOpen||angular.forEach(a,function(n,e){var a,r,o=n.style,c=(i.clientHeight-n.clientHeight)/2,l=(i.clientWidth-n.clientWidth)/2;switch(t.direction){case"up":a=n.scrollHeight*(e+1)+c,r="Y";break;case"down":a=-(n.scrollHeight*(e+1)+c),r="Y";break;case"left":a=n.scrollWidth*(e+1)+l,r="X";break;case"right":a=-(n.scrollWidth*(e+1)+l),r="X"}var s="translate"+r+"("+a+"px)";o.transform=o.webkitTransform=s})}}return{addClass:function(n,a,i){n.hasClass("md-fling")?(t(n),e(i)):i()},removeClass:function(n,a,i){t(n),e(i)}}}function t(n){function e(e){n(e,a,!1)}function t(n){var e=n[0],t=n.controller("mdFabSpeedDial"),a=e.querySelectorAll(".md-fab-action-item"),r=e.querySelector("._md-css-variables"),o=parseInt(window.getComputedStyle(r).zIndex);angular.forEach(a,function(n,e){var r=n.style,c=e*i;r.opacity=t.isOpen?1:0,r.transform=r.webkitTransform=t.isOpen?"scale(1)":"scale(0)",r.transitionDelay=(t.isOpen?c:a.length-c)+"ms",r.zIndex=a.length-e+o})}var i=65;return{addClass:function(n,a,i){t(n),e(i)},removeClass:function(n,a,i){t(n),e(i)}}}var a=300;angular.module("material.components.fabSpeedDial",["material.core","material.components.fabShared","material.components.fabTrigger","material.components.fabActions"]).directive("mdFabSpeedDial",n).animation(".md-fling",e).animation(".md-scale",t).service("mdFabSpeedDialFlingAnimation",e).service("mdFabSpeedDialScaleAnimation",t),e.$inject=["$timeout"],t.$inject=["$timeout"]}(),ng.material.components.fabShared=angular.module("material.components.fabShared");