UNPKG

browser-meshblu-http

Version:
3 lines 33.5 kB
module.exports=function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(15)},function(t,e,r){var n=r(34),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e,r){function n(t,e){var r=i(t,e);return o(r)?r:void 0}var o=r(27),i=r(36);t.exports=n},function(t,e,r){function n(t){return null!=t&&i(t.length)&&!o(t)}var o=r(11),i=r(48);t.exports=n},function(t,e){function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=r},function(t,e){function r(t,e){return e=null==e?n:e,!!e&&("number"==typeof t||o.test(t))&&t>-1&&t%1==0&&t<e}var n=9007199254740991,o=/^(?:0|[1-9]\d*)$/;t.exports=r},function(t,e){function r(t){var e=t&&t.constructor,r="function"==typeof e&&e.prototype||n;return t===r}var n=Object.prototype;t.exports=r},function(t,e){function r(t){if(null!=t){try{return o.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var n=Function.prototype,o=n.toString;t.exports=r},function(t,e){function r(t,e){return t===e||t!==t&&e!==e}t.exports=r},function(t,e,r){function n(t){return o(t)&&u.call(t,"callee")&&(!c.call(t,"callee")||a.call(t)==i)}var o=r(45),i="[object Arguments]",s=Object.prototype,u=s.hasOwnProperty,a=s.toString,c=s.propertyIsEnumerable;t.exports=n},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){function n(t){var e=o(t)?a.call(t):"";return e==i||e==s}var o=r(4),i="[object Function]",s="[object GeneratorFunction]",u=Object.prototype,a=u.toString;t.exports=n},function(t,e){"use strict";var r=function(){for(var t=new Array(256),e=0;e<256;++e)t[e]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t}();e.arrayToObject=function(t,e){for(var r=e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)"undefined"!=typeof t[n]&&(r[n]=t[n]);return r},e.merge=function(t,r,n){if(!r)return t;if("object"!=typeof r){if(Array.isArray(t))t.push(r);else{if("object"!=typeof t)return[t,r];t[r]=!0}return t}if("object"!=typeof t)return[t].concat(r);var o=t;return Array.isArray(t)&&!Array.isArray(r)&&(o=e.arrayToObject(t,n)),Object.keys(r).reduce(function(t,o){var i=r[o];return Object.prototype.hasOwnProperty.call(t,o)?t[o]=e.merge(t[o],i,n):t[o]=i,t},o)},e.decode=function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},e.encode=function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),n="",o=0;o<e.length;++o){var i=e.charCodeAt(o);45===i||46===i||95===i||126===i||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?n+=e.charAt(o):i<128?n+=r[i]:i<2048?n+=r[192|i>>6]+r[128|63&i]:i<55296||i>=57344?n+=r[224|i>>12]+r[128|i>>6&63]+r[128|63&i]:(o+=1,i=65536+((1023&i)<<10|1023&e.charCodeAt(o)),n+=r[240|i>>18]+r[128|i>>12&63]+r[128|i>>6&63]+r[128|63&i])}return n},e.compact=function(t,r){if("object"!=typeof t||null===t)return t;var n=r||[],o=n.indexOf(t);if(o!==-1)return n[o];if(n.push(t),Array.isArray(t)){for(var i=[],s=0;s<t.length;++s)t[s]&&"object"==typeof t[s]?i.push(e.compact(t[s],n)):"undefined"!=typeof t[s]&&i.push(t[s]);return i}for(var u=Object.keys(t),a=0;a<u.length;++a){var c=u[a];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&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}},function(t,e){function r(t){return null!=t&&"object"==typeof t}t.exports=r},function(t,e,r){"use strict";function n(t){var e=c.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]?e[3]:""}}function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);var c,p,h,f,d,y=a.test(t),v=typeof e,b=this,m=0;for("object"!==v&&"string"!==v&&(r=e,e=null),r&&"function"!=typeof r&&(r=u.parse),e=s(e),d=n(t),b.protocol=d.protocol||e.protocol||"",b.slashes=d.slashes||e.slashes,t=d.rest;m<l.length;m++)p=l[m],c=p[0],f=p[1],c!==c?b[f]=t:"string"==typeof c?~(h=t.indexOf(c))&&("number"==typeof p[2]?(b[f]=t.slice(0,h),t=t.slice(h+p[2])):(b[f]=t.slice(h),t=t.slice(0,h))):(h=c.exec(t))&&(b[f]=h[1],t=t.slice(0,t.length-h[0].length)),b[f]=b[f]||(p[3]||"port"===f&&y?e[f]||"":""),p[4]&&(b[f]=b[f].toLowerCase());r&&(b.query=r(b.query)),i(b.port,b.protocol)||(b.host=b.hostname,b.port=""),b.username=b.password="",b.auth&&(p=b.auth.split(":"),b.username=p[0]||"",b.password=p[1]||""),b.origin=b.protocol&&b.host&&"file:"!==b.protocol?b.protocol+"//"+b.host:"null",b.href=b.toString()}var i=r(57),s=r(61),u=r(55),a=/^\/(?!\/)/,c=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port"],[NaN,"hostname",void 0,1,1]];o.prototype.set=function(t,e,r){var n=this;"query"===t?("string"==typeof e&&e.length&&(e=(r||u.parse)(e)),n[t]=e):"port"===t?(n[t]=e,i(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="")):"hostname"===t?(n[t]=e,n.port&&(e+=":"+n.port),n.host=e):"host"===t?(n[t]=e,/:\d+$/.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="")):"protocol"===t?(n.protocol=e.toLowerCase(),n.slashes=!r):n[t]=e;for(var o=0;o<l.length;o++){var s=l[o];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.origin=n.protocol&&n.host&&"file:"!==n.protocol?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},o.prototype.toString=function(t){t&&"function"==typeof t||(t=u.stringify);var e,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var o=n+(r.slashes?"//":"");return r.username&&(o+=r.username,r.password&&(o+=":"+r.password),o+="@"),o+=r.host+r.pathname,e="object"==typeof r.query?t(r.query):r.query,e&&(o+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(o+=r.hash),o},o.extractProtocol=n,o.location=s,o.qs=u,t.exports=o},function(t,e,r){t.exports=r(16)},function(t,e,r){var n,o,i,s,u,a,c,l=function(t,e){return function(){return t.apply(e,arguments)}};c=r(58),o=r(14),a=r(52),s=r(44),u=r(47),i={extend:s,isEmpty:u},n=function(){function t(t){this._request=l(this._request,this),this._url=l(this._url,this),this.whoami=l(this.whoami,this),this.updateDangerously=l(this.updateDangerously,this),this.update=l(this.update,this),this.unregister=l(this.unregister,this),this.revokeToken=l(this.revokeToken,this),this.removeTokenByQuery=l(this.removeTokenByQuery,this),this.register=l(this.register,this),this.message=l(this.message,this),this.listSubscriptions=l(this.listSubscriptions,this),this.generateAndStoreToken=l(this.generateAndStoreToken,this),this.searchTokens=l(this.searchTokens,this),this.search=l(this.search,this),this.devices=l(this.devices,this),this.device=l(this.device,this),this.deleteSubscription=l(this.deleteSubscription,this),this.createSubscription=l(this.createSubscription,this),this.claimdevice=l(this.claimdevice,this);var e;if(null!=t?t.server:void 0)throw new Error("MeshbluHttp only allows hostname: 'server' is not allowed");if(null!=t?t.host:void 0)throw new Error("MeshbluHttp only allows hostname: 'host' is not allowed");e=i.extend({port:443,hostname:"meshblu.octoblu.com"},t),this.uuid=e.uuid,this.token=e.token,this.hostname=e.hostname,this.port=e.port,this.protocol=e.protocol,"websocket"===this.protocol&&(this.protocol=null);try{this.port=parseInt(this.port)}catch(r){}443===this.port&&null==this.protocol&&(this.protocol="https:"),null==this.protocol&&(this.protocol="http:")}return t.prototype.claimdevice=function(t,e){return this._request("post","/claimdevice/"+t).end(function(t){return function(t,r){return null!=t?e(t):r.ok?e(null,r.body):e(new Error("Invalid Response Code"))}}(this))},t.prototype.createSubscription=function(t,e){var r,n,o;return n=t.subscriberUuid,r=t.emitterUuid,o=t.type,this._request("post","/v2/devices/"+n+"/subscriptions/"+r+"/"+o).end(function(t){return function(t,r){return e(null!=t?t:r.ok?null:new Error("Invalid Response Code"))}}(this))},t.prototype.deleteSubscription=function(t,e){var r,n,o;return n=t.subscriberUuid,r=t.emitterUuid,o=t.type,this._request("delete","/v2/devices/"+n+"/subscriptions/"+r+"/"+o).end(function(t){return function(t,r){return e(null!=t?t:r.ok?null:new Error("Invalid Response Code"))}}(this))},t.prototype.device=function(t,e){return this._request("get","/v2/devices/"+t).end(function(t){return function(t,r){return null!=t?e(t):r.notFound?e(null):r.ok?i.isEmpty(r.body)?e(new Error("Invalid Response")):e(null,r.body):e(new Error("Invalid Response Code"))}}(this))},t.prototype.devices=function(t,e){return this._request("get","/v2/devices").query(a.stringify(t)).end(function(t){return function(t,r){var n;return null!=t?e(t):r.notFound?e(null):r.ok?e(null,null!=(n=r.body)?n:[]):e(new Error("Invalid Response Code"))}}(this))},t.prototype.search=function(t,e){var r,n;return n=t.query,r=t.projection,null==r&&(r={}),this._request("post","/search/devices").set("X-MESHBLU-PROJECTION",JSON.stringify(r)).send(n).end(function(t){return function(t,r){var n;return null!=t?e(t):r.notFound?e(null):r.ok?e(null,null!=(n=r.body)?n:[]):e(new Error("Invalid Response Code"))}}(this))},t.prototype.searchTokens=function(t,e){var r,n;return n=t.query,r=t.projection,null==r&&(r={}),this._request("post","/search/tokens").set("X-MESHBLU-PROJECTION",JSON.stringify(r)).send(n).end(function(t){return function(t,r){var n;return null!=t?e(t):r.notFound?e(null):r.ok?e(null,null!=(n=r.body)?n:[]):e(new Error("Invalid Response Code"))}}(this))},t.prototype.generateAndStoreToken=function(t,e,r){return null==e&&(e={}),this._request("post","/devices/"+t+"/tokens").send(e).end(function(t){return function(t,e){return null!=t?r(t):e.ok?i.isEmpty(e.body)?r(new Error("Invalid Response")):r(null,e.body):r(new Error("Invalid Response Code"))}}(this))},t.prototype.listSubscriptions=function(t,e){var r;return r=t.subscriberUuid,this._request("get","/v2/devices/"+r+"/subscriptions").end(function(t){return function(t,r){return null!=t?e(t):r.ok?e(null,r.body):e(new Error("Invalid Response Code"))}}(this))},t.prototype.message=function(t,e){return this._request("post","/messages").send(t).end(function(t){return function(t,r){return e(null!=t?t:r.ok?null:new Error("Invalid Message"))}}(this))},t.prototype.register=function(t,e){return this._request("post","/devices").send(t).end(function(t){return function(t,r){return null!=t?e(t):r.notFound?e(null):r.ok?i.isEmpty(r.body)?e(new Error("Invalid Response")):e(null,r.body):e(new Error("Invalid Response Code"))}}(this))},t.prototype.removeTokenByQuery=function(t,e,r){return null==e&&(e={}),this._request("del","/devices/"+t+"/tokens").query(e).end(function(t){return function(t,e){return r(null!=t?t:e.ok?null:new Error("Invalid Response Code"))}}(this))},t.prototype.revokeToken=function(t,e,r){return null==r&&(r=function(){}),this._request("del","/devices/"+t+"/tokens/"+e).end(function(t){return function(t,e){return r(null!=t?t:e.ok?null:new Error("Invalid Response Code"))}}(this))},t.prototype.unregister=function(t,e){return this._request("del","/devices/"+t).end(function(t){return function(t,r){return null!=t?e(t):r.ok?e(null,r.body):e(new Error("Invalid Response Code"))}}(this))},t.prototype.update=function(t,e,r){return this._request("patch","/v2/devices/"+t).send(e).end(function(t){return function(t,e){return null!=t?r(t):e.ok?r(null,e.body):r(new Error("Invalid Response Code"))}}(this))},t.prototype.updateDangerously=function(t,e,r){return this._request("put","/v2/devices/"+t).send(e).end(function(t){return function(t,e){return null!=t?r(t):e.ok?r(null,e.body):r(new Error("Invalid Response Code"))}}(this))},t.prototype.whoami=function(t){return this._request("get","/v2/whoami").end(function(e){return function(e,r){return null!=e?t(e):r.ok?i.isEmpty(r.body)?t(new Error("Invalid Device")):t(null,r.body):t(new Error("Invalid Response Code"))}}(this))},t.prototype._url=function(t){var e;return e=new o(""),e.set("hostname",this.hostname),e.set("protocol",this.protocol),e.set("port",this.port),e.set("pathname",t),e.toString()},t.prototype._request=function(t,e){var r;return r=c[t](this._url(e)),null!=this.uuid&&null!=this.token&&r.auth(this.uuid,this.token),r.accept("application/json"),r.set("Content-Type","application/json"),r},t}(),t.exports=n},function(t,e,r){function n(t){if(t)return o(t)}function o(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){var n=r(2),o=r(1),i=n(o,"DataView");t.exports=i},function(t,e,r){var n=r(2),o=r(1),i=n(o,"Map");t.exports=i},function(t,e,r){var n=r(2),o=r(1),i=n(o,"Promise");t.exports=i},function(t,e,r){var n=r(2),o=r(1),i=n(o,"Set");t.exports=i},function(t,e,r){var n=r(2),o=r(1),i=n(o,"WeakMap");t.exports=i},function(t,e){function r(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}t.exports=r},function(t,e,r){function n(t,e){var r=s(t)||i(t)?o(t.length,String):[],n=r.length,a=!!n;for(var l in t)!e&&!c.call(t,l)||a&&("length"==l||u(l,n))||r.push(l);return r}var o=r(30),i=r(9),s=r(10),u=r(5),a=Object.prototype,c=a.hasOwnProperty;t.exports=n},function(t,e,r){function n(t,e,r){var n=t[e];s.call(t,e)&&o(n,r)&&(void 0!==r||e in t)||(t[e]=r)}var o=r(8),i=Object.prototype,s=i.hasOwnProperty;t.exports=n},function(t,e){function r(t){return o.call(t)}var n=Object.prototype,o=n.toString;t.exports=r},function(t,e,r){function n(t){if(!u(t)||s(t))return!1;var e=o(t)||i(t)?y:l;return e.test(a(t))}var o=r(11),i=r(37),s=r(39),u=r(4),a=r(7),c=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,p=Function.prototype,h=Object.prototype,f=p.toString,d=h.hasOwnProperty,y=RegExp("^"+f.call(d).replace(c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},function(t,e,r){function n(t){if(!o(t))return s(t);var e=i(t),r=[];for(var n in t)("constructor"!=n||!e&&a.call(t,n))&&r.push(n);return r}var o=r(4),i=r(6),s=r(41),u=Object.prototype,a=u.hasOwnProperty;t.exports=n},function(t,e,r){function n(t,e){return e=i(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,s=i(r.length-e,0),u=Array(s);++n<s;)u[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=u,o(t,this,a)}}var o=r(23),i=Math.max;t.exports=n},function(t,e){function r(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}t.exports=r},function(t,e,r){function n(t,e,r,n){r||(r={});for(var i=-1,s=e.length;++i<s;){var u=e[i],a=n?n(r[u],t[u],u,r,t):void 0;o(r,u,void 0===a?t[u]:a)}return r}var o=r(25);t.exports=n},function(t,e,r){var n=r(1),o=n["__core-js_shared__"];t.exports=o},function(t,e,r){function n(t){return o(function(e,r){var n=-1,o=r.length,s=o>1?r[o-1]:void 0,u=o>2?r[2]:void 0;for(s=t.length>3&&"function"==typeof s?(o--,s):void 0,u&&i(r[0],r[1],u)&&(s=o<3?void 0:s,o=1),e=Object(e);++n<o;){var a=r[n];a&&t(e,a,n,s)}return e})}var o=r(29),i=r(38);t.exports=n},function(t,e){(function(e){var r="object"==typeof e&&e&&e.Object===Object&&e;t.exports=r}).call(e,function(){return this}())},function(t,e,r){var n=r(18),o=r(19),i=r(20),s=r(21),u=r(22),a=r(26),c=r(7),l="[object Map]",p="[object Object]",h="[object Promise]",f="[object Set]",d="[object WeakMap]",y="[object DataView]",v=Object.prototype,b=v.toString,m=c(n),g=c(o),w=c(i),x=c(s),j=c(u),_=a;(n&&_(new n(new ArrayBuffer(1)))!=y||o&&_(new o)!=l||i&&_(i.resolve())!=h||s&&_(new s)!=f||u&&_(new u)!=d)&&(_=function(t){var e=b.call(t),r=e==p?t.constructor:void 0,n=r?c(r):void 0;if(n)switch(n){case m:return y;case g:return l;case w:return h;case x:return f;case j:return d}return e}),t.exports=_},function(t,e){function r(t,e){return null==t?void 0:t[e]}t.exports=r},function(t,e){function r(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}t.exports=r},function(t,e,r){function n(t,e,r){if(!u(r))return!1;var n=typeof e;return!!("number"==n?i(r)&&s(e,r.length):"string"==n&&e in r)&&o(r[e],t)}var o=r(8),i=r(3),s=r(5),u=r(4);t.exports=n},function(t,e,r){function n(t){return!!i&&i in t}var o=r(32),i=function(){var t=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=n},function(t,e,r){var n=r(42),o=n(Object.keys,Object);t.exports=o},function(t,e){function r(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}t.exports=r},function(t,e){function r(t,e){return function(r){return t(e(r))}}t.exports=r},function(t,e,r){var n=r(31),o=r(33),i=r(50),s=o(function(t,e){n(e,i(e),t)});t.exports=s},function(t,e,r){t.exports=r(43)},function(t,e,r){function n(t){return i(t)&&o(t)}var o=r(3),i=r(49);t.exports=n},function(t,e,r){(function(t){var n=r(1),o=r(51),i="object"==typeof e&&e&&!e.nodeType&&e,s=i&&"object"==typeof t&&t&&!t.nodeType&&t,u=s&&s.exports===i,a=u?n.Buffer:void 0,c=a?a.isBuffer:void 0,l=c||o;t.exports=l}).call(e,r(62)(t))},function(t,e,r){function n(t){if(u(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||a(t)||i(t)))return!t.length;var e=o(t);if(e==p||e==h)return!t.size;if(v||c(t))return!l(t).length;for(var r in t)if(d.call(t,r))return!1;return!0}var o=r(35),i=r(9),s=r(10),u=r(3),a=r(46),c=r(6),l=r(40),p="[object Map]",h="[object Set]",f=Object.prototype,d=f.hasOwnProperty,y=f.propertyIsEnumerable,v=!y.call({valueOf:1},"valueOf");t.exports=n},function(t,e){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}var n=9007199254740991;t.exports=r},function(t,e){function r(t){return!!t&&"object"==typeof t}t.exports=r},function(t,e,r){function n(t){return s(t)?o(t,!0):i(t)}var o=r(24),i=r(28),s=r(3);t.exports=n},function(t,e){function r(){return!1}t.exports=r},function(t,e,r){"use strict";var n=r(54),o=r(53);t.exports={stringify:n,parse:o}},function(t,e,r){"use strict";var n=r(12),o=Object.prototype.hasOwnProperty,i={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:n.decode},s=function(t,e){for(var r={},n=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.parameterLimit),i=0;i<n.length;++i){var s,u,a=n[i],c=a.indexOf("]=")===-1?a.indexOf("="):a.indexOf("]=")+1;c===-1?(s=e.decoder(a),u=e.strictNullHandling?null:""):(s=e.decoder(a.slice(0,c)),u=e.decoder(a.slice(c+1))),o.call(r,s)?r[s]=[].concat(r[s]).concat(u):r[s]=u}return r},u=function c(t,e,r){if(!t.length)return e;var n,o=t.shift();if("[]"===o)n=[],n=n.concat(c(t,e,r));else{n=r.plainObjects?Object.create(null):{};var i="["===o[0]&&"]"===o[o.length-1]?o.slice(1,o.length-1):o,s=parseInt(i,10);!isNaN(s)&&o!==i&&String(s)===i&&s>=0&&r.parseArrays&&s<=r.arrayLimit?(n=[],n[s]=c(t,e,r)):n[i]=c(t,e,r)}return n},a=function(t,e,r){if(t){var n=r.allowDots?t.replace(/\.([^\.\[]+)/g,"[$1]"):t,i=/^([^\[\]]*)/,s=/(\[[^\[\]]*\])/g,a=i.exec(n),c=[];if(a[1]){if(!r.plainObjects&&o.call(Object.prototype,a[1])&&!r.allowPrototypes)return;c.push(a[1])}for(var l=0;null!==(a=s.exec(n))&&l<r.depth;)l+=1,(r.plainObjects||!o.call(Object.prototype,a[1].replace(/\[|\]/g,""))||r.allowPrototypes)&&c.push(a[1]);return a&&c.push("["+n.slice(a.index)+"]"),u(c,e,r)}};t.exports=function(t,e){var r=e||{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:i.delimiter,r.depth="number"==typeof r.depth?r.depth:i.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:i.arrayLimit,r.parseArrays=r.parseArrays!==!1,r.decoder="function"==typeof r.decoder?r.decoder:i.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:i.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:i.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:i.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:i.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:i.strictNullHandling,""===t||null===t||"undefined"==typeof t)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof t?s(t,r):t,u=r.plainObjects?Object.create(null):{},c=Object.keys(o),l=0;l<c.length;++l){var p=c[l],h=a(p,o[p],r);u=n.merge(u,h,r)}return n.compact(u)}},function(t,e,r){"use strict";var n=r(12),o={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},i={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:n.encode},s=function u(t,e,r,o,i,s,a,c,l){var p=t;if("function"==typeof a)p=a(e,p);else if(p instanceof Date)p=p.toISOString();else if(null===p){if(o)return s?s(e):e;p=""}if("string"==typeof p||"number"==typeof p||"boolean"==typeof p||n.isBuffer(p))return s?[s(e)+"="+s(p)]:[e+"="+String(p)];var h=[];if("undefined"==typeof p)return h;var f;if(Array.isArray(a))f=a;else{var d=Object.keys(p);f=c?d.sort(c):d}for(var y=0;y<f.length;++y){var v=f[y];i&&null===p[v]||(h=Array.isArray(p)?h.concat(u(p[v],r(e,v),r,o,i,s,a,c,l)):h.concat(u(p[v],e+(l?"."+v:"["+v+"]"),r,o,i,s,a,c,l)))}return h};t.exports=function(t,e){var r,n,u=t,a=e||{},c="undefined"==typeof a.delimiter?i.delimiter:a.delimiter,l="boolean"==typeof a.strictNullHandling?a.strictNullHandling:i.strictNullHandling,p="boolean"==typeof a.skipNulls?a.skipNulls:i.skipNulls,h="boolean"==typeof a.encode?a.encode:i.encode,f=h?"function"==typeof a.encoder?a.encoder:i.encoder:null,d="function"==typeof a.sort?a.sort:null,y="undefined"!=typeof a.allowDots&&a.allowDots;if(null!==a.encoder&&void 0!==a.encoder&&"function"!=typeof a.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof a.filter?(n=a.filter,u=n("",u)):Array.isArray(a.filter)&&(r=n=a.filter);var v=[];if("object"!=typeof u||null===u)return"";var b;b=a.arrayFormat in o?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var m=o[b];r||(r=Object.keys(u)),d&&r.sort(d);for(var g=0;g<r.length;++g){var w=r[g];p&&null===u[w]||(v=v.concat(s(u[w],w,m,l,p,f,n,d,y)))}return v.join(c)}},function(t,e){"use strict";function r(t){for(var e,r=/([^=?&]+)=?([^&]*)/g,n={};e=r.exec(t);n[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return n}function n(t,e){e=e||"";var r=[];"string"!=typeof e&&(e="?");for(var n in t)o.call(t,n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return r.length?e+r.join("&"):""}var o=Object.prototype.hasOwnProperty;e.stringify=n,e.parse=r},function(t,e){t.exports=function(t,e,r){for(var n=0,o=t.length,i=3==arguments.length?r:t[n++];n<o;)i=e.call(null,i,t[n],++n,t);return i}},function(t,e){"use strict";t.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},function(t,e,r){function n(){}function o(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function i(t){if(!g(t))return t;var e=[];for(var r in t)null!=t[r]&&s(e,r,t[r]);return e.join("&")}function s(t,e,r){return Array.isArray(r)?r.forEach(function(r){s(t,e,r)}):void t.push(encodeURIComponent(e)+"="+encodeURIComponent(r))}function u(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;i<s;++i)r=o[i],e=r.split("="),n[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return n}function a(t){var e,r,n,o,i=t.split(/\r?\n/),s={};i.pop();for(var u=0,a=i.length;u<a;++u)r=i[u],e=r.indexOf(":"),n=r.slice(0,e).toLowerCase(),o=x(r.slice(e+1)),s[n]=o;return s}function c(t){return/[\/+]json\b/.test(t)}function l(t){return t.split(/ *; */).shift()}function p(t){return b(t.split(/ *; */),function(t,e){var r=e.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(t[n]=o),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text?this.text:this.xhr.response):null}function f(t,e){var r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new h(r)}catch(n){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=n,t.rawResponse=r.xhr&&r.xhr.responseText?r.xhr.responseText:null,t.statusCode=r.xhr&&r.xhr.status?r.xhr.status:null,r.callback(t)}if(r.emit("response",e),t)return r.callback(t,e);if(e.status>=200&&e.status<300)return r.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,r.callback(o,e)})}function d(t,e){var r=w("DELETE",t);return e&&r.end(e),r}var y,v=r(17),b=r(56),m=r(59),g=r(13);y="undefined"!=typeof window?window:"undefined"!=typeof self?self:this;var w=t.exports=r(60).bind(null,f);w.getXHR=function(){if(!(!y.XMLHttpRequest||y.location&&"file:"==y.location.protocol&&y.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1};var x="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};w.serializeObject=i,w.parseString=u,w.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},w.serialize={"application/x-www-form-urlencoded":i,"application/json":JSON.stringify},w.parse={"application/x-www-form-urlencoded":u,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype.setHeaderProperties=function(t){var e=this.header["content-type"]||"";this.type=l(e);var r=p(e);for(var n in r)this[n]=r[n]},h.prototype.parseBody=function(t){var e=w.parse[this.type];return!e&&c(this.type)&&(e=w.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null},h.prototype.setStatusProperties=function(t){1223===t&&(t=204);var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,n="cannot "+e+" "+r+" ("+this.status+")",o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},w.Response=h,v(f.prototype);for(var j in m)f.prototype[j]=m[j];f.prototype.abort=function(){if(!this.aborted)return this.aborted=!0,this.xhr&&this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this},f.prototype.type=function(t){return this.set("Content-Type",w.types[t]||t),this},f.prototype.responseType=function(t){return this._responseType=t,this},f.prototype.accept=function(t){return this.set("Accept",w.types[t]||t),this},f.prototype.auth=function(t,e,r){switch(r||(r={type:"basic"}),r.type){case"basic":var n=btoa(t+":"+e);this.set("Authorization","Basic "+n);break;case"auto":this.username=t,this.password=e}return this},f.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},f.prototype.attach=function(t,e,r){return this._getFormData().append(t,e,r||e.name),this},f.prototype._getFormData=function(){return this._formData||(this._formData=new y.FormData),this._formData},f.prototype.send=function(t){var e=g(t),r=this._header["content-type"];if(e&&g(this._data))for(var n in t)this._data[n]=t[n];else"string"==typeof t?(r||this.type("form"),r=this._header["content-type"],"application/x-www-form-urlencoded"==r?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||o(t)?this:(r||this.type("json"),this)},h.prototype.parse=function(t){return y.console&&console.warn("Client-side parse() method has been renamed to serialize(). This method is not compatible with superagent v2.0"),this.serialize(t),this},h.prototype.serialize=function(t){return this._parser=t,this},f.prototype.callback=function(t,e){var r=this._callback;this.clearTimeout(),r(t,e)},f.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},f.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype.withCredentials=function(){return this._withCredentials=!0,this},f.prototype.end=function(t){var e=this,r=this.xhr=w.getXHR(),i=this._query.join("&"),s=this._timeout,u=this._formData||this._data;this._callback=t||n,r.onreadystatechange=function(){if(4==r.readyState){var t;try{t=r.status}catch(n){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};var a=function(t){t.total>0&&(t.percent=t.loaded/t.total*100),t.direction="download",e.emit("progress",t)};this.hasListeners("progress")&&(r.onprogress=a);try{r.upload&&this.hasListeners("progress")&&(r.upload.onprogress=a)}catch(l){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=w.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),this.username&&this.password?r.open(this.method,this.url,!0,this.username,this.password):r.open(this.method,this.url,!0),this._withCredentials&&(r.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!o(u)){var p=this._header["content-type"],h=this._parser||w.serialize[p?p.split(";")[0]:""];!h&&c(p)&&(h=w.serialize["application/json"]),h&&(u=h(u))}for(var f in this.header)null!=this.header[f]&&r.setRequestHeader(f,this.header[f]);return this._responseType&&(r.responseType=this._responseType),this.emit("request",this),r.send("undefined"!=typeof u?u:null),this},w.Request=f,w.get=function(t,e,r){var n=w("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},w.head=function(t,e,r){var n=w("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.del=d,w.delete=d,w.patch=function(t,e,r){var n=w("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.post=function(t,e,r){var n=w("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},w.put=function(t,e,r){var n=w("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r), n}},function(t,e,r){var n=r(13);e.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},e.parse=function(t){return this._parser=t,this},e.timeout=function(t){return this._timeout=t,this},e.then=function(t,e){return this.end(function(r,n){r?e(r):t(n)})},e.use=function(t){return t(this),this},e.get=function(t){return this._header[t.toLowerCase()]},e.getHeader=e.get,e.set=function(t,e){if(n(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},e.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},e.field=function(t,e){return this._getFormData().append(t,e),this}},function(t,e){function r(t,e,r){return"function"==typeof r?new t("GET",e).end(r):2==arguments.length?new t("GET",e):new t(e,r)}t.exports=r},function(t,e,r){(function(e){"use strict";var n,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i={hash:1,query:1};t.exports=function(t){t=t||e.location||{},n=n||r(14);var s,u={},a=typeof t;if("blob:"===t.protocol)u=new n(unescape(t.pathname),{});else if("string"===a){u=new n(t,{});for(s in i)delete u[s]}else if("object"===a){for(s in t)s in i||(u[s]=t[s]);void 0===u.slashes&&(u.slashes=o.test(t.href))}return u}}).call(e,function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}]); //# sourceMappingURL=bundle.js.map