diff --git a/clientapp/app.js b/clientapp/app.js index 8be4c55..baea192 100644 --- a/clientapp/app.js +++ b/clientapp/app.js @@ -1,9 +1,11 @@ -/*global $, app, me, client, XMPP*/ +/*global $, app, me, client*/ "use strict"; var _ = require('underscore'); var async = require('async'); var Backbone = require('backbone'); +var StanzaIO = require('stanza.io'); + var AppState = require('./models/state'); var MeModel = require('./models/me'); var MainView = require('./views/main'); @@ -52,7 +54,7 @@ module.exports = { } }; - self.api = window.client = XMPP.createClient(config); + self.api = window.client = StanzaIO.createClient(config); xmppEventHandlers(self.api, self); self.api.once('session:started', function () { diff --git a/clientapp/helpers/xmppEventHandlers.js b/clientapp/helpers/xmppEventHandlers.js index 9552f0b..7e6cef1 100644 --- a/clientapp/helpers/xmppEventHandlers.js +++ b/clientapp/helpers/xmppEventHandlers.js @@ -1,10 +1,9 @@ -/*global XMPP, me, app, client*/ +/*global me, app, client*/ "use strict"; -var crypto = XMPP.crypto; - var _ = require('underscore'); var async = require('async'); +var crypto = require('crypto'); var log = require('andlog'); var uuid = require('node-uuid'); var Contact = require('../models/contact'); diff --git a/clientapp/libraries/stanza.io.js b/clientapp/libraries/stanza.io.js deleted file mode 100644 index cb74535..0000000 --- a/clientapp/libraries/stanza.io.js +++ /dev/null @@ -1,8 +0,0 @@ -!function(t){if("function"==typeof bootstrap)bootstrap("xmpp",t);else if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeXMPP=t}else"undefined"!=typeof window?window.XMPP=t():global.XMPP=t()}(function(){var t;return function(t,e,n){function r(n,o){if(!e[n]){if(!t[n]){var a="function"==typeof require&&require;if(!o&&a)return a(n,!0);if(i)return i(n,!0);throw new Error("Cannot find module '"+n+"'")}var s=e[n]={exports:{}};t[n][0].call(s.exports,function(e){var i=t[n][1][e];return r(i?i:e)},s,s.exports)}return e[n].exports}for(var i="function"==typeof require&&require,o=0;o0?this.jid.slice(0,t):this.jid,this.parts.bare},get resource(){if(this.parts.resource)return this.parts.resource;var t=this.jid.indexOf("/");return this.parts.resource=t>0?this.jid.slice(t+1):"",this.parts.resource},get local(){if(this.parts.local)return this.parts.local;var t=this.bare,e=t.indexOf("@");return this.parts.local=e>0?t.slice(0,e):t,this.parts.local},get domain(){if(this.parts.domain)return this.parts.domain;var t=this.bare,e=t.indexOf("@");return this.parts.domain=e>0?t.slice(e+1):t,this.parts.domain}},e.exports=n},{}],4:[function(t,e){e.exports=function(t){t.disco.addFeature("urn:xmpp:attention:0"),t.getAttention=function(e,n){n=n||{},n.to=e,n.type="headline",n.attention=!0,t.sendMessage(n)},t.on("message",function(e){e._extensions._attention&&t.emit("attention",e)})}},{}],5:[function(t,e){t("../stanza/avatar"),e.exports=function(t){t.disco.addFeature("urn:xmpp:avatar:metadata+notify"),t.on("pubsubEvent",function(e){e.event._extensions.updated&&"urn:xmpp:avatar:metadata"===e.event.updated.node&&t.emit("avatar",{jid:e.from,avatars:e.event.updated.published[0].avatars})}),t.publishAvatar=function(e,n,r){t.publish("","urn:xmpp:avatar:data",{id:e,avatarData:n},r)},t.useAvatars=function(e,n){t.publish("","urn:xmpp:avatar:metadata",{id:"current",avatars:e},n)},t.getAvatar=function(e,n,r){t.getItem(e,"urn:xmpp:avatar:data",n,r)}}},{"../stanza/avatar":23}],6:[function(t,e){t("../stanza/bookmarks"),e.exports=function(t){t.getBookmarks=function(t){this.getPrivateData({bookmarks:{}},t)},t.setBookmarks=function(t,e){this.setPrivateData({bookmarks:t},e)}}},{"../stanza/bookmarks":25}],7:[function(t,e){t("../stanza/carbons"),e.exports=function(t){t.disco.addFeature("urn:xmpp:carbons:2"),t.enableCarbons=function(t){this.sendIq({type:"set",enableCarbons:!0},t)},t.disableCarbons=function(t){this.sendIq({type:"set",disableCarbons:!0},t)},t.on("message",function(e){return e._extensions.carbonSent?t.emit("carbon:sent",e):e._extensions.carbonReceived?t.emit("carbon:received",e):void 0})}},{"../stanza/carbons":27}],8:[function(t,e){t("../stanza/chatstates"),e.exports=function(t){t.disco.addFeature("http://jabber.org/protocol/chatstates"),t.on("message",function(e){e.chatState&&t.emit("chatState",{to:e.to,from:e.from,chatState:e.chatState})})}},{"../stanza/chatstates":28}],9:[function(t,e){e.exports=function(t){t.disco.addFeature("urn:xmpp:message-correct:0"),t.on("message",function(e){e.replace&&(t.emit("replace",e),t.emit("replace:"+e.id,e))})}},{}],10:[function(t,e){t("../stanza/delayed"),e.exports=function(t){t.disco.addFeature("urn:xmpp:delay")}},{"../stanza/delayed":30}],11:[function(t,e){function n(t,e,n){"sha-1"===e&&(e="sha1");var i=r(t,e);return i&&i==n}function r(t,e){var n="",r=t.features.sort(),i=[],u={},c=[];o.forEach(t.identities,function(t){i.push([t.category||"",t.type||"",t.lang||"",t.name||""].join("/"))});var f=i.length,l=r.length;if(i=o.unique(i,!0),r=o.unique(r,!0),l!=r.length||f!=i.length)return!1;n+=i.join("<")+"<",n+=r.join("<")+"<";var p=!1;if(o.forEach(t.extensions,function(t){for(var e=t.fields,n=0,r=e.length;r>n;n++)if("FORM_TYPE"==e[n].name&&"hidden"==e[n].type){var i=e[n].value;return u[i]?(p=!0,void 0):(u[i]=t,c.push(i),void 0)}}),p)return!1;c.sort(),o.forEach(c,function(t){var e=u[t],r={},i=[];n+="<"+t,o.forEach(e.fields,function(t){var e=t.name;if("FORM_TYPE"!=e){var n=t.value||"";"object"!=typeof n&&(n=n.split("\n")),r[e]=n.sort(),i.push(e)}}),i.sort(),o.forEach(i,function(t){n+="<"+t,o.forEach(r[t],function(t){n+="<"+t})})}),"sha-1"===e&&(e="sha1");var h=a.createHash(e).update(s.encode(n)).digest("base64"),d=4-h.length%4;4===d&&(d=0);for(var m=0;d>m;m++)h+="=";return h}function i(){this.features={},this.identities={},this.extensions={},this.items={},this.caps={}}var o=t("underscore"),a=t("crypto");t("../stanza/disco"),t("../stanza/caps");var s={encode:function(t){return unescape(encodeURIComponent(t))},decode:function(t){return decodeURIComponent(escape(t))}};i.prototype={constructor:{value:i},addFeature:function(t,e){e=e||"",this.features[e]||(this.features[e]=[]),this.features[e].push(t)},addIdentity:function(t,e){e=e||"",this.identities[e]||(this.identities[e]=[]),this.identities[e].push(t)},addItem:function(t,e){e=e||"",this.items[e]||(this.items[e]=[]),this.items[e].push(t)},addExtension:function(t,e){e=e||"",this.extensions[e]||(this.extensions[e]=[]),this.extensions[e].push(t)}},e.exports=function(t){t.disco=new i(t),t.disco.addFeature("http://jabber.org/protocol/disco#info"),t.disco.addIdentity({category:"client",type:"web"}),t.getDiscoInfo=function(t,e,n){this.sendIq({to:t,type:"get",discoInfo:{node:e}},n)},t.getDiscoItems=function(t,e,n){this.sendIq({to:t,type:"get",discoItems:{node:e}},n)},t.updateCaps=function(){var e=this.config.capsNode||"https://stanza.io",n=JSON.parse(JSON.stringify({identities:this.disco.identities[""],features:this.disco.features[""],extensions:this.disco.extensions[""]})),i=r(n,"sha-1");return this.disco.caps={node:e,hash:"sha-1",ver:i},e=e+"#"+i,this.disco.features[e]=n.features,this.disco.identities[e]=n.identities,this.disco.extensions[e]=n.extensions,t.getCurrentCaps()},t.getCurrentCaps=function(){var e=t.disco.caps;if(!e.ver)return{ver:null,discoInfo:null};var n=e.node+"#"+e.ver;return{ver:e.ver,discoInfo:{identities:t.disco.identities[n],features:t.disco.features[n],extensions:t.disco.extensions[n]}}},t.on("presence",function(e){e._extensions.caps&&t.emit("disco:caps",e)}),t.on("iq:get:discoInfo",function(e){var n=e.discoInfo.node,r=e.discoInfo.node;n===t.disco.caps.node+"#"+t.disco.caps.ver&&(r=n,n=""),t.sendIq(e.resultReply({discoInfo:{node:r,identities:t.disco.identities[n]||[],features:t.disco.features[n]||[],extensions:t.disco.extensions[n]||[]}}))}),t.on("iq:get:discoItems",function(e){var n=e.discoInfo.node;t.sendIq(e.resultReply({discoItems:{node:n,items:t.disco.items[n]||[]}}))}),t.verifyVerString=n,t.generateVerString=r}},{"../stanza/caps":26,"../stanza/disco":31,crypto:62,underscore:95}],12:[function(t,e){t("../stanza/forwarded"),e.exports=function(t){t.disco.addFeature("urn:xmpp:forward:0")}},{"../stanza/forwarded":33}],13:[function(t,e){e.exports=function(t){t.disco.addFeature("urn:xmpp:idle:0")}},{}],14:[function(t,e){t("../stanza/visibility"),e.exports=function(t){t.goInvisible=function(){this.sendIq({type:"set",invisible:!0})},t.goVisible=function(){this.sendIq({type:"set",visible:!0})}}},{"../stanza/visibility":53}],15:[function(t,e){t("../stanza/mam"),e.exports=function(t){t.disco.addFeature("urn:xmpp:mam:tmp"),t.getHistory=function(t,e){var n=this,r=this.nextId();t=t||{},t.queryid=r;var i=[];this.on("mam:"+r,"session",function(t){i.push(t)}),e=e||function(){},this.sendIq({type:"get",id:r,mamQuery:t},function(t,o){t?e(t):(n.off("mam:"+r),o.mamQuery.results=i,e(null,o))})},t.getHistoryPreferences=function(e){t.sendIq({type:"get",mamPrefs:{}},e)},t.setHistoryPreferences=function(e,n){t.sendIq({type:"set",mamPrefs:e},n)},t.on("message",function(e){e._extensions.mam&&t.emit("mam:"+e.mam.queryid,e)})}},{"../stanza/mam":35}],16:[function(t,e){t("../stanza/muc"),e.exports=function(t){t.joinRoom=function(t,e,n){n=n||{},n.to=t+"/"+e,n.caps=this.disco.caps,n.joinMuc=n.joinMuc||{},this.sendPresence(n)},t.leaveRoom=function(t,e,n){n=n||{},n.to=t+"/"+e,n.type="unavailable",this.sendPresence(n)}}},{"../stanza/muc":37}],17:[function(t,e){t("../stanza/private"),e.exports=function(t){t.getPrivateData=function(t,e){this.sendIq({type:"get",privateStorage:t},e)},t.setPrivateData=function(t,e){this.sendIq({type:"set",privateStorage:t},e)}}},{"../stanza/private":39}],18:[function(t,e){t("../stanza/pubsub"),e.exports=function(t){t.on("message",function(e){e._extensions.event&&t.emit("pubsubEvent",e)}),t.subscribeToNode=function(e,n,r){t.sendIq({type:"set",to:e,pubsub:{subscribe:{node:n.node,jid:n.jid||t.jid}}},r)},t.unsubscribeFromNode=function(e,n,r){t.sendIq({type:"set",to:e,pubsub:{unsubscribe:{node:n.node,jid:n.jid||t.jid.split("/")[0]}}},r)},t.publish=function(e,n,r,i){t.sendIq({type:"set",to:e,pubsub:{publish:{node:n,item:r}}},i)},t.getItem=function(e,n,r,i){t.sendIq({type:"get",to:e,pubsub:{retrieve:{node:n,item:r}}},i)},t.getItems=function(e,n,r,i){r=r||{},r.node=n,t.sendIq({type:"get",to:e,pubsub:{retrieve:{node:n,max:r.max},rsm:r.rsm}},i)},t.retract=function(e,n,r,i,o){t.sendIq({type:"set",to:e,pubsub:{retract:{node:n,notify:i,id:r}}},o)},t.purgeNode=function(e,n,r){t.sendIq({type:"set",to:e,pubsubOwner:{purge:n}},r)},t.deleteNode=function(e,n,r){t.sendIq({type:"set",to:e,pubsubOwner:{del:n}},r)},t.createNode=function(e,n,r,i){var o={type:"set",to:e,pubsubOwner:{create:n}};r&&(o.pubsubOwner.config={form:r}),t.sendIq(o,i)}}},{"../stanza/pubsub":40}],19:[function(t,e){t("../stanza/receipts"),e.exports=function(t){t.disco.addFeature("urn:xmpp:receipts"),t.on("message",function(e){var n={normal:!0,chat:!0,headline:!0};n[e.type]&&e.requestReceipt&&!e._extensions.receipt&&t.sendMessage({to:e.from,receipt:{id:e.id},id:e.id}),e._extensions.receipt&&t.emit("receipt:"+e.receipt.id)})}},{"../stanza/receipts":41}],20:[function(t,e){t("../stanza/time"),e.exports=function(t){t.disco.addFeature("urn:xmpp:time"),t.getTime=function(t,e){this.sendIq({to:t,type:"get",time:!0},e)},t.on("iq:get:time",function(e){var n=new Date;t.sendIq(e.resultReply({time:{utc:n,tzo:n.getTimezoneOffset()}}))})}},{"../stanza/time":50}],21:[function(t,e){t("../stanza/version"),e.exports=function(t){t.disco.addFeature("jabber:iq:version"),t.on("iq:get:version",function(e){t.sendIq(e.resultReply({version:t.config.version||{name:"stanza.io"}}))}),t.getSoftwareVersion=function(t,e){this.sendIq({to:t,type:"get",version:{}},e)}}},{"../stanza/version":52}],22:[function(t,e){function n(t,e){return(t%e+e)%e}function r(t){this.conn=t,this.id=!1,this.allowResume=!0,this.started=!1,this.lastAck=0,this.handled=0,this.windowSize=1,this.windowCount=0,this.unacked=[]}var i=t("./stanza/sm"),o=Math.pow(2,32);r.prototype={constructor:{value:r},enable:function(){var t=new i.Enable;t.resume=this.allowResume,this.conn.send(t),this.handled=0,this.started=!0},resume:function(){var t=new i.Resume({h:this.handled,previd:this.id});this.conn.send(t),this.started=!0},enabled:function(t){this.id=t.id},resumed:function(t){this.id=t.id,t.h&&this.process(t,!0)},failed:function(){this.started=!1,this.id=!1,this.lastAck=0,this.handled=0,this.windowCount=0,this.unacked=[]},ack:function(){this.conn.send(new i.Ack({h:this.handled}))},request:function(){this.conn.send(new i.Request)},process:function(t,e){for(var r=this,i=n(t.h-this.lastAck,o),a=0;i>a&&this.unacked.length>0;a++)this.conn.emit("stanza:acked",this.unacked.shift());if(e){var s=this.unacked;this.unacked=[],s.forEach(function(t){r.conn.send(t)})}this.lastAck=t.h},track:function(t){var e=t._name,n={message:!0,presence:!0,iq:!0};this.started&&n[e]&&(this.unacked.push(t),this.windowCount+=1,this.windowCount==this.windowSize&&(this.request(),this.windowCount=0))},handle:function(){this.started&&(this.handled=n(this.handled+1,o))}},e.exports=r},{"./stanza/sm":46}],23:[function(t,e){var n=t("underscore"),r=t("jxt"),i=t("./pubsub").Item,o=t("./pubsub").EventItem,a=e.exports=r.define({name:"avatar",namespace:"urn:xmpp:avatar:metadata",element:"info",fields:{id:r.attribute("id"),bytes:r.attribute("bytes"),height:r.attribute("height"),width:r.attribute("width"),type:r.attribute("type","image/png"),url:r.attribute("url")}}),s={get:function(){var t=r.find(this.xml,"urn:xmpp:avatar:metadata","metadata"),e=[];if(t.length){var i=r.find(t[0],"urn:xmpp:avatar:metadata","info");n.forEach(i,function(t){e.push(new a({},t))})}return e},set:function(t){var e=r.findOrCreate(this.xml,"urn:xmpp:avatar:metadata","metadata");r.setAttribute(e,"xmlns","urn:xmpp:avatar:metadata"),n.forEach(t,function(t){var n=new a(t);e.appendChild(n.xml)})}};r.add(i,"avatars",s),r.add(o,"avatars",s),r.add(i,"avatarData",r.subText("urn:xmpp:avatar:data","data")),r.add(o,"avatarData",r.subText("urn:xmpp:avatar:data","data"))},{"./pubsub":40,jxt:76,underscore:95}],24:[function(t,e){var n=t("jxt"),r=t("./iq"),i=t("./streamFeatures"),o=t("./util"),a="urn:ietf:params:xml:ns:xmpp-bind",s=e.exports=n.define({name:"bind",namespace:a,element:"bind",fields:{resource:n.subText(a,"resource"),jid:o.jidSub(a,"jid")}});n.extend(r,s),n.extend(i,s)},{"./iq":34,"./streamFeatures":49,"./util":51,jxt:76}],25:[function(t,e){var n=t("jxt"),r=t("./util"),i=t("./private"),o=n.define({name:"conference",namespace:"storage:bookmarks",element:"conference",fields:{name:n.attribute("name"),autoJoin:n.boolAttribute("autojoin"),jid:r.jidAttribute("jid"),nick:n.subText("storage:bookmarks","nick")}}),a=e.exports=n.define({name:"bookmarks",namespace:"storage:bookmarks",element:"storage"});n.extend(i,a),n.extend(a,o,"conferences")},{"./private":39,"./util":51,jxt:76}],26:[function(t,e){var n=t("jxt"),r=t("./presence"),i=t("./streamFeatures"),o=e.exports=n.define({name:"caps",namespace:"http://jabber.org/protocol/caps",element:"c",fields:{ver:n.attribute("ver"),node:n.attribute("node"),hash:n.attribute("hash"),ext:n.attribute("ext")}});n.extend(r,o),n.extend(i,o)},{"./presence":38,"./streamFeatures":49,jxt:76}],27:[function(t,e,n){var r=t("jxt"),i=t("./message"),o=t("./iq"),a=t("./forwarded");n.Sent=r.define({name:"carbonSent",eventName:"carbon:sent",namespace:"urn:xmpp:carbons:2",element:"sent"}),n.Received=r.define({name:"carbonReceived",eventName:"carbon:received",namespace:"urn:xmpp:carbons:2",element:"received"}),n.Private=r.define({name:"carbonPrivate",eventName:"carbon:private",namespace:"urn:xmpp:carbons:2",element:"private"}),n.Enable=r.define({name:"enableCarbons",namespace:"urn:xmpp:carbons:2",element:"enable"}),n.Disable=r.define({name:"disableCarbons",namespace:"urn:xmpp:carbons:2",element:"disable"}),r.extend(n.Sent,a),r.extend(n.Received,a),r.extend(i,n.Sent),r.extend(i,n.Received),r.extend(i,n.Private),r.extend(o,n.Enable),r.extend(o,n.Disable)},{"./forwarded":33,"./iq":34,"./message":36,jxt:76}],28:[function(t){var e=t("jxt"),n=t("./message"),r="http://jabber.org/protocol/chatstates",i=e.define({name:"chatStateActive",eventName:"chat:active",namespace:r,element:"active"}),o=e.define({name:"chatStateComposing",eventName:"chat:composing",namespace:r,element:"composing"}),a=e.define({name:"chatStatePaused",eventName:"chat:paused",namespace:r,element:"paused"}),s=e.define({name:"chatStateInactive",eventName:"chat:inactive",namespace:r,element:"inactive"}),u=e.define({name:"chatStateGone",eventName:"chat:gone",namespace:r,element:"gone"});e.extend(n,i),e.extend(n,o),e.extend(n,a),e.extend(n,s),e.extend(n,u),e.add(n,"chatState",{get:function(){for(var t=this,e=["Active","Composing","Paused","Inactive","Gone"],n=0;n1?"text-multi"===this._type?t.join("\n"):t:t[0]},set:function(t){"boolean"===this._type?r.setSubText(this.xml,this._NS,"value",t?"1":"0"):("text-multi"===this._type&&(t=t.split("\n")),r.setMultiSubText(this.xml,this._NS,"value",t))}},options:{get:function(){var t=this;return r.getMultiSubText(this.xml,this._NS,"option",function(e){return r.getSubText(e,t._NS,"value")})},set:function(t){var e=this;r.setMultiSubText(this.xml,this._NS,"option",t,function(t){var n=document.createElementNS(e._NS,"option"),r=document.createElementNS(e._NS,"value");n.appendChild(r),r.textContent=t,e.xml.appendChild(n)})}}}}),r.extend(i,n.DataForm)},{"./message":36,"./util":51,jxt:76,underscore:95}],30:[function(t,e){var n=t("jxt"),r=t("./message"),i=t("./presence"),o=t("./util"),a=e.exports=n.define({name:"delay",namespace:"urn:xmpp:delay",element:"delay",fields:{from:o.jidAttribute("from"),stamp:o.dateAttribute("stamp"),reason:n.text()}});n.extend(r,a),n.extend(i,a)},{"./message":36,"./presence":38,"./util":51,jxt:76}],31:[function(t,e,n){t("underscore");var r=t("jxt"),i=t("../jid"),o=t("./iq"),a=t("./rsm"),s=t("./dataforms").DataForm;n.DiscoInfo=r.define({name:"discoInfo",namespace:"http://jabber.org/protocol/disco#info",element:"query",fields:{node:r.attribute("node"),identities:{get:function(){var t=[],e=r.find(this.xml,this._NS,"identity");return e.forEach(function(e){t.push({category:r.getAttribute(e,"category"),type:r.getAttribute(e,"type"),lang:e.getAttributeNS(r.XML_NS,"lang"),name:r.getAttribute(e,"name")})}),t},set:function(t){var e=this,n=r.find(this.xml,this._NS,"identity");n.forEach(function(t){e.xml.removeChild(t)}),t.forEach(function(t){var n=document.createElementNS(e._NS,"identity");r.setAttribute(n,"category",t.category),r.setAttribute(n,"type",t.type),r.setAttribute(n,"name",t.name),t.lang&&n.setAttributeNS(r.XML_NS,"lang",t.lang),e.xml.appendChild(n)})}},features:{get:function(){var t=[],e=r.find(this.xml,this._NS,"feature");return e.forEach(function(e){t.push(e.getAttribute("var"))}),t},set:function(t){var e=this,n=r.find(this.xml,this._NS,"feature");n.forEach(function(t){e.xml.removeChild(t)}),t.forEach(function(t){var n=document.createElementNS(e._NS,"feature");n.setAttribute("var",t),e.xml.appendChild(n)})}}}}),n.DiscoItems=r.define({name:"discoItems",namespace:"http://jabber.org/protocol/disco#items",element:"query",fields:{node:r.attribute("node"),items:{get:function(){var t=[],e=r.find(this.xml,this._NS,"item");return e.forEach(function(e){t.push({jid:new i(r.getAttribute(e,"jid")),node:r.getAttribute(e,"node"),name:r.getAttribute(e,"name")})}),t},set:function(t){var e=this,n=r.find(this.xml,this._NS,"item");n.forEach(function(t){e.xml.removeChild(t)}),t.forEach(function(t){var n=document.createElementNS(e._NS,"item");r.setAttribute(n,"jid",t.jid.toString()),r.setAttribute(n,"node",t.node),r.setAttribute(n,"name",t.name),e.xml.appendChild(n)})}}}}),r.extend(o,n.DiscoInfo),r.extend(o,n.DiscoItems),r.extend(n.DiscoItems,a),r.extend(n.DiscoInfo,s,"extensions")},{"../jid":3,"./dataforms":29,"./iq":34,"./rsm":43,jxt:76,underscore:95}],32:[function(t,e){t("underscore");var n=t("jxt"),r=t("./util"),i=t("./message"),o=t("./presence"),a=t("./iq"),s="urn:ietf:params:xml:ns:xmpp-stanzas",u=["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"],c=e.exports=n.define({name:"error",namespace:"jabber:client",element:"error",fields:{lang:{get:function(){return(this.parent||{}).lang||""}},condition:{get:function(){var t=this,e=[];return u.forEach(function(r){var i=n.find(t.xml,s,r);i.length&&e.push(i[0].tagName)}),e[0]||""},set:function(t){var e=this;if(u.forEach(function(t){var r=n.find(e.xml,s,t);r.length&&e.xml.removeChild(r[0])}),t){var r=document.createElementNS(s,t);r.setAttribute("xmlns",s),this.xml.appendChild(r)}}},gone:{get:function(){return n.getSubText(this.xml,s,"gone")},set:function(t){this.condition="gone",n.setSubText(this.xml,s,"gone",t)}},redirect:{get:function(){return n.getSubText(this.xml,s,"redirect")},set:function(t){this.condition="redirect",n.setSubText(this.xml,s,"redirect",t)}},code:n.attribute("code"),type:n.attribute("type"),by:r.jidAttribute("by"),$text:{get:function(){return n.getSubLangText(this.xml,s,"text",this.lang)}},text:{get:function(){var t=this.$text;return t[this.lang]||""},set:function(t){n.setSubLangText(this.xml,s,"text",t,this.lang)}}}});n.extend(i,c),n.extend(o,c),n.extend(a,c)},{"./iq":34,"./message":36,"./presence":38,"./util":51,jxt:76,underscore:95}],33:[function(t,e){var n=t("jxt"),r=t("./message"),i=t("./presence"),o=t("./iq"),a=t("./delayed"),s=e.exports=n.define({name:"forwarded",eventName:"forward",namespace:"urn:xmpp:forward:0",element:"forwarded"});n.extend(r,s),n.extend(s,r),n.extend(s,i),n.extend(s,o),n.extend(s,a)},{"./delayed":30,"./iq":34,"./message":36,"./presence":38,jxt:76}],34:[function(t,e){var n=t("jxt"),r=t("./util"),i=e.exports=n.define({name:"iq",namespace:"jabber:client",element:"iq",topLevel:!0,fields:{lang:r.langAttribute(),id:n.attribute("id"),to:r.jidAttribute("to"),from:r.jidAttribute("from"),type:n.attribute("type")}});i.prototype.resultReply=function(t){return t.to=this.from,t.id=this.id,t.type="result",new i(t) -},i.prototype.errorReply=function(t){return t.to=this.from,t.id=this.id,t.type="error",new i(t)}},{"./util":51,jxt:76}],35:[function(t,e,n){var r=t("jxt"),i=t("./util"),o=t("./message"),a=t("./iq"),s=t("./forwarded"),u=t("./rsm"),c=t("../jid");n.MAMQuery=r.define({name:"mamQuery",namespace:"urn:xmpp:mam:tmp",element:"query",fields:{queryid:r.attribute("queryid"),start:i.dateSub("urn:xmpp:mam:tmp","start"),end:i.dateSub("urn:xmpp:mam:tmp","end"),"with":i.jidSub("urn:xmpp:mam:tmp","with")}}),n.Result=r.define({name:"mam",eventName:"mam:result",namespace:"urn:xmpp:mam:tmp",element:"result",fields:{queryid:r.attribute("queryid"),id:r.attribute("id")}}),n.Archived=r.define({name:"mamArchived",namespace:"urn:xmpp:mam:tmp",element:"archived",fields:{by:i.jidAttribute("by"),id:r.attribute("id")}}),n.Prefs=r.define({name:"mamPrefs",namespace:"urn:xmpp:mam:tmp",element:"prefs",fields:{defaultCondition:r.attribute("default"),always:{get:function(){var t=[],e=r.find(this.xml,this._NS,"always");if(0===e.length)return t;e=e[0];var n=r.getMultiSubText(e,this._NS,"jid");return n.forEach(function(e){t.push(new c(e.textContent))}),t},set:function(t){if(t.length>0){var e=r.find(this.xml,this._NS,"always");r.setMultiSubText(e,this._NS,"jid",t)}}},never:{get:function(){var t=[],e=r.find(this.xml,this._NS,"always");if(0===e.length)return t;e=e[0];var n=r.getMultiSubText(e,this._NS,"jid");return n.forEach(function(e){t.push(new c(e.textContent))}),t},set:function(t){if(t.length>0){var e=r.find(this.xml,this._NS,"never");r.setMultiSubText(e,this._NS,"jid",t)}}}}}),r.extend(o,n.Archived,"archived"),r.extend(a,n.MAMQuery),r.extend(a,n.Prefs),r.extend(o,n.Result),r.extend(n.Result,s),r.extend(n.MAMQuery,u)},{"../jid":3,"./forwarded":33,"./iq":34,"./message":36,"./rsm":43,"./util":51,jxt:76}],36:[function(t,e){t("underscore");var n=t("jxt"),r=t("./util");e.exports=n.define({name:"message",namespace:"jabber:client",element:"message",topLevel:!0,fields:{lang:r.langAttribute(),id:n.attribute("id"),to:r.jidAttribute("to"),from:r.jidAttribute("from"),type:n.attribute("type","normal"),thread:n.subText("jabber:client","thread"),parentThread:n.subAttribute("jabber:client","thread","parent"),$body:{get:function(){return n.getSubLangText(this.xml,this._NS,"body",this.lang)}},body:{get:function(){var t=this.$body;return t[this.lang]||""},set:function(t){n.setSubLangText(this.xml,this._NS,"body",t,this.lang)}},attention:n.boolSub("urn:xmpp:attention:0","attention"),replace:n.subAttribute("urn:xmpp:message-correct:0","replace","id")}})},{"./util":51,jxt:76,underscore:95}],37:[function(t,e,n){var r=t("jxt");t("./message");var i=t("./presence");t("./iq");var o="http://jabber.org/protocol/muc";n.MUCJoin=r.define({name:"joinMuc",namespace:o,element:"x",fields:{password:r.subText(o,"password"),history:{get:function(){var t={},e=r.find(this.xml,this._NS,"history");if(!e.length)return{};e=e[0];var n=e.getAttribute("maxchars")||"",i=e.getAttribute("maxstanas")||"",o=e.getAttribute("seconds")||"",a=e.getAttribute("since")||"";n&&(t.maxchars=parseInt(n,10)),i&&(t.maxstanzas=parseInt(i,10)),o&&(t.seconds=parseInt(o,10)),a&&(t.since=new Date(a))},set:function(t){var e=r.find(this.xml,this._NS,"history");if(e.length)for(var n=0;nt&&(t=-t,i="+"),e=t/60,r=t%60,i+=(10>e?"0":"")+e+":"+(10>r?"0":"")+r):i=t,n.setSubText(this.xml,this._NS,"tzo",i)}}}});n.extend(i,o)},{"./iq":34,"./util":51,jxt:76}],51:[function(t,e,n){var r=t("jxt"),i=t("../jid"),o="http://www.w3.org/XML/1998/namespace";n.langAttribute=r.field(function(t){return t.getAttributeNS(o,"lang")||""},function(t,e){t.setAttributeNS(o,"lang",e)}),n.jidAttribute=r.field(function(t,e){return new i(r.getAttribute(t,e))},function(t,e,n){r.setAttribute(t,e,(n||"").toString())}),n.jidSub=r.field(function(t,e,n){return new i(r.getSubText(t,e,n))},function(t,e,n,i){r.setSubText(t,e,n,(i||"").toString())}),n.b64Text=r.field(function(t){return t.textContent&&"="!=t.textContent?atob(t.textContent):""},function(t,e){t.textContent=btoa(e)||"="}),n.dateAttribute=function(t,e){return{get:function(){var n=r.getAttribute(this.xml,t);return n?new Date(n):e?new Date(Date.now()):void 0},set:function(e){e&&r.setAttribute(this.xml,t,e.toISOString())}}},n.dateSub=function(t,e,n){return{get:function(){var i=r.getSubText(this.xml,t,e);return i?new Date(i):n?new Date(Date.now()):void 0},set:function(n){n&&r.setSubText(this.xml,t,e,n.toISOString())}}},n.dateSubAttribute=function(t,e,n,i){return{get:function(){var o=r.getSubAttribute(this.xml,t,e,n);return o?new Date(o):i?new Date(Date.now()):void 0},set:function(i){i&&r.setSubAttribute(this.xml,t,e,n,i.toISOString())}}},n.numberAttribute=r.field(function(t,e,n){return parseInt(r.getAttribute(t,e,n),10)},function(t,e,n){r.setAttribute(t,e,n.toString())}),n.numberSub=r.field(function(t,e,n,i){return parseInt(r.getSubText(t,e,n,i),10)},function(t,e,n,i){r.setSubText(t,e,n,i.toString())})},{"../jid":3,jxt:76}],52:[function(t,e){var n=t("jxt"),r=t("./iq"),i="jabber:iq:version",o=e.exports=n.define({name:"version",namespace:i,element:"query",fields:{name:n.subText(i,"name"),version:n.subText(i,"version"),os:n.subText(i,"os")}});n.extend(r,o)},{"./iq":34,jxt:76}],53:[function(t){var e=t("jxt"),n=t("./iq");e.add(n,"visible",e.boolSub("urn:xmpp:invisible:0","visible")),e.add(n,"invisible",e.boolSub("urn:xmpp:invisible:0","invisible"))},{"./iq":34,jxt:76}],54:[function(t,e){function n(){function t(t){var e=[n.streamStart,t,n.streamEnd].join("");return e}function e(t){for(var e=n.parser.parseFromString(t,"application/xml").childNodes,r=0;r'].join(" "))}),n.on("raw:incoming",function(i){var o,s;if(i=i.trim(),i=i.replace(/^(\s*<\?.*\?>\s*)*/,""),""!==i){if(i.match(n.streamEnd))return n.disconnect();if(n.hasStream)try{o=new a({},e(t(i)))}catch(u){return n.disconnect()}else{var c=i.match(/^<(\S+:)?(\S+) /);n.streamStart=i,n.streamEnd="",s=!1;try{o=new a({},e(i+n.streamEnd))}catch(u){try{o=new a({},e(i)),s=!0}catch(f){return n.disconnect()}}n.hasStream=!0,n.stream=o,n.emit("stream:start",o)}r.each(o._extensions,function(t){t.lang||(t.lang=n.stream.lang),("message"===t._name||"presence"===t._name||"iq"===t._name)&&(n.sm.handle(t),n.emit("stanza",t)),n.emit(t._eventname||t._name,t),n.emit("stream:data",t),t.id&&n.emit("id:"+t.id,t)}),s&&n.emit("stream:end")}})}var r=t("underscore"),i=t("wildemitter"),o=t("async"),a=t("./stanza/stream");t("./stanza/message"),t("./stanza/presence"),t("./stanza/iq");var s=t("./sm");t("node-uuid"),n.prototype=Object.create(i.prototype,{constructor:{value:n}}),n.prototype.connect=function(t){var e=this;e.config=t,e.hasStream=!1,e.streamStart='',e.streamEnd="",e.parser=new DOMParser,e.serializer=new XMLSerializer,e.conn=new WebSocket(t.wsURL,"xmpp"),e.conn.onerror=function(t){return t.preventDefault(),e.emit("disconnected",e),!1},e.conn.onclose=function(){e.emit("disconnected",e)},e.conn.onopen=function(){e.sm.started=!1,e.emit("connected",e)},e.conn.onmessage=function(t){e.emit("raw:incoming",t.data)}},n.prototype.disconnect=function(){this.conn&&(this.hasStream&&(this.conn.send(""),this.emit("raw:outgoing",""),this.emit("stream:end")),this.hasStream=!1,this.conn.close(),this.stream=void 0,this.conn=void 0,this.sm.failed())},n.prototype.restart=function(){var t=this;t.hasStream=!1,t.send(["'].join(" "))},n.prototype.send=function(t){this.sendQueue.push(t)},e.exports=n},{"./sm":22,"./stanza/iq":34,"./stanza/message":36,"./stanza/presence":38,"./stanza/stream":47,async:55,"node-uuid":81,underscore:95,wildemitter:96}],55:[function(e,n){var r=e("__browserify_process");!function(){function e(t){var e=!1;return function(){if(e)throw new Error("Callback was already called.");e=!0,t.apply(i,arguments)}}var i,o,a={};i=this,null!=i&&(o=i.async),a.noConflict=function(){return i.async=o,a};var s=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;n=t.length&&r(null))}))})},a.forEach=a.each,a.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,i=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n(null):i())})};i()},a.forEachSeries=a.eachSeries,a.eachLimit=function(t,e,n,r){var i=l(e);i.apply(null,[t,n,r])},a.forEachLimit=a.eachLimit;var l=function(t){return function(e,n,r){if(r=r||function(){},!e.length||0>=t)return r();var i=0,o=0,a=0;!function s(){if(i>=e.length)return r();for(;t>a&&o=e.length?r():s())})}()}},p=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[a.each].concat(e))}},h=function(t,e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[l(t)].concat(n))}},d=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[a.eachSeries].concat(e))}},m=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n,r){i[t.index]=r,e(n)})},function(t){r(t,i)})};a.map=p(m),a.mapSeries=d(m),a.mapLimit=function(t,e,n,r){return g(e)(t,n,r)};var g=function(t){return h(t,m)};a.reduce=function(t,e,n,r){a.eachSeries(t,function(t,r){n(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(t,e,n,r){var i=u(t,function(t){return t}).reverse();a.reduce(i,e,n,r)},a.foldr=a.reduceRight;var v=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n&&i.push(t),e()})},function(){r(u(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};a.filter=p(v),a.filterSeries=d(v),a.select=a.filter,a.selectSeries=a.filterSeries;var y=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n||i.push(t),e()})},function(){r(u(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};a.reject=p(y),a.rejectSeries=d(y);var b=function(t,e,n,r){t(e,function(t,e){n(t,function(n){n?(r(t),r=function(){}):e()})},function(){r()})};a.detect=p(b),a.detectSeries=d(b),a.some=function(t,e,n){a.each(t,function(t,r){e(t,function(t){t&&(n(!0),n=function(){}),r()})},function(){n(!1)})},a.any=a.some,a.every=function(t,e,n){a.each(t,function(t,r){e(t,function(t){t||(n(!1),n=function(){}),r()})},function(){n(!0)})},a.all=a.every,a.sortBy=function(t,e,n){a.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);var r=function(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0};n(null,u(e.sort(r),function(t){return t.value}))})},a.auto=function(t,e){e=e||function(){};var n=f(t);if(!n.length)return e(null);var r={},i=[],o=function(t){i.unshift(t)},u=function(t){for(var e=0;ee;e++)t[e].apply(null,arguments)}])))};return i.memo=n,i.unmemoized=t,i},a.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},a.times=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return a.map(r,e,n)},a.timesSeries=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return a.mapSeries(r,e,n)},a.compose=function(){var t=Array.prototype.reverse.call(arguments);return function(){var e=this,n=Array.prototype.slice.call(arguments),r=n.pop();a.reduce(t,n,function(t,n,r){n.apply(e,t.concat([function(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);r(t,e)}]))},function(t,n){r.apply(e,[t].concat(n))})}};var E=function(t,e){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),i=r.pop();return t(e,function(t,e){t.apply(n,r.concat([e]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return n.apply(this,r)}return n};a.applyEach=p(E),a.applyEachSeries=d(E),a.forever=function(t,e){function n(r){if(r){if(e)return e(r);throw r}t(n)}n()},"undefined"!=typeof t&&t.amd?t([],function(){return a}):"undefined"!=typeof n&&n.exports?n.exports=a:i.async=a}()},{__browserify_process:68}],56:[function(t,e){function n(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}function r(t,e){return void 0===e?""+e:"number"!=typeof e||!isNaN(e)&&isFinite(e)?"function"==typeof e||e instanceof RegExp?e.toString():e:e.toString()}function i(t,e){return"string"==typeof t?t.length=0;i--)if(o[i]!=a[i])return!1;for(i=o.length-1;i>=0;i--)if(r=o[i],!s(t[r],e[r]))return!1;return!0}function l(t,e){return t&&e?e instanceof RegExp?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function p(t,e,n,r){var i;"string"==typeof n&&(r=n,n=null);try{e()}catch(a){i=a}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&o("Missing expected exception"+r),!t&&l(i,n)&&o("Got unwanted exception"+r),t&&i&&n&&!l(i,n)||!t&&i)throw i}var h=t("util"),d=t("buffer").Buffer,m=Array.prototype.slice,g=e.exports=a;g.AssertionError=function(t){this.name="AssertionError",this.message=t.message,this.actual=t.actual,this.expected=t.expected,this.operator=t.operator;var e=t.stackStartFunction||o;Error.captureStackTrace&&Error.captureStackTrace(this,e)},h.inherits(g.AssertionError,Error),g.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",i(JSON.stringify(this.actual,r),128),this.operator,i(JSON.stringify(this.expected,r),128)].join(" ")},g.fail=o,g.ok=a,g.equal=function(t,e,n){t!=e&&o(t,e,n,"==",g.equal)},g.notEqual=function(t,e,n){t==e&&o(t,e,n,"!=",g.notEqual)},g.deepEqual=function(t,e,n){s(t,e)||o(t,e,n,"deepEqual",g.deepEqual)},g.notDeepEqual=function(t,e,n){s(t,e)&&o(t,e,n,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(t,e,n){t!==e&&o(t,e,n,"===",g.strictEqual)},g.notStrictEqual=function(t,e,n){t===e&&o(t,e,n,"!==",g.notStrictEqual)},g.throws=function(){p.apply(this,[!0].concat(m.call(arguments)))},g.doesNotThrow=function(){p.apply(this,[!1].concat(m.call(arguments)))},g.ifError=function(t){if(t)throw t}},{buffer:60,util:58}],57:[function(t,e,n){function r(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;ni;i++)r[i].apply(this,n);return!0}return!1},o.prototype.addListener=function(t,e){if("function"!=typeof e)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",t,e),this._events[t])if(a(this._events[t])){if(!this._events[t].warned){var n;n=void 0!==this._events.maxListeners?this._events.maxListeners:s,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),console.trace())}this._events[t].push(e)}else this._events[t]=[this._events[t],e];else this._events[t]=e;return this},o.prototype.on=o.prototype.addListener,o.prototype.once=function(t,e){var n=this;return n.on(t,function r(){n.removeListener(t,r),e.apply(this,arguments)}),this},o.prototype.removeListener=function(t,e){if("function"!=typeof e)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var n=this._events[t];if(a(n)){var i=r(n,e);if(0>i)return this;n.splice(i,1),0==n.length&&delete this._events[t]}else this._events[t]===e&&delete this._events[t];return this},o.prototype.removeAllListeners=function(t){return 0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},o.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),a(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]},o.listenerCount=function(t,e){var n;return n=t._events&&t._events[e]?"function"==typeof t._events[e]?1:t._events[e].length:0}},{__browserify_process:68}],58:[function(t,e,n){function r(t){return Array.isArray(t)||"object"==typeof t&&"[object Array]"===Object.prototype.toString.call(t)}function i(t){"object"==typeof t&&"[object RegExp]"===Object.prototype.toString.call(t)}function o(t){return"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)}t("events"),n.isArray=r,n.isDate=function(t){return"[object Date]"===Object.prototype.toString.call(t)},n.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},n.print=function(){},n.puts=function(){},n.debug=function(){},n.inspect=function(t,e,u,c){function f(t,u){if(t&&"function"==typeof t.inspect&&t!==n&&(!t.constructor||t.constructor.prototype!==t))return t.inspect(u);switch(typeof t){case"undefined":return p("undefined","undefined");case"string":var c="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return p(c,"string");case"number":return p(""+t,"number");case"boolean":return p(""+t,"boolean")}if(null===t)return p("null","null");var h=a(t),d=e?s(t):h;if("function"==typeof t&&0===d.length){if(i(t))return p(""+t,"regexp");var m=t.name?": "+t.name:"";return p("[Function"+m+"]","special")}if(o(t)&&0===d.length)return p(t.toUTCString(),"date");var g,v,y;if(r(t)?(v="Array",y=["[","]"]):(v="Object",y=["{","}"]),"function"==typeof t){var b=t.name?": "+t.name:"";g=i(t)?" "+t:" [Function"+b+"]"}else g="";if(o(t)&&(g=" "+t.toUTCString()),0===d.length)return y[0]+g+y[1];if(0>u)return i(t)?p(""+t,"regexp"):p("[Object]","special");l.push(t);var x=d.map(function(e){var n,i;if(t.__lookupGetter__&&(t.__lookupGetter__(e)?i=t.__lookupSetter__(e)?p("[Getter/Setter]","special"):p("[Getter]","special"):t.__lookupSetter__(e)&&(i=p("[Setter]","special"))),h.indexOf(e)<0&&(n="["+e+"]"),i||(l.indexOf(t[e])<0?(i=null===u?f(t[e]):f(t[e],u-1),i.indexOf("\n")>-1&&(i=r(t)?i.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+i.split("\n").map(function(t){return" "+t}).join("\n"))):i=p("[Circular]","special")),"undefined"==typeof n){if("Array"===v&&e.match(/^\d+$/))return i;n=JSON.stringify(""+e),n.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(n=n.substr(1,n.length-2),n=p(n,"name")):(n=n.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),n=p(n,"string"))}return n+": "+i});l.pop();var w=0,_=x.reduce(function(t,e){return w++,e.indexOf("\n")>=0&&w++,t+e.length+1},0);return x=_>50?y[0]+(""===g?"":g+"\n ")+" "+x.join(",\n ")+" "+y[1]:y[0]+g+" "+x.join(", ")+" "+y[1]}var l=[],p=function(t,e){var n={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]},r={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[e];return r?"["+n[r][0]+"m"+t+"["+n[r][1]+"m":t};return c||(p=function(t){return t}),f(t,"undefined"==typeof u?2:u)},n.log=function(){},n.pump=null;var a=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e},s=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.hasOwnProperty.call(t,n)&&e.push(n);return e},u=Object.create||function(t,e){var n;if(null===t)n={__proto__:null};else{if("object"!=typeof t)throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var r=function(){};r.prototype=t,n=new r,n.__proto__=t}return"undefined"!=typeof e&&Object.defineProperties&&Object.defineProperties(n,e),n};n.inherits=function(t,e){t.super_=e,t.prototype=u(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})};var c=/%[sdj%]/g;n.format=function(t){if("string"!=typeof t){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":return JSON.stringify(i[r++]);default:return t}}),s=i[r];o>r;s=i[++r])a+=null===s||"object"!=typeof s?" "+s:" "+n.inspect(s);return a}},{events:57}],59:[function(t,e,n){n.readIEEE754=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,f=-7,l=n?0:i-1,p=n?1:-1,h=t[e+l];for(l+=p,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+t[e+l],l+=p,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===o)o=1-c;else{if(o===u)return a?0/0:1/0*(h?-1:1);a+=Math.pow(2,r),o-=c}return(h?-1:1)*a*Math.pow(2,o-r)},n.writeIEEE754=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?o-1:0,d=r?-1:1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+l>=1?p/u:p*Math.pow(2,1-l),e*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=d,s/=256,i-=8);for(a=a<0;t[n+h]=255&a,h+=d,a/=256,c-=8);t[n+h-d]|=128*m}},{}],60:[function(t,e,n){function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);this.parent=this,this.offset=0;var o;if("number"==typeof n)this.length=i(e),this.offset=n;else{switch(o=typeof t){case"number":this.length=i(t);break;case"string":this.length=r.byteLength(t,e);break;case"object":this.length=i(t.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(a(t))for(var s=0;st?0:t}function o(t){return(Array.isArray||function(t){return"[object Array]"=={}.toString.apply(t)})(t)}function a(t){return o(t)||r.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function s(t){return 16>t?"0"+t.toString(16):t.toString(16)}function u(t){for(var e=[],n=0;ni&&!(i+n>=e.length||i>=t.length);)e[i+n]=t[i],i++;return i}function p(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function h(t,e,n,r){var i=0;return r||(I.ok("boolean"==typeof n,"missing or invalid endian"),I.ok(void 0!==e&&null!==e,"missing offset"),I.ok(e+1=t.length?0:(n?(i=t[e]<<8,e+1=t.length?0:(n?(e+1>>0):(e+2>>0)),i)}function m(t,e,n,r){var i,o;return r||(I.ok("boolean"==typeof n,"missing or invalid endian"),I.ok(void 0!==e&&null!==e,"missing offset"),I.ok(e+1=0,"specified a negative value for writing an unsigned value"),I.ok(e>=t,"value is larger than maximum value for type"),I.ok(Math.floor(t)===t,"value has a fractional component")}function x(t,e,n,r,i){i||(I.ok(void 0!==e&&null!==e,"missing value"),I.ok("boolean"==typeof r,"missing or invalid endian"),I.ok(void 0!==n&&null!==n,"missing offset"),I.ok(n+1>>8*(r?1-o:o)}function w(t,e,n,r,i){i||(I.ok(void 0!==e&&null!==e,"missing value"),I.ok("boolean"==typeof r,"missing or invalid endian"),I.ok(void 0!==n&&null!==n,"missing offset"),I.ok(n+3>>8*(r?3-o:o)}function _(t,e,n){I.ok("number"==typeof t,"cannot write a non-number as a number"),I.ok(e>=t,"value larger than maximum allowed value"),I.ok(t>=n,"value smaller than minimum allowed value"),I.ok(Math.floor(t)===t,"value has a fractional component")}function E(t,e,n){I.ok("number"==typeof t,"cannot write a non-number as a number"),I.ok(e>=t,"value larger than maximum allowed value"),I.ok(t>=n,"value smaller than minimum allowed value")}function S(t,e,n,r,i){i||(I.ok(void 0!==e&&null!==e,"missing value"),I.ok("boolean"==typeof r,"missing or invalid endian"),I.ok(void 0!==n&&null!==n,"missing offset"),I.ok(n+1=0?x(t,e,n,r,i):x(t,65535+e+1,n,r,i)}function j(t,e,n,r,i){i||(I.ok(void 0!==e&&null!==e,"missing value"),I.ok("boolean"==typeof r,"missing or invalid endian"),I.ok(void 0!==n&&null!==n,"missing offset"),I.ok(n+3=0?w(t,e,n,r,i):w(t,4294967295+e+1,n,r,i)}function k(e,n,r,i,o){o||(I.ok(void 0!==n&&null!==n,"missing value"),I.ok("boolean"==typeof i,"missing or invalid endian"),I.ok(void 0!==r&&null!==r,"missing offset"),I.ok(r+3t||t>=this.length)throw new Error("oob");return this[t]},r.prototype.set=function(t,e){if(0>t||t>=this.length)throw new Error("oob");return this[t]=e},r.byteLength=function(t,e){switch(e||"utf8"){case"hex":return t.length/2;case"utf8":case"utf-8":return u(t).length;case"ascii":case"binary":return t.length;case"base64":return f(t).length;default:throw new Error("Unknown encoding")}},r.prototype.utf8Write=function(t,e,n){return r._charsWritten=l(u(t),this,e,n)},r.prototype.asciiWrite=function(t,e,n){return r._charsWritten=l(c(t),this,e,n)},r.prototype.binaryWrite=r.prototype.asciiWrite,r.prototype.base64Write=function(t,e,n){return r._charsWritten=l(f(t),this,e,n)},r.prototype.base64Slice=function(){var e=Array.prototype.slice.apply(this,arguments);return t("base64-js").fromByteArray(e)},r.prototype.utf8Slice=function(){for(var t=Array.prototype.slice.apply(this,arguments),e="",n="",r=0;rr;r++)if(t[r]=s(this[r]),r==n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},r.prototype.hexSlice=function(t,e){var n=this.length;(!t||0>t)&&(t=0),(!e||0>e||e>n)&&(e=n);for(var r="",i=t;e>i;i++)r+=s(this[i]);return r},r.prototype.toString=function(t,e,n){if(t=String(t||"utf8").toLowerCase(),e=+e||0,"undefined"==typeof n&&(n=this.length),+n==e)return"";switch(t){case"hex":return this.hexSlice(e,n);case"utf8":case"utf-8":return this.utf8Slice(e,n);case"ascii":return this.asciiSlice(e,n);case"binary":return this.binarySlice(e,n);case"base64":return this.base64Slice(e,n);case"ucs2":case"ucs-2":return this.ucs2Slice(e,n);default:throw new Error("Unknown encoding")}},r.prototype.hexWrite=function(t,e,n){e=+e||0;var i=this.length-e;n?(n=+n,n>i&&(n=i)):n=i;var o=t.length;if(o%2)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");this[e+a]=s}return r._charsWritten=2*a,a},r.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var i=r;r=e,e=n,n=i}e=+e||0;var o=this.length-e;switch(n?(n=+n,n>o&&(n=o)):n=o,r=String(r||"utf8").toLowerCase()){case"hex":return this.hexWrite(t,e,n);case"utf8":case"utf-8":return this.utf8Write(t,e,n);case"ascii":return this.asciiWrite(t,e,n);case"binary":return this.binaryWrite(t,e,n);case"base64":return this.base64Write(t,e,n);case"ucs2":case"ucs-2":return this.ucs2Write(t,e,n);default:throw new Error("Unknown encoding")}},r.prototype.slice=function(t,e){if(void 0===e&&(e=this.length),e>this.length)throw new Error("oob");if(t>e)throw new Error("oob");return new r(this,e-t,+t)},r.prototype.copy=function(t,e,n,r){var i=this;if(n||(n=0),(void 0===r||isNaN(r))&&(r=this.length),e||(e=0),n>r)throw new Error("sourceEnd < sourceStart");if(r===n)return 0;if(0==t.length||0==i.length)return 0;if(0>e||e>=t.length)throw new Error("targetStart out of bounds");if(0>n||n>=i.length)throw new Error("sourceStart out of bounds");if(0>r||r>i.length)throw new Error("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-ea;a++)I.ok("undefined"!=typeof this[a],"copying undefined buffer bytes!"),o.push(this[a]);for(var a=e;an)throw new Error("end < start");if(n===e)return 0;if(0==this.length)return 0;if(0>e||e>=this.length)throw new Error("start out of bounds");if(0>n||n>this.length)throw new Error("end out of bounds");for(var r=e;n>r;r++)this[r]=t},r.isBuffer=function(t){return t instanceof r||t instanceof r},r.concat=function(t,e){if(!o(t))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===t.length)return new r(0);if(1===t.length)return t[0];if("number"!=typeof e){e=0;for(var n=0;n=n.length?void 0:n[t]},r.prototype.readUInt16LE=function(t,e){return h(this,t,!1,e)},r.prototype.readUInt16BE=function(t,e){return h(this,t,!0,e)},r.prototype.readUInt32LE=function(t,e){return d(this,t,!1,e)},r.prototype.readUInt32BE=function(t,e){return d(this,t,!0,e)},r.prototype.readInt8=function(t,e){var n,r=this;return e||(I.ok(void 0!==t&&null!==t,"missing offset"),I.ok(t=r.length?void 0:(n=128&r[t],n?-1*(255-r[t]+1):r[t])},r.prototype.readInt16LE=function(t,e){return m(this,t,!1,e)},r.prototype.readInt16BE=function(t,e){return m(this,t,!0,e)},r.prototype.readInt32LE=function(t,e){return g(this,t,!1,e)},r.prototype.readInt32BE=function(t,e){return g(this,t,!0,e)},r.prototype.readFloatLE=function(t,e){return v(this,t,!1,e)},r.prototype.readFloatBE=function(t,e){return v(this,t,!0,e)},r.prototype.readDoubleLE=function(t,e){return y(this,t,!1,e)},r.prototype.readDoubleBE=function(t,e){return y(this,t,!0,e)},r.prototype.writeUInt8=function(t,e,n){var r=this;n||(I.ok(void 0!==t&&null!==t,"missing value"),I.ok(void 0!==e&&null!==e,"missing offset"),I.ok(e=0?r.writeUInt8(t,e,n):r.writeUInt8(255+t+1,e,n)},r.prototype.writeInt16LE=function(t,e,n){S(this,t,e,!1,n)},r.prototype.writeInt16BE=function(t,e,n){S(this,t,e,!0,n)},r.prototype.writeInt32LE=function(t,e,n){j(this,t,e,!1,n)},r.prototype.writeInt32BE=function(t,e,n){j(this,t,e,!0,n)},r.prototype.writeFloatLE=function(t,e,n){k(this,t,e,!1,n)},r.prototype.writeFloatBE=function(t,e,n){k(this,t,e,!0,n)},r.prototype.writeDoubleLE=function(t,e,n){A(this,t,e,!1,n)},r.prototype.writeDoubleBE=function(t,e,n){A(this,t,e,!0,n)}},{"./buffer_ieee754":59,assert:56,"base64-js":61}],61:[function(t,e){!function(){"use strict";function t(t){var e,n,i,o,a,s;if(t.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(a=t.indexOf("="),a=a>0?t.length-a:0,s=[],i=a>0?t.length-4:t.length,e=0,n=0;i>e;e+=4,n+=3)o=r.indexOf(t[e])<<18|r.indexOf(t[e+1])<<12|r.indexOf(t[e+2])<<6|r.indexOf(t[e+3]),s.push((16711680&o)>>16),s.push((65280&o)>>8),s.push(255&o);return 2===a?(o=r.indexOf(t[e])<<2|r.indexOf(t[e+1])>>4,s.push(255&o)):1===a&&(o=r.indexOf(t[e])<<10|r.indexOf(t[e+1])<<4|r.indexOf(t[e+2])>>2,s.push(255&o>>8),s.push(255&o)),s}function n(t){function e(t){return r[63&t>>18]+r[63&t>>12]+r[63&t>>6]+r[63&t]}var n,i,o,a=t.length%3,s="";for(n=0,o=t.length-a;o>n;n+=3)i=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s+=e(i);switch(a){case 1:i=t[t.length-1],s+=r[i>>2],s+=r[63&i<<4],s+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],s+=r[i>>10],s+=r[63&i>>4],s+=r[63&i<<2],s+="="}return s}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports.toByteArray=t,e.exports.fromByteArray=n}()},{}],62:[function(t,e,n){function r(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function i(t,e){for(var n in t)e(t[n],n)}var o=t("buffer").Buffer,a=t("./sha"),s=t("./sha256"),u=t("./rng"),c=t("./md5"),f={sha1:{hex:a.hex_sha1,base64:a.b64_sha1,binary:a.str_sha1},sha256:{hex:s.hex_sha256,base64:s.b64_sha256,binary:s.str_sha256},md5:{hex:c.hex_md5,base64:c.b64_md5,binary:c.bin_md5}},l={sha1:{hex:a.hex_hmac_sha1,base64:a.b64_hmac_sha1,binary:a.str_hmac_sha1},sha256:{hex:s.hex_hmac_sha256,base64:s.b64_hmac_sha256,binary:s.str_hmac_sha256},md5:{hex:c.hex_hmac_md5,base64:c.b64_hmac_md5,binary:c.bin_hmac_md5}};n.createHash=function(t){t=t||"sha1",f[t]||r("algorithm:",t,"is not yet supported");var e="",n=f[t];return{update:function(t){return e+=t,this},digest:function(i){i=i||"binary";var o;(o=n[i])||r("encoding:",i,"is not yet supported for algorithm",t);var a=o(e);return e=null,a}}},n.createHmac=function(t,e){l[t]||r("algorithm:",t,"is not yet supported"),"string"!=typeof e&&(e=e.toString("binary"));var n="",i=l[t];return{update:function(t){return n+=t,this},digest:function(o){o=o||"binary";var a;(a=i[o])||r("encoding:",o,"is not yet support for algorithm",t);var s=a(e,n);return n=null,s}}},n.randomBytes=function(t,e){if(!e||!e.call)return new o(u(t));try{e.call(this,void 0,new o(u(t)))}catch(n){e(n)}},i(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(t){n[t]=function(){r("sorry,",t,"is not implemented yet")}})},{"./md5":63,"./rng":64,"./sha":65,"./sha256":66,buffer:60}],63:[function(t,e,n){function r(t){return x(c(y(t),t.length*S))}function i(t){return w(c(y(t),t.length*S))}function o(t){return b(c(y(t),t.length*S))}function a(t,e){return x(m(t,e))}function s(t,e){return w(m(t,e))}function u(t,e){return b(m(t,e))}function c(t,e){t[e>>5]|=128<>>9<<4)+14]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a16&&(n=c(n,t.length*S));for(var r=Array(16),i=Array(16),o=0;16>o;o++)r[o]=909522486^n[o],i[o]=1549556828^n[o];var a=c(r.concat(y(e)),512+e.length*S);return c(i.concat(a),640)}function g(t,e){var n=(65535&t)+(65535&e),r=(t>>16)+(e>>16)+(n>>16);return r<<16|65535&n}function v(t,e){return t<>>32-e}function y(t){for(var e=Array(),n=(1<>5]|=(t.charCodeAt(r/S)&n)<>5]>>>r%32&n);return e}function x(t){for(var e=_?"0123456789ABCDEF":"0123456789abcdef",n="",r=0;r<4*t.length;r++)n+=e.charAt(15&t[r>>2]>>8*(r%4)+4)+e.charAt(15&t[r>>2]>>8*(r%4));return n}function w(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",r=0;r<4*t.length;r+=3)for(var i=(255&t[r>>2]>>8*(r%4))<<16|(255&t[r+1>>2]>>8*((r+1)%4))<<8|255&t[r+2>>2]>>8*((r+2)%4),o=0;4>o;o++)n+=8*r+6*o>32*t.length?E:e.charAt(63&i>>6*(3-o));return n}var _=0,E="=",S=8;n.hex_md5=r,n.b64_md5=i,n.bin_md5=o,n.hex_hmac_md5=a,n.b64_hmac_md5=s,n.bin_hmac_md5=u},{}],64:[function(t,e){!function(){var t,n,r=this;if(t=function(t){for(var e,e,n=new Array(t),r=0;t>r;r++)0==(3&r)&&(e=4294967296*Math.random()),n[r]=255&e>>>((3&r)<<3);return n},r.crypto&&crypto.getRandomValues){var i=new Uint32Array(4);n=function(t){var e=new Array(t);crypto.getRandomValues(i);for(var n=0;t>n;n++)e[n]=255&i[n>>2]>>>8*(3&n);return e}}e.exports=n||t}()},{}],65:[function(t,e,n){function r(t){return v(c(m(t),t.length*w))}function i(t){return y(c(m(t),t.length*w))}function o(t){return g(c(m(t),t.length*w))}function a(t,e){return v(p(t,e))}function s(t,e){return y(p(t,e))}function u(t,e){return g(p(t,e))}function c(t,e){t[e>>5]|=128<<24-e%32,t[(e+64>>9<<4)+15]=e;for(var n=Array(80),r=1732584193,i=-271733879,o=-1732584194,a=271733878,s=-1009589776,u=0;uy;y++){n[y]=16>y?t[u+y]:d(n[y-3]^n[y-8]^n[y-14]^n[y-16],1);var b=h(h(d(r,5),f(y,i,o,a)),h(h(s,n[y]),l(y)));s=a,a=o,o=d(i,30),i=r,r=b}r=h(r,c),i=h(i,p),o=h(o,m),a=h(a,g),s=h(s,v)}return Array(r,i,o,a,s)}function f(t,e,n,r){return 20>t?e&n|~e&r:40>t?e^n^r:60>t?e&n|e&r|n&r:e^n^r}function l(t){return 20>t?1518500249:40>t?1859775393:60>t?-1894007588:-899497514}function p(t,e){var n=m(t);n.length>16&&(n=c(n,t.length*w));for(var r=Array(16),i=Array(16),o=0;16>o;o++)r[o]=909522486^n[o],i[o]=1549556828^n[o];var a=c(r.concat(m(e)),512+e.length*w);return c(i.concat(a),672)}function h(t,e){var n=(65535&t)+(65535&e),r=(t>>16)+(e>>16)+(n>>16);return r<<16|65535&n}function d(t,e){return t<>>32-e}function m(t){for(var e=Array(),n=(1<>5]|=(t.charCodeAt(r/w)&n)<<32-w-r%32;return e}function g(t){for(var e="",n=(1<>5]>>>32-w-r%32&n);return e}function v(t){for(var e=b?"0123456789ABCDEF":"0123456789abcdef",n="",r=0;r<4*t.length;r++)n+=e.charAt(15&t[r>>2]>>8*(3-r%4)+4)+e.charAt(15&t[r>>2]>>8*(3-r%4));return n}function y(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",r=0;r<4*t.length;r+=3)for(var i=(255&t[r>>2]>>8*(3-r%4))<<16|(255&t[r+1>>2]>>8*(3-(r+1)%4))<<8|255&t[r+2>>2]>>8*(3-(r+2)%4),o=0;4>o;o++)n+=8*r+6*o>32*t.length?x:e.charAt(63&i>>6*(3-o));return n}n.hex_sha1=r,n.b64_sha1=i,n.str_sha1=o,n.hex_hmac_sha1=a,n.b64_hmac_sha1=s,n.str_hmac_sha1=u;var b=0,x="=",w=8},{}],66:[function(t,e,n){function r(t){return E(w(_(t),t.length*l))}function i(t){return S(w(_(t),t.length*l))}function o(t){return c(w(_(t),t.length*l))}function a(t,e){return E(j(t,e))}function s(t,e){return S(j(t,e))}function u(t,e){return c(j(t,e))}function c(t){for(var e="",n=(1<>5]>>>32-l-r%32&n);return e}n.hex_sha256=r,n.b64_sha256=i,n.str_sha256=o,n.hex_hmac_sha256=a,n.b64_hmac_sha256=s,n.str_hmac_sha256=u;var f=0,l=8,p=function(t,e){var n=(65535&t)+(65535&e),r=(t>>16)+(e>>16)+(n>>16);return r<<16|65535&n},h=function(t,e){return t>>>e|t<<32-e},d=function(t,e){return t>>>e -},m=function(t,e,n){return t&e^~t&n},g=function(t,e,n){return t&e^t&n^e&n},v=function(t){return h(t,2)^h(t,13)^h(t,22)},y=function(t){return h(t,6)^h(t,11)^h(t,25)},b=function(t){return h(t,7)^h(t,18)^d(t,3)},x=function(t){return h(t,17)^h(t,19)^d(t,10)},w=function(t,e){var n,r,i,o,a,s,u,c,f,l,h,d,w=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),_=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),E=new Array(64);t[e>>5]|=128<<24-e%32,t[(e+64>>9<<4)+15]=e;for(var f=0;fl;l++)E[l]=16>l?t[l+f]:p(p(p(x(E[l-2]),E[l-7]),b(E[l-15])),E[l-16]),h=p(p(p(p(c,y(a)),m(a,s,u)),w[l]),E[l]),d=p(v(n),g(n,r,i)),c=u,u=s,s=a,a=p(o,h),o=i,i=r,r=n,n=p(h,d);_[0]=p(n,_[0]),_[1]=p(r,_[1]),_[2]=p(i,_[2]),_[3]=p(o,_[3]),_[4]=p(a,_[4]),_[5]=p(s,_[5]),_[6]=p(u,_[6]),_[7]=p(c,_[7])}return _},_=function(t){for(var e=Array(),n=(1<>5]|=(t.charCodeAt(r/l)&n)<<24-r%32;return e},E=function(t){for(var e=f?"0123456789ABCDEF":"0123456789abcdef",n="",r=0;r<4*t.length;r++)n+=e.charAt(15&t[r>>2]>>8*(3-r%4)+4)+e.charAt(15&t[r>>2]>>8*(3-r%4));return n},S=function(t){var e,n,r,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o="",a=4*t.length,s="=";for(e=0;a>e;e+=3)for(r=(255&t[e>>2]>>8*(3-e%4))<<16|(255&t[e+1>>2]>>8*(3-(e+1)%4))<<8|255&t[e+2>>2]>>8*(3-(e+2)%4),n=0;4>n;n+=1)o+=8*e+6*n<=32*t.length?i.charAt(63&r>>6*(3-n)):s;return o},j=function(t,e){var n=_(t);n.length>16&&(n=w(n,t.length*l));for(var r=Array(16),i=Array(16),o=0;16>o;o++)r[o]=909522486^n[o],i[o]=1549556828^n[o];var a=w(r.concat(_(e)),512+e.length*l);return w(i.concat(a),768)}},{}],67:[function(t,e){t=function(t,e,n,r){function i(r){if(!n[r]){if(!e[r]){if(t)return t(r);throw new Error("Cannot find module '"+r+"'")}var o=n[r]={exports:{}};e[r][0](function(t){var n=e[r][1][t];return i(n?n:t)},o,o.exports)}return n[r].exports}for(var o=0;o=0;i--)if(o[i]!=a[i])return!1;for(i=o.length-1;i>=0;i--)if(r=o[i],!s(t[r],e[r]))return!1;return!0}function l(t,e){return t&&e?e instanceof RegExp?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function p(t,e,n,r){var i;"string"==typeof n&&(r=n,n=null);try{e()}catch(a){i=a}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&o("Missing expected exception"+r),!t&&l(i,n)&&o("Got unwanted exception"+r),t&&i&&n&&!l(i,n)||!t&&i)throw i}var h=t("util"),d=t("buffer").Buffer,m=Array.prototype.slice,g=e.exports=a;g.AssertionError=function(t){this.name="AssertionError",this.message=t.message,this.actual=t.actual,this.expected=t.expected,this.operator=t.operator;var e=t.stackStartFunction||o;Error.captureStackTrace&&Error.captureStackTrace(this,e)},h.inherits(g.AssertionError,Error),g.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",i(JSON.stringify(this.actual,r),128),this.operator,i(JSON.stringify(this.expected,r),128)].join(" ")},g.AssertionError.__proto__=Error.prototype,g.fail=o,g.ok=a,g.equal=function(t,e,n){t!=e&&o(t,e,n,"==",g.equal)},g.notEqual=function(t,e,n){t==e&&o(t,e,n,"!=",g.notEqual)},g.deepEqual=function(t,e,n){s(t,e)||o(t,e,n,"deepEqual",g.deepEqual)},g.notDeepEqual=function(t,e,n){s(t,e)&&o(t,e,n,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(t,e,n){t!==e&&o(t,e,n,"===",g.strictEqual)},g.notStrictEqual=function(t,e,n){t===e&&o(t,e,n,"!==",g.notStrictEqual)},g.throws=function(){p.apply(this,[!0].concat(m.call(arguments)))},g.doesNotThrow=function(){p.apply(this,[!1].concat(m.call(arguments)))},g.ifError=function(t){if(t)throw t}},{util:2,buffer:3}],2:[function(t,e,n){function r(t){return t instanceof Array||Array.isArray(t)||t&&t!==Object.prototype&&r(t.__proto__)}function i(t){return t instanceof RegExp||"object"==typeof t&&"[object RegExp]"===Object.prototype.toString.call(t)}function o(t){if(t instanceof Date)return!0;if("object"!=typeof t)return!1;var e=Date.prototype&&s(Date.prototype),n=t.__proto__&&s(t.__proto__);return JSON.stringify(n)===JSON.stringify(e)}t("events"),n.isArray=r,n.isDate=function(t){return"[object Date]"===Object.prototype.toString.call(t)},n.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},n.print=function(){},n.puts=function(){},n.debug=function(){},n.inspect=function(t,e,u,c){function f(t,u){if(t&&"function"==typeof t.inspect&&t!==n&&(!t.constructor||t.constructor.prototype!==t))return t.inspect(u);switch(typeof t){case"undefined":return p("undefined","undefined");case"string":var c="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return p(c,"string");case"number":return p(""+t,"number");case"boolean":return p(""+t,"boolean")}if(null===t)return p("null","null");var h=a(t),d=e?s(t):h;if("function"==typeof t&&0===d.length){if(i(t))return p(""+t,"regexp");var m=t.name?": "+t.name:"";return p("[Function"+m+"]","special")}if(o(t)&&0===d.length)return p(t.toUTCString(),"date");var g,v,y;if(r(t)?(v="Array",y=["[","]"]):(v="Object",y=["{","}"]),"function"==typeof t){var b=t.name?": "+t.name:"";g=i(t)?" "+t:" [Function"+b+"]"}else g="";if(o(t)&&(g=" "+t.toUTCString()),0===d.length)return y[0]+g+y[1];if(0>u)return i(t)?p(""+t,"regexp"):p("[Object]","special");l.push(t);var x=d.map(function(e){var n,i;if(t.__lookupGetter__&&(t.__lookupGetter__(e)?i=t.__lookupSetter__(e)?p("[Getter/Setter]","special"):p("[Getter]","special"):t.__lookupSetter__(e)&&(i=p("[Setter]","special"))),h.indexOf(e)<0&&(n="["+e+"]"),i||(l.indexOf(t[e])<0?(i=null===u?f(t[e]):f(t[e],u-1),i.indexOf("\n")>-1&&(i=r(t)?i.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+i.split("\n").map(function(t){return" "+t}).join("\n"))):i=p("[Circular]","special")),"undefined"==typeof n){if("Array"===v&&e.match(/^\d+$/))return i;n=JSON.stringify(""+e),n.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(n=n.substr(1,n.length-2),n=p(n,"name")):(n=n.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),n=p(n,"string"))}return n+": "+i});l.pop();var w=0,_=x.reduce(function(t,e){return w++,e.indexOf("\n")>=0&&w++,t+e.length+1},0);return x=_>50?y[0]+(""===g?"":g+"\n ")+" "+x.join(",\n ")+" "+y[1]:y[0]+g+" "+x.join(", ")+" "+y[1]}var l=[],p=function(t,e){var n={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]},r={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[e];return r?"["+n[r][0]+"m"+t+"["+n[r][1]+"m":t};return c||(p=function(t){return t}),f(t,"undefined"==typeof u?2:u)},n.log=function(){},n.pump=null;var a=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e},s=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.hasOwnProperty.call(t,n)&&e.push(n);return e},u=Object.create||function(t,e){var n;if(null===t)n={__proto__:null};else{if("object"!=typeof t)throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var r=function(){};r.prototype=t,n=new r,n.__proto__=t}return"undefined"!=typeof e&&Object.defineProperties&&Object.defineProperties(n,e),n};n.inherits=function(t,e){t.super_=e,t.prototype=u(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})};var c=/%[sdj%]/g;n.format=function(t){if("string"!=typeof t){for(var e=[],r=0;r=o)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":return JSON.stringify(i[r++]);default:return t}}),s=i[r];o>r;s=i[++r])a+=null===s||"object"!=typeof s?" "+s:" "+n.inspect(s);return a}},{events:4}],5:[function(t,e,n){n.readIEEE754=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,f=-7,l=n?0:i-1,p=n?1:-1,h=t[e+l];for(l+=p,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+t[e+l],l+=p,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===o)o=1-c;else{if(o===u)return a?0/0:1/0*(h?-1:1);a+=Math.pow(2,r),o-=c}return(h?-1:1)*a*Math.pow(2,o-r)},n.writeIEEE754=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?o-1:0,d=r?-1:1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+l>=1?p/u:p*Math.pow(2,1-l),e*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=d,s/=256,i-=8);for(a=a<0;t[n+h]=255&a,h+=d,a/=256,c-=8);t[n+h-d]|=128*m}},{}],6:[function(t,e){var n=e.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){if(t.source===window&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var e=n.shift();e()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){!function(t){function e(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;no;o++)r[o].apply(this,n);return!0}return!1},r.prototype.addListener=function(t,e){if("function"!=typeof e)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",t,e),this._events[t])if(i(this._events[t])){if(!this._events[t].warned){var n;n=void 0!==this._events.maxListeners?this._events.maxListeners:o,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),console.trace())}this._events[t].push(e)}else this._events[t]=[this._events[t],e];else this._events[t]=e;return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){var n=this;return n.on(t,function r(){n.removeListener(t,r),e.apply(this,arguments)}),this},r.prototype.removeListener=function(t,n){if("function"!=typeof n)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var r=this._events[t];if(i(r)){var o=e(r,n);if(0>o)return this;r.splice(o,1),0==r.length&&delete this._events[t]}else this._events[t]===n&&delete this._events[t];return this},r.prototype.removeAllListeners=function(t){return 0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},r.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),i(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}}(t("__browserify_process"))},{__browserify_process:6}],"buffer-browserify":[function(t,e){e.exports=t("q9TxCC")},{}],q9TxCC:[function(t,e,n){function r(t){this.length=t}function i(t){return 16>t?"0"+t.toString(16):t.toString(16)}function o(t){for(var e=[],n=0;ni&&!(i+n>=e.length||i>=t.length);)e[i+n]=t[i],i++;return i}function c(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function f(t){return t=~~Math.ceil(+t),0>t?0:t}function l(t,e,n){if(!(this instanceof l))return new l(t,e,n);var i;if("number"==typeof n)this.length=f(e),this.parent=t,this.offset=n;else{switch(i=typeof t){case"number":this.length=f(t);break;case"string":this.length=l.byteLength(t,e);break;case"object":this.length=f(t.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new r(this.length),this.offset=0):((!N||N.length-N.used=t.length?0:(n?(i=t.parent[t.offset+e]<<8,e+1=t.length?0:(n?(e+1>>0):(e+2>>0)),i)}function g(t,e,n,r){var i,o;return r||(C.ok("boolean"==typeof n,"missing or invalid endian"),C.ok(void 0!==e&&null!==e,"missing offset"),C.ok(e+1=0,"specified a negative value for writing an unsigned value"),C.ok(e>=t,"value is larger than maximum value for type"),C.ok(Math.floor(t)===t,"value has a fractional component")}function w(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+1>>8*(r?1-o:o)}function _(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+3>>8*(r?3-o:o)}function E(t,e,n){C.ok("number"==typeof t,"cannot write a non-number as a number"),C.ok(e>=t,"value larger than maximum allowed value"),C.ok(t>=n,"value smaller than minimum allowed value"),C.ok(Math.floor(t)===t,"value has a fractional component")}function S(t,e,n){C.ok("number"==typeof t,"cannot write a non-number as a number"),C.ok(e>=t,"value larger than maximum allowed value"),C.ok(t>=n,"value smaller than minimum allowed value")}function j(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+1=0?w(t,e,n,r,i):w(t,65535+e+1,n,r,i)}function k(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+3=0?_(t,e,n,r,i):_(t,4294967295+e+1,n,r,i)}function A(e,n,r,i,o){o||(C.ok(void 0!==n&&null!==n,"missing value"),C.ok("boolean"==typeof i,"missing or invalid endian"),C.ok(void 0!==r&&null!==r,"missing offset"),C.ok(r+3r;r++)if(t[r]=i(this[r]),r==n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},r.prototype.hexSlice=function(t,e){var n=this.length;(!t||0>t)&&(t=0),(!e||0>e||e>n)&&(e=n);for(var r="",o=t;e>o;o++)r+=i(this[o]);return r},r.prototype.toString=function(t,e,n){if(t=String(t||"utf8").toLowerCase(),e=+e||0,"undefined"==typeof n&&(n=this.length),+n==e)return"";switch(t){case"hex":return this.hexSlice(e,n);case"utf8":case"utf-8":return this.utf8Slice(e,n);case"ascii":return this.asciiSlice(e,n);case"binary":return this.binarySlice(e,n);case"base64":return this.base64Slice(e,n);case"ucs2":case"ucs-2":return this.ucs2Slice(e,n);default:throw new Error("Unknown encoding")}},r.prototype.hexWrite=function(t,e,n){e=+e||0;var i=this.length-e;n?(n=+n,n>i&&(n=i)):n=i;var o=t.length;if(o%2)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");this[e+a]=s}return r._charsWritten=2*a,a},r.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var i=r;r=e,e=n,n=i}e=+e||0;var o=this.length-e;switch(n?(n=+n,n>o&&(n=o)):n=o,r=String(r||"utf8").toLowerCase()){case"hex":return this.hexWrite(t,e,n);case"utf8":case"utf-8":return this.utf8Write(t,e,n);case"ascii":return this.asciiWrite(t,e,n);case"binary":return this.binaryWrite(t,e,n);case"base64":return this.base64Write(t,e,n);case"ucs2":case"ucs-2":return this.ucs2Write(t,e,n);default:throw new Error("Unknown encoding")}},r.prototype.slice=function(t,e){if(void 0===e&&(e=this.length),e>this.length)throw new Error("oob");if(t>e)throw new Error("oob");return new l(this,e-t,+t)},r.prototype.copy=function(t,e,n,r){for(var i=[],o=n;r>o;o++)C.ok("undefined"!=typeof this[o],"copying undefined buffer bytes!"),i.push(this[o]);for(var o=e;othis.length)throw new Error("oob");if(e>n)throw new Error("oob");for(var r=e;n>r;r++)this[r]=t},n.SlowBuffer=r,n.Buffer=l,l.poolSize=8192;var N;l.isBuffer=function(t){return t instanceof l||t instanceof r},l.concat=function(t,e){if(!Array.isArray(t))throw new Error("Usage: Buffer.concat(list, [totalLength])\n list should be an Array.");if(0===t.length)return new l(0);if(1===t.length)return t[0];if("number"!=typeof e){e=0;for(var n=0;nr;r++)if(t[r]=i(this.parent[r+this.offset]),r==n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},l.prototype.get=function(t){if(0>t||t>=this.length)throw new Error("oob");return this.parent[this.offset+t]},l.prototype.set=function(t,e){if(0>t||t>=this.length)throw new Error("oob");return this.parent[this.offset+t]=e},l.prototype.write=function(t,e,n,i){if(isFinite(e))isFinite(n)||(i=n,n=void 0);else{var o=i;i=e,e=n,n=o}e=+e||0;var a=this.length-e;n?(n=+n,n>a&&(n=a)):n=a,i=String(i||"utf8").toLowerCase();var s;switch(i){case"hex":s=this.parent.hexWrite(t,this.offset+e,n);break;case"utf8":case"utf-8":s=this.parent.utf8Write(t,this.offset+e,n);break;case"ascii":s=this.parent.asciiWrite(t,this.offset+e,n);break;case"binary":s=this.parent.binaryWrite(t,this.offset+e,n);break;case"base64":s=this.parent.base64Write(t,this.offset+e,n);break;case"ucs2":case"ucs-2":s=this.parent.ucs2Write(t,this.offset+e,n);break;default:throw new Error("Unknown encoding")}return l._charsWritten=r._charsWritten,s},l.prototype.toString=function(t,e,n){switch(t=String(t||"utf8").toLowerCase(),"undefined"==typeof e||0>e?e=0:e>this.length&&(e=this.length),"undefined"==typeof n||n>this.length?n=this.length:0>n&&(n=0),e+=this.offset,n+=this.offset,t){case"hex":return this.parent.hexSlice(e,n);case"utf8":case"utf-8":return this.parent.utf8Slice(e,n);case"ascii":return this.parent.asciiSlice(e,n);case"binary":return this.parent.binarySlice(e,n);case"base64":return this.parent.base64Slice(e,n);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(e,n);default:throw new Error("Unknown encoding")}},l.byteLength=r.byteLength,l.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),"number"!=typeof t||isNaN(t))throw new Error("value is not a number");if(e>n)throw new Error("end < start");if(n===e)return 0;if(0==this.length)return 0;if(0>e||e>=this.length)throw new Error("start out of bounds");if(0>n||n>this.length)throw new Error("end out of bounds");return this.parent.fill(t,e+this.offset,n+this.offset)},l.prototype.copy=function(t,e,n,r){var i=this;if(n||(n=0),r||(r=this.length),e||(e=0),n>r)throw new Error("sourceEnd < sourceStart");if(r===n)return 0;if(0==t.length||0==i.length)return 0;if(0>e||e>=t.length)throw new Error("targetStart out of bounds");if(0>n||n>=i.length)throw new Error("sourceStart out of bounds");if(0>r||r>i.length)throw new Error("sourceEnd out of bounds");return r>this.length&&(r=this.length),t.length-ethis.length)throw new Error("oob");if(t>e)throw new Error("oob");return new l(this.parent,e-t,+t+this.offset)},l.prototype.utf8Slice=function(t,e){return this.toString("utf8",t,e)},l.prototype.binarySlice=function(t,e){return this.toString("binary",t,e)},l.prototype.asciiSlice=function(t,e){return this.toString("ascii",t,e)},l.prototype.utf8Write=function(t,e){return this.write(t,e,"utf8")},l.prototype.binaryWrite=function(t,e){return this.write(t,e,"binary")},l.prototype.asciiWrite=function(t,e){return this.write(t,e,"ascii")},l.prototype.readUInt8=function(t,e){var n=this;return e||(C.ok(void 0!==t&&null!==t,"missing offset"),C.ok(t=n.length?void 0:n.parent[n.offset+t]},l.prototype.readUInt16LE=function(t,e){return d(this,t,!1,e)},l.prototype.readUInt16BE=function(t,e){return d(this,t,!0,e)},l.prototype.readUInt32LE=function(t,e){return m(this,t,!1,e)},l.prototype.readUInt32BE=function(t,e){return m(this,t,!0,e)},l.prototype.readInt8=function(t,e){var n,r=this;return e||(C.ok(void 0!==t&&null!==t,"missing offset"),C.ok(t=r.length?void 0:(n=128&r.parent[r.offset+t],n?-1*(255-r.parent[r.offset+t]+1):r.parent[r.offset+t])},l.prototype.readInt16LE=function(t,e){return g(this,t,!1,e)},l.prototype.readInt16BE=function(t,e){return g(this,t,!0,e)},l.prototype.readInt32LE=function(t,e){return v(this,t,!1,e)},l.prototype.readInt32BE=function(t,e){return v(this,t,!0,e)},l.prototype.readFloatLE=function(t,e){return y(this,t,!1,e)},l.prototype.readFloatBE=function(t,e){return y(this,t,!0,e)},l.prototype.readDoubleLE=function(t,e){return b(this,t,!1,e)},l.prototype.readDoubleBE=function(t,e){return b(this,t,!0,e)},l.prototype.writeUInt8=function(t,e,n){var r=this;n||(C.ok(void 0!==t&&null!==t,"missing value"),C.ok(void 0!==e&&null!==e,"missing offset"),C.ok(e=0?r.writeUInt8(t,e,n):r.writeUInt8(255+t+1,e,n)},l.prototype.writeInt16LE=function(t,e,n){j(this,t,e,!1,n)},l.prototype.writeInt16BE=function(t,e,n){j(this,t,e,!0,n)},l.prototype.writeInt32LE=function(t,e,n){k(this,t,e,!1,n)},l.prototype.writeInt32BE=function(t,e,n){k(this,t,e,!0,n)},l.prototype.writeFloatLE=function(t,e,n){A(this,t,e,!1,n)},l.prototype.writeFloatBE=function(t,e,n){A(this,t,e,!0,n)},l.prototype.writeDoubleLE=function(t,e,n){I(this,t,e,!1,n)},l.prototype.writeDoubleBE=function(t,e,n){I(this,t,e,!0,n)},r.prototype.readUInt8=l.prototype.readUInt8,r.prototype.readUInt16LE=l.prototype.readUInt16LE,r.prototype.readUInt16BE=l.prototype.readUInt16BE,r.prototype.readUInt32LE=l.prototype.readUInt32LE,r.prototype.readUInt32BE=l.prototype.readUInt32BE,r.prototype.readInt8=l.prototype.readInt8,r.prototype.readInt16LE=l.prototype.readInt16LE,r.prototype.readInt16BE=l.prototype.readInt16BE,r.prototype.readInt32LE=l.prototype.readInt32LE,r.prototype.readInt32BE=l.prototype.readInt32BE,r.prototype.readFloatLE=l.prototype.readFloatLE,r.prototype.readFloatBE=l.prototype.readFloatBE,r.prototype.readDoubleLE=l.prototype.readDoubleLE,r.prototype.readDoubleBE=l.prototype.readDoubleBE,r.prototype.writeUInt8=l.prototype.writeUInt8,r.prototype.writeUInt16LE=l.prototype.writeUInt16LE,r.prototype.writeUInt16BE=l.prototype.writeUInt16BE,r.prototype.writeUInt32LE=l.prototype.writeUInt32LE,r.prototype.writeUInt32BE=l.prototype.writeUInt32BE,r.prototype.writeInt8=l.prototype.writeInt8,r.prototype.writeInt16LE=l.prototype.writeInt16LE,r.prototype.writeInt16BE=l.prototype.writeInt16BE,r.prototype.writeInt32LE=l.prototype.writeInt32LE,r.prototype.writeInt32BE=l.prototype.writeInt32BE,r.prototype.writeFloatLE=l.prototype.writeFloatLE,r.prototype.writeFloatBE=l.prototype.writeFloatBE,r.prototype.writeDoubleLE=l.prototype.writeDoubleLE,r.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":5,"base64-js":7}],7:[function(t,e){!function(){"use strict";function t(t){var e,n,i,o,a,s;if(t.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(a=t.indexOf("="),a=a>0?t.length-a:0,s=[],i=a>0?t.length-4:t.length,e=0,n=0;i>e;e+=4,n+=3)o=r.indexOf(t[e])<<18|r.indexOf(t[e+1])<<12|r.indexOf(t[e+2])<<6|r.indexOf(t[e+3]),s.push((16711680&o)>>16),s.push((65280&o)>>8),s.push(255&o);return 2===a?(o=r.indexOf(t[e])<<2|r.indexOf(t[e+1])>>4,s.push(255&o)):1===a&&(o=r.indexOf(t[e])<<10|r.indexOf(t[e+1])<<4|r.indexOf(t[e+2])>>2,s.push(255&o>>8),s.push(255&o)),s}function n(t){function e(t){return r[63&t>>18]+r[63&t>>12]+r[63&t>>6]+r[63&t]}var n,i,o,a=t.length%3,s="";for(n=0,o=t.length-a;o>n;n+=3)i=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s+=e(i);switch(a){case 1:i=t[t.length-1],s+=r[i>>2],s+=r[63&i<<4],s+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],s+=r[i>>10],s+=r[63&i>>4],s+=r[63&i<<2],s+="="}return s}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports.toByteArray=t,e.exports.fromByteArray=n}()},{}],8:[function(t,e,n){n.readIEEE754=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,f=-7,l=n?0:i-1,p=n?1:-1,h=t[e+l];for(l+=p,o=h&(1<<-f)-1,h>>=-f,f+=s;f>0;o=256*o+t[e+l],l+=p,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+t[e+l],l+=p,f-=8);if(0===o)o=1-c; -else{if(o===u)return a?0/0:1/0*(h?-1:1);a+=Math.pow(2,r),o-=c}return(h?-1:1)*a*Math.pow(2,o-r)},n.writeIEEE754=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,f=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?o-1:0,d=r?-1:1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+l>=1?p/u:p*Math.pow(2,1-l),e*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=d,s/=256,i-=8);for(a=a<0;t[n+h]=255&a,h+=d,a/=256,c-=8);t[n+h-d]|=128*m}},{}],3:[function(t,e,n){function r(t){this.length=t}function i(t){return 16>t?"0"+t.toString(16):t.toString(16)}function o(t){for(var e=[],n=0;ni&&!(i+n>=e.length||i>=t.length);)e[i+n]=t[i],i++;return i}function c(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function f(t){return t=~~Math.ceil(+t),0>t?0:t}function l(t,e,n){if(!(this instanceof l))return new l(t,e,n);var i;if("number"==typeof n)this.length=f(e),this.parent=t,this.offset=n;else{switch(i=typeof t){case"number":this.length=f(t);break;case"string":this.length=l.byteLength(t,e);break;case"object":this.length=f(t.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new r(this.length),this.offset=0):((!N||N.length-N.used>>0):(i=t.parent[t.offset+e+2]<<16,i|=t.parent[t.offset+e+1]<<8,i|=t.parent[t.offset+e],i+=t.parent[t.offset+e+3]<<24>>>0),i}function g(t,e,n,r){var i,o;return r||(C.ok("boolean"==typeof n,"missing or invalid endian"),C.ok(void 0!==e&&null!==e,"missing offset"),C.ok(e+1=0,"specified a negative value for writing an unsigned value"),C.ok(e>=t,"value is larger than maximum value for type"),C.ok(Math.floor(t)===t,"value has a fractional component")}function w(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+1>>8,t.parent[t.offset+n+1]=255&e):(t.parent[t.offset+n+1]=(65280&e)>>>8,t.parent[t.offset+n]=255&e)}function _(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+3>>24,t.parent[t.offset+n+1]=255&e>>>16,t.parent[t.offset+n+2]=255&e>>>8,t.parent[t.offset+n+3]=255&e):(t.parent[t.offset+n+3]=255&e>>>24,t.parent[t.offset+n+2]=255&e>>>16,t.parent[t.offset+n+1]=255&e>>>8,t.parent[t.offset+n]=255&e)}function E(t,e,n){C.ok("number"==typeof t,"cannot write a non-number as a number"),C.ok(e>=t,"value larger than maximum allowed value"),C.ok(t>=n,"value smaller than minimum allowed value"),C.ok(Math.floor(t)===t,"value has a fractional component")}function S(t,e,n){C.ok("number"==typeof t,"cannot write a non-number as a number"),C.ok(e>=t,"value larger than maximum allowed value"),C.ok(t>=n,"value smaller than minimum allowed value")}function j(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+1=0?w(t,e,n,r,i):w(t,65535+e+1,n,r,i)}function k(t,e,n,r,i){i||(C.ok(void 0!==e&&null!==e,"missing value"),C.ok("boolean"==typeof r,"missing or invalid endian"),C.ok(void 0!==n&&null!==n,"missing offset"),C.ok(n+3=0?_(t,e,n,r,i):_(t,4294967295+e+1,n,r,i)}function A(e,n,r,i,o){o||(C.ok(void 0!==n&&null!==n,"missing value"),C.ok("boolean"==typeof i,"missing or invalid endian"),C.ok(void 0!==r&&null!==r,"missing offset"),C.ok(r+3r;r++)if(t[r]=i(this[r]),r==n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},r.prototype.hexSlice=function(t,e){var n=this.length;(!t||0>t)&&(t=0),(!e||0>e||e>n)&&(e=n);for(var r="",o=t;e>o;o++)r+=i(this[o]);return r},r.prototype.toString=function(t,e,n){if(t=String(t||"utf8").toLowerCase(),e=+e||0,"undefined"==typeof n&&(n=this.length),+n==e)return"";switch(t){case"hex":return this.hexSlice(e,n);case"utf8":case"utf-8":return this.utf8Slice(e,n);case"ascii":return this.asciiSlice(e,n);case"binary":return this.binarySlice(e,n);case"base64":return this.base64Slice(e,n);case"ucs2":case"ucs-2":return this.ucs2Slice(e,n);default:throw new Error("Unknown encoding")}},r.prototype.hexWrite=function(t,e,n){e=+e||0;var i=this.length-e;n?(n=+n,n>i&&(n=i)):n=i;var o=t.length;if(o%2)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");this[e+a]=s}return r._charsWritten=2*a,a},r.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var i=r;r=e,e=n,n=i}e=+e||0;var o=this.length-e;switch(n?(n=+n,n>o&&(n=o)):n=o,r=String(r||"utf8").toLowerCase()){case"hex":return this.hexWrite(t,e,n);case"utf8":case"utf-8":return this.utf8Write(t,e,n);case"ascii":return this.asciiWrite(t,e,n);case"binary":return this.binaryWrite(t,e,n);case"base64":return this.base64Write(t,e,n);case"ucs2":case"ucs-2":return this.ucs2Write(t,e,n);default:throw new Error("Unknown encoding")}},r.prototype.slice=function(t,e){if(void 0===e&&(e=this.length),e>this.length)throw new Error("oob");if(t>e)throw new Error("oob");return new l(this,e-t,+t)},r.prototype.copy=function(t,e,n,r){for(var i=[],o=n;r>o;o++)C.ok("undefined"!=typeof this[o],"copying undefined buffer bytes!"),i.push(this[o]);for(var o=e;or;r++)if(t[r]=i(this.parent[r+this.offset]),r==n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},l.prototype.get=function(t){if(0>t||t>=this.length)throw new Error("oob");return this.parent[this.offset+t]},l.prototype.set=function(t,e){if(0>t||t>=this.length)throw new Error("oob");return this.parent[this.offset+t]=e},l.prototype.write=function(t,e,n,i){if(isFinite(e))isFinite(n)||(i=n,n=void 0);else{var o=i;i=e,e=n,n=o}e=+e||0;var a=this.length-e;n?(n=+n,n>a&&(n=a)):n=a,i=String(i||"utf8").toLowerCase();var s;switch(i){case"hex":s=this.parent.hexWrite(t,this.offset+e,n);break;case"utf8":case"utf-8":s=this.parent.utf8Write(t,this.offset+e,n);break;case"ascii":s=this.parent.asciiWrite(t,this.offset+e,n);break;case"binary":s=this.parent.binaryWrite(t,this.offset+e,n);break;case"base64":s=this.parent.base64Write(t,this.offset+e,n);break;case"ucs2":case"ucs-2":s=this.parent.ucs2Write(t,this.offset+e,n);break;default:throw new Error("Unknown encoding")}return l._charsWritten=r._charsWritten,s},l.prototype.toString=function(t,e,n){switch(t=String(t||"utf8").toLowerCase(),"undefined"==typeof e||0>e?e=0:e>this.length&&(e=this.length),"undefined"==typeof n||n>this.length?n=this.length:0>n&&(n=0),e+=this.offset,n+=this.offset,t){case"hex":return this.parent.hexSlice(e,n);case"utf8":case"utf-8":return this.parent.utf8Slice(e,n);case"ascii":return this.parent.asciiSlice(e,n);case"binary":return this.parent.binarySlice(e,n);case"base64":return this.parent.base64Slice(e,n);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(e,n);default:throw new Error("Unknown encoding")}},l.byteLength=r.byteLength,l.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),"number"!=typeof t||isNaN(t))throw new Error("value is not a number");if(e>n)throw new Error("end < start");if(n===e)return 0;if(0==this.length)return 0;if(0>e||e>=this.length)throw new Error("start out of bounds");if(0>n||n>this.length)throw new Error("end out of bounds");return this.parent.fill(t,e+this.offset,n+this.offset)},l.prototype.copy=function(t,e,n,r){var i=this;if(n||(n=0),r||(r=this.length),e||(e=0),n>r)throw new Error("sourceEnd < sourceStart");if(r===n)return 0;if(0==t.length||0==i.length)return 0;if(0>e||e>=t.length)throw new Error("targetStart out of bounds");if(0>n||n>=i.length)throw new Error("sourceStart out of bounds");if(0>r||r>i.length)throw new Error("sourceEnd out of bounds");return r>this.length&&(r=this.length),t.length-ethis.length)throw new Error("oob");if(t>e)throw new Error("oob");return new l(this.parent,e-t,+t+this.offset)},l.prototype.utf8Slice=function(t,e){return this.toString("utf8",t,e)},l.prototype.binarySlice=function(t,e){return this.toString("binary",t,e)},l.prototype.asciiSlice=function(t,e){return this.toString("ascii",t,e)},l.prototype.utf8Write=function(t,e){return this.write(t,e,"utf8")},l.prototype.binaryWrite=function(t,e){return this.write(t,e,"binary")},l.prototype.asciiWrite=function(t,e){return this.write(t,e,"ascii")},l.prototype.readUInt8=function(t,e){var n=this;return e||(C.ok(void 0!==t&&null!==t,"missing offset"),C.ok(t=0?r.writeUInt8(t,e,n):r.writeUInt8(255+t+1,e,n)},l.prototype.writeInt16LE=function(t,e,n){j(this,t,e,!1,n)},l.prototype.writeInt16BE=function(t,e,n){j(this,t,e,!0,n)},l.prototype.writeInt32LE=function(t,e,n){k(this,t,e,!1,n)},l.prototype.writeInt32BE=function(t,e,n){k(this,t,e,!0,n)},l.prototype.writeFloatLE=function(t,e,n){A(this,t,e,!1,n)},l.prototype.writeFloatBE=function(t,e,n){A(this,t,e,!0,n)},l.prototype.writeDoubleLE=function(t,e,n){I(this,t,e,!1,n)},l.prototype.writeDoubleBE=function(t,e,n){I(this,t,e,!0,n)},r.prototype.readUInt8=l.prototype.readUInt8,r.prototype.readUInt16LE=l.prototype.readUInt16LE,r.prototype.readUInt16BE=l.prototype.readUInt16BE,r.prototype.readUInt32LE=l.prototype.readUInt32LE,r.prototype.readUInt32BE=l.prototype.readUInt32BE,r.prototype.readInt8=l.prototype.readInt8,r.prototype.readInt16LE=l.prototype.readInt16LE,r.prototype.readInt16BE=l.prototype.readInt16BE,r.prototype.readInt32LE=l.prototype.readInt32LE,r.prototype.readInt32BE=l.prototype.readInt32BE,r.prototype.readFloatLE=l.prototype.readFloatLE,r.prototype.readFloatBE=l.prototype.readFloatBE,r.prototype.readDoubleLE=l.prototype.readDoubleLE,r.prototype.readDoubleBE=l.prototype.readDoubleBE,r.prototype.writeUInt8=l.prototype.writeUInt8,r.prototype.writeUInt16LE=l.prototype.writeUInt16LE,r.prototype.writeUInt16BE=l.prototype.writeUInt16BE,r.prototype.writeUInt32LE=l.prototype.writeUInt32LE,r.prototype.writeUInt32BE=l.prototype.writeUInt32BE,r.prototype.writeInt8=l.prototype.writeInt8,r.prototype.writeInt16LE=l.prototype.writeInt16LE,r.prototype.writeInt16BE=l.prototype.writeInt16BE,r.prototype.writeInt32LE=l.prototype.writeInt32LE,r.prototype.writeInt32BE=l.prototype.writeInt32BE,r.prototype.writeFloatLE=l.prototype.writeFloatLE,r.prototype.writeFloatBE=l.prototype.writeFloatBE,r.prototype.writeDoubleLE=l.prototype.writeDoubleLE,r.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":8,"base64-js":9}],9:[function(t,e){!function(){"use strict";function t(t){var e,n,i,o,a,s;if(t.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(a=t.indexOf("="),a=a>0?t.length-a:0,s=[],i=a>0?t.length-4:t.length,e=0,n=0;i>e;e+=4,n+=3)o=r.indexOf(t[e])<<18|r.indexOf(t[e+1])<<12|r.indexOf(t[e+2])<<6|r.indexOf(t[e+3]),s.push((16711680&o)>>16),s.push((65280&o)>>8),s.push(255&o);return 2===a?(o=r.indexOf(t[e])<<2|r.indexOf(t[e+1])>>4,s.push(255&o)):1===a&&(o=r.indexOf(t[e])<<10|r.indexOf(t[e+1])<<4|r.indexOf(t[e+2])>>2,s.push(255&o>>8),s.push(255&o)),s}function n(t){function e(t){return r[63&t>>18]+r[63&t>>12]+r[63&t>>6]+r[63&t]}var n,i,o,a=t.length%3,s="";for(n=0,o=t.length-a;o>n;n+=3)i=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s+=e(i);switch(a){case 1:i=t[t.length-1],s+=r[i>>2],s+=r[63&i<<4],s+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],s+=r[i>>10],s+=r[63&i>>4],s+=r[63&i<<2],s+="="}return s}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";e.exports.toByteArray=t,e.exports.fromByteArray=n}()},{}]},{},[]),e.exports=t("buffer-browserify")},{}],68:[function(t,e){var n=e.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){if(t.source===window&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var e=n.shift();e()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},{}],69:[function(t,e){function n(t,e){return o.init(this,e,t)}var r=t("./vendor/lodash"),i=t("async"),o=t("jxt"),a=t("xhr"),s=new DOMParser;n.prototype={constructor:{value:n},NS:"http://docs.oasis-open.org/ns/xri/xrd-1.0",EL:"XRD",toString:o.toString,toJSON:o.toJSON,get subject(){return o.getSubText(this.xml,this.NS,"Subject")},get expires(){return new Date(o.getSubText(this.xml,this.NS,"Expires"))},get aliases(){return o.getMultiSubText(this.xml,this.NS,"Alias")},get properties(){var t={},e=o.find(this.xml,this.NS,"Property");return r.each(e,function(e){var n=o.getAttribute(e,"type");t[n]=e.textContent}),t},get links(){var t=[],e=o.find(this.xml,this.NS,"Link");return r.each(e,function(e){var n={rel:o.getAttribute(e,"rel"),href:o.getAttribute(e,"href"),type:o.getAttribute(e,"type"),template:o.getAttribute(e,"template"),titles:o.getSubLangText(e,this.NS,"Title","default"),properties:{}},i=o.find(e,this.NS,"Property");r.each(i,function(t){var e=o.getAttribute(t,"type");n.properties[e]=t.textContent}),t.push(n)}),t}},e.exports=function(t,e){"string"==typeof t&&(t={host:t}),t=r.extend({ssl:!0,json:!0},t);var o=t.ssl?"https://":"http://";i.parallel({json:function(e){return t.json?(a({uri:o+t.host+"/.well-known/host-meta.json"},function(t,n,r){if(t)return e();try{e("completed",JSON.parse(r))}catch(i){e(null,{})}}),void 0):e(null,{})},xrd:function(e){a({uri:o+t.host+"/.well-known/host-meta"},function(t,r){if(t)return e(null,{});try{var i=s.parseFromString(r.body,"application/xml").childNodes[0],o=new n({},i);e("completed",o.toJSON())}catch(a){e(null,{})}})}},function(t,n){if(t){if(Object.keys(n.json).length)return e(!1,n.json);if(Object.keys(n.xrd).length)return e(!1,n.xrd)}e("no-host-meta",{})})}},{"./vendor/lodash":75,async:55,jxt:70,xhr:72}],70:[function(t,e,n){var r=t("./vendor/lodash"),i=new XMLSerializer,o="http://www.w3.org/XML/1998/namespace",a={},s={},u={},c=n.find=function(t,e,n){var i=t.querySelectorAll(n);return r.filter(i,function(n){return n.namespaceURI===e&&n.parentNode==t})};n.findOrCreate=function(t,e,n){var r=c(t,e,n);if(r.length)return r[0];var i=document.createElementNS(e,n);return t.appendChild(i),i},n.init=function(t,e,n){return t.xml=e||document.createElementNS(t.NS,t.EL),t.xml.parentNode&&t.xml.parentNode.namespaceURI===t.NS||t.xml.setAttribute("xmlns",t.NS),t._extensions={},r.each(t.xml.childNodes,function(e){var n=e.namespaceURI+"|"+e.localName,r=s[n];if(void 0!==r){var i=r.prototype._name;t._extensions[i]=new r(null,e),t._extensions[i].parent=t}}),r.extend(t,n),t},n.getSubText=function(t,e,n){var r=c(t,e,n);if(!r)return"";for(var i=0;i=0?Object.keys(r).length>0&&(e[t]=r):i.indexOf("Array")>=0?r.length>0&&(e[t]=r):r&&(e[t]=r)}return e},n.extend=function(t,e){var i=t.prototype.NS+"|"+t.prototype.EL,o=e.prototype._name,a=e.prototype.NS+"|"+e.prototype.EL;s[a]=e,u[a]||(u[a]={}),u[i]||(u[i]={}),u[i][o]=e,t.prototype.__defineGetter__(o,function(){if(!this._extensions[o]){var t=n.find(this.xml,e.prototype.NS,e.prototype.EL);t.length?this._extensions[o]=new e(null,t[0]):(this._extensions[o]=new e,this.xml.appendChild(this._extensions[o].xml)),this._extensions[o].parent=this}return this._extensions[o]}),t.prototype.__defineSetter__(o,function(t){var e=this[o];r.extend(e,t)})},n.topLevel=function(t){var e=t.prototype.NS+"|"+t.prototype.EL;s[e]=t,a[e]=t},n.build=function(t){var e=a[t.namespaceURI+"|"+t.localName];return e?new e(null,t):void 0},n.XML_NS=o,n.TOP_LEVEL_LOOKUP=a,n.LOOKUP_EXT=u,n.LOOKUP=s},{"./vendor/lodash":71}],71:[function(e,n,r){var i=self;!function(e){function o(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function a(t){t.length=0,y.lengthk;k++)r+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(r+="||(!v[m]&&r[m]!==y[m])"),r+="){"+t.f+"}";r+="}"}return(t.b||Y.nonEnumArgs)&&(r+="}"),r+=t.c+";return C",e=e("i,j,l,n,o,q,t,u,y,z,w,G,H,J",n+r+"}"),s(t),e(C,U,P,f,Z,d,ee,u,z,q,K,T,R,J)}function f(t){return J.call(t)==S}function l(t,e,n,r,i,s){var c=n===x;if("function"==typeof n&&!c){n=u.createCallback(n,r,2);var h=n(t,e);if("undefined"!=typeof h)return!!h}if(t===e)return 0!==t||1/t==1/e;var d=typeof t,m=typeof e;if(t===t&&(!t||"function"!=d&&"object"!=d)&&(!e||"function"!=m&&"object"!=m))return!1;if(null==t||null==e)return t===e;if(m=J.call(t),d=J.call(e),m==S&&(m=O),d==S&&(d=O),m!=d)return!1;switch(m){case A:case I:return+t==+e;case N:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case L:case T:return t==e+""}if(d=m==j,!d){if(P.call(t,"__wrapped__")||P.call(e,"__wrapped__"))return l(t.__wrapped__||t,e.__wrapped__||e,n,r,i,s);if(m!=O||!Y.nodeClass&&(o(t)||o(e)))return!1;var m=!Y.argsObject&&f(t)?Object:t.constructor,g=!Y.argsObject&&f(e)?Object:e.constructor;if(!(m==g||p(m)&&m instanceof m&&p(g)&&g instanceof g))return!1}for(g=!i,i||(i=y.pop()||[]),s||(s=y.pop()||[]),m=i.length;m--;)if(i[m]==t)return s[m]==e;var v=0,h=!0;if(i.push(t),s.push(e),d){if(m=t.length,v=e.length,h=v==t.length,!h&&!c)return h;for(;v--;)if(d=m,g=e[v],c)for(;d--&&!(h=l(t[d],g,n,r,i,s)););else if(!(h=l(t[v],g,n,r,i,s)))break;return h}return re(e,function(e,o,a){return P.call(a,o)?(v++,h=P.call(t,o)&&l(t[o],e,n,r,i,s)):void 0}),h&&!c&&re(t,function(t,e,n){return P.call(n,e)?h=-1<--v:void 0}),g&&(a(i),a(s)),h}function p(t){return"function"==typeof t}function h(t){return!(!t||!q[typeof t])}function d(t){return"string"==typeof t||J.call(t)==T}function m(t,e,n){var r=[];if(e=u.createCallback(e,n),Z(t)){n=-1;for(var i=t.length;++n3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),re=c($,F,{i:!1});p(/x/)&&(p=function(t){return"function"==typeof t&&"[object Function]"==J.call(t)}),u.assign=X,u.createCallback=function(t,e,n){if(null==t)return v;var r=typeof t;if("function"!=r){if("object"!=r)return function(e){return e[t]};var i=ee(t);return function(e){for(var n=i.length,r=!1;n--&&(r=l(e[i[n]],t[i[n]],x)););return r}}return"undefined"==typeof e||_&&!_.test(D.call(t))?t:1===n?function(n){return t.call(e,n)}:2===n?function(n,r){return t.call(e,n,r)}:4===n?function(n,r,i,o){return t.call(e,n,r,i,o)}:function(n,r,i){return t.call(e,n,r,i)}},u.filter=m,u.forEach=g,u.forIn=re,u.keys=ee,u.each=g,u.extend=X,u.select=m,u.identity=v,u.isArguments=f,u.isArray=Z,u.isEqual=l,u.isFunction=p,u.isObject=h,u.isString=d,u.VERSION="1.3.1","function"==typeof t&&"object"==typeof t.amd&&t.amd?(e._=u,t(function(){return u})):B&&!B.nodeType?M?(M.exports=u)._=u:B._=u:e._=u -}(this)},{}],72:[function(t,e){function n(t,e){function n(){4===f.readyState&&i()}function i(){var t=null,n=f.statusCode=f.status,r=f.body=f.response||f.responseText||f.responseXML;if(0===n||n>=400&&600>n){var i=f.responseText||a[String(f.status).charAt(0)];t=new Error(i),t.statusCode=f.status}if(m)try{r=f.body=JSON.parse(r)}catch(o){}e(t,f,r)}function c(t){e(t,f)}"string"==typeof t&&(t={uri:t}),t=t||{},e=o(e);var f;t.cors?(f=new u,f.withCredentials=!0):f=new s;var l=f.url=t.uri,p=f.method=t.method||"GET",h=t.body||t.data,d=f.headers=t.headers||{},m=!1;return"json"in t&&(m=!0,d["Content-Type"]="application/json",h=JSON.stringify(t.json)),f.onreadystatechange=n,f.onload=i,f.onerror=c,f.onprogress=function(){},f.ontimeout=r,f.open(p,l),f.timeout="timeout"in t?t.timeout:5e3,f.setRequestHeader&&Object.keys(d).forEach(function(t){f.setRequestHeader(t,d[t])}),f.send(h),f}function r(){}var i=t("global/window"),o=t("once"),a={0:"Internal XMLHttpRequest Error",4:"4xx Client Error",5:"5xx Server Error"},s=i.XMLHttpRequest||r,u="withCredentials"in new s?i.XMLHttpRequest:i.XDomainRequest;e.exports=n},{"global/window":73,once:74}],73:[function(t,e){var n=self;e.exports="undefined"!=typeof window?window:"undefined"!=typeof n?n:{}},{}],74:[function(t,e){function n(t){var e=!1;return function(){return e?void 0:(e=!0,t.apply(this,arguments))}}e.exports=n,n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0})})},{}],75:[function(e,n,r){var i=self;!function(e){function o(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function a(t){t.length=0,v.lengthk;k++)r+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(r+="||(!v[m]&&r[m]!==y[m])"),r+="){"+t.f+"}";r+="}"}return(t.b||K.nonEnumArgs)&&(r+="}"),r+=t.c+";return C",e=e("i,j,l,n,o,q,t,u,y,z,w,G,H,J",n+r+"}"),s(t),e(I,F,D,f,Q,d,te,u,U,T,V,L,z,W)}function f(t){return W.call(t)==E}function l(t,e,n,r,i,s){var c=n===b;if("function"==typeof n&&!c){n=u.createCallback(n,r,2);var h=n(t,e);if("undefined"!=typeof h)return!!h}if(t===e)return 0!==t||1/t==1/e;var d=typeof t,m=typeof e;if(t===t&&(!t||"function"!=d&&"object"!=d)&&(!e||"function"!=m&&"object"!=m))return!1;if(null==t||null==e)return t===e;if(m=W.call(t),d=W.call(e),m==E&&(m=N),d==E&&(d=N),m!=d)return!1;switch(m){case j:case A:return+t==+e;case C:return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case O:case L:return t==e+""}if(d=m==S,!d){if(D.call(t,"__wrapped__")||D.call(e,"__wrapped__"))return l(t.__wrapped__||t,e.__wrapped__||e,n,r,i,s);if(m!=N||!K.nodeClass&&(o(t)||o(e)))return!1;var m=!K.argsObject&&f(t)?Object:t.constructor,g=!K.argsObject&&f(e)?Object:e.constructor;if(!(m==g||p(m)&&m instanceof m&&p(g)&&g instanceof g))return!1}for(g=!i,i||(i=v.pop()||[]),s||(s=v.pop()||[]),m=i.length;m--;)if(i[m]==t)return s[m]==e;var y=0,h=!0;if(i.push(t),s.push(e),d){if(m=t.length,y=e.length,h=y==t.length,!h&&!c)return h;for(;y--;)if(d=m,g=e[y],c)for(;d--&&!(h=l(t[d],g,n,r,i,s)););else if(!(h=l(t[y],g,n,r,i,s)))break;return h}return ne(e,function(e,o,a){return D.call(a,o)?(y++,h=D.call(t,o)&&l(t[o],e,n,r,i,s)):void 0}),h&&!c&&ne(t,function(t,e,n){return D.call(n,e)?h=-1<--y:void 0}),g&&(a(i),a(s)),h}function p(t){return"function"==typeof t}function h(t){return!(!t||!T[typeof t])}function d(t){return"string"==typeof t||W.call(t)==L}function m(t,e,n){if(e&&"undefined"==typeof n&&Q(t)){n=-1;for(var r=t.length;++n3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),ne=c(G,M,{i:!1});p(/x/)&&(p=function(t){return"function"==typeof t&&"[object Function]"==W.call(t)}),u.assign=$,u.createCallback=function(t,e,n){if(null==t)return g;var r=typeof t;if("function"!=r){if("object"!=r)return function(e){return e[t]};var i=te(t);return function(e){for(var n=i.length,r=!1;n--&&(r=l(e[i[n]],t[i[n]],b)););return r}}return"undefined"==typeof e||w&&!w.test(R.call(t))?t:1===n?function(n){return t.call(e,n)}:2===n?function(n,r){return t.call(e,n,r)}:4===n?function(n,r,i,o){return t.call(e,n,r,i,o)}:function(n,r,i){return t.call(e,n,r,i)}},u.forEach=m,u.forIn=ne,u.keys=te,u.each=m,u.extend=$,u.identity=g,u.isArguments=f,u.isArray=Q,u.isEqual=l,u.isFunction=p,u.isObject=h,u.isString=d,u.VERSION="1.3.1","function"==typeof t&&"object"==typeof t.amd&&t.amd?(e._=u,t(function(){return u})):q&&!q.nodeType?B?(B.exports=u)._=u:q._=u:e._=u}(this)},{}],76:[function(t,e){"use strict";var n=t("lodash"),r=t("./lib/core"),i=t("./lib/helpers"),o=t("./lib/types");e.exports=n.extend({},r,i,o)},{"./lib/core":77,"./lib/helpers":78,"./lib/types":79,lodash:80}],77:[function(t,e,n){"use strict";function r(t){var e=t.prototype._NS+"|"+t.prototype._EL;c[e]=t,l[e]=t}function i(t){return u.serializeToString(t)}function o(t){var e,n={},r={constructor:!0,_EL:!0,_NS:!0,_extensions:!0,_name:!0,parent:!0,prototype:!0,toJSON:!0,toString:!0,xml:!0};for(e in t._extensions)t._extensions[e].toJSON&&(n[e]=t._extensions[e].toJSON());for(e in t)if(!r[e]&&!(f[t._NS+"|"+t._EL]||{})[e]&&!t._extensions[e]&&"_"!==e[0]){var i=t[e];if("function"==typeof i)continue;var o=Object.prototype.toString.call(i);o.indexOf("Object")>=0?Object.keys(i).length>0&&(n[e]=i):o.indexOf("Array")>=0?i.length>0&&(n[e]=i):i&&(n[e]=i)}return n}var a=t("underscore");t("./helpers").find;var s=t("./types"),u=new XMLSerializer,c={},f={},l={};n.build=function(t){var e=l[t.namespaceURI+"|"+t.localName];return e?new e(null,t):void 0},n.extend=function(t,e,r){var i=t.prototype._NS+"|"+t.prototype._EL,o=e.prototype._name,a=e.prototype._NS+"|"+e.prototype._EL;c[a]=e,f[a]||(f[a]={}),f[i]||(f[i]={}),f[i][o]=e,n.add(t,o,s.extension(e)),r&&n.add(t,r,s.multiExtension(e))},n.add=function(t,e,n){n.get&&t.prototype.__defineGetter__(e,n.get),n.set&&t.prototype.__defineSetter__(e,n.set)},n.define=function(t){var e=function(e,n){var r=this;return r.xml=n||document.createElementNS(r._NS,r._EL),r.xml.parentNode&&r.xml.parentNode.namespaceURI===r._NS||r.xml.setAttribute("xmlns",r._NS),r._extensions={},a.each(r.xml.childNodes,function(t){var e=t.namespaceURI+"|"+t.localName,n=c[e];if(void 0!==n){var i=n.prototype._name;r._extensions[i]=new n(null,t),r._extensions[i].parent=r}}),a.extend(r,e),t.init&&t.init(e),r};e.prototype={constructor:{value:e},_name:t.name,_eventname:t.eventName,_NS:t.namespace,_EL:t.element,toString:function(){return i(this.xml)},toJSON:function(){return o(this)}};var s=Object.keys(t.fields||{});return s.forEach(function(r){n.add(e,r,t.fields[r])}),t.topLevel&&r(e),e}},{"./helpers":78,"./types":79,underscore:95}],78:[function(t,e,n){"use strict";var r=t("underscore"),i="http://www.w3.org/XML/1998/namespace";n.getParser=function(){return new DOMParser},n.createElement=function(t,e,r){var i=document.createElementNS(t,e);return r&&r!==t&&n.setAttribute(i,"xmlns",t),i};var o=n.find=function(t,e,n){var i=t.querySelectorAll(n);return r.filter(i,function(n){return n.namespaceURI===e&&n.parentNode==t})};n.findOrCreate=function(t,e,r){var i=n.find(t,e,r);if(i.length)return i[0];var o=n.createElement(e,r,t.namespaceURI);return t.appendChild(o),o},n.getAttribute=function(t,e,n){return t.getAttribute(e)||n||""},n.setAttribute=function(t,e,n,r){n||r?t.setAttribute(e,n):t.removeAttribute(e)},n.getBoolAttribute=function(t,e,n){var r=t.getAttribute(e)||n||"";return"true"===r||"1"===r},n.setBoolAttribute=function(t,e,n){n?t.setAttribute(e,"1"):t.removeAttribute(e)},n.getSubAttribute=function(t,e,n,r,i){var a=o(t,e,n);if(!a)return"";for(var s=0;s-1?0:-1:t?0:-1}function a(t){var e=this.cache,n=typeof t;if("boolean"==n||null==t)e[t]=!0;else{"number"!=n&&"string"!=n&&(n="object");var r="number"==n?t:_+t,i=e[n]||(e[n]={});"object"==n?(i[r]||(i[r]=[])).push(t):i[r]=!0}}function s(t){return t.charCodeAt(0)}function u(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||"undefined"==typeof n)return 1;if(r>n||"undefined"==typeof r)return-1}return t.index-e.index}function c(t){var e=-1,n=t.length,r=t[0],i=t[0|n/2],o=t[n-1];if(r&&"object"==typeof r&&i&&"object"==typeof i&&o&&"object"==typeof o)return!1;var s=p();s["false"]=s["null"]=s["true"]=s.undefined=!1;var u=p();for(u.array=t,u.cache=s,u.push=a;++ei?0:i);++r-1:void 0}),g&&(d(i),d(o)),a}function S(t,e,n,r,i){(Hr(e)?We:ii)(e,function(e,o){var a,s,u=e,c=t[o];if(e&&((s=Hr(e))||oi(e))){for(var f=r.length;f--;)if(a=r[f]==e){c=i[f];break}if(!a){var l;n&&(u=n(c,e),(l="undefined"!=typeof u)&&(c=u)),l||(c=s?Hr(c)?c:[]:oi(c)?c:{}),r.push(e),i.push(c),l||S(c,e,n,r,i)}}else n&&(u=n(c,e),"undefined"==typeof u&&(u=e)),"undefined"!=typeof u&&(c=u);t[o]=c})}function K(t,n,r){var i=-1,a=ie(),s=t?t.length:0,u=[],f=!n&&s>=E&&a===e,p=r||f?l():u;if(f){var h=c(p);h?(a=o,p=h):(f=!1,p=r?p:(d(p),u))}for(;++i3&&"function"==typeof e[n-2])var r=a(e[--n-1],e[n--],2);else n>2&&"function"==typeof e[n-1]&&(r=e[--n]);for(var i=Pr.call(arguments,1,n),o=-1,s=l(),u=l();++on?Ur(0,o+n):n)||0,Hr(t)?a=i(t,e,n)>-1:"number"==typeof o?a=(Ce(t)?t.indexOf(e,n):i(t,e,n))>-1:ii(t,function(t){return++r>=n?!(a=t===e):void 0}),a}function ze(t,e,r){var i=!0;e=n.createCallback(e,r,3);var o=-1,a=t?t.length:0;if("number"==typeof a)for(;++oo&&(o=c)}else e=!e&&Ce(t)?s:n.createCallback(e,r,3),We(t,function(t,n,r){var a=e(t,n,r);a>i&&(i=a,o=t)});return o}function He(t,e,r){var i=1/0,o=i;if(!e&&Hr(t))for(var a=-1,u=t.length;++ac&&(o=c)}else e=!e&&Ce(t)?s:n.createCallback(e,r,3),We(t,function(t,n,r){var a=e(t,n,r);i>a&&(i=a,o=t)});return o}function Ve(t,e){var n=-1,r=t?t.length:0;if("number"==typeof r)for(var i=ir(r);++n=E&&r===e;if(u){var f=c(a);f?(r=o,a=f):u=!1}for(;++nr?Ur(0,i+r):r||0}else if(r){var o=wn(t,n);return t[o]===n?o:-1}return e(t,n,r)}function hn(t,e,r){var i=0,o=t?t.length:0;if("number"!=typeof e&&null!=e){var a=o;for(e=n.createCallback(e,r,3);a--&&e(t[a],a,t);)i++}else i=null==e||r?1:e||i;return g(t,0,zr(Ur(0,o-i),o))}function dn(t){for(var n=arguments,r=n.length,i=-1,a=l(),s=-1,u=ie(),f=t?t.length:0,p=[],h=l();++i=E&&c(i?n[i]:h)}t:for(;++sn?Ur(0,r+n):zr(n,r-1))+1);r--;)if(t[r]===e)return r;return-1}function vn(t){for(var e=arguments,n=0,r=e.length,i=t?t.length:0;++no;){var s=o+a>>>1;r(t[s])1?arguments:arguments[0],e=-1,n=t?Xe(Ve(t,"length")):0,r=ir(0>n?0:n);++e2?Z(t,17,Pr.call(arguments,2),null,e):Z(t,1,null,null,e)}function Cn(t){for(var e=arguments.length>1?b(arguments,!0,!1,1):de(t),n=-1,r=e.length;++n2?Z(e,19,Pr.call(arguments,2),null,t):Z(e,3,null,null,t)}function On(){for(var t=arguments,e=t.length;e--;)if(!Ee(t[e]))throw new hr;return function(){for(var e=arguments,n=t.length;n--;)e=[t[n].apply(this,e)];return e[0]}}function Ln(t,e,n){var r=typeof t;if(null==t||"function"==r)return a(t,e,n);if("object"!=r)return function(e){return e[t]};var i=Kr(t),o=i[0],s=t[o];return 1!=i.length||s!==s||Se(s)?function(e){for(var n=i.length,r=!1;n--&&(r=x(e[i[n]],t[i[n]],null,!0)););return r}:function(t){var e=t[o];return s===e&&(0!==s||1/s==1/e)}}function Tn(t,e){return e="number"==typeof e?e:+e||t.length,Z(t,4,null,null,null,e)}function qn(t,e,n){var r,i,o,a,s,u,c,f=0,l=!1,p=!0;if(!Ee(t))throw new hr;if(e=Ur(0,e)||0,n===!0){var h=!0;p=!1}else Se(n)&&(h=n.leading,l="maxWait"in n&&(Ur(e,n.maxWait)||0),p="trailing"in n?n.trailing:p);var d=function(){var n=e-(Sr()-a);if(0>=n){i&&br(i);var l=c;i=u=c=y,l&&(f=Sr(),o=t.apply(s,r))}else u=Ar(d,n)},m=function(){u&&br(u),i=u=c=y,(p||l!==e)&&(f=Sr(),o=t.apply(s,r))};return function(){if(r=arguments,a=Sr(),s=this,c=p&&(u||!h),l===!1)var n=h&&!u; -else{i||h||(f=a);var g=l-(a-f);0>=g?(i&&(i=br(i)),f=a,o=t.apply(s,r)):i||(i=Ar(m,g))}return u||e===l||(u=Ar(d,e)),n&&(o=t.apply(s,r)),o}}function Bn(t){if(!Ee(t))throw new hr;var e=Pr.call(arguments,1);return Ar(function(){t.apply(y,e)},1)}function Mn(t,e){if(!Ee(t))throw new hr;var n=Pr.call(arguments,2);return Ar(function(){t.apply(y,n)},e)}function Fn(t,e){if(!Ee(t))throw new hr;var n=function(){var r=n.cache,i=e?e.apply(this,arguments):_+arguments[0];return Er.call(r,i)?r[i]:r[i]=t.apply(this,arguments)};return n.cache={},n}function Un(t){var e,n;if(!Ee(t))throw new hr;return function(){return e?n:(e=!0,n=t.apply(this,arguments),t=null,n)}}function zn(t){return Z(t,16,Pr.call(arguments,1))}function Rn(t){return Z(t,32,null,Pr.call(arguments,1))}function Dn(t,e,n){var r=!0,i=!0;if(!Ee(t))throw new hr;n===!1?r=!1:Se(n)&&(r="leading"in n?n.leading:r,i="trailing"in n?n.trailing:i),n=p(),n.leading=r,n.maxWait=e,n.trailing=i;var o=qn(t,e,n);return m(n),o}function Pn(t,e){if(!Ee(e))throw new hr;return function(){var n=[t];return jr.apply(n,arguments),e.apply(this,n)}}function Wn(t){return null==t?"":pr(t).replace(ti,re)}function Jn(t){return t}function Gn(t,e){var i=t,o=!e||Ee(i);e||(i=r,e=t,t=n),We(de(e),function(n){var r=t[n]=e[n];o&&(i.prototype[n]=function(){var e=this.__wrapped__,n=[e];jr.apply(n,arguments);var o=r.apply(t,n);return e&&"object"==typeof e&&e===o?this:new i(o)})})}function $n(){return t._=gr,this}function Xn(t,e,n){var r=null==t,i=null==e;null==n&&("boolean"==typeof t&&i?(n=t,t=1):i||"boolean"!=typeof e||(n=e,i=!0)),r&&i&&(e=1),t=+t||0,i?(e=t,t=0):e=+e||0;var o=Dr();return n||t%1||e%1?t+zr(o*(e-t+parseFloat("1e-"+((o+"").length-1))),e):t+xr(o*(e-t+1))}function Hn(t,e){if(t){var n=t[e];return Ee(n)?t[e]():n}}function Vn(t,e,r){var i=n.templateSettings;t||(t=""),r=ni({},r,i);var o,a=ni({},r.imports,i.imports),s=Kr(a),u=Me(a),c=0,l=r.interpolate||q,p="__p += '",h=lr((r.escape||q).source+"|"+l.source+"|"+(l===L?C:q).source+"|"+(r.evaluate||q).source+"|$","g");t.replace(h,function(e,n,r,i,a,s){return r||(r=i),p+=t.slice(c,s).replace(M,f),n&&(p+="' +\n__e("+n+") +\n'"),a&&(o=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=s+e.length,e}),p+="';\n";var d=r.variable,m=d;m||(d="obj",p="with ("+d+") {\n"+p+"\n}\n"),p=(o?p.replace(k,""):p).replace(A,"$1").replace(I,"$1;"),p="function("+d+") {\n"+(m?"":d+" || ("+d+" = {});\n")+"var __t, __p = '', __e = _.escape"+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g="\n/*\n//# sourceURL="+(r.sourceURL||"/lodash/template/source["+U++ +"]")+"\n*/";try{var v=sr(s,"return "+p+g).apply(y,u)}catch(b){throw b.source=p,b}return e?v(e):(v.source=p,v)}function Kn(t,e,n){t=(t=+t)>-1?t:0;var r=-1,i=ir(t);for(e=a(e,n,1);++r/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:L,variable:"",imports:{_:n}};var Xr=Or?function(t,e){var n=p();n.value=e,Or(t,"__bindData__",n),m(n)}:h,Hr=qr||function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Cr.call(t)==R||!1},Vr=function(t){var e,n=t,r=[];if(!n)return r;if(!V[typeof t])return r;for(e in n)Er.call(n,e)&&r.push(e);return r},Kr=Fr?function(t){return Se(t)?Fr(t):[]}:Vr,Yr={"&":"&","<":"<",">":">",'"':""","'":"'"},Qr=ge(Yr),Zr=lr("("+Kr(Qr).join("|")+")","g"),ti=lr("["+Kr(Yr).join("")+"]","g"),ei=function(t,e,n){var r,i=t,o=i;if(!i)return o;var s=arguments,u=0,c="number"==typeof n?2:s.length;if(c>3&&"function"==typeof s[c-2])var f=a(s[--c-1],s[c--],2);else c>2&&"function"==typeof s[c-1]&&(f=s[--c]);for(;++u/g,T=RegExp("^["+j+"]*0+(?=.$)"),q=/($^)/,B=/\bthis\b/,M=/['\n\r\t\u2028\u2029\\]/g,F=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setImmediate","setTimeout"],U=0,z="[object Arguments]",R="[object Array]",D="[object Boolean]",P="[object Date]",W="[object Function]",J="[object Number]",G="[object Object]",$="[object RegExp]",X="[object String]",H={};H[W]=!1,H[z]=H[R]=H[D]=H[P]=H[J]=H[G]=H[$]=H[X]=!0;var V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},K={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},Y=V[typeof window]&&window||this,Q=V[typeof r]&&r&&!r.nodeType&&r,Z=V[typeof n]&&n&&!n.nodeType&&n,te=Z&&Z.exports===Q&&Q,ee=V[typeof i]&&i;!ee||ee.global!==ee&&ee.window!==ee||(Y=ee);var ne=v();"function"==typeof t&&"object"==typeof t.amd&&t.amd?(Y._=ne,t(function(){return ne})):Q&&Z?te?(Z.exports=ne)._=ne:Q._=ne:Y._=ne}.call(this)},{}],81:[function(e,n){var r=e("__browserify_Buffer").Buffer;!function(){function i(t,e,n){var r=e&&n||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){16>i&&(e[r+i++]=g[t])});16>i;)e[r+i++]=0;return e}function o(t,e){var n=e||0,r=m;return r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]}function a(t,e,n){var r=e&&n||0,i=e||[];t=t||{};var a=null!=t.clockseq?t.clockseq:x,s=null!=t.msecs?t.msecs:(new Date).getTime(),u=null!=t.nsecs?t.nsecs:_+1,c=s-w+(u-_)/1e4;if(0>c&&null==t.clockseq&&(a=16383&a+1),(0>c||s>w)&&null==t.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");w=s,_=u,x=a,s+=122192928e5;var f=(1e4*(268435455&s)+u)%4294967296;i[r++]=255&f>>>24,i[r++]=255&f>>>16,i[r++]=255&f>>>8,i[r++]=255&f;var l=268435455&1e4*(s/4294967296);i[r++]=255&l>>>8,i[r++]=255&l,i[r++]=16|15&l>>>24,i[r++]=255&l>>>16,i[r++]=128|a>>>8,i[r++]=255&a;for(var p=t.node||b,h=0;6>h;h++)i[r+h]=p[h];return e?e:o(i)}function s(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new d(16):null,t=null),t=t||{};var i=t.random||(t.rng||u)();if(i[6]=64|15&i[6],i[8]=128|63&i[8],e)for(var a=0;16>a;a++)e[r+a]=i[a];return e||o(i)}var u,c=this;if("function"==typeof e)try{var f=e("crypto").randomBytes;u=f&&function(){return f(16)}}catch(l){}if(!u&&c.crypto&&crypto.getRandomValues){var p=new Uint8Array(16);u=function(){return crypto.getRandomValues(p),p}}if(!u){var h=new Array(16);u=function(){for(var t,e=0;16>e;e++)0===(3&e)&&(t=4294967296*Math.random()),h[e]=255&t>>>((3&e)<<3);return h}}for(var d="function"==typeof r?r:Array,m=[],g={},v=0;256>v;v++)m[v]=(v+256).toString(16).substr(1),g[m[v]]=v;var y=u(),b=[1|y[0],y[1],y[2],y[3],y[4],y[5]],x=16383&(y[6]<<8|y[7]),w=0,_=0,E=s;if(E.v1=a,E.v4=s,E.parse=i,E.unparse=o,E.BufferClass=d,c.define&&t.amd)t(function(){return E});else if("undefined"!=typeof n&&n.exports)n.exports=E;else{var S=c.uuid;E.noConflict=function(){return c.uuid=S,E},c.uuid=E}}()},{__browserify_Buffer:67,crypto:62}],82:[function(t,e,n){function r(t){c.call(this),this.registry=new Object,this.insureids=0,this.freq=void 0===t?5:t,this.run=!1,this.start()}function i(t,e,n,r){void 0===r&&(++this.insureids,this.insureids%=65e3,r=this.insureids),expiretime=Date.now()+1e3*e;var i=this,o={paddle:i,error_callback:t,args:n,id:r,timeout:expiretime,done:!1,check_in:function(){return this.paddle.check_in(this.id)}};return this.registry[r]=o,o}function o(t){return void 0!==t.id&&(t=t.id),t in this.registry?(this.emit("check_in",this.registry[t]),this.registry[t].done=!0,delete this.registry[t],!0):!1}function a(){var t=Date.now();for(var e in this.registry)t>this.registry[e].timeout&&(this.registry[e].error_callback.apply(this,this.registry[e].args),this.emit("timeout",this.registry[e]),delete this.registry[e]);this.run&&setTimeout(function(){this.checkEnsures()}.bind(this),1e3*this.freq)}function s(t){return void 0!==t&&(this.freq=t),this.run?!1:(this.run=!0,setTimeout(function(){this.checkEnsures()}.bind(this),1e3*this.freq),!0)}function u(){return this.run?(this.run=!1,!0):!0}var c=t("events").EventEmitter;r.super_=c,r.prototype=Object.create(c.prototype,{constructor:{value:r,enumerable:!1}}),r.prototype.insure=i,r.prototype.check_in=o,r.prototype.checkEnsures=a,r.prototype.start=s,r.prototype.stop=u,n.Paddle=r},{events:57}],83:[function(e,n,r){!function(e,i){"object"==typeof r?i(r,n):"function"==typeof t&&t.amd&&t(["exports","module"],i)}(this,function(t,e){function n(){}n.prototype.name="ANONYMOUS",n.prototype.clientFirst=!0,n.prototype.response=function(t){return t.trace||""},n.prototype.challenge=function(){},t=e.exports=n})},{}],84:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("./lib/mechanism")):"function"==typeof t&&t.amd&&t(["exports","module","./lib/mechanism"],o)}(this,function(t,e,n){t=e.exports=n,t.Mechanism=n})},{"./lib/mechanism":83}],85:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("crypto")):"function"==typeof t&&t.amd&&t(["exports","module","crypto"],o)}(this,function(t,e,n){function r(t){t=t||{},this._genNonce=t.genNonce||o(32)}function i(t){for(var e={},n=t.split(/,(?=(?:[^"]|"[^"]*")*$)/),r=0,i=n.length;i>r;r++){var o=/(\w+)=["]?([^"]+)["]?$/.exec(n[r]);o&&(e[o[1]]=o[2])}return e}function o(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length;return function(){for(var r=[],i=0;t>i;++i)r.push(e[0|Math.random()*n]);return r.join("")}}function a(t,e){return n.createHash("md5").update(t).digest(e||"hex")}r.prototype.name="DIGEST-MD5",r.prototype.clientFirst=!1,r.prototype.response=function(t){var e=t.serviceType+"/"+t.host;t.serviceName&&t.host!==t.serviceName&&(e+="/"+serviceName);var n,r,i,o=t.realm||this._realm||"",s=this._genNonce(),u="00000001",c="auth",f="";return f+='username="'+t.username+'"',o&&(f+=',realm="'+o+'"'),f+=',nonce="'+this._nonce+'"',f+=',cnonce="'+s+'"',f+=",nc="+u,f+=",qop="+c,f+=',digest-uri="'+e+'"',n=t.authzid?a(a(t.username+":"+o+":"+t.password,"binary")+":"+this._nonce+":"+s+":"+t.authzid):a(a(t.username+":"+o+":"+t.password,"binary")+":"+this._nonce+":"+s),"auth"==c?r=a("AUTHENTICATE:"+e):("auth-int"==c||"auth-conf"==c)&&(r=a("AUTHENTICATE:"+e+":00000000000000000000000000000000")),i=a(n+":"+this._nonce+":"+u+":"+s+":"+c+":"+r),f+=",response="+i,"utf-8"==this._charset&&(f+=",charset=utf-8"),t.authzid&&(f+='authzid="'+t.authzid+'"'),f},r.prototype.challenge=function(t){var e=i(t);return this._realm=e.realm,this._nonce=e.nonce,this._qop=(e.qop||"auth").split(","),this._stale=e.stale,this._maxbuf=parseInt(e.maxbuf)||65536,this._charset=e.charset,this._algo=e.algorithm,this._cipher=e.cipher,this._cipher&&this._cipher.split(","),this},t=e.exports=r})},{crypto:62}],86:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("./lib/mechanism")):"function"==typeof t&&t.amd&&t(["exports","module","./lib/mechanism"],o)}(this,function(t,e,n){t=e.exports=n,t.Mechanism=n})},{"./lib/mechanism":85}],87:[function(e,n,r){!function(e,i){"object"==typeof r?i(r,n):"function"==typeof t&&t.amd&&t(["exports","module"],i)}(this,function(t,e){function n(){}n.prototype.name="EXTERNAL",n.prototype.clientFirst=!0,n.prototype.response=function(t){return t.authzid||""},n.prototype.challenge=function(){},t=e.exports=n})},{}],88:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("./lib/mechanism")):"function"==typeof t&&t.amd&&t(["exports","module","./lib/mechanism"],o)}(this,function(t,e,n){t=e.exports=n,t.Mechanism=n})},{"./lib/mechanism":87}],89:[function(e,n,r){!function(e,i){"object"==typeof r?i(r,n):"function"==typeof t&&t.amd&&t(["exports","module"],i)}(this,function(t,e){function n(){}n.prototype.name="PLAIN",n.prototype.clientFirst=!0,n.prototype.response=function(t){var e="";return e+=t.authzid||"",e+="\0",e+=t.username,e+="\0",e+=t.password},n.prototype.challenge=function(){return this},t=e.exports=n})},{}],90:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("./lib/mechanism")):"function"==typeof t&&t.amd&&t(["exports","module","./lib/mechanism"],o)}(this,function(t,e,n){t=e.exports=n,t.Mechanism=n})},{"./lib/mechanism":89}],91:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("crypto"),e("buffer")):"function"==typeof t&&t.amd&&t(["exports","module","crypto","buffer"],o)}(this,function(t,e,n,r){function i(t){t=t||{},this._genNonce=t.genNonce||l(32),this._stage=0}function o(t,e){return n.createHmac("sha1",t).update(e).digest("binary")}function a(t,e,n){for(var r=o(t,e+"\0\0\0"),i=r,a=0;n-1>a;a++)r=o(t,r),i=u(i,r);return i}function s(t){return n.createHash("sha1").update(t).digest("binary")}function u(t,e){t=new p(t,"binary"),e=new p(e,"binary");var n=Math.min(t.length,e.length);result=[];for(var r=0;n>r;r++)result.push(t[r]^e[r]);return result=new p(result,"binary"),result.toString("binary")}function c(t){for(var e=[],n="",r=0;rr;r++){var o=/(\w+)=["]?([^"]+)["]?$/.exec(n[r]);o&&(e[o[1]]=o[2])}return e}function l(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length;return function(){for(var r=[],i=0;t>i;++i)r.push(e[0|Math.random()*n]);return r.join("")}}var p=r.Buffer;i.prototype.name="SCRAM-SHA-1",i.prototype.clientFirst=!0,i.prototype.response=function(t){return h[this._stage](this,t)},i.prototype.challenge=function(t){var e=f(t);return this._salt=new p(e.s||"","base64").toString("binary"),this._iterationCount=parseInt(e.i,10),this._nonce=e.r,this._verifier=e.v,this._error=e.e,this._challenge=t,this};var h={};h[0]=function(t,e){t._cnonce=t._genNonce();var n="";e.authzid&&(n="a="+c(e.authzid)),t._gs2Header="n,"+n+",";var r="r="+t._cnonce,i="n="+c(e.username);t._clientFirstMessageBare=i+","+r;var o=t._gs2Header+t._clientFirstMessageBare;return t._stage=1,o},h[1]=function(t,e){var n=new p(t._gs2Header).toString("base64");t._clientFinalMessageWithoutProof="c="+n+",r="+t._nonce;var r,i,c;e.clientKey&&e.serverKey?(i=e.clientKey,c=e.serverKey):(r=e.saltedPassword||a(e.password,t._salt,t._iterationCount),i=o(r,"Client Key"),c=o(r,"Server Key"));var f=s(i),l=t._clientFirstMessageBare+","+t._challenge+","+t._clientFinalMessageWithoutProof,h=o(f,l),d=u(i,h),m=new p(d,"binary").toString("base64");t._serverSignature=o(c,l);var g=t._clientFinalMessageWithoutProof+",p="+m;return t._stage=2,t.cache={saltedPassword:r,clientKey:i,serverKey:c},g},h[2]=function(){return""},t=e.exports=i})},{buffer:60,crypto:62}],92:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("./lib/mechanism")):"function"==typeof t&&t.amd&&t(["exports","module","./lib/mechanism"],o)}(this,function(t,e,n){t=e.exports=n,t.Mechanism=n})},{"./lib/mechanism":91}],93:[function(e,n,r){!function(e,i){"object"==typeof r?i(r,n):"function"==typeof t&&t.amd&&t(["exports","module"],i)}(this,function(t,e){function n(){this._mechs=[]}n.prototype.use=function(t,e){return e||(e=t,t=e.prototype.name),this._mechs.push({name:t,mech:e}),this},n.prototype.create=function(t){for(var e=0,n=this._mechs.length;n>e;e++)for(var r=0,i=t.length;i>r;r++){var o=this._mechs[e];if(o.name==t[r])return new o.mech}return null},t=e.exports=n})},{}],94:[function(e,n,r){!function(i,o){"object"==typeof r?o(r,n,e("./lib/factory")):"function"==typeof t&&t.amd&&t(["exports","module","./lib/factory"],o)}(this,function(t,e,n){t=e.exports=n,t.Factory=n})},{"./lib/factory":93}],95:[function(t,e,n){!function(){var t=this,r=t._,i={},o=Array.prototype,a=Object.prototype,s=Function.prototype,u=o.push,c=o.slice,f=o.concat,l=a.toString,p=a.hasOwnProperty,h=o.forEach,d=o.map,m=o.reduce,g=o.reduceRight,v=o.filter,y=o.every,b=o.some,x=o.indexOf,w=o.lastIndexOf,_=Array.isArray,E=Object.keys,S=s.bind,j=function(t){return t instanceof j?t:this instanceof j?(this._wrapped=t,void 0):new j(t)};"undefined"!=typeof n?("undefined"!=typeof e&&e.exports&&(n=e.exports=j),n._=j):t._=j,j.VERSION="1.5.2";var k=j.each=j.forEach=function(t,e,n){if(null!=t)if(h&&t.forEach===h)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,o=t.length;o>r;r++)if(e.call(n,t[r],r,t)===i)return}else for(var a=j.keys(t),r=0,o=a.length;o>r;r++)if(e.call(n,t[a[r]],a[r],t)===i)return};j.map=j.collect=function(t,e,n){var r=[];return null==t?r:d&&t.map===d?t.map(e,n):(k(t,function(t,i,o){r.push(e.call(n,t,i,o))}),r)};var A="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),m&&t.reduce===m)return r&&(e=j.bind(e,r)),i?t.reduce(e,n):t.reduce(e);if(k(t,function(t,o,a){i?n=e.call(r,n,t,o,a):(n=t,i=!0)}),!i)throw new TypeError(A);return n},j.reduceRight=j.foldr=function(t,e,n,r){var i=arguments.length>2;if(null==t&&(t=[]),g&&t.reduceRight===g)return r&&(e=j.bind(e,r)),i?t.reduceRight(e,n):t.reduceRight(e);var o=t.length;if(o!==+o){var a=j.keys(t);o=a.length}if(k(t,function(s,u,c){u=a?a[--o]:--o,i?n=e.call(r,n,t[u],u,c):(n=t[u],i=!0)}),!i)throw new TypeError(A);return n},j.find=j.detect=function(t,e,n){var r;return I(t,function(t,i,o){return e.call(n,t,i,o)?(r=t,!0):void 0}),r},j.filter=j.select=function(t,e,n){var r=[];return null==t?r:v&&t.filter===v?t.filter(e,n):(k(t,function(t,i,o){e.call(n,t,i,o)&&r.push(t)}),r)},j.reject=function(t,e,n){return j.filter(t,function(t,r,i){return!e.call(n,t,r,i)},n)},j.every=j.all=function(t,e,n){e||(e=j.identity);var r=!0;return null==t?r:y&&t.every===y?t.every(e,n):(k(t,function(t,o,a){return(r=r&&e.call(n,t,o,a))?void 0:i}),!!r)};var I=j.some=j.any=function(t,e,n){e||(e=j.identity);var r=!1;return null==t?r:b&&t.some===b?t.some(e,n):(k(t,function(t,o,a){return r||(r=e.call(n,t,o,a))?i:void 0}),!!r)};j.contains=j.include=function(t,e){return null==t?!1:x&&t.indexOf===x?-1!=t.indexOf(e):I(t,function(t){return t===e})},j.invoke=function(t,e){var n=c.call(arguments,2),r=j.isFunction(e);return j.map(t,function(t){return(r?e:t[e]).apply(t,n)})},j.pluck=function(t,e){return j.map(t,function(t){return t[e]})},j.where=function(t,e,n){return j.isEmpty(e)?n?void 0:[]:j[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},j.findWhere=function(t,e){return j.where(t,e,!0)},j.max=function(t,e,n){if(!e&&j.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&j.isEmpty(t))return-1/0;var r={computed:-1/0,value:-1/0};return k(t,function(t,i,o){var a=e?e.call(n,t,i,o):t;a>r.computed&&(r={value:t,computed:a})}),r.value},j.min=function(t,e,n){if(!e&&j.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&j.isEmpty(t))return 1/0;var r={computed:1/0,value:1/0};return k(t,function(t,i,o){var a=e?e.call(n,t,i,o):t;ar||void 0===n)return 1;if(r>n||void 0===r)return-1}return t.index-e.index}),"value")};var N=function(t){return function(e,n,r){var i={},o=null==n?j.identity:C(n);return k(e,function(n,a){var s=o.call(r,n,a,e);t(i,s,n)}),i}};j.groupBy=N(function(t,e,n){(j.has(t,e)?t[e]:t[e]=[]).push(n)}),j.indexBy=N(function(t,e,n){t[e]=n}),j.countBy=N(function(t,e){j.has(t,e)?t[e]++:t[e]=1}),j.sortedIndex=function(t,e,n,r){n=null==n?j.identity:C(n);for(var i=n.call(r,e),o=0,a=t.length;a>o;){var s=o+a>>>1;n.call(r,t[s])=0})})},j.difference=function(t){var e=f.apply(o,c.call(arguments,1));return j.filter(t,function(t){return!j.contains(e,t)})},j.zip=function(){for(var t=j.max(j.pluck(arguments,"length").concat(0)),e=new Array(t),n=0;t>n;n++)e[n]=j.pluck(arguments,""+n);return e},j.object=function(t,e){if(null==t)return{};for(var n={},r=0,i=t.length;i>r;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n},j.indexOf=function(t,e,n){if(null==t)return-1;var r=0,i=t.length;if(n){if("number"!=typeof n)return r=j.sortedIndex(t,e),t[r]===e?r:-1;r=0>n?Math.max(0,i+n):n}if(x&&t.indexOf===x)return t.indexOf(e,n);for(;i>r;r++)if(t[r]===e)return r;return-1},j.lastIndexOf=function(t,e,n){if(null==t)return-1;var r=null!=n;if(w&&t.lastIndexOf===w)return r?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var i=r?n:t.length;i--;)if(t[i]===e)return i;return-1},j.range=function(t,e,n){arguments.length<=1&&(e=t||0,t=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((e-t)/n),0),i=0,o=new Array(r);r>i;)o[i++]=t,t+=n;return o};var L=function(){};j.bind=function(t,e){var n,r;if(S&&t.bind===S)return S.apply(t,c.call(arguments,1));if(!j.isFunction(t))throw new TypeError;return n=c.call(arguments,2),r=function(){if(!(this instanceof r))return t.apply(e,n.concat(c.call(arguments)));L.prototype=t.prototype;var i=new L;L.prototype=null;var o=t.apply(i,n.concat(c.call(arguments)));return Object(o)===o?o:i}},j.partial=function(t){var e=c.call(arguments,1);return function(){return t.apply(this,e.concat(c.call(arguments)))}},j.bindAll=function(t){var e=c.call(arguments,1);if(0===e.length)throw new Error("bindAll must be passed function names");return k(e,function(e){t[e]=j.bind(t[e],t)}),t},j.memoize=function(t,e){var n={};return e||(e=j.identity),function(){var r=e.apply(this,arguments);return j.has(n,r)?n[r]:n[r]=t.apply(this,arguments)}},j.delay=function(t,e){var n=c.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},j.defer=function(t){return j.delay.apply(j,[t,1].concat(c.call(arguments,1)))},j.throttle=function(t,e,n){var r,i,o,a=null,s=0;n||(n={});var u=function(){s=n.leading===!1?0:new Date,a=null,o=t.apply(r,i)};return function(){var c=new Date;s||n.leading!==!1||(s=c);var f=e-(c-s);return r=this,i=arguments,0>=f?(clearTimeout(a),a=null,s=c,o=t.apply(r,i)):a||n.trailing===!1||(a=setTimeout(u,f)),o}},j.debounce=function(t,e,n){var r,i,o,a,s;return function(){o=this,i=arguments,a=new Date;var u=function(){var c=new Date-a;e>c?r=setTimeout(u,e-c):(r=null,n||(s=t.apply(o,i)))},c=n&&!r;return r||(r=setTimeout(u,e)),c&&(s=t.apply(o,i)),s}},j.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},j.wrap=function(t,e){return function(){var n=[t];return u.apply(n,arguments),e.apply(this,n)}},j.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},j.after=function(t,e){return function(){return--t<1?e.apply(this,arguments):void 0}},j.keys=E||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)j.has(t,n)&&e.push(n);return e},j.values=function(t){for(var e=j.keys(t),n=e.length,r=new Array(n),i=0;n>i;i++)r[i]=t[e[i]];return r},j.pairs=function(t){for(var e=j.keys(t),n=e.length,r=new Array(n),i=0;n>i;i++)r[i]=[e[i],t[e[i]]];return r},j.invert=function(t){for(var e={},n=j.keys(t),r=0,i=n.length;i>r;r++)e[t[n[r]]]=n[r];return e},j.functions=j.methods=function(t){var e=[];for(var n in t)j.isFunction(t[n])&&e.push(n);return e.sort()},j.extend=function(t){return k(c.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},j.pick=function(t){var e={},n=f.apply(o,c.call(arguments,1));return k(n,function(n){n in t&&(e[n]=t[n])}),e},j.omit=function(t){var e={},n=f.apply(o,c.call(arguments,1));for(var r in t)j.contains(n,r)||(e[r]=t[r]);return e},j.defaults=function(t){return k(c.call(arguments,1),function(e){if(e)for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t},j.clone=function(t){return j.isObject(t)?j.isArray(t)?t.slice():j.extend({},t):t},j.tap=function(t,e){return e(t),t};var T=function(t,e,n,r){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof j&&(t=t._wrapped),e instanceof j&&(e=e._wrapped);var i=l.call(t);if(i!=l.call(e))return!1;switch(i){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var o=n.length;o--;)if(n[o]==t)return r[o]==e;var a=t.constructor,s=e.constructor;if(a!==s&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(s)&&s instanceof s))return!1;n.push(t),r.push(e);var u=0,c=!0;if("[object Array]"==i){if(u=t.length,c=u==e.length)for(;u--&&(c=T(t[u],e[u],n,r)););}else{for(var f in t)if(j.has(t,f)&&(u++,!(c=j.has(e,f)&&T(t[f],e[f],n,r))))break;if(c){for(f in e)if(j.has(e,f)&&!u--)break;c=!u}}return n.pop(),r.pop(),c};j.isEqual=function(t,e){return T(t,e,[],[])},j.isEmpty=function(t){if(null==t)return!0;if(j.isArray(t)||j.isString(t))return 0===t.length;for(var e in t)if(j.has(t,e))return!1;return!0},j.isElement=function(t){return!(!t||1!==t.nodeType)},j.isArray=_||function(t){return"[object Array]"==l.call(t)},j.isObject=function(t){return t===Object(t)},k(["Arguments","Function","String","Number","Date","RegExp"],function(t){j["is"+t]=function(e){return l.call(e)=="[object "+t+"]"}}),j.isArguments(arguments)||(j.isArguments=function(t){return!(!t||!j.has(t,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(t){return"function"==typeof t}),j.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t)) -},j.isNaN=function(t){return j.isNumber(t)&&t!=+t},j.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==l.call(t)},j.isNull=function(t){return null===t},j.isUndefined=function(t){return void 0===t},j.has=function(t,e){return p.call(t,e)},j.noConflict=function(){return t._=r,this},j.identity=function(t){return t},j.times=function(t,e,n){for(var r=Array(Math.max(0,t)),i=0;t>i;i++)r[i]=e.call(n,i);return r},j.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var q={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};q.unescape=j.invert(q.escape);var B={escape:new RegExp("["+j.keys(q.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(q.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(t){j[t]=function(e){return null==e?"":(""+e).replace(B[t],function(e){return q[t][e]})}}),j.result=function(t,e){if(null==t)return void 0;var n=t[e];return j.isFunction(n)?n.call(t):n},j.mixin=function(t){k(j.functions(t),function(e){var n=j[e]=t[e];j.prototype[e]=function(){var t=[this._wrapped];return u.apply(t,arguments),R.call(this,n.apply(j,t))}})};var M=0;j.uniqueId=function(t){var e=++M+"";return t?t+e:e},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var F=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(t,e,n){var r;n=j.defaults({},n,j.templateSettings);var i=new RegExp([(n.escape||F).source,(n.interpolate||F).source,(n.evaluate||F).source].join("|")+"|$","g"),o=0,a="__p+='";t.replace(i,function(e,n,r,i,s){return a+=t.slice(o,s).replace(z,function(t){return"\\"+U[t]}),n&&(a+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(a+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(a+="';\n"+i+"\n__p+='"),o=s+e.length,e}),a+="';\n",n.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{r=new Function(n.variable||"obj","_",a)}catch(s){throw s.source=a,s}if(e)return r(e,j);var u=function(t){return r.call(this,t,j)};return u.source="function("+(n.variable||"obj")+"){\n"+a+"}",u},j.chain=function(t){return j(t).chain()};var R=function(t){return this._chain?j(t).chain():t};j.mixin(j),k(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=o[t];j.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],R.call(this,n)}}),k(["concat","join","slice"],function(t){var e=o[t];j.prototype[t]=function(){return R.call(this,e.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this)},{}],96:[function(t,e){function n(){this.callbacks={}}e.exports=n,n.prototype.on=function(t){var e=3===arguments.length,n=e?arguments[1]:void 0,r=e?arguments[2]:arguments[1];return r._groupName=n,(this.callbacks[t]=this.callbacks[t]||[]).push(r),this},n.prototype.once=function(t){function e(){n.off(t,e),o.apply(this,arguments)}var n=this,r=3===arguments.length,i=r?arguments[1]:void 0,o=r?arguments[2]:arguments[1];return this.on(t,i,e),this},n.prototype.releaseGroup=function(t){var e,n,r,i;for(e in this.callbacks)for(i=this.callbacks[e],n=0,r=i.length;r>n;n++)i[n]._groupName===t&&(i.splice(n,1),n--,r--);return this},n.prototype.off=function(t,e){var n,r=this.callbacks[t];return r?1===arguments.length?(delete this.callbacks[t],this):(n=r.indexOf(e),r.splice(n,1),this):this},n.prototype.emit=function(t){var e,n,r=[].slice.call(arguments,1),i=this.callbacks[t],o=this.getWildcardCallbacks(t);if(i)for(e=0,n=i.length;n>e&&i[e];++e)i[e].apply(this,r);if(o)for(e=0,n=o.length;n>e&&o[e];++e)o[e].apply(this,[t].concat(r));return this},n.prototype.getWildcardCallbacks=function(t){var e,n,r=[];for(e in this.callbacks)n=e.split("*"),("*"===e||2===n.length&&t.slice(0,n[1].length)===n[1])&&(r=r.concat(this.callbacks[e]));return r}},{}]},{},[1])(1)}); \ No newline at end of file diff --git a/clientapp/models/muc.js b/clientapp/models/muc.js index 8e3465c..a0ce7be 100644 --- a/clientapp/models/muc.js +++ b/clientapp/models/muc.js @@ -1,4 +1,4 @@ -/*global XMPP, app, me, client*/ +/*global app, me, client*/ "use strict"; var _ = require('underscore'); diff --git a/clientapp/pages/main.js b/clientapp/pages/main.js index c681db8..4f5f876 100644 --- a/clientapp/pages/main.js +++ b/clientapp/pages/main.js @@ -1,4 +1,4 @@ -/*global app, me, XMPP, client, Resample*/ +/*global app, me, client, Resample*/ "use strict"; var crypto = require('crypto'); diff --git a/package.json b/package.json index 9c1fd45..ac926f9 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "human-view": "1.1.2", "templatizer": "0.1.2", "underscore": "1.5.1", - "raf-component": "1.1.1" + "raf-component": "1.1.1", + "stanza.io": "2.3.1" }, "devDependencies": { "precommit-hook": "0.3.6" diff --git a/server.js b/server.js index 5536fee..89e2172 100644 --- a/server.js +++ b/server.js @@ -20,13 +20,12 @@ app.use(helmet.contentTypeOptions()); var clientApp = new Moonboots({ main: __dirname + '/clientapp/app.js', templateFile: __dirname + '/clientapp/template.html', - developmentMode: config.isDev, + //developmentMode: config.isDev, libraries: [ __dirname + '/clientapp/libraries/zepto.js', __dirname + '/clientapp/libraries/ui.js', __dirname + '/clientapp/libraries/resampler.js', - __dirname + '/clientapp/libraries/IndexedDBShim.min.js', - __dirname + '/clientapp/libraries/stanza.io.js' + __dirname + '/clientapp/libraries/IndexedDBShim.min.js' ], stylesheets: [ __dirname + '/public/css/otalk.css'