Skip to content

Instantly share code, notes, and snippets.

@mailtoharshit
Created February 24, 2014 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mailtoharshit/9179867 to your computer and use it in GitHub Desktop.
Save mailtoharshit/9179867 to your computer and use it in GitHub Desktop.
!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.jsforce=a()}}(function(){var define,module,exports;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var d=a("underscore")._;a("./promise");var f=function(a,b){this._report=a,this._conn=a._conn,this.id=b};f.prototype.retrieve=function(a){var b=this._conn,c=this._report,d=[b._baseUrl(),"analytics","reports",c.id,"instances",this.id].join("/");return b._request(d).thenCall(a)};var g=function(a,b){this._conn=a,this.id=b};g.prototype.describe=function(a){var b=[this._conn._baseUrl(),"analytics","reports",this.id,"describe"].join("/");return this._conn._request(b).thenCall(a)},g.prototype.run=g.prototype.exec=g.prototype.execute=function(a,b){a=a||{},d.isFunction(a)&&(b=a,a={});var c=[this._conn._baseUrl(),"analytics","reports",this.id].join("/");a.details&&(c+="?includeDetails=true");var e={method:a.metadata?"POST":"GET",url:c};return a.metadata&&(e.headers={"Content-Type":"application/json"},e.body=JSON.stringify(a.metadata)),this._conn._request(e).thenCall(b)},g.prototype.executeAsync=function(a,b){a=a||{},d.isFunction(a)&&(b=a,a={});var c=[this._conn._baseUrl(),"analytics","reports",this.id,"instances"].join("/");a.details&&(c+="?includeDetails=true");var e={method:"POST",url:c,body:""};return a.metadata&&(e.headers={"Content-Type":"application/json"},e.body=JSON.stringify(a.metadata)),this._conn._request(e).thenCall(b)},g.prototype.instance=function(a){return new f(this,a)},g.prototype.instances=function(a){var b=[this._conn._baseUrl(),"analytics","reports",this.id,"instances"].join("/");return this._conn._request(b).thenCall(a)};var h=function(a){this._conn=a};h.prototype.report=function(a){return new g(this._conn,a)},h.prototype.reports=function(a){var b=[this._conn._baseUrl(),"analytics","reports"].join("/");return this._conn._request(b).thenCall(a)},b.exports=h},{"./promise":17,underscore:52}],2:[function(a,b){var d=function(a){this._conn=a};d.prototype._baseUrl=function(){return this._conn.instanceUrl+"/services/apexrest"},d.prototype._createRequestParams=function(a,b,c){var d={method:a,url:this._baseUrl()+b};return/^(GET|DELETE)$/i.test(a)||(d.headers={"Content-Type":"application/json"}),c&&(d.body=JSON.stringify(c)),d},d.prototype.get=function(a,b){return this._conn._request(this._createRequestParams("GET",a)).thenCall(b)},d.prototype.post=function(a,b,c){"function"==typeof b&&(c=b,b=void 0);var d=this._createRequestParams("POST",a,b);return this._conn._request(d).thenCall(c)},d.prototype.put=function(a,b,c){"function"==typeof b&&(c=b,b=void 0);var d=this._createRequestParams("PUT",a,b);return this._conn._request(d).thenCall(c)},d.prototype.patch=function(a,b,c){"function"==typeof b&&(c=b,b=void 0);var d=this._createRequestParams("PATCH",a,b);return this._conn._request(d).thenCall(c)},d.prototype.del=d.prototype["delete"]=function(a,b){return this._conn._request(this._createRequestParams("DELETE",a)).thenCall(b)},b.exports=d},{}],3:[function(a,b){function f(a){var b={};return a.split(/\n/).forEach(function(a){var c=a.split(/\s*:\s*/),d=c[0].toLowerCase(),e=c[1];b[d]=e}),b}var d=a("stream"),e=a("underscore");b.exports={supported:"object"==typeof Sfdc&&"undefined"!=typeof Sfdc.canvas,createRequest:function(a){return function(b,c){function k(d){var i={client:a.client,method:b.method,data:d};if(b.headers){i.headers={};for(var j in b.headers)"content-type"===j.toLowerCase()?i.contentType=b.headers[j]:i.headers[j]=b.headers[j]}i.success=function(a){var b=f(a.responseHeaders),d=a.payload;e.isString(d)||(d=JSON.stringify(d)),g={statusCode:a.status,headers:b,body:d},c&&c(null,g,g.body),h.end()},i.failure=function(a){c&&c(a)},Sfdc.canvas.client.ajax(b.url,i)}var g,h=new d.Duplex;h._read=function(){g&&h.push(g.body)};var i=[],j=!1;return h._write=function(a,b,c){i.push(a.toString(b)),c()},h.on("finish",function(){j||(k(i.join("")),j=!0)}),(b.body||""===b.body||!/^(put|post|patch)$/i.test(b.method))&&(k(b.body),j=!0),h}}}},{stream:42,underscore:52}],4:[function(a,b){function j(a,b,c){var d=screen.width/2-b/2,e=screen.height/2-c/2;return window.open(a,null,"toolbar=no,status=no,menubar=no,width="+b+",height="+c+",top="+e+",left="+d)}function k(a){var b;if(l(a))if(a.location.hash){if(b=f.parse(a.location.hash.substring(1)),b.access_token)return{success:!0,body:b}}else if(a.location.search&&(b=f.parse(a.location.search.substring(1)),b.error))return{success:!1,error:b}}function l(a){return location.origin?location.origin===a.location.origin:location.hostname===a.location.hostname&&location.port===a.location.port&&location.protocol===a.location.protocol}var d=a("events"),e=a("util"),f=a("querystring"),g=a("underscore"),h=a("../connection"),i=a("../oauth2"),m=0,n=function(){this._prefix="sf"+m++,this.connection=null};e.inherits(n,d.EventEmitter),n.prototype.init=function(a){this.config=a,this.connection=new h(a);var b=this._getTokens();if(b){this.connection.initialize(b);var c=this;setTimeout(function(){c.emit("connect",c.connection)},10)}},n.prototype.login=function(a,b){g.isFunction(a)&&(b=a,a={}),a=a||{},b=b||function(){},g.extend(a,this.config);var c=this,d=new i(a),e=Math.random().toString(36).substring(2),f=d.getAuthorizationUrl({response_type:"token",scope:a.scope,state:e}),h=a.popup||{},l=j(f,h.width||912,h.height||513),m=setInterval(function(){try{if(l.closed)clearInterval(m),b(null,{status:"cancel"});else{var a=k(l);if(l.close(),clearInterval(m),a.success&&a.body.state===e)c._storeTokens(a.body),c.connection.initialize({accessToken:a.body.access_token,instanceUrl:a.body.instance_url}),c.emit("connect",c.connection),b(null,{status:"connect",body:a.body});else if(!a.success){var d=new Error(a.error.error+": "+a.error.error_description);b(d)}}}catch(f){}},1e3)},n.prototype.isLoggedIn=function(){return!(!this.connection||!this.connection.accessToken)},n.prototype.logout=function(){this.connection.logout(),this._removeTokens(),this.emit("disconnect")},n.prototype._getTokens=function(){var a=new RegExp("(^|;\\s*)"+this._prefix+"_loggedin=true(;|$)");if(document.cookie.match(a)){var b=Number(localStorage.getItem(this._prefix+"_issued_at"));if(Date.now()<b+72e5)return{accessToken:localStorage.getItem(this._prefix+"_access_token"),instanceUrl:localStorage.getItem(this._prefix+"_instance_url")}}return null},n.prototype._storeTokens=function(a){localStorage.setItem(this._prefix+"_access_token",a.access_token),localStorage.setItem(this._prefix+"_instance_url",a.instance_url),localStorage.setItem(this._prefix+"_issued_at",a.issued_at),document.cookie=this._prefix+"_loggedin=true;"},n.prototype._removeTokens=function(){localStorage.removeItem(this._prefix+"_access_token"),localStorage.removeItem(this._prefix+"_instance_url"),localStorage.removeItem(this._prefix+"_issued_at"),document.cookie=this._prefix+"_loggedin="},b.exports=new n,b.exports.Client=n},{"../connection":10,"../oauth2":16,events:31,querystring:40,underscore:52,util:50}],5:[function(a,b){var d=0;b.exports={supported:"undefined"!=typeof window,createRequest:function(a,b){return a=a||"callback",b=b||1e4,function(c,e){if("GET"!==c.method.toUpperCase())return e(new Error("JSONP only supports GET request."));var f="_jsforce_jsonpCallback_"+ ++d,g=window,h=c.url;h+=h.indexOf("?")>0?"&":"?",h+=a+"="+f;var i=document.createElement("script");i.type="text/javascript",i.src=h,document.documentElement.appendChild(i);var j=setTimeout(function(){k(),e(new Error("JSONP call time out."))},b);g[f]=function(a){k(),e(null,{statusCode:200,headers:{"content-type":"application/json"},body:JSON.stringify(a)})};var k=function(){clearTimeout(j),document.documentElement.removeChild(i),delete g[f]}}}}},{}],6:[function(a,b){var d=a("stream");b.exports=function(a,b){var c=new XMLHttpRequest;if(c.open(a.method,a.url),a.headers)for(var e in a.headers)c.setRequestHeader(e,a.headers[e]);var f,g=new d.Duplex;g._read=function(){f&&g.push(f.body)};var h=[],i=!1;return g._write=function(a,b,c){h.push(a.toString(b)),c()},g.on("finish",function(){i||(c.send(h.join("")),i=!0)}),(a.body||""===a.body||!/^(put|post|patch)$/i.test(a.method))&&(c.send(a.body),i=!0),c.onreadystatechange=function(){if(4===c.readyState){var a={"content-type":c.getResponseHeader("content-type")};f={statusCode:c.status,headers:a,body:c.response},f.statusCode||(f.statusCode=400,f.body="Access Declined"),b&&b(null,f,f.body),g.end()}},g}},{stream:42}],7:[function(a,b){var d=a("util"),e=a("stream"),f=e.Stream,g=a("events"),h=a("underscore")._,j=(a("./connection"),a("./record-stream")),l=(a("./csv"),a("./promise")),m=function(a,b,c,d,e){this._bulk=a,this.type=b,this.operation=c,this.options=d||{},this.id=e,this.state=this.id?"Open":"Unknown",this._batches={}};d.inherits(m,g.EventEmitter),m.prototype.open=function(a){var b=this,c=this._bulk;if(c._logger,!this._jobInfo){var e=['<?xml version="1.0" encoding="UTF-8"?>','<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">',"<operation>"+this.operation.toLowerCase()+"</operation>","<object>"+this.type+"</object>",this.options.extIdField?"<externalIdFieldName>"+this.options.extIdField+"</externalIdFieldName>":"","<contentType>CSV</contentType>","</jobInfo>"].join("");this._jobInfo=c._request({method:"POST",path:"/job",body:e,headers:{"Content-Type":"application/xml; charset=utf-8"},responseType:"application/xml"}).then(function(a){return b.emit("open",a.jobInfo),b.id=a.jobInfo.id,b.state=a.jobInfo.state,a.jobInfo},function(a){throw b.emit("error",a),a})}return this._jobInfo.thenCall(a)},m.prototype.createBatch=function(){var a=new n(this),b=this;return a.on("queue",function(){b._batches[a.id]=a}),a},m.prototype.batch=function(a){var b=this._batches[a];return b||(b=new n(this,a),this._batches[a]=b),b},m.prototype.check=function(a){var b=this,c=this._bulk,d=c._logger;return this.open().then(function(){return c._request({method:"GET",path:"/job/"+b.id,responseType:"application/xml"})}).then(function(a){return d.debug(a.jobInfo),b.state=a.jobInfo.state,a.jobInfo}).thenCall(a)},m.prototype.list=function(a){var b=this,c=this._bulk,d=c._logger;return this.open().then(function(){return c._request({method:"GET",path:"/job/"+b.id+"/batch",responseType:"application/xml"})}).then(function(a){d.debug(a.batchInfoList.batchInfo);var b=a.batchInfoList;return b=h.isArray(b.batchInfo)?b.batchInfo:[b.batchInfo]}).thenCall(a)},m.prototype.close=function(){var a=this;return this._changeState("Closed").then(function(b){return a.id=null,a.emit("close",b),b},function(b){throw a.emit("error",b),b})},m.prototype.abort=function(){var a=this;return this._changeState("Aborted").then(function(b){return a.id=null,a.emit("abort",b),a.state="Aborted",b},function(b){throw a.emit("error",b),b})},m.prototype._changeState=function(a,b){var c=this,d=this._bulk,e=d._logger;return this.open().then(function(){var b=['<?xml version="1.0" encoding="UTF-8"?>','<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">',"<state>"+a+"</state>","</jobInfo>"].join("");return d._request({method:"POST",path:"/job/"+c.id,body:b,headers:{"Content-Type":"application/xml; charset=utf-8"},responseType:"application/xml"})}).then(function(a){return e.debug(a.jobInfo),c.state=a.jobInfo.state,a.jobInfo}).thenCall(b)};var n=function(a,b){n.super_.apply(this),this.sendable=!0,this.job=a,this.id=b,this._bulk=a._bulk,this._csvStream=new j.CSVStream,this._csvStream.stream().pipe(this.stream()),this._deferred=l.defer()};d.inherits(n,j),n.prototype.run=n.prototype.exec=n.prototype.execute=function(a,b){var c=this;if("function"==typeof a&&(b=a,a=null),this._result)throw new Error("Batch already executed.");var d=l.defer();if(this._result=d.promise,this._result.thenCall(b).then(function(a){c._deferred.resolve(a)},function(a){c._deferred.reject(a)}),this.once("response",function(a){d.resolve(a)}),this.once("error",function(a){d.reject(a)}),a instanceof f)a.pipe(this.stream());else{var e;if(h.isArray(a))h.forEach(a,function(a){c.send(a)}),c.end();else if(h.isString(a)){e=a;var g=this.stream();g.write(e),g.end()}}return this},n.prototype.then=function(a,b,c){return this._deferred.promise.then(a,b,c)},n.prototype.thenCall=function(a){return h.isFunction(a)?this.then(function(b){return a(null,b)},function(b){return a(b)}):this},n.prototype.send=function(a){return a=h.clone(a),"insert"===this.job.operation?delete a.Id:"delete"===this.job.operation&&(a={Id:a.Id}),delete a.type,delete a.attributes,this._csvStream.send(a)},n.prototype.end=function(a){a&&this.send(a),this.sendable=!1,this._csvStream.end()},n.prototype.check=function(a){var c=this._bulk,d=c._logger,e=this.job.id,f=this.id;if(!e||!f)throw new Error("Batch not started.");return c._request({method:"GET",path:"/job/"+e+"/batch/"+f,responseType:"application/xml"}).then(function(a){return d.debug(a.batchInfo),a.batchInfo}).thenCall(a)},n.prototype.poll=function(a,b){var c=this,d=this.job.id,e=this.id;if(!d||!e)throw new Error("Batch not started.");var f=(new Date).getTime(),g=function(){var d=(new Date).getTime();return d>f+b?(c.emit("error",new Error("polling time out")),void 0):(c.check(function(b,d){b?c.emit("error",b):"Failed"===d.state?parseInt(d.numberRecordsProcessed,10)>0?c.retrieve():c.emit("error",new Error(d.stateMessage)):"Completed"===d.state?c.retrieve():setTimeout(g,a)}),void 0)};setTimeout(g,a)},n.prototype.retrieve=function(a){var b=this,c=this._bulk,d=this.job.id,e=this.id;if(!d||!e)throw new Error("Batch not started.");return c._request({method:"GET",path:"/job/"+d+"/batch/"+e+"/result"}).then(function(a){return a=h.map(a,function(a){return{id:a.Id||null,success:"true"===a.Success,errors:a.Error?[a.Error]:[]}}),b.emit("response",a),a},function(a){throw b.emit("error",a),a}).thenCall(a)},n.prototype.stream=function(){return this._stream||(this._stream=new o(this)),this._stream};var o=function(a){o.super_.call(this),this.batch=a,this.writable=!0};d.inherits(o,f),o.prototype._getRequestStream=function(){var a=this.batch,b=a._bulk,c=b._logger;return this._reqStream||(this._reqStream=b._request({method:"POST",path:"/job/"+a.job.id+"/batch",headers:{"Content-Type":"text/csv"},responseType:"application/xml"},function(b,d){b?a.emit("error",b):(c.debug(d.batchInfo),a.id=d.batchInfo.id,a.emit("queue",d.batchInfo))}).stream()),this._reqStream},o.prototype.write=function(a){var b=this.batch;return b.job.id?this._getRequestStream().write(a):(this._queue(a),void 0)},o.prototype.end=function(a){var b=this.batch;return b.job.id?(this.writable=!1,this._getRequestStream().end(a),void 0):(this._ending=!0,a&&this._queue(a),void 0)},o.prototype._queue=function(a){var b=this,c=this.batch,d=c.job;this._buffer||(this._buffer=[],d.open(function(a){return a?(c.emit("error",a),void 0):(b._buffer.forEach(function(a){b.write(a)}),b._ending&&b.end(),b._buffer=[],void 0)})),this._buffer.push(a)};var p=function(a){this._conn=a,this._logger=a._logger};p.prototype.pollInterval=1e3,p.prototype.pollTimeout=1e4,p.prototype._request=function(a,b){var c=this._conn;a=h.clone(a);var d=[c.instanceUrl,"services/async",c.version].join("/");a.url=d+a.path;var e={responseContentType:a.responseType,beforesend:function(a,b){b.headers["X-SFDC-SESSION"]=a.accessToken},parseError:function(a){return{code:a.error.exceptionCode,message:a.error.exceptionMessage}}};return delete a.path,delete a.responseType,this._conn._request(a,b,e)},p.prototype.load=function(a,b,c,d,e){var f=this;if(!a||!b)throw new Error("Insufficient arguments. At least, 'type' and 'operation' are required.");"upsert"!==b.toLowerCase()&&(e=d,d=c,c=null);var g=this.createJob(a,b,c),h=g.createBatch(),i=function(){g.close()};return h.on("response",i),h.on("error",i),h.on("queue",function(){h.poll(f.pollInterval,f.pollTimeout)}),h.execute(d,e)},p.prototype.createJob=function(a,b,c){var d=new m(this,a,b,c);return d.open(),d},p.prototype.job=function(a){return new m(this,null,null,null,a)},b.exports=p},{"./connection":10,"./csv":11,"./promise":17,"./record-stream":19,events:31,stream:42,underscore:52,util:50}],8:[function(a,b){function i(a,b){return b=Array.prototype.slice.apply(b),a+"("+f.map(b,function(a){return JSON.stringify(a)}).join(",")+")"}var d=a("events"),e=a("util"),f=a("underscore")._,g=function(){this.fetching=!1};e.inherits(g,d.EventEmitter),g.prototype.get=function(a){return a?(this.once("value",a),f.isUndefined(this._value)||this.emit("value",this._value),void 0):this._value},g.prototype.set=function(a){this._value=a,this.emit("value",this._value)},g.prototype.clear=function(){this.fetching=!1,delete this._value};var h=function(){this._entries={}};h.prototype.get=function(a){if(a&&this._entries[a])return this._entries[a];var b=new g;return this._entries[a]=b,b},h.prototype.clear=function(a){for(var b in this._entries)a&&0!==b.indexOf(a)||this._entries[b].clear()},h.prototype.makeResponseCacheable=function(a,b,c){var d=this;return c=c||{},function(){var e=Array.prototype.slice.apply(arguments),g=e.pop();f.isFunction(g)||(e.push(g),g=null);var h=f.isString(c.key)?c.key:f.isFunction(c.key)?c.key.apply(b,e):i(c.namespace,e),j=d.get(h);j.fetching=!0,g&&e.push(function(a,b){j.set({error:a,result:b}),g(a,b)});var k,l;try{k=a.apply(b||this,e)}catch(m){l=m}if(k&&f.isFunction(k.then))return g?k:k.then(function(a){return j.set({error:void 0,result:a}),a},function(a){throw j.set({error:a,result:void 0}),a});if(j.set({error:l,result:k}),l)throw l;return k}},h.prototype.makeCacheable=function(a,b,c){var d=this;c=c||{};var e=function(){var e=Array.prototype.slice.apply(arguments),g=e.pop();f.isFunction(g)||e.push(g);var h=f.isString(c.key)?c.key:f.isFunction(c.key)?c.key.apply(b,e):i(c.namespace,e),j=d.get(h);if(!f.isFunction(g)){var k=j.get();if(!k)throw new Error("Function call result is not cached yet.");if(k.error)throw k.error;return k.result}j.get(function(a){g(a.error,a.result)}),j.fetching||(j.fetching=!0,e.push(function(a,b){j.set({error:a,result:b})}),a.apply(b||this,e))};return e.clear=function(){var a=f.isString(c.key)?c.key:f.isFunction(c.key)?c.key.apply(b,arguments):i(c.namespace,arguments);d.clear(a)},e},b.exports=h},{events:31,underscore:52,util:50}],9:[function(a,b){var d=a("util"),e=a("underscore"),f=a("./promise"),g=b.exports=function(a){this._conn=a};g.prototype._request=function(a,b){return/^(put|post|patch)$/i.test(a.method)&&e.isObject(a.body)&&(a.headers={"Content-Type":"application/json"},a.body=JSON.stringify(a.body)),a.url=this._normalizeUrl(a.url),this._conn._request(a,b)},g.prototype._normalizeUrl=function(a){return 0===a.indexOf("/chatter/")||0===a.indexOf("/connect/")?"/services/data/v"+this._conn.version+a:/^\/v[\d]+\.[\d]+\//.test(a)?"/services/data"+a:0!==a.indexOf("/services/")&&"/"===a[0]?"/services/data/v"+this._conn.version+"/chatter"+a:a},g.prototype.request=function(a,b){return new h(this,a).thenCall(b)},g.prototype.resource=function(a,b){return new i(this,a,b)},g.prototype.batch=function(a,b){var d=[],g=[];e.forEach(a,function(a){var b=f.defer();a._promise=b.promise,d.push(a.batchParams()),g.push(b)});var h={method:"POST",url:this._normalizeUrl("/connect/batch"),body:{batchRequests:d}};return this._request(h).then(function(a){return e.forEach(a.results,function(a,b){var c=g[b];a.statusCode>=400?c.reject(a.result):c.resolve(a.result)}),a}).thenCall(b)};var h=function(a,b){this._chatter=a,this._params=b,this._promise=null};h.prototype.batchParams=function(){var a=this._params,b={method:a.method,url:this._chatter._normalizeUrl(a.url)};return this._params.body&&(b.richInput=this._params.body),b},h.prototype.promise=function(){return this._promise||this._chatter._request(this._params)},h.prototype.stream=function(){return this._chatter._request(this._params).stream()},h.prototype.then=function(a,b){return this.promise().then(a,b)},h.prototype.thenCall=function(a){return e.isFunction(a)?this.promise().thenCall(a):this};var i=function(a,b,c){if(c){var d=e.map(e.keys(c),function(a){return a+"="+encodeURIComponent(c[a])}).join("&");b+=(b.indexOf("?")>0?"&":"?")+d}i.super_.call(this,a,{method:"GET",url:b}),this._url=b};d.inherits(i,h),i.prototype.create=function(a,b){return this._chatter.request({method:"POST",url:this._url,body:a}).thenCall(b)},i.prototype.retrieve=function(a){return this.thenCall(a)},i.prototype.update=function(a,b){return this._chatter.request({method:"POST",url:this._url,body:a}).thenCall(b)},i.prototype.del=i.prototype["delete"]=function(a){return this._chatter.request({method:"DELETE",url:this._url}).thenCall(a)}},{"./promise":17,underscore:52,util:50}],10:[function(a,b){function y(a){if(h.isString(a)){if("{"===a[0])return JSON.parse(a);var b=a.split(".").pop(),c=new d(b,"base64").toString("utf-8");return JSON.parse(c)}return a}function z(a){return JSON.parse(a)}function A(b){var c={};if(a("xml2js").parseString(b,{explicitArray:!1},function(a,b){c={error:a,result:b}}),c.error)throw c.error;return c.result}function B(b){return a("./csv").parseCSV(b)}function C(a){return a}function D(a){function b(a){return 10>a?"0"+a:a}return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())+"+00:00"}function E(a){return a&&String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var d=a("__browserify_Buffer"),e=a("events"),f=a("util"),h=(a("async"),a("underscore")._),i=a("./promise"),j=a("./logger"),k=a("./oauth2"),l=a("./query"),m=a("./sobject"),n=a("./transport"),o=a("./bulk"),p=a("./streaming"),q=a("./tooling"),r=a("./analytics"),s=a("./chatter"),t=a("./apex"),u=a("./metadata"),v=a("./cache"),w={loginUrl:"https://login.salesforce.com",instanceUrl:"",version:"29.0"},x=b.exports=function(a){a=a||{},this._logger=new j(a.logLevel);var b=a.oauth2;!b&&a.clientId&&(b={loginUrl:a.loginUrl,clientId:a.clientId,clientSecret:a.clientSecret,redirectUri:a.redirectUri}),b&&(this.oauth2=b instanceof k?b:new k(b)),this.loginUrl=a.loginUrl||b&&b.loginUrl||w.loginUrl,this.version=a.version||w.version,this.maxRequest=a.maxRequest||this.maxRequest||10,this._transport=a.proxyUrl?new n.ProxyTransport(a.proxyUrl):new n,this.streaming=new p(this),this.bulk=new o(this),this.tooling=new q(this),this.analytics=new r(this),this.chatter=new s(this),this.metadata=new u(this),this.apex=new t(this),this.cache=new v;var c={key:function(a){return a?"describe."+a:"describe"}};this.describe$=this.cache.makeCacheable(this.describe,this,c),this.describe=this.cache.makeResponseCacheable(this.describe,this,c),this.describeSObject$=this.describe$,this.describeSObject=this.describe,c={key:"describeGlobal"},this.describeGlobal$=this.cache.makeCacheable(this.describeGlobal,this,c),this.describeGlobal=this.cache.makeResponseCacheable(this.describeGlobal,this,c),this.initialize(a)};f.inherits(x,e.EventEmitter),x.prototype.initialize=function(a){if(!a.instanceUrl&&a.serverUrl&&(a.instanceUrl=a.serverUrl.split("/").slice(0,3).join("/")),this.instanceUrl=a.instanceUrl||a.serverUrl||this.instanceUrl||w.instanceUrl,this.urls={soap:{login:[this.loginUrl,"services/Soap/u",this.version].join("/"),service:[this.instanceUrl,"services/Soap/u",this.version].join("/")},rest:{base:[this.instanceUrl,"services/data","v"+this.version].join("/")}},this.accessToken=a.sessionId||a.accessToken||this.accessToken,this.refreshToken=a.refreshToken||this.refreshToken,this.refreshToken&&!this.oauth2)throw new Error("Refersh token is specified without oauth2 client information");this.signedRequest=a.signedRequest&&y(a.signedRequest),this.signedRequest&&(this.accessToken=this.signedRequest.client.oauthToken),this.userInfo=a.userInfo,this.sobjects={},this.cache.clear(),this.cache.get("describeGlobal").on("value",h.bind(function(a){if(a.result){var b=h.map(a.result.sobjects,function(a){return a.name});h.each(b,this.sobject,this)}},this)),this.tooling.initialize(),this._initializedAt=Date.now()},x.prototype._baseUrl=function(){return this.urls.rest.base},x.prototype._request=function(a,b,c){c=c||{},h.isString(a)&&(a={method:"GET",url:a}),"/"===a.url[0]&&(a.url=this.instanceUrl+a.url);var d=this,e=this._logger,f=i.defer(),g=function(e){return e?(f.reject(e),void 0):(d._request(a,b,c).then(function(a){f.resolve(a)},function(a){f.reject(a)}),void 0)};if(d._suspended)return d.once("resume",g),f.promise;a.headers=a.headers||{},this.accessToken&&(a.headers.Authorization="Bearer "+this.accessToken),c.beforesend&&c.beforesend(this,a),this.signedRequest&&(c.signedRequest=this.signedRequest),d.emit("request",a.method,a.url,a),e.debug("<request> method="+a.method+", url="+a.url);var j=Date.now(),k=function(b,h){var i=Date.now();if(e.debug("elappsed time : "+(i-j)+"msec"),b)throw e.error(b),b;if(e.debug("<response> status="+h.statusCode+", url="+a.url),d.emit("response",h.statusCode,h.body,h),401===h.statusCode&&d.oauth2&&d.refreshToken)return d._initializedAt>j?g():(d.once("resume",g),d._suspended||(d._suspended=!0,d._refresh())),f.promise;var k=c.responseContentType||h.headers&&h.headers["content-type"],l=/^application\/xml(;|$)/.test(k)?A:/^application\/json(;|$)/.test(k)?z:/^text\/csv(;|$)/.test(k)?B:C;if(h.statusCode>=400){var m;try{var n=c.parseError||function(a){return a[0]};m=n(l(h.body))}catch(o){m={message:h.body}}b=new Error(m.message),b.name=m.errorCode;for(var p in m)b[p]=m[p];throw b}if(204===h.statusCode)return c.noContentResponse;var q=l(h.body);if(300===h.statusCode)throw b=new Error("Multiple records found"),b.name="MULTIPLE_CHOICES",b.content=q,b;return q};return this._transport.httpRequest(a,k,c).thenCall(b)},x.prototype._refresh=function(){var a=this,b=this._logger;return b.debug("<refresh token>"),this.oauth2.refreshToken(this.refreshToken,function(c,d){c||(a.initialize({instanceUrl:d.instance_url,accessToken:d.access_token}),b.debug("token refresh completed. result = "+JSON.stringify(d)),a.emit("refresh",d.access_token,d)),a._suspended=!1,a.emit("resume",c)})},x.prototype.query=function(a,b){var c=new l(this,a);return b&&c.run(b),c},x.prototype.queryAll=function(a,b){var c=new l(this,a);return c.scanAll(!0),b&&c.run(b),c},x.prototype.queryMore=function(a,b){var c=new l(this,null,a);return b&&c.run(b),c},x.prototype.retrieve=function(a,b,c){var d=this,e=h.isArray(b);return b=e?b:[b],b.length>d.maxRequest?i.reject(new Error("Exceeded max limit of concurrent call")).thenCall(c):i.all(h.map(b,function(b){var c=[d._baseUrl(),"sobjects",a,b].join("/");return d._request(c)})).then(function(a){return!e&&h.isArray(a)?a[0]:a}).thenCall(c)},x.prototype.insert=x.prototype.create=function(a,b,c){2===arguments.length&&(a=null,b=a,c=b);var d=this,e=h.isArray(b);return b=e?b:[b],b.length>d.maxRequest?i.reject(new Error("Exceeded max limit of concurrent call")).thenCall(c):i.all(h.map(b,function(b){var c=a||b.attributes&&b.attributes.type||b.type;if(!c)throw new Error("No SObject Type defined in record");b=h.clone(b),delete b.Id,delete b.type,delete b.attributes;var e=[d._baseUrl(),"sobjects",c].join("/");return d._request({method:"POST",url:e,body:JSON.stringify(b),headers:{"Content-Type":"application/json"}})})).then(function(a){return!e&&h.isArray(a)?a[0]:a}).thenCall(c)},x.prototype.update=function(a,b,c){2===arguments.length&&(a=null,b=a,c=b);var d=this,e=h.isArray(b);return b=e?b:[b],b.length>d.maxRequest?i.reject(new Error("Exceeded max limit of concurrent call")).thenCall(c):i.all(h.map(b,function(b){var c=b.Id;if(!c)throw new Error("Record id is not found in record.");var e=a||b.attributes&&b.attributes.type||b.type;if(!e)throw new Error("No SObject Type defined in record");b=h.clone(b),delete b.Id,delete b.type,delete b.attributes;var f=[d._baseUrl(),"sobjects",e,c].join("/");return d._request({method:"PATCH",url:f,body:JSON.stringify(b),headers:{"Content-Type":"application/json"}},null,{noContentResponse:{id:c,success:!0,errors:[]}})})).then(function(a){return!e&&h.isArray(a)?a[0]:a}).thenCall(c)},x.prototype.upsert=function(a,b,c,d){3===arguments.length&&(a=null,b=a,c=b,d=c);var e=this,f=h.isArray(b);return b=f?b:[b],b.length>e.maxRequest?i.reject(new Error("Exceeded max limit of concurrent call")).thenCall(d):i.all(h.map(b,function(b){var d=a||b.attributes&&b.attributes.type||b.type,f=b[c];if(!f)return i.reject(new Error("External ID is not defined in the record"));b=h.clone(b),delete b[c],delete b.type,delete b.attributes;var g=[e._baseUrl(),"sobjects",d,c,f].join("/");return e._request({method:"PATCH",url:g,body:JSON.stringify(b),headers:{"Content-Type":"application/json"}},null,{noContentResponse:{success:!0,errors:[]}})})).then(function(a){return!f&&h.isArray(a)?a[0]:a}).thenCall(d)},x.prototype["delete"]=x.prototype.del=x.prototype.destroy=function(a,b,c){var d=this,e=h.isArray(b);return b=e?b:[b],b.length>d.maxRequest?i.reject(new Error("Exceeded max limit of concurrent call")).thenCall(c):i.all(h.map(b,function(b){var c=[d._baseUrl(),"sobjects",a,b].join("/");return d._request({method:"DELETE",url:c},null,{noContentResponse:{id:b,success:!0,errors:[]}})})).then(function(a){return!e&&h.isArray(a)?a[0]:a}).thenCall(c)},x.prototype.search=function(a,b){var c=this._baseUrl()+"/search?q="+encodeURIComponent(a);return this._request(c).thenCall(b)},x.prototype.describe=x.prototype.describeSObject=function(a,b){var c=[this._baseUrl(),"sobjects",a,"describe"].join("/");return this._request(c).thenCall(b)},x.prototype.describeGlobal=function(a){var b=this._baseUrl()+"/sobjects";return this._request(b).thenCall(a)},x.prototype.sobject=function(a){this.sobjects=this.sobjects||{};var b=this.sobjects[a]=this.sobjects[a]||new m(this,a);return b},x.prototype.identity=function(a){var b=this,c=this.userInfo&&this.userInfo.url;return new i(c?{identity:c}:this._request(this._baseUrl())).then(function(a){var c=a.identity;return c+="?format=json&oauth_token="+encodeURIComponent(b.accessToken),b._request(c,null,{jsonp:"callback"})}).then(function(a){return b.userInfo={id:a.user_id,organizationId:a.organization_id,url:a.id},a}).thenCall(a)},x.prototype.authorize=function(a,b){var c=this,d=this._logger;return this.oauth2.requestToken(a).then(function(a){d.debug("OAuth2 token response = "+JSON.stringify(a));var b=a.id.split("/"),e=b.pop(),f=b.pop(),g={id:e,organizationId:f,url:a.id};return c.initialize({instanceUrl:a.instance_url,accessToken:a.access_token,refreshToken:a.refresh_token,userInfo:g}),d.debug("<login> completed. user id = "+e+", org id = "+f),g}).thenCall(b)},x.prototype.login=function(a,b,c){return this.oauth2?this.loginByOAuth2(a,b,c):this.loginBySoap(a,b,c)},x.prototype.loginByOAuth2=function(a,b,c){var d=this,e=this._logger;return this.oauth2.authenticate(a,b).then(function(a){e.debug("OAuth2 token response = "+JSON.stringify(a));var b=a.id.split("/"),c=b.pop(),f=b.pop(),g={id:c,organizationId:f,url:a.id};return d.initialize({instanceUrl:a.instance_url,accessToken:a.access_token,userInfo:g}),e.debug("<login> completed. user id = "+c+", org id = "+f),g}).thenCall(c)},x.prototype.loginBySoap=function(a,b,c){var d=this,e=this._logger,f=['<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/">',"<se:Header/>","<se:Body>",'<login xmlns="urn:partner.soap.sforce.com">',"<username>"+E(a)+"</username>","<password>"+E(b)+"</password>","</login>","</se:Body>","</se:Envelope>"].join("");return this._transport.httpRequest({method:"POST",url:this.urls.soap.login,body:f,headers:{"Content-Type":"text/xml",SOAPAction:'""'}}).then(function(a){var b;if(a.statusCode>=400){b=a.body.match(/<faultstring>([^<]+)<\/faultstring>/);var c=b&&b[1];throw new Error(c||a.body)}e.debug("SOAP response = "+a.body),b=a.body.match(/<serverUrl>([^<]+)<\/serverUrl>/);
var f=b&&b[1];b=a.body.match(/<sessionId>([^<]+)<\/sessionId>/);var g=b&&b[1];b=a.body.match(/<userId>([^<]+)<\/userId>/);var h=b&&b[1];b=a.body.match(/<organizationId>([^<]+)<\/organizationId>/);var i=b&&b[1],j=d.urls.soap.login.split("/").slice(0,3).join("/");j+="/id/"+i+"/"+h;var k={id:h,organizationId:i,url:j};return d.initialize({serverUrl:f.split("/").slice(0,3).join("/"),sessionId:g,userInfo:k}),e.debug("<login> completed. user id = "+h+", org id = "+i),k}).thenCall(c)},x.prototype.logout=function(a){var b=this,c=this._logger,d=['<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/">',"<se:Header>",'<SessionHeader xmlns="urn:partner.soap.sforce.com">',"<sessionId>"+E(this.accessToken)+"</sessionId>","</SessionHeader>","</se:Header>","<se:Body>",'<logout xmlns="urn:partner.soap.sforce.com"/>',"</se:Body>","</se:Envelope>"].join("");return this._transport.httpRequest({method:"POST",url:this.urls.soap.service,body:d,headers:{"Content-Type":"text/xml",SOAPAction:'""'}}).then(function(a){if(c.debug("SOAP statusCode = "+a.statusCode+", response = "+a.body),a.statusCode>=400){var d=a.body.match(/<faultstring>([^<]+)<\/faultstring>/),e=d&&d[1];throw new Error(e||a.body)}return b.accessToken=null,b.userInfo=null,b.refreshToken=null,b.instanceUrl=null,b.cache.clear(),void 0}).thenCall(a)},x.prototype.recent=function(a,b,c){h.isString(a)||(c=b,b=a,a=void 0),h.isNumber(b)||(c=b,b=void 0);var d;return a?(d=[this._baseUrl(),"sobjects",a].join("/"),this._request(d).then(function(a){return b?a.recentItems.slice(0,b):a.recentItems}).thenCall(c)):(d=this._baseUrl()+"/recent",b&&(d+="?limit="+b),this._request(d).thenCall(c))},x.prototype.updated=function(a,b,c,d){var e=[this._baseUrl(),"sobjects",a,"updated"].join("/");return"string"==typeof b&&(b=new Date(b)),b instanceof Date&&(b=D(b)),b&&(e+="?start="+encodeURIComponent(b)),"string"==typeof c&&(c=new Date(c)),c instanceof Date&&(c=D(c)),c&&(e+="&end="+encodeURIComponent(c)),this._request(e).thenCall(d)},x.prototype.deleted=function(a,b,c,d){var e=[this._baseUrl(),"sobjects",a,"deleted"].join("/");return"string"==typeof b&&(b=new Date(b)),b instanceof Date&&(b=D(b)),b&&(e+="?start="+encodeURIComponent(b)),"string"==typeof c&&(c=new Date(c)),c instanceof Date&&(c=D(c)),c&&(e+="&end="+encodeURIComponent(c)),this._request(e).thenCall(d)}},{"./analytics":1,"./apex":2,"./bulk":7,"./cache":8,"./chatter":9,"./csv":11,"./logger":14,"./metadata":15,"./oauth2":16,"./promise":17,"./query":18,"./sobject":22,"./streaming":24,"./tooling":25,"./transport":26,__browserify_Buffer:33,async:27,events:31,underscore:52,util:50,xml2js:55}],11:[function(a,b){function f(a,b,c){c=c||{},b||(b=g(a,c));var e=d.map(a,function(a){return h(a,b)});return i(b)+"\n"+e.join("\n")}function g(a,b){b=b||{};var c={};return d.forEach(a,function(a){for(var b in a){var d=a[b];!a.hasOwnProperty(b)||null!==d&&"object"==typeof d||(c[b]=!0)}}),d.keys(c)}function h(a,b){var c=[];return d.forEach(b,function(b){var d=a[b];"undefined"==typeof d&&(d=null),c.push(d)}),i(c)}function i(a){return d.map(a,j).join(",")}function j(a){return(null===a||"undefined"==typeof a)&&(a=""),a=String(a),(a.indexOf('"')>=0||a.indexOf(",")>=0||/[\n\r]/.test(a))&&(a='"'+a.replace(/"/g,'""')+'"'),a}function l(a){var e,b=new k(a),c=[];if(b.nextLine())for(e=b.nextToken();!d.isUndefined(e)&&!d.isNull(e);)c.push(e),e=b.nextToken();for(var f=[];b.nextLine();){var g={};e=b.nextToken();for(var h=0;!d.isUndefined(e)&&!d.isNull(e);){var i=c[h++];g[i]=e,e=b.nextToken()}f.push(g)}return f}var d=a("underscore");a("./date");var k=function(a){this.text=a,this.cursor=0};k.prototype={nextToken:function(){var a,b=!1,c=this.text.charAt(this.cursor);if(""===c||"\r"===c||"\n"===c)return null;if('"'===c&&(b=!0),b){for(var d=this.cursor;;){if(d++,d=this.text.indexOf('"',d),0>d||'"'!==this.text.charAt(d+1))break;d++}if(d>=0){var e=this.text.charAt(d+1);a=this.text.substring(this.cursor,d+1),this.cursor=d+(","===e?2:1)}else a=this.text.substring(this.cursor),this.cursor=this.text.length;return a.replace(/""/g,'"').replace(/^"/,"").replace(/"$/,"")}var f=this.text.indexOf(",",this.cursor),g=this.text.indexOf("\r",this.cursor),h=this.text.indexOf("\n",this.cursor);f=0>f?this.text.length+1:f,g=0>g?this.text.length+1:g,h=0>h?this.text.length+1:h;var i=Math.min(f,g,h,this.text.length);return a=this.text.substring(this.cursor,i),this.cursor=i,f===i&&this.cursor++,a},nextLine:function(){for(var a=this.text.charAt(this.cursor);"\r"===a||"\n"===a;a=this.text.charAt(++this.cursor));return this.cursor!==this.text.length}},b.exports={toCSV:f,extractHeaders:g,recordToCSV:h,arrayToCSV:i,parseCSV:l}},{"./date":12,underscore:52}],12:[function(a,b){function f(a){return(10>a?"0":"")+a}function j(a){return function(b){return new e(a+":"+b)}}var d=a("underscore")._,e=b.exports=function(a){this._literal=a};e.prototype.toString=e.prototype.toJSON=function(){return this._literal},e.toDateLiteral=function(a){d.isNumber(a)?a=new Date(a):d.isString(a)&&(a=e.parseDate(a));var b=a.getFullYear(),c=a.getMonth()+1,g=a.getDate(),h=[b,f(c),f(g)].join("-");return new e(h)},e.toDateTimeLiteral=function(a){d.isNumber(a)?a=new Date(a):d.isString(a)&&(a=e.parseDate(a));var b=a.getUTCFullYear(),c=a.getUTCMonth()+1,g=a.getUTCDate(),h=a.getUTCHours(),i=a.getUTCMinutes(),j=a.getUTCSeconds(),k=[b,f(c),f(g)].join("-")+"T"+[f(h),f(i),f(j)].join(":")+"Z";return new e(k)},e.parseDate=function(a){var b=new Date,c=/^([\d]{4})-?([\d]{2})-?([\d]{2})(T([\d]{2}):?([\d]{2}):?([\d]{2})(.([\d]{3}))?(Z|([\+\-])([\d]{2}):?([\d]{2})))?$/,d=a.match(c);if(d){if(b=new Date(0),d[4]){if(b.setUTCFullYear(parseInt(d[1],10)),b.setUTCDate(parseInt(d[3],10)),b.setUTCMonth(parseInt(d[2],10)-1),b.setUTCHours(parseInt(d[5],10)),b.setUTCMinutes(parseInt(d[6],10)),b.setUTCSeconds(parseInt(d[7],10)),b.setUTCMilliseconds(parseInt(d[9]||"0",10)),d[10]&&"Z"!==d[10]){var e=60*parseInt(d[12],10)+parseInt(d[13],10);b.setTime(1e3*60*("+"===d[11]?-1:1)*e+b.getTime())}}else b.setFullYear(parseInt(d[1],10)),b.setDate(parseInt(d[3],10)),b.setMonth(parseInt(d[2],10)-1),b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0);return b}throw new Error("Invalid date format is specified : "+a)};var g={YESTERDAY:1,TODAY:1,TOMORROW:1,LAST_WEEK:1,THIS_WEEK:1,NEXT_WEEK:1,LAST_MONTH:1,THIS_MONTH:1,NEXT_MONTH:1,LAST_90_DAYS:1,NEXT_90_DAYS:1,LAST_N_DAYS:2,NEXT_N_DAYS:2,THIS_QUARTER:1,LAST_QUARTER:1,NEXT_QUARTER:1,NEXT_N_QUARTERS:2,LAST_N_QUARTERS:2,THIS_YEAR:1,LAST_YEAR:1,NEXT_YEAR:1,NEXT_N_YEARS:2,LAST_N_YEARS:2,THIS_FISCAL_QUARTER:1,LAST_FISCAL_QUARTER:1,NEXT_FISCAL_QUARTER:1,NEXT_N_FISCAL_QUARTERS:2,LAST_N_FISCAL_QUARTERS:2,THIS_FISCAL_YEAR:1,LAST_FISCAL_YEAR:1,NEXT_FISCAL_YEAR:1,NEXT_N_FISCAL_YEARS:2,LAST_N_FISCAL_YEARS:2};for(var h in g){var i=g[h];e[h]=1===i?new e(h):j(h)}},{underscore:52}],13:[function(a,b,c){c.Connection=a("./connection"),c.OAuth2=a("./oauth2"),c.Date=c.SfDate=a("./date"),c.RecordStream=a("./record-stream"),"undefined"!=typeof window&&(c.browser=a("./browser/client"))},{"./browser/client":4,"./connection":10,"./date":12,"./oauth2":16,"./record-stream":19}],14:[function(a,b){function g(a){return function(b){this.log(a,b)}}var d=b.exports=function(a){"string"==typeof a&&(a=e[a]),a||(a=e.INFO),this._logLevel=a},e=d.LogLevels={DEBUG:1,INFO:2,WARN:3,ERROR:4,FATAL:5};d.prototype.log=function(a,b){this._logLevel<=a&&(a<e.ERROR?console.log(b):console.error(b))};for(var f in e)d.prototype[f.toLowerCase()]=g(e[f])},{}],15:[function(a,b){var d=a("__browserify_Buffer"),e=a("util"),f=a("events"),g=a("stream"),h=g.Stream,i=a("underscore"),j=a("./promise"),k=a("./soap"),l=b.exports=function(a){this._conn=a};l.prototype.pollInterval=1e3,l.prototype.pollTimeout=1e4,l.prototype._invoke=function(a,b,c){var d=new k({sessionId:this._conn.accessToken,serverUrl:this._conn.instanceUrl+"/services/Soap/m/"+this._conn.version,xmlns:"http://soap.sforce.com/2006/04/metadata"},this._conn._transport);return d.invoke(a,b).then(function(a){return a.result}).thenCall(c)},l.prototype.create=function(a,b,c){var d=function(b){return b["@xsi:type"]=a,b},e=i.isArray(b);b=e?i.map(b,d):d(b);var f=this._invoke("create",{metadata:b});return new m(this,f,e).thenCall(c)},l.prototype.update=function(a,b,c){var d=function(b){return b.metadata["@xsi:type"]=a,b},e=i.isArray(b);b=e?i.map(b,d):d(b);var f=this._invoke("update",{updateMetadata:b});return new m(this,f,e).thenCall(c)},l.prototype.del=l.prototype["delete"]=function(a,b,c){var d=function(b){return i.isString(b)&&(b={fullName:b}),b["@xsi:type"]=a,b},e=i.isArray(b);b=e?i.map(b,d):d(b);var f=this._invoke("delete",{metadata:b});return new m(this,f,e).thenCall(c)},l.prototype.checkStatus=function(a,b){var c=i.isArray(a),d=this._invoke("checkStatus",{asyncProcessId:a});return new m(this,d,c).thenCall(b)},l.prototype.describe=function(a,b){return i.isString(a)||(b=a,a=this._conn.version),this._invoke("describeMetadata",{asOfVersion:a}).then(function(a){return a.metadataObjects=i.isArray(a.metadataObjects)?a.metadataObjects:[a.metadataObjects],a.metadataObjects=i.map(a.metadataObjects,function(a){return a.childXmlNames&&(a.childXmlNames=i.isArray(a.childXmlNames)?a.childXmlNames:[a.childXmlNames]),a.inFolder="true"===a.inFolder,a.metaFile="true"===a.metaFile,a}),a.partialSaveAllowed="true"===a.partialSaveAllowed,a.testRequired="true"===a.testRequired,a})},l.prototype.list=function(a,b,c){return i.isString(b)||(c=b,b=this._conn.version),i.isArray(a)||(a=[a]),this._invoke("listMetadata",{queries:a,asOfVersion:b},c)},l.prototype.retrieve=function(a,b){var c=this._invoke("retrieve",{request:a});return new n(this,c).thenCall(b)},l.prototype.checkRetrieveStatus=function(a,b){return this._invoke("checkRetrieveStatus",{asyncProcessId:a},b)},l.prototype.deploy=function(a,b,c){(!b||i.isFunction(b))&&(c=b,b={});var e=j.defer();if(a instanceof h){var f=[];a.on("data",function(a){f.push(a)}),a.on("end",function(){e.resolve(d.concat(f))}),a.resume()}else a instanceof d&&e.resolve(a);var g=this,k=e.promise.then(function(a){var d=a.toString("base64");return g._invoke("deploy",{ZipFile:d,DeployOptions:b},c)});return new o(this,k).thenCall(c)},l.prototype.checkDeployStatus=function(a,b,c){return i.isObject(b)||i.isBoolean(b)?b=!!b:(c=b,b=!1),this._invoke("checkDeployStatus",{asyncProcessId:a,includeDetails:b}).then(function(a){return a.done="true"===a.done,a.success="true"===a.success,a.checkOnly="true"===a.checkOnly,a.ignoreWarnings&&(a.ignoreWarnings="true"===a.ignoreWarnings),a.rollbackOnError&&(a.rollbackOnError="true"===a.rollbackOnError),a.numberComponentErrors=Number(a.numberComponentErrors),a.numberComponentsDeployed=Number(a.numberComponentsDeployed),a.numberComponentsTotal=Number(a.numberComponentsTotal),a.numberTestErrors=Number(a.numberTestErrors),a.numberTestsCompleted=Number(a.numberTestsCompleted),a.numberTestsTotal=Number(a.numberTestsTotal),a}).thenCall(c)};var m=function(a,b,c){this._meta=a,this._results=b,this._isArray=c};e.inherits(m,f.EventEmitter),m.prototype.then=function(a,b){var c=this;return this._results.then(function(b){var d=function(a){return a.$&&"true"===a.$["xsi:nil"]?null:(a.done="true"===a.done,a)};return b=i.isArray(b)?i.map(b,d):d(b),c._isArray&&!i.isArray(b)&&(b=[b]),a(b)},b)},m.prototype.thenCall=function(a){return i.isFunction(a)?this.then(function(b){return a(null,b)},function(b){return a(b)}):this},m.prototype.check=function(a){var c=this._meta;return this.then(function(a){var b=i.isArray(a)?i.map(a,function(a){return a.id}):a.id;return c.checkStatus(b)}).thenCall(a)},m.prototype.poll=function(a,b){var c=this,d=(new Date).getTime(),e=function(){var f=(new Date).getTime();return f>d+b?(c.emit("error",new Error("polling time out")),void 0):(c.check().then(function(b){for(var d=!0,f=i.isArray(b)?b:[b],g=0,h=f.length;h>g;g++){var j=f[g];j&&!j.done&&(d=!1)}d?c.emit("complete",b):setTimeout(e,a)},function(a){c.emit("error",a)}),void 0)};setTimeout(e,a)},m.prototype.complete=function(a){var b=j.defer();this.on("complete",function(a){b.resolve(a)}),this.on("error",function(a){b.reject(a)});var c=this._meta;return this.poll(c.pollInterval,c.pollTimeout),b.promise.thenCall(a)};var n=function(a,b){n.super_.call(this,a,b)};e.inherits(n,m),n.prototype.complete=function(a){var b=this._meta;return n.super_.prototype.complete.call(this).then(function(a){return b.checkRetrieveStatus(a.id)}).thenCall(a)},n.prototype.stream=function(){var a=new h;return a.readable=!0,this.complete(function(b,c){b?a.emit("error",b):(a.emit("data",new d(c.zipFile,"base64")),a.emit("end"))}),a};var o=function(a,b){o.super_.call(this,a,b)};e.inherits(o,m),o.prototype.complete=function(a,b){i.isFunction(a)&&(b=a,a=!1);var c=this._meta;return o.super_.prototype.complete.call(this).then(function(b){return c.checkDeployStatus(b.id,a)}).thenCall(b)}},{"./promise":17,"./soap":21,__browserify_Buffer:33,events:31,stream:42,underscore:52,util:50}],16:[function(a,b){var d=a("querystring"),e=a("underscore"),f=a("./transport"),g={loginUrl:"https://login.salesforce.com"},h=b.exports=function(a){a.authzServiceUrl&&a.tokenServiceUrl?(this.loginUrl=a.authzServiceUrl.split("/").slice(0,3).join("/"),this.authzServiceUrl=a.authzServiceUrl,this.tokenServiceUrl=a.tokenServiceUrl):(this.loginUrl=a.loginUrl||g.loginUrl,this.authzServiceUrl=this.loginUrl+"/services/oauth2/authorize",this.tokenServiceUrl=this.loginUrl+"/services/oauth2/token"),this.clientId=a.clientId,this.clientSecret=a.clientSecret,this.redirectUri=a.redirectUri,this._transport=a.proxyUrl?new f.ProxyTransport(a.proxyUrl):new f};e.extend(h.prototype,{getAuthorizationUrl:function(a){return a=e.extend({response_type:"code",client_id:this.clientId,redirect_uri:this.redirectUri},a||{}),this.authzServiceUrl+(this.authzServiceUrl.indexOf("?")>=0?"&":"?")+d.stringify(a)},refreshToken:function(a,b){return this._postParams({grant_type:"refresh_token",refresh_token:a,client_id:this.clientId,client_secret:this.clientSecret},b)},requestToken:function(a,b){return this._postParams({grant_type:"authorization_code",code:a,client_id:this.clientId,client_secret:this.clientSecret,redirect_uri:this.redirectUri},b)},authenticate:function(a,b,c){return this._postParams({grant_type:"password",username:a,password:b,client_id:this.clientId,client_secret:this.clientSecret,redirect_uri:this.redirectUri},c)},_postParams:function(a,b){return this._transport.httpRequest({method:"POST",url:this.tokenServiceUrl,body:d.stringify(a),headers:{"content-type":"application/x-www-form-urlencoded"}}).then(function(a){var b=JSON.parse(a.body);if(a.statusCode>=400){var c=new Error(b.error+": "+b.error_description);throw c.name=b.error,c}return b}).thenCall(b)}})},{"./transport":26,querystring:40,underscore:52}],17:[function(a,b){var d=a("q"),e=a("underscore")._,f=function(a){this._promise=d(a)};f.prototype.then=function(){return new f(this._promise.then.apply(this._promise,arguments))},f.prototype.thenCall=function(a){return e.isFunction(a)?this.then(function(b){return a(null,b)},function(b){return a(b)}):this},f.prototype.fail=function(){return new f(this._promise.fail.apply(this._promise,arguments))},f.prototype.done=function(){return new f(this._promise.done.apply(this._promise,arguments))},f.when=function(){return new f(d.when.apply(d,arguments))},f.reject=function(a){return new f(d.reject(a))},f.all=function(){return new f(d.all.apply(d,arguments))},f.defer=function(){return new g};var g=function(){this._deferred=d.defer(),this.promise=new f(this._deferred.promise)};g.prototype.resolve=function(){return this._deferred.resolve.apply(this._promise,arguments)},g.prototype.reject=function(){return this._deferred.reject.apply(this._promise,arguments)},b.exports=f},{q:51,underscore:52}],18:[function(a,b){var d=a("util"),f=(a("events"),a("underscore")._),g=a("async"),h=a("q"),j=(a("./date"),a("./soql-builder")),k=a("./record-stream"),l=b.exports=function(a,b,c){l.super_.apply(this),this.receivable=!0,this._conn=a,b&&(f.isString(b)?this._soql=b:(this._config=b,this.select(b.fields),b.includes&&this.include(b.includes))),c&&c.indexOf("/")>=0&&(c=c.split("/").pop()),this._locator=c,this._buffer=[],this._paused=!0,this._closed=!1,this._deferred=h.defer()};d.inherits(l,k),l.prototype.select=function(a){if(this._soql)throw Error("Cannot set select fields for the query which has already built SOQL.");if(a=a||"*",f.isString(a))a=a.split(/\s*,\s*/);else if(f.isObject(a)&&!f.isArray(a)){var b=[];for(var c in a)a[c]&&b.push(c);a=b}return this._config.fields=a,this},l.prototype.where=function(a){if(this._soql)throw Error("Cannot set where conditions for the query which has already built SOQL.");return this._config.conditions=a,this},l.prototype.limit=function(a){if(this._soql)throw Error("Cannot set limit for the query which has already built SOQL.");return this._config.limit=a,this},l.prototype.skip=l.prototype.offset=function(a){if(this._soql)throw Error("Cannot set skip/offset for the query which has already built SOQL.");return this._config.offset=a,this},l.prototype.sort=l.prototype.orderby=function(a,b){if(this._soql)throw Error("Cannot set sort for the query which has already built SOQL.");return f.isString(a)&&f.isString(b)&&(a=[[a,b]]),this._config.sort=a,this},l.prototype.include=function(a,b,c,d){if(this._soql)throw Error("Cannot include child relationship into the query which has already built SOQL.");{if(!f.isObject(a)){var i={table:a,conditions:b,fields:c,limit:d&&d.limit,offset:d&&(d.offset||d.skip)};this._config.includes=this._config.includes||[],this._config.includes.push(i);var j=new n(this._conn,this,i);return this._children=this._children||[],this._children.push(j),j}var e=a;for(var g in e){var h=e[g];this.include(g,h.conditions,h.fields,h)}}},l.prototype._maxFetch=1e4,l.prototype.maxFetch=function(a){return this._maxFetch=a,this},l.prototype._autoFetch=!1,l.prototype.autoFetch=function(a){return this._autoFetch=a,this},l.prototype._scanAll=!1,l.prototype.scanAll=function(a){return this._scanAll=a,this};var m=l.ResponseTargets={};["QueryResult","Records","SingleRecord","Count"].forEach(function(a){m[a]=a}),l.prototype._responseTarget=m.QueryResult,l.prototype.setResponseTarget=function(a){return a in m&&(this._responseTarget=a),this},l.prototype.pause=function(){this._paused=!0},l.prototype.resume=function(){if(this._closed)throw new Error("resuming already closed stream");if(this._paused){for(this._paused=!1;!this._paused&&this._buffer.length>0;){if(this.totalFetched>=this._maxFetch)return this.close(),void 0;var a=this._buffer.shift();this.emit("record",a,this.totalFetched++,this)}this._paused||(this._finished?this.close():this.execute({autoFetch:!0}))}},l.prototype.close=function(){this.pause(),this._closed=!0,this.emit("end",this)},l.prototype.run=l.prototype.exec=l.prototype.execute=function(a,b){var c=this,d=this._conn._logger,e=this._deferred;if(this._closed)return e.reject(new Error("executing already closed query")),this;this._paused=!1,a=a||{},"function"==typeof a&&(b=a,a={});var h=a.responseTarget||c._responseTarget,i=a.autoFetch||c._autoFetch,k=a.maxFetch||c._maxFetch,l=a.scanAll||c._scanAll,n=function(a,c){if(f.isFunction(b))try{c=b(a,c),a=null}catch(d){a=d}a?e.reject(a):e.resolve(c)};return this.once("response",function(a){n(null,a)}),this.once("error",function(a){n(a)}),g.waterfall([function(a){if(c._locator){var b=c._conn._baseUrl()+"/query/"+c._locator;a(null,b)}else c.totalFetched=0,g.waterfall([function(a){c._soql?a():c._expandFields(a)},function(a){var b=c._soql||j.createSOQL(c._config);d.debug("SOQL = "+b);var e=c._conn._baseUrl()+"/"+(l?"queryAll":"query")+"?q="+encodeURIComponent(b);a(null,e)}],a)},function(a,b){c._conn._request(a,b)}],function(b,d){if(b)return c.emit("error",b),void 0;c.totalSize=d.totalSize;var e;switch(h){case m.SingleRecord:e=d.records&&d.records.length>0?d.records[0]:null;break;case m.Records:e=d.records;break;case m.Count:e=d.totalSize;break;default:e=d}c.emit("response",e,c);for(var f=0,g=d.records.length;g>f&&!(c.totalFetched>=k);f++){var j=d.records[f];c._paused?c._buffer.push(j):c.emit("record",j,c.totalFetched++,c)}c._finished=d.done,d.nextRecordsUrl&&(c._locator=d.nextRecordsUrl.split("/").pop()),i&&!c._finished?c._paused||c.execute(a):c._paused||c.close()}),this},l.prototype._expandFields=function(a){function h(a,c){var d=b._parent._config.table;g.waterfall([function(a){b._conn.describe$(d,a)},function(b,c){var d=f.find(b.childRelationships,function(b){return(b.relationshipName||"").toUpperCase()===a.toUpperCase()});d?c(null,d.childSObject):c({message:"No child relationship found: "+a})}],c)}function i(a,b,d){var e=b.split(".");"*"===e[e.length-1]?g.waterfall([function(b){c.describe$(a,b)},function(a,b){if(e.length>1){var c=e.shift(),d=f.find(a.fields,function(a){return a.relationshipName&&a.relationshipName.toUpperCase()===c.toUpperCase()});if(d){var h=1===d.referenceTo.length?d.referenceTo[0]:"Name";g.waterfall([function(a){i(h,e.join("."),a)},function(a,b){b(null,f.map(a,function(a){return c+"."+a}))}],b)}else b(null,[])}else{var j=f.map(a.fields,function(a){return a.name});b(null,j)}}],d):d(null,[b])}this._soql&&a({message:"Cannot expand fields for the query which has already built SOQL."});var b=this,c=this._conn,d=this._config.table,e=this._config.fields||[];g.parallel([function(a){g.waterfall([function(a){b._parent?h(d,a):a(null,d)},function(a,b){g.map(e,function(b,c){i(a,b,c)},b)},function(a,c){b._config.fields=f.flatten(a),c()}],a)},function(a){g.forEach(b._children||[],function(a,b){a._expandFields(b)},a)}],function(b){a(b)})},l.prototype.pipe=function(){var a=k.prototype.pipe.apply(this,arguments);return this.resume(),a},l.prototype["delete"]=l.prototype.del=l.prototype.destroy=function(a,b){if("function"==typeof a&&(b=a,a=null),a=a||this._config&&this._config.table,!a)throw new Error("SOQL based query needs SObject type information to bulk delete.");return this.pipe(this._conn.sobject(a).deleteBulk(b))},l.prototype.update=function(a,b,c){if("function"==typeof b&&(c=b,b=null),b=b||this._config&&this._config.table,!b)throw new Error("SOQL based query needs SObject type information to bulk update.");var d=f.isFunction(a)?k.map(a):k.recordMapStream(a);return this.pipe(d).pipe(this._conn.sobject(b).updateBulk(c))},l.prototype.then=function(){return!this._closed&&this._paused&&this.execute(),this._deferred.promise.then.apply(this._deferred.promise,arguments)},l.prototype.thenCall=function(a){return f.isFunction(a)?this.then(function(b){return a(null,b)},function(b){return a(b)}):this};var n=function(a,b,c){n.super_.call(this,a,c),this._parent=b};d.inherits(n,l),n.prototype.include=function(){throw new Error("Not allowed to include another subquery in subquery.")},n.prototype.end=function(){return this._parent},n.prototype.run=n.prototype.exec=n.prototype.execute=function(){return this._parent.execute.apply(this._parent,arguments)}},{"./date":12,"./record-stream":19,"./soql-builder":23,async:27,events:31,q:51,underscore:52,util:50}],19:[function(a,b){var d=a("events"),e=a("stream"),f=e.Stream,g=a("util"),h=a("underscore"),i=a("./csv"),j=b.exports=function(){this.sendable=!1,this.receivable=!1,this.on("error",function(){this.sendable=!1,this.recievable=!1}),this.on("end",function(){this.recievable=!1})};g.inherits(j,d.EventEmitter),j.prototype.send=function(){},j.prototype.end=function(){this.sendable=!1},j.prototype.destroy=function(){this.reciebable=!1,this.sendable=!1},j.prototype.destroySoon=function(){},j.prototype.pause=function(){},j.prototype.resume=function(){},j.prototype.pipe=function(a,b){var c=this,d=function(b){a.send&&!1===a.send(b)&&c.pause()};c.on("record",d);var e=function(){c.resume()};a.on("drain",e);var f=!1,g=function(){f||(f=!0,a.end())},h=function(){f||(f=!0,"function"==typeof a.destroy&&a.destroy())};b&&b.end===!1||(c.on("end",g),c.on("close",h));var i=function(a){if(j(),0===this.listeners("error").length)throw a};c.on("error",i),a.on("error",i);var j=function(){c.removeListener("record",d),a.removeListener("drain",e),c.removeListener("end",g),c.removeListener("close",h),c.removeListener("error",i),a.removeListener("error",i),c.removeListener("end",j),c.removeListener("close",j),a.removeListener("end",j),a.removeListener("close",j)};return c.on("end",j),c.on("close",j),a.on("end",j),a.on("close",j),a.emit("pipe",c),a},j.prototype.map=function(a){return this.pipe(j.map(a))},j.prototype.filter=function(a){return this.pipe(j.filter(a))},j.prototype.stream=function(a){a=a||"csv";var b;if("csv"===a&&(b=new j.CSVStream),!b)throw new Error("No stream type defined for '"+a+"'.");return this.receivable?this.pipe(b):this.sendable&&b.pipe(this),b.stream()},j.map=function(a){var b=new j;return b.receivable=!0,b.send=function(b){var c=a(b)||b;this.emit("record",c)},b.end=function(){this.emit("end")},b},j.recordMapStream=function(a,b){function c(a,b){if(h.isString(a)){var c=/^\$\{(\w+)\}$/.exec(a);return c?b[c[1]]:a.replace(/\$\{(\w+)\}/g,function(a,c){var d=b[c];return h.isNull(d)||h.isUndefined(d)?"":String(d)})}return a}return j.map(function(d){var e={Id:d.Id};for(var f in a)e[f]=b?a[f]:c(a[f],d);return e})},j.filter=function(a){var b=new j;return b.receivable=!0,b.send=function(b){a(b)&&this.emit("record",b)},b.end=function(){this.emit("end")},b};var k=j.CSVStream=function(a){var b=this;this.sendable=!0,this.receivable=!0,this.headers=a,this.wroteHeaders=!1,this._stream=new f,this._buffer=[],this._stream.on("data",function(a){b._handleData(a)}),this._stream.on("end",function(a){b._handleEnd(a)})};g.inherits(k,j),k.prototype.send=function(a){this.wroteHeaders||(this.headers||(this.headers=i.extractHeaders([a])),this._stream.emit("data",i.arrayToCSV(this.headers)+"\n"),this.wroteHeaders=!0),this._stream.emit("data",i.recordToCSV(a,this.headers)+"\n")},k.prototype.end=function(a){a&&this.send(a),this.readable=!1,this.sendable=!1,this._stream.emit("end")},k.prototype._handleData=function(a,b){this._buffer.push([a,b])},k.prototype._handleEnd=function(a,b){var c=this;a&&this._buffer.push([a,b]),a=this._buffer.map(function(a){return a[0].toString(a[1]||"utf-8")}).join("");var d=i.parseCSV(a);d.forEach(function(a){c.emit("record",a)}),this.emit("end")},k.prototype.stream=function(){return this._stream}},{"./csv":11,events:31,stream:42,underscore:52,util:50}],20:[function(a,b){var d=a("underscore")._,e=b.exports=function(a,b,c){this._conn=a,this.type=b,this.id=c};e.prototype.retrieve=function(a){return this._conn.retrieve(this.type,this.id,a)},e.prototype.update=function(a,b){return a=d.clone(a),a.Id=this.id,this._conn.update(this.type,a,b)},e.prototype["delete"]=e.prototype.del=e.prototype.destroy=function(a){return this._conn.destroy(this.type,this.id,a)},e.prototype.blob=function(a){var b=[this._conn._baseUrl(),"sobjects",this.type,this.id,a].join("/");return this._conn._request(b).stream()}},{underscore:52}],21:[function(a,b){function h(a,b){var c=b.shift();if(c){for(var d in a)if(c.test(d))return h(a[d],b);return null}return a}function i(a,b){if(d.isObject(a)&&(b=a,a=null),d.isArray(b))return d.map(b,function(b){return i(a,b)}).join("");var c=[],e=[];if(d.isObject(b)){for(var f in b){var g=b[f];"@"===f[0]?(f=f.substring(1),c.push(f+'="'+g+'"')):e.push(i(f,g))}b=e.join("")}else b=String(b);var h=a?"<"+a+(c.length>0?" "+c.join(" "):"")+">":"",j=a?"</"+a+">":"";return h+b+j}var d=a("underscore"),e=a("xml2js"),f=a("./transport"),g=b.exports=function(a,b){this.serverUrl=a.serverUrl,this.sessionId=a.sessionId,this.xmlns=a.xmlns||"urn:partner.soap.sforce.com",this._transport=b,this._transport||(this._transport=a.proxyUrl?new f:new f.ProxyTransport(a.proxyUrl))};g.prototype.invoke=function(a,b,c){var d={};d[a]=b;var f=this._createEnvelope(d);return this._transport.httpRequest({method:"POST",url:this.serverUrl,headers:{"Content-Type":"text/xml",SOAPAction:'""'},body:f}).then(function(a){var b=null;if(e.parseString(a.body,{explicitArray:!1},function(a,c){b=c}),b){var c=h(b,[/:Envelope$/,/:Body$/,/:Fault$/,/faultstring$/]);if(c)throw new Error(c);return h(b,[/:Envelope$/,/:Body$/,/.+/])}throw new Error("invalid response")}).thenCall(c)},g.prototype._createEnvelope=function(a){return['<?xml version="1.0" encoding="UTF-8"?>','<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"',' xmlns:xsd="http://www.w3.org/2001/XMLSchema"',' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">','<soapenv:Header xmlns="'+this.xmlns+'">',"<SessionHeader>","<sessionId>"+this.sessionId+"</sessionId>","</SessionHeader>","</soapenv:Header>",'<soapenv:Body xmlns="'+this.xmlns+'">',i(a),"</soapenv:Body>","</soapenv:Envelope>"].join("")}},{"./transport":26,underscore:52,xml2js:55}],22:[function(a,b){var d=a("underscore"),e=a("./record"),f=a("./query");a("./cache");var h=b.exports=function(a,b){this._conn=a,this.type=b;var c={key:"describe."+this.type};this.describe$=a.cache.makeCacheable(this.describe,this,c),this.describe=a.cache.makeResponseCacheable(this.describe,this,c)};h.prototype.insert=h.prototype.create=function(a,b){return this._conn.create(this.type,a,b)},h.prototype.retrieve=function(a,b){return this._conn.retrieve(this.type,a,b)},h.prototype.update=function(a,b){return this._conn.update(this.type,a,b)},h.prototype.upsert=function(a,b,c){return this._conn.upsert(this.type,a,b,c)},h.prototype["delete"]=h.prototype.del=h.prototype.destroy=function(a,b){return this._conn.destroy(this.type,a,b)},h.prototype.describe=function(a){return this._conn.describe(this.type,a)},h.prototype.record=function(a){return new e(this._conn,this.type,a)},h.prototype.find=function(a,b,c,d){"function"==typeof a?(d=a,a={},b=null,c=null):"function"==typeof b?(d=b,b=null,c=null):"function"==typeof c&&(d=c,c=null),c=c||{};var e={fields:b,includes:c.includes,table:this.type,conditions:a,limit:c.limit,offset:c.offset||c.skip},g=new f(this._conn,e);return g.setResponseTarget(f.ResponseTargets.Records),d&&g.run(d),g},h.prototype.findOne=function(a,b,c,e){"function"==typeof a?(e=a,a={},b=null,c=null):"function"==typeof b?(e=b,b=null,c=null):"function"==typeof c&&(e=c,c=null),c=d.extend(c||{},{limit:1});var g=this.find(a,b,c);return g.setResponseTarget(f.ResponseTargets.SingleRecord),e&&g.run(e),g},h.prototype.select=function(a,b){return this.find(null,a,null,b)},h.prototype.count=function(a,b){"function"==typeof a&&(b=a,a={});var c=this.find(a,{"count()":!0});return c.setResponseTarget("Count"),b&&c.run(b),c},h.prototype.bulkload=function(a,b,c,d){return this._conn.bulk.load(this.type,a,b,c,d)},h.prototype.insertBulk=h.prototype.createBulk=function(a,b){return this.bulkload("insert",a,b)},h.prototype.updateBulk=function(a,b){return this.bulkload("update",a,b)},h.prototype.upsertBulk=function(a,b,c){return this.bulkload("upsert",{extIdField:b},a,c)},h.prototype.deleteBulk=h.prototype.destroyBulk=function(a,b){return this.bulkload("delete",a,b)},h.prototype.deleteHardBulk=h.prototype.destroyHardBulk=function(a,b){return this.bulkload("hardDelete",a,b)},h.prototype.recent=function(a){return this._conn.recent(this.type,a)},h.prototype.updated=function(a,b,c){return this._conn.updated(this.type,a,b,c)},h.prototype.deleted=function(a,b,c){return this._conn.deleted(this.type,a,b,c)}},{"./cache":8,"./query":18,"./record":20,underscore:52}],23:[function(a,b,c){function f(a){var b=["SELECT ",g(a.fields,a.includes)," FROM ",a.table].join(""),c=h(a.conditions);c&&(b+=" WHERE "+c);var d=n(a.sort);return d&&(b+=" ORDER BY "+d),a.limit&&(b+=" LIMIT "+a.limit),a.offset&&(b+=" OFFSET "+a.offset),b}function g(a,b){return b=d.map(d.values(b||{}),function(a){return"("+f(a)+")"}),(a||["Id"]).concat(b).join(", ")}function h(a,b,c){if(d.isString(a))return a;a=a||[],b=b||"AND",c=c||0,a=m(a)?a.map(function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b.length>1?b:b[0]}):d.keys(a).map(function(b){return{key:b,value:a[b]}}),a=a.map(function(d){var f,e=c+1;switch(d.key){case"$or":case"$and":case"$not":return"NOT"!==b&&1===a.length&&(e=c),f="$or"===d.key?"OR":"$and"===d.key?"AND":"NOT",h(d.value,f,e);default:return j(d.key,d.value)}}).filter(function(a){return a});var e;
return"NOT"===b?(e=c>0,(e?"(":"")+"NOT "+a[0]+(e?")":"")):(e=c>0&&a.length>1,(e?"(":"")+a.join(" "+b+" ")+(e?")":""))}function j(a,b){var c="$eq";if(d.isObject(b))for(var f in b)if("$"===f[0]){c=f,b=b[f];break}var g=i[c];if(!g||d.isUndefined(b))return null;var h=k(b);if(d.isUndefined(h))return null;switch(g){case"NOT LIKE":return"("+["NOT",a,"LIKE",h].join(" ")+")";case"EXISTS":return[a,b?"!=":"=","null"].join(" ");default:return[a,g,h].join(" ")}}function k(a){return m(a)?a.length>0?"("+a.map(k).join(", ")+")":void 0:a instanceof e?a.toString():d.isString(a)?"'"+l(a)+"'":d.isNumber(a)?a.toString():d.isNull(a)?"null":a}function l(a){return String(a||"").replace(/'/g,"\\'")}function m(a){return d.isObject(a)&&d.isFunction(a.pop)}function n(a){if(a=a||[],d.isString(a)){if(/,|\s+(asc|desc)\s*$/.test(a))return a;a=a.split(/\s+/).map(function(a){var b="ASC",c=a[0];return"-"===c?(b="DESC",a=a.substring(1)):"+"===c&&(a=a.substring(1)),[a,b]})}else m(a)||(a=d.keys(a).map(function(b){var c=a[b];return[b,c]}));return a.map(function(a){var b=a[0],c=a[1];switch(String(c)){case"DESC":case"desc":case"descending":case"-":case"-1":c="DESC";break;default:c="ASC"}return b+" "+c}).join(", ")}var d=a("underscore"),e=a("./date"),i={"=":"=",$eq:"=","!=":"!=",$ne:"!=",">":">",$gt:">","<":"<",$lt:"<",">=":">=",$gte:">=","<=":"<=",$lte:"<=",$like:"LIKE",$nlike:"NOT LIKE",$in:"IN",$nin:"NOT IN",$exists:"EXISTS"};c.createSOQL=f},{"./date":12,underscore:52}],24:[function(a,b){var d=a("events"),e=a("util"),f=a("faye"),g=b.exports=function(a,b){this._streaming=a,this.name=b};g.prototype.subscribe=function(a){return this._streaming.subscribe(this.name,a),this},g.prototype.unsubscribe=function(a){return this._streaming.unsubscribe(this.name,a),this};var h=function(a){this._conn=a};e.inherits(h,d.EventEmitter),h.prototype._createClient=function(){var a=[this._conn.instanceUrl,"cometd",this._conn.version].join("/"),b=new f.Client(a,{});return b.setHeader("Authorization","OAuth "+this._conn.accessToken),b},h.prototype.topic=function(a){this._topics=this._topics||{};var b=this._topics[a]=this._topics[a]||new g(this,a);return b},h.prototype.subscribe=function(a,b){return this._fayeClient||(f.Transport.NodeHttp&&(f.Transport.NodeHttp.prototype.batching=!1),this._fayeClient=this._createClient()),this._fayeClient.subscribe("/topic/"+a,b),this},h.prototype.unsubscribe=function(a,b){return this._fayeClient&&this._fayeClient.unsubscribe("/topic/"+a,b),this},b.exports=h},{events:31,faye:29,util:50}],25:[function(a,b){var e=(a("util"),a("underscore")._),f=a("./cache"),g=function(a){this._conn=a,this._logger=a._logger;var b=["query","queryMore","create","insert","retrieve","update","upsert","del","delete","destroy","describe","describeGlobal","sobject"];b.forEach(function(b){this[b]=a.constructor.prototype[b]},this),this.cache=new f;var c={key:function(a){return a?"describe."+a:"describe"}};this.describe$=this.cache.makeCacheable(this.describe,this,c),this.describe=this.cache.makeResponseCacheable(this.describe,this,c),this.describeSObject$=this.describe$,this.describeSObject=this.describe,c={key:"describeGlobal"},this.describeGlobal$=this.cache.makeCacheable(this.describeGlobal,this,c),this.describeGlobal=this.cache.makeResponseCacheable(this.describeGlobal,this,c),this.initialize()};g.prototype.initialize=function(){this.sobjects={},this.cache.clear(),this.cache.get("describeGlobal").on("value",e.bind(function(a){if(a.result){var b=e.map(a.result.sobjects,function(a){return a.name});e.each(b,this.sobject,this)}},this))},g.prototype._baseUrl=function(){return this._conn.urls.rest.base+"/tooling"},g.prototype._request=function(){return this._conn._request.apply(this._conn,arguments)},g.prototype.executeAnonymous=function(a,b){var c=this._baseUrl()+"/executeAnonymous?anonymousBody="+encodeURIComponent(a);return this._request(c).thenCall(b)},g.prototype.completions=function(a,b){e.isString(a)||(b=a,a="apex");var c=this._baseUrl()+"/completions?type="+encodeURIComponent(a);return this._request(c).thenCall(b)},b.exports=g},{"./cache":8,underscore:52,util:50}],26:[function(a,b){function m(a,b){var c=a.then;return a.then=function(){b();var d=c.apply(a,arguments);return m(d,b)},a.stream=b,a}var l,d=a("__browserify_process"),e=a("util"),g=(a("stream"),a("./promise")),h=a("request"),i=a("./browser/request"),j=a("./browser/canvas"),k=a("./browser/jsonp");"undefined"==typeof window?(l=h,d.env.HTTP_PROXY&&(l=l.defaults({proxy:d.env.HTTP_PROXY}))):l=i;var n=b.exports=function(){};n.prototype.httpRequest=function(a,b,c){var e,d=g.defer(),f=l;c&&c.jsonp&&k.supported?f=k.createRequest(c.jsonp):c&&c.signedRequest&&j.supported&&(f=j.createRequest(c.signedRequest));var h=function(){return e||(e=f(a,function(a,b){a?d.reject(a):d.resolve(b)})),e};return m(d.promise,h).thenCall(b)};var o=n.ProxyTransport=function(a){this._proxyUrl=a};e.inherits(o,n),o.prototype.httpRequest=function(a,b){var c={method:a.method,url:this._proxyUrl+"?"+Date.now()+"."+(""+Math.random()).substring(2),headers:{"salesforceproxy-endpoint":a.url}};if((a.body||""===a.body)&&(c.body=a.body),a.headers)for(var d in a.headers)c.headers[d]=a.headers[d];return o.super_.prototype.httpRequest.call(this,c,b)}},{"./browser/canvas":3,"./browser/jsonp":5,"./browser/request":6,"./promise":17,__browserify_process:34,request:30,stream:42,util:50}],27:[function(a,b){b.exports=a("./lib/async")},{"./lib/async":28}],28:[function(a,b){var d=a("__browserify_process");!function(){var a={},c=this,e=c.async;"undefined"!=typeof b&&b.exports?b.exports=a:c.async=a,a.noConflict=function(){return c.async=e,a};var f=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c+=1)b(a[c],c,a)},g=function(a,b){if(a.map)return a.map(b);var c=[];return f(a,function(a,d,e){c.push(b(a,d,e))}),c},h=function(a,b,c){return a.reduce?a.reduce(b,c):(f(a,function(a,d,e){c=b(c,a,d,e)}),c)},i=function(a){if(Object.keys)return Object.keys(a);var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};a.nextTick="undefined"!=typeof d&&d.nextTick?d.nextTick:function(a){setTimeout(a,0)},a.forEach=function(a,b,c){if(c=c||function(){},!a.length)return c();var d=0;f(a,function(e){b(e,function(b){b?(c(b),c=function(){}):(d+=1,d===a.length&&c(null))})})},a.forEachSeries=function(a,b,c){if(c=c||function(){},!a.length)return c();var d=0,e=function(){b(a[d],function(b){b?(c(b),c=function(){}):(d+=1,d===a.length?c(null):e())})};e()},a.forEachLimit=function(a,b,c,d){if(d=d||function(){},!a.length||0>=b)return d();var e=0,f=0,g=0;!function h(){if(e===a.length)return d();for(;b>g&&f<a.length;)f+=1,g+=1,c(a[f-1],function(b){b?(d(b),d=function(){}):(e+=1,g-=1,e===a.length?d():h())})}()};var j=function(b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[a.forEach].concat(c))}},k=function(b){return function(){var c=Array.prototype.slice.call(arguments);return b.apply(null,[a.forEachSeries].concat(c))}},l=function(a,b,c,d){var e=[];b=g(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c,d){e[a.index]=d,b(c)})},function(a){d(a,e)})};a.map=j(l),a.mapSeries=k(l),a.reduce=function(b,c,d,e){a.forEachSeries(b,function(a,b){d(c,a,function(a,d){c=d,b(a)})},function(a){e(a,c)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(b,c,d,e){var f=g(b,function(a){return a}).reverse();a.reduce(f,c,d,e)},a.foldr=a.reduceRight;var m=function(a,b,c,d){var e=[];b=g(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c&&e.push(a),b()})},function(){d(g(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};a.filter=j(m),a.filterSeries=k(m),a.select=a.filter,a.selectSeries=a.filterSeries;var n=function(a,b,c,d){var e=[];b=g(b,function(a,b){return{index:b,value:a}}),a(b,function(a,b){c(a.value,function(c){c||e.push(a),b()})},function(){d(g(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})};a.reject=j(n),a.rejectSeries=k(n);var o=function(a,b,c,d){a(b,function(a,b){c(a,function(c){c?(d(a),d=function(){}):b()})},function(){d()})};a.detect=j(o),a.detectSeries=k(o),a.some=function(b,c,d){a.forEach(b,function(a,b){c(a,function(a){a&&(d(!0),d=function(){}),b()})},function(){d(!1)})},a.any=a.some,a.every=function(b,c,d){a.forEach(b,function(a,b){c(a,function(a){a||(d(!1),d=function(){}),b()})},function(){d(!0)})},a.all=a.every,a.sortBy=function(b,c,d){a.map(b,function(a,b){c(a,function(c,d){c?b(c):b(null,{value:a,criteria:d})})},function(a,b){if(a)return d(a);var c=function(a,b){var c=a.criteria,d=b.criteria;return d>c?-1:c>d?1:0};d(null,g(b.sort(c),function(a){return a.value}))})},a.auto=function(a,b){b=b||function(){};var c=i(a);if(!c.length)return b(null);var d={},e=[],g=function(a){e.unshift(a)},j=function(a){for(var b=0;b<e.length;b+=1)if(e[b]===a)return e.splice(b,1),void 0},k=function(){f(e.slice(0),function(a){a()})};g(function(){i(d).length===c.length&&(b(null,d),b=function(){})}),f(c,function(c){var e=a[c]instanceof Function?[a[c]]:a[c],f=function(a){if(a)b(a),b=function(){};else{var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[c]=e,k()}},i=e.slice(0,Math.abs(e.length-1))||[],l=function(){return h(i,function(a,b){return a&&d.hasOwnProperty(b)},!0)&&!d.hasOwnProperty(c)};if(l())e[e.length-1](f,d);else{var m=function(){l()&&(j(m),e[e.length-1](f,d))};g(m)}})},a.waterfall=function(b,c){if(c=c||function(){},!b.length)return c();var d=function(b){return function(e){if(e)c(e),c=function(){};else{var f=Array.prototype.slice.call(arguments,1),g=b.next();g?f.push(d(g)):f.push(c),a.nextTick(function(){b.apply(null,f)})}}};d(a.iterator(b))()},a.parallel=function(b,c){if(c=c||function(){},b.constructor===Array)a.map(b,function(a,b){a&&a(function(a){var c=Array.prototype.slice.call(arguments,1);c.length<=1&&(c=c[0]),b.call(null,a,c)})},c);else{var d={};a.forEach(i(b),function(a,c){b[a](function(b){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[a]=e,c(b)})},function(a){c(a,d)})}},a.series=function(b,c){if(c=c||function(){},b.constructor===Array)a.mapSeries(b,function(a,b){a&&a(function(a){var c=Array.prototype.slice.call(arguments,1);c.length<=1&&(c=c[0]),b.call(null,a,c)})},c);else{var d={};a.forEachSeries(i(b),function(a,c){b[a](function(b){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),d[a]=e,c(b)})},function(a){c(a,d)})}},a.iterator=function(a){var b=function(c){var d=function(){return a.length&&a[c].apply(null,arguments),d.next()};return d.next=function(){return c<a.length-1?b(c+1):null},d};return b(0)},a.apply=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b.concat(Array.prototype.slice.call(arguments)))}};var p=function(a,b,c,d){var e=[];a(b,function(a,b){c(a,function(a,c){e=e.concat(c||[]),b(a)})},function(a){d(a,e)})};a.concat=j(p),a.concatSeries=k(p),a.whilst=function(b,c,d){b()?c(function(e){return e?d(e):(a.whilst(b,c,d),void 0)}):d()},a.until=function(b,c,d){b()?d():c(function(e){return e?d(e):(a.until(b,c,d),void 0)})},a.queue=function(b,c){var d=0,e={tasks:[],concurrency:c,saturated:null,empty:null,drain:null,push:function(b,d){b.constructor!==Array&&(b=[b]),f(b,function(b){e.tasks.push({data:b,callback:"function"==typeof d?d:null}),e.saturated&&e.tasks.length==c&&e.saturated(),a.nextTick(e.process)})},process:function(){if(d<e.concurrency&&e.tasks.length){var a=e.tasks.shift();e.empty&&0==e.tasks.length&&e.empty(),d+=1,b(a.data,function(){d-=1,a.callback&&a.callback.apply(a,arguments),e.drain&&0==e.tasks.length+d&&e.drain(),e.process()})}},length:function(){return e.tasks.length},running:function(){return d}};return e};var q=function(a){return function(b){var c=Array.prototype.slice.call(arguments,1);b.apply(null,c.concat([function(b){var c=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(b?console.error&&console.error(b):console[a]&&f(c,function(b){console[a](b)}))}]))}};a.log=q("log"),a.dir=q("dir"),a.memoize=function(a,b){var c={},d={};b=b||function(a){return a};var e=function(){var e=Array.prototype.slice.call(arguments),f=e.pop(),g=b.apply(null,e);g in c?f.apply(null,c[g]):g in d?d[g].push(f):(d[g]=[f],a.apply(null,e.concat([function(){c[g]=arguments;var a=d[g];delete d[g];for(var b=0,e=a.length;e>b;b++)a[b].apply(null,arguments)}])))};return e.unmemoized=a,e},a.unmemoize=function(a){return function(){return(a.unmemoized||a).apply(null,arguments)}}}()},{__browserify_process:34}],29:[function(_dereq_,module,exports){var process=_dereq_("__browserify_process"),global="undefined"!=typeof self?self:"undefined"!=typeof window?window:{};!function(){"use strict";var Faye={VERSION:"1.0.1",BAYEUX_VERSION:"1.0",ID_LENGTH:160,JSONP_CALLBACK:"jsonpcallback",CONNECTION_TYPES:["long-polling","cross-origin-long-polling","callback-polling","websocket","eventsource","in-process"],MANDATORY_CONNECTION_TYPES:["long-polling","callback-polling","in-process"],ENV:"undefined"!=typeof window?window:global,extend:function(a,b,c){if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a.hasOwnProperty(d)&&c===!1||a[d]!==b[d]&&(a[d]=b[d]));return a},random:function(a){return a=a||this.ID_LENGTH,csprng(a,36)},clientIdFromMessages:function(a){var b=this.filter([].concat(a),function(a){return"/meta/connect"===a.channel});return b[0]&&b[0].clientId},copyObject:function(a){var b,c,d;if(a instanceof Array){for(b=[],c=a.length;c--;)b[c]=Faye.copyObject(a[c]);return b}if("object"==typeof a){b=null===a?null:{};for(d in a)b[d]=Faye.copyObject(a[d]);return b}return a},commonElement:function(a,b){for(var c=0,d=a.length;d>c;c++)if(-1!==this.indexOf(b,a[c]))return a[c];return null},indexOf:function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},map:function(a,b,c){if(a.map)return a.map(b,c);var d=[];if(a instanceof Array)for(var e=0,f=a.length;f>e;e++)d.push(b.call(c||null,a[e],e));else for(var g in a)a.hasOwnProperty(g)&&d.push(b.call(c||null,g,a[g]));return d},filter:function(a,b,c){if(a.filter)return a.filter(b,c);for(var d=[],e=0,f=a.length;f>e;e++)b.call(c||null,a[e],e)&&d.push(a[e]);return d},asyncEach:function(a,b,c,d){var e=a.length,f=-1,g=0,h=!1,i=function(){return g-=1,f+=1,f===e?c&&c.call(d):(b(a[f],k),void 0)},j=function(){if(!h){for(h=!0;g>0;)i();h=!1}},k=function(){g+=1,j()};k()},toJSON:function(a){return this.stringify?this.stringify(a,function(a,b){return this[a]instanceof Array?this[a]:b}):JSON.stringify(a)}};"undefined"!=typeof module?module.exports=Faye:"undefined"!=typeof window&&(window.Faye=Faye),Faye.Class=function(a,b){"function"!=typeof a&&(b=a,a=Object);var c=function(){return this.initialize?this.initialize.apply(this,arguments)||this:this},d=function(){};return d.prototype=a.prototype,c.prototype=new d,Faye.extend(c.prototype,b),c},function(){function c(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;c++)if(b===a[c])return c;return-1}var a=Faye.EventEmitter=function(){},b="function"==typeof Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};a.prototype.emit=function(a){if("error"===a&&(!this._events||!this._events.error||b(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var c=this._events[a];if(!c)return!1;if("function"==typeof c){switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:var d=Array.prototype.slice.call(arguments,1);c.apply(this,d)}return!0}if(b(c)){for(var d=Array.prototype.slice.call(arguments,1),e=c.slice(),f=0,g=e.length;g>f;f++)e[f].apply(this,d);return!0}return!1},a.prototype.addListener=function(a,c){if("function"!=typeof c)throw new Error("addListener only takes instances of Function");return this._events||(this._events={}),this.emit("newListener",a,c),this._events[a]?b(this._events[a])?this._events[a].push(c):this._events[a]=[this._events[a],c]:this._events[a]=c,this},a.prototype.on=a.prototype.addListener,a.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},a.prototype.removeListener=function(a,d){if("function"!=typeof d)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var e=this._events[a];if(b(e)){var f=c(e,d);if(0>f)return this;e.splice(f,1),0==e.length&&delete this._events[a]}else this._events[a]===d&&delete this._events[a];return this},a.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},a.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),b(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]}}(),Faye.Namespace=Faye.Class({initialize:function(){this._used={}},exists:function(a){return this._used.hasOwnProperty(a)},generate:function(){for(var a=Faye.random();this._used.hasOwnProperty(a);)a=Faye.random();return this._used[a]=a},release:function(a){delete this._used[a]}}),function(){var b,a=setTimeout;b="function"==typeof setImmediate?function(a){setImmediate(a)}:"object"==typeof process&&process.nextTick?function(a){process.nextTick(a)}:function(b){a(b,0)};var c=0,d=1,e=2,f=function(a){return a},g=function(a){throw a},h=function(a){if(this._state=c,this._callbacks=[],this._errbacks=[],"function"==typeof a){var b=this;a(function(a){m(b,a)},function(a){n(b,a)})}};h.prototype.then=function(a,b){var c={},d=this;return c.promise=new h(function(e,f){c.fulfill=e,c.reject=f,i(d,a,c),j(d,b,c)}),c.promise};var i=function(a,b,e){"function"!=typeof b&&(b=f);var g=function(a){k(b,a,e)};a._state===c?a._callbacks.push(g):a._state===d&&g(a._value)},j=function(a,b,d){"function"!=typeof b&&(b=g);var f=function(a){k(b,a,d)};a._state===c?a._errbacks.push(f):a._state===e&&f(a._reason)},k=function(a,c,d){b(function(){l(a,c,d)})},l=function(a,b,c){var e,g,h,d=!1;try{if(e=a(b),g=typeof e,h=null!==e&&("function"===g||"object"===g)&&e.then,e===c.promise)return c.reject(new TypeError("Recursive promise chain detected"));if("function"!=typeof h)return c.fulfill(e);h.call(e,function(a){d||(d=!0,l(f,a,c))},function(a){d||(d=!0,c.reject(a))})}catch(i){if(d)return;d=!0,c.reject(i)}},m=h.fulfill=h.resolve=function(a,b){if(a._state===c){a._state=d,a._value=b,a._errbacks=[];for(var f,e=a._callbacks;f=e.shift();)f(b)}},n=h.reject=function(a,b){if(a._state===c){a._state=e,a._reason=b,a._callbacks=[];for(var f,d=a._errbacks;f=d.shift();)f(b)}};h.defer=b,h.deferred=h.pending=function(){var a={};return a.promise=new h(function(b,c){a.fulfill=a.resolve=b,a.reject=c}),a},h.fulfilled=h.resolved=function(a){return new h(function(b){b(a)})},h.rejected=function(a){return new h(function(b,c){c(a)})},"undefined"==typeof Faye?module.exports=h:Faye.Promise=h}(),Faye.Set=Faye.Class({initialize:function(){this._index={}},add:function(a){var b=void 0!==a.id?a.id:a;return this._index.hasOwnProperty(b)?!1:(this._index[b]=a,!0)},forEach:function(a,b){for(var c in this._index)this._index.hasOwnProperty(c)&&a.call(b,this._index[c])},isEmpty:function(){for(var a in this._index)if(this._index.hasOwnProperty(a))return!1;return!0},member:function(a){for(var b in this._index)if(this._index[b]===a)return!0;return!1},remove:function(a){var b=void 0!==a.id?a.id:a,c=this._index[b];return delete this._index[b],c},toArray:function(){var a=[];return this.forEach(function(b){a.push(b)}),a}}),Faye.URI={isURI:function(a){return a&&a.protocol&&a.host&&a.path},isSameOrigin:function(a){var b=Faye.ENV.location;return a.protocol===b.protocol&&a.hostname===b.hostname&&a.port===b.port},parse:function(a){if("string"!=typeof a)return a;var c,d,e,f,g,h,b={},i=function(c,d){a=a.replace(d,function(a){return b[c]=a,""}),b[c]=b[c]||""};for(i("protocol",/^[a-z]+\:/i),i("host",/^\/\/[^\/\?#]+/),/^\//.test(a)||b.host||(a=Faye.ENV.location.pathname.replace(/[^\/]*$/,"")+a),i("pathname",/^[^\?#]*/),i("search",/^\?[^#]*/),i("hash",/^#.*/),b.protocol=b.protocol||Faye.ENV.location.protocol,b.host?(b.host=b.host.substr(2),c=b.host.split(":"),b.hostname=c[0],b.port=c[1]||""):(b.host=Faye.ENV.location.host,b.hostname=Faye.ENV.location.hostname,b.port=Faye.ENV.location.port),b.pathname=b.pathname||"/",b.path=b.pathname+b.search,d=b.search.replace(/^\?/,""),e=d?d.split("&"):[],h={},f=0,g=e.length;g>f;f++)c=e[f].split("="),h[decodeURIComponent(c[0]||"")]=decodeURIComponent(c[1]||"");return b.query=h,b.href=this.stringify(b),b},stringify:function(a){var b=a.protocol+"//"+a.hostname;return a.port&&(b+=":"+a.port),b+=a.pathname+this.queryString(a.query)+(a.hash||"")},queryString:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return 0===b.length?"":"?"+b.join("&")}},Faye.Error=Faye.Class({initialize:function(a,b,c){this.code=a,this.params=Array.prototype.slice.call(b),this.message=c},toString:function(){return this.code+":"+this.params.join(",")+":"+this.message}}),Faye.Error.parse=function(a){if(a=a||"",!Faye.Grammar.ERROR.test(a))return new this(null,[],a);var b=a.split(":"),c=parseInt(b[0]),d=b[1].split(","),a=b[2];return new this(c,d,a)},Faye.Error.versionMismatch=function(){return new this(300,arguments,"Version mismatch").toString()},Faye.Error.conntypeMismatch=function(){return new this(301,arguments,"Connection types not supported").toString()},Faye.Error.extMismatch=function(){return new this(302,arguments,"Extension mismatch").toString()},Faye.Error.badRequest=function(){return new this(400,arguments,"Bad request").toString()},Faye.Error.clientUnknown=function(){return new this(401,arguments,"Unknown client").toString()},Faye.Error.parameterMissing=function(){return new this(402,arguments,"Missing required parameter").toString()},Faye.Error.channelForbidden=function(){return new this(403,arguments,"Forbidden channel").toString()},Faye.Error.channelUnknown=function(){return new this(404,arguments,"Unknown channel").toString()},Faye.Error.channelInvalid=function(){return new this(405,arguments,"Invalid channel").toString()},Faye.Error.extUnknown=function(){return new this(406,arguments,"Unknown extension").toString()},Faye.Error.publishFailed=function(){return new this(407,arguments,"Failed to publish").toString()},Faye.Error.serverError=function(){return new this(500,arguments,"Internal server error").toString()},Faye.Deferrable={then:function(a,b){var c=this;return this._promise||(this._promise=new Faye.Promise(function(a,b){c._fulfill=a,c._reject=b})),0===arguments.length?this._promise:this._promise.then(a,b)},callback:function(a,b){return this.then(function(c){a.call(b,c)})},errback:function(a,b){return this.then(null,function(c){a.call(b,c)})},timeout:function(a,b){this.then();var c=this;this._timer=Faye.ENV.setTimeout(function(){c._reject(b)},1e3*a)},setDeferredStatus:function(a,b){this._timer&&Faye.ENV.clearTimeout(this._timer),this.then(),"succeeded"===a?this._fulfill(b):"failed"===a?this._reject(b):delete this._promise}},Faye.Publisher={countListeners:function(a){return this.listeners(a).length},bind:function(a,b,c){var d=Array.prototype.slice,e=function(){b.apply(c,d.call(arguments))};return this._listeners=this._listeners||[],this._listeners.push([a,b,c,e]),this.on(a,e)},unbind:function(a,b,c){this._listeners=this._listeners||[];for(var e,d=this._listeners.length;d--;)e=this._listeners[d],e[0]===a&&(!b||e[1]===b&&e[2]===c)&&(this._listeners.splice(d,1),this.removeListener(a,e[3]))}},Faye.extend(Faye.Publisher,Faye.EventEmitter.prototype),Faye.Publisher.trigger=Faye.Publisher.emit,Faye.Timeouts={addTimeout:function(a,b,c,d){if(this._timeouts=this._timeouts||{},!this._timeouts.hasOwnProperty(a)){var e=this;this._timeouts[a]=Faye.ENV.setTimeout(function(){delete e._timeouts[a],c.call(d)},1e3*b)}},removeTimeout:function(a){this._timeouts=this._timeouts||{};var b=this._timeouts[a];b&&(clearTimeout(b),delete this._timeouts[a])},removeAllTimeouts:function(){this._timeouts=this._timeouts||{};for(var a in this._timeouts)this.removeTimeout(a)}},Faye.Logging={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(a,b){if(Faye.logger){var a=Array.prototype.slice.apply(a),c="[Faye",d=this.className,e=a.shift().replace(/\?/g,function(){try{return Faye.toJSON(a.shift())}catch(b){return"[Object]"}});for(var f in Faye)d||"function"==typeof Faye[f]&&this instanceof Faye[f]&&(d=f);d&&(c+="."+d),c+="] ","function"==typeof Faye.logger[b]?Faye.logger[b](c+e):"function"==typeof Faye.logger&&Faye.logger(c+e)}}},function(){for(var a in Faye.Logging.LOG_LEVELS)!function(a){Faye.Logging[a]=function(){this.writeLog(arguments,a)}}(a,Faye.Logging.LOG_LEVELS[a])}(),Faye.Grammar={CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/},Faye.Extensible={addExtension:function(a){this._extensions=this._extensions||[],this._extensions.push(a),a.added&&a.added(this)},removeExtension:function(a){if(this._extensions)for(var b=this._extensions.length;b--;)this._extensions[b]===a&&(this._extensions.splice(b,1),a.removed&&a.removed(this))},pipeThroughExtensions:function(a,b,c,d,e){if(this.debug("Passing through ? extensions: ?",a,b),!this._extensions)return d.call(e,b);var f=this._extensions.slice(),g=function(b){if(!b)return d.call(e,b);var h=f.shift();if(!h)return d.call(e,b);var i=h[a];return i?(i.length>=3?h[a](b,c,g):h[a](b,g),void 0):g(b)};g(b)}},Faye.extend(Faye.Extensible,Faye.Logging),Faye.Channel=Faye.Class({initialize:function(a){this.id=this.name=a},push:function(a){this.trigger("message",a)},isUnused:function(){return 0===this.countListeners("message")}}),Faye.extend(Faye.Channel.prototype,Faye.Publisher),Faye.extend(Faye.Channel,{HANDSHAKE:"/meta/handshake",CONNECT:"/meta/connect",SUBSCRIBE:"/meta/subscribe",UNSUBSCRIBE:"/meta/unsubscribe",DISCONNECT:"/meta/disconnect",META:"meta",SERVICE:"service",expand:function(a){var b=this.parse(a),c=["/**",a],d=b.slice();d[d.length-1]="*",c.push(this.unparse(d));for(var e=1,f=b.length;f>e;e++)d=b.slice(0,e),d.push("**"),c.push(this.unparse(d));return c},isValid:function(a){return Faye.Grammar.CHANNEL_NAME.test(a)||Faye.Grammar.CHANNEL_PATTERN.test(a)},parse:function(a){return this.isValid(a)?a.split("/").slice(1):null},unparse:function(a){return"/"+a.join("/")},isMeta:function(a){var b=this.parse(a);return b?b[0]===this.META:null},isService:function(a){var b=this.parse(a);return b?b[0]===this.SERVICE:null},isSubscribable:function(a){return this.isValid(a)?!this.isMeta(a)&&!this.isService(a):null},Set:Faye.Class({initialize:function(){this._channels={}},getKeys:function(){var a=[];for(var b in this._channels)a.push(b);return a},remove:function(a){delete this._channels[a]},hasSubscription:function(a){return this._channels.hasOwnProperty(a)},subscribe:function(a,b,c){if(b)for(var d,e=0,f=a.length;f>e;e++){d=a[e];var g=this._channels[d]=this._channels[d]||new Faye.Channel(d);g.bind("message",b,c)}},unsubscribe:function(a,b,c){var d=this._channels[a];return d?(d.unbind("message",b,c),d.isUnused()?(this.remove(a),!0):!1):!1},distributeMessage:function(a){for(var b=Faye.Channel.expand(a.channel),c=0,d=b.length;d>c;c++){var e=this._channels[b[c]];e&&e.trigger("message",a.data)}}})}),Faye.Envelope=Faye.Class({initialize:function(a,b){this.id=a.id,this.message=a,void 0!==b&&this.timeout(b/1e3,!1)}}),Faye.extend(Faye.Envelope.prototype,Faye.Deferrable),Faye.Publication=Faye.Class(Faye.Deferrable),Faye.Subscription=Faye.Class({initialize:function(a,b,c,d){this._client=a,this._channels=b,this._callback=c,this._context=d,this._cancelled=!1},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this._callback,this._context),this._cancelled=!0)},unsubscribe:function(){this.cancel()}}),Faye.extend(Faye.Subscription.prototype,Faye.Deferrable),Faye.Client=Faye.Class({UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:"handshake",RETRY:"retry",NONE:"none",CONNECTION_TIMEOUT:60,DEFAULT_RETRY:5,MAX_REQUEST_SIZE:2048,DEFAULT_ENDPOINT:"/bayeux",INTERVAL:0,initialize:function(a,b){this.info("New client created for ?",a),this._options=b||{},this.endpoint=Faye.URI.parse(a||this.DEFAULT_ENDPOINT),this.endpoints=this._options.endpoints||{},this.transports={},this.cookies=Faye.CookieJar&&new Faye.CookieJar,this.headers={},this.ca=this._options.ca,this._disabled=[],this._retry=this._options.retry||this.DEFAULT_RETRY;for(var c in this.endpoints)this.endpoints[c]=Faye.URI.parse(this.endpoints[c]);this.maxRequestSize=this.MAX_REQUEST_SIZE,this._state=this.UNCONNECTED,this._channels=new Faye.Channel.Set,this._messageId=0,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(this._options.interval||this.INTERVAL),timeout:1e3*(this._options.timeout||this.CONNECTION_TIMEOUT)},Faye.Event&&void 0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,"beforeunload",function(){Faye.indexOf(this._disabled,"autodisconnect")<0&&this.disconnect()},this)},disable:function(a){this._disabled.push(a)},setHeader:function(a,b){this.headers[a]=b},handshake:function(a,b){if(this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED){this._state=this.CONNECTING;var c=this;this.info("Initiating handshake with ?",Faye.URI.stringify(this.endpoint)),this._selectTransport(Faye.MANDATORY_CONNECTION_TYPES),this._send({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:[this._transport.connectionType]},function(d){d.successful?(this._state=this.CONNECTED,this._clientId=d.clientId,this._selectTransport(d.supportedConnectionTypes),this.info("Handshake successful: ?",this._clientId),this.subscribe(this._channels.getKeys(),!0),a&&Faye.Promise.defer(function(){a.call(b)})):(this.info("Handshake unsuccessful"),Faye.ENV.setTimeout(function(){c.handshake(a,b)},this._advice.interval),this._state=this.UNCONNECTED)},this)}},connect:function(a,b){if(this._advice.reconnect!==this.NONE&&this._state!==this.DISCONNECTED){if(this._state===this.UNCONNECTED)return this.handshake(function(){this.connect(a,b)},this);this.callback(a,b),this._state===this.CONNECTED&&(this.info("Calling deferred actions for ?",this._clientId),this.setDeferredStatus("succeeded"),this.setDeferredStatus("unknown"),this._connectRequest||(this._connectRequest=!0,this.info("Initiating connection for ?",this._clientId),this._send({channel:Faye.Channel.CONNECT,clientId:this._clientId,connectionType:this._transport.connectionType},this._cycleConnection,this)))}},disconnect:function(){this._state===this.CONNECTED&&(this._state=this.DISCONNECTED,this.info("Disconnecting ?",this._clientId),this._send({channel:Faye.Channel.DISCONNECT,clientId:this._clientId},function(a){a.successful&&(this._transport.close(),delete this._transport)},this),this.info("Clearing channel listeners for ?",this._clientId),this._channels=new Faye.Channel.Set)},subscribe:function(a,b,c){if(a instanceof Array)return Faye.map(a,function(a){return this.subscribe(a,b,c)},this);var d=new Faye.Subscription(this,a,b,c),e=b===!0,f=this._channels.hasSubscription(a);return f&&!e?(this._channels.subscribe([a],b,c),d.setDeferredStatus("succeeded"),d):(this.connect(function(){this.info("Client ? attempting to subscribe to ?",this._clientId,a),e||this._channels.subscribe([a],b,c),this._send({channel:Faye.Channel.SUBSCRIBE,clientId:this._clientId,subscription:a},function(e){if(!e.successful)return d.setDeferredStatus("failed",Faye.Error.parse(e.error)),this._channels.unsubscribe(a,b,c);
var f=[].concat(e.subscription);this.info("Subscription acknowledged for ? to ?",this._clientId,f),d.setDeferredStatus("succeeded")},this)},this),d)},unsubscribe:function(a,b,c){if(a instanceof Array)return Faye.map(a,function(a){return this.unsubscribe(a,b,c)},this);var d=this._channels.unsubscribe(a,b,c);d&&this.connect(function(){this.info("Client ? attempting to unsubscribe from ?",this._clientId,a),this._send({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._clientId,subscription:a},function(a){if(a.successful){var b=[].concat(a.subscription);this.info("Unsubscription acknowledged for ? from ?",this._clientId,b)}},this)},this)},publish:function(a,b){var c=new Faye.Publication;return this.connect(function(){this.info("Client ? queueing published message to ?: ?",this._clientId,a,b),this._send({channel:a,data:b,clientId:this._clientId},function(a){a.successful?c.setDeferredStatus("succeeded"):c.setDeferredStatus("failed",Faye.Error.parse(a.error))},this)},this),c},receiveMessage:function(a){var d,b=a.id;void 0!==a.successful&&(d=this._responseCallbacks[b],delete this._responseCallbacks[b]),this.pipeThroughExtensions("incoming",a,null,function(a){a&&(a.advice&&this._handleAdvice(a.advice),this._deliverMessage(a),d&&d[0].call(d[1],a))},this),this._transportUp!==!0&&(this._transportUp=!0,this.trigger("transport:up"))},messageError:function(a,b){for(var e,f,c=this._retry,d=this,h=0,i=a.length;i>h;h++)f=a[h],e=f.id,b?this._transportSend(f):Faye.ENV.setTimeout(function(){d._transportSend(f)},1e3*c);b||this._transportUp===!1||(this._transportUp=!1,this.trigger("transport:down"))},_selectTransport:function(a){Faye.Transport.get(this,a,this._disabled,function(a){this.debug("Selected ? transport for ?",a.connectionType,Faye.URI.stringify(a.endpoint)),a!==this._transport&&(this._transport&&this._transport.close(),this._transport=a)},this)},_send:function(a,b,c){this._transport&&(a.id=a.id||this._generateMessageId(),this.pipeThroughExtensions("outgoing",a,null,function(a){a&&(b&&(this._responseCallbacks[a.id]=[b,c]),this._transportSend(a))},this))},_transportSend:function(a){if(this._transport){var b=1.2*(this._advice.timeout||1e3*this._retry),c=new Faye.Envelope(a,b);c.errback(function(b){this.messageError([a],b)},this),this._transport.send(c)}},_generateMessageId:function(){return this._messageId+=1,this._messageId>=Math.pow(2,32)&&(this._messageId=0),this._messageId.toString(36)},_handleAdvice:function(a){Faye.extend(this._advice,a),this._advice.reconnect===this.HANDSHAKE&&this._state!==this.DISCONNECTED&&(this._state=this.UNCONNECTED,this._clientId=null,this._cycleConnection())},_deliverMessage:function(a){a.channel&&void 0!==a.data&&(this.info("Client ? calling listeners for ? with ?",this._clientId,a.channel,a.data),this._channels.distributeMessage(a))},_cycleConnection:function(){this._connectRequest&&(this._connectRequest=null,this.info("Closed connection for ?",this._clientId));var a=this;Faye.ENV.setTimeout(function(){a.connect()},this._advice.interval)}}),Faye.extend(Faye.Client.prototype,Faye.Deferrable),Faye.extend(Faye.Client.prototype,Faye.Publisher),Faye.extend(Faye.Client.prototype,Faye.Logging),Faye.extend(Faye.Client.prototype,Faye.Extensible),Faye.Transport=Faye.extend(Faye.Class({MAX_DELAY:0,batching:!0,initialize:function(a,b){this._client=a,this.endpoint=b,this._outbox=[]},close:function(){},encode:function(){return""},send:function(a){var b=a.message;return this.debug("Client ? sending message to ?: ?",this._client._clientId,Faye.URI.stringify(this.endpoint),b),this.batching?(this._outbox.push(a),b.channel===Faye.Channel.HANDSHAKE?this.addTimeout("publish",.01,this.flush,this):(b.channel===Faye.Channel.CONNECT&&(this._connectMessage=b),this.flushLargeBatch(),this.addTimeout("publish",this.MAX_DELAY,this.flush,this),void 0)):this.request([a])},flush:function(){this.removeTimeout("publish"),this._outbox.length>1&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this.request(this._outbox),this._connectMessage=null,this._outbox=[]},flushLargeBatch:function(){var a=this.encode(this._outbox);if(!(a.length<this._client.maxRequestSize)){var b=this._outbox.pop();this.flush(),b&&this._outbox.push(b)}},receive:function(a,b){for(var c=a.length;c--;)a[c].setDeferredStatus("succeeded");b=[].concat(b),this.debug("Client ? received from ?: ?",this._client._clientId,Faye.URI.stringify(this.endpoint),b);for(var d=0,c=b.length;c>d;d++)this._client.receiveMessage(b[d])},handleError:function(a,b){for(var c=a.length;c--;)a[c].setDeferredStatus("failed",b)},_getCookies:function(){var a=this._client.cookies;return a?a.getCookies({domain:this.endpoint.hostname,path:this.endpoint.path,secure:"https:"===this.endpoint.protocol}).toValueString():""},_storeCookies:function(a){if(a&&this._client.cookies){a=[].concat(a);for(var b,c=0,d=a.length;d>c;c++)b=this._client.cookies.setCookie(a[c]),b=b[0]||b,b.domain=b.domain||this.endpoint.hostname}}}),{get:function(a,b,c,d,e){var f=a.endpoint;Faye.asyncEach(this._transports,function(g,h){var i=g[0],j=g[1],k=a.endpoints[i]||f;return Faye.indexOf(c,i)>=0?h():Faye.indexOf(b,i)<0?(j.isUsable(a,k,function(){}),h()):(j.isUsable(a,k,function(b){if(!b)return h();var c=j.hasOwnProperty("create")?j.create(a,k):new j(a,k);d.call(e,c)}),void 0)},function(){throw new Error("Could not find a usable connection type for "+Faye.URI.stringify(f))})},register:function(a,b){this._transports.push([a,b]),b.prototype.connectionType=a},_transports:[]}),Faye.extend(Faye.Transport.prototype,Faye.Logging),Faye.extend(Faye.Transport.prototype,Faye.Timeouts),Faye.Event={_registry:[],on:function(a,b,c,d){var e=function(){c.call(d)};a.addEventListener?a.addEventListener(b,e,!1):a.attachEvent("on"+b,e),this._registry.push({_element:a,_type:b,_callback:c,_context:d,_handler:e})},detach:function(a,b,c,d){for(var f,e=this._registry.length;e--;)f=this._registry[e],a&&a!==f._element||b&&b!==f._type||c&&c!==f._callback||d&&d!==f._context||(f._element.removeEventListener?f._element.removeEventListener(f._type,f._handler,!1):f._element.detachEvent("on"+f._type,f._handler),this._registry.splice(e,1),f=null)}},void 0!==Faye.ENV.onunload&&Faye.Event.on(Faye.ENV,"unload",Faye.Event.detach,Faye.Event),"object"!=typeof JSON&&(JSON={}),function(){function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,h,g=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,h=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)h[c]=str(c,i)||"null";return e=0===h.length?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=0===h.length?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;Faye.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})},"function"!=typeof JSON.stringify&&(JSON.stringify=Faye.stringify),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(a,b){this.callback(function(){a.call(b,!0)}),this.errback(function(){a.call(b,!1)}),this.connect()},request:function(a){this._pending=this._pending||new Faye.Set;for(var b=0,c=a.length;c>b;b++)this._pending.add(a[b]);this.callback(function(b){if(b){var c=Faye.map(a,function(a){return a.message});b.send(Faye.toJSON(c))}},this),this.connect()},connect:function(){if(!Faye.Transport.WebSocket._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var a=this._createSocket();if(!a)return this.setDeferredStatus("failed");var b=this;a.onopen=function(){a.headers&&b._storeCookies(a.headers["set-cookie"]),b._socket=a,b._state=b.CONNECTED,b._everConnected=!0,b._ping(),b.setDeferredStatus("succeeded",a)};var c=!1;a.onclose=a.onerror=function(){if(!c){c=!0;var d=b._state===b.CONNECTED;a.onopen=a.onclose=a.onerror=a.onmessage=null,delete b._socket,b._state=b.UNCONNECTED,b.removeTimeout("ping"),b.setDeferredStatus("unknown");var e=b._pending?b._pending.toArray():[];delete b._pending,d?b.handleError(e,!0):b._everConnected?b.handleError(e):b.setDeferredStatus("failed")}},a.onmessage=function(a){var e,c=JSON.parse(a.data),d=[];if(c){c=[].concat(c);for(var f=0,g=c.length;g>f;f++)void 0!==c[f].successful&&(e=b._pending.remove(c[f]),e&&d.push(e));b.receive(d,c)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var a=Faye.Transport.WebSocket.getSocketUrl(this.endpoint),b={headers:Faye.copyObject(this._client.headers),ca:this._client.ca};return b.headers.Cookie=this._getCookies(),Faye.WebSocket?new Faye.WebSocket.Client(a,[],b):Faye.ENV.MozWebSocket?new MozWebSocket(a):Faye.ENV.WebSocket?new WebSocket(a):void 0},_ping:function(){this._socket&&(this._socket.send("[]"),this.addTimeout("ping",this._client._advice.timeout/2e3,this._ping,this))}}),{PROTOCOLS:{"http:":"ws:","https:":"wss:"},create:function(a,b){var c=a.transports.websocket=a.transports.websocket||{};return c[b.href]=c[b.href]||new this(a,b),c[b.href]},getSocketUrl:function(a){return a=Faye.copyObject(a),a.protocol=this.PROTOCOLS[a.protocol],Faye.URI.stringify(a)},isUsable:function(a,b,c,d){this.create(a,b).isUsable(c,d)}}),Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable),Faye.Transport.register("websocket",Faye.Transport.WebSocket),Faye.Event&&Faye.Event.on(Faye.ENV,"beforeunload",function(){Faye.Transport.WebSocket._unloaded=!0}),Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(a,b){if(Faye.Transport.prototype.initialize.call(this,a,b),!Faye.ENV.EventSource)return this.setDeferredStatus("failed");this._xhr=new Faye.Transport.XHR(a,b),b=Faye.copyObject(b),b.pathname+="/"+a._clientId;var c=new EventSource(Faye.URI.stringify(b)),d=this;c.onopen=function(){d._everConnected=!0,d.setDeferredStatus("succeeded")},c.onerror=function(){d._everConnected?d._client.messageError([]):(d.setDeferredStatus("failed"),c.close())},c.onmessage=function(a){d.receive([],JSON.parse(a.data))},this._socket=c},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(a,b){this.callback(function(){a.call(b,!0)}),this.errback(function(){a.call(b,!1)})},encode:function(a){return this._xhr.encode(a)},request:function(a){this._xhr.request(a)}}),{isUsable:function(a,b,c,d){var e=a._clientId;return e?(Faye.Transport.XHR.isUsable(a,b,function(e){return e?(this.create(a,b).isUsable(c,d),void 0):c.call(d,!1)},this),void 0):c.call(d,!1)},create:function(a,b){var c=a.transports.eventsource=a.transports.eventsource||{},d=a._clientId;b=Faye.copyObject(b),b.pathname+="/"+(d||"");var e=Faye.URI.stringify(b);return c[e]=c[e]||new this(a,b),c[e]}}),Faye.extend(Faye.Transport.EventSource.prototype,Faye.Deferrable),Faye.Transport.register("eventsource",Faye.Transport.EventSource),Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{encode:function(a){var b=Faye.map(a,function(a){return a.message});return Faye.toJSON(b)},request:function(a){var b=this.endpoint.path,c=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest,d=this;c.open("POST",b,!0),c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("Pragma","no-cache"),c.setRequestHeader("X-Requested-With","XMLHttpRequest");var e=this._client.headers;for(var f in e)e.hasOwnProperty(f)&&c.setRequestHeader(f,e[f]);var g=function(){c.abort()};Faye.Event.on(Faye.ENV,"beforeunload",g),c.onreadystatechange=function(){if(c&&4===c.readyState){var b=null,e=c.status,f=c.responseText,h=e>=200&&300>e||304===e||1223===e;if(Faye.Event.detach(Faye.ENV,"beforeunload",g),c.onreadystatechange=function(){},c=null,!h)return d.handleError(a);try{b=JSON.parse(f)}catch(i){}b?d.receive(a,b):d.handleError(a)}},c.send(this.encode(a))}}),{isUsable:function(a,b,c,d){c.call(d,Faye.URI.isSameOrigin(b))}}),Faye.Transport.register("long-polling",Faye.Transport.XHR),Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{encode:function(a){var b=Faye.map(a,function(a){return a.message});return"message="+encodeURIComponent(Faye.toJSON(b))},request:function(a){var f,b=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,c=new b,d=this._client.headers,e=this;if(c.open("POST",Faye.URI.stringify(this.endpoint),!0),c.setRequestHeader){c.setRequestHeader("Pragma","no-cache");for(f in d)d.hasOwnProperty(f)&&c.setRequestHeader(f,d[f])}var g=function(){return c?(c.onload=c.onerror=c.ontimeout=c.onprogress=null,c=null,void 0):!1};c.onload=function(){var b=null;try{b=JSON.parse(c.responseText)}catch(d){}g(),b?e.receive(a,b):e.handleError(a)},c.onerror=c.ontimeout=function(){g(),e.handleError(a)},c.onprogress=function(){},c.send(this.encode(a))}}),{isUsable:function(a,b,c,d){if(Faye.URI.isSameOrigin(b))return c.call(d,!1);if(Faye.ENV.XDomainRequest)return c.call(d,b.protocol===Faye.ENV.location.protocol);if(Faye.ENV.XMLHttpRequest){var e=new Faye.ENV.XMLHttpRequest;return c.call(d,void 0!==e.withCredentials)}return c.call(d,!1)}}),Faye.Transport.register("cross-origin-long-polling",Faye.Transport.CORS),Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{encode:function(a){var b=Faye.map(a,function(a){return a.message}),c=Faye.copyObject(this.endpoint);return c.query.message=Faye.toJSON(b),c.query.jsonp="__jsonp"+Faye.Transport.JSONP._cbCount+"__",Faye.URI.stringify(c)},request:function(a){var b=Faye.map(a,function(a){return a.message}),c=document.getElementsByTagName("head")[0],d=document.createElement("script"),e=Faye.Transport.JSONP.getCallbackName(),f=Faye.copyObject(this.endpoint),g=this;f.query.message=Faye.toJSON(b),f.query.jsonp=e,Faye.ENV[e]=function(b){if(!Faye.ENV[e])return!1;Faye.ENV[e]=void 0;try{delete Faye.ENV[e]}catch(c){}d.parentNode.removeChild(d),g.receive(a,b)},d.type="text/javascript",d.src=Faye.URI.stringify(f),c.appendChild(d)}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(a,b,c,d){c.call(d,!0)}}),Faye.Transport.register("callback-polling",Faye.Transport.JSONP)}()},{__browserify_process:34}],30:[function(){},{}],31:[function(a,b){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length))throw b=arguments[1],b instanceof Error?b:TypeError('Uncaught, unspecified "error" event.');if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function d(){this.removeListener(a,d),c||(c=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var c=!1;return d.listener=b,this.on(a,d),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],32:[function(a,b){b.exports="function"==typeof Object.create?function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],33:[function(a,b){a=function d(b,c,e){function f(h,i){if(!c[h]){if(!b[h]){var j="function"==typeof a&&a;if(!i&&j)return j(h,!0);if(g)return g(h,!0);throw new Error("Cannot find module '"+h+"'")}var k=c[h]={exports:{}};b[h][0].call(k.exports,function(a){var c=b[h][1][a];return f(c?c:a)},k,k.exports,d,b,c,e)}return c[h].exports}for(var g="function"==typeof a&&a,h=0;h<e.length;h++)f(e[h]);return f}({PcZj9L:[function(a,b,c){function g(a,b,c){if(!(this instanceof g))return new g(a,b,c);var d=typeof a;if("base64"===b&&"string"===d)for(a=F(a);0!==a.length%4;)a+="=";var e;if("number"===d)e=J(a);else if("string"===d)e=g.byteLength(a,b);else{if("object"!==d)throw new Error("First argument needs to be a number, array or string.");e=J(a.length)}var h;f?h=H(new Uint8Array(e)):(h=this,h.length=e);var i;if(g.isBuffer(a))h.set(a);else if(L(a))for(i=0;e>i;i++)h[i]=g.isBuffer(a)?a.readUInt8(i):a[i];else if("string"===d)h.write(a,0,b);else if("number"===d&&!f&&!c)for(i=0;e>i;i++)h[i]=0;return h}function h(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(0!==f%2)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var h=0;d>h;h++){var i=parseInt(b.substr(2*h,2),16);if(isNaN(i))throw new Error("Invalid hex string");a[c+h]=i}return g._charsWritten=2*h,h}function i(a,b,c,d){return g._charsWritten=Q(N(b),a,c,d)}function k(a,b,c,d){return g._charsWritten=Q(O(b),a,c,d)}function l(a,b,c,d){return k(a,b,c,d)}function m(a,b,c,d){return g._charsWritten=Q(P(b),a,c,d)}function n(a,b,c){return 0===b&&c===a.length?d.fromByteArray(a):d.fromByteArray(a.slice(b,c))}function o(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=R(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+R(e)}function p(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function q(a,b,c){return p(a,b,c)}function r(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=M(a[f]);return e}function s(a,b,c,d){d||(V("boolean"==typeof c,"missing or invalid endian"),V(void 0!==b&&null!==b,"missing offset"),V(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){if(f){if(e>b+1)return a._dataview.getUint16(b,c);var g=new DataView(new ArrayBuffer(2));return g.setUint8(0,a[e-1]),g.getUint16(0,c)}var h;return c?(h=a[b],e>b+1&&(h|=a[b+1]<<8)):(h=a[b]<<8,e>b+1&&(h|=a[b+1])),h}}function t(a,b,c,d){d||(V("boolean"==typeof c,"missing or invalid endian"),V(void 0!==b&&null!==b,"missing offset"),V(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){if(f){if(e>b+3)return a._dataview.getUint32(b,c);for(var g=new DataView(new ArrayBuffer(4)),h=0;e>h+b;h++)g.setUint8(h,a[h+b]);return g.getUint32(0,c)}var i;return c?(e>b+2&&(i=a[b+2]<<16),e>b+1&&(i|=a[b+1]<<8),i|=a[b],e>b+3&&(i+=a[b+3]<<24>>>0)):(e>b+1&&(i=a[b+1]<<16),e>b+2&&(i|=a[b+2]<<8),e>b+3&&(i|=a[b+3]),i+=a[b]<<24>>>0),i}}function u(a,b,c,d){d||(V("boolean"==typeof c,"missing or invalid endian"),V(void 0!==b&&null!==b,"missing offset"),V(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){if(f){if(b+1===e){var g=new DataView(new ArrayBuffer(2));return g.setUint8(0,a[e-1]),g.getInt16(0,c)}return a._dataview.getInt16(b,c)}var h=s(a,b,c,!0),i=32768&h;return i?-1*(65535-h+1):h}}function v(a,b,c,d){d||(V("boolean"==typeof c,"missing or invalid endian"),V(void 0!==b&&null!==b,"missing offset"),V(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){if(f){if(b+3>=e){for(var g=new DataView(new ArrayBuffer(4)),h=0;e>h+b;h++)g.setUint8(h,a[h+b]);return g.getInt32(0,c)}return a._dataview.getInt32(b,c)}var i=t(a,b,c,!0),j=2147483648&i;return j?-1*(4294967295-i+1):i}}function w(a,b,c,d){return d||(V("boolean"==typeof c,"missing or invalid endian"),V(b+3<a.length,"Trying to read beyond buffer length")),f?a._dataview.getFloat32(b,c):e.read(a,b,c,23,4)}function x(a,b,c,d){return d||(V("boolean"==typeof c,"missing or invalid endian"),V(b+7<a.length,"Trying to read beyond buffer length")),f?a._dataview.getFloat64(b,c):e.read(a,b,c,52,8)}function y(a,b,c,d,e){e||(V(void 0!==b&&null!==b,"missing value"),V("boolean"==typeof d,"missing or invalid endian"),V(void 0!==c&&null!==c,"missing offset"),V(c+1<a.length,"trying to write beyond buffer length"),S(b,65535));var g=a.length;if(!(c>=g))if(f)if(c+1===g){var h=new DataView(new ArrayBuffer(2));h.setUint16(0,b,d),a[c]=h.getUint8(0)}else a._dataview.setUint16(c,b,d);else for(var i=0,j=Math.min(g-c,2);j>i;i++)a[c+i]=(b&255<<8*(d?i:1-i))>>>8*(d?i:1-i)}function z(a,b,c,d,e){e||(V(void 0!==b&&null!==b,"missing value"),V("boolean"==typeof d,"missing or invalid endian"),V(void 0!==c&&null!==c,"missing offset"),V(c+3<a.length,"trying to write beyond buffer length"),S(b,4294967295));var g=a.length;if(!(c>=g)){var h;if(f)if(c+3>=g){var i=new DataView(new ArrayBuffer(4));for(i.setUint32(0,b,d),h=0;g>h+c;h++)a[h+c]=i.getUint8(h)}else a._dataview.setUint32(c,b,d);else for(h=0,j=Math.min(g-c,4);j>h;h++)a[c+h]=255&b>>>8*(d?h:3-h)}}function A(a,b,c,d,e){e||(V(void 0!==b&&null!==b,"missing value"),V("boolean"==typeof d,"missing or invalid endian"),V(void 0!==c&&null!==c,"missing offset"),V(c+1<a.length,"Trying to write beyond buffer length"),T(b,32767,-32768));var g=a.length;if(!(c>=g))if(f)if(c+1===g){var h=new DataView(new ArrayBuffer(2));h.setInt16(0,b,d),a[c]=h.getUint8(0)}else a._dataview.setInt16(c,b,d);else b>=0?y(a,b,c,d,e):y(a,65535+b+1,c,d,e)}function B(a,b,c,d,e){e||(V(void 0!==b&&null!==b,"missing value"),V("boolean"==typeof d,"missing or invalid endian"),V(void 0!==c&&null!==c,"missing offset"),V(c+3<a.length,"Trying to write beyond buffer length"),T(b,2147483647,-2147483648));var g=a.length;if(!(c>=g))if(f)if(c+3>=g){var h=new DataView(new ArrayBuffer(4));h.setInt32(0,b,d);for(var i=0;g>i+c;i++)a[i+c]=h.getUint8(i)}else a._dataview.setInt32(c,b,d);else b>=0?z(a,b,c,d,e):z(a,4294967295+b+1,c,d,e)}function C(a,b,c,d,g){g||(V(void 0!==b&&null!==b,"missing value"),V("boolean"==typeof d,"missing or invalid endian"),V(void 0!==c&&null!==c,"missing offset"),V(c+3<a.length,"Trying to write beyond buffer length"),U(b,3.4028234663852886e38,-3.4028234663852886e38));var h=a.length;if(!(c>=h))if(f)if(c+3>=h){var i=new DataView(new ArrayBuffer(4));i.setFloat32(0,b,d);for(var j=0;h>j+c;j++)a[j+c]=i.getUint8(j)}else a._dataview.setFloat32(c,b,d);else e.write(a,b,c,d,23,4)}function D(a,b,c,d,g){g||(V(void 0!==b&&null!==b,"missing value"),V("boolean"==typeof d,"missing or invalid endian"),V(void 0!==c&&null!==c,"missing offset"),V(c+7<a.length,"Trying to write beyond buffer length"),U(b,1.7976931348623157e308,-1.7976931348623157e308));var h=a.length;if(!(c>=h))if(f)if(c+7>=h){var i=new DataView(new ArrayBuffer(8));i.setFloat64(0,b,d);for(var j=0;h>j+c;j++)a[j+c]=i.getUint8(j)}else a._dataview.setFloat64(c,b,d);else e.write(a,b,c,d,52,8)}function E(){return new g(this).buffer}function F(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function H(a){return a._isBuffer=!0,a.write=G.write,a.toString=G.toString,a.toLocaleString=G.toString,a.toJSON=G.toJSON,a.copy=G.copy,a.slice=G.slice,a.readUInt8=G.readUInt8,a.readUInt16LE=G.readUInt16LE,a.readUInt16BE=G.readUInt16BE,a.readUInt32LE=G.readUInt32LE,a.readUInt32BE=G.readUInt32BE,a.readInt8=G.readInt8,a.readInt16LE=G.readInt16LE,a.readInt16BE=G.readInt16BE,a.readInt32LE=G.readInt32LE,a.readInt32BE=G.readInt32BE,a.readFloatLE=G.readFloatLE,a.readFloatBE=G.readFloatBE,a.readDoubleLE=G.readDoubleLE,a.readDoubleBE=G.readDoubleBE,a.writeUInt8=G.writeUInt8,a.writeUInt16LE=G.writeUInt16LE,a.writeUInt16BE=G.writeUInt16BE,a.writeUInt32LE=G.writeUInt32LE,a.writeUInt32BE=G.writeUInt32BE,a.writeInt8=G.writeInt8,a.writeInt16LE=G.writeInt16LE,a.writeInt16BE=G.writeInt16BE,a.writeInt32LE=G.writeInt32LE,a.writeInt32BE=G.writeInt32BE,a.writeFloatLE=G.writeFloatLE,a.writeFloatBE=G.writeFloatBE,a.writeDoubleLE=G.writeDoubleLE,a.writeDoubleBE=G.writeDoubleBE,a.fill=G.fill,a.inspect=G.inspect,a.toArrayBuffer=E,0!==a.byteLength&&(a._dataview=new DataView(a.buffer,a.byteOffset,a.byteLength)),a}function I(a,b,c){return"number"!=typeof a?c:(a=~~a,a>=b?b:a>=0?a:(a+=b,a>=0?a:0))}function J(a){return a=~~Math.ceil(+a),0>a?0:a}function K(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function L(a){return K(a)||g.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function M(a){return 16>a?"0"+a.toString(16):a.toString(16)}function N(a){for(var b=[],c=0;c<a.length;c++)if(a.charCodeAt(c)<=127)b.push(a.charCodeAt(c));else for(var d=encodeURIComponent(a.charAt(c)).substr(1).split("%"),e=0;e<d.length;e++)b.push(parseInt(d[e],16));return b}function O(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function P(a){return d.toByteArray(a)}function Q(a,b,c,d){for(var f=0;d>f&&!(f+c>=b.length||f>=a.length);f++)b[f+c]=a[f];return f}function R(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function S(a,b){V("number"==typeof a,"cannot write a non-number as a number"),V(a>=0,"specified a negative value for writing an unsigned value"),V(b>=a,"value is larger than maximum value for type"),V(Math.floor(a)===a,"value has a fractional component")}function T(a,b,c){V("number"==typeof a,"cannot write a non-number as a number"),V(b>=a,"value larger than maximum allowed value"),V(a>=c,"value smaller than minimum allowed value"),V(Math.floor(a)===a,"value has a fractional component")}function U(a,b,c){V("number"==typeof a,"cannot write a non-number as a number"),V(b>=a,"value larger than maximum allowed value"),V(a>=c,"value smaller than minimum allowed value")}function V(a,b){if(!a)throw new Error(b||"Failed assertion")}var d=a("base64-js"),e=a("ieee754");c.Buffer=g,c.SlowBuffer=g,c.INSPECT_MAX_BYTES=50,g.poolSize=8192;var f=function(){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer||"undefined"==typeof DataView)return!1;try{var a=new Uint8Array(0);return a.foo=function(){return 42},42===a.foo()}catch(b){return!1}}();g.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":return!0;default:return!1}},g.isBuffer=function(a){return a&&a._isBuffer},g.byteLength=function(a,b){switch(b||"utf8"){case"hex":return a.length/2;case"utf8":case"utf-8":return N(a).length;case"ascii":case"binary":return a.length;case"base64":return P(a).length;default:throw new Error("Unknown encoding")}},g.concat=function(a,b){if(!K(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\nlist should be an Array.");if(0===a.length)return new g(0);if(1===a.length)return a[0];var c;if("number"!=typeof b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new g(b),e=0;for(c=0;c<a.length;c++){var f=a[c];f.copy(d,e),e+=f.length}return d},g.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=Number(b)||0;var f=this.length-b;switch(c?(c=Number(c),c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return h(this,a,b,c);case"utf8":case"utf-8":return i(this,a,b,c);case"ascii":return k(this,a,b,c);case"binary":return l(this,a,b,c);case"base64":return m(this,a,b,c);default:throw new Error("Unknown encoding")}},g.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0!==c?Number(c):c=d.length,c===b)return"";switch(a){case"hex":return r(d,b,c);case"utf8":case"utf-8":return o(d,b,c);case"ascii":return p(d,b,c);case"binary":return q(d,b,c);case"base64":return n(d,b,c);default:throw new Error("Unknown encoding")}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}
},g.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){if(c>d)throw new Error("sourceEnd < sourceStart");if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);for(var f=0;d-c>f;f++)a[f+b]=this[f+c]}},g.prototype.slice=function(a,b){var c=this.length;if(a=I(a,c,0),b=I(b,c,c),f)return H(this.subarray(a,b));for(var d=b-a,e=new g(d,void 0,!0),h=0;d>h;h++)e[h]=this[h+a];return e},g.prototype.readUInt8=function(a,b){var c=this;return b||(V(void 0!==a&&null!==a,"missing offset"),V(a<c.length,"Trying to read beyond buffer length")),a>=c.length?void 0:c[a]},g.prototype.readUInt16LE=function(a,b){return s(this,a,!0,b)},g.prototype.readUInt16BE=function(a,b){return s(this,a,!1,b)},g.prototype.readUInt32LE=function(a,b){return t(this,a,!0,b)},g.prototype.readUInt32BE=function(a,b){return t(this,a,!1,b)},g.prototype.readInt8=function(a,b){var c=this;if(b||(V(void 0!==a&&null!==a,"missing offset"),V(a<c.length,"Trying to read beyond buffer length")),!(a>=c.length)){if(f)return c._dataview.getInt8(a);var d=128&c[a];return d?-1*(255-c[a]+1):c[a]}},g.prototype.readInt16LE=function(a,b){return u(this,a,!0,b)},g.prototype.readInt16BE=function(a,b){return u(this,a,!1,b)},g.prototype.readInt32LE=function(a,b){return v(this,a,!0,b)},g.prototype.readInt32BE=function(a,b){return v(this,a,!1,b)},g.prototype.readFloatLE=function(a,b){return w(this,a,!0,b)},g.prototype.readFloatBE=function(a,b){return w(this,a,!1,b)},g.prototype.readDoubleLE=function(a,b){return x(this,a,!0,b)},g.prototype.readDoubleBE=function(a,b){return x(this,a,!1,b)},g.prototype.writeUInt8=function(a,b,c){var d=this;c||(V(void 0!==a&&null!==a,"missing value"),V(void 0!==b&&null!==b,"missing offset"),V(b<d.length,"trying to write beyond buffer length"),S(a,255)),b>=d.length||(d[b]=a)},g.prototype.writeUInt16LE=function(a,b,c){y(this,a,b,!0,c)},g.prototype.writeUInt16BE=function(a,b,c){y(this,a,b,!1,c)},g.prototype.writeUInt32LE=function(a,b,c){z(this,a,b,!0,c)},g.prototype.writeUInt32BE=function(a,b,c){z(this,a,b,!1,c)},g.prototype.writeInt8=function(a,b,c){var d=this;c||(V(void 0!==a&&null!==a,"missing value"),V(void 0!==b&&null!==b,"missing offset"),V(b<d.length,"Trying to write beyond buffer length"),T(a,127,-128)),b>=d.length||(f?d._dataview.setInt8(b,a):a>=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c))},g.prototype.writeInt16LE=function(a,b,c){A(this,a,b,!0,c)},g.prototype.writeInt16BE=function(a,b,c){A(this,a,b,!1,c)},g.prototype.writeInt32LE=function(a,b,c){B(this,a,b,!0,c)},g.prototype.writeInt32BE=function(a,b,c){B(this,a,b,!1,c)},g.prototype.writeFloatLE=function(a,b,c){C(this,a,b,!0,c)},g.prototype.writeFloatBE=function(a,b,c){C(this,a,b,!1,c)},g.prototype.writeDoubleLE=function(a,b,c){D(this,a,b,!0,c)},g.prototype.writeDoubleBE=function(a,b,c){D(this,a,b,!1,c)},g.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");for(var d=b;c>d;d++)this[d]=a}},g.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=M(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"};var G=g.prototype},{"base64-js":3,ieee754:4}],"native-buffer-browserify":[function(a,b){b.exports=a("PcZj9L")},{}],3:[function(a,b){function d(a,b){var c=a.length,d=Number(arguments[1])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if("string"==typeof a&&a.charAt(d)===b||"string"!=typeof a&&a[d]===b)return d;return-1}!function(){"use strict";function e(a){var b,e,f,g,h,i;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(h=d(a,"="),h=h>0?a.length-h:0,i=[],f=h>0?a.length-4:a.length,b=0,e=0;f>b;b+=4,e+=3)g=d(c,a.charAt(b))<<18|d(c,a.charAt(b+1))<<12|d(c,a.charAt(b+2))<<6|d(c,a.charAt(b+3)),i.push((16711680&g)>>16),i.push((65280&g)>>8),i.push(255&g);return 2===h?(g=d(c,a.charAt(b))<<2|d(c,a.charAt(b+1))>>4,i.push(255&g)):1===h&&(g=d(c,a.charAt(b))<<10|d(c,a.charAt(b+1))<<4|d(c,a.charAt(b+2))>>2,i.push(255&g>>8),i.push(255&g)),i}function f(a){function h(a){return c.charAt(63&a>>18)+c.charAt(63&a>>12)+c.charAt(63&a>>6)+c.charAt(63&a)}var b,f,g,d=a.length%3,e="";for(b=0,g=a.length-d;g>b;b+=3)f=(a[b]<<16)+(a[b+1]<<8)+a[b+2],e+=h(f);switch(d){case 1:f=a[a.length-1],e+=c.charAt(f>>2),e+=c.charAt(63&f<<4),e+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],e+=c.charAt(f>>10),e+=c.charAt(63&f>>4),e+=c.charAt(63&f<<2),e+="="}return e}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=e,b.exports.fromByteArray=f}()},{}],4:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}]},{},[]),b.exports=a("native-buffer-browserify").Buffer},{}],34:[function(a,b){var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],35:[function(a,b,c){function f(a,b,c){if(!(this instanceof f))return new f(a,b,c);var d=typeof a;if("base64"===b&&"string"===d)for(a=C(a);0!==a.length%4;)a+="=";var e;if("number"===d)e=G(a);else if("string"===d)e=f.byteLength(a,b);else{if("object"!==d)throw new Error("First argument needs to be a number, array or string.");e=G(a.length)}var g;f._useTypedArrays?g=E(new Uint8Array(e)):(g=this,g.length=e,g._isBuffer=!0);var h;if(f._useTypedArrays&&"function"==typeof Uint8Array&&a instanceof Uint8Array)g._set(a);else if(I(a))for(h=0;e>h;h++)g[h]=f.isBuffer(a)?a.readUInt8(h):a[h];else if("string"===d)g.write(a,0,b);else if("number"===d&&!f._useTypedArrays&&!c)for(h=0;e>h;h++)g[h]=0;return g}function g(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var g=b.length;S(0===g%2,"Invalid hex string"),d>g/2&&(d=g/2);for(var h=0;d>h;h++){var i=parseInt(b.substr(2*h,2),16);S(!isNaN(i),"Invalid hex string"),a[c+h]=i}return f._charsWritten=2*h,h}function h(a,b,c,d){return f._charsWritten=N(K(b),a,c,d)}function i(a,b,c,d){return f._charsWritten=N(L(b),a,c,d)}function j(a,b,c,d){return i(a,b,c,d)}function k(a,b,c,d){return f._charsWritten=N(M(b),a,c,d)}function l(a,b,c){return 0===b&&c===a.length?d.fromByteArray(a):d.fromByteArray(a.slice(b,c))}function m(a,b,c){var d="",e="";c=Math.min(a.length,c);for(var f=b;c>f;f++)a[f]<=127?(d+=O(e)+String.fromCharCode(a[f]),e=""):e+="%"+a[f].toString(16);return d+O(e)}function n(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function o(a,b,c){return n(a,b,c)}function p(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=J(a[f]);return e}function q(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(f=a[b],e>b+1&&(f|=a[b+1]<<8)):(f=a[b]<<8,e>b+1&&(f|=a[b+1])),f}}function r(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f;return c?(e>b+2&&(f=a[b+2]<<16),e>b+1&&(f|=a[b+1]<<8),f|=a[b],e>b+3&&(f+=a[b+3]<<24>>>0)):(e>b+1&&(f=a[b+1]<<16),e>b+2&&(f|=a[b+2]<<8),e>b+3&&(f|=a[b+3]),f+=a[b]<<24>>>0),f}}function s(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+1<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=q(a,b,c,!0),g=32768&f;return g?-1*(65535-f+1):f}}function t(a,b,c,d){d||(S("boolean"==typeof c,"missing or invalid endian"),S(void 0!==b&&null!==b,"missing offset"),S(b+3<a.length,"Trying to read beyond buffer length"));var e=a.length;if(!(b>=e)){var f=r(a,b,c,!0),g=2147483648&f;return g?-1*(4294967295-f+1):f}}function u(a,b,c,d){return d||(S("boolean"==typeof c,"missing or invalid endian"),S(b+3<a.length,"Trying to read beyond buffer length")),e.read(a,b,c,23,4)}function v(a,b,c,d){return d||(S("boolean"==typeof c,"missing or invalid endian"),S(b+7<a.length,"Trying to read beyond buffer length")),e.read(a,b,c,52,8)}function w(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+1<a.length,"trying to write beyond buffer length"),P(b,65535));var f=a.length;if(!(c>=f))for(var g=0,h=Math.min(f-c,2);h>g;g++)a[c+g]=(b&255<<8*(d?g:1-g))>>>8*(d?g:1-g)}function x(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+3<a.length,"trying to write beyond buffer length"),P(b,4294967295));var f=a.length;if(!(c>=f))for(var g=0,h=Math.min(f-c,4);h>g;g++)a[c+g]=255&b>>>8*(d?g:3-g)}function y(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+1<a.length,"Trying to write beyond buffer length"),Q(b,32767,-32768));var f=a.length;c>=f||(b>=0?w(a,b,c,d,e):w(a,65535+b+1,c,d,e))}function z(a,b,c,d,e){e||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+3<a.length,"Trying to write beyond buffer length"),Q(b,2147483647,-2147483648));var f=a.length;c>=f||(b>=0?x(a,b,c,d,e):x(a,4294967295+b+1,c,d,e))}function A(a,b,c,d,f){f||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+3<a.length,"Trying to write beyond buffer length"),R(b,3.4028234663852886e38,-3.4028234663852886e38));var g=a.length;c>=g||e.write(a,b,c,d,23,4)}function B(a,b,c,d,f){f||(S(void 0!==b&&null!==b,"missing value"),S("boolean"==typeof d,"missing or invalid endian"),S(void 0!==c&&null!==c,"missing offset"),S(c+7<a.length,"Trying to write beyond buffer length"),R(b,1.7976931348623157e308,-1.7976931348623157e308));var g=a.length;c>=g||e.write(a,b,c,d,52,8)}function C(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function E(a){return a._isBuffer=!0,a._get=a.get,a._set=a.set,a.get=D.get,a.set=D.set,a.write=D.write,a.toString=D.toString,a.toLocaleString=D.toString,a.toJSON=D.toJSON,a.copy=D.copy,a.slice=D.slice,a.readUInt8=D.readUInt8,a.readUInt16LE=D.readUInt16LE,a.readUInt16BE=D.readUInt16BE,a.readUInt32LE=D.readUInt32LE,a.readUInt32BE=D.readUInt32BE,a.readInt8=D.readInt8,a.readInt16LE=D.readInt16LE,a.readInt16BE=D.readInt16BE,a.readInt32LE=D.readInt32LE,a.readInt32BE=D.readInt32BE,a.readFloatLE=D.readFloatLE,a.readFloatBE=D.readFloatBE,a.readDoubleLE=D.readDoubleLE,a.readDoubleBE=D.readDoubleBE,a.writeUInt8=D.writeUInt8,a.writeUInt16LE=D.writeUInt16LE,a.writeUInt16BE=D.writeUInt16BE,a.writeUInt32LE=D.writeUInt32LE,a.writeUInt32BE=D.writeUInt32BE,a.writeInt8=D.writeInt8,a.writeInt16LE=D.writeInt16LE,a.writeInt16BE=D.writeInt16BE,a.writeInt32LE=D.writeInt32LE,a.writeInt32BE=D.writeInt32BE,a.writeFloatLE=D.writeFloatLE,a.writeFloatBE=D.writeFloatBE,a.writeDoubleLE=D.writeDoubleLE,a.writeDoubleBE=D.writeDoubleBE,a.fill=D.fill,a.inspect=D.inspect,a.toArrayBuffer=D.toArrayBuffer,a}function F(a,b,c){return"number"!=typeof a?c:(a=~~a,a>=b?b:a>=0?a:(a+=b,a>=0?a:0))}function G(a){return a=~~Math.ceil(+a),0>a?0:a}function H(a){return(Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)})(a)}function I(a){return H(a)||f.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function J(a){return 16>a?"0"+a.toString(16):a.toString(16)}function K(a){for(var b=[],c=0;c<a.length;c++){var d=a.charCodeAt(c);if(127>=d)b.push(a.charCodeAt(c));else{var e=c;d>=55296&&57343>=d&&c++;for(var f=encodeURIComponent(a.slice(e,c+1)).substr(1).split("%"),g=0;g<f.length;g++)b.push(parseInt(f[g],16))}}return b}function L(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function M(a){return d.toByteArray(a)}function N(a,b,c,d){for(var f=0;d>f&&!(f+c>=b.length||f>=a.length);f++)b[f+c]=a[f];return f}function O(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function P(a,b){S("number"==typeof a,"cannot write a non-number as a number"),S(a>=0,"specified a negative value for writing an unsigned value"),S(b>=a,"value is larger than maximum value for type"),S(Math.floor(a)===a,"value has a fractional component")}function Q(a,b,c){S("number"==typeof a,"cannot write a non-number as a number"),S(b>=a,"value larger than maximum allowed value"),S(a>=c,"value smaller than minimum allowed value"),S(Math.floor(a)===a,"value has a fractional component")}function R(a,b,c){S("number"==typeof a,"cannot write a non-number as a number"),S(b>=a,"value larger than maximum allowed value"),S(a>=c,"value smaller than minimum allowed value")}function S(a,b){if(!a)throw new Error(b||"Failed assertion")}var d=a("base64-js"),e=a("ieee754");c.Buffer=f,c.SlowBuffer=f,c.INSPECT_MAX_BYTES=50,f.poolSize=8192,f._useTypedArrays=function(){if("undefined"==typeof Uint8Array||"undefined"==typeof ArrayBuffer)return!1;try{var a=new Uint8Array(0);return a.foo=function(){return 42},42===a.foo()&&"function"==typeof a.subarray}catch(b){return!1}}(),f.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":return!0;default:return!1}},f.isBuffer=function(a){return null!=a&&a._isBuffer||!1},f.byteLength=function(a,b){switch(b||"utf8"){case"hex":return a.length/2;case"utf8":case"utf-8":return K(a).length;case"ascii":case"binary":return a.length;case"base64":return M(a).length;default:throw new Error("Unknown encoding")}},f.concat=function(a,b){if(S(H(a),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===a.length)return new f(0);if(1===a.length)return a[0];var c;if("number"!=typeof b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new f(b),e=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(d,e),e+=g.length}return d},f.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=Number(b)||0;var f=this.length-b;switch(c?(c=Number(c),c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return g(this,a,b,c);case"utf8":case"utf-8":return h(this,a,b,c);case"ascii":return i(this,a,b,c);case"binary":return j(this,a,b,c);case"base64":return k(this,a,b,c);default:throw new Error("Unknown encoding")}},f.prototype.toString=function(a,b,c){var d=this;if(a=String(a||"utf8").toLowerCase(),b=Number(b)||0,c=void 0!==c?Number(c):c=d.length,c===b)return"";switch(a){case"hex":return p(d,b,c);case"utf8":case"utf-8":return m(d,b,c);case"ascii":return n(d,b,c);case"binary":return o(d,b,c);case"base64":return l(d,b,c);default:throw new Error("Unknown encoding")}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},f.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||0===d||(d=this.length),b||(b=0),d!==c&&0!==a.length&&0!==e.length){S(d>=c,"sourceEnd < sourceStart"),S(b>=0&&b<a.length,"targetStart out of bounds"),S(c>=0&&c<e.length,"sourceStart out of bounds"),S(d>=0&&d<=e.length,"sourceEnd out of bounds"),d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);for(var f=0;d-c>f;f++)a[f+b]=this[f+c]}},f.prototype.slice=function(a,b){var c=this.length;if(a=F(a,c,0),b=F(b,c,c),f._useTypedArrays)return E(this.subarray(a,b));for(var d=b-a,e=new f(d,void 0,!0),g=0;d>g;g++)e[g]=this[g+a];return e},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.readUInt8=function(a,b){var c=this;return b||(S(void 0!==a&&null!==a,"missing offset"),S(a<c.length,"Trying to read beyond buffer length")),a>=c.length?void 0:c[a]},f.prototype.readUInt16LE=function(a,b){return q(this,a,!0,b)},f.prototype.readUInt16BE=function(a,b){return q(this,a,!1,b)},f.prototype.readUInt32LE=function(a,b){return r(this,a,!0,b)},f.prototype.readUInt32BE=function(a,b){return r(this,a,!1,b)},f.prototype.readInt8=function(a,b){var c=this;if(b||(S(void 0!==a&&null!==a,"missing offset"),S(a<c.length,"Trying to read beyond buffer length")),!(a>=c.length)){var d=128&c[a];return d?-1*(255-c[a]+1):c[a]}},f.prototype.readInt16LE=function(a,b){return s(this,a,!0,b)},f.prototype.readInt16BE=function(a,b){return s(this,a,!1,b)},f.prototype.readInt32LE=function(a,b){return t(this,a,!0,b)},f.prototype.readInt32BE=function(a,b){return t(this,a,!1,b)},f.prototype.readFloatLE=function(a,b){return u(this,a,!0,b)},f.prototype.readFloatBE=function(a,b){return u(this,a,!1,b)},f.prototype.readDoubleLE=function(a,b){return v(this,a,!0,b)},f.prototype.readDoubleBE=function(a,b){return v(this,a,!1,b)},f.prototype.writeUInt8=function(a,b,c){var d=this;c||(S(void 0!==a&&null!==a,"missing value"),S(void 0!==b&&null!==b,"missing offset"),S(b<d.length,"trying to write beyond buffer length"),P(a,255)),b>=d.length||(d[b]=a)},f.prototype.writeUInt16LE=function(a,b,c){w(this,a,b,!0,c)},f.prototype.writeUInt16BE=function(a,b,c){w(this,a,b,!1,c)},f.prototype.writeUInt32LE=function(a,b,c){x(this,a,b,!0,c)},f.prototype.writeUInt32BE=function(a,b,c){x(this,a,b,!1,c)},f.prototype.writeInt8=function(a,b,c){var d=this;c||(S(void 0!==a&&null!==a,"missing value"),S(void 0!==b&&null!==b,"missing offset"),S(b<d.length,"Trying to write beyond buffer length"),Q(a,127,-128)),b>=d.length||(a>=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c))},f.prototype.writeInt16LE=function(a,b,c){y(this,a,b,!0,c)},f.prototype.writeInt16BE=function(a,b,c){y(this,a,b,!1,c)},f.prototype.writeInt32LE=function(a,b,c){z(this,a,b,!0,c)},f.prototype.writeInt32BE=function(a,b,c){z(this,a,b,!1,c)},f.prototype.writeFloatLE=function(a,b,c){A(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){A(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){B(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){B(this,a,b,!1,c)},f.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),S("number"==typeof a&&!isNaN(a),"value is not a number"),S(c>=b,"end < start"),c!==b&&0!==this.length){S(b>=0&&b<this.length,"start out of bounds"),S(c>=0&&c<=this.length,"end out of bounds");for(var d=b;c>d;d++)this[d]=a}},f.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=J(this[d]),d===c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},f.prototype.toArrayBuffer=function(){if("function"==typeof Uint8Array){if(f._useTypedArrays)return new f(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var D=f.prototype},{"base64-js":36,ieee754:37}],36:[function(a,b){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(){"use strict";function k(a){var b=a.charCodeAt(0);return b===f?62:b===g?63:h>b?-1:h+10>b?b-h+26+26:j+26>b?b-j:i+26>b?b-i+26:void 0}function l(a){function l(a){h[j++]=a}var b,d,e,f,g,h;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=a.length;g="="===a.charAt(i-2)?2:"="===a.charAt(i-1)?1:0,h=new c(3*a.length/4-g),e=g>0?a.length-4:a.length;var j=0;for(b=0,d=0;e>b;b+=4,d+=3)f=k(a.charAt(b))<<18|k(a.charAt(b+1))<<12|k(a.charAt(b+2))<<6|k(a.charAt(b+3)),l((16711680&f)>>16),l((65280&f)>>8),l(255&f);return 2===g?(f=k(a.charAt(b))<<2|k(a.charAt(b+1))>>4,l(255&f)):1===g&&(f=k(a.charAt(b))<<10|k(a.charAt(b+1))<<4|k(a.charAt(b+2))>>2,l(255&f>>8),l(255&f)),h}function m(a){function h(a){return d.charAt(a)}function i(a){return h(63&a>>18)+h(63&a>>12)+h(63&a>>6)+h(63&a)}var b,f,g,c=a.length%3,e="";for(b=0,g=a.length-c;g>b;b+=3)f=(a[b]<<16)+(a[b+1]<<8)+a[b+2],e+=i(f);switch(c){case 1:f=a[a.length-1],e+=h(f>>2),e+=h(63&f<<4),e+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],e+=h(f>>10),e+=h(63&f>>4),e+=h(63&f<<2),e+="="}return e}var c="undefined"!=typeof Uint8Array?Uint8Array:Array;"0".charCodeAt(0);var f="+".charCodeAt(0),g="/".charCodeAt(0),h="0".charCodeAt(0),i="a".charCodeAt(0),j="A".charCodeAt(0);b.exports.toByteArray=l,b.exports.fromByteArray=m}()},{}],37:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?0/0:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||1/0===b?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],38:[function(a,b){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;j>k;++k){var n,o,p,q,l=a[k].replace(h,"%20"),m=l.indexOf(c);m>=0?(n=l.substr(0,m),o=l.substr(m+1)):(n=l,o=""),p=decodeURIComponent(n),q=decodeURIComponent(o),d(g,p)?e(g[p])?g[p].push(q):g[p]=[g[p],q]:g[p]=q}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],39:[function(a,b){"use strict";function f(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d<a.length;d++)c.push(b(a[d],d));return c}var d=function(a){switch(typeof a){case"string":return a;case"boolean":return a?"true":"false";case"number":return isFinite(a)?a:"";default:return""}};b.exports=function(a,b,c,h){return b=b||"&",c=c||"=",null===a&&(a=void 0),"object"==typeof a?f(g(a),function(f){var g=encodeURIComponent(d(f))+c;return e(a[f])?a[f].map(function(a){return g+encodeURIComponent(d(a))}).join(b):g+encodeURIComponent(d(a[f]))}).join(b):h?encodeURIComponent(d(h))+c+encodeURIComponent(d(a)):""};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},g=Object.keys||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b}},{}],40:[function(a,b,c){"use strict";c.decode=c.parse=a("./decode"),c.encode=c.stringify=a("./encode")},{"./decode":38,"./encode":39}],41:[function(a,b){function h(a){return this instanceof h?(f.call(this,a),g.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",i),void 0):new h(a)}function i(){if(!this.allowHalfOpen&&!this._writableState.ended){var a=this;e(function(){a.end()})}}b.exports=h;var d=a("inherits"),e=a("process/browser.js").nextTick,f=a("./readable.js"),g=a("./writable.js");d(h,f),h.prototype.write=g.prototype.write,h.prototype.end=g.prototype.end,h.prototype._write=g.prototype._write},{"./readable.js":45,"./writable.js":47,inherits:32,"process/browser.js":43}],42:[function(a,b){function f(){d.call(this)}b.exports=f;var d=a("events").EventEmitter,e=a("inherits");e(f,d),f.Readable=a("./readable.js"),f.Writable=a("./writable.js"),f.Duplex=a("./duplex.js"),f.Transform=a("./transform.js"),f.PassThrough=a("./passthrough.js"),f.Stream=f,f.prototype.pipe=function(a,b){function e(b){a.writable&&!1===a.write(b)&&c.pause&&c.pause()}function f(){c.readable&&c.resume&&c.resume()}function h(){g||(g=!0,a.end())}function i(){g||(g=!0,"function"==typeof a.destroy&&a.destroy())}function j(a){if(k(),0===d.listenerCount(this,"error"))throw a}function k(){c.removeListener("data",e),a.removeListener("drain",f),c.removeListener("end",h),c.removeListener("close",i),c.removeListener("error",j),a.removeListener("error",j),c.removeListener("end",k),c.removeListener("close",k),a.removeListener("close",k)}var c=this;c.on("data",e),a.on("drain",f),a._isStdio||b&&b.end===!1||(c.on("end",h),c.on("close",i));var g=!1;return c.on("error",j),a.on("error",j),c.on("end",k),c.on("close",k),a.on("close",k),a.emit("pipe",c),a}},{"./duplex.js":41,"./passthrough.js":44,"./readable.js":45,"./transform.js":46,"./writable.js":47,events:31,inherits:32}],43:[function(a,b){b.exports=a(34)},{}],44:[function(a,b){function f(a){return this instanceof f?(d.call(this,a),void 0):new f(a)}b.exports=f;var d=a("./transform.js"),e=a("inherits");e(f,d),f.prototype._transform=function(a,b,c){c(null,a)}},{"./transform.js":46,inherits:32}],45:[function(a,b){function k(b){b=b||{};var d=b.highWaterMark;this.highWaterMark=d||0===d?d:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!b.objectMode,this.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(i||(i=a("string_decoder").StringDecoder),this.decoder=new i(b.encoding),this.encoding=b.encoding)}function l(a){return this instanceof l?(this._readableState=new k(a,this),this.readable=!0,f.call(this),void 0):new l(a)}function m(a,b,c,d,e){var f=r(b,c);if(f)a.emit("error",f);else if(null===c||void 0===c)b.reading=!1,b.ended||s(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var g=new Error("stream.push() after EOF");a.emit("error",g)}else if(b.endEmitted&&e){var g=new Error("stream.unshift() after end event");a.emit("error",g)}else!b.decoder||e||d||(c=b.decoder.write(c)),b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):(b.reading=!1,b.buffer.push(c)),b.needReadable&&t(a),v(a,b);else e||(b.reading=!1);return n(b)}function n(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function p(a){if(a>=o)a=o;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function q(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:isNaN(a)||null===a?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=p(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function r(a,b){var c=null;return g.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||c||(c=new TypeError("Invalid non-string/buffer chunk")),c}function s(a,b){if(b.decoder&&!b.ended){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,b.length>0?t(a):C(a)}function t(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(b.emittedReadable=!0,b.sync?h(function(){u(a)}):u(a))}function u(a){a.emit("readable")}function v(a,b){b.readingMore||(b.readingMore=!0,h(function(){w(a,b)}))}function w(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function x(a){return function(){var c=a._readableState;c.awaitDrain--,0===c.awaitDrain&&y(a)}}function y(a){function d(a){var f=a.write(c);!1===f&&b.awaitDrain++}var c,b=a._readableState;for(b.awaitDrain=0;b.pipesCount&&null!==(c=a.read());)if(1===b.pipesCount?d(b.pipes,0,null):D(b.pipes,d),a.emit("data",c),b.awaitDrain>0)return;return 0===b.pipesCount?(b.flowing=!1,e.listenerCount(a,"data")>0&&A(a),void 0):(b.ranOut=!0,void 0)}function z(){this._readableState.ranOut&&(this._readableState.ranOut=!1,y(this))}function A(a,b){var c=a._readableState;if(c.flowing)throw new Error("Cannot switch to old mode now.");var d=b||!1,e=!1;a.readable=!0,a.pipe=f.prototype.pipe,a.on=a.addListener=f.prototype.on,a.on("readable",function(){e=!0;for(var b;!d&&null!==(b=a.read());)a.emit("data",b);null===b&&(e=!1,a._readableState.needReadable=!0)}),a.pause=function(){d=!0,this.emit("pause")},a.resume=function(){d=!1,e?h(function(){a.emit("readable")}):this.read(0),this.emit("resume")},a.emit("readable")}function B(a,b){var h,c=b.buffer,d=b.length,e=!!b.decoder,f=!!b.objectMode;if(0===c.length)return null;if(0===d)h=null;else if(f)h=c.shift();else if(!a||a>=d)h=e?c.join(""):g.concat(c,d),c.length=0;else if(a<c[0].length){var i=c[0];h=i.slice(0,a),c[0]=i.slice(a)}else if(a===c[0].length)h=c.shift();else{h=e?"":new g(a);for(var j=0,k=0,l=c.length;l>k&&a>j;k++){var i=c[0],m=Math.min(a-j,i.length);e?h+=i.slice(0,m):i.copy(h,j,0,m),m<i.length?c[0]=i.slice(m):c.shift(),j+=m}}return h}function C(a){var b=a._readableState;if(b.length>0)throw new Error("endReadable called on non-empty stream");!b.endEmitted&&b.calledRead&&(b.ended=!0,h(function(){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}))}function D(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function E(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}var d=a("__browserify_process");b.exports=l,l.ReadableState=k;var i,e=a("events").EventEmitter,f=a("./index.js"),g=a("buffer").Buffer,h=a("process/browser.js").nextTick,j=a("inherits");j(l,f),l.prototype.push=function(a,b){var c=this._readableState;return"string"!=typeof a||c.objectMode||(b=b||c.defaultEncoding,b!==c.encoding&&(a=new g(a,b),b="")),m(this,c,a,b,!1)},l.prototype.unshift=function(a){var b=this._readableState;return m(this,b,a,"",!0)},l.prototype.setEncoding=function(b){i||(i=a("string_decoder").StringDecoder),this._readableState.decoder=new i(b),this._readableState.encoding=b};var o=8388608;l.prototype.read=function(a){var b=this._readableState;b.calledRead=!0;var c=a;if(("number"!=typeof a||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return t(this),null;if(a=q(a,b),0===a&&b.ended)return 0===b.length&&C(this),null;var d=b.needReadable;b.length-a<=b.highWaterMark&&(d=!0),(b.ended||b.reading)&&(d=!1),d&&(b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=q(c,b));
var e;return e=a>0?B(a,b):null,null===e&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),b.ended&&!b.endEmitted&&0===b.length&&C(this),e},l.prototype._read=function(){this.emit("error",new Error("not implemented"))},l.prototype.pipe=function(a,b){function j(a){a===c&&m()}function k(){a.end()}function m(){a.removeListener("close",p),a.removeListener("finish",q),a.removeListener("drain",l),a.removeListener("error",o),a.removeListener("unpipe",j),c.removeListener("end",k),c.removeListener("end",m),(!a._writableState||a._writableState.needDrain)&&l()}function o(b){r(),0===n&&0===e.listenerCount(a,"error")&&a.emit("error",b)}function p(){a.removeListener("finish",q),r()}function q(){a.removeListener("close",p),r()}function r(){c.unpipe(a)}var c=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=a;break;case 1:f.pipes=[f.pipes,a];break;default:f.pipes.push(a)}f.pipesCount+=1;var g=(!b||b.end!==!1)&&a!==d.stdout&&a!==d.stderr,i=g?k:m;f.endEmitted?h(i):c.once("end",i),a.on("unpipe",j);var l=x(c);a.on("drain",l);var n=e.listenerCount(a,"error");return a.once("error",o),a.once("close",p),a.once("finish",q),a.emit("pipe",c),f.flowing||(this.on("readable",z),f.flowing=!0,h(function(){y(c)})),a},l.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,this.removeListener("readable",z),b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,this.removeListener("readable",z),b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=E(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},l.prototype.on=function(a,b){var c=f.prototype.on.call(this,a,b);if("data"!==a||this._readableState.flowing||A(this),"readable"===a&&this.readable){var d=this._readableState;d.readableListening||(d.readableListening=!0,d.emittedReadable=!1,d.needReadable=!0,d.reading?d.length&&t(this,d):this.read(0))}return c},l.prototype.addListener=l.prototype.on,l.prototype.resume=function(){A(this),this.read(0),this.emit("resume")},l.prototype.pause=function(){A(this,!0),this.emit("pause")},l.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(b.decoder&&(e=b.decoder.write(e)),e&&(b.objectMode||e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)"function"==typeof a[e]&&"undefined"==typeof this[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];return D(f,function(b){a.on(b,function(a){return d.emit.apply(d,b,a)})}),d._read=function(){c&&(c=!1,a.resume())},d},l._fromList=B},{"./index.js":42,__browserify_process:34,buffer:35,events:31,inherits:32,"process/browser.js":43,string_decoder:48}],46:[function(a,b){function f(a,b){this.afterTransform=function(a,c){return g(b,a,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function g(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&a._read(f.highWaterMark)}function h(a){if(!(this instanceof h))return new h(a);d.call(this,a),this._transformState=new f(a,this);var c=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(a){i(c,a)}):i(c)})}function i(a,b){if(b)return a.emit("error",b);var c=a._writableState;a._readableState;var e=a._transformState;if(c.length)throw new Error("calling transform done when ws.length != 0");if(e.transforming)throw new Error("calling transform done when still transforming");return a.push(null)}b.exports=h;var d=a("./duplex.js"),e=a("inherits");e(h,d),h.prototype.push=function(a,b){return this._transformState.needTransform=!1,d.prototype.push.call(this,a,b)},h.prototype._transform=function(){throw new Error("not implemented")},h.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},h.prototype._read=function(){var b=this._transformState;b.writechunk&&b.writecb&&!b.transforming?(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform)):b.needTransform=!0}},{"./duplex.js":41,inherits:32}],47:[function(a,b){function j(a,b,c){this.chunk=a,this.encoding=b,this.callback=c}function k(a,b){a=a||{};var c=a.highWaterMark;this.highWaterMark=c||0===c?c:16384,this.objectMode=!!a.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var d=a.decodeStrings===!1;this.decodeStrings=!d,this.defaultEncoding=a.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){t(b,a)},this.writecb=null,this.writelen=0,this.buffer=[]}function l(a){return this instanceof l||this instanceof g.Duplex?(this._writableState=new k(a,this),this.writable=!0,g.call(this),void 0):new l(a)}function m(a,b,c){var d=new Error("write after end");a.emit("error",d),h(function(){c(d)})}function n(a,b,c,d){var e=!0;if(!i.isBuffer(c)&&"string"!=typeof c&&null!==c&&void 0!==c&&!b.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");a.emit("error",f),h(function(){d(f)}),e=!1}return e}function o(a,b,c){return a.objectMode||a.decodeStrings===!1||"string"!=typeof b||(b=new i(b,c)),b}function p(a,b,c,d,e){c=o(b,c,d);var f=b.objectMode?1:c.length;b.length+=f;var g=b.length<b.highWaterMark;return b.needDrain=!g,b.writing?b.buffer.push(new j(c,d,e)):q(a,b,f,c,d,e),g}function q(a,b,c,d,e,f){b.writelen=c,b.writecb=f,b.writing=!0,b.sync=!0,a._write(d,e,b.onwrite),b.sync=!1}function r(a,b,c,d,e){c?h(function(){e(d)}):e(d),a.emit("error",d)}function s(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function t(a,b){var c=a._writableState,d=c.sync,e=c.writecb;if(s(c),b)r(a,c,d,b,e);else{var f=x(a,c);f||c.bufferProcessing||!c.buffer.length||w(a,c),d?h(function(){u(a,c,f,e)}):u(a,c,f,e)}}function u(a,b,c,d){c||v(a,b),d(),c&&y(a,b)}function v(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function w(a,b){b.bufferProcessing=!0;for(var c=0;c<b.buffer.length;c++){var d=b.buffer[c],e=d.chunk,f=d.encoding,g=d.callback,h=b.objectMode?1:e.length;if(q(a,b,h,e,f,g),b.writing){c++;break}}b.bufferProcessing=!1,c<b.buffer.length?b.buffer=b.buffer.slice(c):b.buffer.length=0}function x(a,b){return b.ending&&0===b.length&&!b.finished&&!b.writing}function y(a,b){var c=x(a,b);return c&&(b.finished=!0,a.emit("finish")),c}function z(a,b,c){b.ending=!0,y(a,b),c&&(b.finished?h(c):a.once("finish",c)),b.ended=!0}b.exports=l,l.WritableState=k;var d="undefined"!=typeof Uint8Array?function(a){return a instanceof Uint8Array}:function(a){return a&&a.constructor&&"Uint8Array"===a.constructor.name},e="undefined"!=typeof ArrayBuffer?function(a){return a instanceof ArrayBuffer}:function(a){return a&&a.constructor&&"ArrayBuffer"===a.constructor.name},f=a("inherits"),g=a("./index.js"),h=a("process/browser.js").nextTick,i=a("buffer").Buffer;f(l,g),l.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},l.prototype.write=function(a,b,c){var f=this._writableState,g=!1;return"function"==typeof b&&(c=b,b=null),d(a)&&(a=new i(a)),e(a)&&"undefined"!=typeof Uint8Array&&(a=new i(new Uint8Array(a))),i.isBuffer(a)?b="buffer":b||(b=f.defaultEncoding),"function"!=typeof c&&(c=function(){}),f.ended?m(this,f,c):n(this,f,a,c)&&(g=p(this,f,a,b,c)),g},l.prototype._write=function(a,b,c){c(new Error("not implemented"))},l.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),"undefined"!=typeof a&&null!==a&&this.write(a,b),d.ending||d.finished||z(this,d,c)}},{"./index.js":42,buffer:35,inherits:32,"process/browser.js":43}],48:[function(a,b,c){function e(a){if(a&&!d.isEncoding(a))throw new Error("Unknown encoding: "+a)}function g(a){return a.toString(this.encoding)}function h(a){var b=this.charReceived=a.length%2;return this.charLength=b?2:0,b}function i(a){var b=this.charReceived=a.length%3;return this.charLength=b?3:0,b}var d=a("buffer").Buffer,f=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),e(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=h;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=i;break;default:return this.write=g,void 0}this.charBuffer=new d(6),this.charReceived=0,this.charLength=0};f.prototype.write=function(a){for(var b="",c=0;this.charLength;){var d=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,c,d),this.charReceived+=d-c,c=d,this.charReceived<this.charLength)return"";b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var e=b.charCodeAt(b.length-1);if(!(e>=55296&&56319>=e)){if(this.charReceived=this.charLength=0,d==a.length)return b;a=a.slice(d,a.length);break}this.charLength+=this.surrogateSize,b=""}var f=this.detectIncompleteChar(a),g=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-f,g),this.charReceived=f,g-=f),b+=a.toString(this.encoding,0,g);var g=b.length-1,e=b.charCodeAt(g);if(e>=55296&&56319>=e){var h=this.surrogateSize;return this.charLength+=h,this.charReceived+=h,this.charBuffer.copy(this.charBuffer,h,0,h),this.charBuffer.write(b.charAt(b.length-1),this.encoding),b.substring(0,g)}return b},f.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&6==c>>5){this.charLength=2;break}if(2>=b&&14==c>>4){this.charLength=3;break}if(3>=b&&30==c>>3){this.charLength=4;break}}return b},f.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:35}],49:[function(a,b){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],50:[function(a,b,c){function i(a,b){var d={seen:[],stylize:k};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),t(b)?d.showHidden=b:b&&c._extend(d,b),z(d.showHidden)&&(d.showHidden=!1),z(d.depth)&&(d.depth=2),z(d.colors)&&(d.colors=!1),z(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=j),m(d,a,d.depth)}function j(a,b){var c=i.styles[b];return c?"["+i.colors[c][0]+"m"+a+"["+i.colors[c][1]+"m":a}function k(a){return a}function l(a){var b={};return a.forEach(function(a){b[a]=!0}),b}function m(a,b,d){if(a.customInspect&&b&&E(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return x(e)||(e=m(a,e,d)),e}var f=n(a,b);if(f)return f;var g=Object.keys(b),h=l(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),D(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return o(b);if(0===g.length){if(E(b)){var i=b.name?": "+b.name:"";return a.stylize("[Function"+i+"]","special")}if(A(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(C(b))return a.stylize(Date.prototype.toString.call(b),"date");if(D(b))return o(b)}var j="",k=!1,t=["{","}"];if(s(b)&&(k=!0,t=["[","]"]),E(b)){var u=b.name?": "+b.name:"";j=" [Function"+u+"]"}if(A(b)&&(j=" "+RegExp.prototype.toString.call(b)),C(b)&&(j=" "+Date.prototype.toUTCString.call(b)),D(b)&&(j=" "+o(b)),0===g.length&&(!k||0==b.length))return t[0]+j+t[1];if(0>d)return A(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var v;return v=k?p(a,b,d,h,g):g.map(function(c){return q(a,b,d,h,c,k)}),a.seen.pop(),r(v,j,t)}function n(a,b){if(z(b))return a.stylize("undefined","undefined");if(x(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return w(b)?a.stylize(""+b,"number"):t(b)?a.stylize(""+b,"boolean"):u(b)?a.stylize("null","null"):void 0}function o(a){return"["+Error.prototype.toString.call(a)+"]"}function p(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)K(b,String(g))?f.push(q(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(q(a,b,c,d,e,!0))}),f}function q(a,b,c,d,e,f){var g,h,i;if(i=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},i.get?h=i.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):i.set&&(h=a.stylize("[Setter]","special")),K(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(i.value)<0?(h=u(c)?m(a,i.value,null):m(a,i.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),z(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function r(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function s(a){return Array.isArray(a)}function t(a){return"boolean"==typeof a}function u(a){return null===a}function v(a){return null==a}function w(a){return"number"==typeof a}function x(a){return"string"==typeof a}function y(a){return"symbol"==typeof a}function z(a){return void 0===a}function A(a){return B(a)&&"[object RegExp]"===G(a)}function B(a){return"object"==typeof a&&null!==a}function C(a){return B(a)&&"[object Date]"===G(a)}function D(a){return B(a)&&("[object Error]"===G(a)||a instanceof Error)}function E(a){return"function"==typeof a}function F(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function G(a){return Object.prototype.toString.call(a)}function H(a){return 10>a?"0"+a.toString(10):a.toString(10)}function J(){var a=new Date,b=[H(a.getHours()),H(a.getMinutes()),H(a.getSeconds())].join(":");return[a.getDate(),I[a.getMonth()],b].join(" ")}function K(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var d=a("__browserify_process"),e="undefined"!=typeof self?self:"undefined"!=typeof window?window:{},f=/%[sdj%]/g;c.format=function(a){if(!x(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(i(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,e=d.length,g=String(a).replace(f,function(a){if("%%"===a)return"%";if(c>=e)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];e>c;h=d[++c])g+=u(h)||!B(h)?" "+h:" "+i(h);return g},c.deprecate=function(a,b){function g(){if(!f){if(d.throwDeprecation)throw new Error(b);d.traceDeprecation?console.trace(b):console.error(b),f=!0}return a.apply(this,arguments)}if(z(e.process))return function(){return c.deprecate(a,b).apply(this,arguments)};if(d.noDeprecation===!0)return a;var f=!1;return g};var h,g={};c.debuglog=function(a){if(z(h)&&(h=d.env.NODE_DEBUG||""),a=a.toUpperCase(),!g[a])if(new RegExp("\\b"+a+"\\b","i").test(h)){var b=d.pid;g[a]=function(){var d=c.format.apply(c,arguments);console.error("%s %d: %s",a,b,d)}}else g[a]=function(){};return g[a]},c.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=s,c.isBoolean=t,c.isNull=u,c.isNullOrUndefined=v,c.isNumber=w,c.isString=x,c.isSymbol=y,c.isUndefined=z,c.isRegExp=A,c.isObject=B,c.isDate=C,c.isError=D,c.isFunction=E,c.isPrimitive=F,c.isBuffer=a("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",J(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!B(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}},{"./support/isBuffer":49,__browserify_process:34,inherits:32}],51:[function(a,b,c){var d=a("__browserify_process");!function(a){if("function"==typeof bootstrap)bootstrap("promise",a);else if("object"==typeof c)b.exports=a();else if("function"==typeof define&&define.amd)define(a);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=a}else Q=a()}(function(){"use strict";function i(a){return function(){return h.apply(a,arguments)}}function r(a){return a===Object(a)}function s(a){return"[object StopIteration]"===q(a)||a instanceof t}function w(b,c){if(a&&c.stack&&"object"==typeof b&&null!==b&&b.stack&&-1===b.stack.indexOf(v)){for(var d=[],e=c;e;e=e.source)e.stack&&d.unshift(e.stack);d.unshift(b.stack);var f=d.join("\n"+v+"\n");b.stack=x(f)}}function x(a){for(var b=a.split("\n"),c=[],d=0;d<b.length;++d){var e=b[d];A(e)||y(e)||!e||c.push(e)}return c.join("\n")}function y(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function z(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function A(a){var b=z(a);if(!b)return!1;var d=b[0],f=b[1];return d===e&&f>=c&&lb>=f}function B(){if(a)try{throw new Error}catch(b){var c=b.stack.split("\n"),d=c[0].indexOf("@")>0?c[1]:c[2],f=z(d);if(!f)return;return e=f[0],f[1]}}function C(a,b,c){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(b+" is deprecated, use "+c+" instead.",new Error("").stack),a.apply(a,arguments)}}function D(a){return K(a)?a:L(a)?$(a):Z(a)}function E(){function i(a){d=a,f.source=a,k(b,function(b,c){g(function(){a.promiseDispatch.apply(a,c)})},void 0),b=void 0,c=void 0}var d,b=[],c=[],e=n(E.prototype),f=n(H.prototype);if(f.promiseDispatch=function(a,e,f){var h=j(arguments);b?(b.push(h),"when"===e&&f[1]&&c.push(f[1])):g(function(){d.promiseDispatch.apply(d,h)})},f.valueOf=C(function(){if(b)return f;var a=J(d);return K(a)&&(d=a),a},"valueOf","inspect"),f.inspect=function(){return d?d.inspect():{state:"pending"}},D.longStackSupport&&a)try{throw new Error}catch(h){f.stack=h.stack.substring(h.stack.indexOf("\n")+1)}return e.promise=f,e.resolve=function(a){d||i(D(a))},e.fulfill=function(a){d||i(Z(a))},e.reject=function(a){d||i(Y(a))},e.notify=function(a){d||k(c,function(b,c){g(function(){c(a)})},void 0)},e}function F(a){if("function"!=typeof a)throw new TypeError("resolver must be a function.");var b=E();try{a(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}return b.promise}function G(a){return F(function(b,c){for(var d=0,e=a.length;e>d;d++)D(a[d]).then(b,c)})}function H(a,b,c){void 0===b&&(b=function(a){return Y(new Error("Promise does not support operation: "+a))}),void 0===c&&(c=function(){return{state:"unknown"}});var d=n(H.prototype);if(d.promiseDispatch=function(c,e,f){var g;try{g=a[e]?a[e].apply(d,f):b.call(d,e,f)}catch(h){g=Y(h)}c&&c(g)},d.inspect=c,c){var e=c();"rejected"===e.state&&(d.exception=e.reason),d.valueOf=C(function(){var a=c();return"pending"===a.state||"rejected"===a.state?d:a.value})}return d}function I(a,b,c,d){return D(a).then(b,c,d)}function J(a){if(K(a)){var b=a.inspect();if("fulfilled"===b.state)return b.value}return a}function K(a){return r(a)&&"function"==typeof a.promiseDispatch&&"function"==typeof a.inspect}function L(a){return r(a)&&"function"==typeof a.then}function M(a){return K(a)&&"pending"===a.inspect().state}function N(a){return!K(a)||"fulfilled"===a.inspect().state}function O(a){return K(a)&&"rejected"===a.inspect().state}function T(){R||"undefined"==typeof window||window.Touch||!window.console||console.warn("[Q] Unhandled rejection reasons (should be empty):",P),R=!0}function U(){for(var a=0;a<P.length;a++){var b=P[a];console.warn("Unhandled rejection reason:",b)}}function V(){P.length=0,Q.length=0,R=!1,S||(S=!0,"undefined"!=typeof d&&d.on&&d.on("exit",U))}function W(a,b){S&&(Q.push(a),b&&"undefined"!=typeof b.stack?P.push(b.stack):P.push("(no stack) "+b),T())}function X(a){if(S){var b=l(Q,a);-1!==b&&(Q.splice(b,1),P.splice(b,1))}}function Y(a){var b=H({when:function(b){return b&&X(this),b?b(a):this}},function(){return this},function(){return{state:"rejected",reason:a}});return W(b,a),b}function Z(a){return H({when:function(){return a},get:function(b){return a[b]},set:function(b,c){a[b]=c},"delete":function(b){delete a[b]},post:function(b,c){return null===b||void 0===b?a.apply(void 0,c):a[b].apply(a,c)},apply:function(b,c){return a.apply(b,c)},keys:function(){return p(a)}},void 0,function(){return{state:"fulfilled",value:a}})}function $(a){var b=E();return g(function(){try{a.then(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}}),b.promise}function _(a){return H({isDef:function(){}},function(b,c){return fb(a,b,c)},function(){return D(a).inspect()})}function ab(a,b,c){return D(a).spread(b,c)}function bb(a){return function(){function b(a,b){var f;if(u){try{f=c[a](b)}catch(g){return Y(g)}return f.done?f.value:I(f.value,d,e)}try{f=c[a](b)}catch(g){return s(g)?g.value:Y(g)}return I(f,d,e)}var c=a.apply(this,arguments),d=b.bind(b,"next"),e=b.bind(b,"throw");return d()}}function cb(a){D.done(D.async(a)())}function db(a){throw new t(a)}function eb(a){return function(){return ab([this,gb(arguments)],function(b,c){return a.apply(b,c)})}}function fb(a,b,c){return D(a).dispatch(b,c)}function gb(a){return I(a,function(a){var b=0,c=E();return k(a,function(d,e,f){var g;K(e)&&"fulfilled"===(g=e.inspect()).state?a[f]=g.value:(++b,I(e,function(d){a[f]=d,0===--b&&c.resolve(a)},c.reject,function(a){c.notify({index:f,value:a})}))},void 0),0===b&&c.resolve(a),c.promise})}function hb(a){return I(a,function(a){return a=m(a,D),I(gb(m(a,function(a){return I(a,f,f)})),function(){return a})})}function ib(a){return D(a).allSettled()}function jb(a,b){return D(a).then(void 0,void 0,b)}function kb(a,b){return D(a).nodeify(b)}var a=!1;try{throw new Error}catch(b){a=!!b.stack}var e,t,c=B(),f=function(){},g=function(){function h(){for(;a.next;){a=a.next;var b=a.task;a.task=void 0;var d=a.domain;d&&(a.domain=void 0,d.enter());try{b()}catch(e){if(f)throw d&&d.exit(),setTimeout(h,0),d&&d.enter(),e;setTimeout(function(){throw e},0)}d&&d.exit()}c=!1}var a={task:void 0,next:null},b=a,c=!1,e=void 0,f=!1;if(g=function(a){b=b.next={task:a,domain:f&&d.domain,next:null},c||(c=!0,e())},"undefined"!=typeof d&&d.nextTick)f=!0,e=function(){d.nextTick(h)};else if("function"==typeof setImmediate)e="undefined"!=typeof window?setImmediate.bind(window,h):function(){setImmediate(h)};else if("undefined"!=typeof MessageChannel){var i=new MessageChannel;i.port1.onmessage=function(){e=j,i.port1.onmessage=h,h()};var j=function(){i.port2.postMessage(0)};e=function(){setTimeout(h,0),j()}}else e=function(){setTimeout(h,0)};return g}(),h=Function.call,j=i(Array.prototype.slice),k=i(Array.prototype.reduce||function(a,b){var c=0,d=this.length;if(1===arguments.length)for(;;){if(c in this){b=this[c++];break}if(++c>=d)throw new TypeError}for(;d>c;c++)c in this&&(b=a(b,this[c],c));return b}),l=i(Array.prototype.indexOf||function(a){for(var b=0;b<this.length;b++)if(this[b]===a)return b;return-1}),m=i(Array.prototype.map||function(a,b){var c=this,d=[];return k(c,function(e,f,g){d.push(a.call(b,f,g,c))},void 0),d}),n=Object.create||function(a){function b(){}return b.prototype=a,new b},o=i(Object.prototype.hasOwnProperty),p=Object.keys||function(a){var b=[];for(var c in a)o(a,c)&&b.push(c);return b},q=i(Object.prototype.toString);t="undefined"!=typeof ReturnValue?ReturnValue:function(a){this.value=a};var u;try{new Function("(function* (){ yield 1; })"),u=!0}catch(b){u=!1}var v="From previous event:";D.resolve=D,D.nextTick=g,D.longStackSupport=!1,D.defer=E,E.prototype.makeNodeResolver=function(){var a=this;return function(b,c){b?a.reject(b):arguments.length>2?a.resolve(j(arguments,1)):a.resolve(c)}},D.promise=F,D.passByCopy=function(a){return a},H.prototype.passByCopy=function(){return this},D.join=function(a,b){return D(a).join(b)},H.prototype.join=function(a){return D([this,a]).spread(function(a,b){if(a===b)return a;throw new Error("Can't join: not the same: "+a+" "+b)})},D.race=G,H.prototype.race=function(){return this.then(D.race)},D.makePromise=H,H.prototype.toString=function(){return"[object Promise]"},H.prototype.then=function(a,b,c){function h(b){try{return"function"==typeof a?a(b):b}catch(c){return Y(c)}}function i(a){if("function"==typeof b){w(a,d);try{return b(a)}catch(c){return Y(c)}}return Y(a)}function j(a){return"function"==typeof c?c(a):a}var d=this,e=E(),f=!1;return g(function(){d.promiseDispatch(function(a){f||(f=!0,e.resolve(h(a)))},"when",[function(a){f||(f=!0,e.resolve(i(a)))}])}),d.promiseDispatch(void 0,"when",[void 0,function(a){var b,c=!1;try{b=j(a)}catch(d){if(c=!0,!D.onerror)throw d;D.onerror(d)}c||e.notify(b)}]),e.promise},D.when=I,H.prototype.thenResolve=function(a){return this.then(function(){return a})},D.thenResolve=function(a,b){return D(a).thenResolve(b)},H.prototype.thenReject=function(a){return this.then(function(){throw a})},D.thenReject=function(a,b){return D(a).thenReject(b)},D.nearer=J,D.isPromise=K,D.isPromiseAlike=L,D.isPending=M,H.prototype.isPending=function(){return"pending"===this.inspect().state},D.isFulfilled=N,H.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},D.isRejected=O,H.prototype.isRejected=function(){return"rejected"===this.inspect().state};var P=[],Q=[],R=!1,S=!0;D.resetUnhandledRejections=V,D.getUnhandledReasons=function(){return P.slice()},D.stopUnhandledRejectionTracking=function(){V(),"undefined"!=typeof d&&d.on&&d.removeListener("exit",U),S=!1},V(),D.reject=Y,D.fulfill=Z,D.master=_,D.spread=ab,H.prototype.spread=function(a,b){return this.all().then(function(b){return a.apply(void 0,b)},b)},D.async=bb,D.spawn=cb,D["return"]=db,D.promised=eb,D.dispatch=fb,H.prototype.dispatch=function(a,b){var c=this,d=E();return g(function(){c.promiseDispatch(d.resolve,a,b)}),d.promise},D.get=function(a,b){return D(a).dispatch("get",[b])},H.prototype.get=function(a){return this.dispatch("get",[a])},D.set=function(a,b,c){return D(a).dispatch("set",[b,c])},H.prototype.set=function(a,b){return this.dispatch("set",[a,b])},D.del=D["delete"]=function(a,b){return D(a).dispatch("delete",[b])},H.prototype.del=H.prototype["delete"]=function(a){return this.dispatch("delete",[a])},D.mapply=D.post=function(a,b,c){return D(a).dispatch("post",[b,c])},H.prototype.mapply=H.prototype.post=function(a,b){return this.dispatch("post",[a,b])},D.send=D.mcall=D.invoke=function(a,b){return D(a).dispatch("post",[b,j(arguments,2)])},H.prototype.send=H.prototype.mcall=H.prototype.invoke=function(a){return this.dispatch("post",[a,j(arguments,1)])},D.fapply=function(a,b){return D(a).dispatch("apply",[void 0,b])},H.prototype.fapply=function(a){return this.dispatch("apply",[void 0,a])},D["try"]=D.fcall=function(a){return D(a).dispatch("apply",[void 0,j(arguments,1)])},H.prototype.fcall=function(){return this.dispatch("apply",[void 0,j(arguments)])},D.fbind=function(a){var b=D(a),c=j(arguments,1);return function(){return b.dispatch("apply",[this,c.concat(j(arguments))])}},H.prototype.fbind=function(){var a=this,b=j(arguments);return function(){return a.dispatch("apply",[this,b.concat(j(arguments))])}},D.keys=function(a){return D(a).dispatch("keys",[])},H.prototype.keys=function(){return this.dispatch("keys",[])},D.all=gb,H.prototype.all=function(){return gb(this)},D.allResolved=C(hb,"allResolved","allSettled"),H.prototype.allResolved=function(){return hb(this)},D.allSettled=ib,H.prototype.allSettled=function(){return this.then(function(a){return gb(m(a,function(a){function b(){return a.inspect()}return a=D(a),a.then(b,b)}))})},D.fail=D["catch"]=function(a,b){return D(a).then(void 0,b)},H.prototype.fail=H.prototype["catch"]=function(a){return this.then(void 0,a)},D.progress=jb,H.prototype.progress=function(a){return this.then(void 0,void 0,a)},D.fin=D["finally"]=function(a,b){return D(a)["finally"](b)},H.prototype.fin=H.prototype["finally"]=function(a){return a=D(a),this.then(function(b){return a.fcall().then(function(){return b})},function(b){return a.fcall().then(function(){throw b})})},D.done=function(a,b,c,d){return D(a).done(b,c,d)},H.prototype.done=function(a,b,c){var e=function(a){g(function(){if(w(a,f),!D.onerror)throw a;D.onerror(a)})},f=a||b||c?this.then(a,b,c):this;"object"==typeof d&&d&&d.domain&&(e=d.domain.bind(e)),f.then(void 0,e)},D.timeout=function(a,b,c){return D(a).timeout(b,c)},H.prototype.timeout=function(a,b){var c=E(),d=setTimeout(function(){c.reject(new Error(b||"Timed out after "+a+" ms"))},a);return this.then(function(a){clearTimeout(d),c.resolve(a)},function(a){clearTimeout(d),c.reject(a)},c.notify),c.promise},D.delay=function(a,b){return void 0===b&&(b=a,a=void 0),D(a).delay(b)},H.prototype.delay=function(a){return this.then(function(b){var c=E();return setTimeout(function(){c.resolve(b)},a),c.promise})},D.nfapply=function(a,b){return D(a).nfapply(b)},H.prototype.nfapply=function(a){var b=E(),c=j(a);return c.push(b.makeNodeResolver()),this.fapply(c).fail(b.reject),b.promise},D.nfcall=function(a){var b=j(arguments,1);return D(a).nfapply(b)},H.prototype.nfcall=function(){var a=j(arguments),b=E();return a.push(b.makeNodeResolver()),this.fapply(a).fail(b.reject),b.promise},D.nfbind=D.denodeify=function(a){var b=j(arguments,1);return function(){var c=b.concat(j(arguments)),d=E();return c.push(d.makeNodeResolver()),D(a).fapply(c).fail(d.reject),d.promise}},H.prototype.nfbind=H.prototype.denodeify=function(){var a=j(arguments);return a.unshift(this),D.denodeify.apply(void 0,a)},D.nbind=function(a,b){var c=j(arguments,2);return function(){function f(){return a.apply(b,arguments)}var d=c.concat(j(arguments)),e=E();return d.push(e.makeNodeResolver()),D(f).fapply(d).fail(e.reject),e.promise}},H.prototype.nbind=function(){var a=j(arguments,0);return a.unshift(this),D.nbind.apply(void 0,a)},D.nmapply=D.npost=function(a,b,c){return D(a).npost(b,c)},H.prototype.nmapply=H.prototype.npost=function(a,b){var c=j(b||[]),d=E();return c.push(d.makeNodeResolver()),this.dispatch("post",[a,c]).fail(d.reject),d.promise},D.nsend=D.nmcall=D.ninvoke=function(a,b){var c=j(arguments,2),d=E();return c.push(d.makeNodeResolver()),D(a).dispatch("post",[b,c]).fail(d.reject),d.promise},H.prototype.nsend=H.prototype.nmcall=H.prototype.ninvoke=function(a){var b=j(arguments,1),c=E();return b.push(c.makeNodeResolver()),this.dispatch("post",[a,b]).fail(c.reject),c.promise},D.nodeify=kb,H.prototype.nodeify=function(a){return a?(this.then(function(b){g(function(){a(null,b)})},function(b){g(function(){a(b)})}),void 0):this};var lb=B();return D})},{__browserify_process:34}],52:[function(a,b,c){!function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?(this._wrapped=a,void 0):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.4.4";
var A=z.each=z.forEach=function(a,b,c){if(null!=a)if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g in a)if(z.has(a,g)&&b.call(c,a[g],g,a)===e)return};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,function(a){return a[b]})},z.where=function(a,b,c){return z.isEmpty(b)?c?null:[]:z[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},z.findWhere=function(a,b){return z.where(a,b,!0)},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return A(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return A(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d};var D=function(a){return z.isFunction(a)?a:function(b){return b[a]}};z.sortBy=function(a,b,c){var d=D(b);return z.pluck(z.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index<b.index?-1:1}),"value")};var E=function(a,b,c,d){var e={},f=D(b||z.identity);return A(a,function(b,g){var h=f.call(c,b,g,a);d(e,h,b)}),e};z.groupBy=function(a,b,c){return E(a,b,c,function(a,b,c){(z.has(a,b)?a[b]:a[b]=[]).push(c)})},z.countBy=function(a,b,c){return E(a,b,c,function(a,b){z.has(a,b)||(a[b]=0),a[b]++})},z.sortedIndex=function(a,b,c,d){c=null==c?z.identity:D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return A(a,function(a){z.isArray(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(k.apply(f,arguments))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.indexOf(b,a)>=0})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=j.call(arguments),b=z.max(z.pluck(a,"length")),c=new Array(b),d=0;b>d;d++)c[d]=z.pluck(a,""+d);return c},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f},z.bind=function(a,b){if(a.bind===y&&y)return y.apply(a,j.call(arguments,1));var c=j.call(arguments,2);return function(){return a.apply(b,c.concat(j.call(arguments)))}},z.partial=function(a){var b=j.call(arguments,1);return function(){return a.apply(this,b.concat(j.call(arguments)))}},z.bindAll=function(a){var b=j.call(arguments,1);return 0===b.length&&(b=z.functions(a)),A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b){var c,d,e,f,g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)};return function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},z.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},z.once=function(a){var c,b=!1;return function(){return b?c:(b=!0,c=a.apply(this,arguments),a=null,c)}},z.wrap=function(a,b){return function(){var c=[a];return i.apply(c,arguments),b.apply(this,c)}},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return 0>=a?b():function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=x||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)z.has(a,c)&&(b[b.length]=c);return b},z.values=function(a){var b=[];for(var c in a)z.has(a,c)&&b.push(a[c]);return b},z.pairs=function(a){var b=[];for(var c in a)z.has(a,c)&&b.push([c,a[c]]);return b},z.invert=function(a){var b={};for(var c in a)z.has(a,c)&&(b[a[c]]=c);return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var G=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if("[object Array]"==e){if(g=a.length,h=g==b.length)for(;g--&&(h=G(a[g],b[g],c,d)););}else{var i=a.constructor,j=b.constructor;if(i!==j&&!(z.isFunction(i)&&i instanceof i&&z.isFunction(j)&&j instanceof j))return!1;for(var k in a)if(z.has(a,k)&&(g++,!(h=z.has(b,k)&&G(a[k],b[k],c,d))))break;if(h){for(k in b)if(z.has(b,k)&&!g--)break;h=!g}}return c.pop(),d.pop(),h};z.isEqual=function(a,b){return G(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.times=function(a,b,c){for(var d=Array(a),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var H={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};H.unescape=z.invert(H.escape);var I={escape:new RegExp("["+z.keys(H.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(H.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(I[a],function(b){return H[a][b]})}}),z.result=function(a,b){if(null==a)return null;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),N.call(this,c.apply(z,a))}})};var J=0;z.uniqueId=function(a){var b=++J+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,L={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},M=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||K).source,(c.interpolate||K).source,(c.evaluate||K).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(M,function(a){return"\\"+L[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var N=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],N.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return N.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this)},{}],53:[function(a,b,c){!function(){var b;b=a("../lib/xml2js"),c.stripBOM=function(a){return"\ufeff"===a[0]?a.substring(1):a}}.call(this)},{"../lib/xml2js":55}],54:[function(a,b,c){!function(){var a;a=new RegExp(/(?!xmlns)^.*:/),c.normalize=function(a){return a.toLowerCase()},c.firstCharLowerCase=function(a){return a.charAt(0).toLowerCase()+a.slice(1)},c.stripPrefix=function(b){return b.replace(a,"")}}.call(this)},{}],55:[function(a,b,c){var d=a("__browserify_process");!function(){var b,e,f,g,h,i,j,k={}.hasOwnProperty,l=function(a,b){function d(){this.constructor=a}for(var c in b)k.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},m=function(a,b){return function(){return a.apply(b,arguments)}};j=a("sax"),f=a("events"),e=a("xmlbuilder"),b=a("./bom"),i=a("./processors"),g=function(a){return"object"==typeof a&&null!=a&&0===Object.keys(a).length},h=function(a,b){var c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],b=c(b);return b},c.processors=i,c.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,async:!1,strict:!0,attrNameProcessors:null,tagNameProcessors:null},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,childkey:"$$",charsAsChildren:!1,async:!1,strict:!0,attrNameProcessors:null,tagNameProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"}}},c.ValidationError=function(a){function b(a){this.message=a}return l(b,a),b}(Error),c.Builder=function(){function a(a){var b,d,e;this.options={},e=c.defaults["0.2"];for(b in e)k.call(e,b)&&(d=e[b],this.options[b]=d);for(b in a)k.call(a,b)&&(d=a[b],this.options[b]=d)}return a.prototype.buildObject=function(a){var b,d,f,g,h;return b=this.options.attrkey,d=this.options.charkey,1===Object.keys(a).length&&this.options.rootName===c.defaults["0.2"].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,f=function(a,c){var e,f,g,h,i,j,l,m;if("object"!=typeof c)a.txt(c);else for(i in c)if(k.call(c,i))if(f=c[i],i===b){if("object"==typeof f)for(e in f)j=f[e],a=a.att(e,j)}else if(i===d)a=a.txt(f);else if("object"==typeof f&&null!=(null!=f?f.constructor:void 0)&&null!=(null!=f?null!=(l=f.constructor)?l.name:void 0:void 0)&&"Array"===(null!=f?null!=(m=f.constructor)?m.name:void 0:void 0))for(h in f)k.call(f,h)&&(g=f[h],a="string"==typeof g?a.ele(i,g).up():arguments.callee(a.ele(i),g).up());else a="object"==typeof f?arguments.callee(a.ele(i),f).up():a.ele(i,f.toString()).up();return a},g=e.create(h,this.options.xmldec,this.options.doctype),f(g,a).end(this.options.renderOpts)},a}(),c.Parser=function(a){function e(a){this.parseString=m(this.parseString,this),this.reset=m(this.reset,this),this.assignOrPush=m(this.assignOrPush,this);var b,d,e;if(!(this instanceof c.Parser))return new c.Parser(a);this.options={},e=c.defaults["0.2"];for(b in e)k.call(e,b)&&(d=e[b],this.options[b]=d);for(b in a)k.call(a,b)&&(d=a[b],this.options[b]=d);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(i.normalize)),this.reset()}return l(e,a),e.prototype.assignOrPush=function(a,b,c){return b in a?(a[b]instanceof Array||(a[b]=[a[b]]),a[b].push(c)):a[b]=this.options.explicitArray?[c]:c},e.prototype.reset=function(){var a,b,c,d,e,f=this;return this.removeAllListeners(),this.saxParser=j.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),c=!1,this.saxParser.onerror=function(a){return c?void 0:(c=!0,f.emit("error",a))},this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,e=[],a=this.options.attrkey,b=this.options.charkey,this.saxParser.onopentag=function(c){var d,g,i,j,l;if(i={},i[b]="",!f.options.ignoreAttrs){l=c.attributes;for(d in l)k.call(l,d)&&(a in i||f.options.mergeAttrs||(i[a]={}),g=c.attributes[d],j=f.options.attrNameProcessors?h(f.options.attrNameProcessors,d):d,f.options.mergeAttrs?f.assignOrPush(i,j,g):i[a][j]=g)}return i["#name"]=f.options.tagNameProcessors?h(f.options.tagNameProcessors,c.name):c.name,f.options.xmlns&&(i[f.options.xmlnskey]={uri:c.uri,local:c.local}),e.push(i)},this.saxParser.onclosetag=function(){var a,d,h,i,j,k,l,m;if(j=e.pop(),i=j["#name"],delete j["#name"],a=j.cdata,delete j.cdata,l=e[e.length-1],j[b].match(/^\s*$/)&&!a?(d=j[b],delete j[b]):(f.options.trim&&(j[b]=j[b].trim()),f.options.normalize&&(j[b]=j[b].replace(/\s{2,}/g," ").trim()),1===Object.keys(j).length&&b in j&&!f.EXPLICIT_CHARKEY&&(j=j[b])),g(j)&&(j=void 0!==f.options.emptyTag?f.options.emptyTag:d),null!=f.options.validator){m="/"+function(){var a,b,c;for(c=[],a=0,b=e.length;b>a;a++)h=e[a],c.push(h["#name"]);return c}().concat(i).join("/");try{j=f.options.validator(m,l&&l[i],j)}catch(n){c=n,f.emit("error",c)}}return f.options.explicitChildren&&!f.options.mergeAttrs&&"object"==typeof j&&(h={},f.options.attrkey in j&&(h[f.options.attrkey]=j[f.options.attrkey],delete j[f.options.attrkey]),!f.options.charsAsChildren&&f.options.charkey in j&&(h[f.options.charkey]=j[f.options.charkey],delete j[f.options.charkey]),Object.getOwnPropertyNames(j).length>0&&(h[f.options.childkey]=j),j=h),e.length>0?f.assignOrPush(l,i,j):(f.options.explicitRoot&&(k=j,j={},j[i]=k),f.resultObject=j,f.emit("end",f.resultObject))},d=function(a){var c;return c=e[e.length-1],c?(c[b]+=a,c):void 0},this.saxParser.ontext=d,this.saxParser.oncdata=function(a){var b;return b=d(a),b?b.cdata=!0:void 0}},e.prototype.parseString=function(a,c){return null!=c&&"function"==typeof c&&(this.on("end",function(a){return this.reset(),this.options.async?d.nextTick(function(){return c(null,a)}):c(null,a)}),this.on("error",function(a){return this.reset(),this.options.async?d.nextTick(function(){return c(a)}):c(a)})),""===a.toString().trim()?(this.emit("end",null),!0):this.saxParser.write(b.stripBOM(a.toString())).close()},e}(f.EventEmitter),c.parseString=function(a,b,d){var e,f,g;return null!=d?("function"==typeof d&&(e=d),"object"==typeof b&&(f=b)):("function"==typeof b&&(e=b),f={}),g=new c.Parser(f),g.parseString(a,e)}}.call(this)},{"./bom":53,"./processors":54,__browserify_process:34,events:31,sax:56,xmlbuilder:73}],56:[function(a,b,c){var d=a("__browserify_Buffer");!function(b){function e(a,c){if(!(this instanceof e))return new e(a,c);var d=this;g(d),d.q=d.c="",d.bufferCheckPosition=b.MAX_BUFFER_LENGTH,d.opt=c||{},d.opt.lowercase=d.opt.lowercase||d.opt.lowercasetags,d.looseCase=d.opt.lowercase?"toLowerCase":"toUpperCase",d.tags=[],d.closed=d.closedRoot=d.sawRoot=!1,d.tag=d.error=null,d.strict=!!a,d.noscript=!(!a&&!d.opt.noscript),d.state=E.BEGIN,d.ENTITIES=Object.create(b.ENTITIES),d.attribList=[],d.opt.xmlns&&(d.ns=Object.create(x)),d.trackPosition=d.opt.position!==!1,d.trackPosition&&(d.position=d.line=d.column=0),F(d,"onready")}function f(a){for(var d=Math.max(b.MAX_BUFFER_LENGTH,10),e=0,f=0,g=c.length;g>f;f++){var h=a[c[f]].length;if(h>d)switch(c[f]){case"textNode":H(a);break;case"cdata":G(a,"oncdata",a.cdata),a.cdata="";break;case"script":G(a,"onscript",a.script),a.script="";break;default:J(a,"Max buffer length exceeded: "+c[f])}e=Math.max(e,h)}a.bufferCheckPosition=b.MAX_BUFFER_LENGTH-e+a.position}function g(a){for(var b=0,d=c.length;d>b;b++)a[c[b]]=""}function h(a){H(a),""!==a.cdata&&(G(a,"oncdata",a.cdata),a.cdata=""),""!==a.script&&(G(a,"onscript",a.script),a.script="")}function l(a,b){return new m(a,b)}function m(a,b){if(!(this instanceof m))return new m(a,b);i.apply(this),this._parser=new e(a,b),this.writable=!0,this.readable=!0;var c=this;this._parser.onend=function(){c.emit("end")},this._parser.onerror=function(a){c.emit("error",a),c._parser.error=null},this._decoder=null,k.forEach(function(a){Object.defineProperty(c,"on"+a,{get:function(){return c._parser["on"+a]},set:function(b){return b?(c.on(a,b),void 0):(c.removeAllListeners(a),c._parser["on"+a]=b)},enumerable:!0,configurable:!1})})}function A(a){return a.split("").reduce(function(a,b){return a[b]=!0,a},{})}function B(a){return"[object RegExp]"===Object.prototype.toString.call(a)}function C(a,b){return B(a)?!!b.match(a):a[b]}function D(a,b){return!C(a,b)}function F(a,b,c){a[b]&&a[b](c)}function G(a,b,c){a.textNode&&H(a),F(a,b,c)}function H(a){a.textNode=I(a.opt,a.textNode),a.textNode&&F(a,"ontext",a.textNode),a.textNode=""}function I(a,b){return a.trim&&(b=b.trim()),a.normalize&&(b=b.replace(/\s+/g," ")),b}function J(a,b){return H(a),a.trackPosition&&(b+="\nLine: "+a.line+"\nColumn: "+a.column+"\nChar: "+a.c),b=new Error(b),a.error=b,F(a,"onerror",b),a}function K(a){return a.closedRoot||L(a,"Unclosed root tag"),a.state!==E.BEGIN&&a.state!==E.TEXT&&J(a,"Unexpected end"),H(a),a.c="",a.closed=!0,F(a,"onend"),e.call(a,a.strict,a.opt),a}function L(a,b){if("object"!=typeof a||!(a instanceof e))throw new Error("bad call to strictFail");a.strict&&J(a,b)}function M(a){a.strict||(a.tagName=a.tagName[a.looseCase]());var b=a.tags[a.tags.length-1]||a,c=a.tag={name:a.tagName,attributes:{}};a.opt.xmlns&&(c.ns=b.ns),a.attribList.length=0}function N(a,b){var c=a.indexOf(":"),d=0>c?["",a]:a.split(":"),e=d[0],f=d[1];return b&&"xmlns"===a&&(e="xmlns",f=""),{prefix:e,local:f}}function O(a){if(a.strict||(a.attribName=a.attribName[a.looseCase]()),-1!==a.attribList.indexOf(a.attribName)||a.tag.attributes.hasOwnProperty(a.attribName))return a.attribName=a.attribValue="";if(a.opt.xmlns){var b=N(a.attribName,!0),c=b.prefix,d=b.local;if("xmlns"===c)if("xml"===d&&a.attribValue!==v)L(a,"xml: prefix must be bound to "+v+"\n"+"Actual: "+a.attribValue);else if("xmlns"===d&&a.attribValue!==w)L(a,"xmlns: prefix must be bound to "+w+"\n"+"Actual: "+a.attribValue);else{var e=a.tag,f=a.tags[a.tags.length-1]||a;e.ns===f.ns&&(e.ns=Object.create(f.ns)),e.ns[d]=a.attribValue}a.attribList.push([a.attribName,a.attribValue])}else a.tag.attributes[a.attribName]=a.attribValue,G(a,"onattribute",{name:a.attribName,value:a.attribValue});a.attribName=a.attribValue=""}function P(a,b){if(a.opt.xmlns){var c=a.tag,d=N(a.tagName);c.prefix=d.prefix,c.local=d.local,c.uri=c.ns[d.prefix]||"",c.prefix&&!c.uri&&(L(a,"Unbound namespace prefix: "+JSON.stringify(a.tagName)),c.uri=d.prefix);var e=a.tags[a.tags.length-1]||a;c.ns&&e.ns!==c.ns&&Object.keys(c.ns).forEach(function(b){G(a,"onopennamespace",{prefix:b,uri:c.ns[b]})});for(var f=0,g=a.attribList.length;g>f;f++){var h=a.attribList[f],i=h[0],j=h[1],k=N(i,!0),l=k.prefix,m=k.local,n=""==l?"":c.ns[l]||"",o={name:i,value:j,prefix:l,local:m,uri:n};l&&"xmlns"!=l&&!n&&(L(a,"Unbound namespace prefix: "+JSON.stringify(l)),o.uri=l),a.tag.attributes[i]=o,G(a,"onattribute",o)}a.attribList.length=0}a.tag.isSelfClosing=!!b,a.sawRoot=!0,a.tags.push(a.tag),G(a,"onopentag",a.tag),b||(a.state=a.noscript||"script"!==a.tagName.toLowerCase()?E.TEXT:E.SCRIPT,a.tag=null,a.tagName=""),a.attribName=a.attribValue="",a.attribList.length=0}function Q(a){if(!a.tagName)return L(a,"Weird empty close tag."),a.textNode+="</>",a.state=E.TEXT,void 0;if(a.script){if("script"!==a.tagName)return a.script+="</"+a.tagName+">",a.tagName="",a.state=E.SCRIPT,void 0;G(a,"onscript",a.script),a.script=""}var b=a.tags.length,c=a.tagName;a.strict||(c=c[a.looseCase]());for(var d=c;b--;){var e=a.tags[b];if(e.name===d)break;L(a,"Unexpected close tag")}if(0>b)return L(a,"Unmatched closing tag: "+a.tagName),a.textNode+="</"+a.tagName+">",a.state=E.TEXT,void 0;a.tagName=c;for(var f=a.tags.length;f-->b;){var g=a.tag=a.tags.pop();a.tagName=a.tag.name,G(a,"onclosetag",a.tagName);var h={};for(var i in g.ns)h[i]=g.ns[i];var j=a.tags[a.tags.length-1]||a;a.opt.xmlns&&g.ns!==j.ns&&Object.keys(g.ns).forEach(function(b){var c=g.ns[b];G(a,"onclosenamespace",{prefix:b,uri:c})})}0===b&&(a.closedRoot=!0),a.tagName=a.attribValue=a.attribName="",a.attribList.length=0,a.state=E.TEXT}function R(a){var d,b=a.entity,c=b.toLowerCase(),e="";return a.ENTITIES[b]?a.ENTITIES[b]:a.ENTITIES[c]?a.ENTITIES[c]:(b=c,"#"===b.charAt(0)&&("x"===b.charAt(1)?(b=b.slice(2),d=parseInt(b,16),e=d.toString(16)):(b=b.slice(1),d=parseInt(b,10),e=d.toString(10))),b=b.replace(/^0+/,""),e.toLowerCase()!==b?(L(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCharCode(d))}function S(a){var b=this;if(this.error)throw this.error;if(b.closed)return J(b,"Cannot write after close. Assign an onready handler.");if(null===a)return K(b);for(var c=0,d="";b.c=d=a.charAt(c++);)switch(b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++),b.state){case E.BEGIN:"<"===d?(b.state=E.OPEN_WAKA,b.startTagPosition=b.position):D(n,d)&&(L(b,"Non-whitespace before first tag."),b.textNode=d,b.state=E.TEXT);continue;case E.TEXT:if(b.sawRoot&&!b.closedRoot){for(var e=c-1;d&&"<"!==d&&"&"!==d;)d=a.charAt(c++),d&&b.trackPosition&&(b.position++,"\n"===d?(b.line++,b.column=0):b.column++);b.textNode+=a.substring(e,c-1)}"<"===d?(b.state=E.OPEN_WAKA,b.startTagPosition=b.position):(!D(n,d)||b.sawRoot&&!b.closedRoot||L(b,"Text data outside of root node."),"&"===d?b.state=E.TEXT_ENTITY:b.textNode+=d);continue;case E.SCRIPT:"<"===d?b.state=E.SCRIPT_ENDING:b.script+=d;continue;case E.SCRIPT_ENDING:"/"===d?b.state=E.CLOSE_TAG:(b.script+="<"+d,b.state=E.SCRIPT);continue;case E.OPEN_WAKA:if("!"===d)b.state=E.SGML_DECL,b.sgmlDecl="";else if(C(n,d));else if(C(y,d))b.state=E.OPEN_TAG,b.tagName=d;else if("/"===d)b.state=E.CLOSE_TAG,b.tagName="";else if("?"===d)b.state=E.PROC_INST,b.procInstName=b.procInstBody="";else{if(L(b,"Unencoded <"),b.startTagPosition+1<b.position){var g=b.position-b.startTagPosition;d=new Array(g).join(" ")+d}b.textNode+="<"+d,b.state=E.TEXT}continue;case E.SGML_DECL:(b.sgmlDecl+d).toUpperCase()===t?(G(b,"onopencdata"),b.state=E.CDATA,b.sgmlDecl="",b.cdata=""):"--"===b.sgmlDecl+d?(b.state=E.COMMENT,b.comment="",b.sgmlDecl=""):(b.sgmlDecl+d).toUpperCase()===u?(b.state=E.DOCTYPE,(b.doctype||b.sawRoot)&&L(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):">"===d?(G(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=E.TEXT):C(q,d)?(b.state=E.SGML_DECL_QUOTED,b.sgmlDecl+=d):b.sgmlDecl+=d;continue;case E.SGML_DECL_QUOTED:d===b.q&&(b.state=E.SGML_DECL,b.q=""),b.sgmlDecl+=d;continue;case E.DOCTYPE:">"===d?(b.state=E.TEXT,G(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=d,"["===d?b.state=E.DOCTYPE_DTD:C(q,d)&&(b.state=E.DOCTYPE_QUOTED,b.q=d));continue;case E.DOCTYPE_QUOTED:b.doctype+=d,d===b.q&&(b.q="",b.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:b.doctype+=d,"]"===d?b.state=E.DOCTYPE:C(q,d)&&(b.state=E.DOCTYPE_DTD_QUOTED,b.q=d);continue;case E.DOCTYPE_DTD_QUOTED:b.doctype+=d,d===b.q&&(b.state=E.DOCTYPE_DTD,b.q="");continue;case E.COMMENT:"-"===d?b.state=E.COMMENT_ENDING:b.comment+=d;continue;case E.COMMENT_ENDING:"-"===d?(b.state=E.COMMENT_ENDED,b.comment=I(b.opt,b.comment),b.comment&&G(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+d,b.state=E.COMMENT);continue;case E.COMMENT_ENDED:">"!==d?(L(b,"Malformed comment"),b.comment+="--"+d,b.state=E.COMMENT):b.state=E.TEXT;continue;case E.CDATA:"]"===d?b.state=E.CDATA_ENDING:b.cdata+=d;continue;case E.CDATA_ENDING:"]"===d?b.state=E.CDATA_ENDING_2:(b.cdata+="]"+d,b.state=E.CDATA);continue;case E.CDATA_ENDING_2:">"===d?(b.cdata&&G(b,"oncdata",b.cdata),G(b,"onclosecdata"),b.cdata="",b.state=E.TEXT):"]"===d?b.cdata+="]":(b.cdata+="]]"+d,b.state=E.CDATA);continue;case E.PROC_INST:"?"===d?b.state=E.PROC_INST_ENDING:C(n,d)?b.state=E.PROC_INST_BODY:b.procInstName+=d;continue;case E.PROC_INST_BODY:if(!b.procInstBody&&C(n,d))continue;"?"===d?b.state=E.PROC_INST_ENDING:b.procInstBody+=d;continue;case E.PROC_INST_ENDING:">"===d?(G(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=E.TEXT):(b.procInstBody+="?"+d,b.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:C(z,d)?b.tagName+=d:(M(b),">"===d?P(b):"/"===d?b.state=E.OPEN_TAG_SLASH:(D(n,d)&&L(b,"Invalid character in tag name"),b.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:">"===d?(P(b,!0),Q(b)):(L(b,"Forward-slash in opening tag not followed by >"),b.state=E.ATTRIB);continue;case E.ATTRIB:if(C(n,d))continue;">"===d?P(b):"/"===d?b.state=E.OPEN_TAG_SLASH:C(y,d)?(b.attribName=d,b.attribValue="",b.state=E.ATTRIB_NAME):L(b,"Invalid attribute name");continue;case E.ATTRIB_NAME:"="===d?b.state=E.ATTRIB_VALUE:">"===d?(L(b,"Attribute without value"),b.attribValue=b.attribName,O(b),P(b)):C(n,d)?b.state=E.ATTRIB_NAME_SAW_WHITE:C(z,d)?b.attribName+=d:L(b,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if("="===d)b.state=E.ATTRIB_VALUE;else{if(C(n,d))continue;L(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",G(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",">"===d?P(b):C(y,d)?(b.attribName=d,b.state=E.ATTRIB_NAME):(L(b,"Invalid attribute name"),b.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(C(n,d))continue;C(q,d)?(b.q=d,b.state=E.ATTRIB_VALUE_QUOTED):(L(b,"Unquoted attribute value"),b.state=E.ATTRIB_VALUE_UNQUOTED,b.attribValue=d);continue;case E.ATTRIB_VALUE_QUOTED:if(d!==b.q){"&"===d?b.state=E.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=d;continue}O(b),b.q="",b.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:C(n,d)?b.state=E.ATTRIB:">"===d?P(b):"/"===d?b.state=E.OPEN_TAG_SLASH:C(y,d)?(L(b,"No whitespace between attributes"),b.attribName=d,b.attribValue="",b.state=E.ATTRIB_NAME):L(b,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(D(s,d)){"&"===d?b.state=E.ATTRIB_VALUE_ENTITY_U:b.attribValue+=d;continue}O(b),">"===d?P(b):b.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(b.tagName)">"===d?Q(b):C(z,d)?b.tagName+=d:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=E.SCRIPT):(D(n,d)&&L(b,"Invalid tagname in closing tag"),b.state=E.CLOSE_TAG_SAW_WHITE);else{if(C(n,d))continue;D(y,d)?b.script?(b.script+="</"+d,b.state=E.SCRIPT):L(b,"Invalid tagname in closing tag."):b.tagName=d}continue;case E.CLOSE_TAG_SAW_WHITE:if(C(n,d))continue;">"===d?Q(b):L(b,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:switch(b.state){case E.TEXT_ENTITY:var h=E.TEXT,i="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:var h=E.ATTRIB_VALUE_QUOTED,i="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:var h=E.ATTRIB_VALUE_UNQUOTED,i="attribValue"}";"===d?(b[i]+=R(b),b.entity="",b.state=h):C(r,d)?b.entity+=d:(L(b,"Invalid character entity"),b[i]+="&"+b.entity+d,b.entity="",b.state=h);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&f(b),b}b.parser=function(a,b){return new e(a,b)},b.SAXParser=e,b.SAXStream=m,b.createStream=l,b.MAX_BUFFER_LENGTH=65536;var c=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];
b.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(a){function b(){this.__proto__=a}return b.prototype=a,new b}),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),e.prototype={end:function(){K(this)},write:S,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){h(this)}};try{var i=a("stream").Stream}catch(j){var i=function(){}}var k=b.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});m.prototype=Object.create(i.prototype,{constructor:{value:m}}),m.prototype.write=function(b){if("function"==typeof d&&"function"==typeof d.isBuffer&&d.isBuffer(b)){if(!this._decoder){var c=a("string_decoder").StringDecoder;this._decoder=new c("utf8")}b=this._decoder.write(b)}return this._parser.write(b.toString()),this.emit("data",b),!0},m.prototype.end=function(a){return a&&a.length&&this.write(a),this._parser.end(),!0},m.prototype.on=function(a,b){var c=this;return c._parser["on"+a]||-1===k.indexOf(a)||(c._parser["on"+a]=function(){var b=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,a),c.emit.apply(c,b)}),i.prototype.on.call(c,a,b)};var n="\r\n ",o="0124356789",p="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",q="'\"",r=o+p+"#",s=n+">",t="[CDATA[",u="DOCTYPE",v="http://www.w3.org/XML/1998/namespace",w="http://www.w3.org/2000/xmlns/",x={xml:v,xmlns:w};n=A(n),o=A(o),p=A(p);var y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,z=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;q=A(q),r=A(r),s=A(s);var E=0;b.STATE={BEGIN:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},b.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(b.ENTITIES).forEach(function(a){var c=b.ENTITIES[a],d="number"==typeof c?String.fromCharCode(c):c;b.ENTITIES[a]=d});for(var E in b.STATE)b.STATE[b.STATE[E]]=E;E=b.STATE}("undefined"==typeof c?sax={}:c)},{__browserify_Buffer:33,stream:42,string_decoder:48}],57:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing attribute name");if(null==c)throw new Error("Missing attribute value");this.name=this.stringify.attName(b),this.value=this.stringify.attValue(c)}return a.prototype.toString=function(){return" "+this.name+'="'+this.value+'"'},a}()}.call(this)},{underscore:74}],58:[function(a,b){!function(){var c,d,e,f,g,h;h=a("underscore"),g=a("./XMLStringifier"),d=a("./XMLDeclaration"),e=a("./XMLDocType"),f=a("./XMLElement"),b.exports=c=function(){function a(a,b){var c,d;if(null==a)throw new Error("Root element needs a name");null==b&&(b={}),this.options=b,this.stringify=new g(b),d=new f(this,"doc"),c=d.element(a),c.isRoot=!0,c.documentObject=this,this.rootObject=c,b.headless||(c.declaration(b),(null!=b.pubID||null!=b.sysID)&&c.doctype(b))}return a.prototype.root=function(){return this.rootObject},a.prototype.end=function(a){return toString(a)},a.prototype.toString=function(a){var b,c,d,e;return d=(null!=a?a.pretty:void 0)||!1,b=(null!=a?a.indent:void 0)||" ",c=(null!=a?a.newline:void 0)||"\n",e="",null!=this.xmldec&&(e+=this.xmldec.toString(a)),null!=this.doctype&&(e+=this.doctype.toString(a)),e+=this.rootObject.toString(a),d&&e.slice(-c.length)===c&&(e=e.slice(0,-c.length)),e},a}()}.call(this)},{"./XMLDeclaration":65,"./XMLDocType":66,"./XMLElement":67,"./XMLStringifier":71,underscore:74}],59:[function(a,b){!function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=a("underscore"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(c)}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<![CDATA["+this.text+"]]>",e&&(f+=d),f},b}(d)}.call(this)},{"./XMLNode":68,underscore:74}],60:[function(a,b){!function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=a("underscore"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing comment text");this.text=this.stringify.comment(c)}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<!-- "+this.text+" -->",e&&(f+=d),f},b}(d)}.call(this)},{"./XMLNode":68,underscore:74}],61:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function a(a,b,c,d,e,f){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");if(null==c)throw new Error("Missing DTD attribute name");if(!d)throw new Error("Missing DTD attribute type");if(!e)throw new Error("Missing DTD attribute default");if(0!==e.indexOf("#")&&(e="#"+e),!e.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(f&&!e.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(b),this.attributeName=this.stringify.attName(c),this.attributeType=this.stringify.dtdAttType(d),this.defaultValue=this.stringify.dtdAttDefault(f),this.defaultValueType=e}return a.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<!ATTLIST "+this.elementName+" "+this.attributeName+" "+this.attributeType,"#DEFAULT"!==this.defaultValueType&&(f+=" "+this.defaultValueType),this.defaultValue&&(f+=' "'+this.defaultValue+'"'),f+=">",e&&(f+=d),f},a}()}.call(this)},{underscore:74}],62:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");c||(c="(#PCDATA)"),d.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.eleName(b),this.value=this.stringify.dtdElementValue(c)}return a.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<!ELEMENT "+this.name+" "+this.value+">",e&&(f+=d),f},a}()}.call(this)},{underscore:74}],63:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function a(a,b,c,e){if(this.stringify=a.stringify,null==c)throw new Error("Missing entity name");if(null==e)throw new Error("Missing entity value");if(this.pe=!!b,this.name=this.stringify.eleName(c),d.isObject(e)){if(!e.pubID&&!e.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(e.pubID&&!e.sysID)throw new Error("System identifier is required for a public external entity");if(null!=e.pubID&&(this.pubID=this.stringify.dtdPubID(e.pubID)),null!=e.sysID&&(this.sysID=this.stringify.dtdSysID(e.sysID)),null!=e.nData&&(this.nData=this.stringify.dtdNData(e.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}else this.value=this.stringify.dtdEntityValue(e)}return a.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<!ENTITY",this.pe&&(f+=" %"),f+=" "+this.name,this.value?f+=' "'+this.value+'"':(this.pubID&&this.sysID?f+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.sysID&&(f+=' SYSTEM "'+this.sysID+'"'),this.nData&&(f+=" NDATA "+this.nData)),f+=">",e&&(f+=d),f},a}()}.call(this)},{underscore:74}],64:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing notation name");if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(b),null!=c.pubID&&(this.pubID=this.stringify.dtdPubID(c.pubID)),null!=c.sysID&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return a.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<!NOTATION "+this.name,this.pubID&&this.sysID?f+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.pubID?f+=' PUBLIC "'+this.pubID+'"':this.sysID&&(f+=' SYSTEM "'+this.sysID+'"'),f+=">",e&&(f+=d),f},a}()}.call(this)},{underscore:74}],65:[function(a,b){!function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=a("underscore"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c,d,f){var g;b.__super__.constructor.call(this,a),e.isObject(c)&&(g=c,c=g.version,d=g.encoding,f=g.standalone),c||(c="1.0"),null!=c&&(this.version=this.stringify.xmlVersion(c)),null!=d&&(this.encoding=this.stringify.xmlEncoding(d)),null!=f&&(this.standalone=this.stringify.xmlStandalone(f))}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<?xml",null!=this.version&&(f+=' version="'+this.version+'"'),null!=this.encoding&&(f+=' encoding="'+this.encoding+'"'),null!=this.standalone&&(f+=' standalone="'+this.standalone+'"'),f+="?>",e&&(f+=d),f},b}(d)}.call(this)},{"./XMLNode":68,underscore:74}],66:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function b(a,b,c){var e,f;this.documentObject=a,this.stringify=this.documentObject.stringify,this.children=[],d.isObject(b)&&(e=b,b=e.pubID,c=e.sysID),null==c&&(f=[b,c],c=f[0],b=f[1]),null!=b&&(this.pubID=this.stringify.dtdPubID(b)),null!=c&&(this.sysID=this.stringify.dtdSysID(c))}return b.prototype.element=function(b,c){var d,e;return d=a("./XMLDTDElement"),e=new d(this,b,c),this.children.push(e),this},b.prototype.attList=function(b,c,d,e,f){var g,h;return g=a("./XMLDTDAttList"),h=new g(this,b,c,d,e,f),this.children.push(h),this},b.prototype.entity=function(b,c){var d,e;return d=a("./XMLDTDEntity"),e=new d(this,!1,b,c),this.children.push(e),this},b.prototype.pEntity=function(b,c){var d,e;return d=a("./XMLDTDEntity"),e=new d(this,!0,b,c),this.children.push(e),this},b.prototype.notation=function(b,c){var d,e;return d=a("./XMLDTDNotation"),e=new d(this,b,c),this.children.push(e),this},b.prototype.cdata=function(b){var c,d;return c=a("./XMLCData"),d=new c(this,b),this.children.push(d),this},b.prototype.comment=function(b){var c,d;return c=a("./XMLComment"),d=new c(this,b),this.children.push(d),this},b.prototype.instruction=function(b,c){var d,e;return d=a("./XMLProcessingInstruction"),e=new d(this,b,c),this.children.push(e),this},b.prototype.root=function(){return this.documentObject.root()},b.prototype.document=function(){return this.documentObject},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;if(f=(null!=a?a.pretty:void 0)||!1,d=(null!=a?a.indent:void 0)||" ",e=(null!=a?a.newline:void 0)||"\n",b||(b=0),h=new Array(b+1).join(d),g="",f&&(g+=h),g+="<!DOCTYPE "+this.root().name,this.pubID&&this.sysID?g+=' PUBLIC "'+this.pubID+'" "'+this.sysID+'"':this.sysID&&(g+=' SYSTEM "'+this.sysID+'"'),this.children.length>0){for(g+=" [",f&&(g+=e),k=this.children,i=0,j=k.length;j>i;i++)c=k[i],g+=c.toString(a,b+1);g+="]"}return g+=">",f&&(g+=e),g},b.prototype.ele=function(a,b){return this.element(a,b)},b.prototype.att=function(a,b,c,d,e){return this.attList(a,b,c,d,e)},b.prototype.ent=function(a,b){return this.entity(a,b)},b.prototype.pent=function(a,b){return this.pEntity(a,b)},b.prototype.not=function(a,b){return this.notation(a,b)},b.prototype.dat=function(a){return this.cdata(a)},b.prototype.com=function(a){return this.comment(a)},b.prototype.ins=function(a,b){return this.instruction(a,b)},b.prototype.up=function(){return this.root()},b.prototype.doc=function(){return this.document()},b}()}.call(this)},{"./XMLCData":59,"./XMLComment":60,"./XMLDTDAttList":61,"./XMLDTDElement":62,"./XMLDTDEntity":63,"./XMLDTDNotation":64,"./XMLProcessingInstruction":69,underscore:74}],67:[function(a,b){!function(){var c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function d(){this.constructor=a}for(var c in b)h.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};g=a("underscore"),e=a("./XMLNode"),c=a("./XMLAttribute"),f=a("./XMLProcessingInstruction"),b.exports=d=function(a){function b(a,c,d){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing element name");this.name=this.stringify.eleName(c),this.children=[],this.instructions=[],this.attributes={},null!=d&&this.attribute(d)}return i(b,a),b.prototype.clone=function(a){var b,c,d,e,f,i,j,k;d=g.clone(this),d.attributes={},j=this.attributes;for(c in j)h.call(j,c)&&(b=j[c],d.attributes[c]=g.clone(b));for(d.instructions=[],k=this.instructions,f=0,i=k.length;i>f;f++)e=k[f],d.instructions.push(g.clone(e));return d.children=[],a&&this.children.forEach(function(b){var c;return c=b.clone(a),c.parent=d,d.children.push(c)}),d},b.prototype.attribute=function(a,b){var d,e;if(g.isObject(a))for(d in a)h.call(a,d)&&(e=a[d],this.attribute(d,e));else g.isFunction(b)&&(b=b.apply()),this.options.skipNullAttributes&&null==b||(this.attributes[a]=new c(this,a,b));return this},b.prototype.removeAttribute=function(a){var b,c,d;if(null==a)throw new Error("Missing attribute name");if(g.isArray(a))for(c=0,d=a.length;d>c;c++)b=a[c],delete this.attributes[b];else delete this.attributes[a];return this},b.prototype.instruction=function(a,b){var c,d,e,i,j;if(g.isArray(a))for(i=0,j=a.length;j>i;i++)c=a[i],this.instruction(c);else if(g.isObject(a))for(c in a)h.call(a,c)&&(d=a[c],this.instruction(c,d));else g.isFunction(b)&&(b=b.apply()),e=new f(this,a,b),this.instructions.push(e);return this},b.prototype.toString=function(a,b){var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s;for(j=(null!=a?a.pretty:void 0)||!1,e=(null!=a?a.indent:void 0)||" ",i=(null!=a?a.newline:void 0)||"\n",b||(b=0),l=new Array(b+1).join(e),k="",q=this.instructions,m=0,o=q.length;o>m;m++)f=q[m],k+=f.toString(a,b+1);j&&(k+=l),k+="<"+this.name,r=this.attributes;for(g in r)h.call(r,g)&&(c=r[g],k+=c.toString(a));if(0===this.children.length)k+="/>",j&&(k+=i);else if(j&&1===this.children.length&&null!=this.children[0].value)k+=">",k+=this.children[0].value,k+="</"+this.name+">",k+=i;else{for(k+=">",j&&(k+=i),s=this.children,n=0,p=s.length;p>n;n++)d=s[n],k+=d.toString(a,b+1);j&&(k+=l),k+="</"+this.name+">",j&&(k+=i)}return k},b.prototype.att=function(a,b){return this.attribute(a,b)},b.prototype.ins=function(a,b){return this.instruction(a,b)},b.prototype.a=function(a,b){return this.attribute(a,b)},b.prototype.i=function(a,b){return this.instruction(a,b)},b}(e)}.call(this)},{"./XMLAttribute":57,"./XMLNode":68,"./XMLProcessingInstruction":69,underscore:74}],68:[function(a,b){!function(){var c,d,e={}.hasOwnProperty;d=a("underscore"),b.exports=c=function(){function b(a){this.parent=a,this.options=this.parent.options,this.stringify=this.parent.stringify}return b.prototype.element=function(a,b,c){var f,g,h,i,j,k,l;if(h=null,null==b&&(b={}),d.isObject(b)||(l=[b,c],c=l[0],b=l[1]),d.isArray(a))for(j=0,k=a.length;k>j;j++)f=a[j],h=this.element(f);else if(d.isFunction(a))h=this.element(a.apply());else if(d.isObject(a))for(g in a)e.call(a,g)&&(i=a[g],null!=i&&(d.isFunction(i)&&(i=i.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===g.indexOf(this.stringify.convertAttKey)?h=this.attribute(g.substr(this.stringify.convertAttKey.length),i):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===g.indexOf(this.stringify.convertPIKey)?h=this.instruction(g.substr(this.stringify.convertPIKey.length),i):d.isObject(i)?!this.options.ignoreDecorators&&this.stringify.convertListKey&&0===g.indexOf(this.stringify.convertListKey)&&d.isArray(i)?h=this.element(i):(h=this.element(g),h.element(i)):h=this.element(g,i)));else h=!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===a.indexOf(this.stringify.convertTextKey)?this.text(c):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===a.indexOf(this.stringify.convertCDataKey)?this.cdata(c):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===a.indexOf(this.stringify.convertCommentKey)?this.comment(c):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===a.indexOf(this.stringify.convertRawKey)?this.raw(c):this.node(a,b,c);if(null==h)throw new Error("Could not create any elements with: "+a);return h},b.prototype.insertBefore=function(a,b,c){var d,e,f;if(this.isRoot)throw new Error("Cannot insert elements at root level");return e=this.parent.children.indexOf(this),f=this.parent.children.splice(e),d=this.parent.element(a,b,c),Array.prototype.push.apply(this.parent.children,f),d},b.prototype.insertAfter=function(a,b,c){var d,e,f;if(this.isRoot)throw new Error("Cannot insert elements at root level");return e=this.parent.children.indexOf(this),f=this.parent.children.splice(e+1),d=this.parent.element(a,b,c),Array.prototype.push.apply(this.parent.children,f),d},b.prototype.remove=function(){var a,b;if(this.isRoot)throw new Error("Cannot remove the root element");return a=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[a,a-a+1].concat(b=[])),b,this.parent},b.prototype.node=function(b,c,e){var f,g,h;return null==c&&(c={}),d.isObject(c)||(h=[c,e],e=h[0],c=h[1]),f=a("./XMLElement"),g=new f(this,b,c),null!=e&&g.text(e),this.children.push(g),g},b.prototype.text=function(b){var c,d;return c=a("./XMLText"),d=new c(this,b),this.children.push(d),this},b.prototype.cdata=function(b){var c,d;return c=a("./XMLCData"),d=new c(this,b),this.children.push(d),this},b.prototype.comment=function(b){var c,d;return c=a("./XMLComment"),d=new c(this,b),this.children.push(d),this},b.prototype.raw=function(b){var c,d;return c=a("./XMLRaw"),d=new c(this,b),this.children.push(d),this},b.prototype.declaration=function(b,c,d){var e,f,g;return f=this.document(),e=a("./XMLDeclaration"),g=new e(f,b,c,d),f.xmldec=g,f.root()},b.prototype.doctype=function(b,c){var d,e,f;return e=this.document(),d=a("./XMLDocType"),f=new d(e,b,c),e.doctype=f,f},b.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},b.prototype.root=function(){var a;if(this.isRoot)return this;for(a=this.parent;!a.isRoot;)a=a.parent;return a},b.prototype.document=function(){return this.root().documentObject},b.prototype.end=function(a){return this.document().toString(a)},b.prototype.prev=function(){var a;if(this.isRoot)throw new Error("Root node has no siblings");if(a=this.parent.children.indexOf(this),1>a)throw new Error("Already at the first node");return this.parent.children[a-1]},b.prototype.next=function(){var a;if(this.isRoot)throw new Error("Root node has no siblings");if(a=this.parent.children.indexOf(this),-1===a||a===this.parent.children.length-1)throw new Error("Already at the last node");return this.parent.children[a+1]},b.prototype.importXMLBuilder=function(a){var b;return b=a.root().clone(!0),b.parent=this,this.children.push(b),b.isRoot=!1,this},b.prototype.clone=function(){return d.clone(this)},b.prototype.ele=function(a,b,c){return this.element(a,b,c)},b.prototype.nod=function(a,b,c){return this.node(a,b,c)},b.prototype.txt=function(a){return this.text(a)},b.prototype.dat=function(a){return this.cdata(a)},b.prototype.com=function(a){return this.comment(a)},b.prototype.doc=function(){return this.document()},b.prototype.dec=function(a,b,c){return this.declaration(a,b,c)},b.prototype.dtd=function(a,b){return this.doctype(a,b)},b.prototype.e=function(a,b,c){return this.element(a,b,c)},b.prototype.n=function(a,b,c){return this.node(a,b,c)},b.prototype.t=function(a){return this.text(a)},b.prototype.d=function(a){return this.cdata(a)},b.prototype.c=function(a){return this.comment(a)},b.prototype.r=function(a){return this.raw(a)},b.prototype.u=function(){return this.up()},b}()}.call(this)},{"./XMLCData":59,"./XMLComment":60,"./XMLDeclaration":65,"./XMLDocType":66,"./XMLElement":67,"./XMLRaw":70,"./XMLText":72,underscore:74}],69:[function(a,b){!function(){var c,d;d=a("underscore"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing instruction target");this.target=this.stringify.insTarget(b),c&&(this.value=this.stringify.insValue(c))}return a.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+="<?",f+=this.target,this.value&&(f+=" "+this.value),f+="?>",e&&(f+=d),f},a}()}.call(this)},{underscore:74}],70:[function(a,b){!function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=a("underscore"),c=a("./XMLNode"),b.exports=d=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing raw text");this.value=this.stringify.raw(c)}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+=this.value,e&&(f+=d),f},b}(c)}.call(this)},{"./XMLNode":68,underscore:74}],71:[function(a,b){!function(){var a,d={}.hasOwnProperty;b.exports=a=function(){function a(b){var c,e,f,g=this;this.assertLegalChar=function(){return a.prototype.assertLegalChar.apply(g,arguments)},this.allowSurrogateChars=null!=b?b.allowSurrogateChars:void 0,f=(null!=b?b.stringify:void 0)||{};for(c in f)d.call(f,c)&&(e=f[c],this[c]=e)}return a.prototype.eleName=function(a){return a=""+a||"",this.assertLegalChar(a)},a.prototype.eleText=function(a){return a=""+a||"",this.assertLegalChar(this.escape(a))},a.prototype.cdata=function(a){if(a=""+a||"",a.match(/]]>/))throw new Error("Invalid CDATA text: "+a);return this.assertLegalChar(a)},a.prototype.comment=function(a){if(a=""+a||"",a.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+a);return this.assertLegalChar(this.escape(a))},a.prototype.raw=function(a){return""+a||""},a.prototype.attName=function(a){return""+a||""},a.prototype.attValue=function(a){return a=""+a||"",this.escape(a)},a.prototype.insTarget=function(a){return""+a||""},a.prototype.insValue=function(a){if(a=""+a||"",a.match(/\?>/))throw new Error("Invalid processing instruction value: "+a);return a},a.prototype.xmlVersion=function(a){if(a=""+a||"",!a.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+a);return a},a.prototype.xmlEncoding=function(a){if(a=""+a||"",!a.match(/[A-Za-z](?:[A-Za-z0-9._-]|-)*/))throw new Error("Invalid encoding: "+options.val);return a},a.prototype.xmlStandalone=function(a){return a?"yes":"no"},a.prototype.dtdPubID=function(a){return""+a||""},a.prototype.dtdSysID=function(a){return""+a||""},a.prototype.dtdElementValue=function(a){return""+a||""},a.prototype.dtdAttType=function(a){return""+a||""},a.prototype.dtdAttDefault=function(a){return null!=a?""+a||"":a},a.prototype.dtdEntityValue=function(a){return""+a||""},a.prototype.dtdNData=function(a){return""+a||""},a.prototype.convertAttKey="@",a.prototype.convertPIKey="?",a.prototype.convertTextKey="#text",a.prototype.convertCDataKey="#cdata",a.prototype.convertCommentKey="#comment",a.prototype.convertRawKey="#raw",a.prototype.convertListKey="#list",a.prototype.assertLegalChar=function(a){var b,c;if(b=this.allowSurrogateChars?/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/:/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,c=a.match(b))throw new Error("Invalid character ("+c+") in string: "+a+" at index "+c.index);return a},a.prototype.escape=function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")},a}()}.call(this)},{}],72:[function(a,b){!function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};e=a("underscore"),c=a("./XMLNode"),b.exports=d=function(a){function b(a,c){if(this.parent=a,b.__super__.constructor.call(this,a),null==c)throw new Error("Missing element text");this.value=this.stringify.eleText(c)}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g;return e=(null!=a?a.pretty:void 0)||!1,c=(null!=a?a.indent:void 0)||" ",d=(null!=a?a.newline:void 0)||"\n",b||(b=0),g=new Array(b+1).join(c),f="",e&&(f+=g),f+=this.value,e&&(f+=d),f},b}(c)}.call(this)},{"./XMLNode":68,underscore:74}],73:[function(a,b){!function(){var c,d;d=a("underscore"),c=a("./XMLBuilder"),b.exports.create=function(a,b,e,f){return f=d.extend({},b,e,f),new c(a,f).root()}}.call(this)},{"./XMLBuilder":58,underscore:74}],74:[function(a,b,c){!function(){var a=this,d=a._,e={},f=Array.prototype,g=Object.prototype,h=Function.prototype,i=f.push,j=f.slice,k=f.concat,l=g.toString,m=g.hasOwnProperty,n=f.forEach,o=f.map,p=f.reduce,q=f.reduceRight,r=f.filter,s=f.every,t=f.some,u=f.indexOf,v=f.lastIndexOf,w=Array.isArray,x=Object.keys,y=h.bind,z=function(a){return a instanceof z?a:this instanceof z?(this._wrapped=a,void 0):new z(a)};"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=z),c._=z):a._=z,z.VERSION="1.5.2";var A=z.each=z.forEach=function(a,b,c){if(null!=a)if(n&&a.forEach===n)a.forEach(b,c);else if(a.length===+a.length){for(var d=0,f=a.length;f>d;d++)if(b.call(c,a[d],d,a)===e)return}else for(var g=z.keys(a),d=0,f=g.length;f>d;d++)if(b.call(c,a[g[d]],g[d],a)===e)return};z.map=z.collect=function(a,b,c){var d=[];return null==a?d:o&&a.map===o?a.map(b,c):(A(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var B="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),p&&a.reduce===p)return d&&(b=z.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(A(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(B);return c},z.reduceRight=z.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),q&&a.reduceRight===q)return d&&(b=z.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=z.keys(a);f=g.length}if(A(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(B);return c},z.find=z.detect=function(a,b,c){var d;return C(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},z.filter=z.select=function(a,b,c){var d=[];return null==a?d:r&&a.filter===r?a.filter(b,c):(A(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},z.reject=function(a,b,c){return z.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},z.every=z.all=function(a,b,c){b||(b=z.identity);var d=!0;return null==a?d:s&&a.every===s?a.every(b,c):(A(a,function(a,f,g){return(d=d&&b.call(c,a,f,g))?void 0:e}),!!d)};var C=z.some=z.any=function(a,b,c){b||(b=z.identity);var d=!1;return null==a?d:t&&a.some===t?a.some(b,c):(A(a,function(a,f,g){return d||(d=b.call(c,a,f,g))?e:void 0}),!!d)};z.contains=z.include=function(a,b){return null==a?!1:u&&a.indexOf===u?-1!=a.indexOf(b):C(a,function(a){return a===b})},z.invoke=function(a,b){var c=j.call(arguments,2),d=z.isFunction(b);return z.map(a,function(a){return(d?b:a[b]).apply(a,c)})},z.pluck=function(a,b){return z.map(a,function(a){return a[b]})},z.where=function(a,b,c){return z.isEmpty(b)?c?void 0:[]:z[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},z.findWhere=function(a,b){return z.where(a,b,!0)
},z.max=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&z.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return A(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>d.computed&&(d={value:a,computed:g})}),d.value},z.min=function(a,b,c){if(!b&&z.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&z.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return A(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},z.shuffle=function(a){var b,c=0,d=[];return A(a,function(a){b=z.random(c++),d[c-1]=d[b],d[b]=a}),d},z.sample=function(a,b,c){return arguments.length<2||c?a[z.random(a.length-1)]:z.shuffle(a).slice(0,Math.max(0,b))};var D=function(a){return z.isFunction(a)?a:function(b){return b[a]}};z.sortBy=function(a,b,c){var d=D(b);return z.pluck(z.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var E=function(a){return function(b,c,d){var e={},f=null==c?z.identity:D(c);return A(b,function(c,g){var h=f.call(d,c,g,b);a(e,h,c)}),e}};z.groupBy=E(function(a,b,c){(z.has(a,b)?a[b]:a[b]=[]).push(c)}),z.indexBy=E(function(a,b,c){a[b]=c}),z.countBy=E(function(a,b){z.has(a,b)?a[b]++:a[b]=1}),z.sortedIndex=function(a,b,c,d){c=null==c?z.identity:D(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},z.toArray=function(a){return a?z.isArray(a)?j.call(a):a.length===+a.length?z.map(a,z.identity):z.values(a):[]},z.size=function(a){return null==a?0:a.length===+a.length?a.length:z.keys(a).length},z.first=z.head=z.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:j.call(a,0,b)},z.initial=function(a,b,c){return j.call(a,0,a.length-(null==b||c?1:b))},z.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:j.call(a,Math.max(a.length-b,0))},z.rest=z.tail=z.drop=function(a,b,c){return j.call(a,null==b||c?1:b)},z.compact=function(a){return z.filter(a,z.identity)};var F=function(a,b,c){return b&&z.every(a,z.isArray)?k.apply(c,a):(A(a,function(a){z.isArray(a)||z.isArguments(a)?b?i.apply(c,a):F(a,b,c):c.push(a)}),c)};z.flatten=function(a,b){return F(a,b,[])},z.without=function(a){return z.difference(a,j.call(arguments,1))},z.uniq=z.unique=function(a,b,c,d){z.isFunction(b)&&(d=c,c=b,b=!1);var e=c?z.map(a,c,d):a,f=[],g=[];return A(e,function(c,d){(b?d&&g[g.length-1]===c:z.contains(g,c))||(g.push(c),f.push(a[d]))}),f},z.union=function(){return z.uniq(z.flatten(arguments,!0))},z.intersection=function(a){var b=j.call(arguments,1);return z.filter(z.uniq(a),function(a){return z.every(b,function(b){return z.indexOf(b,a)>=0})})},z.difference=function(a){var b=k.apply(f,j.call(arguments,1));return z.filter(a,function(a){return!z.contains(b,a)})},z.zip=function(){for(var a=z.max(z.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=z.pluck(arguments,""+c);return b},z.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},z.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=z.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(u&&a.indexOf===u)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},z.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(v&&a.lastIndexOf===v)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},z.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var G=function(){};z.bind=function(a,b){var c,d;if(y&&a.bind===y)return y.apply(a,j.call(arguments,1));if(!z.isFunction(a))throw new TypeError;return c=j.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(j.call(arguments)));G.prototype=a.prototype;var e=new G;G.prototype=null;var f=a.apply(e,c.concat(j.call(arguments)));return Object(f)===f?f:e}},z.partial=function(a){var b=j.call(arguments,1);return function(){return a.apply(this,b.concat(j.call(arguments)))}},z.bindAll=function(a){var b=j.call(arguments,1);if(0===b.length)throw new Error("bindAll must be passed function names");return A(b,function(b){a[b]=z.bind(a[b],a)}),a},z.memoize=function(a,b){var c={};return b||(b=z.identity),function(){var d=b.apply(this,arguments);return z.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},z.delay=function(a,b){var c=j.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},z.defer=function(a){return z.delay.apply(z,[a,1].concat(j.call(arguments,1)))},z.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:new Date,g=null,f=a.apply(d,e)};return function(){var j=new Date;h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},z.debounce=function(a,b,c){var d,e,f,g,h;return function(){f=this,e=arguments,g=new Date;var i=function(){var j=new Date-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e)))},j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e)),h}},z.once=function(a){var c,b=!1;return function(){return b?c:(b=!0,c=a.apply(this,arguments),a=null,c)}},z.wrap=function(a,b){return function(){var c=[a];return i.apply(c,arguments),b.apply(this,c)}},z.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},z.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},z.keys=x||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)z.has(a,c)&&b.push(c);return b},z.values=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},z.pairs=function(a){for(var b=z.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},z.invert=function(a){for(var b={},c=z.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},z.functions=z.methods=function(a){var b=[];for(var c in a)z.isFunction(a[c])&&b.push(c);return b.sort()},z.extend=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},z.pick=function(a){var b={},c=k.apply(f,j.call(arguments,1));return A(c,function(c){c in a&&(b[c]=a[c])}),b},z.omit=function(a){var b={},c=k.apply(f,j.call(arguments,1));for(var d in a)z.contains(c,d)||(b[d]=a[d]);return b},z.defaults=function(a){return A(j.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},z.clone=function(a){return z.isObject(a)?z.isArray(a)?a.slice():z.extend({},a):a},z.tap=function(a,b){return b(a),a};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof z&&(a=a._wrapped),b instanceof z&&(b=b._wrapped);var e=l.call(a);if(e!=l.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(z.isFunction(g)&&g instanceof g&&z.isFunction(h)&&h instanceof h))return!1;c.push(a),d.push(b);var i=0,j=!0;if("[object Array]"==e){if(i=a.length,j=i==b.length)for(;i--&&(j=H(a[i],b[i],c,d)););}else{for(var k in a)if(z.has(a,k)&&(i++,!(j=z.has(b,k)&&H(a[k],b[k],c,d))))break;if(j){for(k in b)if(z.has(b,k)&&!i--)break;j=!i}}return c.pop(),d.pop(),j};z.isEqual=function(a,b){return H(a,b,[],[])},z.isEmpty=function(a){if(null==a)return!0;if(z.isArray(a)||z.isString(a))return 0===a.length;for(var b in a)if(z.has(a,b))return!1;return!0},z.isElement=function(a){return!(!a||1!==a.nodeType)},z.isArray=w||function(a){return"[object Array]"==l.call(a)},z.isObject=function(a){return a===Object(a)},A(["Arguments","Function","String","Number","Date","RegExp"],function(a){z["is"+a]=function(b){return l.call(b)=="[object "+a+"]"}}),z.isArguments(arguments)||(z.isArguments=function(a){return!(!a||!z.has(a,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(a){return"function"==typeof a}),z.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},z.isNaN=function(a){return z.isNumber(a)&&a!=+a},z.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==l.call(a)},z.isNull=function(a){return null===a},z.isUndefined=function(a){return void 0===a},z.has=function(a,b){return m.call(a,b)},z.noConflict=function(){return a._=d,this},z.identity=function(a){return a},z.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},z.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var I={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};I.unescape=z.invert(I.escape);var J={escape:new RegExp("["+z.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+z.keys(I.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(a){z[a]=function(b){return null==b?"":(""+b).replace(J[a],function(b){return I[a][b]})}}),z.result=function(a,b){if(null==a)return void 0;var c=a[b];return z.isFunction(c)?c.call(a):c},z.mixin=function(a){A(z.functions(a),function(b){var c=z[b]=a[b];z.prototype[b]=function(){var a=[this._wrapped];return i.apply(a,arguments),O.call(this,c.apply(z,a))}})};var K=0;z.uniqueId=function(a){var b=++K+"";return a?a+b:b},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,M={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},N=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(a,b,c){var d;c=z.defaults({},c,z.templateSettings);var e=new RegExp([(c.escape||L).source,(c.interpolate||L).source,(c.evaluate||L).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(N,function(a){return"\\"+M[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,z);var i=function(a){return d.call(this,a,z)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},z.chain=function(a){return z(a).chain()};var O=function(a){return this._chain?z(a).chain():a};z.mixin(z),A(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=f[a];z.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],O.call(this,c)}}),A(["concat","join","slice"],function(a){var b=f[a];z.prototype[a]=function(){return O.call(this,b.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this)},{}]},{},[13])(13)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment