diff --git a/CHANGELOG.md b/CHANGELOG.md index 48ec181..820dc95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # changelog +## 6.6.1 - 14 Sep 2017 +* Update form-data to v1.0.0-relativepath.2 + ## 6.6.0 - 12 Sep 2017 * Add support for deleting current token diff --git a/dist/particle.min.js b/dist/particle.min.js index af368e7..44b276a 100644 --- a/dist/particle.min.js +++ b/dist/particle.min.js @@ -1,16 +1,16 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Particle = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};return this.api.listLibraries((0,_assign2.default)({},t,{auth:this.auth})).then(function(t){return(t.body.data||[]).map(function(t){return new _Library2.default(e,t)})})}},{key:"library",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.getLibrary((0,_assign2.default)({},r,{name:e,auth:this.auth})).then(function(e){var r=e.body.data||{};return new _Library2.default(t,r)})}},{key:"libraryVersions",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.getLibraryVersions((0,_assign2.default)({},r,{name:e,auth:this.auth})).then(function(e){return(e.body.data||[]).map(function(e){return new _Library2.default(t,e)})})}},{key:"contributeLibrary",value:function(e){var t=this;return this.api.contributeLibrary({archive:e,auth:this.auth}).then(function(e){var r=e.body.data||{};return new _Library2.default(t,r)},function(e){t._throwError(e)})}},{key:"publishLibrary",value:function(e){var t=this;return this.api.publishLibrary({name:e,auth:this.auth}).then(function(e){var r=e.body.data||{};return new _Library2.default(t,r)},function(e){t._throwError(e)})}},{key:"deleteLibrary",value:function(e){var t=this,r=e.name,a=(e.version,e.force);return this.api.deleteLibrary({name:r,force:a,auth:this.auth}).then(function(e){return!0},function(e){t._throwError(e)})}},{key:"_throwError",value:function(e){if(e.body&&e.body.errors){var t=e.body.errors.map(function(e){return e.message}).join("\n");throw new Error(t)}throw e}},{key:"downloadFile",value:function(e){return this.api.downloadFile({url:e})}},{key:"compileCode",value:function(e,t,r){return this.api.compileCode({files:e,platformId:t,targetVersion:r,auth:this.auth})}},{key:"signalDevice",value:function(e){var t=e.signal,r=e.deviceId;return this.api.signalDevice({signal:t,deviceId:r,auth:this.auth})}},{key:"listDevices",value:function(){return this.api.listDevices({auth:this.auth})}},{key:"listBuildTargets",value:function(){return this.api.listBuildTargets({onlyFeatured:!0,auth:this.auth}).then(function(e){var t=[],r=!0,a=!1,i=void 0;try{for(var n,u=(0,_getIterator3.default)(e.body.targets);!(r=(n=u.next()).done);r=!0){var l=n.value,o=!0,s=!1,h=void 0;try{for(var c,f=(0,_getIterator3.default)(l.platforms);!(o=(c=f.next()).done);o=!0){var d=c.value;t.push({version:l.version,platform:d,prerelease:l.prereleases.indexOf(d)>-1,firmware_vendor:l.firmware_vendor})}}catch(e){s=!0,h=e}finally{try{!o&&f.return&&f.return()}finally{if(s)throw h}}}}catch(e){a=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(a)throw i}}return t},function(e){})}},{key:"trackingIdentity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.full,r=void 0!==t&&t,a=e.context;return this.api.trackingIdentity({full:r,context:a,auth:this.auth}).then(function(e){return e.body})}}]),e}();exports.default=Client,module.exports=exports.default; +"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _keys=require("babel-runtime/core-js/object/keys"),_keys2=_interopRequireDefault(_keys),_slicedToArray2=require("babel-runtime/helpers/slicedToArray"),_slicedToArray3=_interopRequireDefault(_slicedToArray2),_entries=require("babel-runtime/core-js/object/entries"),_entries2=_interopRequireDefault(_entries),_getIterator2=require("babel-runtime/core-js/get-iterator"),_getIterator3=_interopRequireDefault(_getIterator2),_assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_promise=require("babel-runtime/core-js/promise"),_promise2=_interopRequireDefault(_promise),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_superagent=require("superagent"),_superagent2=_interopRequireDefault(_superagent),_superagentPrefix=require("superagent-prefix"),_superagentPrefix2=_interopRequireDefault(_superagentPrefix),_path=require("path"),_path2=_interopRequireDefault(_path),Agent=function(){function e(t){(0,_classCallCheck3.default)(this,e),this.prefix=(0,_superagentPrefix2.default)(t)}return(0,_createClass3.default)(e,[{key:"get",value:function(e,t,r,a){return this.request({uri:e,auth:t,method:"get",query:r,context:a})}},{key:"head",value:function(e,t,r,a){return this.request({uri:e,auth:t,method:"head",query:r,context:a})}},{key:"post",value:function(e,t,r,a){return this.request({uri:e,data:t,auth:r,method:"post",context:a})}},{key:"put",value:function(e,t,r,a){return this.request({uri:e,data:t,auth:r,method:"put",context:a})}},{key:"delete",value:function(e,t,r,a){return this.request({uri:e,data:t,auth:r,method:"delete",context:a})}},{key:"request",value:function(e){var t=e.uri,r=e.method,a=e.data,i=void 0===a?void 0:a,u=e.auth,o=e.query,n=void 0===o?void 0:o,s=e.form,l=void 0===s?void 0:s,d=e.files,f=void 0===d?void 0:d,_=e.context,c=void 0===_?void 0:_,p=this._sanitizeFiles(f);return this._request({uri:t,method:r,data:i,auth:u,query:n,form:l,context:c,files:p})}},{key:"_request",value:function(e){var t=e.uri,r=e.method,a=e.data,i=e.auth,u=e.query,o=e.form,n=e.files,s=e.context,l=this._buildRequest({uri:t,method:r,data:a,auth:i,query:u,form:o,context:s,files:n});return this._promiseResponse(l)}},{key:"_promiseResponse",value:function(e){var t=this;return new _promise2.default(function(r,a){return t._sendRequest(e,r,a)})}},{key:"_sendRequest",value:function(e,t,r){e.end(function(a,i){var u=i&&i.body;if(a){var o=e.url,n=a.status,s=(n?"HTTP error "+n:"Network error")+" from "+o,l=void 0;u&&u.error_description&&(s+=" - "+u.error_description,l=u.error_description);var d=new Error(s);(0,_assign2.default)(d,{statusCode:n,errorDescription:s,shortErrorDescription:l,error:a,body:u}),r(d)}else t({body:u,statusCode:i.statusCode})})}},{key:"_buildRequest",value:function(e){var t=e.uri,r=e.method,a=e.data,i=e.auth,u=e.query,o=e.form,n=e.files,s=e.context,l=e.makerequest,d=void 0===l?_superagent2.default:l,f=d(r,t);if(this.prefix&&f.use(this.prefix),this._authorizationHeader(f,i),s&&this._applyContext(f,s),u&&f.query(u),n){var _=!0,c=!1,p=void 0;try{for(var h,v=(0,_getIterator3.default)((0,_entries2.default)(n));!(_=(h=v.next()).done);_=!0){var y=(0,_slicedToArray3.default)(h.value,2),m=y[0],q=y[1];f._getFormData().append(m,q.data,{filename:q.path,relativePath:_path2.default.dirname(q.path)})}}catch(e){c=!0,p=e}finally{try{!_&&v.return&&v.return()}finally{if(c)throw p}}if(o){var x=!0,k=!1,b=void 0;try{for(var g,C=(0,_getIterator3.default)((0,_entries2.default)(o));!(x=(g=C.next()).done);x=!0){var R=(0,_slicedToArray3.default)(g.value,2),m=R[0],D=R[1];f.field(m,D)}}catch(e){k=!0,b=e}finally{try{!x&&C.return&&C.return()}finally{if(k)throw b}}}}else o?(f.type("form"),f.send(o)):a&&f.send(a);return f}},{key:"_applyContext",value:function(e,t){t.tool&&this._addToolContext(e,t.tool),t.project&&this._addProjectContext(e,t.project)}},{key:"_addToolContext",value:function(e,t){var r="";if(t.name&&(r+=this._toolIdent(t),t.components)){var a=!0,i=!1,u=void 0;try{for(var o,n=(0,_getIterator3.default)(t.components);!(a=(o=n.next()).done);a=!0){var s=o.value;r+=", "+this._toolIdent(s)}}catch(e){i=!0,u=e}finally{try{!a&&n.return&&n.return()}finally{if(i)throw u}}}r&&e.set("X-Particle-Tool",r)}},{key:"_toolIdent",value:function(e){return this._nameAtVersion(e.name,e.version)}},{key:"_nameAtVersion",value:function(e,t){var r="";return e&&(r+=e,t&&(r+="@"+t)),r}},{key:"_addProjectContext",value:function(e,t){var r=this._buildSemicolonSeparatedProperties(t,"name");r&&e.set("X-Particle-Project",r)}},{key:"_buildSemicolonSeparatedProperties",value:function(e,t){var r="";if(e[t]){r+=e[t];for(var a in e)a!==t&&e.hasOwnProperty(a)&&(r+="; "+a+"="+e[a])}return r}},{key:"_authorizationHeader",value:function(e,t){return t&&(void 0!==t.username?e.auth(t.username,t.password):e.set({Authorization:"Bearer "+t})),e}},{key:"_sanitizeFiles",value:function(e){var t=void 0;return e&&(t={},(0,_keys2.default)(e).forEach(function(r,a){var i=a?"file"+(a+1):"file";t[i]={data:e[r],path:r}})),t}}]),e}();exports.default=Agent,module.exports=exports.default; +},{"babel-runtime/core-js/get-iterator":8,"babel-runtime/core-js/object/assign":11,"babel-runtime/core-js/object/entries":14,"babel-runtime/core-js/object/keys":16,"babel-runtime/core-js/promise":18,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/slicedToArray":25,"path":143,"superagent":168,"superagent-prefix":167}],2:[function(require,module,exports){ +"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _getIterator2=require("babel-runtime/core-js/get-iterator"),_getIterator3=_interopRequireDefault(_getIterator2),_assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_Particle=require("./Particle"),_Particle2=_interopRequireDefault(_Particle),_Library=require("./Library"),_Library2=_interopRequireDefault(_Library),Client=function(){function e(t){var r=t.auth,a=t.api,i=void 0===a?new _Particle2.default:a;(0,_classCallCheck3.default)(this,e),(0,_assign2.default)(this,{auth:r,api:i})}return(0,_createClass3.default)(e,[{key:"ready",value:function(){return Boolean(this.auth)}},{key:"libraries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.api.listLibraries((0,_assign2.default)({},t,{auth:this.auth})).then(function(t){var r=t.body.data||[];return r.map(function(t){return new _Library2.default(e,t)})})}},{key:"library",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.getLibrary((0,_assign2.default)({},r,{name:e,auth:this.auth})).then(function(e){var r=e.body.data||{};return new _Library2.default(t,r)})}},{key:"libraryVersions",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.api.getLibraryVersions((0,_assign2.default)({},r,{name:e,auth:this.auth})).then(function(e){var r=e.body.data||[];return r.map(function(e){return new _Library2.default(t,e)})})}},{key:"contributeLibrary",value:function(e){var t=this;return this.api.contributeLibrary({archive:e,auth:this.auth}).then(function(e){var r=e.body.data||{};return new _Library2.default(t,r)},function(e){t._throwError(e)})}},{key:"publishLibrary",value:function(e){var t=this;return this.api.publishLibrary({name:e,auth:this.auth}).then(function(e){var r=e.body.data||{};return new _Library2.default(t,r)},function(e){t._throwError(e)})}},{key:"deleteLibrary",value:function(e){var t=this,r=e.name,a=(e.version,e.force);return this.api.deleteLibrary({name:r,force:a,auth:this.auth}).then(function(e){return!0},function(e){t._throwError(e)})}},{key:"_throwError",value:function(e){if(e.body&&e.body.errors){var t=e.body.errors.map(function(e){return e.message}).join("\n");throw new Error(t)}throw e}},{key:"downloadFile",value:function(e){return this.api.downloadFile({url:e})}},{key:"compileCode",value:function(e,t,r){return this.api.compileCode({files:e,platformId:t,targetVersion:r,auth:this.auth})}},{key:"signalDevice",value:function(e){var t=e.signal,r=e.deviceId;return this.api.signalDevice({signal:t,deviceId:r,auth:this.auth})}},{key:"listDevices",value:function(){return this.api.listDevices({auth:this.auth})}},{key:"listBuildTargets",value:function(){return this.api.listBuildTargets({onlyFeatured:!0,auth:this.auth}).then(function(e){var t=[],r=!0,a=!1,i=void 0;try{for(var n,u=(0,_getIterator3.default)(e.body.targets);!(r=(n=u.next()).done);r=!0){var l=n.value,o=!0,s=!1,h=void 0;try{for(var c,f=(0,_getIterator3.default)(l.platforms);!(o=(c=f.next()).done);o=!0){var d=c.value;t.push({version:l.version,platform:d,prerelease:l.prereleases.indexOf(d)>-1,firmware_vendor:l.firmware_vendor})}}catch(e){s=!0,h=e}finally{try{!o&&f.return&&f.return()}finally{if(s)throw h}}}}catch(e){a=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(a)throw i}}return t},function(e){})}},{key:"trackingIdentity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.full,r=void 0!==t&&t,a=e.context;return this.api.trackingIdentity({full:r,context:a,auth:this.auth}).then(function(e){return e.body})}}]),e}();exports.default=Client,module.exports=exports.default; },{"./Library":5,"./Particle":6,"babel-runtime/core-js/get-iterator":8,"babel-runtime/core-js/object/assign":11,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],3:[function(require,module,exports){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={baseUrl:"https://api.particle.io",clientSecret:"particle-api",clientId:"particle-api",tokenDuration:7776e3},module.exports=exports.default; },{}],4:[function(require,module,exports){ -"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _isNan=require("babel-runtime/core-js/number/is-nan"),_isNan2=_interopRequireDefault(_isNan),_promise=require("babel-runtime/core-js/promise"),_promise2=_interopRequireDefault(_promise),_assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_getPrototypeOf=require("babel-runtime/core-js/object/get-prototype-of"),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_http=require("http"),_http2=_interopRequireDefault(_http),_https=require("https"),_https2=_interopRequireDefault(_https),_url=require("url"),_url2=_interopRequireDefault(_url),_events=require("events"),EventStream=function(e){function t(e,r,i){(0,_classCallCheck3.default)(this,t);var s=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||(0,_getPrototypeOf2.default)(t)).call(this));return s.uri=e,s.token=r,s.reconnectInterval=2e3,(0,_assign2.default)(s,i),s}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"connect",value:function(){var e=this;return new _promise2.default(function(t,r){var i=_url2.default.parse(e.uri),s=i.hostname,n=i.protocol,a=i.port,o=i.path;e.origin=n+"//"+s+(a?":"+a:"");var u="https:"===n,l=u?_https2.default:_http2.default,h=l.request({hostname:s,protocol:n,path:o+"?history_limit=30&access_token="+e.token,method:"get",port:a||(u?443:80),avoidFetch:!0,mode:"prefer-streaming"});e.req=h,e.debug&&e.debug(e),h.on("error",function(t){r({error:t,errorDescription:"Network error from "+e.uri})}),h.on("response",function(i){var s=i.statusCode;if(200!==s){var n="";return i.on("data",function(e){return n+=e}),void i.on("end",function(){try{n=JSON.parse(n)}finally{e.emit("response",{statusCode:s,body:n});var t="HTTP error "+s+" from "+e.uri;n&&n.error_description&&(t+=" - "+n.error_description),r({statusCode:s,errorDescription:t,body:n}),e.req=void 0}})}e.data="",e.buf="",e.eventName,e.lastEventId,i.on("data",e.parse.bind(e)),i.once("end",e.end.bind(e)),t(e)}),h.end()})}},{key:"abort",value:function(){this.req&&(this.req.abort(),this.req=void 0),this.removeAllListeners()}},{key:"end",value:function(){var e=this;this.req=void 0,setTimeout(function(){e.connect().catch(function(t){e.emit("error",t),e.removeAllListeners()})},this.reconnectInterval)}},{key:"parse",value:function(e){this.buf+=e;for(var t=0,r=this.buf.length,i=!1;t0&&(this.buf=this.buf.slice(t))}},{key:"parseEventStreamLine",value:function(e,t,r){if(0===r)try{if(this.data.length>0&&this.event){var i=JSON.parse(this.data);i.name=this.eventName||"","event"!==this.eventName&&this.emit(this.eventName,i),this.emit("event",i),this.data=""}this.eventName=void 0,this.event=!1}catch(e){}else if(t>0){var s=this.buf.slice(e,e+t),n=0;n=" "!==this.buf[e+t+1]?t+1:t+2,e+=n;var a=r-n,o=this.buf.slice(e,e+a);if("data"===s)this.data+=o+"\n";else if("event"===s)this.eventName=o,this.event=!0;else if("id"===s)this.lastEventId=o;else if("retry"===s){var u=parseInt(o,10);(0,_isNan2.default)(u)||(this.reconnectInterval=u)}}}}]),t}(_events.EventEmitter);exports.default=EventStream,module.exports=exports.default; -},{"babel-runtime/core-js/number/is-nan":10,"babel-runtime/core-js/object/assign":11,"babel-runtime/core-js/object/get-prototype-of":15,"babel-runtime/core-js/promise":18,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/inherits":23,"babel-runtime/helpers/possibleConstructorReturn":24,"events":138,"http":163,"https":163,"url":174}],5:[function(require,module,exports){ +"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _isNan=require("babel-runtime/core-js/number/is-nan"),_isNan2=_interopRequireDefault(_isNan),_typeof2=require("babel-runtime/helpers/typeof"),_typeof3=_interopRequireDefault(_typeof2),_promise=require("babel-runtime/core-js/promise"),_promise2=_interopRequireDefault(_promise),_assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_getPrototypeOf=require("babel-runtime/core-js/object/get-prototype-of"),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_http=require("http"),_http2=_interopRequireDefault(_http),_https=require("https"),_https2=_interopRequireDefault(_https),_url=require("url"),_url2=_interopRequireDefault(_url),_events=require("events"),EventStream=function(e){function t(e,r,i){(0,_classCallCheck3.default)(this,t);var n=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||(0,_getPrototypeOf2.default)(t)).call(this));return n.uri=e,n.token=r,n.reconnectInterval=2e3,(0,_assign2.default)(n,i),n}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"connect",value:function(){var e=this;return new _promise2.default(function(t,r){var i=_url2.default.parse(e.uri),n=i.hostname,s=i.protocol,a=i.port,o=i.path;e.origin=s+"//"+n+(a?":"+a:"");var u="https:"===s,l=u?_https2.default:_http2.default,f=l.request({hostname:n,protocol:s,path:o+"?history_limit=30&access_token="+e.token,method:"get",port:a||(u?443:80),avoidFetch:!0,mode:"prefer-streaming"});e.req=f,e.debug&&e.debug(e),f.on("error",function(t){r({error:t,errorDescription:"Network error from "+e.uri})}),f.on("response",function(i){var n=i.statusCode;if(200!==n){var s=function(){var t="";return i.on("data",function(e){return t+=e}),i.on("end",function(){try{t=JSON.parse(t)}finally{e.emit("response",{statusCode:n,body:t});var i="HTTP error "+n+" from "+e.uri;t&&t.error_description&&(i+=" - "+t.error_description),r({statusCode:n,errorDescription:i,body:t}),e.req=void 0}}),{v:void 0}}();if("object"===("undefined"==typeof s?"undefined":(0,_typeof3.default)(s)))return s.v}e.data="",e.buf="",e.eventName,e.lastEventId,i.on("data",e.parse.bind(e)),i.once("end",e.end.bind(e)),t(e)}),f.end()})}},{key:"abort",value:function(){this.req&&(this.req.abort(),this.req=void 0),this.removeAllListeners()}},{key:"end",value:function(){var e=this;this.req=void 0,setTimeout(function(){e.connect().catch(function(t){e.emit("error",t),e.removeAllListeners()})},this.reconnectInterval)}},{key:"parse",value:function(e){this.buf+=e;for(var t=0,r=this.buf.length,i=!1;t0&&(this.buf=this.buf.slice(t))}},{key:"parseEventStreamLine",value:function(e,t,r){if(0===r)try{if(this.data.length>0&&this.event){var i=JSON.parse(this.data);i.name=this.eventName||"","event"!==this.eventName&&this.emit(this.eventName,i),this.emit("event",i),this.data=""}this.eventName=void 0,this.event=!1}catch(e){}else if(t>0){var n=this.buf.slice(e,e+t),s=0;s=" "!==this.buf[e+t+1]?t+1:t+2,e+=s;var a=r-s,o=this.buf.slice(e,e+a);if("data"===n)this.data+=o+"\n";else if("event"===n)this.eventName=o,this.event=!0;else if("id"===n)this.lastEventId=o;else if("retry"===n){var u=parseInt(o,10);(0,_isNan2.default)(u)||(this.reconnectInterval=u)}}}}]),t}(_events.EventEmitter);exports.default=EventStream,module.exports=exports.default; +},{"babel-runtime/core-js/number/is-nan":10,"babel-runtime/core-js/object/assign":11,"babel-runtime/core-js/object/get-prototype-of":15,"babel-runtime/core-js/promise":18,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/inherits":23,"babel-runtime/helpers/possibleConstructorReturn":24,"babel-runtime/helpers/typeof":26,"events":138,"http":162,"https":162,"url":173}],5:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _promise=require("babel-runtime/core-js/promise"),_promise2=_interopRequireDefault(_promise),_assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),Library=function(){function e(r,t){(0,_classCallCheck3.default)(this,e),Object.defineProperty(this,"client",{value:r}),this._assignAttributes(t),this.downloadUrl=t.links&&t.links.download}return(0,_createClass3.default)(e,[{key:"_assignAttributes",value:function(e){(0,_assign2.default)(this,e.attributes)}},{key:"download",value:function(){return this.downloadUrl?this.client.downloadFile(this.downloadUrl):_promise2.default.reject(new Error("No download URL for this library"))}}]),e}();exports.default=Library,module.exports=exports.default; },{"babel-runtime/core-js/object/assign":11,"babel-runtime/core-js/promise":18,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],6:[function(require,module,exports){ -"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_superagent=require("superagent"),_superagent2=_interopRequireDefault(_superagent),_superagentBinaryParser=require("./superagent-binary-parser"),_superagentBinaryParser2=_interopRequireDefault(_superagentBinaryParser),_Defaults=require("./Defaults"),_Defaults2=_interopRequireDefault(_Defaults),_EventStream=require("./EventStream"),_EventStream2=_interopRequireDefault(_EventStream),_Agent=require("./Agent"),_Agent2=_interopRequireDefault(_Agent),_Client=require("./Client"),_Client2=_interopRequireDefault(_Client),Particle=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,_classCallCheck3.default)(this,e),(0,_assign2.default)(this,_Defaults2.default,t),this.context={},this.agent=new _Agent2.default(this.baseUrl)}return(0,_createClass3.default)(e,[{key:"_isValidContext",value:function(e,t){return("tool"===e||"project"===e)&&void 0!==t}},{key:"setContext",value:function(e,t){if(void 0!==t){if(!this._isValidContext(e,t))throw Error("uknown context name or undefined context: "+e);this.context[e]=t}}},{key:"_buildContext",value:function(e){return(0,_assign2.default)(this.context,e)}},{key:"login",value:function(e){var t=e.username,r=e.password,i=e.tokenDuration,n=void 0===i?this.tokenDuration:i,u=e.context;return this.request({uri:"/oauth/token",form:{username:t,password:r,grant_type:"password",client_id:this.clientId,client_secret:this.clientSecret,expires_in:n},method:"post",context:u})}},{key:"createUser",value:function(e){var t=e.username,r=e.password,i=e.accountInfo,n=e.context;return this.post("/v1/users",{username:t,password:r,account_info:i},void 0,n)}},{key:"verifyUser",value:function(e){var t=e.token,r=e.context;return this.post("/v1/user/verify",{token:t},void 0,r)}},{key:"resetPassword",value:function(e){var t=e.username,r=e.context;return this.post("/v1/user/password-reset",{username:t},void 0,r)}},{key:"deleteAccessToken",value:function(e){var t=e.username,r=e.password,i=e.token,n=e.context;return this.delete("/v1/access_tokens/"+i,{access_token:i},{username:t,password:r},n)}},{key:"deleteCurrentAccessToken",value:function(e){var t=e.auth,r=e.context;return this.delete("/v1/access_tokens/current",void 0,t,r)}},{key:"listAccessTokens",value:function(e){var t=e.username,r=e.password,i=e.context;return this.get("/v1/access_tokens",{username:t,password:r},void 0,i)}},{key:"trackingIdentity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auth,r=e.full,i=void 0!==r&&r,n=e.context;return this.get("/v1/user/identify",t,i?void 0:{tracking:1},n)}},{key:"listDevices",value:function(e){var t=e.deviceId,r=e.deviceName,i=e.sortAttr,n=e.sortDir,u=e.page,a=e.perPage,o=e.product,s=e.auth,c=e.context,d=o?"/v1/products/"+o+"/devices":"/v1/devices",v=o?{deviceId:t,deviceName:r,sortAttr:i,sortDir:n,page:u,per_page:a}:void 0;return this.get(d,s,v,c)}},{key:"getDevice",value:function(e){var t=e.deviceId,r=e.product,i=e.auth,n=e.context,u=this.deviceUri({deviceId:t,product:r});return this.get(u,i,void 0,n)}},{key:"claimDevice",value:function(e){var t=e.deviceId,r=e.requestTransfer,i=e.auth,n=e.context;return this.post("/v1/devices",{id:t,request_transfer:!!r},i,n)}},{key:"addDeviceToProduct",value:function(e){var t=e.deviceId,r=e.product,i=e.auth,n=e.context,u="/v1/products/"+r+"/devices";return this.post(u,{id:t},i,n)}},{key:"removeDevice",value:function(e){var t=e.deviceId,r=e.deny,i=e.product,n=e.auth,u=e.context,a=this.deviceUri({deviceId:t,product:i}),o=i?{deny:r}:void 0;return this.delete(a,o,n,u)}},{key:"removeDeviceOwner",value:function(e){var t=e.deviceId,r=(e.deny,e.product),i=e.auth,n=e.context,u="/v1/products/"+r+"/devices/"+t+"/owner";return this.delete(u,void 0,i,n)}},{key:"renameDevice",value:function(e){var t=e.deviceId,r=e.name,i=e.product,n=e.auth,u=e.context;return this.updateDevice({deviceId:t,name:r,product:i,auth:n,context:u})}},{key:"signalDevice",value:function(e){var t=e.deviceId,r=e.signal,i=e.product,n=e.auth,u=e.context;return this.updateDevice({deviceId:t,signal:r,product:i,auth:n,context:u})}},{key:"setDeviceNotes",value:function(e){var t=e.deviceId,r=e.notes,i=e.product,n=e.auth,u=e.context;return this.updateDevice({deviceId:t,notes:r,product:i,auth:n,context:u})}},{key:"markAsDevelopmentDevice",value:function(e){var t=e.deviceId,r=e.development,i=void 0===r||r,n=e.product,u=e.auth,a=e.context;return this.updateDevice({deviceId:t,development:i,product:n,auth:u,context:a})}},{key:"lockDeviceProductFirmware",value:function(e){var t=e.deviceId,r=e.desiredFirmwareVersion,i=e.flash,n=e.product,u=e.auth,a=e.context;return this.updateDevice({deviceId:t,desiredFirmwareVersion:r,flash:i,product:n,auth:u,context:a})}},{key:"unlockDeviceProductFirmware",value:function(e){var t=e.deviceId,r=e.product,i=e.auth,n=e.context;return this.updateDevice({deviceId:t,desiredFirmwareVersion:null,product:r,auth:i,context:n})}},{key:"updateDevice",value:function(e){var t=e.deviceId,r=e.name,i=e.signal,n=e.notes,u=e.development,a=e.desiredFirmwareVersion,o=e.flash,s=e.product,c=e.auth,d=e.context;i=i?"1":"0";var v=this.deviceUri({deviceId:t,product:s}),l=s?{name:r,signal:i,notes:n,development:u,desired_firmware_version:a,flash:o}:{name:r,signal:i,notes:n};return this.put(v,l,c,d)}},{key:"provisionDevice",value:function(e){var t=e.productId,r=e.auth,i=e.context;return this.post("/v1/devices",{product_id:t},r,i)}},{key:"getClaimCode",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/device_claims":"/v1/device_claims";return this.post(u,{iccid:t},i,n)}},{key:"validatePromoCode",value:function(e){var t=e.auth,r=e.promoCode,i=e.context;return this.get("/v1/promo_code/"+r,t,void 0,i)}},{key:"changeProduct",value:function(e){var t=e.deviceId,r=e.productId,i=e.auth,n=e.context;return this.put("/v1/devices/"+t,{product_id:r},i,n)}},{key:"getVariable",value:function(e){var t=e.deviceId,r=e.name,i=e.product,n=e.auth,u=e.context,a=i?"/v1/products/"+i+"/devices/"+t+"/"+r:"/v1/devices/"+t+"/"+r;return this.get(a,n,void 0,u)}},{key:"flashDevice",value:function(e){var t=e.deviceId,r=e.files,i=e.targetVersion,n=e.auth,u=e.context,a={};return i?a.build_target_version=i:a.latest="true",this.request({uri:"/v1/devices/"+t,files:r,auth:n,form:a,context:u,method:"put"})}},{key:"flashTinker",value:function(e){var t=e.deviceId,r=e.auth,i=e.context;return console&&console.warning&&console.warning("Particle.flashTinker is deprecated"),this.put("/v1/devices/"+t,{app:"tinker"},r,i)}},{key:"compileCode",value:function(e){var t=e.files,r=e.platformId,i=e.targetVersion,n=e.auth,u=e.context,a={platform_id:r};return i?a.build_target_version=i:a.latest="true",this.request({uri:"/v1/binaries",files:t,auth:n,form:a,context:u,method:"post"})}},{key:"downloadFirmwareBinary",value:function(e){var t=e.binaryId,r=e.auth,i=(e.context,"/v1/binaries/"+t),n=(0,_superagent2.default)("get",i);return n.use(this.prefix),this.headers(n,r),this.debug&&this.debug(n),n}},{key:"sendPublicKey",value:function(e){var t=e.deviceId,r=e.key,i=e.algorithm,n=e.auth,u=e.context;return this.post("/v1/provisioning/"+t,{deviceID:t,publicKey:"string"==typeof r?r:r.toString(),filename:"particle-api",order:"manual_"+Date.now(),algorithm:i||"rsa"},n,u)}},{key:"callFunction",value:function(e){var t=e.deviceId,r=e.name,i=e.argument,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/devices/"+t+"/"+r:"/v1/devices/"+t+"/"+r;return this.post(o,{args:i},u,a)}},{key:"getEventStream",value:function(e){var t=e.deviceId,r=e.name,i=e.org,n=e.product,u=e.auth,a=(e.context,"/v1/");return i&&(a+="orgs/"+i+"/"),n&&(a+="products/"+n+"/"),t&&(a+="devices/","mine"!==t.toLowerCase()&&(a+=t+"/")),a+="events",r&&(a+="/"+encodeURIComponent(r)),new _EventStream2.default(""+this.baseUrl+a,u,{debug:this.debug}).connect()}},{key:"publishEvent",value:function(e){var t=e.name,r=e.data,i=e.isPrivate,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/events":"/v1/devices/events",s={name:t,data:r,private:i};return this.post(o,s,u,a)}},{key:"createWebhook",value:function(e){var t=e.deviceId,r=e.name,i=e.url,n=e.requestType,u=e.headers,a=e.json,o=e.query,s=e.body,c=e.responseTemplate,d=e.responseTopic,v=e.rejectUnauthorized,l=e.webhookAuth,p=e.noDefaults,h=e.form,f=e.product,m=e.auth,g=e.context;"mine"===t&&(t=void 0);var y=f?"/v1/products/"+f+"/webhooks":"/v1/webhooks",k={event:r,deviceid:t,url:i,requestType:n,headers:u,json:a,query:o,body:s,responseTemplate:c,responseTopic:d,rejectUnauthorized:v,auth:l,noDefaults:p,form:h};return this.post(y,k,m,g)}},{key:"deleteWebhook",value:function(e){var t=e.hookId,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/webhooks/"+t:"/v1/webhooks/"+t;return this.delete(u,void 0,i,n)}},{key:"listWebhooks",value:function(e){var t=e.product,r=e.auth,i=e.context,n=t?"/v1/products/"+t+"/webhooks":"/v1/webhooks";return this.get(n,r,void 0,i)}},{key:"createIntegration",value:function(e){var t=(e.integrationType,e.event),r=e.settings,i=e.deviceId,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/integrations":"/v1/integrations",s=(0,_assign2.default)({event:t,deviceid:i},r);return this.post(o,s,u,a)}},{key:"editIntegration",value:function(e){var t=e.integrationId,r=e.event,i=e.settings,n=e.deviceId,u=e.product,a=e.auth,o=e.context,s=u?"/v1/products/"+u+"/integrations/"+t:"/v1/integrations/"+t,c=(0,_assign2.default)({event:r,deviceid:n},i);return this.put(s,c,a,o)}},{key:"deleteIntegration",value:function(e){var t=e.integrationId,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/integrations/"+t:"/v1/integrations/"+t;return this.delete(u,void 0,i,n)}},{key:"listIntegrations",value:function(e){var t=e.product,r=e.auth,i=e.context,n=t?"/v1/products/"+t+"/integrations":"/v1/integrations";return this.get(n,r,void 0,i)}},{key:"getUserInfo",value:function(e){var t=e.auth,r=e.context;return this.get("/v1/user",t,void 0,r)}},{key:"setUserInfo",value:function(e){var t=e.stripeToken,r=e.accountInfo,i=e.password,n=e.auth,u=e.context,a={};return t&&(a.stripe_token=t),r&&(a.account_info=r),i&&(a.password=i),this.put("/v1/user",a,n,u)}},{key:"listSIMs",value:function(e){var t=e.iccid,r=e.deviceId,i=e.deviceName,n=e.page,u=e.perPage,a=e.product,o=e.auth,s=e.context,c=a?"/v1/products/"+a+"/sims":"/v1/sims",d=a?{iccid:t,deviceId:r,deviceName:i,page:n,per_page:u}:void 0;return this.get(c,o,d,s)}},{key:"getSIMDataUsage",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/sims/"+t+"/data_usage":"/v1/sims/"+t+"/data_usage";return this.get(u,i,void 0,n)}},{key:"getFleetDataUsage",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t+"/sims/data_usage",r,void 0,i)}},{key:"checkSIM",value:function(e){var t=e.iccid,r=e.auth,i=e.context;return this.head("/v1/sims/"+t,r,void 0,i)}},{key:"activateSIM",value:function(e){var t=e.iccid,r=e.iccids,i=e.countryCode,n=e.promoCode,u=e.product,a=e.auth,o=e.context;r=r||[t];var s=u?"/v1/products/"+u+"/sims":"/v1/sims/"+t,c=u?{sims:r,countryCode:i}:{countryCode:i,promoCode:n,action:"activate"},d=u?"post":"put";return this.request({uri:s,method:d,data:c,auth:a,context:o})}},{key:"deactivateSIM",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/sims/"+t:"/v1/sims/"+t,a={action:"deactivate"};return this.put(u,a,i,n)}},{key:"reactivateSIM",value:function(e){var t=e.iccid,r=e.mbLimit,i=e.product,n=e.auth,u=e.context,a=i?"/v1/products/"+i+"/sims/"+t:"/v1/sims/"+t,o={mb_limit:r,action:"reactivate"};return this.put(a,o,n,u)}},{key:"updateSIM",value:function(e){var t=e.iccid,r=e.mbLimit,i=e.product,n=e.auth,u=e.context,a=i?"/v1/products/"+i+"/sims/"+t:"/v1/sims/"+t,o={mb_limit:r};return this.put(a,o,n,u)}},{key:"removeSIM",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/sims/"+t:"/v1/sims/"+t;return this.delete(u,void 0,i,n)}},{key:"listBuildTargets",value:function(e){var t=e.onlyFeatured,r=e.auth,i=e.context,n=void 0;return void 0!==t&&(n={featured:!!t}),this.get("/v1/build_targets",r,n,i)}},{key:"listLibraries",value:function(e){var t=e.page,r=e.limit,i=e.filter,n=e.sort,u=e.architectures,a=e.category,o=e.scope,s=e.excludeScopes,c=e.auth,d=e.context;return this.get("/v1/libraries",c,{page:t,filter:i,limit:r,sort:n,architectures:this._asList(u),category:a,scope:o,excludeScopes:this._asList(s)},d)}},{key:"_asList",value:function(e){return Array.isArray(e)?e.join(","):e}},{key:"getLibrary",value:function(e){var t=e.name,r=e.version,i=e.auth,n=e.context;return this.get("/v1/libraries/"+t,i,{version:r},n)}},{key:"getLibraryVersions",value:function(e){var t=e.name,r=e.page,i=e.limit,n=e.auth,u=e.context;return this.get("/v1/libraries/"+t+"/versions",n,{page:r,limit:i},u)}},{key:"contributeLibrary",value:function(e){var t=e.archive,r=e.auth,i=e.context,n={"archive.tar.gz":t};return this.request({uri:"/v1/libraries",files:n,auth:r,context:i,method:"post"})}},{key:"publishLibrary",value:function(e){var t=e.name,r=e.auth,i=e.context;return this.request({uri:"/v1/libraries/"+t,auth:r,context:i,method:"patch",data:{visibility:"public"}})}},{key:"deleteLibrary",value:function(e){var t=e.name,r=e.force,i=e.auth,n=e.context;return this.delete("/v1/libraries/"+t,{force:r},i,n)}},{key:"downloadFile",value:function(e){var t=e.url,r=_superagent2.default.get(t);return r.buffer?r=r.buffer(!0).parse(_superagentBinaryParser2.default):r.responseType&&(r=r.responseType("arraybuffer").then(function(e){return e.body=e.xhr.response,e})),r.then(function(e){return e.body})}},{key:"listOAuthClients",value:function(e){var t=e.product,r=e.auth,i=e.context,n=t?"/v1/products/"+t+"/clients":"/v1/clients";return this.get(n,r,void 0,i)}},{key:"createOAuthClient",value:function(e){var t=e.name,r=e.type,i=e.redirect_uri,n=e.scope,u=e.product,a=e.auth,o=e.context,s=u?"/v1/products/"+u+"/clients":"/v1/clients",c={name:t,type:r,redirect_uri:i,scope:n};return this.post(s,c,a,o)}},{key:"updateOAuthClient",value:function(e){var t=e.clientId,r=e.name,i=e.scope,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/clients/"+t:"/v1/clients/"+t,s={name:r,scope:i};return this.put(o,s,u,a)}},{key:"deleteOAuthClient",value:function(e){var t=e.clientId,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/clients/"+t:"/v1/clients/"+t;return this.delete(u,void 0,i,n)}},{key:"listProducts",value:function(e){var t=e.auth,r=e.context;return this.get("/v1/products",t,void 0,r)}},{key:"getProduct",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t,r,void 0,i)}},{key:"listProductFirmware",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t+"/firmware",r,void 0,i)}},{key:"uploadProductFirmware",value:function(e){var t=e.file,r=e.version,i=e.title,n=e.description,u=e.product,a=e.auth,o=e.context;return this.request({uri:"/v1/products/"+u+"/firmware",method:"post",files:{"firmware.bin":t},form:{version:r,title:i,description:n},context:o,auth:a})}},{key:"getProductFirmware",value:function(e){var t=e.version,r=e.product,i=e.auth,n=e.context;return this.get("/v1/products/"+r+"/firmware/"+t,i,void 0,n)}},{key:"updateProductFirmware",value:function(e){var t=e.version,r=e.title,i=e.description,n=e.product,u=e.auth,a=e.context,o="/v1/products/"+n+"/firmware/"+t;return this.put(o,{title:r,description:i},u,a)}},{key:"downloadProductFirmware",value:function(e){var t=e.version,r=e.product,i=e.auth,n=(e.context,"/v1/products/"+r+"/firmware/"+t+"/binary"),u=(0,_superagent2.default)("get",n);return u.use(this.prefix),this.headers(u,i),this.debug&&this.debug(u),u}},{key:"releaseProductFirmware",value:function(e){var t=e.version,r=e.product,i=e.auth,n=e.context,u="/v1/products/"+r+"/firmware/release";return this.put(u,{version:t},i,n)}},{key:"listTeamMembers",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t+"/team",r,void 0,i)}},{key:"inviteTeamMember",value:function(e){var t=e.username,r=e.product,i=e.auth,n=e.context;return this.post("/v1/products/"+r+"/team",{username:t},i,n)}},{key:"removeTeamMember",value:function(e){var t=e.username,r=e.product,i=e.auth,n=e.context;return this.delete("/v1/products/"+r+"/team/"+t,void 0,i,n)}},{key:"deviceUri",value:function(e){var t=e.deviceId,r=e.product;return r?"/v1/products/"+r+"/devices/"+t:"/v1/devices/"+t}},{key:"get",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.get(e,t,r,i)}},{key:"head",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.head(e,t,r,i)}},{key:"post",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.post(e,t,r,i)}},{key:"put",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.put(e,t,r,i)}},{key:"delete",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.delete(e,t,r,i)}},{key:"request",value:function(e){return e.context=this._buildContext(e.context),this.agent.request(e)}},{key:"client",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _Client2.default((0,_assign2.default)({api:this},e))}}]),e}();Particle.prototype.removeAccessToken=Particle.prototype.deleteAccessToken,exports.default=Particle,module.exports=exports.default; -},{"./Agent":1,"./Client":2,"./Defaults":3,"./EventStream":4,"./superagent-binary-parser":7,"babel-runtime/core-js/object/assign":11,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"superagent":169}],7:[function(require,module,exports){ +"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _assign=require("babel-runtime/core-js/object/assign"),_assign2=_interopRequireDefault(_assign),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_superagent=require("superagent"),_superagent2=_interopRequireDefault(_superagent),_superagentBinaryParser=require("./superagent-binary-parser"),_superagentBinaryParser2=_interopRequireDefault(_superagentBinaryParser),_Defaults=require("./Defaults"),_Defaults2=_interopRequireDefault(_Defaults),_EventStream=require("./EventStream"),_EventStream2=_interopRequireDefault(_EventStream),_Agent=require("./Agent"),_Agent2=_interopRequireDefault(_Agent),_Client=require("./Client"),_Client2=_interopRequireDefault(_Client),Particle=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,_classCallCheck3.default)(this,e),(0,_assign2.default)(this,_Defaults2.default,t),this.context={},this.agent=new _Agent2.default(this.baseUrl)}return(0,_createClass3.default)(e,[{key:"_isValidContext",value:function(e,t){return("tool"===e||"project"===e)&&void 0!==t}},{key:"setContext",value:function(e,t){if(void 0!==t){if(!this._isValidContext(e,t))throw Error("uknown context name or undefined context: "+e);this.context[e]=t}}},{key:"_buildContext",value:function(e){return(0,_assign2.default)(this.context,e)}},{key:"login",value:function(e){var t=e.username,r=e.password,i=e.tokenDuration,n=void 0===i?this.tokenDuration:i,u=e.context;return this.request({uri:"/oauth/token",form:{username:t,password:r,grant_type:"password",client_id:this.clientId,client_secret:this.clientSecret,expires_in:n},method:"post",context:u})}},{key:"createUser",value:function(e){var t=e.username,r=e.password,i=e.accountInfo,n=e.context;return this.post("/v1/users",{username:t,password:r,account_info:i},void 0,n)}},{key:"verifyUser",value:function(e){var t=e.token,r=e.context;return this.post("/v1/user/verify",{token:t},void 0,r)}},{key:"resetPassword",value:function(e){var t=e.username,r=e.context;return this.post("/v1/user/password-reset",{username:t},void 0,r)}},{key:"deleteAccessToken",value:function(e){var t=e.username,r=e.password,i=e.token,n=e.context;return this.delete("/v1/access_tokens/"+i,{access_token:i},{username:t,password:r},n)}},{key:"deleteCurrentAccessToken",value:function(e){var t=e.auth,r=e.context;return this.delete("/v1/access_tokens/current",void 0,t,r)}},{key:"listAccessTokens",value:function(e){var t=e.username,r=e.password,i=e.context;return this.get("/v1/access_tokens",{username:t,password:r},void 0,i)}},{key:"trackingIdentity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auth,r=e.full,i=void 0!==r&&r,n=e.context;return this.get("/v1/user/identify",t,i?void 0:{tracking:1},n)}},{key:"listDevices",value:function(e){var t=e.deviceId,r=e.deviceName,i=e.sortAttr,n=e.sortDir,u=e.page,a=e.perPage,o=e.product,s=e.auth,c=e.context,d=o?"/v1/products/"+o+"/devices":"/v1/devices",v=o?{deviceId:t,deviceName:r,sortAttr:i,sortDir:n,page:u,per_page:a}:void 0;return this.get(d,s,v,c)}},{key:"getDevice",value:function(e){var t=e.deviceId,r=e.product,i=e.auth,n=e.context,u=this.deviceUri({deviceId:t,product:r});return this.get(u,i,void 0,n)}},{key:"claimDevice",value:function(e){var t=e.deviceId,r=e.requestTransfer,i=e.auth,n=e.context;return this.post("/v1/devices",{id:t,request_transfer:!!r},i,n)}},{key:"addDeviceToProduct",value:function(e){var t=e.deviceId,r=e.product,i=e.auth,n=e.context,u="/v1/products/"+r+"/devices";return this.post(u,{id:t},i,n)}},{key:"removeDevice",value:function(e){var t=e.deviceId,r=e.deny,i=e.product,n=e.auth,u=e.context,a=this.deviceUri({deviceId:t,product:i}),o=i?{deny:r}:void 0;return this.delete(a,o,n,u)}},{key:"removeDeviceOwner",value:function(e){var t=e.deviceId,r=(e.deny,e.product),i=e.auth,n=e.context,u="/v1/products/"+r+"/devices/"+t+"/owner";return this.delete(u,void 0,i,n)}},{key:"renameDevice",value:function(e){var t=e.deviceId,r=e.name,i=e.product,n=e.auth,u=e.context;return this.updateDevice({deviceId:t,name:r,product:i,auth:n,context:u})}},{key:"signalDevice",value:function(e){var t=e.deviceId,r=e.signal,i=e.product,n=e.auth,u=e.context;return this.updateDevice({deviceId:t,signal:r,product:i,auth:n,context:u})}},{key:"setDeviceNotes",value:function(e){var t=e.deviceId,r=e.notes,i=e.product,n=e.auth,u=e.context;return this.updateDevice({deviceId:t,notes:r,product:i,auth:n,context:u})}},{key:"markAsDevelopmentDevice",value:function(e){var t=e.deviceId,r=e.development,i=void 0===r||r,n=e.product,u=e.auth,a=e.context;return this.updateDevice({deviceId:t,development:i,product:n,auth:u,context:a})}},{key:"lockDeviceProductFirmware",value:function(e){var t=e.deviceId,r=e.desiredFirmwareVersion,i=e.flash,n=e.product,u=e.auth,a=e.context;return this.updateDevice({deviceId:t,desiredFirmwareVersion:r,flash:i,product:n,auth:u,context:a})}},{key:"unlockDeviceProductFirmware",value:function(e){var t=e.deviceId,r=e.product,i=e.auth,n=e.context;return this.updateDevice({deviceId:t,desiredFirmwareVersion:null,product:r,auth:i,context:n})}},{key:"updateDevice",value:function(e){var t=e.deviceId,r=e.name,i=e.signal,n=e.notes,u=e.development,a=e.desiredFirmwareVersion,o=e.flash,s=e.product,c=e.auth,d=e.context;i=i?"1":"0";var v=this.deviceUri({deviceId:t,product:s}),l=s?{name:r,signal:i,notes:n,development:u,desired_firmware_version:a,flash:o}:{name:r,signal:i,notes:n};return this.put(v,l,c,d)}},{key:"provisionDevice",value:function(e){var t=e.productId,r=e.auth,i=e.context;return this.post("/v1/devices",{product_id:t},r,i)}},{key:"getClaimCode",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/device_claims":"/v1/device_claims";return this.post(u,{iccid:t},i,n)}},{key:"validatePromoCode",value:function(e){var t=e.auth,r=e.promoCode,i=e.context;return this.get("/v1/promo_code/"+r,t,void 0,i)}},{key:"changeProduct",value:function(e){var t=e.deviceId,r=e.productId,i=e.auth,n=e.context;return this.put("/v1/devices/"+t,{product_id:r},i,n)}},{key:"getVariable",value:function(e){var t=e.deviceId,r=e.name,i=e.product,n=e.auth,u=e.context,a=i?"/v1/products/"+i+"/devices/"+t+"/"+r:"/v1/devices/"+t+"/"+r;return this.get(a,n,void 0,u)}},{key:"flashDevice",value:function(e){var t=e.deviceId,r=e.files,i=e.targetVersion,n=e.auth,u=e.context,a={};return i?a.build_target_version=i:a.latest="true",this.request({uri:"/v1/devices/"+t,files:r,auth:n,form:a,context:u,method:"put"})}},{key:"flashTinker",value:function(e){var t=e.deviceId,r=e.auth,i=e.context;return console&&console.warning&&console.warning("Particle.flashTinker is deprecated"),this.put("/v1/devices/"+t,{app:"tinker"},r,i)}},{key:"compileCode",value:function(e){var t=e.files,r=e.platformId,i=e.targetVersion,n=e.auth,u=e.context,a={platform_id:r};return i?a.build_target_version=i:a.latest="true",this.request({uri:"/v1/binaries",files:t,auth:n,form:a,context:u,method:"post"})}},{key:"downloadFirmwareBinary",value:function(e){var t=e.binaryId,r=e.auth,i=(e.context,"/v1/binaries/"+t),n=(0,_superagent2.default)("get",i);return n.use(this.prefix),this.headers(n,r),this.debug&&this.debug(n),n}},{key:"sendPublicKey",value:function(e){var t=e.deviceId,r=e.key,i=e.algorithm,n=e.auth,u=e.context;return this.post("/v1/provisioning/"+t,{deviceID:t,publicKey:"string"==typeof r?r:r.toString(),filename:"particle-api",order:"manual_"+Date.now(),algorithm:i||"rsa"},n,u)}},{key:"callFunction",value:function(e){var t=e.deviceId,r=e.name,i=e.argument,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/devices/"+t+"/"+r:"/v1/devices/"+t+"/"+r;return this.post(o,{args:i},u,a)}},{key:"getEventStream",value:function(e){var t=e.deviceId,r=e.name,i=e.org,n=e.product,u=e.auth,a=(e.context,"/v1/");return i&&(a+="orgs/"+i+"/"),n&&(a+="products/"+n+"/"),t&&(a+="devices/","mine"!==t.toLowerCase()&&(a+=t+"/")),a+="events",r&&(a+="/"+encodeURIComponent(r)),new _EventStream2.default(""+this.baseUrl+a,u,{debug:this.debug}).connect()}},{key:"publishEvent",value:function(e){var t=e.name,r=e.data,i=e.isPrivate,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/events":"/v1/devices/events",s={name:t,data:r,private:i};return this.post(o,s,u,a)}},{key:"createWebhook",value:function(e){var t=e.deviceId,r=e.name,i=e.url,n=e.requestType,u=e.headers,a=e.json,o=e.query,s=e.body,c=e.responseTemplate,d=e.responseTopic,v=e.rejectUnauthorized,l=e.webhookAuth,p=e.noDefaults,h=e.form,f=e.product,m=e.auth,g=e.context;"mine"===t&&(t=void 0);var y=f?"/v1/products/"+f+"/webhooks":"/v1/webhooks",k={event:r,deviceid:t,url:i,requestType:n,headers:u,json:a,query:o,body:s,responseTemplate:c,responseTopic:d,rejectUnauthorized:v,auth:l,noDefaults:p,form:h};return this.post(y,k,m,g)}},{key:"deleteWebhook",value:function(e){var t=e.hookId,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/webhooks/"+t:"/v1/webhooks/"+t;return this.delete(u,void 0,i,n)}},{key:"listWebhooks",value:function(e){var t=e.product,r=e.auth,i=e.context,n=t?"/v1/products/"+t+"/webhooks":"/v1/webhooks";return this.get(n,r,void 0,i)}},{key:"createIntegration",value:function(e){var t=(e.integrationType,e.event),r=e.settings,i=e.deviceId,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/integrations":"/v1/integrations",s=(0,_assign2.default)({event:t,deviceid:i},r);return this.post(o,s,u,a)}},{key:"editIntegration",value:function(e){var t=e.integrationId,r=e.event,i=e.settings,n=e.deviceId,u=e.product,a=e.auth,o=e.context,s=u?"/v1/products/"+u+"/integrations/"+t:"/v1/integrations/"+t,c=(0,_assign2.default)({event:r,deviceid:n},i);return this.put(s,c,a,o)}},{key:"deleteIntegration",value:function(e){var t=e.integrationId,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/integrations/"+t:"/v1/integrations/"+t;return this.delete(u,void 0,i,n)}},{key:"listIntegrations",value:function(e){var t=e.product,r=e.auth,i=e.context,n=t?"/v1/products/"+t+"/integrations":"/v1/integrations";return this.get(n,r,void 0,i)}},{key:"getUserInfo",value:function(e){var t=e.auth,r=e.context;return this.get("/v1/user",t,void 0,r)}},{key:"setUserInfo",value:function(e){var t=e.stripeToken,r=e.accountInfo,i=e.password,n=e.auth,u=e.context,a={};return t?a.stripe_token=t:null,r?a.account_info=r:null,i?a.password=i:null,this.put("/v1/user",a,n,u)}},{key:"listSIMs",value:function(e){var t=e.iccid,r=e.deviceId,i=e.deviceName,n=e.page,u=e.perPage,a=e.product,o=e.auth,s=e.context,c=a?"/v1/products/"+a+"/sims":"/v1/sims",d=a?{iccid:t,deviceId:r,deviceName:i,page:n,per_page:u}:void 0;return this.get(c,o,d,s)}},{key:"getSIMDataUsage",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/sims/"+t+"/data_usage":"/v1/sims/"+t+"/data_usage";return this.get(u,i,void 0,n)}},{key:"getFleetDataUsage",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t+"/sims/data_usage",r,void 0,i)}},{key:"checkSIM",value:function(e){var t=e.iccid,r=e.auth,i=e.context;return this.head("/v1/sims/"+t,r,void 0,i)}},{key:"activateSIM",value:function(e){var t=e.iccid,r=e.iccids,i=e.countryCode,n=e.promoCode,u=e.product,a=e.auth,o=e.context;r=r||[t];var s=u?"/v1/products/"+u+"/sims":"/v1/sims/"+t,c=u?{sims:r,countryCode:i}:{countryCode:i,promoCode:n,action:"activate"},d=u?"post":"put";return this.request({uri:s,method:d,data:c,auth:a,context:o})}},{key:"deactivateSIM",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/sims/"+t:"/v1/sims/"+t,a={action:"deactivate"};return this.put(u,a,i,n)}},{key:"reactivateSIM",value:function(e){var t=e.iccid,r=e.mbLimit,i=e.product,n=e.auth,u=e.context,a=i?"/v1/products/"+i+"/sims/"+t:"/v1/sims/"+t,o={mb_limit:r,action:"reactivate"};return this.put(a,o,n,u)}},{key:"updateSIM",value:function(e){var t=e.iccid,r=e.mbLimit,i=e.product,n=e.auth,u=e.context,a=i?"/v1/products/"+i+"/sims/"+t:"/v1/sims/"+t,o={mb_limit:r};return this.put(a,o,n,u)}},{key:"removeSIM",value:function(e){var t=e.iccid,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/sims/"+t:"/v1/sims/"+t;return this.delete(u,void 0,i,n)}},{key:"listBuildTargets",value:function(e){var t=e.onlyFeatured,r=e.auth,i=e.context,n=void 0;return void 0!==t&&(n={featured:!!t}),this.get("/v1/build_targets",r,n,i)}},{key:"listLibraries",value:function(e){var t=e.page,r=e.limit,i=e.filter,n=e.sort,u=e.architectures,a=e.category,o=e.scope,s=e.excludeScopes,c=e.auth,d=e.context;return this.get("/v1/libraries",c,{page:t,filter:i,limit:r,sort:n,architectures:this._asList(u),category:a,scope:o,excludeScopes:this._asList(s)},d)}},{key:"_asList",value:function(e){return Array.isArray(e)?e.join(","):e}},{key:"getLibrary",value:function(e){var t=e.name,r=e.version,i=e.auth,n=e.context;return this.get("/v1/libraries/"+t,i,{version:r},n)}},{key:"getLibraryVersions",value:function(e){var t=e.name,r=e.page,i=e.limit,n=e.auth,u=e.context;return this.get("/v1/libraries/"+t+"/versions",n,{page:r,limit:i},u)}},{key:"contributeLibrary",value:function(e){var t=e.archive,r=e.auth,i=e.context,n={"archive.tar.gz":t};return this.request({uri:"/v1/libraries",files:n,auth:r,context:i,method:"post"})}},{key:"publishLibrary",value:function(e){var t=e.name,r=e.auth,i=e.context;return this.request({uri:"/v1/libraries/"+t,auth:r,context:i,method:"patch",data:{visibility:"public"}})}},{key:"deleteLibrary",value:function(e){var t=e.name,r=e.force,i=e.auth,n=e.context;return this.delete("/v1/libraries/"+t,{force:r},i,n)}},{key:"downloadFile",value:function(e){var t=e.url,r=_superagent2.default.get(t);return r.buffer?r=r.buffer(!0).parse(_superagentBinaryParser2.default):r.responseType&&(r=r.responseType("arraybuffer").then(function(e){return e.body=e.xhr.response,e})),r.then(function(e){return e.body})}},{key:"listOAuthClients",value:function(e){var t=e.product,r=e.auth,i=e.context,n=t?"/v1/products/"+t+"/clients":"/v1/clients";return this.get(n,r,void 0,i)}},{key:"createOAuthClient",value:function(e){var t=e.name,r=e.type,i=e.redirect_uri,n=e.scope,u=e.product,a=e.auth,o=e.context,s=u?"/v1/products/"+u+"/clients":"/v1/clients",c={name:t,type:r,redirect_uri:i,scope:n};return this.post(s,c,a,o)}},{key:"updateOAuthClient",value:function(e){var t=e.clientId,r=e.name,i=e.scope,n=e.product,u=e.auth,a=e.context,o=n?"/v1/products/"+n+"/clients/"+t:"/v1/clients/"+t,s={name:r,scope:i};return this.put(o,s,u,a)}},{key:"deleteOAuthClient",value:function(e){var t=e.clientId,r=e.product,i=e.auth,n=e.context,u=r?"/v1/products/"+r+"/clients/"+t:"/v1/clients/"+t;return this.delete(u,void 0,i,n)}},{key:"listProducts",value:function(e){var t=e.auth,r=e.context;return this.get("/v1/products",t,void 0,r)}},{key:"getProduct",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t,r,void 0,i)}},{key:"listProductFirmware",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t+"/firmware",r,void 0,i)}},{key:"uploadProductFirmware",value:function(e){var t=e.file,r=e.version,i=e.title,n=e.description,u=e.product,a=e.auth,o=e.context;return this.request({uri:"/v1/products/"+u+"/firmware",method:"post",files:{"firmware.bin":t},form:{version:r,title:i,description:n},context:o,auth:a})}},{key:"getProductFirmware",value:function(e){var t=e.version,r=e.product,i=e.auth,n=e.context;return this.get("/v1/products/"+r+"/firmware/"+t,i,void 0,n)}},{key:"updateProductFirmware",value:function(e){var t=e.version,r=e.title,i=e.description,n=e.product,u=e.auth,a=e.context,o="/v1/products/"+n+"/firmware/"+t;return this.put(o,{title:r,description:i},u,a)}},{key:"downloadProductFirmware",value:function(e){var t=e.version,r=e.product,i=e.auth,n=(e.context,"/v1/products/"+r+"/firmware/"+t+"/binary"),u=(0,_superagent2.default)("get",n);return u.use(this.prefix),this.headers(u,i),this.debug&&this.debug(u),u}},{key:"releaseProductFirmware",value:function(e){var t=e.version,r=e.product,i=e.auth,n=e.context,u="/v1/products/"+r+"/firmware/release";return this.put(u,{version:t},i,n)}},{key:"listTeamMembers",value:function(e){var t=e.product,r=e.auth,i=e.context;return this.get("/v1/products/"+t+"/team",r,void 0,i)}},{key:"inviteTeamMember",value:function(e){var t=e.username,r=e.product,i=e.auth,n=e.context;return this.post("/v1/products/"+r+"/team",{username:t},i,n)}},{key:"removeTeamMember",value:function(e){var t=e.username,r=e.product,i=e.auth,n=e.context;return this.delete("/v1/products/"+r+"/team/"+t,void 0,i,n)}},{key:"deviceUri",value:function(e){var t=e.deviceId,r=e.product;return r?"/v1/products/"+r+"/devices/"+t:"/v1/devices/"+t}},{key:"get",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.get(e,t,r,i)}},{key:"head",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.head(e,t,r,i)}},{key:"post",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.post(e,t,r,i)}},{key:"put",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.put(e,t,r,i)}},{key:"delete",value:function(e,t,r,i){return i=this._buildContext(i),this.agent.delete(e,t,r,i)}},{key:"request",value:function(e){return e.context=this._buildContext(e.context),this.agent.request(e)}},{key:"client",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _Client2.default((0,_assign2.default)({api:this},e))}}]),e}();Particle.prototype.removeAccessToken=Particle.prototype.deleteAccessToken,exports.default=Particle,module.exports=exports.default; +},{"./Agent":1,"./Client":2,"./Defaults":3,"./EventStream":4,"./superagent-binary-parser":7,"babel-runtime/core-js/object/assign":11,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"superagent":168}],7:[function(require,module,exports){ (function (Buffer){ "use strict";function binaryParser(e,r){var t=[];e.on("data",function(e){return t.push(e)}),e.on("end",function(){return r(null,Buffer.concat(t))})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=binaryParser,module.exports=exports.default; }).call(this,require("buffer").Buffer) @@ -46,31 +46,31 @@ module.exports={default:require("core-js/library/fn/symbol/iterator"),__esModule },{}],22:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}exports.__esModule=!0;var _defineProperty=require("../core-js/object/define-property"),_defineProperty2=_interopRequireDefault(_defineProperty);exports.default=function(){function e(e,r){for(var t=0;t0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===o[r-2]?2:"="===o[r-1]?1:0}function byteLength(o){return 3*o.length/4-placeHoldersCount(o)}function toByteArray(o){var r,e,t,u,n,p,a=o.length;n=placeHoldersCount(o),p=new Arr(3*a/4-n),t=n>0?a-4:a;var l=0;for(r=0,e=0;r>16&255,p[l++]=u>>8&255,p[l++]=255&u;return 2===n?(u=revLookup[o.charCodeAt(r)]<<2|revLookup[o.charCodeAt(r+1)]>>4,p[l++]=255&u):1===n&&(u=revLookup[o.charCodeAt(r)]<<10|revLookup[o.charCodeAt(r+1)]<<4|revLookup[o.charCodeAt(r+2)]>>2,p[l++]=u>>8&255,p[l++]=255&u),p}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,u=[],n=r;na?a:p+16383));return 1===t?(r=o[e-1],u+=lookup[r>>2],u+=lookup[r<<4&63],u+="=="):2===t&&(r=(o[e-2]<<8)+o[e-1],u+=lookup[r>>10],u+=lookup[r>>4&63],u+=lookup[r<<2&63],u+="="),n.push(u),n.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===o[r-2]?2:"="===o[r-1]?1:0}function byteLength(o){return 3*o.length/4-placeHoldersCount(o)}function toByteArray(o){var r,e,t,u,n,p,a=o.length;n=placeHoldersCount(o),p=new Arr(3*a/4-n),t=n>0?a-4:a;var l=0;for(r=0,e=0;r>16&255,p[l++]=u>>8&255,p[l++]=255&u;return 2===n?(u=revLookup[o.charCodeAt(r)]<<2|revLookup[o.charCodeAt(r+1)]>>4,p[l++]=255&u):1===n&&(u=revLookup[o.charCodeAt(r)]<<10|revLookup[o.charCodeAt(r+1)]<<4|revLookup[o.charCodeAt(r+2)]>>2,p[l++]=u>>8&255,p[l++]=255&u),p}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,u=[],n=r;nl?l:a+p));return 1===t?(r=o[e-1],u+=lookup[r>>2],u+=lookup[r<<4&63],u+="=="):2===t&&(r=(o[e-2]<<8)+o[e-1],u+=lookup[r>>10],u+=lookup[r>>4&63],u+=lookup[r<<2&63],u+="="),n.push(u),n.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;iMAX_LEN)throw new RangeError("size is too large");var n=f,o=e;void 0===o&&(n=void 0,o=0);var t=new Buffer(r);if("string"==typeof o)for(var u=new Buffer(o,n),i=u.length,a=-1;++aMAX_LEN)throw new RangeError("size is too large");return new Buffer(r)},exports.from=function(r,e,f){if("function"==typeof Buffer.from&&(!global.Uint8Array||Uint8Array.from!==Buffer.from))return Buffer.from(r,e,f);if("number"==typeof r)throw new TypeError('"value" argument must not be a number');if("string"==typeof r)return new Buffer(r,e);if("undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer){var n=e;if(1===arguments.length)return new Buffer(r);void 0===n&&(n=0);var o=f;if(void 0===o&&(o=r.byteLength-n),n>=r.byteLength)throw new RangeError("'offset' is out of bounds");if(o>r.byteLength-n)throw new RangeError("'length' is out of bounds");return new Buffer(r.slice(n,n+o))}if(Buffer.isBuffer(r)){var t=new Buffer(r.length);return r.copy(t,0,0,r.length),t}if(r){if(Array.isArray(r)||"undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return new Buffer(r);if("Buffer"===r.type&&Array.isArray(r.data))return new Buffer(r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},exports.allocUnsafeSlow=function(r){if("function"==typeof Buffer.allocUnsafeSlow)return Buffer.allocUnsafeSlow(r);if("number"!=typeof r)throw new TypeError("size must be a number");if(r>=MAX_LEN)throw new RangeError("size is too large");return new SlowBuffer(r)}; +"use strict";var buffer=require("buffer"),Buffer=buffer.Buffer,SlowBuffer=buffer.SlowBuffer,MAX_LEN=buffer.kMaxLength||2147483647;exports.alloc=function(r,e,f){if("function"==typeof Buffer.alloc)return Buffer.alloc(r,e,f);if("number"==typeof f)throw new TypeError("encoding must not be number");if("number"!=typeof r)throw new TypeError("size must be a number");if(r>MAX_LEN)throw new RangeError("size is too large");var n=f,o=e;void 0===o&&(n=void 0,o=0);var t=new Buffer(r);if("string"==typeof o)for(var u=new Buffer(o,n),i=u.length,a=-1;++aMAX_LEN)throw new RangeError("size is too large");return new Buffer(r)},exports.from=function(r,e,f){if("function"==typeof Buffer.from&&(!global.Uint8Array||Uint8Array.from!==Buffer.from))return Buffer.from(r,e,f);if("number"==typeof r)throw new TypeError('"value" argument must not be a number');if("string"==typeof r)return new Buffer(r,e);if("undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer){var n=e;if(1===arguments.length)return new Buffer(r);"undefined"==typeof n&&(n=0);var o=f;if("undefined"==typeof o&&(o=r.byteLength-n),n>=r.byteLength)throw new RangeError("'offset' is out of bounds");if(o>r.byteLength-n)throw new RangeError("'length' is out of bounds");return new Buffer(r.slice(n,n+o))}if(Buffer.isBuffer(r)){var t=new Buffer(r.length);return r.copy(t,0,0,r.length),t}if(r){if(Array.isArray(r)||"undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return new Buffer(r);if("Buffer"===r.type&&Array.isArray(r.data))return new Buffer(r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},exports.allocUnsafeSlow=function(r){if("function"==typeof Buffer.allocUnsafeSlow)return Buffer.allocUnsafeSlow(r);if("number"!=typeof r)throw new TypeError("size must be a number");if(r>=MAX_LEN)throw new RangeError("size is too large");return new SlowBuffer(r)}; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"buffer":30}],30:[function(require,module,exports){ (function (global){ -"use strict";function typedArraySupport(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,e){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function SlowBuffer(t){return+t!=t&&(t=0),Buffer.alloc(+t)}function byteLength(t,e){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,f){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=f?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(f)return-1;r=t.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof e&&(e=Buffer.from(e,n)),Buffer.isBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,f);if("number"==typeof e)return e&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,f){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,u=t.length,s=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,u/=2,s/=2,r/=2}var a;if(f){var h=-1;for(a=r;au&&(r=u-s),a=r;a>=0;a--){for(var c=!0,l=0;lf&&(n=f):n=f;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(f+u<=r){var s,a,h,c;switch(u){case 1:i<128&&(o=i);break;case 2:s=t[f+1],128==(192&s)&&(c=(31&i)<<6|63&s)>127&&(o=c);break;case 3:s=t[f+1],a=t[f+2],128==(192&s)&&128==(192&a)&&(c=(15&i)<<12|(63&s)<<6|63&a)>2047&&(c<55296||c>57343)&&(o=c);break;case 4:s=t[f+1],a=t[f+2],h=t[f+3],128==(192&s)&&128==(192&a)&&128==(192&h)&&(c=(15&i)<<18|(63&s)<<12|(63&a)<<6|63&h)>65535&&c<1114112&&(o=c)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),f+=u}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var f="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,f,i){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>f||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var f=0,i=Math.min(t.length-r,2);f>>8*(n?f:1-f)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var f=0,i=Math.min(t.length-r,4);f>>8*(n?f:3-f)&255}function checkIEEE754(t,e,r,n,f,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(t,e,r,n,f){return f||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,f){return f||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(t,e,r,n,52,8),r+8}function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,f=null,i=[],o=0;o55295&&r<57344){if(!f){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),f=r;continue}r=65536+(f-55296<<10|r-56320)}else f&&(e-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(t){for(var e=[],r=0;r>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(t){return base64.toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var f=0;f=e.length||f>=t.length);++f)e[f+r]=t[f];return f}function isnan(t){return t!==t}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,e,r){return from(null,t,e,r)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,e){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,f=0,i=Math.min(r,n);f0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer.prototype.compare=function(t,e,r,n,f){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),e<0||r>t.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&e>=r)return 0;if(n>=f)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,f>>>=0,this===t)return 0;for(var i=f-n,o=r-e,u=Math.min(i,o),s=this.slice(n,f),a=t.slice(e,r),h=0;hf)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(f*=256);)n+=this[t+--e]*f;return n},Buffer.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i=f&&(n-=Math.pow(2,8*e)),n},Buffer.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=e,f=1,i=this[t+--n];n>0&&(f*=256);)i+=this[t+--n]*f;return f*=128,i>=f&&(i-=Math.pow(2,8*e)),i},Buffer.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){checkInt(this,t,e,r,Math.pow(2,8*r)-1,0)}var f=1,i=0;for(this[e]=255&t;++i=0&&(i*=256);)this[e+f]=t/i&255;return e+r},Buffer.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=0,o=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},Buffer.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/o>>0)-u&255;return e+r},Buffer.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--f)t[f+e]=this[f+r];else if(i<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(f=0;f>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;i=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function SlowBuffer(t){return+t!=t&&(t=0),Buffer.alloc(+t)}function byteLength(t,e){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,f){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=f?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(f)return-1;r=t.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof e&&(e=Buffer.from(e,n)),Buffer.isBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,f);if("number"==typeof e)return e&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,f){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,u=t.length,s=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,u/=2,s/=2,r/=2}var a;if(f){var h=-1;for(a=r;au&&(r=u-s),a=r;a>=0;a--){for(var c=!0,l=0;lf&&(n=f)):n=f;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(f+u<=r){var s,a,h,c;switch(u){case 1:i<128&&(o=i);break;case 2:s=t[f+1],128===(192&s)&&(c=(31&i)<<6|63&s,c>127&&(o=c));break;case 3:s=t[f+1],a=t[f+2],128===(192&s)&&128===(192&a)&&(c=(15&i)<<12|(63&s)<<6|63&a,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:s=t[f+1],a=t[f+2],h=t[f+3],128===(192&s)&&128===(192&a)&&128===(192&h)&&(c=(15&i)<<18|(63&s)<<12|(63&a)<<6|63&h,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),f+=u}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var f="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,f,i){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>f||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var f=0,i=Math.min(t.length-r,2);f>>8*(n?f:1-f)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var f=0,i=Math.min(t.length-r,4);f>>8*(n?f:3-f)&255}function checkIEEE754(t,e,r,n,f,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(t,e,r,n,f){return f||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,f){return f||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(t,e,r,n,52,8),r+8}function base64clean(t){if(t=stringtrim(t).replace(INVALID_BASE64_RE,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,f=null,i=[],o=0;o55295&&r<57344){if(!f){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),f=r;continue}r=(f-55296<<10|r-56320)+65536}else f&&(e-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(t){for(var e=[],r=0;r>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(t){return base64.toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var f=0;f=e.length||f>=t.length);++f)e[f+r]=t[f];return f}function isnan(t){return t!==t}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,e,r){return from(null,t,e,r)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function(t){return!(null==t||!t._isBuffer)},Buffer.compare=function(t,e){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,f=0,i=Math.min(r,n);f0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer.prototype.compare=function(t,e,r,n,f){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),e<0||r>t.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&e>=r)return 0;if(n>=f)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,f>>>=0,this===t)return 0;for(var i=f-n,o=r-e,u=Math.min(i,o),s=this.slice(n,f),a=t.slice(e,r),h=0;hf)&&(r=f),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(f*=256);)n+=this[t+--e]*f;return n},Buffer.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],f=1,i=0;++i=f&&(n-=Math.pow(2,8*e)),n},Buffer.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=e,f=1,i=this[t+--n];n>0&&(f*=256);)i+=this[t+--n]*f;return f*=128,i>=f&&(i-=Math.pow(2,8*e)),i},Buffer.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},Buffer.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),ieee754.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),ieee754.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){var f=Math.pow(2,8*r)-1;checkInt(this,t,e,r,f,0)}var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Buffer.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=0,o=1,u=0;for(this[e]=255&t;++i>0)-u&255;return e+r},Buffer.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,t,e,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/o>>0)-u&255;return e+r},Buffer.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--f)t[f+e]=this[f+r];else if(i<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(f=0;f>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;if;)if((o=i[f++])!=o)return!0}else for(;u>f;f++)if((e||f in i)&&i[f]===r)return e||f||0;return!e&&-1}}; +var toIObject=require("./_to-iobject"),toLength=require("./_to-length"),toIndex=require("./_to-index");module.exports=function(e){return function(t,r,n){var o,i=toIObject(t),u=toLength(i.length),f=toIndex(n,u);if(e&&r!=r){for(;u>f;)if(o=i[f++],o!=o)return!0}else for(;u>f;f++)if((e||f in i)&&i[f]===r)return e||f||0;return!e&&-1}}; },{"./_to-index":108,"./_to-iobject":110,"./_to-length":111}],51:[function(require,module,exports){ var cof=require("./_cof"),TAG=require("./_wks")("toStringTag"),ARG="Arguments"==cof(function(){return arguments}()),tryGet=function(t,e){try{return t[e]}catch(t){}};module.exports=function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=tryGet(e=Object(t),TAG))?r:ARG?cof(e):"Object"==(n=cof(e))&&"function"==typeof e.callee?"Arguments":n}; },{"./_cof":52,"./_wks":117}],52:[function(require,module,exports){ @@ -126,11 +126,11 @@ module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,to },{}],59:[function(require,module,exports){ var getKeys=require("./_object-keys"),gOPS=require("./_object-gops"),pIE=require("./_object-pie");module.exports=function(e){var r=getKeys(e),t=gOPS.f;if(t)for(var o,u=t(e),g=pIE.f,i=0;u.length>i;)g.call(e,o=u[i++])&&r.push(o);return r}; },{"./_object-gops":90,"./_object-keys":93,"./_object-pie":94}],60:[function(require,module,exports){ -var global=require("./_global"),core=require("./_core"),ctx=require("./_ctx"),hide=require("./_hide"),PROTOTYPE="prototype",$export=function(e,r,t){var o,n,p,i=e&$export.F,x=e&$export.G,c=e&$export.S,l=e&$export.P,u=e&$export.B,a=e&$export.W,$=x?core:core[r]||(core[r]={}),P=$[PROTOTYPE],f=x?global:c?global[r]:(global[r]||{})[PROTOTYPE];x&&(t=r);for(o in t)(n=!i&&f&&void 0!==f[o])&&o in $||(p=n?f[o]:t[o],$[o]=x&&"function"!=typeof f[o]?t[o]:u&&n?ctx(p,global):a&&f[o]==p?function(e){var r=function(r,t,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,t)}return new e(r,t,o)}return e.apply(this,arguments)};return r[PROTOTYPE]=e[PROTOTYPE],r}(p):l&&"function"==typeof p?ctx(Function.call,p):p,l&&(($.virtual||($.virtual={}))[o]=p,e&$export.R&&P&&!P[o]&&hide(P,o,p)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128,module.exports=$export; +var global=require("./_global"),core=require("./_core"),ctx=require("./_ctx"),hide=require("./_hide"),PROTOTYPE="prototype",$export=function(e,r,t){var o,n,p,i=e&$export.F,x=e&$export.G,c=e&$export.S,l=e&$export.P,u=e&$export.B,a=e&$export.W,$=x?core:core[r]||(core[r]={}),P=$[PROTOTYPE],f=x?global:c?global[r]:(global[r]||{})[PROTOTYPE];x&&(t=r);for(o in t)n=!i&&f&&void 0!==f[o],n&&o in $||(p=n?f[o]:t[o],$[o]=x&&"function"!=typeof f[o]?t[o]:u&&n?ctx(p,global):a&&f[o]==p?function(e){var r=function(r,t,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,t)}return new e(r,t,o)}return e.apply(this,arguments)};return r[PROTOTYPE]=e[PROTOTYPE],r}(p):l&&"function"==typeof p?ctx(Function.call,p):p,l&&(($.virtual||($.virtual={}))[o]=p,e&$export.R&&P&&!P[o]&&hide(P,o,p)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128,module.exports=$export; },{"./_core":53,"./_ctx":54,"./_global":63,"./_hide":65}],61:[function(require,module,exports){ module.exports=function(r){try{return!!r()}catch(r){return!0}}; },{}],62:[function(require,module,exports){ -var ctx=require("./_ctx"),call=require("./_iter-call"),isArrayIter=require("./_is-array-iter"),anObject=require("./_an-object"),toLength=require("./_to-length"),getIterFn=require("./core.get-iterator-method"),BREAK={},RETURN={},exports=module.exports=function(e,r,t,o,i){var n,a,R,c,l=i?function(){return e}:getIterFn(e),u=ctx(t,o,r?2:1),E=0;if("function"!=typeof l)throw TypeError(e+" is not iterable!");if(isArrayIter(l)){for(n=toLength(e.length);n>E;E++)if((c=r?u(anObject(a=e[E])[0],a[1]):u(e[E]))===BREAK||c===RETURN)return c}else for(R=l.call(e);!(a=R.next()).done;)if((c=call(R,u,a.value,r))===BREAK||c===RETURN)return c};exports.BREAK=BREAK,exports.RETURN=RETURN; +var ctx=require("./_ctx"),call=require("./_iter-call"),isArrayIter=require("./_is-array-iter"),anObject=require("./_an-object"),toLength=require("./_to-length"),getIterFn=require("./core.get-iterator-method"),BREAK={},RETURN={},exports=module.exports=function(e,r,t,o,i){var n,a,R,c,l=i?function(){return e}:getIterFn(e),u=ctx(t,o,r?2:1),E=0;if("function"!=typeof l)throw TypeError(e+" is not iterable!");if(isArrayIter(l)){for(n=toLength(e.length);n>E;E++)if(c=r?u(anObject(a=e[E])[0],a[1]):u(e[E]),c===BREAK||c===RETURN)return c}else for(R=l.call(e);!(a=R.next()).done;)if(c=call(R,u,a.value,r),c===BREAK||c===RETURN)return c};exports.BREAK=BREAK,exports.RETURN=RETURN; },{"./_an-object":49,"./_ctx":54,"./_is-array-iter":70,"./_iter-call":73,"./_to-length":111,"./core.get-iterator-method":118}],63:[function(require,module,exports){ var global=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=global); },{}],64:[function(require,module,exports){ @@ -156,7 +156,7 @@ var anObject=require("./_an-object");module.exports=function(r,t,e,a){try{return },{"./_an-object":49}],74:[function(require,module,exports){ "use strict";var create=require("./_object-create"),descriptor=require("./_property-desc"),setToStringTag=require("./_set-to-string-tag"),IteratorPrototype={};require("./_hide")(IteratorPrototype,require("./_wks")("iterator"),function(){return this}),module.exports=function(r,t,e){r.prototype=create(IteratorPrototype,{next:descriptor(1,e)}),setToStringTag(r,t+" Iterator")}; },{"./_hide":65,"./_object-create":84,"./_property-desc":97,"./_set-to-string-tag":102,"./_wks":117}],75:[function(require,module,exports){ -"use strict";var LIBRARY=require("./_library"),$export=require("./_export"),redefine=require("./_redefine"),hide=require("./_hide"),has=require("./_has"),Iterators=require("./_iterators"),$iterCreate=require("./_iter-create"),setToStringTag=require("./_set-to-string-tag"),getPrototypeOf=require("./_object-gpo"),ITERATOR=require("./_wks")("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",returnThis=function(){return this};module.exports=function(e,r,t,i,n,o,s){$iterCreate(t,r,i);var u,a,T,R=function(e){if(!BUGGY&&e in f)return f[e];switch(e){case KEYS:case VALUES:return function(){return new t(this,e)}}return function(){return new t(this,e)}},A=r+" Iterator",E=n==VALUES,c=!1,f=e.prototype,h=f[ITERATOR]||f[FF_ITERATOR]||n&&f[n],I=h||R(n),p=n?E?R("entries"):I:void 0,_="Array"==r?f.entries||h:h;if(_&&(T=getPrototypeOf(_.call(new e)))!==Object.prototype&&(setToStringTag(T,A,!0),LIBRARY||has(T,ITERATOR)||hide(T,ITERATOR,returnThis)),E&&h&&h.name!==VALUES&&(c=!0,I=function(){return h.call(this)}),LIBRARY&&!s||!BUGGY&&!c&&f[ITERATOR]||hide(f,ITERATOR,I),Iterators[r]=I,Iterators[A]=returnThis,n)if(u={values:E?I:R(VALUES),keys:o?I:R(KEYS),entries:p},s)for(a in u)a in f||redefine(f,a,u[a]);else $export($export.P+$export.F*(BUGGY||c),r,u);return u}; +"use strict";var LIBRARY=require("./_library"),$export=require("./_export"),redefine=require("./_redefine"),hide=require("./_hide"),has=require("./_has"),Iterators=require("./_iterators"),$iterCreate=require("./_iter-create"),setToStringTag=require("./_set-to-string-tag"),getPrototypeOf=require("./_object-gpo"),ITERATOR=require("./_wks")("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",returnThis=function(){return this};module.exports=function(e,r,t,i,n,o,s){$iterCreate(t,r,i);var u,a,T,R=function(e){if(!BUGGY&&e in h)return h[e];switch(e){case KEYS:return function(){return new t(this,e)};case VALUES:return function(){return new t(this,e)}}return function(){return new t(this,e)}},A=r+" Iterator",c=n==VALUES,f=!1,h=e.prototype,E=h[ITERATOR]||h[FF_ITERATOR]||n&&h[n],I=E||R(n),p=n?c?R("entries"):I:void 0,_="Array"==r?h.entries||E:E;if(_&&(T=getPrototypeOf(_.call(new e)),T!==Object.prototype&&(setToStringTag(T,A,!0),LIBRARY||has(T,ITERATOR)||hide(T,ITERATOR,returnThis))),c&&E&&E.name!==VALUES&&(f=!0,I=function(){return E.call(this)}),LIBRARY&&!s||!BUGGY&&!f&&h[ITERATOR]||hide(h,ITERATOR,I),Iterators[r]=I,Iterators[A]=returnThis,n)if(u={values:c?I:R(VALUES),keys:o?I:R(KEYS),entries:p},s)for(a in u)a in h||redefine(h,a,u[a]);else $export($export.P+$export.F*(BUGGY||f),r,u);return u}; },{"./_export":60,"./_has":64,"./_hide":65,"./_iter-create":74,"./_iterators":78,"./_library":80,"./_object-gpo":91,"./_redefine":99,"./_set-to-string-tag":102,"./_wks":117}],76:[function(require,module,exports){ var ITERATOR=require("./_wks")("iterator"),SAFE_CLOSING=!1;try{var riter=[7][ITERATOR]();riter.return=function(){SAFE_CLOSING=!0},Array.from(riter,function(){throw 2})}catch(r){}module.exports=function(r,t){if(!t&&!SAFE_CLOSING)return!1;var n=!1;try{var e=[7],u=e[ITERATOR]();u.next=function(){return{done:n=!0}},e[ITERATOR]=function(){return u},r(e)}catch(r){}return n}; },{"./_wks":117}],77:[function(require,module,exports){ @@ -174,7 +174,7 @@ var global=require("./_global"),macrotask=require("./_task").set,Observer=global },{"./_cof":52,"./_global":63,"./_task":107}],83:[function(require,module,exports){ "use strict";var getKeys=require("./_object-keys"),gOPS=require("./_object-gops"),pIE=require("./_object-pie"),toObject=require("./_to-object"),IObject=require("./_iobject"),$assign=Object.assign;module.exports=!$assign||require("./_fails")(function(){var e={},t={},r=Symbol(),s="abcdefghijklmnopqrst";return e[r]=7,s.split("").forEach(function(e){t[e]=e}),7!=$assign({},e)[r]||Object.keys($assign({},t)).join("")!=s})?function(e,t){for(var r=toObject(e),s=arguments.length,i=1,o=gOPS.f,c=pIE.f;s>i;)for(var n,a=IObject(arguments[i++]),g=o?getKeys(a).concat(o(a)):getKeys(a),b=g.length,j=0;b>j;)c.call(a,n=g[j++])&&(r[n]=a[n]);return r}:$assign; },{"./_fails":61,"./_iobject":69,"./_object-gops":90,"./_object-keys":93,"./_object-pie":94,"./_to-object":112}],84:[function(require,module,exports){ -var anObject=require("./_an-object"),dPs=require("./_object-dps"),enumBugKeys=require("./_enum-bug-keys"),IE_PROTO=require("./_shared-key")("IE_PROTO"),Empty=function(){},PROTOTYPE="prototype",createDict=function(){var e,t=require("./_dom-create")("iframe"),r=enumBugKeys.length;for(t.style.display="none",require("./_html").appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("