/* AngularJS v1.4.0-beta.5 (c) 2010-2015 Google, Inc. http://angularjs.org License: MIT */ (function(z,h,A){'use strict';function w(h){return["$animate",function(p){return{restrict:"AE",transclude:"element",terminal:!0,require:"^^ngMessages",link:function(n,d,c,k,h){var f=d[0],m,l=c.ngMessage||c.when;c=c.ngMessageExp||c.whenExp;var g=function(a){m=a?x(a)?a:a.split(/[\s,]+/):null;k.reRender()};c?(g(n.$eval(c)),n.$watchCollection(c,g)):g(l);var e,a;k.register(f,a={test:function(a){var b=m;a=b?x(b)?0<=b.indexOf(a):b.hasOwnProperty(a):void 0;return a},attach:function(){e||h(n,function(c){p.enter(c, null,d);e=c;e.on("$destroy",function(){e&&(k.deregister(f),a.detach())})})},detach:function(){if(e){var a=e;e=null;p.leave(a)}}})}}}]}var x=h.isArray,t=h.forEach,y=h.isString,q=h.element;h.module("ngMessages",[]).directive("ngMessages",["$animate",function(h){function p(d,c){return y(c)&&0===c.length||n(d.$eval(c))}function n(d){return y(d)?d.length:!!d}return{require:"ngMessages",restrict:"AE",controller:["$element","$scope","$attrs",function(d,c,k){function r(a,c){for(var b=c,d=[];b&&b!==a;){var f= b.$$ngMessageNode;if(f&&f.length)return l[f];b.childNodes.length&&-1==d.indexOf(b)?(d.push(b),b=b.childNodes[b.childNodes.length-1]):b=b.previousSibling||b.parentNode}}var f=this,m=0,l=this.messages={},g,e;this.render=function(a){a=a||{};g=!1;e=a;for(var m=p(c,k.ngMessagesMultiple)||p(c,k.multiple),b=[],l={},s=f.head,r=!1,q=0;null!=s;){q++;var u=s.message,v=!1;r||t(a,function(a,b){!v&&n(a)&&u.test(b)&&!l[b]&&(v=l[b]=!0,u.attach())});v?r=!m:b.push(u);s=s.next}t(b,function(a){a.detach()});b.length!== q?h.setClass(d,"ng-active","ng-inactive"):h.setClass(d,"ng-inactive","ng-active")};c.$watchCollection(k.ngMessages||k["for"],f.render);this.reRender=function(){g||(g=!0,c.$evalAsync(function(){g&&e&&f.render(e)}))};this.register=function(a,c){var b=m.toString();l[b]={message:c};var e=d[0],g=l[b];f.head?(e=r(e,a))?(g.next=e.next,e.next=g):(g.next=f.head,f.head=g):f.head=g;a.$$ngMessageNode=b;m++;f.reRender()};this.deregister=function(a){var c=a.$$ngMessageNode;delete a.$$ngMessageNode;var b=l[c];(a= r(d[0],a))?a.next=b.next:f.head=b.next;delete l[c];f.reRender()}}]}}]).directive("ngMessagesInclude",["$templateRequest","$document","$compile",function(h,p,n){return{restrict:"AE",require:"^^ngMessages",compile:function(d,c){var k=q(p[0].createComment(" ngMessagesInclude: "));d.after(k);return function(c,f,m,l){d.remove();h(m.ngMessagesInclude||m.src).then(function(d){d=q("
").html(d).contents();var e=k;t(d,function(a){a=q(a);e.after(a);e=a});n(d)(c)})}}}}]).directive("ngMessage",w("AE")).directive("ngMessageExp", w("A"))})(window,window.angular); //# sourceMappingURL=angular-messages.min.js.map