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.

16 lines
643 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,o){for(;--o>=0;){var a=t*this[e++]+n[i]+r;r=Math.floor(a/67108864),n[i++]=67108863&a}return r}function am2(e,t,n,i,r,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this[e],l=this[e++]>>15,u=s*c+l*a;c=a*c+((32767&u)<<15)+n[i]+(1073741823&r),r=(c>>>30)+(u>>>15)+s*l+(r>>>30),n[i++]=1073741823&c}return r}function am3(e,t,n,i,r,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,u=s*c+l*a;c=a*c+((16383&u)<<14)+n[i]+r,r=(c>>28)+(u>>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,o=!1,a=0;--r>=0;){var s=8==i?255&e[r]:intAt(e,r);0>s?"-"==e.charAt(r)&&(o=!0):(o=!1,0==a?this[this.t++]=s:a+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,a+=i,a>=this.DB&&(a-=this.DB))}8==i&&0!=(128&e[0])&&n&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&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,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-->0)for(s<this.DB&&(n=this[a]>>s)>0&&(r=!0,o=int2char(n));a>=0;)t>s?(n=(this[a]&(1<<s)-1)<<t-s,n|=this[--a]>>(s+=this.DB-t)):(n=this[a]>>(s-=t)&i,0>=s&&(s+=this.DB,--a)),n>0&&(r=!0),r&&(o+=int2char(n));return r?o:"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,o=(1<<r)-1,a=Math.floor(e/this.DB),s=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+a+1]=this[n]>>r|s,s=(this[n]&o)<<i;for(n=a-1;n>=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+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,o=(1<<i)-1;t[0]=this[n]>>i;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<r,t[a-n]=this[a]>>i;i>0&&(t[this.t-n-1]|=(this.s&o)<<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||U(),n=Math.max(0,l.startTime+l.duration-t),i=n/l.duration||0,o=1-i,a=0,c=l.tweens.length;c>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&c?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:ut.extend({},t),opts:ut.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||U(),duration:n.duration,tweens:[],createTween:function(t,n){var i=ut.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}}),u=l.props;for(q(u,l.opts.specialEasing);a>o;o++)if(i=ri[o].call(l,e,u,l.opts))return i;return ut.map(u,O,l),ut.isFunction(l.opts.start)&&l.opts.start.call(e,l),ut.fx.timer(ut.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,o,a;for(n in e)if(i=ut.camelCase(n),r=t[i],o=e[n],ut.isArray(o)&&(r=o[1],o=e[n]=o[0]),n!==i&&(e[i]=o,delete e[n]),a=ut.cssHooks[i],a&&"expand"in a){o=a.expand(o),delete e[i];for(n in o)n in e||(e[n]=o[n],t[n]=r)}else t[i]=r}function j(e,t,n){var i,r,o,a,s,c,l=this,u={},p=e.style,d=e.nodeType&&S(e),f=ut._data(e,"fxshow");n.queue||(s=ut._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--,ut.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===ut.css(e,"display")&&"none"===ut.css(e,"float")&&(ut.support.inlineBlockNeedsLayout&&"inline"!==T(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",ut.support.shrinkWrapBlocks||l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(i in t)if(r=t[i],ti.exec(r)){if(delete t[i],o=o||"toggle"===r,r===(d?"hide":"show"))continue;u[i]=f&&f[i]||ut.style(e,i)}if(!ut.isEmptyObject(u)){f?"hidden"in f&&(d=f.hidden):f=ut._data(e,"fxshow",{}),o&&(f.hidden=!d),d?ut(e).show():l.done(function(){ut(e).hide()}),l.done(function(){var t;ut._removeData(e,"fxshow");for(t in u)ut.style(e,t,u[t])});for(i in u)a=O(d?f[i]:0,i,l),i in f||(f[i]=a.start,d&&(a.end=a.start,a.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=Cn[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function V(e){return ut.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var W,G,K=typeof t,Z=e.location,X=e.document,Y=X.documentElement,Q=e.jQuery,J=e.$,et={},tt=[],nt="1.10.2",it=tt.concat,rt=tt.push,ot=tt.slice,at=tt.indexOf,st=et.toString,ct=et.hasOwnProperty,lt=nt.trim,ut=function(e,t){return new ut.fn.init(e,t,G)},pt=/[+-]?(?:\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){(X.addEventListener||"load"===e.type||"complete"===X.readyState)&&(Ct(),ut.ready())},Ct=function(){X.addEventListener?(X.removeEventListener("DOMContentLoaded",St,!1),e.removeEventListener("load",St,!1)):(X.detachEvent("onreadystatechange",St),e.detachEvent("onload",St))};ut.fn=ut.prototype={jquery:nt,constructor:ut,init:function(e,n,i){var r,o;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 ut?n[0]:n,ut.merge(this,ut.parseHTML(r[1],n&&n.nodeType?n.ownerDocument||n:X,!0)),gt.test(r[1])&&ut.isPlainObject
try{delete p.test}catch(d){t.deleteExpando=!1}r=X.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"),a=X.createDocumentFragment(),a.appendChild(r),t.appendChecked=r.checked,t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,p.attachEvent&&(p.attachEvent("onclick",function(){t.noCloneEvent=!1}),p.cloneNode(!0).click());for(u in{submit:!0,change:!0,focusin:!0})p.setAttribute(c="on"+u,"t"),t[u+"Bubbles"]=c in e||p.attributes[c].expando===!1;p.style.backgroundClip="content-box",p.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===p.style.backgroundClip;for(u in ut(t))break;return t.ownLast="0"!==u,ut(function(){var n,i,r,o="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",a=X.getElementsByTagName("body")[0];a&&(n=X.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(p),p.innerHTML="<table><tr><td></td><td>t</td></tr></table>",r=p.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,p.innerHTML="",p.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%;",ut.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===p.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(p,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(p,null)||{width:"4px"}).width,i=p.appendChild(X.createElement("div")),i.style.cssText=p.style.cssText=o,i.style.marginRight=i.style.width="0",p.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)),typeof p.style.zoom!==K&&(p.innerHTML="",p.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===p.offsetWidth,p.style.display="block",p.innerHTML="<div></div>",p.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==p.offsetWidth,t.inlineBlockNeedsLayout&&(a.style.zoom=1)),a.removeChild(n),n=p=r=i=null)}),n=o=a=s=i=r=null,t}({});var Mt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,xt=/([A-Z])/g;ut.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ut.cache[e[ut.expando]]:e[ut.expando],!!e&&!s(e)},data:function(e,t,n){return r(e,t,n)},removeData:function(e,t){return o(e,t)},_data:function(e,t,n){return r(e,t,n,!0)},_removeData:function(e,t){return o(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&ut.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),ut.fn.extend({data:function(e,n){var i,r,o=null,s=0,c=this[0];if(e===t){if(this.length&&(o=ut.data(c),1===c.nodeType&&!ut._data(c,"parsedAttrs"))){for(i=c.attributes;i.length>s;s++)r=i[s].name,0===r.indexOf("data-")&&(r=ut.camelCase(r.slice(5)),a(c,r,o[r]));ut._data(c,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){ut.data(this,e)}):arguments.length>1?this.each(function(){ut.data(this,e,n)}):c?a(c,e,ut.data(c,e)):null},removeData:function(e){return this.each(function(){ut.removeData(this,e)})}}),ut.extend({queue:function(e,n,i){var r;return e?(n=(n||"fx")+"queue",r=ut._data(e,n),i&&(!r||ut.isArray(i)?r=ut._data(e,n,ut.makeArray(i)):r.push(i)),r||[]):t},dequeue:function(e,t){t=t||"fx";var n=ut.queue(e,t),i=n.length,r=n.shift(),o=ut._queueHooks(e,t),a=function(){ut.dequeue(e,t)};"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete o.stop,r.call(e,a,o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ut._data(e,n)||ut._data(e,n,{empty:ut.Callbacks("once memory").add(function(){
return this.each(function(n){ut(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){ut.nodeName(this,"body")||ut(this).replaceWith(this.childNodes)}).end()}});var un,pn,dn,fn=/alpha\([^)]*\)/i,hn=/opacity\s*=\s*([^)]*)/,gn=/^(top|right|bottom|left)$/,mn=/^(none|table(?!-c[ea]).+)/,yn=/^margin/,vn=RegExp("^("+pt+")(.*)$","i"),_n=RegExp("^("+pt+")(?!px)[a-z%]+$","i"),bn=RegExp("^([+-])=("+pt+")","i"),wn={BODY:"block"},$n={position:"absolute",visibility:"hidden",display:"block"},Sn={letterSpacing:0,fontWeight:400},Cn=["Top","Right","Bottom","Left"],kn=["Webkit","O","Moz","ms"];ut.fn.extend({css:function(e,n){return ut.access(this,function(e,n,i){var r,o,a={},s=0;if(ut.isArray(n)){for(o=pn(e),r=n.length;r>s;s++)a[n[s]]=ut.css(e,n[s],!1,o);return a}return i!==t?ut.style(e,n,i):ut.css(e,n)},e,n,arguments.length>1)},show:function(){return C(this,!0)},hide:function(){return C(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){S(this)?ut(this).show():ut(this).hide()})}}),ut.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":ut.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,i,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,c=ut.camelCase(n),l=e.style;if(n=ut.cssProps[c]||(ut.cssProps[c]=$(l,c)),s=ut.cssHooks[n]||ut.cssHooks[c],i===t)return s&&"get"in s&&(o=s.get(e,!1,r))!==t?o:l[n];if(a=typeof i,"string"===a&&(o=bn.exec(i))&&(i=(o[1]+1)*o[2]+parseFloat(ut.css(e,n)),a="number"),!(null==i||"number"===a&&isNaN(i)||("number"!==a||ut.cssNumber[c]||(i+="px"),ut.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(u){}}},css:function(e,n,i,r){var o,a,s,c=ut.camelCase(n);return n=ut.cssProps[c]||(ut.cssProps[c]=$(e.style,c)),s=ut.cssHooks[n]||ut.cssHooks[c],s&&"get"in s&&(a=s.get(e,!0,i)),a===t&&(a=dn(e,n,r)),"normal"===a&&n in Sn&&(a=Sn[n]),""===i||i?(o=parseFloat(a),i===!0||ut.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(pn=function(t){return e.getComputedStyle(t,null)},dn=function(e,n,i){var r,o,a,s=i||pn(e),c=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==c||ut.contains(e.ownerDocument,e)||(c=ut.style(e,n)),_n.test(c)&&yn.test(n)&&(r=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=c,c=s.width,l.width=r,l.minWidth=o,l.maxWidth=a)),c}):X.documentElement.currentStyle&&(pn=function(e){return e.currentStyle},dn=function(e,n,i){var r,o,a,s=i||pn(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,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":c,c=l.pixelLeft+"px",l.left=r,a&&(o.left=a)),""===c?"auto":c}),ut.each(["height","width"],function(e,n){ut.cssHooks[n]={get:function(e,i,r){return i?0===e.offsetWidth&&mn.test(ut.css(e,"display"))?ut.swap(e,$n,function(){return x(e,n,r)}):x(e,n,r):t},set:function(e,t,i){var r=i&&pn(e);return k(e,t,i?M(e,n,i,ut.support.boxSizing&&"border-box"===ut.css(e,"boxSizing",!1,r),r):0)}}}),ut.support.opacity||(ut.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=ut.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=i&&i.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===ut.trim(o.replace(fn,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||i&&!i.filter)||(n.filter=fn.test(o)?o.replace(fn,r):o+" "+r)}}),ut(function(){ut.support.reliableMarginRight||(ut.cssHooks.marginRight={get:function(e,n){return n?ut.swap(e,{display:"inline-block"},dn,[e,"marginRight"]):t}}),!ut.support.pixelPosition&&ut.fn.position&&ut.each(["top","left"],function(e,n){ut.cssHooks[n]={get:function(e,i){return i?(i=dn(e,n),_n.test(i)?ut(e).position()[n]+"px":i):t}}})}),ut.expr&&ut.expr.filters&&(ut.
}catch(e){console.error("CJ protection",e)}if(window.safeConfirm=function(e,t){"string"==typeof e&&(e={message:e});var n=!1;try{n=confirm(e.message)}catch(i){n=!0}setTimeout(function(){t(n)},10)},window.applicationCache&&!Config.Modes.packed&&window.addEventListener){var t=window.applicationCache,n=!1,i=!1,r=function(e){clearTimeout(i),i=setTimeout(function(){try{t.update()}catch(e){console.log("appCache.update: "+e)}},e||3e5)},o=function(){t.addEventListener("updateready",function(){t.status==t.UPDATEREADY&&(n||(safeConfirm({type:"WEBOGRAM_UPDATED_RELOAD",message:"A new version of Webogram is downloaded. Launch it?"},function(e){e?window.location.reload():n=!0}),r()))},!1),t.addEventListener("noupdate",function(){r()},!1),t.addEventListener("error",function(){r()},!1)};r(3e3),window.addEventListener("load",o)}}(),function(e,t,n){"use strict";var i,r,o,a,s,c,l,u,p,d,f,h,g,m,y,v,_,b,w,$,S,C,k,M,x,T,E,A,I;S={paneClass:"pane",sliderClass:"slider",contentClass:"content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null,documentContext:null,windowContext:null},v="scrollbar",y="scroll",u="mousedown",p="mousemove",f="mousewheel",d="mouseup",m="resize",s="drag",b="up",g="panedown",o="DOMMouseScroll",a="down",w="wheel",c="keydown",l="keyup",_="touchmove",i="Microsoft Internet Explorer"===t.navigator.appName&&/msie 7./i.test(t.navigator.appVersion)&&t.ActiveXObject,r=null,x=t.requestAnimationFrame,$=t.cancelAnimationFrame,E=n.createElement("div").style,I=function(){var e,t,n,i,r,o;for(i=["t","webkitT","MozT","msT","OT"],e=r=0,o=i.length;o>r;e=++r)if(n=i[e],t=i[e]+"ransform",t in E)return i[e].substr(0,i[e].length-1);return!1}(),A=function(e){return I===!1?!1:""===I?e:I+e.charAt(0).toUpperCase()+e.substr(1)},T=A("transform"),k=T!==!1,C=function(){var e,t,i;return e=n.createElement("div"),t=e.style,t.position="absolute",t.width="100px",t.height="100px",t.overflow=y,t.top="-9999px",n.body.appendChild(e),i=e.offsetWidth-e.clientWidth,n.body.removeChild(e),i},M=function(){var e,n,i;return n=t.navigator.userAgent,(e=/(?=.+Mac OS X)(?=.+Firefox)/.test(n))?(i=/Firefox\/\d{2}\./.exec(n),i&&(i=i[0].replace(/\D+/g,"")),e&&+i>23):!1},h=function(){function c(i,o){this.el=i,this.options=o,r||(r=C()),this.$el=e(this.el),this.doc=e(this.options.documentContext||n),this.win=e(this.options.windowContext||t),this.$content=this.$el.children("."+o.contentClass),this.$content.attr("tabindex",this.options.tabIndex||0),this.content=this.$content[0],this.options.iOSNativeScrolling&&null!=this.el.style.WebkitOverflowScrolling?this.nativeScrolling():this.generate(),this.createEvents(),this.addEvents(),this.reset()}return c.prototype.preventScrolling=function(e,t){if(this.isActive)if(e.type===o)(t===a&&e.originalEvent.detail>0||t===b&&e.originalEvent.detail<0)&&e.preventDefault();else if(e.type===f){if(!e.originalEvent||!e.originalEvent.wheelDelta)return;(t===a&&e.originalEvent.wheelDelta<0||t===b&&e.originalEvent.wheelDelta>0)&&e.preventDefault()}},c.prototype.nativeScrolling=function(){this.$content.css({WebkitOverflowScrolling:"touch"}),this.iOSNativeScrolling=!0,this.isActive=!0},c.prototype.updateScrollValues=function(){var e;e=this.content,this.maxScrollTop=e.scrollHeight-e.clientHeight,this.prevScrollTop=this.contentScrollTop||0,this.contentScrollTop=e.scrollTop,this.iOSNativeScrolling||(this.maxSliderTop=this.paneHeight-this.sliderHeight,this.sliderTop=0===this.maxScrollTop?0:this.contentScrollTop*this.maxSliderTop/this.maxScrollTop)},c.prototype.setOnScrollStyles=function(){var e,t=this;k?(e={},e[T]="translate(0, "+this.sliderTop+"px)"):e={top:this.sliderTop},x?this.scrollRAF||(this.scrollRAF=x(function(){t.scrollRAF=null,t.slider.css(e)})):this.slider.css(e)},c.prototype.createEvents=function(){var e=this;this.events={down:function(t){return e.isBeingDragged=!0,e.offsetY=t.pageY-e.slider.offset().top,e.pane.addClass("active"),e.doc.bind(p,e.events[s]).bind(d,e.events[b]),!1},drag:function(t){return e.sliderY=t.pageY-e.$el.offset().top-e.offsetY,e.scroll(),e.updat
})}function bt(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");o(t.split(" "),function(e){e=wi(e),-1===n.indexOf(" "+e+" ")&&(n+=e+" ")}),e.setAttribute("class",wi(n))}}function wt(e,t){if(t){t=t.nodeName||!v(t.length)||M(t)?[t]:t;for(var n=0;n<t.length;n++)e.push(t[n])}}function $t(e,t){return St(e,"$"+(t||"ngController")+"Controller")}function St(e,t,i){e=pi(e),9==e[0].nodeType&&(e=e.find("html"));for(var r=S(t)?t:[t];e.length;){for(var o=0,a=r.length;a>o;o++)if((i=e.data(r[o]))!==n)return i;e=e.parent()}}function Ct(e){for(var t=0,n=e.childNodes;t<n.length;t++)ft(n[t]);for(;e.firstChild;)e.removeChild(e.firstChild)}function kt(e,t){var n=Pi[t.toLowerCase()];return n&&Ni[e.nodeName]&&n}function Mt(e,n){var i=function(i,r){if(i.preventDefault||(i.preventDefault=function(){i.returnValue=!1}),i.stopPropagation||(i.stopPropagation=function(){i.cancelBubble=!0}),i.target||(i.target=i.srcElement||t),y(i.defaultPrevented)){var a=i.preventDefault;i.preventDefault=function(){i.defaultPrevented=!0,a.call(i)},i.defaultPrevented=!1}i.isDefaultPrevented=function(){return i.defaultPrevented||i.returnValue===!1};var s=L(n[r||i.type]||[]);o(s,function(t){t.call(e,i)}),8>=ui?(i.preventDefault=null,i.stopPropagation=null,i.isDefaultPrevented=null):(delete i.preventDefault,delete i.stopPropagation,delete i.isDefaultPrevented)};return i.elem=e,i}function xt(e){var t,i=typeof e;return"object"==i&&null!==e?"function"==typeof(t=e.$$hashKey)?t=e.$$hashKey():t===n&&(t=e.$$hashKey=l()):t=e,i+":"+t}function Tt(e){o(e,this.put,this)}function Et(e){var t,n,i,r;return"function"==typeof e?(t=e.$inject)||(t=[],e.length&&(n=e.toString().replace(Ui,""),i=n.match(Li),o(i[1].split(Bi),function(e){e.replace(Fi,function(e,n,i){t.push(i)})})),e.$inject=t):S(e)?(r=e.length-1,nt(e[r],"fn"),t=e.slice(0,r)):nt(e,"fn",!0),t}function At(e){function t(e){return function(t,n){return _(t)?void o(t,c(e)):e(t,n)}}function n(e,t){if(it(e,"service"),(C(t)||S(t))&&(t=w.instantiate(t)),!t.$get)throw Oi("pget","Provider '{0}' must define $get factory method.",e);return v[e+f]=t}function i(e,t){return n(e,{$get:t})}function r(e,t){return i(e,["$injector",function(e){return e.instantiate(t)}])}function a(e,t){return i(e,m(t))}function s(e,t){it(e,"constant"),v[e]=t,$[e]=t}function l(e,t){var n=w.get(e+f),i=n.$get;n.$get=function(){var e=k.invoke(i,n);return k.invoke(t,null,{$delegate:e})}}function u(e){var t,n,i,r,a=[];return o(e,function(e){if(!y.get(e)){y.put(e,!0);try{if(b(e))for(t=fi(e),a=a.concat(u(t.requires)).concat(t._runBlocks),n=t._invokeQueue,i=0,r=n.length;r>i;i++){var o=n[i],s=w.get(o[0]);s[o[1]].apply(s,o[2])}else C(e)?a.push(w.invoke(e)):S(e)?a.push(w.invoke(e)):nt(e,"module")}catch(c){throw S(e)&&(e=e[e.length-1]),c.message&&c.stack&&-1==c.stack.indexOf(c.message)&&(c=c.message+"\n"+c.stack),Oi("modulerr","Failed to instantiate module {0} due to:\n{1}",e,c.stack||c.message||c)}}}),a}function p(e,t){function n(n){if(e.hasOwnProperty(n)){if(e[n]===d)throw Oi("cdep","Circular dependency found: {0}",g.join(" <- "));return e[n]}try{return g.unshift(n),e[n]=d,e[n]=t(n)}catch(i){throw e[n]===d&&delete e[n],i}finally{g.shift()}}function i(e,t,i){var r,o,a,s=[],c=Et(e);for(o=0,r=c.length;r>o;o++){if(a=c[o],"string"!=typeof a)throw Oi("itkn","Incorrect injection token! Expected service name as string, got {0}",a);s.push(i&&i.hasOwnProperty(a)?i[a]:n(a))}return e.$inject||(e=e[r]),e.apply(t,s)}function r(e,t){var n,r,o=function(){};return o.prototype=(S(e)?e[e.length-1]:e).prototype,n=new o,r=i(e,n,t),_(r)||C(r)?r:n}return{invoke:i,instantiate:r,get:n,annotate:Et,has:function(t){return v.hasOwnProperty(t+f)||e.hasOwnProperty(t)}}}var d={},f="Provider",g=[],y=new Tt,v={$provide:{provider:t(n),factory:t(i),service:t(r),value:t(a),constant:t(s),decorator:l}},w=v.$injector=p(v,function(){throw Oi("unpr","Unknown provider: {0}",g.join(" <- "))}),$={},k=$.$injector=p($,function(e){var t=w.get(e+f);return k.invoke(t.$get,t)});return o(u(e),function(e){k.invoke(e||h)}),k}function It(){var e=!0;this.disableAutoScrolling=function()
return e}function gn(e,t){if(e){if(e.constructor===e)throw Zi("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e.document&&e.location&&e.alert&&e.setInterval)throw Zi("isecwindow","Referencing the Window in Angular expressions is disallowed! Expression: {0}",t);if(e.children&&(e.nodeName||e.on&&e.find))throw Zi("isecdom","Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}",t)}return e}function mn(e,t,i,r,o){o=o||{};for(var a,s=t.split("."),c=0;s.length>1;c++){a=hn(s.shift(),r);var l=e[a];l||(l={},e[a]=l),e=l,e.then&&o.unwrapPromises&&(Ki(r),"$$v"in e||!function(e){e.then(function(t){e.$$v=t})}(e),e.$$v===n&&(e.$$v={}),e=e.$$v)}return a=hn(s.shift(),r),e[a]=i,i}function yn(e,t,i,r,o,a,s){return hn(e,a),hn(t,a),hn(i,a),hn(r,a),hn(o,a),s.unwrapPromises?function(s,c){var l,u=c&&c.hasOwnProperty(e)?c:s;return null==u?u:(u=u[e],u&&u.then&&(Ki(a),"$$v"in u||(l=u,l.$$v=n,l.then(function(e){l.$$v=e})),u=u.$$v),t?null==u?n:(u=u[t],u&&u.then&&(Ki(a),"$$v"in u||(l=u,l.$$v=n,l.then(function(e){l.$$v=e})),u=u.$$v),i?null==u?n:(u=u[i],u&&u.then&&(Ki(a),"$$v"in u||(l=u,l.$$v=n,l.then(function(e){l.$$v=e})),u=u.$$v),r?null==u?n:(u=u[r],u&&u.then&&(Ki(a),"$$v"in u||(l=u,l.$$v=n,l.then(function(e){l.$$v=e})),u=u.$$v),o?null==u?n:(u=u[o],u&&u.then&&(Ki(a),"$$v"in u||(l=u,l.$$v=n,l.then(function(e){l.$$v=e})),u=u.$$v),u):u):u):u):u)}:function(a,s){var c=s&&s.hasOwnProperty(e)?s:a;return null==c?c:(c=c[e],t?null==c?n:(c=c[t],i?null==c?n:(c=c[i],r?null==c?n:(c=c[r],o?null==c?n:c=c[o]:c):c):c):c)}}function vn(e,t){return hn(e,t),function(t,i){return null==t?n:(i&&i.hasOwnProperty(e)?i:t)[e]}}function _n(e,t,i){return hn(e,i),hn(t,i),function(i,r){return null==i?n:(i=(r&&r.hasOwnProperty(e)?r:i)[e],null==i?n:i[t])}}function bn(e,t,i){if(tr.hasOwnProperty(e))return tr[e];var r,a=e.split("."),s=a.length;if(t.unwrapPromises||1!==s)if(t.unwrapPromises||2!==s)if(t.csp)r=6>s?yn(a[0],a[1],a[2],a[3],a[4],i,t):function(e,r){var o,c=0;do o=yn(a[c++],a[c++],a[c++],a[c++],a[c++],i,t)(e,r),r=n,e=o;while(s>c);return o};else{var c="var p;\n";o(a,function(e,n){hn(e,i),c+="if(s == null) return undefined;\ns="+(n?"s":'((k&&k.hasOwnProperty("'+e+'"))?k:s)')+'["'+e+'"];\n'+(t.unwrapPromises?'if (s && s.then) {\n pw("'+i.replace(/(["\r\n])/g,"\\$1")+'");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n':"")}),c+="return s;";var l=new Function("s","k","pw",c);l.toString=m(c),r=t.unwrapPromises?function(e,t){return l(e,t,Ki)}:l}else r=_n(a[0],a[1],i);else r=vn(a[0],i);return"hasOwnProperty"!==e&&(tr[e]=r),r}function wn(){var e={},t={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0};this.unwrapPromises=function(e){return v(e)?(t.unwrapPromises=!!e,this):t.unwrapPromises},this.logPromiseWarnings=function(e){return v(e)?(t.logPromiseWarnings=e,this):t.logPromiseWarnings},this.$get=["$filter","$sniffer","$log",function(n,i,r){return t.csp=i.csp,Ki=function(e){t.logPromiseWarnings&&!Xi.hasOwnProperty(e)&&(Xi[e]=!0,r.warn("[$parse] Promise found in the expression `"+e+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))},function(i){var r;switch(typeof i){case"string":if(e.hasOwnProperty(i))return e[i];var o=new Ji(t),a=new er(o,n,t);return r=a.parse(i,!1),"hasOwnProperty"!==i&&(e[i]=r),r;case"function":return i;default:return h}}}]}function $n(){this.$get=["$rootScope","$exceptionHandler",function(e,t){return Sn(function(t){e.$evalAsync(t)},t)}]}function Sn(e,t){function i(e){return e}function r(e){return l(e)}function a(e){var t=s(),n=0,i=S(e)?[]:{};return o(e,function(e,r){n++,c(e).then(function(e){i.hasOwnProperty(r)||(i[r]=e,--n||t.resolve(i))},function(e){i.hasOwnProperty(r)||t.reject(e)})}),0===n&&t.resolve(i),t.promise}var s=function(){var o,a,u=[];return a={resolve:function(t){if(u){var i=u;u=n,o=c(t),i.length&&e(function(){for(var e,t=0,n=i.length;n>t;t++)e=i[t],o.then(e[0],e[1],e[2])})}},reject:function(e){a.resolve(l(e))},notify:function(t){if(u){var n=u;u.length&&e(function(){for(var e,i=0,r=n.length;r>i;i++)e=n[i],e[
},leave:function(t,n){t.remove(),n&&e(n,0,!1)},move:function(e,t,n,i){this.enter(e,t,n,i)},addClass:function(t,n,i){n=b(n)?n:S(n)?n.join(" "):"",o(t,function(e){bt(e,n)}),i&&e(i,0,!1)},removeClass:function(t,n,i){n=b(n)?n:S(n)?n.join(" "):"",o(t,function(e){_t(e,n)}),i&&e(i,0,!1)},enabled:h}}]}],ji=i("$compile");Bt.$inject=["$provide","$$sanitizeUriProvider"];var Hi=/^(x[\:\-_]|data[\:\-_])/i,zi=i("$interpolate"),Vi=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,Wi={http:80,https:443,ftp:21},Gi=i("$location");ln.prototype=cn.prototype=sn.prototype={$$html5:!1,$$replace:!1,absUrl:un("$$absUrl"),url:function(e,t){if(y(e))return this.$$url;var n=Vi.exec(e);return n[1]&&this.path(decodeURIComponent(n[1])),(n[2]||n[1])&&this.search(n[3]||""),this.hash(n[5]||"",t),this},protocol:un("$$protocol"),host:un("$$host"),port:un("$$port"),path:pn("$$path",function(e){return"/"==e.charAt(0)?e:"/"+e}),search:function(e,t){switch(arguments.length){case 0:return this.$$search;case 1:if(b(e))this.$$search=G(e);else{if(!_(e))throw Gi("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");this.$$search=e}break;default:y(t)||null===t?delete this.$$search[e]:this.$$search[e]=t}return this.$$compose(),this},hash:pn("$$hash",g),replace:function(){return this.$$replace=!0,this}};var Ki,Zi=i("$parse"),Xi={},Yi={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:h,"+":function(e,t,i,r){return i=i(e,t),r=r(e,t),v(i)?v(r)?i+r:i:v(r)?r:n},"-":function(e,t,n,i){return n=n(e,t),i=i(e,t),(v(n)?n:0)-(v(i)?i:0)},"*":function(e,t,n,i){return n(e,t)*i(e,t)},"/":function(e,t,n,i){return n(e,t)/i(e,t)},"%":function(e,t,n,i){return n(e,t)%i(e,t)},"^":function(e,t,n,i){return n(e,t)^i(e,t)},"=":h,"===":function(e,t,n,i){return n(e,t)===i(e,t)},"!==":function(e,t,n,i){return n(e,t)!==i(e,t)},"==":function(e,t,n,i){return n(e,t)==i(e,t)},"!=":function(e,t,n,i){return n(e,t)!=i(e,t)},"<":function(e,t,n,i){return n(e,t)<i(e,t)},">":function(e,t,n,i){return n(e,t)>i(e,t)},"<=":function(e,t,n,i){return n(e,t)<=i(e,t)},">=":function(e,t,n,i){return n(e,t)>=i(e,t)},"&&":function(e,t,n,i){return n(e,t)&&i(e,t)},"||":function(e,t,n,i){return n(e,t)||i(e,t)},"&":function(e,t,n,i){return n(e,t)&i(e,t)},"|":function(e,t,n,i){return i(e,t)(e,t,n(e,t))},"!":function(e,t,n){return!n(e,t)}},Qi={n:"\n",f:"\f",r:"\r",t:" ",v:" ","'":"'",'"':'"'},Ji=function(e){this.options=e};Ji.prototype={constructor:Ji,lex:function(e){this.text=e,this.index=0,this.ch=n,this.lastCh=":",this.tokens=[];for(var t,i=[];this.index<this.text.length;){if(this.ch=this.text.charAt(this.index),this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent(),this.was("{,")&&"{"===i[0]&&(t=this.tokens[this.tokens.length-1])&&(t.json=-1===t.text.indexOf("."));else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch,json:this.was(":[,")&&this.is("{[")||this.is("}]:,")}),this.is("{[")&&i.unshift(this.ch),this.is("}]")&&i.shift(),this.index++;else{if(this.isWhitespace(this.ch)){this.index++;continue}var r=this.ch+this.peek(),o=r+this.peek(2),a=Yi[this.ch],s=Yi[r],c=Yi[o];c?(this.tokens.push({index:this.index,text:o,fn:c}),this.index+=3):s?(this.tokens.push({index:this.index,text:r,fn:s}),this.index+=2):a?(this.tokens.push({index:this.index,text:this.ch,fn:a,json:this.was("[,:")&&this.is("+-")}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}this.lastCh=this.ch}return this.tokens},is:function(e){return-1!==e.indexOf(this.ch)},was:function(e){return-1!==e.indexOf(this.lastCh)},peek:function(e){var t=e||1;return this.index+t<this.text.length?this.text.charAt(this.index+t):!1},isNumber:function(e){return e>="0"&&"9">=e},isWhitespace:function(e){return" "===e||"\r"===e||" "===e||"\n"===e||" "===e||" "===e},isIdent:function(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e||"$"===e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,
a.provider("$routeParams",i),a.directive("ngView",r),a.directive("ngView",o),r.$inject=["$route","$anchorScroll","$animate"],o.$inject=["$compile","$controller","$route"]}(window,window.angular),function(e,t,n){"use strict";t.module("ngAnimate",["ng"]).factory("$$animateReflow",["$window","$timeout",function(e,t){var n=e.requestAnimationFrame||e.webkitRequestAnimationFrame||function(e){return t(e,10,!1)},i=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||function(e){return t.cancel(e)};return function(e){var t=n(e);return function(){i(t)}}}]).config(["$provide","$animateProvider",function(i,r){function o(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.nodeType==u)return n}}function a(e,t){return o(e)==o(t)}var s=t.noop,c=t.forEach,l=r.$$selectors,u=1,p="$$ngAnimateState",d="ng-animate",f={running:!0};i.decorator("$animate",["$delegate","$injector","$sniffer","$rootElement","$timeout","$rootScope","$document",function(e,n,i,u,h,g){function m(e){return h(e,0,!1)}function y(e){if(e){var t=[],r={},o=e.substr(1).split(".");(i.transitions||i.animations)&&o.push("");for(var a=0;a<o.length;a++){var s=o[a],c=l[s];c&&!r[s]&&(t.push(n.get(c)),r[s]=!0)}return t}}function v(e,t,n,i,r,a,l){function u(e){if(k(),e===!0)return void M();var t=n.data(p);t&&(t.done=M,n.data(p,t)),f(N,"after",M)}function f(i,r,o){function a(e,t){var n=t+"Complete",r=i[e];r[n]=!0,(r[l]||s)();for(var a=0;a<i.length;a++)if(!i[a][n])return;o()}"after"==r?_():v();var l=r+"End";c(i,function(i,o){var s=function(){a(o,r)};return"before"!=r||"enter"!=e&&"move"!=e?void(i[r]?i[l]=D?i[r](n,t,s):i[r](n,s):s()):void s()})}function g(i){n.triggerHandler("$animate:"+i,{event:e,className:t})}function v(){m(function(){g("before")})}function _(){m(function(){g("after")})}function S(){l&&m(l)}function k(){k.hasBeenRun||(k.hasBeenRun=!0,a())}function M(){if(!M.hasBeenRun){M.hasBeenRun=!0;var e=n.data(p);e&&(D?w(n):(e.closeAnimationTimeout=m(function(){w(n)}),n.data(p,e))),S()}}var x,T,E=o(n);if(E&&(x=E.className,T=x+" "+t),!E||!C(T))return k(),v(),_(),void M();var A=(" "+T).replace(/\s+/g,".");i||(i=r?r.parent():n.parent());var I=y(A),D="addClass"==e||"removeClass"==e,P=n.data(p)||{};if($(n,i)||0===I.length)return k(),v(),_(),void M();var N=[],L=D?!(P.disabled||P.running&&P.structural):!0;if(L&&c(I,function(i){if(!i.allowCancel||i.allowCancel(n,e,t)){var r,o=i[e];"leave"==e?(r=o,o=null):r=i["before"+e.charAt(0).toUpperCase()+e.substr(1)],N.push({before:r,after:o})}}),0===N.length)return k(),v(),_(),void S();var B=" ",F=B+x+B;if(P.running){h.cancel(P.closeAnimationTimeout),w(n),b(P.animations);var U=D&&!P.structural,O=U&&P.className==t&&e!=P.event;P.beforeComplete||O?(P.done||s)(!0):U&&(F="removeClass"==P.event?F.replace(B+P.className+B,B):F+P.className+B)}var R=B+t+B;return"addClass"==e&&F.indexOf(R)>=0||"removeClass"==e&&-1==F.indexOf(R)?(k(),v(),_(),void S()):(n.addClass(d),n.data(p,{running:!0,event:e,className:t,structural:!D,animations:N,done:u}),void f(N,"before",u))}function _(e){var n=o(e);c(n.querySelectorAll("."+d),function(e){e=t.element(e);var n=e.data(p);n&&(b(n.animations),w(e))})}function b(e){var t=!0;c(e,function(e){e.beforeComplete||(e.beforeEnd||s)(t),e.afterComplete||(e.afterEnd||s)(t)})}function w(e){a(e,u)?f.disabled||(f.running=!1,f.structural=!1):(e.removeClass(d),e.removeData(p))}function $(e,t){if(f.disabled)return!0;if(a(e,u))return f.disabled||f.running;do{if(0===t.length)break;var n=a(t,u),i=n?f:t.data(p),r=i&&(!!i.disabled||!!i.running);if(n||r)return r;if(n)return!0}while(t=t.parent());return!0}u.data(p,f),g.$$postDigest(function(){g.$$postDigest(function(){f.running=!1})});var S=r.classNameFilter(),C=S?function(e){return S.test(e)}:function(){return!0};return{enter:function(t,n,i,r){this.enabled(!1,t),e.enter(t,n,i),g.$$postDigest(function(){v("enter","ng-enter",t,n,i,s,r)})},leave:function(t,n){_(t),this.enabled(!1,t),g.$$postDigest(function(){v("leave","ng-leave",t,null,null,function(){e.leave(t)},n)})},move:function(t,n,i,r){_(t),this.enabled(!1,t),e.move(t,n,i),g.$$postDigest(function(){v("move","ng-move",t,n,i,s,r)})},addClass:function(t
var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv;for(rr="0".charCodeAt(0),vv=0;9>=vv;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.fromRadix=bnpFromRadix,BigInteger.prototype.fromNumber=bnpFromNumber,BigInteger.prototype.bitwiseTo=bnpBitwiseTo,BigInteger.prototype.changeBit=bnpChangeBit,BigInteger.prototype.addTo=bnpAddTo,BigInteger.prototype.dMultiply=bnpDMultiply,BigInteger.prototype.dAddOffset=bnpDAddOffset,BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,BigInteger.prototype.modInt=bnpModInt,BigInteger.prototype.millerRabin=bnpMillerRabin,BigInteger.prototype.clone=bnClone,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.byteValue=bnByteValue,BigInteger.prototype.shortValue=bnShortValue,BigInteger.prototype.signum=bnSigNum,BigInteger.prototype.toByteArray=bnToByteArray,BigInteger.prototype.equals=bnEquals,BigInteger.prototype.min=bnMin,BigInteger.prototype.max=bnMax,BigInteger.prototype.and=bnAnd,BigInteger.prototype.or=bnOr,BigInteger.prototype.xor=bnXor,BigInteger.prototype.andNot=bnAndNot,BigInteger.prototype.not=bnNot,BigInteger.prototype.shiftLeft=bnShiftLeft,BigInteger.prototype.shiftRight=bnShiftRight,BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,BigInteger.prototype.bitCount=bnBitCount,BigInteger.prototype.testBit=bnTestBit,BigInteger.prototype.setBit=bnSetBit,BigInteger.prototype.clearBit=bnClearBit,BigInteger.prototype.flipBit=bnFl
if(this.isZero())return"0";if(this.isNegative()){if(this.equals(goog.math.Long.MIN_VALUE)){var n=goog.math.Long.fromNumber(t),i=this.div(n),r=i.multiply(n).subtract(this);return i.toString(t)+r.toInt().toString(t)}return"-"+this.negate().toString(t)}for(var o=goog.math.Long.fromNumber(Math.pow(t,6)),r=this,a="";;){var s=r.div(o),c=r.subtract(s.multiply(o)).toInt(),l=c.toString(t);if(r=s,r.isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},goog.math.Long.prototype.getHighBits=function(){return this.high_},goog.math.Long.prototype.getLowBits=function(){return this.low_},goog.math.Long.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:goog.math.Long.TWO_PWR_32_DBL_+this.low_},goog.math.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(goog.math.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!=this.high_?this.high_:this.low_,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high_?t+33:t+1},goog.math.Long.prototype.isZero=function(){return 0==this.high_&&0==this.low_},goog.math.Long.prototype.isNegative=function(){return this.high_<0},goog.math.Long.prototype.isOdd=function(){return 1==(1&this.low_)},goog.math.Long.prototype.equals=function(e){return this.high_==e.high_&&this.low_==e.low_},goog.math.Long.prototype.notEquals=function(e){return this.high_!=e.high_||this.low_!=e.low_},goog.math.Long.prototype.lessThan=function(e){return this.compare(e)<0},goog.math.Long.prototype.lessThanOrEqual=function(e){return this.compare(e)<=0},goog.math.Long.prototype.greaterThan=function(e){return this.compare(e)>0},goog.math.Long.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},goog.math.Long.prototype.compare=function(e){if(this.equals(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.subtract(e).isNegative()?-1:1},goog.math.Long.prototype.negate=function(){return this.equals(goog.math.Long.MIN_VALUE)?goog.math.Long.MIN_VALUE:this.not().add(goog.math.Long.ONE)},goog.math.Long.prototype.add=function(e){var t=this.high_>>>16,n=65535&this.high_,i=this.low_>>>16,r=65535&this.low_,o=e.high_>>>16,a=65535&e.high_,s=e.low_>>>16,c=65535&e.low_,l=0,u=0,p=0,d=0;return d+=r+c,p+=d>>>16,d&=65535,p+=i+s,u+=p>>>16,p&=65535,u+=n+a,l+=u>>>16,u&=65535,l+=t+o,l&=65535,goog.math.Long.fromBits(p<<16|d,l<<16|u)},goog.math.Long.prototype.subtract=function(e){return this.add(e.negate())},goog.math.Long.prototype.multiply=function(e){if(this.isZero())return goog.math.Long.ZERO;if(e.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE))return e.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(e.equals(goog.math.Long.MIN_VALUE))return this.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(goog.math.Long.TWO_PWR_24_)&&e.lessThan(goog.math.Long.TWO_PWR_24_))return goog.math.Long.fromNumber(this.toNumber()*e.toNumber());var t=this.high_>>>16,n=65535&this.high_,i=this.low_>>>16,r=65535&this.low_,o=e.high_>>>16,a=65535&e.high_,s=e.low_>>>16,c=65535&e.low_,l=0,u=0,p=0,d=0;return d+=r*c,p+=d>>>16,d&=65535,p+=i*c,u+=p>>>16,p&=65535,p+=r*s,u+=p>>>16,p&=65535,u+=n*c,l+=u>>>16,u&=65535,u+=i*s,l+=u>>>16,u&=65535,u+=r*a,l+=u>>>16,u&=65535,l+=t*c+n*s+i*a+r*o,l&=65535,goog.math.Long.fromBits(p<<16|d,l<<16|u)},goog.math.Long.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE)){if(e.equals(goog.math.Long.ONE)||e.equals(goog.math.Long.NEG_ONE))return goog.math.Long.MIN_VALUE;if(e.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ONE;var t=this.shiftRight(1),n=t.div(e).shiftLeft(1);if(n.equals(goog.math.Long.ZERO))return e.isNegative()?goog.math.Long.ONE:goog.math.Long.NEG_ONE;var i=this.subtract(e.multiply(n)),r=n.add(i.div(e));return r}if(e.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ZERO;if(this.isNegative())return e.isNegative()?
if(!n)return!1;var i=this;if(n.container){var r=[];angular.forEach(n.inner,function(e){var t=i.updateSentMessage(e);t&&r.push(t.msg_id)}),n.inner=r}return n.msg_id=t.generateID(),n.seq_no=this.generateSeqNo(n.notContentRelated||n.container),this.sentMessages[n.msg_id]=n,delete i.sentMessages[e],n},p.prototype.generateSeqNo=function(e){var t=2*this.seqNo;return e||(t++,this.seqNo++),t},p.prototype.wrapMtpCall=function(e,n,i){var r=new TLSerialization({mtproto:!0});r.storeMethod(e,n);var o=t.generateID(),a=this.generateSeqNo(),s={msg_id:o,seq_no:a,body:r.getBytes()};return Config.Modes.debug&&console.log(dT(),"MT call",e,n,o,a),this.pushMessage(s,i)},p.prototype.wrapMtpMessage=function(e,n){n=n||{};var i=new TLSerialization({mtproto:!0});i.storeObject(e,"Object");var r=t.generateID(),o=this.generateSeqNo(n.notContentRelated),a={msg_id:r,seq_no:o,body:i.getBytes()};return Config.Modes.debug&&console.log(dT(),"MT message",e,r,o),this.pushMessage(a,n)},p.prototype.wrapApiCall=function(e,n,i){var r=new TLSerialization(i);this.connectionInited||(r.storeInt(3024194404,"invokeWithLayer15"),r.storeInt(1769565673,"initConnection"),r.storeInt(Config.App.id,"api_id"),r.storeString(navigator.userAgent||"Unknown UserAgent","device_model"),r.storeString(navigator.platform||"Unknown Platform","system_version"),r.storeString(Config.App.version,"app_version"),r.storeString(navigator.language||"en","lang_code")),i.afterMessageID&&(r.storeInt(3416209197,"invokeAfterMsg"),r.storeLong(i.afterMessageID,"msg_id")),i.resultType=r.storeMethod(e,n);var o=t.generateID(),a=this.generateSeqNo(),s={msg_id:o,seq_no:a,body:r.getBytes(),isAPI:!0};return Config.Modes.debug?console.log(dT(),"Api call",e,n,o,a,i):console.log(dT(),"Api call",e),this.pushMessage(s,i)},p.prototype.checkLongPoll=function(){var e=this.cleanupSent();if(this.longPollPending&&tsNow()<this.longPollPending||this.offline)return!1;var t=this;o.get("dc").then(function(n){(!e||n==t.dcID&&!t.upload)&&t.sendLongPoll()})},p.prototype.sendLongPoll=function(){var e=25e3,t=this;this.longPollPending=tsNow()+e,this.wrapMtpCall("http_wait",{max_delay:0,wait_after:0,max_wait:e},{noResponse:!0,longPoll:!0}).then(function(){delete t.longPollPending,c(t.checkLongPoll.bind(t),0)},function(){console.log("Long-poll failed")})},p.prototype.pushMessage=function(e,t){var n=s.defer();return this.sentMessages[e.msg_id]=angular.extend(e,t||{},{deferred:n}),this.pendingMessages[e.msg_id]=0,t&&t.noShedule||this.sheduleRequest(),angular.isObject(t)&&(t.messageID=e.msg_id),n.promise},p.prototype.pushResend=function(e,t){var n=t?tsNow()+t:0,i=this.sentMessages[e];if(i.container)for(var r=0;r<i.inner.length;r++)this.pendingMessages[i.inner[r]]=n;else this.pendingMessages[e]=n;this.sheduleRequest(t)},p.prototype.getMsgKeyIv=function(e,t){var n=this.authKey,r=t?0:8,o={sha1a:i.hash(e.concat(n.slice(r,r+32))),sha1b:i.hash(n.slice(32+r,48+r).concat(e,n.slice(48+r,64+r))),sha1c:i.hash(n.slice(64+r,96+r).concat(e)),sha1d:i.hash(e.concat(n.slice(96+r,128+r)))};return s.all(o).then(function(e){var t=e.sha1a.slice(0,8).concat(e.sha1b.slice(8,20),e.sha1c.slice(4,16)),n=e.sha1a.slice(8,20).concat(e.sha1b.slice(0,8),e.sha1c.slice(16,20),e.sha1d.slice(0,8));return[t,n]})},p.prototype.checkConnection=function(e){u.offlineConnecting=!0,console.log(dT(),"Check connection",e),c.cancel(this.checkConnectionPromise);var n=new TLSerialization({mtproto:!0}),i=[nextRandomInt(4294967295),nextRandomInt(4294967295)];n.storeMethod("ping",{ping_id:i});var r={msg_id:t.generateID(),seq_no:this.generateSeqNo(!0),body:n.getBytes()},o=this;this.sendEncryptedRequest(r).then(function(){delete u.offlineConnecting,o.toggleOffline(!1)},function(){console.log(dT(),"Delay ",1e3*o.checkConnectionPeriod),o.checkConnectionPromise=c(o.checkConnection.bind(o),parseInt(1e3*o.checkConnectionPeriod)),o.checkConnectionPeriod=Math.min(60,1.5*o.checkConnectionPeriod),c(function(){delete u.offlineConnecting},1e3)})},p.prototype.toggleOffline=function(e){return void 0!==this.offline&&this.offline==e?!1:(this.offline=e,u.offline=e,u.offlineConnecting=!1,void(this.offli
})}function _(e,t,n,i){return v(e,t,n).then(function(r){i.count=r.count||r.messages.length;var o=0;if(t>0)for(o=0;o<i.history.length&&!(t>i.history[o]);o++);return i.history.splice(o,i.history.length-o),angular.forEach(r.messages,function(e){i.history.push(e.id)}),n-=r.messages.length,n>0&&i.history.length<i.count?(t=i.history[i.history.length-1],_(e,t,n,i)):!0})}function b(t,n,i,r){var o=s.getPeerID(t),a=j[o],c=0,l=!1,u=!1,p=!1,d=[];if(void 0===a?a=j[o]={count:null,history:[],pending:[]}:!n&&a.pending.length&&(d=a.pending.slice()),i||n){if(n>0)for(l=!0,c=0;c<a.history.length;c++)if(n>a.history[c]){l=!1;break}}else{var f=F(o);if(f&&f[0]&&f[0].unread_count>1){var h=f[0].unread_count;(p=h>50)?(i=10,u=6,c=h-u):(i=Math.max(10,h+2),u=h)}}return!l&&(null!==a.count&&a.history.length==a.count||a.history.length>=c+(i||1))?(r?(r=Math.min(c,r),c=Math.max(0,c-r),i+=r):i=i||(c?20:5),e.when({count:a.count,history:d.concat(a.history.slice(c,c+i)),unreadOffset:u,unreadSkip:p})):(r||i||(i=20),l&&(c=0),r||p||n&&-1==a.history.indexOf(n)?(r&&(c=-r,i+=r),v(t,n,i,c).then(function(e){a.count=e.count||e.messages.length;var t=[];return angular.forEach(e.messages,function(e){t.push(e.id)}),{count:a.count,history:d.concat(t),unreadOffset:u,unreadSkip:p}})):_(t,n,i,a).then(function(){if(c=0,n>0)for(c=0;c<a.history.length&&!(n>a.history[c]);c++);return{count:a.count,history:d.concat(a.history.slice(c,c+i)),unreadOffset:u,unreadSkip:p}}))}function w(t,n,i,r,c){var l=[],u=!n,p=s.getPeerID(t),f={peer:p,filter:i},h=u&&angular.equals(Y,f);if(u&&!h&&(Y=f,Q=[]),!r&&!n){var g=j[p];if(void 0!==g&&g.history.length){var m,y,v={},_=c||20;switch(i._){case"inputMessagesFilterPhotos":v.messageMediaPhoto=!0;break;case"inputMessagesFilterVideo":v.messageMediaVideo=!0;break;case"inputMessagesFilterPhotoVideo":v.messageMediaPhoto=!0,v.messageMediaVideo=!0;break;case"inputMessagesFilterDocument":v.messageMediaDocument=!0;break;case"inputMessagesFilterAudio":v.messageMediaAudio=!0}for(m=0;m<g.history.length&&(y=O[g.history[m]],!(y.media&&v[y.media._]&&(l.push(y.id),l.length>=_)));m++);}if(l.length<_&&Q.length&&h)for(var b=l.length?l[l.length-1]:4294967295,m=0;m<Q.length&&!(Q[m]<b&&(l.push(Q[m]),l.length>=_));m++);}return l.length||1e3==c?(u&&(Q=listMergeSorted(Q,l)),e.when({count:null,history:l})):d.invokeApi("messages.search",{peer:t,q:n||"",filter:i||{_:"inputMessagesFilterEmpty"},min_date:0,max_date:0,limit:c||20,max_id:r||0}).then(function(e){o.saveApiUsers(e.users),a.saveApiChats(e.chats),x(e.messages);var t=e.count||e.messages.length;return l=[],angular.forEach(e.messages,function(e){l.push(e.id)}),u&&(Q=listMergeSorted(Q,l)),{count:t,history:l}})}function $(e){return O[e]||{deleted:!0}}function S(e){return d.invokeApi("messages.deleteMessages",{id:e}).then(function(e){return r.processUpdateMessage({_:"updateShort",update:{_:"updateDeleteMessages",messages:e}}),e})}function C(t,n,i){return r.processUpdateMessage({_:"updates",seq:n.seq,updates:[]})?n.offset?d.invokeApi(i,{peer:t,offset:n.offset,max_id:0}).then(function(e){return C(t,e,i)}):e.when():!1}function k(e){var n=s.getPeerID(e),i=j[n],r=F(n);if(!r[0]||!r[0].unread_count){if(!i||!i.history.length)return!1;var o,a,c=!1;for(u=i.history.length;u>=0;u--)if(o=i.history[u],a=O[o],a&&!a.out&&a.unread){c=!0;break}if(!c)return!1}if(i.readPromise)return i.readPromise;var l=d.invokeApi("messages.readHistory",{peer:e,offset:0,max_id:0}).then(function(t){return C(e,t,"messages.readHistory")}).then(function(){r[0]&&(r[0].unread_count=0,t.$broadcast("dialog_unread",{peerID:n,count:0}))})["finally"](function(){delete i.readPromise});if(i&&i.history.length){var o,a,u,n,r;for(u=0;u<i.history.length;u++)o=i.history[u],a=O[o],a&&!a.out&&(a.unread=!1,R[o]&&(R[o].unread=!1),q[o]&&(q[o].unread=!1))}return l}function M(e){{var n=s.getPeerID(e);j[n]}return d.invokeApi("messages.deleteHistory",{peer:e,offset:0}).then(function(t){return C(e,t,"messages.deleteHistory")}).then(function(){var e=F(n);e[0]&&H.dialogs.splice(e[1],1),delete j[n],t.$broadcast("dialog_flush",{peerID:n})})}function x(e){angular.forEach(e,function(e){O[e.id]=e,
!C||e%2e3>1e3?(document.title=T,$('link[rel="icon"]').replaceWith(M)):(document.title=C>1?C+" notifications":"1 notification",$('link[rel="icon"]').replaceWith(x))},1e3)):(C=0,document.title=T,$('link[rel="icon"]').replaceWith(M),v())}),e.$on("apiUpdate",function(e,t){switch(t._){case"updateNotifySettings":if("notifyPeer"==t.peer._){var n=a.getPeerID(t.peer.peer);u(n,t.notify_settings)}}}),{start:f,notify:g,cancel:y,clear:v,getPeerSettings:l,getPeerMuted:d,savePeerSettings:u,updatePeerSettings:p,testSound:m}}]).service("ErrorService",["$rootScope","$modal","$window",function(e,t,n){function i(n,i){if(a>=2)return console.log("Skip error box, too many open",a,n,i),!1;i=i||{};var r=e.$new();angular.extend(r,n),a++;var o=t.open({templateUrl:"partials/error_modal.html",scope:r,windowClass:i.windowClass||"error_modal_window"});return o.result["finally"](function(){a--}),o}function r(e,t){return i({title:e,description:t})}function o(n,i){i=i||{};var r=e.$new();angular.extend(r,n);var o=t.open({templateUrl:"partials/confirm_modal.html",scope:r,windowClass:i.windowClass||"confirm_modal_window"});return o.result}var a=0;return n.safeConfirm=function(e,t){"string"==typeof e&&(e={message:e}),o(e).then(function(e){t(e||!0)},function(){t(!1)})},{show:i,alert:r,confirm:o}}]).service("PeersSelectService",["$rootScope","$modal",function(e,t){function n(n){var i=e.$new();return n&&angular.extend(i,n),t.open({templateUrl:"partials/peer_select.html",controller:"PeerSelectController",scope:i,windowClass:"peer_select_window"}).result}return{selectPeer:n}}]).service("ContactsSelectService",["$rootScope","$modal",function(e,t){function n(n,i){i=i||{};var r=e.$new();return r.multiSelect=n,angular.extend(r,i),t.open({templateUrl:"partials/contacts_modal.html",controller:"ContactsModalController",scope:r,windowClass:"contacts_modal_window"}).result}return{selectContacts:function(e){return n(!0,e)},selectContact:function(e){return n(!1,e)}}}]).service("ChangelogNotifyService",["Storage","$rootScope","$http","$modal",function(e,t,n,i){function r(e,t){"string"!=typeof e&&(e=""),"string"!=typeof t&&(t=""),e=e.replace(/^\s+|\s+$/g,"").split("."),t=t.replace(/^\s+|\s+$/g,"").split(".");var n,i=Math.max(e.length,t.length);for(n=0;i>n;n++)if(e[n]!=t[n])return e[n]>t[n]?1:-1;return 0}function o(){e.get("last_version").then(function(t){t!=Config.App.version&&(t&&a(t),e.set({last_version:Config.App.version}))})}function a(e){var n=t.$new();n.lastVersion=e,n.canShowVersion=function(t){return n.lastVersion===!1||void 0===n.lastVersion?!0:r(t,e)>0},i.open({templateUrl:"partials/changelog_modal.html",scope:n,windowClass:"changelog_modal_window page_modal"})}return{checkUpdate:o,showChangelog:a}}]),angular.module("myApp.controllers",[]).controller("AppWelcomeController",["$scope","$location","MtpApiManager","ErrorService","ChangelogNotifyService",function(e,t,n,i,r){n.getUserID().then(function(n){n?t.url("/im"):e.showWelcome=!0}),r.checkUpdate()}]).controller("AppLoginController",["$scope","$location","$timeout","$modal","$modalStack","MtpApiManager","ErrorService","ChangelogNotifyService",function(e,t,n,i,r,o,a,s){function c(){var t,n,i,r=((e.credentials.phone_country||"")+(e.credentials.phone_number||"")).replace(/\D+/g,""),o=0,a=!1;if(r.length)for(t=0;t<Config.CountryCodes.length;t++)for(n=1;n<Config.CountryCodes[t].length;n++)i=Config.CountryCodes[t][n].replace(/\D+/g,""),i.length>=o&&!r.indexOf(i)&&(o=i.length,a=Config.CountryCodes[t][0]);e.credentials.phone_full=r,e.credentials.phone_country_name=a||"Unknown"}function l(e){o.setUserAuth(p.dcID,{expires:e.expires,id:e.user.id}),n.cancel(d),t.url("/im")}function u(){n.cancel(d),--e.callPending.remaining?d=n(u,1e3):(e.callPending.success=!1,o.invokeApi("auth.sendCall",{phone_number:e.credentials.phone_full,phone_code_hash:e.credentials.phone_code_hash},p).then(function(){e.callPending.success=!0}))}r.dismissAll(),o.getUserID().then(function(e){return e?void t.url("/im"):void 0});var p={dcID:1,createNetworker:!0};e.credentials={phone_country:"+1",phone_country_name:"USA",phone_number:"",phone_full:""},e.progre
c.set({notify_volume:i}),c.remove("notify_nosound"),l.clear(),r&&n.cancel(r),r=n(function(){l.testSound(i)},500)}}),t.toggleDesktop=function(){t.notify.desktop=!t.notify.desktop,t.notify.desktop?c.remove("notify_nodesktop"):c.set({notify_nodesktop:!0})},t.toggleCtrlEnter=function(n){t.send.enter=n,t.send.enter?c.remove("send_ctrlenter"):c.set({send_ctrlenter:!0}),e.$broadcast("settings_changed")}}),t.openChangelog=function(){d.showChangelog(!1)}}]).controller("ProfileEditModalController",["$rootScope","$scope","$timeout","$modal","$modalInstance","AppUsersManager","AppChatsManager","MtpApiManager","Storage","NotificationsManager","MtpApiFileManager","ApiUpdatesManager",function(e,t,n,i,r,o,a,s){t.profile={},t.error={},s.getUserID().then(function(e){t.profile=o.getUser(e)}),t.updateProfile=function(){t.profile.updating=!0,s.invokeApi("account.updateProfile",{first_name:t.profile.first_name||"",last_name:t.profile.last_name||""}).then(function(e){t.error={},o.saveApiUser(e),r.close()},function(e){switch(e.type){case"FIRSTNAME_INVALID":t.error={field:"first_name"},e.handled=!0;break;case"LASTNAME_INVALID":t.error={field:"last_name"},e.handled=!0;break;case"NAME_NOT_MODIFIED":e.handled=!0,r.close()}})["finally"](function(){delete t.profile.updating})}}]).controller("ContactsModalController",["$scope","$modal","$modalInstance","AppUsersManager","ErrorService",function(e,t,n,i){function r(t){i.getContacts(t).then(function(t){e.contacts=[],e.slice.limit=20,angular.forEach(t,function(t){var n={userID:t,user:i.getUser(t),userPhoto:i.getUserPhoto(t,"User")};e.contacts.push(n)}),e.$broadcast("contacts_change")})}if(e.contacts=[],e.search={},e.slice={limit:20,limitDelta:20},e.selectedContacts={},e.disabledContacts={},e.selectedCount=0,e.disabled)for(var o=0;o<e.disabled.length;o++)e.disabledContacts[e.disabled[o]]=!0;if(e.selected)for(var o=0;o<e.selected.length;o++)e.selectedContacts[e.selected[o]]||(e.selectedContacts[e.selected[o]]=!0,e.selectedCount++);e.$watch("search.query",r),e.contactSelect=function(t){return e.disabledContacts[t]?!1:e.multiSelect?void(e.selectedContacts[t]?(delete e.selectedContacts[t],e.selectedCount--):(e.selectedContacts[t]=!0,e.selectedCount++)):n.close(t)},e.submitSelected=function(){if(e.selectedCount>0){var t=[];return angular.forEach(e.selectedContacts,function(e,n){t.push(n)}),n.close(t)}},e.importContact=function(){i.openImportContact().then(function(){r(e.search&&e.search.query||"")})}}]).controller("PeerSelectController",["$scope","$modalInstance","$q","AppPeersManager","ErrorService",function(e,t,n,i,r){e.dialogSelect=function(o){var a;if(e.confirm_type){var s=i.getPeerID(o),c=i.getPeer(s);a=r.confirm({type:e.confirm_type,peer_id:s,peer_data:c})}else a=n.when();a.then(function(){t.close(o)})}}]).controller("ChatCreateModalController",["$scope","$modalInstance","$rootScope","MtpApiManager","AppUsersManager","AppChatsManager","ApiUpdatesManager",function(e,t,n,i,r,o,a){e.group={name:""},e.createGroup=function(){if(e.group.name){e.group.creating=!0;var t=[];return angular.forEach(e.userIDs,function(e){t.push({_:"inputUserContact",user_id:e})}),i.invokeApi("messages.createChat",{title:e.group.name,users:t}).then(function(e){a.processUpdateMessage({_:"updates",seq:e.seq,users:e.users,chats:e.chats,updates:[{_:"updateNewMessage",message:e.message,pts:e.pts}]});var t=o.getChatString(e.message.to_id.chat_id);n.$broadcast("history_focus",{peerString:t})})["finally"](function(){delete e.group.creating})}}}]).controller("ChatEditModalController",["$scope","$modalInstance","$rootScope","MtpApiManager","AppUsersManager","AppChatsManager","ApiUpdatesManager",function(e,t,n,i,r,o,a){var s=o.getChat(e.chatID);e.group={name:s.title},e.updateGroup=function(){return e.group.name?e.group.name==s.title?t.close():(e.group.updating=!0,i.invokeApi("messages.editChatTitle",{chat_id:e.chatID,title:e.group.name}).then(function(t){a.processUpdateMessage({_:"updates",seq:t.seq,users:t.users,chats:t.chats,updates:[{_:"updateNewMessage",message:t.message,pts:t.pts}]});var i=o.getChatString(e.chatID);n.$broadcast("history_fo
}]),angular.module("myApp.directives",["myApp.filters"]).directive("myHead",function(){return{restrict:"AE",scope:!0,templateUrl:"partials/head.html"}}).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("myDialogs",["$modalStack","$transition",function(e){function t(t,n,i){function r(t){if(!l&&e.getTop())return!0;if(36==t.keyCode&&!t.shiftKey&&!t.ctrlKey&&t.altKey){var n=$(a).find(".im_dialog_wrap a")[0];return n&&(n.click(),a.scrollTop=0,$(o).nanoScroller({flash:!0})),cancelEvent(t)}if(27==t.keyCode||9==t.keyCode&&t.shiftKey&&!t.ctrlKey&&!t.metaKey)return l||(s.focus(),s.value&&s.select()),cancelEvent(t);if(l&&13==t.keyCode){var n=$(a).find(".im_dialog_selected")[0]||$(a).find(".im_dialog_wrap a")[0];return n&&n.click(),cancelEvent(t)}if(38==t.keyCode||40==t.keyCode){var i=!t.shiftKey&&t.altKey;if(!i&&(!l||t.metaKey))return!0;var r,c=40==t.keyCode,n=!i&&$(a).find(".im_dialog_selected")[0]||$(a).find(".active a.im_dialog")[0],u=n&&n.parentNode;if(u){var r=n[c?"nextSibling":"previousSibling"];if(!r||!r.className||-1==r.className.indexOf("im_dialog_wrap")){var p=$(a).find(".im_dialog_wrap"),d=p.index(n.parentNode),f=d+(c?1:-1);r=p[f]}}else{var p=$(a).find(".im_dialog_wrap");r=c?p[0]:p[p.length-1]}if(i?r&&$(r).find("a")[0].click():(u&&r&&$(u).find("a").removeClass("im_dialog_selected"),r&&$(r).find("a").addClass("im_dialog_selected")),r){var h=r.offsetTop,g=r.offsetHeight,m=a.scrollTop,y=a.clientHeight;m>h?(a.scrollTop=h,$(o).nanoScroller({flash:!0})):h+g-y>m&&(a.scrollTop=h+g-y,$(o).nanoScroller({flash:!0}))}return cancelEvent(t)}}var o=$(".im_dialogs_wrap",n)[0],a=$(".im_dialogs_scrollable_wrap",n)[0],s=$(".im_dialogs_search_field",n)[0],c=$(".im_dialogs_tabs_wrap",n)[0],l=!1;$(s).on("focus blur",function(e){l="focus"==e.type,l||$(a).find(".im_dialog_selected").removeClass("im_dialog_selected")}),i.$observe("hasTabs",function(e){e="true"==e,$(c).toggle(e),t.$broadcast("ui_dialogs_tabs",e)}),$(document).on("keydown",r),t.$on("$destroy",function(){$(document).off("keydown",r)})}return{link:t}}]).directive("myDialogsList",["$window","$timeout",function(e,t){function n(n,i,r){function o(){return r.modal?($(i).css({height:$(e).height()-(Config.Navigator.mobile?100:200)}),void d()):(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)-(u?38:0)-68}),void d())}var a=$(".im_dialogs_wrap",i)[0],s=$(".im_dialogs_scrollable_wrap",i)[0],c=$(".tg_page_head")[0],l=$(".im_page_footer")[0],u=!1,p=!1;onContentLoaded(function(){$(a).nanoScroller({preventPageScrolling:!0,tabIndex:-1,iOSNativeScrolling:!0})});var d=function(){onContentLoaded(function(){$(a).nanoScroller()})};n.$on("ui_dialogs_prepend",d),n.$on("ui_dialogs_tabs",function(e,t){u=t,o()}),n.$on("ui_dialogs_append",function(){onContentLoaded(function(){d(),p=!1,t(function(){$(s).trigger("scroll")})})}),n.$on("ui_dialogs_change",function(){onContentLoaded(function(){d(),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",o),o(),setTimeout(o,1e3)}return{link:n}}]).directive("myContactsList",["$window","$timeout",function(e){function t(t,n){function i(){$(n).css({height:$(e).height()-(o&&o.offsetHeight||0)-(r&&r.offsetHeight||0)-(Config.Navigator.mobile?100:200)}),$(a).nanoScroller()}var r=$(".contacts_modal_search")[0],o=$(".contacts_modal_panel")[0],a=$(".contacts_wrap",n)[0];onContentLoaded(function(){$(a).nanoScroller({preventPageScrolling:!0,tabIndex:-1,iOSNativeScrolling:!0}),i()}),$(e).on("resize",i),t.$on("contacts_change",function(){onContentLoaded(i)})}return{link:t}}]).directive("myCountriesList",["$window","$timeout",function(e){function t(t,n){function i(){$(n).css({height:$(e).height()-(o&&o.offsetHeight||0)-(r&&r.offsetHeight||0)-200}),$(a).nanoScroll