Skip to content

Instantly share code, notes, and snippets.

@hakimelek
Last active January 30, 2017 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakimelek/8468b9908a556234e4210b896c358f89 to your computer and use it in GitHub Desktop.
Save hakimelek/8468b9908a556234e4210b896c358f89 to your computer and use it in GitHub Desktop.
<script src="script.js"></script>
<div id="now" data-username="hakimelek"></div>
!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.DDP=e()}(this,function(){"use strict";var t=function(){var t=0;return function(){return(t++).toString()}}(),e='{"server_id":"0"}',n=10,i=300,r=1e4,o=["added","changed","connected","error","failed","nosub","ready","removed","result","updated","ping","pong"],s="1",a=function(t){this._endpoint=t.endpoint,this._SocketConstructor=t.SocketConstructor,this._autoreconnect=!t.do_not_autoreconnect,this._ping_interval=t._ping_interval||r,this._socketInterceptFunction=t.socketInterceptFunction,this._onReadyCallbacks={},this._onStopCallbacks={},this._onErrorCallbacks={},this._onResultCallbacks={},this._onUpdatedCallbacks={},this._events={},this._queue=[],this.readyState=-1,this._reconnect_count=0,this._reconnect_incremental_timer=0,t.do_not_autoconnect||this.connect()};return a.prototype.constructor=a,a.prototype.connect=function(){this.readyState=0,this._socket=new this._SocketConstructor(this._endpoint),this._socket.onopen=this._on_socket_open.bind(this),this._socket.onmessage=this._on_socket_message.bind(this),this._socket.onerror=this._on_socket_error.bind(this),this._socket.onclose=this._on_socket_close.bind(this)},a.prototype.method=function(e,n,i,r){var o=t();return this._onResultCallbacks[o]=i,this._onUpdatedCallbacks[o]=r,this._send({msg:"method",id:o,method:e,params:n}),o},a.prototype.sub=function(e,n,i,r,o){var s=t();return this._onReadyCallbacks[s]=i,this._onStopCallbacks[s]=r,this._onErrorCallbacks[s]=o,this._send({msg:"sub",id:s,name:e,params:n}),s},a.prototype.unsub=function(t){return this._send({msg:"unsub",id:t}),t},a.prototype.on=function(t,e){this._events[t]=this._events[t]||[],this._events[t].push(e)},a.prototype.off=function(t,e){if(this._events[t]){var n=this._events[t].indexOf(e);-1!==n&&this._events[t].splice(n,1)}},a.prototype._emit=function(t){if(this._events[t]){var e=arguments,n=this;this._events[t].forEach(function(t){t.apply(n,Array.prototype.slice.call(e,1))})}},a.prototype._send=function(t){if(1!==this.readyState&&"connect"!==t.msg)return void this._queue.push(t);var e;e="undefined"==typeof EJSON?JSON.stringify(t):EJSON.stringify(t),this._socketInterceptFunction&&this._socketInterceptFunction({type:"socket_message_sent",message:e,timestamp:Date.now()}),this._socket.send(e)},a.prototype._try_reconnect=function(){this._reconnect_count<n?(setTimeout(this.connect.bind(this),this._reconnect_incremental_timer),this._reconnect_count+=1,this._reconnect_incremental_timer+=i*this._reconnect_count):setTimeout(this.connect.bind(this),this._reconnect_incremental_timer)},a.prototype._on_result=function(t){if(this._onResultCallbacks[t.id])this._onResultCallbacks[t.id](t.error,t.result),delete this._onResultCallbacks[t.id],t.error&&delete this._onUpdatedCallbacks[t.id];else if(t.error)throw delete this._onUpdatedCallbacks[t.id],t.error},a.prototype._on_updated=function(t){var e=this;t.methods.forEach(function(t){e._onUpdatedCallbacks[t]&&(e._onUpdatedCallbacks[t](),delete e._onUpdatedCallbacks[t])})},a.prototype._on_nosub=function(t){if(t.error){if(!this._onErrorCallbacks[t.id])throw delete this._onReadyCallbacks[t.id],delete this._onStopCallbacks[t.id],new Error(t.error);return this._onErrorCallbacks[t.id](t.error),delete this._onReadyCallbacks[t.id],delete this._onStopCallbacks[t.id],void delete this._onErrorCallbacks[t.id]}this._onStopCallbacks[t.id]&&this._onStopCallbacks[t.id](),delete this._onReadyCallbacks[t.id],delete this._onStopCallbacks[t.id],delete this._onErrorCallbacks[t.id]},a.prototype._on_ready=function(t){var e=this;t.subs.forEach(function(t){e._onReadyCallbacks[t]&&(e._onReadyCallbacks[t](),delete e._onReadyCallbacks[t])})},a.prototype._on_error=function(t){this._emit("error",t)},a.prototype._on_connected=function(e){var n=this,i=0===n._reconnect_count,r=i?"connected":"reconnected";n.readyState=1,n._reconnect_count=0,n._reconnect_incremental_timer=0;for(var o=n._queue.length,s=0;o>s;s++)n._send(n._queue.shift());n._emit(r,e),n._ping_interval_handle=setInterval(function(){var e=t();n._send({msg:"ping",id:e})},n._ping_interval)},a.prototype._on_failed=function(t){this.readyState=4,this._emit("failed",t)},a.prototype._on_added=function(t){this._emit("added",t)},a.prototype._on_removed=function(t){this._emit("removed",t)},a.prototype._on_changed=function(t){this._emit("changed",t)},a.prototype._on_ping=function(t){this._send({msg:"pong",id:t.id})},a.prototype._on_pong=function(t){},a.prototype._on_socket_close=function(){this._socketInterceptFunction&&this._socketInterceptFunction({type:"socket_close",timestamp:Date.now()}),clearInterval(this._ping_interval_handle),this.readyState=4,this._emit("socket_close"),this._autoreconnect&&this._try_reconnect()},a.prototype._on_socket_error=function(t){this._socketInterceptFunction&&this._socketInterceptFunction({type:"socket_error",error:JSON.stringify(t),timestamp:Date.now()}),clearInterval(this._ping_interval_handle),this.readyState=4,this._emit("socket_error",t)},a.prototype._on_socket_open=function(){this._socketInterceptFunction&&this._socketInterceptFunction({type:"socket_open",timestamp:Date.now()}),this._send({msg:"connect",version:s,support:[s]})},a.prototype._on_socket_message=function(t){this._socketInterceptFunction&&this._socketInterceptFunction({type:"socket_message_received",message:t.data,timestamp:Date.now()});var n;if(t.data!==e){try{if(n="undefined"==typeof EJSON?JSON.parse(t.data):EJSON.parse(t.data),-1===o.indexOf(n.msg))throw new Error}catch(i){return console.warn("Non DDP message received:"),void console.warn(t.data)}this["_on_"+n.msg](n)}},a}),function(t){if("function"==typeof bootstrap)bootstrap("promise",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=t}else Q=t()}(function(){"use strict";function t(t){return function(){return z.apply(t,arguments)}}function e(t){return t===Object(t)}function n(t){return"[object StopIteration]"===et(t)||t instanceof G}function i(t,e){if(N&&e.stack&&"object"==typeof t&&null!==t&&t.stack&&-1===t.stack.indexOf(nt)){for(var n=[],i=e;i;i=i.source)i.stack&&n.unshift(i.stack);n.unshift(t.stack);var o=n.join("\n"+nt+"\n");t.stack=r(o)}}function r(t){for(var e=t.split("\n"),n=[],i=0;i<e.length;++i){var r=e[i];a(r)||o(r)||!r||n.push(r)}return n.join("\n")}function o(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function s(t){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);if(e)return[e[1],Number(e[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(t);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(t);return i?[i[1],Number(i[2])]:void 0}function a(t){var e=s(t);if(!e)return!1;var n=e[0],i=e[1];return n===H&&i>=V&&st>=i}function u(){if(N)try{throw new Error}catch(t){var e=t.stack.split("\n"),n=e[0].indexOf("@")>0?e[1]:e[2],i=s(n);if(!i)return;return H=i[0],i[1]}}function c(t,e,n){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(e+" is deprecated, use "+n+" instead.",new Error("").stack),t.apply(t,arguments)}}function l(t){return y(t)?t:g(t)?O(t):Y(t)}function d(){function t(t){e=t,o.source=t,$(n,function(e,n){J(function(){t.promiseDispatch.apply(t,n)})},void 0),n=void 0,i=void 0}var e,n=[],i=[],r=X(d.prototype),o=X(p.prototype);if(o.promiseDispatch=function(t,r,o){var s=Z(arguments);n?(n.push(s),"when"===r&&o[1]&&i.push(o[1])):J(function(){e.promiseDispatch.apply(e,s)})},o.valueOf=function(){if(n)return o;var t=m(e);return y(t)&&(e=t),t},o.inspect=function(){return e?e.inspect():{state:"pending"}},l.longStackSupport&&N)try{throw new Error}catch(s){o.stack=s.stack.substring(s.stack.indexOf("\n")+1)}return r.promise=o,r.resolve=function(n){e||t(l(n))},r.fulfill=function(n){e||t(Y(n))},r.reject=function(n){e||t(M(n))},r.notify=function(t){e||$(i,function(e,n){J(function(){n(t)})},void 0)},r}function h(t){if("function"!=typeof t)throw new TypeError("resolver must be a function.");var e=d();try{t(e.resolve,e.reject,e.notify)}catch(n){e.reject(n)}return e.promise}function f(t){return h(function(e,n){for(var i=0,r=t.length;r>i;i++)l(t[i]).then(e,n)})}function p(t,e,n){void 0===e&&(e=function(t){return M(new Error("Promise does not support operation: "+t))}),void 0===n&&(n=function(){return{state:"unknown"}});var i=X(p.prototype);if(i.promiseDispatch=function(n,r,o){var s;try{s=t[r]?t[r].apply(i,o):e.call(i,r,o)}catch(a){s=M(a)}n&&n(s)},i.inspect=n,n){var r=n();"rejected"===r.state&&(i.exception=r.reason),i.valueOf=function(){var t=n();return"pending"===t.state||"rejected"===t.state?i:t.value}}return i}function _(t,e,n,i){return l(t).then(e,n,i)}function m(t){if(y(t)){var e=t.inspect();if("fulfilled"===e.state)return e.value}return t}function y(t){return e(t)&&"function"==typeof t.promiseDispatch&&"function"==typeof t.inspect}function g(t){return e(t)&&"function"==typeof t.then}function v(t){return y(t)&&"pending"===t.inspect().state}function k(t){return!y(t)||"fulfilled"===t.inspect().state}function w(t){return y(t)&&"rejected"===t.inspect().state}function S(){it.length=0,rt.length=0,ot||(ot=!0)}function b(t,e){ot&&(rt.push(t),e&&"undefined"!=typeof e.stack?it.push(e.stack):it.push("(no stack) "+e))}function D(t){if(ot){var e=q(rt,t);-1!==e&&(rt.splice(e,1),it.splice(e,1))}}function M(t){var e=p({when:function(e){return e&&D(this),e?e(t):this}},function(){return this},function(){return{state:"rejected",reason:t}});return b(e,t),e}function Y(t){return p({when:function(){return t},get:function(e){return t[e]},set:function(e,n){t[e]=n},"delete":function(e){delete t[e]},post:function(e,n){return null===e||void 0===e?t.apply(void 0,n):t[e].apply(t,n)},apply:function(e,n){return t.apply(e,n)},keys:function(){return tt(t)}},void 0,function(){return{state:"fulfilled",value:t}})}function O(t){var e=d();return J(function(){try{t.then(e.resolve,e.reject,e.notify)}catch(n){e.reject(n)}}),e.promise}function x(t){return p({isDef:function(){}},function(e,n){return E(t,e,n)},function(){return l(t).inspect()})}function T(t,e,n){return l(t).spread(e,n)}function R(t){return function(){function e(t,e){var s;if("undefined"==typeof StopIteration){try{s=i[t](e)}catch(a){return M(a)}return s.done?s.value:_(s.value,r,o)}try{s=i[t](e)}catch(a){return n(a)?a.value:M(a)}return _(s,r,o)}var i=t.apply(this,arguments),r=e.bind(e,"next"),o=e.bind(e,"throw");return r()}}function C(t){l.done(l.async(t)())}function j(t){throw new G(t)}function P(t){return function(){return T([this,I(arguments)],function(e,n){return t.apply(e,n)})}}function E(t,e,n){return l(t).dispatch(e,n)}function I(t){return _(t,function(t){var e=0,n=d();return $(t,function(i,r,o){var s;y(r)&&"fulfilled"===(s=r.inspect()).state?t[o]=s.value:(++e,_(r,function(i){t[o]=i,0===--e&&n.resolve(t)},n.reject,function(t){n.notify({index:o,value:t})}))},void 0),0===e&&n.resolve(t),n.promise})}function W(t){return _(t,function(t){return t=B(t,l),_(I(B(t,function(t){return _(t,Q,Q)})),function(){return t})})}function F(t){return l(t).allSettled()}function U(t,e){return l(t).then(void 0,void 0,e)}function L(t,e){return l(t).nodeify(e)}var N=!1;try{throw new Error}catch(A){N=!!A.stack}var H,G,V=u(),Q=function(){},J=function(){function t(){for(;e.next;){e=e.next;var n=e.task;e.task=void 0;var r=e.domain;r&&(e.domain=void 0,r.enter());try{n()}catch(s){if(o)throw r&&r.exit(),setTimeout(t,0),r&&r.enter(),s;setTimeout(function(){throw s},0)}r&&r.exit()}i=!1}var e={task:void 0,next:null},n=e,i=!1,r=void 0,o=!1;if(J=function(t){n=n.next={task:t,domain:o&&process.domain,next:null},i||(i=!0,r())},"undefined"!=typeof process&&process.nextTick)o=!0,r=function(){process.nextTick(t)};else if("function"==typeof setImmediate)r="undefined"!=typeof window?setImmediate.bind(window,t):function(){setImmediate(t)};else if("undefined"!=typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=function(){r=a,s.port1.onmessage=t,t()};var a=function(){s.port2.postMessage(0)};r=function(){setTimeout(t,0),a()}}else r=function(){setTimeout(t,0)};return J}(),z=Function.call,Z=t(Array.prototype.slice),$=t(Array.prototype.reduce||function(t,e){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){e=this[n++];break}if(++n>=i)throw new TypeError}for(;i>n;n++)n in this&&(e=t(e,this[n],n));return e}),q=t(Array.prototype.indexOf||function(t){for(var e=0;e<this.length;e++)if(this[e]===t)return e;return-1}),B=t(Array.prototype.map||function(t,e){var n=this,i=[];return $(n,function(r,o,s){i.push(t.call(e,o,s,n))},void 0),i}),X=Object.create||function(t){function e(){}return e.prototype=t,new e},K=t(Object.prototype.hasOwnProperty),tt=Object.keys||function(t){var e=[];for(var n in t)K(t,n)&&e.push(n);return e},et=t(Object.prototype.toString);G="undefined"!=typeof ReturnValue?ReturnValue:function(t){this.value=t};var nt="From previous event:";l.resolve=l,l.nextTick=J,l.longStackSupport=!1,l.defer=d,d.prototype.makeNodeResolver=function(){var t=this;return function(e,n){e?t.reject(e):arguments.length>2?t.resolve(Z(arguments,1)):t.resolve(n)}},l.Promise=h,l.promise=h,h.race=f,h.all=I,h.reject=M,h.resolve=l,l.passByCopy=function(t){return t},p.prototype.passByCopy=function(){return this},l.join=function(t,e){return l(t).join(e)},p.prototype.join=function(t){return l([this,t]).spread(function(t,e){if(t===e)return t;throw new Error("Can't join: not the same: "+t+" "+e)})},l.race=f,p.prototype.race=function(){return this.then(l.race)},l.makePromise=p,p.prototype.toString=function(){return"[object Promise]"},p.prototype.then=function(t,e,n){function r(e){try{return"function"==typeof t?t(e):e}catch(n){return M(n)}}function o(t){if("function"==typeof e){i(t,a);try{return e(t)}catch(n){return M(n)}}return M(t)}function s(t){return"function"==typeof n?n(t):t}var a=this,u=d(),c=!1;return J(function(){a.promiseDispatch(function(t){c||(c=!0,u.resolve(r(t)))},"when",[function(t){c||(c=!0,u.resolve(o(t)))}])}),a.promiseDispatch(void 0,"when",[void 0,function(t){var e,n=!1;try{e=s(t)}catch(i){if(n=!0,!l.onerror)throw i;l.onerror(i)}n||u.notify(e)}]),u.promise},l.when=_,p.prototype.thenResolve=function(t){return this.then(function(){return t})},l.thenResolve=function(t,e){return l(t).thenResolve(e)},p.prototype.thenReject=function(t){return this.then(function(){throw t})},l.thenReject=function(t,e){return l(t).thenReject(e)},l.nearer=m,l.isPromise=y,l.isPromiseAlike=g,l.isPending=v,p.prototype.isPending=function(){return"pending"===this.inspect().state},l.isFulfilled=k,p.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},l.isRejected=w,p.prototype.isRejected=function(){return"rejected"===this.inspect().state};var it=[],rt=[],ot=!0;l.resetUnhandledRejections=S,l.getUnhandledReasons=function(){return it.slice()},l.stopUnhandledRejectionTracking=function(){S(),ot=!1},S(),l.reject=M,l.fulfill=Y,l.master=x,l.spread=T,p.prototype.spread=function(t,e){return this.all().then(function(e){return t.apply(void 0,e)},e)},l.async=R,l.spawn=C,l["return"]=j,l.promised=P,l.dispatch=E,p.prototype.dispatch=function(t,e){var n=this,i=d();return J(function(){n.promiseDispatch(i.resolve,t,e)}),i.promise},l.get=function(t,e){return l(t).dispatch("get",[e])},p.prototype.get=function(t){return this.dispatch("get",[t])},l.set=function(t,e,n){return l(t).dispatch("set",[e,n])},p.prototype.set=function(t,e){return this.dispatch("set",[t,e])},l.del=l["delete"]=function(t,e){return l(t).dispatch("delete",[e])},p.prototype.del=p.prototype["delete"]=function(t){return this.dispatch("delete",[t])},l.mapply=l.post=function(t,e,n){return l(t).dispatch("post",[e,n])},p.prototype.mapply=p.prototype.post=function(t,e){return this.dispatch("post",[t,e])},l.send=l.mcall=l.invoke=function(t,e){return l(t).dispatch("post",[e,Z(arguments,2)])},p.prototype.send=p.prototype.mcall=p.prototype.invoke=function(t){return this.dispatch("post",[t,Z(arguments,1)])},l.fapply=function(t,e){return l(t).dispatch("apply",[void 0,e])},p.prototype.fapply=function(t){return this.dispatch("apply",[void 0,t])},l["try"]=l.fcall=function(t){return l(t).dispatch("apply",[void 0,Z(arguments,1)])},p.prototype.fcall=function(){return this.dispatch("apply",[void 0,Z(arguments)])},l.fbind=function(t){var e=l(t),n=Z(arguments,1);return function(){return e.dispatch("apply",[this,n.concat(Z(arguments))])}},p.prototype.fbind=function(){var t=this,e=Z(arguments);return function(){return t.dispatch("apply",[this,e.concat(Z(arguments))])}},l.keys=function(t){return l(t).dispatch("keys",[])},p.prototype.keys=function(){return this.dispatch("keys",[])},l.all=I,p.prototype.all=function(){return I(this)},l.allResolved=c(W,"allResolved","allSettled"),p.prototype.allResolved=function(){return W(this)},l.allSettled=F,p.prototype.allSettled=function(){return this.then(function(t){return I(B(t,function(t){function e(){return t.inspect()}return t=l(t),t.then(e,e)}))})},l.fail=l["catch"]=function(t,e){return l(t).then(void 0,e)},p.prototype.fail=p.prototype["catch"]=function(t){return this.then(void 0,t)},l.progress=U,p.prototype.progress=function(t){return this.then(void 0,void 0,t)},l.fin=l["finally"]=function(t,e){return l(t)["finally"](e)},p.prototype.fin=p.prototype["finally"]=function(t){return t=l(t),this.then(function(e){return t.fcall().then(function(){return e})},function(e){return t.fcall().then(function(){throw e})})},l.done=function(t,e,n,i){return l(t).done(e,n,i)},p.prototype.done=function(t,e,n){var r=function(t){J(function(){if(i(t,o),!l.onerror)throw t;l.onerror(t)})},o=t||e||n?this.then(t,e,n):this;"object"==typeof process&&process&&process.domain&&(r=process.domain.bind(r)),o.then(void 0,r)},l.timeout=function(t,e,n){return l(t).timeout(e,n)},p.prototype.timeout=function(t,e){var n=d(),i=setTimeout(function(){n.reject(new Error(e||"Timed out after "+t+" ms"))},t);return this.then(function(t){clearTimeout(i),n.resolve(t)},function(t){clearTimeout(i),n.reject(t)},n.notify),n.promise},l.delay=function(t,e){return void 0===e&&(e=t,t=void 0),l(t).delay(e)},p.prototype.delay=function(t){return this.then(function(e){var n=d();return setTimeout(function(){n.resolve(e)},t),n.promise})},l.nfapply=function(t,e){return l(t).nfapply(e)},p.prototype.nfapply=function(t){var e=d(),n=Z(t);return n.push(e.makeNodeResolver()),this.fapply(n).fail(e.reject),e.promise},l.nfcall=function(t){var e=Z(arguments,1);return l(t).nfapply(e)},p.prototype.nfcall=function(){var t=Z(arguments),e=d();return t.push(e.makeNodeResolver()),this.fapply(t).fail(e.reject),e.promise},l.nfbind=l.denodeify=function(t){var e=Z(arguments,1);return function(){var n=e.concat(Z(arguments)),i=d();return n.push(i.makeNodeResolver()),l(t).fapply(n).fail(i.reject),i.promise}},p.prototype.nfbind=p.prototype.denodeify=function(){var t=Z(arguments);return t.unshift(this),l.denodeify.apply(void 0,t)},l.nbind=function(t,e){var n=Z(arguments,2);return function(){function i(){return t.apply(e,arguments)}var r=n.concat(Z(arguments)),o=d();return r.push(o.makeNodeResolver()),l(i).fapply(r).fail(o.reject),o.promise}},p.prototype.nbind=function(){var t=Z(arguments,0);return t.unshift(this),l.nbind.apply(void 0,t)},l.nmapply=l.npost=function(t,e,n){return l(t).npost(e,n)},p.prototype.nmapply=p.prototype.npost=function(t,e){var n=Z(e||[]),i=d();return n.push(i.makeNodeResolver()),this.dispatch("post",[t,n]).fail(i.reject),i.promise},l.nsend=l.nmcall=l.ninvoke=function(t,e){var n=Z(arguments,2),i=d();return n.push(i.makeNodeResolver()),l(t).dispatch("post",[e,n]).fail(i.reject),i.promise},p.prototype.nsend=p.prototype.nmcall=p.prototype.ninvoke=function(t){var e=Z(arguments,1),n=d();return e.push(n.makeNodeResolver()),this.dispatch("post",[t,e]).fail(n.reject),n.promise},l.nodeify=L,p.prototype.nodeify=function(t){return t?void this.then(function(e){J(function(){t(null,e)})},function(e){J(function(){t(e)})}):this};var st=u();return l}),function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.Asteroid=e()}(this,function(){"use strict";var t=function(e,n,i,r){t.utils.must.beString(e),this._instanceId=r||"0",this._host=(n?"https://":"http://")+e,this.collections={},this.subscriptions={},this._subscriptionsCache={},this._setDdpOptions(e,n,i),this._init()};t.utils||(t.utils={}),t.utils.btoa=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=function(e){return t.charAt(e)},n=function(t){for(var e=[],n=0;t>n;n++)e.push(0);return e};return function(t){if("string"==typeof t){var i=t;t=n(i.length);for(var r=0;r<i.length;r++){var o=i.charCodeAt(r);if(o>255)throw new Error("Not ascii. Base64.encode can only take ascii strings");t[r]=o}}for(var s=[],a=null,u=null,c=null,l=null,d=0;d<t.length;d++)switch(d%3){case 0:a=t[d]>>2&63,u=(3&t[d])<<4;break;case 1:u|=t[d]>>4&15,c=(15&t[d])<<2;break;case 2:c|=t[d]>>6&3,l=63&t[d],s.push(e(a)),s.push(e(u)),s.push(e(c)),s.push(e(l)),a=null,u=null,c=null,l=null}return null!==a&&(s.push(e(a)),s.push(e(u)),null===c?s.push("="):s.push(e(c)),null===l&&s.push("=")),s.join("")}}(),t.utils||(t.utils={}),t.utils.clone=function(t){if("undefined"!=typeof EJSON)return EJSON.clone(t);var e=typeof t;switch(e){case"undefined":case"function":return;case"string":case"number":case"boolean":return t;case"object":return null===t?null:JSON.parse(JSON.stringify(t));default:return}},t.utils||(t.utils={}),t.utils.EventEmitter=function(){},t.utils.EventEmitter.prototype={constructor:t.utils.EventEmitter,on:function(t,e){this._events||(this._events={}),this._events[t]=this._events[t]||[],this._events[t].push(e)},off:function(t,e){this._events||(this._events={}),this._events[t]&&this._events[t].splice(this._events[t].indexOf(e),1)},_emit:function(t){if(this._events||(this._events={}),this._events[t]){var e=arguments,n=this;this._events[t].forEach(function(t){t.apply(n,Array.prototype.slice.call(e,1))})}}},t.utils||(t.utils={}),t.utils.getFilterFromSelector=function(e){var n=function(t,e){return e.split(".").reduce(function(t,e){return t?t=t[e]:t},t)},r=Object.keys(e),o=r.map(function(i){var r;return"$and"===i?(r=e[i].map(t.utils.getFilterFromSelector),function(t){return r.reduce(function(e,n){return e?n(t):e},!0)}):"$or"===i?(r=e[i].map(t.utils.getFilterFromSelector),function(t){return r.reduce(function(e,n){return e?e:n(t)},!1)}):"$nor"===i?(r=e[i].map(t.utils.getFilterFromSelector),function(t){return r.reduce(function(e,n){return e?!n(t):e},!0)}):function(t){var r=n(t,i);return r===e[i]}});return function(t){return t._id&&i(t._id)?!1:o.reduce(function(e,n){return e?n(t):e},!0)}},t.utils||(t.utils={}),t.utils.formQs=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n])+"&");return e=e.slice(0,-1)},t.utils||(t.utils={}),t.utils.getOauthState=function(e){var n={loginStyle:"popup",credentialToken:e,isCordova:!1};return t.utils.btoa(JSON.stringify(n))},t.utils||(t.utils={}),t.utils.guid=function(){for(var t="",e=0;8>e;e++)t+=Math.floor(65536*(1+Math.random())).toString(16).substring(1);return t},t.utils||(t.utils={}),t.utils.isEmail=function(t){return-1!==t.indexOf("@")},t.utils||(t.utils={}),t.utils.isEqual=function(t,e){var n=JSON.stringify(t),i=JSON.stringify(e);return n===i},t.utils||(t.utils={}),t.utils.multiStorage={},t.utils||(t.utils={}),t.utils.must={_toString:function(t){return Object.prototype.toString.call(t).slice(8,-1)},beString:function(t){var e=this._toString(t);if("String"!==e)throw new Error("Assertion failed: expected String, instead got "+e)},beArray:function(t){var e=this._toString(t);if("Array"!==e)throw new Error("Assertion failed: expected Array, instead got "+e)},beObject:function(t){var e=this._toString(t);if("Object"!==e)throw new Error("Assertion failed: expected Object, instead got "+e)}},t.prototype=Object.create(t.utils.EventEmitter.prototype),t.prototype.constructor=t,t.prototype._init=function(){var t=this;t.ddp=new DDP(this._ddpOptions),t.ddp.on("connected",function(){t.resumeLoginPromise=t._tryResumeLogin(),t.subscribe("meteor.loginServiceConfiguration"),t._emit("connected")}),t.ddp.on("reconnected",function(){t.resumeLoginPromise=t._tryResumeLogin(),t._reEstablishSubscriptions(),t._emit("reconnected")}),t.ddp.on("added",function(e){t._onAdded(e)}),t.ddp.on("changed",function(e){t._onChanged(e)}),t.ddp.on("removed",function(e){t._onRemoved(e)})},t.prototype._onAdded=function(e){var n=e.collection;this.collections[n]||(this.collections[n]=new t._Collection(n,this));var i=e.fields||{};i._id=e.id,this.collections[n]._remoteToLocalInsert(i)},t.prototype._onRemoved=function(t){this.collections[t.collection]&&this.collections[t.collection]._remoteToLocalRemove(t.id)},t.prototype._onChanged=function(t){this.collections[t.collection]&&(t.fields||(t.fields={}),t.cleared&&t.cleared.forEach(function(e){t.fields[e]=void 0}),this.collections[t.collection]._remoteToLocalUpdate(t.id,t.fields))},t.prototype.call=function(e){t.utils.must.beString(e);var n=Array.prototype.slice.call(arguments,1);return this.apply(e,n)},t.prototype.apply=function(e,n){t.utils.must.beString(e),Array.isArray(n)||(n=[]);var i=Q.defer(),r=Q.defer(),o=function(t,e){t?(i.reject(t),r.reject()):i.resolve(e)},s=function(){r.resolve()};return this.ddp.method(e,n,o,s),{result:i.promise,updated:r.promise}},t.prototype.getCollection=function(e){return t.utils.must.beString(e),this.collections[e]||(this.collections[e]=new t._Collection(e,this)),this.collections[e]};var e="__del__",n="__upd__",i=function(t){var i=e.length,r=n.length,o=t.slice(-1*i),s=t.slice(-1*r);return o===e||s===n},r=function(t,e){this.name=t,this.asteroid=e,this._set=new s};r.prototype.constructor=r,r.prototype._localToLocalInsert=function(t){if(this._set.contains(t._id))throw new Error("Item "+t._id+" already exists");return this._set.put(t._id,t),Q(t._id)},r.prototype._remoteToLocalInsert=function(t){this._set.put(t._id,t)},r.prototype._localToRemoteInsert=function(t){var e=this,n=Q.defer(),i="/"+e.name+"/insert";return e.asteroid.ddp.method(i,[t],function(i,r){i?(e._set.del(t._id),n.reject(i)):n.resolve(t._id)}),n.promise},r.prototype.insert=function(e){return e._id||(e._id=t.utils.guid()),{local:this._localToLocalInsert(e),remote:this._localToRemoteInsert(e)}},r.prototype._localToLocalRemove=function(t){var n=this._set.get(t);return n&&(this._set.put(t+e,n),this._set.del(t)),Q(t)},r.prototype._remoteToLocalRemove=function(t){this._set.del(t)},r.prototype._localToRemoteRemove=function(t){var n=this,i=Q.defer(),r="/"+n.name+"/remove";return n.asteroid.ddp.method(r,[{_id:t}],function(r,o){if(r){var s=n._set.get(t+e);s&&(n._set.put(t,s),n._set.del(t+e)),i.reject(r)}else n._set.del(t+e),i.resolve(t)}),i.promise},r.prototype.remove=function(t){return{local:this._localToLocalRemove(t),remote:this._localToRemoteRemove(t)}},r.prototype._localToLocalUpdate=function(t,e){var i=this._set.get(t);if(!i)throw new Error("Item "+t+" doesn't exist");if(e._id&&e._id!==t)throw new Error("Modifying the _id of a document is not allowed");this._set.put(t+n,i);for(var r in e)e.hasOwnProperty(r)&&(i[r]=e[r]);return this._set.put(t,i),Q(t)},r.prototype._remoteToLocalUpdate=function(t,e){var n=this._set.get(t);if(!n)return void console.warn("Server misbehaviour: item "+t+" doesn't exist");for(var i in e){if("_id"===i&&e._id!==t)return void console.warn("Server misbehaviour: modifying the _id of a document is not allowed");n[i]=e[i]}this._set.put(t,n)},r.prototype._localToRemoteUpdate=function(t,e){var i=this,r=Q.defer(),o="/"+i.name+"/update",s={_id:t},a={$set:e};return i.asteroid.ddp.method(o,[s,a],function(e,o){if(e){var s=i._set.get(t+n);i._set.put(t,s),i._set.del(t+n),r.reject(e)}else i._set.del(t+n),r.resolve(t)}),r.promise},r.prototype.update=function(t,e){return{local:this._localToLocalUpdate(t,e),remote:this._localToRemoteUpdate(t,e)}};var o=function(t){var e=this;e.result=[],e._set=t,e._getResult(),e._set.on("put",function(t){e._getResult(),e._emit("change",t)}),e._set.on("del",function(t){e._getResult(),e._emit("change",t)})};o.prototype=Object.create(t.utils.EventEmitter.prototype),o.constructor=o,o.prototype._getResult=function(){this.result=this._set.toArray()},r.prototype.reactiveQuery=function(e){var n;n="function"==typeof e?e:t.utils.getFilterFromSelector(e);var i=this._set.filter(n);return new o(i)},t._Collection=r,t.prototype._getOauthClientId=function(t){var e="meteor_accounts_loginServiceConfiguration",n=this.collections[e],i=n.reactiveQuery({service:t}).result[0];return i.clientId||i.consumerKey||i.appId},t.prototype._loginAfterCredentialSecretReceived=function(e){var n=this,i=Q.defer(),r={oauth:e};return n.ddp.method("login",[r],function(e,r){e?(delete n.userId,delete n.loggedIn,t.utils.multiStorage.del(n._host+"__"+n._instanceId+"__login_token__"),i.reject(e),n._emit("loginError",e)):(n.userId=r.id,n.loggedIn=!0,t.utils.multiStorage.set(n._host+"__"+n._instanceId+"__login_token__",r.token),n._emit("login",r.id),i.resolve(r.id))}),i.promise},t.prototype._connectAfterCredentialSecretReceived=function(t){var e=Q.defer(),n={oauth:t};return this.ddp.method("addLoginService",[n],function(t,n){t?e.reject(t):e.resolve()}),e.promise},t.prototype._tryResumeLogin=function(){var e=this;return Q().then(function(){return t.utils.multiStorage.get(e._host+"__"+e._instanceId+"__login_token__")}).then(function(t){if(!t)throw new Error("No login token");return t}).then(function(n){var i=Q.defer(),r={resume:n};return e.ddp.method("login",[r],function(n,r){n?(delete e.userId,delete e.loggedIn,t.utils.multiStorage.del(e._host+"__"+e._instanceId+"__login_token__"),e._emit("loginError",n),i.reject(n)):(e.userId=r.id,e.loggedIn=!0,t.utils.multiStorage.set(e._host+"__"+e._instanceId+"__login_token__",r.token),e._emit("login",r.id),i.resolve(r.id))}),i.promise})},t.prototype.createUser=function(e,n,i){var r,o=this,s=Q.defer();return"string"==typeof e?r={username:t.utils.isEmail(e)?void 0:e,email:t.utils.isEmail(e)?e:void 0,password:n,profile:i}:"object"==typeof e&&(r=e),o.ddp.method("createUser",[r],function(e,n){e?(o._emit("createUserError",e),s.reject(e)):(o.userId=n.id,o.loggedIn=!0,t.utils.multiStorage.set(o._host+"__"+o._instanceId+"__login_token__",n.token),o._emit("createUser",n.id),o._emit("login",n.id),s.resolve(n.id))}),s.promise},t.prototype.loginWithPassword=function(e,n){var i=this,r=Q.defer(),o={password:n,user:{username:t.utils.isEmail(e)?void 0:e,email:t.utils.isEmail(e)?e:void 0}};return i.ddp.method("login",[o],function(e,n){e?(delete i.userId,delete i.loggedIn,t.utils.multiStorage.del(i._host+"__"+i._instanceId+"__login_token__"),r.reject(e),i._emit("loginError",e)):(i.userId=n.id,i.loggedIn=!0,t.utils.multiStorage.set(i._host+"__"+i._instanceId+"__login_token__",n.token),i._emit("login",n.id),r.resolve(n.id))}),r.promise},t.prototype.logout=function(){var e=this,n=Q.defer();return e.ddp.method("logout",[],function(i){i?(e._emit("logoutError",i),n.reject(i)):(delete e.userId,delete e.loggedIn,t.utils.multiStorage.del(e._host+"__"+e._instanceId+"__login_token__"),e._emit("logout"),n.resolve())}),n.promise};var s=function(t){t&&(this._put=this.put,this._del=this.del,this.put=this.del=function(){throw new Error("Attempt to modify readonly set")}),this._items={}};s.prototype=Object.create(t.utils.EventEmitter.prototype),s.constructor=s,s.prototype.put=function(e,n){return t.utils.must.beString(e),t.utils.must.beObject(n),this._items[e]=t.utils.clone(n),this._emit("put",e),this},s.prototype.del=function(e){return t.utils.must.beString(e),delete this._items[e],this._emit("del",e),this},s.prototype.get=function(e){return t.utils.must.beString(e),t.utils.clone(this._items[e])},s.prototype.contains=function(e){return t.utils.must.beString(e),!!this._items[e]},s.prototype.filter=function(e){var n=new s(!0),i=this._items,r=Object.keys(i);return r.forEach(function(r){var o=t.utils.clone(i[r]),s=e(o);s&&(n._items[r]=i[r])}),this.on("put",function(r){var o=t.utils.clone(i[r]),s=e(o);s&&n._put(r,i[r])}),this.on("del",function(t){n._del(t);
}),n},s.prototype.toArray=function(){var e=[],n=this._items,i=Object.keys(this._items);return i.forEach(function(t){e.push(n[t])}),t.utils.clone(e)},s.prototype.toHash=function(){return t.utils.clone(this._items)},t.Set=s;var a=function(t,e,n,i){this._name=t,this._params=e,this._fingerprint=n,this._asteroid=i,this._ready=Q.defer(),this.ready=this._ready.promise;var r=this._onReady.bind(this),o=this._onStop.bind(this),s=this._onError.bind(this);this.id=i.ddp.sub(t,e,r,o,s)};return a.constructor=a,a.prototype.stop=function(){this._asteroid.ddp.unsub(this.id),delete this._asteroid._subscriptionsCache[this._fingerprint]},a.prototype._onReady=function(){this._ready.resolve(this.id)},a.prototype._onStop=function(){delete this._asteroid.subscriptions[this.id],delete this._asteroid._subscriptionsCache[this._fingerprint]},a.prototype._onError=function(t){this.ready.isPending()&&this._ready.reject(t),delete this._asteroid.subscriptions[this.id],delete this._asteroid._subscriptionsCache[this._fingerprint]},t.prototype.subscribe=function(e){t.utils.must.beString(e);var n=Array.prototype.slice.call(arguments),i=JSON.stringify(n);if(!this._subscriptionsCache[i]){var r=n.slice(1),o=new a(e,r,i,this);this._subscriptionsCache[o._fingerprint]=o,this.subscriptions[o.id]=o}return this._subscriptionsCache[i]},t.prototype._reEstablishSubscriptions=function(){var t,e,n=this.subscriptions;for(var i in n)n.hasOwnProperty(i)&&(t=n[i],e=new a(t._name,t._params,t._fingerprint,this),delete this.subscriptions[t.id],delete this._subscriptionsCache[t._fingerprint],this.subscriptions[e.id]=e,this._subscriptionsCache[e._fingerprint]=e)},t.prototype._openOauthPopup=function(t,e,n){var i=this,r=window.open(e,"_blank","location=no,toolbar=no");r.focus&&r.focus();var o=Q.defer(),s=JSON.stringify({credentialToken:t}),a=setInterval(function(){r.postMessage(s,i._host)},100);return window.addEventListener("message",function(e){var n;try{n=JSON.parse(e.data)}catch(r){return}e.origin===i._host&&(n.credentialToken===t&&(clearInterval(a),o.resolve({credentialToken:n.credentialToken,credentialSecret:n.credentialSecret})),n.error&&(clearInterval(a),o.reject(n.error)))}),o.promise.then(n.bind(i))},t.utils.multiStorage.get=function(t){var e=Q.defer();return e.resolve(localStorage[t]),e.promise},t.utils.multiStorage.set=function(t,e){var n=Q.defer();return localStorage[t]=e,n.resolve(),n.promise},t.utils.multiStorage.del=function(t){var e=Q.defer();return delete localStorage[t],e.resolve(),e.promise},t.prototype._setDdpOptions=function(t,e,n){"function"==typeof SockJS?this._ddpOptions={endpoint:(e?"https://":"http://")+t+"/sockjs",SocketConstructor:SockJS,socketInterceptFunction:n}:this._ddpOptions={endpoint:(e?"wss://":"ws://")+t+"/websocket",SocketConstructor:WebSocket,socketInterceptFunction:n}},t}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.moment=e()}(this,function(){"use strict";function t(){return fi.apply(null,arguments)}function e(t){fi=t}function n(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function i(t){return"[object Object]"===Object.prototype.toString.call(t)}function r(t){var e;for(e in t)return!1;return!0}function o(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function s(t,e){var n,i=[];for(n=0;n<t.length;++n)i.push(e(t[n],n));return i}function a(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function u(t,e){for(var n in e)a(e,n)&&(t[n]=e[n]);return a(e,"toString")&&(t.toString=e.toString),a(e,"valueOf")&&(t.valueOf=e.valueOf),t}function c(t,e,n,i){return me(t,e,n,i,!0).utc()}function l(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function d(t){return null==t._pf&&(t._pf=l()),t._pf}function h(t){if(null==t._isValid){var e=d(t),n=pi.call(e.parsedDateParts,function(t){return null!=t});t._isValid=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n),t._strict&&(t._isValid=t._isValid&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour)}return t._isValid}function f(t){var e=c(NaN);return null!=t?u(d(e),t):d(e).userInvalidated=!0,e}function p(t){return void 0===t}function _(t,e){var n,i,r;if(p(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),p(e._i)||(t._i=e._i),p(e._f)||(t._f=e._f),p(e._l)||(t._l=e._l),p(e._strict)||(t._strict=e._strict),p(e._tzm)||(t._tzm=e._tzm),p(e._isUTC)||(t._isUTC=e._isUTC),p(e._offset)||(t._offset=e._offset),p(e._pf)||(t._pf=d(e)),p(e._locale)||(t._locale=e._locale),_i.length>0)for(n in _i)i=_i[n],r=e[i],p(r)||(t[i]=r);return t}function m(e){_(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),mi===!1&&(mi=!0,t.updateOffset(this),mi=!1)}function y(t){return t instanceof m||null!=t&&null!=t._isAMomentObject}function g(t){return 0>t?Math.ceil(t)||0:Math.floor(t)}function v(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=g(e)),n}function k(t,e,n){var i,r=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),s=0;for(i=0;r>i;i++)(n&&t[i]!==e[i]||!n&&v(t[i])!==v(e[i]))&&s++;return s+o}function w(e){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function S(e,n){var i=!0;return u(function(){return null!=t.deprecationHandler&&t.deprecationHandler(null,e),i&&(w(e+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),i=!1),n.apply(this,arguments)},n)}function b(e,n){null!=t.deprecationHandler&&t.deprecationHandler(e,n),yi[e]||(w(n),yi[e]=!0)}function D(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function M(t){var e,n;for(n in t)e=t[n],D(e)?this[n]=e:this["_"+n]=e;this._config=t,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function Y(t,e){var n,r=u({},t);for(n in e)a(e,n)&&(i(t[n])&&i(e[n])?(r[n]={},u(r[n],t[n]),u(r[n],e[n])):null!=e[n]?r[n]=e[n]:delete r[n]);for(n in t)a(t,n)&&!a(e,n)&&i(t[n])&&(r[n]=u({},r[n]));return r}function O(t){null!=t&&this.set(t)}function x(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return D(i)?i.call(e,n):i}function T(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function R(){return this._invalidDate}function C(t){return this._ordinal.replace("%d",t)}function j(t,e,n,i){var r=this._relativeTime[n];return D(r)?r(t,e,n,i):r.replace(/%d/i,t)}function P(t,e){var n=this._relativeTime[t>0?"future":"past"];return D(n)?n(e):n.replace(/%s/i,e)}function E(t,e){var n=t.toLowerCase();Yi[n]=Yi[n+"s"]=Yi[e]=t}function I(t){return"string"==typeof t?Yi[t]||Yi[t.toLowerCase()]:void 0}function W(t){var e,n,i={};for(n in t)a(t,n)&&(e=I(n),e&&(i[e]=t[n]));return i}function F(t,e){Oi[t]=e}function U(t){var e=[];for(var n in t)e.push({unit:n,priority:Oi[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function L(e,n){return function(i){return null!=i?(A(this,e,i),t.updateOffset(this,n),this):N(this,e)}}function N(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function A(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function H(t){return t=I(t),D(this[t])?this[t]():this}function G(t,e){if("object"==typeof t){t=W(t);for(var n=U(t),i=0;i<n.length;i++)this[n[i].unit](t[n[i].unit])}else if(t=I(t),D(this[t]))return this[t](e);return this}function V(t,e,n){var i=""+Math.abs(t),r=e-i.length,o=t>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}function Q(t,e,n,i){var r=i;"string"==typeof i&&(r=function(){return this[i]()}),t&&(Ci[t]=r),e&&(Ci[e[0]]=function(){return V(r.apply(this,arguments),e[1],e[2])}),n&&(Ci[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function J(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function z(t){var e,n,i=t.match(xi);for(e=0,n=i.length;n>e;e++)Ci[i[e]]?i[e]=Ci[i[e]]:i[e]=J(i[e]);return function(e){var r,o="";for(r=0;n>r;r++)o+=i[r]instanceof Function?i[r].call(e,t):i[r];return o}}function Z(t,e){return t.isValid()?(e=$(e,t.localeData()),Ri[e]=Ri[e]||z(e),Ri[e](t)):t.localeData().invalidDate()}function $(t,e){function n(t){return e.longDateFormat(t)||t}var i=5;for(Ti.lastIndex=0;i>=0&&Ti.test(t);)t=t.replace(Ti,n),Ti.lastIndex=0,i-=1;return t}function q(t,e,n){$i[t]=D(e)?e:function(t,i){return t&&n?n:e}}function B(t,e){return a($i,t)?$i[t](e._strict,e._locale):new RegExp(X(t))}function X(t){return K(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,r){return e||n||i||r}))}function K(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function tt(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),"number"==typeof e&&(i=function(t,n){n[e]=v(t)}),n=0;n<t.length;n++)qi[t[n]]=i}function et(t,e){tt(t,function(t,n,i,r){i._w=i._w||{},e(t,i._w,i,r)})}function nt(t,e,n){null!=e&&a(qi,t)&&qi[t](e,n._a,n,t)}function it(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function rt(t,e){return n(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||sr).test(e)?"format":"standalone"][t.month()]}function ot(t,e){return n(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[sr.test(e)?"format":"standalone"][t.month()]}function st(t,e,n){var i,r,o,s=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;12>i;++i)o=c([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(o,"").toLocaleLowerCase();return n?"MMM"===e?(r=vi.call(this._shortMonthsParse,s),-1!==r?r:null):(r=vi.call(this._longMonthsParse,s),-1!==r?r:null):"MMM"===e?(r=vi.call(this._shortMonthsParse,s),-1!==r?r:(r=vi.call(this._longMonthsParse,s),-1!==r?r:null)):(r=vi.call(this._longMonthsParse,s),-1!==r?r:(r=vi.call(this._shortMonthsParse,s),-1!==r?r:null))}function at(t,e,n){var i,r,o;if(this._monthsParseExact)return st.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;12>i;i++){if(r=c([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(o="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[i]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[i].test(t))return i;if(n&&"MMM"===e&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}}function ut(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=v(e);else if(e=t.localeData().monthsParse(e),"number"!=typeof e)return t;return n=Math.min(t.date(),it(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function ct(e){return null!=e?(ut(this,e),t.updateOffset(this,!0),this):N(this,"Month")}function lt(){return it(this.year(),this.month())}function dt(t){return this._monthsParseExact?(a(this,"_monthsRegex")||ft.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=cr),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function ht(t){return this._monthsParseExact?(a(this,"_monthsRegex")||ft.call(this),t?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=lr),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function ft(){function t(t,e){return e.length-t.length}var e,n,i=[],r=[],o=[];for(e=0;12>e;e++)n=c([2e3,e]),i.push(this.monthsShort(n,"")),r.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(i.sort(t),r.sort(t),o.sort(t),e=0;12>e;e++)i[e]=K(i[e]),r[e]=K(r[e]);for(e=0;24>e;e++)o[e]=K(o[e]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function pt(t){return _t(t)?366:365}function _t(t){return t%4===0&&t%100!==0||t%400===0}function mt(){return _t(this.year())}function yt(t,e,n,i,r,o,s){var a=new Date(t,e,n,i,r,o,s);return 100>t&&t>=0&&isFinite(a.getFullYear())&&a.setFullYear(t),a}function gt(t){var e=new Date(Date.UTC.apply(null,arguments));return 100>t&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function vt(t,e,n){var i=7+e-n,r=(7+gt(t,0,i).getUTCDay()-e)%7;return-r+i-1}function kt(t,e,n,i,r){var o,s,a=(7+n-i)%7,u=vt(t,i,r),c=1+7*(e-1)+a+u;return 0>=c?(o=t-1,s=pt(o)+c):c>pt(t)?(o=t+1,s=c-pt(t)):(o=t,s=c),{year:o,dayOfYear:s}}function wt(t,e,n){var i,r,o=vt(t.year(),e,n),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return 1>s?(r=t.year()-1,i=s+St(r,e,n)):s>St(t.year(),e,n)?(i=s-St(t.year(),e,n),r=t.year()+1):(r=t.year(),i=s),{week:i,year:r}}function St(t,e,n){var i=vt(t,e,n),r=vt(t+1,e,n);return(pt(t)-i+r)/7}function bt(t){return wt(t,this._week.dow,this._week.doy).week}function Dt(){return this._week.dow}function Mt(){return this._week.doy}function Yt(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ot(t){var e=wt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function xt(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Tt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Rt(t,e){return n(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]}function Ct(t){return this._weekdaysShort[t.day()]}function jt(t){return this._weekdaysMin[t.day()]}function Pt(t,e,n){var i,r,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;7>i;++i)o=c([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===e?(r=vi.call(this._weekdaysParse,s),-1!==r?r:null):"ddd"===e?(r=vi.call(this._shortWeekdaysParse,s),-1!==r?r:null):(r=vi.call(this._minWeekdaysParse,s),-1!==r?r:null):"dddd"===e?(r=vi.call(this._weekdaysParse,s),-1!==r?r:(r=vi.call(this._shortWeekdaysParse,s),-1!==r?r:(r=vi.call(this._minWeekdaysParse,s),-1!==r?r:null))):"ddd"===e?(r=vi.call(this._shortWeekdaysParse,s),-1!==r?r:(r=vi.call(this._weekdaysParse,s),-1!==r?r:(r=vi.call(this._minWeekdaysParse,s),-1!==r?r:null))):(r=vi.call(this._minWeekdaysParse,s),-1!==r?r:(r=vi.call(this._weekdaysParse,s),-1!==r?r:(r=vi.call(this._shortWeekdaysParse,s),-1!==r?r:null)))}function Et(t,e,n){var i,r,o;if(this._weekdaysParseExact)return Pt.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;7>i;i++){if(r=c([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function It(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=xt(t,this.localeData()),this.add(t-e,"d")):e}function Wt(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Ft(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Tt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function Ut(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||At.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=mr),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Lt(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||At.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=yr),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Nt(t){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||At.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=gr),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function At(){function t(t,e){return e.length-t.length}var e,n,i,r,o,s=[],a=[],u=[],l=[];for(e=0;7>e;e++)n=c([2e3,1]).day(e),i=this.weekdaysMin(n,""),r=this.weekdaysShort(n,""),o=this.weekdays(n,""),s.push(i),a.push(r),u.push(o),l.push(i),l.push(r),l.push(o);for(s.sort(t),a.sort(t),u.sort(t),l.sort(t),e=0;7>e;e++)a[e]=K(a[e]),u[e]=K(u[e]),l[e]=K(l[e]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ht(){return this.hours()%12||12}function Gt(){return this.hours()||24}function Vt(t,e){Q(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function Qt(t,e){return e._meridiemParse}function Jt(t){return"p"===(t+"").toLowerCase().charAt(0)}function zt(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function Zt(t){return t?t.toLowerCase().replace("_","-"):t}function $t(t){for(var e,n,i,r,o=0;o<t.length;){for(r=Zt(t[o]).split("-"),e=r.length,n=Zt(t[o+1]),n=n?n.split("-"):null;e>0;){if(i=qt(r.slice(0,e).join("-")))return i;if(n&&n.length>=e&&k(r,n,!0)>=e-1)break;e--}o++}return null}function qt(t){var e=null;if(!br[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=vr._abbr,require("./locale/"+t),Bt(e)}catch(n){}return br[t]}function Bt(t,e){var n;return t&&(n=p(e)?te(t):Xt(t,e),n&&(vr=n)),vr._abbr}function Xt(t,e){if(null!==e){var n=Sr;return e.abbr=t,null!=br[t]?(b("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=br[t]._config):null!=e.parentLocale&&(null!=br[e.parentLocale]?n=br[e.parentLocale]._config:b("parentLocaleUndefined","specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/")),br[t]=new O(Y(n,e)),Bt(t),br[t]}return delete br[t],null}function Kt(t,e){if(null!=e){var n,i=Sr;null!=br[t]&&(i=br[t]._config),e=Y(i,e),n=new O(e),n.parentLocale=br[t],br[t]=n,Bt(t)}else null!=br[t]&&(null!=br[t].parentLocale?br[t]=br[t].parentLocale:null!=br[t]&&delete br[t]);return br[t]}function te(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return vr;if(!n(t)){if(e=qt(t))return e;t=[t]}return $t(t)}function ee(){return gi(br)}function ne(t){var e,n=t._a;return n&&-2===d(t).overflow&&(e=n[Xi]<0||n[Xi]>11?Xi:n[Ki]<1||n[Ki]>it(n[Bi],n[Xi])?Ki:n[tr]<0||n[tr]>24||24===n[tr]&&(0!==n[er]||0!==n[nr]||0!==n[ir])?tr:n[er]<0||n[er]>59?er:n[nr]<0||n[nr]>59?nr:n[ir]<0||n[ir]>999?ir:-1,d(t)._overflowDayOfYear&&(Bi>e||e>Ki)&&(e=Ki),d(t)._overflowWeeks&&-1===e&&(e=rr),d(t)._overflowWeekday&&-1===e&&(e=or),d(t).overflow=e),t}function ie(t){var e,n,i,r,o,s,a=t._i,u=Dr.exec(a)||Mr.exec(a);if(u){for(d(t).iso=!0,e=0,n=Or.length;n>e;e++)if(Or[e][1].exec(u[1])){r=Or[e][0],i=Or[e][2]!==!1;break}if(null==r)return void(t._isValid=!1);if(u[3]){for(e=0,n=xr.length;n>e;e++)if(xr[e][1].exec(u[3])){o=(u[2]||" ")+xr[e][0];break}if(null==o)return void(t._isValid=!1)}if(!i&&null!=o)return void(t._isValid=!1);if(u[4]){if(!Yr.exec(u[4]))return void(t._isValid=!1);s="Z"}t._f=r+(o||"")+(s||""),ce(t)}else t._isValid=!1}function re(e){var n=Tr.exec(e._i);return null!==n?void(e._d=new Date(+n[1])):(ie(e),void(e._isValid===!1&&(delete e._isValid,t.createFromInputFallback(e))))}function oe(t,e,n){return null!=t?t:null!=e?e:n}function se(e){var n=new Date(t.now());return e._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function ae(t){var e,n,i,r,o=[];if(!t._d){for(i=se(t),t._w&&null==t._a[Ki]&&null==t._a[Xi]&&ue(t),t._dayOfYear&&(r=oe(t._a[Bi],i[Bi]),t._dayOfYear>pt(r)&&(d(t)._overflowDayOfYear=!0),n=gt(r,0,t._dayOfYear),t._a[Xi]=n.getUTCMonth(),t._a[Ki]=n.getUTCDate()),e=0;3>e&&null==t._a[e];++e)t._a[e]=o[e]=i[e];for(;7>e;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[tr]&&0===t._a[er]&&0===t._a[nr]&&0===t._a[ir]&&(t._nextDay=!0,t._a[tr]=0),t._d=(t._useUTC?gt:yt).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[tr]=24)}}function ue(t){var e,n,i,r,o,s,a,u;e=t._w,null!=e.GG||null!=e.W||null!=e.E?(o=1,s=4,n=oe(e.GG,t._a[Bi],wt(ye(),1,4).year),i=oe(e.W,1),r=oe(e.E,1),(1>r||r>7)&&(u=!0)):(o=t._locale._week.dow,s=t._locale._week.doy,n=oe(e.gg,t._a[Bi],wt(ye(),o,s).year),i=oe(e.w,1),null!=e.d?(r=e.d,(0>r||r>6)&&(u=!0)):null!=e.e?(r=e.e+o,(e.e<0||e.e>6)&&(u=!0)):r=o),1>i||i>St(n,o,s)?d(t)._overflowWeeks=!0:null!=u?d(t)._overflowWeekday=!0:(a=kt(n,i,r,o,s),t._a[Bi]=a.year,t._dayOfYear=a.dayOfYear)}function ce(e){if(e._f===t.ISO_8601)return void ie(e);e._a=[],d(e).empty=!0;var n,i,r,o,s,a=""+e._i,u=a.length,c=0;for(r=$(e._f,e._locale).match(xi)||[],n=0;n<r.length;n++)o=r[n],i=(a.match(B(o,e))||[])[0],i&&(s=a.substr(0,a.indexOf(i)),s.length>0&&d(e).unusedInput.push(s),a=a.slice(a.indexOf(i)+i.length),c+=i.length),Ci[o]?(i?d(e).empty=!1:d(e).unusedTokens.push(o),nt(o,i,e)):e._strict&&!i&&d(e).unusedTokens.push(o);d(e).charsLeftOver=u-c,a.length>0&&d(e).unusedInput.push(a),e._a[tr]<=12&&d(e).bigHour===!0&&e._a[tr]>0&&(d(e).bigHour=void 0),d(e).parsedDateParts=e._a.slice(0),d(e).meridiem=e._meridiem,e._a[tr]=le(e._locale,e._a[tr],e._meridiem),ae(e),ne(e)}function le(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(i=t.isPM(n),i&&12>e&&(e+=12),i||12!==e||(e=0),e):e}function de(t){var e,n,i,r,o;if(0===t._f.length)return d(t).invalidFormat=!0,void(t._d=new Date(NaN));for(r=0;r<t._f.length;r++)o=0,e=_({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[r],ce(e),h(e)&&(o+=d(e).charsLeftOver,o+=10*d(e).unusedTokens.length,d(e).score=o,(null==i||i>o)&&(i=o,n=e));u(t,n||e)}function he(t){if(!t._d){var e=W(t._i);t._a=s([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),ae(t)}}function fe(t){var e=new m(ne(pe(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function pe(t){var e=t._i,i=t._f;return t._locale=t._locale||te(t._l),null===e||void 0===i&&""===e?f({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),y(e)?new m(ne(e)):(n(i)?de(t):o(e)?t._d=e:i?ce(t):_e(t),h(t)||(t._d=null),t))}function _e(e){var i=e._i;void 0===i?e._d=new Date(t.now()):o(i)?e._d=new Date(i.valueOf()):"string"==typeof i?re(e):n(i)?(e._a=s(i.slice(0),function(t){return parseInt(t,10)}),ae(e)):"object"==typeof i?he(e):"number"==typeof i?e._d=new Date(i):t.createFromInputFallback(e)}function me(t,e,o,s,a){var u={};return"boolean"==typeof o&&(s=o,o=void 0),(i(t)&&r(t)||n(t)&&0===t.length)&&(t=void 0),u._isAMomentObject=!0,u._useUTC=u._isUTC=a,u._l=o,u._i=t,u._f=e,u._strict=s,fe(u)}function ye(t,e,n,i){return me(t,e,n,i,!1)}function ge(t,e){var i,r;if(1===e.length&&n(e[0])&&(e=e[0]),!e.length)return ye();for(i=e[0],r=1;r<e.length;++r)(!e[r].isValid()||e[r][t](i))&&(i=e[r]);return i}function ve(){var t=[].slice.call(arguments,0);return ge("isBefore",t)}function ke(){var t=[].slice.call(arguments,0);return ge("isAfter",t)}function we(t){var e=W(t),n=e.year||0,i=e.quarter||0,r=e.month||0,o=e.week||0,s=e.day||0,a=e.hour||0,u=e.minute||0,c=e.second||0,l=e.millisecond||0;this._milliseconds=+l+1e3*c+6e4*u+1e3*a*60*60,this._days=+s+7*o,this._months=+r+3*i+12*n,this._data={},this._locale=te(),this._bubble()}function Se(t){return t instanceof we}function be(t,e){Q(t,0,0,function(){var t=this.utcOffset(),n="+";return 0>t&&(t=-t,n="-"),n+V(~~(t/60),2)+e+V(~~t%60,2)})}function De(t,e){var n=(e||"").match(t)||[],i=n[n.length-1]||[],r=(i+"").match(Pr)||["-",0,0],o=+(60*r[1])+v(r[2]);return"+"===r[0]?o:-o}function Me(e,n){var i,r;return n._isUTC?(i=n.clone(),r=(y(e)||o(e)?e.valueOf():ye(e).valueOf())-i.valueOf(),i._d.setTime(i._d.valueOf()+r),t.updateOffset(i,!1),i):ye(e).local()}function Ye(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Oe(e,n){var i,r=this._offset||0;return this.isValid()?null!=e?("string"==typeof e?e=De(Ji,e):Math.abs(e)<16&&(e=60*e),!this._isUTC&&n&&(i=Ye(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),r!==e&&(!n||this._changeInProgress?Ve(this,Ue(e-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?r:Ye(this):null!=e?this:NaN}function xe(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function Te(t){return this.utcOffset(0,t)}function Re(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Ye(this),"m")),this}function Ce(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(De(Qi,this._i)),this}function je(t){return this.isValid()?(t=t?ye(t).utcOffset():0,(this.utcOffset()-t)%60===0):!1}function Pe(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ee(){if(!p(this._isDSTShifted))return this._isDSTShifted;var t={};if(_(t,this),t=pe(t),t._a){var e=t._isUTC?c(t._a):ye(t._a);this._isDSTShifted=this.isValid()&&k(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Ie(){return this.isValid()?!this._isUTC:!1}function We(){return this.isValid()?this._isUTC:!1}function Fe(){return this.isValid()?this._isUTC&&0===this._offset:!1}function Ue(t,e){var n,i,r,o=t,s=null;return Se(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(o={},e?o[e]=t:o.milliseconds=t):(s=Er.exec(t))?(n="-"===s[1]?-1:1,o={y:0,d:v(s[Ki])*n,h:v(s[tr])*n,m:v(s[er])*n,s:v(s[nr])*n,ms:v(s[ir])*n}):(s=Ir.exec(t))?(n="-"===s[1]?-1:1,o={y:Le(s[2],n),M:Le(s[3],n),w:Le(s[4],n),d:Le(s[5],n),h:Le(s[6],n),m:Le(s[7],n),s:Le(s[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(r=Ae(ye(o.from),ye(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),i=new we(o),Se(t)&&a(t,"_locale")&&(i._locale=t._locale),i}function Le(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Ne(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Ae(t,e){var n;return t.isValid()&&e.isValid()?(e=Me(e,t),t.isBefore(e)?n=Ne(t,e):(n=Ne(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function He(t){return 0>t?-1*Math.round(-1*t):Math.round(t)}function Ge(t,e){return function(n,i){var r,o;return null===i||isNaN(+i)||(b(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=i,i=o),n="string"==typeof n?+n:n,r=Ue(n,i),Ve(this,r,t),this}}function Ve(e,n,i,r){var o=n._milliseconds,s=He(n._days),a=He(n._months);e.isValid()&&(r=null==r?!0:r,o&&e._d.setTime(e._d.valueOf()+o*i),s&&A(e,"Date",N(e,"Date")+s*i),a&&ut(e,N(e,"Month")+a*i),r&&t.updateOffset(e,s||a))}function Qe(t,e){var n=t.diff(e,"days",!0);return-6>n?"sameElse":-1>n?"lastWeek":0>n?"lastDay":1>n?"sameDay":2>n?"nextDay":7>n?"nextWeek":"sameElse"}function Je(e,n){var i=e||ye(),r=Me(i,this).startOf("day"),o=t.calendarFormat(this,r)||"sameElse",s=n&&(D(n[o])?n[o].call(this,i):n[o]);return this.format(s||this.localeData().calendar(o,this,ye(i)))}function ze(){return new m(this)}function Ze(t,e){var n=y(t)?t:ye(t);return this.isValid()&&n.isValid()?(e=I(p(e)?"millisecond":e),"millisecond"===e?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf()):!1}function $e(t,e){var n=y(t)?t:ye(t);return this.isValid()&&n.isValid()?(e=I(p(e)?"millisecond":e),"millisecond"===e?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf()):!1}function qe(t,e,n,i){return i=i||"()",("("===i[0]?this.isAfter(t,n):!this.isBefore(t,n))&&(")"===i[1]?this.isBefore(e,n):!this.isAfter(e,n))}function Be(t,e){var n,i=y(t)?t:ye(t);return this.isValid()&&i.isValid()?(e=I(e||"millisecond"),"millisecond"===e?this.valueOf()===i.valueOf():(n=i.valueOf(),this.clone().startOf(e).valueOf()<=n&&n<=this.clone().endOf(e).valueOf())):!1}function Xe(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function Ke(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function tn(t,e,n){var i,r,o,s;return this.isValid()?(i=Me(t,this),i.isValid()?(r=6e4*(i.utcOffset()-this.utcOffset()),e=I(e),"year"===e||"month"===e||"quarter"===e?(s=en(this,i),"quarter"===e?s/=3:"year"===e&&(s/=12)):(o=this-i,s="second"===e?o/1e3:"minute"===e?o/6e4:"hour"===e?o/36e5:"day"===e?(o-r)/864e5:"week"===e?(o-r)/6048e5:o),n?s:g(s)):NaN):NaN}function en(t,e){var n,i,r=12*(e.year()-t.year())+(e.month()-t.month()),o=t.clone().add(r,"months");return 0>e-o?(n=t.clone().add(r-1,"months"),i=(e-o)/(o-n)):(n=t.clone().add(r+1,"months"),i=(e-o)/(n-o)),-(r+i)||0}function nn(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function rn(){var t=this.clone().utc();return 0<t.year()&&t.year()<=9999?D(Date.prototype.toISOString)?this.toDate().toISOString():Z(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):Z(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function on(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var n=Z(this,e);return this.localeData().postformat(n)}function sn(t,e){return this.isValid()&&(y(t)&&t.isValid()||ye(t).isValid())?Ue({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function an(t){return this.from(ye(),t)}function un(t,e){return this.isValid()&&(y(t)&&t.isValid()||ye(t).isValid())?Ue({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function cn(t){return this.to(ye(),t)}function ln(t){var e;return void 0===t?this._locale._abbr:(e=te(t),null!=e&&(this._locale=e),this)}function dn(){return this._locale}function hn(t){switch(t=I(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function fn(t){return t=I(t),void 0===t||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function pn(){return this._d.valueOf()-6e4*(this._offset||0)}function _n(){return Math.floor(this.valueOf()/1e3)}function mn(){return new Date(this.valueOf());
}function yn(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function gn(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function vn(){return this.isValid()?this.toISOString():null}function kn(){return h(this)}function wn(){return u({},d(this))}function Sn(){return d(this).overflow}function bn(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Dn(t,e){Q(0,[t,t.length],0,e)}function Mn(t){return Tn.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Yn(t){return Tn.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function On(){return St(this.year(),1,4)}function xn(){var t=this.localeData()._week;return St(this.year(),t.dow,t.doy)}function Tn(t,e,n,i,r){var o;return null==t?wt(this,i,r).year:(o=St(t,i,r),e>o&&(e=o),Rn.call(this,t,e,n,i,r))}function Rn(t,e,n,i,r){var o=kt(t,e,n,i,r),s=gt(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Cn(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function jn(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Pn(t,e){e[ir]=v(1e3*("0."+t))}function En(){return this._isUTC?"UTC":""}function In(){return this._isUTC?"Coordinated Universal Time":""}function Wn(t){return ye(1e3*t)}function Fn(){return ye.apply(null,arguments).parseZone()}function Un(t){return t}function Ln(t,e,n,i){var r=te(),o=c().set(i,e);return r[n](o,t)}function Nn(t,e,n){if("number"==typeof t&&(e=t,t=void 0),t=t||"",null!=e)return Ln(t,e,n,"month");var i,r=[];for(i=0;12>i;i++)r[i]=Ln(t,i,n,"month");return r}function An(t,e,n,i){"boolean"==typeof t?("number"==typeof e&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,"number"==typeof e&&(n=e,e=void 0),e=e||"");var r=te(),o=t?r._week.dow:0;if(null!=n)return Ln(e,(n+o)%7,i,"day");var s,a=[];for(s=0;7>s;s++)a[s]=Ln(e,(s+o)%7,i,"day");return a}function Hn(t,e){return Nn(t,e,"months")}function Gn(t,e){return Nn(t,e,"monthsShort")}function Vn(t,e,n){return An(t,e,n,"weekdays")}function Qn(t,e,n){return An(t,e,n,"weekdaysShort")}function Jn(t,e,n){return An(t,e,n,"weekdaysMin")}function zn(){var t=this._data;return this._milliseconds=zr(this._milliseconds),this._days=zr(this._days),this._months=zr(this._months),t.milliseconds=zr(t.milliseconds),t.seconds=zr(t.seconds),t.minutes=zr(t.minutes),t.hours=zr(t.hours),t.months=zr(t.months),t.years=zr(t.years),this}function Zn(t,e,n,i){var r=Ue(e,n);return t._milliseconds+=i*r._milliseconds,t._days+=i*r._days,t._months+=i*r._months,t._bubble()}function $n(t,e){return Zn(this,t,e,1)}function qn(t,e){return Zn(this,t,e,-1)}function Bn(t){return 0>t?Math.floor(t):Math.ceil(t)}function Xn(){var t,e,n,i,r,o=this._milliseconds,s=this._days,a=this._months,u=this._data;return o>=0&&s>=0&&a>=0||0>=o&&0>=s&&0>=a||(o+=864e5*Bn(ti(a)+s),s=0,a=0),u.milliseconds=o%1e3,t=g(o/1e3),u.seconds=t%60,e=g(t/60),u.minutes=e%60,n=g(e/60),u.hours=n%24,s+=g(n/24),r=g(Kn(s)),a+=r,s-=Bn(ti(r)),i=g(a/12),a%=12,u.days=s,u.months=a,u.years=i,this}function Kn(t){return 4800*t/146097}function ti(t){return 146097*t/4800}function ei(t){var e,n,i=this._milliseconds;if(t=I(t),"month"===t||"year"===t)return e=this._days+i/864e5,n=this._months+Kn(e),"month"===t?n:n/12;switch(e=this._days+Math.round(ti(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}}function ni(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*v(this._months/12)}function ii(t){return function(){return this.as(t)}}function ri(t){return t=I(t),this[t+"s"]()}function oi(t){return function(){return this._data[t]}}function si(){return g(this.days()/7)}function ai(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function ui(t,e,n){var i=Ue(t).abs(),r=co(i.as("s")),o=co(i.as("m")),s=co(i.as("h")),a=co(i.as("d")),u=co(i.as("M")),c=co(i.as("y")),l=r<lo.s&&["s",r]||1>=o&&["m"]||o<lo.m&&["mm",o]||1>=s&&["h"]||s<lo.h&&["hh",s]||1>=a&&["d"]||a<lo.d&&["dd",a]||1>=u&&["M"]||u<lo.M&&["MM",u]||1>=c&&["y"]||["yy",c];return l[2]=e,l[3]=+t>0,l[4]=n,ai.apply(null,l)}function ci(t){return void 0===t?co:"function"==typeof t?(co=t,!0):!1}function li(t,e){return void 0===lo[t]?!1:void 0===e?lo[t]:(lo[t]=e,!0)}function di(t){var e=this.localeData(),n=ui(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function hi(){var t,e,n,i=ho(this._milliseconds)/1e3,r=ho(this._days),o=ho(this._months);t=g(i/60),e=g(t/60),i%=60,t%=60,n=g(o/12),o%=12;var s=n,a=o,u=r,c=e,l=t,d=i,h=this.asSeconds();return h?(0>h?"-":"")+"P"+(s?s+"Y":"")+(a?a+"M":"")+(u?u+"D":"")+(c||l||d?"T":"")+(c?c+"H":"")+(l?l+"M":"")+(d?d+"S":""):"P0D"}var fi,pi;pi=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),n=e.length>>>0,i=0;n>i;i++)if(i in e&&t.call(this,e[i],i,e))return!0;return!1};var _i=t.momentProperties=[],mi=!1,yi={};t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var gi;gi=Object.keys?Object.keys:function(t){var e,n=[];for(e in t)a(t,e)&&n.push(e);return n};var vi,ki={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},wi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Si="Invalid date",bi="%d",Di=/\d{1,2}/,Mi={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Yi={},Oi={},xi=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Ti=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ri={},Ci={},ji=/\d/,Pi=/\d\d/,Ei=/\d{3}/,Ii=/\d{4}/,Wi=/[+-]?\d{6}/,Fi=/\d\d?/,Ui=/\d\d\d\d?/,Li=/\d\d\d\d\d\d?/,Ni=/\d{1,3}/,Ai=/\d{1,4}/,Hi=/[+-]?\d{1,6}/,Gi=/\d+/,Vi=/[+-]?\d+/,Qi=/Z|[+-]\d\d:?\d\d/gi,Ji=/Z|[+-]\d\d(?::?\d\d)?/gi,zi=/[+-]?\d+(\.\d{1,3})?/,Zi=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,$i={},qi={},Bi=0,Xi=1,Ki=2,tr=3,er=4,nr=5,ir=6,rr=7,or=8;vi=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1},Q("M",["MM",2],"Mo",function(){return this.month()+1}),Q("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),Q("MMMM",0,0,function(t){return this.localeData().months(this,t)}),E("month","M"),F("month",8),q("M",Fi),q("MM",Fi,Pi),q("MMM",function(t,e){return e.monthsShortRegex(t)}),q("MMMM",function(t,e){return e.monthsRegex(t)}),tt(["M","MM"],function(t,e){e[Xi]=v(t)-1}),tt(["MMM","MMMM"],function(t,e,n,i){var r=n._locale.monthsParse(t,i,n._strict);null!=r?e[Xi]=r:d(n).invalidMonth=t});var sr=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,ar="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ur="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),cr=Zi,lr=Zi;Q("Y",0,0,function(){var t=this.year();return 9999>=t?""+t:"+"+t}),Q(0,["YY",2],0,function(){return this.year()%100}),Q(0,["YYYY",4],0,"year"),Q(0,["YYYYY",5],0,"year"),Q(0,["YYYYYY",6,!0],0,"year"),E("year","y"),F("year",1),q("Y",Vi),q("YY",Fi,Pi),q("YYYY",Ai,Ii),q("YYYYY",Hi,Wi),q("YYYYYY",Hi,Wi),tt(["YYYYY","YYYYYY"],Bi),tt("YYYY",function(e,n){n[Bi]=2===e.length?t.parseTwoDigitYear(e):v(e)}),tt("YY",function(e,n){n[Bi]=t.parseTwoDigitYear(e)}),tt("Y",function(t,e){e[Bi]=parseInt(t,10)}),t.parseTwoDigitYear=function(t){return v(t)+(v(t)>68?1900:2e3)};var dr=L("FullYear",!0);Q("w",["ww",2],"wo","week"),Q("W",["WW",2],"Wo","isoWeek"),E("week","w"),E("isoWeek","W"),F("week",5),F("isoWeek",5),q("w",Fi),q("ww",Fi,Pi),q("W",Fi),q("WW",Fi,Pi),et(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=v(t)});var hr={dow:0,doy:6};Q("d",0,"do","day"),Q("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),Q("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),Q("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),Q("e",0,0,"weekday"),Q("E",0,0,"isoWeekday"),E("day","d"),E("weekday","e"),E("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),q("d",Fi),q("e",Fi),q("E",Fi),q("dd",function(t,e){return e.weekdaysMinRegex(t)}),q("ddd",function(t,e){return e.weekdaysShortRegex(t)}),q("dddd",function(t,e){return e.weekdaysRegex(t)}),et(["dd","ddd","dddd"],function(t,e,n,i){var r=n._locale.weekdaysParse(t,i,n._strict);null!=r?e.d=r:d(n).invalidWeekday=t}),et(["d","e","E"],function(t,e,n,i){e[i]=v(t)});var fr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),pr="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),_r="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),mr=Zi,yr=Zi,gr=Zi;Q("H",["HH",2],0,"hour"),Q("h",["hh",2],0,Ht),Q("k",["kk",2],0,Gt),Q("hmm",0,0,function(){return""+Ht.apply(this)+V(this.minutes(),2)}),Q("hmmss",0,0,function(){return""+Ht.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),Q("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),Q("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)}),Vt("a",!0),Vt("A",!1),E("hour","h"),F("hour",13),q("a",Qt),q("A",Qt),q("H",Fi),q("h",Fi),q("HH",Fi,Pi),q("hh",Fi,Pi),q("hmm",Ui),q("hmmss",Li),q("Hmm",Ui),q("Hmmss",Li),tt(["H","HH"],tr),tt(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),tt(["h","hh"],function(t,e,n){e[tr]=v(t),d(n).bigHour=!0}),tt("hmm",function(t,e,n){var i=t.length-2;e[tr]=v(t.substr(0,i)),e[er]=v(t.substr(i)),d(n).bigHour=!0}),tt("hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[tr]=v(t.substr(0,i)),e[er]=v(t.substr(i,2)),e[nr]=v(t.substr(r)),d(n).bigHour=!0}),tt("Hmm",function(t,e,n){var i=t.length-2;e[tr]=v(t.substr(0,i)),e[er]=v(t.substr(i))}),tt("Hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[tr]=v(t.substr(0,i)),e[er]=v(t.substr(i,2)),e[nr]=v(t.substr(r))});var vr,kr=/[ap]\.?m?\.?/i,wr=L("Hours",!0),Sr={calendar:ki,longDateFormat:wi,invalidDate:Si,ordinal:bi,ordinalParse:Di,relativeTime:Mi,months:ar,monthsShort:ur,week:hr,weekdays:fr,weekdaysMin:_r,weekdaysShort:pr,meridiemParse:kr},br={},Dr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Mr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Yr=/Z|[+-]\d\d(?::?\d\d)?/,Or=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],xr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Tr=/^\/?Date\((\-?\d+)/i;t.createFromInputFallback=S("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),t.ISO_8601=function(){};var Rr=S("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=ye.apply(null,arguments);return this.isValid()&&t.isValid()?this>t?this:t:f()}),Cr=S("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=ye.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:f()}),jr=function(){return Date.now?Date.now():+new Date};be("Z",":"),be("ZZ",""),q("Z",Ji),q("ZZ",Ji),tt(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=De(Ji,t)});var Pr=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var Er=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,Ir=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ue.fn=we.prototype;var Wr=Ge(1,"add"),Fr=Ge(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Ur=S("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});Q(0,["gg",2],0,function(){return this.weekYear()%100}),Q(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Dn("gggg","weekYear"),Dn("ggggg","weekYear"),Dn("GGGG","isoWeekYear"),Dn("GGGGG","isoWeekYear"),E("weekYear","gg"),E("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),q("G",Vi),q("g",Vi),q("GG",Fi,Pi),q("gg",Fi,Pi),q("GGGG",Ai,Ii),q("gggg",Ai,Ii),q("GGGGG",Hi,Wi),q("ggggg",Hi,Wi),et(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=v(t)}),et(["gg","GG"],function(e,n,i,r){n[r]=t.parseTwoDigitYear(e)}),Q("Q",0,"Qo","quarter"),E("quarter","Q"),F("quarter",7),q("Q",ji),tt("Q",function(t,e){e[Xi]=3*(v(t)-1)}),Q("D",["DD",2],"Do","date"),E("date","D"),F("date",9),q("D",Fi),q("DD",Fi,Pi),q("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),tt(["D","DD"],Ki),tt("Do",function(t,e){e[Ki]=v(t.match(Fi)[0],10)});var Lr=L("Date",!0);Q("DDD",["DDDD",3],"DDDo","dayOfYear"),E("dayOfYear","DDD"),F("dayOfYear",4),q("DDD",Ni),q("DDDD",Ei),tt(["DDD","DDDD"],function(t,e,n){n._dayOfYear=v(t)}),Q("m",["mm",2],0,"minute"),E("minute","m"),F("minute",14),q("m",Fi),q("mm",Fi,Pi),tt(["m","mm"],er);var Nr=L("Minutes",!1);Q("s",["ss",2],0,"second"),E("second","s"),F("second",15),q("s",Fi),q("ss",Fi,Pi),tt(["s","ss"],nr);var Ar=L("Seconds",!1);Q("S",0,0,function(){return~~(this.millisecond()/100)}),Q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Q(0,["SSS",3],0,"millisecond"),Q(0,["SSSS",4],0,function(){return 10*this.millisecond()}),Q(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),Q(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),Q(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),Q(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),Q(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),E("millisecond","ms"),F("millisecond",16),q("S",Ni,ji),q("SS",Ni,Pi),q("SSS",Ni,Ei);var Hr;for(Hr="SSSS";Hr.length<=9;Hr+="S")q(Hr,Gi);for(Hr="S";Hr.length<=9;Hr+="S")tt(Hr,Pn);var Gr=L("Milliseconds",!1);Q("z",0,0,"zoneAbbr"),Q("zz",0,0,"zoneName");var Vr=m.prototype;Vr.add=Wr,Vr.calendar=Je,Vr.clone=ze,Vr.diff=tn,Vr.endOf=fn,Vr.format=on,Vr.from=sn,Vr.fromNow=an,Vr.to=un,Vr.toNow=cn,Vr.get=H,Vr.invalidAt=Sn,Vr.isAfter=Ze,Vr.isBefore=$e,Vr.isBetween=qe,Vr.isSame=Be,Vr.isSameOrAfter=Xe,Vr.isSameOrBefore=Ke,Vr.isValid=kn,Vr.lang=Ur,Vr.locale=ln,Vr.localeData=dn,Vr.max=Cr,Vr.min=Rr,Vr.parsingFlags=wn,Vr.set=G,Vr.startOf=hn,Vr.subtract=Fr,Vr.toArray=yn,Vr.toObject=gn,Vr.toDate=mn,Vr.toISOString=rn,Vr.toJSON=vn,Vr.toString=nn,Vr.unix=_n,Vr.valueOf=pn,Vr.creationData=bn,Vr.year=dr,Vr.isLeapYear=mt,Vr.weekYear=Mn,Vr.isoWeekYear=Yn,Vr.quarter=Vr.quarters=Cn,Vr.month=ct,Vr.daysInMonth=lt,Vr.week=Vr.weeks=Yt,Vr.isoWeek=Vr.isoWeeks=Ot,Vr.weeksInYear=xn,Vr.isoWeeksInYear=On,Vr.date=Lr,Vr.day=Vr.days=It,Vr.weekday=Wt,Vr.isoWeekday=Ft,Vr.dayOfYear=jn,Vr.hour=Vr.hours=wr,Vr.minute=Vr.minutes=Nr,Vr.second=Vr.seconds=Ar,Vr.millisecond=Vr.milliseconds=Gr,Vr.utcOffset=Oe,Vr.utc=Te,Vr.local=Re,Vr.parseZone=Ce,Vr.hasAlignedHourOffset=je,Vr.isDST=Pe,Vr.isLocal=Ie,Vr.isUtcOffset=We,Vr.isUtc=Fe,Vr.isUTC=Fe,Vr.zoneAbbr=En,Vr.zoneName=In,Vr.dates=S("dates accessor is deprecated. Use date instead.",Lr),Vr.months=S("months accessor is deprecated. Use month instead",ct),Vr.years=S("years accessor is deprecated. Use year instead",dr),Vr.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",xe),Vr.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ee);var Qr=Vr,Jr=O.prototype;Jr.calendar=x,Jr.longDateFormat=T,Jr.invalidDate=R,Jr.ordinal=C,Jr.preparse=Un,Jr.postformat=Un,Jr.relativeTime=j,Jr.pastFuture=P,Jr.set=M,Jr.months=rt,Jr.monthsShort=ot,Jr.monthsParse=at,Jr.monthsRegex=ht,Jr.monthsShortRegex=dt,Jr.week=bt,Jr.firstDayOfYear=Mt,Jr.firstDayOfWeek=Dt,Jr.weekdays=Rt,Jr.weekdaysMin=jt,Jr.weekdaysShort=Ct,Jr.weekdaysParse=Et,Jr.weekdaysRegex=Ut,Jr.weekdaysShortRegex=Lt,Jr.weekdaysMinRegex=Nt,Jr.isPM=Jt,Jr.meridiem=zt,Bt("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===v(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),t.lang=S("moment.lang is deprecated. Use moment.locale instead.",Bt),t.langData=S("moment.langData is deprecated. Use moment.localeData instead.",te);var zr=Math.abs,Zr=ii("ms"),$r=ii("s"),qr=ii("m"),Br=ii("h"),Xr=ii("d"),Kr=ii("w"),to=ii("M"),eo=ii("y"),no=oi("milliseconds"),io=oi("seconds"),ro=oi("minutes"),oo=oi("hours"),so=oi("days"),ao=oi("months"),uo=oi("years"),co=Math.round,lo={s:45,m:45,h:22,d:26,M:11},ho=Math.abs,fo=we.prototype;fo.abs=zn,fo.add=$n,fo.subtract=qn,fo.as=ei,fo.asMilliseconds=Zr,fo.asSeconds=$r,fo.asMinutes=qr,fo.asHours=Br,fo.asDays=Xr,fo.asWeeks=Kr,fo.asMonths=to,fo.asYears=eo,fo.valueOf=ni,fo._bubble=Xn,fo.get=ri,fo.milliseconds=no,fo.seconds=io,fo.minutes=ro,fo.hours=oo,fo.days=so,fo.weeks=si,fo.months=ao,fo.years=uo,fo.humanize=di,fo.toISOString=hi,fo.toString=hi,fo.toJSON=hi,fo.locale=ln,fo.localeData=dn,fo.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",hi),fo.lang=Ur,Q("X",0,0,"unix"),Q("x",0,0,"valueOf"),q("x",Vi),q("X",zi),tt("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),tt("x",function(t,e,n){n._d=new Date(v(t))}),t.version="2.14.1",e(ye),t.fn=Qr,t.min=ve,t.max=ke,t.now=jr,t.utc=c,t.unix=Wn,t.months=Hn,t.isDate=o,t.locale=Bt,t.invalid=f,t.duration=Ue,t.isMoment=y,t.weekdays=Vn,t.parseZone=Fn,t.localeData=te,t.isDuration=Se,t.monthsShort=Gn,t.weekdaysMin=Jn,t.defineLocale=Xt,t.updateLocale=Kt,t.locales=ee,t.weekdaysShort=Qn,t.normalizeUnits=I,t.relativeTimeRounding=ci,t.relativeTimeThreshold=li,t.calendarFormat=Qe,t.prototype=Qr;var po=t;return po});
window.onload = function() {
var username = document.getElementById('now').dataset.username;
var log = new Asteroid("35.166.92.59");
log.subscribe('myNow', username);
var Nows = log.getCollection('nows');
var myNow = Nows.reactiveQuery({});
myNow.on('change', function() {
var result = myNow.result[0].body;
result = result.concat('<div class="ui label small">This page was inspired by <a href="https://sivers.org/nowff">Derek Sivers</a>, powered by <a href="http://loggggg.site/">Now</a>. Last update:',moment().startOf(myNow.result[0].createdAt).fromNow(),'</div>');
document.getElementById('now').innerHTML = result;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment