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.

20 lines
930 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,a,o){for(;--o>=0;){var r=t*this[e++]+n[i]+a;a=Math.floor(r/67108864),n[i++]=67108863&r}return a}function am2(e,t,n,i,a,o){for(var r=32767&t,s=t>>15;--o>=0;){var l=32767&this[e],c=this[e++]>>15,d=s*l+c*r;l=r*l+((32767&d)<<15)+n[i]+(1073741823&a),a=(l>>>30)+(d>>>15)+s*c+(a>>>30),n[i++]=1073741823&l}return a}function am3(e,t,n,i,a,o){for(var r=16383&t,s=t>>14;--o>=0;){var l=16383&this[e],c=this[e++]>>14,d=s*l+c*r;l=r*l+((16383&d)<<14)+n[i]+a,a=(l>>28)+(d>>14)+s*c,n[i++]=268435455&l}return a}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 a=e.length,o=!1,r=0;--a>=0;){var s=8==i?255&e[a]:intAt(e,a);0>s?"-"==e.charAt(a)&&(o=!0):(o=!1,0==r?this[this.t++]=s:r+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-r)-1)<<r,this[this.t++]=s>>this.DB-r):this[this.t-1]|=s<<r,r+=i,r>=this.DB&&(r-=this.DB))}8==i&&0!=(128&e[0])&&n&&(this.s=-1,r>0&&(this[this.t-1]|=(1<<this.DB-r)-1<<r)),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,a=!1,o="",r=this.t,s=this.DB-r*this.DB%t;if(r-->0)for(s<this.DB&&(n=this[r]>>s)>0&&(a=!0,o=int2char(n));r>=0;)t>s?(n=(this[r]&(1<<s)-1)<<t-s,n|=this[--r]>>(s+=this.DB-t)):(n=this[r]>>(s-=t)&i,0>=s&&(s+=this.DB,--r)),n>0&&(a=!0),a&&(o+=int2char(n));return a?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,a=this.DB-i,o=(1<<a)-1,r=Math.floor(e/this.DB),s=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+r+1]=this[n]>>a|s,s=(this[n]&o)<<i;for(n=r-1;n>=0;--n)t[n]=0;t[r]=s,t.t=this.t+r+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,a=this.DB-i,o=(1<<i)-1;t[0]=this[n]>>i;for(var r=n+1;r<this.t;++r)t[r-n-1]|=(this[r]&o)<<a,t[r-n]=this[r]>>i;i>0&&(t[this.t-n-1]|=(this.s&o)<<a),t.t=this.t-n,t.clamp()}function bnpSubTo(e,t){for(var n=0,i=0,a=Math.min(e.t,this.t);a>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(),a=n.t;for(t.t=a+i.t;--a>=0;)t[a]=0;for(a=0;a<i.t;++a)t[a+n.t]=n.am(0,i[a],t,a,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
}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 i=e.createTextRange();i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i.select()}else e.setSelectionRange&&e.setSelectionRange(t,n)}catch(a){}}function getFieldSelection(e){if(e.selectionStart)return e.selectionStart;if(!document.selection)return 0;var t="",n=document.selection.createRange(),i=n.text,a=n.duplicate(),o=0;try{a.moveToElementText(e)}catch(r){return 0}return n.text=i+t,o=a.text.indexOf(t),n.moveStart("character",-1),n.text="",o}function getRichValue(e){if(!e)return"";var t=[],n=[];return getRichElementValue(e,t,n),n.length&&t.push(n.join("")),t.join("\n")}function getRichValueWithCaret(e){if(!e)return[];var t,n,i=[],a=[],o=window.getSelection?window.getSelection():!1;if(o&&o.rangeCount){var r=o.getRangeAt(0);r.startContainer&&r.startContainer==r.endContainer&&r.startOffset==r.endOffset&&(t=r.startContainer,n=r.startOffset)}getRichElementValue(e,i,a,t,n),a.length&&i.push(a.join(""));var s=i.join("\n"),l=s.indexOf("");return-1!=l&&(s=s.substr(0,l)+s.substr(l+1)),[s,l]}function getRichElementValue(e,t,n,i,a){if(3!=e.nodeType){if(1==e.nodeType){var o,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),i===e&&n.push("");for(var o=e.firstChild;o;)getRichElementValue(o,t,n,i,a),o=o.nextSibling;r&&n.length&&(t.push(n.join("")),n.splice(0,n.length))}}else if(i===e){var s=e.nodeValue;n.push(s.substr(0,a)+""+s.substr(a))}else n.push(e.nodeValue)}function setRichFocus(e,t){if(e.focus(),window.getSelection&&document.createRange){var n=document.createRange();t?n.selectNode(t):n.selectNodeContents(e),n.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(n)}else if(void 0!==document.body.createTextRange){var a=document.body.createTextRange();a.moveToElementText(t||e),a.collapse(!1),a.select()}}function onContentLoaded(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),i=e.length?e[e.length-1]:4294967295,a=0;a<t.length;a++)t[a]<i&&n.push(t[a]);return n}function listUniqSorted(e){e=e||[];for(var t=[],n=!1,i=0;i<e.length;i++)e[i]!==n&&t.push(e[i]),n=e[i];return t}function templateUrl(e){return"partials/"+(Config.Mobile?"mobile":"desktop")+"/"+e+".html"}function encodeEntities(e){return e.replace(/&/g,"&amp;").replace(/([^\#-~| |!])/g,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function calcImageInBox(e,t,n,i,a){var o=n,r=i;return e/t>n/i?r=parseInt(t*n/e):(o=parseInt(e*i/t),o>n&&(r=parseInt(r*n/o),o=n)),a&&o>=e&&r>=t&&(o=e,r=t),{w:o,h:r}}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,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 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;n<e.length;n++)!n||n%2||t.push(n%16?n%4?" ":" ":"\n"),t.push((e[n]<16?"0":"")+e[n].toString(16));console.log(t.join(""))}function bytesToHex(e){e=e||[];for(var t=[],n=0;n<e.length;n++)t.push((e[n]<16?"0":"")+(e[n]||0).toString(16));return t.join("")}function bytesFromHex(e){var t,n=e.length,i=0,a=[];for(e.length%2&&(a.push(parseInt(e.charAt(0),16)),i++),t=i;n>t;t+=2)a.push(parseInt(e.substr(t,2),16));return a}function bytesToBase64(e){for(var t,n="",i=e.length,a=0,o=0;i>o;o++)t=o%3,a|=e[o]<<(16>>>t&24),(2===t||i-o===1)&&(n+=String.fromCharCode(uint6ToBase64(a>>>18&63
return i}function m(e,t,n){var i=t.dir,a=n&&"parentNode"===i,o=j++;return t.first?function(t,n,o){for(;t=t[i];)if(1===t.nodeType||a)return e(t,n,o)}:function(t,n,r){var s,l,c=[q,o];if(r){for(;t=t[i];)if((1===t.nodeType||a)&&e(t,n,r))return!0}else for(;t=t[i];)if(1===t.nodeType||a){if(l=t[B]||(t[B]={}),(s=l[i])&&s[0]===q&&s[1]===o)return c[2]=s[2];if(l[i]=c,c[2]=e(t,n,r))return!0}}}function h(e){return e.length>1?function(t,n,i){for(var a=e.length;a--;)if(!e[a](t,n,i))return!1;return!0}:e[0]}function f(e,n,i){for(var a=0,o=n.length;o>a;a++)t(e,n[a],i);return i}function g(e,t,n,i,a){for(var o,r=[],s=0,l=e.length,c=null!=t;l>s;s++)(o=e[s])&&(!n||n(o,i,a))&&(r.push(o),c&&t.push(s));return r}function _(e,t,n,a,o,r){return a&&!a[B]&&(a=_(a)),o&&!o[B]&&(o=_(o,r)),i(function(i,r,s,l){var c,d,u,p=[],m=[],h=r.length,_=i||f(t||"*",s.nodeType?[s]:s,[]),y=!e||!i&&t?_:g(_,p,e,s,l),v=n?o||(i?e:h||a)?[]:r:y;if(n&&n(y,v,s,l),a)for(c=g(v,m),a(c,[],s,l),d=c.length;d--;)(u=c[d])&&(v[m[d]]=!(y[m[d]]=u));if(i){if(o||e){if(o){for(c=[],d=v.length;d--;)(u=v[d])&&c.push(y[d]=u);o(null,v=[],c,l)}for(d=v.length;d--;)(u=v[d])&&(c=o?tt.call(i,u):p[d])>-1&&(i[c]=!(r[c]=u))}}else v=g(v===r?v.splice(h,v.length):v),o?o(null,r,v,l):Q.apply(r,v)})}function y(e){for(var t,n,i,a=e.length,o=$.relative[e[0].type],r=o||$.relative[" "],s=o?1:0,l=m(function(e){return e===t},r,!0),c=m(function(e){return tt.call(t,e)>-1},r,!0),d=[function(e,n,i){return!o&&(i||n!==E)||((t=n).nodeType?l(e,n,i):c(e,n,i))}];a>s;s++)if(n=$.relative[e[s].type])d=[m(h(d),n)];else{if(n=$.filter[e[s].type].apply(null,e[s].matches),n[B]){for(i=++s;a>i&&!$.relative[e[i].type];i++);return _(s>1&&h(d),s>1&&p(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(lt,"$1"),n,i>s&&y(e.slice(s,i)),a>i&&y(e=e.slice(i)),a>i&&p(e))}d.push(n)}return h(d)}function v(e,n){var a=n.length>0,o=e.length>0,r=function(i,r,s,l,c){var d,u,p,m=0,h="0",f=i&&[],_=[],y=E,v=i||o&&$.find.TAG("*",c),b=q+=null==y?1:Math.random()||.1,w=v.length;for(c&&(E=r!==D&&r);h!==w&&null!=(d=v[h]);h++){if(o&&d){for(u=0;p=e[u++];)if(p(d,r,s)){l.push(d);break}c&&(q=b)}a&&((d=!p&&d)&&m--,i&&f.push(d))}if(m+=h,a&&h!==m){for(u=0;p=n[u++];)p(f,_,r,s);if(i){if(m>0)for(;h--;)f[h]||_[h]||(_[h]=X.call(l));_=g(_)}Q.apply(l,_),c&&!i&&_.length>0&&m+n.length>1&&t.uniqueSort(l)}return c&&(q=b,E=y),f};return a?i(r):r}var b,w,$,k,S,C,M,x,E,A,T,I,D,P,N,O,L,U,R,B="sizzle"+-new Date,F=e.document,q=0,j=0,H=n(),z=n(),V=n(),W=function(e,t){return e===t&&(T=!0),0},G="undefined",K=1<<31,Z={}.hasOwnProperty,Y=[],X=Y.pop,J=Y.push,Q=Y.push,et=Y.slice,tt=Y.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},nt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",it="[\\x20\\t\\r\\n\\f]",at="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ot=at.replace("w","w#"),rt="\\["+it+"*("+at+")(?:"+it+"*([*^$|!~]?=)"+it+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ot+"))|)"+it+"*\\]",st=":("+at+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+rt+")*)|.*)\\)|)",lt=new RegExp("^"+it+"+|((?:^|[^\\\\])(?:\\\\.)*)"+it+"+$","g"),ct=new RegExp("^"+it+"*,"+it+"*"),dt=new RegExp("^"+it+"*([>+~]|"+it+")"+it+"*"),ut=new RegExp("="+it+"*([^\\]'\"]*?)"+it+"*\\]","g"),pt=new RegExp(st),mt=new RegExp("^"+ot+"$"),ht={ID:new RegExp("^#("+at+")"),CLASS:new RegExp("^\\.("+at+")"),TAG:new RegExp("^("+at.replace("w","w*")+")"),ATTR:new RegExp("^"+rt),PSEUDO:new RegExp("^"+st),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+it+"*(even|odd|(([+-]|)(\\d*)n|)"+it+"*(?:([+-]|)"+it+"*(\\d+)|))"+it+"*\\)|)","i"),bool:new RegExp("^(?:"+nt+")$","i"),needsContext:new RegExp("^"+it+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+it+"*((?:-\\d)?\\d*)"+it+"*\\)|)(?=[^-]|$)","i")},ft=/^(?:input|select|textarea|button)$/i,gt=/^h\d$/i,_t=/^[^{]+\{\s*\[native \w/,yt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,vt=/[+~]/,bt=/'|\\/g,wt=new RegExp("\\\\([\\da-f]{1,6}"+it+"?|("+it+")|.)","ig"),$t=function(e,t,n){var i="0x"+t-65536;return
return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,i,a,o,r=[],s=t.delegateCount,l=e.target;if(s&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(a=[],o=0;s>o;o++)i=t[o],n=i.selector+" ",void 0===a[n]&&(a[n]=i.needsContext?at(n,this).index(l)>=0:at.find(n,this,null,[l]).length),a[n]&&a.push(i);a.length&&r.push({elem:l,handlers:a})}return s<t.length&&r.push({elem:this,handlers:t.slice(s)}),r},fix:function(e){if(e[at.expando])return e;var t,n,i,a=e.type,o=e,r=this.fixHooks[a];for(r||(this.fixHooks[a]=r=Pt.test(a)?this.mouseHooks:Dt.test(a)?this.keyHooks:{}),i=r.props?this.props.concat(r.props):this.props,e=new at.Event(o),t=i.length;t--;)n=i[t],e[n]=o[n];return e.target||(e.target=o.srcElement||ht),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,r.filter?r.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,i,a,o=t.button,r=t.fromElement;return null==e.pageX&&null!=t.clientX&&(i=e.target.ownerDocument||ht,a=i.documentElement,n=i.body,e.pageX=t.clientX+(a&&a.scrollLeft||n&&n.scrollLeft||0)-(a&&a.clientLeft||n&&n.clientLeft||0),e.pageY=t.clientY+(a&&a.scrollTop||n&&n.scrollTop||0)-(a&&a.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&r&&(e.relatedTarget=r===e.target?t.toElement:r),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==h()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===h()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return at.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return at.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,i){var a=at.extend(new at.Event,n,{type:e,isSimulated:!0,originalEvent:{}});i?at.event.trigger(a,null,t):at.event.dispatch.call(t,a),a.isDefaultPrevented()&&n.preventDefault()}},at.removeEvent=ht.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var i="on"+t;e.detachEvent&&(typeof e[i]===kt&&(e[i]=null),e.detachEvent(i,n))},at.Event=function(e,t){return this instanceof at.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?p:m):this.type=e,t&&at.extend(this,t),this.timeStamp=e&&e.timeStamp||at.now(),void(this[at.expando]=!0)):new at.Event(e,t)},at.Event.prototype={isDefaultPrevented:m,isPropagationStopped:m,isImmediatePropagationStopped:m,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=p,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=p,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=p,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},at.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){at.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,i=this,a=e.relatedTarget,o=e.handleObj;return(!a||a!==i&&!at.contains(i,a))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),nt.submitBubbles||(at.event.special.submit={setup:function(){return at.nodeName(this,"form")?!1:void at.e
}}),at.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,i){return this.on(t,e,n,i)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var In=at.now(),Dn=/\?/,Pn=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;at.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,i=null,a=at.trim(t+"");return a&&!at.trim(a.replace(Pn,function(e,t,a,o){return n&&t&&(i=0),0===i?e:(n=a||t,i+=!o-!a,"")}))?Function("return "+a)():at.error("Invalid JSON: "+t)},at.parseXML=function(t){var n,i;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(i=new DOMParser,n=i.parseFromString(t,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(a){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||at.error("Invalid XML: "+t),n};var Nn,On,Ln=/#.*$/,Un=/([?&])_=[^&]*/,Rn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Bn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fn=/^(?:GET|HEAD)$/,qn=/^\/\//,jn=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hn={},zn={},Vn="*/".concat("*");try{On=location.href}catch(Wn){On=ht.createElement("a"),On.href="",On=On.href}Nn=jn.exec(On.toLowerCase())||[],at.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:On,type:"GET",isLocal:Bn.test(Nn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Vn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":at.parseJSON,"text xml":at.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?q(q(e,at.ajaxSettings),t):q(at.ajaxSettings,e)},ajaxPrefilter:B(Hn),ajaxTransport:B(zn),ajax:function(e,t){function n(e,t,n,i){var a,d,_,y,b,$=t;2!==v&&(v=2,s&&clearTimeout(s),c=void 0,r=i||"",w.readyState=e>0?4:0,a=e>=200&&300>e||304===e,n&&(y=j(u,w,n)),y=H(u,y,w,a),a?(u.ifModified&&(b=w.getResponseHeader("Last-Modified"),b&&(at.lastModified[o]=b),b=w.getResponseHeader("etag"),b&&(at.etag[o]=b)),204===e||"HEAD"===u.type?$="nocontent":304===e?$="notmodified":($=y.state,d=y.data,_=y.error,a=!_)):(_=$,(e||!$)&&($="error",0>e&&(e=0))),w.status=e,w.statusText=(t||$)+"",a?h.resolveWith(p,[d,$,w]):h.rejectWith(p,[w,$,_]),w.statusCode(g),g=void 0,l&&m.trigger(a?"ajaxSuccess":"ajaxError",[w,u,a?d:_]),f.fireWith(p,[w,$]),l&&(m.trigger("ajaxComplete",[w,u]),--at.active||at.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,a,o,r,s,l,c,d,u=at.ajaxSetup({},t),p=u.context||u,m=u.context&&(p.nodeType||p.jquery)?at(p):at.event,h=at.Deferred(),f=at.Callbacks("once memory"),g=u.statusCode||{},_={},y={},v=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(2===v){if(!d)for(d={};t=Rn.exec(r);)d[t[1].toLowerCase()]=t[2];t=d[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===v?r:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return v||(e=y[n]=y[n]||e,_[e]=t),this},overrideMimeType:function(e){return v||(u.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>v)for(t in e)g[t]=[g[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return c&&c.abort(t),n(0,t),this}};if(h.promise(w).complete=f.add,w.success=w.done,w.error=w.fail,u.url=((e||u.url||On)+"").replace(Ln,"").replace(qn,Nn[1]+"//"),u.type=t.method||t.type||u.method||u.type,u.dataTypes=at.trim(u.dataType||"*").toLowerCase().match(vt)||[""],null==u.crossDomain&&(i=jn.exec(u.url.toLowerCase()),u.crossDomain=!(!i||i[1]===Nn[1]&&i[2]===Nn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(Nn[3]||("http:"===Nn[1]?"80":"443")))),u.data&&u.processData&&"string"!=typeof u.
}function n(){l=!0}function i(){return l?(l=!1,""):s}function a(){var e,t,n,a=Array.prototype.slice.call(arguments),o=a.pop(),r=[],s=1==a.length,l=!0,p=i();for(t=0;t<a.length;t++)if(n=a[t]=p+a[t],"xt_"!=n.substr(0,3)&&void 0!==c[n])r.push(c[n]);else if(u){try{e=localStorage.getItem(n)}catch(m){u=!1}try{e=void 0===e||null===e?!1:JSON.parse(e)}catch(m){e=!1}r.push(c[n]=e)}else d?l=!1:r.push(c[n]=!1);return l?o(s?r[0]:r):void chrome.storage.local.get(a,function(e){var i;for(r=[],t=0;t<a.length;t++)n=a[t],i=e[n],i=void 0===i||null===i?!1:JSON.parse(i),r.push(c[n]=i);o(s?r[0]:r)})}function o(e,t){var n,a,o={},r=i();for(n in e)if(e.hasOwnProperty(n))if(a=e[n],n=r+n,c[n]=a,a=JSON.stringify(a),u)try{localStorage.setItem(n,a)}catch(s){u=!1}else o[n]=a;return u||!d?void(t&&t()):void chrome.storage.local.set(o,t)}function r(){var e,t,n,a=Array.prototype.slice.call(arguments),o=i();for("function"==typeof a[a.length-1]&&(n=a.pop()),e=0;e<a.length;e++)if(t=a[e]=o+a[e],delete c[t],u)try{localStorage.removeItem(t)}catch(r){u=!1}d?chrome.storage.local.remove(a,n):n&&n()}var s="",l=!1,c={},d=!!(e.chrome&&chrome.storage&&chrome.storage.local),u=!d&&!!e.localStorage;e.ConfigStorage={prefix:t,noPrefix:n,get:a,set:o,remove:r}}(this),function(){try{window==window.top||window.chrome&&chrome.app&&chrome.app.window?document.documentElement.style.display="block":top.location=self.location}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,a=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}),a()))},!1),t.addEventListener("noupdate",function(){a()},!1),t.addEventListener("error",function(){a()},!1)};a(3e3),window.addEventListener("load",o)}}(),function(){var e=[Config.Navigator.osX?"osx":"non_osx",Config.Navigator.retina?"is_2x":"is_1x"];Config.Modes.ios_standalone&&e.push("ios_standalone"),$(document.body).addClass(e.join(" ")),ConfigStorage.get("current_layout","i18n_locale",function(e){var t=e[0],n=e[1],i="en-us",a={dom:!1,i18n_ng:!1,i18n_messages:!1,i18n_fallback:!1},o=function(){var e,t=!0;for(e in a)if(a.hasOwnProperty(e)&&a[e]===!1){t=!1;break}t&&(a.boot=!1,angular.bootstrap(document,["myApp"]))};switch(t){case"mobile":Config.Mobile=!0;break;case"desktop":Config.Mobile=!1;break;default:Config.Mobile=Config.Navigator.mobile||$(window).width()<480}$("head").append('<link rel="stylesheet" href="css/'+(Config.Mobile?"mobile.css":"desktop.css")+'" />'),n||(n=(navigator.language||"").toLowerCase(),n=Config.I18n.aliases[n]||n);for(var r=0;r<Config.I18n.supported.length;r++)if(Config.I18n.supported[r]==n){Config.I18n.locale=n;break}a.i18n_ng=Config.I18n.locale==i,$.getJSON("js/locales/"+Config.I18n.locale+".json").success(function(e){Config.I18n.messages=e,a.i18n_messages=!0,Config.I18n.locale==i&&(a.i18n_fallback=!0),o()}),Config.I18n.locale!=i&&$.getJSON("js/locales/"+i+".json").success(function(e){Config.I18n.fallback_messages=e,a.i18n_fallback=!0,o()}),$(document).ready(function(){a.dom=!0,a.i18n_ng?o():$("<script>").appendTo("body").on("load",function(){a.i18n_ng=!0,o()}).attr("src","vendor/angular/i18n/angular-locale_"+Config.I18n.locale+".js")})})}(),function(e,t,n){"use strict";var i,a,o,r,s,l,c,d,u,p,m,h,f,g,_,y,v,b,w,$,k,S,C,M,x,E,A,T,I,D,P;C={paneClass:"nano-pane",sliderClass:"nano-slider",contentClass:"nano-content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null,documentContext:null,windowContext:null},b="scrollbar",v="scroll",u="mousedown",p="mouseenter",m="mousemove",f="mousewheel",h="mouseup
if(k(e))e=e();else if(I(e)){var n=e[0],i=t.getComputedStyle(n);e="fixed"!==i.position?0:n.getBoundingClientRect().bottom}else w(e)||(e=0);return e}function r(e){if(e){e.scrollIntoView();var n=o();if(n){var i=e.getBoundingClientRect().top;t.scrollBy(0,i-n)}}else t.scrollTo(0,0)}function s(){var e,t=n.hash();t?(e=l.getElementById(t))?r(e):(e=a(l.getElementsByName(t)))?r(e):"top"===t&&r(null):r(null)}var l=t.document;return e&&i.$watch(function(){return n.hash()},function(e,t){(e!==t||""!==e)&&Dt(function(){i.$evalAsync(s)})}),s}]}function jt(){this.$get=["$$rAF","$timeout",function(e,t){return e.supported?function(t){return e(t)}:function(e){return t(e,0,!1)}}]}function Ht(e,t,i,a){function r(e){try{e.apply(null,B(arguments,1))}finally{if($--,0===$)for(;k.length;)try{k.pop()()}catch(t){i.error(t)}}}function s(e,t){!function n(){o(C,function(e){e()}),S=t(n,e)}()}function l(){c(),d()}function c(){M=e.history.state,M=_(M)?null:M,U(M,P)&&(M=P),P=M}function d(){(E!==p.url()||x!==M)&&(E=p.url(),x=M,o(I,function(e){e(p.url(),M)}))}function u(e){try{return decodeURIComponent(e)}catch(t){return e}}var p=this,m=t[0],f=e.location,g=e.history,y=e.setTimeout,v=e.clearTimeout,w={};p.isMock=!1;var $=0,k=[];p.$$completeOutstandingRequest=r,p.$$incOutstandingRequestCount=function(){$++},p.notifyWhenNoOutstandingRequests=function(e){o(C,function(e){e()}),0===$?e():k.push(e)};var S,C=[];p.addPollFn=function(e){return _(S)&&s(100,y),C.push(e),e};var M,x,E=f.href,A=t.find("base"),T=null;c(),x=M,p.url=function(t,n,i){if(_(i)&&(i=null),f!==e.location&&(f=e.location),g!==e.history&&(g=e.history),t){var o=x===i;if(E===t&&(!a.history||o))return;var r=E&&_n(E)===_n(t);return E=t,x=i,!a.history||r&&o?(r||(T=t),n?f.replace(t):f.href=t):(g[n?"replaceState":"pushState"](i,"",t),c(),x=M),p}return T||f.href.replace(/%27/g,"'")},p.state=function(){return M};var I=[],D=!1,P=null;p.onUrlChange=function(t){return D||(a.history&&Vi(e).on("popstate",l),Vi(e).on("hashchange",l),D=!0),I.push(t),t},p.$$checkUrlChange=d,p.baseHref=function(){var e=A.attr("href");return e?e.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var N={},O="",L=p.baseHref();p.cookies=function(e,t){var a,o,r,s,l;if(!e){if(m.cookie!==O)for(O=m.cookie,o=O.split("; "),N={},s=0;s<o.length;s++)r=o[s],l=r.indexOf("="),l>0&&(e=u(r.substring(0,l)),N[e]===n&&(N[e]=u(r.substring(l+1))));return N}t===n?m.cookie=encodeURIComponent(e)+"=;path="+L+";expires=Thu, 01 Jan 1970 00:00:00 GMT":b(t)&&(a=(m.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path="+L).length+1,a>4096&&i.warn("Cookie '"+e+"' possibly not set or overflowed because it was too large ("+a+" > 4096 bytes)!"))},p.defer=function(e,t){var n;return $++,n=y(function(){delete w[n],r(e)},t||0),w[n]=!0,n},p.defer.cancel=function(e){return w[e]?(delete w[e],v(e),r(h),!0):!1}}function zt(){this.$get=["$window","$log","$sniffer","$document",function(e,t,n,i){return new Ht(e,i,t,n)}]}function Vt(){this.$get=function(){function e(e,n){function a(e){e!=p&&(m?m==e&&(m=e.n):m=e,o(e.n,e.p),o(e,p),p=e,p.n=null)}function o(e,t){e!=t&&(e&&(e.p=t),t&&(t.n=e))}if(e in t)throw i("$cacheFactory")("iid","CacheId '{0}' is already taken!",e);var r=0,s=u({},n,{id:e}),l={},c=n&&n.capacity||Number.MAX_VALUE,d={},p=null,m=null;return t[e]={put:function(e,t){if(c<Number.MAX_VALUE){var n=d[e]||(d[e]={key:e});a(n)}if(!_(t))return e in l||r++,l[e]=t,r>c&&this.remove(m.key),t},get:function(e){if(c<Number.MAX_VALUE){var t=d[e];if(!t)return;a(t)}return l[e]},remove:function(e){if(c<Number.MAX_VALUE){var t=d[e];if(!t)return;t==p&&(p=t.p),t==m&&(m=t.n),o(t.n,t.p),delete d[e]}delete l[e],r--},removeAll:function(){l={},r=0,d={},p=m=null},destroy:function(){l=null,s=null,d=null,delete t[e]},info:function(){return u({},s,{size:r})}}}var t={};return e.info=function(){var e={};return o(t,function(t,n){e[n]=t.info()}),e},e.get=function(e){return t[e]},e}}function Wt(){this.$get=["$cacheFactory",function(e){return e("templates")}]}function Gt(e,i){function a(e,t){var n=/^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/,i={};return o(e,function(e,a){var o=e.match(n);if(!o)throw Ba("iscp","Invalid i
}}),c.absUrl()!=m&&a.url(c.absUrl(),!0);var f=!0;return a.onUrlChange(function(e,t){i.$evalAsync(function(){var n=c.absUrl(),a=c.$$state;c.$$parse(e),c.$$state=t,i.$broadcast("$locationChangeStart",e,n,t,a).defaultPrevented?(c.$$parse(n),c.$$state=a,s(n,!1,a)):(f=!1,l(n,a))}),i.$$phase||i.$digest()}),i.$watch(function(){var e=a.url(),t=a.state(),n=c.$$replace,r=e!==c.absUrl()||c.$$html5&&o.history&&t!==c.$$state;(f||r)&&(f=!1,i.$evalAsync(function(){i.$broadcast("$locationChangeStart",c.absUrl(),e,c.$$state,t).defaultPrevented?(c.$$parse(e),c.$$state=t):(r&&s(c.absUrl(),n,t===c.$$state?null:c.$$state),l(e,t))})),c.$$replace=!1}),c}]}function Mn(){var e=!0,t=this;this.debugEnabled=function(t){return y(t)?(e=t,this):e},this.$get=["$window",function(n){function i(e){return e instanceof Error&&(e.stack?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function a(e){var t=n.console||{},a=t[e]||t.log||h,r=!1;try{r=!!a.apply}catch(s){}return r?function(){var e=[];return o(arguments,function(t){e.push(i(t))}),a.apply(t,e)}:function(e,t){a(e,null==t?"":t)}}return{log:a("log"),info:a("info"),warn:a("warn"),error:a("error"),debug:function(){var n=a("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function xn(e,t){if("__defineGetter__"===e||"__defineSetter__"===e||"__lookupGetter__"===e||"__lookupSetter__"===e||"__proto__"===e)throw Xa("isecfld","Attempting to access a disallowed field in Angular expressions! Expression: {0}",t);return e}function En(e,t){if(e){if(e.constructor===e)throw Xa("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e.window===e)throw Xa("isecwindow","Referencing the Window in Angular expressions is disallowed! Expression: {0}",t);if(e.children&&(e.nodeName||e.prop&&e.attr&&e.find))throw Xa("isecdom","Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}",t);if(e===Object)throw Xa("isecobj","Referencing Object in Angular expressions is disallowed! Expression: {0}",t)}return e}function An(e,t){if(e){if(e.constructor===e)throw Xa("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e===Ja||e===Qa||e===eo)throw Xa("isecff","Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}",t)}}function Tn(e){return e.constant}function In(e,t,n,i){En(e,i);for(var a,o=t.split("."),r=0;o.length>1;r++){a=xn(o.shift(),i);var s=En(e[a],i);s||(s={},e[a]=s),e=s}return a=xn(o.shift(),i),En(e[a],i),e[a]=n,n}function Dn(e){return"constructor"==e}function Pn(e,t,i,a,o,r,s){xn(e,r),xn(t,r),xn(i,r),xn(a,r),xn(o,r);var l=function(e){return En(e,r)},c=s||Dn(e)?l:f,d=s||Dn(t)?l:f,u=s||Dn(i)?l:f,p=s||Dn(a)?l:f,m=s||Dn(o)?l:f;return function(r,s){var l=s&&s.hasOwnProperty(e)?s:r;return null==l?l:(l=c(l[e]),t?null==l?n:(l=d(l[t]),i?null==l?n:(l=u(l[i]),a?null==l?n:(l=p(l[a]),o?null==l?n:l=m(l[o]):l):l):l):l)}}function Nn(e,t){return function(n,i){return e(n,i,En,t)}}function On(e,t,i){var a=t.expensiveChecks,r=a?so:ro,s=r[e];if(s)return s;var l=e.split("."),c=l.length;if(t.csp)s=6>c?Pn(l[0],l[1],l[2],l[3],l[4],i,a):function(e,t){var o,r=0;do o=Pn(l[r++],l[r++],l[r++],l[r++],l[r++],i,a)(e,t),t=n,e=o;while(c>r);return o};else{var d="";a&&(d+="s = eso(s, fe);\nl = eso(l, fe);\n");var u=a;o(l,function(e,t){xn(e,i);var n=(t?"s":'((l&&l.hasOwnProperty("'+e+'"))?l:s)')+"."+e;(a||Dn(e))&&(n="eso("+n+", fe)",u=!0),d+="if(s == null) return undefined;\ns="+n+";\n"}),d+="return s;";var p=new Function("s","l","eso","fe",d);p.toString=g(d),u&&(p=Nn(p,i)),s=p}return s.sharedGetter=!0,s.assign=function(t,n){return In(t,e,n,e)},r[e]=s,s}function Ln(e){return k(e.valueOf)?e.valueOf():lo.call(e)}function Un(){var e=lt(),t=lt();this.$get=["$filter","$sniffer",function(n,i){function a(e){var t=e;return e.sharedGetter&&(t=function(t,n){return e(t,n)},t.literal=e.literal,t.constant=e.constant,t.assign=e.assign),t}function r(e,t){for(var n=0,i=e.length;i>n;n++){var a=e[n];a.constant||(a.inputs?r(a.inputs,t):-1===t.indexOf(a)&&t.push(
},i.$observe("min",function(e){y(e)&&!w(e)&&(e=parseFloat(e,10)),s=w(e)&&!isNaN(e)?e:n,a.$validate()})}if(i.max||i.ngMax){var l;a.$validators.max=function(e){return a.$isEmpty(e)||_(l)||l>=e},i.$observe("max",function(e){y(e)&&!w(e)&&(e=parseFloat(e,10)),l=w(e)&&!isNaN(e)?e:n,a.$validate()})}}function Ai(e,t,n,i,a,o){ki(e,t,n,i,a,o),wi(i),i.$$parserName="url",i.$validators.url=function(e){return i.$isEmpty(e)||Eo.test(e)}}function Ti(e,t,n,i,a,o){ki(e,t,n,i,a,o),wi(i),i.$$parserName="email",i.$validators.email=function(e){return i.$isEmpty(e)||Ao.test(e)}}function Ii(e,t,n,i){_(n.name)&&t.attr("name",c());var a=function(e){t[0].checked&&i.$setViewValue(n.value,e&&e.type)};t.on("click",a),i.$render=function(){var e=n.value;t[0].checked=e==i.$viewValue},n.$observe("value",i.$render)}function Di(e,t,n,a,o){var r;if(y(a)){if(r=e(a),!r.constant)throw i("ngModel")("constexpr","Expected constant expression for `{0}`, but saw `{1}`.",n,a);return r(t)}return o}function Pi(e,t,n,i,a,o,r,s){var l=Di(s,e,"ngTrueValue",n.ngTrueValue,!0),c=Di(s,e,"ngFalseValue",n.ngFalseValue,!1),d=function(e){i.$setViewValue(t[0].checked,e&&e.type)};t.on("click",d),i.$render=function(){t[0].checked=i.$viewValue},i.$isEmpty=function(e){return e!==l},i.$formatters.push(function(e){return U(e,l)}),i.$parsers.push(function(e){return e?l:c})}function Ni(e){function t(e,t,l){t===n?i("$pending",e,l):a("$pending",e,l),A(t)?t?(u(s.$error,e,l),d(s.$$success,e,l)):(d(s.$error,e,l),u(s.$$success,e,l)):(u(s.$error,e,l),u(s.$$success,e,l)),s.$pending?(o(Wo,!0),s.$valid=s.$invalid=n,r("",null)):(o(Wo,!1),s.$valid=Oi(s.$error),s.$invalid=!s.$valid,r("",s.$valid));var c;c=s.$pending&&s.$pending[e]?n:s.$error[e]?!1:s.$$success[e]?!0:null,r(e,c),p.$setValidity(e,c,s)}function i(e,t,n){s[e]||(s[e]={}),d(s[e],t,n)}function a(e,t,i){s[e]&&u(s[e],t,i),Oi(s[e])&&(s[e]=n)}function o(e,t){t&&!c[e]?(m.addClass(l,e),c[e]=!0):!t&&c[e]&&(m.removeClass(l,e),c[e]=!1)}function r(e,t){e=e?"-"+tt(e,"-"):"",o(Fo+e,t===!0),o(qo+e,t===!1)}var s=e.ctrl,l=e.$element,c={},d=e.set,u=e.unset,p=e.parentForm,m=e.$animate;c[qo]=!(c[Fo]=l.hasClass(Fo)),s.$setValidity=t}function Oi(e){if(e)for(var t in e)return!1;return!0}function Li(e,t){return e="ngClass"+e,["$animate",function(n){function i(e,t){var n=[];e:for(var i=0;i<e.length;i++){for(var a=e[i],o=0;o<t.length;o++)if(a==t[o])continue e;n.push(a)}return n}function a(e){if(na(e))return e;if(b(e))return e.split(" ");if(v(e)){var t=[];return o(e,function(e,n){e&&(t=t.concat(n.split(" ")))}),t}return e}return{restrict:"AC",link:function(r,s,l){function c(e){var t=u(e,1);l.$addClass(t)}function d(e){var t=u(e,-1);l.$removeClass(t)}function u(e,t){var n=s.data("$classCounts")||{},i=[];return o(e,function(e){(t>0||n[e])&&(n[e]=(n[e]||0)+t,n[e]===+(t>0)&&i.push(e))}),s.data("$classCounts",n),i.join(" ")}function p(e,t){var a=i(t,e),o=i(e,t);a=u(a,1),o=u(o,-1),a&&a.length&&n.addClass(s,a),o&&o.length&&n.removeClass(s,o)}function m(e){if(t===!0||r.$index%2===t){var n=a(e||[]);if(h){if(!U(e,h)){var i=a(h);p(i,n)}}else c(n)}h=L(e)}var h;r.$watch(l[e],m,!0),l.$observe("class",function(){m(r.$eval(l[e]))}),"ngClass"!==e&&r.$watch("$index",function(n,i){var o=1&n;if(o!==(1&i)){var s=a(r.$eval(l[e]));o===t?c(s):d(s)}})}}}]}var Ui=/^\/(.+)\/([a-z]*)$/,Ri="validity",Bi=function(e){return b(e)?e.toLowerCase():e},Fi=Object.prototype.hasOwnProperty,qi=function(e){return b(e)?e.toUpperCase():e},ji=function(e){return b(e)?e.replace(/[A-Z]/g,function(e){return String.fromCharCode(32|e.charCodeAt(0))}):e},Hi=function(e){return b(e)?e.replace(/[a-z]/g,function(e){return String.fromCharCode(-33&e.charCodeAt(0))}):e};"i"!=="I".toLowerCase()&&(Bi=ji,qi=Hi);var zi,Vi,Wi,Gi,Ki=[].slice,Zi=[].splice,Yi=[].push,Xi=Object.prototype.toString,Ji=i("ng"),Qi=e.angular||(e.angular={}),ea=0;zi=t.documentMode,h.$inject=[],f.$inject=[];var ta,na=Array.isArray,ia=function(e){return b(e)?e.trim():e},aa=function(e){return e.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},oa=function(){if(y(oa.isActive_))return oa.isActive_;var e=!(!t.querySelector("[ng-csp]")&
a.$$setOptions(i[2]&&i[2].$options),o.$addControl(a),n.$observe("name",function(e){a.$name!==e&&o.$$renameControl(a,e)}),e.$on("$destroy",function(){o.$removeControl(a)})},post:function(e,t,n,i){var a=i[0];a.$options&&a.$options.updateOn&&t.on(a.$options.updateOn,function(e){a.$$debounceViewValueCommit(e&&e.type)}),t.on("blur",function(){a.$touched||e.$apply(function(){a.$setTouched()})})}}}}},Zo=g({restrict:"A",require:"ngModel",link:function(e,t,n,i){i.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),Yo=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,i){i&&(n.required=!0,i.$validators.required=function(e){return!n.required||!i.$isEmpty(e)},n.$observe("required",function(){i.$validate()}))}}},Xo=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,a,o){if(o){var r,s=a.ngPattern||a.pattern;a.$observe("pattern",function(e){if(b(e)&&e.length>0&&(e=new RegExp(e)),e&&!e.test)throw i("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",s,e,z(t));r=e||n,o.$validate()}),o.$validators.pattern=function(e){return o.$isEmpty(e)||_(r)||r.test(e)}}}}},Jo=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,i){if(i){var a=0;n.$observe("maxlength",function(e){a=p(e)||0,i.$validate()}),i.$validators.maxlength=function(e,t){return i.$isEmpty(e)||t.length<=a}}}}},Qo=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,i){if(i){var a=0;n.$observe("minlength",function(e){a=p(e)||0,i.$validate()}),i.$validators.minlength=function(e,t){return i.$isEmpty(e)||t.length>=a}}}}},er=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,i,a){var r=t.attr(i.$attr.ngList)||", ",s="false"!==i.ngTrim,l=s?ia(r):r,c=function(e){if(!_(e)){var t=[];return e&&o(e.split(l),function(e){e&&t.push(s?ia(e):e)}),t}};a.$parsers.push(c),a.$formatters.push(function(e){return na(e)?e.join(r):n}),a.$isEmpty=function(e){return!e||!e.length}}}},tr=/^(true|false|\d+)$/,nr=function(){return{restrict:"A",priority:100,compile:function(e,t){return tr.test(t.ngValue)?function(e,t,n){n.$set("value",e.$eval(n.ngValue))}:function(e,t,n){e.$watch(n.ngValue,function(e){n.$set("value",e)})}}}},ir=function(){return{restrict:"A",controller:["$scope","$attrs",function(e,t){var i=this;this.$options=e.$eval(t.ngModelOptions),this.$options.updateOn!==n?(this.$options.updateOnDefault=!1,this.$options.updateOn=ia(this.$options.updateOn.replace(Lo,function(){return i.$options.updateOnDefault=!0," "}))):this.$options.updateOnDefault=!0}]}},ar=["$compile",function(e){return{restrict:"AC",compile:function(t){return e.$$addBindingClass(t),function(t,i,a){e.$$addBindingInfo(i,a.ngBind),i=i[0],t.$watch(a.ngBind,function(e){i.textContent=e===n?"":e})}}}}],or=["$interpolate","$compile",function(e,t){return{compile:function(i){return t.$$addBindingClass(i),function(i,a,o){var r=e(a.attr(o.$attr.ngBindTemplate));t.$$addBindingInfo(a,r.expressions),a=a[0],o.$observe("ngBindTemplate",function(e){a.textContent=e===n?"":e})}}}}],rr=["$sce","$parse","$compile",function(e,t,n){return{restrict:"A",compile:function(i,a){var o=t(a.ngBindHtml),r=t(a.ngBindHtml,function(e){return(e||"").toString()});return n.$$addBindingClass(i),function(t,i,a){n.$$addBindingInfo(i,a.ngBindHtml),t.$watch(r,function(){i.html(e.getTrustedHtml(o(t))||"")})}}}}],sr=Li("",!0),lr=Li("Odd",0),cr=Li("Even",1),dr=yi({compile:function(e,t){t.$set("ngCloak",n),e.removeClass("ng-cloak")}}),ur=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],pr={},mr={blur:!0,focus:!0};o("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(e){var t=Kt("ng-"+e);pr[t]=["$parse","$rootScope",function(n,i){return{restrict:"A",compile:function(a,o){var r=n(o[t],null,!0);return function(t,n){n.on(e,function(n){var a=function(){r(t,{$event:n})};mr[e]&&i.$$phase?t.$evalAsync(a):t.$apply(a)})}}}}]});var hr=["$animate",function(e){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,rest
return e=p(e)?e:e.split(/\s+/),d(e,function(e,i){e&&e.length>0&&(n+=(i>0?" ":"")+e+t)}),n}var A,T,I,D,P="";e.ontransitionend===n&&e.onwebkittransitionend!==n?(P="-webkit-",A="WebkitTransition",T="webkitTransitionEnd transitionend"):(A="transition",T="transitionend"),e.onanimationend===n&&e.onwebkitanimationend!==n?(P="-webkit-",I="WebkitAnimation",D="webkitAnimationEnd animationend"):(I="animation",D="animationend");var N,O="Duration",L="Property",U="Delay",R="IterationCount",B="PlayState",F="$$ngAnimateKey",q="$$ngAnimateCSS3Data",j=3,H=1.5,z=1e3,V={},W=0,G=[],K=null,Z=0,Y=[];return{animate:function(e,t,n,i,a,o){return o=o||{},o.from=n,o.to=i,M("animate",e,t,a,o)},enter:function(e,t,n){return n=n||{},M("enter",e,"ng-enter",t,n)},leave:function(e,t,n){return n=n||{},M("leave",e,"ng-leave",t,n)},move:function(e,t,n){return n=n||{},M("move",e,"ng-move",t,n)},beforeSetClass:function(e,t,n,i,a){a=a||{};var o=E(n,"-remove")+" "+E(t,"-add"),r=S("setClass",e,o,a.from);return r?(u(e,i),r):(l(),void i())},beforeAddClass:function(e,t,n,i){i=i||{};var a=S("addClass",e,E(t,"-add"),i.from);return a?(u(e,n),a):(l(),void n())},beforeRemoveClass:function(e,t,n,i){i=i||{};var a=S("removeClass",e,E(t,"-remove"),i.from);return a?(u(e,n),a):(l(),void n())},setClass:function(e,t,n,i,a){a=a||{},n=E(n,"-remove"),t=E(t,"-add");var o=n+" "+t;return C("setClass",e,o,i,a.to)},addClass:function(e,t,n,i){return i=i||{},C("addClass",e,E(t,"-add"),n,i.to)},removeClass:function(e,t,n,i){return i=i||{},C("removeClass",e,E(t,"-remove"),n,i.to)}}}])}])}(window,window.angular),function(e,t){"use strict";function n(){this.$get=["$$sanitizeUri",function(e){return function(t){var n=[];return o(t,l(n,function(t,n){return!/^unsafe/.test(e(t,n))})),n.join("")}}]}function i(e){var n=[],i=l(n,t.noop);return i.chars(e),n.join("")}function a(e){var t,n={},i=e.split(",");for(t=0;t<i.length;t++)n[i[t]]=!0;return n}function o(e,n){function i(e,i,o,s){if(i=t.lowercase(i),S[i])for(;v.last()&&C[v.last()];)a("",v.last());k[i]&&v.last()==i&&a("",i),s=b[i]||!!s,s||v.push(i);var l={};o.replace(p,function(e,t,n,i,a){var o=n||i||a||"";l[t]=r(o)}),n.start&&n.start(i,l,s)}function a(e,i){var a,o=0;if(i=t.lowercase(i))for(o=v.length-1;o>=0&&v[o]!=i;o--);if(o>=0){for(a=v.length-1;a>=o;a--)n.end&&n.end(v[a]);v.length=o}}"string"!=typeof e&&(e=null===e||"undefined"==typeof e?"":""+e);var o,s,l,y,v=[],w=e;for(v.last=function(){return v[v.length-1]};e;){if(y="",s=!0,v.last()&&x[v.last()]?(e=e.replace(new RegExp("(.*)<\\s*\\/\\s*"+v.last()+"[^>]*>","i"),function(e,t){return t=t.replace(f,"$1").replace(_,"$1"),n.chars&&n.chars(r(t)),""}),a("",v.last())):(0===e.indexOf("<!--")?(o=e.indexOf("--",4),o>=0&&e.lastIndexOf("-->",o)===o&&(n.comment&&n.comment(e.substring(4,o)),e=e.substring(o+3),s=!1)):g.test(e)?(l=e.match(g),l&&(e=e.replace(l[0],""),s=!1)):h.test(e)?(l=e.match(u),l&&(e=e.substring(l[0].length),l[0].replace(u,a),s=!1)):m.test(e)&&(l=e.match(d),l?(l[4]&&(e=e.substring(l[0].length),l[0].replace(d,i)),s=!1):(y+="<",e=e.substring(1))),s&&(o=e.indexOf("<"),y+=0>o?e:e.substring(0,o),e=0>o?"":e.substring(o),n.chars&&n.chars(r(y)))),e==w)throw c("badparse","The sanitizer was unable to parse the following block of html: {0}",e);w=e}a()}function r(e){if(!e)return"";var t=N.exec(e),n=t[1],i=t[3],a=t[2];return a&&(P.innerHTML=a.replace(/</g,"&lt;"),a="textContent"in P?P.textContent:P.innerText),n+a+i}function s(e){return e.replace(/&/g,"&amp;").replace(y,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+(1024*(t-55296)+(n-56320)+65536)+";"}).replace(v,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function l(e,n){var i=!1,a=t.bind(e,e.push);return{start:function(e,o,r){e=t.lowercase(e),!i&&x[e]&&(i=e),i||E[e]!==!0||(a("<"),a(e),t.forEach(o,function(i,o){var r=t.lowercase(o),l="img"===e&&"src"===r||"background"===r;D[r]!==!0||A[r]===!0&&!n(i,l)||(a(" "),a(o),a('="'),a(s(i)),a('"'))}),a(r?"/>":">"))},end:function(e){e=t.lowercase(e),i||E[e]!==!0||(a("</"),a(e),a(">")),e==i&&(i=!1)},chars:function(e){i||a(s(e))}}}var c=t.$$minErr("$sanitize
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=bnFlipBit,BigInteger.prototype.add=bnAdd,BigInteger.prototype.subtract=bnSubtract,BigInteger.prototype.multiply=bnMultiply,BigInteger.prototype.divide=bnDivide,BigInteger.prototype.remainder=bnRemainder,BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder,BigInteger.prototype.modPow=bnModPow,BigInteger.prototype.modInverse=bnModInverse,BigInteger.prototype.pow=bnP
for(t=0,n=s.length;n>t;++t)for(e=s[t],i=0,a=e.length;a>i;++i)l[o++]=e[i];for(t=32768,n=this.a;n>t;++t)l[o++]=r[t];return this.i=[],this.buffer=l},o.prototype.A=function(){var e,t=this.a;return p?this.w?(e=new Uint8Array(t),e.set(this.b.subarray(0,t))):e=this.b.subarray(0,t):(this.b.length>t&&(this.b.length=t),e=this.b),this.buffer=e},c.prototype.F=function(){return this.s||this.g(),this.m.slice()},c.prototype.g=function(){for(var t=this.input.length;this.c<t;){var a=new i,r=d,s=d,l=d,c=d,u=d,m=d,h=d,f=d,g=d,_=this.input,y=this.c;switch(a.u=_[y++],a.v=_[y++],(31!==a.u||139!==a.v)&&e(Error("invalid file signature:"+a.u+","+a.v)),a.p=_[y++],a.p){case 8:break;default:e(Error("unknown compression method: "+a.p))}if(a.h=_[y++],f=_[y++]|_[y++]<<8|_[y++]<<16|_[y++]<<24,a.H=new Date(1e3*f),a.N=_[y++],a.M=_[y++],0<(4&a.h)&&(a.I=_[y++]|_[y++]<<8,y+=a.I),0<(8&a.h)){for(h=[],m=0;0<(u=_[y++]);)h[m++]=String.fromCharCode(u);a.name=h.join("")}if(0<(16&a.h)){for(h=[],m=0;0<(u=_[y++]);)h[m++]=String.fromCharCode(u);a.J=h.join("")}0<(2&a.h)&&(a.B=65535&n(_,0,y),a.B!==(_[y++]|_[y++]<<8)&&e(Error("invalid header crc16"))),r=_[_.length-4]|_[_.length-3]<<8|_[_.length-2]<<16|_[_.length-1]<<24,_.length-y-4-4<512*r&&(c=r),s=new o(_,{index:y,bufferSize:c}),a.data=l=s.g(),y=s.c,a.K=g=(_[y++]|_[y++]<<8|_[y++]<<16|_[y++]<<24)>>>0,n(l,d,d)!==g&&e(Error("invalid CRC-32 checksum: 0x"+n(l,d,d).toString(16)+" / 0x"+g.toString(16))),a.L=r=(_[y++]|_[y++]<<8|_[y++]<<16|_[y++]<<24)>>>0,(4294967295&l.length)!==r&&e(Error("invalid input size: "+(4294967295&l.length)+" / "+r)),this.m.push(a),this.c=y}this.s=!0;var v,b,w,$=this.m,k=0,S=0;for(v=0,b=$.length;b>v;++v)S+=$[v].data.length;if(p)for(w=new Uint8Array(S),v=0;b>v;++v)w.set($[v].data,k),k+=$[v].data.length;else{for(w=[],v=0;b>v;++v)w[v]=$[v].data;w=Array.prototype.concat.apply([],w)}return w},t("Zlib.Gunzip",c),t("Zlib.Gunzip.prototype.decompress",c.prototype.g),t("Zlib.Gunzip.prototype.getMembers",c.prototype.F)}.call(this),this.goog={provide:function(){},math:{}},goog.provide("goog.math.Long"),goog.math.Long=function(e,t){this.low_=0|e,this.high_=0|t},goog.math.Long.IntCache_={},goog.math.Long.fromInt=function(e){if(e>=-128&&128>e){var t=goog.math.Long.IntCache_[e];if(t)return t}var n=new goog.math.Long(0|e,0>e?-1:0);return e>=-128&&128>e&&(goog.math.Long.IntCache_[e]=n),n},goog.math.Long.fromNumber=function(e){return isNaN(e)||!isFinite(e)?goog.math.Long.ZERO:e<=-goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MIN_VALUE:e+1>=goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MAX_VALUE:0>e?goog.math.Long.fromNumber(-e).negate():new goog.math.Long(e%goog.math.Long.TWO_PWR_32_DBL_|0,e/goog.math.Long.TWO_PWR_32_DBL_|0)},goog.math.Long.fromBits=function(e,t){return new goog.math.Long(e,t)},goog.math.Long.fromString=function(e,t){if(0==e.length)throw Error("number format error: empty string");var n=t||10;if(2>n||n>36)throw Error("radix out of range: "+n);if("-"==e.charAt(0))return goog.math.Long.fromString(e.substring(1),n).negate();if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character: '+e);for(var i=goog.math.Long.fromNumber(Math.pow(n,8)),a=goog.math.Long.ZERO,o=0;o<e.length;o+=8){var r=Math.min(8,e.length-o),s=parseInt(e.substring(o,o+r),n);if(8>r){var l=goog.math.Long.fromNumber(Math.pow(n,r));a=a.multiply(l).add(goog.math.Long.fromNumber(s))}else a=a.multiply(i),a=a.add(goog.math.Long.fromNumber(s))}return a},goog.math.Long.TWO_PWR_16_DBL_=65536,goog.math.Long.TWO_PWR_24_DBL_=1<<24,goog.math.Long.TWO_PWR_32_DBL_=goog.math.Long.TWO_PWR_16_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_31_DBL_=goog.math.Long.TWO_PWR_32_DBL_/2,goog.math.Long.TWO_PWR_48_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_64_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_32_DBL_,goog.math.Long.TWO_PWR_63_DBL_=goog.math.Long.TWO_PWR_64_DBL_/2,goog.math.Long.ZERO=goog.math.Long.fromInt(0),goog.math.Long.ONE=goog.math.Long.fromInt(1),goog.math.Long.NEG_ONE=goog.math.Long.fromInt(-1),goog.math.Long.MAX_VALUE=goog.math.Long.fromBits(-1,2147483647),goog
}catch(t){}e.chrome&&chrome.runtime&&chrome.runtime.reload&&chrome.runtime.reload()},close:function(){try{e.close()}catch(t){}},focus:function(){window.navigator.mozApps&&document.hidden?window.navigator.mozApps.getSelf().onsuccess=function(){this.result.launch()}:(window.chrome&&chrome.app&&chrome.app.window&&chrome.app.window.current().focus(),window.focus())}}}]),angular.module("myApp.i18n",["izhukov.utils"]).factory("_",["$rootScope","$locale",function(e,t){function n(e,t){return e.replace(l,function(i,a,o){var r=t[a];return void 0===r?(console.warn("[i18n] missing param "+a+' for message "'+e+'"'),""):(void 0!==o&&(r=n(r,o.split("|"))),r.toString().trim())})}function i(e){return e=e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\n|&#10;/g,"<br/>")}function a(e,t){var a=!1,l=e;if("_raw"===e.substr(-4)&&(a=!0,e=e.substr(0,e.length-4)),r.hasOwnProperty(e))l=r[e];else{if(!s.hasOwnProperty(e))return console.warn("[i18n] missing key "+e),e;l=s[e],console.warn("[i18n] missing locale key "+o+" / "+e)}return a||(l=encodeEntities(l)),"_md"==e.substr(-3)&&(l=i(l)),arguments.length>1&&("string"==typeof t?(Array.prototype.shift.apply(arguments),l=n(l,arguments)):l=n(l,t)),l}var o=Config.I18n.locale,r=Config.I18n.messages,s=Config.I18n.fallback_messages,l=/\{\s*([a-zA-Z\d\-_]+)(?:\s*:\s*(.*?))?\s*\}/g;return a.locale=function(){return o},a.pluralize=function(n){var i=e.$eval(a(n+"_raw"));return function(e){return(i[t.pluralCat(e)]||"").replace("{}",e)}},a}]).filter("i18n",["_",function(e){return function(t,n){return e(t+"_raw",n)}}]).directive("ngPluralize",["_",function(e){return{restrict:"EA",priority:1,compile:function(t){var n=t.attr("when"),i=e(n+"_raw");t.attr("when",i)}}}]).directive("myI18n",["_",function(e){return{restrict:"EA",compile:function(t){var n=t.children('my-i18n-param:not([name]), [my-i18n-param=""]:not([name])').map(function(e,t){return t.outerHTML}).toArray();t.children('my-i18n-param[name], [my-i18n-param]:not([my-i18n-param=""]), [my-i18n-param][name]').each(function(e,t){n[angular.element(t).attr("my-i18n-param")||angular.element(t).attr("name")]=t.outerHTML}),t.children("my-i18n-param").remove();var i=t.attr("my-i18n")||t.attr("msgid")?t:t.children("my-i18n-format, [my-i18n-format]");i.each(function(t,i){var a=angular.element(i),o=a.attr("my-i18n")||a.attr("msgid")||a.attr("my-i18n-format")||a.html().replace(/\s+/g," ").trim(),r=e(o,n);a.html(r)})}}}]),angular.module("izhukov.mtproto",["izhukov.utils"]).factory("MtpDcConfigurator",function(){function e(e,a){if(void 0===i[e]){var o,r,s=!1;if(Config.Modes.ssl){var l=t[e-1]+(a?"-1":""),c=Config.Modes.test?"apiw_test1":"apiw1";return s="https://"+l+".web.telegram.org/"+c}for(o=0;o<n.length;o++)if(r=n[o],r.id==e){s="http://"+r.host+(80!=r.port?":"+r.port:"")+"/apiw1";break}i[e]=s}return i[e]}var t=["pluto","venus","aurora","vesta","flora"],n=Config.Modes.test?[{id:1,host:"149.154.175.10",port:80},{id:2,host:"149.154.167.40",port:80},{id:3,host:"174.140.142.5",port:80}]:[{id:1,host:"149.154.175.50",port:80},{id:2,host:"149.154.167.51",port:80},{id:3,host:"149.154.175.100",port:80},{id:4,host:"149.154.167.91",port:80},{id:5,host:"149.154.171.5",port:80}],i={};return{chooseServer:e}}).factory("MtpRsaKeysManager",function(){function e(){if(!a){for(var e=0;e<n.length;e++){var t=n[e],o=new TLSerialization;o.storeBytes(bytesFromHex(t.modulus),"n"),o.storeBytes(bytesFromHex(t.exponent),"e");var r=o.getBuffer(),s=sha1BytesSync(r).slice(-8);s.reverse(),i[bytesToHex(s)]={modulus:t.modulus,exponent:t.exponent}}a=!0}}function t(t){e();var n,a,o;for(o=0;o<t.length;o++)if(n=bigStringInt(t[o]).toString(16),a=i[n])return angular.extend({fingerprint:t[o]},a);return!1}var n=[{modulus:"c150023e2f70db7985ded064759cfecf0af328e69a41daf4d6f01b538135a6f91f8f8b2a0ec9ba9720ce352efcf6c5680ffc424bd634864902de0b4bd6d49f4e580230e3ae97d95c8b19442b3c0a10d8f5633fecedd6926a7f6dab0ddb7d457f9ea81b8465fcd6fffeed114011df91c059caedaf97625f6c96ecc74725556934ef781d866b34f011fce4d835a090196e9a5f0e4449af7eb697ddb9076494ca5f81104a305b6dd27665722c46b60e5df680fb16b210607ef217652e60236c255f6a28
}),o.promise}function s(e){var t=v[e],n="upload"==e?11:5;if(b[e]>=n||!t||!t.length)return!1;var i=t.shift(),a=i.activeDelta||1;b[e]+=a;w++;i.cb().then(function(t){b[e]-=a,s(e),i.deferred.resolve(t)},function(t){b[e]-=a,s(e),i.deferred.reject(t)})}function l(e){switch(e._){case"inputVideoFileLocation":return"video"+e.id+".mp4";case"inputDocumentFileLocation":return"doc"+e.id;case"inputAudioFileLocation":return"audio"+e.id}return e.volume_id||console.trace("Empty location",e),e.volume_id+"_"+e.local_id+"_"+e.secret+".jpg"}function c(e){if(!e)return!1;var t=l(e);return y[t]||!1}function d(){return a.isAvailable()?a:i.isAvailable()?i:o}function u(e,t){var n=l(e);return g[n]||(g[n]=d().saveFile(n,t).then(function(e){return y[n]=e})),g[n]}function p(i){if(!n.isAvailable())return t.reject({type:"BROWSER_BLOB_NOT_SUPPORTED"});var a=l(i),o="image/jpeg",s=g[a]||_[a];if(s)return s;var c=d();return _[a]=c.getFile(a).then(function(e){return y[a]=e},function(){var t=r(i.dc_id,function(){var t=i;return t._&&"fileLocation"!=t._||(t=angular.extend({},i,{_:"inputFileLocation"})),e.invokeApi("upload.getFile",{location:t,offset:0,limit:1048576},{dcID:i.dc_id,fileDownload:!0,createNetworker:!0})});return c.getFileWriter(a,o).then(function(e){return t.then(function(t){return n.write(e,t.bytes).then(function(){return y[a]=e.finalize()})})})})}function m(e,t){var n=d(),i=l(e);return n.getFile(i,t)}function h(i,a,o,s){if(!n.isAvailable())return t.reject({type:"BROWSER_BLOB_NOT_SUPPORTED"});s=s||{};var c=l(a),u=s.toFileEntry||null,p=g[c]||_[c],m=d();if(p)return u?p.then(function(e){return n.copy(e,u)}):p;var h,f=t.defer(),v=!1,b=!1,w=s.mime||"image/jpeg",$=function(e){f.reject(e),$=angular.noop,!h||e&&"DOWNLOAD_CANCELED"==e.type||h.truncate(0)};return m.getFile(c,o).then(function(e){u?n.copy(e,u).then(function(){f.resolve()},$):f.resolve(y[c]=e)},function(){var s=u?n.getFileWriter(u):m.getFileWriter(c,w);s.then(function(s){h=s;var l,d,p=524288,m=0,g=t.when();if(s.length){if(m=s.length,m>=o)return void f.resolve(u?s.finalize():y[c]=s.finalize());s.seek(m),f.notify({done:m,total:o})}for(l=m;o>l;l+=p)d=t.defer(),function(l,d,m,h){return r(i,function(){return v?t.when():e.invokeApi("upload.getFile",{location:a,offset:d,limit:p},{dcID:i,fileDownload:!0,createNetworker:!0})},2).then(function(e){h.then(function(){return v?t.when():n.write(s,e.bytes).then(function(){m.resolve()},$).then(function(){l?(b=!0,u?f.resolve():f.resolve(y[c]=s.finalize())):f.notify({done:d+p,total:o})})})})}(l+p>=o,l,d,g),g=d.promise})}),f.promise.cancel=function(){v||b||(v=!0,delete _[c],$({type:"DOWNLOAD_CANCELED"}))},u||(_[c]=f.promise),f.promise}function f(n){var i=n.size,a=i>=10485760,o=!1,s=!1,l=0,c=262144,d=2;i>67108864?(c=524288,d=4):102400>i&&(c=32768,d=1);var u=Math.ceil(i/c);if(u>1500)return t.reject({type:"FILE_TOO_BIG"});var p,m=[nextRandomInt(4294967295),nextRandomInt(4294967295)],h=t.defer(),f=function(e){h.reject(e),o=!0,f=angular.noop},g=0,_={_:a?"inputFileBig":"inputFile",id:m,parts:u,name:n.name,md5_checksum:""};for(p=0;i>p;p+=c)!function(p,g){r("upload",function(){var r=t.defer(),d=new FileReader,y=n.slice(p,p+c);return d.onloadend=function(t){return o?void r.reject():void(t.target.readyState==FileReader.DONE&&e.invokeApi(a?"upload.saveBigFilePart":"upload.saveFilePart",{file_id:m,file_part:g,file_total_parts:u,bytes:t.target.result},{startMaxLength:c+256,fileUpload:!0,singleInRequest:!0}).then(function(){l++,r.resolve(),l>=u?(h.resolve(_),s=!0):(console.log(dT(),"Progress",l*c/i),h.notify({done:l*c,total:i}))},f))},d.readAsArrayBuffer(y),r.promise},d)}(p,g++);return h.promise.cancel=function(){console.log("cancel upload",o,s),o||s||(o=!0,f({type:"UPLOAD_CANCELED"}))},h.promise}var g={},_={},y={},v={},b={},w=0;return{getCachedFile:c,getDownloadedFile:m,downloadFile:h,downloadSmallFile:p,saveSmallFile:u,uploadFile:f}}]).service("MtpSingleInstanceService",["_","$rootScope","$interval","Storage","AppRuntimeManager","IdleManager","ErrorService","MtpNetworkerFactory",function(e,t,n,i,a,o,r,s){function l(){if(!p&&!Config.Navigator.mobile&&!Config.Modes.packed){p=!
break;case"messageMediaAudio":d=w("conversation_media_audio_raw");break;case"messageMediaGeo":d=w("conversation_media_location_raw");break;case"messageMediaContact":d=w("conversation_media_contact_raw");break;default:d=w("conversation_media_attachment_raw")}else if("messageService"==e._)switch(e.action._){case"messageActionChatCreate":d=w("conversation_group_created_raw");break;case"messageActionChatEditTitle":d=w("conversation_group_renamed_raw");break;case"messageActionChatEditPhoto":d=w("conversation_group_photo_updated_raw");break;case"messageActionChatDeletePhoto":d=w("conversation_group_photo_removed_raw");break;case"messageActionChatAddUser":d=w(e.action.user_id==e.from_id?"conversation_returned_to_group":"conversation_invited_user_message_raw");break;case"messageActionChatDeleteUser":d=w(e.action.user_id==e.from_id?"conversation_left_group":"conversation_kicked_user_message_raw")}a>0?(c.title=(s.first_name||"")+(s.first_name&&s.last_name?" ":"")+(s.last_name||""),i=l,n=o.getUserString(a)):(c.title=(s.first_name||s.last_name||w("conversation_unknown_user_raw"))+" @ "+(r.getChat(-a).title||w("conversation_unknown_chat_raw")),i=r.getChatPhoto(-a,"Group"),n=r.getChatString(-a)),c.title=h.wrapPlainText(c.title),c.onclick=function(){t.$broadcast("history_focus",{peerString:n})},c.message=d,c.image=i.placeholder,c.key="msg"+e.id,c.tag=n,i.location&&!i.location.empty?m.downloadSmallFile(i.location,i.size).then(function(t){c.image=y.getUrl(t,"image/jpeg"),e.unread&&f.notify(c)}):f.notify(c)}var G,K={},Z={},Y={},X={},J={count:null,dialogs:[]},Q={},et={},tt={},nt=e.when(),it=-1,at=SearchIndexManager.createIndex(),ot={query:!1},rt={},st=[],lt=0,ct=tsNow(!0),dt=ct-ct%86400,ut=new Date,pt=!1;Config.Modes.packed&&_.get("max_seen_msg").then(function(e){pt=e||0}),_.get("server_time_offset").then(function(e){e&&(lt=e)});var mt=i("dateOrTime");return ut.setHours(0),ut.setMinutes(0),ut.setSeconds(0),G=dt-Math.floor(+ut/1e3),f.start(),window.navigator.mozSetMessageHandler&&window.navigator.mozSetMessageHandler("activity",function(e){var n=e.source;console.log(dT(),"Received activity",n.name,n.data),"share"===n.name&&n.data.blobs.length>0&&g.selectPeers({confirm_type:"EXT_SHARE_PEER"}).then(function(e){angular.forEach(e,function(e){var t=s.getPeerID(e);angular.forEach(n.data.blobs,function(e){N(t,e,{isMedia:!0})})}),1==e.length&&t.$broadcast("history_focus",{peerString:e[0]})})}),t.$on("apiUpdate",function(e,n){switch(n._){case"updateMessageID":et[n.id]=n.random_id;break;case"updateNewMessage":var i=n.message,a=F(i),r=X[a];if(void 0!==r){{X[a].history[0]}if(-1!=X[a].history.indexOf(i.id))return!1;r.history.unshift(i.id),r.history.sort(function(e,t){return t-e})}else r=X[a]={count:null,history:[i.id],pending:[]};D([i]),i.out||o.forceUserOnline(i.from_id),null!==r.count&&r.count++;var l,c=et[i.id];c&&((l=R(c,i))&&t.$broadcast("history_update",{peerID:a}),delete et[i.id]),l||t.$broadcast("history_append",{peerID:a,messageID:i.id});var d,u=z(a);if(u.length?(d=u[0],J.dialogs.splice(u[1],1)):d={peerID:a,unread_count:0,top_message:!1},!i.out&&i.unread&&d.unread_count++,d.top_message=i.id,SearchIndexManager.indexObject(a,s.getPeerSearchText(a),at),J.dialogs.unshift(d),t.$broadcast("dialogs_update",d),(t.selectedPeerID!=a||t.idle.isIDLE)&&!i.out&&i.unread){var p=f.getPeerMuted(a),m=t.idle.isIDLE&&b.isOtherDeviceActive()?3e4:1e3;setTimeout(function(){p.then(function(e){i.unread&&!e&&W(i)})},m)}V(i.id);break;case"updateReadMessages":var h,i,g,a,u,d,_={},y=!1;for(g=0;g<n.messages.length;g++)h=n.messages[g],i=K[h],i&&i.unread&&(i.unread=!1,Z[h]&&(Z[h].unread=!1,y||(y=!0)),Y[h]&&(Y[h].unread=!1),a=F(i),i.out?a>0&&o.forceUserOnline(a):(u=z(a),u&&(_[a]=--u[0].unread_count),f.cancel("msg"+h)));angular.forEach(_,function(e,n){t.$broadcast("dialog_unread",{peerID:n,count:e})}),y&&t.$broadcast("messages_read");break;case"updateDeleteMessages":var h,i,g,a,u,d,v,_={},w={};for(g=0;g<n.messages.length;g++)h=n.messages[g],i=K[h],i&&(a=F(i),v=w[a]||(w[a]={count:0,unread:0,msgs:{}}),!i.out&&i.unread&&(v.unread++,f.cancel("msg"+h)),v.count++,v.msgs[h]=!0,Z[h]&&
})}function o(n){if(!l){var i=$(window).width();if(!(!n&&Config.Mobile&&800>=i)){var o=600>i;o!=Config.Mobile&&t.get("layout_confirmed").then(function(n){return n&&(n.mobile?i==n.width:i==n.width)?!1:(l=!0,void e.confirm({type:o?"SWITCH_MOBILE_VERSION":"SWITCH_DESKTOP_VERSION"}).then(function(){t.remove("layout_confirmed"),a(o)},function(){t.set({layout_confirmed:{width:i,mobile:Config.Mobile}}),l=!1}))})}}}function r(){s||Config.Navigator.mobile||(s=!0,o(),$(i).on("resize",o))}var s=!1,l=!1;return{start:r,switchLayout:a}}]).service("TelegramMeWebService",["Storage",function(e){function t(t){return n?!1:void e.get("tgme_sync").then(function(n){var i=tsNow(!0);if(t&&n&&n.canRedirect==t&&n.ts+86400>i)return!1;e.set({tgme_sync:{canRedirect:t,ts:i}});var a=$("<script>").appendTo("body").on("load error",function(){a.remove()}).attr("src","//telegram.me/_websync_?authed="+(t?"1":"0"))})}var n=Config.Modes.test||-1==Config.App.domains.indexOf(location.hostname)||"http:"!=location.protocol&&"https:"!=location.protocol||"https:"==location.protocol&&"web.telegram.org"!=location.hostname;return{setAuthorized:t}}]).service("LocationParamsService",["$rootScope","$routeParams","AppUsersManager",function(e,t,n){function i(){if(t.tgaddr){var i=t.tgaddr.match(/^(web\+)?tg:(\/\/)?resolve\?domain=(.+)$/);i&&i[3]&&n.resolveUsername(i[3]).then(function(t){e.$broadcast("history_focus",{peerString:n.getUserString(t)})})}}function a(){if(!o){o=!0;try{navigator.registerProtocolHandler("tg","#im?tgaddr=%s","Telegram Web")}catch(t){}try{navigator.registerProtocolHandler("web+tg","#im?tgaddr=%s","Telegram Web")}catch(t){}e.$on("$routeUpdate",i),i()}}var o=!("registerProtocolHandler"in navigator);return{start:a}}]),angular.module("myApp.controllers",["myApp.i18n"]).controller("AppWelcomeController",["$scope","$location","MtpApiManager","ErrorService","ChangelogNotifyService","LayoutSwitchService",function(e,t,n,i,a,o){n.getUserID().then(function(e){return e?void t.url("/im"):"http:"!=location.protocol||Config.Modes.http||-1==Config.App.domains.indexOf(location.hostname)?void t.url("/login"):void(location.href=location.href.replace(/^http:/,"https:"))}),a.checkUpdate(),o.start()}]).controller("AppLoginController",["$scope","$rootScope","$location","$timeout","$modal","$modalStack","MtpApiManager","ErrorService","NotificationsManager","ChangelogNotifyService","IdleManager","LayoutSwitchService","TelegramMeWebService","_",function(e,t,n,i,a,o,r,s,l,c,d,u,p,m){function h(){var t=(navigator.language||"").toLowerCase(),n=Config.LangCountries[t],i=!Config.Navigator.mobile;if(f(-1==["en","en-us","en-uk"].indexOf(t)?void 0!==n?n:t.indexOf("-")>0?t.split("-")[1].toUpperCase():"US":"US"),i){var a=e.credentials.phone_country;r.invokeApi("help.getNearestDc",{},{dcID:2,createNetworker:!0}).then(function(t){a==e.credentials.phone_country&&f(t.country),t.nearest_dc!=t.this_dc&&r.getNetworker(t.nearest_dc,{createNetworker:!0})})}}function f(e){var t,n;for(t=0;t<Config.CountryCodes.length;t++)if(n=Config.CountryCodes[t],n[0]==e)return g({name:m(n[1]+"_raw"),code:n[2]});return g({name:m("country_select_modal_country_us_raw"),code:"+1"})}function g(t){w=t,e.credentials.phone_country!=t.code?e.credentials.phone_country=t.code:_(),e.$broadcast("country_selected"),e.$broadcast("value_updated")}function _(){var t,n,i,a=((e.credentials.phone_country||"")+(e.credentials.phone_number||"")).replace(/\D+/g,""),o=0,r=!1;if(a.length)if(w&&!a.indexOf(w.code.replace(/\D+/g,"")))r=w.name;else for(t=0;t<Config.CountryCodes.length;t++)for(n=2;n<Config.CountryCodes[t].length;n++)i=Config.CountryCodes[t][n].replace(/\D+/g,""),i.length>o&&!a.indexOf(i)&&(o=i.length,r=m(Config.CountryCodes[t][1]+"_raw"));e.credentials.phone_full=a,e.credentials.phone_country_name=r||m("login_controller_unknown_country_raw")}function y(e){r.setUserAuth(b.dcID,{expires:e.expires,id:e.user.id}),i.cancel($),n.url("/im")}function v(){i.cancel($),e.credentials.viaApp||(--e.callPending.remaining?$=i(v,1e3):(e.callPending.success=!1,r.invokeApi("auth.sendCall",{phone_number:e.credentials.phone_full,phone_code_ha
})})},t["delete"]=function(){d.confirm({type:"PHOTO_DELETE"}).then(function(){t.photo.updating=!0,a.invokeApi("messages.editChatPhoto",{chat_id:t.chatID,photo:{_:"inputChatPhotoEmpty"}}).then(function(e){l.onStatedMessage(e),i.dismiss(),n.$broadcast("history_focus",{peerString:r.getChatString(t.chatID)})})["finally"](function(){t.photo.updating=!1})})},t.download=function(){o.downloadPhoto(t.photoID)}}]).controller("VideoModalController",["$scope","$rootScope","$modalInstance","PeersSelectService","AppMessagesManager","AppVideoManager","AppPeersManager","ErrorService",function(e,t,n,i,a,o,r,s){e.video=o.wrapForFull(e.videoID),e.progress={enabled:!1},e.player={},e.forward=function(){var n=e.messageID;i.selectPeers({confirm_type:"FORWARD_PEER"}).then(function(e){angular.forEach(e,function(i){var o=r.getPeerID(i);a.forwardMessages(o,[n]).then(function(){1==e.length&&t.$broadcast("history_focus",{peerString:i})})})})},e["delete"]=function(){var t=e.messageID;s.confirm({type:"MESSAGE_DELETE"}).then(function(){a.deleteMessages([t])})},e.download=function(){o.saveVideoFile(e.videoID)},e.$on("history_delete",function(t,i){i.msgs[e.messageID]&&n.dismiss()})}]).controller("DocumentModalController",["$scope","$rootScope","$modalInstance","PeersSelectService","AppMessagesManager","AppDocsManager","AppPeersManager","ErrorService",function(e,t,n,i,a,o,r,s){e.document=o.wrapForHistory(e.docID),e.forward=function(){var n=e.messageID;i.selectPeers({confirm_type:"FORWARD_PEER"}).then(function(e){angular.forEach(e,function(i){var o=r.getPeerID(i);a.forwardMessages(o,[n]).then(function(){1==e.length&&t.$broadcast("history_focus",{peerString:i})})})})},e["delete"]=function(){var t=e.messageID;s.confirm({type:"MESSAGE_DELETE"}).then(function(){a.deleteMessages([t])})},e.download=function(){o.saveDocFile(e.docID)},e.$on("history_delete",function(t,i){i.msgs[e.messageID]&&n.dismiss()})}]).controller("UserModalController",["$scope","$location","$rootScope","$modal","AppUsersManager","MtpApiManager","NotificationsManager","AppPhotosManager","AppMessagesManager","AppPeersManager","PeersSelectService","ErrorService",function(e,t,n,i,a,o,r,s,l,c,d,u){var p=a.getUserString(e.userID);e.user=a.getUser(e.userID),e.userPhoto=a.getUserPhoto(e.userID,"User"),e.blocked=!1,e.settings={notifications:!0},o.invokeApi("users.getFullUser",{id:a.getUserInput(e.userID)}).then(function(t){e.override&&e.override.phone_number?(t.user.phone=e.override.phone_number,(e.override.first_name||e.override.last_name)&&(t.user.first_name=e.override.first_name,t.user.last_name=e.override.last_name),a.saveApiUser(t.user)):a.saveApiUser(t.user,!0),s.savePhoto(t.profile_photo),e.blocked=t.blocked,r.savePeerSettings(e.userID,t.notify_settings),r.getPeerMuted(e.userID).then(function(t){e.settings.notifications=!t,e.$watch("settings.notifications",function(t,n){return t===n?!1:void r.getPeerSettings(e.userID).then(function(n){n.mute_until=t?0:2e9,r.updatePeerSettings(e.userID,n)})})})}),e.goToHistory=function(){n.$broadcast("history_focus",{peerString:p})},e.flushHistory=function(){u.confirm({type:"HISTORY_FLUSH"}).then(function(){l.flushHistory(c.getInputPeerByID(e.userID)).then(function(){e.goToHistory()})})},e.importContact=function(t){var o=n.$new();o.importContact={phone:e.user.phone,first_name:e.user.first_name,last_name:e.user.last_name},i.open({templateUrl:templateUrl(t?"edit_contact_modal":"import_contact_modal"),controller:"ImportContactModalController",windowClass:"md_simple_modal_window mobile_modal",scope:o}).result.then(function(t){e.userID==t&&(e.user=a.getUser(e.userID))})},e.deleteContact=function(){a.deleteContacts([e.userID]).then(function(){e.user=a.getUser(e.userID)})},e.toggleBlock=function(t){o.invokeApi(t?"contacts.block":"contacts.unblock",{id:a.getUserInput(e.userID)}).then(function(){e.blocked=t})},e.shareContact=function(){d.selectPeers({confirm_type:"SHARE_CONTACT_PEER"}).then(function(t){angular.forEach(t,function(i){var a=c.getPeerID(i);l.sendOther(a,{_:"inputMediaContact",phone_number:e.user.phone,first_name:e.user.first_name,last_name:e.user.last_name
}]),function(e,t,n,i){function a(e){ConfigStorage.get("emojis_popular",function(t){var n=[];if(t&&t.length){for(var i=0,a=t.length;a>i;i++)n.push({code:t[i][0],rate:t[i][1]});return void e(n)}ConfigStorage.get("emojis_recent",function(t){t=t||b||[];for(var i,a,o=0,r=t.length;r>o;o++)i=t[o],Array.isArray(i)&&(i=i[0]),":"==i.charAt(0)&&(i=i.substr(1,i.length-2)),(a=g[i])&&n.push({code:a,rate:1});e(n)})})}function o(e){a(function(t){for(var n=!1,i=t.length,a=[],o=0;i>o;o++)t[o].code==e&&(n=!0,t[o].rate++),a.push([t[o].code,t[o].rate]);n?a.sort(function(e,t){return t[1]-e[1]}):(a.length>41&&(a=a.slice(0,41)),a.push([e,1])),ConfigStorage.set({emojis_popular:a})})}function r(){if(v===!1){v=SearchIndexManager.createIndex();var e;for(e in g)g.hasOwnProperty(e)&&SearchIndexManager.indexObject(g[e],e,v)}}function s(e){r();var t,n=SearchIndexManager.search(e,v),i=[];for(t in n)n.hasOwnProperty(t)&&i.push(t);return i}var l,c,d,u,p,m,h,f,t={},g={},_={},y={},v=!1,b="joy,kissing_heart,heart,heart_eyes,blush,grin,+1,relaxed,pensive,smile,sob,kiss,unamused,flushed,stuck_out_tongue_winking_eye,see_no_evil,wink,smiley,cry,stuck_out_tongue_closed_eyes,scream,rage,smirk,disappointed,sweat_smile,kissing_closed_eyes,speak_no_evil,relieved,grinning,yum,laughing,ok_hand,neutral_face,confused".split(",");for(l=0,h=n.length;h>l;l++)for(m=i[l][1],c=0,f=n[l].length;f>c;c++)d=n[l][c],p=Config.Emoji[d],u=p[1][0],t[d]=[p[0],u],g[u]=d,_[d]=[l,c,Math.floor(c/m),c%m];e.EmojiHelper={emojis:t,shortcuts:g,spritesheetPositions:_,stickers:y,getPopularEmoji:a,pushPopularEmoji:o,indexEmojis:r,searchEmojis:s}}(window,Config.Emoji,Config.EmojiCategories,Config.EmojiCategorySpritesheetDimens),EmojiTooltip.prototype.onMouseEnter=function(e){this.hideTimeout?(clearTimeout(this.hideTimeout),delete this.hideTimeout):e&&!this.showTimeout&&(this.showTimeout=setTimeout(this.show.bind(this),500))},EmojiTooltip.prototype.onMouseLeave=function(e){if(this.hideTimeout)e&&this.showTimeout&&(clearTimeout(this.showTimeout),delete this.showTimeout);else{var t=this;this.hideTimeout=setTimeout(function(){t.hide()},500)}},EmojiTooltip.prototype.createTooltip=function(){if(this.tooltipEl)return!1;var e=this;return this.tooltipEl=$('<div class="composer_emoji_tooltip noselect"><div class="composer_emoji_tooltip_tabs"></div><div class="composer_emoji_tooltip_content_wrap nano mobile_scrollable_wrap"><div class="composer_emoji_tooltip_content nano-content clearfix"></div></div><div class="composer_emoji_tooltip_footer"><a class="composer_emoji_tooltip_settings"></a></div><div class="composer_emoji_tooltip_tail"><i class="icon icon-tooltip-tail"></i></div></div>').appendTo(document.body),this.tabsEl=$(".composer_emoji_tooltip_tabs",this.tooltip),this.contentWrapEl=$(".composer_emoji_tooltip_content_wrap",this.tooltip),this.contentEl=$(".composer_emoji_tooltip_content",this.tooltip),this.footerEl=$(".composer_emoji_tooltip_footer",this.tooltip),this.settingsEl=$(".composer_emoji_tooltip_settings",this.tooltip),angular.forEach(["recent","smile","flower","bell","car","grid","stickers"],function(t,n){$('<a class="composer_emoji_tooltip_tab composer_emoji_tooltip_tab_'+t+'"></a>').on("mousedown",function(t){return e.selectTab(n),cancelEvent(t)}).on("mouseenter mouseleave",function(t){clearTimeout(e.selectTabTimeout),"mouseenter"==t.type&&(e.selectTabTimeout=setTimeout(function(){e.selectTab(n)},300))}).appendTo(e.tabsEl)}),Config.Mobile||this.contentWrapEl.nanoScroller({preventPageScrolling:!0,tabIndex:-1}),this.contentEl.on("mousedown",function(t){t=t.originalEvent||t;var n,i,a=$(t.target);return(a.hasClass("emoji")||a.hasClass("composer_sticker_image"))&&(a=$(a[0].parentNode)),(n=a.attr("data-code"))&&(e.onEmojiSelected&&e.onEmojiSelected(n),EmojiHelper.pushPopularEmoji(n)),(i=a.attr("data-sticker"))&&e.onStickerSelected&&e.onStickerSelected(i),cancelEvent(t)}),this.tooltipEl.on("mouseenter mouseleave",function(t){"mouseenter"==t.type?e.onMouseEnter():e.onMouseLeave()}),this.selectTab(0),!0},EmojiTooltip.prototype.selectTab=function(e){return this.tab===e?!1:($(".active",this.tabsEl).remove
})},onEmojiSelected:function(t){e.$apply(function(){x.onEmojiSelected(t)})},onStickerSelected:function(t){e.$apply(function(){e.draftMessage.sticker=t})}});var M;b&&(M=new EmojiPanel(b,{onEmojiSelected:function(e){x.onEmojiSelected(e)}}));var x=new MessageComposer(y,{onTyping:function(){e.$emit("ui_typing")},getSendOnEnter:function(){return A},onMessageSubmit:l,onFilesPaste:m}),E=x.richTextareaEl[0];E&&$(E).attr("placeholder",i($(y).attr("placeholder"))(e)).on("keydown keyup",d),w.on("change",function(){var t=this;e.$apply(function(){e.draftMessage.files=Array.prototype.slice.call(t.files),e.draftMessage.isMedia=$(t).hasClass("im_media_attach_input")||Config.Mobile,setTimeout(function(){try{t.value=""}catch(e){}},1e3)})});var A=!0;e.$on("settings_changed",s),s(),$(C).on("mousedown touchstart",l);var T=E&&E.offsetHeight;$(document).on("keydown",u),$("body").on("dragenter dragleave dragover drop",f),$(document).on("paste",h),Config.Navigator.touch||(e.$on("ui_peer_change",p),e.$on("ui_history_focus",p),e.$on("ui_history_change",p)),e.$on("ui_peer_change",x.resetTyping.bind(x)),e.$on("ui_peer_draft",function(){E&&(x.setValue(e.draftMessage.text||""),d()),x.focus()});var I=!1;e.$on("ui_message_before_send",function(){I=!0,c()}),e.$on("ui_message_send",function(){I=!1,p()}),e.$on("$destroy",function(){$(document).off("paste",h),$(document).off("keydown",u),$("body").off("dragenter dragleave dragover drop",f),$(C).off("mousedown touchstart"),w.off("change")}),Config.Navigator.touch||p()}return{link:s,scope:{draftMessage:"="}}}]).directive("myLoadThumb",["MtpApiFileManager","FileManager",function(e,t){function n(n,i,a){var o=0,r=e.getCachedFile(n.thumb&&n.thumb.location&&!n.thumb.location.empty&&n.thumb.location);r&&i.attr("src",t.getUrl(r,"image/jpeg")),n.thumb&&n.thumb.width&&n.thumb.height&&(i.attr("width",n.thumb.width),i.attr("height",n.thumb.height));var s=n.$watchCollection("thumb.location",function(a){n.thumb&&n.thumb.width&&n.thumb.height&&(i.attr("width",n.thumb.width),i.attr("height",n.thumb.height),n.$emit("ui_height"));var r=++o;if(!a||a.empty)return i.attr("src",n.thumb&&n.thumb.placeholder||"img/blank.gif"),void l();var s=e.getCachedFile(a);return s?(i.attr("src",t.getUrl(s,"image/jpeg")),void l()):(i.attr("src")||i.attr("src",n.thumb.placeholder||"img/blank.gif"),void e.downloadSmallFile(n.thumb.location).then(function(e){r==o&&(i.attr("src",t.getUrl(e,"image/jpeg")),l())},function(e){console.log("Download image failed",e,n.thumb.location,i[0]),r==o&&(i.attr("src",n.thumb.placeholder||"img/blank.gif"),l())}))}),l=a.watch?angular.noop:function(){setTimeout(function(){n.$destroy(),s()},0)}}return{link:n,scope:{thumb:"="}}}]).directive("myLoadFullPhoto",["MtpApiFileManager","FileManager","_",function(e,t,n){function i(i,a){var o=$("img",a)[0],r=$(".img_fullsize_with_progress_wrap",a).add(".img_fullsize_progress_wrap",a).add($(o)),s=function(){r.css({width:i.fullPhoto.width,height:i.fullPhoto.height}),i.$emit("ui_height",!0)},l=0;i.$watchCollection("fullPhoto.location",function(){var a=e.getCachedFile(i.thumbLocation),r=++l;if(a?(o.src=t.getUrl(a,"image/jpeg"),s()):o.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",i.fullPhoto.location){var c;if(i.fullPhoto.size){var d={_:"inputFileLocation",volume_id:i.fullPhoto.location.volume_id,local_id:i.fullPhoto.location.local_id,secret:i.fullPhoto.location.secret};c=e.downloadFile(i.fullPhoto.location.dc_id,d,i.fullPhoto.size)}else c=e.downloadSmallFile(i.fullPhoto.location);i.progress={enabled:!0,percent:0},c.then(function(e){r==l&&(i.progress.enabled=!1,o.src=t.getUrl(e,"image/jpeg"),s())},function(e){console.log("Download image failed",e,i.fullPhoto.location),i.progress.enabled=!1,i.error=e&&"FS_BROWSER_UNSUPPORTED"==e.type?{html:n("error_browser_no_local_file_system_image_md",{"moz-link":'<a href="{0}" target="_blank">{1}</a>',"chrome-link":'<a href="{0}" target="_blank">{1}</a>',"telegram-link":'<a href="{0}" target="_blank">{1}</a>'})}:{text:n("error_image_download_failed"),error:e}},function(e){i.progress.percent=Math.max(1,Math.fl