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

16 lines
672 KiB

function BigInteger(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function nbi(){return new BigInteger(null)}function am1(e,t,n,i,r,o){for(;--o>=0;){var a=t*this[e++]+n[i]+r;r=Math.floor(a/67108864),n[i++]=67108863&a}return r}function am2(e,t,n,i,r,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this[e],l=this[e++]>>15,u=s*c+l*a;c=a*c+((32767&u)<<15)+n[i]+(1073741823&r),r=(c>>>30)+(u>>>15)+s*l+(r>>>30),n[i++]=1073741823&c}return r}function am3(e,t,n,i,r,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,u=s*c+l*a;c=a*c+((16383&u)<<14)+n[i]+r,r=(c>>28)+(u>>14)+s*l,n[i++]=268435455&c}return r}function int2char(e){return BI_RM.charAt(e)}function intAt(e,t){var n=BI_RC[e.charCodeAt(t)];return null==n?-1:n}function bnpCopyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function bnpFromInt(e){this.t=1,this.s=0>e?-1:0,e>0?this[0]=e:-1>e?this[0]=e+this.DV:this.t=0}function nbv(e){var t=nbi();return t.fromInt(e),t}function bnpFromString(e,t,n){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var r=e.length,o=!1,a=0;--r>=0;){var s=8==i?255&e[r]:intAt(e,r);0>s?"-"==e.charAt(r)&&(o=!0):(o=!1,0==a?this[this.t++]=s:a+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,a+=i,a>=this.DB&&(a-=this.DB))}8==i&&0!=(128&e[0])&&n&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function bnToString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-->0)for(s<this.DB&&(n=this[a]>>s)>0&&(r=!0,o=int2char(n));a>=0;)t>s?(n=(this[a]&(1<<s)-1)<<t-s,n|=this[--a]>>(s+=this.DB-t)):(n=this[a]>>(s-=t)&i,0>=s&&(s+=this.DB,--a)),n>0&&(r=!0),r&&(o+=int2char(n));return r?o:"0"}function bnNegate(){var e=nbi();return BigInteger.ZERO.subTo(this,e),e}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function nbits(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function bnpDRShiftTo(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function bnpLShiftTo(e,t){var n,i=e%this.DB,r=this.DB-i,o=(1<<r)-1,a=Math.floor(e/this.DB),s=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+a+1]=this[n]>>r|s,s=(this[n]&o)<<i;for(n=a-1;n>=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function bnpRShiftTo(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)return void(t.t=0);var i=e%this.DB,r=this.DB-i,o=(1<<i)-1;t[0]=this[n]>>i;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<r,t[a-n]=this[a]>>i;i>0&&(t[this.t-n-1]|=(this.s&o)<<r),t.t=this.t-n,t.clamp()}function bnpSubTo(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);r>n;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=0>i?-1:0,-1>i?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()}function bnpMultiplyTo(e,t){var n=this.abs(),i=e.abs(),r=n.t;for(t.t=r+i.t;--r>=0;)t[r]=0;for(r=0;r<i.t;++r)t[r+n.t]=n.am(0,i[r],t,r,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&BigInteger.ZERO.subTo(t,t)}function bnpSquareTo(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.a
if(o)for(s in c)if(c[s]&&c[s].test(o)){l.unshift(s);break}if(l[0]in i)a=l[0];else{for(s in i){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}r||(r=s)}a=a||r}return a?(a!==l[0]&&l.unshift(a),i[a]):t}function L(e,t,n,i){var r,o,a,s,c,l={},u=e.dataTypes.slice();if(u[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!c&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=o,o=u.shift())if("*"===o)o=c;else if("*"!==c&&c!==o){if(a=l[c+" "+o]||l["* "+o],!a)for(r in l)if(s=r.split(" "),s[1]===o&&(a=l[c+" "+s[0]]||l["* "+s[0]])){a===!0?a=l[r]:l[r]!==!0&&(o=s[0],u.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+c+" to "+o}}}return{state:"success",data:t}}function B(){try{return new e.XMLHttpRequest}catch(t){}}function F(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function O(){return setTimeout(function(){Jn=t}),Jn=ut.now()}function U(e,t,n){for(var i,r=(oi[t]||[]).concat(oi["*"]),o=0,a=r.length;a>o;o++)if(i=r[o].call(n,t,e))return i}function R(e,t,n){var i,r,o=0,a=ri.length,s=ut.Deferred().always(function(){delete c.elem}),c=function(){if(r)return!1;for(var t=Jn||O(),n=Math.max(0,l.startTime+l.duration-t),i=n/l.duration||0,o=1-i,a=0,c=l.tweens.length;c>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&c?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:ut.extend({},t),opts:ut.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||O(),duration:n.duration,tweens:[],createTween:function(t,n){var i=ut.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(i),i},stop:function(t){var n=0,i=t?l.tweens.length:0;if(r)return this;for(r=!0;i>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),u=l.props;for(q(u,l.opts.specialEasing);a>o;o++)if(i=ri[o].call(l,e,u,l.opts))return i;return ut.map(u,U,l),ut.isFunction(l.opts.start)&&l.opts.start.call(e,l),ut.fx.timer(ut.extend(c,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function q(e,t){var n,i,r,o,a;for(n in e)if(i=ut.camelCase(n),r=t[i],o=e[n],ut.isArray(o)&&(r=o[1],o=e[n]=o[0]),n!==i&&(e[i]=o,delete e[n]),a=ut.cssHooks[i],a&&"expand"in a){o=a.expand(o),delete e[i];for(n in o)n in e||(e[n]=o[n],t[n]=r)}else t[i]=r}function j(e,t,n){var i,r,o,a,s,c,l=this,u={},p=e.style,d=e.nodeType&&S(e),h=ut._data(e,"fxshow");n.queue||(s=ut._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,c=s.empty.fire,s.empty.fire=function(){s.unqueued||c()}),s.unqueued++,l.always(function(){l.always(function(){s.unqueued--,ut.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===ut.css(e,"display")&&"none"===ut.css(e,"float")&&(ut.support.inlineBlockNeedsLayout&&"inline"!==T(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",ut.support.shrinkWrapBlocks||l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(i in t)if(r=t[i],ti.exec(r)){if(delete t[i],o=o||"toggle"===r,r===(d?"hide":"show"))continue;u[i]=h&&h[i]||ut.style(e,i)}if(!ut.isEmptyObject(u)){h?"hidden"in h&&(d=h.hidden):h=ut._data(e,"fxshow",{}),o&&(h.hidden=!d),d?ut(e).show():l.done(function(){ut(e).hide()}),l.done(function(){var t;ut._removeData(e,"fxshow");for(t in u)ut.style(e,t,u[t])});for(i in u)a=U(d?h[i]:0,i,l),i in h||(h[i]=a.start,d&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}}function H(e,t,n,i,r){return new H.prototype.init(e,t,n,i,r)}function V(e,t){var n,i={height:e},r=0;for(t=t?1:0;4>r;r+=2-t)n=Cn[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function z(e){return ut.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var W,G,K=typeof t,X=e.location,Z=e.document,Y=Z.documentElement,Q=e.jQuery,J=e.$,et={},tt=[],nt="1.10.2",it=tt.concat,rt=tt.push,ot=tt.s
return s||c.resolveWith(i,o),c.promise()}}),ut.support=function(t){var n,i,r,o,a,s,c,l,u,p=Z.createElement("div");if(p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*")||[],i=p.getElementsByTagName("a")[0],!i||!i.style||!n.length)return t;o=Z.createElement("select"),s=o.appendChild(Z.createElement("option")),r=p.getElementsByTagName("input")[0],i.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==p.className,t.leadingWhitespace=3===p.firstChild.nodeType,t.tbody=!p.getElementsByTagName("tbody").length,t.htmlSerialize=!!p.getElementsByTagName("link").length,t.style=/top/.test(i.getAttribute("style")),t.hrefNormalized="/a"===i.getAttribute("href"),t.opacity=/^0.5/.test(i.style.opacity),t.cssFloat=!!i.style.cssFloat,t.checkOn=!!r.value,t.optSelected=s.selected,t.enctype=!!Z.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==Z.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,r.checked=!0,t.noCloneChecked=r.cloneNode(!0).checked,o.disabled=!0,t.optDisabled=!s.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}r=Z.createElement("input"),r.setAttribute("value",""),t.input=""===r.getAttribute("value"),r.value="t",r.setAttribute("type","radio"),t.radioValue="t"===r.value,r.setAttribute("checked","t"),r.setAttribute("name","t"),a=Z.createDocumentFragment(),a.appendChild(r),t.appendChecked=r.checked,t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,p.attachEvent&&(p.attachEvent("onclick",function(){t.noCloneEvent=!1}),p.cloneNode(!0).click());for(u in{submit:!0,change:!0,focusin:!0})p.setAttribute(c="on"+u,"t"),t[u+"Bubbles"]=c in e||p.attributes[c].expando===!1;p.style.backgroundClip="content-box",p.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===p.style.backgroundClip;for(u in ut(t))break;return t.ownLast="0"!==u,ut(function(){var n,i,r,o="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",a=Z.getElementsByTagName("body")[0];a&&(n=Z.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(p),p.innerHTML="<table><tr><td></td><td>t</td></tr></table>",r=p.getElementsByTagName("td"),r[0].style.cssText="padding:0;margin:0;border:0;display:none",l=0===r[0].offsetHeight,r[0].style.display="",r[1].style.display="none",t.reliableHiddenOffsets=l&&0===r[0].offsetHeight,p.innerHTML="",p.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",ut.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===p.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(p,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(p,null)||{width:"4px"}).width,i=p.appendChild(Z.createElement("div")),i.style.cssText=p.style.cssText=o,i.style.marginRight=i.style.width="0",p.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)),typeof p.style.zoom!==K&&(p.innerHTML="",p.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===p.offsetWidth,p.style.display="block",p.innerHTML="<div></div>",p.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==p.offsetWidth,t.inlineBlockNeedsLayout&&(a.style.zoom=1)),a.removeChild(n),n=p=r=i=null)}),n=o=a=s=i=r=null,t}({});var Mt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,xt=/([A-Z])/g;ut.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ut.cache[e[ut.expando]]:e[ut.expando],!!e&&!s(e)},data:function(e,t,n){return r(e,t,n)},removeData:function(e,t){return o(e,t)},_data:function(e,t,n){return r(e,t,n,!0)},_removeData:function(e,t){return o(e,t,!0)},acceptD
return s=null,d},cleanData:function(e,t){for(var n,i,r,o,a=0,s=ut.expando,c=ut.cache,l=ut.support.deleteExpando,u=ut.event.special;null!=(n=e[a]);a++)if((t||ut.acceptData(n))&&(r=n[s],o=r&&c[r])){if(o.events)for(i in o.events)u[i]?ut.event.remove(n,i):ut.removeEvent(n,i,o.handle);c[r]&&(delete c[r],l?delete n[s]:typeof n.removeAttribute!==K?n.removeAttribute(s):n[s]=null,tt.push(r))}},_evalUrl:function(e){return ut.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),ut.fn.extend({wrapAll:function(e){if(ut.isFunction(e))return this.each(function(t){ut(this).wrapAll(e.call(this,t))});if(this[0]){var t=ut(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(ut.isFunction(e)?function(t){ut(this).wrapInner(e.call(this,t))}:function(){var t=ut(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=ut.isFunction(e);return this.each(function(n){ut(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){ut.nodeName(this,"body")||ut(this).replaceWith(this.childNodes)}).end()}});var un,pn,dn,hn=/alpha\([^)]*\)/i,fn=/opacity\s*=\s*([^)]*)/,gn=/^(top|right|bottom|left)$/,mn=/^(none|table(?!-c[ea]).+)/,yn=/^margin/,vn=RegExp("^("+pt+")(.*)$","i"),_n=RegExp("^("+pt+")(?!px)[a-z%]+$","i"),bn=RegExp("^([+-])=("+pt+")","i"),wn={BODY:"block"},$n={position:"absolute",visibility:"hidden",display:"block"},Sn={letterSpacing:0,fontWeight:400},Cn=["Top","Right","Bottom","Left"],kn=["Webkit","O","Moz","ms"];ut.fn.extend({css:function(e,n){return ut.access(this,function(e,n,i){var r,o,a={},s=0;if(ut.isArray(n)){for(o=pn(e),r=n.length;r>s;s++)a[n[s]]=ut.css(e,n[s],!1,o);return a}return i!==t?ut.style(e,n,i):ut.css(e,n)},e,n,arguments.length>1)},show:function(){return C(this,!0)},hide:function(){return C(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){S(this)?ut(this).show():ut(this).hide()})}}),ut.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=dn(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":ut.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,i,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,c=ut.camelCase(n),l=e.style;if(n=ut.cssProps[c]||(ut.cssProps[c]=$(l,c)),s=ut.cssHooks[n]||ut.cssHooks[c],i===t)return s&&"get"in s&&(o=s.get(e,!1,r))!==t?o:l[n];if(a=typeof i,"string"===a&&(o=bn.exec(i))&&(i=(o[1]+1)*o[2]+parseFloat(ut.css(e,n)),a="number"),!(null==i||"number"===a&&isNaN(i)||("number"!==a||ut.cssNumber[c]||(i+="px"),ut.support.clearCloneStyle||""!==i||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(i=s.set(e,i,r))===t)))try{l[n]=i}catch(u){}}},css:function(e,n,i,r){var o,a,s,c=ut.camelCase(n);return n=ut.cssProps[c]||(ut.cssProps[c]=$(e.style,c)),s=ut.cssHooks[n]||ut.cssHooks[c],s&&"get"in s&&(a=s.get(e,!0,i)),a===t&&(a=dn(e,n,r)),"normal"===a&&n in Sn&&(a=Sn[n]),""===i||i?(o=parseFloat(a),i===!0||ut.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(pn=function(t){return e.getComputedStyle(t,null)},dn=function(e,n,i){var r,o,a,s=i||pn(e),c=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==c||ut.contains(e.ownerDocument,e)||(c=ut.style(e,n)),_n.test(c)&&yn.test(n)&&(r=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=c,c=s.width,l.width=r,l.minWidth=o,l.maxWidth=a)),c}):Z.documentElement.currentStyle&&(pn=function(e){return e.currentStyle},dn=function(e,n,i){var r,o,a,s=i||pn(e),c=s?s[n]:t,l=e.style;return null==c&&l&&l[n]&&(c=l[n]),_n.test(c)&&!gn.test(n)&&(r=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":c,c=l.pixelLeft+"px",l.left=r,a&&(o.left=a)),""===c?"auto":c}),ut.each(["height","width"],function(e,n){ut.cssHooks[n]={get:function(e,i,r){return i?0===e.offsetWidth
}catch(e){console.error("CJ protection",e)}if(window.safeConfirm=function(e,t){"string"==typeof e&&(e={message:e});var n=!1;try{n=confirm(e.message)}catch(i){n=!0}setTimeout(function(){t(n)},10)},window.applicationCache&&!Config.Modes.packed&&window.addEventListener){var t=window.applicationCache,n=!1,i=!1,r=function(e){clearTimeout(i),i=setTimeout(function(){try{t.update()}catch(e){console.log("appCache.update: "+e)}},e||3e5)},o=function(){t.addEventListener("updateready",function(){t.status==t.UPDATEREADY&&(n||(safeConfirm({type:"WEBOGRAM_UPDATED_RELOAD",message:"A new version of Webogram is downloaded. Launch it?"},function(e){e?window.location.reload():n=!0}),r()))},!1),t.addEventListener("noupdate",function(){r()},!1),t.addEventListener("error",function(){r()},!1)};r(3e3),window.addEventListener("load",o)}}(),function(e,t,n){"use strict";var i,r,o,a,s,c,l,u,p,d,h,f,g,m,y,v,_,b,w,$,S,C,k,M,x,T,A,E,D;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},v="scrollbar",y="scroll",u="mousedown",p="mousemove",h="mousewheel",d="mouseup",m="resize",s="drag",b="up",g="panedown",o="DOMMouseScroll",a="down",w="wheel",c="keydown",l="keyup",_="touchmove",i="Microsoft Internet Explorer"===t.navigator.appName&&/msie 7./i.test(t.navigator.appVersion)&&t.ActiveXObject,r=null,x=t.requestAnimationFrame,$=t.cancelAnimationFrame,A=n.createElement("div").style,D=function(){var e,t,n,i,r,o;for(i=["t","webkitT","MozT","msT","OT"],e=r=0,o=i.length;o>r;e=++r)if(n=i[e],t=i[e]+"ransform",t in A)return i[e].substr(0,i[e].length-1);return!1}(),E=function(e){return D===!1?!1:""===D?e:D+e.charAt(0).toUpperCase()+e.substr(1)},T=E("transform"),k=T!==!1,C=function(){var e,t,i;return e=n.createElement("div"),t=e.style,t.position="absolute",t.width="100px",t.height="100px",t.overflow=y,t.top="-9999px",n.body.appendChild(e),i=e.offsetWidth-e.clientWidth,n.body.removeChild(e),i},M=function(){var e,n,i;return n=t.navigator.userAgent,(e=/(?=.+Mac OS X)(?=.+Firefox)/.test(n))?(i=/Firefox\/\d{2}\./.exec(n),i&&(i=i[0].replace(/\D+/g,"")),e&&+i>23):!1},f=function(){function c(i,o){this.el=i,this.options=o,r||(r=C()),this.$el=e(this.el),this.doc=e(this.options.documentContext||n),this.win=e(this.options.windowContext||t),this.$content=this.$el.children("."+o.contentClass),this.$content.attr("tabindex",this.options.tabIndex||0),this.content=this.$content[0],this.previousPosition=0,this.options.iOSNativeScrolling&&(null!=this.el.style.WebkitOverflowScrolling||navigator.userAgent.match(/mobi.+Gecko/i))?this.nativeScrolling():this.generate(),this.createEvents(),this.addEvents(),this.reset()}return c.prototype.preventScrolling=function(e,t){if(this.isActive)if(e.type===o)(t===a&&e.originalEvent.detail>0||t===b&&e.originalEvent.detail<0)&&e.preventDefault();else if(e.type===h){if(!e.originalEvent||!e.originalEvent.wheelDelta)return;(t===a&&e.originalEvent.wheelDelta<0||t===b&&e.originalEvent.wheelDelta>0)&&e.preventDefault()}},c.prototype.nativeScrolling=function(){this.$content.css({WebkitOverflowScrolling:"touch"}),this.iOSNativeScrolling=!0,this.isActive=!0},c.prototype.updateScrollValues=function(){var e,t;e=this.content,this.maxScrollTop=e.scrollHeight-e.clientHeight,this.prevScrollTop=this.contentScrollTop||0,this.contentScrollTop=e.scrollTop,t=this.contentScrollTop>this.previousPosition?"down":this.contentScrollTop<this.previousPosition?"up":"same",this.previousPosition=this.contentScrollTop,"same"!==t&&this.$el.trigger("update",{position:this.contentScrollTop,maximum:this.maxScrollTop,direction:t}),this.iOSNativeScrolling||(this.maxSliderTop=this.paneHeight-this.sliderHeight,this.sliderTop=0===this.maxScrollTop?0:this.contentScrollTop*this.maxSliderTop/this.maxScrollTop)},c.prototype.setOnScrollStyles=function(){var e;k?(e={},e[T]="translate(0, "+this.sliderTop+"px)"):e={top:this.sliderTop},x?this.scrollRAF||(this.scrollRAF=x(function(t){return function(){t.sc
return new ft(e)}b(e)?Ct(this,ht(e)):Ct(this,e)}function gt(e){return e.cloneNode(!0)}function mt(e,t){if(t||vt(e),e.childNodes&&e.childNodes.length)for(var n=e.getElementsByTagName?e.getElementsByTagName("*"):e.querySelectorAll?e.querySelectorAll("*"):[],i=0,r=n.length;r>i;i++)vt(n[i])}function yt(e,t,n,i){if(v(i))throw Qi("offargs","jqLite#off() does not support the `selector` argument");var r=_t(e,"events"),a=_t(e,"handle");a&&(y(t)?o(r,function(t,n){Xi(e,n,t),delete r[n]}):o(t.split(" "),function(t){y(n)?(Xi(e,t,r[t]),delete r[t]):N(r[t]||[],n)}))}function vt(e,t){var i=e.ng339,r=Wi[i];if(r){if(t)return void delete Wi[i].data[t];r.handle&&(r.events.$destroy&&r.handle({},"$destroy"),yt(e)),delete Wi[i],e.ng339=n}}function _t(e,t,n){var i=e.ng339,r=Wi[i||-1];return v(n)?(r||(e.ng339=i=ct(),r=Wi[i]={}),void(r[t]=n)):r&&r[t]}function bt(e,t,n){if(pt(e)){var i=_t(e,"data"),r=v(n),o=!r&&v(t),a=o&&!_(t);if(i||a||_t(e,"data",i={}),r)i[t]=n;else{if(!o)return i;if(a)return i&&i[t];p(i,t)}}}function wt(e,t){return e.getAttribute?(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1:!1}function $t(e,t){t&&e.setAttribute&&o(t.split(" "),function(t){e.setAttribute("class",qi((" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+qi(t)+" "," ")))})}function St(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");o(t.split(" "),function(e){e=qi(e),-1===n.indexOf(" "+e+" ")&&(n+=e+" ")}),e.setAttribute("class",qi(n))}}function Ct(e,t){if(t)if(t.nodeType)e[e.length++]=t;else{var n=t.length;"number"==typeof n&&t.window!==t?n&&(t.item&&(t=Ni.call(t)),Li.apply(e,t)):e[e.length++]=t}}function kt(e,t){return Mt(e,"$"+(t||"ngController")+"Controller")}function Mt(e,t,i){9==e.nodeType&&(e=e.documentElement);for(var r=Ri(t)?t:[t];e;){for(var o=0,a=r.length;a>o;o++)if((i=Ei.data(e,r[o]))!==n)return i;e=e.parentNode||11===e.nodeType&&e.host}}function xt(e){for(mt(e,!0);e.firstChild;)e.removeChild(e.firstChild)}function Tt(e,t){var n=or[t.toLowerCase()];return n&&ar[Pi(e)]&&n}function At(e,t){var n=e.nodeName;return("INPUT"===n||"TEXTAREA"===n)&&sr[t]}function Et(e,n){var i=function(i,r){if(i.preventDefault||(i.preventDefault=function(){i.returnValue=!1}),i.stopPropagation||(i.stopPropagation=function(){i.cancelBubble=!0}),i.target||(i.target=i.srcElement||t),y(i.defaultPrevented)){var a=i.preventDefault;i.preventDefault=function(){i.defaultPrevented=!0,a.call(i)},i.defaultPrevented=!1}i.isDefaultPrevented=function(){return i.defaultPrevented||i.returnValue===!1};var s=B(n[r||i.type]||[]);o(s,function(t){t.call(e,i)}),8>=Ai?(i.preventDefault=null,i.stopPropagation=null,i.isDefaultPrevented=null):(delete i.preventDefault,delete i.stopPropagation,delete i.isDefaultPrevented)};return i.elem=e,i}function Dt(e,t){var i,r=typeof e;return"function"==r||"object"==r&&null!==e?"function"==typeof(i=e.$$hashKey)?i=e.$$hashKey():i===n&&(i=e.$$hashKey=(t||l)()):i=e,r+":"+i}function It(e,t){if(t){var n=0;this.nextUid=function(){return++n}}o(e,this.put,this)}function Pt(e){var t=e.toString().replace(pr,""),n=t.match(cr);return n?"function("+(n[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function Nt(e,t,n){var i,r,a,s;if("function"==typeof e){if(!(i=e.$inject)){if(i=[],e.length){if(t)throw b(n)&&n||(n=e.name||Pt(e)),dr("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",n);r=e.toString().replace(pr,""),a=r.match(cr),o(a[1].split(lr),function(e){e.replace(ur,function(e,t,n){i.push(n)})})}e.$inject=i}}else Ri(e)?(s=e.length-1,nt(e[s],"fn"),i=e.slice(0,s)):nt(e,"fn",!0);return i}function Lt(e,t){function i(e){return function(t,n){return _(t)?void o(t,c(e)):e(t,n)}}function r(e,t){if(it(e,"service"),(S(t)||Ri(t))&&(t=C.instantiate(t)),!t.$get)throw dr("pget","Provider '{0}' must define $get factory method.",e);return $[e+y]=t}function a(e,t){return r(e,{$get:t})}function s(e,t){return a(e,["$injector",function(e){return e.instantiate(t)}])}function l(e,t){return a(e,m(t))}function u(e,t){it(e,"constant"),$[e]=t,k[e]=t}function p(e,t){var n=
}function cn(e,t,n){var i="/"!==e.charAt(0);i&&(e="/"+e);var r=Rn(e,n);t.$$path=decodeURIComponent(i&&"/"===r.pathname.charAt(0)?r.pathname.substring(1):r.pathname),t.$$search=W(r.search),t.$$hash=decodeURIComponent(r.hash),t.$$path&&"/"!=t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function ln(e,t){return 0===t.indexOf(e)?t.substr(e.length):void 0}function un(e){var t=e.indexOf("#");return-1==t?e:e.substr(0,t)}function pn(e){return e.substr(0,un(e).lastIndexOf("/")+1)}function dn(e){return e.substring(0,e.indexOf("/",e.indexOf("//")+2))}function hn(e,t){this.$$html5=!0,t=t||"";var i=pn(e);sn(e,this,e),this.$$parse=function(t){var n=ln(i,t);if(!b(n))throw br("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',t,i);cn(n,this,e),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=G(this.$$search),t=this.$$hash?"#"+K(this.$$hash):"";this.$$url=an(this.$$path)+(e?"?"+e:"")+t,this.$$absUrl=i+this.$$url.substr(1)},this.$$rewrite=function(r){var o,a;return(o=ln(e,r))!==n?(a=o,(o=ln(t,o))!==n?i+(ln("/",o)||o):e+a):(o=ln(i,r))!==n?i+o:i==r+"/"?i:void 0}}function fn(e,t){var n=pn(e);sn(e,this,e),this.$$parse=function(i){function r(e,t,n){var i,r=/^\/[A-Z]:(\/.*)/;return 0===t.indexOf(n)&&(t=t.replace(n,"")),r.exec(t)?e:(i=r.exec(e),i?i[1]:e)}var o=ln(e,i)||ln(n,i),a="#"==o.charAt(0)?ln(t,o):this.$$html5?o:"";if(!b(a))throw br("ihshprfx",'Invalid url "{0}", missing hash prefix "{1}".',i,t);cn(a,this,e),this.$$path=r(this.$$path,a,e),this.$$compose()},this.$$compose=function(){var n=G(this.$$search),i=this.$$hash?"#"+K(this.$$hash):"";this.$$url=an(this.$$path)+(n?"?"+n:"")+i,this.$$absUrl=e+(this.$$url?t+this.$$url:"")},this.$$rewrite=function(t){return un(e)==un(t)?t:void 0}}function gn(e,t){this.$$html5=!0,fn.apply(this,arguments);var n=pn(e);this.$$rewrite=function(i){var r;return e==un(i)?i:(r=ln(n,i))?e+t+r:n===i+"/"?n:void 0},this.$$compose=function(){var n=G(this.$$search),i=this.$$hash?"#"+K(this.$$hash):"";this.$$url=an(this.$$path)+(n?"?"+n:"")+i,this.$$absUrl=e+t+this.$$url}}function mn(e){return function(){return this[e]}}function yn(e,t){return function(n){return y(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function vn(){var t="",n=!1;this.hashPrefix=function(e){return v(e)?(t=e,this):t},this.html5Mode=function(e){return v(e)?(n=e,this):n},this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(i,r,o,a){function s(e){i.$broadcast("$locationChangeSuccess",c.absUrl(),e)}var c,l,u,p=r.baseHref(),d=r.url();n?(u=dn(d)+(p||"/"),l=o.history?hn:gn):(u=un(d),l=fn),c=new l(u,"#"+t),c.$$parse(c.$$rewrite(d)),a.on("click",function(n){if(!n.ctrlKey&&!n.metaKey&&2!=n.which){for(var o=Ei(n.target);"a"!==Pi(o[0]);)if(o[0]===a[0]||!(o=o.parent())[0])return;var s=o.prop("href");if(_(s)&&"[object SVGAnimatedString]"===s.toString()&&(s=Rn(s.animVal).href),l===gn){var p=o.attr("href")||o.attr("xlink:href");if(p.indexOf("://")<0){var d="#"+t;if("/"==p[0])s=u+d+p;else if("#"==p[0])s=u+d+(c.path()||"/")+p;else{for(var h=c.path().split("/"),f=p.split("/"),g=0;g<f.length;g++)"."!=f[g]&&(".."==f[g]?h.pop():f[g].length&&h.push(f[g]));s=u+d+h.join("/")}}}var m=c.$$rewrite(s);s&&!o.attr("target")&&m&&!n.isDefaultPrevented()&&(n.preventDefault(),m!=r.url()&&(c.$$parse(m),i.$apply(),e.angular["ff-684208-preventDefault"]=!0))}}),c.absUrl()!=d&&r.url(c.absUrl(),!0),r.onUrlChange(function(e){c.absUrl()!=e&&(i.$evalAsync(function(){var t=c.absUrl();c.$$parse(e),i.$broadcast("$locationChangeStart",e,t).defaultPrevented?(c.$$parse(t),r.url(t)):s(t)}),i.$$phase||i.$digest())});var h=0;return i.$watch(function(){var e=r.url(),t=c.$$replace;return h&&e==c.absUrl()||(h++,i.$evalAsync(function(){i.$broadcast("$locationChangeStart",c.absUrl(),e).defaultPrevented?c.$$parse(e):(r.url(c.absUrl(),t),s(e))})),c.$$replace=!1,h}),c}]}function _n(){var e=!0,t=this;this.debugEnabled=function(t){return v(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"
if(_(e)){var t=[];return o(e,function(e,n){e&&(t=t.concat(n.split(" ")))}),t}return e}return{restrict:"AC",link:function(a,s,c){function l(e){var t=p(e,1);c.$addClass(t)}function u(e){var t=p(e,-1);c.$removeClass(t)}function p(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 d(e,t){var r=i(t,e),o=i(e,t);o=p(o,-1),r=p(r,1),0===r.length?n.removeClass(s,o):0===o.length?n.addClass(s,r):n.setClass(s,r,o)}function h(e){if(t===!0||a.$index%2===t){var n=r(e||[]);if(f){if(!F(e,f)){var i=r(f);d(i,n)}}else l(n)}f=B(e)}var f;a.$watch(c[e],h,!0),c.$observe("class",function(){h(a.$eval(c[e]))}),"ngClass"!==e&&a.$watch("$index",function(n,i){var o=1&n;if(o!==(1&i)){var s=r(a.$eval(c[e]));o===t?l(s):u(s)}})}}}]}var $i=/^\/(.+)\/([a-z]*)$/,Si="validity",Ci=function(e){return b(e)?e.toLowerCase():e},ki=Object.prototype.hasOwnProperty,Mi=function(e){return b(e)?e.toUpperCase():e},xi=function(e){return b(e)?e.replace(/[A-Z]/g,function(e){return String.fromCharCode(32|e.charCodeAt(0))}):e},Ti=function(e){return b(e)?e.replace(/[a-z]/g,function(e){return String.fromCharCode(-33&e.charCodeAt(0))}):e};"i"!=="I".toLowerCase()&&(Ci=xi,Mi=Ti);var Ai,Ei,Di,Ii,Pi,Ni=[].slice,Li=[].push,Bi=Object.prototype.toString,Fi=i("ng"),Oi=e.angular||(e.angular={}),Ui=0;Ai=d((/msie (\d+)/.exec(Ci(navigator.userAgent))||[])[1]),isNaN(Ai)&&(Ai=d((/trident\/.*; rv:(\d+)/.exec(Ci(navigator.userAgent))||[])[1])),f.$inject=[],g.$inject=[];var Ri=function(){return S(Array.isArray)?Array.isArray:function(e){return"[object Array]"===Bi.call(e)}}(),qi=function(){return String.prototype.trim?function(e){return b(e)?e.trim():e}:function(e){return b(e)?e.replace(/^\s\s*/,"").replace(/\s\s*$/,""):e}}();Pi=9>Ai?function(e){return e=e.nodeName?e:e[0],Ci(e.scopeName&&"HTML"!=e.scopeName?e.scopeName+":"+e.nodeName:e.nodeName)}:function(e){return Ci(e.nodeName?e.nodeName:e[0].nodeName)};var ji=function(){if(v(ji.isActive_))return ji.isActive_;var e=!(!t.querySelector("[ng-csp]")&&!t.querySelector("[data-ng-csp]"));if(!e)try{new Function("")}catch(n){e=!0}return ji.isActive_=e},Hi=["ng-","data-ng-","ng:","x-ng-"],Vi=/[A-Z]/g,zi={full:"1.3.0-beta.16",major:1,minor:3,dot:0,codeName:"pizza-transubstantiation"};ft.expando="ng339";var Wi=ft.cache={},Gi=1,Ki=e.document.addEventListener?function(e,t,n){e.addEventListener(t,n,!1)}:function(e,t,n){e.attachEvent("on"+t,n)},Xi=e.document.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1)}:function(e,t,n){e.detachEvent("on"+t,n)},Zi=(ft._data=function(e){return this.cache[e[this.expando]]||{}},/([\:\-\_]+(.))/g),Yi=/^moz([A-Z])/,Qi=i("jqLite"),Ji=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,er=/<|&#?\w+;/,tr=/<([\w:]+)/,nr=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ir={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ir.optgroup=ir.option,ir.tbody=ir.tfoot=ir.colgroup=ir.caption=ir.thead,ir.th=ir.td;var rr=ft.prototype={ready:function(n){function i(){r||(r=!0,n())}var r=!1;"complete"===t.readyState?setTimeout(i):(this.on("DOMContentLoaded",i),ft(e).on("load",i))},toString:function(){var e=[];return o(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return Ei(e>=0?this[e]:this[this.length+e])},length:0,push:Li,sort:[].sort,splice:[].splice},or={};o("multiple,selected,checked,disabled,readOnly,required,open".split(","),function(e){or[Ci(e)]=e});var ar={};o("input,select,option,textarea,button,form,details".split(","),function(e){ar[e]=!0});var sr={ngMinlength:"minlength",ngMaxlength:"maxlength",ngPattern:"pattern"};o({data:bt,removeData:vt},function(e,t){ft[t]=e}),o({data:bt,inheritedData:Mt,scope:function(e){return Ei.data(e,"$scope")||Mt(e.parentNode||e,["$isolateScope","$scope"])},isolateScope:function(e){return Ei.data(e,"$isolateScope")||Ei.data(e,"$isolateScopeNoTemplate"
o(a,function(e,t){f.test(t)&&(u[Ci(t.replace("when","").replace("Minus","-"))]=r.attr(a.$attr[t]))}),o(u,function(e,i){p[i]=t(e.replace(n,d+s+"-"+l+h))}),i.$watch(function(){var t=parseFloat(i.$eval(s));return isNaN(t)?"":(t in u||(t=e.pluralCat(t-l)),p[t](i))},function(e){r.text(e)})}}}],Fo=["$parse","$animate",function(e,n){function a(e){return e.clone[0]}function s(e){return e.clone[e.clone.length-1]}var c="$$NG_REMOVED",l=i("ngRepeat");return{multiElement:!0,transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,link:function(i,u,p,d,h){var f,g,m,y,v,_,b,w,$,S=p.ngRepeat,C=S.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),k={$id:Dt};if(!C)throw l("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",S);if(_=C[1],b=C[2],f=C[3],f?(g=e(f),m=function(e,t,n){return $&&(k[$]=e),k[w]=t,k.$index=n,g(i,k)}):(y=function(e,t){return Dt(t)},v=function(e){return e}),C=_.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/),!C)throw l("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",_);w=C[3]||C[1],$=C[2];var M={};i.$watchCollection(b,function(e){var i,p,d,f,g,_,b,C,k,x,T,A=u[0],E={},D=[],I=function(e,t){e[w]=_,$&&(e[$]=g),e.$index=t,e.$first=0===t,e.$last=t===f-1,e.$middle=!(e.$first||e.$last),e.$odd=!(e.$even=0===(1&t))};if(r(e))k=e,C=m||y;else{C=m||v,k=[];for(var P in e)e.hasOwnProperty(P)&&"$"!=P.charAt(0)&&k.push(P);k.sort()}for(f=k.length,p=D.length=k.length,i=0;p>i;i++)if(g=e===k?i:k[i],_=e[g],b=C(g,_,i),it(b,"`track by` id"),M.hasOwnProperty(b))x=M[b],delete M[b],E[b]=x,D[i]=x;else{if(E.hasOwnProperty(b))throw o(D,function(e){e&&e.scope&&(M[e.id]=e)}),l("dupes","Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",S,b);D[i]={id:b},E[b]=!1}for(var N in M)M.hasOwnProperty(N)&&(x=M[N],T=ot(x.clone),n.leave(T),o(T,function(e){e[c]=!0}),x.scope.$destroy());for(i=0,p=k.length;p>i;i++)if(g=e===k?i:k[i],_=e[g],x=D[i],D[i-1]&&(A=s(D[i-1])),x.scope){d=A;do d=d.nextSibling;while(d&&d[c]);a(x)!=d&&n.move(ot(x.clone),null,Ei(A)),A=s(x),I(x.scope,i)}else h(function(e,r){x.scope=r,e[e.length++]=t.createComment(" end ngRepeat: "+S+" "),n.enter(e,null,Ei(A)),A=e,x.clone=e,E[x.id]=x,I(x.scope,i)});M=E})}}}],Oo=["$animate",function(e){return{multiElement:!0,link:function(t,n,i){t.$watch(i.ngShow,function(t){e[t?"removeClass":"addClass"](n,"ng-hide")})}}}],Uo=["$animate",function(e){return{multiElement:!0,link:function(t,n,i){t.$watch(i.ngHide,function(t){e[t?"addClass":"removeClass"](n,"ng-hide")})}}}],Ro=ai(function(e,t,n){e.$watch(n.ngStyle,function(e,n){n&&e!==n&&o(n,function(e,n){t.css(n,"")}),e&&t.css(e)},!0)}),qo=["$animate",function(e){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(n,i,r,a){var s=r.ngSwitch||r.on,c=[],l=[],u=[],p=[];n.$watch(s,function(i){var s,d;for(s=0,d=u.length;d>s;++s)u[s].remove();for(u.length=0,s=0,d=p.length;d>s;++s){var h=ot(l[s].clone);p[s].$destroy(),u[s]=h,e.leave(h,function(){u.splice(s,1)})}l.length=0,p.length=0,(c=a.cases["!"+i]||a.cases["?"])&&(n.$eval(r.change),o(c,function(n){n.transclude(function(i,r){p.push(r);var o=n.element;i[i.length++]=t.createComment(" end ngSwitchWhen: ");var a={clone:i};l.push(a),e.enter(i,o.parent(),o)})}))})}}}],jo=ai({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,i,r){i.cases["!"+n.ngSwitchWhen]=i.cases["!"+n.ngSwitchWhen]||[],i.cases["!"+n.ngSwitchWhen].push({transclude:r,element:t})}}),Ho=ai({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,i,r){i.cases["?"]=i.cases["?"]||[],i.cases["?"].push({transclude:r,element:t})}}),Vo=ai({restrict:"EAC",link:function(e,t,n,r,o){if(!o)throw i("ngTransclude")("orphan","Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}",V(t));o(function(e){t.empty(),t.append(e)})}}),zo=["$templateCache",function(e){return{r
}),i.on("mousemove mouseup",function(){i.removeClass(m)})}}]),n("ngSwipeLeft",-1,"swipeleft"),n("ngSwipeRight",1,"swiperight")}(window,window.angular),angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.dropdownToggle","ui.bootstrap.modal","ui.bootstrap.position","ui.bootstrap.bindHtml","ui.bootstrap.tooltip"]),angular.module("ui.bootstrap.tpls",["template/modal/backdrop.html","template/modal/window.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(e,t,n){function i(e){for(var t in e)if(void 0!==o.style[t])return e[t]}var r=function(i,o,a){a=a||{};var s=e.defer(),c=r[a.animation?"animationEndEventName":"transitionEndEventName"],l=function(){n.$apply(function(){i.unbind(c,l),s.resolve(i)})};return c&&i.bind(c,l),t(function(){angular.isString(o)?i.addClass(o):angular.isFunction(o)?o(i):angular.isObject(o)&&i.css(o),c||s.resolve(i)}),s.promise.cancel=function(){c&&i.unbind(c,l),s.reject("Transition cancelled")},s.promise},o=document.createElement("trans"),a={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},s={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return r.transitionEndEventName=i(a),r.animationEndEventName=i(s),r}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(e){return{link:function(t,n,i){function r(t){function i(){l===r&&(l=void 0)}var r=e(n,t);return l&&l.cancel(),l=r,r.then(i,i),r}function o(){u?(u=!1,a()):(n.removeClass("collapse").addClass("collapsing"),r({height:n[0].scrollHeight+"px"}).then(a))}function a(){n.removeClass("collapsing"),n.addClass("collapse in"),n.css({height:"auto"})}function s(){if(u)u=!1,c(),n.css({height:0});else{n.css({height:n[0].scrollHeight+"px"});{n[0].offsetWidth}n.removeClass("collapse in").addClass("collapsing"),r({height:0}).then(c)}}function c(){n.removeClass("collapsing"),n.addClass("collapse")}var l,u=!0;t.$watch(i.collapse,function(e){e?s():o()})}}}]),angular.module("ui.bootstrap.dropdownToggle",[]).directive("dropdownToggle",["$document","$location",function(e){var t=null,n=angular.noop;return{restrict:"CA",link:function(i,r){i.$watch("$location.path",function(){n()}),r.parent().bind("click",function(){n()}),r.bind("click",function(i){var o=r===t;i.preventDefault(),i.stopPropagation(),t&&n(),o||r.hasClass("disabled")||r.prop("disabled")||(r.parent().addClass("open"),t=r,n=function(i){i&&(i.preventDefault(),i.stopPropagation()),e.unbind("click",n),r.parent().removeClass("open"),n=angular.noop,t=null},e.bind("click",n))})}}}]),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var e=[];return{add:function(t,n){e.push({key:t,value:n})},get:function(t){for(var n=0;n<e.length;n++)if(t==e[n].key)return e[n]},keys:function(){for(var t=[],n=0;n<e.length;n++)t.push(e[n].key);return t},top:function(){return e[e.length-1]},remove:function(t){for(var n=-1,i=0;i<e.length;i++)if(t==e[i].key){n=i;break}return e.splice(n,1)[0]},removeTop:function(){return e.splice(e.length-1,1)[0]},length:function(){return e.length}}}}}).directive("modalBackdrop",["$timeout",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(t){t.animate=!1,e(function(){t.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(e,t){return{restrict:"EA",scope:{index:"@",animate:"=",nav:"="},replace:!0,transclude:!0,templateUrl:"template/modal/window.html",link:function(n,i,r){n.windowClass=r.windowClass||"",t(function(){n.animate=!0,i[0].focus()}),n.close=function(t){var n=e.getTop();n&&n.value.backdrop&&"static"!=n.value.backdrop&&t.target===t.currentTarget&&(t.preventDefault(),t.stopPropagation(),e.dismiss(n.key,"backdrop click"))}}}}]).factory("$mod
break;case $:this.a=0,this.b=new(d?Uint8Array:Array)(this.j),this.e=this.D,this.q=this.A,this.l=this.C;break;default:e(Error("invalid inflate mode"))}}function a(t,n){for(var i,r=t.f,o=t.d,a=t.input,s=t.c;n>o;)i=a[s++],i===u&&e(Error("input buffer is broken")),r|=i<<o,o+=8;return i=r&(1<<n)-1,t.f=r>>>n,t.d=o-n,t.c=s,i}function s(e,t){for(var n,i,r,o=e.f,a=e.d,s=e.input,c=e.c,l=t[0],p=t[1];p>a&&(n=s[c++],n!==u);)o|=n<<a,a+=8;return i=l[o&(1<<p)-1],r=i>>>16,e.f=o>>r,e.d=a-r,e.c=c,65535&i}function c(e){function t(e,t,n){var i,r,o,c;for(c=0;e>c;)switch(i=s(this,t)){case 16:for(o=3+a(this,2);o--;)n[c++]=r;break;case 17:for(o=3+a(this,3);o--;)n[c++]=0;r=0;break;case 18:for(o=11+a(this,7);o--;)n[c++]=0;r=0;break;default:r=n[c++]=i}return n}var n,i,o,c,l=a(e,5)+257,u=a(e,5)+1,p=a(e,4)+4,h=new(d?Uint8Array:Array)(M.length);for(c=0;p>c;++c)h[M[c]]=a(e,3);n=r(h),i=new(d?Uint8Array:Array)(l),o=new(d?Uint8Array:Array)(u),e.l(r(t.call(e,l,n,i)),r(t.call(e,u,n,o)))}function l(e){this.input=e,this.c=0,this.m=[],this.s=!1}var u=void 0,p=this,d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;new(d?Uint8Array:Array)(256);var h;for(h=0;256>h;++h)for(var f=h,g=7,f=f>>>1;f;f>>>=1)--g;var m=[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],y=d?new Uint32Array(m):m;i.prototype.getName=function(){return this.name},i.prototype.getData=function(){return thi
r[0].dataset.downloadurl=[n,i,e].join(":"),r[0].click(),t(function(){r.remove()},100)}e.URL=e.URL||e.webkitURL,e.BlobBuilder=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder;var d=!0;try{o([],"")}catch(h){d=!1}return{isAvailable:i,copy:r,write:a,getFileWriter:c,getFakeFileWriter:l,chooseSave:s,getUrl:u,download:p}}]).service("IdbFileStorage",["$q","$window","FileManager",function(e,t,n){function i(){return d}function r(){if(c)return c;try{var t=indexedDB.open(l,p),n=e.defer(),i=function(e){e.createObjectStore(u)}}catch(r){return d=!1,e.reject(r)}return t.onsuccess=function(){db=t.result,db.onerror=function(e){d=!1,console.error("Error creating/accessing IndexedDB database",e),n.reject(e)},db.setVersion&&db.version!=p?db.setVersion(p).onsuccess=function(){i(db),n.resolve(db)}:n.resolve(db)},t.onerror=function(e){d=!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 r().then(function(i){try{var r=e.defer(),o=i.transaction([u],IDBTransaction.READ_WRITE||"readwrite").objectStore(u),a=o.put(n,t)}catch(s){return d=!1,e.reject(s)}return a.onsuccess=function(){r.resolve(n)},a.onerror=function(e){r.reject(e)},r.promise})}function a(t){return r().then(function(n){var i=e.defer(),r=n.transaction([u],IDBTransaction.READ||"readonly").objectStore(u),o=r.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 r=n.getFakeFileWriter(i,function(e){o(t,e)});return e.when(r)}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",u="files",p=1,d=void 0!==t.indexedDB&&void 0!==t.IDBTransaction;return r(),{isAvailable:i,saveFile:o,getFile:a,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,5242880,function(e){cachedFs=e,n.resolve()},function(e){l=!1,n.reject(e)}),c=n.promise}function r(){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 a(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){i.reject(e)})},function(e){i.reject(e)}),i.promise})}t.requestFileSystem=t.requestFileSystem||t.webkitRequestFileSystem;var c,l=void 0!==t.requestFileSystem;return i(),{isAvailable:r,saveFile:a,getFile:o,getFileWriter:s}}]).service("MemoryFileStorage",["$q","FileManager",function(e,t){function n(){return!0}function i(t){return a[t]?e.when(a[t]):e.reject(new Error("FILE_NOT_FOUND"))}function r(t,n){return e.when(a[t]=n)}function o(n,i){var o=t.getFakeFileWriter(i,function(e){r(n,e)});return e.when(o)}var a={};return{isAvailable:n,saveFile:r,getFile:i,getFileWriter:o}}]).service("CryptoWorker",["$timeout","$q",function(e,t){function n(e,n){console.log(dT(),"CW start",e);var a=t.defer();return o[r]=a,n.task=e,n.taskID=r,i.postMessage(n),r++,a.promise}var i=window.Worker&&new Worker("js/lib/crypto_worker.js")||!1,r=0,o={};return i&&(i.onmessage=function(e){var t=o[e.data.taskID];void 0!==t&&(console.log(dT(),"CW done"),t.resolve(e.data.result),delete o[e.data.taskID])},i.onerror=function(e){console.log("CW error",e,e.stack)}),{sha1Hash:function(t){return e(function(){return sha1Hash(t)})},aesEncrypt:function(t,n,i){return
b[e]+=i;$++;n.cb().then(function(t){b[e]-=i,s(e),n.deferred.resolve(t)},function(t){b[e]-=i,s(e),n.deferred.reject(t)})}function c(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 l(e){if(!e)return!1;var t=c(e);return v[t]||!1}function u(){return r.isAvailable()?r:i.isAvailable()?i:o}function p(e,t){var i=c(e),r="image/jpeg";return m[i]||(m[i]=u().saveFile(i,t).then(function(e){return v[i]=n.getUrl(e,r)})),m[i]}function d(i){if(!n.isAvailable())return t.reject({type:"BROWSER_BLOB_NOT_SUPPORTED"});var r=c(i),o="image/jpeg",s=m[r]||y[r];if(s)return s;var l=u();return y[r]=l.getFile(r).then(function(e){return v[r]=n.getUrl(e,o)},function(){var t=a(i.dc_id,function(){return e.invokeApi("upload.getFile",{location:angular.extend({},i,{_:"inputFileLocation"}),offset:0,limit:0},{dcID:i.dc_id,fileDownload:!0,createNetworker:!0})});return l.getFileWriter(r,o).then(function(e){return t.then(function(t){return n.write(e,t.bytes).then(function(){return v[r]=n.getUrl(e.finalize(),o)})})})})}function h(i,r,o,s){if(!n.isAvailable())return t.reject({type:"BROWSER_BLOB_NOT_SUPPORTED"});s=s||{};var l=c(r),p=s.toFileEntry||null,d=m[l]||y[l],h=u();if(d)return p?d.then(function(){return h.getFile(l).then(function(e){return n.copy(e,p)})}):d;var f,g=t.defer(),_=!1,b=!1,w=s.mime||"image/jpeg",$=function(e){g.reject(e),$=angular.noop,f&&f.truncate(0)};return h.getFile(l).then(function(e){p?n.copy(e,p).then(function(){g.resolve()},$):g.resolve(v[l]=n.getUrl(e,w))},function(){var s=p?n.getFileWriter(p):h.getFileWriter(l,w);s.then(function(s){f=s;for(var c,u=524288,d=t.when(),h=0;o>h;h+=u)c=t.defer(),function(c,d,h,f){return a(i,function(){return _?t.when():e.invokeApi("upload.getFile",{location:r,offset:d,limit:u},{dcID:i,fileDownload:!0,createNetworker:!0})},6).then(function(e){f.then(function(){return _?t.when():n.write(s,e.bytes).then(function(){h.resolve()},$).then(function(){c?(b=!0,p?g.resolve():g.resolve(v[l]=n.getUrl(s.finalize(),w))):g.notify({done:d+u,total:o})})})})}(h+u>=o,h,c,d),d=c.promise})}),g.promise.cancel=function(){_||b||(_=!0,delete y[l],$({type:"DOWNLOAD_CANCELED"}))},p||(y[l]=g.promise),g.promise}function f(n){var i=n.size,r=i>102400?524288:32768,o=i>=10485760,a=Math.ceil(i/r),s=!1,c=!1,l=0;if(a>1500)return t.reject({type:"FILE_TOO_BIG"});var u,p=[nextRandomInt(4294967295),nextRandomInt(4294967295)],d=t.defer(),h=function(e){d.reject(e),h=angular.noop},f=0,m={_:o?"inputFileBig":"inputFile",id:p,parts:a,name:n.name,md5_checksum:""},y=t.when();for(u=0;i>u;u+=r)!function(u,f){y=y.then(function(){var y=t.defer(),v=new FileReader,_=n.slice(u,u+r);return v.onloadend=function(t){if(!s&&t.target.readyState==FileReader.DONE){var n=g=g.then(function(){return e.invokeApi(o?"upload.saveBigFilePart":"upload.saveFilePart",{file_id:p,file_part:f,file_total_parts:a,bytes:bytesFromArrayBuffer(t.target.result)},{startMaxLength:r+256,fileUpload:!0})},h);n.then(function(){l++,y.resolve(),l>=a?(d.resolve(m),c=!0):(console.log(dT(),"Progress",l*r/i),d.notify({done:l*r,total:i}))},h)}},v.readAsArrayBuffer(_),y.promise})}(u,f++);return d.promise.cancel=function(){console.log("cancel upload",s,c),s||c||(s=!0,h({type:"UPLOAD_CANCELED"}))},d.promise}var g=t.when(),m={},y={},v={},_={},b={},w=5,$=0;return{getCachedFile:l,downloadFile:h,downloadSmallFile:d,saveSmallFile:p,uploadFile:f}}]),angular.module("myApp",["ngRoute","ngSanitize","ngTouch","ui.bootstrap","izhukov.utils","izhukov.mtproto","izhukov.mtproto.wrapper","myApp.filters","myApp.services","myApp.templates","myApp.directives","myApp.controllers"]).config(["$locationProvider","$routeProvider","$compileProvider","StorageProvider",function(e,t,n,i){var r,o,a,s,c,l,u,p={},d={};for(o=0;o<Config.EmojiCategories.length;o++)for(u=Config.EmojiCategorySpritesheetDimens[o][1],r=0;r<Config.EmojiCategories[o].length;r++)s=Config.Emoji[Config.EmojiCategories[o][r]],a=s[1][0],c=Math.
}]).service("AppPhotosManager",["$modal","$window","$timeout","$rootScope","MtpApiManager","MtpApiFileManager","AppUsersManager","FileManager",function(e,t,n,i,r,o,a,s){function c(e){y[e.id]=e,angular.forEach(e.sizes,function(e){"photoCachedSize"==e._&&(o.saveSmallFile(e.location,e.bytes),e.size=e.bytes.length,delete e.bytes,e._="photoSize")})}function l(e,t,n){var i={_:"photoSizeEmpty"},r=16777215;return angular.forEach(e.sizes,function(e){var o=Math.abs(e.w*e.h-t*n);r>o&&(i=e,r=o)}),i}function u(e,t,n){return r.invokeApi("photos.getUserPhotos",{user_id:e,offset:0,limit:n||20,max_id:t||0}).then(function(e){a.saveApiUsers(e.users);for(var t=[],n=0;n<e.photos.length;n++)c(e.photos[n]),t.push(e.photos[n].id);return{count:e.count||e.photos.length,photos:t}})}function p(e){if(y[e]){var n=y[e],i=$(window).width()-36,r=$(t).height()-150,a=l(n,i,r);a&&!a.preloaded&&(a.preloaded=!0,a.size?o.downloadFile(a.location.dc_id,{_:"inputFileLocation",volume_id:a.location.volume_id,local_id:a.location.local_id,secret:a.location.secret},a.size):o.downloadSmallFile(a.location))}}function d(e){return y[e]||{_:"photoEmpty"}}function h(e){var t=angular.copy(y[e])||{_:"photoEmpty"},n=Math.min(v-80,260),i=Math.min(_-100,260),r=l(t,n,i),o={placeholder:"img/placeholders/PhotoThumbConversation.gif",width:n,height:i};return r&&"photoSizeEmpty"!=r._?(r.w/r.h>n/i?o.height=parseInt(r.h*n/r.w):(o.width=parseInt(r.w*i/r.h),o.width>n&&(o.height=parseInt(o.height*n/o.width),o.width=n)),o.location=r.location,o.size=r.size):(o.width=100,o.height=100),t.thumb=o,t}function f(e){var n=h(e),i=$(window).width()-(Config.Navigator.mobile?20:36),r=$(t).height()-150,o=l(n,i,r),s={placeholder:"img/placeholders/PhotoThumbModal.gif"};return i>800&&(i-=200),s.width=i,s.height=r,o&&"photoSizeEmpty"!=o._&&(o.w/o.h>i/r?s.height=parseInt(o.h*i/o.w):(s.width=parseInt(o.w*r/o.h),s.width>i&&(s.height=parseInt(s.height*i/s.width),s.width=i)),!Config.Navigator.mobile&&s.width>=o.w&&s.height>=o.h&&(s.width=o.w,s.height=o.h),s.modalWidth=Math.max(s.width,Math.min(400,i)),s.location=o.location,s.size=o.size),n.full=s,n.fromUser=a.getUser(n.user_id),n}function g(t,n){if(!t||"0"===t)return!1;var r=i.$new(!0);r.photoID=t,0>n?r.userID=-n:r.messageID=n;e.open({templateUrl:"partials/photo_modal.html",controller:r.userID?"UserpicModalController":"PhotoModalController",scope:r,windowClass:"photo_modal_window"})}function m(e){var n=y[e],i="jpg",r="image/jpeg",a="photo"+e+"."+i,c=$(window).width()-36,u=$(t).height()-150,p=l(n,c,u),d={_:"inputFileLocation",volume_id:p.location.volume_id,local_id:p.location.local_id,secret:p.location.secret};s.chooseSave(a,i,r).then(function(e){o.downloadFile(p.location.dc_id,d,p.size,{mime:r,toFileEntry:e}).then(function(){console.log("file save done")},function(e){console.log("photo download failed",e)})},function(){o.downloadFile(p.location.dc_id,d,p.size,{mime:r}).then(function(e){s.download(e,r,a)},function(e){console.log("photo download failed",e)})})}var y={},v=$(window).width(),_=$(window).height();return i.preloadPhoto=p,i.openPhoto=g,{savePhoto:c,preloadPhoto:p,getUserPhotos:u,getPhoto:d,wrapForHistory:h,wrapForFull:f,openPhoto:g,downloadPhoto:m}}]).service("AppVideoManager",["$rootScope","$modal","$window","$timeout","MtpApiFileManager","AppUsersManager","FileManager",function(e,t,n,i,r,o,a){function s(e){d[e.id]=e,e.thumb&&"photoCachedSize"==e.thumb._&&(r.saveSmallFile(e.thumb.location,e.thumb.bytes),e.thumb.size=e.thumb.bytes.length,delete e.thumb.bytes,e.thumb._="photoSize")}function c(e){if(void 0!==h[e])return h[e];var t=angular.copy(d[e]),n=Math.min(f-80,479>=f?260:200),i=Math.min(g-100,479>=f?260:200),r=t.thumb,o={placeholder:"img/placeholders/VideoThumbConversation.gif",width:n,height:i};return r&&"photoSizeEmpty"!=r._&&(r.w/r.h>n/i?o.height=parseInt(r.h*n/r.w):(o.width=parseInt(r.w*i/r.h),o.width>n&&(o.height=parseInt(o.height*n/o.width),o.width=n)),o.location=r.location,o.size=r.size),t.thumb=o,h[e]=t}function l(e){var t=c(e),i=Math.min($(window).width()-60,542),r=$(n).height()-150,a={placeholder:"img/placeholders/VideoThumbModal.gif",wid
}function y(){if(I){var t=F,n=++U,i=0,r=20;s.getHistory(e.curDialog.inputPeer,N,i,r).then(function(i){if(t==F&&n==U){var o,a;for(o=i.history.length-1;o>=0;o--)a=i.history[o],a>N&&e.history.push(s.wrapForHistory(a));i.history.length?(N=i.history.length>=r?i.history[0]:0,s.regroupWrappedHistory(e.history,-r),e.$broadcast("ui_history_append")):N=0,e.skippedHistory=I=N>0}})}}function v(){if(D){var t=F,n=O,i=e.historyFilter.mediaType&&{_:B[e.historyFilter.mediaType]},r=Config.Navigator.mobile?20:0,o=i?s.getSearch(e.curDialog.inputPeer,"",i,P,r):s.getHistory(e.curDialog.inputPeer,P,r);o.then(function(i){t==F&&n==O&&(angular.forEach(i.history,function(t){e.history.unshift(s.wrapForHistory(t))}),D=null===i.count||i.history.length&&e.history.length<i.count,i.history.length&&(P=i.history[i.history.length-1],s.regroupWrappedHistory(e.history,i.history.length+1),e.$broadcast("ui_history_prepend")))})}}function _(t){e.missedCount=0,D=!1,e.skippedHistory=I=!1,P=0,N=0;var n=0,i=0;e.curDialog.messageID?(P=parseInt(e.curDialog.messageID),n=5,i=5):t?n=10:Config.Navigator.mobile&&(n=20);var r=++F,o=e.historyFilter.mediaType&&{_:B[e.historyFilter.mediaType]},a=o?s.getSearch(e.curDialog.inputPeer,"",o,P):s.getHistory(e.curDialog.inputPeer,P,n,i);e.state.mayBeHasMore=!0,a.then(function(t){r==F&&(N=t.unreadSkip||P&&t.history.indexOf(P)>=i-1?t.history[0]:0,P=t.history[t.history.length-1],e.skippedHistory=I=N>0,D=null===t.count||t.history.length&&t.history.length<t.count,g(),safeReplaceObject(e.state,{loaded:!0}),e.history=[],angular.forEach(t.history,function(t){var n=s.wrapForHistory(t);e.skippedHistory&&delete n.unread,e.history.push(n)}),e.history.reverse(),s.regroupWrappedHistory(e.history),t.unreadOffset?e.historyUnreadAfter=t.history[t.unreadOffset-1]:delete e.historyUnreadAfter,e.historyFocus=e.curDialog.messageID||0,e.$broadcast("ui_history_change"),s.readHistory(e.curDialog.inputPeer))},function(){safeReplaceObject(e.state,{error:!0})})}function b(){safeReplaceObject(e.state,{notSelected:!0}),e.history=[],D=!1,e.$broadcast("ui_history_change")}function w(t,n){var i=n.target,r=n.shiftKey;if(r&&e.$broadcast("ui_selection_clear"),!e.historyState.selectActions&&!$(i).hasClass("icon-select-tick")&&!$(i).hasClass("im_content_message_select_area"))return!1;if(e.selectedMsgs[t])L=!1,delete e.selectedMsgs[t],e.selectedCount--,e.selectedCount||(e.historyState.selectActions=!1,e.$broadcast("ui_panel_update"));else{if(r){if(L!=t){var o,a,s,c=L>t;for(o=0;o<e.history.length;o++)if(e.history[o].id==L){a=o;break}for(o=a;e.history[o]&&(s=e.history[o].id)!=t;)e.selectedMsgs[s]||(e.selectedMsgs[s]=!0,e.selectedCount++),o+=c?-1:1}}else L=t;e.selectedMsgs[t]=!0,e.selectedCount++,e.historyState.selectActions||(e.historyState.selectActions=!0,e.$broadcast("ui_panel_update"))}}function S(t){e.selectedMsgs={},e.selectedCount=0,e.historyState.selectActions=!1,L=!1,t||e.$broadcast("ui_panel_update")}function C(){h.confirm({type:"HISTORY_FLUSH"}).then(function(){s.flushHistory(e.curDialog.inputPeer).then(function(){S()})})}function k(){if(e.selectedCount>0){var t=[];angular.forEach(e.selectedMsgs,function(e,n){t.push(n)}),s.deleteMessages(t).then(function(){S()})}}function M(){if(e.selectedCount>0){var t=[];angular.forEach(e.selectedMsgs,function(e,n){t.push(n)}),u.selectPeer({confirm_type:"FORWARD_PEER"}).then(function(e){var n=c.getPeerID(e);s.forwardMessages(n,t).then(function(){S(),i.$broadcast("history_focus",{peerString:e})})})}}function x(){e.historyState.selectActions?S():(e.historyState.selectActions=!0,e.$broadcast("ui_panel_update"))}function T(t){e.historyFilter.mediaType=t||!1,e.history=[],_()}function A(){e.historyFilter.mediaType?T():e.curDialog.messageID?i.$broadcast("history_focus",{peerString:e.curDialog.peer}):_(!0)}e.$watch("curDialog",f),l.attach(),p.start(),d.start(),e.history=[],e.skippedHistory=!1,e.selectedMsgs={},e.selectedCount=0,e.historyState.selectActions=!1,e.missedCount=0,e.state={},e.toggleMessage=w,e.selectedDelete=k,e.selectedForward=M,e.selectedCancel=S,e.selectedFlush=C,e.toggleEdit=x,e.toggleMedia=T,e.returnToRecent=A,e.$on(
}]),angular.module("myApp.directives",["myApp.filters"]).directive("myHead",function(){return{restrict:"AE",templateUrl:"partials/head.html"}}).directive("myDialog",function(){return{restrict:"AE",templateUrl:"partials/dialog.html"}}).directive("myMessage",function(){return{templateUrl:"partials/message.html"}}).directive("myServiceMessage",function(){return{templateUrl:"partials/message_service.html"}}).directive("myMessagePhoto",function(){return{templateUrl:"partials/message_attach_photo.html"}}).directive("myMessageVideo",function(){return{templateUrl:"partials/message_attach_video.html"}}).directive("myMessageDocument",function(){return{templateUrl:"partials/message_attach_document.html"}}).directive("myMessageAudio",function(){return{templateUrl:"partials/message_attach_audio.html"}}).directive("myMessageMap",function(){return{templateUrl:"partials/message_attach_map.html"}}).directive("myMessageContact",function(){return{templateUrl:"partials/message_attach_contact.html"}}).directive("myMessagePending",function(){return{templateUrl:"partials/message_attach_pending.html"}}).directive("myDialogs",["$modalStack","$transition","$window","$timeout",function(e,t,n,i){function r(t,r,o){function a(t){if(!d&&e.getTop())return!0;if(36==t.keyCode&&!t.shiftKey&&!t.ctrlKey&&t.altKey){var n=$(c).find(".im_dialog_wrap a")[0];return n&&(n.click(),c.scrollTop=0,$(s).nanoScroller({flash:!0})),cancelEvent(t)}if(27==t.keyCode||9==t.keyCode&&t.shiftKey&&!t.ctrlKey&&!t.metaKey)return d||(l.focus(),l.value&&l.select()),cancelEvent(t);if(d&&13==t.keyCode){var n=$(c).find(".im_dialog_selected")[0]||$(c).find(".im_dialog_wrap a")[0];return n&&n.click(),cancelEvent(t)}if(38==t.keyCode||40==t.keyCode){var i=!t.shiftKey&&t.altKey;if(!i&&(!d||t.metaKey))return!0;var r,o=40==t.keyCode,n=!i&&$(c).find(".im_dialog_selected")[0]||$(c).find(".active a.im_dialog")[0],a=n&&n.parentNode;if(a){var r=n[o?"nextSibling":"previousSibling"];if(!r||!r.className||-1==r.className.indexOf("im_dialog_wrap")){var u=$(c).find(".im_dialog_wrap"),p=u.index(n.parentNode),h=p+(o?1:-1);r=u[h]}}else{var u=$(c).find(".im_dialog_wrap");r=o?u[0]:u[u.length-1]}if(i?r&&$(r).find("a")[0].click():(a&&r&&$(a).find("a").removeClass("im_dialog_selected"),r&&$(r).find("a").addClass("im_dialog_selected")),r){var f=r.offsetTop,g=r.offsetHeight,m=c.scrollTop,y=c.clientHeight;m>f?(c.scrollTop=f,$(s).nanoScroller({flash:!0})):f+g-y>m&&(c.scrollTop=f+g-y,$(s).nanoScroller({flash:!0}))}return cancelEvent(t)}}var s=$(".im_dialogs_wrap",r)[0],c=$(".im_dialogs_scrollable_wrap",r)[0],l=$(".im_dialogs_search_field",r)[0],u=$(".im_dialogs_panel",r)[0],p=$(".im_dialogs_tabs_wrap",r)[0],d=!1;$(l).on("focus blur",function(e){d="focus"==e.type,d||($(c).find(".im_dialog_selected").removeClass("im_dialog_selected"),l.value||t.$emit("ui_dialogs_search_clear"))}),t.$on("dialogs_search_toggle",function(){$(u).addClass("im_dialogs_panel_search"),t.$broadcast("ui_dialogs_search"),$(n).scrollTop(0),i(function(){l.focus()})}),t.$on("search_clear",function(){$(u).removeClass("im_dialogs_panel_search"),t.$broadcast("ui_dialogs_search")}),o.$observe("hasTabs",function(e){e="true"==e,$(p).toggle(e),t.$broadcast("ui_dialogs_tabs",e)}),$(document).on("keydown",a),t.$on("$destroy",function(){$(document).off("keydown",a)})}return{link:r}}]).directive("myDialogsList",["$window","$timeout",function(e,t){function n(n,i,r){function o(){return r.modal?($(i).css({height:$(e).height()-(Config.Navigator.mobile?100:200)}),void f()):(l&&l.offsetHeight||(l=$(".tg_page_head")[0]),p&&p.offsetHeight||(p=$(".im_page_footer")[0]),u&&u.offsetHeight||(u=$(".im_dialogs_panel")[0]),s&&s.offsetHeight||(s=$(".im_dialogs_col_wrap")[0]),$(i).css({height:$(e).height()-p.offsetHeight-(l?l.offsetHeight:44)-(u?u.offsetHeight:58)-parseInt($(s).css("paddingBottom")||0)}),void f())}var a=$(".im_dialogs_wrap",i)[0],s=$(".im_dialogs_col_wrap")[0],c=$(".im_dialogs_scrollable_wrap",i)[0],l=$(".tg_page_head")[0],u=$(".im_dialogs_panel")[0],p=$(".im_page_footer")[0],d=!1,h=!1;onContentLoaded(function(){$(a).nanoScroller({preventPageScrolling:!0,tabI