From e409ed9c1fcd9709923aa321063df0fdada39ac0 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 22 Apr 2016 20:20:52 +0300 Subject: [PATCH] merged with master --- app.manifest | 8 ++--- css/app.css | 4 +-- index.html | 2 +- js/app.js | 80 +++++++++++++++++++++++++++-------------- js/background.js | 2 +- js/lib/bin_utils.js | 2 +- js/lib/crypto_worker.js | 2 +- js/locales/en-us.json | 1 + manifest.json | 2 +- manifest.webapp | 2 +- webogram.appcache | 8 ++--- 11 files changed, 70 insertions(+), 43 deletions(-) diff --git a/app.manifest b/app.manifest index 9cd13bc4..fdbe3b41 100644 --- a/app.manifest +++ b/app.manifest @@ -1,10 +1,13 @@ CACHE MANIFEST -# Time: Wed Apr 20 2016 20:47:41 GMT+0300 (MSK) +# Time: Fri Apr 22 2016 20:19:37 GMT+0300 (MSK) CACHE: favicon.ico favicon_unread.ico +css/app.css +css/desktop.css +css/mobile.css img/Manytabs.png img/Manytabs_2x.png img/Telegram.png @@ -22,9 +25,6 @@ img/iphone_home120.png img/iphone_startup.png img/logo_share.png img/sound_a.mp3 -css/app.css -css/desktop.css -css/mobile.css js/app.js nacl/mtproto_crypto.nmf nacl/mtproto_crypto.pexe diff --git a/css/app.css b/css/app.css index 2bf0ad52..feed97d0 100644 --- a/css/app.css +++ b/css/app.css @@ -1142,7 +1142,7 @@ button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webk .toast-center{top:45%} #toast-container{position:fixed;z-index:999999;pointer-events:auto} #toast-container.toast-bottom-center,#toast-container.toast-center,#toast-container.toast-top-center{width:100%;pointer-events:none} -#toast-container.toast-bottom-center>div,#toast-container.toast-center>div,#toast-container.toast-top-center>div{margin:auto;pointer-events:auto} +#toast-container.toast-bottom-center>div,#toast-container.toast-center>div,#toast-container.toast-top-center>div{margin-left:auto;margin-right:auto;pointer-events:auto} #toast-container.toast-bottom-center>button,#toast-container.toast-center>button,#toast-container.toast-top-center>button{pointer-events:auto} #toast-container *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box} #toast-container>div{margin:0 0 6px;padding:15px 15px 15px 50px;width:300px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-position:15px center;background-repeat:no-repeat;-moz-box-shadow:0 0 12px #999;-webkit-box-shadow:0 0 12px #999;box-shadow:0 0 12px #999;color:#fff;opacity:.8;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);filter:alpha(opacity=80)} @@ -1163,7 +1163,7 @@ button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webk @media all and (min-width:241px) and (max-width:480px){#toast-container>div{padding:8px 8px 8px 50px;width:18em} #toast-container .toast-close-button{right:-.2em;top:-.2em}} @media all and (min-width:481px) and (max-width:768px){#toast-container>div{padding:15px 15px 15px 50px;width:25em}} -:not(.no-enter)#toast-container>div.ng-enter,:not(.no-leave)#toast-container>div.ng-leave{-webkit-transition:1000ms cubic-bezier(.25,.25,.75,.75) all;-moz-transition:1000ms cubic-bezier(.25,.25,.75,.75) all;-ms-transition:1000ms cubic-bezier(.25,.25,.75,.75) all;-o-transition:1000ms cubic-bezier(.25,.25,.75,.75) all;transition:1000ms cubic-bezier(.25,.25,.75,.75) all} +:not(.no-enter)#toast-container>div.ng-enter,:not(.no-leave)#toast-container>div.ng-leave{-webkit-transition:200ms cubic-bezier(.25,.25,.75,.75) all;-moz-transition:200ms cubic-bezier(.25,.25,.75,.75) all;-ms-transition:200ms cubic-bezier(.25,.25,.75,.75) all;-o-transition:200ms cubic-bezier(.25,.25,.75,.75) all;transition:200ms cubic-bezier(.25,.25,.75,.75) all} :not(.no-enter)#toast-container>div.ng-enter.ng-enter-active,:not(.no-leave)#toast-container>div.ng-leave{opacity:.8} :not(.no-enter)#toast-container>div.ng-enter,:not(.no-leave)#toast-container>div.ng-leave.ng-leave-active{opacity:0} html{display:none;background:#e7ebf0;overflow:visible} diff --git a/index.html b/index.html index d3473497..50ab3647 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Telegram Web
\ No newline at end of file +Telegram Web
\ No newline at end of file diff --git a/js/app.js b/js/app.js index b87b4d2d..3a2518c4 100644 --- a/js/app.js +++ b/js/app.js @@ -1,27 +1,53 @@ -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,a,i,o){for(;--o>=0;){var s=t*this[e++]+n[a]+i;i=Math.floor(s/67108864),n[a++]=67108863&s}return i}function am2(e,t,n,a,i,o){for(var s=32767&t,r=t>>15;--o>=0;){var l=32767&this[e],c=this[e++]>>15,d=r*l+c*s;l=s*l+((32767&d)<<15)+n[a]+(1073741823&i),i=(l>>>30)+(d>>>15)+r*c+(i>>>30),n[a++]=1073741823&l}return i}function am3(e,t,n,a,i,o){for(var s=16383&t,r=t>>14;--o>=0;){var l=16383&this[e],c=this[e++]>>14,d=r*l+c*s;l=s*l+((16383&d)<<14)+n[a]+i,i=(l>>28)+(d>>14)+r*c,n[a++]=268435455&l}return i}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 a;if(16==t)a=4;else if(8==t)a=3;else if(256==t)a=8;else if(2==t)a=1;else if(32==t)a=5;else{if(4!=t)return void this.fromRadix(e,t);a=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var r=8==a?255&e[i]:intAt(e,i);0>r?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=r:s+a>this.DB?(this[this.t-1]|=(r&(1<>this.DB-s):this[this.t-1]|=r<=this.DB&&(s-=this.DB))}8==a&&0!=(128&e[0])&&n&&(this.s=-1,s>0&&(this[this.t-1]|=(1<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,a=(1<0)for(r>r)>0&&(i=!0,o=int2char(n));s>=0;)t>r?(n=(this[s]&(1<>(r+=this.DB-t)):(n=this[s]>>(r-=t)&a,0>=r&&(r+=this.DB,--s)),n>0&&(i=!0),i&&(o+=int2char(n));return i?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=0;--n)t[n+s+1]=this[n]>>i|r,r=(this[n]&o)<=0;--n)t[n]=0;t[s]=r,t.t=this.t+s+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 a=e%this.DB,i=this.DB-a,o=(1<>a;for(var s=n+1;s>a;a>0&&(t[this.t-n-1]|=(this.s&o)<n;)a+=this[n]-e[n],t[n++]=a&this.DM,a>>=this.DB;if(e.t>=this.DB;a+=this.s}else{for(a+=this.s;n>=this.DB;a-=e.s}t.s=0>a?-1:0,-1>a?t[n++]=this.DV+a:a>0&&(t[n++]=a),t.t=n,t.clamp()}function bnpMultiplyTo(e,t){var n=this.abs(),a=e.abs(),i=n.t;for(t.t=i+a.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function bnpDivRemTo(e,t,n){var a=e.abs();if(!(a.t<=0)){var i=this.abs();if(i.t0?(a.lShiftTo(l,o),i.lShiftTo(l,n)):(a.copyTo(o),i.copyTo(n));var c=o.t,d=o[c-1];if(0!=d){var u=d*(1<1?o[c-2]>>this.F2:0),p=this.FV/u,m=(1<=0&&(n[n.t++]=1,n.subTo(_,n)),BigInteger.ONE.dlShiftTo(c,_),_.subTo(o,o);o.t=0;){var v=n[--h]==d?this.DM:Math.floor(n[h]*p+(n[h-1]+g)*m);if((n[h]+=o.am(0,v,n,f,0,c))0&&n.rShiftTo(l,n),0>s&&BigInteger.ZERO.subTo(n,n)}}}function bnMod(e){var t=nbi();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(BigInteger.ZERO)>0&&e.subTo(t,t),t}function Classic(e){this.m=e}function cConvert(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function cRevert(e){return e}function cReduce(e){e.divRemTo(this.m,null,e)}function cMulTo(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function cSqrTo(e,t){e.squareTo(t),this.reduce(t)}function bnpInvDigit(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Montgomery(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function montRevert(e){var t=nbi();return e.copyTo(t),this.reduce(t),t}function montReduce(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,a,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function montSqrTo(e,t){e.squareTo(t),this.reduce(t)}function montMulTo(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(e,t){if(e>4294967295||1>e)return BigInteger.ONE;var n=nbi(),a=nbi(),i=t.convert(this),o=nbits(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,a),(e&1<0)t.mulTo(a,i,n);else{var s=n;n=a,a=s}return t.revert(n)}function bnModPowInt(e,t){var n;return n=256>e||t.isEven()?new Classic(t):new Montgomery(t),this.exp(e,n)}function bnClone(){var e=nbi();return this.copyTo(e),e}function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(e){if(null==e&&(e=10),0==this.signum()||2>e||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),a=nbv(n),i=nbi(),o=nbi(),s="";for(this.divRemTo(a,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(a,i,o);return o.intValue().toString(e)+s}function bnpFromRadix(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),a=Math.pow(t,n),i=!1,o=0,s=0,r=0;rl?"-"==e.charAt(r)&&0==this.signum()&&(i=!0):(s=t*s+l,++o>=n&&(this.dMultiply(a),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(e,t,n){if("number"==typeof t)if(2>e)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(e-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(BigInteger.ONE.shiftLeft(e-1),this);else{var a=new Array,i=7&e;a.length=(e>>3)+1,t.nextBytes(a),i>0?a[0]&=(1<0)for(i>i)!=(this.s&this.DM)>>i&&(n[o++]=a|this.s<=0;)8>i?(a=(this[t]&(1<>(i+=this.DB-8)):(a=this[t]>>(i-=8)&255,0>=i&&(i+=this.DB,--t)),e&&0!=(128&a)&&(a|=-256),0==o&&(128&this.s)!=(128&a)&&++o,(o>0||a!=this.s)&&(n[o++]=a);return n}function bnEquals(e){return 0==this.compareTo(e)}function bnMin(e){return this.compareTo(e)<0?this:e}function bnMax(e){return this.compareTo(e)>0?this:e}function bnpBitwiseTo(e,t,n){var a,i,o=Math.min(e.t,this.t);for(a=0;o>a;++a)n[a]=t(this[a],e[a]);if(e.te?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function bnShiftRight(e){var t=nbi();return 0>e?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function lbit(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function bnGetLowestSetBit(){for(var e=0;e=this.t?0!=this.s:0!=(this[t]&1<n;)a+=this[n]+e[n],t[n++]=a&this.DM,a>>=this.DB;if(e.t>=this.DB;a+=this.s}else{for(a+=this.s;n>=this.DB;a+=e.s}t.s=0>a?-1:0,a>0?t[n++]=a:-1>a&&(t[n++]=this.DV+a),t.t=n,t.clamp()}function bnAdd(e){var t=nbi();return this.addTo(e,t),t}function bnSubtract(e){var t=nbi();return this.subTo(e,t),t}function bnMultiply(e){var t=nbi();return this.multiplyTo(e,t),t}function bnSquare(){var e=nbi();return this.squareTo(e),e}function bnDivide(e){var t=nbi();return this.divRemTo(e,t,null),t}function bnRemainder(e){var t=nbi();return this.divRemTo(e,null,t),t}function bnDivideAndRemainder(e){var t=nbi(),n=nbi();return this.divRemTo(e,t,n),new Array(t,n)}function bnpDMultiply(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function NullExp(){}function nNop(e){return e}function nMulTo(e,t,n){e.multiplyTo(t,n)}function nSqrTo(e,t){e.squareTo(t)}function bnPow(e){return this.exp(e,new NullExp)}function bnpMultiplyLowerTo(e,t,n){var a=Math.min(this.t+e.t,t);for(n.s=0,n.t=a;a>0;)n[--a]=0;var i;for(i=n.t-this.t;i>a;++a)n[a+this.t]=this.am(0,e[a],n,a,0,this.t);for(i=Math.min(e.t,t);i>a;++a)this.am(0,e[a],n,a,0,t-a);n.clamp()}function bnpMultiplyUpperTo(e,t,n){--t;var a=n.t=this.t+e.t-t;for(n.s=0;--a>=0;)n[a]=0;for(a=Math.max(t-this.t,0);a2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=nbi();return e.copyTo(t),this.reduce(t),t}function barrettRevert(e){return e}function barrettReduce(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function barrettSqrTo(e,t){e.squareTo(t),this.reduce(t)}function barrettMulTo(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function bnModPow(e,t){var n,a,i=e.bitLength(),o=nbv(1);if(0>=i)return o;n=18>i?1:48>i?3:144>i?4:768>i?5:6,a=8>i?new Classic(t):t.isEven()?new Barrett(t):new Montgomery(t);var s=new Array,r=3,l=n-1,c=(1<1){var d=nbi();for(a.sqrTo(s[1],d);c>=r;)s[r]=nbi(),a.mulTo(d,s[r-2],s[r]),r+=2}var u,p,m=e.t-1,g=!0,h=nbi();for(i=nbits(e[m])-1;m>=0;){for(i>=l?u=e[m]>>i-l&c:(u=(e[m]&(1<0&&(u|=e[m-1]>>this.DB+i-l)),r=n;0==(1&u);)u>>=1,--r;if((i-=r)<0&&(i+=this.DB,--m),g)s[u].copyTo(o),g=!1;else{for(;r>1;)a.sqrTo(o,h),a.sqrTo(h,o),r-=2;r>0?a.sqrTo(o,h):(p=o,o=h,h=p),a.mulTo(h,s[u],o)}for(;m>=0&&0==(e[m]&1<o)return t;for(o>i&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function bnpModInt(e){if(0>=e)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var a=this.t-1;a>=0;--a)n=(t*n+this[a])%e;return n}function bnModInverse(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return BigInteger.ZERO;for(var n=e.clone(),a=this.clone(),i=nbv(1),o=nbv(0),s=nbv(0),r=nbv(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;a.isEven();)a.rShiftTo(1,a),t?(s.isEven()&&r.isEven()||(s.addTo(this,s),r.subTo(e,r)),s.rShiftTo(1,s)):r.isEven()||r.subTo(e,r),r.rShiftTo(1,r);n.compareTo(a)>=0?(n.subTo(a,n),t&&i.subTo(s,i),o.subTo(r,o)):(a.subTo(n,a),t&&s.subTo(i,s),r.subTo(o,r))}return 0!=a.compareTo(BigInteger.ONE)?BigInteger.ZERO:r.compareTo(e)>=0?r.subtract(e):r.signum()<0?(r.addTo(e,r),r.signum()<0?r.add(e):r):r}function bnIsProbablePrime(e){var t,n=this.abs();if(1==n.t&&n[0]<=lowprimes[lowprimes.length-1]){for(t=0;ta;)a*=lowprimes[i++];for(a=n.modInt(a);i>t;)if(a%lowprimes[t++]==0)return!1}return n.millerRabin(e)}function bnpMillerRabin(e){var t=this.subtract(BigInteger.ONE),n=t.getLowestSetBit();if(0>=n)return!1;var a=t.shiftRight(n);e=e+1>>1,e>lowprimes.length&&(e=lowprimes.length);for(var i=nbi(),o=0;e>o;++o){i.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var s=i.modPow(a,this);if(0!=s.compareTo(BigInteger.ONE)&&0!=s.compareTo(t)){for(var r=1;r++>8&255,rng_pool[rng_pptr++]^=e>>16&255,rng_pool[rng_pptr++]^=e>>24&255,rng_pptr>=rng_psize&&(rng_pptr-=rng_psize)}function rng_seed_time(){rng_seed_int((new Date).getTime())}function rng_get_byte(){if(null==rng_state){for(rng_seed_time(),rng_state=prng_newstate(),rng_state.init(rng_pool),rng_pptr=0;rng_pptrt;++t)this.S[t]=t;for(n=0,t=0;256>t;++t)n=n+this.S[t]+e[t%e.length]&255,a=this.S[t],this.S[t]=this.S[n],this.S[n]=a;this.i=0,this.j=0}function ARC4next(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}function prng_newstate(){return new Arcfour}function findPrimes(e){var t,n,a,i;for(n=new Array(e),t=0;e>t;t++)n[t]=0;for(n[0]=2,a=0;n[a]t;t+=n[a])n[t]=1;for(a++,n[a]=n[a-1]+1;n[a]t;t++)i[t]=n[t];return i}function millerRabinInt(e,t){return mr_x1.length!=e.length&&(mr_x1=dup(e),mr_r=dup(e),mr_a=dup(e)),copyInt_(mr_a,t),millerRabin(e,mr_a)}function millerRabin(e,t){var n,a,i,o;for(mr_x1.length!=e.length&&(mr_x1=dup(e),mr_r=dup(e),mr_a=dup(e)),copy_(mr_a,t),copy_(mr_r,e),copy_(mr_x1,e),addInt_(mr_r,-1),addInt_(mr_x1,-1),i=0,n=0;na;a<<=1)e[n]&a?(o=i=a&&!equals(mr_a,mr_x1);){if(squareMod_(mr_a,e),equalsInt(mr_a,1))return 0;a++}if(!equals(mr_a,mr_x1))return 0}return 1}function bitSize(e){var t,n,a;for(t=e.length-1;0==e[t]&&t>0;t--);for(n=0,a=e[t];a;a>>=1,n++);return n+=bpe*t}function expand(e,t){var n=int2bigInt(0,(e.length>t?e.length:t)*bpe,0);return copy_(n,e),n}function randTruePrime(e){var t=int2bigInt(0,e,0);return randTruePrime_(t,e),trim(t,1)}function randProbPrime(e){return e>=600?randProbPrimeRounds(e,2):e>=550?randProbPrimeRounds(e,4):e>=500?randProbPrimeRounds(e,5):e>=400?randProbPrimeRounds(e,6):e>=350?randProbPrimeRounds(e,7):e>=300?randProbPrimeRounds(e,9):e>=250?randProbPrimeRounds(e,12):e>=200?randProbPrimeRounds(e,15):e>=150?randProbPrimeRounds(e,18):e>=100?randProbPrimeRounds(e,27):randProbPrimeRounds(e,40)}function randProbPrimeRounds(e,t){var n,a,i,o;for(o=3e4,n=int2bigInt(0,e,0),0==primes.length&&(primes=findPrimes(3e4)),rpprb.length!=n.length&&(rpprb=dup(n));;){for(randBigInt_(n,e,0),n[0]|=1,i=0,a=0;aa&&!i;a++){for(randBigInt_(rpprb,e,0);!greater(n,rpprb);)randBigInt_(rpprb,e,0);millerRabin(n,rpprb)||(i=1)}if(!i)return n}}function mod(e,t){var n=dup(e);return mod_(n,t),trim(n,1)}function addInt(e,t){var n=expand(e,e.length+1);return addInt_(n,t),trim(n,1)}function mult(e,t){var n=expand(e,e.length+t.length);return mult_(n,t),trim(n,1)}function powMod(e,t,n){var a=expand(e,n.length);return powMod_(a,trim(t,2),trim(n,2),0),trim(a,1)}function sub(e,t){var n=expand(e,e.length>t.length?e.length+1:t.length+1);return sub_(n,t),trim(n,1)}function add(e,t){var n=expand(e,e.length>t.length?e.length+1:t.length+1);return add_(n,t),trim(n,1)}function inverseMod(e,t){var n,a=expand(e,t.length);return n=inverseMod_(a,t),n?trim(a,1):null}function multMod(e,t,n){var a=expand(e,n.length);return multMod_(a,t,n),trim(a,1)}function randTruePrime_(e,t){var n,a,i,o,s,r,l,c,d,u,p;if(0==primes.length&&(primes=findPrimes(3e4)),0==pows.length)for(pows=new Array(512),s=0;512>s;s++)pows[s]=Math.pow(2,s/511-1);if(n=.1,a=20,recLimit=20,s_i2.length!=e.length&&(s_i2=dup(e),s_R=dup(e),s_n1=dup(e),s_r2=dup(e),s_d=dup(e),s_x1=dup(e),s_x2=dup(e),s_b=dup(e),s_n=dup(e),s_i=dup(e),s_rm=dup(e),s_q=dup(e),s_a=dup(e),s_aa=dup(e)),recLimit>=t){for(i=(1<<(t+2>>1))-1,copyInt_(e,0),o=1;o;)for(o=0,e[0]=1|1<2*a)for(r=1;a>=t-t*r;)r=pows[Math.floor(512*Math.random())];else r=.5;for(p=Math.floor(r*t)+1,randTruePrime_(s_q,p),copyInt_(s_i2,0),s_i2[Math.floor((t-2)/bpe)]|=1<<(t-2)%bpe,divide_(s_i2,s_q,s_i,s_rm),d=bitSize(s_i);;){for(;randBigInt_(s_R,d,0),!greater(s_i,s_R););for(addInt_(s_R,1),add_(s_R,s_i),copy_(s_n,s_q),mult_(s_n,s_R),multInt_(s_n,2),addInt_(s_n,1),copy_(s_r2,s_R),multInt_(s_r2,2),c=0,s=0;s0;s--);for(u=0,w=s_n[s];w;w>>=1,u++);for(u+=bpe*s;randBigInt_(s_a,u,0),!greater(s_n,s_a););if(addInt_(s_n,3),addInt_(s_a,2),copy_(s_b,s_a),copy_(s_n1,s_n),addInt_(s_n1,-1),powMod_(s_b,s_n1,s_n),addInt_(s_b,-1),isZero(s_b)&&(copy_(s_b,s_a),powMod_(s_b,s_r2,s_n),addInt_(s_b,-1),copy_(s_aa,s_n),copy_(s_d,s_b),GCD_(s_d,s_n),equalsInt(s_d,1)))return void copy_(e,s_aa)}}}function randBigInt(e,t){var n,a;return n=Math.floor((e-1)/bpe)+2,a=int2bigInt(0,0,n),randBigInt_(a,e,t),a}function randBigInt_(e,t,n){var a,i;for(a=0;aa;a++)e[a]=Math.floor(Math.random()*(1<=0;a--);for(i=e[a],o=n[a],s=1,r=0,l=0,c=1;o+l&&o+c&&(d=Math.floor((i+s)/(o+l)),qp=Math.floor((i+r)/(o+c)),d==qp);)t=s-d*l,s=l,l=t,t=r-d*c,r=c,c=t,t=i-d*o,i=o,o=t;r?(copy_(T,e),linComb_(e,n,s,r),linComb_(n,T,c,l)):(mod_(e,n),copy_(T,e),copy_(e,n),copy_(n,T))}if(0!=n[0])for(t=modInt(e,n[0]),copyInt_(e,n[0]),n[0]=t;n[0];)e[0]%=n[0],t=e[0],e[0]=n[0],n[0]=t}function inverseMod_(e,t){var n=1+2*Math.max(e.length,t.length);if(!(1&e[0]||1&t[0]))return copyInt_(e,0),0;for(eg_u.length!=n&&(eg_u=new Array(n),eg_v=new Array(n),eg_A=new Array(n),eg_B=new Array(n),eg_C=new Array(n),eg_D=new Array(n)),copy_(eg_u,e),copy_(eg_v,t),copyInt_(eg_A,1),copyInt_(eg_B,0),copyInt_(eg_C,0),copyInt_(eg_D,1);;){for(;!(1&eg_u[0]);)halve_(eg_u),1&eg_A[0]||1&eg_B[0]?(add_(eg_A,t),halve_(eg_A),sub_(eg_B,e),halve_(eg_B)):(halve_(eg_A),halve_(eg_B));for(;!(1&eg_v[0]);)halve_(eg_v),1&eg_C[0]||1&eg_D[0]?(add_(eg_C,t),halve_(eg_C),sub_(eg_D,e),halve_(eg_D)):(halve_(eg_C),halve_(eg_D));if(greater(eg_v,eg_u)?(sub_(eg_v,eg_u),sub_(eg_C,eg_A),sub_(eg_D,eg_B)):(sub_(eg_u,eg_v),sub_(eg_A,eg_C),sub_(eg_B,eg_D)),equalsInt(eg_u,0)){for(;negative(eg_C);)add_(eg_C,t);return copy_(e,eg_C),equalsInt(eg_v,1)?1:(copyInt_(e,0),0)}}}function inverseModInt(e,t){for(var n=1,a=0;;){if(1==e)return n;if(0==e)return 0;if(a-=n*Math.floor(t/e),t%=e,1==t)return a;if(0==t)return 0;n-=a*Math.floor(e/t),e%=t}}function inverseModInt_(e,t){return inverseModInt(e,t)}function eGCD_(e,t,n,a,i){var o=0,s=Math.max(e.length,t.length);for(eg_u.length!=s&&(eg_u=new Array(s),eg_A=new Array(s),eg_B=new Array(s),eg_C=new Array(s),eg_D=new Array(s));!(1&e[0]||1&t[0]);)halve_(e),halve_(t),o++;for(copy_(eg_u,e),copy_(n,t),copyInt_(eg_A,1),copyInt_(eg_B,0),copyInt_(eg_C,0),copyInt_(eg_D,1);;){for(;!(1&eg_u[0]);)halve_(eg_u),1&eg_A[0]||1&eg_B[0]?(add_(eg_A,t),halve_(eg_A),sub_(eg_B,e),halve_(eg_B)):(halve_(eg_A),halve_(eg_B));for(;!(1&n[0]);)halve_(n),1&eg_C[0]||1&eg_D[0]?(add_(eg_C,t),halve_(eg_C),sub_(eg_D,e),halve_(eg_D)):(halve_(eg_C),halve_(eg_D));if(greater(n,eg_u)?(sub_(n,eg_u),sub_(eg_C,eg_A),sub_(eg_D,eg_B)):(sub_(eg_u,n),sub_(eg_A,eg_C),sub_(eg_B,eg_D)),equalsInt(eg_u,0)){for(;negative(eg_C);)add_(eg_C,t),sub_(eg_D,e);return multInt_(eg_D,-1),copy_(a,eg_C),copy_(i,eg_D),void leftShift_(n,o)}}}function negative(e){return e[e.length-1]>>bpe-1&1}function greaterShift(e,t,n){var a,i=e.length,o=t.length;for(k=o>i+n?i+n:o,a=o-1-n;i>a&&a>=0;a++)if(e[a]>0)return 1;for(a=i-1+n;o>a;a++)if(t[a]>0)return 0;for(a=k-1;a>=n;a--){if(e[a-n]>t[a])return 1;if(e[a-n]=0;n--){if(e[n]>t[n])return 1;if(e[n]>=1;for(d=bpe-d,leftShift_(t,d),leftShift_(a,d),i=a.length;0==a[i-1]&&i>o;i--);for(copyInt_(n,0);!greaterShift(t,a,i-o);)subShift_(a,t,i-o),n[i-o]++;for(s=i-1;s>=o;s--){for(n[s-o]=a[s]==t[o-1]?mask:Math.floor((a[s]*radix+a[s-1])/t[o-1]);l=(o>1?t[o-2]:0)*n[s-o],c=l>>bpe,l&=mask,r=c+n[s-o]*t[o-1],c=r>>bpe,r&=mask,c==a[s]?r==a[s-1]?l>(s>1?a[s-2]:0):r>a[s-1]:c>a[s];)n[s-o]--;linCombShift_(a,t,-n[s-o],s-o),negative(a)&&(addShift_(a,t,s-o),n[s-o]--)}rightShift_(t,d),rightShift_(a,d)}function carry_(e){var t,n,a,i;for(n=e.length,a=0,t=0;n>t;t++)a+=e[t],i=0,0>a&&(i=-(a>>bpe),a+=i*radix),e[t]=a&mask,a=(a>>bpe)-i}function modInt(e,t){var n,a=0;for(n=e.length-1;n>=0;n--)a=(a*radix+e[n])%t;return a}function int2bigInt(e,t,n){var a;return a=Math.ceil(t/bpe)+1,a=n>a?n:a,buff=new Array(a),copyInt_(buff,e),buff}function str2bigInt(e,t,n){var a,i,o,s,r,l=e.length;if(-1==t){for(o=new Array(0);;){for(s=new Array(o.length+1),i=0;ia)break;if(e=e.substring(a+1),0==e.length)break}return o.lengthi&&(a=digitsStr.indexOf(e.substring(i,i+1),0),36>=t&&a>=36&&(a-=26),!(a>=t||0>a));i++)multInt_(o,t),addInt_(o,a);for(l=o.length;l>0&&!o[l-1];l--);for(l=n>l+1?n:l+1,s=new Array(l),r=li;i++)s[i]=o[i];for(;l>i;i++)s[i]=0;return s}function equalsInt(e,t){var n;if(e[0]!=t)return 0;for(n=1;nn;n++)if(e[n]!=t[n])return 0;if(e.length>t.length){for(;n0;n--)i+=e[n]+",";i+=e[0]}else for(;!isZero(s6);)a=divInt_(s6,t),i=digitsStr.substring(a,a+1)+i;return 0==i.length&&(i="0"),i}function dup(e){return buff=new Array(e.length),copy_(buff,e),buff}function copy_(e,t){var n,a=e.lengthn;n++)e[n]=t[n];for(n=a;n>=bpe}function addInt_(e,t){var n,a,i,o;for(e[0]+=t,a=e.length,i=0,n=0;a>n;n++)if(i+=e[n],o=0,0>i&&(o=-(i>>bpe),i+=o*radix),e[n]=i&mask,i=(i>>bpe)-o,!i)return}function rightShift_(e,t){var n,a=Math.floor(t/bpe);if(a){for(n=0;n>t);e[n]>>=t}function halve_(e){var t;for(t=0;t>1);e[t]=e[t]>>1|e[t]&radix>>1}function leftShift_(e,t){var n,a=Math.floor(t/bpe);if(a){for(n=e.length;n>=a;n--)e[n]=e[n-a];for(;n>=0;n--)e[n]=0;t%=bpe}if(t){for(n=e.length-1;n>0;n--)e[n]=mask&(e[n]<>bpe-t);e[n]=mask&e[n]<n;n++)i+=e[n]*t,o=0,0>i&&(o=-(i>>bpe),i+=o*radix),e[n]=i&mask,i=(i>>bpe)-o}function divInt_(e,t){var n,a,i=0;for(n=e.length-1;n>=0;n--)a=i*radix+e[n],e[n]=Math.floor(a/t),i=a%t;return i}function linComb_(e,t,n,a){var i,o,s,r;for(s=e.lengthi;i++)o+=n*e[i]+a*t[i],e[i]=o&mask,o>>=bpe;for(i=s;r>i;i++)o+=n*e[i],e[i]=o&mask,o>>=bpe}function linCombShift_(e,t,n,a){var i,o,s,r;for(s=e.lengthi;i++)o+=e[i]+n*t[i-a],e[i]=o&mask,o>>=bpe;for(i=s;o&&r>i;i++)o+=e[i],e[i]=o&mask,o>>=bpe}function addShift_(e,t,n){var a,i,o,s;for(o=e.lengtha;a++)i+=e[a]+t[a-n],e[a]=i&mask,i>>=bpe;for(a=o;i&&s>a;a++)i+=e[a],e[a]=i&mask,i>>=bpe}function subShift_(e,t,n){var a,i,o,s;for(o=e.lengtha;a++)i+=e[a]-t[a-n],e[a]=i&mask,i>>=bpe;for(a=o;i&&s>a;a++)i+=e[a],e[a]=i&mask,i>>=bpe}function sub_(e,t){var n,a,i;for(i=e.lengthn;n++)a+=e[n]-t[n],e[n]=a&mask,a>>=bpe;for(n=i;a&&n>=bpe}function add_(e,t){var n,a,i;for(i=e.lengthn;n++)a+=e[n]+t[n],e[n]=a&mask,a>>=bpe;for(n=i;a&&n>=bpe}function mult_(e,t){var n;for(ss.length!=2*e.length&&(ss=new Array(2*e.length)),copyInt_(ss,0),n=0;n0&&!e[o-1];o--);for(s=o>t.length?2*o:2*t.length,s0.length!=s&&(s0=new Array(s)),copyInt_(s0,0),n=0;o>n;n++){for(i=s0[2*n]+e[n]*e[n],s0[2*n]=i&mask,i>>=bpe,a=n+1;o>a;a++)i=s0[n+a]+2*e[n]*e[a]+i,s0[n+a]=i&mask,i>>=bpe;s0[n+o]=i}mod_(s0,t),copy_(e,s0)}function trim(e,t){var n,a;for(n=e.length;n>0&&!e[n-1];n--);return a=new Array(n+t),copy_(a,e),a}function powMod_(e,t,n){var a,i,o,s;if(s7.length!=n.length&&(s7=dup(n)),0!=(1&n[0])){for(copyInt_(s7,0),o=n.length;o>0&&!n[o-1];o--);for(s=radix-inverseModInt(modInt(n,radix),radix),s7[o]=1,multMod_(e,s7,n),s3.length!=e.length?s3=dup(e):copy_(s3,e),a=t.length-1;a>0&!t[a];a--);if(0==t[a])return void copyInt_(e,1);for(i=1<>=1);for(;;){if(!(i>>=1)){if(a--,0>a)return void mont_(e,one,n,s);i=1<0&&0==n[d-1];d--);for(;u>0&&0==t[u-1];u--);for(c=sa.length-1,i=0;d>i;i++){for(l=sa[0]+e[i]*t[0],r=(l&mask)*a&mask,s=l+r*n[0]>>bpe,l=e[i],o=1;u-4>o;)s+=sa[o]+r*n[o]+l*t[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o]+l*t[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o]+l*t[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o]+l*t[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o]+l*t[o],sa[o-1]=s&mask,s>>=bpe,o++;for(;u>o;)s+=sa[o]+r*n[o]+l*t[o],sa[o-1]=s&mask,s>>=bpe,o++;for(;d-4>o;)s+=sa[o]+r*n[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o],sa[o-1]=s&mask,s>>=bpe,o++,s+=sa[o]+r*n[o],sa[o-1]=s&mask,s>>=bpe,o++;for(;d>o;)s+=sa[o]+r*n[o],sa[o-1]=s&mask,s>>=bpe,o++;for(;c>o;)s+=sa[o],sa[o-1]=s&mask,s>>=bpe,o++;sa[o-1]=s&mask}greater(n,sa)||sub_(sa,n),copy_(e,sa)}function dT(){return"["+(((new Date).getTime()-_logTimer)/1e3).toFixed(3)+"]"}function checkClick(e,t){return 1==e.which&&(e.ctrlKey||e.metaKey)||2==e.which?!0:(t||e.preventDefault(),!1)}function isInDOM(e,t){return e?(t=t||document.body,e==t?!0:isInDOM(e.parentNode,t)):!1}function checkDragEvent(e){if(!e||e.target&&("IMG"==e.target.tagName||"A"==e.target.tagName))return!1;if(!e.dataTransfer||!e.dataTransfer.types)return!0;for(var t=0;t").css({position:"absolute",width:100,height:100,overflow:"scroll",top:-9999}).appendTo($(document.body)),t=e[0].offsetWidth-e[0].clientWidth;return e.remove(),t}function onCtrlEnter(e,t){$(e).on("keydown",function(e){return 13==e.keyCode&&(e.ctrlKey||e.metaKey)?(t(),cancelEvent(e)):void 0})}function setFieldSelection(e,t,n){e=$(e)[0];try{if(e.focus(),(void 0===t||t===!1)&&(t=e.value.length),(void 0===n||n===!1)&&(n=t),e.createTextRange){var a=e.createTextRange();a.collapse(!0),a.moveEnd("character",n),a.moveStart("character",t),a.select()}else e.setSelectionRange&&e.setSelectionRange(t,n)}catch(i){}}function getFieldSelection(e){if(e.selectionStart)return e.selectionStart;if(!document.selection)return 0;var t="",n=document.selection.createRange(),a=n.text,i=n.duplicate(),o=0;try{i.moveToElementText(e)}catch(s){return 0}return n.text=a+t,o=i.text.indexOf(t),n.moveStart("character",-1),n.text="",o}function getRichValue(e){if(!e)return"";var t=[],n=[];getRichElementValue(e,t,n),n.length&&t.push(n.join(""));var a=t.join("\n");return a=a.replace(/\u00A0/g," ")}function getRichValueWithCaret(e){if(!e)return[];var t,n,a=[],i=[],o=window.getSelection?window.getSelection():!1;if(o&&o.rangeCount){var s=o.getRangeAt(0);s.startContainer&&s.startContainer==s.endContainer&&s.startOffset==s.endOffset&&(t=s.startContainer,n=s.startOffset)}getRichElementValue(e,a,i,t,n),i.length&&a.push(i.join(""));var r=a.join("\n"),l=r.indexOf("");return-1!=l&&(r=r.substr(0,l)+r.substr(l+1)),r=r.replace(/\u00A0/g," "),[r,l]}function getRichElementValue(e,t,n,a,i){if(3!=e.nodeType){if(1==e.nodeType){var o,s=a===e,r="DIV"==e.tagName||"P"==e.tagName;r&&n.length||"BR"==e.tagName?(t.push(n.join("")),n.splice(0,n.length)):"IMG"==e.tagName&&e.alt&&n.push(e.alt),s&&!i&&n.push("");for(var o=e.firstChild;o;)getRichElementValue(o,t,n,a,i),o=o.nextSibling;s&&i&&n.push(""),r&&n.length&&(t.push(n.join("")),n.splice(0,n.length))}}else if(a===e){var l=e.nodeValue;n.push(l.substr(0,i)+""+l.substr(i))}else n.push(e.nodeValue)}function setRichFocus(e,t,n){if(e.focus(),!t||t.parentNode!=e||t.nextSibling||n||(e.removeChild(t),t=null),window.getSelection&&document.createRange){var a=document.createRange();t?a.selectNode(t):a.selectNodeContents(e),n||a.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(a)}else if(void 0!==document.body.createTextRange){var o=document.body.createTextRange();o.moveToElementText(t||e),n||o.collapse(!1),o.select()}}function getSelectedText(){var e=(window.getSelection&&window.getSelection()||document.getSelection&&document.getSelection()||document.selection&&document.selection.createRange().text||"").toString().replace(/^\s+|\s+$/g,"");return e}function scrollToNode(e,t,n){var a=t.offsetTop-15,i=t.offsetHeight+30,o=e.scrollTop,s=e.clientHeight;o>a?(e.scrollTop=a,$(n).nanoScroller({flash:!0})):a+i-s>o&&(e.scrollTop=a+i-s,$(n).nanoScroller({flash:!0}))}function onContentLoaded(e){e=onAnimationFrameCallback(e),setZeroTimeout(e)}function tsNow(e){var t=+new Date+(window.tsOffset||0);return e?Math.floor(t/1e3):t}function safeReplaceObject(e,t){for(var n in e)t.hasOwnProperty(n)||"$"==n.charAt(0)||delete e[n];for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function listMergeSorted(e,t){e=e||[],t=t||[];for(var n=angular.copy(e),a=e.length?e[e.length-1]:4294967295,i=0;i/g,">")}function calcImageInBox(e,t,n,a,i){var o=n,s=a;return e/t>n/a?s=parseInt(t*n/e):(o=parseInt(e*a/t),o>n&&(s=parseInt(s*n/o),o=n)),i&&o>=e&&s>=t&&(o=e,s=t),{w:o,h:s}}function versionCompare(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,a=Math.max(e.length,t.length);for(n=0;a>n;n++)if(e[n]!=t[n])return e[n]>t[n]?1:-1;return 0}function bigint(e){return new BigInteger(e.toString(16),16)}function bigStringInt(e){return new BigInteger(e,10)}function dHexDump(e){for(var t=[],n=0;nt;t+=2)i.push(parseInt(e.substr(t,2),16));return i}function bytesToBase64(e){for(var t,n="",a=e.length,i=0,o=0;a>o;o++)t=o%3,i|=e[o]<<(16>>>t&24),(2===t||a-o===1)&&(n+=String.fromCharCode(uint6ToBase64(i>>>18&63),uint6ToBase64(i>>>12&63),uint6ToBase64(i>>>6&63),uint6ToBase64(63&i)),i=0);return n.replace(/A(?=A$|$)/g,"=")}function uint6ToBase64(e){return 26>e?e+65:52>e?e+71:62>e?e-4:62===e?43:63===e?47:65}function base64ToBlob(e,t){for(var n=1024,a=atob(e),i=a.length,o=Math.ceil(i/n),s=new Array(o),r=0;o>r;++r){for(var l=r*n,c=Math.min(l+n,i),d=new Array(c-l),u=l,p=0;c>u;++p,++u)d[p]=a[u].charCodeAt(0);s[r]=new Uint8Array(d)}return blobConstruct(s,t)}function dataUrlToBlob(e){var t=e.split(","),n=t[1],a=t[0].split(":")[1].split(";")[0],i=base64ToBlob(n,a);return i}function blobConstruct(e,t){var n;try{n=new Blob(e,{type:t})}catch(a){var i=new BlobBuilder;angular.forEach(e,function(e){i.append(e)}),n=i.getBlob(t)}return n}function bytesCmp(e,t){var n=e.length;if(n!=t.length)return!1;for(var a=0;n>a;a++)if(e[a]!=t[a])return!1;return!0}function bytesXor(e,t){for(var n=e.length,a=[],i=0;n>i;++i)a[i]=e[i]^t[i];return a}function bytesToWords(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var t,n=e.length,a=[];for(t=0;n>t;t++)a[t>>>2]|=e[t]<<24-t%4*8;return new CryptoJS.lib.WordArray.init(a,n)}function bytesFromWords(e){for(var t=e.words,n=e.sigBytes,a=[],i=0;n>i;i++)a.push(t[i>>>2]>>>24-i%4*8&255);return a}function bytesFromBigInt(e,t){var n=e.toByteArray();if(t&&n.lengthi;i++)a[i]=0;n=n instanceof ArrayBuffer?bufferConcat(a,n):a.concat(n)}else for(;!n[0]&&(!t||n.length>t);)n=n.slice(1);return n}function bytesFromLeemonBigInt(e){var t=bigInt2str(e,16);return bytesFromHex(t)}function bytesToArrayBuffer(e){return new Uint8Array(e).buffer}function convertToArrayBuffer(e){return e instanceof ArrayBuffer?e:void 0!==e.buffer&&e.buffer.byteLength==e.length*e.BYTES_PER_ELEMENT?e.buffer:bytesToArrayBuffer(e)}function convertToUint8Array(e){return void 0!==e.buffer?e:new Uint8Array(e)}function convertToByteArray(e){if(Array.isArray(e))return e;e=convertToUint8Array(e);for(var t=[],n=0,a=e.length;a>n;n++)t.push(e[n]);return t}function bytesFromArrayBuffer(e){for(var t=e.byteLength,n=new Uint8Array(e),a=[],i=0;t>i;++i)a[i]=n[i];return a}function bufferConcat(e,t){var n=e.byteLength||e.length,a=t.byteLength||t.length,i=new Uint8Array(n+a);return i.set(e instanceof ArrayBuffer?new Uint8Array(e):e,0),i.set(t instanceof ArrayBuffer?new Uint8Array(t):t,n),i.buffer}function longToInts(e){var t=bigStringInt(e).divideAndRemainder(bigint(4294967296));return[t[0].intValue(),t[1].intValue()]}function longToBytes(e){return bytesFromWords({words:longToInts(e),sigBytes:8}).reverse()}function longFromInts(e,t){return bigint(e).shiftLeft(32).add(bigint(t)).toString(10)}function intToUint(e){return e=parseInt(e),0>e&&(e+=4294967296),e}function uintToInt(e){return e>2147483647&&(e-=4294967296),e}function sha1HashSync(e){this.rushaInstance=this.rushaInstance||new Rusha(1048576);var t=rushaInstance.rawDigest(e).buffer;return t}function sha1BytesSync(e){return bytesFromArrayBuffer(sha1HashSync(e))}function sha256HashSync(e){var t=CryptoJS.SHA256(bytesToWords(e)),n=bytesFromWords(t);return n}function rsaEncrypt(e,t){t=addPadding(t,255);var n=new BigInteger(e.modulus,16),a=new BigInteger(e.exponent,16),i=new BigInteger(t),o=i.modPowInt(a,n),s=bytesFromBigInt(o,256);return s}function addPadding(e,t,n){t=t||16;var a=e.byteLength||e.length,i=t-a%t;if(i>0&&t>i){var o=new Array(i);if(n)for(var s=0;i>s;s++)o[s]=0;else(new SecureRandom).nextBytes(o);e=e instanceof ArrayBuffer?bufferConcat(e,o):e.concat(o)}return e}function aesEncryptSync(e,t,n){e.byteLength||e.length;e=addPadding(e);var a=CryptoJS.AES.encrypt(bytesToWords(e),bytesToWords(t),{iv:bytesToWords(n),padding:CryptoJS.pad.NoPadding,mode:CryptoJS.mode.IGE}).ciphertext,i=bytesFromWords(a);return i}function aesDecryptSync(e,t,n){var a=CryptoJS.AES.decrypt({ciphertext:bytesToWords(e)},bytesToWords(t),{iv:bytesToWords(n),padding:CryptoJS.pad.NoPadding,mode:CryptoJS.mode.IGE}),i=bytesFromWords(a);return i}function gzipUncompress(e){var t=new Zlib.Gunzip(e).decompress();return t}function nextRandomInt(e){return Math.floor(Math.random()*e)}function pqPrimeFactorization(e){var t=new BigInteger(e),n=!1;try{n=pqPrimeLeemon(str2bigInt(t.toString(16),16,Math.ceil(64/bpe)+1))}catch(a){console.error("Pq leemon Exception",a)}if(n===!1&&t.bitLength()<=64)try{n=pqPrimeLong(goog.math.Long.fromString(t.toString(16),16))}catch(a){console.error("Pq long Exception",a)}return n===!1&&(n=pqPrimeBigInteger(t)),n}function pqPrimeBigInteger(e){for(var t,n=0,a=0;3>a;a++){for(var i=(15&nextRandomInt(128))+17,o=bigint(nextRandomInt(1e9)+1),s=o.clone(),r=1<l;l++){++n;for(var c=o.clone(),d=o.clone(),u=bigint(i);!d.equals(BigInteger.ZERO);)d.and(BigInteger.ONE).equals(BigInteger.ZERO)||(u=u.add(c),u.compareTo(e)>0&&(u=u.subtract(e))),c=c.add(c),c.compareTo(e)>0&&(c=c.subtract(e)),d=d.shiftRight(1);o=u.clone();var p=o.compareTo(s)<0?s.subtract(o):o.subtract(s);if(t=p.gcd(e),!t.equals(BigInteger.ONE))break;0==(l&l-1)&&(s=o.clone())}if(t.compareTo(BigInteger.ONE)>0)break}var m,g,h=e.divide(t);return t.compareTo(h)>0?(m=h,g=t):(m=t,g=h),[bytesFromBigInt(m),bytesFromBigInt(g),n]}function gcdLong(e,t){for(;e.notEquals(goog.math.Long.ZERO)&&t.notEquals(goog.math.Long.ZERO);){for(;t.and(goog.math.Long.ONE).equals(goog.math.Long.ZERO);)t=t.shiftRight(1);for(;e.and(goog.math.Long.ONE).equals(goog.math.Long.ZERO);)e=e.shiftRight(1);e.compare(t)>0?e=e.subtract(t):t=t.subtract(e)}return t.equals(goog.math.Long.ZERO)?e:t}function pqPrimeLong(e){for(var t,n=0,a=0;3>a;a++){for(var i=goog.math.Long.fromInt((15&nextRandomInt(128))+17),o=goog.math.Long.fromInt(nextRandomInt(1e9)+1),s=o,r=1<l;l++){++n;for(var c=o,d=o,u=i;d.notEquals(goog.math.Long.ZERO);)d.and(goog.math.Long.ONE).notEquals(goog.math.Long.ZERO)&&(u=u.add(c),u.compare(e)>0&&(u=u.subtract(e))),c=c.add(c),c.compare(e)>0&&(c=c.subtract(e)),d=d.shiftRight(1);o=u;var p=o.compare(s)<0?s.subtract(o):o.subtract(s);if(t=gcdLong(p,e),t.notEquals(goog.math.Long.ONE))break;0==(l&l-1)&&(s=o)}if(t.compare(goog.math.Long.ONE)>0)break}var m,g,h=e.div(t);return t.compare(h)>0?(m=h,g=t):(m=t,g=h),[bytesFromHex(m.toString(16)),bytesFromHex(g.toString(16)),n]}function pqPrimeLeemon(e){var t,n,a,i,o,s,r,l=64,c=Math.ceil(l/bpe)+1,d=0,u=new Array(c),p=new Array(c),m=new Array(c),o=new Array(c),g=new Array(c),h=new Array(c),f=new Array(c);for(t=0;3>t;t++){for(n=(15&nextRandomInt(128))+17,copyInt_(h,nextRandomInt(1e9)+1),copy_(f,h),i=1<a;a++){for(++d,copy_(u,h),copy_(p,h),copyInt_(m,n);!isZero(p);)1&p[0]&&(add_(m,u),greater(m,e)&&sub_(m,e)),add_(u,u),greater(u,e)&&sub_(u,e),rightShift_(p,1);if(copy_(h,m),greater(h,f)?(copy_(g,h),sub_(g,f)):(copy_(g,f),sub_(g,h)),eGCD_(g,e,o,u,p),!equalsInt(o,1))break;0==(a&a-1)&©_(f,h)}if(greater(o,one))break}return divide_(e,o,h,f),greater(o,h)?(s=h,r=o):(s=o,r=h),[bytesFromLeemonBigInt(s),bytesFromLeemonBigInt(r),d]}function bytesModPow(e,t,n){try{var a=str2bigInt(bytesToHex(e),16),i=str2bigInt(bytesToHex(t),16),o=str2bigInt(bytesToHex(n),16),s=powMod(a,i,o);return bytesFromHex(bigInt2str(s,16))}catch(r){console.error("mod pow error",r)}return bytesFromBigInt(new BigInteger(e).modPow(new BigInteger(t),new BigInteger(n)),256)}function TLSerialization(e){return e=e||{},this.maxLength=e.startMaxLength||2048,this.offset=0,this.createBuffer(),this.mtproto=e.mtproto||!1,this}function TLDeserialization(e,t){return t=t||{},this.offset=0,this.override=t.override||{},this.buffer=e,this.intView=new Uint32Array(this.buffer),this.byteView=new Uint8Array(this.buffer),this.mtproto=t.mtproto||!1,this}function EmojiTooltip(e,t){t=t||{};var n=this;this.btnEl=$(e),this.onEmojiSelected=t.onEmojiSelected,this.onStickerSelected=t.onStickerSelected,this.getStickers=t.getStickers,this.getStickerImage=t.getStickerImage,this.onStickersetSelected=t.onStickersetSelected,this.langpack=t.langpack||{},Config.Navigator.touch||$(this.btnEl).on("mouseenter mouseleave",function(e){n.isOverBtn="mouseenter"==e.type,n.createTooltip(),n.isOverBtn?n.onMouseEnter(!0):n.onMouseLeave(!0)}),$(this.btnEl).on("mousedown",function(e){return n.shown?(clearTimeout(n.hideTimeout),delete n.hideTimeout,n.hide()):(clearTimeout(n.showTimeout),delete n.showTimeout,n.createTooltip(),n.show()),cancelEvent(e)}),$(document).on("mousedown",function(){n.shown&&n.hide()})}function EmojiPanel(e,t){t=t||{};var n=this;this.containerEl=$(e),this.onEmojiSelected=t.onEmojiSelected,this.containerEl.on("mousedown",function(e){e=e.originalEvent||e;var t,a=$(e.target);return"A"!=a[0].tagName&&(a=$(a[0].parentNode)),(t=a.attr("data-code"))&&(n.onEmojiSelected&&n.onEmojiSelected(t),EmojiHelper.pushPopularEmoji(t)),cancelEvent(e)}),this.update()}function MessageComposer(e,t){var n=this;this.textareaEl=$(e),this.setUpInput(),this.autoCompleteWrapEl=$('
').appendTo(document.body);var a=$("
").appendTo(this.autoCompleteWrapEl);t.dropdownDirective(a,function(e,t){n.autoCompleteEl=t,n.autoCompleteScope=e,n.setUpAutoComplete()}),this.isActive=!1,this.onTyping=t.onTyping,this.onMessageSubmit=t.onMessageSubmit,this.getSendOnEnter=t.getSendOnEnter,this.onFilePaste=t.onFilePaste,this.onCommandSend=t.onCommandSend,this.onInlineResultSend=t.onInlineResultSend,this.mentions=t.mentions,this.commands=t.commands}function Scroller(e,t){t=t||{};t.classPrefix||"scroller";this.content=$(e),this.useNano=void 0!==t.nano?t.nano:!Config.Mobile,this.maxHeight=t.maxHeight,this.minHeight=t.minHeight,this.useNano?this.setUpNano():this.setUpNative(),this.updateHeight()}!function(e){"use strict";e.console=e.console||{};for(var t,n,a=e.console,i={},o=function(){},s="memory".split(","),r="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=s.pop();)a[t]||(a[t]=i);for(;n=r.pop();)a[n]||(a[n]=o)}("undefined"==typeof window?this:window),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n;if(null==this)throw new TypeError('"this" is null or not defined');var a=Object(this),i=a.length>>>0;if(0===i)return-1;var o=+t||0;if(1/0===Math.abs(o)&&(o=0),o>=i)return-1;for(n=Math.max(o>=0?o:i-Math.abs(o),0);i>n;){if(n in a&&a[n]===e)return n;n++}return-1}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),"function"!=typeof Object.create&&(Object.create=function(){var e=function(){};return function(t){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof t)throw TypeError("Argument must be an object");e.prototype=t;var n=new e;return e.prototype=null,n}}()),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),n=this,a=function(){},i=function(){return n.apply(this instanceof a&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return a.prototype=this.prototype,i.prototype=new a,i}),function(e){function t(t){a.push(t),e.postMessage(i,"*")}function n(t){if(t.source==e&&t.data==i&&(t.stopPropagation(),a.length>0)){var n=a.shift();n()}}var a=[],i="zero-timeout-message";e.addEventListener("message",n,!0);var o=e.setTimeout;e.setTimeout=function(e,n){return!n||5>=n?t(e):o(e,n)},e.setZeroTimeout=t}(this),!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=it.type(e);return"function"===n||it.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function a(e,t,n){if(it.isFunction(t))return it.grep(e,function(e,a){return!!t.call(e,a,e)!==n});if(t.nodeType)return it.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(pt.test(t))return it.filter(t,e,n);t=it.filter(t,e)}return it.grep(e,function(e){return it.inArray(e,t)>=0!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t=bt[e]={};return it.each(e.match(yt)||[],function(e,n){t[n]=!0}),t}function s(){gt.addEventListener?(gt.removeEventListener("DOMContentLoaded",r,!1),e.removeEventListener("load",r,!1)):(gt.detachEvent("onreadystatechange",r),e.detachEvent("onload",r))}function r(){(gt.addEventListener||"load"===event.type||"complete"===gt.readyState)&&(s(),it.ready())}function l(e,t,n){if(void 0===n&&1===e.nodeType){var a="data-"+t.replace(St,"-$1").toLowerCase();if(n=e.getAttribute(a),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ct.test(n)?it.parseJSON(n):n}catch(i){}it.data(e,t,n)}else n=void 0}return n}function c(e){var t;for(t in e)if(("data"!==t||!it.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function d(e,t,n,a){if(it.acceptData(e)){var i,o,s=it.expando,r=e.nodeType,l=r?it.cache:e,c=r?e[s]:e[s]&&s;if(c&&l[c]&&(a||l[c].data)||void 0!==n||"string"!=typeof t)return c||(c=r?e[s]=K.pop()||it.guid++:s),l[c]||(l[c]=r?{}:{toJSON:it.noop}),("object"==typeof t||"function"==typeof t)&&(a?l[c]=it.extend(l[c],t):l[c].data=it.extend(l[c].data,t)),o=l[c],a||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[it.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[it.camelCase(t)])):i=o,i}}function u(e,t,n){if(it.acceptData(e)){var a,i,o=e.nodeType,s=o?it.cache:e,r=o?e[it.expando]:it.expando;if(s[r]){if(t&&(a=n?s[r]:s[r].data)){it.isArray(t)?t=t.concat(it.map(t,it.camelCase)):t in a?t=[t]:(t=it.camelCase(t),t=t in a?[t]:t.split(" ")),i=t.length;for(;i--;)delete a[t[i]];if(n?!c(a):!it.isEmptyObject(a))return}(n||(delete s[r].data,c(s[r])))&&(o?it.cleanData([e],!0):nt.deleteExpando||s!=s.window?delete s[r]:s[r]=null)}}}function p(){return!0}function m(){return!1}function g(){try{return gt.activeElement}catch(e){}}function h(e){var t=Nt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function f(e,t){var n,a,i=0,o=typeof e.getElementsByTagName!==$t?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==$t?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(a=n[i]);i++)!t||it.nodeName(a,t)?o.push(a):it.merge(o,f(a,t));return void 0===t||t&&it.nodeName(e,t)?it.merge([e],o):o}function _(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function v(e,t){return it.nodeName(e,"table")&&it.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function y(e){return e.type=(null!==it.find.attr(e,"type"))+"/"+e.type,e}function b(e){var t=Gt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){for(var n,a=0;null!=(n=e[a]);a++)it._data(n,"globalEval",!t||it._data(t[a],"globalEval"))}function k(e,t){if(1===t.nodeType&&it.hasData(e)){var n,a,i,o=it._data(e),s=it._data(t,o),r=o.events;if(r){delete s.handle,s.events={};for(n in r)for(a=0,i=r[n].length;i>a;a++)it.event.add(t,n,r[n][a])}s.data&&(s.data=it.extend({},s.data))}}function $(e,t){var n,a,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!nt.noCloneEvent&&t[it.expando]){i=it._data(t);for(a in i.events)it.removeEvent(t,a,i.handle);t.removeAttribute(it.expando)}"script"===n&&t.text!==e.text?(y(t).text=e.text,b(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),nt.html5Clone&&e.innerHTML&&!it.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function C(t,n){var a,i=it(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(a=e.getDefaultComputedStyle(i[0]))?a.display:it.css(i[0],"display");return i.detach(),o}function S(e){var t=gt,n=Qt[e];return n||(n=C(e,t),"none"!==n&&n||(Jt=(Jt||it("