UNPKG

catan-client

Version:

Settlers of Catan Client Implementation

95 lines (88 loc) 4.34 MB
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 'use strict'; require("./util/Start"); var React = require('react'); var Router = require('react-router'); var $ = require('jquery'); var Route = Router.Route; var RouteHandler = Router.RouteHandler; var Home = wrap(require('./modules/Home')); var Header = wrap(require('./components/Header')); var CreateUser = wrap(require('./modules/CreateUser')); var Editor = wrap(require('./modules/Editor')); var SessionHandler = require('./util/SessionHandler'); var sessionHandler = new SessionHandler(); var App = React.createClass({ displayName: 'App', render: function render() { return React.createElement( 'div', { className: 'container', id: 'app' }, React.createElement(Header, null), React.createElement(RouteHandler, null) ); } }); var onEnter = function onEnter() { $("label.burger").click(); }; var routes = React.createElement( Route, { handler: App }, React.createElement(Route, { onEnter: onEnter, path: '/', handler: Home }), React.createElement(Route, { onEnter: onEnter, path: '/create-user', handler: CreateUser }), React.createElement(Route, { onEnter: onEnter, path: '/editor', handler: Editor }) ); Router.run(routes, Router.HashLocation, function (Root) { React.render(React.createElement(Root, null), document.body); }); function wrap(Component) { return React.createClass({ render: function render() { return React.createElement(Component, { sessionHandler: sessionHandler }); } }); } },{"./components/Header":6,"./modules/CreateUser":7,"./modules/Editor":8,"./modules/Home":9,"./util/SessionHandler":15,"./util/Start":16,"jquery":25,"react":345,"react-router":173}],2:[function(require,module,exports){ (function (process,global){ /* @preserve * The MIT License (MIT) * * Copyright (c) 2013-2015 Petka Antonov * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */"use strict";!(function(e){if("object" == typeof exports && "undefined" != typeof module)module.exports = e();else if("function" == typeof define && define.amd)define([],e);else {var f;"undefined" != typeof window?f = window:"undefined" != typeof global?f = global:"undefined" != typeof self && (f = self),f.Promise = e();}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_ == "function" && _dereq_;if(!u && a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '" + o + "'");throw (f.code = "MODULE_NOT_FOUND",f);}var l=n[o] = {exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e);},l,l.exports,e,t,n,r);}return n[o].exports;}var i=typeof _dereq_ == "function" && _dereq_;for(var o=0;o < r.length;o++) s(r[o]);return s;})({1:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise){var SomePromiseArray=Promise._SomePromiseArray;function any(promises){var ret=new SomePromiseArray(promises);var promise=ret.promise();ret.setHowMany(1);ret.setUnwrap();ret.init();return promise;}Promise.any = function(promises){return any(promises);};Promise.prototype.any = function(){return any(this);};};},{}],2:[function(_dereq_,module,exports){"use strict";var firstLineError;try{throw new Error();}catch(e) {firstLineError = e;}var schedule=_dereq_("./schedule");var Queue=_dereq_("./queue");var util=_dereq_("./util");function Async(){this._isTickUsed = false;this._lateQueue = new Queue(16);this._normalQueue = new Queue(16);this._haveDrainedQueues = false;this._trampolineEnabled = true;var self=this;this.drainQueues = function(){self._drainQueues();};this._schedule = schedule.isStatic?schedule(this.drainQueues):schedule;}Async.prototype.disableTrampolineIfNecessary = function(){if(util.hasDevTools){this._trampolineEnabled = false;}};Async.prototype.haveItemsQueued = function(){return this._isTickUsed || this._haveDrainedQueues;};Async.prototype.fatalError = function(e,isNode){if(isNode){process.stderr.write("Fatal " + (e instanceof Error?e.stack:e));process.exit(2);}else {this.throwLater(e);}};Async.prototype.throwLater = function(fn,arg){if(arguments.length === 1){arg = fn;fn = function(){throw arg;};}if(typeof setTimeout !== "undefined"){setTimeout(function(){fn(arg);},0);}else try{this._schedule(function(){fn(arg);});}catch(e) {throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n");}};function AsyncInvokeLater(fn,receiver,arg){this._lateQueue.push(fn,receiver,arg);this._queueTick();}function AsyncInvoke(fn,receiver,arg){this._normalQueue.push(fn,receiver,arg);this._queueTick();}function AsyncSettlePromises(promise){this._normalQueue._pushOne(promise);this._queueTick();}if(!util.hasDevTools){Async.prototype.invokeLater = AsyncInvokeLater;Async.prototype.invoke = AsyncInvoke;Async.prototype.settlePromises = AsyncSettlePromises;}else {if(schedule.isStatic){schedule = function(fn){setTimeout(fn,0);};}Async.prototype.invokeLater = function(fn,receiver,arg){if(this._trampolineEnabled){AsyncInvokeLater.call(this,fn,receiver,arg);}else {this._schedule(function(){setTimeout(function(){fn.call(receiver,arg);},100);});}};Async.prototype.invoke = function(fn,receiver,arg){if(this._trampolineEnabled){AsyncInvoke.call(this,fn,receiver,arg);}else {this._schedule(function(){fn.call(receiver,arg);});}};Async.prototype.settlePromises = function(promise){if(this._trampolineEnabled){AsyncSettlePromises.call(this,promise);}else {this._schedule(function(){promise._settlePromises();});}};}Async.prototype.invokeFirst = function(fn,receiver,arg){this._normalQueue.unshift(fn,receiver,arg);this._queueTick();};Async.prototype._drainQueue = function(queue){while(queue.length() > 0) {var fn=queue.shift();if(typeof fn !== "function"){fn._settlePromises();continue;}var receiver=queue.shift();var arg=queue.shift();fn.call(receiver,arg);}};Async.prototype._drainQueues = function(){this._drainQueue(this._normalQueue);this._reset();this._haveDrainedQueues = true;this._drainQueue(this._lateQueue);};Async.prototype._queueTick = function(){if(!this._isTickUsed){this._isTickUsed = true;this._schedule(this.drainQueues);}};Async.prototype._reset = function(){this._isTickUsed = false;};module.exports = Async;module.exports.firstLineError = firstLineError;},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,INTERNAL,tryConvertToPromise,debug){var calledBind=false;var rejectThis=function rejectThis(_,e){this._reject(e);};var targetRejected=function targetRejected(e,context){context.promiseRejectionQueued = true;context.bindingPromise._then(rejectThis,rejectThis,null,this,e);};var bindingResolved=function bindingResolved(thisArg,context){if((this._bitField & 50397184) === 0){this._resolveCallback(context.target);}};var bindingRejected=function bindingRejected(e,context){if(!context.promiseRejectionQueued)this._reject(e);};Promise.prototype.bind = function(thisArg){if(!calledBind){calledBind = true;Promise.prototype._propagateFrom = debug.propagateFromFunction();Promise.prototype._boundValue = debug.boundValueFunction();}var maybePromise=tryConvertToPromise(thisArg);var ret=new Promise(INTERNAL);ret._propagateFrom(this,1);var target=this._target();ret._setBoundTo(maybePromise);if(maybePromise instanceof Promise){var context={promiseRejectionQueued:false,promise:ret,target:target,bindingPromise:maybePromise};target._then(INTERNAL,targetRejected,undefined,ret,context);maybePromise._then(bindingResolved,bindingRejected,undefined,ret,context);ret._setOnCancel(maybePromise);}else {ret._resolveCallback(target);}return ret;};Promise.prototype._setBoundTo = function(obj){if(obj !== undefined){this._bitField = this._bitField | 2097152;this._boundTo = obj;}else {this._bitField = this._bitField & ~2097152;}};Promise.prototype._isBound = function(){return (this._bitField & 2097152) === 2097152;};Promise.bind = function(thisArg,value){return Promise.resolve(value).bind(thisArg);};};},{}],4:[function(_dereq_,module,exports){"use strict";var old;if(typeof Promise !== "undefined")old = Promise;function noConflict(){try{if(Promise === bluebird)Promise = old;}catch(e) {}return bluebird;}var bluebird=_dereq_("./promise")();bluebird.noConflict = noConflict;module.exports = bluebird;},{"./promise":22}],5:[function(_dereq_,module,exports){"use strict";var cr=Object.create;if(cr){var callerCache=cr(null);var getterCache=cr(null);callerCache[" size"] = getterCache[" size"] = 0;}module.exports = function(Promise){var util=_dereq_("./util");var canEvaluate=util.canEvaluate;var isIdentifier=util.isIdentifier;var getMethodCaller;var getGetter;if(!true){var makeMethodCaller=function makeMethodCaller(methodName){return new Function("ensureMethod"," \n\ return function(obj) { \n\ 'use strict' \n\ var len = this.length; \n\ ensureMethod(obj, 'methodName'); \n\ switch(len) { \n\ case 1: return obj.methodName(this[0]); \n\ case 2: return obj.methodName(this[0], this[1]); \n\ case 3: return obj.methodName(this[0], this[1], this[2]); \n\ case 0: return obj.methodName(); \n\ default: \n\ return obj.methodName.apply(obj, this); \n\ } \n\ }; \n\ ".replace(/methodName/g,methodName))(ensureMethod);};var makeGetter=function makeGetter(propertyName){return new Function("obj"," \n\ 'use strict'; \n\ return obj.propertyName; \n\ ".replace("propertyName",propertyName));};var getCompiled=function getCompiled(name,compiler,cache){var ret=cache[name];if(typeof ret !== "function"){if(!isIdentifier(name)){return null;}ret = compiler(name);cache[name] = ret;cache[" size"]++;if(cache[" size"] > 512){var keys=Object.keys(cache);for(var i=0;i < 256;++i) delete cache[keys[i]];cache[" size"] = keys.length - 256;}}return ret;};getMethodCaller = function(name){return getCompiled(name,makeMethodCaller,callerCache);};getGetter = function(name){return getCompiled(name,makeGetter,getterCache);};}function ensureMethod(obj,methodName){var fn;if(obj != null)fn = obj[methodName];if(typeof fn !== "function"){var message="Object " + util.classString(obj) + " has no method '" + util.toString(methodName) + "'";throw new Promise.TypeError(message);}return fn;}function caller(obj){var methodName=this.pop();var fn=ensureMethod(obj,methodName);return fn.apply(obj,this);}Promise.prototype.call = function(methodName){var args=[].slice.call(arguments,1);;if(!true){if(canEvaluate){var maybeCaller=getMethodCaller(methodName);if(maybeCaller !== null){return this._then(maybeCaller,undefined,undefined,args,undefined);}}}args.push(methodName);return this._then(caller,undefined,undefined,args,undefined);};function namedGetter(obj){return obj[this];}function indexedGetter(obj){var index=+this;if(index < 0)index = Math.max(0,index + obj.length);return obj[index];}Promise.prototype.get = function(propertyName){var isIndex=typeof propertyName === "number";var getter;if(!isIndex){if(canEvaluate){var maybeGetter=getGetter(propertyName);getter = maybeGetter !== null?maybeGetter:namedGetter;}else {getter = namedGetter;}}else {getter = indexedGetter;}return this._then(getter,undefined,undefined,propertyName,undefined);};};},{"./util":36}],6:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,PromiseArray,apiRejection,debug){var util=_dereq_("./util");var tryCatch=util.tryCatch;var errorObj=util.errorObj;var async=Promise._async;Promise.prototype["break"] = Promise.prototype.cancel = function(){if(!debug.cancellation())return this._warn("cancellation is disabled");var promise=this;var child=promise;while(promise.isCancellable()) {if(!promise._cancelBy(child)){if(child._isFollowing()){child._followee().cancel();}else {child._cancelBranched();}break;}var parent=promise._cancellationParent;if(parent == null || !parent.isCancellable()){if(promise._isFollowing()){promise._followee().cancel();}else {promise._cancelBranched();}break;}else {if(promise._isFollowing())promise._followee().cancel();child = promise;promise = parent;}}};Promise.prototype._branchHasCancelled = function(){this._branchesRemainingToCancel--;};Promise.prototype._enoughBranchesHaveCancelled = function(){return this._branchesRemainingToCancel === undefined || this._branchesRemainingToCancel <= 0;};Promise.prototype._cancelBy = function(canceller){if(canceller === this){this._branchesRemainingToCancel = 0;this._invokeOnCancel();return true;}else {this._branchHasCancelled();if(this._enoughBranchesHaveCancelled()){this._invokeOnCancel();return true;}}return false;};Promise.prototype._cancelBranched = function(){if(this._enoughBranchesHaveCancelled()){this._cancel();}};Promise.prototype._cancel = function(){if(!this.isCancellable())return;this._setCancelled();async.invoke(this._cancelPromises,this,undefined);};Promise.prototype._cancelPromises = function(){if(this._length() > 0)this._settlePromises();};Promise.prototype._unsetOnCancel = function(){this._onCancelField = undefined;};Promise.prototype.isCancellable = function(){return this.isPending() && !this.isCancelled();};Promise.prototype._doInvokeOnCancel = function(onCancelCallback,internalOnly){if(util.isArray(onCancelCallback)){for(var i=0;i < onCancelCallback.length;++i) {this._doInvokeOnCancel(onCancelCallback[i],internalOnly);}}else if(onCancelCallback !== undefined){if(typeof onCancelCallback === "function"){if(!internalOnly){var e=tryCatch(onCancelCallback).call(this._boundValue());if(e === errorObj){this._attachExtraTrace(e.e);async.throwLater(e.e);}}}else {onCancelCallback._resultCancelled(this);}}};Promise.prototype._invokeOnCancel = function(){var onCancelCallback=this._onCancel();this._unsetOnCancel();async.invoke(this._doInvokeOnCancel,this,onCancelCallback);};Promise.prototype._invokeInternalOnCancel = function(){if(this.isCancellable()){this._doInvokeOnCancel(this._onCancel(),true);this._unsetOnCancel();}};Promise.prototype._resultCancelled = function(){this.cancel();};};},{"./util":36}],7:[function(_dereq_,module,exports){"use strict";module.exports = function(NEXT_FILTER){var util=_dereq_("./util");var getKeys=_dereq_("./es5").keys;var tryCatch=util.tryCatch;var errorObj=util.errorObj;function catchFilter(instances,cb,promise){return function(e){var boundTo=promise._boundValue();predicateLoop: for(var i=0;i < instances.length;++i) {var item=instances[i];if(item === Error || item != null && item.prototype instanceof Error){if(e instanceof item){return tryCatch(cb).call(boundTo,e);}}else if(typeof item === "function"){var matchesPredicate=tryCatch(item).call(boundTo,e);if(matchesPredicate === errorObj){return matchesPredicate;}else if(matchesPredicate){return tryCatch(cb).call(boundTo,e);}}else if(util.isObject(e)){var keys=getKeys(item);for(var j=0;j < keys.length;++j) {var key=keys[j];if(item[key] != e[key]){continue predicateLoop;}}return tryCatch(cb).call(boundTo,e);}}return NEXT_FILTER;};}return catchFilter;};},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise){var longStackTraces=false;var contextStack=[];Promise.prototype._promiseCreated = function(){};Promise.prototype._pushContext = function(){};Promise.prototype._popContext = function(){return null;};Promise._peekContext = Promise.prototype._peekContext = function(){};function Context(){this._trace = new Context.CapturedTrace(peekContext());}Context.prototype._pushContext = function(){if(this._trace !== undefined){this._trace._promiseCreated = null;contextStack.push(this._trace);}};Context.prototype._popContext = function(){if(this._trace !== undefined){var trace=contextStack.pop();var ret=trace._promiseCreated;trace._promiseCreated = null;return ret;}return null;};function createContext(){if(longStackTraces)return new Context();}function peekContext(){var lastIndex=contextStack.length - 1;if(lastIndex >= 0){return contextStack[lastIndex];}return undefined;}Context.CapturedTrace = null;Context.create = createContext;Context.activateLongStackTraces = function(){longStackTraces = true;Promise.prototype._pushContext = Context.prototype._pushContext;Promise.prototype._popContext = Context.prototype._popContext;Promise._peekContext = Promise.prototype._peekContext = peekContext;Promise.prototype._promiseCreated = function(){var ctx=this._peekContext();if(ctx && ctx._promiseCreated == null)ctx._promiseCreated = this;};};return Context;};},{}],9:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,Context){var getDomain=Promise._getDomain;var async=Promise._async;var Warning=_dereq_("./errors").Warning;var util=_dereq_("./util");var canAttachTrace=util.canAttachTrace;var unhandledRejectionHandled;var possiblyUnhandledRejection;var bluebirdFramePattern=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;var stackFramePattern=null;var formatStack=null;var indentStackFrames=false;var printWarning;var debugging=!!(util.env("BLUEBIRD_DEBUG") != 0 && (true || util.env("BLUEBIRD_DEBUG") || util.env("NODE_ENV") === "development"));var warnings=!!(util.env("BLUEBIRD_WARNINGS") != 0 && (debugging || util.env("BLUEBIRD_WARNINGS")));var longStackTraces=!!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));Promise.prototype.suppressUnhandledRejections = function(){var target=this._target();target._bitField = target._bitField & ~1048576 | 2097152;};Promise.prototype._ensurePossibleRejectionHandled = function(){if((this._bitField & 2097152) !== 0)return;this._setRejectionIsUnhandled();async.invokeLater(this._notifyUnhandledRejection,this,undefined);};Promise.prototype._notifyUnhandledRejectionIsHandled = function(){fireRejectionEvent("rejectionHandled",unhandledRejectionHandled,undefined,this);};Promise.prototype._notifyUnhandledRejection = function(){if(this._isRejectionUnhandled()){var reason=this._settledValue();this._setUnhandledRejectionIsNotified();fireRejectionEvent("unhandledRejection",possiblyUnhandledRejection,reason,this);}};Promise.prototype._setUnhandledRejectionIsNotified = function(){this._bitField = this._bitField | 262144;};Promise.prototype._unsetUnhandledRejectionIsNotified = function(){this._bitField = this._bitField & ~262144;};Promise.prototype._isUnhandledRejectionNotified = function(){return (this._bitField & 262144) > 0;};Promise.prototype._setRejectionIsUnhandled = function(){this._bitField = this._bitField | 1048576;};Promise.prototype._unsetRejectionIsUnhandled = function(){this._bitField = this._bitField & ~1048576;if(this._isUnhandledRejectionNotified()){this._unsetUnhandledRejectionIsNotified();this._notifyUnhandledRejectionIsHandled();}};Promise.prototype._isRejectionUnhandled = function(){return (this._bitField & 1048576) > 0;};Promise.prototype._warn = function(message,shouldUseOwnTrace,promise){return warn(message,shouldUseOwnTrace,promise || this);};Promise.onPossiblyUnhandledRejection = function(fn){var domain=getDomain();possiblyUnhandledRejection = typeof fn === "function"?domain === null?fn:domain.bind(fn):undefined;};Promise.onUnhandledRejectionHandled = function(fn){var domain=getDomain();unhandledRejectionHandled = typeof fn === "function"?domain === null?fn:domain.bind(fn):undefined;};Promise.longStackTraces = function(){if(async.haveItemsQueued() && !config.longStackTraces){throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");}if(!config.longStackTraces && longStackTracesIsSupported()){config.longStackTraces = true;Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;Context.activateLongStackTraces();async.disableTrampolineIfNecessary();}};Promise.hasLongStackTraces = function(){return config.longStackTraces && longStackTracesIsSupported();};Promise.config = function(opts){opts = Object(opts);if("longStackTraces" in opts && opts.longStackTraces){Promise.longStackTraces();}if("warnings" in opts){config.warnings = !!opts.warnings;}if("cancellation" in opts && opts.cancellation && !config.cancellation){if(async.haveItemsQueued()){throw new Error("cannot enable cancellation after promises are in use");}Promise.prototype._clearCancellationData = cancellationClearCancellationData;Promise.prototype._propagateFrom = cancellationPropagateFrom;Promise.prototype._onCancel = cancellationOnCancel;Promise.prototype._setOnCancel = cancellationSetOnCancel;Promise.prototype._attachCancellationCallback = cancellationAttachCancellationCallback;Promise.prototype._execute = cancellationExecute;_propagateFromFunction = cancellationPropagateFrom;config.cancellation = true;}};Promise.prototype._execute = function(executor,resolve,reject){try{executor(resolve,reject);}catch(e) {return e;}};Promise.prototype._onCancel = function(){};Promise.prototype._setOnCancel = function(handler){;};Promise.prototype._attachCancellationCallback = function(onCancel){;};Promise.prototype._captureStackTrace = function(){};Promise.prototype._attachExtraTrace = function(){};Promise.prototype._clearCancellationData = function(){};Promise.prototype._propagateFrom = function(parent,flags){;;};function cancellationExecute(executor,resolve,reject){var promise=this;try{executor(resolve,reject,function(onCancel){if(typeof onCancel !== "function"){throw new TypeError("onCancel must be a function, got: " + util.toString(onCancel));}promise._attachCancellationCallback(onCancel);});}catch(e) {return e;}}function cancellationAttachCancellationCallback(onCancel){if(!this.isCancellable())return this;var previousOnCancel=this._onCancel();if(previousOnCancel !== undefined){if(util.isArray(previousOnCancel)){previousOnCancel.push(onCancel);}else {this._setOnCancel([previousOnCancel,onCancel]);}}else {this._setOnCancel(onCancel);}}function cancellationOnCancel(){return this._onCancelField;}function cancellationSetOnCancel(onCancel){this._onCancelField = onCancel;}function cancellationClearCancellationData(){this._cancellationParent = undefined;this._onCancelField = undefined;}function cancellationPropagateFrom(parent,flags){if((flags & 1) !== 0){this._cancellationParent = parent;var branchesRemainingToCancel=parent._branchesRemainingToCancel;if(branchesRemainingToCancel === undefined){branchesRemainingToCancel = 0;}parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;}if((flags & 2) !== 0 && parent._isBound()){this._setBoundTo(parent._boundTo);}}function bindingPropagateFrom(parent,flags){if((flags & 2) !== 0 && parent._isBound()){this._setBoundTo(parent._boundTo);}}var _propagateFromFunction=bindingPropagateFrom;function _boundValueFunction(){var ret=this._boundTo;if(ret !== undefined){if(ret instanceof Promise){if(ret.isFulfilled()){return ret.value();}else {return undefined;}}}return ret;}function longStackTracesCaptureStackTrace(){this._trace = new CapturedTrace(this._peekContext());}function longStackTracesAttachExtraTrace(error,ignoreSelf){if(canAttachTrace(error)){var trace=this._trace;if(trace !== undefined){if(ignoreSelf)trace = trace._parent;}if(trace !== undefined){trace.attachExtraTrace(error);}else if(!error.__stackCleaned__){var parsed=parseStackAndMessage(error);util.notEnumerableProp(error,"stack",parsed.message + "\n" + parsed.stack.join("\n"));util.notEnumerableProp(error,"__stackCleaned__",true);}}}function checkForgottenReturns(returnValue,promiseCreated,name,promise){if(returnValue === undefined && promiseCreated !== null && config.longStackTraces && config.warnings){var msg="a promise was created in a " + name + " handler but was not returned from it";promise._warn(msg,true,promiseCreated);}}function deprecated(name,replacement){var message=name + " is deprecated and will be removed in a future version.";if(replacement)message += " Use " + replacement + " instead.";return warn(message);}function warn(message,shouldUseOwnTrace,promise){if(!config.warnings)return;var warning=new Warning(message);var ctx;if(shouldUseOwnTrace){promise._attachExtraTrace(warning);}else if(config.longStackTraces && (ctx = Promise._peekContext())){ctx.attachExtraTrace(warning);}else {var parsed=parseStackAndMessage(warning);warning.stack = parsed.message + "\n" + parsed.stack.join("\n");}formatAndLogError(warning,"",true);}function reconstructStack(message,stacks){for(var i=0;i < stacks.length - 1;++i) {stacks[i].push("From previous event:");stacks[i] = stacks[i].join("\n");}if(i < stacks.length){stacks[i] = stacks[i].join("\n");}return message + "\n" + stacks.join("\n");}function removeDuplicateOrEmptyJumps(stacks){for(var i=0;i < stacks.length;++i) {if(stacks[i].length === 0 || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]){stacks.splice(i,1);i--;}}}function removeCommonRoots(stacks){var current=stacks[0];for(var i=1;i < stacks.length;++i) {var prev=stacks[i];var currentLastIndex=current.length - 1;var currentLastLine=current[currentLastIndex];var commonRootMeetPoint=-1;for(var j=prev.length - 1;j >= 0;--j) {if(prev[j] === currentLastLine){commonRootMeetPoint = j;break;}}for(var j=commonRootMeetPoint;j >= 0;--j) {var line=prev[j];if(current[currentLastIndex] === line){current.pop();currentLastIndex--;}else {break;}}current = prev;}}function cleanStack(stack){var ret=[];for(var i=0;i < stack.length;++i) {var line=stack[i];var isTraceLine=" (No stack trace)" === line || stackFramePattern.test(line);var isInternalFrame=isTraceLine && shouldIgnore(line);if(isTraceLine && !isInternalFrame){if(indentStackFrames && line.charAt(0) !== " "){line = " " + line;}ret.push(line);}}return ret;}function stackFramesAsArray(error){var stack=error.stack.replace(/\s+$/g,"").split("\n");for(var i=0;i < stack.length;++i) {var line=stack[i];if(" (No stack trace)" === line || stackFramePattern.test(line)){break;}}if(i > 0){stack = stack.slice(i);}return stack;}function parseStackAndMessage(error){var stack=error.stack;var message=error.toString();stack = typeof stack === "string" && stack.length > 0?stackFramesAsArray(error):[" (No stack trace)"];return {message:message,stack:cleanStack(stack)};}function formatAndLogError(error,title,isSoft){if(typeof console !== "undefined"){var message;if(util.isObject(error)){var stack=error.stack;message = title + formatStack(stack,error);}else {message = title + String(error);}if(typeof printWarning === "function"){printWarning(message,isSoft);}else if(typeof console.log === "function" || typeof console.log === "object"){console.log(message);}}}function fireRejectionEvent(name,localHandler,reason,promise){var localEventFired=false;try{if(typeof localHandler === "function"){localEventFired = true;if(name === "rejectionHandled"){localHandler(promise);}else {localHandler(reason,promise);}}}catch(e) {async.throwLater(e);}var globalEventFired=false;try{globalEventFired = fireGlobalEvent(name,reason,promise);}catch(e) {globalEventFired = true;async.throwLater(e);}var domEventFired=false;if(fireDomEvent){try{domEventFired = fireDomEvent(name.toLowerCase(),{reason:reason,promise:promise});}catch(e) {domEventFired = true;async.throwLater(e);}}if(!globalEventFired && !localEventFired && !domEventFired && name === "unhandledRejection"){formatAndLogError(reason,"Unhandled rejection ");}}function formatNonError(obj){var str;if(typeof obj === "function"){str = "[function " + (obj.name || "anonymous") + "]";}else {str = obj && typeof obj.toString === "function"?obj.toString():util.toString(obj);var ruselessToString=/\[object [a-zA-Z0-9$_]+\]/;if(ruselessToString.test(str)){try{var newStr=JSON.stringify(obj);str = newStr;}catch(e) {}}if(str.length === 0){str = "(empty array)";}}return "(<" + snip(str) + ">, no stack trace)";}function snip(str){var maxChars=41;if(str.length < maxChars){return str;}return str.substr(0,maxChars - 3) + "...";}function longStackTracesIsSupported(){return typeof captureStackTrace === "function";}var shouldIgnore=function shouldIgnore(){return false;};var parseLineInfoRegex=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function parseLineInfo(line){var matches=line.match(parseLineInfoRegex);if(matches){return {fileName:matches[1],line:parseInt(matches[2],10)};}}function setBounds(firstLineError,lastLineError){if(!longStackTracesIsSupported())return;var firstStackLines=firstLineError.stack.split("\n");var lastStackLines=lastLineError.stack.split("\n");var firstIndex=-1;var lastIndex=-1;var firstFileName;var lastFileName;for(var i=0;i < firstStackLines.length;++i) {var result=parseLineInfo(firstStackLines[i]);if(result){firstFileName = result.fileName;firstIndex = result.line;break;}}for(var i=0;i < lastStackLines.length;++i) {var result=parseLineInfo(lastStackLines[i]);if(result){lastFileName = result.fileName;lastIndex = result.line;break;}}if(firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex){return;}shouldIgnore = function(line){if(bluebirdFramePattern.test(line))return true;var info=parseLineInfo(line);if(info){if(info.fileName === firstFileName && firstIndex <= info.line && info.line <= lastIndex){return true;}}return false;};}function CapturedTrace(parent){this._parent = parent;this._promisesCreated = 0;var length=this._length = 1 + (parent === undefined?0:parent._length);captureStackTrace(this,CapturedTrace);if(length > 32)this.uncycle();}util.inherits(CapturedTrace,Error);Context.CapturedTrace = CapturedTrace;CapturedTrace.prototype.uncycle = function(){var length=this._length;if(length < 2)return;var nodes=[];var stackToIndex={};for(var i=0,node=this;node !== undefined;++i) {nodes.push(node);node = node._parent;}length = this._length = i;for(var i=length - 1;i >= 0;--i) {var stack=nodes[i].stack;if(stackToIndex[stack] === undefined){stackToIndex[stack] = i;}}for(var i=0;i < length;++i) {var currentStack=nodes[i].stack;var index=stackToIndex[currentStack];if(index !== undefined && index !== i){if(index > 0){nodes[index - 1]._parent = undefined;nodes[index - 1]._length = 1;}nodes[i]._parent = undefined;nodes[i]._length = 1;var cycleEdgeNode=i > 0?nodes[i - 1]:this;if(index < length - 1){cycleEdgeNode._parent = nodes[index + 1];cycleEdgeNode._parent.uncycle();cycleEdgeNode._length = cycleEdgeNode._parent._length + 1;}else {cycleEdgeNode._parent = undefined;cycleEdgeNode._length = 1;}var currentChildLength=cycleEdgeNode._length + 1;for(var j=i - 2;j >= 0;--j) {nodes[j]._length = currentChildLength;currentChildLength++;}return;}}};CapturedTrace.prototype.attachExtraTrace = function(error){if(error.__stackCleaned__)return;this.uncycle();var parsed=parseStackAndMessage(error);var message=parsed.message;var stacks=[parsed.stack];var trace=this;while(trace !== undefined) {stacks.push(cleanStack(trace.stack.split("\n")));trace = trace._parent;}removeCommonRoots(stacks);removeDuplicateOrEmptyJumps(stacks);util.notEnumerableProp(error,"stack",reconstructStack(message,stacks));util.notEnumerableProp(error,"__stackCleaned__",true);};var captureStackTrace=(function stackDetection(){var v8stackFramePattern=/^\s*at\s*/;var v8stackFormatter=function v8stackFormatter(stack,error){if(typeof stack === "string")return stack;if(error.name !== undefined && error.message !== undefined){return error.toString();}return formatNonError(error);};if(typeof Error.stackTraceLimit === "number" && typeof Error.captureStackTrace === "function"){Error.stackTraceLimit += 6;stackFramePattern = v8stackFramePattern;formatStack = v8stackFormatter;var captureStackTrace=Error.captureStackTrace;shouldIgnore = function(line){return bluebirdFramePattern.test(line);};return function(receiver,ignoreUntil){Error.stackTraceLimit += 6;captureStackTrace(receiver,ignoreUntil);Error.stackTraceLimit -= 6;};}var err=new Error();if(typeof err.stack === "string" && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0){stackFramePattern = /@/;formatStack = v8stackFormatter;indentStackFrames = true;return function captureStackTrace(o){o.stack = new Error().stack;};}var hasStackAfterThrow;try{throw new Error();}catch(e) {hasStackAfterThrow = "stack" in e;}if(!("stack" in err) && hasStackAfterThrow && typeof Error.stackTraceLimit === "number"){stackFramePattern = v8stackFramePattern;formatStack = v8stackFormatter;return function captureStackTrace(o){Error.stackTraceLimit += 6;try{throw new Error();}catch(e) {o.stack = e.stack;}Error.stackTraceLimit -= 6;};}formatStack = function(stack,error){if(typeof stack === "string")return stack;if((typeof error === "object" || typeof error === "function") && error.name !== undefined && error.message !== undefined){return error.toString();}return formatNonError(error);};return null;})([]);var fireDomEvent;var fireGlobalEvent=(function(){if(util.isNode){return function(name,reason,promise){if(name === "rejectionHandled"){return process.emit(name,promise);}else {return process.emit(name,reason,promise);}};}else {var customEventWorks=false;var anyEventWorks=true;try{var ev=new self.CustomEvent("test");customEventWorks = ev instanceof CustomEvent;}catch(e) {}if(!customEventWorks){try{var event=document.createEvent("CustomEvent");event.initCustomEvent("testingtheevent",false,true,{});self.dispatchEvent(event);}catch(e) {anyEventWorks = false;}}if(anyEventWorks){fireDomEvent = function(type,detail){var event;if(customEventWorks){event = new self.CustomEvent(type,{detail:detail,bubbles:false,cancelable:true});}else if(self.dispatchEvent){event = document.createEvent("CustomEvent");event.initCustomEvent(type,false,true,detail);}return event?!self.dispatchEvent(event):false;};}var toWindowMethodNameMap={};toWindowMethodNameMap["unhandledRejection"] = ("on" + "unhandledRejection").toLowerCase();toWindowMethodNameMap["rejectionHandled"] = ("on" + "rejectionHandled").toLowerCase();return function(name,reason,promise){var methodName=toWindowMethodNameMap[name];var method=self[methodName];if(!method)return false;if(name === "rejectionHandled"){method.call(self,promise);}else {method.call(self,reason,promise);}return true;};}})();if(typeof console !== "undefined" && typeof console.warn !== "undefined"){printWarning = function(message){console.warn(message);};if(util.isNode && process.stderr.isTTY){printWarning = function(message,isSoft){var color=isSoft?"\u001b[33m":"\u001b[31m";console.warn(color + message + "\u001b[0m\n");};}else if(!util.isNode && typeof new Error().stack === "string"){printWarning = function(message,isSoft){console.warn("%c" + message,isSoft?"color: darkorange":"color: red");};}}var config={warnings:warnings,longStackTraces:false,cancellation:false};if(longStackTraces)Promise.longStackTraces();return {longStackTraces:function longStackTraces(){return config.longStackTraces;},warnings:function warnings(){return config.warnings;},cancellation:function cancellation(){return config.cancellation;},propagateFromFunction:function propagateFromFunction(){return _propagateFromFunction;},boundValueFunction:function boundValueFunction(){return _boundValueFunction;},checkForgottenReturns:checkForgottenReturns,setBounds:setBounds,warn:warn,deprecated:deprecated,CapturedTrace:CapturedTrace};};},{"./errors":12,"./util":36}],10:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise){function returner(){return this.value;}function thrower(){throw this.reason;}Promise.prototype["return"] = Promise.prototype.thenReturn = function(value){if(value instanceof Promise)value.suppressUnhandledRejections();return this._then(returner,undefined,undefined,{value:value},undefined);};Promise.prototype["throw"] = Promise.prototype.thenThrow = function(reason){return this._then(thrower,undefined,undefined,{reason:reason},undefined);};Promise.prototype.catchThrow = function(reason){if(arguments.length <= 1){return this._then(undefined,thrower,undefined,{reason:reason},undefined);}else {var _reason=arguments[1];var handler=function handler(){throw _reason;};return this.caught(reason,handler);}};Promise.prototype.catchReturn = function(value){if(arguments.length <= 1){if(value instanceof Promise)value.suppressUnhandledRejections();return this._then(undefined,returner,undefined,{value:value},undefined);}else {var _value=arguments[1];if(_value instanceof Promise)_value.suppressUnhandledRejections();var handler=function handler(){return _value;};return this.caught(value,handler);}};};},{}],11:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,INTERNAL){var PromiseReduce=Promise.reduce;var PromiseAll=Promise.all;function promiseAllThis(){return PromiseAll(this);}function PromiseMapSeries(promises,fn){return PromiseReduce(promises,fn,INTERNAL,INTERNAL);}Promise.prototype.each = function(fn){return this.mapSeries(fn)._then(promiseAllThis,undefined,undefined,this,undefined);};Promise.prototype.mapSeries = function(fn){return PromiseReduce(this,fn,INTERNAL,INTERNAL);};Promise.each = function(promises,fn){return PromiseMapSeries(promises,fn)._then(promiseAllThis,undefined,undefined,promises,undefined);};Promise.mapSeries = PromiseMapSeries;};},{}],12:[function(_dereq_,module,exports){"use strict";var es5=_dereq_("./es5");var Objectfreeze=es5.freeze;var util=_dereq_("./util");var inherits=util.inherits;var notEnumerableProp=util.notEnumerableProp;function subError(nameProperty,defaultMessage){function SubError(message){if(!(this instanceof SubError))return new SubError(message);notEnumerableProp(this,"message",typeof message === "string"?message:defaultMessage);notEnumerableProp(this,"name",nameProperty);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor);}else {Error.call(this);}}inherits(SubError,Error);return SubError;}var _TypeError,_RangeError;var Warning=subError("Warning","warning");var CancellationError=subError("CancellationError","cancellation error");var TimeoutError=subError("TimeoutError","timeout error");var AggregateError=subError("AggregateError","aggregate error");try{_TypeError = TypeError;_RangeError = RangeError;}catch(e) {_TypeError = subError("TypeError","type error");_RangeError = subError("RangeError","range error");}var methods=("join pop push shift unshift slice filter forEach some " + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");for(var i=0;i < methods.length;++i) {if(typeof Array.prototype[methods[i]] === "function"){AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];}}es5.defineProperty(AggregateError.prototype,"length",{value:0,configurable:false,writable:true,enumerable:true});AggregateError.prototype["isOperational"] = true;var level=0;AggregateError.prototype.toString = function(){var indent=Array(level * 4 + 1).join(" ");var ret="\n" + indent + "AggregateError of:" + "\n";level++;indent = Array(level * 4 + 1).join(" ");for(var i=0;i < this.length;++i) {var str=this[i] === this?"[Circular AggregateError]":this[i] + "";var lines=str.split("\n");for(var j=0;j < lines.length;++j) {lines[j] = indent + lines[j];}str = lines.join("\n");ret += str + "\n";}level--;return ret;};function OperationalError(message){if(!(this instanceof OperationalError))return new OperationalError(message);notEnumerableProp(this,"name","OperationalError");notEnumerableProp(this,"message",message);this.cause = message;this["isOperational"] = true;if(message instanceof Error){notEnumerableProp(this,"message",message.message);notEnumerableProp(this,"stack",message.stack);}else if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor);}}inherits(OperationalError,Error);var errorTypes=Error["__BluebirdErrorTypes__"];if(!errorTypes){errorTypes = Objectfreeze({CancellationError:CancellationError,TimeoutError:TimeoutError,OperationalError:OperationalError,RejectionError:OperationalError,AggregateError:AggregateError});notEnumerableProp(Error,"__BluebirdErrorTypes__",errorTypes);}module.exports = {Error:Error,TypeError:_TypeError,RangeError:_RangeError,CancellationError:errorTypes.CancellationError,OperationalError:errorTypes.OperationalError,TimeoutError:errorTypes.TimeoutError,AggregateError:errorTypes.AggregateError,Warning:Warning};},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){var isES5=(function(){"use strict";return this === undefined;})();if(isES5){module.exports = {freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:isES5,propertyIsWritable:function propertyIsWritable(obj,prop){var descriptor=Object.getOwnPropertyDescriptor(obj,prop);return !!(!descriptor || descriptor.writable || descriptor.set);}};}else {var has=({}).hasOwnProperty;var str=({}).toString;var proto=({}).constructor.prototype;var ObjectKeys=function ObjectKeys(o){var ret=[];for(var key in o) {if(has.call(o,key)){ret.push(key);}}return ret;};var ObjectGetDescriptor=function ObjectGetDescriptor(o,key){return {value:o[key]};};var ObjectDefineProperty=function ObjectDefineProperty(o,key,desc){o[key] = desc.value;return o;};var ObjectFreeze=function ObjectFreeze(obj){return obj;};var ObjectGetPrototypeOf=function ObjectGetPrototypeOf(obj){try{return Object(obj).constructor.prototype;}catch(e) {return proto;}};var ArrayIsArray=function ArrayIsArray(obj){try{return str.call(obj) === "[object Array]";}catch(e) {return false;}};module.exports = {isArray:ArrayIsArray,keys:ObjectKeys,names:ObjectKeys,defineProperty:ObjectDefineProperty,getDescriptor:ObjectGetDescriptor,freeze:ObjectFreeze,getPrototypeOf:ObjectGetPrototypeOf,isES5:isES5,propertyIsWritable:function propertyIsWritable(){return true;}};}},{}],14:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,INTERNAL){var PromiseMap=Promise.map;Promise.prototype.filter = function(fn,options){return PromiseMap(this,fn,options,INTERNAL);};Promise.filter = function(promises,fn,options){return PromiseMap(promises,fn,options,INTERNAL);};};},{}],15:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,tryConvertToPromise){var util=_dereq_("./util");var CancellationError=Promise.CancellationError;var errorObj=util.errorObj;function FinallyHandlerCancelReaction(finallyHandler){this.finallyHandler = finallyHandler;}FinallyHandlerCancelReaction.prototype._resultCancelled = function(){checkCancel(this.finallyHandler);};function checkCancel(ctx,reason){if(ctx.cancelPromise != null){if(arguments.length > 1){ctx.cancelPromise._reject(reason);}else {ctx.cancelPromise._cancel();}ctx.cancelPromise = null;return true;}return false;}function succeed(){return finallyHandler.call(this,this.promise._target()._settledValue());}function fail(reason){if(checkCancel(this,reason))return;errorObj.e = reason;return errorObj;}function finallyHandler(reasonOrValue){var promise=this.promise;var handler=this.handler;if(!this.called){this.called = true;var ret=this.type === 0?handler.call(promise._boundValue()):handler.call(promise._boundValue(),reasonOrValue);if(ret !== undefined){var maybePromise=tryConvertToPromise(ret,promise);if(maybePromise instanceof Promise){if(this.cancelPromise != null){if(maybePromise.isCancelled()){var reason=new CancellationError("late cancellation observer");promise._attachExtraTrace(reason);errorObj.e = reason;return errorObj;}else if(maybePromise.isPending()){maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this));}}return maybePromise._then(succeed,fail,undefined,this,undefined);}}}if(promise.isRejected()){checkCancel(this);errorObj.e = reasonOrValue;return errorObj;}else {checkCancel(this);return reasonOrValue;}}Promise.prototype._passThrough = function(handler,type,success,fail){if(typeof handler !== "function")return this.then();return this._then(success,fail,undefined,{promise:this,handler:handler,called:false,cancelPromise:null,type:type},undefined);};Promise.prototype.lastly = Promise.prototype["finally"] = function(handler){return this._passThrough(handler,0,finallyHandler,finallyHandler);};Promise.prototype.tap = function(handler){return this._passThrough(handler,1,finallyHandler);};return finallyHandler;};},{"./util":36}],16:[function(_dereq_,module,exports){"use strict";module.exports = function(Promise,apiRejection,INTERNAL,tryConvertToPromise,Proxyable,debug){var errors=_dereq_("./errors");var TypeError=errors.TypeError;var util=_dereq_("./util");var errorObj=util.errorObj;var tryCatch=util.tryCatch;var yieldHandlers=[];function promiseFromYieldHandler(value,yieldHandlers,traceParent){for(var i=0;i < yieldHandlers.length;++i) {traceParent._pushContext();var result=tryCatch(yieldHandlers[i])(value);traceParent._popContext();if(result === errorObj){traceParent._pushContext();var ret=Promise.reject(errorObj.e);traceParent._popContext();return ret;}var maybePromise=tryConvertToPromise(result,traceParent);if(maybePromise instanceof Promise)return maybePromise;}return null;}function PromiseSpawn(generatorFunction,receiver,yieldHandler,stack){var promise=this._promise = new Promise(INTERNAL);promise._captureStackTrace();promise._setOnCancel(this);this._stack = stack;this._generatorFunction = generatorFunction;this._receiver = receiver;this._generator = undefined;this._yieldHandlers = typeof yieldHandler === "function"?[yieldHandler].concat(yieldHandlers):yieldHandlers;this._yieldedPromise = null;}util.inherits(PromiseSpawn,Proxyable);PromiseSpawn.prototype._isResolved = function(){return this.promise === null;};PromiseSpawn.prototype._cleanup = function(){this._promise = this._generator = null;};PromiseSpawn.prototype._promiseCancelled = function(){if(this._isResolved())return;var implementsReturn=typeof this._generator["return"] !== "undefined";var result;if(!implementsReturn){var reason=new Promise.CancellationError("generator .return() sentinel");Promise.coroutine.returnSentinel = reason;this._promise._attachExtraTrace(reason);this._promise._pushContext();result = tryCatch(this._generator["throw"]).call(this._generator,reason);this._promise._popContext();if(result === errorObj && result.e === reason){result = null;}}else {this._promise._pushContext();result = tryCatch(this._generator["return"]).call(this._generator,undefined);this._promise._popContext();}var promise=this._promise;this._cleanup();if(result === errorObj){promise._rejectCallback(result.e,false);}else {promise.cancel();}};PromiseSpawn.prototype._promiseFulfilled = function(value){this._yieldedPromise = null;this._promise._pushContext();var result=tryCatch(this._generator.next).call(this._generator,value);this._promise._popContext();this._continue(result);};PromiseSpawn.prototype._promiseRejected = function(reason){this._yieldedPromise = null;this._promise._attachExtraTrace(reason);this._promise._pushContext();var result=tryCatch(this._generator["throw"]).call(this._generator,reason);this._promise._popContext();this._continue(result);};PromiseSpawn.prototype._resultCancelled = function(){if(this._yieldedPromise instanceof Promise){var promise=this._yieldedPromise;this._yieldedPromise = null;promise.cancel();}};PromiseSpawn.prototype.promise = function(){return this._promise;};PromiseSpawn.prototype._run = function(){this._generator = this._generatorFunction.call(this._receiver);this._receiver = this._generatorFunction = undefined;this._promiseFulfilled(undefined);};PromiseSpawn.prototype._continue = function(result){var promise=this._promise;if(result === errorObj){this._cleanup();return promise._rejectCallback(result.e,false);}var value=result.value;if(result.done === true){this._cleanup();return promise._resolveCallback(value);}else {var maybePromise=tryConvertToPromise(value,this._promise);if(!(maybePromise instanceof Promise)){maybePromise = promiseFromYieldHandler(maybePromise,this._yieldHandlers,this._promise);if(maybePromise === null){this._promiseRejected(new TypeError("A value %s was yielded that could not be treated as a promise\n\n See http://g