/* * angular-focusmanager * Version: 0.3.12 * Obogo (c) 2018 * https://github.com/obogo/angular-focusmanager * License: MIT. */ !function(a,b){var c={FOCUS_ELEMENT_ID:"fm-id",FOCUS_GROUP_ID:"fm-group",FOCUS_PARENT_ID:"fm-parent",FOCUS_PARENT_GROUP_ID:"fm-parent-group",TAB_INDEX:"tabindex",FOCUS_GROUP:"focus-group",FOCUS_GROUP_INDEX:"focus-group-index",FOCUS_GROUP_HEAD:"focus-group-head",FOCUS_GROUP_TAIL:"focus-group-tail",FOCUS_ELEMENT:"focus-element",FOCUS_ENABLED:"focus-enabled",FOCUS_INDEX:"focus-index",SELECTABLE:"A,SELECT,BUTTON,INPUT,TEXTAREA,*[focus-index]",GROUP_ELEMENTS_STRICT:'[{focusParentId}="{groupId}"][focus-index]:not([disabled]):not(.focus-ignore):not(.disabled)',GROUP_ELEMENTS:'[{focusParentId}="{groupId}"]:not([disabled]):not(.focus-ignore):not(.disabled)'};a.consts=c;var d;!function(){try{d=angular.module("fm")}catch(a){d=angular.module("fm",[])}}(),d.directive("focusAutofocus",["focusManager","focusQuery",function(a,b){function c(){e=null,h=0,clearInterval(f)}function d(b){a.focus(b),b.focus()}var e,f,g=[],h=0;return{scope:!0,link:function(a,i,j){var k=i[0],l=j.focusAutofocus?parseInt(j.focusAutofocus,10):0;g[l]=k,h+=1,e||(e=a.$watch(function(){e();var a=0,h=1e3;f=setInterval(function(){if(a<h){for(var e=g.length,f=0;f<e;f+=1)if(k=g[f],b.isVisible(k)){c(),setTimeout(d,100,k);break}a+=1}},100)})),a.$on("$destroy",function(){c()})}}}]),d.directive("focusGroup",["focusManager","focusQuery","focusDispatcher","focusKeyboard",function(a,b,d,f){function g(a,c){var d,e,f,g;for(d=b.getElementsWithoutParents(c),f=d.length,e=0;e<f;){g=j,b.setParentId(d[e],a),b.getElementId(d[e])||b.setElementId(d[e],g);var h=b.getTabIndex(d[e]);void 0!==h&&null!==h||b.setTabIndex(d[e],-1),j+=1,e+=1}for(d=b.getGroupsWithoutParentGroup(c),f=d.length,e=0;e<f;)b.setParentGroupId(d[e],a),e+=1}function h(d,h,j){function n(){d.$on("focus::"+u,function(){g(u,t)}),b.getParentGroupId(t)||(w=t.innerHTML,t.setAttribute(c.TAB_INDEX,y),d.$watch(e.debounce(function(){if(x=t.innerHTML,w!==x){for(var a,b=t.querySelectorAll("["+c.FOCUS_GROUP+"]"),e=b.length;e;)e-=1,a=b[e].getAttribute(c.FOCUS_GROUP_ID),d.$broadcast("focus::"+a);w=x}g(u,t)},l)),q=k.on("focusin",e.debounce(function(a){b.contains(t,a.newTarget)?v===!1&&(v=!0,d.$broadcast("bindKeys",u)):v===!0&&(v=!1,d.$broadcast("unbindKeys"))},l)),r=k.on("enabled",function(d){var e=f.direction;document.activeElement===t&&("prev"===e?a.findPrevChildGroup(u):a.findNextElement(u)),document.activeElement===t||b.contains(t,document.activeElement)?t.removeAttribute(c.TAB_INDEX):t.setAttribute(c.TAB_INDEX,y)}),s=k.on("disabled",function(){setTimeout(function(){document.activeElement===t||b.contains(t,document.activeElement)?t.removeAttribute(c.TAB_INDEX):t.setAttribute(c.TAB_INDEX,y)})}))}function o(b){z?(f.watchNextTabKey(u),d.activeElement=null,z=!1):a.enable()}function p(a){setTimeout(function(){document.activeElement===m&&(z=!0)})}var q,r,s,t=h[0],u=i++,v=!1,w="",x="",y=t.getAttribute(c.TAB_INDEX)||0,z=!1;t.addEventListener("focus",o,!0),document.addEventListener("blur",p,!0),d.$on("focus::repeat",function(a){a.stopPropagation(),g(u,t)}),b.setGroupId(t,u),d.$$postDigest(function(){n(),g(u,t)}),d.$on("$destroy",function(){r&&r(),q&&q(),s&&s(),t.removeEventListener("focus",o,!0),document.removeEventListener("blur",p,!0)})}var i=1,j=1,k=d(),l=100,m=document.body;return{link:h}}]),d.directive("focusHighlight",["focusManager",function(a){function b(a){var b=a.getBoundingClientRect(),c=document.body,d=document.documentElement,e=d.clientTop||c.clientTop||0,f=d.clientLeft||c.clientLeft||0,g=b.top-e,h=b.left-f,i={top:Math.round(g)-4,left:Math.round(h)-4,width:b.width+8,height:b.height+8};return i}var c=function(c,d){var e=c.style;if(d&&a.canReceiveFocus(d)){var f=b(d);e.display=null,e.left=f.left+"px",e.top=f.top+"px",e.width=f.width+"px",e.height=f.height+"px"}else e.display="none"},d=e.debounce(c,10);return{scope:!0,replace:!0,link:function(b,e,f){var g,h,i=e[0];i.style.display="none";var j,k,l=function(b){clearTimeout(j),setTimeout(function(){clearTimeout(g),h=a.getActiveElement()||b.target,e.removeClass("focus-highlight-inactive"),d(i,h)},10)},m=function(a){g=setTimeout(function(){e.addClass("focus-highlight-inactive")})},n=function(){e.addClass("focus-highlight-disabled"),c(e[0],h),clearTimeout(k),k=setTimeout(function(){e.removeClass("focus-highlight-disabled")},10)};document.addEventListener("focus",l,!0),document.addEventListener("blur",m,!0),window.addEventListener("scroll",n),window.addEventListener("resize",n),b.$on("$destroy",function(){document.removeEventListener("focus",l,!0),document.removeEventListener("blur",m,!0),window.removeEventListener("scroll",n),window.removeEventListener("resize",n)})},template:'<div class="focus-highlight"></div>'}}]),d.directive("focusRepeat",function(){return{scope:!0,link:function(a){a.$last&&a.$emit("focus::repeat")}}}),d.directive("ngRepeat",function(){return{scope:!0,link:function(a){a.$last&&a.$emit("focus::repeat")}}}),d.directive("focusShortcut",["focusManager",function(a){return{link:function(b,c,d){function e(){g||(g=!0,d.hasOwnProperty("focusShortcut")&&Mousetrap.bind(d.focusShortcut.split(","),function(b){return b.preventDefault(),b.stopPropagation(),a.focus(c[0]),!1}))}function f(){g&&(g=!1,d.hasOwnProperty("focusShortcut")&&Mousetrap.unbind(d.focusShortcut.split(",")))}var g=!1;d.focusShortcut&&(b.$on("bindKeys",e),b.$on("unbindKeys",f),b.$on("$destroy",f))}}}]),d.directive("focusStack",["focusManager","focusQuery",function(a,b){var c=[];return{link:function(d,e,f){c.push(b.getElementId(a.activeElement)),d.$on("$destroy",function(){if(c.length){var d=c.pop(),e=b.getElement(d);e&&setTimeout(function(){a.focus(e)})}})}}}]),d.factory("focusDispatcher",function(){function a(){this.events={}}function b(b){return b=b||"fm",c[b]||(c[b]=new a),c[b]}var c={};return a.prototype.events={},a.prototype.on=function(a,b){this.events.hasOwnProperty(a)||(this.events[a]=[]),this.events[a].push(b)},a.prototype.off=function(a,b){if(this.events.hasOwnProperty(a))for(var c in this.events[a])this.events[a][c]===b&&this.events[a].splice(c,1)},a.prototype.trigger=function(a,b){if(this.events.hasOwnProperty(a)){b=b||{},b.currentTarget=this;var c=this.events[a];for(var d in c)c.hasOwnProperty(d)&&c[d](b)}},b}),d.service("focusKeyboard",["focusManager",function(b){function c(){u||(u=!0)}function d(){u&&(u=!1)}function f(){v||(v=!0)}function g(){v&&(v=!1)}function h(){u?(d(),f()):(c(),g())}function i(a){var b=a.target;["email","number","password","search","text","textarea"].indexOf(b.type)>-1||"true"===b.getAttribute("contentEditable")||(a.preventDefault(),a.stopPropagation(),l(b,"mousedown"),l(b,"mouseup"),l(b,"click"))}function j(a){if(t.direction="next",b.enabled&&b.next(),b.enabled)return a.preventDefault(),a.stopPropagation(),!1}function k(a){if(t.direction="prev",b.enabled&&b.prev(),b.enabled)return a.preventDefault(),a.stopPropagation(),!1}function l(a,b){var c,d;if(a.ownerDocument?c=a.ownerDocument:9===a.nodeType&&(c=a),a.dispatchEvent){var e="";switch(b){case"click":case"mousedown":case"mouseup":e="MouseEvents"}d=c.createEvent(e);var f="change"!==b;d.initEvent(b,f,!0),d.synthetic=!0,a.dispatchEvent(d,!0)}else a.fireEvent&&(d=c.createEventObject(),d.synthetic=!0,a.fireEvent("on"+b,d))}function m(){e.addEvent(document,"keydown",o)}function n(){e.removeEvent(document,"keydown",o)}function o(a){u&&9===a.keyCode&&(a.shiftKey?k(a):j(a)),v&&(a.shiftKey||a.altKey||a.ctrlKey||(37===a.keyCode?k(a):38===a.keyCode?k(a):39===a.keyCode?j(a):40===a.keyCode&&j(a))),a.shiftKey||a.altKey||a.ctrlKey||13===a.keyCode&&i(a)}function p(a){r(),u&&(b.enabled||(b.enable(),a.shiftKey?b.findPrevChildGroup(s):b.findNextElement(s)))}function q(a){u&&(s=a,e.addEvent(document,"keyup",p))}function r(){e.removeEvent(document,"keyup",p)}var s,t=this,u=!1,v=!1;t.direction=null,t.enable=m,t.disable=n,t.enableTabKeys=c,t.disableTabKeys=d,t.enableArrowKeys=f,t.disableArrowKeys=g,t.toggleTabArrowKeys=h,t.triggerClick=i,t.watchNextTabKey=q,t.unwatchNextTabKey=r,a.keyboard=t}]).run(["focusKeyboard",function(a){a.enable(),a.enableTabKeys()}]),d.service("focusManager",["focusQuery","focusDispatcher",function(b,c){function d(a){if("undefined"==typeof a)return z.activeElement;if(z.activeElement!==a){var b={oldTarget:z.activeElement,newTarget:a};A.trigger("focusout",b),z.activeElement=a,a&&a.focus(),A.trigger("focusin",b)}}function e(){return b.getElement(b.getElementId(z.activeElement))}function f(a){return b.canReceiveFocus(a)}function g(){var a,c,d=e();d?(a=b.getParentId(d),c=b.getElementId(d),q(a,c)):q()}function h(){var a,c,d=e();d?(a=b.getParentId(d),c=b.getElementId(d),t(a,c)):t()}function i(a,b){for(var c=0,d=a.length;c<d;){if(a[c]===b)return c;c+=1}return-1}function j(a,c){var d,e;if(a&&a.length){if(!c)return a[a.length-1];if(d=b.getElement(c),e=i(a,d),e>0)return a[e-1]}}function k(a,c){var d,e;if(a&&a.length){if(!c)return a[0];if(d=b.getGroup(c),e=i(a,d),e>0)return a[e-1]}}function l(a,c){var d,e;if(a&&a.length){if(!c)return a[0];if(d=b.getElement(c),e=i(a,d),e!==-1&&e+1<a.length)return a[e+1]}}function m(a,c){var d,e;if(a&&(d=b.getGroup(c),e=i(a,d),e!==-1&&e+1<a.length))return a[e+1]}function n(a,c){var d,e,f,g,h,i,j;return d=b.getGroup(c),j=b.hasGroupTail(d),!j&&a?(a=b.getParentGroupId(d),e=b.getChildGroups(a),f=m(e,c),f?(g=b.getGroupId(f),q(g)):(h=b.getGroup(a),i=b.getParentGroupId(h),n(i,a))):void o(c)}function o(a){var c,d;if(c=b.getGroup(a),d=b.getGroupTail(c),a){if("stop"===d)return;if(!d)return void y()}else a=b.getFirstGroupId();q(a)}function p(a){var c,d,e,f;c=b.getChildGroups(a),c.length?(e=b.getGroupId(c[0]),q(e)):(d=b.getGroup(a),f=b.getParentGroupId(d),n(f,a))}function q(a,c){var e,f;a?(e=b.getGroupElements(a),f=l(e,c),f?z.callback?z.callback(f):d(f):p(a)):n()}function r(a,c){var d,e,f;a?(d=b.getChildGroups(a),e=k(d,c),e?(f=b.getGroupId(e),s(f)):t(a)):(c=b.getLastGroupId(),s(c))}function s(a){var c,d;a?(c=b.getChildGroups(a),c.length?(d=b.getGroupId(c[c.length-1]),s(d)):t(a)):r()}function t(a,c){var e,f;a?(e=b.getGroupElements(a),f=j(e,c),f?z.callback?z.callback(f):d(f):u(a)):s()}function u(a){var c,d,e;if(d=b.getGroup(a),e=b.hasGroupHead(d),c=b.getParentGroupId(d),e||!c){var f=b.getGroupHead(d);"loop"===f?s(a):f||y()}else r(c,a)}function v(){z.active=!0}function w(){z.active=!1}function x(){!z.enabled&&z.active&&(z.enabled=!0,z.activeElement=document.activeElement,A.trigger("enabled"))}function y(){z.enabled&&(z.enabled=!1,A.trigger("disabled"))}var z=this,A=c();z.active=!0,z.enabled=!0,z.activeElement=null,z.focus=d,z.prev=h,z.next=g,z.on=v,z.off=w,z.getActiveElement=e,z.findPrevChildGroup=s,z.findNextElement=q,z.canReceiveFocus=f,z.enable=x,z.disable=y,a.manager=z}]),d.service("focusMouse",["focusManager","focusQuery",function(b,c){function d(){h.enabled=!1,e.addEvent(document,"mousedown",g)}function f(){h.enabled=!1,e.removeEvent(document,"mousedown",g)}function g(a){var d=c.findFocusEl(a.target);if(b.canReceiveFocus(d)){b.focus(d);var e=c.getParentId(d);e?b.enable():b.disable()}}var h=this;h.enabled=!1,h.enable=d,h.disable=f,a.mouse=h}]).run(["focusMouse",function(a){a.enable()}]),d.service("focusQuery",function(){function b(a){if(!a)return!1;var b=new RegExp(a.nodeName.toUpperCase()).test(c.SELECTABLE);return b||(b=a.hasAttribute(c.FOCUS_INDEX)),b||(b=a.hasAttribute(c.TAB_INDEX)&&a.getAttribute(c.TAB_INDEX)>-1),b&&(b=!a.hasAttribute("disabled")),b&&(b=k(a)),b&&(b=!a.hasAttribute(c.FOCUS_GROUP)),b}function d(){var a=e.supplant("[{focusGroup}]:not([{focusParentGroupId}])",{focusGroup:c.FOCUS_GROUP,focusParentGroupId:c.FOCUS_PARENT_GROUP_ID}),b=document.querySelector(a);return w(b)}function f(){var a=e.supplant("[{focusGroup}]:not([{focusParentGroupId}])",{focusGroup:c.FOCUS_GROUP,focusParentGroupId:c.FOCUS_PARENT_GROUP_ID}),b=document.querySelectorAll(a);return w(b[b.length-1])}function g(a){for(var b=e.supplant('[{focusParentGroupId}="{groupId}"]',{focusParentGroupId:c.FOCUS_PARENT_GROUP_ID,groupId:a}),d=document.querySelectorAll(b),f=[],g=0,h=d.length;g<h;)k(d[g])&&f.push(d[g]),g+=1;return f=F(f,H)}function h(a){if(a){var b="A:not({focusParentId}),SELECT:not({focusParentId}),BUTTON:not({focusParentId}),INPUT:not({focusParentId}),TEXTAREA:not({focusParentId}),*[focus-index]:not({focusParentId})";return b=e.supplant(b,{focusParentId:"["+c.FOCUS_PARENT_ID+"]"}),a.querySelectorAll(b)}return[]}function i(a){if(!a)return[];var b="["+c.FOCUS_GROUP_ID+"]:not(["+c.FOCUS_PARENT_GROUP_ID+"])";return a.querySelectorAll(b)}function j(a){var b,d,f,g,h,i;for(d=t(a),b=d?e.supplant(c.GROUP_ELEMENTS_STRICT,{focusParentId:c.FOCUS_PARENT_ID,groupId:a}):e.supplant(c.GROUP_ELEMENTS,{focusParentId:c.FOCUS_PARENT_ID,groupId:a}),f=document.querySelectorAll(b),g=[],h=0,i=f.length;h<i;)k(f[h])?(g.push(f[h]),h+=1):h+=1;return g=F(g,G)}function k(a){return!(!a||!a.parentNode)&&(9===a.parentNode.nodeType||0!==a.offsetWidth&&0!==a.offsetHeight&&("none"!==a.style.display&&("hidden"!==a.style.visibility&&(0!==a.style.opacity&&"0"!==a.style.opacity))))}function l(a){return!!a&&"autofocus"===a.getAttribute(c.FOCUS_ELEMENT)}function m(a){return!!a&&"false"!==a.getAttribute(c.FOCUS_ENABLED)}function n(a){return!!a&&!!a.getAttribute(c.FOCUS_GROUP_HEAD)}function o(a){if(a)return a.getAttribute(c.FOCUS_GROUP_HEAD)}function p(a){return!!a&&!!a.getAttribute(c.FOCUS_GROUP_TAIL)}function q(a){if(a)return a.getAttribute(c.FOCUS_GROUP_TAIL)}function r(a){if(a){var b=e.supplant('[{focusElementId}="{elementId}"]',{focusElementId:c.FOCUS_ELEMENT_ID,elementId:a});return document.querySelector(b)}}function s(a){if(a)return document.querySelector("["+c.FOCUS_GROUP_ID+'="'+a+'"]')}function t(a){var b=s(a);return!!b&&"strict"===b.getAttribute(c.FOCUS_GROUP)}function u(a){if(a)return a.getAttribute(c.FOCUS_ELEMENT_ID)}function v(a,b){a.setAttribute(c.FOCUS_ELEMENT_ID,b)}function w(a){if(a)return a.getAttribute(c.FOCUS_GROUP_ID)}function x(a,b){a.setAttribute(c.FOCUS_GROUP_ID,b)}function y(a){if(a)return a.getAttribute(c.FOCUS_PARENT_ID)}function z(a,b){a.setAttribute(c.FOCUS_PARENT_ID,b)}function A(a){if(a)return a.getAttribute(c.FOCUS_PARENT_GROUP_ID)}function B(a,b){a.setAttribute(c.FOCUS_PARENT_GROUP_ID,b)}function C(a){if(a)return a.getAttribute(c.TAB_INDEX)}function D(a,b){a&&(null===b?a.removeAttribute(c.TAB_INDEX):a.setAttribute(c.TAB_INDEX,b))}function E(a,b){if(b){var c=b.parentNode;if(c)for(;c&&9!==c.nodeType;){if(c===a)return!0;c=c.parentNode}}return!1}function F(a,b){var c,d,e,f,g;for(b||(b=function(a,b){return a>b?1:a<b?-1:0}),d=a.length,f=d-1,c=0;c<d;c+=1)for(e=0;e<f;e+=1)b(a[e],a[e+1])>0&&(g=a[e+1],a[e+1]=a[e],a[e]=g);return a}function G(a,b){var d=parseInt(a.getAttribute(c.FOCUS_INDEX),10)||Number.POSITIVE_INFINITY,e=parseInt(b.getAttribute(c.FOCUS_INDEX),10)||Number.POSITIVE_INFINITY;return d<e?-1:d>e?1:0}function H(a,b){var d=parseInt(a.getAttribute(c.FOCUS_GROUP_INDEX),10)||Number.POSITIVE_INFINITY,e=parseInt(b.getAttribute(c.FOCUS_GROUP_INDEX),10)||Number.POSITIVE_INFINITY;return d<e?-1:d>e?1:0}function I(a){for(var b=u(a)||C(a);null===b||void 0===b;){if(a=a.parentNode,9===a.nodeType)return;b=u(a)||C(a)}return a}var J=this;J.getElement=r,J.getElementId=u,J.setElementId=v,J.getGroupId=w,J.setGroupId=x,J.getParentId=y,J.setParentId=z,J.getParentGroupId=A,J.setParentGroupId=B,J.getGroup=s,J.getFirstGroupId=d,J.getLastGroupId=f,J.getTabIndex=C,J.setTabIndex=D,J.getElementsWithoutParents=h,J.getGroupsWithoutParentGroup=i,J.isAutofocus=l,J.isVisible=k,J.hasGroupHead=n,J.hasGroupTail=p,J.getGroupHead=o,J.getGroupTail=q,J.isEnabled=m,J.getGroupElements=j,J.getChildGroups=g,J.contains=E,J.canReceiveFocus=b,J.findFocusEl=I,a.query=J});var e={};e.addEvent=function(a,b,c){angular.element(a).on(b,c)},e.removeEvent=function(a,b,c){angular.element(a).off(b,c)},e.debounce=function(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}},e.throttle=function(a,b,c){b=b||250;var d,e;return function(){var f=c||this,g=+new Date,h=arguments;d&&g<d+b?(clearTimeout(e),e=setTimeout(function(){d=g,a.apply(f,h)},b)):(d=g,a.apply(f,h))}},e.supplant=function(a,b){return a+="",a.replace?a.replace(/{([^{}]*)}/g,function(a,c){var d=b[c];return"string"==typeof d||"number"==typeof d?d:a}):b},function(a,b,c){function d(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function e(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);return a.shiftKey||(b=b.toLowerCase()),b}return q[a.which]?q[a.which]:r[a.which]?r[a.which]:String.fromCharCode(a.which).toLowerCase()}function f(a){a=a||{};var b,c=!1;for(b in w)a[b]?c=!0:w[b]=0;c||(z=!1)}function g(a,b,c,d,e,f){var g,h,i=[],j=c.type;if(!u[a])return[];for("keyup"==j&&k(a)&&(b=[a]),g=0;g<u[a].length;++g)if(h=u[a][g],!(!d&&h.seq&&w[h.seq]!=h.level||j!=h.action||("keypress"!=j||c.metaKey||c.ctrlKey)&&b.sort().join(",")!==h.modifiers.sort().join(","))){var l=d&&h.seq==d&&h.level==f;(!d&&h.combo==e||l)&&u[a].splice(g,1),i.push(h)}return i}function h(a){var b=[];return a.shiftKey&&b.push("shift"),a.altKey&&b.push("alt"),a.ctrlKey&&b.push("ctrl"),a.metaKey&&b.push("meta"),b}function i(a,b,c,d){A.stopCallback(b,b.target||b.srcElement,c,d)||!1!==a(b,c)||(b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation?b.stopPropagation():b.cancelBubble=!0)}function j(a){"number"!=typeof a.which&&(a.which=a.keyCode);var b=e(a);b&&("keyup"==a.type&&x===b?x=!1:A.handleKey(b,h(a),a))}function k(a){return"shift"==a||"ctrl"==a||"alt"==a||"meta"==a}function l(a,b,c,d){function g(b){return function(){z=b,++w[a],clearTimeout(p),p=setTimeout(f,1e3)}}function h(b){i(c,b,a),"keyup"!==d&&(x=e(b)),setTimeout(f,10)}for(var j=w[a]=0;j<b.length;++j){var k=j+1===b.length?h:g(d||m(b[j+1]).action);n(b[j],k,d,a,j)}}function m(a,b){var c,d,e,f=[];for(c="+"===a?["+"]:a.split("+"),e=0;e<c.length;++e)d=c[e],t[d]&&(d=t[d]),b&&"keypress"!=b&&s[d]&&(d=s[d],f.push("shift")),k(d)&&f.push(d);if(c=d,e=b,!e){if(!o){o={};for(var g in q)95<g&&112>g||q.hasOwnProperty(g)&&(o[q[g]]=g)}e=o[c]?"keydown":"keypress"}return"keypress"==e&&f.length&&(e="keydown"),{key:d,modifiers:f,action:e}}function n(a,b,c,d,e){v[a+":"+c]=b,a=a.replace(/\s+/g," ");var f=a.split(" ");1<f.length?l(a,f,b,c):(c=m(a,c),u[c.key]=u[c.key]||[],g(c.key,c.modifiers,{type:c.action},d,a,e),u[c.key][d?"unshift":"push"]({callback:b,modifiers:c.modifiers,action:c.action,seq:d,level:e,combo:a}))}var o,p,q={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},s={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},t={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},u={},v={},w={},x=!1,y=!1,z=!1;for(c=1;20>c;++c)q[111+c]="f"+c;for(c=0;9>=c;++c)q[c+96]=c;d(b,"keypress",j),d(b,"keydown",j),d(b,"keyup",j);var A={bind:function(a,b,c){a=a instanceof Array?a:[a];for(var d=0;d<a.length;++d)n(a[d],b,c);return this},unbind:function(a,b){return A.bind(a,function(){},b)},trigger:function(a,b){return v[a+":"+b]&&v[a+":"+b]({},a),this},reset:function(){return u={},v={},this},stopCallback:function(a,b){return!(-1<(" "+b.className+" ").indexOf(" mousetrap "))&&("INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable)},handleKey:function(a,b,c){var d,e=g(a,b,c);b={};var h=0,j=!1;for(d=0;d<e.length;++d)e[d].seq&&(h=Math.max(h,e[d].level));for(d=0;d<e.length;++d)e[d].seq?e[d].level==h&&(j=!0,b[e[d].seq]=1,i(e[d].callback,c,e[d].combo,e[d].seq)):j||i(e[d].callback,c,e[d].combo);e="keypress"==c.type&&y,c.type!=z||k(a)||e||f(b),y=j&&"keydown"==c.type}};a.Mousetrap=A,"function"==typeof define&&define.amd&&define(A)}(window,document),b.fm=a}({},function(){return this}()); //# sourceMappingURL=angular-focusmanager.min.js.map