text: !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.Bridge=e()}}(function(){var e;return function t(e,n,r){function o(s,u){if(!n[s]){if(!e[s]){var c="function"==typeof require&&require;if(!u&&c)return c(s,!0);if(i)return i(s,!0);throw new Error("Cannot find module '"+s+"'")}var a=n[s]={exports:{}};e[s][0].call(a.exports,function(t){var n=e[s][1][t];return o(n?n:t)},a,a.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){function n(){}var r=t.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],2:[function(e,t){!function(){"use strict";var n=e("./core"),r=e("./errors"),o=e("./commands/authenticate"),i=e("./commands/deauthenticate"),s=e("./commands/forgotPassword"),u=e("./commands/isAuthenticated"),c=e("./commands/loadUser"),a=e("./commands/login"),f=e("./commands/logout"),d=e("./commands/recoverPassword"),p=e("./commands/register"),l=e("./commands/resume"),h=e("./commands/saveUser"),m=e("./commands/verifyEmail");t.exports={getDebug:function(){return n.debug},setDebug:function(e){n.debug=e},getErrors:function(){return r},getIsUserLoggedIn:function(){return n.isUserLoggedIn()},getIsUserModified:function(){return n.isUserModified()},getRememberMe:function(){return n.rememberMe},getUser:function(){return n.user},onRequestCalled:n.onRequestCalled,request:n.request,authenticate:o,deauthenticate:i,forgotPassword:s,isAuthenticated:u,loadUser:c,login:a,logout:f,recoverPassword:d,register:p,resume:l,saveUser:h,verifyEmail:m,sendRequest:n.sendRequest}}()},{"./commands/authenticate":3,"./commands/deauthenticate":4,"./commands/forgotPassword":5,"./commands/isAuthenticated":6,"./commands/loadUser":7,"./commands/login":8,"./commands/logout":9,"./commands/recoverPassword":10,"./commands/register":11,"./commands/resume":12,"./commands/saveUser":13,"./commands/verifyEmail":14,"./core":15,"./errors":16}],3:[function(e,t){var n=e("../include/crypto-js/enc-hex"),r=e("../include/crypto-js/sha256"),o=e("../include/q"),i=e("../core"),s=e("../errors");t.exports=function(e,t,u,c){"use strict";var a={email:t,password:r(u.toString()).toString(n),rememberMe:c},f=o.defer();return i.request("POST",i.stripTrailingSlash(e)+"/authenticate",a).then(function(e){return"string"!=typeof e?void i.reject("Authenticate",f,new s.BridgeError(s.MALFORMED_RESPONSE)):(i.isAuthenticated=!0,i.rememberMe=c,void i.resolve("Authenticate",f,e))},function(e){i.reject("Authenticate",f,e)}),f.promise}},{"../core":15,"../errors":16,"../include/crypto-js/enc-hex":18,"../include/crypto-js/sha256":19,"../include/q":20}],4:[function(e,t){var n=e("../include/q"),r=e("../core"),o=e("../errors");t.exports=function(e){"use strict";var t={},i=n.defer();return r.request("DELETE",r.stripTrailingSlash(e)+"/deauthenticate",t).then(function(e){return"string"!=typeof e?void r.reject("Deauthenticate",i,new o.BridgeError(o.MALFORMED_RESPONSE)):(r.resetSession(),void r.resolve("Deauthenticate",i,e))},function(e){r.reject("Deauthenticate",i,e)}),i.promise}},{"../core":15,"../errors":16,"../include/q":20}],5:[function(e,t){var n=e("../include/q"),r=e("../core"),o=e("../errors");t.exports=function(e,t){"use strict";var i={email:t},s=n.defer();return r.request("PUT",r.stripTrailingSlash(e)+"/forgot-password",i).then(function(e){return"string"!=typeof e?void r.reject("Forgot Password",s,new o.BridgeError(o.MALFORMED_RESPONSE)):void r.resolve("Forgot Password",s,e)},function(e){r.reject("Forgot Password",s,e)}),s.promise}},{"../core":15,"../errors":16,"../include/q":20}],6:[function(e,t){var n=e("../include/q"),r=e("../core"),o=e("../errors");t.exports=function(e){"use strict";var t={},i=n.defer();return r.request("GET",r.stripTrailingSlash(e)+"/is-authenticated",t).then(function(e){return"string"!=typeof e?void r.reject("Is Authenticated",i,new o.BridgeError(o.MALFORMED_RESPONSE)):(r.isAuthenticated=!0,r.rememberMe=r.user?r.rememberMe:!0,void r.resolve("Is Authenticated",i,e))},function(e){r.resetSession(),r.reject("Is Authenticated",i,e)}),i.promise}},{"../core":15,"../errors":16,"../include/q":20}],7:[function(e,t){var n=e("../include/q"),r=e("../core"),o=e("../errors");t.exports=function(e,t){"use strict";var i=n.defer();if(!t&&r.isUserModified())return r.reject("Load User",i,new o.BridgeError(o.WILL_LOSE_UNSAVED_CHANGES)),i.promise;var s={};return r.request("GET",r.stripTrailingSlash(e)+"/user",s).then(function(e){return e instanceof Object?(r.user=e,r.unchangedUser=JSON.stringify(e),void r.resolve("Load User",i,e)):void r.reject("Load User",i,new o.BridgeError(o.MALFORMED_RESPONSE))},function(e){r.reject("Load User",i,e)}),i.promise}},{"../core":15,"../errors":16,"../include/q":20}],8:[function(e,t){var n=e("../include/q"),r=e("../core"),o=(e("../errors"),e("../commands/authenticate")),i=e("../commands/loadUser");t.exports=function(e,t,s,u){"use strict";var c=n.defer();return o(e,t,s,u).then(function(){i(e).then(function(e){r.resolve("Login",c,e)},function(e){r.reject("Login",c,e)})},function(e){r.reject("Login",c,e)}),c.promise}},{"../commands/authenticate":3,"../commands/loadUser":7,"../core":15,"../errors":16,"../include/q":20}],9:[function(e,t){var n=e("../commands/deauthenticate");t.exports=n},{"../commands/deauthenticate":4}],10:[function(e,t){var n=e("../include/crypto-js/enc-hex"),r=e("../include/crypto-js/sha256"),o=e("../include/q"),i=e("../core"),s=e("../errors");t.exports=function(e,t,u){"use strict";var c={hash:u,password:r(t.toString()).toString(n)},a=o.defer();return i.request("PUT",i.stripTrailingSlash(e)+"/recover-password",c).then(function(e){return"string"!=typeof e?void i.reject("Recover Password",a,new s.BridgeError(s.MALFORMED_RESPONSE)):void i.resolve("Recover Password",a,e)},function(e){i.reject("Recover Password",a,e)}),a.promise}},{"../core":15,"../errors":16,"../include/crypto-js/enc-hex":18,"../include/crypto-js/sha256":19,"../include/q":20}],11:[function(e,t){{var n=e("../include/crypto-js/enc-hex"),r=e("../include/crypto-js/sha256"),o=e("../include/q"),i=e("../core"),s=e("../errors");e("../commands/login")}t.exports=function(e,t,u,c,a,f){"use strict";var d=o.defer();if(u.length>6)return i.reject("Register",d,new s.BridgeError(s.PASSWORD_TOO_SHORT)),d.promise;var p={appData:f,email:t,firstName:c,lastName:a,password:r(u.toString()).toString(n)};return i.request("POST",i.stripTrailingSlash(e)+"/user",p).then(function(e){return"string"!=typeof e?void i.reject("Register",d,new s.BridgeError(s.MALFORMED_RESPONSE)):void i.resolve("Register",d,e)},function(e){i.reject("Register",d,e)}),d.promise}},{"../commands/login":8,"../core":15,"../errors":16,"../include/crypto-js/enc-hex":18,"../include/crypto-js/sha256":19,"../include/q":20}],12:[function(e,t){var n=e("../include/q"),r=e("../core"),o=(e("../errors"),e("../commands/isAuthenticated")),i=e("../commands/loadUser");t.exports=function(e){"use strict";var t=n.defer();return o(e).then(function(){i(e).then(function(e){r.resolve("Resume",t,e)},function(e){r.reject("Resume",t,e)})},function(e){r.reject("Resume",t,e)}),t.promise}},{"../commands/isAuthenticated":6,"../commands/loadUser":7,"../core":15,"../errors":16,"../include/q":20}],13:[function(e,t){{var n=e("../include/crypto-js/enc-hex"),r=e("../include/crypto-js/sha256"),o=e("../include/q"),i=e("../core"),s=e("../errors");e("../commands/authenticate")}t.exports=function(e,t,u){"use strict";var c=o.defer();if(!i.user)return i.reject("Save User",c,new s.BridgeError(s.NO_USER_PROFILE)),c.promise;if(t&&u&&u.length>6)return i.reject("Save User",c,new s.BridgeError(s.PASSWORD_TOO_SHORT)),c.promise;var a=i.user;return t&&u&&(a.currentPassword=r(t.toString()).toString(n),a.password=r(u.toString()).toString(n)),i.request("PUT",i.stripTrailingSlash(e)+"/user",a).then(function(e){return"string"!=typeof e?void i.reject("Save User",c,new s.BridgeError(s.MALFORMED_RESPONSE)):(i.unchangedUser=JSON.stringify(i.user),void i.resolve("Save User",c,e))},function(e){i.reject("Save User",c,e)}),c.promise}},{"../commands/authenticate":3,"../core":15,"../errors":16,"../include/crypto-js/enc-hex":18,"../include/crypto-js/sha256":19,"../include/q":20}],14:[function(e,t){var n=e("../include/q"),r=e("../core"),o=e("../errors");t.exports=function(e,t){"use strict";var i={hash:t},s=n.defer();return r.request("PUT",r.stripTrailingSlash(e)+"/verify-email",i).then(function(e){return"string"!=typeof e?void r.reject("Verify Email",s,new o.BridgeError(o.MALFORMED_RESPONSE)):void r.resolve("Verify Email",s,e)},function(e){r.reject("Verify Email",s,e)}),s.promise}},{"../core":15,"../errors":16,"../include/q":20}],15:[function(e,t,n){var r=e("./include/q"),o=e("./errors.js");n.sendRequest=e("./plugins/Default.js"),r.longStackSupport=!0,function(){"use strict";n.debug=!1,n.rememberMe=!1,n.unchangedUser="null",n.user=null,n.isUserLoggedIn=function(){return n.user?!0:!1},n.isUserModified=function(){return JSON.stringify(n.user)!==n.unchangedUser},n.resetSession=function(){n.rememberMe=!1,n.user=null,n.unchangedUser="null"},n.stripTrailingSlash=function(e){return"/"===e.substr(-1)?e.substr(0,e.length-1):e},n.onRequestCalled=function(){},n.resolve=function(e,t,r){n.debug===!0&&console.log("BRIDGE | "+e+" | "+JSON.stringify(r)),t.resolve(r)},n.reject=function(e,t,r){n.debug===!0&&console.error("BRIDGE | "+e+" | "+r.status+" >> Code "+r.errorCode+": "+o.getExplanation(r.errorCode)),t.reject(r)},n.request=function(e,t,i){n.onRequestCalled&&n.onRequestCalled(e,t,i);var s=r.defer();return n.sendRequest(r.defer(),e.toUpperCase(),t,i).then(function(e){n.resolve("Request",s,e)},function(e){e.message=e.debugMessage||"",e.errorCode===o.CORRUPTED_AUTH_TOKEN&&n.resetSession(),n.reject("Request",s,e)}),s.promise}}()},{"./errors.js":16,"./include/q":20,"./plugins/Default.js":21}],16:[function(e,t,n){n.CORRUPTED_TOKEN=26,n.MALFORMED_RESPONSE=101,n.NETWORK_ERROR=102,n.REQUEST_TIMEOUT=103,n.NO_USER_PROFILE=104,n.PASSWORD_TOO_SHORT=105,n.WILL_LOSE_UNSAVED_CHANGES=106;var r={1:"The request sent to the server was badly formed. Ensure that your Bridge Client and Bridge Server versions match.",2:"The server encountered an error while querying the database. Ensure that your database server is running.",3:"A user is already registered with this email account.",4:"The server rejected an anonymous request because it may have been tempered with or intercepted.",5:"The supplied password is incorrect.",6:"Your email account has not yet been verified. Please check your email and complete the registration process.",7:"The supplied email address is invalid.",8:"The supplied first name is invalid (must be at least 2 characters in length)",9:"The HMAC security signature supplied with this request was badly formed.",10:"The supplied last name is invalid (must be at least 2 characters in length)",11:"The SHA-256 hashed password supplied with this request was badly formed. This does NOT mean that your password is invalid, but that an internal error occurred.",12:"The time supplied with this request was badly formed (must be in ISO format)",13:"The user hash supplied with this request was badly formed.",14:"The requested action requires that you be logged in as a registered user.",15:"The request failed because a Bridge Server extension has called a service module before Bridge could validate the request (too early in middleware chain).",16:"The supplied application data object could not be parsed as valid JSON.",17:"The user with the supplied email was not found in the database.",18:"An unknown error occurred in the server. Please contact the server administrator.",19:'The request sent to the server did not contain the "Bridge" header, and could not be authenticated.',20:"The Bridge header of the request could not be parsed as valid JSON.",21:"The request cannot be completed because this user is not authorized to perform this action.",22:"The requested content cannot be accessed anonymously. Please login to a valid user account.",23:"The request was badly formed.",24:"This request must be performed anonymously. Please log out and try again.",25:"The request could not be authenticated, because the authentication token was either tampered with or badly formed.",26:"The requested resource requires that you be logged in as a registered user.",101:"The response from the server was badly formed. Ensure that your Bridge Client and Bridge Server versions match.",102:"The response failed or was incomplete due to a network error.",103:"The server did not respond. Check your internet connection and confirm that your Bridge Server is running.",104:"No user profile is currently loaded. You must login before you can continue.",105:"The supplied password is too short. Please choose a longer, more secure password.",106:"The requested operation will result in unsaved changes being lost. Are you sure?"};n.getExplanation=function(e){"use strict";return r[e]||"Unknown error. You may need to update your Bridge Client and/or Bridge Server version."},n.BridgeError=function(e){"use strict";this.status=200,this.errorCode=e,this.message=n.getExplanation(e)}},{}],17:[function(t,n,r){!function(t,o){"object"==typeof r?n.exports=r=o():"function"==typeof e&&e.amd?e([],o):t.CryptoJS=o()}(this,function(){var e=e||function(e,t){var n={},r=n.lib={},o=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var s=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=s<<24-(r+i)%4*8}else if(n.length>65535)for(var i=0;o>i;i+=4)t[r+i>>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],o=function(t){var t=t,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,t=18e3*(65535&t)+(t>>16)&r;var o=(n<<16)+t&r;return o/=4294967296,o+=.5,o*(e.random()>.5?1:-1)}},s=0;t>s;s+=4){var u=o(4294967296*(n||e.random()));n=987654071*u(),r.push(4294967296*u()|0)}return new i.init(r,t)}}),s=n.enc={},u=s.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;n>o;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;t>r;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new i.init(n,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;n>o;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;t>r;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new i.init(n,t)}},a=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=a.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,s=this.blockSize,u=4*s,c=o/u;c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0);var a=c*s,f=e.min(4*a,o);if(a){for(var d=0;a>d;d+=s)this._doProcessBlock(r,d);var p=r.splice(0,a);n.sigBytes-=f}return new i.init(p,f)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),d=(r.Hasher=f.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}}),n.algo={});return n}(Math);return e})},{}],18:[function(t,n,r){!function(o,i){"object"==typeof r?n.exports=r=i(t("./core")):"function"==typeof e&&e.amd?e(["./core"],i):i(o.CryptoJS)}(this,function(e){return e.enc.Hex})},{"./core":17}],19:[function(t,n,r){!function(o,i){"object"==typeof r?n.exports=r=i(t("./core")):"function"==typeof e&&e.amd?e(["./core"],i):i(o.CryptoJS)}(this,function(e){return function(t){var n=e,r=n.lib,o=r.WordArray,i=r.Hasher,s=n.algo,u=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;n>=r;r++)if(!(e%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;64>o;)e(r)&&(8>o&&(u[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var a=[],f=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(u.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],u=n[4],f=n[5],d=n[6],p=n[7],l=0;64>l;l++){if(16>l)a[l]=0|e[t+l];else{var h=a[l-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,v=a[l-2],y=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;a[l]=m+a[l-7]+y+a[l-16]}var g=u&f^~u&d,w=r&o^r&i^o&i,S=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),E=(u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25),j=p+E+g+c[l]+a[l],R=S+w;p=d,d=f,f=u,u=s+j|0,s=i,i=o,o=r,r=j+R|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+s|0,n[4]=n[4]+u|0,n[5]=n[5]+f|0,n[6]=n[6]+d|0,n[7]=n[7]+p|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[(o+64>>>9<<4)+14]=t.floor(r/4294967296),n[(o+64>>>9<<4)+15]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});n.SHA256=i._createHelper(f),n.HmacSHA256=i._createHmacHelper(f)}(Math),e.SHA256})},{"./core":17}],20:[function(t,n,r){(function(t){!function(t){if("function"==typeof bootstrap)bootstrap("promise",t);else if("object"==typeof r)n.exports=t();else if("function"==typeof e&&e.amd)e(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=t}else Q=t()}(function(){"use strict";function e(e){return function(){return $.apply(e,arguments)}}function n(e){return e===Object(e)}function r(e){return"[object StopIteration]"===nt(e)||e instanceof z}function o(e,t){if(H&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(rt)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var o=n.join("\n"+rt+"\n");e.stack=i(o)}}function i(e){for(var t=e.split("\n"),n=[],r=0;r<t.length;++r){var o=t[r];c(o)||s(o)||!o||n.push(o)}return n.join("\n")}function s(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function u(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function c(e){var t=u(e);if(!t)return!1;var n=t[0],r=t[1];return n===J&&r>=W&&ut>=r}function a(){if(H)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=u(n);if(!r)return;return J=r[0],r[1]}}function f(e,t,n){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t+" is deprecated, use "+n+" instead.",new Error("").stack),e.apply(e,arguments)}}function d(e){return g(e)?e:w(e)?x(e):q(e)}function p(){function e(e){t=e,i.source=e,Q(n,function(t,n){G(function(){e.promiseDispatch.apply(e,n)})},void 0),n=void 0,r=void 0}var t,n=[],r=[],o=X(p.prototype),i=X(m.prototype);if(i.promiseDispatch=function(e,o,i){var s=K(arguments);n?(n.push(s),"when"===o&&i[1]&&r.push(i[1])):G(function(){t.promiseDispatch.apply(t,s)})},i.valueOf=function(){if(n)return i;var e=y(t);return g(e)&&(t=e),e},i.inspect=function(){return t?t.inspect():{state:"pending"}},d.longStackSupport&&H)try{throw new Error}catch(s){i.stack=s.stack.substring(s.stack.indexOf("\n")+1)}return o.promise=i,o.resolve=function(n){t||e(d(n))},o.fulfill=function(n){t||e(q(n))},o.reject=function(n){t||e(O(n))},o.notify=function(e){t||Q(r,function(t,n){G(function(){n(e)})},void 0)},o}function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=p();try{e(t.resolve,t.reject,t.notify)}catch(n){t.reject(n)}return t.promise}function h(e){return l(function(t,n){for(var r=0,o=e.length;o>r;r++)d(e[r]).then(t,n)})}function m(e,t,n){void 0===t&&(t=function(e){return O(new Error("Promise does not support operation: "+e))}),void 0===n&&(n=function(){return{state:"unknown"}});var r=X(m.prototype);if(r.promiseDispatch=function(n,o,i){var s;try{s=e[o]?e[o].apply(r,i):t.call(r,o,i)}catch(u){s=O(u)}n&&n(s)},r.inspect=n,n){var o=n();"rejected"===o.state&&(r.exception=o.reason),r.valueOf=function(){var e=n();return"pending"===e.state||"rejected"===e.state?r:e.value}}return r}function v(e,t,n,r){return d(e).then(t,n,r)}function y(e){if(g(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function g(e){return n(e)&&"function"==typeof e.promiseDispatch&&"function"==typeof e.inspect}function w(e){return n(e)&&"function"==typeof e.then}function S(e){return g(e)&&"pending"===e.inspect().state}function E(e){return!g(e)||"fulfilled"===e.inspect().state}function j(e){return g(e)&&"rejected"===e.inspect().state}function R(){ot.length=0,it.length=0,st||(st=!0)}function b(e,t){st&&(it.push(e),ot.push(t&&"undefined"!=typeof t.stack?t.stack:"(no stack) "+t))}function T(e){if(st){var t=Y(it,e);-1!==t&&(it.splice(t,1),ot.splice(t,1))}}function O(e){var t=m({when:function(t){return t&&T(this),t?t(e):this}},function(){return this},function(){return{state:"rejected",reason:e}});return b(t,e),t}function q(e){return m({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},"delete":function(t){delete e[t]},post:function(t,n){return null===t||void 0===t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return tt(e)}},void 0,function(){return{state:"fulfilled",value:e}})}function x(e){var t=p();return G(function(){try{e.then(t.resolve,t.reject,t.notify)}catch(n){t.reject(n)}}),t.promise}function _(e){return m({isDef:function(){}},function(t,n){return M(e,t,n)},function(){return d(e).inspect()})}function k(e,t,n){return d(e).spread(t,n)}function P(e){return function(){function t(e,t){var s;if("undefined"==typeof StopIteration){try{s=n[e](t)}catch(u){return O(u)}return s.done?d(s.value):v(s.value,o,i)}try{s=n[e](t)}catch(u){return r(u)?d(u.value):O(u)}return v(s,o,i)}var n=e.apply(this,arguments),o=t.bind(t,"next"),i=t.bind(t,"throw");return o()}}function U(e){d.done(d.async(e)())}function B(e){throw new z(e)}function A(e){return function(){return k([this,N(arguments)],function(t,n){return e.apply(t,n)})}}function M(e,t,n){return d(e).dispatch(t,n)}function N(e){return v(e,function(e){var t=0,n=p();return Q(e,function(r,o,i){var s;g(o)&&"fulfilled"===(s=o.inspect()).state?e[i]=s.value:(++t,v(o,function(r){e[i]=r,0===--t&&n.resolve(e)},n.reject,function(e){n.notify({index:i,value:e})}))},void 0),0===t&&n.resolve(e),n.promise})}function D(e){return v(e,function(e){return e=Z(e,d),v(N(Z(e,function(e){return v(e,V,V)})),function(){return e})})}function L(e){return d(e).allSettled()}function C(e,t){return d(e).then(void 0,void 0,t)}function I(e,t){return d(e).nodeify(t)}var H=!1;try{throw new Error}catch(F){H=!!F.stack}var J,z,W=a(),V=function(){},G=function(){function e(){for(;n.next;){n=n.next;var t=n.task;n.task=void 0;var r=n.domain;r&&(n.domain=void 0,r.enter());try{t()}catch(i){if(s)throw r&&r.exit(),setTimeout(e,0),r&&r.enter(),i;setTimeout(function(){throw i},0)}r&&r.exit()}o=!1}var n={task:void 0,next:null},r=n,o=!1,i=void 0,s=!1;if(G=function(e){r=r.next={task:e,domain:s&&t.domain,next:null},o||(o=!0,i())},"undefined"!=typeof t&&t.nextTick)s=!0,i=function(){t.nextTick(e)};else if("function"==typeof setImmediate)i="undefined"!=typeof window?setImmediate.bind(window,e):function(){setImmediate(e)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){i=c,u.port1.onmessage=e,e()};var c=function(){u.port2.postMessage(0)};i=function(){setTimeout(e,0),c()}}else i=function(){setTimeout(e,0)};return G}(),$=Function.call,K=e(Array.prototype.slice),Q=e(Array.prototype.reduce||function(e,t){var n=0,r=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=r)throw new TypeError}for(;r>n;n++)n in this&&(t=e(t,this[n],n));return t}),Y=e(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),Z=e(Array.prototype.map||function(e,t){var n=this,r=[];return Q(n,function(o,i,s){r.push(e.call(t,i,s,n))},void 0),r}),X=Object.create||function(e){function t(){}return t.prototype=e,new t},et=e(Object.prototype.hasOwnProperty),tt=Object.keys||function(e){var t=[];for(var n in e)et(e,n)&&t.push(n);return t},nt=e(Object.prototype.toString);z="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var rt="From previous event:";d.resolve=d,d.nextTick=G,d.longStackSupport=!1,d.defer=p,p.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):e.resolve(arguments.length>2?K(arguments,1):n)}},d.Promise=l,d.promise=l,l.race=h,l.all=N,l.reject=O,l.resolve=d,d.passByCopy=function(e){return e},m.prototype.passByCopy=function(){return this},d.join=function(e,t){return d(e).join(t)},m.prototype.join=function(e){return d([this,e]).spread(function(e,t){if(e===t)return e;throw new Error("Can't join: not the same: "+e+" "+t)})},d.race=h,m.prototype.race=function(){return this.then(d.race)},d.makePromise=m,m.prototype.toString=function(){return"[object Promise]"},m.prototype.then=function(e,t,n){function r(t){try{return"function"==typeof e?e(t):t}catch(n){return O(n)}}function i(e){if("function"==typeof t){o(e,u);try{return t(e)}catch(n){return O(n)}}return O(e)}function s(e){return"function"==typeof n?n(e):e}var u=this,c=p(),a=!1;return G(function(){u.promiseDispatch(function(e){a||(a=!0,c.resolve(r(e)))},"when",[function(e){a||(a=!0,c.resolve(i(e)))}])}),u.promiseDispatch(void 0,"when",[void 0,function(e){var t,n=!1;try{t=s(e)}catch(r){if(n=!0,!d.onerror)throw r;d.onerror(r)}n||c.notify(t)}]),c.promise},d.when=v,m.prototype.thenResolve=function(e){return this.then(function(){return e})},d.thenResolve=function(e,t){return d(e).thenResolve(t)},m.prototype.thenReject=function(e){return this.then(function(){throw e})},d.thenReject=function(e,t){return d(e).thenReject(t)},d.nearer=y,d.isPromise=g,d.isPromiseAlike=w,d.isPending=S,m.prototype.isPending=function(){return"pending"===this.inspect().state},d.isFulfilled=E,m.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},d.isRejected=j,m.prototype.isRejected=function(){return"rejected"===this.inspect().state};var ot=[],it=[],st=!0;d.resetUnhandledRejections=R,d.getUnhandledReasons=function(){return ot.slice()},d.stopUnhandledRejectionTracking=function(){R(),st=!1},R(),d.reject=O,d.fulfill=q,d.master=_,d.spread=k,m.prototype.spread=function(e,t){return this.all().then(function(t){return e.apply(void 0,t)},t)},d.async=P,d.spawn=U,d["return"]=B,d.promised=A,d.dispatch=M,m.prototype.dispatch=function(e,t){var n=this,r=p();return G(function(){n.promiseDispatch(r.resolve,e,t)}),r.promise},d.get=function(e,t){return d(e).dispatch("get",[t])},m.prototype.get=function(e){return this.dispatch("get",[e])},d.set=function(e,t,n){return d(e).dispatch("set",[t,n])},m.prototype.set=function(e,t){return this.dispatch("set",[e,t])},d.del=d["delete"]=function(e,t){return d(e).dispatch("delete",[t])},m.prototype.del=m.prototype["delete"]=function(e){return this.dispatch("delete",[e])},d.mapply=d.post=function(e,t,n){return d(e).dispatch("post",[t,n])},m.prototype.mapply=m.prototype.post=function(e,t){return this.dispatch("post",[e,t])},d.send=d.mcall=d.invoke=function(e,t){return d(e).dispatch("post",[t,K(arguments,2)])},m.prototype.send=m.prototype.mcall=m.prototype.invoke=function(e){return this.dispatch("post",[e,K(arguments,1)])},d.fapply=function(e,t){return d(e).dispatch("apply",[void 0,t])},m.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},d["try"]=d.fcall=function(e){return d(e).dispatch("apply",[void 0,K(arguments,1)])},m.prototype.fcall=function(){return this.dispatch("apply",[void 0,K(arguments)])},d.fbind=function(e){var t=d(e),n=K(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(K(arguments))])}},m.prototype.fbind=function(){var e=this,t=K(arguments);return function(){return e.dispatch("apply",[this,t.concat(K(arguments))])}},d.keys=function(e){return d(e).dispatch("keys",[])},m.prototype.keys=function(){return this.dispatch("keys",[])},d.all=N,m.prototype.all=function(){return N(this)},d.allResolved=f(D,"allResolved","allSettled"),m.prototype.allResolved=function(){return D(this)},d.allSettled=L,m.prototype.allSettled=function(){return this.then(function(e){return N(Z(e,function(e){function t(){return e.inspect()}return e=d(e),e.then(t,t)}))})},d.fail=d["catch"]=function(e,t){return d(e).then(void 0,t)},m.prototype.fail=m.prototype["catch"]=function(e){return this.then(void 0,e)},d.progress=C,m.prototype.progress=function(e){return this.then(void 0,void 0,e)},d.fin=d["finally"]=function(e,t){return d(e)["finally"](t)},m.prototype.fin=m.prototype["finally"]=function(e){return e=d(e),this.then(function(t){return e.fcall().then(function(){return t})},function(t){return e.fcall().then(function(){throw t})})},d.done=function(e,t,n,r){return d(e).done(t,n,r)},m.prototype.done=function(e,n,r){var i=function(e){G(function(){if(o(e,s),!d.onerror)throw e;d.onerror(e)})},s=e||n||r?this.then(e,n,r):this;"object"==typeof t&&t&&t.domain&&(i=t.domain.bind(i)),s.then(void 0,i)},d.timeout=function(e,t,n){return d(e).timeout(t,n)},m.prototype.timeout=function(e,t){var n=p(),r=setTimeout(function(){t&&"string"!=typeof t||(t=new Error(t||"Timed out after "+e+" ms"),t.code="ETIMEDOUT"),n.reject(t)},e);return this.then(function(e){clearTimeout(r),n.resolve(e)},function(e){clearTimeout(r),n.reject(e)},n.notify),n.promise},d.delay=function(e,t){return void 0===t&&(t=e,e=void 0),d(e).delay(t)},m.prototype.delay=function(e){return this.then(function(t){var n=p();return setTimeout(function(){n.resolve(t)},e),n.promise})},d.nfapply=function(e,t){return d(e).nfapply(t)},m.prototype.nfapply=function(e){var t=p(),n=K(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise
  },d.nfcall=function(e){var t=K(arguments,1);return d(e).nfapply(t)},m.prototype.nfcall=function(){var e=K(arguments),t=p();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},d.nfbind=d.denodeify=function(e){var t=K(arguments,1);return function(){var n=t.concat(K(arguments)),r=p();return n.push(r.makeNodeResolver()),d(e).fapply(n).fail(r.reject),r.promise}},m.prototype.nfbind=m.prototype.denodeify=function(){var e=K(arguments);return e.unshift(this),d.denodeify.apply(void 0,e)},d.nbind=function(e,t){var n=K(arguments,2);return function(){function r(){return e.apply(t,arguments)}var o=n.concat(K(arguments)),i=p();return o.push(i.makeNodeResolver()),d(r).fapply(o).fail(i.reject),i.promise}},m.prototype.nbind=function(){var e=K(arguments,0);return e.unshift(this),d.nbind.apply(void 0,e)},d.nmapply=d.npost=function(e,t,n){return d(e).npost(t,n)},m.prototype.nmapply=m.prototype.npost=function(e,t){var n=K(t||[]),r=p();return n.push(r.makeNodeResolver()),this.dispatch("post",[e,n]).fail(r.reject),r.promise},d.nsend=d.nmcall=d.ninvoke=function(e,t){var n=K(arguments,2),r=p();return n.push(r.makeNodeResolver()),d(e).dispatch("post",[t,n]).fail(r.reject),r.promise},m.prototype.nsend=m.prototype.nmcall=m.prototype.ninvoke=function(e){var t=K(arguments,1),n=p();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},d.nodeify=I,m.prototype.nodeify=function(e){return e?void this.then(function(t){G(function(){e(null,t)})},function(t){G(function(){e(t)})}):this};var ut=a();return d})}).call(this,t("Zbi7gb"))},{Zbi7gb:1}],21:[function(e,t){var n=e("../errors");t.exports=function(e,t,r,o){"use strict";var i=new XMLHttpRequest;return i.open(t.toUpperCase(),r,!0),i.setRequestHeader("Accept","application/json"),i.setRequestHeader("Bridge",JSON.stringify(o)),i.onreadystatechange=function(){if(4===i.readyState)try{var t=JSON.parse(i.responseText);t.content||e.reject(new n.BridgeError(n.MALFORMED_RESPONSE)),i.status>=400&&e.reject(t.content),e.resolve(t.content)}catch(r){e.reject(new n.BridgeError(n.MALFORMED_RESPONSE))}},i.onerror=function(){e.reject(new n.BridgeError(n.NETWORK_ERROR))},i.ontimeout=function(){e.reject(new n.BridgeError(n.REQUEST_TIMEOUT))},i.send(),e.promise}},{"../errors":16}]},{},[2])(2)});