!function(e){e.module("ionicLetterAvatarSelector.constants",[]).constant("IONIC_LETTER_AVATAR_SELECTOR_ICONS",{"delete":ionic.Platform.isAndroid()?"ion-android-delete":"ion-ios-trash",finish:ionic.Platform.isAndroid()?"ion-android-arrow-back":"ion-ios-checkmark-empty"}).constant("IONIC_LETTER_AVATAR_SELECTOR_THEMES",{light:"#fff",stable:"#f8f8f8",positive:"#387ef5",calm:"#11c1f3",balanced:"#33cd5f",energized:"#ffc900",assertive:"#ef473a",royal:"#886aea",dark:"#444"}),e.module("ionicLetterAvatarSelector.values",[]).value("ionicLetterAvatarSelectorHeader",void 0),e.module("ionicLetterAvatarSelector.decorators",[]).decorator("ionItemDirective",["$delegate","$document","$ionicGesture","$ionicHistory","$ionicNavBarDelegate","$ionicLetterAvatarSelector","$ionicLetterAvatarSelectorConfig","ionicLetterAvatarSelectorHeader","IONIC_LETTER_AVATAR_SELECTOR_THEMES",function(t,n,i,o,r,a,c,s,l){var d=t[0];return d.compile=function(t,d){var f=e.isDefined(d.href)||e.isDefined(d.ngHref)||e.isDefined(d.uiSref),u=f||/ion-(delete|option|reorder)-button/i.test(t.html()),v=e.element(f?"<a></a>":"<div></div>");u?(v.addClass("item-content"),(e.isDefined(d.href)||e.isDefined(d.ngHref))&&(v.attr("ng-href","{{$href()}}"),e.isDefined(d.target)&&v.attr("target","{{$target()}}")),v.append(t.contents()),t.addClass("item item-complex").append(v)):t.addClass("item");var g=e.isDefined(d.lettersOf);return g&&(t.addClass("item-avatar-left"),t.addClass("item-icon-right"),v.prepend('<img id="img" ng-src="{{src}}" class="ionic-letter-avatar-selector-animate-img" ng-click="select($event)"/>'),e.isUndefined(d.hideAccessoryIcon)&&!c.isAndroid&&v.append('<i class="icon ion-chevron-right icon-accessory"></i>')),function(t,d,f){function u(){for(var e="0123456789ABCDEF".split(""),t="#",n=0;6>n;n++)t+=e[Math.floor(16*Math.random())];return t}function v(e){t.$apply(function(){t.select(e)})}function A(e){e||(e=f.border||c.border),N.css("border",e)}function h(e,t){for(var n in _){var i=_[n];i.style&&(i.style.background=e,i.style.border=t)}}function m(){T&&$(),r.title(E),h(s.background,s.border),c.isAndroid&&k.css("margin-left","10px")}function S(){d.addClass("active"),N.addClass("ng-hide-add"),t.src=R,A("none")}function p(){h(c.selectionColor,"none"),c.isAndroid&&k.css("margin-left","30px")}function $(){d.removeClass("active"),N.removeClass("ng-hide-add"),t.src=I,T=!1,A()}function C(e){y&&(e.preventDefault(),e.stopPropagation(),T=a.select(f.item),T?S():$(),a.active()&&r.title(a.count()))}function b(t,n,i,o,r){var a;if(t)a="âœ“",o=c.selectionColor,i||(i=1);else{if(i||(i=c.letters),i)a=n.substr(0,i).toUpperCase();else{var s=n.split(" ");i=s.length,i>2&&(i=2),a="";for(var d=0;d<s.length;d++){var f=s[d];f.match(/\w/g)&&a.length<2&&(a+=f.substr(0,1).toUpperCase())}}"random"===o?o=u():o||(o=c.background),l[o]&&(o=l[o])}r||(r=c.color),l[r]&&(r=l[r]);var v=30,g=e.element("<text></text>").attr({"text-anchor":"middle",y:"50%",x:"50%",dy:"0.35em","pointer-events":"auto",fill:r,"font-family":"HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica, Arial,Lucida Grande, sans-serif"}).html(a).css({"font-weight":400,"font-size":v-5*(i-1)+"px"}),A=e.element("<svg></svg>").attr({xmlns:"http://www.w3.org/2000/svg","pointer-events":"none",width:50,height:50}).css({width:"50px",height:"50px",background:o});A.append(g);var h=e.element("<div>").append(A.clone()).html();return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(h)))}t.$href=function(){return f.href||f.ngHref},t.$target=function(){return f.target};var L=d[0].querySelector(".item-content");if(L&&t.$on("$collectionRepeatLeave",function(){L&&L.$$ionicOptionsOpen&&(L.style[ionic.CSS.TRANSFORM]="",L.style[ionic.CSS.TRANSITION]="none",$$rAF(function(){L.style[ionic.CSS.TRANSITION]=""}),L.$$ionicOptionsOpen=!1)}),g){var T,E,y=(c.isIos||c.isAndroid)&&e.isDefined(f.item),O=i.on("hold",v,d),I=b(!1,f.lettersOf,f.letters,f.background,f.color),R=y?b(!0):null,_=n[0].body.querySelectorAll(".bar-header"),N=e.element(d[0].querySelector("#img")),k=e.element(n[0].body.querySelectorAll(".title"));A(),s||(s={background:_[0].style.background,border:_[0].style.border}),a.active()||(E=o.currentTitle()),t.src=I,t.select=C,t.$on(a.finished,m),t.$on(a.started,p),t.$on("$destroy",function(){i.off(O,"hold",v)}),t.$on("$stateChangeStart",a.finish)}}},t}]),e.module("ionicLetterAvatarSelector.providers",[]).provider("$ionicLetterAvatarSelectorConfig",function(){var e,t="#387ef5",n="light",i="none",o=ionic.Platform.isAndroid(),r="#A8A8A8",a=!1;return{setBackground:function(e){t=e},setBorder:function(e){i=e},setColor:function(e){n=e},setLetters:function(t){e=t},setSelectionAndroid:function(e){o=e},setSelectionColor:function(e){r=e},setSelectionIos:function(e){a=e},$get:function(){return{background:t,border:i,color:n,isAndroid:o,isIos:a,letters:e,selectionColor:r}}}}),e.module("ionicLetterAvatarSelector.directives",[]).directive("ilasButtonDelete",["$ionicLetterAvatarSelector","$ionicLetterAvatarSelectorConfig","IONIC_LETTER_AVATAR_SELECTOR_ICONS",function(e,t,n){return{restrict:"E",replace:!0,template:'<button class="button button-icon {{icon}}"ng-class="{\'ionic-letter-avatar-selector-icon-smaller\': isAndroid}"ng-show="selectionActive"</button>',link:function(i){i.isAndroid=t.isAndroid,i.icon=n.delete,i.$on(e.started,function(){i.selectionActive=!0}),i.$on(e.finished,function(){i.selectionActive=!1})}}}]).directive("ilasButtonFinish",["$ionicLetterAvatarSelector","$ionicLetterAvatarSelectorConfig","IONIC_LETTER_AVATAR_SELECTOR_ICONS",function(e,t,n){return{restrict:"E",replace:!0,template:'<button class="button button-icon {{icon}}"ng-class="{\'ionic-letter-avatar-selector-icon-smaller\': isAndroid}"ng-show="selectionActive"ng-click="finish()"></button>',link:function(i){i.finish=e.finish,i.isAndroid=t.isAndroid,i.icon=n.finish,i.$on(e.started,function(){i.selectionActive=!0}),i.$on(e.finished,function(){i.selectionActive=!1})}}}]),e.module("ionicLetterAvatarSelector.services",[]).factory("$ionicLetterAvatarSelector",["$rootScope",function(t){var n=this,i=[],o=!1;return n.started="ionicLetterAvatarSelector.started",n.finished="ionicLetterAvatarSelector.finished",n.stateChanged="ionicLetterAvatarSelector.stateChanged",n.active=function(){return i.length>0},n.finish=function(){i.length>0&&(i=[]),t.$broadcast(n.finished),t.$broadcast(n.stateChanged,!1)},n.count=function(){return i.length},n.getData=function(){return i.forEach(function(t,n){i[n]=JSON.parse(t,function(t,n){return e.isString(n)&&/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/.exec(n)?new Date(n):n})}),i},n.select=function(e){var r=i.length,a=i.indexOf(e);-1===a?i.push(e):i.splice(a,1);var c=i.length;return o=0===r&&1===c,o&&(t.$broadcast(n.started),t.$broadcast(n.stateChanged,!0)),n.active()||(t.$broadcast(n.finished),t.$broadcast(n.stateChanged,!1)),-1!==i.indexOf(e)},n}]),e.module("ionicLetterAvatarSelector",["ionicLetterAvatarSelector.constants","ionicLetterAvatarSelector.decorators","ionicLetterAvatarSelector.directives","ionicLetterAvatarSelector.providers","ionicLetterAvatarSelector.services","ionicLetterAvatarSelector.values"])}(angular);