futoin-asyncsteps
Version:
Mimic traditional threads in single threaded event loop
1 lines • 20.5 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["futoin-asyncsteps"]=t():e.$as=t()}(self,(()=>{return e={502:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function u(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var c=n(839),s=n(558).InternalError,a=n(5),l=n(12),f=n(464),h=f.isProduction,_=f.checkFunc,p=f.checkOnError,v=f.noop,y=f.loop,m=f.repeat,d=f.forEach,b=f.as_await,g=f.EMPTY_ARRAY,x=f.newExecStack,k=h?v:function(e){e._stack.length>0&&e.error(s,"Top level add in execution")},w=h?v:function(e,t,n){k(e),_(e,t),p(e,n)},E=100,S=null,A=function(e){e._post_exec=v,e._execute()},q=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),null===n&&(n=function(){return this.state}),this.state=n,this._queue=[],this._stack=[],this._exec_stack=x(),this._in_exec=!1,this._post_exec=v,this._exec_event=null,this._next_args=g,this._async_tool=r;var o=r.callImmediate,i=function(){E=100,S=t,t._exec_event=null,t._execute()};this._scheduleExecute=function(){--E<=0||!t._in_exec||S!==t?t._exec_event=o(i):t._in_exec&&(t._post_exec=A)}}return t=e,n=[{key:"add",value:function(e,t){return w(this,e,t),this._queue.push([e,t]),this}},{key:"parallel",value:function(e){k(this),p(this,e);var t=new l(this,this);return this._queue.push([function(e){t.executeParallel(e)},e]),t}},{key:"sync",value:function(e,t,n){return w(this,t,n),e.sync(this,t,n),this}},{key:"error",value:function(e,t){this.state.error_info=t;var n=new Error(e);throw this._in_exec||(this.state.last_exception=n,this._handle_error(e)),n}},{key:"copyFrom",value:function(e){this._queue.push.apply(this._queue,e._queue);var t=e.state,n=this.state;for(var r in t)r in n||(n[r]=t[r]);return this}},{key:"_handle_success",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,t=this._stack;t.length||this.error(s,"Invalid success completion"),this._next_args=e;for(var n=t[t.length-1];;){var r=n._limit_event;if(r&&(this._async_tool.cancelCall(r),n._limit_event=null),n._cleanup(),t.pop(),!t.length)break;if((n=t[t.length-1])._queue.length)break}(t.length||this._queue.length)&&this._scheduleExecute()}},{key:"_handle_error",value:function(e){if(this._exec_event)this.cancel();else{this._next_args=g;var t=this._stack,n=this._exec_stack;this.state.async_stack=n;for(var r=this._in_exec,o=!0;t.length;){var i=t[t.length-1],u=i._limit_event,c=i._on_cancel,s=i._on_error;if(u&&(this._async_tool.cancelCall(u),i._limit_event=null),c&&(c.call(null,i),i._on_cancel=null),s){var a=t.length;i._queue=null,i._on_error=null,n.push(s);try{if(this._in_exec=!0,s.call(null,i,e),a!==t.length){o=!1;break}if(null!==i._queue){o=!1,this._scheduleExecute();break}}catch(t){this.state.last_exception=t,e=t.message}finally{this._in_exec=r}}i._cleanup(),t.pop()}o?this._queue=[]:r||this._post_exec(this)}}},{key:"cancel",value:function(){this._next_args=g;var e=this._exec_event;e&&(this._async_tool.cancelImmediate(e),this._exec_event=null);for(var t=this._stack,n=this._async_tool;t.length;){var r=t.pop(),o=r._limit_event,i=r._on_cancel;o&&(n.cancelCall(o),r._limit_event=null),i&&(i.call(null,r),r._on_cancel=null),r._cleanup()}return this._queue=[],this}},{key:"execute",value:function(){var e=S;return S=this,this._execute(),S=e,this}},{key:"_execute",value:function(){var e,t=this._stack;if((e=t.length?t[t.length-1]._queue:this._queue).length){var n=e.shift(),r=n[0];this._exec_stack.push(r);var i=this._next_args,u=i.length,c=new a(this,n[1],i);t.push(c);try{var s=t.length;this._in_exec=!0,u?(this._next_args=g,r.apply(void 0,[c].concat(function(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(i)))):r(c),s===t.length&&(null!==c._queue?this._scheduleExecute():c._on_cancel||c._limit_event||this._handle_success(this._next_args))}catch(e){this.state.last_exception=e,this._handle_error(e.message)}finally{this._in_exec=!1}this._post_exec(this)}}},{key:"_burst_success",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;try{this._in_exec=!0,S=this,this._handle_success(e)}catch(e){this.state.last_exception=e,this._handle_error(e.message)}finally{this._in_exec=!1}this._post_exec(this)}},{key:"loop",value:function(e,t){return w(this,e),y(this,this,e,t),this}},{key:"repeat",value:function(e,t,n){return w(this,t),m(this,this,e,t,n),this}},{key:"forEach",value:function(e,t,n){return w(this,t),d(this,this,e,t,n),this}},{key:"successStep",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];k(this);var o=this._queue;return o.length>0?o.push([function(){e._handle_success(n)},void 0]):this._next_args=n,this}},{key:"await",value:function(e,t){return k(this),b(this,this,e,t),this}},{key:"promise",value:function(){var e=this;return k(this),new Promise((function(t,n){var r=e._queue;e._queue=[[function(e){e._queue=r},function(e,t){n(new Error(t))}],[function(e,n){t(n)},void 0]],S=e,e._execute()}))}},{key:"newInstance",value:function(){return new e(null,this._async_tool)}},{key:"isAsyncSteps",value:function(){return!0}}],n&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();e.exports=q},558:e=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,o(r.key),r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}var i=r((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}));["ConnectError","CommError","UnknownInterface","NotSupportedVersion","NotImplemented","Unauthorized","InternalError","InvokerError","InvalidRequest","DefenseRejected","PleaseReauth","SecurityError","Timeout","LoopBreak","LoopCont"].forEach((function(e){return Object.defineProperty(i,e,{enumerable:!0,value:e})})),e.exports=i},5:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var u=n(12),c=n(558),s=c.InternalError,a=c.Timeout,l=c.LoopBreak,f=c.LoopCont,h=n(464),_=h.isProduction,p=h.checkFunc,v=h.checkOnError,y=h.noop,m=h.loop,d=h.repeat,b=h.forEach,g=h.LOOP_TERM_LABEL,x=h.as_await,k=_?y:function(e){var t=e._root;if(t){var n=t._stack;if(n){if(n[n.length-1]===e)return;t.error(s,"Invalid call (sanity check)")}}throw new Error("InternalError: Unexpected call, object is out of service")},w=_?y:function(e,t,n){k(e),p(e,t),v(e,n)},E=function(){return e=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._root=t,this.state=t.state,this._queue=null,this._call_args=r,this._on_error=n,this._on_cancel=null,this._limit_event=null},t=[{key:"add",value:function(e,t){w(this,e,t);var n=[e,t],r=this._queue;return r?r.push(n):this._queue=[n],this}},{key:"parallel",value:function(e){var t=new u(this._root,this);return this.add((function(e){t.executeParallel(e)}),e),t}},{key:"success",value:function(){k(this),null!==this._queue&&this.error(s,"Invalid success() call");for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._root._handle_success(t)}},{key:"error",value:function(e,t){k(this),this._root.error(e,t)}},{key:"setTimeout",value:function(e){var t=this;k(this);var n=this._root._async_tool;return null!==this._limit_event&&n.cancelCall(this._limit_event),this._limit_event=n.callLater((function(){!function(e){e._limit_event=null;var t=e.state;t.error_info=void 0,t.last_exception=new Error(a),e._root._handle_error(a)}(t)}),e),this}},{key:"setCancel",value:function(e){return this._on_cancel=e,this}},{key:"waitExternal",value:function(){return this._on_cancel=y,this}},{key:"copyFrom",value:function(e){if(k(this),e._queue.length){var t=this._queue;null===t&&(t=[],this._queue=t),t.push.apply(t,e._queue)}var n=e.state,r=this.state;for(var o in n)void 0===r[o]&&(r[o]=n[o]);return this}},{key:"loop",value:function(e,t){return w(this,e),m(this,this._root,e,t),this}},{key:"repeat",value:function(e,t,n){return w(this,t),d(this,this._root,e,t,n),this}},{key:"forEach",value:function(e,t,n){return w(this,t),b(this,this._root,e,t,n),this}},{key:"break",value:function(e){k(this),this.state[g]=e,this._root.error(l)}},{key:"continue",value:function(e){k(this),this.state[g]=e,this._root.error(f)}},{key:"successStep",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];k(this);var o=this._queue;return o&&o.length?o.push([function(){e._root._handle_success(n)},void 0]):this._root._next_args=n,this}},{key:"await",value:function(e,t){return k(this),x(this,this._root,e,t),this}},{key:"sync",value:function(e,t,n){return w(this,t,n),e.sync(this,t,n),this}},{key:"newInstance",value:function(){return this._root.newInstance()}},{key:"isAsyncSteps",value:function(){return!0}},{key:"_cleanup",value:function(){this._root=null,this.state=null}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=E},839:(e,t)=>{"use strict";if(t=e.exports={},"undefined"==typeof setImmediate){t.callLater=function(e,t){return setTimeout(e,t)},t.cancelCall=function(e){return clearTimeout(e)},window._FutoInEventLoopQueue=window._FutoInEventLoopQueue||[];var n=window._FutoInEventLoopQueue,r=window.performance,o=null,i=function(){o&&clearTimeout(o),o=setTimeout(u,0)},u=function(){o=null;for(var e=r.now()+10;n.length;){var t=n.shift();try{t()}catch(e){throw i(),e}if(r.now()>=e){i();break}}};t.callImmediate=function(e){n.length||i();var t=function(){e()};return n.push(t),t},t.cancelImmediate=function(e){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}else t.callLater=function(e,t){return setTimeout(e,t)},t.cancelCall=function(e){clearTimeout(e)},t.callImmediate=function(e){return setImmediate(e)},t.cancelImmediate=function(e){clearImmediate(e)}},451:(e,t,n)=>{"use strict";var r=n(491),o=[];(t=e.exports={}).callLater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=1e3*r();t&&(n+=t);for(var i={f:e,t:n},u=0;u<o.length;++u)if(o[u].t>n)return void o.splice(u,0,i);return o.push(i),i},t.cancelCall=function(e){var t=o.indexOf(e);t>=0&&o.splice(t,1)},t.nextEvent=function(){o.shift().f()},t.hasEvents=function(){return o.length>0},t.getEvents=function(){return o},t.resetEvents=function(){o.splice(0,o.length)},t.run=function(){for(;this.hasEvents();)this.nextEvent()},t.callImmediate=t.callLater,t.cancelImmediate=t.cancelCall},12:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var u=n(464),c=u.checkFunc,s=u.checkOnError,a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._root=t,this._as=n,this._queue=[],this._psteps=[],this._complete_count=0}return t=e,(n=[{key:"add",value:function(e,t){return c(this,e),s(this,t),this._queue.push([e,t]),this}},{key:"_complete",value:function(){this._complete_count+=1,this._complete_count===this._psteps.length&&(this._as._root._handle_success(),this._cleanup())}},{key:"_error",value:function(e,t){try{this._as.error(e,t)}catch(e){}}},{key:"executeParallel",value:function(t){var n=this,r=this._queue,o=this._root;if(o!==t._root){var i=new e(t._root,t);return i._queue.push.apply(i._queue,r),void i.executeParallel(t)}if(this._as=t,r.length){t._on_cancel=function(){n.cancel()};var u=this._psteps,c=function(e){n._complete()},s=function(e,t){n._error(t,e.state.error_info)},a=o.constructor;r.forEach((function(e){var n=new a(t.state,o._async_tool);n._queue.push([function(t){t._queue=[[e[0],e[1]]]},s],[c,void 0]),u.push(n)})),u.forEach((function(e){e.execute()}))}else this._complete()}},{key:"cancel",value:function(){this._psteps.forEach((function(e){e.cancel()})),this._cleanup()}},{key:"isAsyncSteps",value:function(){return!0}},{key:"_cleanup",value:function(){this._root=null,this._as=null,this._psteps=null}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();e.exports=a},862:(e,t,n)=>{"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.AsyncSteps){var o=n(360);t.$as=o,r.$as=o,t.FutoInError=o.FutoInError,r.AsyncSteps=o.AsyncSteps,t.FutoIn=r,t.futoin=r}e.exports=r.$as}(window)},464:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c=n(558),s=(c.InternalError,c.LoopCont),a=c.LoopBreak,l="undefined"==typeof Symbol?function(e){return e}:function(e){return Symbol(e)},f=l("_loop_term_label"),h=function(e,t,n,r,o){o&&o()||e.add((function(e){var i=e.state,u=t._exec_stack,c=u.length,l=[n,function(t,n){!function(e,t,n,r,o){if(t===s){var i=r[f];i&&i!==o||(r.last_exception=null,e._root._handle_success())}else if(t===a){var u=r[f];u&&u!==o||(r.last_exception=null,n._queue.length=0,e._root._handle_success())}}(t,n,e,i,r)}],h=[function(e){o&&o()||(u.length=c,_())},null],_=function(){e._queue=[l,h]};_()}))},_=function(e,t,n,r,o){var i=0,u=n;h(e,t,(function(e){r(e,i++)}),o,(function(){return i>=u}))},p=[];Object.freeze(p);var v=function(){};e.exports=t={noop:v,makeSym:l,loop:h,repeat:_,forEach:function(e,t,n,r,o){if(Array.isArray(n)){var i=n;_(e,t,i.length,(function(e,t){r(e,t,i[t])}),o)}else if("undefined"!=typeof Map&&n instanceof Map){var c=n.entries();h(e,t,(function(e){var t=c.next();t.done&&e.break();var n,o,i=(n=t.value,o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,u,c=[],s=!0,a=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){a=!0,o=e}finally{try{if(!s&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(a)throw o}}return c}}(n,o)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=i[0],a=i[1];r(e,s,a)}),o)}else{var s=n,a=Object.keys(s);_(e,t,a.length,(function(e,t){r(e,a[t],s[a[t]])}),o)}},LOOP_TERM_LABEL:f,as_await:function(e,t,n,r){var o,i;n.then((function(e){o?o.state&&t._burst_success([e]):i=function(){t._handle_success([e])}}),(function(e){o?function(e,t,n){var r=e.state;if(r){var o="PromiseReject";if(e._on_cancel=null,n instanceof Error)r.last_exception=n,r.error_info=void 0,t._handle_error(o);else{var i=n||o;r.last_exception=new Error(i),r.error_info=void 0,t._handle_error(i)}}}(o,t,e):(o=null,i=e instanceof Error?function(){throw e}:function(t){t.error(e||"PromiseReject")})})),e.add((function(e){i?i(e):(o=e,e._on_cancel=function(){if(o){o=null;try{n.cancel()}catch(e){}}})}),r)},EMPTY_ARRAY:p,prev_queue:function(e){var t=e._stack,n=t.length;return n>1?t[n-2]._queue:e._queue}},t.isProduction=!0,t.checkFunc=v,t.checkOnError=v;var y=new(function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"push",value:function(){}},{key:"length",get:function(){return 0},set:function(e){}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}());Object.freeze(y),t.newExecStack=function(){return y}},360:(e,t,n)=>{"use strict";var r=n(839),o=n(451),i=n(558),u=n(502),c=n(464).isProduction;(t=e.exports=function(){return new u(null,t.ActiveAsyncTool)}).ActiveAsyncTool=r,t.AsyncTool=r,t.AsyncToolTest=o,t.FutoInError=i,t.Errors=i,t.AsyncSteps=u,t.isProduction=c,t.installAsyncToolTest=function(e){t.ActiveAsyncTool=!1===e?r:o},t.assertAS=function(e){try{if(e.isAsyncSteps())return}catch(e){}throw new Error("Not an instance of AsyncSteps: ".concat(e))}},491:function(e){(function(){var t,n,r,o,i,u;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-i)/1e6},n=process.hrtime,o=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),u=1e9*process.uptime(),i=o-u):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)}},t={},function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(862);var e,t}));