mjackson/mach

View on GitHub
lib/umd/mach.min.js

Summary

Maintainability
A
0 mins
Test Coverage
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.mach=e():t.mach=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var r=[],o=t.exports={version:n(1),Connection:n(2),Header:n(3),Location:n(4),Message:n(5),extend:function(){for(var t,e=0,n=arguments.length;n>e;++e)t=arguments[e],-1===r.indexOf(t)&&(r.push(t),t(o))}};o.extend(n(6))},function(t){"use strict";t.exports="1.3.5"},function(t,e,n){"use strict";function r(t){return c.gs(function(){return this.location[t]},function(e){this.location[t]=e})}function o(t){if("undefined"==typeof console||!console.error)throw t;console.error(t&&t.stack||t)}function i(){}function s(t){t.status=404,t.response.contentType="text/plain",t.response.content="Not found: "+t.method+" "+t.path}function u(t){t=t||{};var e;"string"==typeof t?e=t:t.location||t.url?e=t.location||t.url:"object"==typeof window&&(e=window.location.href),this.location=e,this.version=t.version||"1.1",this.method=t.method,this.onError=(t.onError||o).bind(this),this.onClose=(t.onClose||i).bind(this),this.request=new v(t.content,t.headers),this.response=new v,t.params&&("GET"===this.method||"HEAD"===this.method?this.query=t.params:(this.request.contentType="application/x-www-form-urlencoded",this.request.content=p(t.params))),this.withCredentials=t.withCredentials||!1,this.remoteHost=t.remoteHost||null,this.remoteUser=t.remoteUser||null,this.basename="",this.responseText=null,this.status=200}var c=n(18),a=n(20).isBinary,f=n(7),h=n(8),p=n(9),l=n(10),d=n(4),v=n(5);Object.defineProperties(u.prototype,{method:c.gs(function(){return this._method},function(t){this._method="string"==typeof t?t.toUpperCase():"GET"}),location:c.gs(function(){return this._location},function(t){this._location=t instanceof d?t:new d(t)}),href:r("href"),protocol:r("protocol"),host:r("host"),hostname:r("hostname"),port:r("port"),search:r("search"),queryString:r("queryString"),query:r("query"),isSSL:c.gs(function(){return"https:"===this.protocol}),auth:c.gs(function(){var t=this.request.headers.Authorization;if(t){var e=t.split(" ",2),n=e[0];return"basic"===n.toLowerCase()?f(e[1]):t}return this.location.auth},function(t){var e=this.request.headers;t&&"string"==typeof t?e.Authorization="Basic "+h(t):delete e.Authorization}),pathname:c.gs(function(){return this.location.pathname.replace(this.basename,"")||"/"},function(t){this.location.pathname=this.basename+t}),path:c.gs(function(){return this.pathname+this.search},function(t){this.location.path=this.basename+t}),call:c(function(t){t=t||s;var e=this;try{return l.resolve(t(e)).then(function(t){null!=t&&("number"==typeof t?e.status=t:"string"==typeof t||a(t)||"function"==typeof t.pipe?e.response.content=t:(null!=t.headers&&(e.response.headers=t.headers),null!=t.content&&(e.response.content=t.content),null!=t.status&&(e.status=t.status)))})}catch(n){return l.reject(n)}})}),t.exports=u},function(t,e,n){"use strict";var r=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=n(11),s=function(){function t(e,n){o(this,t),this.name=e,this.value=n}return r(t,null,{name:{get:function(){return this._name},set:function(t){this._name=i(t)},configurable:!0},toString:{value:function(){return this.name+": "+this.value},writable:!0,configurable:!0}}),t}();t.exports=s},function(t,e,n){"use strict";function r(t,e){return s.gs(function(){return this.properties[t]||(null==e?null:e)},function(e){this.properties[t]=e})}function o(t,e){for(var n,r=0,o=p.length;o>r;++r)n=p[r],e.hasOwnProperty(n)&&n in t&&(t[n]=e[n])}function i(t){this.properties={},"string"==typeof t?this.href=t:t&&o(this,t)}var s=n(18),u=n(12),c=n(9),a=n(13),f=n(16),h={"http:":"80","https:":"443"},p=["protocol","auth","hostname","port","host","pathname","search","queryString","query","path"];Object.defineProperties(i.prototype,{concat:s(function(t){t instanceof i||(t=new i(t));var e=this.pathname,n=t.pathname;"/"!==n&&(e=e.replace(/\/*$/,"/")+n.replace(/^\/*/,""));var r=u(this.query,t.query);return new i({protocol:t.protocol||this.protocol,auth:t.auth||this.auth,hostname:t.hostname||this.hostname,port:t.port||this.port,pathname:e,query:r})}),href:s.gs(function(){var t=this.auth,e=this.host,n=this.path;return e?this.protocol+"//"+(t?t+"@":"")+e+n:n},function(t){var e=f(t);o(this,{protocol:e.protocol,auth:e.auth,hostname:e.hostname,port:e.port,pathname:e.pathname,search:e.search})}),protocol:r("protocol"),auth:r("auth",""),host:s.gs(function(){var t=this.protocol,e=this.hostname,n=this.port;return null!=n&&n!==h[t]&&(e+=":"+n),e},function(t){var e;"string"==typeof t&&-1!==(e=t.indexOf(":"))?(this.hostname=t.substring(0,e),this.port=t.substring(e+1)):(this.hostname=t,this.port=null)}),hostname:r("hostname"),port:s.gs(function(){return this.properties.port||(this.protocol?h[this.protocol]:null)},function(t){this.properties.port=t?String(t):null}),pathname:r("pathname","/"),path:s.gs(function(){return this.pathname+this.search},function(t){var e;"string"==typeof t&&-1!==(e=t.indexOf("?"))?(this.pathname=t.substring(0,e),this.search=t.substring(e)):(this.pathname=t,this.search=null)}),search:r("search",""),queryString:s.gs(function(){return this.search.substring(1)},function(t){this.search=t&&"?"+t}),query:s.gs(function(){return a(this.queryString)},function(t){this.queryString=c(t)}),toJSON:s(function(){return this.href}),toString:s(function(){return this.href})}),t.exports=i},function(t,e,n){"use strict";function r(t,e){return t.stringifyContent(e)}function o(t,e){this.headers=e,this.content=t}var i=n(20),s=n(18),u=n(19),c=n(14),a=n(11),f=n(15),h=n(13),p=i.fromString(""),l=Math.pow(2,20),d=/\r?\n/,v=": ";Object.defineProperties(o,{PARSERS:s({enumerable:!0,value:{"application/json":function(t,e){return t.stringifyContent(e).then(JSON.parse)},"application/x-www-form-urlencoded":function(t,e){return t.stringifyContent(e).then(h)}}})}),Object.defineProperties(o.prototype,{headers:s.gs(function(){return this._headers},function(t){if(this._headers={},"string"==typeof t)t.split(d).forEach(function(t){var e=t.indexOf(v);-1===e?this.addHeader(t,!0):this.addHeader(t.substring(0,e),t.substring(e+v.length))},this);else if(null!=t)for(var e in t)t.hasOwnProperty(e)&&this.addHeader(e,t[e])}),getHeader:s(function(t){return this.headers[a(t)]}),setHeader:s(function(t,e){this.headers[a(t)]=e}),addHeader:s(function(t,e){t=a(t);var n=this.headers;t in n?Array.isArray(n[t])?n[t].push(e):n[t]=[n[t],e]:n[t]=e}),cookies:s.gs(function(){if(!this._cookies){var t=this.headers.Cookie;if(t){var e=f(t);for(var n in e)Array.isArray(e[n])&&(e[n]=e[n][0]||"");this._cookies=e}else this._cookies={}}return this._cookies}),contentType:s.gs(function(){return this.headers["Content-Type"]},function(t){this.headers["Content-Type"]=t}),mediaType:s.gs(function(){var t,e=this.contentType;return e&&(t=e.match(/^([^;,]+)/))?t[1].toLowerCase():null},function(t){this.contentType=t+(this.charset?";charset="+this.charset:"")}),charset:s.gs(function(){var t,e=this.contentType;return e&&(t=e.match(/\bcharset=([\w-]+)/))?t[1]:null},function(t){this.contentType=this.mediaType+(t?";charset="+t:"")}),content:s.gs(function(){return this._content},function(t){null==t&&(t=p),t instanceof u?(this._content=t,t.pause()):this._content=new u(t),delete this._bufferedContent}),isBuffered:s.gs(function(){return null!=this._bufferedContent}),bufferContent:s(function(t){return null==this._bufferedContent&&(this._bufferedContent=c(this.content,t)),this._bufferedContent}),stringifyContent:s(function(t,e){return e=e||this.charset,this.bufferContent(t).then(function(t){return i.toString(t,e)})}),parseContent:s(function(t){if(this._parsedContent)return this._parsedContent;"number"!=typeof t&&(t=l);var e=o.PARSERS[this.mediaType]||r;return this._parsedContent=e(this,t),this._parsedContent})}),t.exports=o},function(t,e,n){"use strict";t.exports=function(t){t.extend(n(17))}},function(t,e,n){"use strict";t.exports=n(20).decodeBase64},function(t,e,n){"use strict";t.exports=n(20).encodeBase64},function(t,e,n){"use strict";t.exports=n(25).stringify},function(t,e,n){"use strict";var r=n(28);t.exports=r},function(t,e,n){"use strict";function r(t){return t=t.toLowerCase(),t in o?o[t]:t.replace(/(^|-)([a-z])/g,function(t,e,n){return e+n.toUpperCase()})}var o=n(21);t.exports=r},function(t,e,n){"use strict";t.exports=n(26).merge},function(t,e,n){"use strict";t.exports=n(25).parse},function(t,e,n){"use strict";function r(t,e){if(e=e||1/0,!t.readable)throw new Error("Cannot buffer stream that is not readable");return new i(function(n,r){var i=[],u=0;t.on("error",r),t.on("data",function(t){u+=t.length,u>e?r(new s(e)):i.push(t)}),t.on("end",function(){n(o.join(i))}),"function"==typeof t.resume&&t.resume()})}var o=n(20),i=n(10),s=n(22);t.exports=r},function(t,e,n){"use strict";function r(t){return o(t,{delimiter:/[;,] */})}var o=n(13);t.exports=r},function(t){"use strict";function e(t){var e=n.exec(t)||{},r=document.createElement("a");return r.href=t,{protocol:e[1]||null,auth:e[2]||null,hostname:e[3]||null,port:e[4]||null,pathname:r.pathname,search:r.search,hash:r.hash}}var n=/^(https?:)\/\/(?:([^@]+)@)?([^/:]+)(?::(\d+))?/;t.exports=e},function(t,e,n){"use strict";function r(t){return i(t,t.location)}var o=n(29),i=n(27),s=n(4);t.exports=function(t){t.call=n(24),["DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE"].forEach(function(e){var n=e.toLowerCase();t[n]=function(n,i,u){return"function"!=typeof n?(u=i,i="string"==typeof n?{url:n}:n instanceof s?{location:n}:o({},n||{}),n=r):"string"==typeof i?i={url:i}:i instanceof s?i={location:i}:"object"!=typeof i?(u=i,i={}):i=o({},i||{}),i.method=e,t.call(n,i,u)}})}},function(t,e,n){function r(t){"function"==typeof t&&(t={value:t});var e={configurable:!0,enumerable:!1};return null==t.get&&null==t.set&&(e.writable=!0),o(e,t)}var o=n(29);r.gs=function(t,e){var n={get:t};return"function"==typeof e&&(n.set=e),r(n)},t.exports=r},function(t,e,n){function r(t){t.on("pipe",function(e){function n(){t._source=null,e.removeListener("error",n),e.removeListener("end",n)}if(t._source)throw new Error("BufferedStream is already piped");t._source=e,e.on("error",n),e.on("end",n)})}function o(t){t._flushing||(t._flushing=!0,c(function e(){return t.paused?void(t._flushing=!1):(i(t),void(t.empty?t._flushing=!1:c(e)))}))}function i(t){if(t._chunks){for(var e;(e=t._chunks.shift())&&(t.size-=e.length,t.encoding?t.emit("data",a.toString(e,t.encoding)):t.emit("data",e),!t.paused););t.ended?t.paused||(t._chunks=null,t.emit("end")):t._wasFull&&!t.full&&(t._wasFull=!1,t.emit("drain"))}}function s(t,e,n){return this instanceof s?(u.call(this),"number"!=typeof t&&(n=e,e=t,t=p),this.maxSize=t,this.size=0,this.encoding=null,this.paused=!0,this.ended=!1,this.readable=!0,this.writable=!0,this._chunks=[],this._flushing=!1,this._wasFull=!1,this._source=null,r(this),void(null!=e&&("function"==typeof e.pipe?("function"==typeof e.resume&&e.resume(),e.pipe(this)):this.end(e,n)))):new s(t,e,n)}/*!
     * BufferedStream - A robust stream implementation for node.js and the browser
     * https://github.com/mjackson/bufferedstream
     */
var u,c,a=n(20),f=n(18),h=n(30).EventEmitter,p=Math.pow(2,16);"object"==typeof window?(u=h,c=window.setTimeout):(u=n(23).Stream,c=process.nextTick),s.prototype=Object.create(u.prototype,{constructor:f(s),empty:f.gs(function(){return null==this._chunks||0===this._chunks.length}),full:f.gs(function(){return this.maxSize<this.size}),piped:f.gs(function(){return null!=this._source}),setEncoding:f(function(t){this.encoding=t}),pause:f(function(){this.paused=!0}),resume:f(function(){this.paused&&o(this),this.paused=!1}),pipe:f(function(t,e){function n(e){t.writable&&!1===t.write(e)&&u.pause()}function r(){u.readable&&u.resume()}function o(){c||(c=!0,t.end())}function i(t){if(s(),0===h.listenerCount(this,"error"))throw t}function s(){u.removeListener("data",n),t.removeListener("drain",r),u.removeListener("end",o),u.removeListener("error",i),t.removeListener("error",i),u.removeListener("end",s)}var u=this;u.on("data",n),t.on("drain",r);var c=!1;return t._isStdio||e&&e.end===!1||u.on("end",o),u.on("error",i),t.on("error",i),u.on("end",s),t.on("close",s),t.emit("pipe",u),u.resume(),t}),write:f(function(t){if(!this.writable)throw new Error("BufferedStream is not writable");if(this.ended)throw new Error("BufferedStream is already ended");if("string"==typeof t&&(t=a.fromString(t,arguments[1])),!a.isBinary(t))throw new Error("BufferedStream only accepts binary data");return this._chunks.push(t),this.size+=t.length,o(this),this.full?(this._wasFull=!0,!1):!0}),end:f(function(t){if(this.ended)throw new Error("BufferedStream is already ended");null!=t&&this.write(t,arguments[1]),this.ended=!0,o(this)})}),t.exports=s},function(t){"use strict";function e(t){return t&&"object"==typeof t&&t instanceof Uint8Array||"Uint8Array"===t.constructor.name}function n(t){return new Uint8Array(t)}function r(t){for(var e=t.length,r=0,o=0;e>o;o++)r+=t[o].length;var s=n(r),u=0;for(o=0;e>o;o++){var c=t[o];i(c,s,u),u+=c.length}return s}function o(t,e,n){return void 0===n&&(n=t.length,void 0===e&&(e=0)),t.subarray(e,n)}function i(t,e,r){var o=t.length;void 0===r&&(r=0,void 0===e&&(e=n(o)));for(var i=0;o>i;i++)e[i+r]=t[i];return e}function s(t,e,n){var r="";void 0===n&&(n=t.length,void 0===e&&(e=0));for(var o=e;n>o;o++){var i=t[o];r+=String.fromCharCode(f(i>>4))+String.fromCharCode(f(15&i))}return r}function u(t,e,r){var o=t.length/2;void 0===r&&(r=0,void 0===e&&(e=n(o)));for(var i=0,s=0;o>s;s++)e[r+s]=h(t.charCodeAt(i++))<<4|h(t.charCodeAt(i++));return e}function c(t,e,n){return btoa(b(t,e,n))}function a(t,e,n){return _(atob(t),e,n)}function f(t){return t|=0,t+(10>t?48:87)|0}function h(t){return t|=0,t-(64&t?87:48)|0}function p(t,e,n){return g(b(t,e,n))}function l(t,e,n){return _(w(t),e,n)}function d(t){for(var e=0,n=t.length,r="";n>e;)r+=String.fromCharCode(h(t.charCodeAt(e++))<<4|h(t.charCodeAt(e++)));return r}function v(t){for(var e="",n=t.length,r=0;n>r;r++){var o=t.charCodeAt(r);e+=String.fromCharCode(f(o>>4))+String.fromCharCode(f(15&o))}return e}function y(t){return atob(t)}function m(t){return btoa(t)}function g(t){return decodeURIComponent(window.escape(t))}function w(t){return window.unescape(encodeURIComponent(t))}function b(t,e,n){var r="";void 0===n&&(n=t.length,void 0===e&&(e=0));for(var o=e;n>o;o++)r+=String.fromCharCode(t[o]);return r}function _(t,e,r){var o=t.length;void 0===r&&(r=0,void 0===e&&(e=n(o)));for(var i=0;o>i;i++)e[r+i]=t.charCodeAt(i);return e}function x(t,e,n){void 0===n&&(n=t.length,void 0===e&&(e=0));for(var r=n-e,o=new Array(r),i=0;r>i;i++)o[i]=t[i+e];return o}function j(t,e,r){var o=t.length;void 0===r&&(r=0,void 0===e&&(e=n(o)));for(var i=0;o>i;i++)e[r+i]=t[i];return e}function C(t,e){return(e&&T[e]||T.utf8)(t)}function L(t,e){return(e&&O[e]||O.utf8)(t)}t.exports={Binary:Uint8Array,isBinary:e,create:n,join:r,copy:i,slice:o,toRaw:b,fromRaw:_,toUnicode:p,fromUnicode:l,toHex:s,fromHex:u,toBase64:c,fromBase64:a,toString:C,fromString:L,toArray:x,fromArray:j,decodeHex:d,encodeHex:v,decodeBase64:y,encodeBase64:m,encodeUtf8:w,decodeUtf8:g,nibbleToCode:f,codeToNibble:h};var T={base64:c,hex:s,utf8:p,"utf-8":p},O={base64:a,hex:u,utf8:l,"utf-8":l}},function(t){"use strict";t.exports=["Content-ID","Content-MD5","DNT","ETag","P3P","TE","WWW-Authenticate","X-ATT-DeviceId","X-UA-Compatible","X-WebKit-CSP","X-XSS-Protection"].reduce(function(t,e){return t[e.toLowerCase()]=e,t},{})},function(t,e,n){"use strict";function r(t){Error.call(this),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message="Maximum length exceeded",this.maxLength=t}var o=n(18);r.prototype=Object.create(Error.prototype,{constructor:o(r)}),t.exports=r},function(){},function(t,e,n){"use strict";function r(t,e,n){e=e||{};var r=new o(e);return i.resolve(n?n(r):r).then(function(n){return null!=n&&n instanceof o||(n=r),n.call(t).then(function(){return e.binary?n:n.response.stringifyContent(e.maxLength,e.encoding).then(function(t){return n.responseText=t,n})})})}var o=n(2),i=n(10);t.exports=r},function(t,e,n){t.exports=n(32)},function(t,e){e.arrayToObject=function(t){for(var e={},n=0,r=t.length;r>n;++n)"undefined"!=typeof t[n]&&(e[n]=t[n]);return e},e.merge=function(t,n){if(!n)return t;if("object"!=typeof n)return Array.isArray(t)?t.push(n):t[n]=!0,t;if("object"!=typeof t)return t=[t].concat(n);Array.isArray(t)&&!Array.isArray(n)&&(t=e.arrayToObject(t));for(var r=Object.keys(n),o=0,i=r.length;i>o;++o){var s=r[o],u=n[s];t[s]=t[s]?e.merge(t[s],u):u}return t},e.decode=function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},e.compact=function(t,n){if("object"!=typeof t||null===t)return t;n=n||[];var r=n.indexOf(t);if(-1!==r)return n[r];if(n.push(t),Array.isArray(t)){for(var o=[],i=0,s=t.length;s>i;++i)"undefined"!=typeof t[i]&&o.push(t[i]);return o}var u=Object.keys(t);for(i=0,s=u.length;s>i;++i){var c=u[i];t[c]=e.compact(t[c],n)}return t},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},e.isBuffer=function(t){return null===t||"undefined"==typeof t?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}},function(t,e,n){"use strict";function r(t,e){return e.response.headers=t.getAllResponseHeaders(),e.status=t.status,e.status}function o(t){var e=String(t.responseType).toLowerCase();return"blob"===e?t.responseBlob||t.response:"arraybuffer"===e?t.response:"function"==typeof VBArray?new VBArray(client.responseBody).toArray():t.responseText}function i(t,e,n){var r=o(t);if(null!=r){if(r.toString().match(/ArrayBuffer/))return e.write(new Uint8Array(r,n)),r.byteLength;if(r.length>n)return e.write(r.slice(n)),r.length}return n}function s(t){"responseType"in t?t.responseType="arraybuffer":"overrideMimeType"in t?t.overrideMimeType("text/plain; charset=x-user-defined"):t.setRequestHeader("Accept-Charset","x-user-defined")}function u(t){"withCredentials"in t&&(t.withCredentials=!0)}function c(t,e){return new h(function(n,o,c){function h(){!g&&(g=r(d,t))>0&&n(t)}var d=new a;d.open(t.method,e.href,!0),s(d),t.withCredentials&&u(d);var v=t.request,y=v.headers;if(y)for(var m in y)y.hasOwnProperty(m)&&d.setRequestHeader(m,y[m]);var g,w=t.response.content=new f,b=0;d.onreadystatechange=function(){if(!d.error)if(2===d.readyState&&p)try{h()}catch(t){p=!1}else if(3===d.readyState&&l)try{h(),b=i(d,w,b)}catch(t){l=!1}else 4===d.readyState&&(h(),i(d,w,b),w.end())},d.onerror=function(t){o(t.error||new Error("XMLHttpRequest failed"))},c(function(){try{d.abort()}catch(t){}n()}),v.bufferContent().then(function(t){d.send(t)}).then(void 0,o)})}var a=window.XMLHttpRequest,f=n(19),h=n(31),p=!0,l=!0;t.exports=c},function(t,e,n){var r;/** @license MIT License (c) copyright 2010-2014 original author or authors */
!function(){"use strict";r=function(){var t=n(33),e=n(34),r=n(35).asap;return t({scheduler:new e(r)})}.call(e,n,e,t),!(void 0!==r&&(t.exports=r))}(n(36))},function(t){"use strict";function e(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t){for(var n,r,o=e(t),i=1;i<arguments.length;i++){n=arguments[i],r=Object.keys(Object(n));for(var s=0;s<r.length;s++)o[r[s]]=n[r[s]]}return o}},function(t){function e(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function r(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function i(t){return void 0===t}t.exports=e,e.EventEmitter=e,e.prototype._events=void 0,e.prototype._maxListeners=void 0,e.defaultMaxListeners=10,e.prototype.setMaxListeners=function(t){if(!r(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},e.prototype.emit=function(t){var e,r,s,u,c,a;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],i(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,u=new Array(s-1),c=1;s>c;c++)u[c-1]=arguments[c];r.apply(this,u)}else if(o(r)){for(s=arguments.length,u=new Array(s-1),c=1;s>c;c++)u[c-1]=arguments[c];for(a=r.slice(),s=a.length,c=0;s>c;c++)a[c].apply(this,u)}return!0},e.prototype.addListener=function(t,r){var s;if(!n(r))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(r.listener)?r.listener:r),this._events[t]?o(this._events[t])?this._events[t].push(r):this._events[t]=[this._events[t],r]:this._events[t]=r,o(this._events[t])&&!this._events[t].warned){var s;s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(t,e){function r(){this.removeListener(t,r),o||(o=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var o=!1;return r.listener=e,this.on(t,r),this},e.prototype.removeListener=function(t,e){var r,i,s,u;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(u=s;u-->0;)if(r[u]===e||r[u].listener&&r[u].listener===e){i=u;break}if(0>i)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},e.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},e.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},e.listenerCount=function(t,e){var r;return r=t._events&&t._events[e]?n(t._events[e])?1:t._events[e].length:0}},function(t,e,n){"use strict";function r(t,e){t.abort=e;var n=t.then;return t.then=function(){return r(n.apply(t,arguments),e)},t}function o(t){if("function"!=typeof t)throw new Error("AbortablePromise needs a resolver function");var e,n=new i(function(n,r){var o;e=function(){if(null!=o){var t=o;o=null;try{return t.apply(this,arguments)}catch(e){r(e)}}},t(function(t){o=t&&"function"==typeof t.abort?t.abort:null,n.apply(this,arguments)},function(){o=null,r.apply(this,arguments)},function(t){if("function"!=typeof t)throw new Error("onAbort needs a function");o=t})});return r(n,e)}var i=n(10);t.exports=o},function(t,e,n){var r=n(38),o=n(39);t.exports={stringify:r,parse:o}},function(t,e,n){var r;/** @license MIT License (c) copyright 2010-2014 original author or authors */
!function(){"use strict";r=function(){return function(t){function e(t,e){this._handler=t===w?e:n(t)}function n(t){function e(t){o.resolve(t)}function n(t){o.reject(t)}function r(t){o.notify(t)}var o=new _;try{t(e,n,r)}catch(i){n(i)}return o}function r(t){return P(t)?t:new e(w,new x(y(t)))}function o(t){return new e(w,new x(new L(t)))}function i(){return Z}function s(){return new e(w,new _)}function u(t,e){var n=new _(t.receiver,t.join().context);return new e(w,n)}function c(t){return f(X,null,t)}function a(t,e){return f(z,t,e)}function f(t,n,r){function o(e,o,s){s.resolved||h(r,i,e,t(n,o,e),s)}function i(t,e,n){f[t]=e,0===--a&&n.become(new C(f))}for(var s,u="function"==typeof n?o:i,c=new _,a=r.length>>>0,f=new Array(a),p=0;p<r.length&&!c.resolved;++p)s=r[p],void 0!==s||p in r?h(r,u,p,s,c):--a;return 0===a&&c.become(new C(f)),new e(w,c)}function h(t,e,n,r,o){if(B(r)){var i=m(r),s=i.state();0===s?i.fold(e,n,void 0,o):s>0?e(n,i.value,o):(o.become(i),p(t,n+1,i))}else e(n,r,o)}function p(t,e,n){for(var r=e;r<t.length;++r)l(y(t[r]),n)}function l(t,e){if(t!==e){var n=t.state();0===n?t.visit(t,void 0,t._unreport):0>n&&t._unreport()}}function d(t){return"object"!=typeof t||null===t?o(new TypeError("non-iterable passed to race()")):0===t.length?i():1===t.length?r(t[0]):v(t)}function v(t){var n,r,o,i=new _;for(n=0;n<t.length;++n)if(r=t[n],void 0!==r||n in t){if(o=y(r),0!==o.state()){i.become(o),p(t,n+1,o);break}o.visit(i,i.resolve,i.reject)}return new e(w,i)}function y(t){return P(t)?t._handler.join():B(t)?g(t):new C(t)}function m(t){return P(t)?t._handler.join():g(t)}function g(t){try{var e=t.then;return"function"==typeof e?new j(e,t):new C(t)}catch(n){return new L(n)}}function w(){}function b(){}function _(t,n){e.createContext(this,n),this.consumers=void 0,this.receiver=t,this.handler=void 0,this.resolved=!1}function x(t){this.handler=t}function j(t,e){_.call(this),K.enqueue(new q(t,e,this))}function C(t){e.createContext(this),this.value=t}function L(t){e.createContext(this),this.id=++$,this.value=t,this.handled=!1,this.reported=!1,this._report()}function T(t,e){this.rejection=t,this.context=e}function O(t){this.rejection=t}function E(){return new L(new TypeError("Promise cycle"))}function A(t,e){this.continuation=t,this.handler=e}function S(t,e){this.handler=e,this.value=t}function q(t,e,n){this._then=t,this.thenable=e,this.resolver=n}function k(t,e,n,r,o){try{t.call(e,n,r,o)}catch(i){r(i)}}function R(t,e,n,r){this.f=t,this.z=e,this.c=n,this.to=r,this.resolver=J,this.receiver=this}function P(t){return t instanceof e}function B(t){return("object"==typeof t||"function"==typeof t)&&null!==t}function U(t,n,r,o){return"function"!=typeof t?o.become(n):(e.enterContext(n),N(t,n.value,r,o),void e.exitContext())}function H(t,n,r,o,i){return"function"!=typeof t?i.become(r):(e.enterContext(r),Q(t,n,r.value,o,i),void e.exitContext())}function M(t,n,r,o,i){return"function"!=typeof t?i.notify(n):(e.enterContext(r),I(t,n,o,i),void e.exitContext())}function z(t,e,n){try{return t(e,n)}catch(r){return o(r)}}function N(t,e,n,r){try{r.become(y(t.call(n,e)))}catch(o){r.become(new L(o))}}function Q(t,e,n,r,o){try{t.call(r,e,n,o)}catch(i){o.become(new L(i))}}function I(t,e,n,r){try{r.notify(t.call(n,e))}catch(o){r.notify(o)}}function D(t,e){e.prototype=G(t.prototype),e.prototype.constructor=e}function X(t,e){return e}function F(){}function W(){return"undefined"!=typeof process&&null!==process&&"function"==typeof process.emit?function(t,e){return"unhandledRejection"===t?process.emit(t,e.value,e):process.emit(t,e)}:"undefined"!=typeof self&&"function"==typeof CustomEvent?function(t,e,n){var r=!1;try{var o=new n("unhandledRejection");r=o instanceof n}catch(i){}return r?function(t,r){var o=new n(t,{detail:{reason:r.value,key:r},bubbles:!1,cancelable:!0});return!e.dispatchEvent(o)}:t}(F,self,CustomEvent):F}var K=t.scheduler,V=W(),G=Object.create||function(t){function e(){}return e.prototype=t,new e};e.resolve=r,e.reject=o,e.never=i,e._defer=s,e._handler=y,e.prototype.then=function(t,e,n){var r=this._handler,o=r.join().state();if("function"!=typeof t&&o>0||"function"!=typeof e&&0>o)return new this.constructor(w,r);var i=this._beget(),s=i._handler;return r.chain(s,r.receiver,t,e,n),i},e.prototype["catch"]=function(t){return this.then(void 0,t)},e.prototype._beget=function(){return u(this._handler,this.constructor)},e.all=c,e.race=d,e._traverse=a,e._visitRemaining=p,w.prototype.when=w.prototype.become=w.prototype.notify=w.prototype.fail=w.prototype._unreport=w.prototype._report=F,w.prototype._state=0,w.prototype.state=function(){return this._state},w.prototype.join=function(){for(var t=this;void 0!==t.handler;)t=t.handler;return t},w.prototype.chain=function(t,e,n,r,o){this.when({resolver:t,receiver:e,fulfilled:n,rejected:r,progress:o})},w.prototype.visit=function(t,e,n,r){this.chain(J,t,e,n,r)},w.prototype.fold=function(t,e,n,r){this.when(new R(t,e,n,r))},D(w,b),b.prototype.become=function(t){t.fail()};var J=new b;D(w,_),_.prototype._state=0,_.prototype.resolve=function(t){this.become(y(t))},_.prototype.reject=function(t){this.resolved||this.become(new L(t))},_.prototype.join=function(){if(!this.resolved)return this;for(var t=this;void 0!==t.handler;)if(t=t.handler,t===this)return this.handler=E();return t},_.prototype.run=function(){var t=this.consumers,e=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n<t.length;++n)e.when(t[n])},_.prototype.become=function(t){this.resolved||(this.resolved=!0,this.handler=t,void 0!==this.consumers&&K.enqueue(this),void 0!==this.context&&t._report(this.context))},_.prototype.when=function(t){this.resolved?K.enqueue(new A(t,this.handler)):void 0===this.consumers?this.consumers=[t]:this.consumers.push(t)},_.prototype.notify=function(t){this.resolved||K.enqueue(new S(t,this))},_.prototype.fail=function(t){var e="undefined"==typeof t?this.context:t;this.resolved&&this.handler.join().fail(e)},_.prototype._report=function(t){this.resolved&&this.handler.join()._report(t)},_.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()},D(w,x),x.prototype.when=function(t){K.enqueue(new A(t,this))},x.prototype._report=function(t){this.join()._report(t)},x.prototype._unreport=function(){this.join()._unreport()},D(_,j),D(w,C),C.prototype._state=1,C.prototype.fold=function(t,e,n,r){H(t,e,this,n,r)},C.prototype.when=function(t){U(t.fulfilled,this,t.receiver,t.resolver)};var $=0;D(w,L),L.prototype._state=-1,L.prototype.fold=function(t,e,n,r){r.become(this)},L.prototype.when=function(t){"function"==typeof t.rejected&&this._unreport(),U(t.rejected,this,t.receiver,t.resolver)},L.prototype._report=function(t){K.afterQueue(new T(this,t))},L.prototype._unreport=function(){this.handled||(this.handled=!0,K.afterQueue(new O(this)))},L.prototype.fail=function(t){this.reported=!0,V("unhandledRejection",this),e.onFatalRejection(this,void 0===t?this.context:t)},T.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,V("unhandledRejection",this.rejection)||e.onPotentiallyUnhandledRejection(this.rejection,this.context))},O.prototype.run=function(){this.rejection.reported&&(V("rejectionHandled",this.rejection)||e.onPotentiallyUnhandledRejectionHandled(this.rejection))},e.createContext=e.enterContext=e.exitContext=e.onPotentiallyUnhandledRejection=e.onPotentiallyUnhandledRejectionHandled=e.onFatalRejection=F;var Y=new w,Z=new e(w,Y);return A.prototype.run=function(){this.handler.join().when(this.continuation)},S.prototype.run=function(){var t=this.handler.consumers;if(void 0!==t)for(var e,n=0;n<t.length;++n)e=t[n],M(e.progress,this.value,this.handler,e.receiver,e.resolver)},q.prototype.run=function(){function t(t){r.resolve(t)}function e(t){r.reject(t)}function n(t){r.notify(t)}var r=this.resolver;k(this._then,this.thenable,t,e,n)},R.prototype.fulfilled=function(t){this.f.call(this.c,this.z,t,this.to)},R.prototype.rejected=function(t){this.to.reject(t)},R.prototype.progress=function(t){this.to.notify(t)},e}}.call(e,n,e,t),!(void 0!==r&&(t.exports=r))}(n(36))},function(t,e,n){var r;/** @license MIT License (c) copyright 2010-2014 original author or authors */
!function(){"use strict";r=function(){function t(t){this._async=t,this._running=!1,this._queue=this,this._queueLen=0,this._afterQueue={},this._afterQueueLen=0;var e=this;this.drain=function(){e._drain()}}return t.prototype.enqueue=function(t){this._queue[this._queueLen++]=t,this.run()},t.prototype.afterQueue=function(t){this._afterQueue[this._afterQueueLen++]=t,this.run()},t.prototype.run=function(){this._running||(this._running=!0,this._async(this.drain))},t.prototype._drain=function(){for(var t=0;t<this._queueLen;++t)this._queue[t].run(),this._queue[t]=void 0;for(this._queueLen=0,this._running=!1,t=0;t<this._afterQueueLen;++t)this._afterQueue[t].run(),this._afterQueue[t]=void 0;this._afterQueueLen=0},t}.call(e,n,e,t),!(void 0!==r&&(t.exports=r))}(n(36))},function(t,e,n){var r;/** @license MIT License (c) copyright 2010-2014 original author or authors */
!function(){"use strict";r=function(t){function e(){return"undefined"!=typeof process&&null!==process&&"function"==typeof process.nextTick}function r(){return"function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver}function o(t){function e(){var t=n;n=void 0,t()}var n,r=document.createTextNode(""),o=new t(e);o.observe(r,{characterData:!0});var i=0;return function(t){n=t,r.data=i^=1}}var i,s="undefined"!=typeof setTimeout&&setTimeout,u=function(t,e){return setTimeout(t,e)},c=function(t){return clearTimeout(t)},a=function(t){return s(t,0)};if(e())a=function(t){return process.nextTick(t)};else if(i=r())a=o(i);else if(!s){var f=n(37);u=function(t,e){return f.setTimer(e,t)},c=f.cancelTimer,a=f.runOnLoop||f.runOnContext}return{setTimer:u,clearTimer:c,asap:a}}.call(e,n,e,t),!(void 0!==r&&(t.exports=r))}(n(36))},function(t){t.exports=function(){throw new Error("define cannot be used indirect")}},function(){},function(t,e,n){var r=n(26),o={delimiter:"&",indices:!0};o.stringify=function(t,e,n){if(r.isBuffer(t)?t=t.toString():t instanceof Date?t=t.toISOString():null===t&&(t=""),"string"==typeof t||"number"==typeof t||"boolean"==typeof t)return[encodeURIComponent(e)+"="+encodeURIComponent(t)];var i=[];if("undefined"==typeof t)return i;for(var s=Object.keys(t),u=0,c=s.length;c>u;++u){var a=s[u];i=i.concat(!n.indices&&Array.isArray(t)?o.stringify(t[a],e,n):o.stringify(t[a],e+"["+a+"]",n))}return i},t.exports=function(t,e){e=e||{};var n="undefined"==typeof e.delimiter?o.delimiter:e.delimiter;e.indices="boolean"==typeof e.indices?e.indices:o.indices;var r=[];if("object"!=typeof t||null===t)return"";for(var i=Object.keys(t),s=0,u=i.length;u>s;++s){var c=i[s];r=r.concat(o.stringify(t[c],c,e))}return r.join(n)}},function(t,e,n){var r=n(26),o={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3};o.parseValues=function(t,e){for(var n={},o=t.split(e.delimiter,1/0===e.parameterLimit?void 0:e.parameterLimit),i=0,s=o.length;s>i;++i){var u=o[i],c=-1===u.indexOf("]=")?u.indexOf("="):u.indexOf("]=")+1;if(-1===c)n[r.decode(u)]="";else{var a=r.decode(u.slice(0,c)),f=r.decode(u.slice(c+1));n[a]=n.hasOwnProperty(a)?[].concat(n[a]).concat(f):f}}return n},o.parseObject=function(t,e,n){if(!t.length)return e;var r=t.shift(),i={};if("[]"===r)i=[],i=i.concat(o.parseObject(t,e,n));else{var s="["===r[0]&&"]"===r[r.length-1]?r.slice(1,r.length-1):r,u=parseInt(s,10),c=""+u;!isNaN(u)&&r!==s&&c===s&&u>=0&&u<=n.arrayLimit?(i=[],i[u]=o.parseObject(t,e,n)):i[s]=o.parseObject(t,e,n)}return i},o.parseKeys=function(t,e,n){if(t){var r=/^([^\[\]]*)/,i=/(\[[^\[\]]*\])/g,s=r.exec(t);if(!Object.prototype.hasOwnProperty(s[1])){var u=[];s[1]&&u.push(s[1]);for(var c=0;null!==(s=i.exec(t))&&c<n.depth;)++c,Object.prototype.hasOwnProperty(s[1].replace(/\[|\]/g,""))||u.push(s[1]);return s&&u.push("["+t.slice(s.index)+"]"),o.parseObject(u,e,n)}}},t.exports=function(t,e){if(""===t||null===t||"undefined"==typeof t)return{};e=e||{},e.delimiter="string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:o.delimiter,e.depth="number"==typeof e.depth?e.depth:o.depth,e.arrayLimit="number"==typeof e.arrayLimit?e.arrayLimit:o.arrayLimit,e.parameterLimit="number"==typeof e.parameterLimit?e.parameterLimit:o.parameterLimit;for(var n="string"==typeof t?o.parseValues(t,e):t,i={},s=Object.keys(n),u=0,c=s.length;c>u;++u){var a=s[u],f=o.parseKeys(a,n[a],e);i=r.merge(i,f)}return r.compact(i)}}])});