Skip to content

Instantly share code, notes, and snippets.

@legastero
Last active August 29, 2015 14:00
Show Gist options
  • Save legastero/11155301 to your computer and use it in GitHub Desktop.
Save legastero/11155301 to your computer and use it in GitHub Desktop.
/*! stanzaio 2014-04-21*/!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.XMPP=e():"undefined"!=typeof global?global.XMPP=e():"undefined"!=typeof self&&(self.XMPP=e())}(function(){var e,n,o;return function f(e,n,o){function d(t,u){if(!n[t]){if(!e[t]){var l="function"==typeof require&&require;if(!u&&l)return l(t,!0);if(i)return i(t,!0);throw new Error("Cannot find module '"+t+"'")}var p=n[t]={exports:{}};e[t][0].call(p.exports,function(n){var o=e[t][1][n];return d(o?o:n)},p,p.exports,f,e,n,o)}return n[t].exports}for(var i="function"==typeof require&&require,t=0;t<o.length;t++)d(o[t]);return d}({1:[function(e,n,o){"use strict";o.Stream=e("./lib/stanza/stream"),o.BOSH=e("./lib/stanza/bosh"),o.Message=e("./lib/stanza/message"),o.Presence=e("./lib/stanza/presence"),o.Iq=e("./lib/stanza/iq"),o.PubsubEvent=e("./lib/stanza/pubsub").EventItem,o.PubsubItem=e("./lib/stanza/pubsub").Item,o.JID=e("./lib/jid"),o.Client=e("./lib/client"),o.crypto=e("crypto"),o.jxt=e("jxt"),o.createClient=function(n){var f=new o.Client(n);return f.use(e("./lib/plugins")),f}},{"./lib/client":3,"./lib/jid":4,"./lib/plugins":20,"./lib/stanza/bosh":41,"./lib/stanza/iq":54,"./lib/stanza/message":58,"./lib/stanza/presence":63,"./lib/stanza/pubsub":65,"./lib/stanza/stream":72,crypto:128,jxt:198}],2:[function(e,n){function o(){}function f(e,n,d,i){i=i||0;var t=p(e).cancellable().timeout(1e3*(n||20));return t.spread(function(e,n){if(e.statusCode<200||e.statusCode>=400)throw new o("HTTP Status Error");return n}).catch(l.TimeoutError,function(){throw new o("Dead Connection, exceeded timeout limit")}).catch(l.CancellationError,function(){}).catch(function(){if(d>i)return l.delay(100).then(function(){return f(e,n,d,i+1)});throw new o("Dead Connection, exceeded retry limit")})}function d(e){var n=this;P.call(this),n.sm=e,n.sendQueue=[],n.requests=[],n.maxRequests=2,n.sid="",n.on("raw:incoming",function(e){if(e=e.trim(),""!==e){var o,f;try{o=c.parse(e,s)}catch(d){return f=new y({condition:"invalid-xml"}),n.emit("stream:error",f,d),n.send(f),n.disconnect()}n.hasStream||(n.hasStream=!0,n.stream={id:o.sid,lang:o.lang||"en",version:o.version||"1.0",to:o.to,from:o.from},n.sid=o.sid,n.maxRequests=o.requests);var i=o.payload;i.forEach(function(e){if(e.lang||(e.lang=n.stream.lang),n.emit("stream:data",e),n.emit(e._eventname||e._name,e),"message"===e._name||"presence"===e._name||"iq"===e._name)n.sm.handle(e),n.emit("stanza",e);else{if("smAck"===e._name)return n.sm.process(e);if("smRequest"===e._name)return n.sm.ack()}e.id&&n.emit("id:"+e.id,e)}),"terminate"==o.type&&(n.rid=void 0,n.sid=void 0,n.emit("bosh:terminate",o),n.emit("stream:end"),n.emit("disconnected",n))}})}{var i=e("__browserify_process"),t=e("underscore"),u=e("util"),l=(e("async"),e("bluebird")),p=l.promisify(e("request")),P=e("wildemitter"),c=e("jxt"),s=e("./stanza/bosh"),y=e("./stanza/streamError");e("./stanza/message"),e("./stanza/presence"),e("./stanza/iq")}u.inherits(o,Error),u.inherits(d,P),d.prototype.connect=function(e){var n=this;n.config=t.extend({rid:Math.ceil(9999999999*Math.random()),wait:30,maxRetries:5},e),n.hasStream=!1,n.sm.started=!1,n.url=e.boshURL,n.rid=n.config.rid,n.requests=[],n.rid++,n.request(new s({version:n.config.version||"1.0",to:n.config.server,lang:n.config.lang||"en",wait:n.config.wait,ver:"1.6",hold:1}))},d.prototype.disconnect=function(){this.hasStream?(this.rid++,this.request(new s({type:"terminate"}))):(this.requests.forEach(function(e){e.request.cancel()}),this.stream=void 0,this.sid=void 0,this.rid=void 0,this.emit("disconnected",this))},d.prototype.restart=function(){var e=this;e.rid++,e.request(new s({to:e.config.server,lang:e.config.lang||"en",restart:"true"}))},d.prototype.send=function(e){var n=this;n.hasStream&&(n.sm.track(e),n.sendQueue.push(e),i.nextTick(n.longPoll.bind(n)))},d.prototype.longPoll=function(){var e=0===this.requests.length,n=this.sendQueue.length>0&&this.requests.length<this.maxRequests;if(this.sid&&(e||n)){var o=this.sendQueue;this.sendQueue=[],this.rid++,this.request(new s({payload:o}))}},d.prototype.request=function(e){var n=this,d={id:n.rid,request:null};e.rid=n.rid,e.sid=n.sid;var u=e.toString();n.emit("raw:outgoing",u),n.requests.push(d);var l=f({uri:n.url,body:u,method:"POST",strictSSL:!0},1.5*n.config.wait,this.config.maxRetries);return d.request=l,l.then(function(e){n.emit("raw:incoming",e)}).catch(o,function(e){n.hasStream=!1;var o=new y({condition:"connection-timeout"});n.emit("stream:error",o,e),n.disconnect()}).catch(function(e){var o=new y({condition:"undefined-condition"});n.emit("stream:error",o,e),n.send(o),n.disconnect()}).finally(function(){n.requests=t.filter(n.requests,function(e){return e.id!==d.id}),"terminate"!==e.type&&i.nextTick(function(){i.nextTick(n.longPoll.bind(n))})})},n.exports=d},{"./stanza/bosh":41,"./stanza/iq":54,"./stanza/message":58,"./stanza/presence":63,"./stanza/streamError":73,__browserify_process:135,async:81,bluebird:85,jxt:198,request:120,underscore:222,util:123,wildemitter:223}],3:[function(e,n){"use strict";function o(e){var n=this;f.call(this),e=e||{},this.config=d.extend({useStreamManagement:!0,transports:["websocket","bosh"]},e),this.jid=new b,this.transports={websocket:function(e,n){var o=e.transport=new M(e.sm);o.on("*",function(n,o){e.emit(n,o)}),o.connect(n)},bosh:function(e,n){var o=e.transport=new X(e.sm);o.on("*",function(n,o){e.emit(n,o)}),o.connect(n)}},this.negotiatedFeatures={},this.featureOrder=["sasl","streamManagement","bind","streamManagement","session"],this.features={},this.sm=new r,this.on("streamFeatures",function(e){var o=[];n.featureOrder.forEach(function(f){e._extensions[f]&&!n.negotiatedFeatures[f]&&o.push(function(o){!n.negotiatedFeatures[f]&&n.features[f]?n.features[f](e,o):o()})}),u.series(o,function(e){if("restart"===e)n.transport.restart();else if("disconnect"===e){var o=new w({condition:"policy-violation",text:"failed to negotiate stream features"});n.emit("stream:error",o),n.disconnect()}})}),this.features.sasl=function(e,o){var f=m.create(e.sasl.mechanisms);n.on("sasl:success","sasl",function(){n.negotiatedFeatures.sasl=!0,n.releaseGroup("sasl"),n.emit("auth:success"),o("restart")}),n.on("sasl:challenge","sasl",function(e){f.challenge(e.value),n.send(new c.Response({value:f.response(n.getCredentials())})),f.cache&&(d.each(f.cache,function(e,o){e&&(n.config.credentials[o]=P(e))}),n.emit("credentials:update",n.config.credentials)),o()}),n.on("sasl:failure","sasl",function(){n.releaseGroup("sasl"),n.emit("auth:failed"),o("disconnect")}),n.on("sasl:abort","sasl",function(){n.releaseGroup("sasl"),n.emit("auth:failed"),o("disconnect")});var i={mechanism:f.name};f.clientFirst&&(i.value=f.response(n.getCredentials())),n.send(new c.Auth(i))},this.features.bind=function(e,o){n.sendIq({type:"set",bind:{resource:n.config.resource}}).then(function(f){n.negotiatedFeatures.bind=!0,n.emit("session:bound",f.bind.jid),n.jid=new b(f.bind.jid),n.sessionStarted||e._extensions.session||(n.sessionStarted=!0,n.emit("session:started",f.bind.jid)),o()}).catch(function(e){n.emit("session:error",e),o("disconnect")})},this.features.session=function(e,o){n.sendIq({type:"set",session:{}},function(){n.negotiatedFeatures.session=!0,n.sessionStarted||(n.sessionStarted=!0,n.emit("session:started",n.jid)),o()})},this.features.streamManagement=function(e,o){return n.config.useStreamManagement?(n.on("stream:management:enabled","sm",function(e){n.sm.enabled(e),n.negotiatedFeatures.streamManagement=!0,n.releaseGroup("sm"),o()}),n.on("stream:management:resumed","sm",function(e){n.sm.enabled(e),n.negotiatedFeatures.streamManagement=!0,n.negotiatedFeatures.bind=!0,n.sessionStarted=!0,n.releaseGroup("sm"),o()}),n.on("stream:management:failed","sm",function(){n.sm.failed(),n.emit("session:end"),n.releaseGroup("session"),n.releaseGroup("sm"),o()}),void(n.sm.id?n.sm.id&&n.sm.allowResume?n.sm.resume(n.transport):o():n.negotiatedFeatures.bind?n.sm.enable(n.transport):o())):o()},this.on("disconnected",function(){n.transport&&(n.transport.off("*"),delete n.transport),n.sessionStarted=!1,n.negotiatedFeatures.sasl=!1,n.negotiatedFeatures.streamManagement=!1,n.negotiatedFeatures.bind=!1,n.negotiatedFeatures.session=!1,n.releaseGroup("connection")}),this.on("iq",function(e){var o=e.type,f=Object.keys(e._extensions),i=e.xml.childNodes,t=0;if(d.each(i,function(e){1===e.nodeType&&(t+=1)}),"get"===e.type||"set"===e.type){if(1!=t)return n.sendIq(e.errorReply({error:{type:"modify",condition:"bad-request"}}));if(!f.length)return n.sendIq(e.errorReply({error:{type:"cancel",condition:"feature-not-implemented"}}));var u="iq:"+o+":"+f[0];n.callbacks[u]?n.emit(u,e):n.sendIq(e.errorReply({error:{type:"cancel",condition:"feature-not-implemented"}}))}}),this.on("message",function(e){Object.keys(e.$body).length&&("chat"===e.type||"normal"===e.type?n.emit("chat",e):"groupchat"===e.type&&n.emit("groupchat",e)),"error"===e.type&&n.emit("message:error",e)}),this.on("presence",function(e){var o=e.type||"available";"error"===o&&(o="presence:error"),n.emit(o,e)})}var f=e("wildemitter"),d=e("underscore"),i=e("util"),t=e("bluebird"),u=e("async"),l=e("node-uuid"),p=e("atob"),P=e("btoa"),c=e("./stanza/sasl"),s=e("./stanza/message"),y=e("./stanza/presence"),w=e("./stanza/streamError"),a=e("./stanza/iq"),b=e("./jid"),r=e("./sm"),M=e("./websocket"),X=e("./bosh"),g=e("hostmeta"),m=e("saslmechanisms");m=new m,m.use(e("sasl-external")),m.use(e("sasl-scram-sha-1")),m.use(e("sasl-digest-md5")),m.use(e("sasl-plain")),m.use(e("sasl-anonymous")),e("./stanza/stream"),e("./stanza/sm"),e("./stanza/error"),e("./stanza/streamFeatures"),e("./stanza/bind"),e("./stanza/session"),i.inherits(o,f),o.prototype.__defineGetter__("stream",function(){return this.transport?this.transport.stream:void 0}),o.prototype.use=function(e){e(this)},o.prototype.nextId=function(){return l.v4()},o.prototype.discoverBindings=function(e,n){g(e,function(e,o){if(e)return n(e,[]);var f={websocket:[],bosh:[]},d=o.links||[];d.forEach(function(e){e.href&&"urn:xmpp:alt-connections:websocket"===e.rel&&f.websocket.push(e.href),e.href&&"urn:xmpp:altconnect:websocket"===e.rel&&f.websocket.push(e.href),e.href&&"urn:xmpp:alt-connections:xbosh"===e.rel&&f.bosh.push(e.href),e.href&&"urn:xmpp:altconnect:bosh"===e.rel&&f.bosh.push(e.href)}),n(!1,f)})},o.prototype.getCredentials=function(){var e=this.config.credentials||{},n=new b(this.config.jid),o=e.username||n.local,f=e.server||n.domain,i={username:o,password:this.config.password,server:f,host:f,realm:f,serviceType:"xmpp",serviceName:f},t=d.extend(i,e),u=["saltedPassword","clientKey","serverKey"];return u.forEach(function(e){t[e]&&(t[e]=p(t[e]))}),t},o.prototype.connect=function(e){var n=this;return d.extend(n.config,e||{}),n.config.jid=new b(n.config.jid),n.config.server||(n.config.server=n.config.jid.domain),n.config.password&&(n.config.credentials=n.config.credentials||{},n.config.credentials.password=n.config.password,delete n.config.password),n.config.transport?n.transports[n.config.transport](n,n.config):n.discoverBindings(n.config.server,function(e,o){if(e)return n.disconnect();for(var f=0,d=n.config.transports.length;d>f;f++){var i=n.config.transports[f];console.log("Checking for %s endpoints",i);for(var t=0,u=(o[i]||[]).length;u>t;t++){var l=o[i][t];if(0===l.indexOf("wss://")||0===l.indexOf("https://"))return"websocket"==i?n.config.wsURL=l:n.config.boshURL=l,console.log("Using %s endpoint: %s",i,l),n.config.transport=i,n.connect();console.warn("Discovered unencrypted %s endpoint (%s). Ignoring",i,l)}}return console.warn("No endpoints found for the requested transports."),n.disconnect()})},o.prototype.disconnect=function(){this.sessionStarted&&(this.emit("session:end"),this.releaseGroup("session")),this.sessionStarted=!1,this.releaseGroup("connection"),this.transport?this.transport.disconnect():this.emit("disconnected")},o.prototype.send=function(e){this.transport.send(e)},o.prototype.sendMessage=function(e){e=e||{},e.id||(e.id=this.nextId());var n=new s(e);return this.emit("message:sent",n),this.send(n),e.id},o.prototype.sendPresence=function(e){return e=e||{},e.id||(e.id=this.nextId()),this.send(new y(e)),e.id},o.prototype.sendIq=function(e,n){var o,f,d,i,u=this;e=e||{},e.id||(e.id=this.nextId());var l=e.toJSON?e:new a(e);return"error"===e.type?void this.send(l):(i=new b(e.to),d={},d[""]=!0,d[i.full]=!0,d[i.bare]=!0,d[i.domain]=!0,d[u.jid.bare]=!0,d[u.jid.domain]=!0,f="id:"+e.id,o=new t(function(e,n){var o=function(i){d[i.from.full]&&(u.off(f,o),i._extensions.error?n(i):e(i))};u.on(f,"session",o)}),this.send(l),o.timeout(1e3*u.config.timeout||15e3).catch(t.TimeoutError,function(){return{type:"error",error:{condition:"timeout"}}}).nodeify(n))},o.prototype.sendStreamError=function(e){e=e||{};var n=new w(e);this.emit("stream:error",n),this.send(n),this.disconnect()},o.prototype.JID=function(e){return new b(e)},n.exports=o},{"./bosh":2,"./jid":4,"./sm":37,"./stanza/bind":39,"./stanza/error":49,"./stanza/iq":54,"./stanza/message":58,"./stanza/presence":63,"./stanza/sasl":69,"./stanza/session":70,"./stanza/sm":71,"./stanza/stream":72,"./stanza/streamError":73,"./stanza/streamFeatures":74,"./websocket":80,async:81,atob:82,bluebird:85,btoa:136,hostmeta:137,"node-uuid":204,"sasl-anonymous":206,"sasl-digest-md5":208,"sasl-external":210,"sasl-plain":212,"sasl-scram-sha-1":214,saslmechanisms:221,underscore:222,util:123,wildemitter:223}],4:[function(e,n){"use strict";function o(e){e=e||"","string"==typeof e?(this.jid=e,this.parts={}):(this.jid=e.jid,this.parts=e.parts)}o.prototype={constructor:{value:o},toString:function(){return this.jid},get full(){return this.jid},get bare(){if(this.parts.bare)return this.parts.bare;var e=this.jid.indexOf("/");return this.parts.bare=e>0?this.jid.slice(0,e):this.jid,this.parts.bare},get resource(){if(this.parts.resource)return this.parts.resource;var e=this.jid.indexOf("/");return this.parts.resource=e>0?this.jid.slice(e+1):"",this.parts.resource},get local(){if(this.parts.local)return this.parts.local;var e=this.bare,n=e.indexOf("@");return this.parts.local=n>0?e.slice(0,n):e,this.parts.local},get domain(){if(this.parts.domain)return this.parts.domain;var e=this.bare,n=e.indexOf("@");return this.parts.domain=n>0?e.slice(n+1):e,this.parts.domain}},n.exports=o},{}],5:[function(e,n){"use strict";n.exports=function(e){e.disco.addFeature("urn:xmpp:attention:0"),e.getAttention=function(n,o){o=o||{},o.to=n,o.type="headline",o.attention=!0,e.sendMessage(o)},e.on("message",function(n){n.attention&&e.emit("attention",n)})}},{}],6:[function(e,n){"use strict";e("../stanza/avatar");n.exports=function(e){e.disco.addFeature("urn:xmpp:avatar:metadata+notify"),e.on("pubsubEvent",function(n){n.event._extensions.updated&&"urn:xmpp:avatar:metadata"===n.event.updated.node&&e.emit("avatar",{jid:n.from,source:"pubsub",avatars:n.event.updated.published[0].avatars})}),e.on("presence",function(n){n.avatarId&&e.emit("avatar",{jid:n.from,source:"vcard",avatars:[{id:n.avatarId}]})}),e.publishAvatar=function(e,n,o){return this.publish("","urn:xmpp:avatar:data",{id:e,avatarData:n},o)},e.useAvatars=function(e,n){return this.publish("","urn:xmpp:avatar:metadata",{id:"current",avatars:e},n)},e.getAvatar=function(e,n,o){return this.getItem(e,"urn:xmpp:avatar:data",n,o)}}},{"../stanza/avatar":38}],7:[function(e,n){"use strict";e("../stanza/bookmarks");n.exports=function(e){e.getBookmarks=function(e){return this.getPrivateData({bookmarks:{}},e)},e.setBookmarks=function(e,n){return this.setPrivateData({bookmarks:e},n)}}},{"../stanza/bookmarks":40}],8:[function(e,n){"use strict";e("../stanza/carbons");n.exports=function(e){e.disco.addFeature("urn:xmpp:carbons:2"),e.enableCarbons=function(e){return this.sendIq({type:"set",enableCarbons:!0},e)},e.disableCarbons=function(e){return this.sendIq({type:"set",disableCarbons:!0},e)},e.on("message",function(n){return n._extensions.carbonSent?e.emit("carbon:sent",n):n._extensions.carbonReceived?e.emit("carbon:received",n):void 0})}},{"../stanza/carbons":43}],9:[function(e,n){"use strict";e("../stanza/chatstates");n.exports=function(e){e.disco.addFeature("http://jabber.org/protocol/chatstates"),e.on("message",function(n){n.chatState&&e.emit("chatState",{to:n.to,from:n.from,chatState:n.chatState})})}},{"../stanza/chatstates":44}],10:[function(e,n){"use strict";{var o="http://jabber.org/protocol/commands";e("../stanza/command")}n.exports=function(e){e.disco.addFeature(o),e.disco.addItem({name:"Ad-Hoc Commands",node:o}),e.getCommands=function(n,f){return e.getDiscoItems(n,o,f)}}},{"../stanza/command":45}],11:[function(e,n){"use strict";n.exports=function(e){e.disco.addFeature("urn:xmpp:message-correct:0"),e.on("message",function(n){n.replace&&(e.emit("replace",n),e.emit("replace:"+n.id,n))})}},{}],12:[function(e,n){"use strict";e("../stanza/dataforms"),n.exports=function(e){e.disco.addFeature("jabber:x:data"),e.on("message",function(n){n._extensions.form&&e.emit("dataform",n)})}},{"../stanza/dataforms":46}],13:[function(e,n){"use strict";e("../stanza/delayed");n.exports=function(e){e.disco.addFeature("urn:xmpp:delay")}},{"../stanza/delayed":47}],14:[function(e,n){"use strict";function o(e,n){var o="",f=e.features.sort(),d=[],l={},p=[];i.forEach(e.identities,function(e){d.push([e.category||"",e.type||"",e.lang||"",e.name||""].join("/"))});var P=d.length,c=f.length;if(d=i.unique(d,!0),f=i.unique(f,!0),c!=f.length||P!=d.length)return!1;o+=d.join("<")+"<",o+=f.join("<")+"<";var s=!1;if(i.forEach(e.extensions,function(e){for(var n=e.fields,o=0,f=n.length;f>o;o++)if("FORM_TYPE"==n[o].name&&"hidden"==n[o].type){var d=n[o].value;return l[d]?void(s=!0):(l[d]=e,void p.push(d))}}),s)return!1;p.sort(),i.forEach(p,function(e){var n=l[e],f={},d=[];o+="<"+e,i.forEach(n.fields,function(e){var n=e.name;if("FORM_TYPE"!=n){var o=e.value||"";"object"!=typeof o&&(o=o.split("\n")),f[n]=o.sort(),d.push(n)}}),d.sort(),i.forEach(d,function(e){o+="<"+e,i.forEach(f[e],function(e){o+="<"+e})})}),"sha-1"===n&&(n="sha1");var y=t.createHash(n).update(u.encode(o)).digest("base64"),w=4-y.length%4;4===w&&(w=0);for(var a=0;w>a;a++)y+="=";return y}function f(e,n,f){"sha-1"===n&&(n="sha1");var d=o(e,n);return d&&d==f}function d(){this.features={},this.identities={},this.extensions={},this.items={},this.caps={}}var i=e("underscore"),t=e("crypto");e("../stanza/disco"),e("../stanza/caps");var u={encode:function(e){return unescape(encodeURIComponent(e))},decode:function(e){return decodeURIComponent(escape(e))}};d.prototype={constructor:{value:d},addFeature:function(e,n){n=n||"",this.features[n]||(this.features[n]=[]),this.features[n].push(e)},addIdentity:function(e,n){n=n||"",this.identities[n]||(this.identities[n]=[]),this.identities[n].push(e)},addItem:function(e,n){n=n||"",this.items[n]||(this.items[n]=[]),this.items[n].push(e)},addExtension:function(e,n){n=n||"",this.extensions[n]||(this.extensions[n]=[]),this.extensions[n].push(e)}},n.exports=function(e){e.disco=new d(e),e.disco.addFeature("http://jabber.org/protocol/disco#info"),e.disco.addIdentity({category:"client",type:"web"}),e.getDiscoInfo=function(e,n,o){return this.sendIq({to:e,type:"get",discoInfo:{node:n}},o)},e.getDiscoItems=function(e,n,o){return this.sendIq({to:e,type:"get",discoItems:{node:n}},o)},e.updateCaps=function(){var n=this.config.capsNode||"https://stanza.io",f=JSON.parse(JSON.stringify({identities:this.disco.identities[""],features:this.disco.features[""],extensions:this.disco.extensions[""]})),d=o(f,"sha-1");return this.disco.caps={node:n,hash:"sha-1",ver:d},n=n+"#"+d,this.disco.features[n]=f.features,this.disco.identities[n]=f.identities,this.disco.extensions[n]=f.extensions,e.getCurrentCaps()},e.getCurrentCaps=function(){var n=e.disco.caps;if(!n.ver)return{ver:null,discoInfo:null};var o=n.node+"#"+n.ver;return{ver:n.ver,discoInfo:{identities:e.disco.identities[o],features:e.disco.features[o],extensions:e.disco.extensions[o]}}},e.on("presence",function(n){n._extensions.caps&&e.emit("disco:caps",n)}),e.on("iq:get:discoInfo",function(n){var o=n.discoInfo.node,f=n.discoInfo.node;o===e.disco.caps.node+"#"+e.disco.caps.ver&&(f=o,o=""),e.sendIq(n.resultReply({discoInfo:{node:f,identities:e.disco.identities[o]||[],features:e.disco.features[o]||[],extensions:e.disco.extensions[o]||[]}}))}),e.on("iq:get:discoItems",function(n){var o=n.discoInfo.node;e.sendIq(n.resultReply({discoItems:{node:o,items:e.disco.items[o]||[]}}))}),e.verifyVerString=f,e.generateVerString=o}},{"../stanza/caps":42,"../stanza/disco":48,crypto:128,underscore:222}],15:[function(e,n){"use strict";e("../stanza/extdisco");n.exports=function(e){e.disco.addFeature("urn:xmpp:extdisco:1"),e.getServices=function(e,n,o){return this.sendIq({type:"get",to:e,services:{type:n}},o)},e.getServiceCredentials=function(e,n,o){return this.sendIq({type:"get",to:e,credentials:{service:{host:n}}},o)}}},{"../stanza/extdisco":50}],16:[function(e,n){"use strict";e("../stanza/forwarded");n.exports=function(e){e.disco.addFeature("urn:xmpp:forward:0")}},{"../stanza/forwarded":51}],17:[function(e,n){"use strict";e("../stanza/geoloc");n.exports=function(e){e.disco.addFeature("http://jabber.org/protocol/geoloc"),e.disco.addFeature("http://jabber.org/protocol/geoloc+notify"),e.on("pubsubEvent",function(n){n.event._extensions.updated&&"http://jabber.org/protocol/geoloc"===n.event.updated.node&&e.emit("geoloc",{jid:n.from,geoloc:n.event.updated.published[0].geoloc})}),e.publishGeoLoc=function(e,n){return this.publish("","http://jabber.org/protocol/geoloc",{geoloc:e},n)}}},{"../stanza/geoloc":52}],18:[function(e,n){"use strict";n.exports=function(e){e.disco.addFeature("urn:xmpp:hashes:1"),e.disco.addFeature("urn:xmpp:hash-function-text-names:md5"),e.disco.addFeature("urn:xmpp:hash-function-text-names:sha-1"),e.disco.addFeature("urn:xmpp:hash-function-text-names:sha-256")}},{}],19:[function(e,n){"use strict";n.exports=function(e){e.disco.addFeature("urn:xmpp:idle:1")}},{}],20:[function(e,n){"use strict";n.exports=function(n){n.use(e("./disco")),n.use(e("./attention")),n.use(e("./avatar")),n.use(e("./bookmarks")),n.use(e("./carbons")),n.use(e("./chatstates")),n.use(e("./command")),n.use(e("./correction")),n.use(e("./dataforms")),n.use(e("./delayed")),n.use(e("./extdisco")),n.use(e("./forwarding")),n.use(e("./geoloc")),n.use(e("./hashes")),n.use(e("./idle")),n.use(e("./invisible")),n.use(e("./jingle")),n.use(e("./json")),n.use(e("./keepalive")),n.use(e("./mam")),n.use(e("./muc")),n.use(e("./nick")),n.use(e("./oob")),n.use(e("./ping")),n.use(e("./private")),n.use(e("./pubsub")),n.use(e("./receipts")),n.use(e("./roster")),n.use(e("./time")),n.use(e("./vcard")),n.use(e("./version"))}},{"./attention":5,"./avatar":6,"./bookmarks":7,"./carbons":8,"./chatstates":9,"./command":10,"./correction":11,"./dataforms":12,"./delayed":13,"./disco":14,"./extdisco":15,"./forwarding":16,"./geoloc":17,"./hashes":18,"./idle":19,"./invisible":21,"./jingle":22,"./json":23,"./keepalive":24,"./mam":25,"./muc":26,"./nick":27,"./oob":28,"./ping":29,"./private":30,"./pubsub":31,"./receipts":32,"./roster":33,"./time":34,"./vcard":35,"./version":36}],21:[function(e,n){"use strict";e("../stanza/visibility"),n.exports=function(e){e.goInvisible=function(){return this.sendIq({type:"set",invisible:!0})},e.goVisible=function(){return this.sendIq({type:"set",visible:!0})}}},{"../stanza/visibility":79}],22:[function(e,n){"use strict";{var o=e("jingle");e("../stanza/jingle"),e("../stanza/rtp"),e("../stanza/iceUdp")}n.exports=function(e){var n=e.jingle=new o;n.capabilities.forEach(function(n){e.disco.addFeature(n)});var f=["outgoing","incoming","accepted","terminated","ringing","mute","unmute","hold","resumed"];f.forEach(function(o){n.on(o,function(n,f){e.emit("jingle:"+o,n,f)})}),n.on("localStream",function(n){e.emit("jingle:localstream:added",n)}),n.on("localStreamStopped",function(){e.emit("jingle:localstream:removed")}),n.on("peerStreamAdded",function(n,o){e.emit("jingle:remotestream:added",n,o)}),n.on("peerStreamRemoved",function(n,o){e.emit("jingle:remotestream:removed",n,o)}),n.on("send",function(n){e.sendIq(n)}),e.on("iq:set:jingle",function(e){e=e.toJSON(),n.process(e)}),e.on("unavailable",function(e){var o=e.from.full;n.endPeerSessions(o)}),e.call=function(o){o=o.full||o;var f=n.createMediaSession(o);return e.sendPresence({to:o}),f.start(),f},e.discoverICEServers=function(n){return this.getServices(e.config.server).then(function(n){for(var o=n.services.services,f=[],d=0;d<o.length;d++){var i=o[d],t={};"stun"===i.type?(t.url="stun:"+i.host,i.port&&(t.url+=":"+i.port),f.push(t),e.jingle.addICEServer(t)):"turn"===i.type&&(t.url="turn:"+i.host,i.port&&(t.url+=":"+i.port),i.transport&&"udp"!==i.transport&&(t.url+="?transport="+i.transport),i.username&&(t.username=i.username),i.password&&(t.credential=i.password),f.push(t),e.jingle.addICEServer(t))}return f}).nodeify(n)}}},{"../stanza/iceUdp":53,"../stanza/jingle":55,"../stanza/rtp":68,jingle:179}],23:[function(e,n){"use strict";e("../stanza/json");n.exports=function(e){e.disco.addFeature("urn:xmpp:json:tmp")}},{"../stanza/json":56}],24:[function(e,n){"use strict";function o(e,n){return new f(function(n,o){e.sm.started?(e.once("stream:management:ack",n),e.sm.request()):e.ping().then(n).catch(function(e){e.error&&"timeout"!==e.error.condition?n():o()})}).timeout(1e3*n||15e3)}var f=e("bluebird");n.exports=function(e){e.enableKeepAlive=function(n){function f(){e.sessionStarted&&o(e,n.timeout).catch(function(){e.sendStreamError({condition:"connection-timeout"})})}n=n||{},n.interval=n.interval||300,n.timeout=n.timeout||15,e._keepAliveInterval=setInterval(f,1e3*n.interval)},e.disableKeepAlive=function(){e._keepAliveInterval&&(clearInterval(e._keepAliveInterval),delete e._keepAliveInterval)},e.on("disconnected",function(){e.disableKeepAlive()})}},{bluebird:85}],25:[function(e,n){"use strict";var o=(e("../stanza/mam"),e("../jid"));n.exports=function(e){e.disco.addFeature("urn:xmpp:mam:tmp"),e.getHistory=function(n,f){var d=this,i=this.nextId();n=n||{},n.queryid=i;var t=n.to||"";delete n.to;var u=new o(t||e.jid.bare),l={};l[""]=!0,l[u.full]=!0,l[u.bare]=!0,l[u.domain]=!0,l[e.jid.bare]=!0,l[e.jid.domain]=!0;var p=[];return this.on("mam:"+i,"session",function(e){l[e.from.full]&&p.push(e)}),this.sendIq({type:"get",to:t,id:i,mamQuery:n}).then(function(e){return e.mamQuery.results=p,e}).finally(function(){d.off("mam:"+i)}).nodeify(f)},e.getHistoryPreferences=function(e){return this.sendIq({type:"get",mamPrefs:{}},e)},e.setHistoryPreferences=function(e,n){return this.sendIq({type:"set",mamPrefs:e},n)},e.on("message",function(n){n._extensions.mam&&e.emit("mam:"+n.mam.queryid,n)})}},{"../jid":4,"../stanza/mam":57}],26:[function(e,n){"use strict";var o=e("../jid");e("../stanza/muc"),n.exports=function(e){e.disco.addFeature("http://jabber.org/protocol/muc"),e.disco.addFeature("jabber:x:conference"),e.on("message",function(n){n._extensions.muc?(n._extensions.muc._extensions.invite&&e.emit("muc:invite",{from:n.muc.invite.from,room:n.from,reason:n.muc.invite.reason,password:n.muc.password,thread:n.muc.invite.thread}),n._extensions.muc._extensions.destroyed&&e.emit("muc:destroyed",{room:n.from,newRoom:n.muc.destroyed.jid,reason:n.muc.destroyed.reason,password:n.muc.password}),n._extensions.muc._extensions.decline&&e.emit("muc:declined",{room:n.from,from:n.muc.decline.from,reason:n.muc.decline.reason})):n._extensions.mucInvite&&e.emit("muc:invite",{from:n.from,room:n.mucInvite.jid,reason:n.mucInvite.reason,password:n.mucInvite.password,thread:n.mucInvite.thread}),"groupchat"===n.type&&n.subject&&e.emit("groupchat:subject",n)}),e.on("presence",function(n){n._extensions.muc&&("error"==n.type?e.emit("muc:error",n):"unavailable"==n.type?e.emit("muc:leave",n):e.emit("muc:join",n))}),e.joinRoom=function(e,n,o){o=o||{},o.to=e+"/"+n,o.caps=this.disco.caps,o.joinMuc=o.joinMuc||{},this.sendPresence(o)},e.leaveRoom=function(e,n,o){o=o||{},o.to=e+"/"+n,o.type="unavailable",this.sendPresence(o)},e.ban=function(n,o,f,d){e.setRoomAffiliation(n,o,"outcast",f,d)},e.kick=function(n,o,f,d){e.setRoomRole(n,o,"none",f,d)},e.invite=function(n,o){e.sendMessage({to:n,muc:{invites:o}})},e.directInvite=function(n,o){o.jid=n,e.sendMessage({to:o.to,mucInvite:o})},e.declineInvite=function(n,o,f){e.sendMessage({to:n,muc:{decline:{to:o,reason:f}}})},e.changeNick=function(n,f){e.sendPresence({to:new o(n).bare+"/"+f})},e.setSubject=function(n,o){e.sendMessage({to:n,type:"groupchat",subject:o})},e.discoverReservedNick=function(n,o){e.getDiscoInfo(n,"x-roomuser-item",function(e,n){if(e)return o(e);var f=n.discoInfo.identities[0]||{};o(null,f.name)})},e.requestRoomVoice=function(n){e.sendMessage({to:n,form:{fields:[{name:"FORM_TYPE",value:"http://jabber.org/protocol/muc#request"},{name:"muc#role",type:"text-single",value:"participant"}]}})},e.setRoomAffiliation=function(e,n,o,f,d){return this.sendIq({type:"set",to:e,mucAdmin:{jid:n,affiliation:o,reason:f}},d)},e.setRoomRole=function(e,n,o,f,d){return this.sendIq({type:"set",to:e,mucAdmin:{nick:n,role:o,reason:f}},d)},e.getRoomMembers=function(e,n,o){return this.sendIq({type:"get",to:e,mucAdmin:n},o)},e.getRoomConfig=function(e,n){return this.sendIq({to:e,type:"get",mucOwner:{}},n)},e.configureRoom=function(e,n,o){return n.type||(n.type="submit"),this.sendIq({to:e,type:"set",mucOwner:{form:n}},o)}}},{"../jid":4,"../stanza/muc":59}],27:[function(e,n){"use strict";var o=(e("../stanza/nick"),"http://jabber.org/protocol/nick");n.exports=function(e){e.disco.addFeature(o),e.disco.addFeature(o+"+notify"),e.on("pubsubEvent",function(n){n.event._extensions.updated&&n.event.updated.node===o&&e.emit("nick",{jid:n.from,nick:n.event.updated.published[0].nick})}),e.publishNick=function(e,n){return this.publish("",o,{nick:e},n)}}},{"../stanza/nick":60}],28:[function(e,n){"use strict";e("../stanza/oob");n.exports=function(e){e.disco.addFeature("jabber:x:oob")}},{"../stanza/oob":61}],29:[function(e,n){"use strict";e("../stanza/ping");n.exports=function(e){e.disco.addFeature("urn:xmpp:ping"),e.on("iq:get:ping",function(n){e.sendIq(n.resultReply())}),e.ping=function(e){return this.sendIq({to:e,type:"get",ping:{}})}}},{"../stanza/ping":62}],30:[function(e,n){"use strict";e("../stanza/private");n.exports=function(e){e.getPrivateData=function(e,n){return this.sendIq({type:"get",privateStorage:e},n)},e.setPrivateData=function(e,n){return this.sendIq({type:"set",privateStorage:e},n)}}},{"../stanza/private":64}],31:[function(e,n){"use strict";e("../stanza/pubsub");n.exports=function(e){e.on("message",function(n){n._extensions.event&&e.emit("pubsubEvent",n)}),e.subscribeToNode=function(n,o,f){return this.sendIq({type:"set",to:n,pubsub:{subscribe:{node:o.node,jid:o.jid||e.jid}}},f)},e.unsubscribeFromNode=function(n,o,f){return this.sendIq({type:"set",to:n,pubsub:{unsubscribe:{node:o.node,jid:o.jid||e.jid.split("/")[0]}}},f)},e.publish=function(e,n,o,f){return this.sendIq({type:"set",to:e,pubsub:{publish:{node:n,item:o}}},f)},e.getItem=function(e,n,o,f){return this.sendIq({type:"get",to:e,pubsub:{retrieve:{node:n,item:o}}},f)},e.getItems=function(e,n,o,f){return o=o||{},o.node=n,this.sendIq({type:"get",to:e,pubsub:{retrieve:{node:n,max:o.max},rsm:o.rsm}},f)},e.retract=function(e,n,o,f,d){return this.sendIq({type:"set",to:e,pubsub:{retract:{node:n,notify:f,id:o}}},d)},e.purgeNode=function(e,n,o){return this.sendIq({type:"set",to:e,pubsubOwner:{purge:n}},o)},e.deleteNode=function(e,n,o){return this.sendIq({type:"set",to:e,pubsubOwner:{del:n}},o)},e.createNode=function(e,n,o,f){var d={type:"set",to:e,pubsubOwner:{create:n}};return o&&(d.pubsubOwner.config={form:o}),this.sendIq(d,f)}}},{"../stanza/pubsub":65}],32:[function(e,n){"use strict";n.exports=function(e){e.disco.addFeature("urn:xmpp:receipts"),e.on("message",function(n){var o={normal:!0,chat:!0,headline:!0};o[n.type]&&n.requestReceipt&&!n.receipt&&e.sendMessage({to:n.from,receipt:n.id,id:n.id}),n.receipt&&(e.emit("receipt",n),e.emit("receipt:"+n.receipt))})}},{}],33:[function(e,n){"use strict";e("../stanza/roster");n.exports=function(e){e.on("iq:set:roster",function(n){var o={};
return o[""]=!0,o[e.jid.bare]=!0,o[e.jid.domain]=!0,o[n.from.full]?(e.emit("roster:update",n),void e.sendIq({id:n.id,type:"result"})):e.sendIq(n.errorReply({error:{type:"cancel",condition:"service-unavailable"}}))}),e.getRoster=function(n){var o=this;return n=n||function(){},e.sendIq({type:"get",roster:{ver:o.config.rosterVer}}).then(function(e){var n=e.roster.ver;return n&&(o.config.rosterVer=n,o.emit("roster:ver",n)),e}).nodeify(n)},e.updateRosterItem=function(n,o){return e.sendIq({type:"set",roster:{items:[n]}},o)},e.removeRosterItem=function(n,o){return e.updateRosterItem({jid:n,subscription:"remove"},o)},e.subscribe=function(n){e.sendPresence({type:"subscribe",to:n})},e.unsubscribe=function(n){e.sendPresence({type:"unsubscribe",to:n})},e.acceptSubscription=function(n){e.sendPresence({type:"subscribed",to:n})},e.denySubscription=function(n){e.sendPresence({type:"unsubscribed",to:n})}}},{"../stanza/roster":66}],34:[function(e,n){"use strict";e("../stanza/time");n.exports=function(e){e.disco.addFeature("urn:xmpp:time"),e.getTime=function(e,n){return this.sendIq({to:e,type:"get",time:!0},n)},e.on("iq:get:time",function(n){var o=new Date;e.sendIq(n.resultReply({time:{utc:o,tzo:o.getTimezoneOffset()}}))})}},{"../stanza/time":75}],35:[function(e,n){"use strict";e("../stanza/vcard");n.exports=function(e){e.disco.addFeature("vcard-temp"),e.getVCard=function(e,n){return this.sendIq({to:e,type:"get",vCardTemp:{}},n)},e.publishVCard=function(e,n){return this.sendIq({type:"set",vCardTemp:e},n)}}},{"../stanza/vcard":77}],36:[function(e,n){"use strict";e("../stanza/version"),n.exports=function(e){e.disco.addFeature("jabber:iq:version"),e.on("iq:get:version",function(n){e.sendIq(n.resultReply({version:e.config.version||{name:"stanza.io"}}))}),e.getSoftwareVersion=function(e,n){return this.sendIq({to:e,type:"get",version:{}},n)}}},{"../stanza/version":78}],37:[function(e,n){"use strict";function o(e,n){return(e%n+n)%n}function f(){this.conn=null,this.id=!1,this.allowResume=!0,this.started=!1,this.lastAck=0,this.handled=0,this.windowSize=1,this.unacked=[],this.pendingAck=!1}var d=e("./stanza/sm"),i=Math.pow(2,32);f.prototype={constructor:{value:f},enable:function(e){this.conn=e;var n=new d.Enable;n.resume=this.allowResume,this.conn.send(n),this.handled=0,this.started=!0},resume:function(e){this.conn=e;var n=new d.Resume({h:this.handled,previd:this.id});this.conn.send(n),this.started=!0},enabled:function(e){this.id=e.id},resumed:function(e){this.id=e.id,e.h&&this.process(e,!0)},failed:function(){this.started=!1,this.id=!1,this.lastAck=0,this.handled=0,this.unacked=[]},ack:function(){this.conn.send(new d.Ack({h:this.handled}))},request:function(){this.pendingAck=!0,this.conn.send(new d.Request)},process:function(e,n){var f=this,d=o(e.h-this.lastAck,i);this.pendingAck=!1;for(var t=0;d>t&&this.unacked.length>0;t++)this.conn.emit("stanza:acked",this.unacked.shift());if(this.lastAck=e.h,n){var u=this.unacked;this.unacked=[],u.forEach(function(e){f.conn.send(e)})}this.needAck()&&this.request()},track:function(e){var n=e._name,o={message:!0,presence:!0,iq:!0};this.started&&o[n]&&(this.unacked.push(e),this.needAck()&&this.request())},handle:function(){this.started&&(this.handled=o(this.handled+1,i))},needAck:function(){return!this.pendingAck&&this.unacked.length>=this.windowSize}},n.exports=f},{"./stanza/sm":71}],38:[function(e,n){"use strict";var o=e("underscore"),f=e("jxt"),d=e("./pubsub").Item,i=e("./pubsub").EventItem,t=n.exports=f.define({name:"avatar",namespace:"urn:xmpp:avatar:metadata",element:"info",fields:{id:f.attribute("id"),bytes:f.attribute("bytes"),height:f.attribute("height"),width:f.attribute("width"),type:f.attribute("type","image/png"),url:f.attribute("url")}}),u={get:function(){var e=f.find(this.xml,"urn:xmpp:avatar:metadata","metadata"),n=[];if(e.length){var d=f.find(e[0],"urn:xmpp:avatar:metadata","info");o.forEach(d,function(e){n.push(new t({},e))})}return n},set:function(e){var n=f.findOrCreate(this.xml,"urn:xmpp:avatar:metadata","metadata");f.setAttribute(n,"xmlns","urn:xmpp:avatar:metadata"),o.forEach(e,function(e){var o=new t(e);n.appendChild(o.xml)})}};f.add(d,"avatars",u),f.add(i,"avatars",u),f.add(d,"avatarData",f.subText("urn:xmpp:avatar:data","data")),f.add(i,"avatarData",f.subText("urn:xmpp:avatar:data","data"))},{"./pubsub":65,jxt:198,underscore:222}],39:[function(e,n){var o=e("jxt"),f=e("./iq"),d=e("./streamFeatures"),i=e("./util"),t="urn:ietf:params:xml:ns:xmpp-bind",u=n.exports=o.define({name:"bind",namespace:t,element:"bind",fields:{resource:o.subText(t,"resource"),jid:i.jidSub(t,"jid")}});o.extend(f,u),o.extend(d,u)},{"./iq":54,"./streamFeatures":74,"./util":76,jxt:198}],40:[function(e,n){var o=e("jxt"),f=e("./util"),d=e("./private"),i=o.define({name:"conference",namespace:"storage:bookmarks",element:"conference",fields:{name:o.attribute("name"),autoJoin:o.boolAttribute("autojoin"),jid:f.jidAttribute("jid"),nick:o.subText("storage:bookmarks","nick")}}),t=n.exports=o.define({name:"bookmarks",namespace:"storage:bookmarks",element:"storage"});o.extend(d,t),o.extend(t,i,"conferences")},{"./private":64,"./util":76,jxt:198}],41:[function(e,n){"use strict";var o=e("jxt"),f=e("./util"),d="http://jabber.org/protocol/httpbind",i="urn:xmpp:xbosh";n.exports=o.define({name:"bosh",namespace:d,element:"body",prefixes:{xmpp:i},fields:{accept:o.attribute("accept"),ack:o.numberAttribute("ack"),authid:o.attribute("authid"),charsets:o.attribute("charsets"),condition:o.attribute("condition"),content:o.attribute("content"),from:f.jidAttribute("from"),hold:o.numberAttribute("hold"),inactivity:o.numberAttribute("inactivity"),key:o.attribute("key"),maxpause:o.numberAttribute("maxpause"),newKey:o.attribute("newkey"),pause:o.numberAttribute("pause"),polling:o.numberAttribute("polling"),resport:o.numberAttribute("report"),requests:o.numberAttribute("requests"),rid:o.numberAttribute("rid"),sid:o.attribute("sid"),stream:o.attribute("stream"),time:o.attribute("time"),to:f.jidAttribute("to"),type:o.attribute("type"),ver:o.attribute("ver"),wait:o.numberAttribute("wait"),uri:o.subText(d,"uri"),lang:o.langAttribute(),version:o.attribute("xmpp:version","1.0"),restart:o.attribute("xmpp:restart"),restartLogic:o.boolAttribute("xmpp:restartLogic"),payload:{get:function(){for(var e=[],n=0,f=this.xml.childNodes.length;f>n;n++){var d=o.build(this.xml.childNodes[n]);void 0!==d&&e.push(d)}return e},set:function(e){var n=this;e.forEach(function(e){n.xml.appendChild(e.xml)})}}}})},{"./util":76,jxt:198}],42:[function(e,n){var o=e("jxt"),f=e("./presence"),d=e("./streamFeatures"),i=n.exports=o.define({name:"caps",namespace:"http://jabber.org/protocol/caps",element:"c",fields:{ver:o.attribute("ver"),node:o.attribute("node"),hash:o.attribute("hash"),ext:o.attribute("ext")}});o.extend(f,i),o.extend(d,i)},{"./presence":63,"./streamFeatures":74,jxt:198}],43:[function(e,n,o){var f=e("jxt"),d=e("./message"),i=e("./iq"),t=e("./forwarded");o.Sent=f.define({name:"carbonSent",eventName:"carbon:sent",namespace:"urn:xmpp:carbons:2",element:"sent"}),o.Received=f.define({name:"carbonReceived",eventName:"carbon:received",namespace:"urn:xmpp:carbons:2",element:"received"}),o.Private=f.define({name:"carbonPrivate",eventName:"carbon:private",namespace:"urn:xmpp:carbons:2",element:"private"}),o.Enable=f.define({name:"enableCarbons",namespace:"urn:xmpp:carbons:2",element:"enable"}),o.Disable=f.define({name:"disableCarbons",namespace:"urn:xmpp:carbons:2",element:"disable"}),f.extend(o.Sent,t),f.extend(o.Received,t),f.extend(d,o.Sent),f.extend(d,o.Received),f.extend(d,o.Private),f.extend(i,o.Enable),f.extend(i,o.Disable)},{"./forwarded":51,"./iq":54,"./message":58,jxt:198}],44:[function(e){"use strict";var n=e("jxt"),o=e("./message"),f="http://jabber.org/protocol/chatstates",d=n.define({name:"chatStateActive",eventName:"chat:active",namespace:f,element:"active"}),i=n.define({name:"chatStateComposing",eventName:"chat:composing",namespace:f,element:"composing"}),t=n.define({name:"chatStatePaused",eventName:"chat:paused",namespace:f,element:"paused"}),u=n.define({name:"chatStateInactive",eventName:"chat:inactive",namespace:f,element:"inactive"}),l=n.define({name:"chatStateGone",eventName:"chat:gone",namespace:f,element:"gone"});n.extend(o,d),n.extend(o,i),n.extend(o,t),n.extend(o,u),n.extend(o,l),n.add(o,"chatState",{get:function(){for(var e=this,n=["Active","Composing","Paused","Inactive","Gone"],o=0;o<n.length;o++)if(e._extensions["chatState"+n[o]])return n[o].toLowerCase();return""},set:function(e){var n=this,o=["Active","Composing","Paused","Inactive","Gone"];o.forEach(function(e){n._extensions["chatState"+e]&&(n.xml.removeChild(n._extensions["chatState"+e].xml),delete n._extensions["chatState"+e])}),e&&this["chatState"+e.charAt(0).toUpperCase()+e.slice(1)]}})},{"./message":58,jxt:198}],45:[function(e,n){"use strict";var o=e("jxt"),f=e("./dataforms").DataForm,d=e("./error"),i=e("./iq"),t="http://jabber.org/protocol/commands",u=["next","prev","complete","cancel"],l=["bad-action","bad-locale","bad-payload","bad-sessionid","malformed-action","session-expired"],p=n.exports=o.define({name:"command",namespace:t,element:"command",fields:{action:o.attribute("action"),node:o.attribute("node"),sessionid:o.attribute("sessionid"),status:o.attribute("status"),noteType:o.subAttribute(t,"note","type"),note:o.subText(t,"note"),execute:o.subAttribute(t,"actions","execute"),actions:{get:function(){var e=[],n=o.find(this.xml,t,"actions");return n.length?(u.forEach(function(f){var d=o.find(n[0],t,f);d.length&&e.push(f)}),e):[]},set:function(e){for(var n=o.findOrCreate(this.xml,t,"actions"),f=0,d=n.childNodes.length;d>f;f++)n.removeChild(n.childNodes[f]);e.forEach(function(e){n.appendChild(o.createElement(t,e.toLowerCase(),t))})}}}});o.add(d,"adhocCommandCondition",{get:function(){var e=this,n=[];return l.forEach(function(f){var d=o.find(e.xml,t,f);d.length&&n.push(d[0].tagName)}),n[0]||""},set:function(e){var n=this;if(l.forEach(function(e){var f=o.find(n.xml,t,e);f.length&&n.xml.removeChild(f[0])}),e){var f=o.createElement(t,e);this.xml.appendChild(f)}}}),o.extend(i,p),o.extend(p,f)},{"./dataforms":46,"./error":49,"./iq":54,jxt:198}],46:[function(e,n,o){"use strict";var f=(e("underscore"),e("jxt")),d=(e("./util"),e("./message"));o.DataForm=f.define({name:"form",namespace:"jabber:x:data",element:"x",fields:{title:f.subText("jabber:x:data","title"),instructions:f.multiSubText("jabber:x:data","instructions"),type:f.attribute("type","form")}}),o.Field=f.define({name:"_field",namespace:"jabber:x:data",element:"field",init:function(e){this._type=(e||{}).type||this.type},fields:{type:{get:function(){return f.getAttribute(this.xml,"type","text-single")},set:function(e){this._type=e,f.setAttribute(this.xml,"type",e)}},name:f.attribute("var"),desc:f.subText("desc"),required:f.boolSub("jabber:x:data","required"),label:f.attribute("label"),value:{get:function(){var e=f.getMultiSubText(this.xml,this._NS,"value");return"boolean"===this._type?"1"===e[0]||"true"===e[0]:e.length>1?"text-multi"===this._type?e.join("\n"):e:e[0]},set:function(e){"boolean"===this._type?f.setSubText(this.xml,this._NS,"value",e?"1":"0"):("text-multi"===this._type&&(e=e.split("\n")),f.setMultiSubText(this.xml,this._NS,"value",e))}},options:{get:function(){var e=this;return f.getMultiSubText(this.xml,this._NS,"option",function(n){return f.getSubText(n,e._NS,"value")})},set:function(e){var n=this;f.setMultiSubText(this.xml,this._NS,"option",e,function(e){var o=f.createElement(n._NS,"option",n._NS),d=f.createElement(n._NS,"value",n._NS);o.appendChild(d),d.textContent=e,n.xml.appendChild(o)})}}}}),f.extend(d,o.DataForm),f.extend(o.DataForm,o.Field,"fields")},{"./message":58,"./util":76,jxt:198,underscore:222}],47:[function(e,n){var o=e("jxt"),f=e("./message"),d=e("./presence"),i=e("./util"),t=n.exports=o.define({name:"delay",namespace:"urn:xmpp:delay",element:"delay",fields:{from:i.jidAttribute("from"),stamp:o.dateAttribute("stamp"),reason:o.text()}});o.extend(f,t),o.extend(d,t)},{"./message":58,"./presence":63,"./util":76,jxt:198}],48:[function(e,n,o){"use strict";var f=(e("underscore"),e("jxt")),d=e("../jid"),i=e("./iq"),t=e("./rsm"),u=e("./dataforms").DataForm;o.DiscoInfo=f.define({name:"discoInfo",namespace:"http://jabber.org/protocol/disco#info",element:"query",fields:{node:f.attribute("node"),identities:{get:function(){var e=[],n=f.find(this.xml,this._NS,"identity");return n.forEach(function(n){e.push({category:f.getAttribute(n,"category"),type:f.getAttribute(n,"type"),lang:n.getAttributeNS(f.XML_NS,"lang"),name:f.getAttribute(n,"name")})}),e},set:function(e){var n=this,o=f.find(this.xml,this._NS,"identity");o.forEach(function(e){n.xml.removeChild(e)}),e.forEach(function(e){var o=f.createElement(n._NS,"identity",n._NS);f.setAttribute(o,"category",e.category),f.setAttribute(o,"type",e.type),f.setAttribute(o,"name",e.name),e.lang&&o.setAttributeNS(f.XML_NS,"lang",e.lang),n.xml.appendChild(o)})}},features:{get:function(){var e=[],n=f.find(this.xml,this._NS,"feature");return n.forEach(function(n){e.push(n.getAttribute("var"))}),e},set:function(e){var n=this,o=f.find(this.xml,this._NS,"feature");o.forEach(function(e){n.xml.removeChild(e)}),e.forEach(function(e){var o=f.createElement(n._NS,"feature",n._NS);o.setAttribute("var",e),n.xml.appendChild(o)})}}}}),o.DiscoItems=f.define({name:"discoItems",namespace:"http://jabber.org/protocol/disco#items",element:"query",fields:{node:f.attribute("node"),items:{get:function(){var e=[],n=f.find(this.xml,this._NS,"item");return n.forEach(function(n){e.push({jid:new d(f.getAttribute(n,"jid")),node:f.getAttribute(n,"node"),name:f.getAttribute(n,"name")})}),e},set:function(e){var n=this,o=f.find(this.xml,this._NS,"item");o.forEach(function(e){n.xml.removeChild(e)}),e.forEach(function(e){var o=f.createElement(n._NS,"item",n._NS);e.jid&&f.setAttribute(o,"jid",e.jid.toString()),f.setAttribute(o,"node",e.node),f.setAttribute(o,"name",e.name),n.xml.appendChild(o)})}}}}),f.extend(i,o.DiscoInfo),f.extend(i,o.DiscoItems),f.extend(o.DiscoItems,t),f.extend(o.DiscoInfo,u,"extensions")},{"../jid":4,"./dataforms":46,"./iq":54,"./rsm":67,jxt:198,underscore:222}],49:[function(e,n){"use strict";var o=(e("underscore"),e("jxt")),f=e("./util"),d=e("./message"),i=e("./presence"),t=e("./iq"),u="urn:ietf:params:xml:ns:xmpp-stanzas",l=["bad-request","conflict","feature-not-implemented","forbidden","gone","internal-server-error","item-not-found","jid-malformed","not-acceptable","not-allowed","not-authorized","payment-required","recipient-unavailable","redirect","registration-required","remote-server-not-found","remote-server-timeout","resource-constraint","service-unavailable","subscription-required","undefined-condition","unexpected-request"],p=n.exports=o.define({name:"error",namespace:"jabber:client",element:"error",fields:{lang:{get:function(){return(this.parent||{}).lang||""}},condition:{get:function(){var e=this,n=[];return l.forEach(function(f){var d=o.find(e.xml,u,f);d.length&&n.push(d[0].tagName)}),n[0]||""},set:function(e){var n=this;if(l.forEach(function(e){var f=o.find(n.xml,u,e);f.length&&n.xml.removeChild(f[0])}),e){var f=o.createElement(u,e);this.xml.appendChild(f)}}},gone:{get:function(){return o.getSubText(this.xml,u,"gone")},set:function(e){this.condition="gone",o.setSubText(this.xml,u,"gone",e)}},redirect:{get:function(){return o.getSubText(this.xml,u,"redirect")},set:function(e){this.condition="redirect",o.setSubText(this.xml,u,"redirect",e)}},code:o.attribute("code"),type:o.attribute("type"),by:f.jidAttribute("by"),$text:{get:function(){return o.getSubLangText(this.xml,u,"text",this.lang)}},text:{get:function(){var e=this.$text;return e[this.lang]||""},set:function(e){o.setSubLangText(this.xml,u,"text",e,this.lang)}}}});o.extend(d,p),o.extend(i,p),o.extend(t,p)},{"./iq":54,"./message":58,"./presence":63,"./util":76,jxt:198,underscore:222}],50:[function(e,n,o){var f=e("jxt"),d=e("./iq"),i=e("./dataforms").DataForm,t="urn:xmpp:extdisco:1",u=o.Services=f.define({name:"services",namespace:t,element:"services",fields:{type:f.attribute("type")}}),l=o.Credentials=f.define({name:"credentials",namespace:t,element:"credentials"}),p=f.define({name:"service",namespace:t,element:"service",fields:{host:f.attribute("host"),port:f.attribute("port"),transport:f.attribute("transport"),type:f.attribute("type"),username:f.attribute("username"),password:f.attribute("password")}});f.extend(u,p,"services"),f.extend(l,p),f.extend(p,i),f.extend(d,u),f.extend(d,l)},{"./dataforms":46,"./iq":54,jxt:198}],51:[function(e,n){var o=e("jxt"),f=e("./message"),d=e("./presence"),i=e("./iq"),t=e("./delayed"),u=n.exports=o.define({name:"forwarded",eventName:"forward",namespace:"urn:xmpp:forward:0",element:"forwarded"});o.extend(f,u),o.extend(u,f),o.extend(u,d),o.extend(u,i),o.extend(u,t)},{"./delayed":47,"./iq":54,"./message":58,"./presence":63,jxt:198}],52:[function(e,n){"use strict";var o=e("jxt"),f=e("./pubsub").Item,d=e("./pubsub").EventItem,i="http://jabber.org/protocol/geoloc",t=n.exports=o.define({name:"geoloc",namespace:i,element:"geoloc",fields:{accuracy:o.numberSub(i,"accuracy",!0),altitude:o.numberSub(i,"alt",!0),area:o.subText(i,"area"),heading:o.numberSub(i,"bearing",!0),bearing:o.numberSub(i,"bearing",!0),building:o.subText(i,"building"),country:o.subText(i,"country"),countrycode:o.subText(i,"countrycode"),datum:o.subText(i,"datum"),description:o.subText(i,"description"),error:o.numberSub(i,"error",!0),floor:o.subText(i,"floor"),latitude:o.numberSub(i,"lat",!0),locality:o.subText(i,"locality"),longitude:o.numberSub(i,"lon",!0),postalcode:o.subText(i,"postalcode"),region:o.subText(i,"region"),room:o.subText(i,"room"),speed:o.numberSub(i,"speed",!0),street:o.subText(i,"street"),text:o.subText(i,"text"),timestamp:o.dateSub(i,"timestamp"),uri:o.subText(i,"uri")}});o.extend(f,t),o.extend(d,t)},{"./pubsub":65,jxt:198}],53:[function(e,n,o){var f=(e("underscore"),e("jxt")),d=(e("./util"),e("./jingle")),i="urn:xmpp:jingle:transports:ice-udp:1";o.ICEUDP=f.define({name:"_iceUdp",namespace:i,element:"transport",fields:{transType:{value:"iceUdp"},pwd:f.attribute("pwd"),ufrag:f.attribute("ufrag")}}),o.RemoteCandidate=f.define({name:"remoteCandidate",namespace:i,element:"remote-candidate",fields:{component:f.attribute("component"),ip:f.attribute("ip"),port:f.attribute("port")}}),o.Candidate=f.define({name:"_iceUdpCandidate",namespace:i,element:"candidate",fields:{component:f.attribute("component"),foundation:f.attribute("foundation"),generation:f.attribute("generation"),id:f.attribute("id"),ip:f.attribute("ip"),network:f.attribute("network"),port:f.attribute("port"),priority:f.attribute("priority"),protocol:f.attribute("protocol"),relAddr:f.attribute("rel-addr"),relPort:f.attribute("rel-port"),type:f.attribute("type")}}),o.Fingerprint=f.define({name:"_iceFingerprint",namespace:"urn:xmpp:tmp:jingle:apps:dtls:0",element:"fingerprint",fields:{hash:f.attribute("hash"),value:f.text(),required:f.boolAttribute("required")}}),f.extend(d.Content,o.ICEUDP),f.extend(o.ICEUDP,o.Candidate,"candidates"),f.extend(o.ICEUDP,o.RemoteCandidate),f.extend(o.ICEUDP,o.Fingerprint,"fingerprints")},{"./jingle":55,"./util":76,jxt:198,underscore:222}],54:[function(e,n){"use strict";var o=e("jxt"),f=e("./util"),d=n.exports=o.define({name:"iq",namespace:"jabber:client",element:"iq",topLevel:!0,fields:{lang:o.langAttribute(),id:o.attribute("id"),to:f.jidAttribute("to"),from:f.jidAttribute("from"),type:o.attribute("type")}});d.prototype.resultReply=function(e){return e.to=this.from,e.id=this.id,e.type="result",new d(e)},d.prototype.errorReply=function(e){return e.to=this.from,e.id=this.id,e.type="error",new d(e)}},{"./util":76,jxt:198}],55:[function(e,n,o){"use strict";var f=(e("underscore"),e("jxt")),d=(e("./util"),e("./iq")),i=e("./error"),t="urn:xmpp:jingle:1",u="urn:xmpp:jingle:errors:1",l=["out-of-order","tie-break","unknown-session","unsupported-info"],p=["alternative-session","busy","cancel","connectivity-error","decline","expired","failed-application","failed-transport","general-error","gone","incompatible-parameters","media-error","security-error","success","timeout","unsupported-applications","unsupported-transports"];o.Jingle=f.define({name:"jingle",namespace:t,element:"jingle",fields:{action:f.attribute("action"),initiator:f.attribute("initiator"),responder:f.attribute("responder"),sid:f.attribute("sid")}}),o.Content=f.define({name:"_jingleContent",namespace:t,element:"content",fields:{creator:f.attribute("creator"),disposition:f.attribute("disposition","session"),name:f.attribute("name"),senders:f.attribute("senders","both"),description:{get:function(){for(var e=["_rtp"],n=0;n<e.length;n++)if(this._extensions[e[n]])return this._extensions[e[n]]},set:function(e){var n="_"+e.descType;this[n]=e}},transport:{get:function(){for(var e=["_iceUdp"],n=0;n<e.length;n++)if(this._extensions[e[n]])return this._extensions[e[n]]},set:function(e){var n="_"+e.transType;this[n]=e}}}}),o.Reason=f.define({name:"reason",namespace:t,element:"reason",fields:{condition:{get:function(){var e=this,n=[];return p.forEach(function(o){var d=f.find(e.xml,t,o);d.length&&n.push(d[0].tagName)}),n[0]||""},set:function(e){var n=this;if(p.forEach(function(e){var o=f.find(n.xml,t,e);o.length&&n.xml.removeChild(o[0])}),e){var o=f.createElement(t,e,t);this.xml.appendChild(o)}}},alternativeSession:{get:function(){return f.getSubText(this.xml,t,"alternative-session")},set:function(e){this.condition="alternative-session",f.setSubText(this.xml,t,"alternative-session",e)}},text:f.subText(t,"text")}}),f.add(i,"jingleCondition",{get:function(){var e=this,n=[];return l.forEach(function(o){var d=f.find(e.xml,u,o);d.length&&n.push(d[0].tagName)}),n[0]||""},set:function(e){var n=this;if(l.forEach(function(e){var o=f.find(n.xml,u,e);o.length&&n.xml.removeChild(o[0])}),e){var o=f.createElement(u,e);this.xml.appendChild(o)}}}),f.extend(d,o.Jingle),f.extend(o.Jingle,o.Content,"contents"),f.extend(o.Jingle,o.Reason)},{"./error":49,"./iq":54,"./util":76,jxt:198,underscore:222}],56:[function(e,n){"use strict";var o=e("jxt"),f=e("./message"),d=e("./pubsub").Item,i=e("./pubsub").EventItem,t=n.exports={get:function(){var e=o.getSubText(this.xml,"urn:xmpp:json:0","json");return e?JSON.parse(e):void 0},set:function(e){e=JSON.stringify(e),e&&o.setSubText(this.xml,"urn:xmpp:json:0","json",e)}};o.add(f,"json",t),o.add(d,"json",t),o.add(i,"json",t)},{"./message":58,"./pubsub":65,jxt:198}],57:[function(e,n,o){"use strict";var f=e("jxt"),d=e("./util"),i=e("./message"),t=e("./iq"),u=e("./forwarded"),l=e("./rsm"),p=e("../jid");o.MAMQuery=f.define({name:"mamQuery",namespace:"urn:xmpp:mam:tmp",element:"query",fields:{queryid:f.attribute("queryid"),start:f.dateSub("urn:xmpp:mam:tmp","start"),end:f.dateSub("urn:xmpp:mam:tmp","end"),"with":d.jidSub("urn:xmpp:mam:tmp","with")}}),o.Result=f.define({name:"mam",eventName:"mam:result",namespace:"urn:xmpp:mam:tmp",element:"result",fields:{queryid:f.attribute("queryid"),id:f.attribute("id")}}),o.Archived=f.define({name:"mamArchived",namespace:"urn:xmpp:mam:tmp",element:"archived",fields:{by:d.jidAttribute("by"),id:f.attribute("id")}}),o.Prefs=f.define({name:"mamPrefs",namespace:"urn:xmpp:mam:tmp",element:"prefs",fields:{defaultCondition:f.attribute("default"),always:{get:function(){var e=[],n=f.find(this.xml,this._NS,"always");if(0===n.length)return e;n=n[0];var o=f.getMultiSubText(n,this._NS,"jid");return o.forEach(function(n){e.push(new p(n.textContent))}),e},set:function(e){if(e.length>0){var n=f.find(this.xml,this._NS,"always");f.setMultiSubText(n,this._NS,"jid",e)}}},never:{get:function(){var e=[],n=f.find(this.xml,this._NS,"always");if(0===n.length)return e;n=n[0];var o=f.getMultiSubText(n,this._NS,"jid");return o.forEach(function(n){e.push(new p(n.textContent))}),e},set:function(e){if(e.length>0){var n=f.find(this.xml,this._NS,"never");f.setMultiSubText(n,this._NS,"jid",e)}}}}}),f.extend(i,o.Archived,"archived"),f.extend(t,o.MAMQuery),f.extend(t,o.Prefs),f.extend(i,o.Result),f.extend(o.Result,u),f.extend(o.MAMQuery,l)},{"../jid":4,"./forwarded":51,"./iq":54,"./message":58,"./rsm":67,"./util":76,jxt:198}],58:[function(e,n){"use strict";var o=(e("underscore"),e("jxt")),f=e("./util");n.exports=o.define({name:"message",namespace:"jabber:client",element:"message",topLevel:!0,fields:{lang:o.langAttribute(),id:o.attribute("id"),to:f.jidAttribute("to"),from:f.jidAttribute("from"),type:o.attribute("type","normal"),thread:o.subText("jabber:client","thread"),parentThread:o.subAttribute("jabber:client","thread","parent"),subject:o.subText("jabber:client","subject"),$body:{get:function(){return o.getSubLangText(this.xml,this._NS,"body",this.lang)}},body:{get:function(){var e=this.$body;return e[this.lang]||""},set:function(e){o.setSubLangText(this.xml,this._NS,"body",e,this.lang)}},attention:o.boolSub("urn:xmpp:attention:0","attention"),replace:o.subAttribute("urn:xmpp:message-correct:0","replace","id"),requestReceipt:o.boolSub("urn:xmpp:receipts","request"),receipt:o.subAttribute("urn:xmpp:receipts","received","id")}})},{"./util":76,jxt:198,underscore:222}],59:[function(e,n,o){"use strict";var f=e("jxt"),d=e("./message"),i=e("./presence"),t=e("./iq"),u=e("./dataforms").DataForm,l=e("./util"),p="http://jabber.org/protocol/muc",P=p+"#user",c=p+"#admin",s=p+"#owner",y=function(e,n){return{get:function(){return this._extensions[e]?this[e][n]:void 0},set:function(o){this[e][n]=o}}},w=f.define({name:"_mucUserItem",namespace:P,element:"item",fields:{affiliation:f.attribute("affiliation"),nick:f.attribute("nick"),jid:l.jidAttribute("jid"),role:f.attribute("role"),reason:f.subText(P,"reason")}}),a=f.define({name:"_mucUserActor",namespace:P,element:"actor",fields:{nick:f.attribute("nick"),jid:l.jidAttribute("jid")}}),b=f.define({name:"destroyed",namespace:P,element:"destroy",fields:{jid:l.jidAttribute("jid"),reason:f.subText(P,"reason")}}),r=f.define({name:"invite",namespace:P,element:"invite",fields:{to:l.jidAttribute("to"),from:l.jidAttribute("from"),reason:f.subText(P,"reason"),thread:f.subAttribute(P,"continue","thread"),"continue":f.boolSub(P,"continue")}}),M=f.define({name:"decline",namespace:P,element:"decline",fields:{to:l.jidAttribute("to"),from:l.jidAttribute("from"),reason:f.subText(P,"reason")}}),X=f.define({name:"_mucAdminItem",namespace:c,element:"item",fields:{affiliation:f.attribute("affiliation"),nick:f.attribute("nick"),jid:l.jidAttribute("jid"),role:f.attribute("role"),reason:f.subText(c,"reason")}}),g=f.define({name:"actor",namespace:P,element:"actor",fields:{nick:f.attribute("nick"),jid:l.jidAttribute("jid")}}),m=f.define({name:"destroy",namespace:s,element:"destroy",fields:{jid:l.jidAttribute("jid"),password:f.subText(s,"password"),reason:f.subText(s,"reason")}});o.MUC=f.define({name:"muc",namespace:P,element:"x",fields:{affiliation:y("_mucUserItem","affiliation"),nick:y("_mucUserItem","nick"),jid:y("_mucUserItem","jid"),role:y("_mucUserItem","role"),actor:y("_mucUserItem","_mucUserActor"),reason:y("_mucUserItem","reason"),password:f.subText(P,"password"),codes:{get:function(){return f.getMultiSubText(this.xml,P,"status",function(e){return f.getAttribute(e,"code")})},set:function(e){var n=this;f.setMultiSubText(this.xml,P,"status",e,function(e){var o=f.createElement(P,"status",P);f.setAttribute(o,"code",e),n.xml.appendChild(o)})}}}}),o.MUCAdmin=f.define({name:"mucAdmin",namespace:c,element:"query",fields:{affiliation:y("_mucAdminItem","affiliation"),nick:y("_mucAdminItem","nick"),jid:y("_mucAdminItem","jid"),role:y("_mucAdminItem","role"),actor:y("_mucAdminItem","_mucAdminActor"),reason:y("_mucAdminItem","reason")}}),o.MUCOwner=f.define({name:"mucOwner",namespace:s,element:"query"}),o.MUCJoin=f.define({name:"joinMuc",namespace:p,element:"x",fields:{password:f.subText(p,"password"),history:{get:function(){var e={},n=f.find(this.xml,this._NS,"history");if(!n.length)return{};n=n[0];var o=n.getAttribute("maxchars")||"",d=n.getAttribute("maxstanas")||"",i=n.getAttribute("seconds")||"",t=n.getAttribute("since")||"";o&&(e.maxchars=parseInt(o,10)),d&&(e.maxstanzas=parseInt(d,10)),i&&(e.seconds=parseInt(i,10)),t&&(e.since=new Date(t))},set:function(e){var n=f.find(this.xml,this._NS,"history");if(n.length)for(var o=0;o<n.length;o++)this.xml.removeChild(n[o]);var d=f.createElement(this._NS,"history",this._NS);this.xml.appendChild(d),e.maxchars&&d.setAttribute(""+e.maxchars),e.maxstanzas&&d.setAttribute(""+e.maxstanzas),e.seconds&&d.setAttribute(""+e.seconds),e.since&&d.setAttribute(e.since.toISOString())}}}}),o.DirectInvite=f.define({name:"mucInvite",namespace:"jabber:x:conference",element:"x",fields:{jid:l.jidAttribute("jid"),password:f.attribute("password"),reason:f.attribute("reason"),thread:f.attribute("thread"),"continue":f.boolAttribute("continue")}}),f.extend(w,a),f.extend(o.MUC,w),f.extend(o.MUC,r,"invites"),f.extend(o.MUC,M),f.extend(o.MUC,b),f.extend(X,g),f.extend(o.MUCAdmin,X,"items"),f.extend(o.MUCOwner,m),f.extend(o.MUCOwner,u),f.extend(i,o.MUC),f.extend(d,o.MUC),f.extend(i,o.MUCJoin),f.extend(d,o.DirectInvite),f.extend(t,o.MUCAdmin),f.extend(t,o.MUCOwner)},{"./dataforms":46,"./iq":54,"./message":58,"./presence":63,"./util":76,jxt:198}],60:[function(e){"use strict";var n=e("jxt"),o=e("./pubsub").Item,f=e("./pubsub").EventItem,d=e("./presence"),i=e("./message"),t=n.subText("http://jabber.org/protocol/nick","nick");n.add(o,"nick",t),n.add(f,"nick",t),n.add(d,"nick",t),n.add(i,"nick",t)},{"./message":58,"./presence":63,"./pubsub":65,jxt:198}],61:[function(e,n){"use strict";var o=e("jxt"),f=e("./message"),d="jabber:x:oob",i=n.exports=o.define({name:"oob",element:"x",namespace:d,fields:{url:o.subText(d,"url"),desc:o.subText(d,"desc")}});o.extend(f,i,"oobURIs")},{"./message":58,jxt:198}],62:[function(e,n){var o=e("jxt"),f=e("./iq"),d="urn:xmpp:ping",i=n.exports=o.define({name:"ping",namespace:d,element:"ping",fields:{}});o.extend(f,i)},{"./iq":54,jxt:198}],63:[function(e,n){"use strict";var o=(e("underscore"),e("jxt")),f=e("./util");n.exports=o.define({name:"presence",namespace:"jabber:client",element:"presence",topLevel:!0,fields:{lang:o.langAttribute(),id:o.attribute("id"),to:f.jidAttribute("to"),from:f.jidAttribute("from"),priority:o.numberSub("jabber:client","priority"),show:o.subText("jabber:client","show"),type:{get:function(){return o.getAttribute(this.xml,"type","available")},set:function(e){"available"===e&&(e=!1),o.setAttribute(this.xml,"type",e)}},$status:{get:function(){return o.getSubLangText(this.xml,this._NS,"status",this.lang)}},status:{get:function(){var e=this.$status;return e[this.lang]||""},set:function(e){o.setSubLangText(this.xml,this._NS,"status",e,this.lang)}},idleSince:o.dateSubAttribute("urn:xmpp:idle:1","idle","since"),decloak:o.subAttribute("urn:xmpp:decloak:0","decloak","reason"),avatarId:{get:function(){var e="vcard-temp:x:update",n=o.find(this.xml,e,"x");return n.length?o.getSubText(n[0],e,"photo"):""},set:function(e){var n="vcard-temp:x:update",f=o.findOrCreate(this.xml,n,"x");if(""===e)o.setBoolSub(f,n,"photo",!0);else{if(e===!0)return;e?o.setSubText(f,n,"photo",e):this.xml.removeChild(f)}}}}})},{"./util":76,jxt:198,underscore:222}],64:[function(e,n){var o=e("jxt"),f=e("./iq"),d=n.exports=o.define({name:"privateStorage",namespace:"jabber:iq:private",element:"query"});o.extend(f,d)},{"./iq":54,jxt:198}],65:[function(e,n,o){"use strict";var f=e("underscore"),d=e("jxt"),i=e("./util"),t=e("./iq"),u=e("./message"),l=e("./dataforms").DataForm,p=e("./rsm"),P=(e("../jid"),"http://jabber.org/protocol/pubsub"),c="http://jabber.org/protocol/pubsub#owner",s="http://jabber.org/protocol/pubsub#event";o.Pubsub=d.define({name:"pubsub",namespace:"http://jabber.org/protocol/pubsub",element:"pubsub",fields:{publishOptions:{get:function(){var e=d.find(this.xml,this._NS,"publish-options");return e.length&&e[0].childNodes.length?new l({},e[0].childNodes[0]):void 0},set:function(e){var n=d.findOrCreate(this.xml,this._NS,"publish-options");if(e){var o=new l(e);n.appendChild(o.xml)}}}}}),o.PubsubOwner=d.define({name:"pubsubOwner",namespace:c,element:"pubsub",fields:{create:d.subAttribute(c,"create","node"),purge:d.subAttribute(c,"purge","node"),del:d.subAttribute(c,"delete","node"),redirect:{get:function(){var e=d.find(this.xml,this._NS,"delete");
return e.length?d.getSubAttribute(e[0],this._NS,"redirect","uri"):""},set:function(e){var n=d.findOrCreate(this.xml,this._NS,"delete");d.setSubAttribute(n,this._NS,"redirect","uri",e)}}}}),o.Configure=d.define({name:"config",namespace:c,element:"configure",fields:{node:d.attribute("node")}}),o.Event=d.define({name:"event",namespace:s,element:"event"}),o.Subscribe=d.define({name:"subscribe",namespace:P,element:"subscribe",fields:{node:d.attribute("node"),jid:i.jidAttribute("jid")}}),o.Subscription=d.define({name:"subscription",namespace:P,element:"subscription",fields:{node:d.attribute("node"),jid:i.jidAttribute("jid"),subid:d.attribute("subid"),type:d.attribute("subscription")}}),o.Unsubscribe=d.define({name:"unsubscribe",namespace:P,element:"unsubscribe",fields:{node:d.attribute("node"),jid:i.jidAttribute("jid")}}),o.Publish=d.define({name:"publish",namespace:P,element:"publish",fields:{node:d.attribute("node")}}),o.Retract=d.define({name:"retract",namespace:P,element:"retract",fields:{node:d.attribute("node"),notify:d.boolAttribute("notify"),id:d.subAttribute(P,"item","id")}}),o.Retrieve=d.define({name:"retrieve",namespace:P,element:"items",fields:{node:d.attribute("node"),max:d.attribute("max_items")}}),o.Item=d.define({name:"item",namespace:P,element:"item",fields:{id:d.attribute("id")}}),o.EventItems=d.define({name:"updated",namespace:s,element:"items",fields:{node:d.attribute("node"),retracted:{get:function(){var e=[],n=d.find(this.xml,this._NS,"retract");return f.forEach(n,function(n){e.push(n.getAttribute("id"))}),e},set:function(e){var n=this;f.forEach(e,function(e){var o=d.createElement(n._NS,"retract",n._NS);o.setAttribute("id",e),this.xml.appendChild(o)})}}}}),o.EventItem=d.define({name:"eventItem",namespace:s,element:"item",fields:{id:d.attribute("id"),node:d.attribute("node"),publisher:i.jidAttribute("publisher")}}),d.extend(o.Pubsub,o.Subscribe),d.extend(o.Pubsub,o.Unsubscribe),d.extend(o.Pubsub,o.Publish),d.extend(o.Pubsub,o.Retrieve),d.extend(o.Pubsub,o.Subscription),d.extend(o.PubsubOwner,o.Configure),d.extend(o.Publish,o.Item,"items"),d.extend(o.Retrieve,o.Item,"items"),d.extend(o.Configure,l),d.extend(o.Pubsub,p),d.extend(o.Event,o.EventItems),d.extend(o.EventItems,o.EventItem,"published"),d.extend(u,o.Event),d.extend(t,o.Pubsub),d.extend(t,o.PubsubOwner)},{"../jid":4,"./dataforms":46,"./iq":54,"./message":58,"./rsm":67,"./util":76,jxt:198,underscore:222}],66:[function(e,n){"use strict";var o=(e("underscore"),e("jxt")),f=e("./iq"),d=e("../jid"),i=n.exports=o.define({name:"roster",namespace:"jabber:iq:roster",element:"query",fields:{ver:{get:function(){return o.getAttribute(this.xml,"ver")},set:function(e){var n=""===e;o.setAttribute(this.xml,"ver",e,n)}},items:{get:function(){var e=this,n=o.find(this.xml,this._NS,"item");if(!n.length)return[];var f=[];return n.forEach(function(n){var i={jid:new d(o.getAttribute(n,"jid","")),name:o.getAttribute(n,"name",void 0),subscription:o.getAttribute(n,"subscription","none"),ask:o.getAttribute(n,"ask",void 0),groups:[]},t=o.find(n,e._NS,"group");t.forEach(function(e){i.groups.push(e.textContent)}),f.push(i)}),f},set:function(e){var n=this;e.forEach(function(e){var f=o.createElement(n._NS,"item",n._NS);o.setAttribute(f,"jid",e.jid.toString()),o.setAttribute(f,"name",e.name),o.setAttribute(f,"subscription",e.subscription),o.setAttribute(f,"ask",e.ask),(e.groups||[]).forEach(function(e){var d=o.createElement(n._NS,"group",n._NS);d.textContent=e,f.appendChild(d)}),n.xml.appendChild(f)})}}}});o.extend(f,i)},{"../jid":4,"./iq":54,jxt:198,underscore:222}],67:[function(e,n){"use strict";var o=e("jxt"),f=(e("./util"),"http://jabber.org/protocol/rsm");n.exports=o.define({name:"rsm",namespace:f,element:"set",fields:{after:o.subText(f,"after"),before:{get:function(){return o.getSubText(this.xml,this._NS,"before")},set:function(e){e===!0?o.findOrCreate(this.xml,this._NS,"before"):o.setSubText(this.xml,this._NS,"before",e)}},count:o.numberSub(f,"count"),first:o.subText(f,"first"),firstIndex:o.subAttribute(f,"first","index"),index:o.subText(f,"index"),last:o.subText(f,"last"),max:o.subText(f,"max")}})},{"./util":76,jxt:198}],68:[function(e,n,o){"use strict";var f=(e("underscore"),e("jxt")),d=(e("./util"),e("./jingle")),i="urn:xmpp:jingle:apps:rtp:1",t="urn:xmpp:jingle:apps:rtp:rtcp-fb:0",u="urn:xmpp:jingle:apps:rtp:rtp-hdrext:0",l="urn:xmpp:jingle:apps:rtp:info:1",p="urn:xmpp:jingle:apps:rtp:ssma:0",P={get:function(){var e=f.find(this.xml,t,"rtcp-fb"),n=[];return e.forEach(function(e){n.push({type:f.getAttribute(e,"type"),subtype:f.getAttribute(e,"subtype")})}),e=f.find(this.xml,t,"rtcp-fb-trr-int"),e.forEach(function(e){n.push({type:f.getAttribute(e,"type"),value:f.getAttribute(e,"value")})}),n},set:function(e){var n=this,o=f.find(this.xml,t,"rtcp-fb");o.forEach(function(e){n.xml.removeChild(e)}),o=f.find(this.xml,t,"rtcp-fb-trr-int"),o.forEach(function(e){n.xml.removeChild(e)}),e.forEach(function(e){var o;"trr-int"===e.type?(o=f.createElement(t,"rtcp-fb-trr-int",i),f.setAttribute(o,"type",e.type),f.setAttribute(o,"value",e.value)):(o=f.createElement(t,"rtcp-fb",i),f.setAttribute(o,"type",e.type),f.setAttribute(o,"subtype",e.subtype)),n.xml.appendChild(o)})}};o.RTP=f.define({name:"_rtp",namespace:i,element:"description",fields:{descType:{value:"rtp"},media:f.attribute("media"),ssrc:f.attribute("ssrc"),bandwidth:f.subText(i,"bandwidth"),bandwidthType:f.subAttribute(i,"bandwidth","type"),mux:f.boolSub(i,"rtcp-mux"),encryption:{get:function(){var e=f.find(this.xml,i,"encryption");if(!e.length)return[];e=e[0];var n=this,d=f.find(e,i,"crypto"),t=[];return d.forEach(function(e){t.push(new o.Crypto({},e,n).toJSON())}),t},set:function(e){var n=f.find(this.xml,i,"encryption");if(n.length&&this.xml.removeChild(n),e.length){f.setBoolSubAttribute(this.xml,i,"encryption","required",!0),n=f.find(this.xml,i,"encryption")[0];var d=this;e.forEach(function(e){var f=new o.Crypto(e,null,d);n.appendChild(f.xml)})}}},feedback:P,headerExtensions:{get:function(){var e=f.find(this.xml,u,"rtp-hdrext"),n=[];return e.forEach(function(e){n.push({id:f.getAttribute(e,"id"),uri:f.getAttribute(e,"uri"),senders:f.getAttribute(e,"senders")})}),n},set:function(e){var n=this,o=f.find(this.xml,u,"rtp-hdrext");o.forEach(function(e){n.xml.removeChild(e)}),e.forEach(function(e){var o=f.createElement(u,"rtp-hdrext",i);f.setAttribute(o,"id",e.id),f.setAttribute(o,"uri",e.uri),f.setAttribute(o,"senders",e.senders),n.xml.appendChild(o)})}}}}),o.PayloadType=f.define({name:"_payloadType",namespace:i,element:"payload-type",fields:{channels:f.attribute("channels"),clockrate:f.attribute("clockrate"),id:f.attribute("id"),maxptime:f.attribute("maxptime"),name:f.attribute("name"),ptime:f.attribute("ptime"),feedback:P,parameters:{get:function(){var e=[],n=f.find(this.xml,i,"parameter");return n.forEach(function(n){e.push({key:f.getAttribute(n,"name"),value:f.getAttribute(n,"value")})}),e},set:function(e){var n=this;e.forEach(function(e){var o=f.createElement(i,"parameter");f.setAttribute(o,"name",e.key),f.setAttribute(o,"value",e.value),n.xml.appendChild(o)})}}}}),o.Crypto=f.define({name:"crypto",namespace:i,element:"crypto",fields:{cipherSuite:f.attribute("crypto-suite"),keyParams:f.attribute("key-params"),sessionParams:f.attribute("session-params"),tag:f.attribute("tag")}}),o.ContentGroup=f.define({name:"_group",namespace:"urn:xmpp:jingle:apps:grouping:0",element:"group",fields:{semantics:f.attribute("semantics"),contents:{get:function(){return f.getMultiSubText(this.xml,this._NS,"content",function(e){return f.getAttribute(e,"name")})},set:function(e){var n=this;f.setMultiSubText(this.xml,this._NS,"content",e,function(e){var o=f.createElement(n._NS,"content",n._NS);f.setAttribute(o,"name",e),n.xml.appendChild(o)})}}}}),o.SourceGroup=f.define({name:"_sourceGroup",namespace:p,element:"ssrc-group",fields:{semantics:f.attribute("semantics"),sources:{get:function(){return f.getMultiSubText(this.xml,this._NS,"source",function(e){return f.getAttribute(e,"ssrc")})},set:function(e){var n=this;f.setMultiSubText(this.xml,this._NS,"source",e,function(e){var o=f.createElement(n._NS,"source",n._NS);f.setAttribute(o,"ssrc",e),n.xml.appendChild(o)})}}}}),o.Source=f.define({name:"_source",namespace:p,element:"source",fields:{ssrc:f.attribute("ssrc"),parameters:{get:function(){var e=[],n=f.find(this.xml,p,"parameter");return n.forEach(function(n){e.push({key:f.getAttribute(n,"name"),value:f.getAttribute(n,"value")})}),e},set:function(e){var n=this;e.forEach(function(e){var o=f.createElement(p,"parameter");f.setAttribute(o,"name",e.key),f.setAttribute(o,"value",e.value),n.xml.appendChild(o)})}}}}),o.Mute=f.define({name:"mute",namespace:l,element:"mute",fields:{creator:f.attribute("creator"),name:f.attribute("name")}}),o.Unmute=f.define({name:"unmute",namespace:l,element:"unmute",fields:{creator:f.attribute("creator"),name:f.attribute("name")}}),f.extend(d.Content,o.RTP),f.extend(o.RTP,o.PayloadType,"payloads"),f.extend(o.RTP,o.Source,"sources"),f.extend(o.RTP,o.SourceGroup,"sourceGroups"),f.extend(d.Jingle,o.Mute),f.extend(d.Jingle,o.Unmute),f.extend(d.Jingle,o.ContentGroup,"groups"),f.add(d.Jingle,"ringing",f.boolSub(l,"ringing")),f.add(d.Jingle,"hold",f.boolSub(l,"hold")),f.add(d.Jingle,"active",f.boolSub(l,"active"))},{"./jingle":55,"./util":76,jxt:198,underscore:222}],69:[function(e,n,o){"use strict";var f=(e("underscore"),e("jxt")),d=(e("./util"),e("./streamFeatures")),i="urn:ietf:params:xml:ns:xmpp-sasl",t=["aborted","account-disabled","credentials-expired","encryption-required","incorrect-encoding","invalid-authzid","invalid-mechanism","malformed-request","mechanism-too-weak","not-authorized","temporary-auth-failure"];o.Mechanisms=f.define({name:"sasl",namespace:i,element:"mechanisms",fields:{mechanisms:f.multiSubText(i,"mechanism")}}),o.Auth=f.define({name:"saslAuth",eventName:"sasl:auth",namespace:i,element:"auth",topLevel:!0,fields:{value:f.b64Text(),mechanism:f.attribute("mechanism")}}),o.Challenge=f.define({name:"saslChallenge",eventName:"sasl:challenge",namespace:i,element:"challenge",topLevel:!0,fields:{value:f.b64Text()}}),o.Response=f.define({name:"saslResponse",eventName:"sasl:response",namespace:i,element:"response",topLevel:!0,fields:{value:f.b64Text()}}),o.Abort=f.define({name:"saslAbort",eventName:"sasl:abort",namespace:i,element:"abort",topLevel:!0}),o.Success=f.define({name:"saslSuccess",eventName:"sasl:success",namespace:i,element:"success",topLevel:!0,fields:{value:f.b64Text()}}),o.Failure=f.define({name:"saslFailure",eventName:"sasl:failure",namespace:i,element:"failure",topLevel:!0,fields:{lang:{get:function(){return this._lang||""},set:function(e){this._lang=e}},condition:{get:function(){var e=this,n=[];return t.forEach(function(o){var d=f.find(e.xml,i,o);d.length&&n.push(d[0].tagName)}),n[0]||""},set:function(e){var n=this;if(this._CONDITIONS.forEach(function(e){var o=f.find(n.xml,i,e);o.length&&n.xml.removeChild(o[0])}),e){var o=f.createElementNS(i,e);o.setAttribute("xmlns",i),this.xml.appendChild(o)}}},$text:{get:function(){return f.getSubLangText(this.xml,i,"text",this.lang)}},text:{get:function(){var e=this.$text;return e[this.lang]||""},set:function(e){f.setSubLangText(this.xml,i,"text",e,this.lang)}}}}),f.extend(d,o.Mechanisms)},{"./streamFeatures":74,"./util":76,jxt:198,underscore:222}],70:[function(e,n){var o=e("jxt"),f=e("./iq"),d=e("./streamFeatures"),i=n.exports=o.define({name:"session",namespace:"urn:ietf:params:xml:ns:xmpp-session",element:"session"});o.extend(d,i),o.extend(f,i)},{"./iq":54,"./streamFeatures":74,jxt:198}],71:[function(e,n,o){var f=e("jxt"),d=(e("./util"),e("./streamFeatures")),i="urn:xmpp:sm:3";o.SMFeature=f.define({name:"streamManagement",namespace:i,element:"sm"}),o.Enable=f.define({name:"smEnable",eventName:"stream:management:enable",namespace:i,element:"enable",topLevel:!0,fields:{resume:f.boolAttribute("resume")}}),o.Enabled=f.define({name:"smEnabled",eventName:"stream:management:enabled",namespace:i,element:"enabled",topLevel:!0,fields:{id:f.attribute("id"),resume:f.boolAttribute("resume")}}),o.Resume=f.define({name:"smResume",eventName:"stream:management:resume",namespace:i,element:"resume",topLevel:!0,fields:{h:f.numberAttribute("h"),previd:f.attribute("previd")}}),o.Resumed=f.define({name:"smResumed",eventName:"stream:management:resumed",namespace:i,element:"resumed",topLevel:!0,fields:{h:f.numberAttribute("h"),previd:f.attribute("previd")}}),o.Failed=f.define({name:"smFailed",eventName:"stream:management:failed",namespace:i,element:"failed",topLevel:!0}),o.Ack=f.define({name:"smAck",eventName:"stream:management:ack",namespace:i,element:"a",topLevel:!0,fields:{h:f.numberAttribute("h")}}),o.Request=f.define({name:"smRequest",eventName:"stream:management:request",namespace:i,element:"r",topLevel:!0}),f.extend(d,o.SMFeature)},{"./streamFeatures":74,"./util":76,jxt:198}],72:[function(e,n){"use strict";var o=e("jxt"),f=e("./util");n.exports=o.define({name:"stream",namespace:"http://etherx.jabber.org/streams",element:"stream",fields:{lang:o.langAttribute(),id:o.attribute("id"),version:o.attribute("version","1.0"),to:f.jidAttribute("to"),from:f.jidAttribute("from")}})},{"./util":76,jxt:198}],73:[function(e,n){"use strict";var o=(e("underscore"),e("jxt")),f="urn:ietf:params:xml:ns:xmpp-streams",d=["bad-format","bad-namespace-prefix","conflict","connection-timeout","host-gone","host-unknown","improper-addressing","internal-server-error","invalid-from","invalid-namespace","invalid-xml","not-authorized","not-well-formed","policy-violation","remote-connection-failed","reset","resource-constraint","restricted-xml","see-other-host","system-shutdown","undefined-condition","unsupported-encoding","unsupported-feature","unsupported-stanza-type","unsupported-version"];n.exports=o.define({name:"streamError",namespace:"http://etherx.jabber.org/streams",element:"error",topLevel:!0,fields:{lang:{get:function(){return this._lang||""},set:function(e){this._lang=e}},condition:{get:function(){var e=this,n=[];return d.forEach(function(d){var i=o.find(e.xml,f,d);i.length&&n.push(i[0].tagName)}),n[0]||""},set:function(e){var n=this;if(d.forEach(function(e){var d=o.find(n.xml,f,e);d.length&&n.xml.removeChild(d[0])}),e){var i=o.createElement(f,e);i.setAttribute("xmlns",f),this.xml.appendChild(i)}}},seeOtherHost:{get:function(){return o.getSubText(this.xml,f,"see-other-host")},set:function(e){this.condition="see-other-host",o.setSubText(this.xml,f,"see-other-host",e)}},$text:{get:function(){return o.getSubLangText(this.xml,f,"text",this.lang)}},text:{get:function(){var e=this.$text;return e[this.lang]||""},set:function(e){o.setSubLangText(this.xml,f,"text",e,this.lang)}}}})},{jxt:198,underscore:222}],74:[function(e,n){"use strict";var o=e("jxt"),f=n.exports=o.define({name:"streamFeatures",namespace:"http://etherx.jabber.org/streams",element:"features",topLevel:!0,fields:{features:{get:function(){return this._extensions}}}}),d=o.define({name:"rosterVersioning",namespace:"urn:xmpp:features:rosterver",element:"ver"}),i=o.define({name:"subscriptionPreApproval",namespace:"urn:xmpp:features:pre-approval",element:"sub"});o.extend(f,d),o.extend(f,i)},{jxt:198}],75:[function(e,n){"use strict";var o=e("jxt"),f=(e("./util"),e("./iq")),d=n.exports=o.define({name:"time",namespace:"urn:xmpp:time",element:"time",fields:{utc:o.dateSub("urn:xmpp:time","utc"),tzo:{get:function(){var e,n,f,d=-1,i=o.getSubText(this.xml,this._NS,"tzo");return i?("-"===i.charAt(0)&&(d=1,i=i.slice(1)),e=i.split(":"),n=parseInt(e[0],10),f=parseInt(e[1],10),(60*n+f)*d):0},set:function(e){var n,f,d="-";"number"==typeof e?(0>e&&(e=-e,d="+"),n=e/60,f=e%60,d+=(10>n?"0":"")+n+":"+(10>f?"0":"")+f):d=e,o.setSubText(this.xml,this._NS,"tzo",d)}}}});o.extend(f,d)},{"./iq":54,"./util":76,jxt:198}],76:[function(e,n,o){"use strict";var f=e("jxt"),d=e("../jid");o.jidAttribute=f.field(function(e,n){return new d(f.getAttribute(e,n))},function(e,n,o){f.setAttribute(e,n,(o||"").toString())}),o.jidSub=f.field(function(e,n,o){return new d(f.getSubText(e,n,o))},function(e,n,o,d){f.setSubText(e,n,o,(d||"").toString())})},{"../jid":4,jxt:198}],77:[function(e,n){"use strict";var o=e("jxt"),f=e("./iq"),d="vcard-temp",i=n.exports=o.define({name:"vCardTemp",namespace:d,element:"vCard",fields:{role:o.subText(d,"ROLE"),website:o.subText(d,"URL"),title:o.subText(d,"TITLE"),description:o.subText(d,"DESC"),fullName:o.subText(d,"FN"),birthday:o.dateSub(d,"BDAY"),nicknames:o.multiSubText(d,"NICKNAME"),jids:o.multiSubText(d,"JABBERID")}}),t=o.define({name:"_email",namespace:d,element:"EMAIL",fields:{email:o.subText(d,"USERID"),home:o.boolSub(d,"HOME"),work:o.boolSub(d,"WORK"),preferred:o.boolSub(d,"PREF")}}),u=o.define({name:"_tel",namespace:d,element:"TEL",fields:{number:o.subText(d,"NUMBER"),home:o.boolSub(d,"HOME"),work:o.boolSub(d,"WORK"),mobile:o.boolSub(d,"CELL"),preferred:o.boolSub(d,"PREF")}}),l=o.define({name:"_address",namespace:d,element:"ADR",fields:{street:o.subText(d,"STREET"),street2:o.subText(d,"EXTADD"),country:o.subText(d,"CTRY"),city:o.subText(d,"LOCALITY"),region:o.subText(d,"REGION"),postalCode:o.subText(d,"PCODE"),pobox:o.subText(d,"POBOX"),home:o.boolSub(d,"HOME"),work:o.boolSub(d,"WORK"),preferred:o.boolSub(d,"PREF")}}),p=o.define({name:"organization",namespace:d,element:"ORG",fields:{name:o.subText(d,"ORGNAME"),unit:o.subText(d,"ORGUNIT")}}),P=o.define({name:"name",namespace:d,element:"N",fields:{family:o.subText(d,"FAMILY"),given:o.subText(d,"GIVEN"),middle:o.subText(d,"MIDDLE"),prefix:o.subText(d,"PREFIX"),suffix:o.subText(d,"SUFFIX")}}),c=o.define({name:"photo",namespace:d,element:"PHOTO",fields:{type:o.subText(d,"TYPE"),data:o.subText(d,"BINVAL"),url:o.subText(d,"EXTVAL")}});o.extend(i,t,"emails"),o.extend(i,l,"addresses"),o.extend(i,u,"phoneNumbers"),o.extend(i,p),o.extend(i,P),o.extend(i,c),o.extend(f,i)},{"./iq":54,jxt:198}],78:[function(e,n){var o=e("jxt"),f=e("./iq"),d="jabber:iq:version",i=n.exports=o.define({name:"version",namespace:d,element:"query",fields:{name:o.subText(d,"name"),version:o.subText(d,"version"),os:o.subText(d,"os")}});o.extend(f,i)},{"./iq":54,jxt:198}],79:[function(e){var n=e("jxt"),o=e("./iq");n.add(o,"visible",n.boolSub("urn:xmpp:invisible:0","visible")),n.add(o,"invisible",n.boolSub("urn:xmpp:invisible:0","invisible"))},{"./iq":54,jxt:198}],80:[function(e,n){"use strict";function o(e){function n(e){return[o.streamStart,e,o.streamEnd].join("")}var o=this;t.call(this),o.sm=e,o.sendQueue=u.queue(function(e,n){o.conn&&(o.sm.track(e),"string"!=typeof e&&(e=e.toString()),o.emit("raw:outgoing",e),o.conn.send(e)),n()},1),o.on("connected",function(){o.send(["<stream:stream",'xmlns:stream="http://etherx.jabber.org/streams"','xmlns="jabber:client"','version="'+(o.config.version||"1.0")+'"','xml:lang="'+(o.config.lang||"en")+'"','to="'+o.config.server+'">'].join(" "))}),o.on("raw:incoming",function(e){var d,t,u;if(e=e.trim(),e=e.replace(/^(\s*<\?.*\?>\s*)*/,""),""!==e){if(e.match(o.streamEnd))return o.disconnect();if(o.hasStream)try{d=i.parse(n(e),l)}catch(P){return u=new p({condition:"invalid-xml"}),o.emit("stream:error",u,P),o.send(u),o.disconnect()}else{var c=e.match(/^<(\S+:)?(\S+) /);o.streamStart=e,o.streamEnd="</"+(c[1]||"")+c[2]+">",t=!1;try{d=i.parse(e+o.streamEnd,l)}catch(P){try{d=i.parse(e,l),t=!0}catch(s){return u=new p({condition:"invalid-xml"}),o.emit("stream:error",u,s),o.send(u),o.disconnect()}}o.hasStream=!0,o.stream=d,o.emit("stream:start",d)}f.each(d._extensions,function(e){if(e.lang||(e.lang=o.stream.lang),o.emit("stream:data",e),o.emit(e._eventname||e._name,e),"message"===e._name||"presence"===e._name||"iq"===e._name)o.sm.handle(e),o.emit("stanza",e);else{if("smAck"===e._name)return o.sm.process(e);if("smRequest"===e._name)return o.sm.ack()}e.id&&o.emit("id:"+e.id,e)}),t&&o.emit("stream:end")}})}var f=e("underscore"),d=e("util"),i=e("jxt"),t=e("wildemitter"),u=e("async"),l=e("./stanza/stream"),p=e("./stanza/streamError"),P=(e("./stanza/message"),e("./stanza/presence"),e("./stanza/iq"),e("faye-websocket")&&e("faye-websocket").Client?e("faye-websocket").Client:window.WebSocket);d.inherits(o,t),o.prototype.connect=function(e){var n=this;n.config=e,n.hasStream=!1,n.streamStart='<stream:stream xmlns:stream="http://etherx.jabber.org/streams">',n.streamEnd="</stream:stream>",n.conn=new P(e.wsURL,"xmpp"),n.conn.onerror=function(e){return e.preventDefault(),n.emit("disconnected",n),!1},n.conn.onclose=function(){n.emit("disconnected",n)},n.conn.onopen=function(){n.sm.started=!1,n.emit("connected",n)},n.conn.onmessage=function(e){n.emit("raw:incoming",e.data)}},o.prototype.disconnect=function(){this.conn?(this.hasStream&&(this.conn.send("</stream:stream>"),this.emit("raw:outgoing","</stream:stream>"),this.emit("stream:end")),this.hasStream=!1,this.conn.close(),this.stream=void 0,this.conn=void 0,this.sm.failed()):this.emit("disconnected",this)},o.prototype.restart=function(){var e=this;e.hasStream=!1,e.send(["<stream:stream",'xmlns:stream="http://etherx.jabber.org/streams"','xmlns="jabber:client"','version="'+(e.config.version||"1.0")+'"','xml:lang="'+(e.config.lang||"en")+'"','to="'+e.config.server+'">'].join(" "))},o.prototype.send=function(e){this.sendQueue.push(e)},n.exports=o},{"./stanza/iq":54,"./stanza/message":58,"./stanza/presence":63,"./stanza/stream":72,"./stanza/streamError":73,async:81,"faye-websocket":133,jxt:198,underscore:222,util:123,wildemitter:223}],81:[function(n,o){var f=n("__browserify_process");!function(){function n(e){var n=!1;return function(){if(n)throw new Error("Callback was already called.");n=!0,e.apply(d,arguments)}}var d,i,t={};d=this,null!=d&&(i=d.async),t.noConflict=function(){return d.async=i,t};var u=function(e,n){if(e.forEach)return e.forEach(n);for(var o=0;o<e.length;o+=1)n(e[o],o,e)},l=function(e,n){if(e.map)return e.map(n);var o=[];return u(e,function(e,f,d){o.push(n(e,f,d))}),o},p=function(e,n,o){return e.reduce?e.reduce(n,o):(u(e,function(e,f,d){o=n(o,e,f,d)}),o)},P=function(e){if(Object.keys)return Object.keys(e);var n=[];for(var o in e)e.hasOwnProperty(o)&&n.push(o);return n};"undefined"!=typeof f&&f.nextTick?(t.nextTick=f.nextTick,t.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:t.nextTick):"function"==typeof setImmediate?(t.nextTick=function(e){setImmediate(e)},t.setImmediate=t.nextTick):(t.nextTick=function(e){setTimeout(e,0)},t.setImmediate=t.nextTick),t.each=function(e,o,f){if(f=f||function(){},!e.length)return f();var d=0;u(e,function(i){o(i,n(function(n){n?(f(n),f=function(){}):(d+=1,d>=e.length&&f(null))}))})},t.forEach=t.each,t.eachSeries=function(e,n,o){if(o=o||function(){},!e.length)return o();var f=0,d=function(){n(e[f],function(n){n?(o(n),o=function(){}):(f+=1,f>=e.length?o(null):d())})};d()},t.forEachSeries=t.eachSeries,t.eachLimit=function(e,n,o,f){var d=c(n);d.apply(null,[e,o,f])},t.forEachLimit=t.eachLimit;var c=function(e){return function(n,o,f){if(f=f||function(){},!n.length||0>=e)return f();var d=0,i=0,t=0;!function u(){if(d>=n.length)return f();for(;e>t&&i<n.length;)i+=1,t+=1,o(n[i-1],function(e){e?(f(e),f=function(){}):(d+=1,t-=1,d>=n.length?f():u())})}()}},s=function(e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[t.each].concat(n))}},y=function(e,n){return function(){var o=Array.prototype.slice.call(arguments);return n.apply(null,[c(e)].concat(o))}},w=function(e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[t.eachSeries].concat(n))}},a=function(e,n,o,f){var d=[];n=l(n,function(e,n){return{index:n,value:e}}),e(n,function(e,n){o(e.value,function(o,f){d[e.index]=f,n(o)})},function(e){f(e,d)})};t.map=s(a),t.mapSeries=w(a),t.mapLimit=function(e,n,o,f){return b(n)(e,o,f)};var b=function(e){return y(e,a)};t.reduce=function(e,n,o,f){t.eachSeries(e,function(e,f){o(n,e,function(e,o){n=o,f(e)})},function(e){f(e,n)})},t.inject=t.reduce,t.foldl=t.reduce,t.reduceRight=function(e,n,o,f){var d=l(e,function(e){return e}).reverse();t.reduce(d,n,o,f)},t.foldr=t.reduceRight;var r=function(e,n,o,f){var d=[];n=l(n,function(e,n){return{index:n,value:e}}),e(n,function(e,n){o(e.value,function(o){o&&d.push(e),n()})},function(){f(l(d.sort(function(e,n){return e.index-n.index}),function(e){return e.value}))})};t.filter=s(r),t.filterSeries=w(r),t.select=t.filter,t.selectSeries=t.filterSeries;var M=function(e,n,o,f){var d=[];n=l(n,function(e,n){return{index:n,value:e}}),e(n,function(e,n){o(e.value,function(o){o||d.push(e),n()})},function(){f(l(d.sort(function(e,n){return e.index-n.index}),function(e){return e.value}))})};t.reject=s(M),t.rejectSeries=w(M);var X=function(e,n,o,f){e(n,function(e,n){o(e,function(o){o?(f(e),f=function(){}):n()})},function(){f()})};t.detect=s(X),t.detectSeries=w(X),t.some=function(e,n,o){t.each(e,function(e,f){n(e,function(e){e&&(o(!0),o=function(){}),f()})},function(){o(!1)})},t.any=t.some,t.every=function(e,n,o){t.each(e,function(e,f){n(e,function(e){e||(o(!1),o=function(){}),f()})},function(){o(!0)})},t.all=t.every,t.sortBy=function(e,n,o){t.map(e,function(e,o){n(e,function(n,f){n?o(n):o(null,{value:e,criteria:f})})},function(e,n){if(e)return o(e);var f=function(e,n){var o=e.criteria,f=n.criteria;return f>o?-1:o>f?1:0};o(null,l(n.sort(f),function(e){return e.value}))})},t.auto=function(e,n){n=n||function(){};var o=P(e);if(!o.length)return n(null);var f={},d=[],i=function(e){d.unshift(e)},l=function(e){for(var n=0;n<d.length;n+=1)if(d[n]===e)return void d.splice(n,1)},c=function(){u(d.slice(0),function(e){e()})};i(function(){P(f).length===o.length&&(n(null,f),n=function(){})}),u(o,function(o){var d=e[o]instanceof Function?[e[o]]:e[o],s=function(e){var d=Array.prototype.slice.call(arguments,1);if(d.length<=1&&(d=d[0]),e){var i={};u(P(f),function(e){i[e]=f[e]}),i[o]=d,n(e,i),n=function(){}}else f[o]=d,t.setImmediate(c)},y=d.slice(0,Math.abs(d.length-1))||[],w=function(){return p(y,function(e,n){return e&&f.hasOwnProperty(n)},!0)&&!f.hasOwnProperty(o)};if(w())d[d.length-1](s,f);else{var a=function(){w()&&(l(a),d[d.length-1](s,f))};i(a)}})},t.waterfall=function(e,n){if(n=n||function(){},e.constructor!==Array){var o=new Error("First argument to waterfall must be an array of functions");return n(o)}if(!e.length)return n();var f=function(e){return function(o){if(o)n.apply(null,arguments),n=function(){};else{var d=Array.prototype.slice.call(arguments,1),i=e.next();d.push(i?f(i):n),t.setImmediate(function(){e.apply(null,d)})}}};f(t.iterator(e))()};var g=function(e,n,o){if(o=o||function(){},n.constructor===Array)e.map(n,function(e,n){e&&e(function(e){var o=Array.prototype.slice.call(arguments,1);o.length<=1&&(o=o[0]),n.call(null,e,o)})},o);else{var f={};e.each(P(n),function(e,o){n[e](function(n){var d=Array.prototype.slice.call(arguments,1);d.length<=1&&(d=d[0]),f[e]=d,o(n)})},function(e){o(e,f)})}};t.parallel=function(e,n){g({map:t.map,each:t.each},e,n)},t.parallelLimit=function(e,n,o){g({map:b(n),each:c(n)},e,o)},t.series=function(e,n){if(n=n||function(){},e.constructor===Array)t.mapSeries(e,function(e,n){e&&e(function(e){var o=Array.prototype.slice.call(arguments,1);o.length<=1&&(o=o[0]),n.call(null,e,o)})},n);else{var o={};t.eachSeries(P(e),function(n,f){e[n](function(e){var d=Array.prototype.slice.call(arguments,1);d.length<=1&&(d=d[0]),o[n]=d,f(e)})},function(e){n(e,o)})}},t.iterator=function(e){var n=function(o){var f=function(){return e.length&&e[o].apply(null,arguments),f.next()};return f.next=function(){return o<e.length-1?n(o+1):null},f};return n(0)},t.apply=function(e){var n=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,n.concat(Array.prototype.slice.call(arguments)))}};var m=function(e,n,o,f){var d=[];e(n,function(e,n){o(e,function(e,o){d=d.concat(o||[]),n(e)})},function(e){f(e,d)})};t.concat=s(m),t.concatSeries=w(m),t.whilst=function(e,n,o){e()?n(function(f){return f?o(f):void t.whilst(e,n,o)}):o()},t.doWhilst=function(e,n,o){e(function(f){return f?o(f):void(n()?t.doWhilst(e,n,o):o())})},t.until=function(e,n,o){e()?o():n(function(f){return f?o(f):void t.until(e,n,o)})},t.doUntil=function(e,n,o){e(function(f){return f?o(f):void(n()?o():t.doUntil(e,n,o))})},t.queue=function(e,o){function f(e,n,f,d){n.constructor!==Array&&(n=[n]),u(n,function(n){var i={data:n,callback:"function"==typeof d?d:null};f?e.tasks.unshift(i):e.tasks.push(i),e.saturated&&e.tasks.length===o&&e.saturated(),t.setImmediate(e.process)})}void 0===o&&(o=1);var d=0,i={tasks:[],concurrency:o,saturated:null,empty:null,drain:null,push:function(e,n){f(i,e,!1,n)},unshift:function(e,n){f(i,e,!0,n)},process:function(){if(d<i.concurrency&&i.tasks.length){var o=i.tasks.shift();i.empty&&0===i.tasks.length&&i.empty(),d+=1;var f=function(){d-=1,o.callback&&o.callback.apply(o,arguments),i.drain&&i.tasks.length+d===0&&i.drain(),i.process()},t=n(f);e(o.data,t)}},length:function(){return i.tasks.length},running:function(){return d}};return i},t.cargo=function(e,n){var o=!1,f=[],d={tasks:f,payload:n,saturated:null,empty:null,drain:null,push:function(e,o){e.constructor!==Array&&(e=[e]),u(e,function(e){f.push({data:e,callback:"function"==typeof o?o:null}),d.saturated&&f.length===n&&d.saturated()}),t.setImmediate(d.process)},process:function i(){if(!o){if(0===f.length)return void(d.drain&&d.drain());var t="number"==typeof n?f.splice(0,n):f.splice(0),p=l(t,function(e){return e.data});d.empty&&d.empty(),o=!0,e(p,function(){o=!1;var e=arguments;u(t,function(n){n.callback&&n.callback.apply(null,e)}),i()})}},length:function(){return f.length},running:function(){return o}};return d};var x=function(e){return function(n){var o=Array.prototype.slice.call(arguments,1);n.apply(null,o.concat([function(n){var o=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(n?console.error&&console.error(n):console[e]&&u(o,function(n){console[e](n)}))}]))}};t.log=x("log"),t.dir=x("dir"),t.memoize=function(e,n){var o={},f={};n=n||function(e){return e};var d=function(){var d=Array.prototype.slice.call(arguments),i=d.pop(),t=n.apply(null,d);t in o?i.apply(null,o[t]):t in f?f[t].push(i):(f[t]=[i],e.apply(null,d.concat([function(){o[t]=arguments;var e=f[t];delete f[t];for(var n=0,d=e.length;d>n;n++)e[n].apply(null,arguments)}])))};return d.memo=o,d.unmemoized=e,d},t.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},t.times=function(e,n,o){for(var f=[],d=0;e>d;d++)f.push(d);return t.map(f,n,o)},t.timesSeries=function(e,n,o){for(var f=[],d=0;e>d;d++)f.push(d);return t.mapSeries(f,n,o)},t.compose=function(){var e=Array.prototype.reverse.call(arguments);return function(){var n=this,o=Array.prototype.slice.call(arguments),f=o.pop();t.reduce(e,o,function(e,o,f){o.apply(n,e.concat([function(){var e=arguments[0],n=Array.prototype.slice.call(arguments,1);f(e,n)}]))},function(e,o){f.apply(n,[e].concat(o))})}};var j=function(e,n){var o=function(){var o=this,f=Array.prototype.slice.call(arguments),d=f.pop();return e(n,function(e,n){e.apply(o,f.concat([n]))},d)};if(arguments.length>2){var f=Array.prototype.slice.call(arguments,2);return o.apply(this,f)}return o};t.applyEach=s(j),t.applyEachSeries=w(j),t.forever=function(e,n){function o(f){if(f){if(n)return n(f);throw f}e(o)}o()},"undefined"!=typeof e&&e.amd?e([],function(){return t}):"undefined"!=typeof o&&o.exports?o.exports=t:d.async=t}()},{__browserify_process:135}],82:[function(e,n){var o=e("__browserify_Buffer").Buffer;!function(){"use strict";function e(e){return new o(e,"base64").toString("binary")}n.exports=e}()},{__browserify_Buffer:134}],83:[function(e,n){"use strict";n.exports=function(n,o,f){function d(e,n){var f=o(e,i,n===!0&&e._isBound()?e._boundTo:void 0),d=f.promise();return d.isRejected()?d:(f.setHowMany(1),f.setUnwrap(),f.init(),d)}var i=e("./some_promise_array.js")(f);n.any=function(e){return d(e,!1)},n.prototype.any=function(){return d(this,!0)}}},{"./some_promise_array.js":115}],84:[function(e,n){"use strict";function o(){this._isTickUsed=!1,this._length=0,this._lateBuffer=new d,this._functionBuffer=new d(75e3);var e=this;this.consumeFunctionBuffer=function(){e._consumeFunctionBuffer()
}}var f=e("./schedule.js"),d=e("./queue.js"),i=e("./util.js").errorObj,t=e("./util.js").tryCatch1,u=e("./global.js").process;o.prototype.haveItemsQueued=function(){return this._length>0},o.prototype.invokeLater=function(e,n,o){void 0===u||null==u.domain||e.domain||(e=u.domain.bind(e)),this._lateBuffer.push(e,n,o),this._queueTick()},o.prototype.invoke=function(e,n,o){void 0===u||null==u.domain||e.domain||(e=u.domain.bind(e));var f=this._functionBuffer;f.push(e,n,o),this._length=f.length(),this._queueTick()},o.prototype._consumeFunctionBuffer=function(){for(var e=this._functionBuffer;e.length()>0;){var n=e.shift(),o=e.shift(),f=e.shift();n.call(o,f)}this._reset(),this._consumeLateBuffer()},o.prototype._consumeLateBuffer=function(){for(var e=this._lateBuffer;e.length()>0;){var n=e.shift(),o=e.shift(),f=e.shift(),d=t(n,o,f);if(d===i){if(this._queueTick(),null==n.domain)throw d.e;n.domain.emit("error",d.e)}}},o.prototype._queueTick=function(){this._isTickUsed||(f(this.consumeFunctionBuffer),this._isTickUsed=!0)},o.prototype._reset=function(){this._isTickUsed=!1,this._length=0},n.exports=new o},{"./global.js":97,"./queue.js":108,"./schedule.js":111,"./util.js":119}],85:[function(e,n){"use strict";var o=e("./promise.js")();n.exports=o},{"./promise.js":101}],86:[function(e,n){"use strict";n.exports=function(e){function n(e){var n="string"==typeof this?this:""+this;return e[n]}e.prototype.call=function(e){for(var n=arguments.length,o=new Array(n-1),f=1;n>f;++f)o[f-1]=arguments[f];return this._then(function(n){return n[e].apply(n,o)},void 0,void 0,void 0,void 0)},e.prototype.get=function(e){return this._then(n,void 0,void 0,e,void 0)}}},{}],87:[function(e,n){"use strict";n.exports=function(n,o){var f=e("./errors.js"),d=e("./async.js"),i=f.CancellationError;n.prototype._cancel=function(){if(!this.isCancellable())return this;for(var e,n=this;void 0!==(e=n._cancellationParent)&&e.isCancellable();)n=e;var o=new i;n._attachExtraTrace(o),n._rejectUnchecked(o)},n.prototype.cancel=function(){return this.isCancellable()?(d.invokeLater(this._cancel,this,void 0),this):this},n.prototype.cancellable=function(){return this._cancellable()?this:(this._setCancellable(),this._cancellationParent=void 0,this)},n.prototype.uncancellable=function(){var e=new n(o);return e._setTrace(this),e._follow(this),e._unsetCancellable(),this._isBound()&&e._setBoundTo(this._boundTo),e},n.prototype.fork=function(e,n,o){var f=this._then(e,n,o,void 0,void 0);return f._setCancellable(),f._cancellationParent=void 0,f}}},{"./async.js":84,"./errors.js":91}],88:[function(e,n){"use strict";n.exports=function(){function n(e){var n;if("function"==typeof e)n="[function "+(e.name||"anonymous")+"]";else{n=e.toString();var f=/\[object [a-zA-Z0-9$_]+\]/;if(f.test(n))try{var d=JSON.stringify(e);n=d}catch(i){}0===n.length&&(n="(empty array)")}return"(<"+o(n)+">, no stack trace)"}function o(e){var n=41;return e.length<n?e:e.substr(0,n-3)+"..."}function f(e,n){this.captureStackTrace(f,n)}var d=e("./util.js").inherits,i=e("./es5.js").defineProperty,t=new RegExp("\\b(?:[a-zA-Z0-9.]+\\$_\\w+|tryCatch(?:1|2|Apply)|new \\w*PromiseArray|\\w*PromiseArray\\.\\w*PromiseArray|setTimeout|CatchFilter\\$_\\w+|makeNodePromisified|processImmediate|process._tickCallback|nextTick|Async\\$\\w+)\\b"),u=null,l=null;d(f,Error),f.prototype.captureStackTrace=function(e,n){p(this,e,n)},f.possiblyUnhandledRejection=function(e){if("object"==typeof console){var n;if("object"==typeof e||"function"==typeof e){var o=e.stack;n="Possibly unhandled "+l(o,e)}else n="Possibly unhandled "+String(e);"function"==typeof console.error||"object"==typeof console.error?console.error(n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(n)}},f.combine=function(e,n){for(var o=e.length-1,f=n.length-1;f>=0;--f){var d=n[f];if(e[o]!==d)break;e.pop(),o--}e.push("From previous event:");for(var i=e.concat(n),l=[],f=0,p=i.length;p>f;++f)t.test(i[f])||f>0&&!u.test(i[f])&&"From previous event:"!==i[f]||l.push(i[f]);return l},f.isSupported=function(){return"function"==typeof p};var p=function P(){if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){u=/^\s*at\s*/,l=function(e,o){return"string"==typeof e?e:void 0!==o.name&&void 0!==o.message?o.name+". "+o.message:n(o)};var e=Error.captureStackTrace;return function(n,o){e(n,o)}}var o=new Error;if("string"==typeof o.stack&&"function"==typeof"".startsWith&&o.stack.startsWith("stackDetection@")&&"stackDetection"===P.name){i(Error,"stackTraceLimit",{writable:!0,enumerable:!1,configurable:!1,value:25}),u=/@/;var f=/[@\n]/;return l=function(e,o){return"string"==typeof e?o.name+". "+o.message+"\n"+e:void 0!==o.name&&void 0!==o.message?o.name+". "+o.message:n(o)},function(e){for(var n=(new Error).stack,o=n.split(f),d=o.length,i="",t=0;d>t;t+=2)i+=o[t],i+="@",i+=o[t+1],i+="\n";e.stack=i}}return l=function(e,o){return"string"==typeof e?e:"object"!=typeof o&&"function"!=typeof o||void 0===o.name||void 0===o.message?n(o):o.name+". "+o.message},null}();return f}},{"./es5.js":93,"./util.js":119}],89:[function(e,n){"use strict";n.exports=function(n){function o(e,n,o){this._instances=e,this._callback=n,this._promise=o}function f(e,n){var o={},f=t(e,o,n);if(f===u)return f;var d=l(o);return d.length?(u.e=new p("Catch filter must inherit from Error or be a simple predicate function"),u):f}var d=e("./util.js"),i=e("./errors.js"),t=d.tryCatch1,u=d.errorObj,l=e("./es5.js").keys,p=i.TypeError;return o.prototype.doFilter=function(e){for(var o=this._callback,d=this._promise,l=d._isBound()?d._boundTo:void 0,p=0,P=this._instances.length;P>p;++p){var c=this._instances[p],s=c===Error||null!=c&&c.prototype instanceof Error;if(s&&e instanceof c){var y=t(o,l,e);return y===u?(n.e=y.e,n):y}if("function"==typeof c&&!s){var w=f(c,e);if(w===u){var a=i.canAttach(u.e)?u.e:new Error(u.e+"");this._promise._attachExtraTrace(a),e=u.e;break}if(w){var y=t(o,l,e);return y===u?(n.e=y.e,n):y}}}return n.e=e,n},o}},{"./errors.js":91,"./es5.js":93,"./util.js":119}],90:[function(e,n){"use strict";var o=e("./util.js"),f=o.isPrimitive,d=o.wrapsPrimitiveReceiver;n.exports=function(e){var n=function(){return this},o=function(){throw this},i=function(e,n){return 1===n?function(){throw e}:2===n?function(){return e}:void 0};e.prototype["return"]=e.prototype.thenReturn=function(e){return d&&f(e)?this._then(i(e,2),void 0,void 0,void 0,void 0):this._then(n,void 0,void 0,e,void 0)},e.prototype["throw"]=e.prototype.thenThrow=function(e){return d&&f(e)?this._then(i(e,1),void 0,void 0,void 0,void 0):this._then(o,void 0,void 0,e,void 0)}}},{"./util.js":119}],91:[function(e,n){"use strict";function o(e){try{s(e,"isAsync",!0)}catch(n){}}function f(e){return null==e?!1:e instanceof u||e.isAsync===!0}function d(e){return e instanceof y}function i(e){return d(e)}function t(e,n){function o(f){return this instanceof o?(this.message="string"==typeof f?f:n,this.name=e,void(y.captureStackTrace&&y.captureStackTrace(this,this.constructor))):new o(f)}return c(o,y),o}function u(e){this.name="RejectionError",this.message=e,this.cause=e,this.isAsync=!0,e instanceof y?(this.message=e.message,this.stack=e.stack):y.captureStackTrace&&y.captureStackTrace(this,this.constructor)}var l=e("./global.js"),p=e("./es5.js").freeze,P=e("./util.js"),c=P.inherits,s=P.notEnumerableProp,y=l.Error,w=l.TypeError;"function"!=typeof w&&(w=t("TypeError","type error"));var a=l.RangeError;"function"!=typeof a&&(a=t("RangeError","range error"));var b=t("CancellationError","cancellation error"),r=t("TimeoutError","timeout error");c(u,y);var M="__BluebirdErrorTypes__",X=l[M];X||(X=p({CancellationError:b,TimeoutError:r,RejectionError:u}),s(l,M,X)),n.exports={Error:y,TypeError:w,RangeError:a,CancellationError:X.CancellationError,RejectionError:X.RejectionError,TimeoutError:X.TimeoutError,originatesFromRejection:f,markAsOriginatingFromRejection:o,canAttach:i}},{"./es5.js":93,"./global.js":97,"./util.js":119}],92:[function(e,n){"use strict";n.exports=function(n){function o(e){var o=new f(e),d=n.rejected(o),i=d._peekContext();return null!=i&&i._attachExtraTrace(o),d}var f=e("./errors.js").TypeError;return o}},{"./errors.js":91}],93:[function(e,n){function o(e){var n=[];for(var o in e)l.call(e,o)&&n.push(o);return n}function f(e,n,o){return e[n]=o.value,e}function d(e){return e}function i(e){try{return Object(e).constructor.prototype}catch(n){return P}}function t(e){try{return"[object Array]"===p.call(e)}catch(n){return!1}}var u=function(){"use strict";return void 0===this}();if(u)n.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,keys:Object.keys,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:u};else{var l={}.hasOwnProperty,p={}.toString,P={}.constructor.prototype;n.exports={isArray:t,keys:o,defineProperty:f,freeze:d,getPrototypeOf:i,isES5:u}}},{}],94:[function(e,n){"use strict";n.exports=function(n){function o(e){for(var o=this instanceof n?this._settledValue:this,f=o.length,d=new Array(f),i=0,t=0;f>t;++t)e[t]&&(d[i++]=o[t]);return d.length=i,d}var f=(e("./util.js").isArray,{ref:null});n.filter=function(e,d){return n.map(e,d,f)._then(o,void 0,void 0,f.ref,void 0)},n.prototype.filter=function(e){return this.map(e,f)._then(o,void 0,void 0,f.ref,void 0)}}},{"./util.js":119}],95:[function(e,n){"use strict";n.exports=function(n,o){function f(){return this}function d(){throw this}function i(e){return function(){return e}}function t(e){return function(){throw e}}function u(e,n,o){var u;return u=c&&s(n)?o?i(n):t(n):o?f:d,e._then(u,y,void 0,n,void 0)}function l(e){var f=this.promise,d=this.handler,i=f._isBound()?d.call(f._boundTo):d();if(void 0!==i){var t=n._cast(i,void 0);if(t instanceof n)return u(t,e,f.isFulfilled())}return f.isRejected()?(o.e=e,o):e}function p(e){var o=this.promise,f=this.handler,d=o._isBound()?f.call(o._boundTo,e):f(e);if(void 0!==d){var i=n._cast(d,void 0);if(i instanceof n)return u(i,e,!0)}return e}var P=e("./util.js"),c=P.wrapsPrimitiveReceiver,s=P.isPrimitive,y=P.thrower;n.prototype._passThroughHandler=function(e,n){if("function"!=typeof e)return this.then();var o={promise:this,handler:e};return this._then(n?l:p,n?l:void 0,void 0,o,void 0)},n.prototype.lastly=n.prototype["finally"]=function(e){return this._passThroughHandler(e,!0)},n.prototype.tap=function(e){return this._passThroughHandler(e,!1)}}},{"./util.js":119}],96:[function(e,n){"use strict";n.exports=function(n,o,f){var d=e("./promise_spawn.js")(n,f),i=e("./errors.js"),t=i.TypeError,u=e("./util.js").deprecated;n.coroutine=function(e){if("function"!=typeof e)throw new t("generatorFunction must be a function");var n=d;return function(){var o=e.apply(this,arguments),f=new n(void 0,void 0);return f._generator=o,f._next(void 0),f.promise()}},n.coroutine.addYieldHandler=d.addYieldHandler,n.spawn=function(e){if(u("Promise.spawn is deprecated. Use Promise.coroutine instead."),"function"!=typeof e)return o("generatorFunction must be a function");var f=new d(e,this),i=f.promise();return f._run(n.spawn),i}}},{"./errors.js":91,"./promise_spawn.js":104,"./util.js":119}],97:[function(e,n){var o="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};n.exports=function(){if(void 0!==this)return this;try{return o}catch(e){}try{return window}catch(e){}try{return self}catch(e){}}()},{}],98:[function(e,n){"use strict";n.exports=function(n,o,f,d){function i(e){return t(e,this[0],this[1],this[2])}function t(e,o,t,l){if("function"!=typeof o)return d("fn must be a function");var p=void 0;t===!0?e._isBound()&&(p=e._boundTo):t!==!1&&(p=t);var P=void 0!==l;if(P&&(l.ref=e),e instanceof n){var s=[o,p,l];return e._then(i,void 0,void 0,s,void 0)}if(!c(e))return d("expecting an array, a promise or a thenable");var y=new n(f);void 0!==p&&y._setBoundTo(p),y._setTrace(void 0);var w=new u(y,o,e,p,P);return w.init(),y}function u(e,n,o,f,d){this.shouldUnwrapItems=d,this.index=0,this.items=o,this.callback=n,this.receiver=f,this.promise=e,this.result=new Array(o.length)}var l=n.all,p=e("./util.js"),P=e("./errors.js").canAttach,c=p.isArray,s=n._cast,y={};p.inherits(u,o),u.prototype.init=function(){for(var e=this.items,o=e.length,f=this.result,d=!1,i=0;o>i;++i){var t=s(e[i],void 0);t instanceof n?t.isPending()?(f[i]=y,t._proxyPromiseArray(this,i)):t.isFulfilled()?f[i]=t.value():(t._unsetRejectionIsUnhandled(),d||(this.reject(t.reason()),d=!0)):f[i]=t}d||this.iterate()},u.prototype.isResolved=function(){return null===this.promise},u.prototype._promiseProgressed=function(e){this.isResolved()||this.promise._progress(e)},u.prototype._promiseFulfilled=function(e,n){this.isResolved()||(this.result[n]=e,this.shouldUnwrapItems&&(this.items[n]=e),this.index===n&&this.iterate())},u.prototype._promiseRejected=function(e){this.reject(e)},u.prototype.reject=function(e){if(!this.isResolved()){var n=P(e)?e:new Error(e+"");this.promise._attachExtraTrace(n),this.promise._reject(e,n)}},u.prototype.iterate=function(){for(var e=this.index,n=this.items,o=this.result,f=n.length,o=this.result,d=this.receiver,i=this.callback;f>e;++e){var t=o[e];if(t===y)return void(this.index=e);try{o[e]=i.call(d,t,e,f)}catch(u){return this.reject(u)}}this.promise._follow(l(o)),this.items=this.result=this.callback=this.promise=null},n.prototype.map=function(e,n){return t(this,e,!0,n)},n.map=function(e,n,o){return t(e,n,!1,o)}}},{"./errors.js":91,"./util.js":119}],99:[function(e,n){"use strict";n.exports=function(n){function o(e){throw e}function f(e,n){var f=this,d=void 0===e?l(f,n,null):u(f,n,null,e);d===p&&t.invokeLater(o,void 0,d.e)}function d(e,n){var f=this,d=l(f,n,e);d===p&&t.invokeLater(o,void 0,d.e)}var i=e("./util.js"),t=e("./async.js"),u=i.tryCatch2,l=i.tryCatch1,p=i.errorObj;n.prototype.nodeify=function(e){return"function"==typeof e&&this._then(f,d,void 0,e,this._isBound()?this._boundTo:null),this}}},{"./async.js":84,"./util.js":119}],100:[function(e,n){"use strict";n.exports=function(n,o){var f=e("./util.js"),d=e("./async.js"),i=e("./errors.js"),t=f.tryCatch1,u=f.errorObj;n.prototype.progressed=function(e){return this._then(void 0,void 0,e,void 0,void 0)},n.prototype._progress=function(e){this._isFollowingOrFulfilledOrRejected()||this._progressUnchecked(e)},n.prototype._progressHandlerAt=function(e){return 0===e?this._progressHandler0:this[e+2-5]},n.prototype._doProgressWith=function(e){var o=e.value,f=e.handler,d=e.promise,l=e.receiver;this._pushContext();var p=t(f,l,o);if(this._popContext(),p===u){if(null!=p.e&&"StopProgressPropagation"!==p.e.name){var P=i.canAttach(p.e)?p.e:new Error(p.e+"");d._attachExtraTrace(P),d._progress(p.e)}}else p instanceof n?p._then(d._progress,null,null,d,void 0):d._progress(p)},n.prototype._progressUnchecked=function(e){if(this.isPending())for(var f=this._length(),i=this._progress,t=0;f>t;t+=5){var u=this._progressHandlerAt(t),l=this._promiseAt(t);if(l instanceof n)"function"==typeof u?d.invoke(this._doProgressWith,this,{handler:u,promise:l,receiver:this._receiverAt(t),value:e}):d.invoke(i,l,e);else{var p=this._receiverAt(t);"function"==typeof u?u.call(p,e,l):p instanceof n&&p._isProxied()?p._progressUnchecked(e):o(p,l)&&p._promiseProgressed(e,l)}}}}},{"./async.js":84,"./errors.js":91,"./util.js":119}],101:[function(e,n){var o=e("__browserify_process");n.exports=function(){function n(e){return void 0===e?!1:e instanceof d}function f(e,n){return e instanceof w?n>=0:!1}function d(e){if("function"!=typeof e)throw new h("the promise constructor requires a resolver function");if(this.constructor!==d)throw new h("the promise constructor cannot be invoked directly");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,this._boundTo=void 0,e!==c&&this._resolveFromResolver(e)}function i(e,n){return t(e,w,n===!0&&e._isBound()?e._boundTo:void 0).promise()}function t(e,o,f){var i=null;return M(e)?i=e:(i=d._cast(e,void 0),i!==e?i._setBoundTo(f):n(i)||(i=null)),null!==i?new o(i,f):{promise:function(){return D("expecting an array, a promise or a thenable")}}}var u=e("./global.js"),l=e("./util.js"),p=e("./async.js"),P=e("./errors.js"),c=function(){},s={},y={e:null},w=e("./promise_array.js")(d,c),a=e("./captured_trace.js")(),b=e("./catch_filter.js")(y),r=e("./promise_resolver.js"),M=l.isArray,X=l.errorObj,g=l.tryCatch1,m=l.tryCatch2,x=l.tryCatchApply,j=P.RangeError,h=P.TypeError,k=P.CancellationError,q=P.TimeoutError,v=P.RejectionError,z=P.originatesFromRejection,A=P.markAsOriginatingFromRejection,B=P.canAttach,C=l.thrower,D=e("./errors_api_rejection")(d),E=function(){return new h("circular promise resolution chain")};d.prototype.bind=function(e){var n=new d(c);return n._setTrace(this),n._follow(this),n._setBoundTo(e),this._cancellable()&&(n._setCancellable(),n._cancellationParent=this),n},d.prototype.toString=function(){return"[object Promise]"},d.prototype.caught=d.prototype["catch"]=function(e){var n=arguments.length;if(n>1){var o,f=new Array(n-1),d=0;for(o=0;n-1>o;++o){var i=arguments[o];if("function"!=typeof i){var t=new h("A catch filter must be an error constructor or a filter function");return this._attachExtraTrace(t),void p.invoke(this._reject,this,t)}f[d++]=i}f.length=d,e=arguments[o],this._resetTrace();var u=new b(f,e,this);return this._then(void 0,u.doFilter,void 0,u,void 0)}return this._then(void 0,e,void 0,void 0,void 0)},d.prototype.then=function(e,n,o){return this._then(e,n,o,void 0,void 0)},d.prototype.done=function(e,n,o){var f=this._then(e,n,o,void 0,void 0);f._setIsFinal()},d.prototype.spread=function(e,n){return this._then(e,n,void 0,s,void 0)},d.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable()},d.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this._settledValue,e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this._settledValue,e.isRejected=!0),e},d.prototype.all=function(){return i(this,!0)},d.is=n,d.all=function(e){return i(e,!1)},d.join=function(){for(var e=arguments.length,n=new Array(e),o=0;e>o;++o)n[o]=arguments[o];return t(n,w,void 0).promise()},d.resolve=d.fulfilled=function(e){var n=new d(c);return n._setTrace(void 0),n._tryFollow(e)?n:(n._cleanValues(),n._setFulfilled(),n._settledValue=e,n)},d.reject=d.rejected=function(e){var n=new d(c);if(n._setTrace(void 0),A(e),n._cleanValues(),n._setRejected(),n._settledValue=e,!B(e)){var o=new Error(e+"");n._setCarriedStackTrace(o)}return n._ensurePossibleRejectionHandled(),n},d.prototype.error=function(e){return this.caught(z,e)},d.prototype._resolveFromSyncValue=function(e){if(e===X)this._cleanValues(),this._setRejected(),this._settledValue=e.e,this._ensurePossibleRejectionHandled();else{var n=d._cast(e,void 0);n instanceof d?this._follow(n):(this._cleanValues(),this._setFulfilled(),this._settledValue=e)}},d.method=function(e){if("function"!=typeof e)throw new h("fn must be a function");return function(){var n;switch(arguments.length){case 0:n=g(e,this,void 0);break;case 1:n=g(e,this,arguments[0]);break;case 2:n=m(e,this,arguments[0],arguments[1]);break;default:for(var o=arguments.length,f=new Array(o),i=0;o>i;++i)f[i]=arguments[i];n=x(e,f,this)}var t=new d(c);return t._setTrace(void 0),t._resolveFromSyncValue(n),t}},d.attempt=d["try"]=function(e,n,o){if("function"!=typeof e)return D("fn must be a function");var f=M(n)?x(e,n,o):g(e,o,n),i=new d(c);return i._setTrace(void 0),i._resolveFromSyncValue(f),i},d.defer=d.pending=function(){var e=new d(c);return e._setTrace(void 0),new r(e)},d.bind=function(e){var n=new d(c);return n._setTrace(void 0),n._setFulfilled(),n._setBoundTo(e),n},d.cast=function(e){var n=d._cast(e,void 0);return n instanceof d?n:d.resolve(n)},d.onPossiblyUnhandledRejection=function(e){a.possiblyUnhandledRejection="function"==typeof e?e:void 0};var F;d.onUnhandledRejectionHandled=function(e){F="function"==typeof e?e:void 0};var G=!1||!("undefined"==typeof o||"string"!=typeof o.execPath||"object"!=typeof o.env||!o.env.BLUEBIRD_DEBUG&&"development"!==o.env.NODE_ENV);d.longStackTraces=function(){if(p.haveItemsQueued()&&G===!1)throw new Error("cannot enable long stack traces after promises have been created");G=a.isSupported()},d.hasLongStackTraces=function(){return G&&a.isSupported()},d.prototype._setProxyHandlers=function(e,n){var o=this._length();if(o>=524282&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=e;else{var f=o-5;this[f+3]=n,this[f+4]=e,this[f+0]=this[f+1]=this[f+2]=void 0}this._setLength(o+5)},d.prototype._proxyPromiseArray=function(e,n){this._setProxyHandlers(e,n)},d.prototype._proxyPromise=function(e){e._setProxied(),this._setProxyHandlers(e,-1)},d.prototype._then=function(e,n,o,f,i){var t=void 0!==i,u=t?i:new d(c);if(G&&!t){var l=this._peekContext()===this._traceParent;u._traceParent=l?this._traceParent:this,u._setTrace(this)}!t&&this._isBound()&&u._setBoundTo(this._boundTo);var P=this._addCallbacks(e,n,o,u,f);return!t&&this._cancellable()&&(u._setCancellable(),u._cancellationParent=this),this.isResolved()&&p.invoke(this._queueSettleAt,this,P),u},d.prototype._length=function(){return 524287&this._bitField},d.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},d.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},d.prototype._setLength=function(e){this._bitField=-524288&this._bitField|524287&e},d.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},d.prototype._setRejected=function(){this._bitField=134217728|this._bitField},d.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},d.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},d.prototype._isFinal=function(){return(33554432&this._bitField)>0},d.prototype._cancellable=function(){return(67108864&this._bitField)>0},d.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},d.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},d.prototype._setRejectionIsUnhandled=function(){this._bitField=2097152|this._bitField},d.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-2097153&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},d.prototype._isRejectionUnhandled=function(){return(2097152&this._bitField)>0},d.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=524288|this._bitField},d.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-524289&this._bitField},d.prototype._isUnhandledRejectionNotified=function(){return(524288&this._bitField)>0},d.prototype._setCarriedStackTrace=function(e){this._bitField=1048576|this._bitField,this._fulfillmentHandler0=e},d.prototype._unsetCarriedStackTrace=function(){this._bitField=-1048577&this._bitField,this._fulfillmentHandler0=void 0},d.prototype._isCarryingStackTrace=function(){return(1048576&this._bitField)>0},d.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:void 0},d.prototype._receiverAt=function(e){var n;return n=0===e?this._receiver0:this[e+4-5],this._isBound()&&void 0===n?this._boundTo:n},d.prototype._promiseAt=function(e){return 0===e?this._promise0:this[e+3-5]},d.prototype._fulfillmentHandlerAt=function(e){return 0===e?this._fulfillmentHandler0:this[e+0-5]},d.prototype._rejectionHandlerAt=function(e){return 0===e?this._rejectionHandler0:this[e+1-5]},d.prototype._unsetAt=function(e){0===e?(this._rejectionHandler0=this._progressHandler0=this._promise0=this._receiver0=void 0,this._isCarryingStackTrace()||(this._fulfillmentHandler0=void 0)):this[e-5+0]=this[e-5+1]=this[e-5+2]=this[e-5+3]=this[e-5+4]=void 0},d.prototype._resolveFromResolver=function(e){function n(e){f._tryFollow(e)||f._fulfill(e)}function o(e){var n=B(e)?e:new Error(e+"");f._attachExtraTrace(n),A(e),f._reject(e,n===e?void 0:n)}var f=this;this._setTrace(void 0),this._pushContext();var d=m(e,void 0,n,o);if(this._popContext(),void 0!==d&&d===X){var i=d.e,t=B(i)?i:new Error(i+"");f._reject(i,t)}},d.prototype._addCallbacks=function(e,n,o,f,d){var i=this._length();if(i>=524282&&(i=0,this._setLength(0)),0===i)this._promise0=f,void 0!==d&&(this._receiver0=d),"function"!=typeof e||this._isCarryingStackTrace()||(this._fulfillmentHandler0=e),"function"==typeof n&&(this._rejectionHandler0=n),"function"==typeof o&&(this._progressHandler0=o);else{var t=i-5;this[t+3]=f,this[t+4]=d,this[t+0]="function"==typeof e?e:void 0,this[t+1]="function"==typeof n?n:void 0,this[t+2]="function"==typeof o?o:void 0}return this._setLength(i+5),i},d.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=8388608|this._bitField,this._boundTo=e):this._bitField=-8388609&this._bitField},d.prototype._isBound=function(){return 8388608===(8388608&this._bitField)},d.prototype._spreadSlowCase=function(e,n,o,f){var d=t(o,w,f).promise()._then(function(){return e.apply(f,arguments)},void 0,void 0,s,void 0);n._follow(d)},d.prototype._callSpread=function(e,o,f,i){var t=this._isBound()?this._boundTo:void 0;if(M(f))for(var u=0,l=f.length;l>u;++u)if(n(d._cast(f[u],void 0)))return void this._spreadSlowCase(e,o,f,t);return i&&o._pushContext(),x(e,f,t)},d.prototype._callHandler=function(e,n,o,f,d){var i;return n!==s||this.isRejected()?(d&&o._pushContext(),i=g(e,n,f)):i=this._callSpread(e,o,f,d),d&&o._popContext(),i},d.prototype._settlePromiseFromHandler=function(e,o,f,i){if(!n(i))return void e.call(o,f,i);var t=G,u=this._callHandler(e,o,i,f,t);if(!i._isFollowing())if(u===X||u===i||u===y){var l=u===i?E():u.e,p=B(l)?l:new Error(l+"");u!==y&&i._attachExtraTrace(p),i._rejectUnchecked(l,p)}else{var P=d._cast(u,i);if(n(P)){if(P.isRejected()&&!P._isCarryingStackTrace()&&!B(P._settledValue)){var p=new Error(P._settledValue+"");i._attachExtraTrace(p),P._setCarriedStackTrace(p)}i._follow(P),P._cancellable()&&(i._cancellationParent=P,i._setCancellable())}else i._fulfillUnchecked(u)}},d.prototype._follow=function(e){this._setFollowing(),e.isPending()?(e._cancellable()&&(this._cancellationParent=e,this._setCancellable()),e._proxyPromise(this)):e.isFulfilled()?this._fulfillUnchecked(e._settledValue):this._rejectUnchecked(e._settledValue,e._getCarriedStackTrace()),e._isRejectionUnhandled()&&e._unsetRejectionIsUnhandled(),G&&null==e._traceParent&&(e._traceParent=this)},d.prototype._tryFollow=function(e){if(this._isFollowingOrFulfilledOrRejected()||e===this)return!1;var o=d._cast(e,void 0);return n(o)?(this._follow(o),!0):!1},d.prototype._resetTrace=function(){G&&(this._trace=new a(void 0===this._peekContext()))},d.prototype._setTrace=function(e){if(G){var n=this._peekContext();this._traceParent=n;var o=void 0===n;this._trace=void 0!==e&&e._traceParent===n?e._trace:new a(o)}return this},d.prototype._attachExtraTrace=function(e){if(G){var n=this,o=e.stack;o="string"==typeof o?o.split("\n"):[];for(var f=1;null!=n&&null!=n._trace;)o=a.combine(o,n._trace.stack.split("\n")),n=n._traceParent;var d=Error.stackTraceLimit+f,i=o.length;i>d&&(o.length=d),e.stack=o.length<=f?"(No stack trace)":o.join("\n")}},d.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},d.prototype._fulfill=function(e){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(e)},d.prototype._reject=function(e,n){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(e,n)},d.prototype._settlePromiseAt=function(e){var n=this.isFulfilled()?this._fulfillmentHandlerAt(e):this._rejectionHandlerAt(e),o=this._settledValue,i=this._receiverAt(e),t=this._promiseAt(e);if("function"==typeof n)this._settlePromiseFromHandler(n,i,o,t);else{var u=!1,l=this.isFulfilled();void 0!==i&&(i instanceof d&&i._isProxied()?(i._unsetProxied(),l?i._fulfillUnchecked(o):i._rejectUnchecked(o,this._getCarriedStackTrace()),u=!0):f(i,t)&&(l?i._promiseFulfilled(o,t):i._promiseRejected(o,t),u=!0)),u||(l?t._fulfill(o):t._reject(o,this._getCarriedStackTrace()))}e>=256&&this._queueGC()},d.prototype._isProxied=function(){return 4194304===(4194304&this._bitField)},d.prototype._setProxied=function(){this._bitField=4194304|this._bitField},d.prototype._unsetProxied=function(){this._bitField=-4194305&this._bitField},d.prototype._isGcQueued=function(){return-1073741824===(-1073741824&this._bitField)},d.prototype._setGcQueued=function(){this._bitField=-1073741824|this._bitField},d.prototype._unsetGcQueued=function(){this._bitField=1073741823&this._bitField},d.prototype._queueGC=function(){this._isGcQueued()||(this._setGcQueued(),p.invokeLater(this._gc,this,void 0))},d.prototype._gc=function(){var e=this._length();this._unsetAt(0);for(var n=0;e>n;n++)delete this[n];this._setLength(0),this._unsetGcQueued()},d.prototype._queueSettleAt=function(e){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),p.invoke(this._settlePromiseAt,this,e)},d.prototype._fulfillUnchecked=function(e){if(this.isPending()){if(e===this){var n=E();return this._attachExtraTrace(n),this._rejectUnchecked(n,void 0)}this._cleanValues(),this._setFulfilled(),this._settledValue=e;var o=this._length();o>0&&p.invoke(this._settlePromises,this,o)}},d.prototype._rejectUncheckedCheckError=function(e){var n=B(e)?e:new Error(e+"");this._rejectUnchecked(e,n===e?void 0:n)},d.prototype._rejectUnchecked=function(e,n){if(this.isPending()){if(e===this){var o=E();return this._attachExtraTrace(o),this._rejectUnchecked(o)}if(this._cleanValues(),this._setRejected(),this._settledValue=e,this._isFinal())return void p.invokeLater(C,void 0,void 0===n?e:n);var f=this._length();void 0!==n&&this._setCarriedStackTrace(n),f>0?p.invoke(this._rejectPromises,this,null):this._ensurePossibleRejectionHandled()}},d.prototype._rejectPromises=function(){this._settlePromises(),this._unsetCarriedStackTrace()},d.prototype._settlePromises=function(){for(var e=this._length(),n=0;e>n;n+=5)this._settlePromiseAt(n)},d.prototype._ensurePossibleRejectionHandled=function(){this._setRejectionIsUnhandled(),void 0!==a.possiblyUnhandledRejection&&p.invokeLater(this._notifyUnhandledRejection,this,void 0)},d.prototype._notifyUnhandledRejectionIsHandled=function(){"function"==typeof F&&p.invokeLater(F,void 0,this)},d.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue,n=this._getCarriedStackTrace();this._setUnhandledRejectionIsNotified(),void 0!==n&&(this._unsetCarriedStackTrace(),e=n),"function"==typeof a.possiblyUnhandledRejection&&a.possiblyUnhandledRejection(e,this)}};var H=[];d.prototype._peekContext=function(){var e=H.length-1;return e>=0?H[e]:void 0},d.prototype._pushContext=function(){G&&H.push(this)},d.prototype._popContext=function(){G&&H.pop()};var I=u.Promise;return d.noConflict=function(){return u.Promise===d&&(u.Promise=I),d},a.isSupported()||(d.longStackTraces=function(){},G=!1),d._makeSelfResolutionError=E,e("./finally.js")(d,y),e("./direct_resolve.js")(d),e("./thenables.js")(d,c),e("./synchronous_inspection.js")(d),d.RangeError=j,d.CancellationError=k,d.TimeoutError=q,d.TypeError=h,d.RejectionError=v,l.toFastProperties(d),l.toFastProperties(d.prototype),e("./timers.js")(d,c),e("./any.js")(d,t,w),e("./race.js")(d,c),e("./call_get.js")(d),e("./filter.js")(d,t,w,D),e("./generators.js")(d,D,c),e("./map.js")(d,w,c,D),e("./nodeify.js")(d),e("./promisify.js")(d,c),e("./props.js")(d,w),e("./reduce.js")(d,t,w,D,c),e("./settle.js")(d,t,w),e("./some.js")(d,t,w,D),e("./progress.js")(d,f),e("./cancel.js")(d,c),d.prototype=d.prototype,d}},{"./any.js":83,"./async.js":84,"./call_get.js":86,"./cancel.js":87,"./captured_trace.js":88,"./catch_filter.js":89,"./direct_resolve.js":90,"./errors.js":91,"./errors_api_rejection":92,"./filter.js":94,"./finally.js":95,"./generators.js":96,"./global.js":97,"./map.js":98,"./nodeify.js":99,"./progress.js":100,"./promise_array.js":102,"./promise_resolver.js":103,"./promisify.js":105,"./props.js":107,"./race.js":109,"./reduce.js":110,"./settle.js":112,"./some.js":114,"./synchronous_inspection.js":116,"./thenables.js":117,"./timers.js":118,"./util.js":119,__browserify_process:135}],102:[function(e,n){"use strict";
n.exports=function(n,o){function f(e){switch(e){case-1:return void 0;case-2:return[];case-3:return{}}}function d(e,f){var d=this._promise=new n(o),i=void 0;e instanceof n&&(i=e,e._cancellable()&&(d._setCancellable(),d._cancellationParent=e),e._isBound()&&d._setBoundTo(f)),d._setTrace(i),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var i=e("./errors.js").canAttach,t=e("./util.js"),u=e("./async.js"),l={}.hasOwnProperty,p=t.isArray;return d.PropertiesPromiseArray=function(){},d.prototype.length=function(){return this._length},d.prototype.promise=function(){return this._promise},d.prototype._init=function(e,o){var i=this._values;if(i instanceof n){if(!i.isFulfilled())return i.isPending()?void i._then(this._init,this._reject,void 0,this,o):(i._unsetRejectionIsUnhandled(),void this._reject(i._settledValue));if(i=i._settledValue,!p(i)){var t=new n.TypeError("expecting an array, a promise or a thenable");return void this.__hardReject__(t)}this._values=i}if(0===i.length)return void this._resolve(f(o));var P,c=i.length,s=c;P=this instanceof d.PropertiesPromiseArray?this._values:new Array(c);for(var y=!1,w=0;c>w;++w){var a=i[w];if(void 0!==a||l.call(i,w)){var b=n._cast(a,void 0);b instanceof n?b.isPending()?b._proxyPromiseArray(this,w):(b._unsetRejectionIsUnhandled(),y=!0):y=!0,P[w]=b}else s--}if(0===s)return void this._resolve(-2===o?P:f(o));if(this._values=P,this._length=s,y){var r=s===c?this._scanDirectValues:this._scanDirectValuesHoled;u.invoke(r,this,c)}},d.prototype._settlePromiseAt=function(e){var o=this._values[e];o instanceof n?o.isFulfilled()?this._promiseFulfilled(o._settledValue,e):o.isRejected()&&this._promiseRejected(o._settledValue,e):this._promiseFulfilled(o,e)},d.prototype._scanDirectValuesHoled=function(e){for(var n=0;e>n&&!this._isResolved();++n)l.call(this._values,n)&&this._settlePromiseAt(n)},d.prototype._scanDirectValues=function(e){for(var n=0;e>n&&!this._isResolved();++n)this._settlePromiseAt(n)},d.prototype._isResolved=function(){return null===this._values},d.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},d.prototype.__hardReject__=d.prototype._reject=function(e){this._values=null;var n=i(e)?e:new Error(e+"");this._promise._attachExtraTrace(n),this._promise._reject(e,n)},d.prototype._promiseProgressed=function(e,n){this._isResolved()||this._promise._progress({index:n,value:e})},d.prototype._promiseFulfilled=function(e,n){if(!this._isResolved()){this._values[n]=e;var o=++this._totalResolved;o>=this._length&&this._resolve(this._values)}},d.prototype._promiseRejected=function(e){this._isResolved()||(this._totalResolved++,this._reject(e))},d}},{"./async.js":84,"./errors.js":91,"./util.js":119}],103:[function(e,n){"use strict";function o(e){return e instanceof Error&&y.getPrototypeOf(e)===Error.prototype}function f(e){var n;return n=o(e)?new P(e):e,l.markAsOriginatingFromRejection(n),n}function d(e){function n(n,o){if(null!==e){if(n){var d=f(u(n));e._attachExtraTrace(d),e._reject(d)}else if(arguments.length>2){for(var i=arguments.length,t=new Array(i-1),l=1;i>l;++l)t[l-1]=arguments[l];e._fulfill(t)}else e._fulfill(o);e=null}}return n}var i,t=e("./util.js"),u=t.maybeWrapAsError,l=e("./errors.js"),p=l.TimeoutError,P=l.RejectionError,c=e("./async.js"),s=t.haveGetters,y=e("./es5.js");if(i=s?function(e){this.promise=e}:function(e){this.promise=e,this.asCallback=d(e),this.callback=this.asCallback},s){var w={get:function(){return d(this.promise)}};y.defineProperty(i.prototype,"asCallback",w),y.defineProperty(i.prototype,"callback",w)}i._nodebackForPromise=d,i.prototype.toString=function(){return"[object PromiseResolver]"},i.prototype.resolve=i.prototype.fulfill=function(e){var n=this.promise;n._tryFollow(e)||c.invoke(n._fulfill,n,e)},i.prototype.reject=function(e){var n=this.promise;l.markAsOriginatingFromRejection(e);var o=l.canAttach(e)?e:new Error(e+"");n._attachExtraTrace(o),c.invoke(n._reject,n,e),o!==e&&c.invoke(this._setCarriedStackTrace,this,o)},i.prototype.progress=function(e){c.invoke(this.promise._progress,this.promise,e)},i.prototype.cancel=function(){c.invoke(this.promise.cancel,this.promise,void 0)},i.prototype.timeout=function(){this.reject(new p("timeout"))},i.prototype.isResolved=function(){return this.promise.isResolved()},i.prototype.toJSON=function(){return this.promise.toJSON()},i.prototype._setCarriedStackTrace=function(e){this.promise.isRejected()&&this.promise._setCarriedStackTrace(e)},n.exports=i},{"./async.js":84,"./errors.js":91,"./es5.js":93,"./util.js":119}],104:[function(e,n){"use strict";n.exports=function(n,o){function f(e){for(var o=c,d=p,i=n,t=o.length,u=0;t>u;++u){var l=P(o[u],void 0,e);if(l===d)return i.reject(d.e);var s=i._cast(l,f,void 0);if(s instanceof i)return s}return null}function d(e,f){var d=this._promise=new n(o);d._setTrace(void 0),this._generatorFunction=e,this._receiver=f,this._generator=void 0}var i=e("./errors.js"),t=i.TypeError,u=e("./util.js"),l=u.isArray,p=u.errorObj,P=u.tryCatch1,c=[];return d.prototype.promise=function(){return this._promise},d.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._next(void 0)},d.prototype._continue=function s(e){if(e===p){this._generator=void 0;var o=i.canAttach(e.e)?e.e:new Error(e.e+"");return this._promise._attachExtraTrace(o),void this._promise._reject(e.e,o)}var d=e.value;if(e.done===!0)this._generator=void 0,this._promise._tryFollow(d)||this._promise._fulfill(d);else{var u=n._cast(d,s,void 0);if(!(u instanceof n)&&(u=l(u)?n.all(u):f(u),null===u))return void this._throw(new t("A value was yielded that could not be treated as a promise"));u._then(this._next,this._throw,void 0,this,null)}},d.prototype._throw=function(e){i.canAttach(e)&&this._promise._attachExtraTrace(e),this._continue(P(this._generator["throw"],this._generator,e))},d.prototype._next=function(e){this._continue(P(this._generator.next,this._generator,e))},d.addYieldHandler=function(e){if("function"!=typeof e)throw new t("fn must be a function");c.push(e)},d}},{"./errors.js":91,"./util.js":119}],105:[function(e,n){"use strict";n.exports=function(n,o){function f(e){return e.__isPromisified__===!0}function d(e,n){var o=n+"Async"in e;return o?f(e[n+"Async"]):!1}function i(e){for(var n=0;n<e.length;n+=2){var o=e[n];if(x.test(o))for(var f=o.replace(x,""),d=0;d<e.length;d+=2)if(e[d]===f)throw new m("Cannot promisify an API that has normal methods with Async-suffix")}}function t(e){for(var n=[e],o=Math.max(0,e-1-5),f=e-1;f>=o;--f)f!==e&&n.push(f);for(var f=e+1;5>=f;++f)n.push(f);return n}function u(e){for(var n=new Array(e),o=0;o<n.length;++o)n[o]="_arg"+o;return n.join(", ")}function l(e){return"number"==typeof e.length?Math.max(Math.min(e.length,1024),0):0}function p(e){var n=/^[a-z$_][a-z$_0-9]*$/i;return n.test(e)?"."+e:"['"+e.replace(/(['\\])/g,"\\$1")+"']"}function P(e,f,d,i){function P(n){for(var o=new Array(n),d=0,i=o.length;i>d;++d)o[d]="arguments["+d+"]";var t=n>0?",":"";return"string"==typeof e&&f===y?"this"+p(e)+"("+o.join(",")+t+" fn);break;":(void 0===f?"callback("+o.join(",")+t+" fn);":"callback.call("+(f===y?"this":"receiver")+", "+o.join(",")+t+" fn);")+"break;"}function c(){for(var n="",o=0;o<w.length;++o)n+="case "+w[o]+":"+P(w[o]);return n+="default: var args = new Array(len + 1);var i = 0;for (var i = 0; i < len; ++i) { args[i] = arguments[i];}args[i] = fn;"+("string"==typeof e?"this"+p(e)+".apply(":"callback.apply(")+(f===y?"this":"receiver")+", args); break;"}var s=Math.max(0,l(i)-1),w=t(s),a="string"==typeof d?d+"Async":"promisified";return new Function("Promise","callback","receiver","withAppended","maybeWrapAsError","nodebackForPromise","INTERNAL","var ret = function "+a+"("+u(s)+') {"use strict";var len = arguments.length;var promise = new Promise(INTERNAL);promise._setTrace(void 0);var fn = nodebackForPromise(promise);try {switch(len) {'+c()+"}}catch(e){ var wrapped = maybeWrapAsError(e);promise._attachExtraTrace(wrapped);promise._reject(wrapped);}return promise;}; ret.__isPromisified__ = true; return ret;")(n,e,f,r,M,b,o)}function c(e,f){function d(){var d=f;f===y&&(d=this),"string"==typeof e&&(e=d[e]);var i=new n(o);i._setTrace(void 0);var t=b(i);try{e.apply(d,r(arguments,t))}catch(u){var l=M(u);i._attachExtraTrace(l),i._reject(l)}return i}return d.__isPromisified__=!0,d}function s(e,n,o){if(o){for(var f=j(e),d=0,i=f.length;i>d;d+=2){var t=f[d],u=f[d+1],l=t+"Async";e[l]=h(t,y,t,u)}return w.toFastProperties(e),e}return h(e,n,void 0,e)}var y={},w=e("./util.js"),a=e("./es5.js"),b=e("./promise_resolver.js")._nodebackForPromise,r=w.withAppended,M=w.maybeWrapAsError,X=w.canEvaluate,g=w.deprecated,m=e("./errors").TypeError,x=new RegExp("Async$"),j=function(){if(a.isES5){var e=Object.create,n=Object.getOwnPropertyDescriptor;return function(o){for(var t=[],u=e(null),l=o;null!==o;){for(var p=a.keys(o),P=0,c=p.length;c>P;++P){var s=p[P];if(!u[s]){u[s]=!0;var y=n(o,s);null==y||"function"!=typeof y.value||f(y.value)||d(l,s)||t.push(s,y.value)}}o=a.getPrototypeOf(o)}return i(t),t}}return function(e){var n=[];for(var o in e){var t=e[o];"function"!=typeof t||f(t)||d(e,o)||n.push(o,t)}return i(n),n}}(),h=X?P:c;n.promisify=function(e,n){if("object"==typeof e&&null!==e)return g("Promise.promisify for promisifying entire objects is deprecated. Use Promise.promisifyAll instead."),s(e,n,!0);if("function"!=typeof e)throw new m("fn must be a function");return f(e)?e:s(e,arguments.length<2?y:n,!1)},n.promisifyAll=function(e){if("function"!=typeof e&&"object"!=typeof e)throw new m("the target of promisifyAll must be an object or a function");return s(e,void 0,!0)}}},{"./errors":91,"./es5.js":93,"./promise_resolver.js":103,"./util.js":119}],106:[function(e,n){"use strict";n.exports=function(n,o){function f(e,n){for(var o=t.keys(e),f=new Array(o.length),d=0,i=f.length;i>d;++d)f[d]=e[o[d]];if(this.constructor$(f,n),!this._isResolved())for(var d=0,i=o.length;i>d;++d)f.push(o[d])}var d=e("./util.js"),i=d.inherits,t=e("./es5.js");return i(f,o),f.prototype._init=function(){this._init$(void 0,-3)},f.prototype._promiseFulfilled=function(e,n){if(!this._isResolved()){this._values[n]=e;var o=++this._totalResolved;if(o>=this._length){for(var f={},d=this.length(),i=0,t=this.length();t>i;++i)f[this._values[i+d]]=this._values[i];this._resolve(f)}}},f.prototype._promiseProgressed=function(e,n){this._isResolved()||this._promise._progress({key:this._values[n+this.length()],value:e})},o.PropertiesPromiseArray=f,f}},{"./es5.js":93,"./util.js":119}],107:[function(e,n){"use strict";n.exports=function(n,o){function f(e,o){var f,i=n._cast(e,void 0);return u(i)?(i instanceof n?f=i._then(n.props,void 0,void 0,void 0,void 0):(f=new d(i,o===!0&&i._isBound()?i._boundTo:void 0).promise(),o=!1),o===!0&&i._isBound()&&f._setBoundTo(i._boundTo),f):t("cannot await properties of a non-object")}var d=e("./properties_promise_array.js")(n,o),i=e("./util.js"),t=e("./errors_api_rejection")(n),u=i.isObject;n.prototype.props=function(){return f(this,!0)},n.props=function(e){return f(e,!1)}}},{"./errors_api_rejection":92,"./properties_promise_array.js":106,"./util.js":119}],108:[function(e,n){"use strict";function o(e,n,o,f,d){for(var i=0;d>i;++i)o[i+f]=e[i+n]}function f(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function d(e){return"number"!=typeof e?16:f(Math.min(Math.max(16,e),1073741824))}function i(e){this._capacity=d(e),this._length=0,this._front=0,this._makeCapacity()}i.prototype._willBeOverCapacity=function(e){return this._capacity<e},i.prototype._pushOne=function(e){var n=this.length();this._checkCapacity(n+1);var o=this._front+n&this._capacity-1;this[o]=e,this._length=n+1},i.prototype.push=function(e,n,o){var f=this.length()+3;if(this._willBeOverCapacity(f))return this._pushOne(e),this._pushOne(n),void this._pushOne(o);var d=this._front+f-3;this._checkCapacity(f);var i=this._capacity-1;this[d+0&i]=e,this[d+1&i]=n,this[d+2&i]=o,this._length=f},i.prototype.shift=function(){var e=this._front,n=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,n},i.prototype.length=function(){return this._length},i.prototype._makeCapacity=function(){for(var e=this._capacity,n=0;e>n;++n)this[n]=void 0},i.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<3)},i.prototype._resizeTo=function(e){var n=this._front,f=this._capacity,d=new Array(f),i=this.length();if(o(this,0,d,0,f),this._capacity=e,this._makeCapacity(),this._front=0,f>=n+i)o(d,n,this,0,i);else{var t=i-(n+i&f-1);o(d,n,this,0,t),o(d,0,this,t,i-t)}},n.exports=i},{}],109:[function(e,n){"use strict";n.exports=function(n,o){function f(e,f){var l=n._cast(e,void 0);if(l instanceof n)return t(l);if(!i(e))return d("expecting an array, a promise or a thenable");var p=new n(o);p._setTrace(f),void 0!==f&&(f._isBound()&&p._setBoundTo(f._boundTo),f._cancellable()&&(p._setCancellable(),p._cancellationParent=f));for(var P=p._fulfill,c=p._reject,s=0,y=e.length;y>s;++s){var w=e[s];(void 0!==w||u.call(e,s))&&n.cast(w)._then(P,c,void 0,p,null)}return p}var d=e("./errors_api_rejection.js")(n),i=e("./util.js").isArray,t=function(e){return e.then(function(n){return f(n,e)})},u={}.hasOwnProperty;n.race=function(e){return f(e,void 0)},n.prototype.race=function(){return f(this,void 0)}}},{"./errors_api_rejection.js":92,"./util.js":119}],110:[function(e,n){"use strict";n.exports=function(e,n,o,f,d){function i(n,o,f,i,t){this.promise=new e(d),this.index=o,this.length=i.length,this.items=i,this.callback=n,this.receiver=t,this.accum=f}function t(e,n){var o=this,f=void 0;"function"!=typeof o&&(f=o.receiver,o=o.fn);var d=e.length,t=void 0,u=0;void 0!==n?(t=n,u=0):(u=1,d>0&&(t=e[0]));var l=u;if(l>=d)return t;var p=new i(o,l,t,e,f);return p.iterate(),p.promise}function u(e){var n=this.fn,o=this.initialValue;return t.call(n,e,o)}function l(e,n,o,f){return o._then(function(o){return p(e,n,o,f)},void 0,void 0,void 0,void 0)}function p(d,i,p,P){if("function"!=typeof i)return f("fn must be a function");if(P===!0&&d._isBound()&&(i={fn:i,receiver:d._boundTo}),void 0!==p){if(p instanceof e){if(!p.isFulfilled())return l(d,i,p,P);p=p._settledValue}return n(d,o,P===!0&&d._isBound()?d._boundTo:void 0).promise()._then(u,void 0,void 0,{fn:i,initialValue:p},void 0)}return n(d,o,P===!0&&d._isBound()?d._boundTo:void 0).promise()._then(t,void 0,void 0,i,void 0)}i.prototype.reject=function(e){this.promise._reject(e)},i.prototype.fulfill=function(e,n){this.accum=e,this.index=n+1,this.iterate()},i.prototype.iterate=function(){for(var n=this.index,o=this.length,f=this.items,d=this.accum,i=this.receiver,t=this.callback;o>n;++n)if(d=t.call(i,d,f[n],n,o),d=e._cast(d,void 0),d instanceof e)return void d._then(this.fulfill,this.reject,void 0,this,n);this.promise._fulfill(d)},e.reduce=function(e,n,o){return p(e,n,o,!1)},e.prototype.reduce=function(e,n){return p(this,e,n,!0)}}},{}],111:[function(e,n){var o,f=e("__browserify_process"),d=e("./global.js");if("undefined"!=typeof f&&null!==f&&"function"==typeof f.cwd&&"function"==typeof f.nextTick&&"string"==typeof f.version)o=function(e){f.nextTick(e)};else if("function"!=typeof d.MutationObserver&&"function"!=typeof d.WebkitMutationObserver&&"function"!=typeof d.WebKitMutationObserver||"undefined"==typeof document||"function"!=typeof document.createElement)if("function"==typeof d.postMessage&&"function"!=typeof d.importScripts&&"function"==typeof d.addEventListener&&"function"==typeof d.removeEventListener){var i="bluebird_message_key_"+Math.random();o=function(){function e(e){if(e.source===d&&e.data===i){var o=n;n=void 0,o()}}var n=void 0;return d.addEventListener("message",e,!1),function(e){n=e,d.postMessage(i,"*")}}()}else o="function"==typeof d.MessageChannel?function(){var e=void 0,n=new d.MessageChannel;return n.port1.onmessage=function(){var n=e;e=void 0,n()},function(o){e=o,n.port2.postMessage(null)}}():d.setTimeout?function(e){setTimeout(e,4)}:function(e){e()};else o=function(){var e=d.MutationObserver||d.WebkitMutationObserver||d.WebKitMutationObserver,n=document.createElement("div"),o=void 0,f=new e(function(){var e=o;o=void 0,e()});return f.observe(n,{attributes:!0}),function(e){o=e,n.setAttribute("class","foo")}}();n.exports=o},{"./global.js":97,__browserify_process:135}],112:[function(e,n){"use strict";n.exports=function(n,o,f){function d(e,n){return o(e,i,n===!0&&e._isBound()?e._boundTo:void 0).promise()}var i=e("./settled_promise_array.js")(n,f);n.settle=function(e){return d(e,!1)},n.prototype.settle=function(){return d(this,!0)}}},{"./settled_promise_array.js":113}],113:[function(e,n){"use strict";n.exports=function(n,o){function f(e,n){this.constructor$(e,n)}var d=n.PromiseInspection,i=e("./util.js"),t=i.inherits;return t(f,o),f.prototype._promiseResolved=function(e,n){this._values[e]=n;var o=++this._totalResolved;o>=this._length&&this._resolve(this._values)},f.prototype._promiseFulfilled=function(e,n){if(!this._isResolved()){var o=new d;o._bitField=268435456,o._settledValue=e,this._promiseResolved(n,o)}},f.prototype._promiseRejected=function(e,n){if(!this._isResolved()){var o=new d;o._bitField=134217728,o._settledValue=e,this._promiseResolved(n,o)}},f}},{"./util.js":119}],114:[function(e,n){"use strict";n.exports=function(n,o,f,d){function i(e,n,f){if((0|n)!==n||0>n)return d("expecting a positive integer");var i=o(e,t,f===!0&&e._isBound()?e._boundTo:void 0),u=i.promise();return u.isRejected()?u:(i.setHowMany(n),i.init(),u)}var t=e("./some_promise_array.js")(f);n.some=function(e,n){return i(e,n,!1)},n.prototype.some=function(e){return i(this,e,!0)}}},{"./some_promise_array.js":115}],115:[function(e,n){"use strict";n.exports=function(n){function o(e,n){this.constructor$(e,n),this._howMany=0,this._unwrap=!1,this._initialized=!1}var f=e("./util.js"),d=e("./errors.js").RangeError,i=f.inherits,t=f.isArray;return i(o,n),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-2);var e=t(this._values);if(this._holes=e?this._values.length-this.length():0,!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()){var n="(Promise.some) input array contains less than "+this._howMany+" promises";this._reject(new d(n))}}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(e){this._isResolved()||(this._howMany=e)},o.prototype._promiseFulfilled=function(e){this._isResolved()||(this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values)))},o.prototype._promiseRejected=function(e){this._isResolved()||(this._addRejected(e),this.howMany()>this._canPossiblyFulfill()&&this._reject(this._values.length===this.length()?[]:this._values.slice(this.length()+this._holes)))},o.prototype._fulfilled=function(){return this._totalResolved},o.prototype._rejected=function(){return this._values.length-this.length()-this._holes},o.prototype._addRejected=function(e){this._values.push(e)},o.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},o.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},o}},{"./errors.js":91,"./util.js":119}],116:[function(e,n){"use strict";n.exports=function(e){function n(e){void 0!==e?(this._bitField=e._bitField,this._settledValue=e.isResolved()?e._settledValue:void 0):(this._bitField=0,this._settledValue=void 0)}n.prototype.isFulfilled=e.prototype.isFulfilled=function(){return(268435456&this._bitField)>0},n.prototype.isRejected=e.prototype.isRejected=function(){return(134217728&this._bitField)>0},n.prototype.isPending=e.prototype.isPending=function(){return 0===(402653184&this._bitField)},n.prototype.value=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise");return this._settledValue},n.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise");return this._settledValue},n.prototype.isResolved=e.prototype.isResolved=function(){return(402653184&this._bitField)>0},e.prototype.inspect=function(){return new n(this)},e.PromiseInspection=n}},{}],117:[function(e,n){"use strict";n.exports=function(n,o){function f(e){try{return e.then}catch(n){return p.e=n,p}}function d(e,d){if(P(e)){if(e instanceof n)return e;if(i(e)){var u=new n(o);return u._setTrace(void 0),e._then(u._fulfillUnchecked,u._rejectUncheckedCheckError,u._progressUnchecked,u,null),u._setFollowing(),u}var c=f(e);if(c===p)return void 0!==d&&l(c.e)&&d._attachExtraTrace(c.e),n.reject(c.e);if("function"==typeof c)return t(e,c,d)}return e}function i(e){return c.call(e,"_promise0")}function t(e,o,f){function d(o){if(!p){if(p=!0,e===o){var d=n._makeSelfResolutionError();return void 0!==f&&f._attachExtraTrace(d),void u.promise._reject(d,void 0)}u.resolve(o)}}function i(e){if(!p){p=!0;var n=l(e)?e:new Error(e+"");void 0!==f&&f._attachExtraTrace(n),u.promise._reject(e,n)}}function t(e){if(!p){var n=u.promise;"function"==typeof n._progress&&n._progress(e)}}var u=n.defer(),p=!1;try{o.call(e,d,i,t)}catch(P){if(!p){p=!0;var c=l(P)?P:new Error(P+"");void 0!==f&&f._attachExtraTrace(c),u.promise._reject(P,c)}}return u.promise}var u=e("./util.js"),l=e("./errors.js").canAttach,p=u.errorObj,P=u.isObject,c={}.hasOwnProperty;n._cast=d}},{"./errors.js":91,"./util.js":119}],118:[function(e,n){"use strict";var o=e("./global.js"),f=function(e,n){for(var f=arguments.length,d=new Array(f-2),i=2;f>i;++i)d[i-2]=arguments[i];o.setTimeout(function(){e.apply(void 0,d)},n)};n.exports=function(n,o){var d=(e("./util.js"),e("./errors.js")),i=(e("./errors_api_rejection")(n),n.TimeoutError),t=function(e,n,o){if(e.isPending()){"string"!=typeof n&&(n="operation timed out after "+o+" ms");var f=new i(n);d.markAsOriginatingFromRejection(f),e._attachExtraTrace(f),e._rejectUnchecked(f)}},u=function(e,n){n._fulfill(e)},l=n.delay=function(e,d){void 0===d&&(d=e,e=void 0),d=+d;var i=n._cast(e,void 0),t=new n(o);return i instanceof n?(i._isBound()&&t._setBoundTo(i._boundTo),i._cancellable()&&(t._setCancellable(),t._cancellationParent=i),t._setTrace(i),t._follow(i),t.then(function(e){return n.delay(e,d)})):(t._setTrace(void 0),f(u,d,e,t),t)};n.prototype.delay=function(e){return l(this,e)},n.prototype.timeout=function(e,d){e=+e;var i=new n(o);return i._setTrace(this),this._isBound()&&i._setBoundTo(this._boundTo),this._cancellable()&&(i._setCancellable(),i._cancellationParent=this),i._follow(this),f(t,e,i,d,e),i}}},{"./errors.js":91,"./errors_api_rejection":92,"./global.js":97,"./util.js":119}],119:[function(e,n,o){"use strict";function f(e){"undefined"!=typeof console&&null!==console&&"function"==typeof console.warn&&console.warn("Bluebird: "+e)}function d(e,n,o){try{return e.call(n,o)}catch(f){return X.e=f,X}}function i(e,n,o,f){try{return e.call(n,o,f)}catch(d){return X.e=d,X}}function t(e,n,o){try{return e.apply(o,n)}catch(f){return X.e=f,X}}function u(e){return"string"==typeof e?e:""+e}function l(e){return null==e||e===!0||e===!1||"string"==typeof e||"number"==typeof e}function p(e){return!l(e)}function P(e){return l(e)?new Error(u(e)):e}function c(e,n){var o,f=e.length,d=new Array(f+1);for(o=0;f>o;++o)d[o]=e[o];return d[o]=n,d}function s(e,n,o){if(l(e))return e;var f={value:o,configurable:!0,enumerable:!1,writable:!0};return b.defineProperty(e,n,f),e}function y(e){throw e}function w(e){function n(){}return n.prototype=e,n}var a=e("./global.js"),b=e("./es5.js"),r=function(){try{var e={};return b.defineProperty(e,"f",{get:function(){return 3}}),3===e.f}catch(n){return!1}}(),M=function(){return"undefined"!=typeof window&&null!==window&&"undefined"!=typeof window.document&&"undefined"!=typeof navigator&&null!==navigator&&"string"==typeof navigator.appName&&window===a?!1:!0}(),X={e:{}},g=function(e,n){function o(){this.constructor=e,this.constructor$=n;for(var o in n.prototype)f.call(n.prototype,o)&&"$"!==o.charAt(o.length-1)&&(this[o+"$"]=n.prototype[o])}var f={}.hasOwnProperty;return o.prototype=n.prototype,e.prototype=new o,e.prototype},m=function(){return"string"!==this}.call("string"),x={thrower:y,isArray:b.isArray,haveGetters:r,notEnumerableProp:s,isPrimitive:l,isObject:p,canEvaluate:M,deprecated:f,errorObj:X,tryCatch1:d,tryCatch2:i,tryCatchApply:t,inherits:g,withAppended:c,asString:u,maybeWrapAsError:P,wrapsPrimitiveReceiver:m,toFastProperties:w};n.exports=x},{"./es5.js":93,"./global.js":97}],120:[function(e,n){function o(e,n){if("function"!=typeof n)throw new Error("Bad callback given: "+n);if(!e)throw new Error("No options given");var t=e.onResponse;if(e="string"==typeof e?{uri:e}:JSON.parse(JSON.stringify(e)),e.onResponse=t,e.verbose&&(o.log=i()),e.url&&(e.uri=e.url,delete e.url),!e.uri&&""!==e.uri)throw new Error("options.uri is a required argument");if("string"!=typeof e.uri)throw new Error("options.uri must be a string");for(var u=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],p=0;p<u.length;p++)if(e[u[p]])throw new Error("options."+u[p]+" is not supported");if(e.callback=n,e.method=e.method||"GET",e.headers=e.headers||{},e.body=e.body||null,e.timeout=e.timeout||o.DEFAULT_TIMEOUT,e.headers.host)throw new Error("Options.headers.host is not supported");return e.json&&(e.headers.accept=e.headers.accept||"application/json","GET"!==e.method&&(e.headers["content-type"]="application/json"),"boolean"!=typeof e.json?e.body=JSON.stringify(e.json):"string"!=typeof e.body&&(e.body=JSON.stringify(e.body))),e.onResponse=e.onResponse||d,e.onResponse===!0&&(e.onResponse=n,e.callback=d),!e.headers.authorization&&e.auth&&(e.headers.authorization="Basic "+l(e.auth.username+":"+e.auth.password)),f(e)}function f(e){function n(){P=!0;var n=new Error("ETIMEDOUT");return n.code="ETIMEDOUT",n.duration=e.timeout,o.log.error("Timeout",{id:l._id,milliseconds:e.timeout}),e.callback(n,l)}function f(){if(P)return o.log.debug("Ignoring timed out state change",{state:l.readyState,id:l.id});if(o.log.debug("State change",{state:l.readyState,id:l.id,timed_out:P}),l.readyState===p.OPENED){o.log.debug("Request started",{id:l.id});for(var n in e.headers)l.setRequestHeader(n,e.headers[n])}else l.readyState===p.HEADERS_RECEIVED?d():l.readyState===p.LOADING?(d(),i()):l.readyState===p.DONE&&(d(),i(),t())}function d(){if(!a.response){if(a.response=!0,o.log.debug("Got response",{id:l.id,status:l.status}),clearTimeout(l.timeoutTimer),l.statusCode=l.status,s&&0==l.statusCode){var n=new Error("CORS request rejected: "+e.uri);return n.cors="rejected",a.loading=!0,a.end=!0,e.callback(n,l)}e.onResponse(null,l)}}function i(){a.loading||(a.loading=!0,o.log.debug("Response body loading",{id:l.id}))}function t(){if(!a.end){if(a.end=!0,o.log.debug("Request done",{id:l.id}),l.body=l.responseText,e.json)try{l.body=JSON.parse(l.responseText)}catch(n){return e.callback(n,l)}e.callback(null,l,l.body)}}var l=new p,P=!1,s=u(e.uri),y="withCredentials"in l;if(c+=1,l.seq_id=c,l.id=c+": "+e.method+" "+e.uri,l._id=l.id,s&&!y){var w=new Error("Browser does not support cross-origin request: "+e.uri);return w.cors="unsupported",e.callback(w,l)}l.timeoutTimer=setTimeout(n,e.timeout);var a={response:!1,loading:!1,end:!1};return l.onreadystatechange=f,l.open(e.method,e.uri,!0),s&&(l.withCredentials=!!e.withCredentials),l.send(e.body),l}function d(){}function i(){var e,n,o={},f=["trace","debug","info","warn","error"];for(n=0;n<f.length;n++)e=f[n],o[e]=d,"undefined"!=typeof console&&console&&console[e]&&(o[e]=t(console,e));return o}function t(e,n){function o(o,f){return"object"==typeof f&&(o+=" "+JSON.stringify(f)),e[n].call(e,o)}return o}function u(e){var n,o=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;try{n=location.href}catch(f){n=document.createElement("a"),n.href="",n=n.href}var d=o.exec(n.toLowerCase())||[],i=o.exec(e.toLowerCase()),t=!(!i||i[1]==d[1]&&i[2]==d[2]&&(i[3]||("http:"===i[1]?80:443))==(d[3]||("http:"===d[1]?80:443)));return t}function l(e){var n,o,f,d,i,t,u,l,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",P=0,c=0,s="",y=[];if(!e)return e;do n=e.charCodeAt(P++),o=e.charCodeAt(P++),f=e.charCodeAt(P++),l=n<<16|o<<8|f,d=l>>18&63,i=l>>12&63,t=l>>6&63,u=63&l,y[c++]=p.charAt(d)+p.charAt(i)+p.charAt(t)+p.charAt(u);while(P<e.length);switch(s=y.join(""),e.length%3){case 1:s=s.slice(0,-2)+"==";break;case 2:s=s.slice(0,-1)+"="}return s}var p=XMLHttpRequest;if(!p)throw new Error("missing XMLHttpRequest");n.exports=o,o.log={trace:d,debug:d,info:d,warn:d,error:d};var P=18e4,c=0;o.withCredentials=!1,o.DEFAULT_TIMEOUT=P,o.defaults=function(e){var n=function(n){var o=function(o,f){o="string"==typeof o?{uri:o}:JSON.parse(JSON.stringify(o));for(var d in e)void 0===o[d]&&(o[d]=e[d]);return n(o,f)};return o},f=n(o);return f.get=n(o.get),f.post=n(o.post),f.put=n(o.put),f.head=n(o.head),f};var s=["get","put","post","head"];s.forEach(function(e){var n=e.toUpperCase(),f=e.toLowerCase();o[f]=function(e){"string"==typeof e?e={method:n,uri:e}:(e=JSON.parse(JSON.stringify(e)),e.method=n);var f=[e].concat(Array.prototype.slice.apply(arguments,[1]));return o.apply(this,f)}}),o.couch=function(e,n){function f(e,o,f){if(e)return n(e,o,f);if((o.statusCode<200||o.statusCode>299)&&f.error){e=new Error("CouchDB error: "+(f.error.reason||f.error.error));for(var d in f)e[d]=f[d];return n(e,o,f)}return n(e,o,f)}"string"==typeof e&&(e={uri:e}),e.json=!0,e.body&&(e.json=e.body),delete e.body,n=n||d;var i=o(e,f);return i}},{}],121:[function(e,n,o){function f(e){return"[object Array]"===p.call(e)}function d(e,n){var o;if(null===e)o={__proto__:null};else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var f=function(){};f.prototype=e,o=new f,o.__proto__=e}return"undefined"!=typeof n&&Object.defineProperties&&Object.defineProperties(o,n),o}function i(e){return"object"!=typeof e&&"function"!=typeof e||null===e}function t(e){if(i(e))throw new TypeError("Object.keys called on a non-object");var n=[];for(var o in e)P.call(e,o)&&n.push(o);return n}function u(e){if(i(e))throw new TypeError("Object.getOwnPropertyNames called on a non-object");var n=t(e);return o.isArray(e)&&-1===o.indexOf(e,"length")&&n.push("length"),n}function l(e,n){return{value:e[n]}}var p=Object.prototype.toString,P=Object.prototype.hasOwnProperty;o.isArray="function"==typeof Array.isArray?Array.isArray:f,o.indexOf=function(e,n){if(e.indexOf)return e.indexOf(n);for(var o=0;o<e.length;o++)if(n===e[o])return o;return-1},o.filter=function(e,n){if(e.filter)return e.filter(n);for(var o=[],f=0;f<e.length;f++)n(e[f],f,e)&&o.push(e[f]);return o},o.forEach=function(e,n,o){if(e.forEach)return e.forEach(n,o);for(var f=0;f<e.length;f++)n.call(o,e[f],f,e)},o.map=function(e,n){if(e.map)return e.map(n);for(var o=new Array(e.length),f=0;f<e.length;f++)o[f]=n(e[f],f,e);return o},o.reduce=function(e,n,o){if(e.reduce)return e.reduce(n,o);var f,d=!1;2<arguments.length&&(f=o,d=!0);for(var i=0,t=e.length;t>i;++i)e.hasOwnProperty(i)&&(d?f=n(f,e[i],i,e):(f=e[i],d=!0));return f},o.substr="b"!=="ab".substr(-1)?function(e,n,o){return 0>n&&(n=e.length+n),e.substr(n,o)}:function(e,n,o){return e.substr(n,o)},o.trim=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},o.bind=function(){var e=Array.prototype.slice.call(arguments),n=e.shift();if(n.bind)return n.bind.apply(n,e);var o=e.shift();return function(){n.apply(o,e.concat([Array.prototype.slice.call(arguments)]))}},o.create="function"==typeof Object.create?Object.create:d;var c="function"==typeof Object.keys?Object.keys:t,s="function"==typeof Object.getOwnPropertyNames?Object.getOwnPropertyNames:u;if((new Error).hasOwnProperty("description")){var y=function(e,n){return"[object Error]"===p.call(e)&&(n=o.filter(n,function(e){return"description"!==e&&"number"!==e&&"message"!==e})),n};o.keys=function(e){return y(e,c(e))},o.getOwnPropertyNames=function(e){return y(e,s(e))}}else o.keys=c,o.getOwnPropertyNames=s;
if("function"==typeof Object.getOwnPropertyDescriptor)try{Object.getOwnPropertyDescriptor({a:1},"a"),o.getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor}catch(w){o.getOwnPropertyDescriptor=function(e,n){try{return Object.getOwnPropertyDescriptor(e,n)}catch(o){return l(e,n)}}}else o.getOwnPropertyDescriptor=l},{}],122:[function(e,n){function o(e,n){return s.isUndefined(n)?""+n:!s.isNumber(n)||!isNaN(n)&&isFinite(n)?s.isFunction(n)||s.isRegExp(n)?n.toString():n:n.toString()}function f(e,n){return s.isString(e)?e.length<n?e:e.slice(0,n):e}function d(e){return f(JSON.stringify(e.actual,o),128)+" "+e.operator+" "+f(JSON.stringify(e.expected,o),128)}function i(e,n,o,f,d){throw new a.AssertionError({message:o,actual:e,expected:n,operator:f,stackStartFunction:d})}function t(e,n){e||i(e,!0,n,"==",a.ok)}function u(e,n){if(e===n)return!0;if(s.isBuffer(e)&&s.isBuffer(n)){if(e.length!=n.length)return!1;for(var o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}return s.isDate(e)&&s.isDate(n)?e.getTime()===n.getTime():s.isRegExp(e)&&s.isRegExp(n)?e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.lastIndex===n.lastIndex&&e.ignoreCase===n.ignoreCase:s.isObject(e)||s.isObject(n)?p(e,n):e==n}function l(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function p(e,n){if(s.isNullOrUndefined(e)||s.isNullOrUndefined(n))return!1;if(e.prototype!==n.prototype)return!1;if(l(e))return l(n)?(e=w.call(e),n=w.call(n),u(e,n)):!1;try{var o,f,d=y.keys(e),i=y.keys(n)}catch(t){return!1}if(d.length!=i.length)return!1;for(d.sort(),i.sort(),f=d.length-1;f>=0;f--)if(d[f]!=i[f])return!1;for(f=d.length-1;f>=0;f--)if(o=d[f],!u(e[o],n[o]))return!1;return!0}function P(e,n){return e&&n?"[object RegExp]"==Object.prototype.toString.call(n)?n.test(e):e instanceof n?!0:n.call({},e)===!0?!0:!1:!1}function c(e,n,o,f){var d;s.isString(o)&&(f=o,o=null);try{n()}catch(t){d=t}if(f=(o&&o.name?" ("+o.name+").":".")+(f?" "+f:"."),e&&!d&&i(d,o,"Missing expected exception"+f),!e&&P(d,o)&&i(d,o,"Got unwanted exception"+f),e&&d&&o&&!P(d,o)||!e&&d)throw d}var s=e("util"),y=e("_shims"),w=Array.prototype.slice,a=n.exports=t;a.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,this.message=e.message||d(this)},s.inherits(a.AssertionError,Error),a.fail=i,a.ok=t,a.equal=function(e,n,o){e!=n&&i(e,n,o,"==",a.equal)},a.notEqual=function(e,n,o){e==n&&i(e,n,o,"!=",a.notEqual)},a.deepEqual=function(e,n,o){u(e,n)||i(e,n,o,"deepEqual",a.deepEqual)},a.notDeepEqual=function(e,n,o){u(e,n)&&i(e,n,o,"notDeepEqual",a.notDeepEqual)},a.strictEqual=function(e,n,o){e!==n&&i(e,n,o,"===",a.strictEqual)},a.notStrictEqual=function(e,n,o){e===n&&i(e,n,o,"!==",a.notStrictEqual)},a.throws=function(){c.apply(this,[!0].concat(w.call(arguments)))},a.doesNotThrow=function(){c.apply(this,[!1].concat(w.call(arguments)))},a.ifError=function(e){if(e)throw e}},{_shims:121,util:123}],123:[function(e,n,o){function f(e,n){var f={seen:[],stylize:i};return arguments.length>=3&&(f.depth=arguments[2]),arguments.length>=4&&(f.colors=arguments[3]),w(n)?f.showHidden=n:n&&o._extend(f,n),g(f.showHidden)&&(f.showHidden=!1),g(f.depth)&&(f.depth=2),g(f.colors)&&(f.colors=!1),g(f.customInspect)&&(f.customInspect=!0),f.colors&&(f.stylize=d),u(f,e,f.depth)}function d(e,n){var o=f.styles[n];return o?"["+f.colors[o][0]+"m"+e+"["+f.colors[o][1]+"m":e}function i(e){return e}function t(e){var n={};return D.forEach(e,function(e){n[e]=!0}),n}function u(e,n,f){if(e.customInspect&&n&&k(n.inspect)&&n.inspect!==o.inspect&&(!n.constructor||n.constructor.prototype!==n)){var d=n.inspect(f);return M(d)||(d=u(e,d,f)),d}var i=l(e,n);if(i)return i;var w=D.keys(n),a=t(w);if(e.showHidden&&(w=D.getOwnPropertyNames(n)),0===w.length){if(k(n)){var b=n.name?": "+n.name:"";return e.stylize("[Function"+b+"]","special")}if(m(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(j(n))return e.stylize(Date.prototype.toString.call(n),"date");if(h(n))return p(n)}var r="",X=!1,g=["{","}"];if(y(n)&&(X=!0,g=["[","]"]),k(n)){var x=n.name?": "+n.name:"";r=" [Function"+x+"]"}if(m(n)&&(r=" "+RegExp.prototype.toString.call(n)),j(n)&&(r=" "+Date.prototype.toUTCString.call(n)),h(n)&&(r=" "+p(n)),0===w.length&&(!X||0==n.length))return g[0]+r+g[1];if(0>f)return m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var q;return q=X?P(e,n,f,a,w):w.map(function(o){return c(e,n,f,a,o,X)}),e.seen.pop(),s(q,r,g)}function l(e,n){if(g(n))return e.stylize("undefined","undefined");if(M(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(o,"string")}return r(n)?e.stylize(""+n,"number"):w(n)?e.stylize(""+n,"boolean"):a(n)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function P(e,n,o,f,d){for(var i=[],t=0,u=n.length;u>t;++t)i.push(C(n,String(t))?c(e,n,o,f,String(t),!0):"");return D.forEach(d,function(d){d.match(/^\d+$/)||i.push(c(e,n,o,f,d,!0))}),i}function c(e,n,o,f,d,i){var t,l,p;if(p=D.getOwnPropertyDescriptor(n,d)||{value:n[d]},p.get?l=p.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):p.set&&(l=e.stylize("[Setter]","special")),C(f,d)||(t="["+d+"]"),l||(D.indexOf(e.seen,p.value)<0?(l=a(o)?u(e,p.value,null):u(e,p.value,o-1),l.indexOf("\n")>-1&&(l=i?l.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+l.split("\n").map(function(e){return" "+e}).join("\n"))):l=e.stylize("[Circular]","special")),g(t)){if(i&&d.match(/^\d+$/))return l;t=JSON.stringify(""+d),t.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(t=t.substr(1,t.length-2),t=e.stylize(t,"name")):(t=t.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t=e.stylize(t,"string"))}return t+": "+l}function s(e,n,o){var f=0,d=D.reduce(e,function(e,n){return f++,n.indexOf("\n")>=0&&f++,e+n.replace(/\u001b\[\d\d?m/g,"").length+1},0);return d>60?o[0]+(""===n?"":n+"\n ")+" "+e.join(",\n ")+" "+o[1]:o[0]+n+" "+e.join(", ")+" "+o[1]}function y(e){return D.isArray(e)}function w(e){return"boolean"==typeof e}function a(e){return null===e}function b(e){return null==e}function r(e){return"number"==typeof e}function M(e){return"string"==typeof e}function X(e){return"symbol"==typeof e}function g(e){return void 0===e}function m(e){return x(e)&&"[object RegExp]"===z(e)}function x(e){return"object"==typeof e&&e}function j(e){return x(e)&&"[object Date]"===z(e)}function h(e){return x(e)&&"[object Error]"===z(e)}function k(e){return"function"==typeof e}function q(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function v(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.binarySlice}function z(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function B(){var e=new Date,n=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),F[e.getMonth()],n].join(" ")}function C(e,n){return Object.prototype.hasOwnProperty.call(e,n)}var D=e("_shims"),E=/%[sdj%]/g;o.format=function(e){if(!M(e)){for(var n=[],o=0;o<arguments.length;o++)n.push(f(arguments[o]));return n.join(" ")}for(var o=1,d=arguments,i=d.length,t=String(e).replace(E,function(e){if("%%"===e)return"%";if(o>=i)return e;switch(e){case"%s":return String(d[o++]);case"%d":return Number(d[o++]);case"%j":try{return JSON.stringify(d[o++])}catch(n){return"[Circular]"}default:return e}}),u=d[o];i>o;u=d[++o])t+=a(u)||!x(u)?" "+u:" "+f(u);return t},o.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},o.isArray=y,o.isBoolean=w,o.isNull=a,o.isNullOrUndefined=b,o.isNumber=r,o.isString=M,o.isSymbol=X,o.isUndefined=g,o.isRegExp=m,o.isObject=x,o.isDate=j,o.isError=h,o.isFunction=k,o.isPrimitive=q,o.isBuffer=v;var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];o.log=function(){console.log("%s - %s",B(),o.format.apply(o,arguments))},o.inherits=function(e,n){e.super_=n,e.prototype=D.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},o._extend=function(e,n){if(!n||!x(n))return e;for(var o=D.keys(n),f=o.length;f--;)e[o[f]]=n[o[f]];return e}},{_shims:121}],124:[function(e,n,o){o.readIEEE754=function(e,n,o,f,d){var i,t,u=8*d-f-1,l=(1<<u)-1,p=l>>1,P=-7,c=o?0:d-1,s=o?1:-1,y=e[n+c];for(c+=s,i=y&(1<<-P)-1,y>>=-P,P+=u;P>0;i=256*i+e[n+c],c+=s,P-=8);for(t=i&(1<<-P)-1,i>>=-P,P+=f;P>0;t=256*t+e[n+c],c+=s,P-=8);if(0===i)i=1-p;else{if(i===l)return t?0/0:1/0*(y?-1:1);t+=Math.pow(2,f),i-=p}return(y?-1:1)*t*Math.pow(2,i-f)},o.writeIEEE754=function(e,n,o,f,d,i){var t,u,l,p=8*i-d-1,P=(1<<p)-1,c=P>>1,s=23===d?Math.pow(2,-24)-Math.pow(2,-77):0,y=f?i-1:0,w=f?-1:1,a=0>n||0===n&&0>1/n?1:0;for(n=Math.abs(n),isNaN(n)||1/0===n?(u=isNaN(n)?1:0,t=P):(t=Math.floor(Math.log(n)/Math.LN2),n*(l=Math.pow(2,-t))<1&&(t--,l*=2),n+=t+c>=1?s/l:s*Math.pow(2,1-c),n*l>=2&&(t++,l/=2),t+c>=P?(u=0,t=P):t+c>=1?(u=(n*l-1)*Math.pow(2,d),t+=c):(u=n*Math.pow(2,c-1)*Math.pow(2,d),t=0));d>=8;e[o+y]=255&u,y+=w,u/=256,d-=8);for(t=t<<d|u,p+=d;p>0;e[o+y]=255&t,y+=w,t/=256,p-=8);e[o+y-w]|=128*a}},{}],125:[function(e,n,o){function f(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function d(n,o,i){if(B||(B=e("assert")),!(this instanceof d))return new d(n,o,i);if(this.parent=this,this.offset=0,"base64"==o&&"string"==typeof n)for(n=f(n);n.length%4!=0;)n+="=";var u;if("number"==typeof i){this.length=t(o);for(var p=0;p<this.length;p++)this[p]=n.get(p+i)}else{switch(u=typeof n){case"number":this.length=t(n);break;case"string":this.length=d.byteLength(n,o);break;case"object":this.length=t(n.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(l(n))for(var p=0;p<this.length;p++)this[p]=n instanceof d?n.readUInt8(p):n[p];else if("string"==u)this.length=this.write(n,0,o);else if("number"===u)for(var p=0;p<this.length;p++)this[p]=0}}function i(e,n,o){return"number"!=typeof e?o:(e=~~e,e>=n?n:e>=0?e:(e+=n,e>=0?e:0))}function t(e){return e=~~Math.ceil(+e),0>e?0:e}function u(e){return(Array.isArray||function(e){return"[object Array]"=={}.toString.apply(e)})(e)}function l(e){return u(e)||d.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function p(e){return 16>e?"0"+e.toString(16):e.toString(16)}function P(e){for(var n=[],o=0;o<e.length;o++)if(e.charCodeAt(o)<=127)n.push(e.charCodeAt(o));else for(var f=encodeURIComponent(e.charAt(o)).substr(1).split("%"),d=0;d<f.length;d++)n.push(parseInt(f[d],16));return n}function c(e){for(var n=[],o=0;o<e.length;o++)n.push(255&e.charCodeAt(o));return n}function s(n){return e("base64-js").toByteArray(n)}function y(e,n,o,f){for(var d=0;f>d&&!(d+o>=n.length||d>=e.length);)n[d+o]=e[d],d++;return d}function w(e){try{return decodeURIComponent(e)}catch(n){return String.fromCharCode(65533)}}function a(e,n,o,f){var d=0;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+1<e.length,"Trying to read beyond buffer length")),n>=e.length?0:(o?(d=e[n]<<8,n+1<e.length&&(d|=e[n+1])):(d=e[n],n+1<e.length&&(d|=e[n+1]<<8)),d)}function b(e,n,o,f){var d=0;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+3<e.length,"Trying to read beyond buffer length")),n>=e.length?0:(o?(n+1<e.length&&(d=e[n+1]<<16),n+2<e.length&&(d|=e[n+2]<<8),n+3<e.length&&(d|=e[n+3]),d+=e[n]<<24>>>0):(n+2<e.length&&(d=e[n+2]<<16),n+1<e.length&&(d|=e[n+1]<<8),d|=e[n],n+3<e.length&&(d+=e[n+3]<<24>>>0)),d)}function r(e,n,o,f){var d,i;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+1<e.length,"Trying to read beyond buffer length")),i=a(e,n,o,f),d=32768&i,d?-1*(65535-i+1):i}function M(e,n,o,f){var d,i;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+3<e.length,"Trying to read beyond buffer length")),i=b(e,n,o,f),d=2147483648&i,d?-1*(4294967295-i+1):i}function X(n,o,f,d){return d||(B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(o+3<n.length,"Trying to read beyond buffer length")),e("./buffer_ieee754").readIEEE754(n,o,f,23,4)}function g(n,o,f,d){return d||(B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(o+7<n.length,"Trying to read beyond buffer length")),e("./buffer_ieee754").readIEEE754(n,o,f,52,8)}function m(e,n){B.ok("number"==typeof e,"cannot write a non-number as a number"),B.ok(e>=0,"specified a negative value for writing an unsigned value"),B.ok(n>=e,"value is larger than maximum value for type"),B.ok(Math.floor(e)===e,"value has a fractional component")}function x(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+1<e.length,"trying to write beyond buffer length"),m(n,65535));for(var i=0;i<Math.min(e.length-o,2);i++)e[o+i]=(n&255<<8*(f?1-i:i))>>>8*(f?1-i:i)}function j(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+3<e.length,"trying to write beyond buffer length"),m(n,4294967295));for(var i=0;i<Math.min(e.length-o,4);i++)e[o+i]=n>>>8*(f?3-i:i)&255}function h(e,n,o){B.ok("number"==typeof e,"cannot write a non-number as a number"),B.ok(n>=e,"value larger than maximum allowed value"),B.ok(e>=o,"value smaller than minimum allowed value"),B.ok(Math.floor(e)===e,"value has a fractional component")}function k(e,n,o){B.ok("number"==typeof e,"cannot write a non-number as a number"),B.ok(n>=e,"value larger than maximum allowed value"),B.ok(e>=o,"value smaller than minimum allowed value")}function q(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+1<e.length,"Trying to write beyond buffer length"),h(n,32767,-32768)),n>=0?x(e,n,o,f,d):x(e,65535+n+1,o,f,d)}function v(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+3<e.length,"Trying to write beyond buffer length"),h(n,2147483647,-2147483648)),n>=0?j(e,n,o,f,d):j(e,4294967295+n+1,o,f,d)}function z(n,o,f,d,i){i||(B.ok(void 0!==o&&null!==o,"missing value"),B.ok("boolean"==typeof d,"missing or invalid endian"),B.ok(void 0!==f&&null!==f,"missing offset"),B.ok(f+3<n.length,"Trying to write beyond buffer length"),k(o,3.4028234663852886e38,-3.4028234663852886e38)),e("./buffer_ieee754").writeIEEE754(n,o,f,d,23,4)}function A(n,o,f,d,i){i||(B.ok(void 0!==o&&null!==o,"missing value"),B.ok("boolean"==typeof d,"missing or invalid endian"),B.ok(void 0!==f&&null!==f,"missing offset"),B.ok(f+7<n.length,"Trying to write beyond buffer length"),k(o,1.7976931348623157e308,-1.7976931348623157e308)),e("./buffer_ieee754").writeIEEE754(n,o,f,d,52,8)}var B;o.Buffer=d,o.SlowBuffer=d,d.poolSize=8192,o.INSPECT_MAX_BYTES=50,d.prototype.get=function(e){if(0>e||e>=this.length)throw new Error("oob");return this[e]},d.prototype.set=function(e,n){if(0>e||e>=this.length)throw new Error("oob");return this[e]=n},d.byteLength=function(e,n){switch(n||"utf8"){case"hex":return e.length/2;case"utf8":case"utf-8":return P(e).length;case"ascii":case"binary":return e.length;case"base64":return s(e).length;default:throw new Error("Unknown encoding")}},d.prototype.utf8Write=function(e,n,o){return d._charsWritten=y(P(e),this,n,o)},d.prototype.asciiWrite=function(e,n,o){return d._charsWritten=y(c(e),this,n,o)},d.prototype.binaryWrite=d.prototype.asciiWrite,d.prototype.base64Write=function(e,n,o){return d._charsWritten=y(s(e),this,n,o)},d.prototype.base64Slice=function(){var n=Array.prototype.slice.apply(this,arguments);return e("base64-js").fromByteArray(n)},d.prototype.utf8Slice=function(){for(var e=Array.prototype.slice.apply(this,arguments),n="",o="",f=0;f<e.length;)e[f]<=127?(n+=w(o)+String.fromCharCode(e[f]),o=""):o+="%"+e[f].toString(16),f++;return n+w(o)},d.prototype.asciiSlice=function(){for(var e=Array.prototype.slice.apply(this,arguments),n="",o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n},d.prototype.binarySlice=d.prototype.asciiSlice,d.prototype.inspect=function(){for(var e=[],n=this.length,f=0;n>f;f++)if(e[f]=p(this[f]),f==o.INSPECT_MAX_BYTES){e[f+1]="...";break}return"<Buffer "+e.join(" ")+">"},d.prototype.hexSlice=function(e,n){var o=this.length;(!e||0>e)&&(e=0),(!n||0>n||n>o)&&(n=o);for(var f="",d=e;n>d;d++)f+=p(this[d]);return f},d.prototype.toString=function(e,n,o){if(e=String(e||"utf8").toLowerCase(),n=+n||0,"undefined"==typeof o&&(o=this.length),+o==n)return"";switch(e){case"hex":return this.hexSlice(n,o);case"utf8":case"utf-8":return this.utf8Slice(n,o);case"ascii":return this.asciiSlice(n,o);case"binary":return this.binarySlice(n,o);case"base64":return this.base64Slice(n,o);case"ucs2":case"ucs-2":return this.ucs2Slice(n,o);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(e,n,o){n=+n||0;var f=this.length-n;o?(o=+o,o>f&&(o=f)):o=f;var i=e.length;if(i%2)throw new Error("Invalid hex string");o>i/2&&(o=i/2);for(var t=0;o>t;t++){var u=parseInt(e.substr(2*t,2),16);if(isNaN(u))throw new Error("Invalid hex string");this[n+t]=u}return d._charsWritten=2*t,t},d.prototype.write=function(e,n,o,f){if(isFinite(n))isFinite(o)||(f=o,o=void 0);else{var d=f;f=n,n=o,o=d}n=+n||0;var i=this.length-n;switch(o?(o=+o,o>i&&(o=i)):o=i,f=String(f||"utf8").toLowerCase()){case"hex":return this.hexWrite(e,n,o);case"utf8":case"utf-8":return this.utf8Write(e,n,o);case"ascii":return this.asciiWrite(e,n,o);case"binary":return this.binaryWrite(e,n,o);case"base64":return this.base64Write(e,n,o);case"ucs2":case"ucs-2":return this.ucs2Write(e,n,o);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(e,n){var o=this.length;return e=i(e,o,0),n=i(n,o,o),new d(this,n-e,+e)},d.prototype.copy=function(e,n,o,f){var d=this;if(o||(o=0),(void 0===f||isNaN(f))&&(f=this.length),n||(n=0),o>f)throw new Error("sourceEnd < sourceStart");if(f===o)return 0;if(0==e.length||0==d.length)return 0;if(0>n||n>=e.length)throw new Error("targetStart out of bounds");if(0>o||o>=d.length)throw new Error("sourceStart out of bounds");if(0>f||f>d.length)throw new Error("sourceEnd out of bounds");f>this.length&&(f=this.length),e.length-n<f-o&&(f=e.length-n+o);for(var i=[],t=o;f>t;t++)B.ok("undefined"!=typeof this[t],"copying undefined buffer bytes!"),i.push(this[t]);for(var t=n;t<n+i.length;t++)e[t]=i[t-n]},d.prototype.fill=function(e,n,o){if(e||(e=0),n||(n=0),o||(o=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),"number"!=typeof e||isNaN(e))throw new Error("value is not a number");if(n>o)throw new Error("end < start");if(o===n)return 0;if(0==this.length)return 0;if(0>n||n>=this.length)throw new Error("start out of bounds");if(0>o||o>this.length)throw new Error("end out of bounds");for(var f=n;o>f;f++)this[f]=e},d.isBuffer=function(e){return e instanceof d||e instanceof d},d.concat=function(e,n){if(!u(e))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===e.length)return new d(0);if(1===e.length)return e[0];if("number"!=typeof n){n=0;for(var o=0;o<e.length;o++){var f=e[o];n+=f.length}}for(var i=new d(n),t=0,o=0;o<e.length;o++){var f=e[o];f.copy(i,t),t+=f.length}return i},d.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},d.prototype.readUInt8=function(e,n){var o=this;return n||(B.ok(void 0!==e&&null!==e,"missing offset"),B.ok(e<o.length,"Trying to read beyond buffer length")),e>=o.length?void 0:o[e]},d.prototype.readUInt16LE=function(e,n){return a(this,e,!1,n)},d.prototype.readUInt16BE=function(e,n){return a(this,e,!0,n)},d.prototype.readUInt32LE=function(e,n){return b(this,e,!1,n)},d.prototype.readUInt32BE=function(e,n){return b(this,e,!0,n)},d.prototype.readInt8=function(e,n){var o,f=this;return n||(B.ok(void 0!==e&&null!==e,"missing offset"),B.ok(e<f.length,"Trying to read beyond buffer length")),e>=f.length?void 0:(o=128&f[e],o?-1*(255-f[e]+1):f[e])},d.prototype.readInt16LE=function(e,n){return r(this,e,!1,n)},d.prototype.readInt16BE=function(e,n){return r(this,e,!0,n)},d.prototype.readInt32LE=function(e,n){return M(this,e,!1,n)},d.prototype.readInt32BE=function(e,n){return M(this,e,!0,n)},d.prototype.readFloatLE=function(e,n){return X(this,e,!1,n)},d.prototype.readFloatBE=function(e,n){return X(this,e,!0,n)},d.prototype.readDoubleLE=function(e,n){return g(this,e,!1,n)},d.prototype.readDoubleBE=function(e,n){return g(this,e,!0,n)},d.prototype.writeUInt8=function(e,n,o){var f=this;o||(B.ok(void 0!==e&&null!==e,"missing value"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n<f.length,"trying to write beyond buffer length"),m(e,255)),n<f.length&&(f[n]=e)},d.prototype.writeUInt16LE=function(e,n,o){x(this,e,n,!1,o)},d.prototype.writeUInt16BE=function(e,n,o){x(this,e,n,!0,o)},d.prototype.writeUInt32LE=function(e,n,o){j(this,e,n,!1,o)},d.prototype.writeUInt32BE=function(e,n,o){j(this,e,n,!0,o)},d.prototype.writeInt8=function(e,n,o){var f=this;o||(B.ok(void 0!==e&&null!==e,"missing value"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n<f.length,"Trying to write beyond buffer length"),h(e,127,-128)),e>=0?f.writeUInt8(e,n,o):f.writeUInt8(255+e+1,n,o)},d.prototype.writeInt16LE=function(e,n,o){q(this,e,n,!1,o)},d.prototype.writeInt16BE=function(e,n,o){q(this,e,n,!0,o)},d.prototype.writeInt32LE=function(e,n,o){v(this,e,n,!1,o)},d.prototype.writeInt32BE=function(e,n,o){v(this,e,n,!0,o)},d.prototype.writeFloatLE=function(e,n,o){z(this,e,n,!1,o)},d.prototype.writeFloatBE=function(e,n,o){z(this,e,n,!0,o)},d.prototype.writeDoubleLE=function(e,n,o){A(this,e,n,!1,o)},d.prototype.writeDoubleBE=function(e,n,o){A(this,e,n,!0,o)}},{"./buffer_ieee754":124,assert:122,"base64-js":126}],126:[function(e,n){!function(){"use strict";function e(e){var n,o,d,i,t,u;if(e.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(t=e.indexOf("="),t=t>0?e.length-t:0,u=[],d=t>0?e.length-4:e.length,n=0,o=0;d>n;n+=4,o+=3)i=f.indexOf(e[n])<<18|f.indexOf(e[n+1])<<12|f.indexOf(e[n+2])<<6|f.indexOf(e[n+3]),u.push((16711680&i)>>16),u.push((65280&i)>>8),u.push(255&i);return 2===t?(i=f.indexOf(e[n])<<2|f.indexOf(e[n+1])>>4,u.push(255&i)):1===t&&(i=f.indexOf(e[n])<<10|f.indexOf(e[n+1])<<4|f.indexOf(e[n+2])>>2,u.push(i>>8&255),u.push(255&i)),u}function o(e){function n(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}var o,d,i,t=e.length%3,u="";for(o=0,i=e.length-t;i>o;o+=3)d=(e[o]<<16)+(e[o+1]<<8)+e[o+2],u+=n(d);switch(t){case 1:d=e[e.length-1],u+=f[d>>2],u+=f[d<<4&63],u+="==";break;case 2:d=(e[e.length-2]<<8)+e[e.length-1],u+=f[d>>10],u+=f[d>>4&63],u+=f[d<<2&63],u+="="}return u}var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";n.exports.toByteArray=e,n.exports.fromByteArray=o}()},{}],127:[function(e,n){function o(e,n){if(e.length%t!==0){var o=e.length+(t-e.length%t);e=i.concat([e,u],o)}for(var f=[],d=n?e.readInt32BE:e.readInt32LE,l=0;l<e.length;l+=t)f.push(d.call(e,l));return f}function f(e,n,o){for(var f=new i(n),d=o?f.writeInt32BE:f.writeInt32LE,t=0;t<e.length;t++)d.call(f,e[t],4*t,!0);return f}function d(e,n,d,t){i.isBuffer(e)||(e=new i(e));var u=n(o(e,t),e.length*l);return f(u,d,t)}var i=e("buffer").Buffer,t=4,u=new i(t);u.fill(0);var l=8;n.exports={hash:d}},{buffer:125}],128:[function(e,n,o){function f(e,n,o){u.isBuffer(n)||(n=new u(n)),u.isBuffer(o)||(o=new u(o)),n.length>y?n=e(n):n.length<y&&(n=u.concat([n,w],y));for(var f=new u(y),d=new u(y),i=0;y>i;i++)f[i]=54^n[i],d[i]=92^n[i];var t=e(u.concat([f,o]));return e(u.concat([d,t]))}function d(e,n){e=e||"sha1";var o=s[e],d=[],t=0;return o||i("algorithm:",e,"is not yet supported"),{update:function(e){return u.isBuffer(e)||(e=new u(e)),d.push(e),t+=e.length,this},digest:function(e){var i=u.concat(d),t=n?f(o,n,i):o(i);return d=null,e?t.toString(e):t}}}function i(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function t(e,n){for(var o in e)n(e[o],o)}var u=e("buffer").Buffer,l=e("./sha"),p=e("./sha256"),P=e("./rng"),c=e("./md5"),s={sha1:l,sha256:p,md5:c},y=64,w=new u(y);w.fill(0),o.createHash=function(e){return d(e)},o.createHmac=function(e,n){return d(e,n)},o.randomBytes=function(e,n){if(!n||!n.call)return new u(P(e));try{n.call(this,void 0,new u(P(e)))}catch(o){n(o)}},t(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){o[e]=function(){i("sorry,",e,"is not implemented yet")}})},{"./md5":129,"./rng":130,"./sha":131,"./sha256":132,buffer:125}],129:[function(e,n){function o(e,n){e[n>>5]|=128<<n%32,e[(n+64>>>9<<4)+14]=n;for(var o=1732584193,f=-271733879,p=-1732584194,P=271733878,c=0;c<e.length;c+=16){var s=o,y=f,w=p,a=P;o=d(o,f,p,P,e[c+0],7,-680876936),P=d(P,o,f,p,e[c+1],12,-389564586),p=d(p,P,o,f,e[c+2],17,606105819),f=d(f,p,P,o,e[c+3],22,-1044525330),o=d(o,f,p,P,e[c+4],7,-176418897),P=d(P,o,f,p,e[c+5],12,1200080426),p=d(p,P,o,f,e[c+6],17,-1473231341),f=d(f,p,P,o,e[c+7],22,-45705983),o=d(o,f,p,P,e[c+8],7,1770035416),P=d(P,o,f,p,e[c+9],12,-1958414417),p=d(p,P,o,f,e[c+10],17,-42063),f=d(f,p,P,o,e[c+11],22,-1990404162),o=d(o,f,p,P,e[c+12],7,1804603682),P=d(P,o,f,p,e[c+13],12,-40341101),p=d(p,P,o,f,e[c+14],17,-1502002290),f=d(f,p,P,o,e[c+15],22,1236535329),o=i(o,f,p,P,e[c+1],5,-165796510),P=i(P,o,f,p,e[c+6],9,-1069501632),p=i(p,P,o,f,e[c+11],14,643717713),f=i(f,p,P,o,e[c+0],20,-373897302),o=i(o,f,p,P,e[c+5],5,-701558691),P=i(P,o,f,p,e[c+10],9,38016083),p=i(p,P,o,f,e[c+15],14,-660478335),f=i(f,p,P,o,e[c+4],20,-405537848),o=i(o,f,p,P,e[c+9],5,568446438),P=i(P,o,f,p,e[c+14],9,-1019803690),p=i(p,P,o,f,e[c+3],14,-187363961),f=i(f,p,P,o,e[c+8],20,1163531501),o=i(o,f,p,P,e[c+13],5,-1444681467),P=i(P,o,f,p,e[c+2],9,-51403784),p=i(p,P,o,f,e[c+7],14,1735328473),f=i(f,p,P,o,e[c+12],20,-1926607734),o=t(o,f,p,P,e[c+5],4,-378558),P=t(P,o,f,p,e[c+8],11,-2022574463),p=t(p,P,o,f,e[c+11],16,1839030562),f=t(f,p,P,o,e[c+14],23,-35309556),o=t(o,f,p,P,e[c+1],4,-1530992060),P=t(P,o,f,p,e[c+4],11,1272893353),p=t(p,P,o,f,e[c+7],16,-155497632),f=t(f,p,P,o,e[c+10],23,-1094730640),o=t(o,f,p,P,e[c+13],4,681279174),P=t(P,o,f,p,e[c+0],11,-358537222),p=t(p,P,o,f,e[c+3],16,-722521979),f=t(f,p,P,o,e[c+6],23,76029189),o=t(o,f,p,P,e[c+9],4,-640364487),P=t(P,o,f,p,e[c+12],11,-421815835),p=t(p,P,o,f,e[c+15],16,530742520),f=t(f,p,P,o,e[c+2],23,-995338651),o=u(o,f,p,P,e[c+0],6,-198630844),P=u(P,o,f,p,e[c+7],10,1126891415),p=u(p,P,o,f,e[c+14],15,-1416354905),f=u(f,p,P,o,e[c+5],21,-57434055),o=u(o,f,p,P,e[c+12],6,1700485571),P=u(P,o,f,p,e[c+3],10,-1894986606),p=u(p,P,o,f,e[c+10],15,-1051523),f=u(f,p,P,o,e[c+1],21,-2054922799),o=u(o,f,p,P,e[c+8],6,1873313359),P=u(P,o,f,p,e[c+15],10,-30611744),p=u(p,P,o,f,e[c+6],15,-1560198380),f=u(f,p,P,o,e[c+13],21,1309151649),o=u(o,f,p,P,e[c+4],6,-145523070),P=u(P,o,f,p,e[c+11],10,-1120210379),p=u(p,P,o,f,e[c+2],15,718787259),f=u(f,p,P,o,e[c+9],21,-343485551),o=l(o,s),f=l(f,y),p=l(p,w),P=l(P,a)}return Array(o,f,p,P)}function f(e,n,o,f,d,i){return l(p(l(l(n,e),l(f,i)),d),o)}function d(e,n,o,d,i,t,u){return f(n&o|~n&d,e,n,i,t,u)}function i(e,n,o,d,i,t,u){return f(n&d|o&~d,e,n,i,t,u)}function t(e,n,o,d,i,t,u){return f(n^o^d,e,n,i,t,u)}function u(e,n,o,d,i,t,u){return f(o^(n|~d),e,n,i,t,u)}function l(e,n){var o=(65535&e)+(65535&n),f=(e>>16)+(n>>16)+(o>>16);return f<<16|65535&o}function p(e,n){return e<<n|e>>>32-n}var P=e("./helpers");n.exports=function(e){return P.hash(e,o,16)}},{"./helpers":127}],130:[function(e,n){!function(){var e,o,f=this;e=function(e){for(var n,n,o=new Array(e),f=0;e>f;f++)0==(3&f)&&(n=4294967296*Math.random()),o[f]=n>>>((3&f)<<3)&255;return o},f.crypto&&crypto.getRandomValues&&(o=function(e){var n=new Uint8Array(e);return crypto.getRandomValues(n),n}),n.exports=o||e}()},{}],131:[function(e,n){function o(e,n){e[n>>5]|=128<<24-n%32,e[(n+64>>9<<4)+15]=n;for(var o=Array(80),u=1732584193,l=-271733879,p=-1732584194,P=271733878,c=-1009589776,s=0;s<e.length;s+=16){for(var y=u,w=l,a=p,b=P,r=c,M=0;80>M;M++){o[M]=16>M?e[s+M]:t(o[M-3]^o[M-8]^o[M-14]^o[M-16],1);var X=i(i(t(u,5),f(M,l,p,P)),i(i(c,o[M]),d(M)));c=P,P=p,p=t(l,30),l=u,u=X}u=i(u,y),l=i(l,w),p=i(p,a),P=i(P,b),c=i(c,r)}return Array(u,l,p,P,c)}function f(e,n,o,f){return 20>e?n&o|~n&f:40>e?n^o^f:60>e?n&o|n&f|o&f:n^o^f}function d(e){return 20>e?1518500249:40>e?1859775393:60>e?-1894007588:-899497514}function i(e,n){var o=(65535&e)+(65535&n),f=(e>>16)+(n>>16)+(o>>16);return f<<16|65535&o}function t(e,n){return e<<n|e>>>32-n}var u=e("./helpers");n.exports=function(e){return u.hash(e,o,20,!0)}},{"./helpers":127}],132:[function(e,n){var o=e("./helpers"),f=function(e,n){var o=(65535&e)+(65535&n),f=(e>>16)+(n>>16)+(o>>16);return f<<16|65535&o},d=function(e,n){return e>>>n|e<<32-n},i=function(e,n){return e>>>n},t=function(e,n,o){return e&n^~e&o},u=function(e,n,o){return e&n^e&o^n&o},l=function(e){return d(e,2)^d(e,13)^d(e,22)},p=function(e){return d(e,6)^d(e,11)^d(e,25)},P=function(e){return d(e,7)^d(e,18)^i(e,3)},c=function(e){return d(e,17)^d(e,19)^i(e,10)},s=function(e,n){var o,d,i,s,y,w,a,b,r,M,X,g,m=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),x=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),j=new Array(64);e[n>>5]|=128<<24-n%32,e[(n+64>>9<<4)+15]=n;for(var r=0;r<e.length;r+=16){o=x[0],d=x[1],i=x[2],s=x[3],y=x[4],w=x[5],a=x[6],b=x[7];for(var M=0;64>M;M++)j[M]=16>M?e[M+r]:f(f(f(c(j[M-2]),j[M-7]),P(j[M-15])),j[M-16]),X=f(f(f(f(b,p(y)),t(y,w,a)),m[M]),j[M]),g=f(l(o),u(o,d,i)),b=a,a=w,w=y,y=f(s,X),s=i,i=d,d=o,o=f(X,g);x[0]=f(o,x[0]),x[1]=f(d,x[1]),x[2]=f(i,x[2]),x[3]=f(s,x[3]),x[4]=f(y,x[4]),x[5]=f(w,x[5]),x[6]=f(a,x[6]),x[7]=f(b,x[7])}return x};n.exports=function(e){return o.hash(e,s,32,!0)}},{"./helpers":127}],133:[function(){},{}],134:[function(e,n){e=function o(n,f,d){function i(u,l){if(!f[u]){if(!n[u]){var p="function"==typeof e&&e;if(!l&&p)return p(u,!0);if(t)return t(u,!0);throw new Error("Cannot find module '"+u+"'")}var P=f[u]={exports:{}};n[u][0].call(P.exports,function(e){var o=n[u][1][e];return i(o?o:e)},P,P.exports,o,n,f,d)}return f[u].exports}for(var t="function"==typeof e&&e,u=0;u<d.length;u++)i(d[u]);return i}({1:[function(e,n,o){o.readIEEE754=function(e,n,o,f,d){var i,t,u=8*d-f-1,l=(1<<u)-1,p=l>>1,P=-7,c=o?0:d-1,s=o?1:-1,y=e[n+c];for(c+=s,i=y&(1<<-P)-1,y>>=-P,P+=u;P>0;i=256*i+e[n+c],c+=s,P-=8);for(t=i&(1<<-P)-1,i>>=-P,P+=f;P>0;t=256*t+e[n+c],c+=s,P-=8);if(0===i)i=1-p;else{if(i===l)return t?0/0:1/0*(y?-1:1);t+=Math.pow(2,f),i-=p}return(y?-1:1)*t*Math.pow(2,i-f)},o.writeIEEE754=function(e,n,o,f,d,i){var t,u,l,p=8*i-d-1,P=(1<<p)-1,c=P>>1,s=23===d?Math.pow(2,-24)-Math.pow(2,-77):0,y=f?i-1:0,w=f?-1:1,a=0>n||0===n&&0>1/n?1:0;
for(n=Math.abs(n),isNaN(n)||1/0===n?(u=isNaN(n)?1:0,t=P):(t=Math.floor(Math.log(n)/Math.LN2),n*(l=Math.pow(2,-t))<1&&(t--,l*=2),n+=t+c>=1?s/l:s*Math.pow(2,1-c),n*l>=2&&(t++,l/=2),t+c>=P?(u=0,t=P):t+c>=1?(u=(n*l-1)*Math.pow(2,d),t+=c):(u=n*Math.pow(2,c-1)*Math.pow(2,d),t=0));d>=8;e[o+y]=255&u,y+=w,u/=256,d-=8);for(t=t<<d|u,p+=d;p>0;e[o+y]=255&t,y+=w,t/=256,p-=8);e[o+y-w]|=128*a}},{}],q9TxCC:[function(e,n,o){function f(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function d(n,o,i){if(B||(B=e("assert")),!(this instanceof d))return new d(n,o,i);if(this.parent=this,this.offset=0,"base64"==o&&"string"==typeof n)for(n=f(n);n.length%4!=0;)n+="=";var u;if("number"==typeof i){this.length=t(o);for(var p=0;p<this.length;p++)this[p]=n.get(p+i)}else{switch(u=typeof n){case"number":this.length=t(n);break;case"string":this.length=d.byteLength(n,o);break;case"object":this.length=t(n.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(l(n))for(var p=0;p<this.length;p++)this[p]=n instanceof d?n.readUInt8(p):n[p];else if("string"==u)this.length=this.write(n,0,o);else if("number"===u)for(var p=0;p<this.length;p++)this[p]=0}}function i(e,n,o){return"number"!=typeof e?o:(e=~~e,e>=n?n:e>=0?e:(e+=n,e>=0?e:0))}function t(e){return e=~~Math.ceil(+e),0>e?0:e}function u(e){return(Array.isArray||function(e){return"[object Array]"=={}.toString.apply(e)})(e)}function l(e){return u(e)||d.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function p(e){return 16>e?"0"+e.toString(16):e.toString(16)}function P(e){for(var n=[],o=0;o<e.length;o++)if(e.charCodeAt(o)<=127)n.push(e.charCodeAt(o));else for(var f=encodeURIComponent(e.charAt(o)).substr(1).split("%"),d=0;d<f.length;d++)n.push(parseInt(f[d],16));return n}function c(e){for(var n=[],o=0;o<e.length;o++)n.push(255&e.charCodeAt(o));return n}function s(n){return e("base64-js").toByteArray(n)}function y(e,n,o,f){for(var d=0;f>d&&!(d+o>=n.length||d>=e.length);)n[d+o]=e[d],d++;return d}function w(e){try{return decodeURIComponent(e)}catch(n){return String.fromCharCode(65533)}}function a(e,n,o,f){var d=0;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+1<e.length,"Trying to read beyond buffer length")),n>=e.length?0:(o?(d=e[n]<<8,n+1<e.length&&(d|=e[n+1])):(d=e[n],n+1<e.length&&(d|=e[n+1]<<8)),d)}function b(e,n,o,f){var d=0;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+3<e.length,"Trying to read beyond buffer length")),n>=e.length?0:(o?(n+1<e.length&&(d=e[n+1]<<16),n+2<e.length&&(d|=e[n+2]<<8),n+3<e.length&&(d|=e[n+3]),d+=e[n]<<24>>>0):(n+2<e.length&&(d=e[n+2]<<16),n+1<e.length&&(d|=e[n+1]<<8),d|=e[n],n+3<e.length&&(d+=e[n+3]<<24>>>0)),d)}function r(e,n,o,f){var d,i;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+1<e.length,"Trying to read beyond buffer length")),i=a(e,n,o,f),d=32768&i,d?-1*(65535-i+1):i}function M(e,n,o,f){var d,i;return f||(B.ok("boolean"==typeof o,"missing or invalid endian"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n+3<e.length,"Trying to read beyond buffer length")),i=b(e,n,o,f),d=2147483648&i,d?-1*(4294967295-i+1):i}function X(n,o,f,d){return d||(B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(o+3<n.length,"Trying to read beyond buffer length")),e("./buffer_ieee754").readIEEE754(n,o,f,23,4)}function g(n,o,f,d){return d||(B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(o+7<n.length,"Trying to read beyond buffer length")),e("./buffer_ieee754").readIEEE754(n,o,f,52,8)}function m(e,n){B.ok("number"==typeof e,"cannot write a non-number as a number"),B.ok(e>=0,"specified a negative value for writing an unsigned value"),B.ok(n>=e,"value is larger than maximum value for type"),B.ok(Math.floor(e)===e,"value has a fractional component")}function x(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+1<e.length,"trying to write beyond buffer length"),m(n,65535));for(var i=0;i<Math.min(e.length-o,2);i++)e[o+i]=(n&255<<8*(f?1-i:i))>>>8*(f?1-i:i)}function j(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+3<e.length,"trying to write beyond buffer length"),m(n,4294967295));for(var i=0;i<Math.min(e.length-o,4);i++)e[o+i]=n>>>8*(f?3-i:i)&255}function h(e,n,o){B.ok("number"==typeof e,"cannot write a non-number as a number"),B.ok(n>=e,"value larger than maximum allowed value"),B.ok(e>=o,"value smaller than minimum allowed value"),B.ok(Math.floor(e)===e,"value has a fractional component")}function k(e,n,o){B.ok("number"==typeof e,"cannot write a non-number as a number"),B.ok(n>=e,"value larger than maximum allowed value"),B.ok(e>=o,"value smaller than minimum allowed value")}function q(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+1<e.length,"Trying to write beyond buffer length"),h(n,32767,-32768)),n>=0?x(e,n,o,f,d):x(e,65535+n+1,o,f,d)}function v(e,n,o,f,d){d||(B.ok(void 0!==n&&null!==n,"missing value"),B.ok("boolean"==typeof f,"missing or invalid endian"),B.ok(void 0!==o&&null!==o,"missing offset"),B.ok(o+3<e.length,"Trying to write beyond buffer length"),h(n,2147483647,-2147483648)),n>=0?j(e,n,o,f,d):j(e,4294967295+n+1,o,f,d)}function z(n,o,f,d,i){i||(B.ok(void 0!==o&&null!==o,"missing value"),B.ok("boolean"==typeof d,"missing or invalid endian"),B.ok(void 0!==f&&null!==f,"missing offset"),B.ok(f+3<n.length,"Trying to write beyond buffer length"),k(o,3.4028234663852886e38,-3.4028234663852886e38)),e("./buffer_ieee754").writeIEEE754(n,o,f,d,23,4)}function A(n,o,f,d,i){i||(B.ok(void 0!==o&&null!==o,"missing value"),B.ok("boolean"==typeof d,"missing or invalid endian"),B.ok(void 0!==f&&null!==f,"missing offset"),B.ok(f+7<n.length,"Trying to write beyond buffer length"),k(o,1.7976931348623157e308,-1.7976931348623157e308)),e("./buffer_ieee754").writeIEEE754(n,o,f,d,52,8)}var B;o.Buffer=d,o.SlowBuffer=d,d.poolSize=8192,o.INSPECT_MAX_BYTES=50,d.prototype.get=function(e){if(0>e||e>=this.length)throw new Error("oob");return this[e]},d.prototype.set=function(e,n){if(0>e||e>=this.length)throw new Error("oob");return this[e]=n},d.byteLength=function(e,n){switch(n||"utf8"){case"hex":return e.length/2;case"utf8":case"utf-8":return P(e).length;case"ascii":case"binary":return e.length;case"base64":return s(e).length;default:throw new Error("Unknown encoding")}},d.prototype.utf8Write=function(e,n,o){return d._charsWritten=y(P(e),this,n,o)},d.prototype.asciiWrite=function(e,n,o){return d._charsWritten=y(c(e),this,n,o)},d.prototype.binaryWrite=d.prototype.asciiWrite,d.prototype.base64Write=function(e,n,o){return d._charsWritten=y(s(e),this,n,o)},d.prototype.base64Slice=function(){var n=Array.prototype.slice.apply(this,arguments);return e("base64-js").fromByteArray(n)},d.prototype.utf8Slice=function(){for(var e=Array.prototype.slice.apply(this,arguments),n="",o="",f=0;f<e.length;)e[f]<=127?(n+=w(o)+String.fromCharCode(e[f]),o=""):o+="%"+e[f].toString(16),f++;return n+w(o)},d.prototype.asciiSlice=function(){for(var e=Array.prototype.slice.apply(this,arguments),n="",o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n},d.prototype.binarySlice=d.prototype.asciiSlice,d.prototype.inspect=function(){for(var e=[],n=this.length,f=0;n>f;f++)if(e[f]=p(this[f]),f==o.INSPECT_MAX_BYTES){e[f+1]="...";break}return"<Buffer "+e.join(" ")+">"},d.prototype.hexSlice=function(e,n){var o=this.length;(!e||0>e)&&(e=0),(!n||0>n||n>o)&&(n=o);for(var f="",d=e;n>d;d++)f+=p(this[d]);return f},d.prototype.toString=function(e,n,o){if(e=String(e||"utf8").toLowerCase(),n=+n||0,"undefined"==typeof o&&(o=this.length),+o==n)return"";switch(e){case"hex":return this.hexSlice(n,o);case"utf8":case"utf-8":return this.utf8Slice(n,o);case"ascii":return this.asciiSlice(n,o);case"binary":return this.binarySlice(n,o);case"base64":return this.base64Slice(n,o);case"ucs2":case"ucs-2":return this.ucs2Slice(n,o);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(e,n,o){n=+n||0;var f=this.length-n;o?(o=+o,o>f&&(o=f)):o=f;var i=e.length;if(i%2)throw new Error("Invalid hex string");o>i/2&&(o=i/2);for(var t=0;o>t;t++){var u=parseInt(e.substr(2*t,2),16);if(isNaN(u))throw new Error("Invalid hex string");this[n+t]=u}return d._charsWritten=2*t,t},d.prototype.write=function(e,n,o,f){if(isFinite(n))isFinite(o)||(f=o,o=void 0);else{var d=f;f=n,n=o,o=d}n=+n||0;var i=this.length-n;switch(o?(o=+o,o>i&&(o=i)):o=i,f=String(f||"utf8").toLowerCase()){case"hex":return this.hexWrite(e,n,o);case"utf8":case"utf-8":return this.utf8Write(e,n,o);case"ascii":return this.asciiWrite(e,n,o);case"binary":return this.binaryWrite(e,n,o);case"base64":return this.base64Write(e,n,o);case"ucs2":case"ucs-2":return this.ucs2Write(e,n,o);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(e,n){var o=this.length;return e=i(e,o,0),n=i(n,o,o),new d(this,n-e,+e)},d.prototype.copy=function(e,n,o,f){var d=this;if(o||(o=0),(void 0===f||isNaN(f))&&(f=this.length),n||(n=0),o>f)throw new Error("sourceEnd < sourceStart");if(f===o)return 0;if(0==e.length||0==d.length)return 0;if(0>n||n>=e.length)throw new Error("targetStart out of bounds");if(0>o||o>=d.length)throw new Error("sourceStart out of bounds");if(0>f||f>d.length)throw new Error("sourceEnd out of bounds");f>this.length&&(f=this.length),e.length-n<f-o&&(f=e.length-n+o);for(var i=[],t=o;f>t;t++)B.ok("undefined"!=typeof this[t],"copying undefined buffer bytes!"),i.push(this[t]);for(var t=n;t<n+i.length;t++)e[t]=i[t-n]},d.prototype.fill=function(e,n,o){if(e||(e=0),n||(n=0),o||(o=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),"number"!=typeof e||isNaN(e))throw new Error("value is not a number");if(n>o)throw new Error("end < start");if(o===n)return 0;if(0==this.length)return 0;if(0>n||n>=this.length)throw new Error("start out of bounds");if(0>o||o>this.length)throw new Error("end out of bounds");for(var f=n;o>f;f++)this[f]=e},d.isBuffer=function(e){return e instanceof d||e instanceof d},d.concat=function(e,n){if(!u(e))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===e.length)return new d(0);if(1===e.length)return e[0];if("number"!=typeof n){n=0;for(var o=0;o<e.length;o++){var f=e[o];n+=f.length}}for(var i=new d(n),t=0,o=0;o<e.length;o++){var f=e[o];f.copy(i,t),t+=f.length}return i},d.isEncoding=function(e){switch((e+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},d.prototype.readUInt8=function(e,n){var o=this;return n||(B.ok(void 0!==e&&null!==e,"missing offset"),B.ok(e<o.length,"Trying to read beyond buffer length")),e>=o.length?void 0:o[e]},d.prototype.readUInt16LE=function(e,n){return a(this,e,!1,n)},d.prototype.readUInt16BE=function(e,n){return a(this,e,!0,n)},d.prototype.readUInt32LE=function(e,n){return b(this,e,!1,n)},d.prototype.readUInt32BE=function(e,n){return b(this,e,!0,n)},d.prototype.readInt8=function(e,n){var o,f=this;return n||(B.ok(void 0!==e&&null!==e,"missing offset"),B.ok(e<f.length,"Trying to read beyond buffer length")),e>=f.length?void 0:(o=128&f[e],o?-1*(255-f[e]+1):f[e])},d.prototype.readInt16LE=function(e,n){return r(this,e,!1,n)},d.prototype.readInt16BE=function(e,n){return r(this,e,!0,n)},d.prototype.readInt32LE=function(e,n){return M(this,e,!1,n)},d.prototype.readInt32BE=function(e,n){return M(this,e,!0,n)},d.prototype.readFloatLE=function(e,n){return X(this,e,!1,n)},d.prototype.readFloatBE=function(e,n){return X(this,e,!0,n)},d.prototype.readDoubleLE=function(e,n){return g(this,e,!1,n)},d.prototype.readDoubleBE=function(e,n){return g(this,e,!0,n)},d.prototype.writeUInt8=function(e,n,o){var f=this;o||(B.ok(void 0!==e&&null!==e,"missing value"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n<f.length,"trying to write beyond buffer length"),m(e,255)),n<f.length&&(f[n]=e)},d.prototype.writeUInt16LE=function(e,n,o){x(this,e,n,!1,o)},d.prototype.writeUInt16BE=function(e,n,o){x(this,e,n,!0,o)},d.prototype.writeUInt32LE=function(e,n,o){j(this,e,n,!1,o)},d.prototype.writeUInt32BE=function(e,n,o){j(this,e,n,!0,o)},d.prototype.writeInt8=function(e,n,o){var f=this;o||(B.ok(void 0!==e&&null!==e,"missing value"),B.ok(void 0!==n&&null!==n,"missing offset"),B.ok(n<f.length,"Trying to write beyond buffer length"),h(e,127,-128)),e>=0?f.writeUInt8(e,n,o):f.writeUInt8(255+e+1,n,o)},d.prototype.writeInt16LE=function(e,n,o){q(this,e,n,!1,o)},d.prototype.writeInt16BE=function(e,n,o){q(this,e,n,!0,o)},d.prototype.writeInt32LE=function(e,n,o){v(this,e,n,!1,o)},d.prototype.writeInt32BE=function(e,n,o){v(this,e,n,!0,o)},d.prototype.writeFloatLE=function(e,n,o){z(this,e,n,!1,o)},d.prototype.writeFloatBE=function(e,n,o){z(this,e,n,!0,o)},d.prototype.writeDoubleLE=function(e,n,o){A(this,e,n,!1,o)},d.prototype.writeDoubleBE=function(e,n,o){A(this,e,n,!0,o)}},{"./buffer_ieee754":1,assert:6,"base64-js":4}],"buffer-browserify":[function(e,n){n.exports=e("q9TxCC")},{}],4:[function(e,n){!function(){"use strict";function e(e){var n,o,d,i,t,u;if(e.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(t=e.indexOf("="),t=t>0?e.length-t:0,u=[],d=t>0?e.length-4:e.length,n=0,o=0;d>n;n+=4,o+=3)i=f.indexOf(e[n])<<18|f.indexOf(e[n+1])<<12|f.indexOf(e[n+2])<<6|f.indexOf(e[n+3]),u.push((16711680&i)>>16),u.push((65280&i)>>8),u.push(255&i);return 2===t?(i=f.indexOf(e[n])<<2|f.indexOf(e[n+1])>>4,u.push(255&i)):1===t&&(i=f.indexOf(e[n])<<10|f.indexOf(e[n+1])<<4|f.indexOf(e[n+2])>>2,u.push(i>>8&255),u.push(255&i)),u}function o(e){function n(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}var o,d,i,t=e.length%3,u="";for(o=0,i=e.length-t;i>o;o+=3)d=(e[o]<<16)+(e[o+1]<<8)+e[o+2],u+=n(d);switch(t){case 1:d=e[e.length-1],u+=f[d>>2],u+=f[d<<4&63],u+="==";break;case 2:d=(e[e.length-2]<<8)+e[e.length-1],u+=f[d>>10],u+=f[d>>4&63],u+=f[d<<2&63],u+="="}return u}var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";n.exports.toByteArray=e,n.exports.fromByteArray=o}()},{}],5:[function(e,n,o){function f(e){return"[object Array]"===p.call(e)}function d(e,n){var o;if(null===e)o={__proto__:null};else{if("object"!=typeof e)throw new TypeError("typeof prototype["+typeof e+"] != 'object'");var f=function(){};f.prototype=e,o=new f,o.__proto__=e}return"undefined"!=typeof n&&Object.defineProperties&&Object.defineProperties(o,n),o}function i(e){return"object"!=typeof e&&"function"!=typeof e||null===e}function t(e){if(i(e))throw new TypeError("Object.keys called on a non-object");var n=[];for(var o in e)P.call(e,o)&&n.push(o);return n}function u(e){if(i(e))throw new TypeError("Object.getOwnPropertyNames called on a non-object");var n=t(e);return o.isArray(e)&&-1===o.indexOf(e,"length")&&n.push("length"),n}function l(e,n){return{value:e[n]}}var p=Object.prototype.toString,P=Object.prototype.hasOwnProperty;o.isArray="function"==typeof Array.isArray?Array.isArray:f,o.indexOf=function(e,n){if(e.indexOf)return e.indexOf(n);for(var o=0;o<e.length;o++)if(n===e[o])return o;return-1},o.filter=function(e,n){if(e.filter)return e.filter(n);for(var o=[],f=0;f<e.length;f++)n(e[f],f,e)&&o.push(e[f]);return o},o.forEach=function(e,n,o){if(e.forEach)return e.forEach(n,o);for(var f=0;f<e.length;f++)n.call(o,e[f],f,e)},o.map=function(e,n){if(e.map)return e.map(n);for(var o=new Array(e.length),f=0;f<e.length;f++)o[f]=n(e[f],f,e);return o},o.reduce=function(e,n,o){if(e.reduce)return e.reduce(n,o);var f,d=!1;2<arguments.length&&(f=o,d=!0);for(var i=0,t=e.length;t>i;++i)e.hasOwnProperty(i)&&(d?f=n(f,e[i],i,e):(f=e[i],d=!0));return f},o.substr="b"!=="ab".substr(-1)?function(e,n,o){return 0>n&&(n=e.length+n),e.substr(n,o)}:function(e,n,o){return e.substr(n,o)},o.trim=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},o.bind=function(){var e=Array.prototype.slice.call(arguments),n=e.shift();if(n.bind)return n.bind.apply(n,e);var o=e.shift();return function(){n.apply(o,e.concat([Array.prototype.slice.call(arguments)]))}},o.create="function"==typeof Object.create?Object.create:d;var c="function"==typeof Object.keys?Object.keys:t,s="function"==typeof Object.getOwnPropertyNames?Object.getOwnPropertyNames:u;if((new Error).hasOwnProperty("description")){var y=function(e,n){return"[object Error]"===p.call(e)&&(n=o.filter(n,function(e){return"description"!==e&&"number"!==e&&"message"!==e})),n};o.keys=function(e){return y(e,c(e))},o.getOwnPropertyNames=function(e){return y(e,s(e))}}else o.keys=c,o.getOwnPropertyNames=s;if("function"==typeof Object.getOwnPropertyDescriptor)try{Object.getOwnPropertyDescriptor({a:1},"a"),o.getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor}catch(w){o.getOwnPropertyDescriptor=function(e,n){try{return Object.getOwnPropertyDescriptor(e,n)}catch(o){return l(e,n)}}}else o.getOwnPropertyDescriptor=l},{}],6:[function(e,n){function o(e,n){return s.isUndefined(n)?""+n:!s.isNumber(n)||!isNaN(n)&&isFinite(n)?s.isFunction(n)||s.isRegExp(n)?n.toString():n:n.toString()}function f(e,n){return s.isString(e)?e.length<n?e:e.slice(0,n):e}function d(e){return f(JSON.stringify(e.actual,o),128)+" "+e.operator+" "+f(JSON.stringify(e.expected,o),128)}function i(e,n,o,f,d){throw new a.AssertionError({message:o,actual:e,expected:n,operator:f,stackStartFunction:d})}function t(e,n){e||i(e,!0,n,"==",a.ok)}function u(e,n){if(e===n)return!0;if(s.isBuffer(e)&&s.isBuffer(n)){if(e.length!=n.length)return!1;for(var o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}return s.isDate(e)&&s.isDate(n)?e.getTime()===n.getTime():s.isRegExp(e)&&s.isRegExp(n)?e.source===n.source&&e.global===n.global&&e.multiline===n.multiline&&e.lastIndex===n.lastIndex&&e.ignoreCase===n.ignoreCase:s.isObject(e)||s.isObject(n)?p(e,n):e==n}function l(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function p(e,n){if(s.isNullOrUndefined(e)||s.isNullOrUndefined(n))return!1;if(e.prototype!==n.prototype)return!1;if(l(e))return l(n)?(e=w.call(e),n=w.call(n),u(e,n)):!1;try{var o,f,d=y.keys(e),i=y.keys(n)}catch(t){return!1}if(d.length!=i.length)return!1;for(d.sort(),i.sort(),f=d.length-1;f>=0;f--)if(d[f]!=i[f])return!1;for(f=d.length-1;f>=0;f--)if(o=d[f],!u(e[o],n[o]))return!1;return!0}function P(e,n){return e&&n?"[object RegExp]"==Object.prototype.toString.call(n)?n.test(e):e instanceof n?!0:n.call({},e)===!0?!0:!1:!1}function c(e,n,o,f){var d;s.isString(o)&&(f=o,o=null);try{n()}catch(t){d=t}if(f=(o&&o.name?" ("+o.name+").":".")+(f?" "+f:"."),e&&!d&&i(d,o,"Missing expected exception"+f),!e&&P(d,o)&&i(d,o,"Got unwanted exception"+f),e&&d&&o&&!P(d,o)||!e&&d)throw d}var s=e("util"),y=e("_shims"),w=Array.prototype.slice,a=n.exports=t;a.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,this.message=e.message||d(this)},s.inherits(a.AssertionError,Error),a.fail=i,a.ok=t,a.equal=function(e,n,o){e!=n&&i(e,n,o,"==",a.equal)},a.notEqual=function(e,n,o){e==n&&i(e,n,o,"!=",a.notEqual)},a.deepEqual=function(e,n,o){u(e,n)||i(e,n,o,"deepEqual",a.deepEqual)},a.notDeepEqual=function(e,n,o){u(e,n)&&i(e,n,o,"notDeepEqual",a.notDeepEqual)},a.strictEqual=function(e,n,o){e!==n&&i(e,n,o,"===",a.strictEqual)},a.notStrictEqual=function(e,n,o){e===n&&i(e,n,o,"!==",a.notStrictEqual)},a.throws=function(){c.apply(this,[!0].concat(w.call(arguments)))},a.doesNotThrow=function(){c.apply(this,[!1].concat(w.call(arguments)))},a.ifError=function(e){if(e)throw e}},{_shims:5,util:7}],7:[function(e,n,o){function f(e,n){var f={seen:[],stylize:i};return arguments.length>=3&&(f.depth=arguments[2]),arguments.length>=4&&(f.colors=arguments[3]),w(n)?f.showHidden=n:n&&o._extend(f,n),g(f.showHidden)&&(f.showHidden=!1),g(f.depth)&&(f.depth=2),g(f.colors)&&(f.colors=!1),g(f.customInspect)&&(f.customInspect=!0),f.colors&&(f.stylize=d),u(f,e,f.depth)}function d(e,n){var o=f.styles[n];return o?"["+f.colors[o][0]+"m"+e+"["+f.colors[o][1]+"m":e}function i(e){return e}function t(e){var n={};return D.forEach(e,function(e){n[e]=!0}),n}function u(e,n,f){if(e.customInspect&&n&&k(n.inspect)&&n.inspect!==o.inspect&&(!n.constructor||n.constructor.prototype!==n)){var d=n.inspect(f);return M(d)||(d=u(e,d,f)),d}var i=l(e,n);if(i)return i;var w=D.keys(n),a=t(w);if(e.showHidden&&(w=D.getOwnPropertyNames(n)),0===w.length){if(k(n)){var b=n.name?": "+n.name:"";return e.stylize("[Function"+b+"]","special")}if(m(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(j(n))return e.stylize(Date.prototype.toString.call(n),"date");if(h(n))return p(n)}var r="",X=!1,g=["{","}"];if(y(n)&&(X=!0,g=["[","]"]),k(n)){var x=n.name?": "+n.name:"";r=" [Function"+x+"]"}if(m(n)&&(r=" "+RegExp.prototype.toString.call(n)),j(n)&&(r=" "+Date.prototype.toUTCString.call(n)),h(n)&&(r=" "+p(n)),0===w.length&&(!X||0==n.length))return g[0]+r+g[1];if(0>f)return m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var q;return q=X?P(e,n,f,a,w):w.map(function(o){return c(e,n,f,a,o,X)}),e.seen.pop(),s(q,r,g)}function l(e,n){if(g(n))return e.stylize("undefined","undefined");if(M(n)){var o="'"+JSON.stringify(n).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(o,"string")}return r(n)?e.stylize(""+n,"number"):w(n)?e.stylize(""+n,"boolean"):a(n)?e.stylize("null","null"):void 0}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function P(e,n,o,f,d){for(var i=[],t=0,u=n.length;u>t;++t)i.push(C(n,String(t))?c(e,n,o,f,String(t),!0):"");return D.forEach(d,function(d){d.match(/^\d+$/)||i.push(c(e,n,o,f,d,!0))}),i}function c(e,n,o,f,d,i){var t,l,p;if(p=D.getOwnPropertyDescriptor(n,d)||{value:n[d]},p.get?l=p.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):p.set&&(l=e.stylize("[Setter]","special")),C(f,d)||(t="["+d+"]"),l||(D.indexOf(e.seen,p.value)<0?(l=a(o)?u(e,p.value,null):u(e,p.value,o-1),l.indexOf("\n")>-1&&(l=i?l.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+l.split("\n").map(function(e){return" "+e}).join("\n"))):l=e.stylize("[Circular]","special")),g(t)){if(i&&d.match(/^\d+$/))return l;t=JSON.stringify(""+d),t.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(t=t.substr(1,t.length-2),t=e.stylize(t,"name")):(t=t.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),t=e.stylize(t,"string"))}return t+": "+l}function s(e,n,o){var f=0,d=D.reduce(e,function(e,n){return f++,n.indexOf("\n")>=0&&f++,e+n.replace(/\u001b\[\d\d?m/g,"").length+1},0);return d>60?o[0]+(""===n?"":n+"\n ")+" "+e.join(",\n ")+" "+o[1]:o[0]+n+" "+e.join(", ")+" "+o[1]}function y(e){return D.isArray(e)}function w(e){return"boolean"==typeof e}function a(e){return null===e}function b(e){return null==e}function r(e){return"number"==typeof e}function M(e){return"string"==typeof e}function X(e){return"symbol"==typeof e}function g(e){return void 0===e}function m(e){return x(e)&&"[object RegExp]"===z(e)}function x(e){return"object"==typeof e&&e}function j(e){return x(e)&&"[object Date]"===z(e)}function h(e){return x(e)&&"[object Error]"===z(e)}function k(e){return"function"==typeof e}function q(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function v(e){return e instanceof Buffer}function z(e){return Object.prototype.toString.call(e)}function A(e){return 10>e?"0"+e.toString(10):e.toString(10)}function B(){var e=new Date,n=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":");return[e.getDate(),F[e.getMonth()],n].join(" ")}function C(e,n){return Object.prototype.hasOwnProperty.call(e,n)}var D=e("_shims"),E=/%[sdj%]/g;o.format=function(e){if(!M(e)){for(var n=[],o=0;o<arguments.length;o++)n.push(f(arguments[o]));return n.join(" ")}for(var o=1,d=arguments,i=d.length,t=String(e).replace(E,function(e){if("%%"===e)return"%";if(o>=i)return e;switch(e){case"%s":return String(d[o++]);case"%d":return Number(d[o++]);case"%j":try{return JSON.stringify(d[o++])}catch(n){return"[Circular]"}default:return e}}),u=d[o];i>o;u=d[++o])t+=a(u)||!x(u)?" "+u:" "+f(u);return t},o.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},o.isArray=y,o.isBoolean=w,o.isNull=a,o.isNullOrUndefined=b,o.isNumber=r,o.isString=M,o.isSymbol=X,o.isUndefined=g,o.isRegExp=m,o.isObject=x,o.isDate=j,o.isError=h,o.isFunction=k,o.isPrimitive=q,o.isBuffer=v;var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];o.log=function(){console.log("%s - %s",B(),o.format.apply(o,arguments))},o.inherits=function(e,n){e.super_=n,e.prototype=D.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},o._extend=function(e,n){if(!n||!x(n))return e;for(var o=D.keys(n),f=o.length;f--;)e[o[f]]=n[o[f]];return e}},{_shims:5}]},{},[]),n.exports=e("buffer-browserify")},{}],135:[function(e,n){var o=n.exports={};o.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var o=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){var f=o.shift();f()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),o.title="browser",o.browser=!0,o.env={},o.argv=[],o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")}},{}],136:[function(e,n){var o=e("__browserify_Buffer").Buffer;!function(){"use strict";function e(e){var n;return n=e instanceof o?e:new o(e.toString(),"binary"),n.toString("base64")}n.exports=e}()},{__browserify_Buffer:134}],137:[function(e,n){"use strict";var o=e("underscore"),f=e("bluebird"),d=f.promisify(e("request")),i=e("jxt"),t=e("./lib/xrd");n.exports=function(e,n){"string"==typeof e&&(e={host:e}),e=o.extend({ssl:!0,json:!0,xrd:!0},e);var u=e.ssl?"https://":"http://",l=new f(function(n,o){d(u+e.host+"/.well-known/host-meta.json").spread(function(e,o){n(JSON.parse(o))}).catch(o)}),p=new f(function(n,o){d(u+e.host+"/.well-known/host-meta").spread(function(e,o){var f=i.parse(o,t);n(f.toJSON())}).catch(o)});return new f(function(e,n){f.some([l,p],1).spread(e).catch(function(){n("no-host-meta")})}).nodeify(n)}},{"./lib/xrd":138,bluebird:142,jxt:198,request:120,underscore:178}],138:[function(e,n){"use strict";var o=e("underscore"),f=e("jxt"),d="http://docs.oasis-open.org/ns/xri/xrd-1.0",i={get:function(){var e={},n=f.find(this.xml,d,"Property");return o.each(n,function(n){var o=f.getAttribute(n,"type");e[o]=n.textContent}),e}},t=n.exports=f.define({name:"xrd",namespace:d,element:"XRD",fields:{subject:f.subText(d,"Subject"),expires:f.dateSub(d,"Expires"),aliases:f.multiSubText(d,"Alias"),properties:i}}),u=f.define({name:"xrdlink",namespace:d,element:"Link",fields:{rel:f.attribute("rel"),href:f.attribute("href"),type:f.attribute("type"),template:f.attribute("template"),titles:f.subLangText(d,"Title","default"),properties:i}});f.extend(t,u,"links")},{jxt:198,underscore:178}],139:[function(e,n){"use strict";n.exports=function(n,o,f){function d(e,n,f){var d=o(e,i,f,n===!0&&e._isBound()?e._boundTo:void 0),t=d.promise();return t.isRejected()?t:(d.setHowMany(1),d.setUnwrap(),d.init(),t)}{var i=e("./some_promise_array.js")(f);e("./assert.js")}n.any=function(e){return d(e,!1,n.any)},n.prototype.any=function(){return d(this,!0,this.any)}}},{"./assert.js":140,"./some_promise_array.js":173}],140:[function(e,n){"use strict";n.exports=function(){var e=function(){function e(e){this.constructor$(e),this.message=e,this.name="AssertionError"}return e.prototype=new Error,e.prototype.constructor=e,e.prototype.constructor$=Error,e}();return function n(o,f){if(o!==!0){var d=new e(f);throw Error.captureStackTrace&&Error.captureStackTrace(d,n),console&&console.error&&console.error(d.stack+""),d}}}()},{}],141:[function(e,n){"use strict";function o(){this._isTickUsed=!1,this._length=0,this._lateBuffer=new d,this._functionBuffer=new d(75e3);var e=this;this.consumeFunctionBuffer=function(){e._consumeFunctionBuffer()}}var f=(e("./assert.js"),e("./schedule.js")),d=e("./queue.js"),i=e("./util.js").errorObj,t=e("./util.js").tryCatch1;o.prototype.haveItemsQueued=function(){return this._length>0},o.prototype.invokeLater=function(e,n,o){this._lateBuffer.push(e,n,o),this._queueTick()},o.prototype.invoke=function(e,n,o){var f=this._functionBuffer;f.push(e,n,o),this._length=f.length(),this._queueTick()},o.prototype._consumeFunctionBuffer=function(){for(var e=this._functionBuffer;e.length()>0;){var n=e.shift(),o=e.shift(),f=e.shift();n.call(o,f)}this._reset(),this._consumeLateBuffer()},o.prototype._consumeLateBuffer=function(){for(var e=this._lateBuffer;e.length()>0;){var n=e.shift(),o=e.shift(),f=e.shift(),d=t(n,o,f);if(d===i)throw this._queueTick(),d.e}},o.prototype._queueTick=function(){this._isTickUsed||(f(this.consumeFunctionBuffer),this._isTickUsed=!0)},o.prototype._reset=function(){this._isTickUsed=!1,this._length=0},n.exports=new o},{"./assert.js":140,"./queue.js":166,"./schedule.js":169,"./util.js":177}],142:[function(e,n){"use strict";var o=e("./promise.js")();n.exports=o},{"./promise.js":158}],143:[function(e,n){"use strict";n.exports=function(e){function n(e){var n="string"==typeof this?this:""+this;return e[n]}e.prototype.call=function(e){for(var n=arguments.length,o=new Array(n-1),f=1;n>f;++f)o[f-1]=arguments[f];return this._then(function(n){return n[e].apply(n,o)},void 0,void 0,void 0,void 0,this.call)},e.prototype.get=function(e){return this._then(n,void 0,void 0,e,void 0,this.get)}}},{}],144:[function(e,n){"use strict";n.exports=function(n,o){var f=e("./errors.js"),d=e("./async.js"),i=(e("./assert.js"),f.CancellationError),t={};n.prototype._cancel=function(){if(!this.isCancellable())return this;var e;if(void 0!==(e=this._cancellationParent))return void e.cancel(t);var n=new i;this._attachExtraTrace(n),this._rejectUnchecked(n)},n.prototype.cancel=function(e){return this.isCancellable()?e===t?(this._cancel(),this):(d.invokeLater(this._cancel,this,void 0),this):this},n.prototype.cancellable=function(){return this._cancellable()?this:(this._setCancellable(),this._cancellationParent=void 0,this)},n.prototype.uncancellable=function(){var e=new n(o);return e._setTrace(this.uncancellable,this),e._follow(this),e._unsetCancellable(),this._isBound()&&e._setBoundTo(this._boundTo),e},n.prototype.fork=function(e,n,o){var f=this._then(e,n,o,void 0,void 0,this.fork);return f._setCancellable(),f._cancellationParent=void 0,f}}},{"./assert.js":140,"./async.js":141,"./errors.js":148}],145:[function(e,n){"use strict";n.exports=function(){function n(e){var n;if("function"==typeof e)n="[function "+(e.name||"anonymous")+"]";else{n=e.toString();var f=/\[object [a-zA-Z0-9$_]+\]/;if(f.test(n))try{var d=JSON.stringify(e);n=d}catch(i){}0===n.length&&(n="(empty array)")}return"(<"+o(n)+">, no stack trace)"}function o(e){var n=41;return e.length<n?e:e.substr(0,n-3)+"..."}function f(e,n){this.captureStackTrace(e,n)}var d=(e("./assert.js"),e("./util.js").inherits),i=e("./es5.js").defineProperty,t=new RegExp("\\b(?:[\\w.]*Promise(?:Array|Spawn)?\\$_\\w+|tryCatch(?:1|2|Apply)|new \\w*PromiseArray|\\w*PromiseArray\\.\\w*PromiseArray|setTimeout|CatchFilter\\$_\\w+|makeNodePromisified|processImmediate|process._tickCallback|nextTick|Async\\$\\w+)\\b"),u=null,l=null,p=!1;
d(f,Error),f.prototype.captureStackTrace=function(e,n){P(this,e,n)},f.possiblyUnhandledRejection=function(e){if("object"==typeof console){var n;if("object"==typeof e||"function"==typeof e){var o=e.stack;n="Possibly unhandled "+l(o,e)}else n="Possibly unhandled "+String(e);"function"==typeof console.error||"object"==typeof console.error?console.error(n):("function"==typeof console.log||"object"==typeof console.error)&&console.log(n)}},p="CapturedTrace$captureStackTrace"!==f.prototype.captureStackTrace.name,f.combine=function(e,n){for(var o=e.length-1,f=n.length-1;f>=0;--f){var d=n[f];if(e[o]!==d)break;e.pop(),o--}e.push("From previous event:");for(var i=e.concat(n),l=[],f=0,p=i.length;p>f;++f)t.test(i[f])||f>0&&!u.test(i[f])&&"From previous event:"!==i[f]||l.push(i[f]);return l},f.isSupported=function(){return"function"==typeof P};var P=function c(){if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){u=/^\s*at\s*/,l=function(e,o){return"string"==typeof e?e:void 0!==o.name&&void 0!==o.message?o.name+". "+o.message:n(o)};var e=Error.captureStackTrace;return function(n,o){e(n,o)}}var o=new Error;if(!p&&"string"==typeof o.stack&&"function"==typeof"".startsWith&&o.stack.startsWith("stackDetection@")&&"stackDetection"===c.name){i(Error,"stackTraceLimit",{writable:!0,enumerable:!1,configurable:!1,value:25}),u=/@/;var f=/[@\n]/;return l=function(e,o){return"string"==typeof e?o.name+". "+o.message+"\n"+e:void 0!==o.name&&void 0!==o.message?o.name+". "+o.message:n(o)},function(e,n){var o,d=n.name,i=(new Error).stack,t=i.split(f),u=t.length;for(o=0;u>o&&t[o]!==d;o+=2);t=t.slice(o+2),u=t.length-2;var l="";for(o=0;u>o;o+=2)l+=t[o],l+="@",l+=t[o+1],l+="\n";e.stack=l}}return l=function(e,o){return"string"==typeof e?e:"object"!=typeof o&&"function"!=typeof o||void 0===o.name||void 0===o.message?n(o):o.name+". "+o.message},null}();return f}},{"./assert.js":140,"./es5.js":150,"./util.js":177}],146:[function(e,n){"use strict";n.exports=function(n){function o(e,n,o){this._instances=e,this._callback=n,this._promise=o}function f(e,n){var o={},f=i(e,o,n);if(f===t)return f;var d=u(o);return d.length?(t.e=new TypeError("Catch filter must inherit from Error or be a simple predicate function"),t):f}var d=e("./util.js"),i=d.tryCatch1,t=d.errorObj,u=e("./es5.js").keys;return o.prototype.doFilter=function(e){for(var o=this._callback,d=this._promise,u=d._isBound()?d._boundTo:void 0,l=0,p=this._instances.length;p>l;++l){var P=this._instances[l],c=P===Error||null!=P&&P.prototype instanceof Error;if(c&&e instanceof P){var s=i(o,u,e);return s===t?(n.e=s.e,n):s}if("function"==typeof P&&!c){var y=f(P,e);if(y===t){this._promise._attachExtraTrace(t.e),e=t.e;break}if(y){var s=i(o,u,e);return s===t?(n.e=s.e,n):s}}}return n.e=e,n},o}},{"./es5.js":150,"./util.js":177}],147:[function(e,n){"use strict";var o=e("./util.js"),f=(e("./assert.js"),o.isPrimitive),d=o.wrapsPrimitiveReceiver;n.exports=function(e){var n=function(){return this},o=function(){throw this},i=function(e,n){return 1===n?function(){throw e}:2===n?function(){return e}:void 0};e.prototype["return"]=e.prototype.thenReturn=function(e){return d&&f(e)?this._then(i(e,2),void 0,void 0,void 0,void 0,this.thenReturn):this._then(n,void 0,void 0,e,void 0,this.thenReturn)},e.prototype["throw"]=e.prototype.thenThrow=function(e){return d&&f(e)?this._then(i(e,1),void 0,void 0,void 0,void 0,this.thenThrow):this._then(o,void 0,void 0,e,void 0,this.thenThrow)}}},{"./assert.js":140,"./util.js":177}],148:[function(e,n){"use strict";function o(e){return(1&e)>0}function f(e){return(2&e)>0}function d(e){return 1|e}function i(e){return 2|e}function t(e){return-3&e}function u(e){var n;return X(e)&&void 0!==(n=e.__promiseHandled__)&&(e.__promiseHandled__=t(n)),e}function l(e){try{g(e,"__rejectionError__",w)}catch(n){}}function p(e){return null==e?!1:e instanceof w||e.__rejectionError__===w}function P(e){try{return g(e,"__promiseHandled__",0),!0}catch(n){return!1}}function c(e){return e instanceof m}function s(e){if(c(e)){var n=e.__promiseHandled__;return void 0===n?P(e):!o(n)}return!1}function y(e,n){function o(o){this.message="string"==typeof o?o:n,this.name=e,m.captureStackTrace&&m.captureStackTrace(this,this.constructor)}return M(o,m),o}function w(e){this.name="RejectionError",this.message=e,this.cause=e,e instanceof m?(this.message=e.message,this.stack=e.stack):m.captureStackTrace&&m.captureStackTrace(this,this.constructor)}var a=e("./global.js"),b=e("./es5.js").freeze,r=e("./util.js"),M=r.inherits,X=r.isObject,g=r.notEnumerableProp,m=a.Error,x=a.TypeError;"function"!=typeof x&&(x=y("TypeError","type error"));var j=a.RangeError;"function"!=typeof j&&(j=y("RangeError","range error"));var h=y("CancellationError","cancellation error"),k=y("TimeoutError","timeout error");M(w,m);var q="__BluebirdErrorTypes__",v=a[q];v||(v=b({CancellationError:h,TimeoutError:k,RejectionError:w}),g(a,q,v)),n.exports={Error:m,TypeError:x,RangeError:j,CancellationError:v.CancellationError,RejectionError:v.RejectionError,TimeoutError:v.TimeoutError,originatesFromRejection:p,markAsOriginatingFromRejection:l,attachDefaultState:P,ensureNotHandled:u,withHandledUnmarked:t,withHandledMarked:i,withStackAttached:d,isStackAttached:o,isHandled:f,canAttach:s}},{"./es5.js":150,"./global.js":154,"./util.js":177}],149:[function(e,n){"use strict";n.exports=function(n){function o(e){var o=new f(e),d=n.rejected(o),i=d._peekContext();return null!=i&&i._attachExtraTrace(o),d}var f=e("./errors.js").TypeError;return o}},{"./errors.js":148}],150:[function(e,n){function o(e){var n=[];for(var o in e)l.call(e,o)&&n.push(o);return n}function f(e,n,o){return e[n]=o.value,e}function d(e){return e}function i(e){try{return Object(e).constructor.prototype}catch(n){return P}}function t(e){try{return"[object Array]"===p.call(e)}catch(n){return!1}}var u=function(){"use strict";return void 0===this}();if(u)n.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,keys:Object.keys,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:u};else{var l={}.hasOwnProperty,p={}.toString,P={}.constructor.prototype;n.exports={isArray:t,keys:o,defineProperty:f,freeze:d,getPrototypeOf:i,isES5:u}}},{}],151:[function(e,n){"use strict";n.exports=function(n){function o(e){for(var n=this._settledValue,o=n.length,f=new Array(o),d=0,i=0;o>i;++i)e[i]&&(f[d++]=n[i]);return f.length=d,f}var f=(e("./assert.js"),e("./util.js").isArray,{ref:null});n.filter=function(e,d){return n.map(e,d,f)._then(o,void 0,void 0,f.ref,void 0,n.filter)},n.prototype.filter=function(e){return this.map(e,f)._then(o,void 0,void 0,f.ref,void 0,this.filter)}}},{"./assert.js":140,"./util.js":177}],152:[function(e,n){n.exports=function(n,o){function f(){return this}function d(){throw P(this),this}function i(e){return function(){return e}}function t(e){return function(){throw P(e),e}}function u(e,n,o){var l=c&&s(n);return o?e._then(l?f:i(n),y,void 0,n,void 0,u):e._then(l?d:t(n),y,void 0,n,void 0,u)}function l(e){var f=this.promise,d=this.handler,i=f._isBound()?d.call(f._boundTo):d();if(void 0!==i){var t=n._cast(i,l,void 0);if(n.is(t))return u(t,e,f.isFulfilled())}return f.isRejected()?(P(e),o.e=e,o):e}var p=e("./util.js"),P=e("./errors.js").ensureNotHandled,c=p.wrapsPrimitiveReceiver,s=p.isPrimitive,y=p.thrower;n.prototype.lastly=n.prototype["finally"]=function(e){if("function"!=typeof e)return this.then();var n={promise:this,handler:e};return this._then(l,l,void 0,n,void 0,this.lastly)}}},{"./errors.js":148,"./util.js":177}],153:[function(e,n){"use strict";n.exports=function(n,o,f){var d=e("./promise_spawn.js")(n,f),i=e("./errors.js"),t=i.TypeError;n.coroutine=function(e){if("function"!=typeof e)throw new t("generatorFunction must be a function");var n=d;return function o(){var f=e.apply(this,arguments),d=new n(void 0,void 0,o);return d._generator=f,d._next(void 0),d.promise()}},n.spawn=function(e){if("function"!=typeof e)return o("generatorFunction must be a function");var f=new d(e,this,n.spawn),i=f.promise();return f._run(n.spawn),i}}},{"./errors.js":148,"./promise_spawn.js":162}],154:[function(e,n){var o=e("__browserify_process"),f="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};n.exports=function(){return"undefined"!=typeof this?this:"undefined"!=typeof o&&"undefined"!=typeof f&&"string"==typeof o.execPath?f:"undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator&&null!==navigator&&"string"==typeof navigator.appName?void 0!==window.wrappedJSObject?window.wrappedJSObject:window:void 0}()},{__browserify_process:135}],155:[function(e,n){"use strict";n.exports=function(n,o,f,d){function i(e){var d=this,t=void 0;"function"!=typeof d&&(t=d.receiver,d=d.fn);var u=!1,l=new Array(e.length);if(void 0===t)for(var p=0,P=e.length;P>p;++p){var c=d(e[p],p,P);if(!u){var s=n._cast(c,i,void 0);if(s instanceof n){if(s.isFulfilled()){l[p]=s._settledValue;continue}u=!0,c=s}}l[p]=c}else for(var p=0,P=e.length;P>p;++p){var c=d.call(t,e[p],p,P);if(!u){var s=n._cast(c,i,void 0);if(s instanceof n){if(s.isFulfilled()){l[p]=s._settledValue;continue}u=!0,c=s}}l[p]=c}return u?o(l,f,i,void 0).promise():l}function t(e,n,t,u,l){if("function"!=typeof n)return d("fn must be a function");t===!0&&e._isBound()&&(n={fn:n,receiver:e._boundTo});var p=o(e,f,u,t===!0&&e._isBound()?e._boundTo:void 0).promise();return void 0!==l&&(l.ref=p),p._then(i,void 0,void 0,n,void 0,u)}e("./assert.js");n.prototype.map=function(e,n){return t(this,e,!0,this.map,n)},n.map=function(e,o,f){return t(e,o,!1,n.map,f)}}},{"./assert.js":140}],156:[function(e,n){"use strict";n.exports=function(n){function o(e){throw e}function f(e,n){var f=this,d=u(f,n,null,e);d===p&&t.invokeLater(o,void 0,d.e)}function d(e,n){var f=this,d=l(f,n,e);d===p&&t.invokeLater(o,void 0,d.e)}var i=e("./util.js"),t=e("./async.js"),u=(e("./assert.js"),i.tryCatch2),l=i.tryCatch1,p=i.errorObj;n.prototype.nodeify=function(e){return"function"==typeof e&&this._then(f,d,void 0,e,this._isBound()?this._boundTo:null,this.nodeify),this}}},{"./assert.js":140,"./async.js":141,"./util.js":177}],157:[function(e,n){"use strict";n.exports=function(n,o){var f=(e("./assert.js"),e("./util.js")),d=e("./async.js"),i=f.tryCatch1,t=f.errorObj;n.prototype.progressed=function(e){return this._then(void 0,void 0,e,void 0,void 0,this.progressed)},n.prototype._progress=function(e){this._isFollowingOrFulfilledOrRejected()||this._progressUnchecked(e)},n.prototype._progressHandlerAt=function(e){return 0===e?this._progressHandler0:this[e+2-5]},n.prototype._doProgressWith=function(e){var o=e.value,f=e.handler,d=e.promise,u=e.receiver;this._pushContext();var l=i(f,u,o);this._popContext(),l===t?null!=l.e&&"StopProgressPropagation"===l.e.name?l.e.__promiseHandled__=2:(d._attachExtraTrace(l.e),d._progress(l.e)):n.is(l)?l._then(d._progress,null,null,d,void 0,this._progress):d._progress(l)},n.prototype._progressUnchecked=function(e){if(this.isPending())for(var f=this._length(),i=0;f>i;i+=5){var t=this._progressHandlerAt(i),u=this._promiseAt(i);if(n.is(u))"function"==typeof t?d.invoke(this._doProgressWith,this,{handler:t,promise:u,receiver:this._receiverAt(i),value:e}):d.invoke(u._progress,u,e);else{var l=this._receiverAt(i);"function"==typeof t?t.call(l,e,u):n.is(l)&&l._isProxied()?l._progressUnchecked(e):o(l,u)&&l._promiseProgressed(e,u)}}}}},{"./assert.js":140,"./async.js":141,"./util.js":177}],158:[function(e,n){var o=e("__browserify_process");n.exports=function(){function n(e){return void 0===e?!1:e instanceof d}function f(e,n){return e instanceof w?n>=0:!1}function d(e){if("function"!=typeof e)throw new v("the promise constructor requires a resolver function");if(this.constructor!==d)throw new v("the promise constructor cannot be invoked directly");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,this._boundTo=void 0,e!==c&&this._resolveFromResolver(e)}function i(e,n,o){return t(e,w,o,n===!0&&e._isBound()?e._boundTo:void 0).promise()}function t(e,o,f,i){var u=null;return M(e)?u=e:(u=d._cast(e,f,void 0),u!==e?u._setBoundTo(i):n(u)||(u=null)),null!==u?new o(u,"function"==typeof f?f:t,i):{promise:function(){return L("expecting an array, a promise or a thenable")}}}var u=e("./global.js"),l=(e("./assert.js"),e("./util.js")),p=e("./async.js"),P=e("./errors.js"),c=function(){},s={},y={e:null},w=e("./promise_array.js")(d,c),a=e("./captured_trace.js")(),b=e("./catch_filter.js")(y),r=e("./promise_resolver.js"),M=l.isArray,X=l.notEnumerableProp,g=l.isObject,m=l.ensurePropertyExpansion,x=l.errorObj,j=l.tryCatch1,h=l.tryCatch2,k=l.tryCatchApply,q=P.RangeError,v=P.TypeError,z=P.CancellationError,A=P.TimeoutError,B=P.RejectionError,C=P.originatesFromRejection,D=P.markAsOriginatingFromRejection,E=P.ensureNotHandled,F=P.withHandledMarked,G=P.withStackAttached,H=P.isStackAttached,I=P.isHandled,J=P.canAttach,K=l.thrower,L=e("./errors_api_rejection")(d),N=function(){return new v("circular promise resolution chain")};d.prototype.bind=function(e){var n=new d(c);return O&&n._setTrace(this.bind,this),n._follow(this),n._setBoundTo(e),this._cancellable()&&(n._setCancellable(),n._cancellationParent=this),n},d.prototype.toString=function(){return"[object Promise]"},d.prototype.caught=d.prototype["catch"]=function(e){var n=arguments.length;if(n>1){var o,f=new Array(n-1),d=0;for(o=0;n-1>o;++o){var i=arguments[o];if("function"!=typeof i){var t=new v("A catch filter must be an error constructor or a filter function");return this._attachExtraTrace(t),void p.invoke(this._reject,this,t)}f[d++]=i}f.length=d,e=arguments[o],this._resetTrace(this.caught);var u=new b(f,e,this);return this._then(void 0,u.doFilter,void 0,u,void 0,this.caught)}return this._then(void 0,e,void 0,void 0,void 0,this.caught)},d.prototype.then=function(e,n,o){return this._then(e,n,o,void 0,void 0,this.then)},d.prototype.done=function(e,n,o){var f=this._then(e,n,o,void 0,void 0,this.done);f._setIsFinal()},d.prototype.spread=function(e,n){return this._then(e,n,void 0,s,void 0,this.spread)},d.prototype.isFulfilled=function(){return(268435456&this._bitField)>0},d.prototype.isRejected=function(){return(134217728&this._bitField)>0},d.prototype.isPending=function(){return!this.isResolved()},d.prototype.isResolved=function(){return(402653184&this._bitField)>0},d.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable()},d.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this._settledValue,e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this._settledValue,e.isRejected=!0),e},d.prototype.all=function(){return i(this,!0,this.all)},d.is=n,d.all=function(e){return i(e,!1,d.all)},d.join=function(){for(var e=arguments.length,n=new Array(e),o=0;e>o;++o)n[o]=arguments[o];return t(n,w,d.join,void 0).promise()},d.resolve=d.fulfilled=function(e,n){var o=new d(c);return O&&o._setTrace("function"==typeof n?n:d.resolve,void 0),o._tryFollow(e)?o:(o._cleanValues(),o._setFulfilled(),o._settledValue=e,o)},d.reject=d.rejected=function(e){var n=new d(c);return O&&n._setTrace(d.reject,void 0),D(e),n._cleanValues(),n._setRejected(),n._settledValue=e,n},d.prototype.error=function(e){return this.caught(C,e)},d.prototype._resolveFromSyncValue=function(e,n){if(e===x)this._cleanValues(),this._setRejected(),this._settledValue=e.e;else{var o=d._cast(e,n,void 0);o instanceof d?this._follow(o):(this._cleanValues(),this._setFulfilled(),this._settledValue=e)}},d.method=function(e){if("function"!=typeof e)throw new v("fn must be a function");return function n(){var o;switch(arguments.length){case 0:o=j(e,this,void 0);break;case 1:o=j(e,this,arguments[0]);break;case 2:o=h(e,this,arguments[0],arguments[1]);break;default:for(var f=arguments.length,i=new Array(f),t=0;f>t;++t)i[t]=arguments[t];o=k(e,i,this)}var u=new d(c);return O&&u._setTrace(n,void 0),u._resolveFromSyncValue(o,n),u}},d["try"]=d.attempt=function(e,n,o){if("function"!=typeof e)return L("fn must be a function");var f=M(n)?k(e,n,o):j(e,o,n),i=new d(c);return O&&i._setTrace(d.attempt,void 0),i._resolveFromSyncValue(f,d.attempt),i},d.defer=d.pending=function(e){var n=new d(c);return O&&n._setTrace("function"==typeof e?e:d.defer,void 0),new r(n)},d.bind=function(e){var n=new d(c);return O&&n._setTrace(d.bind,void 0),n._setFulfilled(),n._setBoundTo(e),n},d.cast=function(e,n){"function"!=typeof n&&(n=d.cast);var o=d._cast(e,n,void 0);return o instanceof d?o:d.resolve(o,n)},d.onPossiblyUnhandledRejection=function(e){a.possiblyUnhandledRejection="function"==typeof e?e:void 0};var O=!1||!("undefined"==typeof o||"string"!=typeof o.execPath||"object"!=typeof o.env||!o.env.BLUEBIRD_DEBUG&&"development"!==o.env.NODE_ENV);d.longStackTraces=function(){if(p.haveItemsQueued()&&O===!1)throw new Error("cannot enable long stack traces after promises have been created");O=a.isSupported()},d.hasLongStackTraces=function(){return O&&a.isSupported()},d.prototype._setProxyHandlers=function(e,n){var o=this._length();if(o>=4194298&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=e;else{var f=o-5;this[f+3]=n,this[f+4]=e,this[f+0]=this[f+1]=this[f+2]=void 0}this._setLength(o+5)},d.prototype._proxyPromiseArray=function(e,n){this._setProxyHandlers(e,n)},d.prototype._proxyPromise=function(e){e._setProxied(),this._setProxyHandlers(e,-1)},d.prototype._then=function(e,n,o,f,i,t){var u=void 0!==i,l=u?i:new d(c);if(O&&!u){var P=this._peekContext()===this._traceParent;l._traceParent=P?this._traceParent:this,l._setTrace("function"==typeof t?t:this._then,this)}!u&&this._isBound()&&l._setBoundTo(this._boundTo);var s=this._addCallbacks(e,n,o,l,f);return!u&&this._cancellable()&&(l._setCancellable(),l._cancellationParent=this),this.isResolved()&&p.invoke(this._queueSettleAt,this,s),l},d.prototype._length=function(){return 4194303&this._bitField},d.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},d.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},d.prototype._setLength=function(e){this._bitField=-4194304&this._bitField|4194303&e},d.prototype._cancellable=function(){return(67108864&this._bitField)>0},d.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},d.prototype._setRejected=function(){this._bitField=134217728|this._bitField},d.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},d.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},d.prototype._isFinal=function(){return(33554432&this._bitField)>0},d.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},d.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},d.prototype._receiverAt=function(e){var n;return n=0===e?this._receiver0:this[e+4-5],this._isBound()&&void 0===n?this._boundTo:n},d.prototype._promiseAt=function(e){return 0===e?this._promise0:this[e+3-5]},d.prototype._fulfillmentHandlerAt=function(e){return 0===e?this._fulfillmentHandler0:this[e+0-5]},d.prototype._rejectionHandlerAt=function(e){return 0===e?this._rejectionHandler0:this[e+1-5]},d.prototype._unsetAt=function(e){0===e?this._fulfillmentHandler0=this._rejectionHandler0=this._progressHandler0=this._promise0=this._receiver0=void 0:this[e-5+0]=this[e-5+1]=this[e-5+2]=this[e-5+3]=this[e-5+4]=void 0},d.prototype._resolveFromResolver=function(e){function n(e){f._tryFollow(e)||f._fulfill(e)}function o(e){f._attachExtraTrace(e),D(e),f._reject(e)}var f=this,d=O;d&&(this._setTrace(this._resolveFromResolver,void 0),this._pushContext());var i=h(e,void 0,n,o);d&&this._popContext(),void 0!==i&&i===x&&f._reject(i.e)},d.prototype._addCallbacks=function(e,n,o,f,d){var i=this._length();if(i>=4194298&&(i=0,this._setLength(0)),0===i)this._promise0=f,void 0!==d&&(this._receiver0=d),"function"==typeof e&&(this._fulfillmentHandler0=e),"function"==typeof n&&(this._rejectionHandler0=n),"function"==typeof o&&(this._progressHandler0=o);else{var t=i-5;this[t+3]=f,this[t+4]=d,this[t+0]="function"==typeof e?e:void 0,this[t+1]="function"==typeof n?n:void 0,this[t+2]="function"==typeof o?o:void 0}return this._setLength(i+5),i},d.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=8388608|this._bitField,this._boundTo=e):this._bitField=-8388609&this._bitField},d.prototype._isBound=function(){return 8388608===(8388608&this._bitField)},d.prototype._spreadSlowCase=function(e,n,o,f){var d=t(o,w,this._spreadSlowCase,f).promise()._then(function(){return e.apply(f,arguments)},void 0,void 0,s,void 0,this._spreadSlowCase);n._follow(d)},d.prototype._markHandled=function(e){if("object"==typeof e&&null!==e){var n=e.__promiseHandled__;void 0===n?X(e,"__promiseHandled__",2):e.__promiseHandled__=F(n)}},d.prototype._callSpread=function(e,o,f,i){var t=this._isBound()?this._boundTo:void 0;if(M(f))for(var u=this._settlePromiseFromHandler,l=0,p=f.length;p>l;++l)if(n(d._cast(f[l],u,void 0)))return void this._spreadSlowCase(e,o,f,t);return i&&o._pushContext(),k(e,f,t)},d.prototype._callHandler=function(e,n,o,f,d){var i;return n!==s||this.isRejected()?(d&&o._pushContext(),i=j(e,n,f)):i=this._callSpread(e,o,f,d),d&&o._popContext(),i},d.prototype._settlePromiseFromHandler=function(e,o,f,i){if(!n(i))return void e.call(o,f,i);this.isRejected()&&this._markHandled(f);var t=O,u=this._callHandler(e,o,i,f,t);if(!i._isFollowing())if(u===x||u===i||u===y){var l=u===i?N():E(u.e);u!==y&&i._attachExtraTrace(l),i._rejectUnchecked(l)}else{var p=d._cast(u,t?this._settlePromiseFromHandler:void 0,i);n(p)?(i._follow(p),p._cancellable()&&(i._cancellationParent=p,i._setCancellable())):i._fulfillUnchecked(u)}},d.prototype._follow=function(e){this._setFollowing(),e.isPending()?(e._cancellable()&&(this._cancellationParent=e,this._setCancellable()),e._proxyPromise(this)):e.isFulfilled()?this._fulfillUnchecked(e._settledValue):this._rejectUnchecked(e._settledValue),O&&null==e._traceParent&&(e._traceParent=this)},d.prototype._tryFollow=function(e){if(this._isFollowingOrFulfilledOrRejected()||e===this)return!1;var o=d._cast(e,this._tryFollow,void 0);return n(o)?(this._follow(o),!0):!1},d.prototype._resetTrace=function(e){if(O){var n=this._peekContext(),o=void 0===n;this._trace=new a("function"==typeof e?e:this._resetTrace,o)}},d.prototype._setTrace=function(e,n){if(O){var o=this._peekContext();this._traceParent=o;var f=void 0===o;this._trace=void 0!==n&&n._traceParent===o?n._trace:new a("function"==typeof e?e:this._setTrace,f)}return this},d.prototype._attachExtraTrace=function(e){if(O&&J(e)){var n=this,o=e.stack;o="string"==typeof o?o.split("\n"):[];for(var f=1;null!=n&&null!=n._trace;)o=a.combine(o,n._trace.stack.split("\n")),n=n._traceParent;var d=Error.stackTraceLimit+f,i=o.length;i>d&&(o.length=d),e.stack=o.length<=f?"(No stack trace)":o.join("\n"),e.__promiseHandled__=G(e.__promiseHandled__)}},d.prototype._notifyUnhandledRejection=function(e){I(e.__promiseHandled__)||(e.__promiseHandled__=F(e.__promiseHandled__),a.possiblyUnhandledRejection(e,this))},d.prototype._unhandledRejection=function(e){I(e.__promiseHandled__)||p.invokeLater(this._notifyUnhandledRejection,this,e)},d.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},d.prototype._fulfill=function(e){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(e)},d.prototype._reject=function(e){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(e)},d.prototype._settlePromiseAt=function(e){var n=this.isFulfilled()?this._fulfillmentHandlerAt(e):this._rejectionHandlerAt(e),o=this._settledValue,i=this._receiverAt(e),t=this._promiseAt(e);if("function"==typeof n)this._settlePromiseFromHandler(n,i,o,t);else{var u=!1,l=this.isFulfilled();void 0!==i&&(i instanceof d&&i._isProxied()?(i._unsetProxied(),l?i._fulfillUnchecked(o):i._rejectUnchecked(o),u=!0):f(i,t)&&(l?i._promiseFulfilled(o,t):i._promiseRejected(o,t),u=!0)),u||(l?t._fulfill(o):t._reject(o))}e>=256&&this._queueGC()},d.prototype._isProxied=function(){return 4194304===(4194304&this._bitField)},d.prototype._setProxied=function(){this._bitField=4194304|this._bitField},d.prototype._unsetProxied=function(){this._bitField=-4194305&this._bitField},d.prototype._isGcQueued=function(){return-1073741824===(-1073741824&this._bitField)},d.prototype._setGcQueued=function(){this._bitField=-1073741824|this._bitField},d.prototype._unsetGcQueued=function(){this._bitField=1073741823&this._bitField},d.prototype._queueGC=function(){this._isGcQueued()||(this._setGcQueued(),p.invokeLater(this._gc,this,void 0))},d.prototype._gc=function(){var e=this._length();this._unsetAt(0);for(var n=0;e>n;n++)delete this[n];this._setLength(0),this._unsetGcQueued()},d.prototype._queueSettleAt=function(e){p.invoke(this._settlePromiseAt,this,e)},d.prototype._fulfillUnchecked=function(e){if(this.isPending()){if(e===this){var n=N();return this._attachExtraTrace(n),this._rejectUnchecked(n)}this._cleanValues(),this._setFulfilled(),this._settledValue=e;var o=this._length();o>0&&p.invoke(this._fulfillPromises,this,o)}},d.prototype._fulfillPromises=function(e){e=this._length();for(var n=0;e>n;n+=5)this._settlePromiseAt(n)},d.prototype._rejectUnchecked=function(e){if(this.isPending()){if(e===this){var n=N();return this._attachExtraTrace(n),this._rejectUnchecked(n)}if(this._cleanValues(),this._setRejected(),this._settledValue=e,this._isFinal())return void p.invokeLater(K,void 0,e);var o=this._length();o>0?p.invoke(this._rejectPromises,this,o):this._ensurePossibleRejectionHandled(e)}},d.prototype._rejectPromises=function(e){e=this._length();for(var o=!1,d=0;e>d;d+=5){var i=this._rejectionHandlerAt(d);if(!o)if("function"==typeof i)o=!0;else{var t=this._promiseAt(d);if(n(t)&&t._length()>0)o=!0;else{var u=this._receiverAt(d);(n(u)&&u._length()>0||f(u,t))&&(o=!0)}}this._settlePromiseAt(d)}o||this._ensurePossibleRejectionHandled(this._settledValue)},d.prototype._ensurePossibleRejectionHandled=function(e){if(void 0!==a.possiblyUnhandledRejection&&g(e)){var n=e.__promiseHandled__,o=e;if(void 0===n)o=m(e,"__promiseHandled__",0),n=0;else if(I(n))return;H(n)||this._attachExtraTrace(o),p.invoke(this._unhandledRejection,this,o)}};var Q=[];d.prototype._peekContext=function(){var e=Q.length-1;return e>=0?Q[e]:void 0},d.prototype._pushContext=function(){O&&Q.push(this)},d.prototype._popContext=function(){O&&Q.pop()};var R=u.Promise;return d.noConflict=function(){return u.Promise===d&&(u.Promise=R),d},a.isSupported()||(d.longStackTraces=function(){},O=!1),d._makeSelfResolutionError=N,e("./finally.js")(d,y),e("./direct_resolve.js")(d),e("./thenables.js")(d),d.RangeError=q,d.CancellationError=z,d.TimeoutError=A,d.TypeError=v,d.RejectionError=B,e("./timers.js")(d,c),e("./synchronous_inspection.js")(d),e("./any.js")(d,t,w),e("./race.js")(d,c),e("./call_get.js")(d),e("./filter.js")(d,t,w,L),e("./generators.js")(d,L,c),e("./map.js")(d,t,w,L),e("./nodeify.js")(d),e("./promisify.js")(d,c),e("./props.js")(d,w),e("./reduce.js")(d,t,w,L,c),e("./settle.js")(d,t,w),e("./some.js")(d,t,w,L),e("./progress.js")(d,f),e("./cancel.js")(d,c),d.prototype=d.prototype,d}},{"./any.js":139,"./assert.js":140,"./async.js":141,"./call_get.js":143,"./cancel.js":144,"./captured_trace.js":145,"./catch_filter.js":146,"./direct_resolve.js":147,"./errors.js":148,"./errors_api_rejection":149,"./filter.js":151,"./finally.js":152,"./generators.js":153,"./global.js":154,"./map.js":155,"./nodeify.js":156,"./progress.js":157,"./promise_array.js":159,"./promise_resolver.js":161,"./promisify.js":163,"./props.js":165,"./race.js":167,"./reduce.js":168,"./settle.js":170,"./some.js":172,"./synchronous_inspection.js":174,"./thenables.js":175,"./timers.js":176,"./util.js":177,__browserify_process:135}],159:[function(e,n){"use strict";n.exports=function(n,o){function f(e){switch(e){case-1:return void 0;case-2:return[];case-3:return{}}}function d(e,f,d){var i=this._promise=new n(o),t=void 0;n.is(e)&&(t=e,e._cancellable()&&(i._setCancellable(),i._cancellationParent=e),e._isBound()&&i._setBoundTo(d)),i._setTrace(f,t),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var i=(e("./assert.js"),e("./errors.js").ensureNotHandled),t=e("./util.js"),u=e("./async.js"),l={}.hasOwnProperty,p=t.isArray;return d.PropertiesPromiseArray=function(){},d.prototype.length=function(){return this._length},d.prototype.promise=function(){return this._promise},d.prototype._init=function(e,o){var i=this._values;if(n.is(i)){if(!i.isFulfilled())return i.isPending()?void i._then(this._init,this._reject,void 0,this,o,this.constructor):void this._reject(i._settledValue);if(i=i._settledValue,!p(i)){var t=new n.TypeError("expecting an array, a promise or a thenable");return void this.__hardReject__(t)}this._values=i}if(0===i.length)return void this._resolve(f(o));var P,c=i.length,s=c;P=this instanceof d.PropertiesPromiseArray?this._values:new Array(c);for(var y=!1,w=0;c>w;++w){var a=i[w];if(void 0!==a||l.call(i,w)){var b=n._cast(a,void 0,void 0);b instanceof n&&b.isPending()?b._proxyPromiseArray(this,w):y=!0,P[w]=b}else s--}if(0===s)return void this._resolve(-2===o?P:f(o));if(this._values=P,this._length=s,y){var r=s===c?this._scanDirectValues:this._scanDirectValuesHoled;u.invoke(r,this,c)}},d.prototype._settlePromiseAt=function(e){var o=this._values[e];n.is(o)?o.isFulfilled()?this._promiseFulfilled(o._settledValue,e):o.isRejected()&&this._promiseRejected(o._settledValue,e):this._promiseFulfilled(o,e)},d.prototype._scanDirectValuesHoled=function(e){for(var n=0;e>n&&!this._isResolved();++n)l.call(this._values,n)&&this._settlePromiseAt(n)},d.prototype._scanDirectValues=function(e){for(var n=0;e>n&&!this._isResolved();++n)this._settlePromiseAt(n)},d.prototype._isResolved=function(){return null===this._values},d.prototype._resolve=function(e){this._values=null,this._promise._fulfill(e)},d.prototype.__hardReject__=d.prototype._reject=function(e){i(e),this._values=null,this._promise._attachExtraTrace(e),this._promise._reject(e)},d.prototype._promiseProgressed=function(e,n){this._isResolved()||this._promise._progress({index:n,value:e})},d.prototype._promiseFulfilled=function(e,n){if(!this._isResolved()){this._values[n]=e;var o=++this._totalResolved;o>=this._length&&this._resolve(this._values)}},d.prototype._promiseRejected=function(e){this._isResolved()||(this._totalResolved++,this._reject(e))},d}},{"./assert.js":140,"./async.js":141,"./errors.js":148,"./util.js":177}],160:[function(e,n){"use strict";function o(e){void 0!==e?(this._bitField=e._bitField,this._settledValue=e.isResolved()?e._settledValue:void 0):(this._bitField=0,this._settledValue=void 0)}var f=e("./errors.js").TypeError;o.prototype.isFulfilled=function(){return(268435456&this._bitField)>0},o.prototype.isRejected=function(){return(134217728&this._bitField)>0},o.prototype.isPending=function(){return 0===(402653184&this._bitField)},o.prototype.value=function(){if(!this.isFulfilled())throw new f("cannot get fulfillment value of a non-fulfilled promise");return this._settledValue},o.prototype.error=function(){if(!this.isRejected())throw new f("cannot get rejection reason of a non-rejected promise");return this._settledValue},n.exports=o},{"./errors.js":148}],161:[function(e,n){"use strict";function o(e){return e instanceof Error&&y.getPrototypeOf(e)===Error.prototype}function f(e){var n;return n=o(e)?new P(e):e,l.markAsOriginatingFromRejection(n),n}function d(e){function n(n,o){if(n){var d=f(u(n));e._attachExtraTrace(d),e._reject(d)}else if(arguments.length>2){for(var i=arguments.length,t=new Array(i-1),l=1;i>l;++l)t[l-1]=arguments[l];e._fulfill(t)}else e._fulfill(o)}return n}var i,t=e("./util.js"),u=t.maybeWrapAsError,l=e("./errors.js"),p=l.TimeoutError,P=l.RejectionError,c=e("./async.js"),s=t.haveGetters,y=e("./es5.js");if(i=s?function(e){this.promise=e}:function(e){this.promise=e,this.asCallback=d(e),this.callback=this.asCallback},s){var w={get:function(){return d(this.promise)}};y.defineProperty(i.prototype,"asCallback",w),y.defineProperty(i.prototype,"callback",w)
}i._nodebackForPromise=d,i.prototype.toString=function(){return"[object PromiseResolver]"},i.prototype.resolve=i.prototype.fulfill=function(e){var n=this.promise;n._tryFollow(e)||c.invoke(n._fulfill,n,e)},i.prototype.reject=function(e){var n=this.promise;l.markAsOriginatingFromRejection(e),n._attachExtraTrace(e),c.invoke(n._reject,n,e)},i.prototype.progress=function(e){c.invoke(this.promise._progress,this.promise,e)},i.prototype.cancel=function(){c.invoke(this.promise.cancel,this.promise,void 0)},i.prototype.timeout=function(){this.reject(new p("timeout"))},i.prototype.isResolved=function(){return this.promise.isResolved()},i.prototype.toJSON=function(){return this.promise.toJSON()},n.exports=i},{"./async.js":141,"./errors.js":148,"./es5.js":150,"./util.js":177}],162:[function(e,n){"use strict";n.exports=function(n,o){function f(e,f,d){var i=this._promise=new n(o);i._setTrace(d,void 0),this._generatorFunction=e,this._receiver=f,this._generator=void 0}var d=e("./errors.js"),i=d.TypeError,t=d.ensureNotHandled,u=e("./util.js"),l=u.isArray,p=u.errorObj,P=u.tryCatch1;return 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._next(void 0)},f.prototype._continue=function c(e){if(e===p)return this._generator=void 0,this._promise._attachExtraTrace(e.e),void this._promise._reject(e.e);var o=e.value;if(e.done===!0)this._generator=void 0,this._promise._tryFollow(o)||this._promise._fulfill(o);else{var f=n._cast(o,c,void 0);if(!(f instanceof n)){if(!l(f))return void this._throw(new i("A value was yielded that could not be treated as a promise"));f=n.all(f)}f._then(this._next,this._throw,void 0,this,null,void 0)}},f.prototype._throw=function(e){t(e),this._promise._attachExtraTrace(e),this._continue(P(this._generator["throw"],this._generator,e))},f.prototype._next=function(e){this._continue(P(this._generator.next,this._generator,e))},f}},{"./errors.js":148,"./util.js":177}],163:[function(e,n){"use strict";n.exports=function(n,o){function f(e){return e.__isPromisified__===!0}function d(e,f,d){function i(n){for(var o=new Array(n),d=0,i=o.length;i>d;++d)o[d]="a"+(d+1);var t=n>0?",":"";return"string"==typeof e&&f===l?"this['"+e+"']("+o.join(",")+t+" fn);break;":(void 0===f?"callback("+o.join(",")+t+" fn);":"callback.call("+(f===l?"this":"receiver")+", "+o.join(",")+t+" fn);")+"break;"}function t(){return"var args = new Array(len + 1);var i = 0;for (var i = 0; i < len; ++i) { args[i] = arguments[i];}args[i] = fn;"}var u="string"==typeof d?d+"Async":"promisified";return new Function("Promise","callback","receiver","withAppended","maybeWrapAsError","nodebackForPromise","INTERNAL","var ret = function "+u+'(a1, a2, a3, a4, a5) {"use strict";var len = arguments.length;var promise = new Promise(INTERNAL);promise._setTrace('+u+", void 0);var fn = nodebackForPromise(promise);try{switch(len) {case 1:"+i(1)+"case 2:"+i(2)+"case 3:"+i(3)+"case 0:"+i(0)+"case 4:"+i(4)+"case 5:"+i(5)+"default: "+t()+("string"==typeof e?"this['"+e+"'].apply(":"callback.apply(")+(f===l?"this":"receiver")+", args); break;}}catch(e){ var wrapped = maybeWrapAsError(e);promise._attachExtraTrace(wrapped);promise._reject(wrapped);}return promise;}; ret.__isPromisified__ = true; return ret;")(n,e,f,s,y,c,o)}function i(e,f){function d(){var i=f;f===l&&(i=this),"string"==typeof e&&(e=i[e]);var t=new n(o);t._setTrace(d,void 0);var u=c(t);try{e.apply(i,s(arguments,u))}catch(p){var P=y(p);t._attachExtraTrace(P),t._reject(P)}return t}return d.__isPromisified__=!0,d}function t(){}function u(e,n,o){if(o){for(var f=X(e),d=0,i=f.length;i>d;d+=2){var u=f[d],p=f[d+1],P=u+"__beforePromisified__",c=u+"Async";a(e,P,p),e[c]=g(P,l,u)}return f.length>16&&(t.prototype=e),e}return g(e,n,void 0)}var l={},p=e("./util.js"),P=e("./es5.js"),c=e("./promise_resolver.js")._nodebackForPromise,s=p.withAppended,y=p.maybeWrapAsError,w=p.canEvaluate,a=p.notEnumerableProp,b=p.deprecated,r=(e("./assert.js"),new RegExp("__beforePromisified__$")),M={}.hasOwnProperty,X=function(){if(P.isES5){var e=Object.create,n=Object.getOwnPropertyDescriptor;return function(o){for(var d=o,i=[],t=e(null);null!==o;){for(var u=P.keys(o),l=0,p=u.length;p>l;++l){var c=u[l];if(!(t[c]||r.test(c)||M.call(d,c+"__beforePromisified__"))){t[c]=!0;var s=n(o,c);null==s||"function"!=typeof s.value||f(s.value)||i.push(c,s.value)}}o=P.getPrototypeOf(o)}return i}}return function(e){var n=[];for(var o in e)if(!r.test(o)&&!M.call(e,o+"__beforePromisified__")){var d=e[o];"function"!=typeof d||f(d)||n.push(o,d)}return n}}(),g=w?d:i;n.promisify=function(e,n){if("object"==typeof e&&null!==e)return b("Promise.promisify for promisifying entire objects is deprecated. Use Promise.promisifyAll instead."),u(e,n,!0);if("function"!=typeof e)throw new TypeError("fn must be a function");return f(e)?e:u(e,arguments.length<2?l:n,!1)},n.promisifyAll=function(e){if("function"!=typeof e&&"object"!=typeof e)throw new TypeError("the target of promisifyAll must be an object or a function");return u(e,void 0,!0)}}},{"./assert.js":140,"./es5.js":150,"./promise_resolver.js":161,"./util.js":177}],164:[function(e,n){"use strict";n.exports=function(n,o){function f(e,n,o){for(var f=t.keys(e),d=new Array(f.length),i=0,u=d.length;u>i;++i)d[i]=e[f[i]];if(this.constructor$(d,n,o),!this._isResolved())for(var i=0,u=f.length;u>i;++i)d.push(f[i])}var d=(e("./assert.js"),e("./util.js")),i=d.inherits,t=e("./es5.js");return i(f,o),f.prototype._init=function(){this._init$(void 0,-3)},f.prototype._promiseFulfilled=function(e,n){if(!this._isResolved()){this._values[n]=e;var o=++this._totalResolved;if(o>=this._length){for(var f={},d=this.length(),i=0,t=this.length();t>i;++i)f[this._values[i+d]]=this._values[i];this._resolve(f)}}},f.prototype._promiseProgressed=function(e,n){this._isResolved()||this._promise._progress({key:this._values[n+this.length()],value:e})},o.PropertiesPromiseArray=f,f}},{"./assert.js":140,"./es5.js":150,"./util.js":177}],165:[function(e,n){"use strict";n.exports=function(n,o){function f(e,o,f){var i,l=n._cast(e,f,void 0);return u(l)?(n.is(l)?i=l._then(n.props,void 0,void 0,void 0,void 0,f):(i=new d(l,f,o===!0&&l._isBound()?l._boundTo:void 0).promise(),o=!1),o===!0&&l._isBound()&&i._setBoundTo(l._boundTo),i):t("cannot await properties of a non-object")}var d=e("./properties_promise_array.js")(n,o),i=e("./util.js"),t=e("./errors_api_rejection")(n),u=i.isObject;n.prototype.props=function(){return f(this,!0,this.props)},n.props=function(e){return f(e,!1,n.props)}}},{"./errors_api_rejection":149,"./properties_promise_array.js":164,"./util.js":177}],166:[function(e,n){"use strict";function o(e,n,o,f,d){for(var i=0;d>i;++i)o[i+f]=e[i+n]}function f(e){return e>>>=0,e-=1,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function d(e){return"number"!=typeof e?16:f(Math.min(Math.max(16,e),1073741824))}function i(e){this._capacity=d(e),this._length=0,this._front=0,this._makeCapacity()}e("./assert.js");i.prototype._willBeOverCapacity=function(e){return this._capacity<e},i.prototype._pushOne=function(e){var n=this.length();this._checkCapacity(n+1);var o=this._front+n&this._capacity-1;this[o]=e,this._length=n+1},i.prototype.push=function(e,n,o){var f=this.length()+3;if(this._willBeOverCapacity(f))return this._pushOne(e),this._pushOne(n),void this._pushOne(o);var d=this._front+f-3;this._checkCapacity(f);var i=this._capacity-1;this[d+0&i]=e,this[d+1&i]=n,this[d+2&i]=o,this._length=f},i.prototype.shift=function(){var e=this._front,n=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length--,n},i.prototype.length=function(){return this._length},i.prototype._makeCapacity=function(){for(var e=this._capacity,n=0;e>n;++n)this[n]=void 0},i.prototype._checkCapacity=function(e){this._capacity<e&&this._resizeTo(this._capacity<<3)},i.prototype._resizeTo=function(e){var n=this._front,f=this._capacity,d=new Array(f),i=this.length();if(o(this,0,d,0,f),this._capacity=e,this._makeCapacity(),this._front=0,f>=n+i)o(d,n,this,0,i);else{var t=i-(n+i&f-1);o(d,n,this,0,t),o(d,0,this,t,i-t)}},n.exports=i},{"./assert.js":140}],167:[function(e,n){"use strict";n.exports=function(n,o){function f(e,f,l){var p=n._cast(e,f,void 0);if(n.is(p))return t(p);if(!i(e))return d("expecting an array, a promise or a thenable");var P=new n(o);P._setTrace(f,l),void 0!==l&&(l._isBound()&&P._setBoundTo(l._boundTo),l._cancellable()&&(P._setCancellable(),P._cancellationParent=l));for(var c=P._fulfill,s=P._reject,y=0,w=e.length;w>y;++y){var a=e[y];(void 0!==a||u.call(e,y))&&n.cast(a)._then(c,s,void 0,P,null,f)}return P}var d=e("./errors_api_rejection.js")(n),i=e("./util.js").isArray,t=function(e){return e.then(function n(o){return f(o,n,e)})},u={}.hasOwnProperty;n.race=function(e){return f(e,n.race,void 0)},n.prototype.race=function(){return f(this,this.race,void 0)}}},{"./errors_api_rejection.js":149,"./util.js":177}],168:[function(e,n){"use strict";n.exports=function(n,o,f,d,i){function t(e,o,f,d,t){this.promise=new n(i),this.index=o,this.length=d.length,this.items=d,this.callback=e,this.receiver=t,this.accum=f}function u(e,n){var o=this,f=void 0;"function"!=typeof o&&(f=o.receiver,o=o.fn);var d=e.length,i=void 0,u=0;void 0!==n?(i=n,u=0):(u=1,d>0&&(i=e[0]));var l=u;if(l>=d)return i;var p=new t(o,l,i,e,f);return p.iterate(),p.promise}function l(e){var n=this.fn,o=this.initialValue;return u.call(n,e,o)}function p(e,n,o,f,d){return o._then(function i(o){return P(e,n,o,f,i)},void 0,void 0,void 0,void 0,d)}function P(e,i,t,P,c){if("function"!=typeof i)return d("fn must be a function");if(P===!0&&e._isBound()&&(i={fn:i,receiver:e._boundTo}),void 0!==t){if(n.is(t)){if(!t.isFulfilled())return p(e,i,t,P,c);t=t._settledValue}return o(e,f,c,P===!0&&e._isBound()?e._boundTo:void 0).promise()._then(l,void 0,void 0,{fn:i,initialValue:t},void 0,n.reduce)}return o(e,f,c,P===!0&&e._isBound()?e._boundTo:void 0).promise()._then(u,void 0,void 0,i,void 0,c)}e("./assert.js");t.prototype.reject=function(e){this.promise._reject(e)},t.prototype.fulfill=function(e,n){this.accum=e,this.index=n+1,this.iterate()},t.prototype.iterate=function(){for(var e=this.index,o=this.length,f=this.items,d=this.accum,i=this.receiver,t=this.callback,u=this.iterate;o>e;++e)if(d=n._cast(t.call(i,d,f[e],e,o),u,void 0),d instanceof n)return void d._then(this.fulfill,this.reject,void 0,this,e,u);this.promise._fulfill(d)},n.reduce=function(e,o,f){return P(e,o,f,!1,n.reduce)},n.prototype.reduce=function(e,n){return P(this,e,n,!0,this.reduce)}}},{"./assert.js":140}],169:[function(e,n){{var o,f=e("__browserify_process"),d=e("./global.js");e("./assert.js")}if("undefined"!=typeof f&&null!==f&&"function"==typeof f.cwd&&"function"==typeof f.nextTick)o=f.nextTick;else if("function"!=typeof MutationObserver&&"function"!=typeof WebkitMutationObserver&&"function"!=typeof WebKitMutationObserver||"undefined"==typeof document||"function"!=typeof document.createElement)if("function"==typeof d.postMessage&&"function"!=typeof d.importScripts&&"function"==typeof d.addEventListener&&"function"==typeof d.removeEventListener){var i="bluebird_message_key_"+Math.random();o=function(){function e(e){if(e.source===d&&e.data===i){var o=n;n=void 0,o()}}var n=void 0;return d.addEventListener("message",e,!1),function(e){n=e,d.postMessage(i,"*")}}()}else o="function"==typeof MessageChannel?function(){var e=void 0,n=new MessageChannel;return n.port1.onmessage=function(){var n=e;e=void 0,n()},function(o){e=o,n.port2.postMessage(null)}}():d.setTimeout?function(e){setTimeout(e,4)}:function(e){e()};else o=function(){var e=d.MutationObserver||d.WebkitMutationObserver||d.WebKitMutationObserver,n=document.createElement("div"),o=void 0,f=new e(function(){var e=o;o=void 0,e()});return f.observe(n,{attributes:!0}),function(e){o=e,n.setAttribute("class","foo")}}();n.exports=o},{"./assert.js":140,"./global.js":154,__browserify_process:135}],170:[function(e,n){"use strict";n.exports=function(n,o,f){function d(e,n,f){return o(e,i,f,n===!0&&e._isBound()?e._boundTo:void 0).promise()}var i=e("./settled_promise_array.js")(n,f);n.settle=function(e){return d(e,!1,n.settle)},n.prototype.settle=function(){return d(this,!0,this.settle)}}},{"./settled_promise_array.js":171}],171:[function(e,n){"use strict";n.exports=function(n,o){function f(e,n,o){this.constructor$(e,n,o)}var d=(e("./assert.js"),e("./promise_inspection.js")),i=e("./util.js"),t=i.inherits;return t(f,o),f.prototype._promiseResolved=function(e,n){this._values[e]=n;var o=++this._totalResolved;o>=this._length&&this._resolve(this._values)},f.prototype._promiseFulfilled=function(e,n){if(!this._isResolved()){var o=new d;o._bitField=268435456,o._settledValue=e,this._promiseResolved(n,o)}},f.prototype._promiseRejected=function(e,n){if(!this._isResolved()){var o=new d;o._bitField=134217728,o._settledValue=e,this._promiseResolved(n,o)}},f}},{"./assert.js":140,"./promise_inspection.js":160,"./util.js":177}],172:[function(e,n){"use strict";n.exports=function(n,o,f,d){function i(e,n,f,i){if((0|n)!==n||0>n)return d("expecting a positive integer");var u=o(e,t,i,f===!0&&e._isBound()?e._boundTo:void 0),l=u.promise();return l.isRejected()?l:(u.setHowMany(n),u.init(),l)}{var t=e("./some_promise_array.js")(f);e("./assert.js")}n.some=function(e,o){return i(e,o,!1,n.some)},n.prototype.some=function(e){return i(this,e,!0,this.some)}}},{"./assert.js":140,"./some_promise_array.js":173}],173:[function(e,n){"use strict";n.exports=function(n){function o(e,n,o){this.constructor$(e,n,o),this._howMany=0,this._unwrap=!1,this._initialized=!1}var f=e("./util.js"),d=e("./errors.js").RangeError,i=f.inherits,t=f.isArray;return i(o,n),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-2);var e=t(this._values);if(this._holes=e?this._values.length-this.length():0,!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()){var n="(Promise.some) input array contains less than "+this._howMany+" promises";this._reject(new d(n))}}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(e){this._isResolved()||(this._howMany=e)},o.prototype._promiseFulfilled=function(e){this._isResolved()||(this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values)))},o.prototype._promiseRejected=function(e){this._isResolved()||(this._addRejected(e),this.howMany()>this._canPossiblyFulfill()&&this._reject(this._values.length===this.length()?[]:this._values.slice(this.length()+this._holes)))},o.prototype._fulfilled=function(){return this._totalResolved},o.prototype._rejected=function(){return this._values.length-this.length()-this._holes},o.prototype._addRejected=function(e){this._values.push(e)},o.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},o.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},o}},{"./errors.js":148,"./util.js":177}],174:[function(e,n){"use strict";n.exports=function(n){var o=e("./promise_inspection.js");n.prototype.inspect=function(){return new o(this)}}},{"./promise_inspection.js":160}],175:[function(e,n){"use strict";n.exports=function(n){function o(e){try{return e.then}catch(n){return t.e=n,t}}function f(e,i,l){if(u(e)){if(e instanceof n)return e;var p=o(e);if(p===t)return i="function"==typeof i?i:f,void 0!==l&&l._attachExtraTrace(p.e),n.reject(p.e,i);if("function"==typeof p)return i="function"==typeof i?i:f,d(e,p,i,l)}return e}function d(e,o,f,d){function i(o){if(!P){if(P=!0,e===o){var f=n._makeSelfResolutionError();return void 0!==d&&d._attachExtraTrace(f),void p.promise._reject(f)}p.resolve(o)}}function u(e){P||(P=!0,void 0!==d&&d._attachExtraTrace(e),p.promise._attachExtraTrace(e),p.promise._reject(e))}var p=n.defer(f),P=!1,c=l(o,e,i,u);return c!==t||P||(P=!0,void 0!==d&&d._attachExtraTrace(c.e),p.promise._reject(c.e)),p.promise}var i=(e("./assert.js"),e("./util.js")),t=i.errorObj,u=i.isObject,l=i.tryCatch2;n._cast=f}},{"./assert.js":140,"./util.js":177}],176:[function(e,n){"use strict";var o=e("./global.js"),f=function(e,n){for(var f=arguments.length,d=new Array(f-2),i=2;f>i;++i)d[i-2]=arguments[i];o.setTimeout(function(){e.apply(void 0,d)},n)},d={};o.setTimeout(function(e){e===d&&(f=o.setTimeout)},1,d),n.exports=function(n,o){var d=(e("./util.js"),e("./assert.js"),e("./errors.js")),i=e("./errors_api_rejection")(n),t=n.TimeoutError,u=function(e,n,o){if(e.isPending()){"string"!=typeof n&&(n="operation timed out after "+o+" ms");var f=new t(n);d.markAsOriginatingFromRejection(f),e._attachExtraTrace(f),e._rejectUnchecked(f)}},l=function(e,n){n._fulfill(e)};n.delay=function(e,d,t){if(void 0===d&&(d=e,e=void 0),(0|d)!==d||0>d)return i("expecting a positive integer");"function"!=typeof t&&(t=n.delay);var u=n._cast(e,t,void 0),p=new n(o);return n.is(u)?(u._isBound()&&p._setBoundTo(u._boundTo),u._cancellable()&&(p._setCancellable(),p._cancellationParent=u),p._setTrace(t,u),p._follow(u),p.then(function(e){return n.delay(e,d)})):(p._setTrace(t,void 0),f(l,d,e,p),p)},n.prototype.delay=function(e){return n.delay(this,e,this.delay)},n.prototype.timeout=function(e,d){if((0|e)!==e||0>e)return i("expecting a positive integer");var t=new n(o);return t._setTrace(this.timeout,this),this._isBound()&&t._setBoundTo(this._boundTo),this._cancellable()&&(t._setCancellable(),t._cancellationParent=this),t._follow(this),f(u,e,t,d,e),t}}},{"./assert.js":140,"./errors.js":148,"./errors_api_rejection":149,"./global.js":154,"./util.js":177}],177:[function(e,n){"use strict";function o(e){"undefined"!=typeof console&&null!==console&&"function"==typeof console.warn&&console.warn("Bluebird: "+e)}function f(e,n,o){try{return e.call(n,o)}catch(f){return M.e=f,M}}function d(e,n,o,f){try{return e.call(n,o,f)}catch(d){return M.e=d,M}}function i(e,n,o){try{return e.apply(o,n)}catch(f){return M.e=f,M}}function t(e){return"string"==typeof e?e:""+e}function u(e){return null==e||e===!0||e===!1||"string"==typeof e||"number"==typeof e}function l(e){return!u(e)}function p(e){return u(e)?new Error(t(e)):e}function P(e,n){var o,f=e.length,d=new Array(f+1);for(o=0;f>o;++o)d[o]=e[o];return d[o]=n,d}function c(e,n,o){var f={value:o,configurable:!0,enumerable:!1,writable:!0};return w.defineProperty(e,n,f),e}function s(e){throw e}var y=e("./global.js"),w=(e("./assert.js"),e("./es5.js")),a=function(){try{var e={};return w.defineProperty(e,"f",{get:function(){return 3}}),3===e.f}catch(n){return!1}}(),b=function(e,n,o){try{return c(e,n,o),e}catch(f){for(var d={},i=w.keys(e),t=0,u=i.length;u>t;++t)try{var l=i[t];d[l]=e[l]}catch(p){d[l]=p}return c(d,n,o),d}},r=function(){return"undefined"!=typeof window&&null!==window&&"undefined"!=typeof window.document&&"undefined"!=typeof navigator&&null!==navigator&&"string"==typeof navigator.appName&&window===y?!1:!0}(),M={e:{}},X=function(e,n){function o(){this.constructor=e,this.constructor$=n;for(var o in n.prototype)f.call(n.prototype,o)&&"$"!==o.charAt(o.length-1)&&(this[o+"$"]=n.prototype[o])}var f={}.hasOwnProperty;return o.prototype=n.prototype,e.prototype=new o,e.prototype},g=function(){return"string"!==this}.call("string"),m={thrower:s,isArray:w.isArray,haveGetters:a,notEnumerableProp:c,isPrimitive:u,isObject:l,ensurePropertyExpansion:b,canEvaluate:r,deprecated:o,errorObj:M,tryCatch1:f,tryCatch2:d,tryCatchApply:i,inherits:X,withAppended:P,asString:t,maybeWrapAsError:p,wrapsPrimitiveReceiver:g};n.exports=m},{"./assert.js":140,"./es5.js":150,"./global.js":154}],178:[function(e,n,o){(function(){var e=this,f=e._,d={},i=Array.prototype,t=Object.prototype,u=Function.prototype,l=i.push,p=i.slice,P=i.concat,c=t.toString,s=t.hasOwnProperty,y=i.forEach,w=i.map,a=i.reduce,b=i.reduceRight,r=i.filter,M=i.every,X=i.some,g=i.indexOf,m=i.lastIndexOf,x=Array.isArray,j=Object.keys,h=u.bind,k=function(e){return e instanceof k?e:this instanceof k?void(this._wrapped=e):new k(e)};"undefined"!=typeof o?("undefined"!=typeof n&&n.exports&&(o=n.exports=k),o._=k):e._=k,k.VERSION="1.5.2";var q=k.each=k.forEach=function(e,n,o){if(null!=e)if(y&&e.forEach===y)e.forEach(n,o);else if(e.length===+e.length){for(var f=0,i=e.length;i>f;f++)if(n.call(o,e[f],f,e)===d)return}else for(var t=k.keys(e),f=0,i=t.length;i>f;f++)if(n.call(o,e[t[f]],t[f],e)===d)return};k.map=k.collect=function(e,n,o){var f=[];return null==e?f:w&&e.map===w?e.map(n,o):(q(e,function(e,d,i){f.push(n.call(o,e,d,i))}),f)};var v="Reduce of empty array with no initial value";k.reduce=k.foldl=k.inject=function(e,n,o,f){var d=arguments.length>2;if(null==e&&(e=[]),a&&e.reduce===a)return f&&(n=k.bind(n,f)),d?e.reduce(n,o):e.reduce(n);if(q(e,function(e,i,t){d?o=n.call(f,o,e,i,t):(o=e,d=!0)}),!d)throw new TypeError(v);return o},k.reduceRight=k.foldr=function(e,n,o,f){var d=arguments.length>2;if(null==e&&(e=[]),b&&e.reduceRight===b)return f&&(n=k.bind(n,f)),d?e.reduceRight(n,o):e.reduceRight(n);var i=e.length;if(i!==+i){var t=k.keys(e);i=t.length}if(q(e,function(u,l,p){l=t?t[--i]:--i,d?o=n.call(f,o,e[l],l,p):(o=e[l],d=!0)}),!d)throw new TypeError(v);return o},k.find=k.detect=function(e,n,o){var f;return z(e,function(e,d,i){return n.call(o,e,d,i)?(f=e,!0):void 0}),f},k.filter=k.select=function(e,n,o){var f=[];return null==e?f:r&&e.filter===r?e.filter(n,o):(q(e,function(e,d,i){n.call(o,e,d,i)&&f.push(e)}),f)},k.reject=function(e,n,o){return k.filter(e,function(e,f,d){return!n.call(o,e,f,d)},o)},k.every=k.all=function(e,n,o){n||(n=k.identity);var f=!0;return null==e?f:M&&e.every===M?e.every(n,o):(q(e,function(e,i,t){return(f=f&&n.call(o,e,i,t))?void 0:d}),!!f)};var z=k.some=k.any=function(e,n,o){n||(n=k.identity);var f=!1;return null==e?f:X&&e.some===X?e.some(n,o):(q(e,function(e,i,t){return f||(f=n.call(o,e,i,t))?d:void 0}),!!f)};k.contains=k.include=function(e,n){return null==e?!1:g&&e.indexOf===g?-1!=e.indexOf(n):z(e,function(e){return e===n})},k.invoke=function(e,n){var o=p.call(arguments,2),f=k.isFunction(n);return k.map(e,function(e){return(f?n:e[n]).apply(e,o)})},k.pluck=function(e,n){return k.map(e,function(e){return e[n]})},k.where=function(e,n,o){return k.isEmpty(n)?o?void 0:[]:k[o?"find":"filter"](e,function(e){for(var o in n)if(n[o]!==e[o])return!1;return!0})},k.findWhere=function(e,n){return k.where(e,n,!0)},k.max=function(e,n,o){if(!n&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!n&&k.isEmpty(e))return-1/0;var f={computed:-1/0,value:-1/0};return q(e,function(e,d,i){var t=n?n.call(o,e,d,i):e;t>f.computed&&(f={value:e,computed:t})}),f.value},k.min=function(e,n,o){if(!n&&k.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!n&&k.isEmpty(e))return 1/0;var f={computed:1/0,value:1/0};return q(e,function(e,d,i){var t=n?n.call(o,e,d,i):e;t<f.computed&&(f={value:e,computed:t})}),f.value},k.shuffle=function(e){var n,o=0,f=[];return q(e,function(e){n=k.random(o++),f[o-1]=f[n],f[n]=e}),f},k.sample=function(e,n,o){return arguments.length<2||o?e[k.random(e.length-1)]:k.shuffle(e).slice(0,Math.max(0,n))};var A=function(e){return k.isFunction(e)?e:function(n){return n[e]}};k.sortBy=function(e,n,o){var f=A(n);return k.pluck(k.map(e,function(e,n,d){return{value:e,index:n,criteria:f.call(o,e,n,d)}}).sort(function(e,n){var o=e.criteria,f=n.criteria;if(o!==f){if(o>f||void 0===o)return 1;if(f>o||void 0===f)return-1}return e.index-n.index}),"value")};var B=function(e){return function(n,o,f){var d={},i=null==o?k.identity:A(o);return q(n,function(o,t){var u=i.call(f,o,t,n);e(d,u,o)}),d}};k.groupBy=B(function(e,n,o){(k.has(e,n)?e[n]:e[n]=[]).push(o)}),k.indexBy=B(function(e,n,o){e[n]=o}),k.countBy=B(function(e,n){k.has(e,n)?e[n]++:e[n]=1}),k.sortedIndex=function(e,n,o,f){o=null==o?k.identity:A(o);for(var d=o.call(f,n),i=0,t=e.length;t>i;){var u=i+t>>>1;o.call(f,e[u])<d?i=u+1:t=u}return i},k.toArray=function(e){return e?k.isArray(e)?p.call(e):e.length===+e.length?k.map(e,k.identity):k.values(e):[]},k.size=function(e){return null==e?0:e.length===+e.length?e.length:k.keys(e).length},k.first=k.head=k.take=function(e,n,o){return null==e?void 0:null==n||o?e[0]:p.call(e,0,n)},k.initial=function(e,n,o){return p.call(e,0,e.length-(null==n||o?1:n))},k.last=function(e,n,o){return null==e?void 0:null==n||o?e[e.length-1]:p.call(e,Math.max(e.length-n,0))},k.rest=k.tail=k.drop=function(e,n,o){return p.call(e,null==n||o?1:n)},k.compact=function(e){return k.filter(e,k.identity)};var C=function(e,n,o){return n&&k.every(e,k.isArray)?P.apply(o,e):(q(e,function(e){k.isArray(e)||k.isArguments(e)?n?l.apply(o,e):C(e,n,o):o.push(e)}),o)};k.flatten=function(e,n){return C(e,n,[])},k.without=function(e){return k.difference(e,p.call(arguments,1))},k.uniq=k.unique=function(e,n,o,f){k.isFunction(n)&&(f=o,o=n,n=!1);var d=o?k.map(e,o,f):e,i=[],t=[];return q(d,function(o,f){(n?f&&t[t.length-1]===o:k.contains(t,o))||(t.push(o),i.push(e[f]))}),i},k.union=function(){return k.uniq(k.flatten(arguments,!0))},k.intersection=function(e){var n=p.call(arguments,1);return k.filter(k.uniq(e),function(e){return k.every(n,function(n){return k.indexOf(n,e)>=0})})},k.difference=function(e){var n=P.apply(i,p.call(arguments,1));return k.filter(e,function(e){return!k.contains(n,e)})},k.zip=function(){for(var e=k.max(k.pluck(arguments,"length").concat(0)),n=new Array(e),o=0;e>o;o++)n[o]=k.pluck(arguments,""+o);return n},k.object=function(e,n){if(null==e)return{};for(var o={},f=0,d=e.length;d>f;f++)n?o[e[f]]=n[f]:o[e[f][0]]=e[f][1];return o},k.indexOf=function(e,n,o){if(null==e)return-1;var f=0,d=e.length;if(o){if("number"!=typeof o)return f=k.sortedIndex(e,n),e[f]===n?f:-1;f=0>o?Math.max(0,d+o):o}if(g&&e.indexOf===g)return e.indexOf(n,o);for(;d>f;f++)if(e[f]===n)return f;return-1},k.lastIndexOf=function(e,n,o){if(null==e)return-1;var f=null!=o;if(m&&e.lastIndexOf===m)return f?e.lastIndexOf(n,o):e.lastIndexOf(n);for(var d=f?o:e.length;d--;)if(e[d]===n)return d;return-1},k.range=function(e,n,o){arguments.length<=1&&(n=e||0,e=0),o=arguments[2]||1;for(var f=Math.max(Math.ceil((n-e)/o),0),d=0,i=new Array(f);f>d;)i[d++]=e,e+=o;return i};var D=function(){};k.bind=function(e,n){var o,f;if(h&&e.bind===h)return h.apply(e,p.call(arguments,1));if(!k.isFunction(e))throw new TypeError;return o=p.call(arguments,2),f=function(){if(!(this instanceof f))return e.apply(n,o.concat(p.call(arguments)));D.prototype=e.prototype;var d=new D;D.prototype=null;var i=e.apply(d,o.concat(p.call(arguments)));return Object(i)===i?i:d}},k.partial=function(e){var n=p.call(arguments,1);return function(){return e.apply(this,n.concat(p.call(arguments)))}},k.bindAll=function(e){var n=p.call(arguments,1);if(0===n.length)throw new Error("bindAll must be passed function names");return q(n,function(n){e[n]=k.bind(e[n],e)}),e},k.memoize=function(e,n){var o={};return n||(n=k.identity),function(){var f=n.apply(this,arguments);return k.has(o,f)?o[f]:o[f]=e.apply(this,arguments)}},k.delay=function(e,n){var o=p.call(arguments,2);return setTimeout(function(){return e.apply(null,o)},n)},k.defer=function(e){return k.delay.apply(k,[e,1].concat(p.call(arguments,1)))},k.throttle=function(e,n,o){var f,d,i,t=null,u=0;o||(o={});var l=function(){u=o.leading===!1?0:new Date,t=null,i=e.apply(f,d)};return function(){var p=new Date;u||o.leading!==!1||(u=p);var P=n-(p-u);return f=this,d=arguments,0>=P?(clearTimeout(t),t=null,u=p,i=e.apply(f,d)):t||o.trailing===!1||(t=setTimeout(l,P)),i}},k.debounce=function(e,n,o){var f,d,i,t,u;return function(){i=this,d=arguments,t=new Date;var l=function(){var p=new Date-t;n>p?f=setTimeout(l,n-p):(f=null,o||(u=e.apply(i,d)))},p=o&&!f;return f||(f=setTimeout(l,n)),p&&(u=e.apply(i,d)),u}},k.once=function(e){var n,o=!1;return function(){return o?n:(o=!0,n=e.apply(this,arguments),e=null,n)}},k.wrap=function(e,n){return function(){var o=[e];return l.apply(o,arguments),n.apply(this,o)}},k.compose=function(){var e=arguments;return function(){for(var n=arguments,o=e.length-1;o>=0;o--)n=[e[o].apply(this,n)];return n[0]}},k.after=function(e,n){return function(){return--e<1?n.apply(this,arguments):void 0}},k.keys=j||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var n=[];for(var o in e)k.has(e,o)&&n.push(o);return n},k.values=function(e){for(var n=k.keys(e),o=n.length,f=new Array(o),d=0;o>d;d++)f[d]=e[n[d]];return f},k.pairs=function(e){for(var n=k.keys(e),o=n.length,f=new Array(o),d=0;o>d;d++)f[d]=[n[d],e[n[d]]];return f},k.invert=function(e){for(var n={},o=k.keys(e),f=0,d=o.length;d>f;f++)n[e[o[f]]]=o[f];return n},k.functions=k.methods=function(e){var n=[];for(var o in e)k.isFunction(e[o])&&n.push(o);return n.sort()},k.extend=function(e){return q(p.call(arguments,1),function(n){if(n)for(var o in n)e[o]=n[o]}),e},k.pick=function(e){var n={},o=P.apply(i,p.call(arguments,1));return q(o,function(o){o in e&&(n[o]=e[o])}),n},k.omit=function(e){var n={},o=P.apply(i,p.call(arguments,1));for(var f in e)k.contains(o,f)||(n[f]=e[f]);return n},k.defaults=function(e){return q(p.call(arguments,1),function(n){if(n)for(var o in n)void 0===e[o]&&(e[o]=n[o])}),e},k.clone=function(e){return k.isObject(e)?k.isArray(e)?e.slice():k.extend({},e):e},k.tap=function(e,n){return n(e),e};var E=function(e,n,o,f){if(e===n)return 0!==e||1/e==1/n;if(null==e||null==n)return e===n;e instanceof k&&(e=e._wrapped),n instanceof k&&(n=n._wrapped);var d=c.call(e);if(d!=c.call(n))return!1;switch(d){case"[object String]":return e==String(n);case"[object Number]":return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object RegExp]":return e.source==n.source&&e.global==n.global&&e.multiline==n.multiline&&e.ignoreCase==n.ignoreCase}if("object"!=typeof e||"object"!=typeof n)return!1;for(var i=o.length;i--;)if(o[i]==e)return f[i]==n;var t=e.constructor,u=n.constructor;if(t!==u&&!(k.isFunction(t)&&t instanceof t&&k.isFunction(u)&&u instanceof u))return!1;o.push(e),f.push(n);var l=0,p=!0;if("[object Array]"==d){if(l=e.length,p=l==n.length)for(;l--&&(p=E(e[l],n[l],o,f)););}else{for(var P in e)if(k.has(e,P)&&(l++,!(p=k.has(n,P)&&E(e[P],n[P],o,f))))break;if(p){for(P in n)if(k.has(n,P)&&!l--)break;p=!l}}return o.pop(),f.pop(),p};k.isEqual=function(e,n){return E(e,n,[],[])},k.isEmpty=function(e){if(null==e)return!0;if(k.isArray(e)||k.isString(e))return 0===e.length;for(var n in e)if(k.has(e,n))return!1;return!0},k.isElement=function(e){return!(!e||1!==e.nodeType)},k.isArray=x||function(e){return"[object Array]"==c.call(e)},k.isObject=function(e){return e===Object(e)},q(["Arguments","Function","String","Number","Date","RegExp"],function(e){k["is"+e]=function(n){return c.call(n)=="[object "+e+"]"}}),k.isArguments(arguments)||(k.isArguments=function(e){return!(!e||!k.has(e,"callee"))}),"function"!=typeof/./&&(k.isFunction=function(e){return"function"==typeof e}),k.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},k.isNaN=function(e){return k.isNumber(e)&&e!=+e},k.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},k.isNull=function(e){return null===e},k.isUndefined=function(e){return void 0===e},k.has=function(e,n){return s.call(e,n)},k.noConflict=function(){return e._=f,this},k.identity=function(e){return e},k.times=function(e,n,o){for(var f=Array(Math.max(0,e)),d=0;e>d;d++)f[d]=n.call(o,d);return f},k.random=function(e,n){return null==n&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))};var F={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};F.unescape=k.invert(F.escape);var G={escape:new RegExp("["+k.keys(F.escape).join("")+"]","g"),unescape:new RegExp("("+k.keys(F.unescape).join("|")+")","g")};k.each(["escape","unescape"],function(e){k[e]=function(n){return null==n?"":(""+n).replace(G[e],function(n){return F[e][n]})}}),k.result=function(e,n){if(null==e)return void 0;var o=e[n];return k.isFunction(o)?o.call(e):o},k.mixin=function(e){q(k.functions(e),function(n){var o=k[n]=e[n];k.prototype[n]=function(){var e=[this._wrapped];
return l.apply(e,arguments),L.call(this,o.apply(k,e))}})};var H=0;k.uniqueId=function(e){var n=++H+"";return e?e+n:n},k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;k.template=function(e,n,o){var f;o=k.defaults({},o,k.templateSettings);var d=new RegExp([(o.escape||I).source,(o.interpolate||I).source,(o.evaluate||I).source].join("|")+"|$","g"),i=0,t="__p+='";e.replace(d,function(n,o,f,d,u){return t+=e.slice(i,u).replace(K,function(e){return"\\"+J[e]}),o&&(t+="'+\n((__t=("+o+"))==null?'':_.escape(__t))+\n'"),f&&(t+="'+\n((__t=("+f+"))==null?'':__t)+\n'"),d&&(t+="';\n"+d+"\n__p+='"),i=u+n.length,n}),t+="';\n",o.variable||(t="with(obj||{}){\n"+t+"}\n"),t="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+t+"return __p;\n";try{f=new Function(o.variable||"obj","_",t)}catch(u){throw u.source=t,u}if(n)return f(n,k);var l=function(e){return f.call(this,e,k)};return l.source="function("+(o.variable||"obj")+"){\n"+t+"}",l},k.chain=function(e){return k(e).chain()};var L=function(e){return this._chain?k(e).chain():e};k.mixin(k),q(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var n=i[e];k.prototype[e]=function(){var o=this._wrapped;return n.apply(o,arguments),"shift"!=e&&"splice"!=e||0!==o.length||delete o[0],L.call(this,o)}}),q(["concat","join","slice"],function(e){var n=i[e];k.prototype[e]=function(){return L.call(this,n.apply(this._wrapped,arguments))}}),k.extend(k.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],179:[function(e,n){n.exports=e("./lib/sessionManager")},{"./lib/sessionManager":182}],180:[function(e,n){function o(e){var n=e.split("-");return"on"+n[0][0].toUpperCase()+n[0].substr(1)+n[1][0].toUpperCase()+n[1].substr(1)}function f(e){var n=this;this.sid=e.sid||Date.now().toString(),this.peer=e.peer,this.isInitiator=e.initiator||!1,this.state="starting",this.parent=e.parent,this.processingQueue=i.queue(function(e,o){var f=e.action,d=e.changes,i=e.cb;u(n.sid+": "+f),n[f](d,function(e){i(e),o()})})}var d=e("bows"),i=e("async"),t=e("wildemitter"),u=d("JingleSession");f.prototype=Object.create(t.prototype,{constructor:{value:f}}),f.prototype.process=function(e,n,f){var d=o(e);this.processingQueue.push({action:d,changes:n,cb:f})},f.prototype.send=function(e,n){n=n||{},n.sid=this.sid,n.action=e,this.parent.emit("send",{to:this.peer,type:"set",jingle:n})},Object.defineProperty(f.prototype,"state",{get:function(){return this._state},set:function(e){var n={starting:!0,pending:!0,active:!0,ended:!0};if(!n[e])throw new Error("Invalid Jingle Session State: "+e);this._state!==e&&(this._state=e,u(this.sid+": State changed to "+e))}}),Object.defineProperty(f.prototype,"starting",{get:function(){return"starting"==this._state}}),Object.defineProperty(f.prototype,"pending",{get:function(){return"pending"==this._state}}),Object.defineProperty(f.prototype,"active",{get:function(){return"active"==this._state}}),Object.defineProperty(f.prototype,"ended",{get:function(){return"ended"==this._state}}),f.prototype.start=function(){this.state="pending",u(this.sid+": Can not start generic session")},f.prototype.end=function(e,n){this.parent.peers[this.peer].splice(this.parent.peers[this.peer].indexOf(this),1),delete this.parent.sessions[this.sid],this.state="ended",e=e||{},n||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e)};var l=["content-accept","content-add","content-modify","content-reject","content-remove","description-info","session-accept","session-info","session-initiate","session-terminate","transport-accept","transport-info","transport-reject","transport-replace"];l.forEach(function(e){var n=o(e);f.prototype[n]=function(n,o){u(this.sid+": Unsupported action "+e),o()}}),n.exports=f},{async:183,bows:184,wildemitter:223}],181:[function(e,n){function o(e){t.call(this,e);var n=this,o=this.parent.config.peerConnectionConfig,f=this.parent.config.peerConnectionConstraints;o.useJingle=!0,this.pc=new u(o,f),this.pc.on("ice",this.onIceCandidate.bind(this)),this.pc.on("addStream",this.onStreamAdded.bind(this)),this.pc.on("removeStream",this.onStreamRemoved.bind(this)),this.parent.localStream?(this.pc.addStream(this.parent.localStream),this.localStream=this.parent.localStream):this.parent.once("localStream",function(e){n.pc.addStream(e),this.localStream=e})}var f=e("underscore"),d=e("util"),i=e("bows"),t=e("./genericSession"),u=e("rtcpeerconnection"),l=i("JingleMedia");d.inherits(o,t),Object.defineProperty(o.prototype,"streams",{get:function(){return this.pc.remoteStreams}}),o.prototype=f.extend(o.prototype,{start:function(){var e=this;this.state="pending",this.pc.isInitiator=!0,this.pc.offer(function(n,o){e.send("session-initiate",o.jingle)})},end:function(e){var n=this;this.pc.close(),f.each(this.streams,function(e){n.onStreamRemoved({stream:e})}),t.prototype.end.call(this,e)},accept:function(){var e=this;l(this.sid+": Accepted incoming session"),this.state="active",this.pc.answer(function(n,o){return n?l(e.sid+": Could not create WebRTC answer",n):void e.send("session-accept",o.jingle)})},ring:function(){l(this.sid+": Ringing on incoming session"),this.send("session-info",{ringing:!0})},mute:function(e,n){l(this.sid+": Muting"),this.send("session-info",{mute:{creator:e,name:n}})},unmute:function(e,n){l(this.sid+": Unmuting"),this.send("session-info",{unmute:{creator:e,name:n}})},hold:function(){l(this.sid+": Placing on hold"),this.send("session-info",{hold:!0})},resume:function(){l(this.sid+": Resuing from hold"),this.send("session-info",{active:!0})},onSessionInitiate:function(e,n){var o=this;l(o.sid+": Initiating incoming session"),this.state="pending",this.pc.isInitiator=!1,this.pc.handleOffer({type:"offer",jingle:e},function(e){return e?(l(o.sid+": Could not create WebRTC answer",e),n({condition:"general-error"})):void n()})},onSessionAccept:function(e,n){var o=this;l(this.sid+": Activating accepted outbound session"),this.state="active",this.pc.handleAnswer({type:"answer",jingle:e},function(e){return e?(l(o.sid+": Could not process WebRTC answer",e),n({condition:"general-error"})):(o.parent.emit("accepted",o),void n())})},onSessionTerminate:function(e,n){var o=this;l(this.sid+": Terminating session"),this.pc.close(),f.each(this.streams,function(e){o.onStreamRemoved({stream:e})}),t.prototype.end.call(this,e.reason,!0),n()},onTransportInfo:function(e,n){var o=this;l(this.sid+": Adding ICE candidate"),this.pc.processIce(e,function(e){e&&l(o.sid+": Could not process ICE candidate",e),n()})},onSessionInfo:function(e,n){l(e),e.ringing&&(l(this.sid+": Ringing on remote stream"),this.parent.emit("ringing",this)),e.hold&&(l(this.sid+": On hold"),this.parent.emit("hold",this)),e.active&&(l(this.sid+": Resumed from hold"),this.parent.emit("resumed",this)),e.mute&&(l(this.sid+": Muted",e.mute),this.parent.emit("mute",this,e.mute)),e.unmute&&(l(this.sid+": Unmuted",e.unmute),this.parent.emit("unmute",this,e.unmute)),n()},onIceCandidate:function(e){l(this.sid+": Discovered new ICE candidate",e.jingle),this.send("transport-info",e.jingle)},onStreamAdded:function(e){var n=this;l(this.sid+": Remote media stream added"),e.stream.onended=function(){n.onStreamRemoved({stream:e.stream})},this.parent.emit("peerStreamAdded",this,e.stream)},onStreamRemoved:function(e){l(this.sid+": Remote media stream removed"),this.parent.emit("peerStreamRemoved",this,e.stream)}}),n.exports=o},{"./genericSession":180,bows:184,rtcpeerconnection:192,underscore:222,util:123}],182:[function(e,n){function o(e){e=e||{};var n=this.config={debug:!1,peerConnectionConfig:{iceServers:[{url:"stun:stun.l.google.com:19302"}]},peerConnectionConstraints:{optional:[{DtlsSrtpKeyAgreement:!0},{RtpDataChannels:!1}]},autoAdjustMic:!1,media:{audio:!0,video:!0}};this.MediaSession=c,this.jid=e.jid,this.sessions={},this.peers={},this.screenSharingSupport=t.screenSharing;for(var o in e)n[o]=e[o];this.capabilities=["urn:xmpp:jingle:1"],t.support?this.capabilities=["urn:xmpp:jingle:1","urn:xmpp:jingle:apps:rtp:1","urn:xmpp:jingle:apps:rtp:audio","urn:xmpp:jingle:apps:rtp:video","urn:xmpp:jingle:apps:rtp:rtcb-fb:0","urn:xmpp:jingle:apps:rtp:rtp-hdrext:0","urn:xmpp:jingle:apps:rtp:ssma:0","urn:xmpp:jingle:apps:dtls:0","urn:xmpp:jingle:apps:grouping:0","urn:xmpp:jingle:transports:ice-udp:1","urn:ietf:rfc:3264","urn:ietf:rfc:5576","urn:ietf:rfc:5888"]:s("WebRTC not supported"),l.call(this),this.config.debug&&this.on("*",function(e,n,o){s(e,n,o)})}var f=e("underscore"),d=e("bows"),i=e("hark"),t=e("webrtcsupport"),u=(e("mockconsole"),e("getusermedia")),l=e("wildemitter"),p=e("mediastream-gain"),P=e("./genericSession"),c=e("./mediaSession"),s=d("Jingle");o.prototype=Object.create(l.prototype,{constructor:{value:o}}),o.prototype.addICEServer=function(e){this.config.peerConnectionConfig.iceServers.push(e)},o.prototype.startLocalMedia=function(e,n){var o=this,f=e||{video:!0,audio:!0};u(f,function(e,d){e?s("Could not start local media"):(f.audio&&o.config.detectSpeakingEvents&&o.setupAudioMonitor(d),o.localStream=d,o.config.autoAdjustMic&&(o.gainController=new p(d),o.setMicIfEnabled(.5)),s("Local media stream started"),o.emit("localStream",d)),n&&n(e,d)})},o.prototype.stopLocalMedia=function(){this.localStream&&(this.localStream.stop(),this.emit("localStreamStopped"))},o.prototype.setupAudioMonitor=function(e){s("Setup audio");var n,o=i(e),f=this;o.on("speaking",function(){f.hardMuted||(f.setMicIfEnabled(1),f.emit("speaking"))}),o.on("stopped_speaking",function(){f.hardMuted||(n&&clearTimeout(n),n=setTimeout(function(){f.setMicIfEnabled(.5),f.emit("stoppedSpeaking")},1e3))})},o.prototype.setMicIfEnabled=function(e){this.config.autoAdjustMic&&this.gainController.setGain(e)},o.prototype.sendError=function(e,n,o){o.type="cancel",this.emit("send",{to:e,id:n,type:"error",error:o})},o.prototype.process=function(e){var n=this;if("error"===e.type)return this.emit("error",e);if("result"!==e.type){var o,d,i,t=e.jingle.sid,u=e.jingle.action,l=e.jingle.contents||[],p=f.map(l,function(e){return(e.description||{}).descType}),y=this.sessions[t]||null,w=e.from.full||e.from,a=e.id;if("session-initiate"!==u){if(!y)return s("Unknown session",t),this.sendError(w,a,{condition:"item-not-found",jingleCondition:"unknown-session"});if(y.peer!==w||y.ended)return s("Session has ended, or action has wrong sender"),this.sendError(w,a,{condition:"item-not-found",jingleCondition:"unknown-session"});if("session-accept"===u&&!y.pending)return s("Tried to accept session twice",t),this.sendError(w,a,{condition:"unexpected-request",jingleCondition:"out-of-order"});if("session-terminate"!==u&&y.pendingAction&&(s("Tie break during pending request"),y.isInitiator))return this.sendError(w,a,{condition:"conflict",jingleCondition:"tie-break"})}else{if(y)return y.peer!==w?(s("Duplicate sid from new sender"),this.sendError(w,a,{condition:"service-unavailable"})):y.pending&&this.jid>y.peer?(s("Tie break new session because of duplicate sids"),this.sendError(w,a,{condition:"conflict",jingleCondition:"tie-break"})):(s("Someone is doing this wrong"),this.sendError(w,a,{condition:"unexpected-request",jingleCondition:"out-of-order"}));if(Object.keys(this.peers[w]||{}).length){o=Object.keys(this.peers[w]);for(var b=0;b<o.length;b++)if(d=o[b],i=this.sessions[d],i&&i.pending&&f.intersection(p,i.contentTypes).length&&d>t)return s("Tie break"),this.sendError(w,a,{condition:"conflict",jingleCondition:"tie-break"})}}if("session-initiate"===u){var r={sid:t,peer:w,initiator:!1,parent:this};y=p.indexOf("rtp")>=0?new c(r):new P(r),this.sessions[t]=y,this.peers[w]||(this.peers[w]=[]),this.peers[w].push(y)}y.process(u,e.jingle,function(o){o?(s("Could not process request",e,o),n.sendError(w,a,o)):(n.emit("send",{to:w,id:a,type:"result",action:u}),"session-initiate"===u&&(s("Incoming session request from ",w,y),n.emit("incoming",y)))})}},o.prototype.createMediaSession=function(e,n){var o=new c({sid:n,peer:e,initiator:!0,parent:this});return n=o.sid,this.sessions[n]=o,this.peers[e]||(this.peers[e]=[]),this.peers[e].push(o),s("Outgoing session",o.sid,o),this.emit("outgoing",o),o},o.prototype.endPeerSessions=function(e){s("Ending all sessions with",e);var n=this.peers[e]||[];n.forEach(function(e){e.end()})},n.exports=o},{"./genericSession":180,"./mediaSession":181,bows:184,getusermedia:186,hark:187,"mediastream-gain":189,mockconsole:190,underscore:222,webrtcsupport:197,wildemitter:223}],183:[function(e,n){n.exports=e(81)},{__browserify_process:135}],184:[function(e,n){(function(){function o(){var e=!!window.chrome,n=/firefox/i.test(navigator.userAgent),o=n&&!!window.console.exception;return e||o}var f,d,i,t="undefined"==typeof window,u=!t&&window.localStorage,l=u.debug,p=e("andlog"),P=0,c=15,s=function(){},y=u.debugColors||o();f=function(){var e=.618033988749895;return P+=e,P%=1,360*P},i=l&&"/"===l[0]&&new RegExp(l.substring(1,l.length-1)),d=function(e){var n,o,d;if(n=e.slice(0,c),n+=Array(c+3-n.length).join(" ")+"|",i&&!e.match(i))return s;if(y){var t=f();n="%c"+n,o="color: hsl("+t+",99%,40%); font-weight: bold",d=p.log.bind(p,n,o),["log","debug","warn","error","info"].forEach(function(e){d[e]=p[e].bind(p,n,o)})}else d=p.log.bind(p,n),["log","debug","warn","error","info"].forEach(function(e){d[e]=p[e].bind(p,n)});return d},d.config=function(e){e.padLength&&(this.padLength=e.padLength)},"undefined"!=typeof n?n.exports=d:window.bows=d}).call()},{andlog:185}],185:[function(e,n,o){!function(){var e="undefined"==typeof window,f=!e&&window.localStorage,d={};if(e)return void(n.exports=console);if(f&&f.debug&&window.console)d=window.console;else for(var i="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),t=i.length,u=function(){};t--;)d[i[t]]=u;"undefined"!=typeof o?n.exports=d:window.console=d}()},{}],186:[function(e,n){var o=window.navigator.getUserMedia||window.navigator.webkitGetUserMedia||window.navigator.mozGetUserMedia||window.navigator.msGetUserMedia;n.exports=function(e,n){var f,d=2===arguments.length,i={video:!0,audio:!0},t="PERMISSION_DENIED",u="CONSTRAINT_NOT_SATISFIED";return d||(n=e,e=i),o?void o.call(window.navigator,e,function(e){n(null,e)},function(e){var o;"string"==typeof e?(o=new Error("NavigatorUserMediaError"),o.name=e===t?t:u):(o=e,o.name||(e.name=o[t]?t:u)),n(o)}):(f=new Error("NavigatorUserMediaError"),f.name="NOT_SUPPORTED_ERROR",n(f))}},{}],187:[function(e,n){function o(e,n){var o=-1/0;e.getFloatFrequencyData(n);for(var f=0,d=n.length;d>f;f++)n[f]>o&&n[f]<0&&(o=n[f]);return o}var f=e("wildemitter"),d=window.webkitAudioContext||window.AudioContext,i=null;n.exports=function(e,n){var t=new f;if(!d)return t;var n=n||{},u=n.smoothing||.5,l=n.interval||100,p=n.threshold,P=n.play;i||(i=new d);var c,s,y;y=i.createAnalyser(),y.fftSize=512,y.smoothingTimeConstant=u,s=new Float32Array(y.fftSize),e.jquery&&(e=e[0]),e instanceof HTMLAudioElement?(c=i.createMediaElementSource(e),"undefined"==typeof P&&(P=!0),p=p||-65):(c=i.createMediaStreamSource(e),p=p||-45),c.connect(y),P&&y.connect(i.destination),t.speaking=!1,t.setThreshold=function(e){p=e},t.setInterval=function(e){l=e};var w=function(){setTimeout(function(){var e=o(y,s);t.emit("volume_change",e,p),e>p?t.speaking||(t.speaking=!0,t.emit("speaking")):t.speaking&&(t.speaking=!1,t.emit("stopped_speaking")),w()},l)};return w(),t}},{wildemitter:188}],188:[function(e,n){function o(){this.callbacks={}}n.exports=o,o.prototype.on=function(e){var n=3===arguments.length,o=n?arguments[1]:void 0,f=n?arguments[2]:arguments[1];return f._groupName=o,(this.callbacks[e]=this.callbacks[e]||[]).push(f),this},o.prototype.once=function(e){function n(){o.off(e,n),i.apply(this,arguments)}var o=this,f=3===arguments.length,d=f?arguments[1]:void 0,i=f?arguments[2]:arguments[1];return this.on(e,d,n),this},o.prototype.releaseGroup=function(e){var n,o,f,d;for(n in this.callbacks)for(d=this.callbacks[n],o=0,f=d.length;f>o;o++)d[o]._groupName===e&&(d.splice(o,1),o--,f--);return this},o.prototype.off=function(e,n){var o,f=this.callbacks[e];return f?1===arguments.length?(delete this.callbacks[e],this):(o=f.indexOf(n),f.splice(o,1),this):this},o.prototype.emit=function(e){var n,o,f=[].slice.call(arguments,1),d=this.callbacks[e],i=this.getWildcardCallbacks(e);if(d)for(n=0,o=d.length;o>n&&d[n];++n)d[n].apply(this,f);if(i)for(n=0,o=i.length;o>n&&i[n];++n)i[n].apply(this,[e].concat(f));return this},o.prototype.getWildcardCallbacks=function(e){var n,o,f=[];for(n in this.callbacks)o=n.split("*"),("*"===n||2===o.length&&e.slice(0,o[1].length)===o[1])&&(f=f.concat(this.callbacks[n]));return f}},{}],189:[function(e,n){function o(e){if(this.support=f.webAudio&&f.mediaStream,this.gain=1,this.support){var n=this.context=new f.AudioContext;this.microphone=n.createMediaStreamSource(e),this.gainFilter=n.createGain(),this.destination=n.createMediaStreamDestination(),this.outputStream=this.destination.stream,this.microphone.connect(this.gainFilter),this.gainFilter.connect(this.destination),e.removeTrack(e.getAudioTracks()[0]),e.addTrack(this.outputStream.getAudioTracks()[0])}this.stream=e}var f=e("webrtcsupport");o.prototype.setGain=function(e){this.support&&(this.gainFilter.gain.value=e,this.gain=e)},o.prototype.getGain=function(){return this.gain},o.prototype.off=function(){return this.setGain(0)},o.prototype.on=function(){this.setGain(1)},n.exports=o},{webrtcsupport:197}],190:[function(e,n){for(var o="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),f=o.length,d=function(){},i={};f--;)i[o[f]]=d;n.exports=i},{}],191:[function(e,n){function o(e){return"type: "+e.type+"\r\n"+e.sdp}function f(e,n){var o=this;t.call(this),this.peerconnection=new i.PeerConnection(e,n),this.trace=function(e,n){o.emit("PeerConnectionTrace",{time:new Date,type:e,value:n||""})},this.onicecandidate=null,this.peerconnection.onicecandidate=function(e){o.trace("onicecandidate",JSON.stringify(e.candidate,null," ")),null!==o.onicecandidate&&o.onicecandidate(e)},this.onaddstream=null,this.peerconnection.onaddstream=function(e){o.trace("onaddstream",e.stream.id),null!==o.onaddstream&&o.onaddstream(e)},this.onremovestream=null,this.peerconnection.onremovestream=function(e){o.trace("onremovestream",e.stream.id),null!==o.onremovestream&&o.onremovestream(e)},this.onsignalingstatechange=null,this.peerconnection.onsignalingstatechange=function(e){o.trace("onsignalingstatechange",o.signalingState),null!==o.onsignalingstatechange&&o.onsignalingstatechange(e)},this.oniceconnectionstatechange=null,this.peerconnection.oniceconnectionstatechange=function(e){o.trace("oniceconnectionstatechange",o.iceConnectionState),null!==o.oniceconnectionstatechange&&o.oniceconnectionstatechange(e)},this.onnegotiationneeded=null,this.peerconnection.onnegotiationneeded=function(e){o.trace("onnegotiationneeded"),null!==o.onnegotiationneeded&&o.onnegotiationneeded(e)},o.ondatachannel=null,this.peerconnection.ondatachannel=function(e){o.trace("ondatachannel",e),null!==o.ondatachannel&&o.ondatachannel(e)}}var d=e("util"),i=e("webrtcsupport"),t=e("wildemitter");d.inherits(f,t),void 0!==f.prototype.__defineGetter__&&(f.prototype.__defineGetter__("signalingState",function(){return this.peerconnection.signalingState}),f.prototype.__defineGetter__("iceConnectionState",function(){return this.peerconnection.iceConnectionState}),f.prototype.__defineGetter__("localDescription",function(){return this.peerconnection.localDescription}),f.prototype.__defineGetter__("remoteDescription",function(){return this.peerconnection.remoteDescription})),f.prototype.addStream=function(e){this.trace("addStream",e.id),this.peerconnection.addStream(e)},f.prototype.removeStream=function(e){this.trace("removeStream",e.id),this.peerconnection.removeStream(e)},f.prototype.createDataChannel=function(e,n){return this.trace("createDataChannel",e,n),this.peerconnection.createDataChannel(e,n)},f.prototype.setLocalDescription=function(e,n,f){var d=this;this.trace("setLocalDescription",o(e)),this.peerconnection.setLocalDescription(e,function(){d.trace("setLocalDescriptionOnSuccess"),n()},function(e){d.trace("setLocalDescriptionOnFailure",e),f(e)})},f.prototype.setRemoteDescription=function(e,n,f){var d=this;this.trace("setRemoteDescription",o(e)),this.peerconnection.setRemoteDescription(e,function(){d.trace("setRemoteDescriptionOnSuccess"),n()},function(e){d.trace("setRemoteDescriptionOnFailure",e),f(e)})},f.prototype.close=function(){this.trace("stop"),null!==this.statsinterval&&(window.clearInterval(this.statsinterval),this.statsinterval=null),"closed"!=this.peerconnection.signalingState&&this.peerconnection.close()},f.prototype.createOffer=function(e,n,f){var d=this;this.trace("createOffer",JSON.stringify(f,null," ")),this.peerconnection.createOffer(function(n){d.trace("createOfferOnSuccess",o(n)),e(n)},function(e){d.trace("createOfferOnFailure",e),n(e)},f)},f.prototype.createAnswer=function(e,n,f){var d=this;this.trace("createAnswer",JSON.stringify(f,null," ")),this.peerconnection.createAnswer(function(n){d.trace("createAnswerOnSuccess",o(n)),e(n)},function(e){d.trace("createAnswerOnFailure",e),n(e)},f)},f.prototype.addIceCandidate=function(e){this.trace("addIceCandidate",JSON.stringify(e,null," ")),this.peerconnection.addIceCandidate(e)},f.prototype.getStats=function(e,n){navigator.mozGetUserMedia?this.peerconnection.getStats(null,e,n):this.peerconnection.getStats(e)},n.exports=f},{util:123,webrtcsupport:197,wildemitter:223}],192:[function(e,n){function o(e,n){var o,f=this;u.call(this),e=e||{},e.iceServers=e.iceServers||[],this.pc=new l(e,n),this.pc.on("*",function(){f.emit.apply(f,arguments)}),this.pc.onremovestream=this.emit.bind(this,"removeStream"),this.pc.onnegotiationneeded=this.emit.bind(this,"negotiationNeeded"),this.pc.oniceconnectionstatechange=this.emit.bind(this,"iceConnectionStateChange"),this.pc.onsignalingstatechange=this.emit.bind(this,"signalingStateChange"),this.pc.onaddstream=this._onAddStream.bind(this),this.pc.onicecandidate=this._onIce.bind(this),this.pc.ondatachannel=this._onDataChannel.bind(this),this.localDescription={contents:[]},this.remoteDescription={contents:[]},this.localStream=null,this.remoteStreams=[],this.config={debug:!1,ice:{},sid:"",isInitiator:!0,sdpSessionID:Date.now(),useJingle:!1};for(o in e)this.config[o]=e[o];this.config.debug&&this.on("*",function(){var n=e.logger||console;n.log("PeerConnection event:",arguments)})}var f=e("underscore"),d=e("util"),i=e("webrtcsupport"),t=e("sdp-jingle-json"),u=e("wildemitter"),l=e("traceablepeerconnection");d.inherits(o,u),o.prototype.__defineGetter__&&(o.prototype.__defineGetter__("signalingState",function(){return this.pc.signalingState}),o.prototype.__defineGetter__("iceConnectionState",function(){return this.pc.iceConnectionState})),o.prototype.addStream=function(e){this.localStream=e,this.pc.addStream(e)},o.prototype.processIce=function(e,n){n=n||function(){};var o=this;if(e.contents){var d=f.pluck(this.remoteDescription.contents,"name"),u=e.contents;u.forEach(function(e){var n=e.transport||{},f=n.candidates||[],u=d.indexOf(e.name),l=e.name;f.forEach(function(e){console.log("addicecandidate");var n=t.toCandidateSDP(e)+"\r\n";o.pc.addIceCandidate(new i.IceCandidate({candidate:n,sdpMLineIndex:u,sdpMid:l}))})})}else o.pc.addIceCandidate(new i.IceCandidate(e.candidate));n()},o.prototype.offer=function(e,n){var o=this,d=2===arguments.length,i=d?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};n=d?n:e,n=n||function(){},this.pc.createOffer(function(e){o.pc.setLocalDescription(e,function(){var d,i={type:"offer",sdp:e.sdp};o.config.useJingle&&(d=t.toSessionJSON(e.sdp,o.config.isInitiator?"initiator":"responder"),d.sid=o.config.sid,o.localDescription=d,f.each(d.contents,function(e){var n=e.transport||{};n.ufrag&&(o.config.ice[e.name]={ufrag:n.ufrag,pwd:n.pwd})}),i.jingle=d),o.emit("offer",i),n(null,i)},function(e){o.emit("error",e),n(e)})},function(e){o.emit("error",e),n(e)},i)},o.prototype.handleOffer=function(e,n){n=n||function(){};var o=this;e.type="offer",e.jingle&&(e.sdp=t.toSessionSDP(e.jingle,o.config.sdpSessionID)),o.pc.setRemoteDescription(new i.SessionDescription(e),function(){n()},n)},o.prototype.answerAudioOnly=function(e){var n={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!1}};this._answer(n,e)},o.prototype.answerBroadcastOnly=function(e){var n={mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}};this._answer(n,e)},o.prototype.answer=function(e,n){var o=2===arguments.length,f=o?n:e,d=o?e:{mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};this._answer(d,f)},o.prototype.handleAnswer=function(e,n){n=n||function(){};var o=this;e.jingle&&(e.sdp=t.toSessionSDP(e.jingle,o.config.sdpSessionID),o.remoteDescription=e.jingle),o.pc.setRemoteDescription(new i.SessionDescription(e),function(){n(null)},n)},o.prototype.close=function(){this.pc.close(),this.emit("close")},o.prototype._answer=function(e,n){n=n||function(){};var o=this;if(!this.pc.remoteDescription)throw new Error("remoteDescription not set");o.pc.createAnswer(function(e){o.pc.setLocalDescription(e,function(){var f={type:"answer",sdp:e.sdp};if(o.config.useJingle){var d=t.toSessionJSON(e.sdp);d.sid=o.config.sid,o.localDescription=d,f.jingle=d}o.emit("answer",f),n(null,f)},function(e){o.emit("error",e),n(e)})},function(e){o.emit("error",e),n(e)},e)},o.prototype._onIce=function(e){var n=this;if(e.candidate){var o=e.candidate,d={candidate:e.candidate};if(n.config.useJingle){if(!n.config.ice[o.sdpMid]){var i=t.toSessionJSON(n.pc.localDescription.sdp,n.config.isInitiator?"initiator":"responder");f.each(i.contents,function(e){var o=e.transport||{};o.ufrag&&(n.config.ice[e.name]={ufrag:o.ufrag,pwd:o.pwd})})}d.jingle={contents:[{name:o.sdpMid,creator:n.config.isInitiator?"initiator":"responder",transport:{transType:"iceUdp",ufrag:n.config.ice[o.sdpMid].ufrag,pwd:n.config.ice[o.sdpMid].pwd,candidates:[t.toCandidateJSON(o.candidate)]}}]}}this.emit("ice",d)}else this.emit("endOfCandidates")},o.prototype._onDataChannel=function(e){this.emit("addChannel",e.channel)},o.prototype._onAddStream=function(e){this.remoteStreams.push(e.stream),this.emit("addStream",e)},o.prototype.createDataChannel=function(e,n){var o=this.pc.createDataChannel(e,n);return o},o.prototype.getStats=function(e){"moz"===i.prefix?this.pc.getStats(function(n){var o=[];n.forEach(function(e){o.push(e)}),e(null,o)},e):this.pc.getStats(function(n){var o=[];n.result().forEach(function(e){var n={};e.names().forEach(function(o){n[o]=e.stat(o)}),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,o.push(n)}),e(null,o)})},n.exports=o},{"sdp-jingle-json":193,traceablepeerconnection:191,underscore:222,util:123,webrtcsupport:197,wildemitter:223}],193:[function(e,n,o){var f=e("./lib/tosdp"),d=e("./lib/tojson");o.toSessionSDP=f.toSessionSDP,o.toMediaSDP=f.toMediaSDP,o.toCandidateSDP=f.toCandidateSDP,o.toSessionJSON=d.toSessionJSON,o.toMediaJSON=d.toMediaJSON,o.toCandidateJSON=d.toCandidateJSON},{"./lib/tojson":195,"./lib/tosdp":196}],194:[function(e,n,o){o.lines=function(e){return e.split("\r\n").filter(function(e){return e.length>0})},o.findLine=function(e,n,o){for(var f=e.length,d=0;d<n.length;d++)if(n[d].substr(0,f)===e)return n[d];if(!o)return!1;for(var i=0;i<o.length;i++)if(o[i].substr(0,f)===e)return o[i];return!1},o.findLines=function(e,n,o){for(var f=[],d=e.length,i=0;i<n.length;i++)n[i].substr(0,d)===e&&f.push(n[i]);if(f.length||!o)return f;for(var t=0;t<o.length;t++)o[t].substr(0,d)===e&&f.push(o[t]);return f},o.mline=function(e){for(var n=e.substr(2).split(" "),o={media:n[0],port:n[1],proto:n[2],formats:[]},f=3;f<n.length;f++)n[f]&&o.formats.push(n[f]);return o},o.rtpmap=function(e){var n=e.substr(9).split(" "),o={id:n.shift()};return n=n[0].split("/"),o.name=n[0],o.clockrate=n[1],o.channels=3==n.length?n[2]:"1",o},o.fmtp=function(e){for(var n,o,f,d=e.substr(e.indexOf(" ")+1).split(";"),i=[],t=0;t<d.length;t++)n=d[t].split("="),o=n[0].trim(),f=n[1],o&&f?i.push({key:o,value:f}):o&&i.push({key:"",value:o});return i},o.crypto=function(e){var n=e.substr(9).split(" "),o={tag:n[0],cipherSuite:n[1],keyParams:n[2],sessionParams:n.slice(3).join(" ")};return o},o.fingerprint=function(e){var n=e.substr(14).split(" ");return{hash:n[0],value:n[1]}},o.extmap=function(e){var n=e.substr(9).split(" "),o={},f=n.shift(),d=f.indexOf("/");return d>=0?(o.id=f.substr(0,d),o.senders=f.substr(d+1)):(o.id=f,o.senders="sendrecv"),o.uri=n.shift()||"",o},o.rtcpfb=function(e){var n=e.substr(10).split(" "),o={};return o.id=n.shift(),o.type=n.shift(),"trr-int"===o.type?o.value=n.shift():o.subtype=n.shift()||"",o.parameters=n,o},o.candidate=function(e){for(var n=e.substring(12).split(" "),o={foundation:n[0],component:n[1],protocol:n[2].toLowerCase(),priority:n[3],ip:n[4],port:n[5],type:n[7],generation:"0"},f=8;f<n.length;f+=2)"raddr"===n[f]?o.relAddr=n[f+1]:"rport"===n[f]?o.relPort=n[f+1]:"generation"===n[f]&&(o.generation=n[f+1]);return o.network="1",o},o.sourceGroups=function(e){for(var n=[],o=0;o<e.length;o++){var f=e[o].substr(13).split(" ");n.push({semantics:f.shift(),sources:f})}return n},o.sources=function(e){for(var n=[],o={},f=0;f<e.length;f++){var d=e[f].substr(7).split(" "),i=d.shift();if(!o[i]){var t={ssrc:i,parameters:[]};n.push(t),o[i]=t}d=d.join(" ").split(":");var u=d.shift(),l=d.join(":")||null;o[i].parameters.push({key:u,value:l})}return n},o.groups=function(e){for(var n,o=[],f=0;f<e.length;f++)n=e[f].substr(8).split(" "),o.push({semantics:n.shift(),contents:n});return o}},{}],195:[function(e,n,o){var f=e("./parsers"),d=Math.random();o._setIdCounter=function(e){d=e},o.toSessionJSON=function(e,n){for(var d=e.split("\r\nm="),i=1;i<d.length;i++)d[i]="m="+d[i],i!==d.length-1&&(d[i]+="\r\n");var t=d.shift()+"\r\n",u=f.lines(t),l={},p=[];d.forEach(function(e){p.push(o.toMediaJSON(e,t,n))}),l.contents=p;var P=f.findLines("a=group:",u);return P.length&&(l.groups=f.groups(P)),l},o.toMediaJSON=function(e,n,d){var i=f.lines(e),t=f.lines(n),u=f.mline(i[0]),l={creator:d,name:u.media,description:{descType:"rtp",media:u.media,payloads:[],encryption:[],feedback:[],headerExtensions:[]},transport:{transType:"iceUdp",candidates:[],fingerprints:[]}},p=l.description,P=l.transport,c=f.findLine("a=ssrc:",i);c&&(p.ssrc=c.substr(7).split(" ")[0]);var s=f.findLine("a=mid:",i);s&&(l.name=s.substr(6)),f.findLine("a=sendrecv",i,t)?l.senders="both":f.findLine("a=sendonly",i,t)?l.senders="initiator":f.findLine("a=recvonly",i,t)?l.senders="responder":f.findLine("a=inactive",i,t)&&(l.senders="none");var y=f.findLines("a=rtpmap:",i);y.forEach(function(e){var n=f.rtpmap(e);n.feedback=[];var o=f.findLines("a=fmtp:"+n.id,i);o.forEach(function(e){n.parameters=f.fmtp(e)});var d=f.findLines("a=rtcp-fb:"+n.id,i);d.forEach(function(e){n.feedback.push(f.rtcpfb(e))}),p.payloads.push(n)});var w=f.findLines("a=crypto:",i,t);w.forEach(function(e){p.encryption.push(f.crypto(e))}),f.findLine("a=rtcp-mux",i)&&(p.mux=!0);var a=f.findLines("a=rtcp-fb:*",i);a.forEach(function(e){p.feedback.push(f.rtcpfb(e))});var b=f.findLines("a=extmap:",i);b.forEach(function(e){var n=f.extmap(e),o={sendonly:"responder",recvonly:"initiator",sendrecv:"both",inactive:"none"};n.senders=o[n.senders],p.headerExtensions.push(n)});var r=f.findLines("a=ssrc-group:",i);p.sourceGroups=f.sourceGroups(r||[]);var M=f.findLines("a=ssrc:",i);p.sources=f.sources(M||[]);var X=f.findLines("a=fingerprint:",i,t);X.forEach(function(e){var n=f.fingerprint(e),o=f.findLine("a=setup:",i,t);o&&(n.setup=o.substr(8)),P.fingerprints.push(n)});var g=f.findLine("a=ice-ufrag:",i,t),m=f.findLine("a=ice-pwd:",i,t);if(g&&m){P.ufrag=g.substr(12),P.pwd=m.substr(10),P.candidates=[];var x=f.findLines("a=candidate:",i,t);x.forEach(function(e){P.candidates.push(o.toCandidateJSON(e))})}return l
},o.toCandidateJSON=function(e){var n=f.candidate(e.split("\r\n")[0]);return n.id=(d++).toString(36).substr(0,12),n}},{"./parsers":194}],196:[function(e,n,o){var f={initiator:"sendonly",responder:"recvonly",both:"sendrecv",none:"inactive",sendonly:"initator",recvonly:"responder",sendrecv:"both",inactive:"none"};o.toSessionSDP=function(e,n,f){var d=["v=0","o=- "+(n||e.sid||Date.now())+" "+(f||Date.now())+" IN IP4 0.0.0.0","s=-","t=0 0"],i=e.groups||[];i.forEach(function(e){d.push("a=group:"+e.semantics+" "+e.contents.join(" "))});var t=e.contents||[];return t.forEach(function(e){d.push(o.toMediaSDP(e))}),d.join("\r\n")+"\r\n"},o.toMediaSDP=function(e){var n=[],d=e.description,i=e.transport,t=d.payloads||[],u=i&&i.fingerprints||[],l=[d.media,"1"];l.push(d.encryption&&d.encryption.length>0||u.length>0?"RTP/SAVPF":"RTP/AVPF"),t.forEach(function(e){l.push(e.id)}),n.push("m="+l.join(" ")),n.push("c=IN IP4 0.0.0.0"),n.push("a=rtcp:1 IN IP4 0.0.0.0"),i&&(i.ufrag&&n.push("a=ice-ufrag:"+i.ufrag),i.pwd&&n.push("a=ice-pwd:"+i.pwd),i.setup&&n.push("a=setup:"+i.setup),u.forEach(function(e){n.push("a=fingerprint:"+e.hash+" "+e.value)})),n.push("a="+(f[e.senders]||"sendrecv")),n.push("a=mid:"+e.name),d.mux&&n.push("a=rtcp-mux");var p=d.encryption||[];p.forEach(function(e){n.push("a=crypto:"+e.tag+" "+e.cipherSuite+" "+e.keyParams+(e.sessionParams?" "+e.sessionParams:""))}),t.forEach(function(e){var o="a=rtpmap:"+e.id+" "+e.name+"/"+e.clockrate;if(e.channels&&"1"!=e.channels&&(o+="/"+e.channels),n.push(o),e.parameters&&e.parameters.length){var f=["a=fmtp:"+e.id];e.parameters.forEach(function(e){f.push((e.key?e.key+"=":"")+e.value)}),n.push(f.join(" "))}e.feedback&&e.feedback.forEach(function(o){n.push("trr-int"===o.type?"a=rtcp-fb:"+e.id+" trr-int "+o.value?o.value:"0":"a=rtcp-fb:"+e.id+" "+o.type+(o.subtype?" "+o.subtype:""))})}),d.feedback&&d.feedback.forEach(function(e){n.push("trr-int"===e.type?e.value:"a=rtcp-fb:* "+e.type+(e.subtype?" "+e.subtype:""))});var P=d.headerExtensions||[];P.forEach(function(e){n.push("a=extmap:"+e.id+(e.senders?"/"+f[e.senders]:"")+" "+e.uri)});var c=d.sourceGroups||[];c.forEach(function(e){n.push("a=ssrc-group:"+e.semantics+" "+e.sources.join(" "))});var s=d.sources||[];s.forEach(function(e){for(var o=0;o<e.parameters.length;o++){var f=e.parameters[o];n.push("a=ssrc:"+(e.ssrc||d.ssrc)+" "+f.key+(f.value?":"+f.value:""))}});var y=i.candidates||[];return y.forEach(function(e){n.push(o.toCandidateSDP(e))}),n.join("\r\n")},o.toCandidateSDP=function(e){var n=[];n.push(e.foundation),n.push(e.component),n.push(e.protocol),n.push(e.priority),n.push(e.ip),n.push(e.port);var o=e.type;return n.push("typ"),n.push(o),("srflx"===o||"prflx"===o||"relay"===o)&&e.relAddr&&e.relPort&&(n.push("raddr"),n.push(e.relAddr),n.push("rport"),n.push(e.relPort)),n.push("generation"),n.push(e.generation||"0"),"a=candidate:"+n.join(" ")}},{}],197:[function(e,n){var o,f=!1,d=!1,i=window.navigator.userAgent.toLowerCase();-1!==i.indexOf("firefox")?(o="moz",d=!0):-1!==i.indexOf("chrome")&&(o="webkit",f=!0);var t=window.mozRTCPeerConnection||window.webkitRTCPeerConnection,u=window.mozRTCIceCandidate||window.RTCIceCandidate,l=window.mozRTCSessionDescription||window.RTCSessionDescription,p=window.webkitMediaStream||window.MediaStream,P="https:"===window.location.protocol&&window.navigator.userAgent.match("Chrome")&&parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1],10)>=26,c=window.webkitAudioContext||window.AudioContext;n.exports={support:!!t,dataChannel:f||d||t&&t.prototype&&t.prototype.createDataChannel,prefix:o,webAudio:!(!c||!c.prototype.createMediaStreamSource),mediaStream:!(!p||!p.prototype.removeTrack),screenSharing:!!P,AudioContext:c,PeerConnection:t,SessionDescription:l,IceCandidate:u}},{}],198:[function(e,n){"use strict";var o=e("underscore"),f=e("./lib/core"),d=e("./lib/helpers"),i=e("./lib/types");n.exports=o.extend({},f,d,i)},{"./lib/core":199,"./lib/helpers":200,"./lib/types":201,underscore:203}],199:[function(e,n,o){"use strict";function f(e){var n=e.prototype._NS+"|"+e.prototype._EL;P[n]=e,s[n]=e}function d(e){return u.serializeToString(e)}function i(e){var n,o={},f={constructor:!0,_EL:!0,_NS:!0,_extensions:!0,_name:!0,parent:!0,prototype:!0,toJSON:!0,toString:!0,xml:!0};for(n in e._extensions)e._extensions[n].toJSON&&"_"!==n[0]&&(o[n]=e._extensions[n].toJSON());for(n in e)if(!f[n]&&!(c[e._NS+"|"+e._EL]||{})[n]&&!e._extensions[n]&&"_"!==n[0]){var d=e[n];if("function"==typeof d)continue;var i=Object.prototype.toString.call(d);i.indexOf("Object")>=0?Object.keys(d).length>0&&(o[n]=d):i.indexOf("Array")>=0?d.length>0&&(o[n]=d):d&&(o[n]=d)}return o}var t=e("underscore"),u=e("ltx-dom-shim"),l=e("./helpers"),p=e("./types"),P=(l.find,{}),c={},s={};o.build=function(e){var n=s[e.namespaceURI+"|"+e.localName];return n?new n(null,e):void 0},o.parse=function(e,n,o){o=o||s;for(var f=u.parseFromString(e,"application/xml").childNodes,d=0;d<f.length;d++)if(1===f[d].nodeType){if("parsererror"===f[d].nodeName)throw new Error({name:"parsererror",message:"Could not parse: "+e});if(f[d].childElementCount>0&&"parsererror"===f[d].childNodes[0].nodeName)throw new Error({name:"parsererror",message:"Could not parse: "+e});var i=f[d];return n?new n(null,i):new(n=o[i.namespaceURI+"|"+i.localName])(null,i)}throw new Error({name:"parsererror",message:"Could not parse: "+e})},o.extend=function(e,n,f){var d=e.prototype._NS+"|"+e.prototype._EL,i=n.prototype._name,t=n.prototype._NS+"|"+n.prototype._EL;P[t]=n,c[t]||(c[t]={}),c[d]||(c[d]={}),c[d][i]=n,o.add(e,i,p.extension(n)),f&&o.add(e,f,p.multiExtension(n))},o.add=function(e,n,o){o.enumerable=!0,Object.defineProperty(e.prototype,n,o)},o.define=function(e){var n=function(n,o,f){var d=this,i=(o||{}).parentNode||(f||{}).xml,u=(i||{}).namespaceURI;d.xml=o||l.createElement(d._NS,d._EL,u);e.prefixes||{};return t.each(e.prefixes||{},function(e,n){d.xml.setAttribute("xmlns:"+n,e)}),d._extensions={},t.each(d.xml.childNodes,function(e){var n=e.namespaceURI+"|"+e.localName,o=P[n];if(void 0!==o){var f=o.prototype._name;d._extensions[f]=new o(null,e),d._extensions[f].parent=d}}),t.extend(d,n),e.init&&e.init.apply(d,[n]),d};n.prototype={constructor:{value:n},_name:e.name,_eventname:e.eventName,_NS:e.namespace,_EL:e.element,toString:function(){return d(this.xml)},toJSON:function(){return i(this)}};var u=Object.keys(e.fields||{});return u.forEach(function(f){o.add(n,f,e.fields[f])}),e.topLevel&&f(n),n}},{"./helpers":200,"./types":201,"ltx-dom-shim":202,underscore:203}],200:[function(e,n,o){"use strict";var f=e("underscore"),d=e("ltx-dom-shim"),i=o.XML_NS="http://www.w3.org/XML/1998/namespace";o.createElement=function(e,n,f){var i=d.createElementNS(e,n);return f&&f===e||o.setAttribute(i,"xmlns",e),i};var t=o.find=function(e,n,o){var d=e.getElementsByTagName(o);return f.filter(d,function(o){return o.namespaceURI===n&&o.parentNode==e})};o.findOrCreate=function(e,n,f){var d=o.find(e,n,f);if(d.length)return d[0];var i=o.createElement(n,f,e.namespaceURI);return e.appendChild(i),i},o.getAttribute=function(e,n,o){return e.getAttribute(n)||o||""},o.getAttributeNS=function(e,n,o,f){return e.getAttributeNS(n,o)||f||""},o.setAttribute=function(e,n,o,f){o||f?e.setAttribute(n,o):e.removeAttribute(n)},o.setAttributeNS=function(e,n,o,f,d){f||d?e.setAttributeNS(n,o,f):e.removeAttributeNS(n,o)},o.getBoolAttribute=function(e,n,o){var f=e.getAttribute(n)||o||"";return"true"===f||"1"===f},o.setBoolAttribute=function(e,n,o){o?e.setAttribute(n,"1"):e.removeAttribute(n)},o.getSubAttribute=function(e,n,o,f,d){var i=t(e,n,o);if(!i)return"";for(var u=0;u<i.length;u++)return i[u].getAttribute(f)||d||"";return""},o.setSubAttribute=function(e,n,f,d,i){var u=t(e,n,f);if(u.length)for(var l=0;l<u.length;l++){if(i)return void u[l].setAttribute(d,i);u[l].removeAttribute(d)}else i&&(f=o.createElement(n,f,e.namespaceURI),f.setAttribute(d,i),e.appendChild(f))},o.getBoolSubAttribute=function(e,n,o,f,d){var i=e.getSubAttribute(n,o,f)||d||"";return"true"===i||"1"===i},o.setBoolSubAttribute=function(e,n,f,d,i){i=i?"1":"",o.setSubAttribute(e,n,f,d,i)},o.getText=function(e){return e.textContent},o.setText=function(e,n){e.textContent=n},o.getSubText=function(e,n,o,f){var d=t(e,n,o);return f=f||"",d.length?d[0].textContent||f:f},o.setSubText=function(e,n,f,d){var i=t(e,n,f);if(i.length)for(var u=0;u<i.length;u++){if(d)return void(i[u].textContent=d);e.removeChild(i[u])}else if(d){var l=o.createElement(n,f,e.namespaceURI);l.textContent=d,e.appendChild(l)}},o.getMultiSubText=function(e,n,o,f){var d=t(e,n,o),i=[];f=f||function(e){return e.textContent||""};for(var u=0;u<d.length;u++)i.push(f(d[u]));return i},o.setMultiSubText=function(e,n,d,i,u){var l=t(e,n,d),p=[];u=u||function(f){var i=o.createElement(n,d,e.namespaceURI);i.textContent=f,e.appendChild(i)},p="string"==typeof i?(i||"").split("\n"):i,f.forEach(l,function(n){e.removeChild(n)}),f.forEach(p,function(e){e&&u(e)})},o.getSubLangText=function(e,n,o,f){var d=t(e,n,o);if(!d.length)return{};for(var u,l,p={},P=[],c=0;c<d.length;c++)l=d[c],u=l.getAttributeNS(i,"lang")||f,P.push(u),p[u]=l.textContent||"";return p},o.setSubLangText=function(e,n,f,d,u){var l,p,P=t(e,n,f);if(P.length)for(var c=0;c<P.length;c++)e.removeChild(P[c]);if("string"==typeof d)l=o.createElement(n,f,e.namespaceURI),l.textContent=d,e.appendChild(l);else if("object"==typeof d)for(p in d)d.hasOwnProperty(p)&&(l=o.createElement(n,f,e.namespaceURI),p!==u&&l.setAttributeNS(i,"lang",p),l.textContent=d[p],e.appendChild(l))},o.getBoolSub=function(e,n,o){var f=t(e,n,o);return!!f.length},o.setBoolSub=function(e,n,f,d){var i=t(e,n,f);if(i.length)for(var u=0;u<i.length;u++){if(d)return;e.removeChild(i[u])}else if(d){var l=o.createElement(n,f,e.namespaceURI);e.appendChild(l)}}},{"ltx-dom-shim":202,underscore:203}],201:[function(e,n,o){"use strict";var f=e("underscore"),d=e("atob"),i=e("btoa"),t=e("./helpers"),u=t.find,l=o.field=function(e,n){return function(){var o=f.toArray(arguments);return{get:function(){return e.apply(null,[this.xml].concat(o))},set:function(e){n.apply(null,[this.xml].concat(o).concat([e]))}}}};o.field=l,o.boolAttribute=l(t.getBoolAttribute,t.setBoolAttribute),o.subAttribute=l(t.getSubAttribute,t.setSubAttribute),o.boolSubAttribute=l(t.getSubBoolAttribute,t.setSubBoolAttribute),o.text=l(t.getText,t.setText),o.subText=l(t.getSubText,t.setSubText),o.multiSubText=l(t.getMultiSubText,t.setMultiSubText),o.subLangText=l(t.getSubLangText,t.setSubLangText),o.boolSub=l(t.getBoolSub,t.setBoolSub),o.langAttribute=l(function(e){return e.getAttributeNS(t.XML_NS,"lang")||""},function(e,n){e.setAttributeNS(t.XML_NS,"lang",n)}),o.b64Text=l(function(e){return e.textContent&&"="!=e.textContent?d(e.textContent):""},function(e,n){e.textContent=i(n)||"="}),o.dateAttribute=function(e,n){return{get:function(){var o=t.getAttribute(this.xml,e);return o?new Date(o):n?new Date(Date.now()):void 0},set:function(n){n&&("string"!=typeof n&&(n=n.toISOString()),t.setAttribute(this.xml,e,n))}}},o.dateSub=function(e,n,o){return{get:function(){var f=t.getSubText(this.xml,e,n);return f?new Date(f):o?new Date(Date.now()):void 0},set:function(o){o&&("string"!=typeof o&&(o=o.toISOString()),t.setSubText(this.xml,e,n,o))}}},o.dateSubAttribute=function(e,n,o,f){return{get:function(){var d=t.getSubAttribute(this.xml,e,n,o);return d?new Date(d):f?new Date(Date.now()):void 0},set:function(f){f&&("string"!=typeof f&&(f=f.toISOString()),t.setSubAttribute(this.xml,e,n,o,f))}}},o.numberAttribute=function(e,n){return{get:function(){var o=n?parseFloat:parseInt;return o(t.getAttribute(this.xml,e,"0"),10)},set:function(n){t.setAttribute(this.xml,e,n.toString())}}},o.numberSub=function(e,n,o){return{get:function(){var f=o?parseFloat:parseInt;return f(t.getSubText(this.xml,e,n,"0"),10)},set:function(o){t.setSubText(this.xml,e,n,o.toString())}}},o.attribute=function(e,n){return{get:function(){return t.getAttribute(this.xml,e,n)},set:function(n){t.setAttribute(this.xml,e,n)}}},o.attributeNS=function(e,n,o){return{get:function(){return t.getAttributeNS(this.xml,e,n,o)},set:function(o){t.setAttributeNS(this.xml,e,n,o)}}},o.extension=function(e){return{get:function(){var n=this,o=e.prototype._name;if(!this._extensions[o]){var f=u(this.xml,e.prototype._NS,e.prototype._EL);f.length?this._extensions[o]=new e(null,f[0],n):(this._extensions[o]=new e({},null,n),this.xml.appendChild(this._extensions[o].xml)),this._extensions[o].parent=this}return this._extensions[o]},set:function(n){var o=this[e.prototype._name];f.extend(o,n)}}},o.multiExtension=function(e){return{get:function(){var n=this,o=u(this.xml,e.prototype._NS,e.prototype._EL),d=[];return f.forEach(o,function(o){d.push(new e({},o,n).toJSON())}),d},set:function(n){var o=this,d=u(this.xml,e.prototype._NS,e.prototype._EL);f.forEach(d,function(e){o.xml.removeChild(e)}),f.forEach(n,function(n){var f=new e(n,null,o);o.xml.appendChild(f.xml)})}}}},{"./helpers":200,atob:82,btoa:136,underscore:203}],202:[function(e,n){var o=new window.DOMParser,f=new window.XMLSerializer;n.exports={serializeToString:function(e){return f.serializeToString(e)},parseFromString:function(e,n){return o.parseFromString(e,n)},createElementNS:function(e,n){return document.createElementNS(e,n)}}},{}],203:[function(e,n){n.exports=e(178)},{}],204:[function(n,o){var f=n("__browserify_Buffer").Buffer;(function(){function d(e,n,o){var f=n&&o||0,d=0;for(n=n||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){16>d&&(n[f+d++]=b[e])});16>d;)n[f+d++]=0;return n}function i(e,n){var o=n||0,f=a;return f[e[o++]]+f[e[o++]]+f[e[o++]]+f[e[o++]]+"-"+f[e[o++]]+f[e[o++]]+"-"+f[e[o++]]+f[e[o++]]+"-"+f[e[o++]]+f[e[o++]]+"-"+f[e[o++]]+f[e[o++]]+f[e[o++]]+f[e[o++]]+f[e[o++]]+f[e[o++]]}function t(e,n,o){var f=n&&o||0,d=n||[];e=e||{};var t=null!=e.clockseq?e.clockseq:g,u=null!=e.msecs?e.msecs:(new Date).getTime(),l=null!=e.nsecs?e.nsecs:x+1,p=u-m+(l-x)/1e4;if(0>p&&null==e.clockseq&&(t=t+1&16383),(0>p||u>m)&&null==e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");m=u,x=l,g=t,u+=122192928e5;var P=(1e4*(268435455&u)+l)%4294967296;d[f++]=P>>>24&255,d[f++]=P>>>16&255,d[f++]=P>>>8&255,d[f++]=255&P;var c=u/4294967296*1e4&268435455;d[f++]=c>>>8&255,d[f++]=255&c,d[f++]=c>>>24&15|16,d[f++]=c>>>16&255,d[f++]=t>>>8|128,d[f++]=255&t;for(var s=e.node||X,y=0;6>y;y++)d[f+y]=s[y];return n?n:i(d)}function u(e,n,o){var f=n&&o||0;"string"==typeof e&&(n="binary"==e?new w(16):null,e=null),e=e||{};var d=e.random||(e.rng||l)();if(d[6]=15&d[6]|64,d[8]=63&d[8]|128,n)for(var t=0;16>t;t++)n[f+t]=d[t];return n||i(d)}var l,p=this;if("function"==typeof n)try{var P=n("crypto").randomBytes;l=P&&function(){return P(16)}}catch(c){}if(!l&&p.crypto&&crypto.getRandomValues){var s=new Uint8Array(16);l=function(){return crypto.getRandomValues(s),s}}if(!l){var y=new Array(16);l=function(){for(var e,n=0;16>n;n++)0===(3&n)&&(e=4294967296*Math.random()),y[n]=e>>>((3&n)<<3)&255;return y}}for(var w="function"==typeof f?f:Array,a=[],b={},r=0;256>r;r++)a[r]=(r+256).toString(16).substr(1),b[a[r]]=r;var M=l(),X=[1|M[0],M[1],M[2],M[3],M[4],M[5]],g=16383&(M[6]<<8|M[7]),m=0,x=0,j=u;if(j.v1=t,j.v4=u,j.parse=d,j.unparse=i,j.BufferClass=w,"function"==typeof e&&e.amd)e(function(){return j});else if("undefined"!=typeof o&&o.exports)o.exports=j;else{var h=p.uuid;j.noConflict=function(){return p.uuid=h,j},p.uuid=j}}).call(this)},{__browserify_Buffer:134,crypto:128}],205:[function(n,o,f){!function(n,d){"object"==typeof f?d(f,o):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,n){function o(){}o.prototype.name="ANONYMOUS",o.prototype.clientFirst=!0,o.prototype.response=function(e){return e.trace||""},o.prototype.challenge=function(){},e=n.exports=o})},{}],206:[function(n,o,f){!function(d,i){"object"==typeof f?i(f,o,n("./lib/mechanism")):"function"==typeof e&&e.amd&&e(["exports","module","./lib/mechanism"],i)}(this,function(e,n,o){e=n.exports=o,e.Mechanism=o})},{"./lib/mechanism":205}],207:[function(n,o,f){!function(d,i){"object"==typeof f?i(f,o,n("crypto")):"function"==typeof e&&e.amd&&e(["exports","module","crypto"],i)}(this,function(e,n,o){function f(e){e=e||{},this._genNonce=e.genNonce||i(32)}function d(e){for(var n={},o=e.split(/,(?=(?:[^"]|"[^"]*")*$)/),f=0,d=o.length;d>f;f++){var i=/(\w+)=["]?([^"]+)["]?$/.exec(o[f]);i&&(n[i[1]]=i[2])}return n}function i(e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=n.length;return function(){for(var f=[],d=0;e>d;++d)f.push(n[Math.random()*o|0]);return f.join("")}}function t(e,n){return o.createHash("md5").update(e).digest(n||"hex")}f.prototype.name="DIGEST-MD5",f.prototype.clientFirst=!1,f.prototype.response=function(e){var n=e.serviceType+"/"+e.host;e.serviceName&&e.host!==e.serviceName&&(n+="/"+serviceName);var o,f,d,i=e.realm||this._realm||"",u=this._genNonce(),l="00000001",p="auth",P="";return P+='username="'+e.username+'"',i&&(P+=',realm="'+i+'"'),P+=',nonce="'+this._nonce+'"',P+=',cnonce="'+u+'"',P+=",nc="+l,P+=",qop="+p,P+=',digest-uri="'+n+'"',o=t(e.authzid?t(e.username+":"+i+":"+e.password,"binary")+":"+this._nonce+":"+u+":"+e.authzid:t(e.username+":"+i+":"+e.password,"binary")+":"+this._nonce+":"+u),"auth"==p?f=t("AUTHENTICATE:"+n):("auth-int"==p||"auth-conf"==p)&&(f=t("AUTHENTICATE:"+n+":00000000000000000000000000000000")),d=t(o+":"+this._nonce+":"+l+":"+u+":"+p+":"+f),P+=",response="+d,"utf-8"==this._charset&&(P+=",charset=utf-8"),e.authzid&&(P+='authzid="'+e.authzid+'"'),P},f.prototype.challenge=function(e){var n=d(e);return this._realm=n.realm,this._nonce=n.nonce,this._qop=(n.qop||"auth").split(","),this._stale=n.stale,this._maxbuf=parseInt(n.maxbuf)||65536,this._charset=n.charset,this._algo=n.algorithm,this._cipher=n.cipher,this._cipher&&this._cipher.split(","),this},e=n.exports=f})},{crypto:128}],208:[function(e,n,o){arguments[4][206][0].apply(o,arguments)},{"./lib/mechanism":207}],209:[function(n,o,f){!function(n,d){"object"==typeof f?d(f,o):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,n){function o(){}o.prototype.name="EXTERNAL",o.prototype.clientFirst=!0,o.prototype.response=function(e){return e.authzid||""},o.prototype.challenge=function(){},e=n.exports=o})},{}],210:[function(e,n,o){arguments[4][206][0].apply(o,arguments)},{"./lib/mechanism":209}],211:[function(n,o,f){!function(n,d){"object"==typeof f?d(f,o):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,n){function o(){}o.prototype.name="PLAIN",o.prototype.clientFirst=!0,o.prototype.response=function(e){var n="";return n+=e.authzid||"",n+="\x00",n+=e.username,n+="\x00",n+=e.password},o.prototype.challenge=function(){return this},e=n.exports=o})},{}],212:[function(e,n,o){arguments[4][206][0].apply(o,arguments)},{"./lib/mechanism":211}],213:[function(n,o,f){!function(d,i){"object"==typeof f?i(f,o,n("crypto"),n("buffer")):"function"==typeof e&&e.amd&&e(["exports","module","crypto","buffer"],i)}(this,function(e,n,o,f){function d(e){e=e||{},this._genNonce=e.genNonce||c(32),this._stage=0}function i(e,n){return o.createHmac("sha1",e).update(n).digest("binary")}function t(e,n,o){for(var f=i(e,n+"\x00\x00\x00"),d=f,t=0;o-1>t;t++)f=i(e,f),d=l(d,f);return d}function u(e){return o.createHash("sha1").update(e).digest("binary")}function l(e,n){e=new s(e,"binary"),n=new s(n,"binary");var o=Math.min(e.length,n.length);result=[];for(var f=0;o>f;f++)result.push(e[f]^n[f]);return result=new s(result,"binary"),result.toString("binary")}function p(e){for(var n=[],o="",f=0;f<e.length;f++)o=e[f],n.push(","===o?"=2C":"="===o?"=3D":o);return n.join("")}function P(e){for(var n={},o=e.split(/,(?=(?:[^"]|"[^"]*")*$)/),f=0,d=o.length;d>f;f++){var i=/(\w+)=["]?([^"]+)["]?$/.exec(o[f]);i&&(n[i[1]]=i[2])}return n}function c(e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=n.length;return function(){for(var f=[],d=0;e>d;++d)f.push(n[Math.random()*o|0]);return f.join("")}}var s=f.Buffer;d.prototype.name="SCRAM-SHA-1",d.prototype.clientFirst=!0,d.prototype.response=function(e){return y[this._stage](this,e)},d.prototype.challenge=function(e){var n=P(e);return this._salt=new s(n.s||"","base64").toString("binary"),this._iterationCount=parseInt(n.i,10),this._nonce=n.r,this._verifier=n.v,this._error=n.e,this._challenge=e,this};var y={};y[0]=function(e,n){e._cnonce=e._genNonce();var o="";n.authzid&&(o="a="+p(n.authzid)),e._gs2Header="n,"+o+",";var f="r="+e._cnonce,d="n="+p(n.username);e._clientFirstMessageBare=d+","+f;var i=e._gs2Header+e._clientFirstMessageBare;return e._stage=1,i},y[1]=function(e,n){var o=new s(e._gs2Header).toString("base64");e._clientFinalMessageWithoutProof="c="+o+",r="+e._nonce;var f,d,p;n.clientKey&&n.serverKey?(d=n.clientKey,p=n.serverKey):(f=n.saltedPassword||t(n.password,e._salt,e._iterationCount),d=i(f,"Client Key"),p=i(f,"Server Key"));var P=u(d),c=e._clientFirstMessageBare+","+e._challenge+","+e._clientFinalMessageWithoutProof,y=i(P,c),w=l(d,y),a=new s(w,"binary").toString("base64");e._serverSignature=i(p,c);var b=e._clientFinalMessageWithoutProof+",p="+a;return e._stage=2,e.cache={saltedPassword:f,clientKey:d,serverKey:p},b},y[2]=function(){return""},e=n.exports=d})},{buffer:125,crypto:215}],214:[function(e,n,o){arguments[4][206][0].apply(o,arguments)},{"./lib/mechanism":213}],215:[function(e,n,o){function f(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function d(e,n){for(var o in e)n(e[o],o)}var i=e("buffer").Buffer,t=e("./sha"),u=e("./sha256"),l=e("./rng"),p=e("./md5"),P={sha1:{hex:t.hex_sha1,base64:t.b64_sha1,binary:t.str_sha1},sha256:{hex:u.hex_sha256,base64:u.b64_sha256,binary:u.str_sha256},md5:{hex:p.hex_md5,base64:p.b64_md5,binary:p.bin_md5}},c={sha1:{hex:t.hex_hmac_sha1,base64:t.b64_hmac_sha1,binary:t.str_hmac_sha1},sha256:{hex:u.hex_hmac_sha256,base64:u.b64_hmac_sha256,binary:u.str_hmac_sha256},md5:{hex:p.hex_hmac_md5,base64:p.b64_hmac_md5,binary:p.bin_hmac_md5}};o.createHash=function(e){e=e||"sha1",P[e]||f("algorithm:",e,"is not yet supported");var n="",o=P[e];return{update:function(e){return n+=e,this},digest:function(d){d=d||"binary";var i;(i=o[d])||f("encoding:",d,"is not yet supported for algorithm",e);var t=i(n);return n=null,t}}},o.createHmac=function(e,n){c[e]||f("algorithm:",e,"is not yet supported"),"string"!=typeof n&&(n=n.toString("binary"));var o="",d=c[e];return{update:function(e){return o+=e,this},digest:function(i){i=i||"binary";var t;(t=d[i])||f("encoding:",i,"is not yet support for algorithm",e);var u=t(n,o);return o=null,u}}},o.randomBytes=function(e,n){if(!n||!n.call)return new i(l(e));try{n.call(this,void 0,new i(l(e)))}catch(o){n(o)}},d(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){o[e]=function(){f("sorry,",e,"is not implemented yet")}})},{"./md5":216,"./rng":217,"./sha":218,"./sha256":219,buffer:125}],216:[function(e,n,o){function f(e){return g(p(M(e),e.length*h))}function d(e){return m(p(M(e),e.length*h))}function i(e){return X(p(M(e),e.length*h))}function t(e,n){return g(a(e,n))}function u(e,n){return m(a(e,n))}function l(e,n){return X(a(e,n))}function p(e,n){e[n>>5]|=128<<n%32,e[(n+64>>>9<<4)+14]=n;for(var o=1732584193,f=-271733879,d=-1732584194,i=271733878,t=0;t<e.length;t+=16){var u=o,l=f,p=d,P=i;o=c(o,f,d,i,e[t+0],7,-680876936),i=c(i,o,f,d,e[t+1],12,-389564586),d=c(d,i,o,f,e[t+2],17,606105819),f=c(f,d,i,o,e[t+3],22,-1044525330),o=c(o,f,d,i,e[t+4],7,-176418897),i=c(i,o,f,d,e[t+5],12,1200080426),d=c(d,i,o,f,e[t+6],17,-1473231341),f=c(f,d,i,o,e[t+7],22,-45705983),o=c(o,f,d,i,e[t+8],7,1770035416),i=c(i,o,f,d,e[t+9],12,-1958414417),d=c(d,i,o,f,e[t+10],17,-42063),f=c(f,d,i,o,e[t+11],22,-1990404162),o=c(o,f,d,i,e[t+12],7,1804603682),i=c(i,o,f,d,e[t+13],12,-40341101),d=c(d,i,o,f,e[t+14],17,-1502002290),f=c(f,d,i,o,e[t+15],22,1236535329),o=s(o,f,d,i,e[t+1],5,-165796510),i=s(i,o,f,d,e[t+6],9,-1069501632),d=s(d,i,o,f,e[t+11],14,643717713),f=s(f,d,i,o,e[t+0],20,-373897302),o=s(o,f,d,i,e[t+5],5,-701558691),i=s(i,o,f,d,e[t+10],9,38016083),d=s(d,i,o,f,e[t+15],14,-660478335),f=s(f,d,i,o,e[t+4],20,-405537848),o=s(o,f,d,i,e[t+9],5,568446438),i=s(i,o,f,d,e[t+14],9,-1019803690),d=s(d,i,o,f,e[t+3],14,-187363961),f=s(f,d,i,o,e[t+8],20,1163531501),o=s(o,f,d,i,e[t+13],5,-1444681467),i=s(i,o,f,d,e[t+2],9,-51403784),d=s(d,i,o,f,e[t+7],14,1735328473),f=s(f,d,i,o,e[t+12],20,-1926607734),o=y(o,f,d,i,e[t+5],4,-378558),i=y(i,o,f,d,e[t+8],11,-2022574463),d=y(d,i,o,f,e[t+11],16,1839030562),f=y(f,d,i,o,e[t+14],23,-35309556),o=y(o,f,d,i,e[t+1],4,-1530992060),i=y(i,o,f,d,e[t+4],11,1272893353),d=y(d,i,o,f,e[t+7],16,-155497632),f=y(f,d,i,o,e[t+10],23,-1094730640),o=y(o,f,d,i,e[t+13],4,681279174),i=y(i,o,f,d,e[t+0],11,-358537222),d=y(d,i,o,f,e[t+3],16,-722521979),f=y(f,d,i,o,e[t+6],23,76029189),o=y(o,f,d,i,e[t+9],4,-640364487),i=y(i,o,f,d,e[t+12],11,-421815835),d=y(d,i,o,f,e[t+15],16,530742520),f=y(f,d,i,o,e[t+2],23,-995338651),o=w(o,f,d,i,e[t+0],6,-198630844),i=w(i,o,f,d,e[t+7],10,1126891415),d=w(d,i,o,f,e[t+14],15,-1416354905),f=w(f,d,i,o,e[t+5],21,-57434055),o=w(o,f,d,i,e[t+12],6,1700485571),i=w(i,o,f,d,e[t+3],10,-1894986606),d=w(d,i,o,f,e[t+10],15,-1051523),f=w(f,d,i,o,e[t+1],21,-2054922799),o=w(o,f,d,i,e[t+8],6,1873313359),i=w(i,o,f,d,e[t+15],10,-30611744),d=w(d,i,o,f,e[t+6],15,-1560198380),f=w(f,d,i,o,e[t+13],21,1309151649),o=w(o,f,d,i,e[t+4],6,-145523070),i=w(i,o,f,d,e[t+11],10,-1120210379),d=w(d,i,o,f,e[t+2],15,718787259),f=w(f,d,i,o,e[t+9],21,-343485551),o=b(o,u),f=b(f,l),d=b(d,p),i=b(i,P)}return Array(o,f,d,i)}function P(e,n,o,f,d,i){return b(r(b(b(n,e),b(f,i)),d),o)}function c(e,n,o,f,d,i,t){return P(n&o|~n&f,e,n,d,i,t)}function s(e,n,o,f,d,i,t){return P(n&f|o&~f,e,n,d,i,t)}function y(e,n,o,f,d,i,t){return P(n^o^f,e,n,d,i,t)}function w(e,n,o,f,d,i,t){return P(o^(n|~f),e,n,d,i,t)}function a(e,n){var o=M(e);o.length>16&&(o=p(o,e.length*h));for(var f=Array(16),d=Array(16),i=0;16>i;i++)f[i]=909522486^o[i],d[i]=1549556828^o[i];var t=p(f.concat(M(n)),512+n.length*h);return p(d.concat(t),640)}function b(e,n){var o=(65535&e)+(65535&n),f=(e>>16)+(n>>16)+(o>>16);return f<<16|65535&o}function r(e,n){return e<<n|e>>>32-n}function M(e){for(var n=Array(),o=(1<<h)-1,f=0;f<e.length*h;f+=h)n[f>>5]|=(e.charCodeAt(f/h)&o)<<f%32;return n}function X(e){for(var n="",o=(1<<h)-1,f=0;f<32*e.length;f+=h)n+=String.fromCharCode(e[f>>5]>>>f%32&o);return n}function g(e){for(var n=x?"0123456789ABCDEF":"0123456789abcdef",o="",f=0;f<4*e.length;f++)o+=n.charAt(e[f>>2]>>f%4*8+4&15)+n.charAt(e[f>>2]>>f%4*8&15);return o}function m(e){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o="",f=0;f<4*e.length;f+=3)for(var d=(e[f>>2]>>8*(f%4)&255)<<16|(e[f+1>>2]>>8*((f+1)%4)&255)<<8|e[f+2>>2]>>8*((f+2)%4)&255,i=0;4>i;i++)o+=8*f+6*i>32*e.length?j:n.charAt(d>>6*(3-i)&63);return o}var x=0,j="=",h=8;o.hex_md5=f,o.b64_md5=d,o.bin_md5=i,o.hex_hmac_md5=t,o.b64_hmac_md5=u,o.bin_hmac_md5=l},{}],217:[function(e,n){!function(){var e,o,f=this;if(e=function(e){for(var n,n,o=new Array(e),f=0;e>f;f++)0==(3&f)&&(n=4294967296*Math.random()),o[f]=n>>>((3&f)<<3)&255;return o},f.crypto&&crypto.getRandomValues){var d=new Uint32Array(4);o=function(e){var n=new Array(e);crypto.getRandomValues(d);for(var o=0;e>o;o++)n[o]=d[o>>2]>>>8*(3&o)&255;return n}}n.exports=o||e}()},{}],218:[function(e,n,o){function f(e){return r(p(a(e),e.length*m))}function d(e){return M(p(a(e),e.length*m))}function i(e){return b(p(a(e),e.length*m))}function t(e,n){return r(s(e,n))}function u(e,n){return M(s(e,n))}function l(e,n){return b(s(e,n))}function p(e,n){e[n>>5]|=128<<24-n%32,e[(n+64>>9<<4)+15]=n;for(var o=Array(80),f=1732584193,d=-271733879,i=-1732584194,t=271733878,u=-1009589776,l=0;l<e.length;l+=16){for(var p=f,s=d,a=i,b=t,r=u,M=0;80>M;M++){o[M]=16>M?e[l+M]:w(o[M-3]^o[M-8]^o[M-14]^o[M-16],1);var X=y(y(w(f,5),P(M,d,i,t)),y(y(u,o[M]),c(M)));u=t,t=i,i=w(d,30),d=f,f=X}f=y(f,p),d=y(d,s),i=y(i,a),t=y(t,b),u=y(u,r)}return Array(f,d,i,t,u)}function P(e,n,o,f){return 20>e?n&o|~n&f:40>e?n^o^f:60>e?n&o|n&f|o&f:n^o^f}function c(e){return 20>e?1518500249:40>e?1859775393:60>e?-1894007588:-899497514}function s(e,n){var o=a(e);o.length>16&&(o=p(o,e.length*m));for(var f=Array(16),d=Array(16),i=0;16>i;i++)f[i]=909522486^o[i],d[i]=1549556828^o[i];var t=p(f.concat(a(n)),512+n.length*m);return p(d.concat(t),672)}function y(e,n){var o=(65535&e)+(65535&n),f=(e>>16)+(n>>16)+(o>>16);return f<<16|65535&o}function w(e,n){return e<<n|e>>>32-n}function a(e){for(var n=Array(),o=(1<<m)-1,f=0;f<e.length*m;f+=m)n[f>>5]|=(e.charCodeAt(f/m)&o)<<32-m-f%32;return n}function b(e){for(var n="",o=(1<<m)-1,f=0;f<32*e.length;f+=m)n+=String.fromCharCode(e[f>>5]>>>32-m-f%32&o);return n}function r(e){for(var n=X?"0123456789ABCDEF":"0123456789abcdef",o="",f=0;f<4*e.length;f++)o+=n.charAt(e[f>>2]>>8*(3-f%4)+4&15)+n.charAt(e[f>>2]>>8*(3-f%4)&15);return o}function M(e){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o="",f=0;f<4*e.length;f+=3)for(var d=(e[f>>2]>>8*(3-f%4)&255)<<16|(e[f+1>>2]>>8*(3-(f+1)%4)&255)<<8|e[f+2>>2]>>8*(3-(f+2)%4)&255,i=0;4>i;i++)o+=8*f+6*i>32*e.length?g:n.charAt(d>>6*(3-i)&63);return o}o.hex_sha1=f,o.b64_sha1=d,o.str_sha1=i,o.hex_hmac_sha1=t,o.b64_hmac_sha1=u,o.str_hmac_sha1=l;var X=0,g="=",m=8},{}],219:[function(e,n,o){function f(e){return j(m(x(e),e.length*c))}function d(e){return h(m(x(e),e.length*c))}function i(e){return p(m(x(e),e.length*c))}function t(e,n){return j(k(e,n))}function u(e,n){return h(k(e,n))}function l(e,n){return p(k(e,n))}function p(e){for(var n="",o=(1<<c)-1,f=0;f<32*e.length;f+=c)n+=String.fromCharCode(e[f>>5]>>>32-c-f%32&o);return n}o.hex_sha256=f,o.b64_sha256=d,o.str_sha256=i,o.hex_hmac_sha256=t,o.b64_hmac_sha256=u,o.str_hmac_sha256=l;var P=0,c=8,s=function(e,n){var o=(65535&e)+(65535&n),f=(e>>16)+(n>>16)+(o>>16);return f<<16|65535&o},y=function(e,n){return e>>>n|e<<32-n},w=function(e,n){return e>>>n},a=function(e,n,o){return e&n^~e&o},b=function(e,n,o){return e&n^e&o^n&o},r=function(e){return y(e,2)^y(e,13)^y(e,22)},M=function(e){return y(e,6)^y(e,11)^y(e,25)},X=function(e){return y(e,7)^y(e,18)^w(e,3)},g=function(e){return y(e,17)^y(e,19)^w(e,10)},m=function(e,n){var o,f,d,i,t,u,l,p,P,c,y,w,m=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),x=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),j=new Array(64);e[n>>5]|=128<<24-n%32,e[(n+64>>9<<4)+15]=n;for(var P=0;P<e.length;P+=16){o=x[0],f=x[1],d=x[2],i=x[3],t=x[4],u=x[5],l=x[6],p=x[7];for(var c=0;64>c;c++)j[c]=16>c?e[c+P]:s(s(s(g(j[c-2]),j[c-7]),X(j[c-15])),j[c-16]),y=s(s(s(s(p,M(t)),a(t,u,l)),m[c]),j[c]),w=s(r(o),b(o,f,d)),p=l,l=u,u=t,t=s(i,y),i=d,d=f,f=o,o=s(y,w);x[0]=s(o,x[0]),x[1]=s(f,x[1]),x[2]=s(d,x[2]),x[3]=s(i,x[3]),x[4]=s(t,x[4]),x[5]=s(u,x[5]),x[6]=s(l,x[6]),x[7]=s(p,x[7])}return x},x=function(e){for(var n=Array(),o=(1<<c)-1,f=0;f<e.length*c;f+=c)n[f>>5]|=(e.charCodeAt(f/c)&o)<<24-f%32;return n},j=function(e){for(var n=P?"0123456789ABCDEF":"0123456789abcdef",o="",f=0;f<4*e.length;f++)o+=n.charAt(e[f>>2]>>8*(3-f%4)+4&15)+n.charAt(e[f>>2]>>8*(3-f%4)&15);return o},h=function(e){var n,o,f,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="",t=4*e.length,u="=";for(n=0;t>n;n+=3)for(f=(e[n>>2]>>8*(3-n%4)&255)<<16|(e[n+1>>2]>>8*(3-(n+1)%4)&255)<<8|e[n+2>>2]>>8*(3-(n+2)%4)&255,o=0;4>o;o+=1)i+=8*n+6*o<=32*e.length?d.charAt(f>>6*(3-o)&63):u;
return i},k=function(e,n){var o=x(e);o.length>16&&(o=m(o,e.length*c));for(var f=Array(16),d=Array(16),i=0;16>i;i++)f[i]=909522486^o[i],d[i]=1549556828^o[i];var t=m(f.concat(x(n)),512+n.length*c);return m(d.concat(t),768)}},{}],220:[function(n,o,f){!function(n,d){"object"==typeof f?d(f,o):"function"==typeof e&&e.amd&&e(["exports","module"],d)}(this,function(e,n){function o(){this._mechs=[]}o.prototype.use=function(e,n){return n||(n=e,e=n.prototype.name),this._mechs.push({name:e,mech:n}),this},o.prototype.create=function(e){for(var n=0,o=this._mechs.length;o>n;n++)for(var f=0,d=e.length;d>f;f++){var i=this._mechs[n];if(i.name==e[f])return new i.mech}return null},e=n.exports=o})},{}],221:[function(n,o,f){!function(d,i){"object"==typeof f?i(f,o,n("./lib/factory")):"function"==typeof e&&e.amd&&e(["exports","module","./lib/factory"],i)}(this,function(e,n,o){e=n.exports=o,e.Factory=o})},{"./lib/factory":220}],222:[function(n,o,f){(function(){var n=this,d=n._,i={},t=Array.prototype,u=Object.prototype,l=Function.prototype,p=t.push,P=t.slice,c=t.concat,s=u.toString,y=u.hasOwnProperty,w=t.forEach,a=t.map,b=t.reduce,r=t.reduceRight,M=t.filter,X=t.every,g=t.some,m=t.indexOf,x=t.lastIndexOf,j=Array.isArray,h=Object.keys,k=l.bind,q=function(e){return e instanceof q?e:this instanceof q?void(this._wrapped=e):new q(e)};"undefined"!=typeof f?("undefined"!=typeof o&&o.exports&&(f=o.exports=q),f._=q):n._=q,q.VERSION="1.6.0";var v=q.each=q.forEach=function(e,n,o){if(null==e)return e;if(w&&e.forEach===w)e.forEach(n,o);else if(e.length===+e.length){for(var f=0,d=e.length;d>f;f++)if(n.call(o,e[f],f,e)===i)return}else for(var t=q.keys(e),f=0,d=t.length;d>f;f++)if(n.call(o,e[t[f]],t[f],e)===i)return;return e};q.map=q.collect=function(e,n,o){var f=[];return null==e?f:a&&e.map===a?e.map(n,o):(v(e,function(e,d,i){f.push(n.call(o,e,d,i))}),f)};var z="Reduce of empty array with no initial value";q.reduce=q.foldl=q.inject=function(e,n,o,f){var d=arguments.length>2;if(null==e&&(e=[]),b&&e.reduce===b)return f&&(n=q.bind(n,f)),d?e.reduce(n,o):e.reduce(n);if(v(e,function(e,i,t){d?o=n.call(f,o,e,i,t):(o=e,d=!0)}),!d)throw new TypeError(z);return o},q.reduceRight=q.foldr=function(e,n,o,f){var d=arguments.length>2;if(null==e&&(e=[]),r&&e.reduceRight===r)return f&&(n=q.bind(n,f)),d?e.reduceRight(n,o):e.reduceRight(n);var i=e.length;if(i!==+i){var t=q.keys(e);i=t.length}if(v(e,function(u,l,p){l=t?t[--i]:--i,d?o=n.call(f,o,e[l],l,p):(o=e[l],d=!0)}),!d)throw new TypeError(z);return o},q.find=q.detect=function(e,n,o){var f;return A(e,function(e,d,i){return n.call(o,e,d,i)?(f=e,!0):void 0}),f},q.filter=q.select=function(e,n,o){var f=[];return null==e?f:M&&e.filter===M?e.filter(n,o):(v(e,function(e,d,i){n.call(o,e,d,i)&&f.push(e)}),f)},q.reject=function(e,n,o){return q.filter(e,function(e,f,d){return!n.call(o,e,f,d)},o)},q.every=q.all=function(e,n,o){n||(n=q.identity);var f=!0;return null==e?f:X&&e.every===X?e.every(n,o):(v(e,function(e,d,t){return(f=f&&n.call(o,e,d,t))?void 0:i}),!!f)};var A=q.some=q.any=function(e,n,o){n||(n=q.identity);var f=!1;return null==e?f:g&&e.some===g?e.some(n,o):(v(e,function(e,d,t){return f||(f=n.call(o,e,d,t))?i:void 0}),!!f)};q.contains=q.include=function(e,n){return null==e?!1:m&&e.indexOf===m?-1!=e.indexOf(n):A(e,function(e){return e===n})},q.invoke=function(e,n){var o=P.call(arguments,2),f=q.isFunction(n);return q.map(e,function(e){return(f?n:e[n]).apply(e,o)})},q.pluck=function(e,n){return q.map(e,q.property(n))},q.where=function(e,n){return q.filter(e,q.matches(n))},q.findWhere=function(e,n){return q.find(e,q.matches(n))},q.max=function(e,n,o){if(!n&&q.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);var f=-1/0,d=-1/0;return v(e,function(e,i,t){var u=n?n.call(o,e,i,t):e;u>d&&(f=e,d=u)}),f},q.min=function(e,n,o){if(!n&&q.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);var f=1/0,d=1/0;return v(e,function(e,i,t){var u=n?n.call(o,e,i,t):e;d>u&&(f=e,d=u)}),f},q.shuffle=function(e){var n,o=0,f=[];return v(e,function(e){n=q.random(o++),f[o-1]=f[n],f[n]=e}),f},q.sample=function(e,n,o){return null==n||o?(e.length!==+e.length&&(e=q.values(e)),e[q.random(e.length-1)]):q.shuffle(e).slice(0,Math.max(0,n))};var B=function(e){return null==e?q.identity:q.isFunction(e)?e:q.property(e)};q.sortBy=function(e,n,o){return n=B(n),q.pluck(q.map(e,function(e,f,d){return{value:e,index:f,criteria:n.call(o,e,f,d)}}).sort(function(e,n){var o=e.criteria,f=n.criteria;if(o!==f){if(o>f||void 0===o)return 1;if(f>o||void 0===f)return-1}return e.index-n.index}),"value")};var C=function(e){return function(n,o,f){var d={};return o=B(o),v(n,function(i,t){var u=o.call(f,i,t,n);e(d,u,i)}),d}};q.groupBy=C(function(e,n,o){q.has(e,n)?e[n].push(o):e[n]=[o]}),q.indexBy=C(function(e,n,o){e[n]=o}),q.countBy=C(function(e,n){q.has(e,n)?e[n]++:e[n]=1}),q.sortedIndex=function(e,n,o,f){o=B(o);for(var d=o.call(f,n),i=0,t=e.length;t>i;){var u=i+t>>>1;o.call(f,e[u])<d?i=u+1:t=u}return i},q.toArray=function(e){return e?q.isArray(e)?P.call(e):e.length===+e.length?q.map(e,q.identity):q.values(e):[]},q.size=function(e){return null==e?0:e.length===+e.length?e.length:q.keys(e).length},q.first=q.head=q.take=function(e,n,o){return null==e?void 0:null==n||o?e[0]:0>n?[]:P.call(e,0,n)},q.initial=function(e,n,o){return P.call(e,0,e.length-(null==n||o?1:n))},q.last=function(e,n,o){return null==e?void 0:null==n||o?e[e.length-1]:P.call(e,Math.max(e.length-n,0))},q.rest=q.tail=q.drop=function(e,n,o){return P.call(e,null==n||o?1:n)},q.compact=function(e){return q.filter(e,q.identity)};var D=function(e,n,o){return n&&q.every(e,q.isArray)?c.apply(o,e):(v(e,function(e){q.isArray(e)||q.isArguments(e)?n?p.apply(o,e):D(e,n,o):o.push(e)}),o)};q.flatten=function(e,n){return D(e,n,[])},q.without=function(e){return q.difference(e,P.call(arguments,1))},q.partition=function(e,n){var o=[],f=[];return v(e,function(e){(n(e)?o:f).push(e)}),[o,f]},q.uniq=q.unique=function(e,n,o,f){q.isFunction(n)&&(f=o,o=n,n=!1);var d=o?q.map(e,o,f):e,i=[],t=[];return v(d,function(o,f){(n?f&&t[t.length-1]===o:q.contains(t,o))||(t.push(o),i.push(e[f]))}),i},q.union=function(){return q.uniq(q.flatten(arguments,!0))},q.intersection=function(e){var n=P.call(arguments,1);return q.filter(q.uniq(e),function(e){return q.every(n,function(n){return q.contains(n,e)})})},q.difference=function(e){var n=c.apply(t,P.call(arguments,1));return q.filter(e,function(e){return!q.contains(n,e)})},q.zip=function(){for(var e=q.max(q.pluck(arguments,"length").concat(0)),n=new Array(e),o=0;e>o;o++)n[o]=q.pluck(arguments,""+o);return n},q.object=function(e,n){if(null==e)return{};for(var o={},f=0,d=e.length;d>f;f++)n?o[e[f]]=n[f]:o[e[f][0]]=e[f][1];return o},q.indexOf=function(e,n,o){if(null==e)return-1;var f=0,d=e.length;if(o){if("number"!=typeof o)return f=q.sortedIndex(e,n),e[f]===n?f:-1;f=0>o?Math.max(0,d+o):o}if(m&&e.indexOf===m)return e.indexOf(n,o);for(;d>f;f++)if(e[f]===n)return f;return-1},q.lastIndexOf=function(e,n,o){if(null==e)return-1;var f=null!=o;if(x&&e.lastIndexOf===x)return f?e.lastIndexOf(n,o):e.lastIndexOf(n);for(var d=f?o:e.length;d--;)if(e[d]===n)return d;return-1},q.range=function(e,n,o){arguments.length<=1&&(n=e||0,e=0),o=arguments[2]||1;for(var f=Math.max(Math.ceil((n-e)/o),0),d=0,i=new Array(f);f>d;)i[d++]=e,e+=o;return i};var E=function(){};q.bind=function(e,n){var o,f;if(k&&e.bind===k)return k.apply(e,P.call(arguments,1));if(!q.isFunction(e))throw new TypeError;return o=P.call(arguments,2),f=function(){if(!(this instanceof f))return e.apply(n,o.concat(P.call(arguments)));E.prototype=e.prototype;var d=new E;E.prototype=null;var i=e.apply(d,o.concat(P.call(arguments)));return Object(i)===i?i:d}},q.partial=function(e){var n=P.call(arguments,1);return function(){for(var o=0,f=n.slice(),d=0,i=f.length;i>d;d++)f[d]===q&&(f[d]=arguments[o++]);for(;o<arguments.length;)f.push(arguments[o++]);return e.apply(this,f)}},q.bindAll=function(e){var n=P.call(arguments,1);if(0===n.length)throw new Error("bindAll must be passed function names");return v(n,function(n){e[n]=q.bind(e[n],e)}),e},q.memoize=function(e,n){var o={};return n||(n=q.identity),function(){var f=n.apply(this,arguments);return q.has(o,f)?o[f]:o[f]=e.apply(this,arguments)}},q.delay=function(e,n){var o=P.call(arguments,2);return setTimeout(function(){return e.apply(null,o)},n)},q.defer=function(e){return q.delay.apply(q,[e,1].concat(P.call(arguments,1)))},q.throttle=function(e,n,o){var f,d,i,t=null,u=0;o||(o={});var l=function(){u=o.leading===!1?0:q.now(),t=null,i=e.apply(f,d),f=d=null};return function(){var p=q.now();u||o.leading!==!1||(u=p);var P=n-(p-u);return f=this,d=arguments,0>=P?(clearTimeout(t),t=null,u=p,i=e.apply(f,d),f=d=null):t||o.trailing===!1||(t=setTimeout(l,P)),i}},q.debounce=function(e,n,o){var f,d,i,t,u,l=function(){var p=q.now()-t;n>p?f=setTimeout(l,n-p):(f=null,o||(u=e.apply(i,d),i=d=null))};return function(){i=this,d=arguments,t=q.now();var p=o&&!f;return f||(f=setTimeout(l,n)),p&&(u=e.apply(i,d),i=d=null),u}},q.once=function(e){var n,o=!1;return function(){return o?n:(o=!0,n=e.apply(this,arguments),e=null,n)}},q.wrap=function(e,n){return q.partial(n,e)},q.compose=function(){var e=arguments;return function(){for(var n=arguments,o=e.length-1;o>=0;o--)n=[e[o].apply(this,n)];return n[0]}},q.after=function(e,n){return function(){return--e<1?n.apply(this,arguments):void 0}},q.keys=function(e){if(!q.isObject(e))return[];if(h)return h(e);var n=[];for(var o in e)q.has(e,o)&&n.push(o);return n},q.values=function(e){for(var n=q.keys(e),o=n.length,f=new Array(o),d=0;o>d;d++)f[d]=e[n[d]];return f},q.pairs=function(e){for(var n=q.keys(e),o=n.length,f=new Array(o),d=0;o>d;d++)f[d]=[n[d],e[n[d]]];return f},q.invert=function(e){for(var n={},o=q.keys(e),f=0,d=o.length;d>f;f++)n[e[o[f]]]=o[f];return n},q.functions=q.methods=function(e){var n=[];for(var o in e)q.isFunction(e[o])&&n.push(o);return n.sort()},q.extend=function(e){return v(P.call(arguments,1),function(n){if(n)for(var o in n)e[o]=n[o]}),e},q.pick=function(e){var n={},o=c.apply(t,P.call(arguments,1));return v(o,function(o){o in e&&(n[o]=e[o])}),n},q.omit=function(e){var n={},o=c.apply(t,P.call(arguments,1));for(var f in e)q.contains(o,f)||(n[f]=e[f]);return n},q.defaults=function(e){return v(P.call(arguments,1),function(n){if(n)for(var o in n)void 0===e[o]&&(e[o]=n[o])}),e},q.clone=function(e){return q.isObject(e)?q.isArray(e)?e.slice():q.extend({},e):e},q.tap=function(e,n){return n(e),e};var F=function(e,n,o,f){if(e===n)return 0!==e||1/e==1/n;if(null==e||null==n)return e===n;e instanceof q&&(e=e._wrapped),n instanceof q&&(n=n._wrapped);var d=s.call(e);if(d!=s.call(n))return!1;switch(d){case"[object String]":return e==String(n);case"[object Number]":return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object RegExp]":return e.source==n.source&&e.global==n.global&&e.multiline==n.multiline&&e.ignoreCase==n.ignoreCase}if("object"!=typeof e||"object"!=typeof n)return!1;for(var i=o.length;i--;)if(o[i]==e)return f[i]==n;var t=e.constructor,u=n.constructor;if(t!==u&&!(q.isFunction(t)&&t instanceof t&&q.isFunction(u)&&u instanceof u)&&"constructor"in e&&"constructor"in n)return!1;o.push(e),f.push(n);var l=0,p=!0;if("[object Array]"==d){if(l=e.length,p=l==n.length)for(;l--&&(p=F(e[l],n[l],o,f)););}else{for(var P in e)if(q.has(e,P)&&(l++,!(p=q.has(n,P)&&F(e[P],n[P],o,f))))break;if(p){for(P in n)if(q.has(n,P)&&!l--)break;p=!l}}return o.pop(),f.pop(),p};q.isEqual=function(e,n){return F(e,n,[],[])},q.isEmpty=function(e){if(null==e)return!0;if(q.isArray(e)||q.isString(e))return 0===e.length;for(var n in e)if(q.has(e,n))return!1;return!0},q.isElement=function(e){return!(!e||1!==e.nodeType)},q.isArray=j||function(e){return"[object Array]"==s.call(e)},q.isObject=function(e){return e===Object(e)},v(["Arguments","Function","String","Number","Date","RegExp"],function(e){q["is"+e]=function(n){return s.call(n)=="[object "+e+"]"}}),q.isArguments(arguments)||(q.isArguments=function(e){return!(!e||!q.has(e,"callee"))}),"function"!=typeof/./&&(q.isFunction=function(e){return"function"==typeof e}),q.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},q.isNaN=function(e){return q.isNumber(e)&&e!=+e},q.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==s.call(e)},q.isNull=function(e){return null===e},q.isUndefined=function(e){return void 0===e},q.has=function(e,n){return y.call(e,n)},q.noConflict=function(){return n._=d,this},q.identity=function(e){return e},q.constant=function(e){return function(){return e}},q.property=function(e){return function(n){return n[e]}},q.matches=function(e){return function(n){if(n===e)return!0;for(var o in e)if(e[o]!==n[o])return!1;return!0}},q.times=function(e,n,o){for(var f=Array(Math.max(0,e)),d=0;e>d;d++)f[d]=n.call(o,d);return f},q.random=function(e,n){return null==n&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))},q.now=Date.now||function(){return(new Date).getTime()};var G={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};G.unescape=q.invert(G.escape);var H={escape:new RegExp("["+q.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+q.keys(G.unescape).join("|")+")","g")};q.each(["escape","unescape"],function(e){q[e]=function(n){return null==n?"":(""+n).replace(H[e],function(n){return G[e][n]})}}),q.result=function(e,n){if(null==e)return void 0;var o=e[n];return q.isFunction(o)?o.call(e):o},q.mixin=function(e){v(q.functions(e),function(n){var o=q[n]=e[n];q.prototype[n]=function(){var e=[this._wrapped];return p.apply(e,arguments),N.call(this,o.apply(q,e))}})};var I=0;q.uniqueId=function(e){var n=++I+"";return e?e+n:n},q.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;q.template=function(e,n,o){var f;o=q.defaults({},o,q.templateSettings);var d=new RegExp([(o.escape||J).source,(o.interpolate||J).source,(o.evaluate||J).source].join("|")+"|$","g"),i=0,t="__p+='";e.replace(d,function(n,o,f,d,u){return t+=e.slice(i,u).replace(L,function(e){return"\\"+K[e]}),o&&(t+="'+\n((__t=("+o+"))==null?'':_.escape(__t))+\n'"),f&&(t+="'+\n((__t=("+f+"))==null?'':__t)+\n'"),d&&(t+="';\n"+d+"\n__p+='"),i=u+n.length,n}),t+="';\n",o.variable||(t="with(obj||{}){\n"+t+"}\n"),t="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+t+"return __p;\n";try{f=new Function(o.variable||"obj","_",t)}catch(u){throw u.source=t,u}if(n)return f(n,q);var l=function(e){return f.call(this,e,q)};return l.source="function("+(o.variable||"obj")+"){\n"+t+"}",l},q.chain=function(e){return q(e).chain()};var N=function(e){return this._chain?q(e).chain():e};q.mixin(q),v(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var n=t[e];q.prototype[e]=function(){var o=this._wrapped;return n.apply(o,arguments),"shift"!=e&&"splice"!=e||0!==o.length||delete o[0],N.call(this,o)}}),v(["concat","join","slice"],function(e){var n=t[e];q.prototype[e]=function(){return N.call(this,n.apply(this._wrapped,arguments))}}),q.extend(q.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof e&&e.amd&&e("underscore",[],function(){return q})}).call(this)},{}],223:[function(e,n){function o(){this.callbacks={}}n.exports=o,o.prototype.on=function(e){var n=3===arguments.length,o=n?arguments[1]:void 0,f=n?arguments[2]:arguments[1];return f._groupName=o,(this.callbacks[e]=this.callbacks[e]||[]).push(f),this},o.prototype.once=function(e){function n(){o.off(e,n),i.apply(this,arguments)}var o=this,f=3===arguments.length,d=f?arguments[1]:void 0,i=f?arguments[2]:arguments[1];return this.on(e,d,n),this},o.prototype.releaseGroup=function(e){var n,o,f,d;for(n in this.callbacks)for(d=this.callbacks[n],o=0,f=d.length;f>o;o++)d[o]._groupName===e&&(d.splice(o,1),o--,f--);return this},o.prototype.off=function(e,n){var o,f=this.callbacks[e];return f?1===arguments.length?(delete this.callbacks[e],this):(o=f.indexOf(n),f.splice(o,1),this):this},o.prototype.emit=function(e){var n,o,f,d=[].slice.call(arguments,1),i=this.callbacks[e],t=this.getWildcardCallbacks(e);if(i)for(f=i.slice(),n=0,o=f.length;o>n&&f[n];++n)f[n].apply(this,d);if(t)for(o=t.length,f=t.slice(),n=0,o=f.length;o>n&&f[n];++n)f[n].apply(this,[e].concat(d));return this},o.prototype.getWildcardCallbacks=function(e){var n,o,f=[];for(n in this.callbacks)o=n.split("*"),("*"===n||2===o.length&&e.slice(0,o[0].length)===o[0])&&(f=f.concat(this.callbacks[n]));return f}},{}]},{},[1])(1)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment