xpuz
Version:
Parses and creates crossword puzzle files
1 lines • 427 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.XPuz=t():e.XPuz=t()}(global,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/index.js")}({"./node_modules/bluebird/js/browser/bluebird.js":function(e,t,n){var o;o=function(){var e,t,n;return function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,(function(e){var n=t[s][1][e];return r(n||e)}),l,l.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof _dereq_&&_dereq_,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,t,n){"use strict";t.exports=function(e){var t=e._SomePromiseArray;function n(e){var n=new t(e),o=n.promise();return n.setHowMany(1),n.setUnwrap(),n.init(),o}e.any=function(e){return n(e)},e.prototype.any=function(){return n(this)}}},{}],2:[function(e,t,n){"use strict";var o;try{throw new Error}catch(e){o=e}var r=e("./schedule"),i=e("./queue"),s=e("./util");function a(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new i(16),this._normalQueue=new i(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=r}function c(e,t,n){this._lateQueue.push(e,t,n),this._queueTick()}function u(e,t,n){this._normalQueue.push(e,t,n),this._queueTick()}function l(e){this._normalQueue._pushOne(e),this._queueTick()}a.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},a.prototype.hasCustomScheduler=function(){return this._customScheduler},a.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},a.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},a.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},a.prototype.fatalError=function(e,t){t?(process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),process.exit(2)):this.throwLater(e)},a.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout((function(){e(t)}),0);else try{this._schedule((function(){e(t)}))}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(a.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?c.call(this,e,t,n):this._schedule((function(){setTimeout((function(){e.call(t,n)}),100)}))},a.prototype.invoke=function(e,t,n){this._trampolineEnabled?u.call(this,e,t,n):this._schedule((function(){e.call(t,n)}))},a.prototype.settlePromises=function(e){this._trampolineEnabled?l.call(this,e):this._schedule((function(){e._settlePromises()}))}):(a.prototype.invokeLater=c,a.prototype.invoke=u,a.prototype.settlePromises=l),a.prototype._drainQueue=function(e){for(;e.length()>0;){var t=e.shift();if("function"==typeof t){var n=e.shift(),o=e.shift();t.call(n,o)}else t._settlePromises()}},a.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},a.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},a.prototype._reset=function(){this._isTickUsed=!1},t.exports=a,t.exports.firstLineError=o},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,o){var r=!1,i=function(e,t){this._reject(t)},s=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(i,i,null,this,e)},a=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},c=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(i){r||(r=!0,e.prototype._propagateFrom=o.propagateFromFunction(),e.prototype._boundValue=o.boundValueFunction());var u=n(i),l=new e(t);l._propagateFrom(this,1);var d=this._target();if(l._setBoundTo(u),u instanceof e){var f={promiseRejectionQueued:!1,promise:l,target:d,bindingPromise:u};d._then(t,s,void 0,l,f),u._then(a,c,void 0,l,f),l._setOnCancel(u)}else l._resolveCallback(d);return l},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){"use strict";var o;"undefined"!=typeof Promise&&(o=Promise);var r=e("./promise")();r.noConflict=function(){try{Promise===r&&(Promise=o)}catch(e){}return r},t.exports=r},{"./promise":22}],5:[function(e,t,n){"use strict";var o=Object.create;if(o){var r=o(null),i=o(null);r[" size"]=i[" size"]=0}t.exports=function(t){var n=e("./util"),o=n.canEvaluate;function r(e){return function(e,o){var r;if(null!=e&&(r=e[o]),"function"!=typeof r){var i="Object "+n.classString(e)+" has no method '"+n.toString(o)+"'";throw new t.TypeError(i)}return r}(e,this.pop()).apply(e,this)}function i(e){return e[this]}function s(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}n.isIdentifier,t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(r,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t;if("number"==typeof e)t=s;else if(o){var n=(void 0)(e);t=null!==n?n:i}else t=i;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){"use strict";t.exports=function(t,n,o,r){var i=e("./util"),s=i.tryCatch,a=i.errorObj,c=t._async;t.prototype.break=t.prototype.cancel=function(){if(!r.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(i.isArray(e))for(var n=0;n<e.length;++n)this._doInvokeOnCancel(e[n],t);else if(void 0!==e)if("function"==typeof e){if(!t){var o=s(e).call(this._boundValue());o===a&&(this._attachExtraTrace(o.e),c.throwLater(o.e))}}else e._resultCancelled(this)},t.prototype._invokeOnCancel=function(){var e=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,e)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(e,t,n){"use strict";t.exports=function(t){var n=e("./util"),o=e("./es5").keys,r=n.tryCatch,i=n.errorObj;return function(e,s,a){return function(c){var u=a._boundValue();e:for(var l=0;l<e.length;++l){var d=e[l];if(d===Error||null!=d&&d.prototype instanceof Error){if(c instanceof d)return r(s).call(u,c)}else if("function"==typeof d){var f=r(d).call(u,c);if(f===i)return f;if(f)return r(s).call(u,c)}else if(n.isObject(c)){for(var h=o(d),p=0;p<h.length;++p){var _=h[p];if(d[_]!=c[_])continue e}return r(s).call(u,c)}}return t}}}},{"./es5":13,"./util":36}],8:[function(e,t,n){"use strict";t.exports=function(e){var t=!1,n=[];function o(){this._trace=new o.CapturedTrace(r())}function r(){var e=n.length-1;if(e>=0)return n[e]}return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},o.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},o.prototype._popContext=function(){if(void 0!==this._trace){var e=n.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},o.CapturedTrace=null,o.create=function(){if(t)return new o},o.deactivateLongStackTraces=function(){},o.activateLongStackTraces=function(){var n=e.prototype._pushContext,i=e.prototype._popContext,s=e._peekContext,a=e.prototype._peekContext,c=e.prototype._promiseCreated;o.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=i,e._peekContext=s,e.prototype._peekContext=a,e.prototype._promiseCreated=c,t=!1},t=!0,e.prototype._pushContext=o.prototype._pushContext,e.prototype._popContext=o.prototype._popContext,e._peekContext=e.prototype._peekContext=r,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},o}},{}],9:[function(e,t,n){"use strict";t.exports=function(t,n){var o,r,i,s=t._getDomain,a=t._async,c=e("./errors").Warning,u=e("./util"),l=u.canAttachTrace,d=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,f=/\((?:timers\.js):\d+:\d+\)/,h=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,p=null,_=null,v=!1,m=!(0==u.env("BLUEBIRD_DEBUG")),b=!(0==u.env("BLUEBIRD_WARNINGS")||!m&&!u.env("BLUEBIRD_WARNINGS")),y=!(0==u.env("BLUEBIRD_LONG_STACK_TRACES")||!m&&!u.env("BLUEBIRD_LONG_STACK_TRACES")),g=0!=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));t.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},t.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout((function(){e._notifyUnhandledRejection()}),1)}},t.prototype._notifyUnhandledRejectionIsHandled=function(){V("rejectionHandled",o,void 0,this)},t.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},t.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},t.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),V("unhandledRejection",r,e,this)}},t.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},t.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},t.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},t.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},t.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},t.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},t.prototype._warn=function(e,t,n){return D(e,t,n||this)},t.onPossiblyUnhandledRejection=function(e){var t=s();r="function"==typeof e?null===t?e:u.domainBind(t,e):void 0},t.onUnhandledRejectionHandled=function(e){var t=s();o="function"==typeof e?null===t?e:u.domainBind(t,e):void 0};var j=function(){};t.longStackTraces=function(){if(a.haveItemsQueued()&&!X.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!X.longStackTraces&&H()){var e=t.prototype._captureStackTrace,o=t.prototype._attachExtraTrace;X.longStackTraces=!0,j=function(){if(a.haveItemsQueued()&&!X.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");t.prototype._captureStackTrace=e,t.prototype._attachExtraTrace=o,n.deactivateLongStackTraces(),a.enableTrampoline(),X.longStackTraces=!1},t.prototype._captureStackTrace=N,t.prototype._attachExtraTrace=L,n.activateLongStackTraces(),a.disableTrampolineIfNecessary()}},t.hasLongStackTraces=function(){return X.longStackTraces&&H()};var w=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return u.global.dispatchEvent(e),function(e,t){var n=new CustomEvent(e.toLowerCase(),{detail:t,cancelable:!0});return!u.global.dispatchEvent(n)}}return"function"==typeof Event?(e=new Event("CustomEvent"),u.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,!u.global.dispatchEvent(n)}):((e=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),u.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!u.global.dispatchEvent(n)})}catch(e){}return function(){return!1}}(),E=u.isNode?function(){return process.emit.apply(process,arguments)}:u.global?function(e){var t="on"+e.toLowerCase(),n=u.global[t];return!!n&&(n.apply(u.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function C(e,t){return{promise:t}}var x={promiseCreated:C,promiseFulfilled:C,promiseRejected:C,promiseResolved:C,promiseCancelled:C,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:C},S=function(e){var t=!1;try{t=E.apply(null,arguments)}catch(e){a.throwLater(e),t=!0}var n=!1;try{n=w(e,x[e].apply(null,arguments))}catch(e){a.throwLater(e),n=!0}return n||t};function A(){return!1}function T(e,t,n){var o=this;try{e(t,n,(function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+u.toString(e));o._attachCancellationCallback(e)}))}catch(e){return e}}function k(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?u.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function O(){return this._onCancelField}function R(e){this._onCancelField=e}function F(){this._cancellationParent=void 0,this._onCancelField=void 0}function P(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}t.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?t.longStackTraces():!e.longStackTraces&&t.hasLongStackTraces()&&j()),"warnings"in e){var n=e.warnings;X.warnings=!!n,g=X.warnings,u.isObject(n)&&"wForgottenReturn"in n&&(g=!!n.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!X.cancellation){if(a.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");t.prototype._clearCancellationData=F,t.prototype._propagateFrom=P,t.prototype._onCancel=O,t.prototype._setOnCancel=R,t.prototype._attachCancellationCallback=k,t.prototype._execute=T,B=P,X.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!X.monitoring?(X.monitoring=!0,t.prototype._fireEvent=S):!e.monitoring&&X.monitoring&&(X.monitoring=!1,t.prototype._fireEvent=A)),t},t.prototype._fireEvent=A,t.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},t.prototype._onCancel=function(){},t.prototype._setOnCancel=function(e){},t.prototype._attachCancellationCallback=function(e){},t.prototype._captureStackTrace=function(){},t.prototype._attachExtraTrace=function(){},t.prototype._clearCancellationData=function(){},t.prototype._propagateFrom=function(e,t){};var B=function(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)};function I(){var e=this._boundTo;return void 0!==e&&e instanceof t?e.isFulfilled()?e.value():void 0:e}function N(){this._trace=new W(this._peekContext())}function L(e,t){if(l(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var o=M(e);u.notEnumerableProp(e,"stack",o.message+"\n"+o.stack.join("\n")),u.notEnumerableProp(e,"__stackCleaned__",!0)}}}function D(e,n,o){if(X.warnings){var r,i=new c(e);if(n)o._attachExtraTrace(i);else if(X.longStackTraces&&(r=t._peekContext()))r.attachExtraTrace(i);else{var s=M(i);i.stack=s.message+"\n"+s.stack.join("\n")}S("warning",i)||z(i,"",!0)}}function U(e){for(var t=[],n=0;n<e.length;++n){var o=e[n],r=" (No stack trace)"===o||p.test(o),i=r&&q(o);r&&!i&&(v&&" "!==o.charAt(0)&&(o=" "+o),t.push(o))}return t}function M(e){var t=e.stack,n=e.toString();return t="string"==typeof t&&t.length>0?function(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),n=0;n<t.length;++n){var o=t[n];if(" (No stack trace)"===o||p.test(o))break}return n>0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:U(t)}}function z(e,t,n){if("undefined"!=typeof console){var o;if(u.isObject(e)){var r=e.stack;o=t+_(r,e)}else o=t+String(e);"function"==typeof i?i(o,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(o)}}function V(e,t,n,o){var r=!1;try{"function"==typeof t&&(r=!0,"rejectionHandled"===e?t(o):t(n,o))}catch(e){a.throwLater(e)}"unhandledRejection"===e?S(e,n,o)||r||z(n,"Unhandled rejection "):S(e,o)}function G(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{if(t=e&&"function"==typeof e.toString?e.toString():u.toString(e),/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+function(e){return e.length<41?e:e.substr(0,38)+"..."}(t)+">, no stack trace)"}function H(){return"function"==typeof $}var q=function(){return!1},Y=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function K(e){var t=e.match(Y);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function W(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);$(this,W),t>32&&this.uncycle()}u.inherits(W,Error),n.CapturedTrace=W,W.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},o=0,r=this;void 0!==r;++o)t.push(r),r=r._parent;for(o=(e=this._length=o)-1;o>=0;--o){var i=t[o].stack;void 0===n[i]&&(n[i]=o)}for(o=0;o<e;++o){var s=n[t[o].stack];if(void 0!==s&&s!==o){s>0&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[o]._parent=void 0,t[o]._length=1;var a=o>0?t[o-1]:this;s<e-1?(a._parent=t[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var c=a._length+1,u=o-2;u>=0;--u)t[u]._length=c,c++;return}}}},W.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=M(e),n=t.message,o=[t.stack],r=this;void 0!==r;)o.push(U(r.stack.split("\n"))),r=r._parent;!function(e){for(var t=e[0],n=1;n<e.length;++n){for(var o=e[n],r=t.length-1,i=t[r],s=-1,a=o.length-1;a>=0;--a)if(o[a]===i){s=a;break}for(a=s;a>=0;--a){var c=o[a];if(t[r]!==c)break;t.pop(),r--}t=o}}(o),function(e){for(var t=0;t<e.length;++t)(0===e[t].length||t+1<e.length&&e[t][0]===e[t+1][0])&&(e.splice(t,1),t--)}(o),u.notEnumerableProp(e,"stack",function(e,t){for(var n=0;n<t.length-1;++n)t[n].push("From previous event:"),t[n]=t[n].join("\n");return n<t.length&&(t[n]=t[n].join("\n")),e+"\n"+t.join("\n")}(n,o)),u.notEnumerableProp(e,"__stackCleaned__",!0)}};var $=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():G(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,p=e,_=t;var n=Error.captureStackTrace;return q=function(e){return d.test(e)},function(e,t){Error.stackTraceLimit+=6,n(e,t),Error.stackTraceLimit-=6}}var o,r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return p=/@/,_=t,v=!0,function(e){e.stack=(new Error).stack};try{throw new Error}catch(e){o="stack"in e}return"stack"in r||!o||"number"!=typeof Error.stackTraceLimit?(_=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?G(t):t.toString()},null):(p=e,_=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(i=function(e){console.warn(e)},u.isNode&&process.stderr.isTTY?i=function(e,t){var n=t?"[33m":"[31m";console.warn(n+e+"[0m\n")}:u.isNode||"string"!=typeof(new Error).stack||(i=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var X={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return y&&t.longStackTraces(),{longStackTraces:function(){return X.longStackTraces},warnings:function(){return X.warnings},cancellation:function(){return X.cancellation},monitoring:function(){return X.monitoring},propagateFromFunction:function(){return B},boundValueFunction:function(){return I},checkForgottenReturns:function(e,t,n,o,r){if(void 0===e&&null!==t&&g){if(void 0!==r&&r._returnedNonUndefined())return;if(0==(65535&o._bitField))return;n&&(n+=" ");var i="",s="";if(t._trace){for(var a=t._trace.stack.split("\n"),c=U(a),u=c.length-1;u>=0;--u){var l=c[u];if(!f.test(l)){var d=l.match(h);d&&(i="at "+d[1]+":"+d[2]+":"+d[3]+" ");break}}if(c.length>0){var p=c[0];for(u=0;u<a.length;++u)if(a[u]===p){u>0&&(s="\n"+a[u-1]);break}}}var _="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+s;o._warn(_,!0,t)}},setBounds:function(e,t){if(H()){for(var n,o,r=e.stack.split("\n"),i=t.stack.split("\n"),s=-1,a=-1,c=0;c<r.length;++c)if(u=K(r[c])){n=u.fileName,s=u.line;break}for(c=0;c<i.length;++c){var u;if(u=K(i[c])){o=u.fileName,a=u.line;break}}s<0||a<0||!n||!o||n!==o||s>=a||(q=function(e){if(d.test(e))return!0;var t=K(e);return!!(t&&t.fileName===n&&s<=t.line&&t.line<=a)})}},warn:D,deprecated:function(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),D(n)},CapturedTrace:W,fireDomEvent:w,fireGlobalEvent:E}}},{"./errors":12,"./util":36}],10:[function(e,t,n){"use strict";t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1],o=function(){throw t};return this.caught(e,o)},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var o=arguments[1];o instanceof e&&o.suppressUnhandledRejections();var r=function(){return o};return this.caught(n,r)}}},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.reduce,o=e.all;function r(){return o(this)}e.prototype.each=function(e){return n(this,e,t,0)._then(r,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return n(this,e,t,t)},e.each=function(e,o){return n(e,o,t,0)._then(r,void 0,void 0,e,void 0)},e.mapSeries=function(e,o){return n(e,o,t,t)}}},{}],12:[function(e,t,n){"use strict";var o,r,i=e("./es5"),s=i.freeze,a=e("./util"),c=a.inherits,u=a.notEnumerableProp;function l(e,t){function n(o){if(!(this instanceof n))return new n(o);u(this,"message","string"==typeof o?o:t),u(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return c(n,Error),n}var d=l("Warning","warning"),f=l("CancellationError","cancellation error"),h=l("TimeoutError","timeout error"),p=l("AggregateError","aggregate error");try{o=TypeError,r=RangeError}catch(e){o=l("TypeError","type error"),r=l("RangeError","range error")}for(var _="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),v=0;v<_.length;++v)"function"==typeof Array.prototype[_[v]]&&(p.prototype[_[v]]=Array.prototype[_[v]]);i.defineProperty(p.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),p.prototype.isOperational=!0;var m=0;function b(e){if(!(this instanceof b))return new b(e);u(this,"name","OperationalError"),u(this,"message",e),this.cause=e,this.isOperational=!0,e instanceof Error?(u(this,"message",e.message),u(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}p.prototype.toString=function(){var e=Array(4*m+1).join(" "),t="\n"+e+"AggregateError of:\n";m++,e=Array(4*m+1).join(" ");for(var n=0;n<this.length;++n){for(var o=this[n]===this?"[Circular AggregateError]":this[n]+"",r=o.split("\n"),i=0;i<r.length;++i)r[i]=e+r[i];t+=(o=r.join("\n"))+"\n"}return m--,t},c(b,Error);var y=Error.__BluebirdErrorTypes__;y||(y=s({CancellationError:f,TimeoutError:h,OperationalError:b,RejectionError:b,AggregateError:p}),i.defineProperty(Error,"__BluebirdErrorTypes__",{value:y,writable:!1,enumerable:!1,configurable:!1})),t.exports={Error:Error,TypeError:o,RangeError:r,CancellationError:y.CancellationError,OperationalError:y.OperationalError,TimeoutError:y.TimeoutError,AggregateError:y.AggregateError,Warning:d}},{"./es5":13,"./util":36}],13:[function(e,t,n){var o=function(){"use strict";return void 0===this}();if(o)t.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:o,propertyIsWritable:function(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!(n&&!n.writable&&!n.set)}};else{var r={}.hasOwnProperty,i={}.toString,s={}.constructor.prototype,a=function(e){var t=[];for(var n in e)r.call(e,n)&&t.push(n);return t};t.exports={isArray:function(e){try{return"[object Array]"===i.call(e)}catch(e){return!1}},keys:a,names:a,defineProperty:function(e,t,n){return e[t]=n.value,e},getDescriptor:function(e,t){return{value:e[t]}},freeze:function(e){return e},getPrototypeOf:function(e){try{return Object(e).constructor.prototype}catch(e){return s}},isES5:o,propertyIsWritable:function(){return!0}}}},{}],14:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.map;e.prototype.filter=function(e,o){return n(this,e,o,t)},e.filter=function(e,o,r){return n(e,o,r,t)}}},{}],15:[function(e,t,n){"use strict";t.exports=function(t,n,o){var r=e("./util"),i=t.CancellationError,s=r.errorObj,a=e("./catch_filter")(o);function c(e,t,n){this.promise=e,this.type=t,this.handler=n,this.called=!1,this.cancelPromise=null}function u(e){this.finallyHandler=e}function l(e,t){return null!=e.cancelPromise&&(arguments.length>1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function d(){return h.call(this,this.promise._target()._settledValue())}function f(e){if(!l(this,e))return s.e=e,s}function h(e){var r=this.promise,a=this.handler;if(!this.called){this.called=!0;var c=this.isFinallyHandler()?a.call(r._boundValue()):a.call(r._boundValue(),e);if(c===o)return c;if(void 0!==c){r._setReturnedNonUndefined();var h=n(c,r);if(h instanceof t){if(null!=this.cancelPromise){if(h._isCancelled()){var p=new i("late cancellation observer");return r._attachExtraTrace(p),s.e=p,s}h.isPending()&&h._attachCancellationCallback(new u(this))}return h._then(d,f,void 0,this,void 0)}}}return r.isRejected()?(l(this),s.e=e,s):(l(this),e)}return c.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){l(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,o){return"function"!=typeof e?this.then():this._then(n,o,void 0,new c(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,h,h)},t.prototype.tap=function(e){return this._passThrough(e,1,h)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,h);var o,i=new Array(n-1),s=0;for(o=0;o<n-1;++o){var c=arguments[o];if(!r.isObject(c))return t.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+r.classString(c)));i[s++]=c}i.length=s;var u=arguments[o];return this._passThrough(a(i,u,this),1,void 0,h)},c}},{"./catch_filter":7,"./util":36}],16:[function(e,t,n){"use strict";t.exports=function(t,n,o,r,i,s){var a=e("./errors").TypeError,c=e("./util"),u=c.errorObj,l=c.tryCatch,d=[];function f(e,n,r,i){if(s.cancellation()){var a=new t(o),c=this._finallyPromise=new t(o);this._promise=a.lastly((function(){return c})),a._captureStackTrace(),a._setOnCancel(this)}else(this._promise=new t(o))._captureStackTrace();this._stack=i,this._generatorFunction=e,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof r?[r].concat(d):d,this._yieldedPromise=null,this._cancellationPhase=!1}c.inherits(f,i),f.prototype._isResolved=function(){return null===this._promise},f.prototype._cleanup=function(){this._promise=this._generator=null,s.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},f.prototype._promiseCancelled=function(){if(!this._isResolved()){var e;if(void 0!==this._generator.return)this._promise._pushContext(),e=l(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var n=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=n,this._promise._attachExtraTrace(n),this._promise._pushContext(),e=l(this._generator.throw).call(this._generator,n),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(e)}},f.prototype._promiseFulfilled=function(e){this._yieldedPromise=null,this._promise._pushContext();var t=l(this._generator.next).call(this._generator,e);this._promise._popContext(),this._continue(t)},f.prototype._promiseRejected=function(e){this._yieldedPromise=null,this._promise._attachExtraTrace(e),this._promise._pushContext();var t=l(this._generator.throw).call(this._generator,e);this._promise._popContext(),this._continue(t)},f.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null,e.cancel()}},f.prototype.promise=function(){return this._promise},f.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},f.prototype._continue=function(e){var n=this._promise;if(e===u)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(e.e,!1);var o=e.value;if(!0===e.done)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(o);var i=r(o,this._promise);if(i instanceof t||null!==(i=function(e,n,o){for(var i=0;i<n.length;++i){o._pushContext();var s=l(n[i])(e);if(o._popContext(),s===u){o._pushContext();var a=t.reject(u.e);return o._popContext(),a}var c=r(s,o);if(c instanceof t)return c}return null}(i,this._yieldHandlers,this._promise))){var s=(i=i._target())._bitField;0==(50397184&s)?(this._yieldedPromise=i,i._proxy(this,null)):0!=(33554432&s)?t._async.invoke(this._promiseFulfilled,this,i._value()):0!=(16777216&s)?t._async.invoke(this._promiseRejected,this,i._reason()):this._promiseCancelled()}else this._promiseRejected(new a("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(o))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")))},t.coroutine=function(e,t){if("function"!=typeof e)throw new a("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=Object(t).yieldHandler,o=f,r=(new Error).stack;return function(){var t=e.apply(this,arguments),i=new o(void 0,void 0,n,r),s=i.promise();return i._generator=t,i._promiseFulfilled(void 0),s}},t.coroutine.addYieldHandler=function(e){if("function"!=typeof e)throw new a("expecting a function but got "+c.classString(e));d.push(e)},t.spawn=function(e){if(s.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof e)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var o=new f(e,this),r=o.promise();return o._run(t.spawn),r}}},{"./errors":12,"./util":36}],17:[function(e,t,n){"use strict";t.exports=function(t,n,o,r,i,s){var a=e("./util");a.canEvaluate,a.tryCatch,a.errorObj,t.join=function(){var e,t=arguments.length-1;t>0&&"function"==typeof arguments[t]&&(e=arguments[t]);var o=[].slice.call(arguments);e&&o.pop();var r=new n(o).promise();return void 0!==e?r.spread(e):r}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(t,n,o,r,i,s){var a=t._getDomain,c=e("./util"),u=c.tryCatch,l=c.errorObj,d=t._async;function f(e,t,n,o){this.constructor$(e),this._promise._captureStackTrace();var r=a();this._callback=null===r?t:c.domainBind(r,t),this._preservedValues=o===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],d.invoke(this._asyncInit,this,void 0)}function h(e,n,r,i){if("function"!=typeof n)return o("expecting a function but got "+c.classString(n));var s=0;if(void 0!==r){if("object"!=typeof r||null===r)return t.reject(new TypeError("options argument must be an object but it is "+c.classString(r)));if("number"!=typeof r.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+c.classString(r.concurrency)));s=r.concurrency}return new f(e,n,s="number"==typeof s&&isFinite(s)&&s>=1?s:0,i).promise()}c.inherits(f,n),f.prototype._asyncInit=function(){this._init$(void 0,-2)},f.prototype._init=function(){},f.prototype._promiseFulfilled=function(e,n){var o=this._values,i=this.length(),a=this._preservedValues,c=this._limit;if(n<0){if(o[n=-1*n-1]=e,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return o[n]=e,this._queue.push(n),!1;null!==a&&(a[n]=e);var d=this._promise,f=this._callback,h=d._boundValue();d._pushContext();var p=u(f).call(h,e,n,i),_=d._popContext();if(s.checkForgottenReturns(p,_,null!==a?"Promise.filter":"Promise.map",d),p===l)return this._reject(p.e),!0;var v=r(p,this._promise);if(v instanceof t){var m=(v=v._target())._bitField;if(0==(50397184&m))return c>=1&&this._inFlight++,o[n]=v,v._proxy(this,-1*(n+1)),!1;if(0==(33554432&m))return 0!=(16777216&m)?(this._reject(v._reason()),!0):(this._cancel(),!0);p=v._value()}o[n]=p}return++this._totalResolved>=i&&(null!==a?this._filter(o,a):this._resolve(o),!0)},f.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight<t;){if(this._isResolved())return;var o=e.pop();this._promiseFulfilled(n[o],o)}},f.prototype._filter=function(e,t){for(var n=t.length,o=new Array(n),r=0,i=0;i<n;++i)e[i]&&(o[r++]=t[i]);o.length=r,this._resolve(o)},f.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(e,t){return h(this,e,t,null)},t.map=function(e,t,n,o){return h(e,t,n,o)}}},{"./util":36}],19:[function(e,t,n){"use strict";t.exports=function(t,n,o,r,i){var s=e("./util"),a=s.tryCatch;t.method=function(e){if("function"!=typeof e)throw new t.TypeError("expecting a function but got "+s.classString(e));return function(){var o=new t(n);o._captureStackTrace(),o._pushContext();var r=a(e).apply(this,arguments),s=o._popContext();return i.checkForgottenReturns(r,s,"Promise.method",o),o._resolveFromSyncValue(r),o}},t.attempt=t.try=function(e){if("function"!=typeof e)return r("expecting a function but got "+s.classString(e));var o,c=new t(n);if(c._captureStackTrace(),c._pushContext(),arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],l=arguments[2];o=s.isArray(u)?a(e).apply(l,u):a(e).call(l,u)}else o=a(e)();var d=c._popContext();return i.checkForgottenReturns(o,d,"Promise.try",c),c._resolveFromSyncValue(o),c},t.prototype._resolveFromSyncValue=function(e){e===s.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){"use strict";var o=e("./util"),r=o.maybeWrapAsError,i=e("./errors").OperationalError,s=e("./es5"),a=/^(?:name|message|stack|cause)$/;function c(e){var t;if(function(e){return e instanceof Error&&s.getPrototypeOf(e)===Error.prototype}(e)){(t=new i(e)).name=e.name,t.message=e.message,t.stack=e.stack;for(var n=s.keys(e),r=0;r<n.length;++r){var c=n[r];a.test(c)||(t[c]=e[c])}return t}return o.markAsOriginatingFromRejection(e),e}t.exports=function(e,t){return function(n,o){if(null!==e){if(n){var i=c(r(n));e._attachExtraTrace(i),e._reject(i)}else if(t){var s=[].slice.call(arguments,1);e._fulfill(s)}else e._fulfill(o);e=null}}}},{"./errors":12,"./es5":13,"./util":36}],21:[function(e,t,n){"use strict";t.exports=function(t){var n=e("./util"),o=t._async,r=n.tryCatch,i=n.errorObj;function s(e,t){if(!n.isArray(e))return a.call(this,e,t);var s=r(t).apply(this._boundValue(),[null].concat(e));s===i&&o.throwLater(s.e)}function a(e,t){var n=this._boundValue(),s=void 0===e?r(t).call(n,null):r(t).call(n,null,e);s===i&&o.throwLater(s.e)}function c(e,t){if(!e){var n=new Error(e+"");n.cause=e,e=n}var s=r(t).call(this._boundValue(),e);s===i&&o.throwLater(s.e)}t.prototype.asCallback=t.prototype.nodeify=function(e,t){if("function"==typeof e){var n=a;void 0!==t&&Object(t).spread&&(n=s),this._then(n,c,void 0,this,e)}return this}}},{"./util":36}],22:[function(e,t,n){"use strict";t.exports=function(){var n=function(){return new h("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},o=function(){return new T.PromiseInspection(this._target())},r=function(e){return T.reject(new h(e))};function i(){}var s,a={},c=e("./util");s=c.isNode?function(){var e=process.domain;return void 0===e&&(e=null),e}:function(){return null},c.notEnumerableProp(T,"_getDomain",s);var u=e("./es5"),l=e("./async"),d=new l;u.defineProperty(T,"_async",{value:d});var f=e("./errors"),h=T.TypeError=f.TypeError;T.RangeError=f.RangeError;var p=T.CancellationError=f.CancellationError;T.TimeoutError=f.TimeoutError,T.OperationalError=f.OperationalError,T.RejectionError=f.OperationalError,T.AggregateError=f.AggregateError;var _=function(){},v={},m={},b=e("./thenables")(T,_),y=e("./promise_array")(T,_,b,r,i),g=e("./context")(T),j=g.create,w=e("./debuggability")(T,g),E=(w.CapturedTrace,e("./finally")(T,b,m)),C=e("./catch_filter")(m),x=e("./nodeback"),S=c.errorObj,A=c.tryCatch;function T(e){e!==_&&function(e,t){if(null==e||e.constructor!==T)throw new h("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof t)throw new h("expecting a function but got "+c.classString(t))}(this,e),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(e),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function k(e){this.promise._resolveCallback(e)}function O(e){this.promise._rejectCallback(e,!1)}function R(e){var t=new T(_);t._fulfillmentHandler0=e,t._rejectionHandler0=e,t._promise0=e,t._receiver0=e}return T.prototype.toString=function(){return"[object Promise]"},T.prototype.caught=T.prototype.catch=function(e){var t=arguments.length;if(t>1){var n,o=new Array(t-1),i=0;for(n=0;n<t-1;++n){var s=arguments[n];if(!c.isObject(s))return r("Catch statement predicate: expecting an object but got "+c.classString(s));o[i++]=s}return o.length=i,e=arguments[n],this.then(void 0,C(o,e,this))}return this.then(void 0,e)},T.prototype.reflect=function(){return this._then(o,o,void 0,this,void 0)},T.prototype.then=function(e,t){if(w.warnings()&&arguments.length>0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+c.classString(e);arguments.length>1&&(n+=", "+c.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},T.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},T.prototype.spread=function(e){return"function"!=typeof e?r("expecting a function but got "+c.classString(e)):this.all()._then(e,void 0,void 0,v,void 0)},T.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},T.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new y(this).promise()},T.prototype.error=function(e){return this.caught(c.originatesFromRejection,e)},T.getNewLibraryCopy=t.exports,T.is=function(e){return e instanceof T},T.fromNode=T.fromCallback=function(e){var t=new T(_);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,o=A(e)(x(t,n));return o===S&&t._rejectCallback(o.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},T.all=function(e){return new y(e).promise()},T.cast=function(e){var t=b(e);return t instanceof T||((t=new T(_))._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},T.resolve=T.fulfilled=T.cast,T.reject=T.rejected=function(e){var t=new T(_);return t._captureStackTrace(),t._rejectCallback(e,!0),t},T.setScheduler=function(e){if("function"!=typeof e)throw new h("expecting a function but got "+c.classString(e));return d.setScheduler(e)},T.prototype._then=function(e,t,n,o,r){var i=void 0!==r,a=i?r:new T(_),u=this._target(),l=u._bitField;i||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===o&&0!=(2097152&this._bitField)&&(o=0!=(50397184&l)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var f=s();if(0!=(50397184&l)){var h,v,m=u._settlePromiseCtx;0!=(33554432&l)?(v=u._rejectionHandler0,h=e):0!=(16777216&l)?(v=u._fulfillmentHandler0,h=t,u._unsetRejectionIsUnhandled()):(m=u._settlePromiseLateCancellationObserver,v=new p("late cancellation observer"),u._attachExtraTrace(v),h=t),d.invoke(m,u,{handler:null===f?h:"function"==typeof h&&c.domainBind(f,h),promise:a,receiver:o,value:v})}else u._addCallbacks(e,t,a,o,f);return a},T.prototype._length=function(){return 65535&this._bitField},T.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},T.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},T.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},T.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},T.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},T.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},T.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},T.prototype._isFinal=function(){return(4194304&this._bitField)>0},T.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},T.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},T.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},T.prototype._setAsyncGuaranteed=function(){d.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},T.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==a)return void 0===t&&this._isBound()?this._boundValue():t},T.prototype._promiseAt=function(e){return this[4*e-4+2]},T.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},T.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},T.prototype._boundValue=function(){},T.prototype._migrateCallback0=function(e){e._bitField;var t=e._fulfillmentHandler0,n=e._rejectionHandler0,o=e._promise0,r=e._receiverAt(0);void 0===r&&(r=a),this._addCallbacks(t,n,o,r,null)},T.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),o=e._rejectionHandlerAt(t),r=e._promiseAt(t),i=e._receiverAt(t);void 0===i&&(i=a),this._addCallbacks(n,o,r,i,null)},T.prototype._addCallbacks=function(e,t,n,o,r){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=o,"function"==typeof e&&(this._fulfillmentHandler0=null===r?e:c.domainBind(r,e)),"function"==typeof t&&(this._rejectionHandler0=null===r?t:c.domainBind(r,t));else{var s=4*i-4;this[s+2]=n,this[s+3]=o,"function"==typeof e&&(this[s+0]=null===r?e:c.domainBind(r,e)),"function"==typeof t&&(this[s+1]=null===r?t:c.domainBind(r,t))}return this._setLength(i+1),i},T.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},T.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(n(),!1);var o=b(e,this);if(!(o instanceof T))return this._fulfill(e);t&&this._propagateFrom(o,2);var r=o._target();if(r!==this){var i=r._bitField;if(0==(50397184&i)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;a<s;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else if(0!=(33554432&i))this._fulfill(r._value());else if(0!=(16777216&i))this._reject(r._reason());else{var c=new p("late cancellation observer");r._attachExtraTrace(c),this._reject(c)}}else this._reject(n())}},T.prototype._rejectCallback=function(e,t,n){var o=c.ensureErrorObject(e),r=o===e;if(!r&&!n&&w.warnings()){var i="a promise was rejected with a non-error: "+c.classString(e);this._warn(i,!0)}this._attachExtraTrace(o,!!t&&r),this._reject(e)},T.prototype._resolveFromExecutor=function(e){if(e!==_){var t=this;this._captureStackTrace(),this._pushContext();var n=!0,o=this._execute(e,(function(e){t._resolveCallback(e)}),(function(e){t._rejectCallback(e,n)}));n=!1,this._popContext(),void 0!==o&&t._rejectCallback(o,!0)}},T.prototype._settlePromiseFromHandler=function(e,t,n,o){var r=o._bitField;if(0==(65536&r)){var i;o._pushContext(),t===v?n&&"number"==typeof n.length?i=A(e).apply(this._boundValue(),n):(i=S).e=new h("cannot .spread() a non-array: "+c.classString(n)):i=A(e).call(t,n);var s=o._popContext();0==(65536&(r=o._bitField))&&(i===m?o._reject(n):i===S?o._rejectCallback(i.e,!1):(w.checkForgottenReturns(i,s,"",o,this),o._resolveCallback(i)))}},T.prototype._target=function(){for(var e=this;e._isFollowing();)e=e._followee();return e},T.prototype._followee=function(){return this._rejectionHandler0},T.prototype._setFollowee=function(e){this._rejectionHandler0=e},T.prototype._settlePromise=function(e,t,n,r){var s=e instanceof T,a=this._bitField,c=0!=(134217728&a);0!=(65536&a)?(s&&e._invokeInternalOnCancel(),n instanceof E&&n.isFinallyHandler()?(n.cancelPromise=e,A(t).call(n,r)===S&&e._reject(S.e)):t===o?e._fulfill(o.call(n)):n instanceof i?n._promiseCancelled(e):s||e instanceof y?e._cancel():n.cancel()):"function"==typeof t?s?(c&&e._setAsyncGuaranteed(),this._settlePromiseFromHandler(t,n,r,e)):t.call(n,r,e):n instanceof i?n._isResolved()||(0!=(33554432&a)?n._promiseFulfilled(r,e):n._promiseRejected(r,e)):s&&(c&&e._setAsyncGuaranteed(),0!=(33554432&a)?e._fulfill(r):e._reject(r))},T.prototype._settlePromiseLateCancellationObserver=function(e){var t=e.handler,n=e.promise,o=e.receiver,r=e.value;"function"==typeof t?n instanceof T?this._settlePromiseFromHandler(t,o,r,n):t.call(o,r,n):n instanceof T&&n._reject(r)},T.prototype._settlePromiseCtx=function(e){this._settlePromise(e.promise,e.handler,e.receiver,e.value)},T.prototype._settlePromise0=function(e,t,n){var o=this._promise0,r=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(o,e,r,t)},T.prototype._clearCallbackDataAtIndex=function(e){var t=4*e-4;this[t+2]=this[t+3]=this[t+0]=this[t+1]=void 0},T.prototype._fulfill=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(e===this){var o=n();return this._attachExtraTrace(o),this._reject(o)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():d.settlePromises(this))}},T.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return d.fatalError(e,c.isNode);(65535&t)>0?d.settlePromises(this):this._ensurePossibleRejectionHandled()}},T.prototype._fulfillPromises=function(e,t){for(var n=1;n<e;n++){var o=this._fulfillmentHandlerAt(n),r=this._promiseAt(n),i=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(r,o,i,t)}},T.prototype._rejectPromises=function(e,t){for(var n=1;n<e;n++){var o=this._rejectionHandlerAt(n),r=this._promiseAt(n),i=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(r,o,i,t)}},T.prototype._settlePromises=function(){var e=this._bitField,t=65535&e;if(t>0){if(0!=(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{v