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
866 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 c=32767&this[e],l=this[e++]>>15,d=s*c+l*r;c=r*c+((32767&d)<<15)+n[i]+(1073741823&a),a=(c>>>30)+(d>>>15)+s*l+(a>>>30),n[i++]=1073741823&c}return a}function am3(e,t,n,i,a,o){for(var r=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,d=s*c+l*r;c=r*c+((16383&d)<<14)+n[i]+a,a=(c>>28)+(d>>14)+s*l,n[i++]=268435455&c}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 onContentLoaded(e){setTimeout(e,0)}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 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),uint6ToBase64(a>>>12&63),uint6ToBase64(a>>>6&63),uint6ToBase64(63&a)),a=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 bytesCmp(e,t){var n=e.length;if(n!=t.length)return!1;for(var i=0;n>i;i++)if(e[i]!=t[i])return!1;return!0}function bytesXor(e,t){for(var n=e.length,i=[],a=0;n>a;++a)i[a]=e[a]^t[a];return i}function bytesToWords(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var t,n=e.length,i=[];for(t=0;n>t;t++)i[t>>>2]|=e[t]<<24-t%4*8;return new CryptoJS.lib.WordArray.init(i,n)}function bytesFromWords(e){for(var t=e.words,n=e.sigBytes,i=[],a=0;n>a;a++)i.push(t[a>>>2]>>>24-a%4*8&255);return i}function bytesFromBigInt(e,t){for(var n=e.toByteArray();!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,i=e.length;i>n;n++)t.push(e[n]);return t}function bytesFromArrayBuffer(e){for(var t=e.byteLength,n=new Uint8Array(e),i=[],a=0;t>a;++a)i[a]=n[a];return i}function bufferConcat(e,t){var n=e.byteLength||e.length,i=t.byteLength||t.length,a=new Uint8Array(n+i);return a.set(e instanceof ArrayBuffer?new Uint8Array(e):e,0),a.set(t instanceof ArrayBuffer?new Uint8Array(t):t,n),a.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 bytesFromArrayBuf
}catch(kt){Q={apply:Z.length?function(e,t){J.apply(e,et.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}w=t.support={},C=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},I=t.setDocument=function(e){var t,n=e?e.ownerDocument||e:F,i=n.defaultView;return n!==D&&9===n.nodeType&&n.documentElement?(D=n,P=n.documentElement,N=!C(n),i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",function(){I()},!1):i.attachEvent&&i.attachEvent("onunload",function(){I()})),w.attributes=a(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=a(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=_t.test(n.getElementsByClassName)&&a(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),w.getById=a(function(e){return P.appendChild(e).id=R,!n.getElementsByName||!n.getElementsByName(R).length}),w.getById?($.find.ID=function(e,t){if(typeof t.getElementById!==G&&N){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},$.filter.ID=function(e){var t=e.replace(wt,$t);return function(e){return e.getAttribute("id")===t}}):(delete $.find.ID,$.filter.ID=function(e){var t=e.replace(wt,$t);return function(e){var n=typeof e.getAttributeNode!==G&&e.getAttributeNode("id");return n&&n.value===t}}),$.find.TAG=w.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==G?t.getElementsByTagName(e):void 0}:function(e,t){var n,i=[],a=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[a++];)1===n.nodeType&&i.push(n);return i}return o},$.find.CLASS=w.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==G&&N?t.getElementsByClassName(e):void 0},U=[],L=[],(w.qsa=_t.test(n.querySelectorAll))&&(a(function(e){e.innerHTML="<select msallowclip=''><option selected=''></option></select>",e.querySelectorAll("[msallowclip^='']").length&&L.push("[*^$]="+it+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||L.push("\\["+it+"*(?:value|"+nt+")"),e.querySelectorAll(":checked").length||L.push(":checked")}),a(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&L.push("name"+it+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||L.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),L.push(",.*:")})),(w.matchesSelector=_t.test(O=P.matches||P.webkitMatchesSelector||P.mozMatchesSelector||P.oMatchesSelector||P.msMatchesSelector))&&a(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),U.push("!=",st)}),L=L.length&&new RegExp(L.join("|")),U=U.length&&new RegExp(U.join("|")),t=_t.test(P.compareDocumentPosition),B=t||_t.test(P.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},W=t?function(e,t){if(e===t)return E=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i?i:(i=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&i||!w.sortDetached&&t.compareDocumentPosition(e)===i?e===n||e.ownerDocument===F&&B(F,e)?-1:t===n||t.ownerDocument===F&&B(F,t)?1:T?tt.call(T,e)-tt.call(T,t):0:4&i?-1:1)}:function(e,t){if(e===t)return E=!0,0;var i,a=0,o=e.parentNode,s=t.parentNode,c=[e],l=[t];if(!o||!s)return e===n?-1:t===n?1:o?-1:s?1:T?tt.call(T,e)-tt.call(T,t):0;if(o===s)return r(e,t);for(i=e;i=i.parentNode;)c.unshift(i);for(i=t;i=i.parentNode;)l.unshift(i);for(;c[a]===l[a];)a++;return a?r(c[a],l[a]):c[a]===F?-1:l[a]===F?1:0},n):D},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==D&&I(e),n=n.replace(ut,"='$1']"),!(!w.matchesSelector||!N||U&&U.test(n)||L&&L.test(n)))try{var i=O.call(e,n);if(i||w.disconnectedMatch||e.document&&11!==e.docu
}}}),nt.submitBubbles||(at.event.special.submit={setup:function(){return at.nodeName(this,"form")?!1:void at.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,n=at.nodeName(t,"input")||at.nodeName(t,"button")?t.form:void 0;n&&!at._data(n,"submitBubbles")&&(at.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),at._data(n,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&at.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return at.nodeName(this,"form")?!1:void at.event.remove(this,"._submit")}}),nt.changeBubbles||(at.event.special.change={setup:function(){return It.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(at.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),at.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),at.event.simulate("change",this,e,!0)})),!1):void at.event.add(this,"beforeactivate._change",function(e){var t=e.target;It.test(t.nodeName)&&!at._data(t,"changeBubbles")&&(at.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||at.event.simulate("change",this.parentNode,e,!0)}),at._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return at.event.remove(this,"._change"),!It.test(this.nodeName)}}),nt.focusinBubbles||at.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){at.event.simulate(t,e.target,at.event.fix(e),!0)};at.event.special[t]={setup:function(){var i=this.ownerDocument||this,a=at._data(i,t);a||i.addEventListener(e,n,!0),at._data(i,t,(a||0)+1)},teardown:function(){var i=this.ownerDocument||this,a=at._data(i,t)-1;a?at._data(i,t,a):(i.removeEventListener(e,n,!0),at._removeData(i,t))}}}),at.fn.extend({on:function(e,t,n,i,a){var o,r;if("object"==typeof e){"string"!=typeof t&&(n=n||t,t=void 0);for(o in e)this.on(o,t,n,e[o],a);return this}if(null==n&&null==i?(i=t,n=t=void 0):null==i&&("string"==typeof t?(i=n,n=void 0):(i=n,n=t,t=void 0)),i===!1)i=m;else if(!i)return this;return 1===a&&(r=i,i=function(e){return at().off(e),r.apply(this,arguments)},i.guid=r.guid||(r.guid=at.guid++)),this.each(function(){at.event.add(this,e,i,n,t)})},one:function(e,t,n,i){return this.on(e,t,n,i,1)},off:function(e,t,n){var i,a;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,at(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(a in e)this.off(a,t,e[a]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=void 0),n===!1&&(n=m),this.each(function(){at.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){at.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?at.event.trigger(e,t,n,!0):void 0}});var Ut="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Ot=/ jQuery\d+="(?:null|\d+)"/g,Bt=new RegExp("<(?:"+Ut+")[\\s/>]","i"),Rt=/^\s+/,Ft=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,qt=/<([\w:]+)/,Ht=/<tbody/i,jt=/<|&#?\w+;/,zt=/<(?:script|style|link)/i,Vt=/checked\s*(?:[^=]|=\s*.checked.)/i,Wt=/^$|\/(?:java|ecma)script/i,Gt=/^true\/(.*)/,Kt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Xt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:nt.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Zt=f(ht),Yt=Zt.appendChild(ht.createElement("div"));Xt.optgroup=Xt.option,Xt.tbody=Xt.tfoot=Xt.colgro
c=u.global,c&&0===at.active++&&at.event.trigger("ajaxStart"),u.type=u.type.toUpperCase(),u.hasContent=!Fn.test(u.type),o=u.url,u.hasContent||(u.data&&(o=u.url+=(Dn.test(o)?"&":"?")+u.data,delete u.data),u.cache===!1&&(u.url=On.test(o)?o.replace(On,"$1_="+In++):o+(Dn.test(o)?"&":"?")+"_="+In++)),u.ifModified&&(at.lastModified[o]&&w.setRequestHeader("If-Modified-Since",at.lastModified[o]),at.etag[o]&&w.setRequestHeader("If-None-Match",at.etag[o])),(u.data&&u.hasContent&&u.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",u.contentType),w.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+Vn+"; q=0.01":""):u.accepts["*"]);for(a in u.headers)w.setRequestHeader(a,u.headers[a]);if(u.beforeSend&&(u.beforeSend.call(p,w,u)===!1||2===v))return w.abort();b="abort";for(a in{success:1,error:1,complete:1})w[a](u[a]);if(l=F(zn,u,t,w)){w.readyState=1,c&&m.trigger("ajaxSend",[w,u]),u.async&&u.timeout>0&&(s=setTimeout(function(){w.abort("timeout")},u.timeout));try{v=1,l.send(_,n)}catch($){if(!(2>v))throw $;n(-1,$)}}else n(-1,"No Transport");return w},getJSON:function(e,t,n){return at.get(e,t,n,"json")},getScript:function(e,t){return at.get(e,void 0,t,"script")}}),at.each(["get","post"],function(e,t){at[t]=function(e,n,i,a){return at.isFunction(n)&&(a=a||i,i=n,n=void 0),at.ajax({url:e,type:t,dataType:a,data:n,success:i})}}),at.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){at.fn[t]=function(e){return this.on(t,e)}}),at._evalUrl=function(e){return at.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},at.fn.extend({wrapAll:function(e){if(at.isFunction(e))return this.each(function(t){at(this).wrapAll(e.call(this,t))});if(this[0]){var t=at(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(at.isFunction(e)?function(t){at(this).wrapInner(e.call(this,t))}:function(){var t=at(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=at.isFunction(e);return this.each(function(n){at(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){at.nodeName(this,"body")||at(this).replaceWith(this.childNodes)}).end()}}),at.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!nt.reliableHiddenOffsets()&&"none"===(e.style&&e.style.display||at.css(e,"display"))},at.expr.filters.visible=function(e){return!at.expr.filters.hidden(e)};var Gn=/%20/g,Kn=/\[\]$/,Xn=/\r?\n/g,Zn=/^(?:submit|button|image|reset|file)$/i,Yn=/^(?:input|select|textarea|keygen)/i;at.param=function(e,t){var n,i=[],a=function(e,t){t=at.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=at.ajaxSettings&&at.ajaxSettings.traditional),at.isArray(e)||e.jquery&&!at.isPlainObject(e))at.each(e,function(){a(this.name,this.value)});else for(n in e)z(n,e[n],t,a);return i.join("&").replace(Gn,"+")},at.fn.extend({serialize:function(){return at.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=at.prop(this,"elements");return e?at.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!at(this).is(":disabled")&&Yn.test(this.nodeName)&&!Zn.test(e)&&(this.checked||!Et.test(e))}).map(function(e,t){var n=at(this).val();return null==n?null:at.isArray(n)?at.map(n,function(e){return{name:t.name,value:e.replace(Xn,"\r\n")}}):{name:t.name,value:n.replace(Xn,"\r\n")}}).get()}}),at.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&V()||W()}:V;var Jn=0,Qn={},ei=at.ajaxSettings.xhr();e.ActiveXObject&&at(e).on("unload",function(){for(var e in Qn)Qn[e](void 0,!0)}),nt.cors=!!ei&&"withCredentials"in ei,ei=nt.ajax=!!ei,ei&&at.ajaxTransport(function(e){if(!e.crossDomain||nt.cors){var t;return{send:f
}function n(){c=!0}function i(){return c?(c=!1,""):s}function a(){var e,t,n,a=Array.prototype.slice.call(arguments),o=a.pop(),r=[],s=1==a.length,c=!0,p=i();for(t=0;t<a.length;t++)if(n=a[t]=p+a[t],"xt_"!=n.substr(0,3)&&void 0!==l[n])r.push(l[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(l[n]=e)}else d?c=!1:r.push(l[n]=!1);return c?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(l[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,l[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 l[t],u)try{localStorage.removeItem(t)}catch(r){u=!1}d?chrome.storage.local.remove(a,n):n&&n()}var s="",c=!1,l={},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,c,l,d,u,p,m,h,f,g,_,y,v,b,w,$,k,C,S,x,M,A,T,E,I,D,P;S={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
return o.$$minErr=o.$$minErr||i,t(o,"module",function(){var e={};return function(i,o,r){var s=function(e,t){if("hasOwnProperty"===e)throw a("badname","hasOwnProperty is not a valid {0} name",t)};return s(i,"module"),o&&e.hasOwnProperty(i)&&(e[i]=null),t(e,i,function(){function e(e,n,i,a){return a||(a=t),function(){return a[i||"push"]([e,n,arguments]),l}}if(!o)throw n("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",i);var t=[],a=[],s=[],c=e("$injector","invoke","push",a),l={_invokeQueue:t,_configBlocks:a,_runBlocks:s,requires:o,name:i,provider:e("$provide","provider"),factory:e("$provide","factory"),service:e("$provide","service"),value:e("$provide","value"),constant:e("$provide","constant","unshift"),animation:e("$animateProvider","register"),filter:e("$filterProvider","register"),controller:e("$controllerProvider","register"),directive:e("$compileProvider","directive"),config:c,run:function(e){return s.push(e),this}};return r&&c(r),l})}})}function dt(t){u(t,{bootstrap:J,copy:L,extend:u,equals:O,element:Vi,forEach:o,injector:Ft,noop:h,bind:F,toJson:H,fromJson:j,identity:f,isUndefined:_,isDefined:y,isString:b,isFunction:k,isObject:v,isNumber:w,isElement:I,isArray:na,version:ha,isDate:$,lowercase:Ri,uppercase:qi,callbacks:{counter:0},getTestability:et,$$minErr:i,$$csp:oa,reloadWithDebugInfo:Q}),Gi=lt(e);try{Gi("ngLocale")}catch(n){Gi("ngLocale",[]).provider("$locale",pn)}Gi("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:jn}),e.provider("$compile",Gt).directive({a:bo,input:Ro,textarea:Ro,form:So,script:Er,select:Pr,style:Lr,option:Nr,ngBind:ar,ngBindHtml:rr,ngBindTemplate:or,ngClass:sr,ngClassEven:lr,ngClassOdd:cr,ngCloak:dr,ngController:ur,ngForm:xo,ngHide:Cr,ngIf:hr,ngInclude:fr,ngInit:_r,ngNonBindable:yr,ngPluralize:vr,ngRepeat:br,ngShow:kr,ngStyle:Sr,ngSwitch:xr,ngSwitchWhen:Mr,ngSwitchDefault:Ar,ngOptions:Dr,ngTransclude:Tr,ngModel:Ko,ngList:er,ngChange:Xo,pattern:Yo,ngPattern:Yo,required:Zo,ngRequired:Zo,minlength:Qo,ngMinlength:Qo,maxlength:Jo,ngMaxlength:Jo,ngValue:nr,ngModelOptions:ir}).directive({ngInclude:gr}).directive(wo).directive(pr),e.provider({$anchorScroll:qt,$animate:Ba,$browser:zt,$cacheFactory:Vt,$controller:Yt,$document:Jt,$exceptionHandler:Qt,$filter:ti,$interpolate:dn,$interval:un,$http:rn,$httpBackend:cn,$location:Sn,$log:xn,$parse:On,$rootScope:Hn,$q:Bn,$$q:Rn,$sce:Gn,$sceDelegate:Wn,$sniffer:Kn,$templateCache:Wt,$templateRequest:Xn,$$testability:Zn,$timeout:Yn,$window:ei,$$rAF:qn,$$asyncCallback:Ht})}])}function ut(){return++ga}function pt(e){return e.replace(va,function(e,t,n,i){return i?n.toUpperCase():n}).replace(ba,"Moz$1")}function mt(e){return!Ca.test(e)}function ht(e){var t=e.nodeType;return t===la||!t||t===pa}function ft(e,t){var n,i,a,r,s=t.createDocumentFragment(),c=[];if(mt(e))c.push(t.createTextNode(e));else{for(n=n||s.appendChild(t.createElement("div")),i=(Sa.exec(e)||["",""])[1].toLowerCase(),a=Ma[i]||Ma._default,n.innerHTML=a[1]+e.replace(xa,"<$1></$2>")+a[2],r=a[0];r--;)n=n.lastChild;c=B(c,n.childNodes),n=s.firstChild,n.textContent=""}return s.textContent="",s.innerHTML="",o(c,function(e){s.appendChild(e)}),s}function gt(e,n){n=n||t;var i;return(i=ka.exec(e))?[n.createElement(i[1])]:(i=ft(e,n))?i.childNodes:[]}function _t(e){if(e instanceof _t)return e;var t;if(b(e)&&(e=ia(e),t=!0),!(this instanceof _t)){if(t&&"<"!=e.charAt(0))throw $a("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new _t(e)}t?Mt(this,gt(e)):Mt(this,e)}function yt(e){return e.cloneNode(!0)}function vt(e,t){if(t||wt(e),e.querySelectorAll)for(var n=e.querySelectorAll("*"),i=0,a=n.length;a>i;i++)wt(n[i])}function bt(e,t,n,i){if(y(i))throw $a("offargs","jqLite#off() does not support the `selector` argument");var a=$t(e),r=a&&a.events,s=a&&a.handle;if(s)if(t)o(t.split(" "),function(t){if(y(n)){var i=r[t];if(N(i||[],n),i&&i.length>0)return}ya(e,t,s),delete r[t]});else for(t in
}function h(){o(arguments,function(e){m[e]=function(t,n){return m(u(n||{},{method:e,url:t}))}})}function f(){o(arguments,function(e){m[e]=function(t,n,i){return m(u(i||{},{method:e,url:t,data:n}))}})}function g(i,o,s){function c(e,n,i,a){function o(){u(n,e,i,a)}h&&(on(e)?h.put($,[e,n,tn(i),a]):h.remove($)),t?l.$applyAsync(o):(o(),l.$$phase||l.$apply())}function u(e,t,n,a){t=Math.max(t,0),(on(t)?g.resolve:g.reject)({data:e,status:t,headers:nn(n),config:i,statusText:a})}function p(){var e=m.pendingRequests.indexOf(i);-1!==e&&m.pendingRequests.splice(e,1)}var h,f,g=d.defer(),b=g.promise,$=w(i.url,i.params);if(m.pendingRequests.push(i),b.then(p,p),!i.cache&&!e.cache||i.cache===!1||"GET"!==i.method&&"JSONP"!==i.method||(h=v(i.cache)?i.cache:v(e.cache)?e.cache:C),h)if(f=h.get($),y(f)){if(E(f))return f.then(p,p),f;na(f)?u(f[1],f[0],U(f[2]),f[3]):u(f,200,{},"OK")}else h.put($,b);if(_(f)){var k=Qn(i.url)?r.cookies()[i.xsrfCookieName||e.xsrfCookieName]:n;k&&(s[i.xsrfHeaderName||e.xsrfHeaderName]=k),a(i.method,$,o,c,s,i.timeout,i.withCredentials,i.responseType)}return b}function w(e,t){if(!t)return e;var n=[];return s(t,function(e,t){null===e||_(e)||(na(e)||(e=[e]),o(e,function(e){v(e)&&(e=$(e)?e.toISOString():H(e)),n.push(X(t)+"="+X(e))}))}),n.length>0&&(e+=(-1==e.indexOf("?")?"?":"&")+n.join("&")),e}var C=c("$http"),S=[];return o(i,function(e){S.unshift(b(e)?p.get(e):p.invoke(e))}),m.pendingRequests=[],h("get","delete","head","jsonp"),f("post","put","patch"),m.defaults=e,m}]}function sn(){return new e.XMLHttpRequest}function cn(){this.$get=["$browser","$window","$document",function(e,t,n){return ln(e,sn,e.defer,t.angular.callbacks,n[0])}]}function ln(e,t,n,i,a){function r(e,t,n){var o=a.createElement("script"),r=null;return o.type="text/javascript",o.src=e,o.async=!0,r=function(e){ya(o,"load",r),ya(o,"error",r),a.body.removeChild(o),o=null;var s=-1,c="unknown";e&&("load"!==e.type||i[t].called||(e={type:"error"}),c=e.type,s="error"===e.type?404:200),n&&n(s,c)},_a(o,"load",r),_a(o,"error",r),a.body.appendChild(o),r}return function(a,s,c,l,d,u,p,m){function f(){v&&v(),b&&b.abort()}function g(t,i,a,o,r){k&&n.cancel(k),v=b=null,t(i,a,o,r),e.$$completeOutstandingRequest(h)}if(e.$$incOutstandingRequestCount(),s=s||e.url(),"jsonp"==Ri(a)){var _="_"+(i.counter++).toString(36);i[_]=function(e){i[_].data=e,i[_].called=!0};var v=r(s.replace("JSON_CALLBACK","angular.callbacks."+_),_,function(e,t){g(l,e,i[_].data,"",t),i[_]=h})}else{var b=t();b.open(a,s,!0),o(d,function(e,t){y(e)&&b.setRequestHeader(t,e)}),b.onload=function(){var e=b.statusText||"",t="response"in b?b.response:b.responseText,n=1223===b.status?204:b.status;0===n&&(n=t?200:"file"==Jn(s).protocol?404:0),g(l,n,t,b.getAllResponseHeaders(),e)};var w=function(){g(l,-1,null,null,"")};if(b.onerror=w,b.onabort=w,p&&(b.withCredentials=!0),m)try{b.responseType=m}catch($){if("json"!==m)throw $}b.send(c||null)}if(u>0)var k=n(f,u);else E(u)&&u.then(f)}}function dn(){var e="{{",t="}}";this.startSymbol=function(t){return t?(e=t,this):e},this.endSymbol=function(e){return e?(t=e,this):t},this.$get=["$parse","$exceptionHandler","$sce",function(n,i,a){function o(e){return"\\\\\\"+e}function r(o,r,p,m){function h(n){return n.replace(l,e).replace(d,t)}function f(e){try{return T(A(e))}catch(t){var n=Wa("interr","Can't interpolate: {0}\n{1}",o,t.toString());i(n)}}m=!!m;for(var g,y,v,b=0,w=[],$=[],C=o.length,S=[],x=[];C>b;){if(-1==(g=o.indexOf(e,b))||-1==(y=o.indexOf(t,g+s))){b!==C&&S.push(h(o.substring(b)));break}b!==g&&S.push(h(o.substring(b,g))),v=o.substring(g+s,y),w.push(v),$.push(n(v,f)),b=y+c,x.push(S.length),S.push("")}if(p&&S.length>1)throw Wa("noconcat","Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce",o);if(!r||w.length){var M=function(e){for(var t=0,n=w.length;n>t;t++){if(m&&_(e[t]))return;S[x[t]]=e[t]}return S.join("")},A=function(e){return p?a.getTrusted(p,e):a.valueOf(e)},T=function(e){if(null==e)return"";switch(typeof e){case"string":brea
return o(i,function(e,n){r[n]=t(n,e)}),r}return e.factory(i+n,a)}var n="Filter";this.register=t,this.$get=["$injector",function(e){return function(t){return e.get(t+n)}}],t("currency",ii),t("date",hi),t("filter",ni),t("json",fi),t("limitTo",gi),t("lowercase",yo),t("number",ai),t("orderBy",_i),t("uppercase",vo)}function ni(){return function(e,t,n){if(!na(e))return e;var i=typeof n,a=[];a.check=function(e,t){for(var n=0;n<a.length;n++)if(!a[n](e,t))return!1;return!0},"function"!==i&&(n="boolean"===i&&n?function(e,t){return Qi.equals(e,t)}:function(e,t){if(e&&t&&"object"==typeof e&&"object"==typeof t){for(var i in e)if("$"!==i.charAt(0)&&Fi.call(e,i)&&n(e[i],t[i]))return!0;return!1}return t=(""+t).toLowerCase(),(""+e).toLowerCase().indexOf(t)>-1});var o=function(e,t){if("string"==typeof t&&"!"===t.charAt(0))return!o(e,t.substr(1));switch(typeof e){case"boolean":case"number":case"string":return n(e,t);case"object":switch(typeof t){case"object":return n(e,t);default:for(var i in e)if("$"!==i.charAt(0)&&o(e[i],t))return!0}return!1;case"array":for(var a=0;a<e.length;a++)if(o(e[a],t))return!0;return!1;default:return!1}};switch(typeof t){case"boolean":case"number":case"string":t={$:t};case"object":for(var r in t)!function(e){"undefined"!=typeof t[e]&&a.push(function(n){return o("$"==e?n:n&&n[e],t[e])})}(r);break;case"function":a.push(t);break;default:return e}for(var s=[],c=0;c<e.length;c++){var l=e[c];a.check(l,c)&&s.push(l)}return s}}function ii(e){var t=e.NUMBER_FORMATS;return function(e,n,i){return _(n)&&(n=t.CURRENCY_SYM),_(i)&&(i=2),null==e?e:oi(e,t.PATTERNS[1],t.GROUP_SEP,t.DECIMAL_SEP,i).replace(/\u00A4/g,n)}}function ai(e){var t=e.NUMBER_FORMATS;return function(e,n){return null==e?e:oi(e,t.PATTERNS[0],t.GROUP_SEP,t.DECIMAL_SEP,n)}}function oi(e,t,n,i,a){if(!isFinite(e)||v(e))return"";var o=0>e;e=Math.abs(e);var r=e+"",s="",c=[],l=!1;if(-1!==r.indexOf("e")){var d=r.match(/([\d\.]+)e(-?)(\d+)/);d&&"-"==d[2]&&d[3]>a+1?(r="0",e=0):(s=r,l=!0)}if(l)a>0&&e>-1&&1>e&&(s=e.toFixed(a));else{var u=(r.split(ho)[1]||"").length;_(a)&&(a=Math.min(Math.max(t.minFrac,u),t.maxFrac)),e=+(Math.round(+(e.toString()+"e"+a)).toString()+"e"+-a),0===e&&(o=!1);var p=(""+e).split(ho),m=p[0];p=p[1]||"";var h,f=0,g=t.lgSize,y=t.gSize;if(m.length>=g+y)for(f=m.length-g,h=0;f>h;h++)(f-h)%y===0&&0!==h&&(s+=n),s+=m.charAt(h);for(h=f;h<m.length;h++)(m.length-h)%g===0&&0!==h&&(s+=n),s+=m.charAt(h);for(;p.length<a;)p+="0";a&&"0"!==a&&(s+=i+p.substr(0,a))}return c.push(o?t.negPre:t.posPre),c.push(s),c.push(o?t.negSuf:t.posSuf),c.join("")}function ri(e,t,n){var i="";for(0>e&&(i="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),i+e}function si(e,t,n,i){return n=n||0,function(a){var o=a["get"+e]();return(n>0||o>-n)&&(o+=n),0===o&&-12==n&&(o=12),ri(o,t,i)}}function ci(e,t){return function(n,i){var a=n["get"+e](),o=qi(t?"SHORT"+e:e);return i[o][a]}}function li(e){var t=-1*e.getTimezoneOffset(),n=t>=0?"+":"";return n+=ri(Math[t>0?"floor":"ceil"](t/60),2)+ri(Math.abs(t%60),2)}function di(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function ui(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+(4-e.getDay()))}function pi(e){return function(t){var n=di(t.getFullYear()),i=ui(t),a=+i-+n,o=1+Math.round(a/6048e5);return ri(o,e)}}function mi(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}function hi(e){function t(e){var t;if(t=e.match(n)){var i=new Date(0),a=0,o=0,r=t[8]?i.setUTCFullYear:i.setFullYear,s=t[8]?i.setUTCHours:i.setHours;t[9]&&(a=p(t[9]+t[10]),o=p(t[9]+t[11])),r.call(i,p(t[1]),p(t[2])-1,p(t[3]));var c=p(t[4]||0)-a,l=p(t[5]||0)-o,d=p(t[6]||0),u=Math.round(1e3*parseFloat("0."+(t[7]||0)));return s.call(i,c,l,d,u),i}return e}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,i,a){var r,s,c="",l=[];if(i=i||"mediumDate",i=e.DATETIME_FORMATS[i]||i,b(n)&&(n=_o.test(n)?p(n):t(n)),w(n)&&(n=new Date(n)),!$(n))return n;for(;i;)s=go.exec(i),s?(l=B(l,s,1),i=l.pop()):(l.push(i),i=null);return a&&"UTC"===a&&(n=new Date(n.getTime()),n.setMinute
return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t=this.binaryFn(t,e.fn,this.unary());return t},unary:function(){var e;return this.expect("+")?this.primary():(e=this.expect("-"))?this.binaryFn(oo.ZERO,e.fn,this.unary()):(e=this.expect("!"))?this.unaryFn(e.fn,this.unary()):this.primary()},fieldAccess:function(e){var t=this.text,n=this.expect().text,i=Ln(n,this.options,t);return u(function(t,n,a){return i(a||e(t,n))},{assign:function(i,a,o){var r=e(i,o);return r||e.assign(i,r={}),In(r,n,a,t)}})},objectIndex:function(e){var t=this.text,i=this.expression();return this.consume("]"),u(function(a,o){var r,s=e(a,o),c=i(a,o);return Mn(c,t),s?r=An(s[c],t):n},{assign:function(n,a,o){var r=Mn(i(n,o),t),s=An(e(n,o),t);return s||e.assign(n,s={}),s[r]=a}})},functionCall:function(e,t){var n=[];if(")"!==this.peekToken().text)do n.push(this.expression());while(this.expect(","));this.consume(")");var i=this.text,a=n.length?[]:null;return function(o,r){var s=t?t(o,r):o,c=e(o,r,s)||h;if(a)for(var l=n.length;l--;)a[l]=An(n[l](o,r),i);An(s,i),Tn(c,i);var d=c.apply?c.apply(s,a):c(a[0],a[1],a[2],a[3],a[4]);return An(d,i)}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;var t=this.expression();e.push(t)}while(this.expect(","));return this.consume("]"),u(function(t,n){for(var i=[],a=0,o=e.length;o>a;a++)i.push(e[a](t,n));return i},{literal:!0,constant:e.every(En),inputs:e})},object:function(){var e=[],t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;var n=this.expect();e.push(n.string||n.text),this.consume(":");var i=this.expression();t.push(i)}while(this.expect(","));return this.consume("}"),u(function(n,i){for(var a={},o=0,r=t.length;r>o;o++)a[e[o]]=t[o](n,i);return a},{literal:!0,constant:t.every(En),inputs:t})}};var ro=ct(),so=ct(),co=Object.prototype.valueOf,lo=i("$sce"),uo={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Ra=i("$compile"),po=t.createElement("a"),mo=Jn(e.location.href,!0);ti.$inject=["$provide"],ii.$inject=["$locale"],ai.$inject=["$locale"];var ho=".",fo={yyyy:si("FullYear",4),yy:si("FullYear",2,0,!0),y:si("FullYear",1),MMMM:ci("Month"),MMM:ci("Month",!0),MM:si("Month",2,1),M:si("Month",1,1),dd:si("Date",2),d:si("Date",1),HH:si("Hours",2),H:si("Hours",1),hh:si("Hours",2,-12),h:si("Hours",1,-12),mm:si("Minutes",2),m:si("Minutes",1),ss:si("Seconds",2),s:si("Seconds",1),sss:si("Milliseconds",3),EEEE:ci("Day"),EEE:ci("Day",!0),a:mi,Z:li,ww:pi(2),w:pi(1)},go=/((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|w+))(.*)/,_o=/^\-?\d+$/;hi.$inject=["$locale"];var yo=g(Ri),vo=g(qi);_i.$inject=["$parse"];var bo=g({restrict:"E",compile:function(e,t){return t.href||t.xlinkHref||t.name?void 0:function(e,t){var n="[object SVGAnimatedString]"===Yi.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}),wo={};o(Ta,function(e,t){if("multiple"!=e){var n=Kt("ng-"+t);wo[n]=function(){return{restrict:"A",priority:100,link:function(e,i,a){e.$watch(a[n],function(e){a.$set(t,!!e)})}}}}}),o(Ia,function(e,t){wo[t]=function(){return{priority:100,link:function(e,n,i){if("ngPattern"===t&&"/"==i.ngPattern.charAt(0)){var a=i.ngPattern.match(Oi);if(a)return void i.$set("ngPattern",new RegExp(a[1],a[2]))}e.$watch(i[t],function(e){i.$set(t,e)})}}}}),o(["src","srcset","href"],function(e){var t=Kt("ng-"+e);wo[t]=function(){return{priority:99,link:function(n,i,a){var o=e,r=e;"href"===e&&"[object SVGAnimatedString]"===Yi.call(i.prop("href"))&&(r="xlinkHref",a.$attr[r]="xlink:href",o=null),a.$observe(t,function(t){return t?(a.$set(r,t),void(zi&&o&&i.prop(o,a[r]))):void("href"===e&&a.$set(r,null))})}}}});var $o={$addControl:h,$$renameControl:vi,$removeControl:h,$setValidity:h,$setDirty:h,$setPristine:h,$setSubmitted:h},ko="ng-submitted";bi.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var Co=function(e){return["$timeout",function(t){var i={name:"form",restrict:e?"EAC":"E",controller:bi,compile:function(e){return e.addClass(Ho).addClass(Fo),{pre:function(e,i,a,o)
});var o=[],r=[];return d(t&&t.classes||[],function(e,t){var n=a[t],s=i[t]||{};e===!1?(n||"addClass"==s.event)&&r.push(t):e===!0&&(n&&"removeClass"!=s.event||o.push(t))}),o.length+r.length>0&&[o.join(" "),r.join(" ")]}function T(e){if(e){var t=[],n={},a=e.substr(1).split(".");(f.transitions||f.animations)&&t.push(i.get(u[""]));for(var o=0;o<a.length;o++){var r=a[o],s=u[r];s&&!n[r]&&(t.push(i.get(s)),n[r]=!0)}return t}}function E(e,n,i,a){function o(e,t){var n=e[t],i=e["before"+t.charAt(0).toUpperCase()+t.substr(1)];return n||i?("leave"==t&&(i=n,n=null),$.push({event:t,fn:n}),v.push({event:t,fn:i}),!0):void 0}function r(t,n,o){function r(e){if(n){if((n[e]||l)(),++p<s.length)return;n=null}o()}var s=[];d(t,function(e){e.fn&&s.push(e)});var p=0;d(s,function(t,o){var s=function(){r(o)};switch(t.event){case"setClass":n.push(t.fn(e,c,u,s,a));break;case"animate":n.push(t.fn(e,i,a.from,a.to,s));break;case"addClass":n.push(t.fn(e,c||i,s,a));break;case"removeClass":n.push(t.fn(e,u||i,s,a));break;default:n.push(t.fn(e,s,a))}}),n&&0===n.length&&o()}var s=e[0];if(s){a&&(a.to=a.to||{},a.from=a.from||{});var c,u;p(i)&&(c=i[0],u=i[1],c?u?i=c+" "+u:(i=c,n="addClass"):(i=u,n="removeClass"));var m="setClass"==n,h=m||"addClass"==n||"removeClass"==n||"animate"==n,f=e.attr("class"),g=f+" "+i;if(B(g)){var _=l,y=[],v=[],b=l,w=[],$=[],k=(" "+g).replace(/\s+/g,".");return d(T(k),function(e){var t=o(e,n);!t&&m&&(o(e,"addClass"),o(e,"removeClass"))}),{node:s,event:n,className:i,isClassBased:h,isSetClassOperation:m,applyStyles:function(){a&&e.css(t.extend(a.from||{},a.to||{}))},before:function(e){_=e,r(v,y,function(){_=l,e()})},after:function(e){b=e,r($,w,function(){b=l,e()})},cancel:function(){y&&(d(y,function(e){(e||l)(!0)}),_(!0)),w&&(d(w,function(e){(e||l)(!0)}),b(!0))}}}}}function I(e,n,i,a,o,r,s,c){function u(t){var a="$animate:"+t;$&&$[a]&&$[a].length>0&&w(function(){i.triggerHandler(a,{event:e,className:n})})}function p(){u("before")}function m(){u("after")}function h(){u("close"),c()}function f(){f.hasBeenRun||(f.hasBeenRun=!0,r())}function _(){if(!_.hasBeenRun){b&&b.applyStyles(),_.hasBeenRun=!0,s&&s.tempClasses&&d(s.tempClasses,function(e){i.removeClass(e)});var t=i.data(g);t&&(b&&b.isClassBased?P(i,n):(w(function(){var t=i.data(g)||{};D==t.index&&P(i,n,e)}),i.data(g,t))),h()}}var v=l,b=E(i,e,n,s);if(!b)return f(),p(),m(),_(),v;e=b.event,n=b.className;var $=t.element._data(b.node);if($=$&&$.events,a||(a=o?o.parent():i.parent()),N(i,a))return f(),p(),m(),_(),v;var k=i.data(g)||{},C=k.active||{},S=k.totalActive||0,x=k.last,M=!1;if(S>0){var A=[];if(b.isClassBased){if("setClass"==x.event)A.push(x),P(i,n);else if(C[n]){var T=C[n];T.event==e?M=!0:(A.push(T),P(i,n))}}else if("leave"==e&&C["ng-leave"])M=!0;else{for(var I in C)A.push(C[I]);k={},P(i,!0)}A.length>0&&d(A,function(e){e.cancel()})}if(!b.isClassBased||b.isSetClassOperation||"animate"==e||M||(M="addClass"==e==i.hasClass(n)),M)return f(),p(),m(),h(),v;C=k.active||{},S=k.totalActive||0,"leave"==e&&i.one("$destroy",function(){var e=t.element(this),n=e.data(g);if(n){var i=n.active["ng-leave"];i&&(i.cancel(),P(e,"ng-leave"))}}),i.addClass(y),s&&s.tempClasses&&d(s.tempClasses,function(e){i.addClass(e)});var D=U++;return S++,C[n]=b,i.data(g,{last:b,active:C,index:D,totalActive:S}),p(),b.before(function(t){var a=i.data(g);t=t||!a||!a.active[n]||b.isClassBased&&a.active[n].event!=e,f(),t===!0?_():(m(),b.after(_))}),b.cancel}function D(e){var n=o(e);if(n){var i=t.isFunction(n.getElementsByClassName)?n.getElementsByClassName(y):n.querySelectorAll("."+y);d(i,function(e){e=t.element(e);var n=e.data(g);n&&n.active&&d(n.active,function(e){e.cancel()})})}}function P(e,t){if(c(e,b))v.disabled||(v.running=!1,v.structural=!1);else if(t){var n=e.data(g)||{},i=t===!0;!i&&n.active&&n.active[t]&&(n.totalActive--,delete n.active[t]),(i||!n.totalActive)&&(e.removeClass(y),e.removeData(g))}}function N(e,n){if(v.disabled)return!0;if(c(e,b))return v.running;var i,a,o;do{if(0===n.length)break;var r=c(n,b),s=r?v:n.data(g)||{};if(s.disabled)return!0;if(r&&(o=!0),i!==!1){var l=n.data(_);t.isDefined(l)&&(i=l)}a=a||s.run
}).directive("tooltip",["$tooltip",function(e){return e("tooltip","tooltip","mouseenter")}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).directive("tooltipHtmlUnsafe",["$tooltip",function(e){return e("tooltipHtmlUnsafe","tooltip","mouseenter")}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(e){e.put("template/modal/backdrop.html",'<div class="modal-backdrop fade" ng-class="{in: animate}" ng-style="{\'z-index\': 1040 + index*10 + 1}"></div>')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(e){e.put("template/modal/window.html",'<div tabindex="-1" class="modal fade {{ windowClass }}" ng-class="{in: animate}" ng-style="{\'z-index\': 1050 + index*10, display: \'block\'}" ng-click="close($event)">\n <div class="modal_prev_wrap hidden-xs hidden-sm" ng-show="nav.hasPrev" ng-click="nav.prev($event)">\n <div class="modal_prev"></div>\n </div>\n <div class="modal_close_wrap hidden-xs hidden-sm" ng-click="close($event)">\n <div class="modal_close"></div>\n </div>\n <div class="modal-dialog"><div class="modal-content" ng-transclude></div></div>\n</div>')}]),angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-html-unsafe-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" bind-html-unsafe="content"></div>\n</div>\n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(e){e.put("template/tooltip/tooltip-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind="content"></div>\n</div>\n')}]),angular.module("mediaPlayer",["mediaPlayer.helpers"]).constant("mp.playerDefaults",{currentTrack:0,ended:void 0,network:void 0,playing:!1,seeking:!1,tracks:0,volume:1,formatDuration:"00:00",formatTime:"00:00",loadPercent:0}).directive("mediaPlayer",["$rootScope","$interpolate","$timeout","mp.throttle","mp.playerDefaults",function(e,t,n,i,a){function o(e){return function(t,i){var a,o=null;if(e.$attachPlaylist(t),void 0===t&&void 0!==i)return e.pause();if(e.currentTrack){a=i?i[e.currentTrack-1]:-1;for(var r=0;r<t.length;r++)if(angular.equals(t[r],a)){o=r;break}null!==o?(e.currentTrack=o+1,e.tracks=t.length):(e.pause(),t.length?n(function(){e.$clearSourceList(),e.$addSourceList(t[0]),e.load(),e.tracks=t.length}):e.reset())}else t.length?(e.$clearSourceList(),e.$addSourceList(t[0]),e.load(),e.tracks=t.length):e.reset()}}var r={load:function(e,t){"boolean"==typeof e?(t=e,e=null):"object"==typeof e&&(this.$clearSourceList(),this.$addSourceList(e)),this.$domEl.load(),this.ended=void 0,t&&this.$element.one("canplay",this.play.bind(this))},reset:function(e){angular.extend(this,a),this.$clearSourceList(),this.load(this.$playlist,e)},play:function(e,t){return"boolean"==typeof e&&(t=e,e=void 0),t&&(this.$selective=!0),this.$playlist.length>e?(this.currentTrack=e+1,this.load(this.$playlist[e],!0)):(!this.currentTrack&&this.$domEl.readyState&&this.currentTrack++,void(this.ended?this.load(!0):this.$domEl.play()))},playPause:function(e,t){"boolean"==typeof e&&(t=e,e=void 0),t&&(this.$selective=!0),"number"==typeof e&&e+1!==this.currentTrack?this.play(e):this.playing?this.pause():this.play()},pause:function(){this.$domEl.pause()},stop:function(){this.reset()},toggleMute:function(){this.muted=this.$domEl.muted=!this.$domEl.muted},next:function(e){var t=this;if(t.currentTrack&&t.currentTrack<t.tracks){var i=e||t.playing;t.pause(),n(function(){t.$clearSourceList(),t.$addSourceList(t.$playlist[t.currentTrack]),t.load(i),t.currentTrack++})}},prev:function(e){var t=this;if(t.currentTrack&&t.currentTrack-1){var i=e||t.playing;t.pause(),n(function(){t.$clearSourceList(),t.$addSourceList(t.$playl
return i=l[o&(1<<u)-1],a=i>>>16,e.f=o>>a,e.d=r-a,e.c=c,65535&i}function c(e){function t(e,t,n){var i,a,o,c;for(c=0;e>c;)switch(i=s(this,t)){case 16:for(o=3+r(this,2);o--;)n[c++]=a;break;case 17:for(o=3+r(this,3);o--;)n[c++]=0;a=0;break;case 18:for(o=11+r(this,7);o--;)n[c++]=0;a=0;break;default:a=n[c++]=i}return n}var n,i,o,c,l=r(e,5)+257,d=r(e,5)+1,u=r(e,4)+4,m=new(p?Uint8Array:Array)(x.length);for(c=0;u>c;++c)m[x[c]]=r(e,3);n=a(m),i=new(p?Uint8Array:Array)(l),o=new(p?Uint8Array:Array)(d),e.l(a(t.call(e,l,n,i)),a(t.call(e,d,n,o)))}function l(e){this.input=e,this.c=0,this.m=[],this.s=!1}var d=void 0,u=this,p="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;new(p?Uint8Array:Array)(256);var m;for(m=0;256>m;++m)for(var h=m,f=7,h=h>>>1;h;h>>>=1)--f;var g=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],_=p?new Uint32Array(g):g;i.prototype.getName=function(){return this.name},i.prototype.getData=function(){return this.data},i.prototype.G=function(){return this.H},t("Zlib.GunzipMember",i),t("Zlib.GunzipMember.prototype.getName",i.prototype.getName),t("Zlib.GunzipMember.prototype.getData",i.prototype.getData),t("Zlib.GunzipMember.prototype.getMtime",i.prototype.G);var y,v=[];for(y=0;288>y;y++)switch(!0){case 143>=y:v.push([y+48,8]);break;case 255>=y:v.push([y-144+400,9]);break;case 279>=y:v.push([y-256+0,7]);break;case 287>=y:v.push([y-28
},db.setVersion&&db.version!=u?db.setVersion(u).onsuccess=function(){i(db),n.resolve(db)}:n.resolve(db)},t.onerror=function(e){p=!1,console.error("Error creating/accessing IndexedDB database",e),n.reject(e)},t.onupgradeneeded=function(e){i(e.target.result)},c=n.promise}function o(t,n){return a().then(function(i){try{var a=e.defer(),o=i.transaction([d],IDBTransaction.READ_WRITE||"readwrite").objectStore(d),r=o.put(n,t)}catch(s){return p=!1,e.reject(s)}return r.onsuccess=function(){a.resolve(n)},r.onerror=function(e){a.reject(e)},a.promise})}function r(t){return a().then(function(n){var i=e.defer(),a=n.transaction([d],IDBTransaction.READ||"readonly").objectStore(d),o=a.get(t);return o.onsuccess=function(e){void 0===e.target.result?i.reject():i.resolve(e.target.result)},o.onerror=function(e){i.reject(e)},i.promise})}function s(t,i){var a=n.getFakeFileWriter(i,function(e){o(t,e)});return e.when(a)}t.indexedDB=t.indexedDB||t.webkitIndexedDB||t.mozIndexedDB||t.OIndexedDB||t.msIndexedDB,t.IDBTransaction=t.IDBTransaction||t.webkitIDBTransaction||t.OIDBTransaction||t.msIDBTransaction;var c,l="cachedFiles",d="files",u=1,p=void 0!==t.indexedDB&&void 0!==t.IDBTransaction;return a(),{isAvailable:i,saveFile:o,getFile:r,getFileWriter:s}}]).service("TmpfsFileStorage",["$q","$window","FileManager",function(e,t,n){function i(){if(c)return c;if(!t.requestFileSystem)return c=e.reject({type:"FS_BROWSER_UNSUPPORTED",description:"requestFileSystem not present"});var n=e.defer();return t.requestFileSystem(t.TEMPORARY,524288e3,function(e){cachedFs=e,n.resolve()},function(e){l=!1,n.reject(e)}),c=n.promise}function a(){return l}function o(t,n){return n=n||1,i().then(function(){var i=e.defer();return cachedFs.root.getFile(t,{create:!1},function(e){e.file(function(t){t.size>=n?i.resolve(e):i.reject(new Error("FILE_NOT_FOUND"))},function(e){console.log(dT(),"error",e),i.reject(e)})},function(){i.reject(new Error("FILE_NOT_FOUND"))}),i.promise})}function r(e,t){return s(e).then(function(e){return n.write(e,t).then(function(){return e.finalize()})})}function s(t){return i().then(function(){var i=e.defer();return cachedFs.root.getFile(t,{create:!0},function(e){n.getFileWriter(e).then(function(t){t.finalize=function(){return e},i.resolve(t)},function(e){l=!1,i.reject(e)})},function(e){l=!1,i.reject(e)}),i.promise})}t.requestFileSystem=t.requestFileSystem||t.webkitRequestFileSystem;var c,l=void 0!==t.requestFileSystem;return i(),{isAvailable:a,saveFile:r,getFile:o,getFileWriter:s}}]).service("MemoryFileStorage",["$q","FileManager",function(e,t){function n(){return!0}function i(t){return r[t]?e.when(r[t]):e.reject(new Error("FILE_NOT_FOUND"))}function a(t,n){return e.when(r[t]=n)}function o(n,i){var o=t.getFakeFileWriter(i,function(e){a(n,e)});return e.when(o)}var r={};return{isAvailable:n,saveFile:a,getFile:i,getFileWriter:o}}]).service("CryptoWorker",["$timeout","$q",function(e,t){function n(e,n,a){var s=t.defer();return r[o]=s,n.task=e,n.taskID=o,(a||i).postMessage(n),o++,s.promise}var i=!1,a=!1,o=0,r={},s=window.crypto&&(window.crypto.subtle||window.crypto.webkitSubtle)||window.msCrypto&&window.msCrypto.subtle,c=s&&void 0!==s.digest,l=function(e,t){var n=r[e];void 0!==n&&(n.resolve(t),delete r[e])};if(void 0!==navigator.mimeTypes["application/x-pnacl"]){var d=$('<div id="nacl_listener"><embed id="mtproto_crypto" width="0" height="0" src="nacl/mtproto_crypto.nmf" type="application/x-pnacl" /></div>').appendTo($("body"))[0];d.addEventListener("load",function(){a=d.firstChild,console.log(dT(),"NaCl ready")},!0),d.addEventListener("message",function(e){l(e.data.taskID,e.data.result)},!0),d.addEventListener("error",function(e){console.error("NaCl error",e)},!0)}if(window.Worker){var u=new Worker("js/lib/crypto_worker.js");u.onmessage=function(e){i?l(e.data.taskID,e.data.result):i=u},u.onerror=function(e){console.error("CW error",e,e.stack),i=!1}}return{sha1Hash:function(n){if(c){var i=t.defer(),a=Array.isArray(n)?convertToUint8Array(n):n;return s.digest({name:"SHA-1"},a).then(function(e){i.resolve(e)},function(e){console.error("Crypto digest error",e),c=!1
break;case"new_session_created":this.ackMessage(n),this.processMessageAck(e.first_msg_id),this.applyServerSalt(e.server_salt);var l=this;i.get("dc").then(function(t){t==l.dcID&&!l.upload&&h&&h(e)});break;case"msgs_ack":for(var r=0;r<e.msg_ids.length;r++)this.processMessageAck(e.msg_ids[r]);break;case"msg_detailed_info":if(!this.sentMessages[e.msg_id]){this.ackMessage(e.answer_msg_id);break}case"msg_new_detailed_info":this.reqResendMessage(e.answer_msg_id);break;case"msgs_state_info":if(this.ackMessage(e.answer_msg_id),this.lastResendReq&&this.lastResendReq.req_msg_id==e.req_msg_id&&this.pendingResends.length){var r,d,u;for(r=0;r<this.lastResendReq.resend_msg_ids.length;r++)d=this.lastResendReq.resend_msg_ids[r],u=this.pendingResends.indexOf(d),-1!=u&&this.pendingResends.splice(u,1)}break;case"rpc_result":this.ackMessage(n);var p=e.req_msg_id,s=this.sentMessages[p];if(this.processMessageAck(p),s){var m=s.deferred;if("rpc_error"==e.result._){var f=this.processError(e.result);console.log(dT(),"Rpc error",f),m&&m.reject(f)}else{if(m){if(Config.Modes.debug)console.log(dT(),"Rpc response",e.result);else{var g=e.result._;g||(g=e.result.length>5?"[.."+e.result.length+"..]":e.result),console.log(dT(),"Rpc response",g)}s.deferred.resolve(e.result)}s.isAPI&&(this.connectionInited=!0)}delete this.sentMessages[p]}break;default:this.ackMessage(n),h&&h(e)}},{getNetworker:function(e,t,n,i){return new u(e,t,n,i)},setUpdatesProcessor:function(e){h=e},stopAll:m,startAll:p}}]),angular.module("izhukov.mtproto.wrapper",["izhukov.utils","izhukov.mtproto"]).factory("MtpApiManager",["Storage","MtpAuthorizer","MtpNetworkerFactory","MtpSingleInstanceService","ErrorService","$q",function(e,t,n,i,a,o){function r(t,n){e.set({dc:t,user_auth:angular.extend({dcID:t},n)}),f=t}function s(){return l("auth.logOut").then(function(){e.remove("dc","user_auth"),f=!1},function(t){e.remove("dc","user_auth"),t&&401!=t.code&&e.remove("dc"+f+"_auth_key"),f=!1,t.handled=!0})}function c(i,a){a=a||{};var r=a.fileUpload||a.fileDownload?m:p;if(!i)throw new Exception("get Networker without dcID");if(void 0!==r[i])return{then:function(e){e(r[i])}};var s="dc"+i+"_auth_key",c="dc"+i+"_server_salt";return e.get(s,c).then(function(l){if(void 0!==r[i])return r[i];var d=l[0],u=l[1];if(d&&512==d.length){var p=bytesFromHex(d),m=bytesFromHex(u);return r[i]=n.getNetworker(i,p,m,a)}return a.createNetworker?t.auth(i).then(function(t){var o={};return o[s]=bytesToHex(t.authKey),o[c]=bytesToHex(t.serverSalt),e.set(o),r[i]=n.getNetworker(i,t.authKey,t.serverSalt,a)},function(e){return console.log("Get networker error",e,e.stack),o.reject(e)}):o.reject({type:"AUTH_KEY_EMPTY",code:401})})}function l(t,n,i){i=i||{};var r,s,d=o.defer(),u=function(e){e?angular.isObject(e)||(e={message:e}):e={type:"ERROR_EMPTY"},d.reject(e),i.noErrorBox||(e.input=t,e.stack=e.originalError&&e.originalError.stack||e.stack||(new Error).stack,setTimeout(function(){e.handled||(a.show({error:e}),e.handled=!0)},100))},p=(new Error).stack;if(!p)try{window.unexistingFunction()}catch(m){p=m.stack||""}var g=function(a){return(s=a).wrapApiCall(t,n,i).then(function(e){d.resolve(e)},function(p){if(console.error(dT(),"Error",p.code,p.type,f,r),401==p.code&&f==r)e.remove("dc","user_auth"),u(p);else if(401==p.code&&f&&r!=f){if(void 0===h[r]){var m=o.defer();l("auth.exportAuthorization",{dc_id:r},{noErrorBox:!0}).then(function(e){l("auth.importAuthorization",{id:e.id,bytes:e.bytes},{dcID:r,noErrorBox:!0}).then(function(){m.resolve()},function(e){m.reject(e)})},function(e){m.reject(e)}),h[r]=m.promise}h[r].then(function(){(s=a).wrapApiCall(t,n,i).then(function(e){d.resolve(e)},u)},u)}else if(303==p.code){var g=p.type.match(/^(PHONE_MIGRATE_|NETWORK_MIGRATE_|USER_MIGRATE_)(\d+)/)[2];g!=r&&(i.dcID?i.dcID=g:e.set({dc:f=g}),c(g,i).then(function(e){e.wrapApiCall(t,n,i).then(function(e){d.resolve(e)},u)}))}else u(p)})};return(r=i.dcID||f)?c(r,i).then(g,u):e.get("dc").then(function(e){c(r=e||2,i).then(g,u)}),d.promise}function d(){return e.get("user_auth").then(function(e){return e.id||0})}function u(){return f||!1}var p={},m={},h={},f
var t=angular.copy(z[e])||{id:e};if(t.media&&void 0!==t.media.progress&&(t.media.progress=z[e].media.progress),t.media)switch(t.media._){case"messageMediaPhoto":t.media.photo=c.wrapForHistory(t.media.photo.id);break;case"messageMediaVideo":t.media.video=l.wrapForHistory(t.media.video.id);break;case"messageMediaDocument":t.media.document=d.wrapForHistory(t.media.document.id);break;case"messageMediaAudio":t.media.audio=u.wrapForHistory(t.media.audio.id);break;case"messageMediaContact":t.media.rFullName=h.wrapRichText(t.media.first_name+" "+(t.media.last_name||""),{noLinks:!0,noLinebreaks:!0});break;case"messageMediaEmpty":delete t.media}else if(t.action)switch(t.action._){case"messageActionChatEditPhoto":t.action.photo=c.wrapForHistory(t.action.photo.id);break;case"messageActionChatCreate":case"messageActionChatEditTitle":t.action.rTitle=h.wrapRichText(t.action.title,{noLinks:!0,noLinebreaks:!0})||v("chat_title_deleted")}return t.message&&t.message.length&&(t.richMessage=h.wrapRichText(t.message),Config.Navigator.mobile||(t.richUrlEmbed=h.extractExternalEmbed(t.message))),V[e]=t}function F(e,t){if(!e||!e.length)return!1;var n,i,a,o,r,s,c,l=0,d=e.length,u=d,p=!1,m=!Config.Mobile;for(t>0?u=Math.min(t,d):0>t&&(l=Math.max(0,u+t)),n=l;u>n;n++){if(o=e[n],i=Math.floor((o.date+j)/86400),c=r&&r.grouped,s=o.grouped,i===a?o.needDate&&(delete o.needDate,p=!0):(!n||r)&&(o.needDate||(o.needDate=!0,p=!0)),r&&o.from_id==r.from_id&&!r.fwd_from_id==!o.fwd_from_id&&!r.action&&!o.action&&o.date<r.date+900){var h=o.message&&o.message.length<70&&-1==o.message.indexOf("\n");o.grouped=m&&o.fwd_from_id&&o.fwd_from_id==r.fwd_from_id?h?"im_grouped_fwd_short":"im_grouped_fwd":!o.fwd_from_id&&h?"im_grouped_short":"im_grouped",m&&o.fwd_from_id&&(r.grouped||(r.grouped="im_grouped_fwd_start"),o.grouped&&n==d-1&&(o.grouped+=" im_grouped_fwd_end"))}else(r||!n)&&(delete o.grouped,m&&r&&r.grouped&&r.fwd_from_id&&(r.grouped+=" im_grouped_fwd_end"));p||c==(r&&r.grouped)||(p=!0),r=o,a=i}return p||s==(r&&r.grouped)||(p=!0),p}function q(e){for(var t=0;t<K.dialogs.length;t++)if(K.dialogs[t].peerID==e)return[K.dialogs[t],t];return[]}function H(e){var n,i,a=O(e),s=o.getUser(e.from_id),c=o.getUserPhoto(e.from_id,"User"),l={},d=!1;if(e.message)d=h.wrapPlainText(e.message);else if(e.media&&"messageMediaEmpty"!=e.media._)switch(e.media._){case"messageMediaPhoto":d=v("conversation_media_photo_raw");break;case"messageMediaVideo":d=v("conversation_media_video_raw");break;case"messageMediaDocument":d=e.media.document.file_name||v("conversation_media_document_raw");break;case"messageMediaAudio":d=v("conversation_media_audio_raw");break;case"messageMediaGeo":d=v("conversation_media_location_raw");break;case"messageMediaContact":d=v("conversation_media_contact_raw");break;default:d=v("conversation_media_attachment_raw")}else if("messageService"==e._)switch(e.action._){case"messageActionChatCreate":d=v("conversation_group_created_raw");break;case"messageActionChatEditTitle":d=v("conversation_group_renamed_raw");break;case"messageActionChatEditPhoto":d=v("conversation_group_photo_updated_raw");break;case"messageActionChatDeletePhoto":d=v("conversation_group_photo_removed_raw");break;case"messageActionChatAddUser":d=v(e.action.user_id==e.from_id?"conversation_returned_to_group":"conversation_invited_user_message_raw");break;case"messageActionChatDeleteUser":d=v(e.action.user_id==e.from_id?"conversation_left_group":"conversation_kicked_user_message_raw")}a>0?(l.title=(s.first_name||"")+(s.first_name&&s.last_name?" ":"")+(s.last_name||""),i=c,n=o.getUserString(a)):(l.title=(s.first_name||s.last_name||v("conversation_unknown_user_raw"))+" @ "+(r.getChat(-a).title||v("conversation_unknown_chat_raw")),i=r.getChatPhoto(-a,"Group"),n=r.getChatString(-a)),l.title=h.wrapPlainText(l.title),l.onclick=function(){t.$broadcast("history_focus",{peerString:n})},l.message=d,l.image=i.placeholder,l.key="msg"+e.id,l.tag=n,i.location&&!i.location.empty?m.downloadSmallFile(i.location,i.size).then(function(t){l.image=t,e.unread&&f.notify(l)}):f.notify(l)}var j,z={},V={},W={},G={},K={count:null,dialog
}function g(e){r.setUserAuth(y.dcID,{expires:e.expires,id:e.user.id}),i.cancel(b),n.url("/im")}function _(){i.cancel(b),e.credentials.viaApp||(--e.callPending.remaining?b=i(_,1e3):(e.callPending.success=!1,r.invokeApi("auth.sendCall",{phone_number:e.credentials.phone_full,phone_code_hash:e.credentials.phone_code_hash},y).then(function(){e.callPending.success=!0})))}o.dismissAll(),d.start(),r.getUserID().then(function(e){return e?void n.url("/im"):void 0});var y={dcID:2,createNetworker:!0},v=!1;e.credentials={phone_country:"",phone_country_name:"",phone_number:"",phone_full:""},e.progress={},e.callPending={},e.chooseCountry=function(){var e=a.open({templateUrl:templateUrl("country_select_modal"),controller:"CountrySelectModalController",windowClass:"countries_modal_window mobile_modal"});e.result.then(h)},e.$watch("credentials.phone_country",f),e.$watch("credentials.phone_number",f),p();var b;e.sendCode=function(){i.cancel(b),s.confirm({type:"LOGIN_PHONE_CORRECT",country_code:e.credentials.phone_country,phone_number:e.credentials.phone_number}).then(function(){e.progress.enabled=!0,onContentLoaded(function(){e.$broadcast("ui_height")});var n=tsNow();r.invokeApi("auth.sendCode",{phone_number:e.credentials.phone_full,sms_type:5,api_id:Config.App.id,api_hash:Config.App.hash},y).then(function(t){e.progress.enabled=!1,e.credentials.phone_code_hash=t.phone_code_hash,e.credentials.phone_occupied=t.phone_registered,e.credentials.viaApp="auth.sentAppCode"==t._,e.callPending.remaining=t.send_call_timeout||60,e.error={},_(),onContentLoaded(function(){e.$broadcast("ui_height")})},function(t){switch(e.progress.enabled=!1,console.log("sendCode error",t),t.type){case"NETWORK_BAD_REQUEST":"https:"==location.protocol&&(s.confirm({type:"HTTPS_MIXED_FAIL"}).then(function(){location=location.toString().replace(/^https:/,"http:")}),t.handled=!0);break;case"PHONE_NUMBER_INVALID":e.error={field:"phone"},t.handled=!0}})["finally"](function(){(t.idle.isIDLE||tsNow()-n>6e4)&&c.notify({title:"Telegram",message:"Your authorization key was successfully generated! Open the app to log in.",tag:"auth_key"})})})},e.sendSms=function(){e.credentials.viaApp&&(delete e.credentials.viaApp,r.invokeApi("auth.sendSms",{phone_number:e.credentials.phone_full,phone_code_hash:e.credentials.phone_code_hash},y).then(_))},e.editPhone=function(){i.cancel(b),delete e.credentials.phone_code_hash,delete e.credentials.phone_unoccupied,delete e.credentials.phone_code_valid,delete e.credentials.viaApp,delete e.callPending.remaining,delete e.callPending.success},e.logIn=function(t){var n="auth.signIn",i={phone_number:e.credentials.phone_full,phone_code_hash:e.credentials.phone_code_hash,phone_code:e.credentials.phone_code};t&&(n="auth.signUp",angular.extend(i,{first_name:e.credentials.first_name,last_name:e.credentials.last_name})),e.progress.enabled=!0,r.invokeApi(n,i,y).then(g,function(t){if(e.progress.enabled=!1,400==t.code&&"PHONE_NUMBER_UNOCCUPIED"==t.type)return t.handled=!0,e.credentials.phone_code_valid=!0,void(e.credentials.phone_unoccupied=!0);if(400==t.code&&"PHONE_NUMBER_OCCUPIED"==t.type)return t.handled=!0,e.logIn(!1);switch(t.type){case"FIRSTNAME_INVALID":e.error={field:"first_name"},t.handled=!0;break;case"LASTNAME_INVALID":e.error={field:"last_name"},t.handled=!0;break;case"PHONE_CODE_INVALID":e.error={field:"phone_code"},delete e.credentials.phone_code_valid,t.handled=!0}})},l.checkUpdate()}]).controller("AppIMController",["$scope","$location","$routeParams","$modal","$rootScope","$modalStack","MtpApiManager","AppUsersManager","AppChatsManager","ContactsSelectService","ChangelogNotifyService","ErrorService","AppRuntimeManager",function(e,t,n,i,a,o,r,s,c,l,d,u,p){function m(){if(n.q){if(n.q!==h&&(e.search.query=h=n.q,e.search.messages=!0,void 0!==e.curDialog))return!1}else h=!1;e.curDialog={peer:n.p||!1,messageID:n.m||!1}}e.$on("$routeUpdate",m),e.$on("history_focus",function(n,i){o.dismissAll(),i.peerString==e.curDialog.peer&&i.messageID==e.curDialog.messageID?e.$broadcast(i.messageID?"ui_history_change_scroll":"ui_history_focus"):t.url("/im?p="+i.peerString
},t.changeUsername=function(){i.open({templateUrl:templateUrl("username_edit_modal"),controller:"UsernameEditModalController",windowClass:"username_edit_modal_window mobile_modal"})},t.terminateSessions=function(){m.confirm({type:"TERMINATE_SESSIONS"}).then(function(){s.invokeApi("auth.resetAuthorizations",{})})},c.get("notify_nodesktop","notify_nosound","send_ctrlenter","notify_volume","notify_novibrate").then(function(i){t.notify.desktop=!i[0],t.send.enter=i[2]?"":"1",t.notify.volume=i[1]?0:i[3]!==!1?i[3]>0&&i[3]<=1?i[3]:0:.5,t.notify.canVibrate=l.getVibrateSupport(),t.notify.vibrate=!i[4],t.notify.volumeOf4=function(){return 1+Math.ceil((t.notify.volume-.1)/.33)},t.toggleSound=function(){t.notify.volume=t.notify.volume?0:.5};var a;t.$watch("notify.volume",function(e,t){e!==t&&(c.set({notify_volume:e}),c.remove("notify_nosound"),l.clear(),a&&n.cancel(a),a=n(function(){l.testSound(e)},500))}),t.toggleDesktop=function(){t.notify.desktop=!t.notify.desktop,t.notify.desktop?c.remove("notify_nodesktop"):c.set({notify_nodesktop:!0})},t.toggleVibrate=function(){t.notify.vibrate=!t.notify.vibrate,t.notify.vibrate?c.remove("notify_novibrate"):c.set({notify_novibrate:!0})},t.toggleCtrlEnter=function(n){t.send.enter=n,t.send.enter?c.remove("send_ctrlenter"):c.set({send_ctrlenter:!0}),e.$broadcast("settings_changed")}}),t.openChangelog=function(){p.showChangelog(!1)}}]).controller("ChangelogModalController",["$scope","$modal",function(e,t){e.changeUsername=function(){t.open({templateUrl:templateUrl("username_edit_modal"),controller:"UsernameEditModalController",windowClass:"username_edit_modal_window mobile_modal"})}}]).controller("ProfileEditModalController",["$scope","$modalInstance","AppUsersManager","MtpApiManager",function(e,t,n,i){e.profile={},e.error={},i.getUserID().then(function(t){e.profile=n.getUser(t)}),e.updateProfile=function(){e.profile.updating=!0,i.invokeApi("account.updateProfile",{first_name:e.profile.first_name||"",last_name:e.profile.last_name||""}).then(function(i){e.error={},n.saveApiUser(i),t.close()},function(n){switch(n.type){case"FIRSTNAME_INVALID":e.error={field:"first_name"},n.handled=!0;break;case"LASTNAME_INVALID":e.error={field:"last_name"},n.handled=!0;break;case"NAME_NOT_MODIFIED":n.handled=!0,t.close()}})["finally"](function(){delete e.profile.updating})}}]).controller("UsernameEditModalController",["$scope","$modalInstance","AppUsersManager","MtpApiManager",function(e,t,n,i){e.profile={},e.error={},i.getUserID().then(function(t){e.profile=angular.copy(n.getUser(t))}),e.updateUsername=function(){e.profile.updating=!0,i.invokeApi("account.updateUsername",{username:e.profile.username||""}).then(function(i){e.checked={},n.saveApiUser(i),t.close()},function(e){"USERNAME_NOT_MODIFIED"==e.type&&(e.handled=!0,t.close())})["finally"](function(){delete e.profile.updating})},e.$watch("profile.username",function(t){return t.length?void i.invokeApi("account.checkUsername",{username:t||""}).then(function(n){e.profile.username==t&&(e.checked=n?{success:!0}:{error:!0})},function(n){if(e.profile.username==t)switch(n.type){case"USERNAME_INVALID":e.checked={error:!0},n.handled=!0}}):void(e.checked={})})}]).controller("ContactsModalController",["$scope","$modal","$modalInstance","AppUsersManager","ErrorService",function(e,t,n,i){function a(){e.selectedContacts={},e.selectedCount=0}function o(t){i.getContacts(t).then(function(n){e.contacts=[],e.slice.limit=20,angular.forEach(n,function(t){var n={userID:t,user:i.getUser(t),userPhoto:i.getUserPhoto(t,"User")};e.contacts.push(n)}),e.contactsEmpty=t?!1:!e.contacts.length,e.$broadcast("contacts_change")})}if(e.contacts=[],e.search={},e.slice={limit:20,limitDelta:20},a(),e.disabledContacts={},e.disabled)for(var r=0;r<e.disabled.length;r++)e.disabledContacts[e.disabled[r]]=!0;if(e.selected)for(var r=0;r<e.selected.length;r++)e.selectedContacts[e.selected[r]]||(e.selectedContacts[e.selected[r]]=!0,e.selectedCount++);e.$watch("search.query",o),e.$on("contacts_update",function(){o(e.search&&e.search.query||"")}),e.toggleEdit=function(t){e.action=t?"edit":"",e.multiSelect=t,a(
}]),angular.module("myApp.directives",["myApp.filters"]).directive("myHead",function(){return{restrict:"AE",templateUrl:templateUrl("head")}}).directive("myLangFooter",function(){return{restrict:"AE",templateUrl:templateUrl("lang_footer")}}).directive("myDialog",function(){return{restrict:"AE",templateUrl:templateUrl("dialog")}}).directive("myMessage",["$filter","_",function(e,t){function n(e,t){var n,u,p=!1,m=!1,h=!1,f=!1,g=!1,_=!1,y=!1,v=function(){p!=(e.selectedMsgs[e.historyMessage.id]||!1)&&(p=!p,t.toggleClass(r,p))},b=function(){m!=e.historyMessage.grouped&&(m&&t.removeClass(m),m=e.historyMessage.grouped,m&&t.addClass(m)),_!=(e.historyMessage.needDate||!1)&&(_=!_,_?n?n.show():(n=$(a),$(n[0].firstChild).text(i(e.historyMessage.date)),u?n.insertBefore(u):n.prependTo(t)):n.hide())};v(),b(),e.$on("messages_select",v),e.$on("messages_regroup",b),e.$on("messages_focus",function(n,i){i==e.historyMessage.id!=h&&(h=!h,t.toggleClass(s,h))});var w;if(!e.historyMessage.out&&(e.historyMessage.unread||e.historyMessage.unreadAfter)){var k=function(){e.peerHistory.peerID==e.historyPeer.id&&y!=(e.historyUnreadAfter==e.historyMessage.id)&&(y=!y,y?u?u.show():u=$(o).prependTo(t):(u.hide(),w&&w()))};k(),w=e.$on("messages_unread_after",k)}if(e.historyMessage.unread){t.addClass(c);var C=e.$on("messages_read",function(){e.historyMessage.unread||(t.removeClass(c),C(),w&&!y&&w())})}if(e.historyMessage.error||e.historyMessage.pending){var S=function(){g!=(e.historyMessage.pending||!1)&&(g=!g,t.toggleClass(d,g)),f!=(e.historyMessage.error||!1)&&(f=!f,t.toggleClass(l,f)),f||g||x()},x=e.$on("messages_pending",S);S()}}var i=e("myDate"),a='<div class="im_message_date_split im_service_message_wrap"><div class="im_service_message"></div></div>',o='<div class="im_message_unread_split">'+t("unread_messages_split")+"</div>",r="im_message_selected",s="im_message_focus",c="im_message_unread",l="im_message_error",d="im_message_pending";return{templateUrl:templateUrl("message"),link:n}}]).directive("myExternalEmbed",function(){function e(e,a,o){var r=e.$eval(o.myExternalEmbed);if(r){var s="",c=!1;switch(r[0]){case"youtube":var l=r[1];s='<div class="im_message_media_embed im_message_video_embed"><'+i+' type="text/html" frameborder="0" src="//www.youtube.com/embed/'+l+'?autoplay=0&amp;controls=2"></'+i+"></div>";break;case"instagram":var d=r[1];s='<div class="im_message_media_embed im_message_insta_embed"><'+i+' type="text/html" frameborder="0" src="//instagram.com/p/'+d+'/embed/"></'+i+"></div>";break;case"vine":var u=r[1];s='<div class="im_message_media_embed im_message_vine_embed"><'+i+' type="text/html" frameborder="0" src="//vine.co/v/'+u+'/embed/simple"></'+i+"></div>";break;case"twitter":s='<div class="im_message_twitter_embed"><blockquote class="twitter-tweet" lang="en"><a href="'+r[1]+'"></a></blockquote></div>',c=function(){t?window.twttr&&twttr.widgets.load(a[0]):(t=!0,$("<script>").appendTo("body").on("load",function(){twttr.events.bind("loaded",function(){for(var e=0;e<n.length;e++)n[e].$emit("ui_height");n=[]})}).attr("src","//platform.twitter.com/widgets.js")),n.push(e)}}s&&(a[0].innerHTML=s,c&&c())}}var t=!1,n=[],i=Config.Modes.chrome_packed?"webview":"iframe";return{link:e}}).directive("myServiceMessage",function(){return{templateUrl:templateUrl("message_service")}}).directive("myMessagePhoto",function(){return{templateUrl:templateUrl("message_attach_photo")}}).directive("myMessageVideo",["AppVideoManager",function(e){return{scope:{video:"=myMessageVideo",messageId:"=messageId"},templateUrl:templateUrl("message_attach_video"),link:function(t){e.updateVideoDownloaded(t.video.id),t.videoSave=function(){e.saveVideoFile(t.video.id)},t.videoOpen=function(){e.openVideo(t.video.id,t.messageId)}}}}]).directive("myMessageDocument",["AppDocsManager",function(e){return{scope:{document:"=myMessageDocument",messageId:"=messageId"},templateUrl:templateUrl("message_attach_document"),link:function(t){e.updateDocDownloaded(t.document.id),t.docSave=function(){e.saveDocFile(t.document.id)},t.docOpen=function(){return t.document.withPreview?void e.openDoc(t.d
var n=$(e).height()-d.offsetHeight-(p?p.offsetHeight:46);$(s).css({height:n}),r(),t!==!0&&g&&onContentLoaded(function(){c.scrollTop=c.scrollHeight})}}function r(){return}var s=$(".im_history_wrap",i)[0],c=($(".im_history_messages",i)[0],$(".im_history_scrollable_wrap",i)[0]),l=$(".im_history_scrollable",i)[0],d=$(".im_bottom_panel_wrap",i)[0],u=$(".im_send_form_wrap",i)[0],p=$(".tg_page_head")[0],m=$(".im_send_form",i)[0],h=!1,f=!1;onContentLoaded(function(){c.scrollTop=c.scrollHeight}),n.$on("ui_history_append_new",function(e,t){if(g||t.my){var n=parseInt($(c).css("paddingRight"));$(c).addClass("im_history_to_bottom"),$(l).css({bottom:0,marginLeft:-Math.ceil(n/2)}),onContentLoaded(function(){$(c).removeClass("im_history_to_bottom"),$(l).css({bottom:"",marginLeft:""}),c.scrollTop=c.scrollHeight,r()})}}),n.$on("ui_history_change",function(){var e=parseInt($(c).css("paddingRight"));$(c).addClass("im_history_to_bottom"),$(l).css({bottom:0,marginLeft:-Math.ceil(e/2)}),onContentLoaded(function(){$(c).removeClass("im_history_to_bottom"),$(l).css({bottom:"",marginLeft:""}),o(!0),h=!1,f=!1,a()})}),n.$on("ui_history_change_scroll",function(){onContentLoaded(a)}),n.$on("ui_history_focus",function(){g||(c.scrollTop=c.scrollHeight,g=!0)}),n.$on("ui_history_prepend",function(){var e=c.scrollHeight,i=c.scrollTop,o=parseInt($(c).css("paddingRight")),s=c.clientHeight;$(c).addClass("im_history_to_bottom"),c.scrollHeight,$(l).css({bottom:-(e-i-s),marginLeft:-Math.ceil(o/2)});var d=function(){$(c).removeClass("im_history_to_bottom"),$(l).css({bottom:"",marginLeft:""}),_>=0?a():c.scrollTop=i+c.scrollHeight-e,r(),h=!1,t(function(){c.scrollHeight!=e&&$(c).trigger("scroll")}),clearTimeout(u),p()},u=setTimeout(d,0),p=n.$on("$viewContentLoaded",d)}),n.$on("ui_history_append",function(){var e=c.scrollHeight;onContentLoaded(function(){g=!1,r(),f=!1,_>=0&&a(),t(function(){c.scrollHeight!=e&&$(c).trigger("scroll")})})}),n.$on("ui_panel_update",function(){onContentLoaded(function(){o(),n.$broadcast("ui_message_send"),t(function(){$(c).trigger("scroll")})})}),n.$on("ui_selection_clear",function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty()}),n.$on("ui_editor_resize",o),n.$on("ui_height",function(){onContentLoaded(o)});var g=!0,_=-1;$(c).on("scroll",function(){if(i.is(":visible")&&!$(c).hasClass("im_history_to_bottom")){var e=c.scrollTop;g=e>=c.scrollHeight-c.clientHeight,_>=0&&_!=e&&(_=-1),!h&&300>=e?(h=!0,n.$emit("history_need_more")):!f&&e>=c.scrollHeight-c.clientHeight-300&&(f=!0,n.$emit("history_need_less"))}}),$(e).on("resize",o),o(),onContentLoaded(o)}return{link:n}}]).directive("myContactsListMobile",["$window","$timeout",function(e){function t(t,n){function i(){$(n).css({height:$(e).height()-(o&&o.offsetHeight||0)-(a&&a.offsetHeight||0)-64})}var a=$(".contacts_modal_search")[0],o=$(".contacts_modal_panel")[0];$(e).on("resize",i),t.$on("contacts_change",function(){onContentLoaded(i)}),onContentLoaded(i)}return{link:t}}]).directive("myCountriesListMobile",["$window","$timeout",function(e){function t(t,n){function i(){$(n).css({height:$(e).height()-(o&&o.offsetHeight||0)-(a&&a.offsetHeight||0)-64})}var a=$(".countries_modal_search")[0],o=$(".countries_modal_panel")[0];$(e).on("resize",i),onContentLoaded(i)}return{link:t}}]).directive("myInfiniteScrollerMobile",function(){function e(e,t){var n=t[0],i=!1;$(n).on("scroll",function(){t.is(":visible")&&!i&&n.scrollTop>=n.scrollHeight-n.clientHeight-300&&(i=!0,e.$apply(function(){e.slice.limit+=e.slice.limitDelta||20}),onContentLoaded(function(){i=!1}))})}return{link:e,scope:!0}});