You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
588 KiB

function BigInteger(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function nbi(){return new BigInteger(null)}function am1(e,t,n,i,r,a){for(;--a>=0;){var o=t*this[e++]+n[i]+r;r=Math.floor(o/67108864),n[i++]=67108863&o}return r}function am2(e,t,n,i,r,a){for(var o=32767&t,s=t>>15;--a>=0;){var c=32767&this[e],l=this[e++]>>15,p=s*c+l*o;c=o*c+((32767&p)<<15)+n[i]+(1073741823&r),r=(c>>>30)+(p>>>15)+s*l+(r>>>30),n[i++]=1073741823&c}return r}function am3(e,t,n,i,r,a){for(var o=16383&t,s=t>>14;--a>=0;){var c=16383&this[e],l=this[e++]>>14,p=s*c+l*o;c=o*c+((16383&p)<<14)+n[i]+r,r=(c>>28)+(p>>14)+s*l,n[i++]=268435455&c}return r}function int2char(e){return BI_RM.charAt(e)}function intAt(e,t){var n=BI_RC[e.charCodeAt(t)];return null==n?-1:n}function bnpCopyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function bnpFromInt(e){this.t=1,this.s=0>e?-1:0,e>0?this[0]=e:-1>e?this[0]=e+this.DV:this.t=0}function nbv(e){var t=nbi();return t.fromInt(e),t}function bnpFromString(e,t,n){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var r=e.length,a=!1,o=0;--r>=0;){var s=8==i?255&e[r]:intAt(e,r);0>s?"-"==e.charAt(r)&&(a=!0):(a=!1,0==o?this[this.t++]=s:o+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=i,o>=this.DB&&(o-=this.DB))}8==i&&0!=(128&e[0])&&n&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function bnToString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,a="",o=this.t,s=this.DB-o*this.DB%t;if(o-->0)for(s<this.DB&&(n=this[o]>>s)>0&&(r=!0,a=int2char(n));o>=0;)t>s?(n=(this[o]&(1<<s)-1)<<t-s,n|=this[--o]>>(s+=this.DB-t)):(n=this[o]>>(s-=t)&i,0>=s&&(s+=this.DB,--o)),n>0&&(r=!0),r&&(a+=int2char(n));return r?a:"0"}function bnNegate(){var e=nbi();return BigInteger.ZERO.subTo(this,e),e}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function nbits(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function bnpDRShiftTo(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function bnpLShiftTo(e,t){var n,i=e%this.DB,r=this.DB-i,a=(1<<r)-1,o=Math.floor(e/this.DB),s=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+o+1]=this[n]>>r|s,s=(this[n]&a)<<i;for(n=o-1;n>=0;--n)t[n]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function bnpRShiftTo(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)return void(t.t=0);var i=e%this.DB,r=this.DB-i,a=(1<<i)-1;t[0]=this[n]>>i;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<r,t[o-n]=this[o]>>i;i>0&&(t[this.t-n-1]|=(this.s&a)<<r),t.t=this.t-n,t.clamp()}function bnpSubTo(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);r>n;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=0>i?-1:0,-1>i?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()}function bnpMultiplyTo(e,t){var n=this.abs(),i=e.abs(),r=n.t;for(t.t=r+i.t;--r>=0;)t[r]=0;for(r=0;r<i.t;++r)t[r+n.t]=n.am(0,i[r],t,r,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&BigInteger.ZERO.subTo(t,t)}function bnpSquareTo(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.a
}),c=function(){if(r)return!1;for(var t=Jn||O(),n=Math.max(0,l.startTime+l.duration-t),i=n/l.duration||0,a=1-i,o=0,c=l.tweens.length;c>o;o++)l.tweens[o].run(a);return s.notifyWith(e,[l,a,n]),1>a&&c?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:pt.extend({},t),opts:pt.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||O(),duration:n.duration,tweens:[],createTween:function(t,n){var i=pt.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(i),i},stop:function(t){var n=0,i=t?l.tweens.length:0;if(r)return this;for(r=!0;i>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),p=l.props;for(q(p,l.opts.specialEasing);o>a;a++)if(i=ri[a].call(l,e,p,l.opts))return i;return pt.map(p,F,l),pt.isFunction(l.opts.start)&&l.opts.start.call(e,l),pt.fx.timer(pt.extend(c,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function q(e,t){var n,i,r,a,o;for(n in e)if(i=pt.camelCase(n),r=t[i],a=e[n],pt.isArray(a)&&(r=a[1],a=e[n]=a[0]),n!==i&&(e[i]=a,delete e[n]),o=pt.cssHooks[i],o&&"expand"in o){a=o.expand(a),delete e[i];for(n in a)n in e||(e[n]=a[n],t[n]=r)}else t[i]=r}function j(e,t,n){var i,r,a,o,s,c,l=this,p={},u=e.style,d=e.nodeType&&S(e),f=pt._data(e,"fxshow");n.queue||(s=pt._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,c=s.empty.fire,s.empty.fire=function(){s.unqueued||c()}),s.unqueued++,l.always(function(){l.always(function(){s.unqueued--,pt.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[u.overflow,u.overflowX,u.overflowY],"inline"===pt.css(e,"display")&&"none"===pt.css(e,"float")&&(pt.support.inlineBlockNeedsLayout&&"inline"!==T(e.nodeName)?u.zoom=1:u.display="inline-block")),n.overflow&&(u.overflow="hidden",pt.support.shrinkWrapBlocks||l.always(function(){u.overflow=n.overflow[0],u.overflowX=n.overflow[1],u.overflowY=n.overflow[2]}));for(i in t)if(r=t[i],ti.exec(r)){if(delete t[i],a=a||"toggle"===r,r===(d?"hide":"show"))continue;p[i]=f&&f[i]||pt.style(e,i)}if(!pt.isEmptyObject(p)){f?"hidden"in f&&(d=f.hidden):f=pt._data(e,"fxshow",{}),a&&(f.hidden=!d),d?pt(e).show():l.done(function(){pt(e).hide()}),l.done(function(){var t;pt._removeData(e,"fxshow");for(t in p)pt.style(e,t,p[t])});for(i in p)o=F(d?f[i]:0,i,l),i in f||(f[i]=o.start,d&&(o.end=o.start,o.start="width"===i||"height"===i?1:0))}}function H(e,t,n,i,r){return new H.prototype.init(e,t,n,i,r)}function z(e,t){var n,i={height:e},r=0;for(t=t?1:0;4>r;r+=2-t)n=Mn[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function V(e){return pt.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var W,G,X=typeof t,Z=e.location,K=e.document,Y=K.documentElement,Q=e.jQuery,J=e.$,et={},tt=[],nt="1.10.2",it=tt.concat,rt=tt.push,at=tt.slice,ot=tt.indexOf,st=et.toString,ct=et.hasOwnProperty,lt=nt.trim,pt=function(e,t){return new pt.fn.init(e,t,G)},ut=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,dt=/\S+/g,ft=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ht=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,gt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,mt=/^[\],:{}\s]*$/,yt=/(?:^|:|,)(?:\s*\[)+/g,vt=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,_t=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,bt=/^-ms-/,wt=/-([\da-z])/gi,$t=function(e,t){return t.toUpperCase()},St=function(e){(K.addEventListener||"load"===e.type||"complete"===K.readyState)&&(Mt(),pt.ready())},Mt=function(){K.addEventListener?(K.removeEventListener("DOMContentLoaded",St,!1),e.removeEventListener("load",St,!1)):(K.detachEvent("onreadystatechange",St),e.detachEvent("onload",St))};pt.fn=pt.prototype={jquery:nt,constructor:pt,init:function(e,n,i){var r,a;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:ht.exec(e),!r||!r[1]&&n)return!n||n.jquery?(n||i).find(e):this.constructor(n).find(e);if(r[1]){if(n=n instanceof pt?n[0]:n,pt.merge(this,pt.parseHTML(r[1],n&&n.nodeType?n.ownerDocument||n:K,!0)),gt.test(r[1])&&pt.isPlainObject
try{delete u.test}catch(d){t.deleteExpando=!1}r=K.createElement("input"),r.setAttribute("value",""),t.input=""===r.getAttribute("value"),r.value="t",r.setAttribute("type","radio"),t.radioValue="t"===r.value,r.setAttribute("checked","t"),r.setAttribute("name","t"),o=K.createDocumentFragment(),o.appendChild(r),t.appendChecked=r.checked,t.checkClone=o.cloneNode(!0).cloneNode(!0).lastChild.checked,u.attachEvent&&(u.attachEvent("onclick",function(){t.noCloneEvent=!1}),u.cloneNode(!0).click());for(p in{submit:!0,change:!0,focusin:!0})u.setAttribute(c="on"+p,"t"),t[p+"Bubbles"]=c in e||u.attributes[c].expando===!1;u.style.backgroundClip="content-box",u.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===u.style.backgroundClip;for(p in pt(t))break;return t.ownLast="0"!==p,pt(function(){var n,i,r,a="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",o=K.getElementsByTagName("body")[0];o&&(n=K.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",o.appendChild(n).appendChild(u),u.innerHTML="<table><tr><td></td><td>t</td></tr></table>",r=u.getElementsByTagName("td"),r[0].style.cssText="padding:0;margin:0;border:0;display:none",l=0===r[0].offsetHeight,r[0].style.display="",r[1].style.display="none",t.reliableHiddenOffsets=l&&0===r[0].offsetHeight,u.innerHTML="",u.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",pt.swap(o,null!=o.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===u.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(u,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(u,null)||{width:"4px"}).width,i=u.appendChild(K.createElement("div")),i.style.cssText=u.style.cssText=a,i.style.marginRight=i.style.width="0",u.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)),typeof u.style.zoom!==X&&(u.innerHTML="",u.style.cssText=a+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===u.offsetWidth,u.style.display="block",u.innerHTML="<div></div>",u.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==u.offsetWidth,t.inlineBlockNeedsLayout&&(o.style.zoom=1)),o.removeChild(n),n=u=r=i=null)}),n=a=o=s=i=r=null,t}({});var Ct=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,kt=/([A-Z])/g;pt.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pt.cache[e[pt.expando]]:e[pt.expando],!!e&&!s(e)},data:function(e,t,n){return r(e,t,n)},removeData:function(e,t){return a(e,t)},_data:function(e,t,n){return r(e,t,n,!0)},_removeData:function(e,t){return a(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&pt.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),pt.fn.extend({data:function(e,n){var i,r,a=null,s=0,c=this[0];if(e===t){if(this.length&&(a=pt.data(c),1===c.nodeType&&!pt._data(c,"parsedAttrs"))){for(i=c.attributes;i.length>s;s++)r=i[s].name,0===r.indexOf("data-")&&(r=pt.camelCase(r.slice(5)),o(c,r,a[r]));pt._data(c,"parsedAttrs",!0)}return a}return"object"==typeof e?this.each(function(){pt.data(this,e)}):arguments.length>1?this.each(function(){pt.data(this,e,n)}):c?o(c,e,pt.data(c,e)):null},removeData:function(e){return this.each(function(){pt.removeData(this,e)})}}),pt.extend({queue:function(e,n,i){var r;return e?(n=(n||"fx")+"queue",r=pt._data(e,n),i&&(!r||pt.isArray(i)?r=pt._data(e,n,pt.makeArray(i)):r.push(i)),r||[]):t},dequeue:function(e,t){t=t||"fx";var n=pt.queue(e,t),i=n.length,r=n.shift(),a=pt._queueHooks(e,t),o=function(){pt.dequeue(e,t)};"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete a.stop,r.call(e,o,a)),!i&&a&&a.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pt._data(e,n)||pt._data(e,n,{empty:pt.Callbacks("once memory").add(function(){
return this.each(function(n){pt(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pt.nodeName(this,"body")||pt(this).replaceWith(this.childNodes)}).end()}});var pn,un,dn,fn=/alpha\([^)]*\)/i,hn=/opacity\s*=\s*([^)]*)/,gn=/^(top|right|bottom|left)$/,mn=/^(none|table(?!-c[ea]).+)/,yn=/^margin/,vn=RegExp("^("+ut+")(.*)$","i"),_n=RegExp("^("+ut+")(?!px)[a-z%]+$","i"),bn=RegExp("^([+-])=("+ut+")","i"),wn={BODY:"block"},$n={position:"absolute",visibility:"hidden",display:"block"},Sn={letterSpacing:0,fontWeight:400},Mn=["Top","Right","Bottom","Left"],xn=["Webkit","O","Moz","ms"];pt.fn.extend({css:function(e,n){return pt.access(this,function(e,n,i){var r,a,o={},s=0;if(pt.isArray(n)){for(a=un(e),r=n.length;r>s;s++)o[n[s]]=pt.css(e,n[s],!1,a);return o}return i!==t?pt.style(e,n,i):pt.css(e,n)},e,n,arguments.length>1)},show:function(){return M(this,!0)},hide:function(){return M(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){S(this)?pt(this).show():pt(this).hide()})}}),pt.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=dn(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":pt.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,i,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var a,o,s,c=pt.camelCase(n),l=e.style;if(n=pt.cssProps[c]||(pt.cssProps[c]=$(l,c)),s=pt.cssHooks[n]||pt.cssHooks[c],i===t)return s&&"get"in s&&(a=s.get(e,!1,r))!==t?a:l[n];if(o=typeof i,"string"===o&&(a=bn.exec(i))&&(i=(a[1]+1)*a[2]+parseFloat(pt.css(e,n)),o="number"),!(null==i||"number"===o&&isNaN(i)||("number"!==o||pt.cssNumber[c]||(i+="px"),pt.support.clearCloneStyle||""!==i||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(i=s.set(e,i,r))===t)))try{l[n]=i}catch(p){}}},css:function(e,n,i,r){var a,o,s,c=pt.camelCase(n);return n=pt.cssProps[c]||(pt.cssProps[c]=$(e.style,c)),s=pt.cssHooks[n]||pt.cssHooks[c],s&&"get"in s&&(o=s.get(e,!0,i)),o===t&&(o=dn(e,n,r)),"normal"===o&&n in Sn&&(o=Sn[n]),""===i||i?(a=parseFloat(o),i===!0||pt.isNumeric(a)?a||0:o):o}}),e.getComputedStyle?(un=function(t){return e.getComputedStyle(t,null)},dn=function(e,n,i){var r,a,o,s=i||un(e),c=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==c||pt.contains(e.ownerDocument,e)||(c=pt.style(e,n)),_n.test(c)&&yn.test(n)&&(r=l.width,a=l.minWidth,o=l.maxWidth,l.minWidth=l.maxWidth=l.width=c,c=s.width,l.width=r,l.minWidth=a,l.maxWidth=o)),c}):K.documentElement.currentStyle&&(un=function(e){return e.currentStyle},dn=function(e,n,i){var r,a,o,s=i||un(e),c=s?s[n]:t,l=e.style;return null==c&&l&&l[n]&&(c=l[n]),_n.test(c)&&!gn.test(n)&&(r=l.left,a=e.runtimeStyle,o=a&&a.left,o&&(a.left=e.currentStyle.left),l.left="fontSize"===n?"1em":c,c=l.pixelLeft+"px",l.left=r,o&&(a.left=o)),""===c?"auto":c}),pt.each(["height","width"],function(e,n){pt.cssHooks[n]={get:function(e,i,r){return i?0===e.offsetWidth&&mn.test(pt.css(e,"display"))?pt.swap(e,$n,function(){return k(e,n,r)}):k(e,n,r):t},set:function(e,t,i){var r=i&&un(e);return x(e,t,i?C(e,n,i,pt.support.boxSizing&&"border-box"===pt.css(e,"boxSizing",!1,r),r):0)}}}),pt.support.opacity||(pt.cssHooks.opacity={get:function(e,t){return hn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,i=e.currentStyle,r=pt.isNumeric(t)?"alpha(opacity="+100*t+")":"",a=i&&i.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pt.trim(a.replace(fn,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||i&&!i.filter)||(n.filter=fn.test(a)?a.replace(fn,r):a+" "+r)}}),pt(function(){pt.support.reliableMarginRight||(pt.cssHooks.marginRight={get:function(e,n){return n?pt.swap(e,{display:"inline-block"},dn,[e,"marginRight"]):t}}),!pt.support.pixelPosition&&pt.fn.position&&pt.each(["top","left"],function(e,n){pt.cssHooks[n]={get:function(e,i){return i?(i=dn(e,n),_n.test(i)?pt(e).position()[n]+"px":i):t}}})}),pt.expr&&pt.expr.filters&&(pt.
},c.extend=function(e,t){if("undefined"!=typeof e&&e||(e={}),"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},c.escapeRegex=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},c.htmlEntities=function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};var l=function(){};l.prototype.setup=function(){var e=this;this.$editor.on("focus",function(){e.hasFocus=!0}),this.$editor.on("blur",function(){e.hasFocus=!1}),this.setupButton()},l.prototype.setupButton=function(){var t,n=this;this.options.button?t=e(this.options.button):this.options.button!==!1?(t=e('<a href="javascript:void(0)">'),t.html(this.options.buttonLabel),t.addClass("emoji-button"),t.attr({title:this.options.buttonLabel}),this.$editor[this.options.buttonPosition](t)):t=e(""),t.on("click",function(e){d.show(n),e.stopPropagation()}),this.$button=t},l.createIcon=function(t){var n=t[0],i=t[1],r=t[2],a=t[3],o=e.emojiarea.spritesheetPath,s=-(e.emojiarea.iconSize*r),l=-(e.emojiarea.iconSize*i),p=e.emojiarea.spritesheetDimens[n][1]*e.emojiarea.iconSize,u=e.emojiarea.spritesheetDimens[n][0]*e.emojiarea.iconSize,d="display:inline-block;";return d+="width:"+e.emojiarea.iconSize+"px;",d+="height:"+e.emojiarea.iconSize+"px;",d+="background:url('"+o.replace("!",n)+"') "+s+"px "+l+"px no-repeat;",d+="background-size:"+p+"px "+u+"px;",'<img src="img/blank.gif" class="img" style="'+d+'" alt="'+c.htmlEntities(a)+'">'};var p=function(e,t){this.options=t,this.$textarea=e,this.$editor=e,this.setup()};p.prototype.insert=function(t){e.emojiarea.icons.hasOwnProperty(t)&&(c.insertAtCursor(t,this.$textarea[0]),this.$textarea.trigger("change"))},p.prototype.val=function(){return this.$textarea.val()},c.extend(p.prototype,l.prototype);var u=function(t,i){var r=this;this.options=i||{},this.$textarea=t,this.$editor=e("<div>").addClass("emoji-wysiwyg-editor"),this.$editor.text(t.val()),this.$editor.attr({contenteditable:"true"});var a="blur change";this.options.norealTime||(a+=" keyup"),this.$editor.on(a,function(e){return r.onChange.apply(r,[e])}),this.$editor.on("paste",function(e){return r.onPaste.apply(r,[e])}),this.$editor.on("mousedown focus",function(){n.execCommand("enableObjectResizing",!1,!1)}),this.$editor.on("blur",function(){n.execCommand("enableObjectResizing",!0,!0)});var o=this.$editor.text(),s=e.emojiarea.icons;for(var p in s)s.hasOwnProperty(p)&&(o=o.replace(new RegExp(c.escapeRegex(p),"g"),l.createIcon(s[p])));this.$editor.html(o),t.hide().after(this.$editor),this.setup(),e(n.body).on("mousedown",function(){r.hasFocus&&(r.selection=c.saveSelection())})};u.prototype.onPaste=function(e){var t,i=(e.originalEvent||e).clipboardData,r=i&&i.items||[];for(t=0;t<r.length;t++)if("file"==r[t].kind)return e.preventDefault(),!0;var a=(e.originalEvent||e).clipboardData.getData("text/plain"),o=this;return setTimeout(function(){o.onChange()},0),a.length?(n.execCommand("insertText",!1,a),cancelEvent(e)):!0},u.prototype.onChange=function(){this.$textarea.val(this.val()).trigger("change")},u.prototype.insert=function(t){var n=e(l.createIcon(e.emojiarea.icons[t]));n[0].attachEvent&&n[0].attachEvent("onresizestart",function(e){e.returnValue=!1},!1),this.$editor.trigger("focus"),this.selection&&c.restoreSelection(this.selection);try{c.replaceSelection(n[0])}catch(i){}var r=this;setTimeout(function(){r.selection=c.saveSelection()},100),this.onChange()},u.prototype.val=function(){for(var e=[],t=[],n=function(){e.push(t.join("")),t=[]},o=function(e){if(e.nodeType===r)t.push(e.nodeValue);else if(e.nodeType===i){var s=e.tagName.toLowerCase(),c=-1!==a.indexOf(s);if(c&&t.length&&n(),"img"===s){var l=e.getAttribute("alt")||"";return void(l&&t.push(l))}"br"===s&&n();for(var p=e.childNodes,u=0;u<p.length;u++)o(p[u]);c&&t.length&&n()}},s=this.$editor[0].childNodes,c=0;c<s.length;c++)o(s[c]);return t.length&&n(),e.join("\n")},c.extend(u.prototype,l.prototype);var d=function(){var i=this,r=e(n.body),a=e(t);this.visible=!1,this.emojiarea=null,this.$menu=e("<div>"),this.$menu.addClass("emoji-menu"),this.$menu.hid
$=e.controller,"@"==$&&($=h[e.name]),n=v($,i),x[e.name]=n,X||m.data("$"+e.name+"Controller",n),e.controllerAs&&(i.$scope[e.controllerAs]=n)}),_=0,b=u.length;b>_;_++)try{w=u[_],w(w.isolateScope?S:t,m,h,w.require&&g(w.require,m,x),M)}catch(T){c(T,V(m))}var E=t;for(R&&(R.template||null===R.templateUrl)&&(E=S),e&&e(E,s.childNodes,n,p),_=d.length-1;_>=0;_--)try{w=d[_],w(w.isolateScope?S:t,m,h,w.require&&g(w.require,m,x),M)}catch(T){c(T,V(m))}}f=f||{};for(var w,$,x,C,k,E,D=-Number.MAX_VALUE,U=f.controllerDirectives,R=f.newIsolateScopeDirective,q=f.templateDirective,z=f.nonTlbTranscludeDirective,G=!1,X=!1,Z=o.$$element=ui(r),J=p,et=s,tt=0,nt=e.length;nt>tt;tt++){$=e[tt];var rt=$.$$start,at=$.$$end;if(rt&&(Z=P(r,rt,at)),C=n,D>$.priority)break;if((E=$.scope)&&(w=w||$,$.templateUrl||(W("new/isolated scope",R,$,Z),_(E)&&(R=$))),x=$.name,!$.templateUrl&&$.controller&&(E=$.controller,U=U||{},W("'"+x+"' controller",U[x],$,Z),U[x]=$),(E=$.transclude)&&(G=!0,$.$$tlb||(W("transclusion",z,$,Z),z=$),"element"==E?(X=!0,D=$.priority,C=P(r,rt,at),Z=o.$$element=ui(t.createComment(" "+x+": "+o[x]+" ")),r=Z[0],K(l,ui(F(C)),r),et=T(C,s,D,J&&J.name,{nonTlbTranscludeDirective:z})):(C=ui(dt(r)).contents(),Z.empty(),et=T(C,s))),$.template)if(W("template",q,$,Z),q=$,E=M($.template)?$.template(Z,o):$.template,E=it(E),$.replace){if(J=$,C=ui("<div>"+wi(E)+"</div>").contents(),r=C[0],1!=C.length||1!==r.nodeType)throw ji("tplrt","Template for directive '{0}' must have exactly one root element. {1}",x,"");K(l,Z,r);var ot={$attr:{}},st=I(r,[],ot),ct=e.splice(tt+1,e.length-(tt+1));R&&O(st),e=e.concat(st).concat(ct),j(o,ot),nt=e.length}else Z.html(E);if($.templateUrl)W("template",q,$,Z),q=$,$.replace&&(J=$),m=H(e.splice(tt,e.length-tt),Z,o,l,et,u,d,{controllerDirectives:U,newIsolateScopeDirective:R,templateDirective:q,nonTlbTranscludeDirective:z}),nt=e.length;else if($.compile)try{k=$.compile(Z,o,et),M(k)?h(null,k,rt,at):k&&h(k.pre,k.post,rt,at)}catch(lt){c(lt,V(Z))}$.terminal&&(m.terminal=!0,D=Math.max(D,$.priority))}return m.scope=w&&w.scope===!0,m.transclude=G&&et,m}function O(e){for(var t=0,n=e.length;n>t;t++)e[t]=f(e[t],{$$isolateScope:!0})}function q(t,i,a,s,l,p,u){if(i===l)return null;var d=null;if(r.hasOwnProperty(i))for(var h,g=e.get(i+o),m=0,y=g.length;y>m;m++)try{h=g[m],(s===n||s>h.priority)&&-1!=h.restrict.indexOf(a)&&(p&&(h=f(h,{$$start:p,$$end:u})),t.push(h),d=h)}catch(v){c(v)}return d}function j(e,t){var n=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?(A(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])})}function H(e,t,n,i,r,o,s,c){var l,p,f=[],g=t[0],m=e.shift(),y=u({},m,{templateUrl:null,transclude:null,replace:null,$$originalDirective:m}),v=M(m.templateUrl)?m.templateUrl(t,n):m.templateUrl;return t.empty(),d.get(x.getTrustedResourceUrl(v),{cache:h}).success(function(u){var d,h,b,w;if(u=it(u),m.replace){if(b=ui("<div>"+wi(u)+"</div>").contents(),d=b[0],1!=b.length||1!==d.nodeType)throw ji("tplrt","Template for directive '{0}' must have exactly one root element. {1}",m.name,v);h={$attr:{}},K(i,t,d);var $=I(d,[],h);_(m.scope)&&O($),e=$.concat(e),j(n,h)}else d=g,t.html(u);for(e.unshift(y),l=U(e,d,n,r,t,m,o,s,c),a(i,function(e,n){e==d&&(i[n]=t[0])}),p=E(t[0].childNodes,r);f.length;){var S=f.shift(),M=f.shift(),x=f.shift(),C=f.shift(),k=t[0];M!==g&&(k=dt(d),K(x,ui(M),k)),w=l.transclude?D(S,l.transclude):C,l(p,S,k,i,w)}f=null}).error(function(e,t,n,i){throw ji("tpload","Failed to load template: {0}",i.url)}),function(e,t,n,i,r){f?(f.push(t),f.push(n),f.push(i),f.push(r)):l(p,t,n,i,r)}}function z(e,t){var n=t.priority-e.priority;return 0!==n?n:e.name!==t.name?e.name<t.name?-1:1:e.index-t.index}function W(e,t,n,i){if(t)throw ji("multidir","Multiple directives [{0}, {1}] asking for {2} on: {3}",t.name,n.name,e,V(i))}function G(e,t){var n=i(t,!0);n&&e.push({priority:0,compile:m(function(e,t){var i=t
if(e===ir.RESOURCE_URL){if(a(t))return t;throw nr("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",t.toString())}if(e===ir.HTML)return p(t);throw nr("unsafe","Attempting to use an unsafe value in a safe context.")}var p=function(){throw nr("unsafe","Attempting to use an unsafe value in a safe context.")};i.has("$sanitize")&&(p=i.get("$sanitize"));var u=o(),d={};return d[ir.HTML]=o(u),d[ir.CSS]=o(u),d[ir.URL]=o(u),d[ir.JS]=o(u),d[ir.RESOURCE_URL]=o(d[ir.URL]),{trustAs:s,getTrusted:l,valueOf:c}}]}function En(){var e=!0;this.enabled=function(t){return arguments.length&&(e=!!t),e},this.$get=["$parse","$sniffer","$sceDelegate",function(t,n,i){if(e&&n.msie&&n.msieDocumentMode<8)throw nr("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.");var r=N(ir);r.isEnabled=function(){return e},r.trustAs=i.trustAs,r.getTrusted=i.getTrusted,r.valueOf=i.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){return t},r.valueOf=g),r.parseAs=function(e,n){var i=t(n);return i.literal&&i.constant?i:function(t,n){return r.getTrusted(e,i(t,n))}};var o=r.parseAs,s=r.getTrusted,c=r.trustAs;return a(ir,function(e,t){var n=oi(t);r[lt("parse_as_"+n)]=function(t){return o(e,t)},r[lt("get_trusted_"+n)]=function(t){return s(e,t)},r[lt("trust_as_"+n)]=function(t){return c(e,t)}}),r}]}function Dn(){this.$get=["$window","$document",function(e,t){var n,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])/,p=s.body&&s.body.style,u=!1,f=!1;if(p){for(var h in p)if(i=l.exec(h)){n=i[0],n=n.substr(0,1).toUpperCase()+n.substr(1);break}n||(n="WebkitOpacity"in p&&"webkit"),u=!!("transition"in p||n+"Transition"in p),f=!!("animation"in p||n+"Animation"in p),!a||u&&f||(u=b(s.body.style.webkitTransition),f=b(s.body.style.webkitAnimation))}return{history:!(!e.history||!e.history.pushState||4>a||o),hashchange:"onhashchange"in e&&(!c||c>7),hasEvent:function(e){if("input"==e&&9==pi)return!1;if(y(r[e])){var t=s.createElement("div");r[e]="on"+e in t}return r[e]},csp:U(),vendorPrefix:n,transitions:u,animations:f,android:a,msie:pi,msieDocumentMode:c}}]}function In(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(e,t,n,i){function r(r,o,s){var c,l=n.defer(),p=l.promise,u=v(s)&&!s;return c=t.defer(function(){try{l.resolve(r())}catch(t){l.reject(t),i(t)}finally{delete a[p.$$timeoutId]}u||e.$apply()},o),p.$$timeoutId=c,a[c]=l,p}var a={};return r.cancel=function(e){return e&&e.$$timeoutId in a?(a[e.$$timeoutId].reject("canceled"),delete a[e.$$timeoutId],t.defer.cancel(e.$$timeoutId)):!1},r}]}function Pn(e){var t=e;return pi&&(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(/^#/,""):"",hostname:rr.hostname,port:rr.port,pathname:"/"===rr.pathname.charAt(0)?rr.pathname:"/"+rr.pathname}}function Nn(e){var t=b(e)?Pn(e):e;return t.protocol===ar.protocol&&t.host===ar.host}function Ln(){this.$get=m(e)}function Bn(e){function t(i,r){if(_(i)){var o={};return a(i,function(e,n){o[n]=t(n,e)}),o}return e.factory(i+n,r)}var n="Filter";this.register=t,this.$get=["$injector",function(e){return function(t){return e.get(t+n)}}],t("currency",On),t("date",Wn),t("filter",Un),t("json",Gn),t("limitTo",Xn),t("lowercase",pr),t("number",Fn),t("orderBy",Zn),t("uppercase",ur)}function Un(){return function(e,t,n){if(!S(e))return e;var i=typeof n,r=[];r.check=function(e){for(var t=0;t<r.length;t++)if(!r[t](e))return!1;return!0},"function"!==i&&(n="boolean"===i&&n?function(e,t){return _i.equals(e,t)}:function(e,t){return t=(""+t).toLowerCase(),(""+e).toLowerCase().indexOf(t)>-1});var a=function(e,t){if("string"==typeof t&&"!"===t.charAt(0))return!a(e,t.substr(1));
})}}}),fr={};a(Pi,function(e,t){if("multiple"!=e){var n=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){var t=Ut("ng-"+e);fr[t]=function(){return{priority:99,link:function(n,i,r){r.$observe(t,function(t){t&&(r.$set(e,t),pi&&i.prop(e,r[e]))})}}}});var hr={$addControl:h,$removeControl:h,$setValidity:h,$setDirty:h,$setPristine:h};Yn.$inject=["$element","$attrs","$scope"];var gr=function(e){return["$timeout",function(t){var i={name:"form",restrict:e?"EAC":"E",controller:Yn,compile:function(){return{pre:function(e,i,r,a){if(!r.action){var o=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)})}var s=i.parent().controller("form"),c=r.name||r.ngForm;c&&mn(e,c,a,c),s&&i.on("$destroy",function(){s.$removeControl(a),c&&mn(e,c,n,c),u(a,hr)})}}}};return i}]},mr=gr(),yr=gr(!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",Mr="ng-invalid",xr="ng-pristine",Cr="ng-dirty",kr=["$scope","$exceptionHandler","$attrs","$element","$parse",function(e,t,n,r,o){function s(e,t){t=t?"-"+J(t,"-"):"",r.removeClass((e?Mr:Sr)+t).addClass((e?Sr:Mr)+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;var c=o(n.ngModel),l=c.assign;if(!l)throw i("ngModel")("nonassign","Expression '{0}' is non-assignable. Element: {1}",n.ngModel,V(r));this.$render=h,this.$isEmpty=function(e){return y(e)||""===e||null===e||e!==e};var p=r.inheritedData("$formController")||hr,u=0,d=this.$error={};r.addClass(xr),s(!0),this.$setValidity=function(e,t){d[e]!==!t&&(t?(d[e]&&u--,u||(s(!0),this.$valid=!0,this.$invalid=!1)):(s(!1),this.$invalid=!0,this.$valid=!1,u++),d[e]=!t,s(t,e),p.$setValidity(e,t,this))},this.$setPristine=function(){this.$dirty=!1,this.$pristine=!0,r.removeClass(Cr).addClass(xr)},this.$setViewValue=function(n){this.$viewValue=n,this.$pristine&&(this.$dirty=!0,this.$pristine=!1,r.removeClass(xr).addClass(Cr),p.$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)}}))};var f=this;e.$watch(function(){var t=c(e);if(f.$modelValue!==t){var n=f.$formatters,i=n.length;for(f.$modelValue=t;i--;)t=n[i](t);f.$viewValue!==t&&(f.$viewValue=t,f.$render())}return t})}],Tr=function(){return{require:["ngModel","^?form"],controller:kr,link:function(e,t,n,i){var r=i[0],a=i[1]||hr;a.$addControl(r),e.$on("$destroy",function(){a.$removeControl(r)})}}},Ar=m({require:"ngModel",link:function(e,t,n,i){i.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),Er=function(){return{require:"?ngModel",link:function(e,t,n,i){if(i){n.required=!0;var r=function(e){return n.required&&i.$isEmpty(e)?void i.$setValidity("required",!1):(i.$setValidity("required",!0),e)};i.$formatters.push(r),i.$parsers.unshift(r),n.$observe("required",function(){r(i.$viewValue)})}}}},Dr=function(){return{require:"ngModel",link:function(e,t,i,r){var o=/\/(.*)\//.exec(i.ngList),s=o&&new RegExp(o[1])||i.ngList||",",c=function(e){if(!y(e)){var t=[];return e&&a(e.split(s),function(e){e&&t.push(wi(e))}),t}};r.$parsers.push(c),r.$formatters.push(function(e){return S(e)?e.join(", "):n}),r.$isEmpty=function(e){return!e||!e.length}}}},Ir=/^(true|false|\d+)$/,Pr=function(){return{priority:100,compile:function(e,t){return Ir.test(t.ngValue)?function(e,t,n){n.$set("value",e.$eval(n.ngValue))}:function(e,t,n){e.$watch(n.ngValue,function(e){n.$set("value",e)})}}}},Nr=Kn(functio
t.module("ngSanitize",[]).provider("$sanitize",n),t.module("ngSanitize").filter("linky",["$sanitize",function(e){var n=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,r=/^mailto:/;return function(a,o){function s(e){e&&f.push(i(e))}function c(e,n){f.push("<a "),t.isDefined(o)&&(f.push('target="'),f.push(o),f.push('" ')),f.push('href="'),f.push(e),f.push('">'),s(n),f.push("</a>")}if(!a)return a;for(var l,p,u,d=a,f=[];l=d.match(n);)p=l[0],l[2]==l[3]&&(p="mailto:"+p),u=l.index,s(d.substr(0,u)),c(p,l[0].replace(r,"")),d=d.substring(u+l[0].length);return s(d),e(f.join(""))}}])}(window,window.angular),angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.dropdownToggle","ui.bootstrap.modal","ui.bootstrap.position","ui.bootstrap.bindHtml","ui.bootstrap.tooltip"]),angular.module("ui.bootstrap.tpls",["template/modal/backdrop.html","template/modal/window.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(e,t,n){function i(e){for(var t in e)if(void 0!==a.style[t])return e[t]}var r=function(i,a,o){o=o||{};var s=e.defer(),c=r[o.animation?"animationEndEventName":"transitionEndEventName"],l=function(){n.$apply(function(){i.unbind(c,l),s.resolve(i)})};return c&&i.bind(c,l),t(function(){angular.isString(a)?i.addClass(a):angular.isFunction(a)?a(i):angular.isObject(a)&&i.css(a),c||s.resolve(i)}),s.promise.cancel=function(){c&&i.unbind(c,l),s.reject("Transition cancelled")},s.promise},a=document.createElement("trans"),o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},s={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return r.transitionEndEventName=i(o),r.animationEndEventName=i(s),r}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(e){return{link:function(t,n,i){function r(t){function i(){l===r&&(l=void 0)}var r=e(n,t);return l&&l.cancel(),l=r,r.then(i,i),r}function a(){p?(p=!1,o()):(n.removeClass("collapse").addClass("collapsing"),r({height:n[0].scrollHeight+"px"}).then(o))}function o(){n.removeClass("collapsing"),n.addClass("collapse in"),n.css({height:"auto"})}function s(){if(p)p=!1,c(),n.css({height:0});else{n.css({height:n[0].scrollHeight+"px"});{n[0].offsetWidth}n.removeClass("collapse in").addClass("collapsing"),r({height:0}).then(c)}}function c(){n.removeClass("collapsing"),n.addClass("collapse")}var l,p=!0;t.$watch(i.collapse,function(e){e?s():a()})}}}]),angular.module("ui.bootstrap.dropdownToggle",[]).directive("dropdownToggle",["$document","$location",function(e){var t=null,n=angular.noop;return{restrict:"CA",link:function(i,r){i.$watch("$location.path",function(){n()}),r.parent().bind("click",function(){n()}),r.bind("click",function(i){var a=r===t;i.preventDefault(),i.stopPropagation(),t&&n(),a||r.hasClass("disabled")||r.prop("disabled")||(r.parent().addClass("open"),t=r,n=function(i){i&&(i.preventDefault(),i.stopPropagation()),e.unbind("click",n),r.parent().removeClass("open"),n=angular.noop,t=null},e.bind("click",n))})}}}]),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var e=[];return{add:function(t,n){e.push({key:t,value:n})},get:function(t){for(var n=0;n<e.length;n++)if(t==e[n].key)return e[n]},keys:function(){for(var t=[],n=0;n<e.length;n++)t.push(e[n].key);return t},top:function(){return e[e.length-1]},remove:function(t){for(var n=-1,i=0;i<e.length;i++)if(t==e[i].key){n=i;break}return e.splice(n,1)[0]},removeTop:function(){return e.splice(e.length-1,1)[0]},length:function(){return e.length}}}}}).directive("modalBackdrop",["$timeout",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(t){t.animate=!1,e(function(){t.animate=!0})}}}]).directive("modalWind
var a=_.decrypt.call(this,e,t,r.key,i);return a}})}(),function(){var e=CryptoJS,t=e.lib,n=t.BlockCipher,i=e.algo,r=[],a=[],o=[],s=[],c=[],l=[],p=[],u=[],d=[],f=[];!function(){for(var e=[],t=0;256>t;t++)e[t]=128>t?t<<1:t<<1^283;for(var n=0,i=0,t=0;256>t;t++){var h=i^i<<1^i<<2^i<<3^i<<4;h=h>>>8^255&h^99,r[n]=h,a[h]=n;var g=e[n],m=e[g],y=e[m],v=257*e[h]^16843008*h;o[n]=v<<24|v>>>8,s[n]=v<<16|v>>>16,c[n]=v<<8|v>>>24,l[n]=v;var v=16843009*y^65537*m^257*g^16843008*n;p[h]=v<<24|v>>>8,u[h]=v<<16|v>>>16,d[h]=v<<8|v>>>24,f[h]=v,n?(n=g^e[e[e[y^g]]],i^=e[e[i]]):n=i=1}}();var h=[0,1,2,4,8,16,32,64,128,27,54],g=i.AES=n.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,i=this._nRounds=n+6,a=4*(i+1),o=this._keySchedule=[],s=0;a>s;s++)if(n>s)o[s]=t[s];else{var c=o[s-1];s%n?n>6&&s%n==4&&(c=r[c>>>24]<<24|r[c>>>16&255]<<16|r[c>>>8&255]<<8|r[255&c]):(c=c<<8|c>>>24,c=r[c>>>24]<<24|r[c>>>16&255]<<16|r[c>>>8&255]<<8|r[255&c],c^=h[s/n|0]<<24),o[s]=o[s-n]^c}for(var l=this._invKeySchedule=[],g=0;a>g;g++){var s=a-g;if(g%4)var c=o[s];else var c=o[s-4];l[g]=4>g||4>=s?c:p[r[c>>>24]]^u[r[c>>>16&255]]^d[r[c>>>8&255]]^f[r[255&c]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,c,l,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,p,u,d,f,a);var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,r,a,o,s){for(var c=this._nRounds,l=e[t]^n[0],p=e[t+1]^n[1],u=e[t+2]^n[2],d=e[t+3]^n[3],f=4,h=1;c>h;h++){var g=i[l>>>24]^r[p>>>16&255]^a[u>>>8&255]^o[255&d]^n[f++],m=i[p>>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&l]^n[f++],y=i[u>>>24]^r[d>>>16&255]^a[l>>>8&255]^o[255&p]^n[f++],v=i[d>>>24]^r[l>>>16&255]^a[p>>>8&255]^o[255&u]^n[f++];l=g,p=m,u=y,d=v}var g=(s[l>>>24]<<24|s[p>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^n[f++],m=(s[p>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^n[f++],y=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&p])^n[f++],v=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[p>>>8&255]<<8|s[255&u])^n[f++];e[t]=g,e[t+1]=m,e[t+2]=y,e[t+3]=v},keySize:8});e.AES=n._createHelper(g)}();var sha1;!function(e){function t(e){for(var t,n="",i=7;i>=0;--i)t=e>>>(i<<2)&15,n+=t.toString(16);return n}function n(e){for(var t,n=[],i=3;i>=0;--i)t=e>>8*i&255,n.push(t);return n}function i(e,t){return e<<t|e>>>32-t}function r(e){e=e.replace(/[\u0080-\u07ff]/g,function(e){var t=e.charCodeAt(0);return String.fromCharCode(192|t>>6,128|63&t)}),e=e.replace(/[\u0080-\uffff]/g,function(e){var t=e.charCodeAt(0);return String.fromCharCode(224|t>>12,128|t>>6&63,128|63&t)});for(var t=e.length,n=new Uint8Array(t),i=0;t>i;++i)n[i]=e.charCodeAt(i);return n.buffer}function a(e){for(var t=e.length,n=new Uint8Array(t),i=0;t>i;++i)n[i]=e[i];return n.buffer}function o(e,o){var s;s=e instanceof ArrayBuffer?e:"[object Array]"==Object.prototype.toString.apply(e)?a(e):r(String(e));var p,u,d=1732584193,f=4023233417,h=2562383102,g=271733878,m=3285377520,y=s.byteLength,v=y<<3,_=v+65,b=Math.ceil(_/512)<<9,w=b>>>3,$=w>>>2,S=new l($),M=S.bytes,x=new Uint32Array(80),C=new Uint8Array(s);for(p=0;y>p;++p)M[p]=C[p];for(M[y]=128,S.set($-2,Math.floor(v/c)),S.set($-1,4294967295&v),p=0;$>p;p+=16){for(u=0;16>u;++u)x[u]=S.get(p+u);for(;80>u;++u)x[u]=i(x[u-3]^x[u-8]^x[u-14]^x[u-16],1);var k,T,A,E=d,D=f,I=h,P=g,N=m;for(u=0;80>u;++u)20>u?(k=D&I|~D&P,T=1518500249):40>u?(k=D^I^P,T=1859775393):60>u?(k=D&I^D&P^I&P,T=2400959708):(k=D^I^P,T=3395469782),A=i(E,5)+k+N+T+x[u]&4294967295,N=P,P=I,I=i(D,30),D=E,E=A;d=d+E&4294967295,f=f+D&4294967295,h=h+I&4294967295,g=g+P&4294967295,m=m+N&4294967295}return o?n(d).concat(n(f),n(h),n(g),n(m)):t(d)+t(f)+t(h)+t(g)+t(m)}var s=Math.pow(2,24),c=Math.pow(2,32),l=function(){function e(e){this.bytes=new Uint8Array(e<<2)}return e.prototype.get=function(e){return e<<=2,this.bytes[e]*s+(this.bytes[e+1]<<16|this.bytes[e+2]<<8|this.bytes[e+3])},e.prototype.set=function(e,t){var n=Math.floor(t/s),i=t-n*s;e<<=2,this.bytes[e]=n,this.bytes[e+1]=i>>16,this.bytes[e+2]=i>>8&255,this.bytes[e+3]=255&i},e}();e.hash=o}(sha1||(sha1={})),function(){"use strict";function e(e){throw e}function
},TLSerialization.prototype.getArray=function(){var e=new ArrayBuffer(this.offset),t=new Int32Array(e);return t.set(this.intView.subarray(0,this.offset/4)),t},TLSerialization.prototype.getBuffer=function(){return this.getArray().buffer},TLSerialization.prototype.getBytes=function(){for(var e=[],t=0;t<this.offset;t++)e.push(this.byteView[t]);return e},TLSerialization.prototype.checkLength=function(e){if(!(this.offset+e<this.maxLength)){console.trace("Increase buffer",this.offset,e,this.maxLength),this.maxLength=4*Math.ceil(Math.max(2*this.maxLength,this.offset+e+16)/4);var t=this.buffer,n=new Int32Array(t);this.createBuffer(),new Int32Array(this.buffer).set(n)}},TLSerialization.prototype.writeInt=function(e,t){this.debug&&console.log(">>>",e.toString(16),e,t),this.checkLength(4),this.intView[this.offset/4]=e,this.offset+=4},TLSerialization.prototype.storeInt=function(e,t){this.writeInt(e,(t||"")+":int")},TLSerialization.prototype.storeBool=function(e,t){e?this.writeInt(2574415285,(t||"")+":bool"):this.writeInt(3162085175,(t||"")+":bool")},TLSerialization.prototype.storeLongP=function(e,t,n){this.writeInt(t,(n||"")+":long[low]"),this.writeInt(e,(n||"")+":long[high]")},TLSerialization.prototype.storeLong=function(e,t){if(angular.isArray(e))return 2==e.length?this.storeLongP(e[0],e[1],t):this.storeIntBytes(e,64,t);var n=bigStringInt(e).divideAndRemainder(bigint(4294967296));this.writeInt(intToUint(n[1].intValue()),(t||"")+":long[low]"),this.writeInt(intToUint(n[0].intValue()),(t||"")+":long[high]")},TLSerialization.prototype.storeDouble=function(e){var t=new ArrayBuffer(8),n=new Int32Array(t),i=new Float64Array(t);i[0]=e,this.writeInt(n[0],(field||"")+":double[low]"),this.writeInt(n[1],(field||"")+":double[high]")},TLSerialization.prototype.storeString=function(e,t){this.debug&&console.log(">>>",e,(t||"")+":string");var n=unescape(encodeURIComponent(e));this.checkLength(n.length+8);var i=n.length;253>=i?this.byteView[this.offset++]=i:(this.byteView[this.offset++]=254,this.byteView[this.offset++]=255&i,this.byteView[this.offset++]=(65280&i)>>8,this.byteView[this.offset++]=(16711680&i)>>16);for(var r=0;i>r;r++)this.byteView[this.offset++]=n.charCodeAt(r);for(;this.offset%4;)this.byteView[this.offset++]=0},TLSerialization.prototype.storeBytes=function(e,t){this.debug&&console.log(">>>",bytesToHex(e),(t||"")+":bytes"),this.checkLength(e.length+8);var n=e.length;253>=n?this.byteView[this.offset++]=n:(this.byteView[this.offset++]=254,this.byteView[this.offset++]=255&n,this.byteView[this.offset++]=(65280&n)>>8,this.byteView[this.offset++]=(16711680&n)>>16);for(var i=0;n>i;i++)this.byteView[this.offset++]=e[i];for(;this.offset%4;)this.byteView[this.offset++]=0},TLSerialization.prototype.storeIntBytes=function(e,t,n){var i=e.length;if(t%32||8*i!=t)throw new Error("Invalid bits: "+t+", "+e.length);this.debug&&console.log(">>>",bytesToHex(e),(n||"")+":int"+t),this.checkLength(i);for(var r=0;i>r;r++)this.byteView[this.offset++]=e[r]},TLSerialization.prototype.storeRawBytes=function(e,t){var n=e.length;this.debug&&console.log(">>>",bytesToHex(e),t||""),this.checkLength(n);for(var i=0;n>i;i++)this.byteView[this.offset++]=e[i]},TLSerialization.prototype.storeMethod=function(e,t){var n,i=this.mtproto?Config.Schema.MTProto:Config.Schema.API,r=!1;for(n=0;n<i.methods.length;n++)if(i.methods[n].method==e){r=i.methods[n];break}if(!r)throw new Error("No method "+e+" found");this.storeInt(intToUint(r.id),e+"[id]");var a=this;return angular.forEach(r.params,function(n){a.storeObject(t[n.name],n.type,e+"["+n.name+"]")}),r.type},TLSerialization.prototype.storeObject=function(e,t,n){switch(t){case"int":return this.storeInt(e,n);case"long":return this.storeLong(e,n);case"int128":return this.storeIntBytes(e,128,n);case"int256":return this.storeIntBytes(e,256,n);case"int512":return this.storeIntBytes(e,512,n);case"string":return this.storeString(e,n);case"bytes":return this.storeBytes(e,n);case"double":return this.storeDouble(e,n);case"Bool":return this.storeBool(e,n)}if(angular.isArray(e)){if("Vector"==t.substr(0,6))this.writeInt(481674261,n+"[id]");el
break;case"new_session_created":this.ackMessage(n),this.processMessageAck(e.first_msg_id),this.applyServerSalt(e.server_salt),this.onSessionCreate(i,n);break;case"msgs_ack":for(var a=0;a<e.msg_ids.length;a++)this.processMessageAck(e.msg_ids[a]);break;case"msg_detailed_info":if(!this.sentMessages[e.msg_id]){this.ackMessage(e.answer_msg_id);break}case"msg_new_detailed_info":this.reqResendMessage(e.answer_msg_id);break;case"rpc_result":this.ackMessage(n);var c=e.req_msg_id,o=this.sentMessages[c];if(this.processMessageAck(c),o){var l=o.deferred;if("rpc_error"==e.result._){var p=this.processError(e.result);console.log(dT(),"Rpc error",p),l&&l.reject(p)}else l&&(window._debugMode?console.log(dT(),"Rpc response",e.result):console.log(dT(),"Rpc response",e.result._),o.deferred.resolve(e.result)),o.isAPI&&(this.connectionInited=!0);delete this.sentMessages[c]}break;default:this.ackMessage(n),d&&d(e)}},{getNetworker:function(e,t,n,i){return new u(e,t,n,i)},setUpdatesProcessor:function(e){d=e}}}]).factory("MtpApiManager",["AppConfigManager","MtpAuthorizer","MtpNetworkerFactory","ErrorService","$q",function(e,t,n,i,r){function a(t,n){e.set({dc:t,user_auth:angular.extend({dcID:t},n)}),h=t}function o(){return c("auth.logOut").then(function(){e.remove("dc","user_auth"),h=!1},function(t){e.remove("dc","user_auth"),t&&401!=t.code&&e.remove("dc"+h+"_auth_key"),h=!1,t.handled=!0})}function s(i,a){a=a||{};var o=a.fileUpload||a.fileDownload?d:u;if(!i)throw new Exception("get Networker without dcID");if(void 0!==o[i])return r.when(o[i]);var s="dc"+i+"_auth_key",c="dc"+i+"_server_salt";return e.get(s,c).then(function(l){if(void 0!==o[i])return o[i];var p=l[0],u=l[1];if(p&&512==p.length){var d=bytesFromHex(p),f=bytesFromHex(u);return o[i]=n.getNetworker(i,d,f,a)}return a.createNetworker?t.auth(i).then(function(t){var r={};return r[s]=bytesToHex(t.authKey),r[c]=bytesToHex(t.serverSalt),e.set(r),o[i]=n.getNetworker(i,t.authKey,t.serverSalt,a)},function(e){return console.log("Get networker error",e,e.stack),r.reject(e)}):r.reject({type:"AUTH_KEY_EMPTY",code:401})})}function c(t,n,a){a=a||{};var o,l,p=r.defer(),u=function(e){e?angular.isObject(e)||(e={message:e}):e={type:"ERROR_EMPTY"},p.reject(e),a.noErrorBox||(e.input=t,e.stack=e.stack||g,setTimeout(function(){e.handled||(i.show({error:e}),e.handled=!0)},100))};l=(o=a.dcID)?s(o,a):e.get("dc").then(function(e){return s(o=e||1,a)});var d,g=!1;if(l.then(function(i){return(d=i).wrapApiCall(t,n,a).then(function(e){p.resolve(e)},function(l){if(console.error(dT(),"Error",l.code,l.type,h,o),401==l.code&&h&&o!=h){if(void 0===f[o]){var g=r.defer();c("auth.exportAuthorization",{dc_id:o},{noErrorBox:!0}).then(function(e){c("auth.importAuthorization",{id:e.id,bytes:e.bytes},{dcID:o,noErrorBox:!0}).then(function(){g.resolve()},function(e){g.reject(e)})},function(e){g.reject(e)}),f[o]=g.promise}f[o].then(function(){(d=i).wrapApiCall(t,n,a).then(function(e){p.resolve(e)},function(e){u(e)})},function(e){u(e)})}else if(303==l.code){var m=l.type.match(/^(PHONE_MIGRATE_|NETWORK_MIGRATE_)(\d+)/)[2];m!=o&&(a.dcID?a.dcID=m:e.set({dc:h=m}),s(m,a).then(function(e){e.wrapApiCall(t,n,a).then(function(e){p.resolve(e)},function(e){u(e)})}))}else u(l)})},function(e){u(e)}),!(g=g||(new Error).stack))try{window.unexistingFunction()}catch(m){g=m.stack||""}return p.promise}function l(){return e.get("user_auth").then(function(e){return e.id||0})}function p(){return h||!1}var u={},d={},f={},h=!1;return e.get("dc").then(function(e){e&&(h=e)}),{getBaseDcID:p,getUserID:l,invokeApi:c,setUserAuth:a,logOut:o}}]).factory("MtpApiFileManager",["MtpApiManager","$q","$window",function(e,t,n){function i(e,n,i){void 0===_[e]&&(_[e]=[],b[e]=0);var a=_[e],o=t.defer();return a.push({cb:n,deferred:o,activeDelta:i}),r(e),o.promise}function r(e){var t=_[e];if(b[e]>=w||!t||!t.length)return!1;var n=t.shift(),i=n.activeDelta||1;b[e]+=i;$++;n.cb().then(function(t){b[e]-=i,r(e),n.deferred.resolve(t)},function(t){b[e]-=i,r(e),n.deferred.reject(t)})}function a(){if(h)return h;if(n.requestFileSystem=n.requestFileSystem||n.webkitRequestFileSystem,!n.requestF
return[]}function U(e){var n,i,r=P(e),s=a.getUser(e.from_id),c=a.getUserPhoto(e.from_id,"User"),l={},p=!1;if(e.message)p=e.message;else if(e.media&&"messageMediaEmpty"!=e.media._)switch(e.media._){case"messageMediaPhoto":p="Photo";break;case"messageMediaVideo":p="Video";break;case"messageMediaDocument":p="Document";break;case"messageMediaGeo":p="Location";break;case"messageMediaContact":p="Contact";break;default:p="Attachment"}else if("messageService"==e._)switch(e.action._){case"messageActionChatCreate":p="created the group";break;case"messageActionChatEditTitle":p="changed group name";break;case"messageActionChatEditPhoto":p="changed group photo";break;case"messageActionChatDeletePhoto":p="removed group photo";break;case"messageActionChatAddUser":p="invited user";break;case"messageActionChatDeleteUser":p="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=p,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&&g.notify(l)}):g.notify(l)}var O={},F={},R={},q={},j={count:null,dialogs:[]},H={},z={},V={},W=e.when(),G=-1,X=m.createIndex(),Z={query:!1},K={},Y=[];return g.start(),t.$on("apiUpdate",function(e,n){switch(n._){case"updateMessageID":z[n.id]=n.random_id;break;case"updateNewMessage":var i=n.message,r=P(i),a=q[r];if(void 0!==a){var o=q[r].history[0];if(i.id<=o)return!1}else a=q[r]={count:null,history:[],pending:[]};C([i]),null!==a.count&&a.count++,a.history.unshift(i.id);var c,l=z[i.id];l&&((c=I(l,i))&&t.$broadcast("history_update",{peerID:r}),delete z[i.id]),c||t.$broadcast("history_append",{peerID:r,messageID:i.id});var p,u=B(r);u.length?(p=u[0],j.dialogs.splice(u[1],1)):p={peerID:r,unread_count:0,top_message:!1},!i.out&&i.unread&&p.unread_count++,p.top_message=i.id,m.indexObject(r,s.getPeerSearchText(r),X),j.dialogs.unshift(p),t.$broadcast("dialogs_update",p),t.idle.isIDLE&&!i.out&&i.unread&&g.getPeerMuted(r).then(function(e){i.unread&&!e&&U(i)});break;case"updateReadMessages":var d,i,f,r,u,p,h={};for(f=0;f<n.messages.length;f++)d=n.messages[f],i=O[d],i&&i.unread&&(i.unread=!1,F[d]&&(F[d].unread=!1),R[d]&&(R[d].unread=!1),r=P(i),i.out||(u=B(r),u&&(h[r]=--u[0].unread_count),g.cancel("msg"+d)));angular.forEach(h,function(e,n){t.$broadcast("dialog_unread",{peerID:n,count:e})});break;case"updateDeleteMessages":var d,i,f,r,u,p,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++,g.cancel("msg"+d)),y.count++,y.msgs[d]=!0,F[d]&&(F[d].DELETED=!0,delete F[d]),R[d]&&(R[d].DELETED=!0,delete R[d]),i.DELETED=!0,delete O[d]);angular.forEach(v,function(e,n){var i=B(n);i&&e.unread&&(i[0].unread_count-=e.unread,t.$broadcast("dialog_unread",{peerID:n,count:i[0].unread_count}));var r=q[n];if(void 0!==r){for(var a=[],o=[],s=0;s<r.history.length;s++)e.msgs[r.history[s]]||a.push(r.history[s]);r.history=a;for(var s=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,getHistory:_,getSearch:b,getMessage:w,readHistory:M,flushHistory:x,deleteMessages:$,saveMessages:C,sendText:k,sendFile:T,sendOther:A,forwardMessages:E,getMessagePeer:P,wrapForDialog:N,wrapForHistory:L}}]).service("AppPhotosManager",["$modal","$window","$rootScope","MtpApiFileManager","AppUsersManager",function(e,t,n,i,r){function a(e){u[e.id]=e,angular.forEach(e.sizes,function(e){"photoCachedSize"==e._&&(i.saveSmallFile(e.location,e.bytes),e.size=e.bytes.length,delete e.bytes,e._="photoSize")})}function o(e,t,n){var i={_:"photoSizeEmpty"},r=16777215;return angular.forEach(e.sizes,function(e){var a=Math.abs(e.w*e.h-t*n);r>a&&(i=e,r=a)}),i}function s(e){var t=angular.copy(u[e])||{_:"photoEmpty"}
if(!angular.isString(t)||!t.length)return!1;t=t.replace(/:([a-z0-9\-\+\*_]+?):/gi,function(e,t){var n=$.emojiarea.reverseIcons[t];return void 0!==n?n:e});do a.sendText(e.curDialog.peerID,t.substr(0,4096)),t=t.substr(4096);while(t.length);s(),e.$broadcast("ui_message_send")}),cancelEvent(n)}function s(t){t?i.get("draft"+e.curDialog.peerID).then(function(t){e.draftMessage.text=t||"",e.$broadcast("ui_peer_draft")}):(e.draftMessage.text="",e.$broadcast("ui_peer_draft"))}function c(t){if(a.readHistory(e.curDialog.inputPeer),t&&t.length){var n={};n["draft"+e.curDialog.peerID]=t,i.set(n)}else i.remove("draft"+e.curDialog.peerID)}function l(){n.invokeApi("messages.setTyping",{peer:e.curDialog.inputPeer,typing:!0})}function p(t){if(angular.isArray(t)&&t.length)for(var n=0;n<t.length;n++)a.sendFile(e.curDialog.peerID,t[n],{isMedia:e.draftMessage.isMedia}),e.$broadcast("ui_message_send")}e.$watch("curDialog.peer",s),e.$on("user_update",angular.noop),e.$on("ui_typing",l),e.draftMessage={text:""},e.$watch("draftMessage.text",c),e.$watch("draftMessage.files",p),e.sendMessage=o}]).controller("PhotoModalController",["$q","$scope","$rootScope","$modalInstance","AppPhotosManager","AppMessagesManager","AppPeersManager","PeersSelectService","ErrorService",function(e,t,n,i,r,a,o,s,c){function l(n){var i=m.indexOf(t.messageID),o=i>=0?i+n:0,s=++_,c=o>=m.length?p():e.when();c.then(function(){s==_&&(t.messageID=m[o],t.photoID=a.getMessage(t.messageID).media.photo.id,t.photo=r.wrapForFull(t.photoID),u())})}function p(){return b?b:b=a.getSearch(f,h,g,y).then(function(e){y=e.history[e.history.length-1],m=m.concat(e.history),v=e.history.length||m.length<e.count,u(),b=!1})}function u(){var e=m.indexOf(t.messageID);t.nav.hasNext=v||e<m.length-1,t.nav.hasPrev=e>0}if(t.photo=r.wrapForFull(t.photoID),t.nav={},!t.messageID)return void(t.nav.next=function(){i.close()});var d=a.getMessagePeer(a.getMessage(t.messageID)),f=o.getInputPeerByID(d),h="",g={_:"inputMessagesFilterPhotos"},m=[t.messageID],y=t.messageID,v=!0;u(),a.getSearch(f,h,g,0,1e3).then(function(e){e.history.indexOf(t.messageID)>=0&&(m=e.history,y=m[m.length-1],u())});var _=0,b=!1;t.nav.next=function(){return t.nav.hasNext?void l(1):!1},t.nav.prev=function(){return t.nav.hasPrev?void l(-1):!1},t.forward=function(){var e=t.messageID;s.selectPeer().then(function(t){var i=o.getPeerID(t);a.forwardMessages(i,[e]).then(function(){n.$broadcast("history_focus",{peerString:t})})})},t.delete=function(){var e=t.messageID;c.confirm({type:"MESSAGE_DELETE"}).then(function(){a.deleteMessages([e])})},t.$on("history_delete",function(e,n){if(console.log(dT(),"delete",n),n.peerID==d){if(n.msgs[t.messageID])if(t.nav.hasNext)t.nav.next();else{if(!t.nav.hasPrev)return i.dismiss();t.nav.prev()}for(var r=[],a=0;a<m.length;a++)n.msgs[m[a]]||r.push(m[a]);m=r}})}]).controller("VideoModalController",["$scope","$rootScope","$modalInstance","PeersSelectService","AppMessagesManager","AppVideoManager","AppPeersManager","ErrorService",function(e,t,n,i,r,a,o,s){e.video=a.wrapForFull(e.videoID),e.progress={enabled:!1},e.player={},e.forward=function(){var n=e.messageID;i.selectPeer().then(function(e){var i=o.getPeerID(e);r.forwardMessages(i,[n]).then(function(){t.$broadcast("history_focus",{peerString:e})})})},e.delete=function(){var t=e.messageID;s.confirm({type:"MESSAGE_DELETE"}).then(function(){r.deleteMessages([t])})},e.$on("history_delete",function(t,i){i.msgs[e.messageID]&&n.dismiss()})}]).controller("UserModalController",["$scope","$location","$rootScope","$modal","AppUsersManager","NotificationsManager","AppMessagesManager","AppPeersManager","PeersSelectService","ErrorService",function(e,t,n,i,r,a,o,s,c,l){var p=r.getUserString(e.userID);e.user=r.getUser(e.userID),e.userPhoto=r.getUserPhoto(e.userID,"User"),e.settings={notifications:!0},a.getPeerMuted(e.userID).then(function(t){e.settings.notifications=!t,e.$watch("settings.notifications",function(t,n){return t===n?!1:void a.getPeerSettings(e.userID).then(function(n){n.mute_until=t?0:2e9,a.updatePeerSettings(e.userID,n)})})}),e.goToHistory=function(){n.$broadcast("history
}]),angular.module("myApp.directives",["myApp.filters"]).directive("myDialog",function(){return{restrict:"AE",scope:!0,translude:!1,templateUrl:"partials/dialog.html"}}).directive("myMessage",function(){return{restrict:"AE",scope:!0,translude:!1,templateUrl:"partials/message.html"}}).directive("myDialogsList",["$window","$timeout",function(e,t){function n(n,i,r){function a(){return r.modal?($(i).css({height:$(e).height()-200}),void u()):(c&&c.offsetHeight||(c=$(".tg_page_head")[0]),l&&l.offsetHeight||(l=$(".im_page_footer")[0]),$(i).css({height:$(e).height()-l.offsetHeight-(c?c.offsetHeight:44)-72}),void u())}var o=$(".im_dialogs_wrap",i)[0],s=$(".im_dialogs_scrollable_wrap",i)[0],c=$(".tg_page_head")[0],l=$(".im_page_footer")[0],p=!1;onContentLoaded(function(){$(o).nanoScroller({preventPageScrolling:!0,tabIndex:-1,iOSNativeScrolling:!0})});var u=function(){onContentLoaded(function(){$(o).nanoScroller()})};n.$on("ui_dialogs_prepend",u),n.$on("ui_dialogs_append",function(){onContentLoaded(function(){u(),p=!1,t(function(){$(s).trigger("scroll")})})}),n.$on("ui_dialogs_change",function(){onContentLoaded(function(){u(),p=!1,t(function(){$(s).trigger("scroll")})})}),$(s).on("scroll",function(){!p&&s.scrollTop>=s.scrollHeight-s.clientHeight-300&&(n.$emit("dialogs_need_more"),p=!0)}),$(e).on("resize",a),a(),setTimeout(a,1e3)}return{link:n}}]).directive("myContactsList",["$window","$timeout",function(e){function t(t,n){function i(){$(n).css({height:$(e).height()-(a&&a.offsetHeight||0)-(r&&r.offsetHeight||0)-200}),$(o).nanoScroller()}var r=$(".contacts_modal_search")[0],a=$(".contacts_modal_panel")[0],o=$(".contacts_wrap",n)[0];onContentLoaded(function(){$(o).nanoScroller({preventPageScrolling:!0,tabIndex:-1,iOSNativeScrolling:!0}),i()}),$(e).on("resize",i),t.$on("contacts_change",function(){onContentLoaded(i)})}return{link:t}}]).directive("myHistory",["$window","$timeout","$transition",function(e,t,n){function i(i,r){function a(t){if(r.is(":visible")&&$(r[0].parentNode).is(":visible")){$(h).is(":visible")&&$(h).css({height:$(y).height()}),g&&g.offsetHeight||(g=$(".tg_page_head")[0]),m&&m.offsetHeight||(m=$(".im_page_footer")[0]);var n=$(e).height()-d.offsetHeight-f.offsetHeight-(g?g.offsetHeight:44)-m.offsetHeight;$(s).css({height:n}),$(l).css({minHeight:n-44}),o(),t!==!0&&(C&&onContentLoaded(function(){p.scrollTop=p.scrollHeight,b()}),b(100))}}function o(){$(c).css({marginTop:0}),c.offsetHeight>0&&c.offsetHeight<=p.offsetHeight&&$(c).css({marginTop:p.offsetHeight-c.offsetHeight-20-44+"px"}),$(s).nanoScroller()}var s=$(".im_history_wrap",r)[0],c=$(".im_history_messages",r)[0],l=$(".im_history",r)[0],p=$(".im_history_scrollable_wrap",r)[0],u=$(".im_history_scrollable",r)[0],d=$(".im_history_panel_wrap",r)[0],f=$(".im_bottom_panel_wrap",r)[0],h=$(".im_send_form_wrap",r)[0],g=$(".tg_page_head")[0],m=$(".im_page_footer")[0],y=$(".im_send_form",r)[0],v=!1;onContentLoaded(function(){p.scrollTop=p.scrollHeight,$(s).nanoScroller({preventPageScrolling:!0,tabIndex:-1,iOSNativeScrolling:!0})});var _,b=function(e){t(function(){$(p).hasClass("im_history_to_bottom")||$(s).nanoScroller()},e||0)},w=!1,S=["transform","webkitTransform","MozTransform","msTransform","OTransform"];for(_=0;_<S.length;_++)if(S[_]in c.style){w=S[_];break}var M=w?!0:!1,x=!1;i.$on("ui_history_append",function(e,t){if(C||t.my){M||($(u).css({bottom:0}),$(p).addClass("im_history_to_bottom"));var i=p.scrollHeight;onContentLoaded(function(){if(M){x=!0,$(c).removeClass("im_history_appending"),p.scrollTop=p.scrollHeight,$(c).css(w,"translate(0px, "+(p.scrollHeight-i)+"px)"),$(s).nanoScroller();var e={};e[w]="translate(0px, 0px)",$(c).addClass("im_history_appending"),n($(c),e).then(function(){x=!1,$(c).removeClass("im_history_appending"),o()})}else $(p).removeClass("im_history_to_bottom"),$(u).css({bottom:""}),p.scrollTop=p.scrollHeight,o(),$(s).nanoScroller()})}}),i.$on("ui_history_change",function(){$(p).addClass("im_history_to_bottom"),$(u).css({bottom:0}),onContentLoaded(function(){$(p).removeClass("im_history_to_bottom"),$(u).css({bottom:""}),a(!0);var e=$(".im_message_unr