S=t.$new(!0),q&&q===F.$$originalDirective?k.data("$isolateScope",S):k.data("$isolateScopeNoTemplate",S),E(k,"ng-isolate-scope"),a(F.scope,function(e,n){varr,a,o,s,c=e.match(x)||[],l=c[3]||n,u="?"==c[2],p=c[1];switch(S.$$isolateBindings[n]=p+l,p){case"@":h.$observe(l,function(e){S[n]=e}),h.$$observers[l].$$scope=t,h[l]&&(S[n]=i(h[l])(t));break;case"=":if(u&&!h[l])return;a=y(h[l]),s=a.literal?B:function(e,t){returne===t},o=a.assign||function(){throwr=S[n]=a(t),ji("nonassign","Expression '{0}' used with directive '{1}' is non-assignable!",h[l],F.name)},r=S[n]=a(t),S.$watch(function(){vare=a(t);returns(e,S[n])||(s(e,r)?o(t,e=S[n]):S[n]=e),r=e},null,a.literal);break;case"&":a=y(h[l]),S[n]=function(e){returna(t,e)};break;default:throwji("iscp","Invalid isolate scope definition for directive '{0}'. Definition: {... {1}: '{2}' ...}",F.name,n,e)}})}for(C=u&&f,U&&a(U,function(e){varn,i={$scope:e===F||e.$$isolateScope?S:t,$element:g,$attrs:h,$transclude:C};$=e.controller,"@"==$&&($=h[e.name]),n=v($,i),M[e.name]=n,K||g.data("$"+e.name+"Controller",n),e.controllerAs&&(i.$scope[e.controllerAs]=n)}),_=0,b=p.length;b>_;_++)try{w=p[_],w(w.isolateScope?S:t,g,h,w.require&&m(w.require,g,M),C)}catch(T){c(T,V(g))}varA=t;for(F&&(F.template||null===F.templateUrl)&&(A=S),e&&e(A,s.childNodes,n,u),_=d.length-1;_>=0;_--)try{w=d[_],w(w.isolateScope?S:t,g,h,w.require&&m(w.require,g,M),C)}catch(T){c(T,V(g))}}f=f||{};for(varw,$,M,x,k,A,D=-Number.MAX_VALUE,U=f.controllerDirectives,F=f.newIsolateScopeDirective,q=f.templateDirective,z=f.nonTlbTranscludeDirective,G=!1,K=!1,Z=o.$$element=pi(r),J=u,et=s,tt=0,nt=e.length;nt>tt;tt++){$=e[tt];varrt=$.$$start,at=$.$$end;if(rt&&(Z=P(r,rt,at)),x=n,D>$.priority)break;if((A=$.scope)&&(w=w||$,$.templateUrl||(W("new/isolated scope",F,$,Z),_(A)&&(F=$))),M=$.name,!$.templateUrl&&$.controller&&(A=$.controller,U=U||{},W("'"+M+"' controller",U[M],$,Z),U[M]=$),(A=$.transclude)&&(G=!0,$.$$tlb||(W("transclusion",z,$,Z),z=$),"element"==A?(K=!0,D=$.priority,x=P(r,rt,at),Z=o.$$element=pi(t.createComment(" "+M+": "+o[M]+" ")),r=Z[0],X(l,pi(R(x)),r),et=T(x,s,D,J&&J.name,{nonTlbTranscludeDirective:z})):(x=pi(dt(r)).contents(),Z.empty(),et=T(x,s))),$.template)if(W("template",q,$,Z),q=$,A=C($.template)?$.template(Z,o):$.template,A=it(A),$.replace){if(J=$,x=pi("<div>"+wi(A)+"</div>").contents(),r=x[0],1!=x.length||1!==r.nodeType)throwji("tplrt","Template for directive '{0}' must have exactly one root element. {1}",M,"");X(l,Z,r);varot={$attr:{}},st=I(r,[],ot),ct=e.splice(tt+1,e.length-(tt+1));F&&O(st),e=e.concat(st).concat(ct),j(o,ot),nt=e.length}elseZ.html(A);if($.templateUrl)W("template",q,$,Z),q=$,$.replace&&(J=$),g=H(e.splice(tt,e.length-tt),Z,o,l,et,p,d,{controllerDirectives:U,newIsolateScopeDirective:F,templateDirective:q,nonTlbTranscludeDirective:z}),nt=e.length;elseif($.compile)try{k=$.compile(Z,o,et),C(k)?h(null,k,rt,at):k&&h(k.pre,k.post,rt,at)}catch(lt){c(lt,V(Z))}$.terminal&&(g.terminal=!0,D=Math.max(D,$.priority))}returng.scope=w&&w.scope===!0,g.transclude=G&&et,g}functionO(e){for(vart=0,n=e.length;n>t;t++)e[t]=f(e[t],{$$isolateScope:!0})}functionq(t,i,a,s,l,u,p){if(i===l)returnnull;vard=null;if(r.hasOwnProperty(i))for(varh,m=e.get(i+o),g=0,y=m.length;y>g;g++)try{h=m[g],(s===n||s>h.priority)&&-1!=h.restrict.indexOf(a)&&(u&&(h=f(h,{$$start:u,$$end:p})),t.push(h),d=h)}catch(v){c(v)}returnd}functionj(e,t){varn=t.$attr,i=e.$attr,r=e.$$element;a(e,function(i,r){"$"!=r.charAt(0)&&(t[r]&&(i+=("style"===r?";":" ")+t[r]),e.$set(r,i,!0,n[r]))}),a(t,function(t,a){"class"==a?(E(r,t),e["class"]=(e["class"]?e["class"]+" ":"")+t):"style"==a?(r.attr("style",r.attr("style")+";"+t),e.style=(e.style?e.style+";":"")+t):"$"==a.charAt(0)||e.hasOwnProperty(a)||(e[a]=t,i[a]=n[a])})}functionH(e,t,n,i,r,o,s,c){varl,u,f=[],m=t[0],g=e.shift(),y=p({},g,{templateUrl:null,transclude:null,replace:null,$$originalDirective:g}),v=C(g.templateUrl)?g.templateUrl(t,n):g.templateUrl;returnt.empty(),d.get(M.getTrustedResourceUrl(v),{cache:h}).success(function(p){vard,h,b,w;if(p=it(p),g.replace){if(b=pi("<div>"+wi(p)+"</div>").conte
}functiona(n){vari,a,o=Pn(n.toString()),s=!1;for(i=0,a=e.length;a>i;i++)if(r(e[i],o)){s=!0;break}if(s)for(i=0,a=t.length;a>i;i++)if(r(t[i],o)){s=!1;break}returns}functiono(e){vart=function(e){this.$$unwrapTrustedValue=function(){returne}};returne&&(t.prototype=newe),t.prototype.valueOf=function(){returnthis.$$unwrapTrustedValue()},t.prototype.toString=function(){returnthis.$$unwrapTrustedValue().toString()},t}functions(e,t){vari=d.hasOwnProperty(e)?d[e]:null;if(!i)thrownr("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",e,t);if(null===t||t===n||""===t)returnt;if("string"!=typeoft)thrownr("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",e);returnnewi(t)}functionc(e){returneinstanceofp?e.$$unwrapTrustedValue():e}functionl(e,t){if(null===t||t===n||""===t)returnt;vari=d.hasOwnProperty(e)?d[e]:null;if(i&&tinstanceofi)returnt.$$unwrapTrustedValue();if(e===ir.RESOURCE_URL){if(a(t))returnt;thrownr("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",t.toString())}if(e===ir.HTML)returnu(t);thrownr("unsafe","Attempting to use an unsafe value in a safe context.")}varu=function(){thrownr("unsafe","Attempting to use an unsafe value in a safe context.")};i.has("$sanitize")&&(u=i.get("$sanitize"));varp=o(),d={};returnd[ir.HTML]=o(p),d[ir.CSS]=o(p),d[ir.URL]=o(p),d[ir.JS]=o(p),d[ir.RESOURCE_URL]=o(d[ir.URL]),{trustAs:s,getTrusted:l,valueOf:c}}]}functionAn(){vare=!0;this.enabled=function(t){returnarguments.length&&(e=!!t),e},this.$get=["$parse","$sniffer","$sceDelegate",function(t,n,i){if(e&&n.msie&&n.msieDocumentMode<8)thrownr("iequirks","Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");varr=N(ir);r.isEnabled=function(){returne},r.trustAs=i.trustAs,r.getTrusted=i.getTrusted,r.valueOf=i.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){returnt},r.valueOf=m),r.parseAs=function(e,n){vari=t(n);returni.literal&&i.constant?i:function(t,n){returnr.getTrusted(e,i(t,n))}};varo=r.parseAs,s=r.getTrusted,c=r.trustAs;returna(ir,function(e,t){varn=oi(t);r[lt("parse_as_"+n)]=function(t){returno(e,t)},r[lt("get_trusted_"+n)]=function(t){returns(e,t)},r[lt("trust_as_"+n)]=function(t){returnc(e,t)}}),r}]}functionDn(){this.$get=["$window","$document",function(e,t){varn,i,r={},a=d((/android (\d+)/.exec(oi((e.navigator||{}).userAgent))||[])[1]),o=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},c=s.documentMode,l=/^(Moz|webkit|O|ms)(?=[A-Z])/,u=s.body&&s.body.style,p=!1,f=!1;if(u){for(varhinu)if(i=l.exec(h)){n=i[0],n=n.substr(0,1).toUpperCase()+n.substr(1);break}n||(n="WebkitOpacity"inu&&"webkit"),p=!!("transition"inu||n+"Transition"inu),f=!!("animation"inu||n+"Animation"inu),!a||p&&f||(p=b(s.body.style.webkitTransition),f=b(s.body.style.webkitAnimation))}return{history:!(!e.history||!e.history.pushState||4>a||o),hashchange:"onhashchange"ine&&(!c||c>7),hasEvent:function(e){if("input"==e&&9==ui)return!1;if(y(r[e])){vart=s.createElement("div");r[e]="on"+eint}returnr[e]},csp:U(),vendorPrefix:n,transitions:p,animations:f,android:a,msie:ui,msieDocumentMode:c}}]}functionIn(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(e,t,n,i){functionr(r,o,s){varc,l=n.defer(),u=l.promise,p=v(s)&&!s;returnc=t.defer(function(){try{l.resolve(r())}catch(t){l.reject(t),i(t)}finally{deletea[u.$$timeoutId]}p||e.$apply()},o),u.$$timeoutId=c,a[c]=l,u}vara={};returnr.cancel=function(e){returne&&e.$$timeoutIdina?(a[e.$$timeoutId].reject("canceled"),deletea[e.$$timeoutId],t.defer.cancel(e.$$timeoutId)):!1},r}]}functionPn(e){vart=e;returnui&&(rr.setAttribute("href",t),t=rr.href),rr.setAttribute("href",t),{href:rr.href,protocol:rr.protocol?rr.protocol.replace(/:$/,""):"",host:rr.host,search:rr.search?rr.search.replace(/^\?/,""):"",hash:rr.hash?rr.hash.replace(/^#/,""):"",ho
i[a.key]=a.value(t,n)}returni},{literal:!0,constant:t})}};vartr={},nr=i("$sce"),ir={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},rr=t.createElement("a"),ar=Pn(e.location.href,!0);Bn.$inject=["$provide"],On.$inject=["$locale"],Rn.$inject=["$locale"];varor=".",sr={yyyy:jn("FullYear",4),yy:jn("FullYear",2,0,!0),y:jn("FullYear",1),MMMM:Hn("Month"),MMM:Hn("Month",!0),MM:jn("Month",2,1),M:jn("Month",1,1),dd:jn("Date",2),d:jn("Date",1),HH:jn("Hours",2),H:jn("Hours",1),hh:jn("Hours",2,-12),h:jn("Hours",1,-12),mm:jn("Minutes",2),m:jn("Minutes",1),ss:jn("Seconds",2),s:jn("Seconds",1),sss:jn("Milliseconds",3),EEEE:Hn("Day"),EEE:Hn("Day",!0),a:Vn,Z:zn},cr=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,lr=/^\-?\d+$/;Wn.$inject=["$locale"];varur=g(oi),pr=g(si);Zn.$inject=["$parse"];vardr=g({restrict:"E",compile:function(e,n){return8>=ui&&(n.href||n.name||n.$set("href",""),e.append(t.createComment("IE fix"))),n.href||n.name?void0:function(e,t){t.on("click",function(e){t.attr("href")||e.preventDefault()})}}}),fr={};a(Pi,function(e,t){if("multiple"!=e){varn=Ut("ng-"+t);fr[n]=function(){return{priority:100,link:function(e,i,r){e.$watch(r[n],function(e){r.$set(t,!!e)})}}}}}),a(["src","srcset","href"],function(e){vart=Ut("ng-"+e);fr[t]=function(){return{priority:99,link:function(n,i,r){r.$observe(t,function(t){t&&(r.$set(e,t),ui&&i.prop(e,r[e]))})}}}});varhr={$addControl:h,$removeControl:h,$setValidity:h,$setDirty:h,$setPristine:h};Yn.$inject=["$element","$attrs","$scope"];varmr=function(e){return["$timeout",function(t){vari={name:"form",restrict:e?"EAC":"E",controller:Yn,compile:function(){return{pre:function(e,i,r,a){if(!r.action){varo=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1};ki(i[0],"submit",o),i.on("$destroy",function(){t(function(){Ti(i[0],"submit",o)},0,!1)})}vars=i.parent().controller("form"),c=r.name||r.ngForm;c&&gn(e,c,a,c),s&&i.on("$destroy",function(){s.$removeControl(a),c&&gn(e,c,n,c),p(a,hr)})}}}};returni}]},gr=mr(),yr=mr(!0),vr=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,_r=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/,br=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,wr={text:Jn,number:ei,url:ti,email:ni,radio:ii,checkbox:ri,hidden:h,button:h,submit:h,reset:h},$r=["$browser","$sniffer",function(e,t){return{restrict:"E",require:"?ngModel",link:function(n,i,r,a){a&&(wr[oi(r.type)]||wr.text)(n,i,r,a,t,e)}}}],Sr="ng-valid",Cr="ng-invalid",Mr="ng-pristine",xr="ng-dirty",kr=["$scope","$exceptionHandler","$attrs","$element","$parse",function(e,t,n,r,o){functions(e,t){t=t?"-"+J(t,"-"):"",r.removeClass((e?Cr:Sr)+t).addClass((e?Sr:Cr)+t)}this.$viewValue=Number.NaN,this.$modelValue=Number.NaN,this.$parsers=[],this.$formatters=[],this.$viewChangeListeners=[],this.$pristine=!0,this.$dirty=!1,this.$valid=!0,this.$invalid=!1,this.$name=n.name;varc=o(n.ngModel),l=c.assign;if(!l)throwi("ngModel")("nonassign","Expression '{0}' is non-assignable. Element: {1}",n.ngModel,V(r));this.$render=h,this.$isEmpty=function(e){returny(e)||""===e||null===e||e!==e};varu=r.inheritedData("$formController")||hr,p=0,d=this.$error={};r.addClass(Mr),s(!0),this.$setValidity=function(e,t){d[e]!==!t&&(t?(d[e]&&p--,p||(s(!0),this.$valid=!0,this.$invalid=!1)):(s(!1),this.$invalid=!0,this.$valid=!1,p++),d[e]=!t,s(t,e),u.$setValidity(e,t,this))},this.$setPristine=function(){this.$dirty=!1,this.$pristine=!0,r.removeClass(xr).addClass(Mr)},this.$setViewValue=function(n){this.$viewValue=n,this.$pristine&&(this.$dirty=!0,this.$pristine=!1,r.removeClass(Mr).addClass(xr),u.$setDirty()),a(this.$parsers,function(e){n=e(n)}),this.$modelValue!==n&&(this.$modelValue=n,l(e,n),a(this.$viewChangeListeners,function(e){try{e()}catch(n){t(n)}}))};varf=this;e.$watch(function(){vart=c(e);if(f.$modelValue!==t){varn=f.$formatters,i=n.length;for(f.$modelValue=t;i--;)t=n[i](t);f.$viewValue!==t&&(f.$viewValue=t,f.$render())}returnt})}],Tr=function(){return{require:["ngModel","^?form"],controller:kr,link:function(e,t,n,i){varr=i[0],a=i[1]||hr;a.$addCont
}t.media.user_id&&(t.media.user=a.getUser(t.media.user_id),t.media.userPhoto=a.getUserPhoto(t.media.user_id,"User"))}elseif(t.action){switch(t.action._){case"messageActionChatEditPhoto":t.action.photo=c.wrapForHistory(t.action.photo.id);break;case"messageActionChatCreate":case"messageActionChatEditTitle":t.action.rTitle=h.wrapRichText(t.action.title,{noLinks:!0,noLinebreaks:!0})||"DELETED"}t.action.user_id&&(t.action.user=a.getUser(t.action.user_id),t.action.userPhoto=a.getUserPhoto(t.action.user_id,"User"))}returnt.message&&t.message.length&&(t.richMessage=h.wrapRichText(t.message)),R[e]=t}functionB(e){for(vart=0;t<j.dialogs.length;t++)if(j.dialogs[t].peerID==e)return[j.dialogs[t],t];return[]}functionU(e){varn,i,r=P(e),s=a.getUser(e.from_id),c=a.getUserPhoto(e.from_id,"User"),l={},u=!1;if(e.message)u=e.message;elseif(e.media&&"messageMediaEmpty"!=e.media._)switch(e.media._){case"messageMediaPhoto":u="Photo";break;case"messageMediaVideo":u="Video";break;case"messageMediaDocument":u="Document";break;case"messageMediaGeo":u="Location";break;case"messageMediaContact":u="Contact";break;default:u="Attachment"}elseif("messageService"==e._)switch(e.action._){case"messageActionChatCreate":u="created the group";break;case"messageActionChatEditTitle":u="changed group name";break;case"messageActionChatEditPhoto":u="changed group photo";break;case"messageActionChatDeletePhoto":u="removed group photo";break;case"messageActionChatAddUser":u="invited user";break;case"messageActionChatDeleteUser":u="kicked user"}r>0?(l.title=(s.first_name||"")+(s.first_name&&s.last_name?" ":"")+(s.last_name||""),i=c,n=a.getUserString(r)):(l.title=(s.first_name||s.last_name||"Somebody")+" @ "+(o.getChat(-r).title||"Unknown chat"),i=o.getChatPhoto(-r,"Group"),n=o.getChatString(-r)),l.onclick=function(){t.$broadcast("history_focus",{peerString:n})},l.message=u,l.image=i.placeholder,l.key="msg"+e.id,l.tag=n,i.location&&!i.location.empty?f.downloadSmallFile(i.location,i.size).then(function(t){l.image=t,e.unread&&m.notify(l)}):m.notify(l)}varO={},R={},F={},q={},j={count:null,dialogs:[]},H={},z={},V={},W=e.when(),G=-1,K=g.createIndex(),Z={query:!1},X={},Y=[];returnm.start(),t.$on("apiUpdate",function(e,n){switch(n._){case"updateMessageID":z[n.id]=n.random_id;break;case"updateNewMessage":vari=n.message,r=P(i),a=q[r];if(void0!==a){varo=q[r].history[0];if(i.id<=o)return!1}elsea=q[r]={count:null,history:[],pending:[]};x([i]),null!==a.count&&a.count++,a.history.unshift(i.id);varc,l=z[i.id];l&&((c=I(l,i))&&t.$broadcast("history_update",{peerID:r}),deletez[i.id]),c||t.$broadcast("history_append",{peerID:r,messageID:i.id});varu,p=B(r);p.length?(u=p[0],j.dialogs.splice(p[1],1)):u={peerID:r,unread_count:0,top_message:!1},!i.out&&i.unread&&u.unread_count++,u.top_message=i.id,g.indexObject(r,s.getPeerSearchText(r),K),j.dialogs.unshift(u),t.$broadcast("dialogs_update",u),t.idle.isIDLE&&!i.out&&i.unread&&m.getPeerMuted(r).then(function(e){i.unread&&!e&&U(i)});break;case"updateReadMessages":vard,i,f,r,p,u,h={};for(f=0;f<n.messages.length;f++)d=n.messages[f],i=O[d],i&&i.unread&&(i.unread=!1,R[d]&&(R[d].unread=!1),F[d]&&(F[d].unread=!1),r=P(i),i.out||(p=B(r),p&&(h[r]=--p[0].unread_count),m.cancel("msg"+d)));angular.forEach(h,function(e,n){t.$broadcast("dialog_unread",{peerID:n,count:e})});break;case"updateDeleteMessages":vard,i,f,r,p,u,y,h={},v={};for(f=0;f<n.messages.length;f++)d=n.messages[f],i=O[d],i&&(r=P(i),y=v[r]||(v[r]={count:0,unread:0,msgs:{}}),!i.out&&i.unread&&(y.unread++,m.cancel("msg"+d)),y.count++,y.msgs[d]=!0,R[d]&&(R[d].DELETED=!0,deleteR[d]),F[d]&&(F[d].DELETED=!0,deleteF[d]),i.DELETED=!0,deleteO[d]);angular.forEach(v,function(e,n){vari=B(n);i&&e.unread&&(i[0].unread_count-=e.unread,t.$broadcast("dialog_unread",{peerID:n,count:i[0].unread_count}));varr=q[n];if(void0!==r){for(vara=[],o=[],s=0;s<r.history.length;s++)e.msgs[r.history[s]]||a.push(r.history[s]);r.history=a;for(vars=0;s<r.pending.length;s++)e.msgs[r.pending[s]]||o.push(r.pending[s]);r.pending=o,t.$broadcast("history_delete",{peerID:n,msgs:e.msgs})}})}}),{getDialogs:y,getH