summaryrefslogtreecommitdiff
path: root/node_modules/then-request
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:37:42 -0700
committer8cy <[email protected]>2020-04-03 02:37:42 -0700
commit60867fb030bae582082340ead7dbc7efdc2f5398 (patch)
tree4c6a7356351be2e4914e15c4703172597c45656e /node_modules/then-request
parentcommenting (diff)
downloads5nical-60867fb030bae582082340ead7dbc7efdc2f5398.tar.xz
s5nical-60867fb030bae582082340ead7dbc7efdc2f5398.zip
2020/04/03, 02:34, v1.2.0
Diffstat (limited to 'node_modules/then-request')
-rw-r--r--node_modules/then-request/.npmignore15
-rw-r--r--node_modules/then-request/.travis.yml3
-rw-r--r--node_modules/then-request/HISTORY.md79
-rw-r--r--node_modules/then-request/LICENSE19
-rw-r--r--node_modules/then-request/README.md82
-rw-r--r--node_modules/then-request/browser.js127
-rw-r--r--node_modules/then-request/dist/request.js1538
-rw-r--r--node_modules/then-request/dist/request.js.map47
-rw-r--r--node_modules/then-request/dist/request.min.js42
-rw-r--r--node_modules/then-request/dist/request.min.js.map1
-rw-r--r--node_modules/then-request/index.js93
-rw-r--r--node_modules/then-request/lib/handle-qs.js22
-rw-r--r--node_modules/then-request/package.json69
-rw-r--r--node_modules/then-request/test/browser.js53
-rw-r--r--node_modules/then-request/test/get-mock-response.js20
-rw-r--r--node_modules/then-request/test/index.js97
-rw-r--r--node_modules/then-request/test/server.js25
17 files changed, 2332 insertions, 0 deletions
diff --git a/node_modules/then-request/.npmignore b/node_modules/then-request/.npmignore
new file mode 100644
index 0000000..1f7fdd0
--- /dev/null
+++ b/node_modules/then-request/.npmignore
@@ -0,0 +1,15 @@
+coverage
+HISTORY.md
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+pids
+logs
+results
+npm-debug.log
+node_modules
diff --git a/node_modules/then-request/.travis.yml b/node_modules/then-request/.travis.yml
new file mode 100644
index 0000000..6e5919d
--- /dev/null
+++ b/node_modules/then-request/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "0.10"
diff --git a/node_modules/then-request/HISTORY.md b/node_modules/then-request/HISTORY.md
new file mode 100644
index 0000000..f4e99fb
--- /dev/null
+++ b/node_modules/then-request/HISTORY.md
@@ -0,0 +1,79 @@
+2.1.1 / 2015-02-12
+==================
+
+ * Preserve header casing
+
+2.1.0 / 2015-01-21
+==================
+
+ * Add retry, maxRedirects and timeout
+
+2.0.3 / 2015-01-21
+==================
+
+ * Add a "dist" folder with prebuilt clients for browsers
+
+2.0.1 / 2015-01-14
+==================
+
+ * Add support for 303 See Other redirects
+
+1.1.0 / 2014-12-18
+==================
+
+ * Support not following redirects
+
+1.0.5 / 2014-12-18
+==================
+
+ * Update dependencies
+
+1.0.4 / 2014-09-29
+==================
+
+ * Update promise to 6.0.0 ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+1.0.3 / 2014-09-09
+==================
+
+ * Update qs to 2.2.3 ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+1.0.2 / 2014-09-09
+==================
+
+ * Add content-length header ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+1.0.1 / 2014-08-07
+==================
+
+ * Update dependencies ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+1.0.0 / 2014-08-01
+==================
+
+ * Completely new API ([@ForbesLindesay](https://github.com/ForbesLindesay))
+ * Gzip support ([@ForbesLindesay](https://github.com/ForbesLindesay))
+ * Caching support ([@ForbesLindesay](https://github.com/ForbesLindesay))
+ * Redirects support ([@ForbesLindesay](https://github.com/ForbesLindesay))
+ * Documentation ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+0.0.4 / 2014-04-02
+==================
+
+ * Fix for empty responses ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+0.0.3 / 2014-04-02
+==================
+
+ * Fix for empty responses ([@ForbesLindesay](https://github.com/ForbesLindesay))
+
+0.0.2 / 2014-04-01
+==================
+
+ * Fix dependencies ([@Volox](https://github.com/Volox))
+ * Update readme ([@Volox](https://github.com/Volox))
+
+0.0.1 / 2014-02-10
+==================
+
+ * Initial release ([@ForbesLindesay](https://github.com/ForbesLindesay))
diff --git a/node_modules/then-request/LICENSE b/node_modules/then-request/LICENSE
new file mode 100644
index 0000000..27cc9f3
--- /dev/null
+++ b/node_modules/then-request/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2014 Forbes Lindesay
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/then-request/README.md b/node_modules/then-request/README.md
new file mode 100644
index 0000000..5bd39e7
--- /dev/null
+++ b/node_modules/then-request/README.md
@@ -0,0 +1,82 @@
+# then-request
+
+A request library that returns promises, inspired by request
+
+[![Build Status](https://img.shields.io/travis/then/then-request/master.svg)](https://travis-ci.org/then/then-request)
+[![Dependency Status](https://img.shields.io/david/then/then-request.svg)](https://david-dm.org/then/then-request)
+[![NPM version](https://img.shields.io/npm/v/then-request.svg)](https://www.npmjs.org/package/then-request)
+
+## Installation
+
+ npm install then-request
+
+## Usage
+
+`request(method, url, options, callback?)`
+
+e.g.
+
+```js
+var request = require('then-request');
+
+request('GET', 'http://example.com').done(function (res) {
+ console.log(res.getBody());
+});
+```
+
+**Method:**
+
+An HTTP method (e.g. `GET`, `POST`, `PUT`, `DELETE` or `HEAD`). It is not case sensitive.
+
+**URL:**
+
+A url as a string (e.g. `http://example.com`). Relative URLs are allowed in the browser.
+
+**Options:**
+
+ - `qs` - an object containing querystring values to be appended to the uri
+ - `headers` - http headers (default: `{}`)
+ - `body` - body for PATCH, POST and PUT requests. Must be a `Buffer` or `String` (only strings are accepted client side)
+ - `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json`. Does not have any affect on how the response is treated.
+ - `cache` - only used in node.js (browsers already have their own caches) Can be `'memory'`, `'file'` or your own custom implementaton (see https://github.com/ForbesLindesay/http-basic#implementing-a-cache).
+ - `followRedirects` - defaults to `true` but can be explicitly set to `false` on node.js to prevent then-request following redirects automatically.
+ - `maxRedirects` - sets the maximum number of redirects to follow before erroring on node.js (default: `Infinity`)
+ - `gzip` - defaults to `true` but can be explicitly set to `false` on node.js to prevent then-request automatically supporting the gzip encoding on responses.
+ - `timeout` (default: `false`) - times out if no response is returned within the given number of milliseconds.
+ - `socketTimeout` (default: `false`) - calls `req.setTimeout` internally which causes the request to timeout if no new data is seen for the given number of milliseconds. This option is ignored in the browser.
+ - `retry` (default: `false`) - retry GET requests. Set this to `true` to retry when the request errors or returns a status code greater than or equal to 400 (can also be a function that takes `(err, req, attemptNo) => shouldRetry`)
+ - `retryDelay` (default: `200`) - the delay between retries (can also be set to a function that takes `(err, res, attemptNo) => delay`)
+ - `maxRetries` (default: `5`) - the number of times to retry before giving up.
+
+
+**Callback / Returns:**
+
+If a callback is provided it is called with `err` and `res`. If no callback is provided, a [Promise](https://www.promisejs.org/) is returned that eventually resolves to `res`. The resulting Promise also has an additional `.getBody(encoding?)` method that is equivallent to calling `.then(function (res) { return res.getBody(encoding?); })`.
+
+### Response
+
+Note that even for status codes that represent an error, the promise will be resolved as the request succeeded. You can call `getBody` if you want to error on invalid status codes. The response has the following properties:
+
+ - `statusCode` - a number representing the HTTP status code
+ - `headers` - http response headers
+ - `body` - a string if in the browser or a buffer if on the server
+ - `url` - the URL that was requested (in the case of redirects on the server, this is the final url that was requested)
+
+It also has a method `getBody(encoding?)` which looks like:
+
+```js
+function getBody(encoding) {
+ if (this.statusCode >= 300) {
+ var err = new Error('Server responded with status code ' + this.statusCode + ':\n' + this.body.toString(encoding));
+ err.statusCode = this.statusCode;
+ err.headers = this.headers;
+ err.body = this.body;
+ throw err;
+ }
+ return encoding ? this.body.toString(encoding) : this.body;
+}
+```
+
+## License
+
+ MIT
diff --git a/node_modules/then-request/browser.js b/node_modules/then-request/browser.js
new file mode 100644
index 0000000..a2b605a
--- /dev/null
+++ b/node_modules/then-request/browser.js
@@ -0,0 +1,127 @@
+'use strict';
+
+var Promise = require('promise');
+var Response = require('http-response-object');
+var handleQs = require('./lib/handle-qs.js');
+
+module.exports = doRequest;
+function doRequest(method, url, options, callback) {
+ var result = new Promise(function (resolve, reject) {
+ var xhr = new window.XMLHttpRequest();
+
+ // check types of arguments
+
+ if (typeof method !== 'string') {
+ throw new TypeError('The method must be a string.');
+ }
+ if (typeof url !== 'string') {
+ throw new TypeError('The URL/path must be a string.');
+ }
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ }
+ if (options === null || options === undefined) {
+ options = {};
+ }
+ if (typeof options !== 'object') {
+ throw new TypeError('Options must be an object (or null).');
+ }
+ if (typeof callback !== 'function') {
+ callback = undefined;
+ }
+
+ method = method.toUpperCase();
+ options.headers = options.headers || {};
+
+
+ function attempt(n) {
+ doRequest(method, url, {
+ qs: options.qs,
+ headers: options.headers,
+ timeout: options.timeout
+ }).nodeify(function (err, res) {
+ var retry = err || res.statusCode >= 400;
+ if (typeof options.retry === 'function') {
+ retry = options.retry(err, res, n + 1);
+ }
+ if (n >= (options.maxRetries | 5)) {
+ retry = false;
+ }
+ if (retry) {
+ var delay = options.retryDelay;
+ if (typeof options.retryDelay === 'function') {
+ delay = options.retryDelay(err, res, n + 1);
+ }
+ delay = delay || 200;
+ setTimeout(function () {
+ attempt(n + 1);
+ }, delay);
+ } else {
+ if (err) reject(err);
+ else resolve(res);
+ }
+ });
+ }
+ if (options.retry && method === 'GET') {
+ return attempt(0);
+ }
+
+ // handle cross domain
+
+ var match;
+ var crossDomain = !!((match = /^([\w-]+:)?\/\/([^\/]+)/.exec(url)) && (match[2] != window.location.host));
+ if (!crossDomain) options.headers['X-Requested-With'] = 'XMLHttpRequest';
+
+ // handle query string
+ if (options.qs) {
+ url = handleQs(url, options.qs);
+ }
+
+ // handle json body
+ if (options.json) {
+ options.body = JSON.stringify(options.json);
+ options.headers['Content-Type'] = 'application/json';
+ }
+
+ if (options.timeout) {
+ xhr.timeout = options.timeout;
+ var start = Date.now();
+ xhr.ontimeout = function () {
+ var duration = Date.now() - start;
+ var err = new Error('Request timed out after ' + duration + 'ms');
+ err.timeout = true;
+ err.duration = duration;
+ reject(err);
+ };
+ }
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4) {
+ var headers = {};
+ xhr.getAllResponseHeaders().split('\r\n').forEach(function (header) {
+ var h = header.split(':');
+ if (h.length > 1) {
+ headers[h[0].toLowerCase()] = h.slice(1).join(':').trim();
+ }
+ });
+ var res = new Response(xhr.status, headers, xhr.responseText);
+ res.url = url;
+ resolve(res);
+ }
+ };
+
+ // method, url, async
+ xhr.open(method, url, true);
+
+ for (var name in options.headers) {
+ xhr.setRequestHeader(name, options.headers[name]);
+ }
+
+ // avoid sending empty string (#319)
+ xhr.send(options.body ? options.body : null);
+ });
+ result.getBody = function () {
+ return result.then(function (res) { return res.getBody(); });
+ };
+ return result.nodeify(callback);
+}
diff --git a/node_modules/then-request/dist/request.js b/node_modules/then-request/dist/request.js
new file mode 100644
index 0000000..75404a6
--- /dev/null
+++ b/node_modules/then-request/dist/request.js
@@ -0,0 +1,1538 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.request=e()}}(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+'use strict';
+
+var Promise = require('promise');
+var Response = require('http-response-object');
+var handleQs = require('./lib/handle-qs.js');
+
+module.exports = doRequest;
+function doRequest(method, url, options, callback) {
+ var result = new Promise(function (resolve, reject) {
+ var xhr = new window.XMLHttpRequest();
+
+ // check types of arguments
+
+ if (typeof method !== 'string') {
+ throw new TypeError('The method must be a string.');
+ }
+ if (typeof url !== 'string') {
+ throw new TypeError('The URL/path must be a string.');
+ }
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ }
+ if (options === null || options === undefined) {
+ options = {};
+ }
+ if (typeof options !== 'object') {
+ throw new TypeError('Options must be an object (or null).');
+ }
+ if (typeof callback !== 'function') {
+ callback = undefined;
+ }
+
+ method = method.toUpperCase();
+ options.headers = options.headers || {};
+
+
+ function attempt(n) {
+ doRequest(method, url, {
+ qs: options.qs,
+ headers: options.headers,
+ timeout: options.timeout
+ }).nodeify(function (err, res) {
+ var retry = err || res.statusCode >= 400;
+ if (typeof options.retry === 'function') {
+ retry = options.retry(err, res, n + 1);
+ }
+ if (n >= (options.maxRetries | 5)) {
+ retry = false;
+ }
+ if (retry) {
+ var delay = options.retryDelay;
+ if (typeof options.retryDelay === 'function') {
+ delay = options.retryDelay(err, res, n + 1);
+ }
+ delay = delay || 200;
+ setTimeout(function () {
+ attempt(n + 1);
+ }, delay);
+ } else {
+ if (err) reject(err);
+ else resolve(res);
+ }
+ });
+ }
+ if (options.retry && method === 'GET') {
+ return attempt(0);
+ }
+
+ // handle cross domain
+
+ var match;
+ var crossDomain = !!((match = /^([\w-]+:)?\/\/([^\/]+)/.exec(url)) && (match[2] != window.location.host));
+ if (!crossDomain) options.headers['X-Requested-With'] = 'XMLHttpRequest';
+
+ // handle query string
+ if (options.qs) {
+ url = handleQs(url, options.qs);
+ }
+
+ // handle json body
+ if (options.json) {
+ options.body = JSON.stringify(options.json);
+ options.headers['Content-Type'] = 'application/json';
+ }
+
+ if (options.timeout) {
+ xhr.timeout = options.timeout;
+ var start = Date.now();
+ xhr.ontimeout = function () {
+ var duration = Date.now() - start;
+ var err = new Error('Request timed out after ' + duration + 'ms');
+ err.timeout = true;
+ err.duration = duration;
+ reject(err);
+ };
+ }
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === 4) {
+ var headers = {};
+ xhr.getAllResponseHeaders().split('\r\n').forEach(function (header) {
+ var h = header.split(':');
+ if (h.length > 1) {
+ headers[h[0].toLowerCase()] = h.slice(1).join(':').trim();
+ }
+ });
+ var res = new Response(xhr.status, headers, xhr.responseText);
+ res.url = url;
+ resolve(res);
+ }
+ };
+
+ // method, url, async
+ xhr.open(method, url, true);
+
+ for (var name in options.headers) {
+ xhr.setRequestHeader(name, options.headers[name]);
+ }
+
+ // avoid sending empty string (#319)
+ xhr.send(options.body ? options.body : null);
+ });
+ result.getBody = function () {
+ return result.then(function (res) { return res.getBody(); });
+ };
+ return result.nodeify(callback);
+}
+
+},{"./lib/handle-qs.js":2,"http-response-object":3,"promise":4}],2:[function(require,module,exports){
+'use strict';
+
+var parse = require('qs').parse;
+var stringify = require('qs').stringify;
+
+module.exports = handleQs;
+function handleQs(url, query) {
+ url = url.split('?');
+ var start = url[0];
+ var qs = (url[1] || '').split('#')[0];
+ var end = url[1] && url[1].split('#').length > 1 ? '#' + url[1].split('#')[1] : '';
+
+ var baseQs = parse(qs);
+ for (var i in query) {
+ baseQs[i] = query[i];
+ }
+ qs = stringify(baseQs);
+ if (qs !== '') {
+ qs = '?' + qs;
+ }
+ return start + qs + end;
+}
+
+},{"qs":14}],3:[function(require,module,exports){
+'use strict';
+
+module.exports = Response;
+
+/**
+ * A response from a web request
+ *
+ * @param {Number} statusCode
+ * @param {Object} headers
+ * @param {Buffer} body
+ * @param {String} url
+ */
+function Response(statusCode, headers, body, url) {
+ if (typeof statusCode !== 'number') {
+ throw new TypeError('statusCode must be a number but was ' + (typeof statusCode));
+ }
+ if (headers === null) {
+ throw new TypeError('headers cannot be null');
+ }
+ if (typeof headers !== 'object') {
+ throw new TypeError('headers must be an object but was ' + (typeof headers));
+ }
+ this.statusCode = statusCode;
+ this.headers = {};
+ for (var key in headers) {
+ this.headers[key.toLowerCase()] = headers[key];
+ }
+ this.body = body;
+ this.url = url;
+}
+
+Response.prototype.getBody = function (encoding) {
+ if (this.statusCode >= 300) {
+ var err = new Error('Server responded with status code '
+ + this.statusCode + ':\n' + this.body.toString());
+ err.statusCode = this.statusCode;
+ err.headers = this.headers;
+ err.body = this.body;
+ err.url = this.url;
+ throw err;
+ }
+ return encoding ? this.body.toString(encoding) : this.body;
+};
+
+},{}],4:[function(require,module,exports){
+'use strict';
+
+module.exports = require('./lib')
+
+},{"./lib":9}],5:[function(require,module,exports){
+'use strict';
+
+var asap = require('asap/raw');
+
+function noop() {}
+
+// States:
+//
+// 0 - pending
+// 1 - fulfilled with _value
+// 2 - rejected with _value
+// 3 - adopted the state of another promise, _value
+//
+// once the state is no longer pending (0) it is immutable
+
+// All `_` prefixed properties will be reduced to `_{random number}`
+// at build time to obfuscate them and discourage their use.
+// We don't use symbols or Object.defineProperty to fully hide them
+// because the performance isn't good enough.
+
+
+// to avoid using try/catch inside critical functions, we
+// extract them to here.
+var LAST_ERROR = null;
+var IS_ERROR = {};
+function getThen(obj) {
+ try {
+ return obj.then;
+ } catch (ex) {
+ LAST_ERROR = ex;
+ return IS_ERROR;
+ }
+}
+
+function tryCallOne(fn, a) {
+ try {
+ return fn(a);
+ } catch (ex) {
+ LAST_ERROR = ex;
+ return IS_ERROR;
+ }
+}
+function tryCallTwo(fn, a, b) {
+ try {
+ fn(a, b);
+ } catch (ex) {
+ LAST_ERROR = ex;
+ return IS_ERROR;
+ }
+}
+
+module.exports = Promise;
+
+function Promise(fn) {
+ if (typeof this !== 'object') {
+ throw new TypeError('Promises must be constructed via new');
+ }
+ if (typeof fn !== 'function') {
+ throw new TypeError('not a function');
+ }
+ this._45 = 0;
+ this._81 = 0;
+ this._65 = null;
+ this._54 = null;
+ if (fn === noop) return;
+ doResolve(fn, this);
+}
+Promise._10 = null;
+Promise._97 = null;
+Promise._61 = noop;
+
+Promise.prototype.then = function(onFulfilled, onRejected) {
+ if (this.constructor !== Promise) {
+ return safeThen(this, onFulfilled, onRejected);
+ }
+ var res = new Promise(noop);
+ handle(this, new Handler(onFulfilled, onRejected, res));
+ return res;
+};
+
+function safeThen(self, onFulfilled, onRejected) {
+ return new self.constructor(function (resolve, reject) {
+ var res = new Promise(noop);
+ res.then(resolve, reject);
+ handle(self, new Handler(onFulfilled, onRejected, res));
+ });
+};
+function handle(self, deferred) {
+ while (self._81 === 3) {
+ self = self._65;
+ }
+ if (Promise._10) {
+ Promise._10(self);
+ }
+ if (self._81 === 0) {
+ if (self._45 === 0) {
+ self._45 = 1;
+ self._54 = deferred;
+ return;
+ }
+ if (self._45 === 1) {
+ self._45 = 2;
+ self._54 = [self._54, deferred];
+ return;
+ }
+ self._54.push(deferred);
+ return;
+ }
+ handleResolved(self, deferred);
+}
+
+function handleResolved(self, deferred) {
+ asap(function() {
+ var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;
+ if (cb === null) {
+ if (self._81 === 1) {
+ resolve(deferred.promise, self._65);
+ } else {
+ reject(deferred.promise, self._65);
+ }
+ return;
+ }
+ var ret = tryCallOne(cb, self._65);
+ if (ret === IS_ERROR) {
+ reject(deferred.promise, LAST_ERROR);
+ } else {
+ resolve(deferred.promise, ret);
+ }
+ });
+}
+function resolve(self, newValue) {
+ // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
+ if (newValue === self) {
+ return reject(
+ self,
+ new TypeError('A promise cannot be resolved with itself.')
+ );
+ }
+ if (
+ newValue &&
+ (typeof newValue === 'object' || typeof newValue === 'function')
+ ) {
+ var then = getThen(newValue);
+ if (then === IS_ERROR) {
+ return reject(self, LAST_ERROR);
+ }
+ if (
+ then === self.then &&
+ newValue instanceof Promise
+ ) {
+ self._81 = 3;
+ self._65 = newValue;
+ finale(self);
+ return;
+ } else if (typeof then === 'function') {
+ doResolve(then.bind(newValue), self);
+ return;
+ }
+ }
+ self._81 = 1;
+ self._65 = newValue;
+ finale(self);
+}
+
+function reject(self, newValue) {
+ self._81 = 2;
+ self._65 = newValue;
+ if (Promise._97) {
+ Promise._97(self, newValue);
+ }
+ finale(self);
+}
+function finale(self) {
+ if (self._45 === 1) {
+ handle(self, self._54);
+ self._54 = null;
+ }
+ if (self._45 === 2) {
+ for (var i = 0; i < self._54.length; i++) {
+ handle(self, self._54[i]);
+ }
+ self._54 = null;
+ }
+}
+
+function Handler(onFulfilled, onRejected, promise){
+ this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
+ this.onRejected = typeof onRejected === 'function' ? onRejected : null;
+ this.promise = promise;
+}
+
+/**
+ * Take a potentially misbehaving resolver function and make sure
+ * onFulfilled and onRejected are only called once.
+ *
+ * Makes no guarantees about asynchrony.
+ */
+function doResolve(fn, promise) {
+ var done = false;
+ var res = tryCallTwo(fn, function (value) {
+ if (done) return;
+ done = true;
+ resolve(promise, value);
+ }, function (reason) {
+ if (done) return;
+ done = true;
+ reject(promise, reason);
+ })
+ if (!done && res === IS_ERROR) {
+ done = true;
+ reject(promise, LAST_ERROR);
+ }
+}
+
+},{"asap/raw":13}],6:[function(require,module,exports){
+'use strict';
+
+var Promise = require('./core.js');
+
+module.exports = Promise;
+Promise.prototype.done = function (onFulfilled, onRejected) {
+ var self = arguments.length ? this.then.apply(this, arguments) : this;
+ self.then(null, function (err) {
+ setTimeout(function () {
+ throw err;
+ }, 0);
+ });
+};
+
+},{"./core.js":5}],7:[function(require,module,exports){
+'use strict';
+
+//This file contains the ES6 extensions to the core Promises/A+ API
+
+var Promise = require('./core.js');
+
+module.exports = Promise;
+
+/* Static Functions */
+
+var TRUE = valuePromise(true);
+var FALSE = valuePromise(false);
+var NULL = valuePromise(null);
+var UNDEFINED = valuePromise(undefined);
+var ZERO = valuePromise(0);
+var EMPTYSTRING = valuePromise('');
+
+function valuePromise(value) {
+ var p = new Promise(Promise._61);
+ p._81 = 1;
+ p._65 = value;
+ return p;
+}
+Promise.resolve = function (value) {
+ if (value instanceof Promise) return value;
+
+ if (value === null) return NULL;
+ if (value === undefined) return UNDEFINED;
+ if (value === true) return TRUE;
+ if (value === false) return FALSE;
+ if (value === 0) return ZERO;
+ if (value === '') return EMPTYSTRING;
+
+ if (typeof value === 'object' || typeof value === 'function') {
+ try {
+ var then = value.then;
+ if (typeof then === 'function') {
+ return new Promise(then.bind(value));
+ }
+ } catch (ex) {
+ return new Promise(function (resolve, reject) {
+ reject(ex);
+ });
+ }
+ }
+ return valuePromise(value);
+};
+
+Promise.all = function (arr) {
+ var args = Array.prototype.slice.call(arr);
+
+ return new Promise(function (resolve, reject) {
+ if (args.length === 0) return resolve([]);
+ var remaining = args.length;
+ function res(i, val) {
+ if (val && (typeof val === 'object' || typeof val === 'function')) {
+ if (val instanceof Promise && val.then === Promise.prototype.then) {
+ while (val._81 === 3) {
+ val = val._65;
+ }
+ if (val._81 === 1) return res(i, val._65);
+ if (val._81 === 2) reject(val._65);
+ val.then(function (val) {
+ res(i, val);
+ }, reject);
+ return;
+ } else {
+ var then = val.then;
+ if (typeof then === 'function') {
+ var p = new Promise(then.bind(val));
+ p.then(function (val) {
+ res(i, val);
+ }, reject);
+ return;
+ }
+ }
+ }
+ args[i] = val;
+ if (--remaining === 0) {
+ resolve(args);
+ }
+ }
+ for (var i = 0; i < args.length; i++) {
+ res(i, args[i]);
+ }
+ });
+};
+
+Promise.reject = function (value) {
+ return new Promise(function (resolve, reject) {
+ reject(value);
+ });
+};
+
+Promise.race = function (values) {
+ return new Promise(function (resolve, reject) {
+ values.forEach(function(value){
+ Promise.resolve(value).then(resolve, reject);
+ });
+ });
+};
+
+/* Prototype Methods */
+
+Promise.prototype['catch'] = function (onRejected) {
+ return this.then(null, onRejected);
+};
+
+},{"./core.js":5}],8:[function(require,module,exports){
+'use strict';
+
+var Promise = require('./core.js');
+
+module.exports = Promise;
+Promise.prototype['finally'] = function (f) {
+ return this.then(function (value) {
+ return Promise.resolve(f()).then(function () {
+ return value;
+ });
+ }, function (err) {
+ return Promise.resolve(f()).then(function () {
+ throw err;
+ });
+ });
+};
+
+},{"./core.js":5}],9:[function(require,module,exports){
+'use strict';
+
+module.exports = require('./core.js');
+require('./done.js');
+require('./finally.js');
+require('./es6-extensions.js');
+require('./node-extensions.js');
+require('./synchronous.js');
+
+},{"./core.js":5,"./done.js":6,"./es6-extensions.js":7,"./finally.js":8,"./node-extensions.js":10,"./synchronous.js":11}],10:[function(require,module,exports){
+'use strict';
+
+// This file contains then/promise specific extensions that are only useful
+// for node.js interop
+
+var Promise = require('./core.js');
+var asap = require('asap');
+
+module.exports = Promise;
+
+/* Static Functions */
+
+Promise.denodeify = function (fn, argumentCount) {
+ if (
+ typeof argumentCount === 'number' && argumentCount !== Infinity
+ ) {
+ return denodeifyWithCount(fn, argumentCount);
+ } else {
+ return denodeifyWithoutCount(fn);
+ }
+}
+
+var callbackFn = (
+ 'function (err, res) {' +
+ 'if (err) { rj(err); } else { rs(res); }' +
+ '}'
+);
+function denodeifyWithCount(fn, argumentCount) {
+ var args = [];
+ for (var i = 0; i < argumentCount; i++) {
+ args.push('a' + i);
+ }
+ var body = [
+ 'return function (' + args.join(',') + ') {',
+ 'var self = this;',
+ 'return new Promise(function (rs, rj) {',
+ 'var res = fn.call(',
+ ['self'].concat(args).concat([callbackFn]).join(','),
+ ');',
+ 'if (res &&',
+ '(typeof res === "object" || typeof res === "function") &&',
+ 'typeof res.then === "function"',
+ ') {rs(res);}',
+ '});',
+ '};'
+ ].join('');
+ return Function(['Promise', 'fn'], body)(Promise, fn);
+}
+function denodeifyWithoutCount(fn) {
+ var fnLength = Math.max(fn.length - 1, 3);
+ var args = [];
+ for (var i = 0; i < fnLength; i++) {
+ args.push('a' + i);
+ }
+ var body = [
+ 'return function (' + args.join(',') + ') {',
+ 'var self = this;',
+ 'var args;',
+ 'var argLength = arguments.length;',
+ 'if (arguments.length > ' + fnLength + ') {',
+ 'args = new Array(arguments.length + 1);',
+ 'for (var i = 0; i < arguments.length; i++) {',
+ 'args[i] = arguments[i];',
+ '}',
+ '}',
+ 'return new Promise(function (rs, rj) {',
+ 'var cb = ' + callbackFn + ';',
+ 'var res;',
+ 'switch (argLength) {',
+ args.concat(['extra']).map(function (_, index) {
+ return (
+ 'case ' + (index) + ':' +
+ 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +
+ 'break;'
+ );
+ }).join(''),
+ 'default:',
+ 'args[argLength] = cb;',
+ 'res = fn.apply(self, args);',
+ '}',
+
+ 'if (res &&',
+ '(typeof res === "object" || typeof res === "function") &&',
+ 'typeof res.then === "function"',
+ ') {rs(res);}',
+ '});',
+ '};'
+ ].join('');
+
+ return Function(
+ ['Promise', 'fn'],
+ body
+ )(Promise, fn);
+}
+
+Promise.nodeify = function (fn) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ var callback =
+ typeof args[args.length - 1] === 'function' ? args.pop() : null;
+ var ctx = this;
+ try {
+ return fn.apply(this, arguments).nodeify(callback, ctx);
+ } catch (ex) {
+ if (callback === null || typeof callback == 'undefined') {
+ return new Promise(function (resolve, reject) {
+ reject(ex);
+ });
+ } else {
+ asap(function () {
+ callback.call(ctx, ex);
+ })
+ }
+ }
+ }
+}
+
+Promise.prototype.nodeify = function (callback, ctx) {
+ if (typeof callback != 'function') return this;
+
+ this.then(function (value) {
+ asap(function () {
+ callback.call(ctx, null, value);
+ });
+ }, function (err) {
+ asap(function () {
+ callback.call(ctx, err);
+ });
+ });
+}
+
+},{"./core.js":5,"asap":12}],11:[function(require,module,exports){
+'use strict';
+
+var Promise = require('./core.js');
+
+module.exports = Promise;
+Promise.enableSynchronous = function () {
+ Promise.prototype.isPending = function() {
+ return this.getState() == 0;
+ };
+
+ Promise.prototype.isFulfilled = function() {
+ return this.getState() == 1;
+ };
+
+ Promise.prototype.isRejected = function() {
+ return this.getState() == 2;
+ };
+
+ Promise.prototype.getValue = function () {
+ if (this._81 === 3) {
+ return this._65.getValue();
+ }
+
+ if (!this.isFulfilled()) {
+ throw new Error('Cannot get a value of an unfulfilled promise.');
+ }
+
+ return this._65;
+ };
+
+ Promise.prototype.getReason = function () {
+ if (this._81 === 3) {
+ return this._65.getReason();
+ }
+
+ if (!this.isRejected()) {
+ throw new Error('Cannot get a rejection reason of a non-rejected promise.');
+ }
+
+ return this._65;
+ };
+
+ Promise.prototype.getState = function () {
+ if (this._81 === 3) {
+ return this._65.getState();
+ }
+ if (this._81 === -1 || this._81 === -2) {
+ return 0;
+ }
+
+ return this._81;
+ };
+};
+
+Promise.disableSynchronous = function() {
+ Promise.prototype.isPending = undefined;
+ Promise.prototype.isFulfilled = undefined;
+ Promise.prototype.isRejected = undefined;
+ Promise.prototype.getValue = undefined;
+ Promise.prototype.getReason = undefined;
+ Promise.prototype.getState = undefined;
+};
+
+},{"./core.js":5}],12:[function(require,module,exports){
+"use strict";
+
+// rawAsap provides everything we need except exception management.
+var rawAsap = require("./raw");
+// RawTasks are recycled to reduce GC churn.
+var freeTasks = [];
+// We queue errors to ensure they are thrown in right order (FIFO).
+// Array-as-queue is good enough here, since we are just dealing with exceptions.
+var pendingErrors = [];
+var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
+
+function throwFirstError() {
+ if (pendingErrors.length) {
+ throw pendingErrors.shift();
+ }
+}
+
+/**
+ * Calls a task as soon as possible after returning, in its own event, with priority
+ * over other events like animation, reflow, and repaint. An error thrown from an
+ * event will not interrupt, nor even substantially slow down the processing of
+ * other events, but will be rather postponed to a lower priority event.
+ * @param {{call}} task A callable object, typically a function that takes no
+ * arguments.
+ */
+module.exports = asap;
+function asap(task) {
+ var rawTask;
+ if (freeTasks.length) {
+ rawTask = freeTasks.pop();
+ } else {
+ rawTask = new RawTask();
+ }
+ rawTask.task = task;
+ rawAsap(rawTask);
+}
+
+// We wrap tasks with recyclable task objects. A task object implements
+// `call`, just like a function.
+function RawTask() {
+ this.task = null;
+}
+
+// The sole purpose of wrapping the task is to catch the exception and recycle
+// the task object after its single use.
+RawTask.prototype.call = function () {
+ try {
+ this.task.call();
+ } catch (error) {
+ if (asap.onerror) {
+ // This hook exists purely for testing purposes.
+ // Its name will be periodically randomized to break any code that
+ // depends on its existence.
+ asap.onerror(error);
+ } else {
+ // In a web browser, exceptions are not fatal. However, to avoid
+ // slowing down the queue of pending tasks, we rethrow the error in a
+ // lower priority turn.
+ pendingErrors.push(error);
+ requestErrorThrow();
+ }
+ } finally {
+ this.task = null;
+ freeTasks[freeTasks.length] = this;
+ }
+};
+
+},{"./raw":13}],13:[function(require,module,exports){
+(function (global){
+"use strict";
+
+// Use the fastest means possible to execute a task in its own turn, with
+// priority over other events including IO, animation, reflow, and redraw
+// events in browsers.
+//
+// An exception thrown by a task will permanently interrupt the processing of
+// subsequent tasks. The higher level `asap` function ensures that if an
+// exception is thrown by a task, that the task queue will continue flushing as
+// soon as possible, but if you use `rawAsap` directly, you are responsible to
+// either ensure that no exceptions are thrown from your task, or to manually
+// call `rawAsap.requestFlush` if an exception is thrown.
+module.exports = rawAsap;
+function rawAsap(task) {
+ if (!queue.length) {
+ requestFlush();
+ flushing = true;
+ }
+ // Equivalent to push, but avoids a function call.
+ queue[queue.length] = task;
+}
+
+var queue = [];
+// Once a flush has been requested, no further calls to `requestFlush` are
+// necessary until the next `flush` completes.
+var flushing = false;
+// `requestFlush` is an implementation-specific method that attempts to kick
+// off a `flush` event as quickly as possible. `flush` will attempt to exhaust
+// the event queue before yielding to the browser's own event loop.
+var requestFlush;
+// The position of the next task to execute in the task queue. This is
+// preserved between calls to `flush` so that it can be resumed if
+// a task throws an exception.
+var index = 0;
+// If a task schedules additional tasks recursively, the task queue can grow
+// unbounded. To prevent memory exhaustion, the task queue will periodically
+// truncate already-completed tasks.
+var capacity = 1024;
+
+// The flush function processes all tasks that have been scheduled with
+// `rawAsap` unless and until one of those tasks throws an exception.
+// If a task throws an exception, `flush` ensures that its state will remain
+// consistent and will resume where it left off when called again.
+// However, `flush` does not make any arrangements to be called again if an
+// exception is thrown.
+function flush() {
+ while (index < queue.length) {
+ var currentIndex = index;
+ // Advance the index before calling the task. This ensures that we will
+ // begin flushing on the next task the task throws an error.
+ index = index + 1;
+ queue[currentIndex].call();
+ // Prevent leaking memory for long chains of recursive calls to `asap`.
+ // If we call `asap` within tasks scheduled by `asap`, the queue will
+ // grow, but to avoid an O(n) walk for every task we execute, we don't
+ // shift tasks off the queue after they have been executed.
+ // Instead, we periodically shift 1024 tasks off the queue.
+ if (index > capacity) {
+ // Manually shift all values starting at the index back to the
+ // beginning of the queue.
+ for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
+ queue[scan] = queue[scan + index];
+ }
+ queue.length -= index;
+ index = 0;
+ }
+ }
+ queue.length = 0;
+ index = 0;
+ flushing = false;
+}
+
+// `requestFlush` is implemented using a strategy based on data collected from
+// every available SauceLabs Selenium web driver worker at time of writing.
+// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
+
+// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
+// have WebKitMutationObserver but not un-prefixed MutationObserver.
+// Must use `global` instead of `window` to work in both frames and web
+// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
+var BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;
+
+// MutationObservers are desirable because they have high priority and work
+// reliably everywhere they are implemented.
+// They are implemented in all modern browsers.
+//
+// - Android 4-4.3
+// - Chrome 26-34
+// - Firefox 14-29
+// - Internet Explorer 11
+// - iPad Safari 6-7.1
+// - iPhone Safari 7-7.1
+// - Safari 6-7
+if (typeof BrowserMutationObserver === "function") {
+ requestFlush = makeRequestCallFromMutationObserver(flush);
+
+// MessageChannels are desirable because they give direct access to the HTML
+// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
+// 11-12, and in web workers in many engines.
+// Although message channels yield to any queued rendering and IO tasks, they
+// would be better than imposing the 4ms delay of timers.
+// However, they do not work reliably in Internet Explorer or Safari.
+
+// Internet Explorer 10 is the only browser that has setImmediate but does
+// not have MutationObservers.
+// Although setImmediate yields to the browser's renderer, it would be
+// preferrable to falling back to setTimeout since it does not have
+// the minimum 4ms penalty.
+// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
+// Desktop to a lesser extent) that renders both setImmediate and
+// MessageChannel useless for the purposes of ASAP.
+// https://github.com/kriskowal/q/issues/396
+
+// Timers are implemented universally.
+// We fall back to timers in workers in most engines, and in foreground
+// contexts in the following browsers.
+// However, note that even this simple case requires nuances to operate in a
+// broad spectrum of browsers.
+//
+// - Firefox 3-13
+// - Internet Explorer 6-9
+// - iPad Safari 4.3
+// - Lynx 2.8.7
+} else {
+ requestFlush = makeRequestCallFromTimer(flush);
+}
+
+// `requestFlush` requests that the high priority event queue be flushed as
+// soon as possible.
+// This is useful to prevent an error thrown in a task from stalling the event
+// queue if the exception handled by Node.js’s
+// `process.on("uncaughtException")` or by a domain.
+rawAsap.requestFlush = requestFlush;
+
+// To request a high priority event, we induce a mutation observer by toggling
+// the text of a text node between "1" and "-1".
+function makeRequestCallFromMutationObserver(callback) {
+ var toggle = 1;
+ var observer = new BrowserMutationObserver(callback);
+ var node = document.createTextNode("");
+ observer.observe(node, {characterData: true});
+ return function requestCall() {
+ toggle = -toggle;
+ node.data = toggle;
+ };
+}
+
+// The message channel technique was discovered by Malte Ubl and was the
+// original foundation for this library.
+// http://www.nonblocking.io/2011/06/windownexttick.html
+
+// Safari 6.0.5 (at least) intermittently fails to create message ports on a
+// page's first load. Thankfully, this version of Safari supports
+// MutationObservers, so we don't need to fall back in that case.
+
+// function makeRequestCallFromMessageChannel(callback) {
+// var channel = new MessageChannel();
+// channel.port1.onmessage = callback;
+// return function requestCall() {
+// channel.port2.postMessage(0);
+// };
+// }
+
+// For reasons explained above, we are also unable to use `setImmediate`
+// under any circumstances.
+// Even if we were, there is another bug in Internet Explorer 10.
+// It is not sufficient to assign `setImmediate` to `requestFlush` because
+// `setImmediate` must be called *by name* and therefore must be wrapped in a
+// closure.
+// Never forget.
+
+// function makeRequestCallFromSetImmediate(callback) {
+// return function requestCall() {
+// setImmediate(callback);
+// };
+// }
+
+// Safari 6.0 has a problem where timers will get lost while the user is
+// scrolling. This problem does not impact ASAP because Safari 6.0 supports
+// mutation observers, so that implementation is used instead.
+// However, if we ever elect to use timers in Safari, the prevalent work-around
+// is to add a scroll event listener that calls for a flush.
+
+// `setTimeout` does not call the passed callback if the delay is less than
+// approximately 7 in web workers in Firefox 8 through 18, and sometimes not
+// even then.
+
+function makeRequestCallFromTimer(callback) {
+ return function requestCall() {
+ // We dispatch a timeout with a specified delay of 0 for engines that
+ // can reliably accommodate that request. This will usually be snapped
+ // to a 4 milisecond delay, but once we're flushing, there's no delay
+ // between events.
+ var timeoutHandle = setTimeout(handleTimer, 0);
+ // However, since this timer gets frequently dropped in Firefox
+ // workers, we enlist an interval handle that will try to fire
+ // an event 20 times per second until it succeeds.
+ var intervalHandle = setInterval(handleTimer, 50);
+
+ function handleTimer() {
+ // Whichever timer succeeds will cancel both timers and
+ // execute the callback.
+ clearTimeout(timeoutHandle);
+ clearInterval(intervalHandle);
+ callback();
+ }
+ };
+}
+
+// This is for `asap.js` only.
+// Its name will be periodically randomized to break any code that depends on
+// its existence.
+rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;
+
+// ASAP was originally a nextTick shim included in Q. This was factored out
+// into this ASAP package. It was later adapted to RSVP which made further
+// amendments. These decisions, particularly to marginalize MessageChannel and
+// to capture the MutationObserver implementation in a closure, were integrated
+// back into ASAP proper.
+// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9wcm9taXNlL25vZGVfbW9kdWxlcy9hc2FwL2Jyb3dzZXItcmF3LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QU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9ic2VydmVyIGltcGxlbWVudGF0aW9uIGluIGEgY2xvc3VyZSwgd2VyZSBpbnRlZ3JhdGVkXG4vLyBiYWNrIGludG8gQVNBUCBwcm9wZXIuXG4vLyBodHRwczovL2dpdGh1Yi5jb20vdGlsZGVpby9yc3ZwLmpzL2Jsb2IvY2RkZjcyMzI1NDZhOWNmODU4NTI0Yjc1Y2RlNmY5ZWRmNzI2MjBhNy9saWIvcnN2cC9hc2FwLmpzXG4iXX0=
+},{}],14:[function(require,module,exports){
+'use strict';
+
+var Stringify = require('./stringify');
+var Parse = require('./parse');
+
+module.exports = {
+ stringify: Stringify,
+ parse: Parse
+};
+
+},{"./parse":15,"./stringify":16}],15:[function(require,module,exports){
+'use strict';
+
+var Utils = require('./utils');
+
+var internals = {
+ delimiter: '&',
+ depth: 5,
+ arrayLimit: 20,
+ parameterLimit: 1000,
+ strictNullHandling: false,
+ plainObjects: false,
+ allowPrototypes: false,
+ allowDots: false
+};
+
+internals.parseValues = function (str, options) {
+ var obj = {};
+ var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);
+
+ for (var i = 0; i < parts.length; ++i) {
+ var part = parts[i];
+ var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
+
+ if (pos === -1) {
+ obj[Utils.decode(part)] = '';
+
+ if (options.strictNullHandling) {
+ obj[Utils.decode(part)] = null;
+ }
+ } else {
+ var key = Utils.decode(part.slice(0, pos));
+ var val = Utils.decode(part.slice(pos + 1));
+
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ obj[key] = [].concat(obj[key]).concat(val);
+ } else {
+ obj[key] = val;
+ }
+ }
+ }
+
+ return obj;
+};
+
+internals.parseObject = function (chain, val, options) {
+ if (!chain.length) {
+ return val;
+ }
+
+ var root = chain.shift();
+
+ var obj;
+ if (root === '[]') {
+ obj = [];
+ obj = obj.concat(internals.parseObject(chain, val, options));
+ } else {
+ obj = options.plainObjects ? Object.create(null) : {};
+ var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
+ var index = parseInt(cleanRoot, 10);
+ if (
+ !isNaN(index) &&
+ root !== cleanRoot &&
+ String(index) === cleanRoot &&
+ index >= 0 &&
+ (options.parseArrays && index <= options.arrayLimit)
+ ) {
+ obj = [];
+ obj[index] = internals.parseObject(chain, val, options);
+ } else {
+ obj[cleanRoot] = internals.parseObject(chain, val, options);
+ }
+ }
+
+ return obj;
+};
+
+internals.parseKeys = function (givenKey, val, options) {
+ if (!givenKey) {
+ return;
+ }
+
+ // Transform dot notation to bracket notation
+ var key = options.allowDots ? givenKey.replace(/\.([^\.\[]+)/g, '[$1]') : givenKey;
+
+ // The regex chunks
+
+ var parent = /^([^\[\]]*)/;
+ var child = /(\[[^\[\]]*\])/g;
+
+ // Get the parent
+
+ var segment = parent.exec(key);
+
+ // Stash the parent if it exists
+
+ var keys = [];
+ if (segment[1]) {
+ // If we aren't using plain objects, optionally prefix keys
+ // that would overwrite object prototype properties
+ if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {
+ if (!options.allowPrototypes) {
+ return;
+ }
+ }
+
+ keys.push(segment[1]);
+ }
+
+ // Loop through children appending to the array until we hit depth
+
+ var i = 0;
+ while ((segment = child.exec(key)) !== null && i < options.depth) {
+ i += 1;
+ if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
+ if (!options.allowPrototypes) {
+ continue;
+ }
+ }
+ keys.push(segment[1]);
+ }
+
+ // If there's a remainder, just add whatever is left
+
+ if (segment) {
+ keys.push('[' + key.slice(segment.index) + ']');
+ }
+
+ return internals.parseObject(keys, val, options);
+};
+
+module.exports = function (str, opts) {
+ var options = opts || {};
+ options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;
+ options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
+ options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
+ options.parseArrays = options.parseArrays !== false;
+ options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots;
+ options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects;
+ options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes;
+ options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
+ options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
+
+ if (
+ str === '' ||
+ str === null ||
+ typeof str === 'undefined'
+ ) {
+ return options.plainObjects ? Object.create(null) : {};
+ }
+
+ var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
+ var obj = options.plainObjects ? Object.create(null) : {};
+
+ // Iterate over the keys and setup the new object
+
+ var keys = Object.keys(tempObj);
+ for (var i = 0; i < keys.length; ++i) {
+ var key = keys[i];
+ var newObj = internals.parseKeys(key, tempObj[key], options);
+ obj = Utils.merge(obj, newObj, options);
+ }
+
+ return Utils.compact(obj);
+};
+
+},{"./utils":17}],16:[function(require,module,exports){
+'use strict';
+
+var Utils = require('./utils');
+
+var internals = {
+ delimiter: '&',
+ arrayPrefixGenerators: {
+ brackets: function (prefix) {
+ return prefix + '[]';
+ },
+ indices: function (prefix, key) {
+ return prefix + '[' + key + ']';
+ },
+ repeat: function (prefix) {
+ return prefix;
+ }
+ },
+ strictNullHandling: false,
+ skipNulls: false,
+ encode: true
+};
+
+internals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) {
+ var obj = object;
+ if (typeof filter === 'function') {
+ obj = filter(prefix, obj);
+ } else if (Utils.isBuffer(obj)) {
+ obj = String(obj);
+ } else if (obj instanceof Date) {
+ obj = obj.toISOString();
+ } else if (obj === null) {
+ if (strictNullHandling) {
+ return encode ? Utils.encode(prefix) : prefix;
+ }
+
+ obj = '';
+ }
+
+ if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {
+ if (encode) {
+ return [Utils.encode(prefix) + '=' + Utils.encode(obj)];
+ }
+ return [prefix + '=' + obj];
+ }
+
+ var values = [];
+
+ if (typeof obj === 'undefined') {
+ return values;
+ }
+
+ var objKeys;
+ if (Array.isArray(filter)) {
+ objKeys = filter;
+ } else {
+ var keys = Object.keys(obj);
+ objKeys = sort ? keys.sort(sort) : keys;
+ }
+
+ for (var i = 0; i < objKeys.length; ++i) {
+ var key = objKeys[i];
+
+ if (skipNulls && obj[key] === null) {
+ continue;
+ }
+
+ if (Array.isArray(obj)) {
+ values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
+ } else {
+ values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
+ }
+ }
+
+ return values;
+};
+
+module.exports = function (object, opts) {
+ var obj = object;
+ var options = opts || {};
+ var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;
+ var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
+ var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls;
+ var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode;
+ var sort = typeof options.sort === 'function' ? options.sort : null;
+ var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
+ var objKeys;
+ var filter;
+ if (typeof options.filter === 'function') {
+ filter = options.filter;
+ obj = filter('', obj);
+ } else if (Array.isArray(options.filter)) {
+ objKeys = filter = options.filter;
+ }
+
+ var keys = [];
+
+ if (typeof obj !== 'object' || obj === null) {
+ return '';
+ }
+
+ var arrayFormat;
+ if (options.arrayFormat in internals.arrayPrefixGenerators) {
+ arrayFormat = options.arrayFormat;
+ } else if ('indices' in options) {
+ arrayFormat = options.indices ? 'indices' : 'repeat';
+ } else {
+ arrayFormat = 'indices';
+ }
+
+ var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];
+
+ if (!objKeys) {
+ objKeys = Object.keys(obj);
+ }
+
+ if (sort) {
+ objKeys.sort(sort);
+ }
+
+ for (var i = 0; i < objKeys.length; ++i) {
+ var key = objKeys[i];
+
+ if (skipNulls && obj[key] === null) {
+ continue;
+ }
+
+ keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));
+ }
+
+ return keys.join(delimiter);
+};
+
+},{"./utils":17}],17:[function(require,module,exports){
+'use strict';
+
+var hexTable = (function () {
+ var array = new Array(256);
+ for (var i = 0; i < 256; ++i) {
+ array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
+ }
+
+ return array;
+}());
+
+exports.arrayToObject = function (source, options) {
+ var obj = options.plainObjects ? Object.create(null) : {};
+ for (var i = 0; i < source.length; ++i) {
+ if (typeof source[i] !== 'undefined') {
+ obj[i] = source[i];
+ }
+ }
+
+ return obj;
+};
+
+exports.merge = function (target, source, options) {
+ if (!source) {
+ return target;
+ }
+
+ if (typeof source !== 'object') {
+ if (Array.isArray(target)) {
+ target.push(source);
+ } else if (typeof target === 'object') {
+ target[source] = true;
+ } else {
+ return [target, source];
+ }
+
+ return target;
+ }
+
+ if (typeof target !== 'object') {
+ return [target].concat(source);
+ }
+
+ var mergeTarget = target;
+ if (Array.isArray(target) && !Array.isArray(source)) {
+ mergeTarget = exports.arrayToObject(target, options);
+ }
+
+ return Object.keys(source).reduce(function (acc, key) {
+ var value = source[key];
+
+ if (Object.prototype.hasOwnProperty.call(acc, key)) {
+ acc[key] = exports.merge(acc[key], value, options);
+ } else {
+ acc[key] = value;
+ }
+ return acc;
+ }, mergeTarget);
+};
+
+exports.decode = function (str) {
+ try {
+ return decodeURIComponent(str.replace(/\+/g, ' '));
+ } catch (e) {
+ return str;
+ }
+};
+
+exports.encode = function (str) {
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
+ // It has been adapted here for stricter adherence to RFC 3986
+ if (str.length === 0) {
+ return str;
+ }
+
+ var string = typeof str === 'string' ? str : String(str);
+
+ var out = '';
+ for (var i = 0; i < string.length; ++i) {
+ var c = string.charCodeAt(i);
+
+ if (
+ c === 0x2D || // -
+ c === 0x2E || // .
+ c === 0x5F || // _
+ c === 0x7E || // ~
+ (c >= 0x30 && c <= 0x39) || // 0-9
+ (c >= 0x41 && c <= 0x5A) || // a-z
+ (c >= 0x61 && c <= 0x7A) // A-Z
+ ) {
+ out += string.charAt(i);
+ continue;
+ }
+
+ if (c < 0x80) {
+ out = out + hexTable[c];
+ continue;
+ }
+
+ if (c < 0x800) {
+ out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
+ continue;
+ }
+
+ if (c < 0xD800 || c >= 0xE000) {
+ out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
+ continue;
+ }
+
+ i += 1;
+ c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
+ out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
+ }
+
+ return out;
+};
+
+exports.compact = function (obj, references) {
+ if (typeof obj !== 'object' || obj === null) {
+ return obj;
+ }
+
+ var refs = references || [];
+ var lookup = refs.indexOf(obj);
+ if (lookup !== -1) {
+ return refs[lookup];
+ }
+
+ refs.push(obj);
+
+ if (Array.isArray(obj)) {
+ var compacted = [];
+
+ for (var i = 0; i < obj.length; ++i) {
+ if (typeof obj[i] !== 'undefined') {
+ compacted.push(obj[i]);
+ }
+ }
+
+ return compacted;
+ }
+
+ var keys = Object.keys(obj);
+ for (var j = 0; j < keys.length; ++j) {
+ var key = keys[j];
+ obj[key] = exports.compact(obj[key], refs);
+ }
+
+ return obj;
+};
+
+exports.isRegExp = function (obj) {
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
+};
+
+exports.isBuffer = function (obj) {
+ if (obj === null || typeof obj === 'undefined') {
+ return false;
+ }
+
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
+};
+
+},{}]},{},[1])(1)
+});
+
+
+//# sourceMappingURL=request.js.map \ No newline at end of file
diff --git a/node_modules/then-request/dist/request.js.map b/node_modules/then-request/dist/request.js.map
new file mode 100644
index 0000000..7b4238c
--- /dev/null
+++ b/node_modules/then-request/dist/request.js.map
@@ -0,0 +1,47 @@
+{
+ "version": 3,
+ "sources": [
+ "node_modules/browserify/node_modules/browser-pack/_prelude.js",
+ "browser.js",
+ "lib/handle-qs.js",
+ "node_modules/http-response-object/index.js",
+ "node_modules/promise/index.js",
+ "node_modules/promise/lib/core.js",
+ "node_modules/promise/lib/done.js",
+ "node_modules/promise/lib/es6-extensions.js",
+ "node_modules/promise/lib/finally.js",
+ "node_modules/promise/lib/index.js",
+ "node_modules/promise/lib/node-extensions.js",
+ "node_modules/promise/lib/synchronous.js",
+ "node_modules/promise/node_modules/asap/browser-asap.js",
+ "node_modules/promise/node_modules/asap/browser-raw.js",
+ "node_modules/qs/lib/index.js",
+ "node_modules/qs/lib/parse.js",
+ "node_modules/qs/lib/stringify.js",
+ "node_modules/qs/lib/utils.js"
+ ],
+ "names": [],
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA",
+ "file": "generated.js",
+ "sourceRoot": "",
+ "sourcesContent": [
+ "(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;o<r.length;o++)s(r[o]);return s})",
+ "'use strict';\n\nvar Promise = require('promise');\nvar Response = require('http-response-object');\nvar handleQs = require('./lib/handle-qs.js');\n\nmodule.exports = doRequest;\nfunction doRequest(method, url, options, callback) {\n var result = new Promise(function (resolve, reject) {\n var xhr = new window.XMLHttpRequest();\n\n // check types of arguments\n\n if (typeof method !== 'string') {\n throw new TypeError('The method must be a string.');\n }\n if (typeof url !== 'string') {\n throw new TypeError('The URL/path must be a string.');\n }\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (options === null || options === undefined) {\n options = {};\n }\n if (typeof options !== 'object') {\n throw new TypeError('Options must be an object (or null).');\n }\n if (typeof callback !== 'function') {\n callback = undefined;\n }\n\n method = method.toUpperCase();\n options.headers = options.headers || {};\n\n\n function attempt(n) {\n doRequest(method, url, {\n qs: options.qs,\n headers: options.headers,\n timeout: options.timeout\n }).nodeify(function (err, res) {\n var retry = err || res.statusCode >= 400;\n if (typeof options.retry === 'function') {\n retry = options.retry(err, res, n + 1);\n }\n if (n >= (options.maxRetries | 5)) {\n retry = false;\n }\n if (retry) {\n var delay = options.retryDelay;\n if (typeof options.retryDelay === 'function') {\n delay = options.retryDelay(err, res, n + 1);\n }\n delay = delay || 200;\n setTimeout(function () {\n attempt(n + 1);\n }, delay);\n } else {\n if (err) reject(err);\n else resolve(res);\n }\n });\n }\n if (options.retry && method === 'GET') {\n return attempt(0);\n }\n\n // handle cross domain\n\n var match;\n var crossDomain = !!((match = /^([\\w-]+:)?\\/\\/([^\\/]+)/.exec(url)) && (match[2] != window.location.host));\n if (!crossDomain) options.headers['X-Requested-With'] = 'XMLHttpRequest';\n\n // handle query string\n if (options.qs) {\n url = handleQs(url, options.qs);\n }\n\n // handle json body\n if (options.json) {\n options.body = JSON.stringify(options.json);\n options.headers['Content-Type'] = 'application/json';\n }\n\n if (options.timeout) {\n xhr.timeout = options.timeout;\n var start = Date.now();\n xhr.ontimeout = function () {\n var duration = Date.now() - start;\n var err = new Error('Request timed out after ' + duration + 'ms');\n err.timeout = true;\n err.duration = duration;\n reject(err);\n };\n }\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n var headers = {};\n xhr.getAllResponseHeaders().split('\\r\\n').forEach(function (header) {\n var h = header.split(':');\n if (h.length > 1) {\n headers[h[0].toLowerCase()] = h.slice(1).join(':').trim();\n }\n });\n var res = new Response(xhr.status, headers, xhr.responseText);\n res.url = url;\n resolve(res);\n }\n };\n\n // method, url, async\n xhr.open(method, url, true);\n\n for (var name in options.headers) {\n xhr.setRequestHeader(name, options.headers[name]);\n }\n\n // avoid sending empty string (#319)\n xhr.send(options.body ? options.body : null);\n });\n result.getBody = function () {\n return result.then(function (res) { return res.getBody(); });\n };\n return result.nodeify(callback);\n}\n",
+ "'use strict';\n\nvar parse = require('qs').parse;\nvar stringify = require('qs').stringify;\n\nmodule.exports = handleQs;\nfunction handleQs(url, query) {\n url = url.split('?');\n var start = url[0];\n var qs = (url[1] || '').split('#')[0];\n var end = url[1] && url[1].split('#').length > 1 ? '#' + url[1].split('#')[1] : '';\n\n var baseQs = parse(qs);\n for (var i in query) {\n baseQs[i] = query[i];\n }\n qs = stringify(baseQs);\n if (qs !== '') {\n qs = '?' + qs;\n }\n return start + qs + end;\n}\n",
+ "'use strict';\n\nmodule.exports = Response;\n\n/**\n * A response from a web request\n *\n * @param {Number} statusCode\n * @param {Object} headers\n * @param {Buffer} body\n * @param {String} url\n */\nfunction Response(statusCode, headers, body, url) {\n if (typeof statusCode !== 'number') {\n throw new TypeError('statusCode must be a number but was ' + (typeof statusCode));\n }\n if (headers === null) {\n throw new TypeError('headers cannot be null');\n }\n if (typeof headers !== 'object') {\n throw new TypeError('headers must be an object but was ' + (typeof headers));\n }\n this.statusCode = statusCode;\n this.headers = {};\n for (var key in headers) {\n this.headers[key.toLowerCase()] = headers[key];\n }\n this.body = body;\n this.url = url;\n}\n\nResponse.prototype.getBody = function (encoding) {\n if (this.statusCode >= 300) {\n var err = new Error('Server responded with status code '\n + this.statusCode + ':\\n' + this.body.toString());\n err.statusCode = this.statusCode;\n err.headers = this.headers;\n err.body = this.body;\n err.url = this.url;\n throw err;\n }\n return encoding ? this.body.toString(encoding) : this.body;\n};\n",
+ "'use strict';\n\nmodule.exports = require('./lib')\n",
+ "'use strict';\n\nvar asap = require('asap/raw');\n\nfunction noop() {}\n\n// States:\n//\n// 0 - pending\n// 1 - fulfilled with _value\n// 2 - rejected with _value\n// 3 - adopted the state of another promise, _value\n//\n// once the state is no longer pending (0) it is immutable\n\n// All `_` prefixed properties will be reduced to `_{random number}`\n// at build time to obfuscate them and discourage their use.\n// We don't use symbols or Object.defineProperty to fully hide them\n// because the performance isn't good enough.\n\n\n// to avoid using try/catch inside critical functions, we\n// extract them to here.\nvar LAST_ERROR = null;\nvar IS_ERROR = {};\nfunction getThen(obj) {\n try {\n return obj.then;\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\n\nfunction tryCallOne(fn, a) {\n try {\n return fn(a);\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\nfunction tryCallTwo(fn, a, b) {\n try {\n fn(a, b);\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\n\nmodule.exports = Promise;\n\nfunction Promise(fn) {\n if (typeof this !== 'object') {\n throw new TypeError('Promises must be constructed via new');\n }\n if (typeof fn !== 'function') {\n throw new TypeError('not a function');\n }\n this._45 = 0;\n this._81 = 0;\n this._65 = null;\n this._54 = null;\n if (fn === noop) return;\n doResolve(fn, this);\n}\nPromise._10 = null;\nPromise._97 = null;\nPromise._61 = noop;\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n if (this.constructor !== Promise) {\n return safeThen(this, onFulfilled, onRejected);\n }\n var res = new Promise(noop);\n handle(this, new Handler(onFulfilled, onRejected, res));\n return res;\n};\n\nfunction safeThen(self, onFulfilled, onRejected) {\n return new self.constructor(function (resolve, reject) {\n var res = new Promise(noop);\n res.then(resolve, reject);\n handle(self, new Handler(onFulfilled, onRejected, res));\n });\n};\nfunction handle(self, deferred) {\n while (self._81 === 3) {\n self = self._65;\n }\n if (Promise._10) {\n Promise._10(self);\n }\n if (self._81 === 0) {\n if (self._45 === 0) {\n self._45 = 1;\n self._54 = deferred;\n return;\n }\n if (self._45 === 1) {\n self._45 = 2;\n self._54 = [self._54, deferred];\n return;\n }\n self._54.push(deferred);\n return;\n }\n handleResolved(self, deferred);\n}\n\nfunction handleResolved(self, deferred) {\n asap(function() {\n var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n if (self._81 === 1) {\n resolve(deferred.promise, self._65);\n } else {\n reject(deferred.promise, self._65);\n }\n return;\n }\n var ret = tryCallOne(cb, self._65);\n if (ret === IS_ERROR) {\n reject(deferred.promise, LAST_ERROR);\n } else {\n resolve(deferred.promise, ret);\n }\n });\n}\nfunction resolve(self, newValue) {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self) {\n return reject(\n self,\n new TypeError('A promise cannot be resolved with itself.')\n );\n }\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = getThen(newValue);\n if (then === IS_ERROR) {\n return reject(self, LAST_ERROR);\n }\n if (\n then === self.then &&\n newValue instanceof Promise\n ) {\n self._81 = 3;\n self._65 = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(then.bind(newValue), self);\n return;\n }\n }\n self._81 = 1;\n self._65 = newValue;\n finale(self);\n}\n\nfunction reject(self, newValue) {\n self._81 = 2;\n self._65 = newValue;\n if (Promise._97) {\n Promise._97(self, newValue);\n }\n finale(self);\n}\nfunction finale(self) {\n if (self._45 === 1) {\n handle(self, self._54);\n self._54 = null;\n }\n if (self._45 === 2) {\n for (var i = 0; i < self._54.length; i++) {\n handle(self, self._54[i]);\n }\n self._54 = null;\n }\n}\n\nfunction Handler(onFulfilled, onRejected, promise){\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n })\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}\n",
+ "'use strict';\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\nPromise.prototype.done = function (onFulfilled, onRejected) {\n var self = arguments.length ? this.then.apply(this, arguments) : this;\n self.then(null, function (err) {\n setTimeout(function () {\n throw err;\n }, 0);\n });\n};\n",
+ "'use strict';\n\n//This file contains the ES6 extensions to the core Promises/A+ API\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nvar TRUE = valuePromise(true);\nvar FALSE = valuePromise(false);\nvar NULL = valuePromise(null);\nvar UNDEFINED = valuePromise(undefined);\nvar ZERO = valuePromise(0);\nvar EMPTYSTRING = valuePromise('');\n\nfunction valuePromise(value) {\n var p = new Promise(Promise._61);\n p._81 = 1;\n p._65 = value;\n return p;\n}\nPromise.resolve = function (value) {\n if (value instanceof Promise) return value;\n\n if (value === null) return NULL;\n if (value === undefined) return UNDEFINED;\n if (value === true) return TRUE;\n if (value === false) return FALSE;\n if (value === 0) return ZERO;\n if (value === '') return EMPTYSTRING;\n\n if (typeof value === 'object' || typeof value === 'function') {\n try {\n var then = value.then;\n if (typeof then === 'function') {\n return new Promise(then.bind(value));\n }\n } catch (ex) {\n return new Promise(function (resolve, reject) {\n reject(ex);\n });\n }\n }\n return valuePromise(value);\n};\n\nPromise.all = function (arr) {\n var args = Array.prototype.slice.call(arr);\n\n return new Promise(function (resolve, reject) {\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n function res(i, val) {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n if (val instanceof Promise && val.then === Promise.prototype.then) {\n while (val._81 === 3) {\n val = val._65;\n }\n if (val._81 === 1) return res(i, val._65);\n if (val._81 === 2) reject(val._65);\n val.then(function (val) {\n res(i, val);\n }, reject);\n return;\n } else {\n var then = val.then;\n if (typeof then === 'function') {\n var p = new Promise(then.bind(val));\n p.then(function (val) {\n res(i, val);\n }, reject);\n return;\n }\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n }\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.reject = function (value) {\n return new Promise(function (resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function (values) {\n return new Promise(function (resolve, reject) {\n values.forEach(function(value){\n Promise.resolve(value).then(resolve, reject);\n });\n });\n};\n\n/* Prototype Methods */\n\nPromise.prototype['catch'] = function (onRejected) {\n return this.then(null, onRejected);\n};\n",
+ "'use strict';\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\nPromise.prototype['finally'] = function (f) {\n return this.then(function (value) {\n return Promise.resolve(f()).then(function () {\n return value;\n });\n }, function (err) {\n return Promise.resolve(f()).then(function () {\n throw err;\n });\n });\n};\n",
+ "'use strict';\n\nmodule.exports = require('./core.js');\nrequire('./done.js');\nrequire('./finally.js');\nrequire('./es6-extensions.js');\nrequire('./node-extensions.js');\nrequire('./synchronous.js');\n",
+ "'use strict';\n\n// This file contains then/promise specific extensions that are only useful\n// for node.js interop\n\nvar Promise = require('./core.js');\nvar asap = require('asap');\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nPromise.denodeify = function (fn, argumentCount) {\n if (\n typeof argumentCount === 'number' && argumentCount !== Infinity\n ) {\n return denodeifyWithCount(fn, argumentCount);\n } else {\n return denodeifyWithoutCount(fn);\n }\n}\n\nvar callbackFn = (\n 'function (err, res) {' +\n 'if (err) { rj(err); } else { rs(res); }' +\n '}'\n);\nfunction denodeifyWithCount(fn, argumentCount) {\n var args = [];\n for (var i = 0; i < argumentCount; i++) {\n args.push('a' + i);\n }\n var body = [\n 'return function (' + args.join(',') + ') {',\n 'var self = this;',\n 'return new Promise(function (rs, rj) {',\n 'var res = fn.call(',\n ['self'].concat(args).concat([callbackFn]).join(','),\n ');',\n 'if (res &&',\n '(typeof res === \"object\" || typeof res === \"function\") &&',\n 'typeof res.then === \"function\"',\n ') {rs(res);}',\n '});',\n '};'\n ].join('');\n return Function(['Promise', 'fn'], body)(Promise, fn);\n}\nfunction denodeifyWithoutCount(fn) {\n var fnLength = Math.max(fn.length - 1, 3);\n var args = [];\n for (var i = 0; i < fnLength; i++) {\n args.push('a' + i);\n }\n var body = [\n 'return function (' + args.join(',') + ') {',\n 'var self = this;',\n 'var args;',\n 'var argLength = arguments.length;',\n 'if (arguments.length > ' + fnLength + ') {',\n 'args = new Array(arguments.length + 1);',\n 'for (var i = 0; i < arguments.length; i++) {',\n 'args[i] = arguments[i];',\n '}',\n '}',\n 'return new Promise(function (rs, rj) {',\n 'var cb = ' + callbackFn + ';',\n 'var res;',\n 'switch (argLength) {',\n args.concat(['extra']).map(function (_, index) {\n return (\n 'case ' + (index) + ':' +\n 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +\n 'break;'\n );\n }).join(''),\n 'default:',\n 'args[argLength] = cb;',\n 'res = fn.apply(self, args);',\n '}',\n \n 'if (res &&',\n '(typeof res === \"object\" || typeof res === \"function\") &&',\n 'typeof res.then === \"function\"',\n ') {rs(res);}',\n '});',\n '};'\n ].join('');\n\n return Function(\n ['Promise', 'fn'],\n body\n )(Promise, fn);\n}\n\nPromise.nodeify = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n var callback =\n typeof args[args.length - 1] === 'function' ? args.pop() : null;\n var ctx = this;\n try {\n return fn.apply(this, arguments).nodeify(callback, ctx);\n } catch (ex) {\n if (callback === null || typeof callback == 'undefined') {\n return new Promise(function (resolve, reject) {\n reject(ex);\n });\n } else {\n asap(function () {\n callback.call(ctx, ex);\n })\n }\n }\n }\n}\n\nPromise.prototype.nodeify = function (callback, ctx) {\n if (typeof callback != 'function') return this;\n\n this.then(function (value) {\n asap(function () {\n callback.call(ctx, null, value);\n });\n }, function (err) {\n asap(function () {\n callback.call(ctx, err);\n });\n });\n}\n",
+ "'use strict';\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\nPromise.enableSynchronous = function () {\n Promise.prototype.isPending = function() {\n return this.getState() == 0;\n };\n\n Promise.prototype.isFulfilled = function() {\n return this.getState() == 1;\n };\n\n Promise.prototype.isRejected = function() {\n return this.getState() == 2;\n };\n\n Promise.prototype.getValue = function () {\n if (this._81 === 3) {\n return this._65.getValue();\n }\n\n if (!this.isFulfilled()) {\n throw new Error('Cannot get a value of an unfulfilled promise.');\n }\n\n return this._65;\n };\n\n Promise.prototype.getReason = function () {\n if (this._81 === 3) {\n return this._65.getReason();\n }\n\n if (!this.isRejected()) {\n throw new Error('Cannot get a rejection reason of a non-rejected promise.');\n }\n\n return this._65;\n };\n\n Promise.prototype.getState = function () {\n if (this._81 === 3) {\n return this._65.getState();\n }\n if (this._81 === -1 || this._81 === -2) {\n return 0;\n }\n\n return this._81;\n };\n};\n\nPromise.disableSynchronous = function() {\n Promise.prototype.isPending = undefined;\n Promise.prototype.isFulfilled = undefined;\n Promise.prototype.isRejected = undefined;\n Promise.prototype.getValue = undefined;\n Promise.prototype.getReason = undefined;\n Promise.prototype.getState = undefined;\n};\n",
+ "\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(\"./raw\");\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n var rawTask;\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n rawTask.task = task;\n rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n};\n",
+ "(function (global){\n\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n index = index + 1;\n queue[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n queue.length -= index;\n index = 0;\n }\n }\n queue.length = 0;\n index = 0;\n flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\nvar BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode(\"\");\n observer.observe(node, {characterData: true});\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9wcm9taXNlL25vZGVfbW9kdWxlcy9hc2FwL2Jyb3dzZXItcmF3LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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1Yi5jb20vdGlsZGVpby9yc3ZwLmpzL2Jsb2IvY2RkZjcyMzI1NDZhOWNmODU4NTI0Yjc1Y2RlNmY5ZWRmNzI2MjBhNy9saWIvcnN2cC9hc2FwLmpzXG4iXX0=",
+ "'use strict';\n\nvar Stringify = require('./stringify');\nvar Parse = require('./parse');\n\nmodule.exports = {\n stringify: Stringify,\n parse: Parse\n};\n",
+ "'use strict';\n\nvar Utils = require('./utils');\n\nvar internals = {\n delimiter: '&',\n depth: 5,\n arrayLimit: 20,\n parameterLimit: 1000,\n strictNullHandling: false,\n plainObjects: false,\n allowPrototypes: false,\n allowDots: false\n};\n\ninternals.parseValues = function (str, options) {\n var obj = {};\n var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);\n\n for (var i = 0; i < parts.length; ++i) {\n var part = parts[i];\n var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;\n\n if (pos === -1) {\n obj[Utils.decode(part)] = '';\n\n if (options.strictNullHandling) {\n obj[Utils.decode(part)] = null;\n }\n } else {\n var key = Utils.decode(part.slice(0, pos));\n var val = Utils.decode(part.slice(pos + 1));\n\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n obj[key] = [].concat(obj[key]).concat(val);\n } else {\n obj[key] = val;\n }\n }\n }\n\n return obj;\n};\n\ninternals.parseObject = function (chain, val, options) {\n if (!chain.length) {\n return val;\n }\n\n var root = chain.shift();\n\n var obj;\n if (root === '[]') {\n obj = [];\n obj = obj.concat(internals.parseObject(chain, val, options));\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;\n var index = parseInt(cleanRoot, 10);\n if (\n !isNaN(index) &&\n root !== cleanRoot &&\n String(index) === cleanRoot &&\n index >= 0 &&\n (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = internals.parseObject(chain, val, options);\n } else {\n obj[cleanRoot] = internals.parseObject(chain, val, options);\n }\n }\n\n return obj;\n};\n\ninternals.parseKeys = function (givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^\\.\\[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var parent = /^([^\\[\\]]*)/;\n var child = /(\\[[^\\[\\]]*\\])/g;\n\n // Get the parent\n\n var segment = parent.exec(key);\n\n // Stash the parent if it exists\n\n var keys = [];\n if (segment[1]) {\n // If we aren't using plain objects, optionally prefix keys\n // that would overwrite object prototype properties\n if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(segment[1]);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while ((segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\\[|\\]/g, ''))) {\n if (!options.allowPrototypes) {\n continue;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return internals.parseObject(keys, val, options);\n};\n\nmodule.exports = function (str, opts) {\n var options = opts || {};\n options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;\n options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;\n options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;\n options.parseArrays = options.parseArrays !== false;\n options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots;\n options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects;\n options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes;\n options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;\n options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;\n\n if (\n str === '' ||\n str === null ||\n typeof str === 'undefined'\n ) {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = internals.parseKeys(key, tempObj[key], options);\n obj = Utils.merge(obj, newObj, options);\n }\n\n return Utils.compact(obj);\n};\n",
+ "'use strict';\n\nvar Utils = require('./utils');\n\nvar internals = {\n delimiter: '&',\n arrayPrefixGenerators: {\n brackets: function (prefix) {\n return prefix + '[]';\n },\n indices: function (prefix, key) {\n return prefix + '[' + key + ']';\n },\n repeat: function (prefix) {\n return prefix;\n }\n },\n strictNullHandling: false,\n skipNulls: false,\n encode: true\n};\n\ninternals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (Utils.isBuffer(obj)) {\n obj = String(obj);\n } else if (obj instanceof Date) {\n obj = obj.toISOString();\n } else if (obj === null) {\n if (strictNullHandling) {\n return encode ? Utils.encode(prefix) : prefix;\n }\n\n obj = '';\n }\n\n if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {\n if (encode) {\n return [Utils.encode(prefix) + '=' + Utils.encode(obj)];\n }\n return [prefix + '=' + obj];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (Array.isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n if (Array.isArray(obj)) {\n values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));\n } else {\n values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));\n }\n }\n\n return values;\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = opts || {};\n var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;\n var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;\n var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls;\n var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode;\n var sort = typeof options.sort === 'function' ? options.sort : null;\n var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n var objKeys;\n var filter;\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (Array.isArray(options.filter)) {\n objKeys = filter = options.filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (options.arrayFormat in internals.arrayPrefixGenerators) {\n arrayFormat = options.arrayFormat;\n } else if ('indices' in options) {\n arrayFormat = options.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (sort) {\n objKeys.sort(sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));\n }\n\n return keys.join(delimiter);\n};\n",
+ "'use strict';\n\nvar hexTable = (function () {\n var array = new Array(256);\n for (var i = 0; i < 256; ++i) {\n array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();\n }\n\n return array;\n}());\n\nexports.arrayToObject = function (source, options) {\n var obj = options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nexports.merge = function (target, source, options) {\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (Array.isArray(target)) {\n target.push(source);\n } else if (typeof target === 'object') {\n target[source] = true;\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (Array.isArray(target) && !Array.isArray(source)) {\n mergeTarget = exports.arrayToObject(target, options);\n }\n\n\treturn Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (Object.prototype.hasOwnProperty.call(acc, key)) {\n acc[key] = exports.merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n\t\treturn acc;\n }, mergeTarget);\n};\n\nexports.decode = function (str) {\n try {\n return decodeURIComponent(str.replace(/\\+/g, ' '));\n } catch (e) {\n return str;\n }\n};\n\nexports.encode = function (str) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = typeof str === 'string' ? str : String(str);\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D || // -\n c === 0x2E || // .\n c === 0x5F || // _\n c === 0x7E || // ~\n (c >= 0x30 && c <= 0x39) || // 0-9\n (c >= 0x41 && c <= 0x5A) || // a-z\n (c >= 0x61 && c <= 0x7A) // A-Z\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n }\n\n return out;\n};\n\nexports.compact = function (obj, references) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n var refs = references || [];\n var lookup = refs.indexOf(obj);\n if (lookup !== -1) {\n return refs[lookup];\n }\n\n refs.push(obj);\n\n if (Array.isArray(obj)) {\n var compacted = [];\n\n for (var i = 0; i < obj.length; ++i) {\n if (typeof obj[i] !== 'undefined') {\n compacted.push(obj[i]);\n }\n }\n\n return compacted;\n }\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n obj[key] = exports.compact(obj[key], refs);\n }\n\n return obj;\n};\n\nexports.isRegExp = function (obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nexports.isBuffer = function (obj) {\n if (obj === null || typeof obj === 'undefined') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n"
+ ]
+} \ No newline at end of file
diff --git a/node_modules/then-request/dist/request.min.js b/node_modules/then-request/dist/request.min.js
new file mode 100644
index 0000000..89a98eb
--- /dev/null
+++ b/node_modules/then-request/dist/request.min.js
@@ -0,0 +1,42 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.request=e()}}(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+"use strict";function doRequest(e,t,o,r){var n=new Promise(function(n,s){function i(r){doRequest(e,t,{qs:o.qs,headers:o.headers,timeout:o.timeout}).nodeify(function(e,t){var a=e||t.statusCode>=400;if("function"==typeof o.retry&&(a=o.retry(e,t,r+1)),r>=(5|o.maxRetries)&&(a=!1),a){var u=o.retryDelay;"function"==typeof o.retryDelay&&(u=o.retryDelay(e,t,r+1)),u=u||200,setTimeout(function(){i(r+1)},u)}else e?s(e):n(t)})}var a=new window.XMLHttpRequest;if("string"!=typeof e)throw new TypeError("The method must be a string.");if("string"!=typeof t)throw new TypeError("The URL/path must be a string.");if("function"==typeof o&&(r=o,o={}),(null===o||void 0===o)&&(o={}),"object"!=typeof o)throw new TypeError("Options must be an object (or null).");if("function"!=typeof r&&(r=void 0),e=e.toUpperCase(),o.headers=o.headers||{},o.retry&&"GET"===e)return i(0);var u,d=!(!(u=/^([\w-]+:)?\/\/([^\/]+)/.exec(t))||u[2]==window.location.host);if(d||(o.headers["X-Requested-With"]="XMLHttpRequest"),o.qs&&(t=handleQs(t,o.qs)),o.json&&(o.body=JSON.stringify(o.json),o.headers["Content-Type"]="application/json"),o.timeout){a.timeout=o.timeout;var f=Date.now();a.ontimeout=function(){var e=Date.now()-f,t=new Error("Request timed out after "+e+"ms");t.timeout=!0,t.duration=e,s(t)}}a.onreadystatechange=function(){if(4===a.readyState){var e={};a.getAllResponseHeaders().split("\r\n").forEach(function(t){var o=t.split(":");o.length>1&&(e[o[0].toLowerCase()]=o.slice(1).join(":").trim())});var o=new Response(a.status,e,a.responseText);o.url=t,n(o)}},a.open(e,t,!0);for(var p in o.headers)a.setRequestHeader(p,o.headers[p]);a.send(o.body?o.body:null)});return n.getBody=function(){return n.then(function(e){return e.getBody()})},n.nodeify(r)}var Promise=require("promise"),Response=require("http-response-object"),handleQs=require("./lib/handle-qs.js");module.exports=doRequest;
+},{"./lib/handle-qs.js":2,"http-response-object":3,"promise":4}],2:[function(require,module,exports){
+"use strict";function handleQs(r,s){r=r.split("?");var i=r[0],e=(r[1]||"").split("#")[0],t=r[1]&&r[1].split("#").length>1?"#"+r[1].split("#")[1]:"",n=parse(e);for(var a in s)n[a]=s[a];return e=stringify(n),""!==e&&(e="?"+e),i+e+t}var parse=require("qs").parse,stringify=require("qs").stringify;module.exports=handleQs;
+},{"qs":14}],3:[function(require,module,exports){
+"use strict";function Response(t,e,s,o){if("number"!=typeof t)throw new TypeError("statusCode must be a number but was "+typeof t);if(null===e)throw new TypeError("headers cannot be null");if("object"!=typeof e)throw new TypeError("headers must be an object but was "+typeof e);this.statusCode=t,this.headers={};for(var r in e)this.headers[r.toLowerCase()]=e[r];this.body=s,this.url=o}module.exports=Response,Response.prototype.getBody=function(t){if(this.statusCode>=300){var e=new Error("Server responded with status code "+this.statusCode+":\n"+this.body.toString());throw e.statusCode=this.statusCode,e.headers=this.headers,e.body=this.body,e.url=this.url,e}return t?this.body.toString(t):this.body};
+},{}],4:[function(require,module,exports){
+"use strict";module.exports=require("./lib");
+},{"./lib":9}],5:[function(require,module,exports){
+"use strict";function noop(){}function getThen(e){try{return e.then}catch(n){return LAST_ERROR=n,IS_ERROR}}function tryCallOne(e,n){try{return e(n)}catch(o){return LAST_ERROR=o,IS_ERROR}}function tryCallTwo(e,n,o){try{e(n,o)}catch(t){return LAST_ERROR=t,IS_ERROR}}function Promise(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._45=0,this._81=0,this._65=null,this._54=null,e!==noop&&doResolve(e,this)}function safeThen(e,n,o){return new e.constructor(function(t,r){var i=new Promise(noop);i.then(t,r),handle(e,new Handler(n,o,i))})}function handle(e,n){for(;3===e._81;)e=e._65;return Promise._10&&Promise._10(e),0===e._81?0===e._45?(e._45=1,void(e._54=n)):1===e._45?(e._45=2,void(e._54=[e._54,n])):void e._54.push(n):void handleResolved(e,n)}function handleResolved(e,n){asap(function(){var o=1===e._81?n.onFulfilled:n.onRejected;if(null===o)return void(1===e._81?resolve(n.promise,e._65):reject(n.promise,e._65));var t=tryCallOne(o,e._65);t===IS_ERROR?reject(n.promise,LAST_ERROR):resolve(n.promise,t)})}function resolve(e,n){if(n===e)return reject(e,new TypeError("A promise cannot be resolved with itself."));if(n&&("object"==typeof n||"function"==typeof n)){var o=getThen(n);if(o===IS_ERROR)return reject(e,LAST_ERROR);if(o===e.then&&n instanceof Promise)return e._81=3,e._65=n,void finale(e);if("function"==typeof o)return void doResolve(o.bind(n),e)}e._81=1,e._65=n,finale(e)}function reject(e,n){e._81=2,e._65=n,Promise._97&&Promise._97(e,n),finale(e)}function finale(e){if(1===e._45&&(handle(e,e._54),e._54=null),2===e._45){for(var n=0;n<e._54.length;n++)handle(e,e._54[n]);e._54=null}}function Handler(e,n,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=o}function doResolve(e,n){var o=!1,t=tryCallTwo(e,function(e){o||(o=!0,resolve(n,e))},function(e){o||(o=!0,reject(n,e))});o||t!==IS_ERROR||(o=!0,reject(n,LAST_ERROR))}var asap=require("asap/raw"),LAST_ERROR=null,IS_ERROR={};module.exports=Promise,Promise._10=null,Promise._97=null,Promise._61=noop,Promise.prototype.then=function(e,n){if(this.constructor!==Promise)return safeThen(this,e,n);var o=new Promise(noop);return handle(this,new Handler(e,n,o)),o};
+},{"asap/raw":13}],6:[function(require,module,exports){
+"use strict";var Promise=require("./core.js");module.exports=Promise,Promise.prototype.done=function(t,e){var o=arguments.length?this.then.apply(this,arguments):this;o.then(null,function(t){setTimeout(function(){throw t},0)})};
+},{"./core.js":5}],7:[function(require,module,exports){
+"use strict";function valuePromise(e){var r=new Promise(Promise._61);return r._81=1,r._65=e,r}var Promise=require("./core.js");module.exports=Promise;var TRUE=valuePromise(!0),FALSE=valuePromise(!1),NULL=valuePromise(null),UNDEFINED=valuePromise(void 0),ZERO=valuePromise(0),EMPTYSTRING=valuePromise("");Promise.resolve=function(e){if(e instanceof Promise)return e;if(null===e)return NULL;if(void 0===e)return UNDEFINED;if(e===!0)return TRUE;if(e===!1)return FALSE;if(0===e)return ZERO;if(""===e)return EMPTYSTRING;if("object"==typeof e||"function"==typeof e)try{var r=e.then;if("function"==typeof r)return new Promise(r.bind(e))}catch(n){return new Promise(function(e,r){r(n)})}return valuePromise(e)},Promise.all=function(e){var r=Array.prototype.slice.call(e);return new Promise(function(e,n){function o(i,u){if(u&&("object"==typeof u||"function"==typeof u)){if(u instanceof Promise&&u.then===Promise.prototype.then){for(;3===u._81;)u=u._65;return 1===u._81?o(i,u._65):(2===u._81&&n(u._65),void u.then(function(e){o(i,e)},n))}var f=u.then;if("function"==typeof f){var s=new Promise(f.bind(u));return void s.then(function(e){o(i,e)},n)}}r[i]=u,0===--t&&e(r)}if(0===r.length)return e([]);for(var t=r.length,i=0;i<r.length;i++)o(i,r[i])})},Promise.reject=function(e){return new Promise(function(r,n){n(e)})},Promise.race=function(e){return new Promise(function(r,n){e.forEach(function(e){Promise.resolve(e).then(r,n)})})},Promise.prototype["catch"]=function(e){return this.then(null,e)};
+},{"./core.js":5}],8:[function(require,module,exports){
+"use strict";var Promise=require("./core.js");module.exports=Promise,Promise.prototype["finally"]=function(e){return this.then(function(r){return Promise.resolve(e()).then(function(){return r})},function(r){return Promise.resolve(e()).then(function(){throw r})})};
+},{"./core.js":5}],9:[function(require,module,exports){
+"use strict";module.exports=require("./core.js"),require("./done.js"),require("./finally.js"),require("./es6-extensions.js"),require("./node-extensions.js"),require("./synchronous.js");
+},{"./core.js":5,"./done.js":6,"./es6-extensions.js":7,"./finally.js":8,"./node-extensions.js":10,"./synchronous.js":11}],10:[function(require,module,exports){
+"use strict";function denodeifyWithCount(n,e){for(var r=[],t=0;e>t;t++)r.push("a"+t);var o=["return function ("+r.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(r).concat([callbackFn]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],o)(Promise,n)}function denodeifyWithoutCount(n){for(var e=Math.max(n.length-1,3),r=[],t=0;e>t;t++)r.push("a"+t);var o=["return function ("+r.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+e+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+callbackFn+";","var res;","switch (argLength) {",r.concat(["extra"]).map(function(n,e){return"case "+e+":res = fn.call("+["self"].concat(r.slice(0,e)).concat("cb").join(",")+");break;"}).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],o)(Promise,n)}var Promise=require("./core.js"),asap=require("asap");module.exports=Promise,Promise.denodeify=function(n,e){return"number"==typeof e&&e!==1/0?denodeifyWithCount(n,e):denodeifyWithoutCount(n)};var callbackFn="function (err, res) {if (err) { rj(err); } else { rs(res); }}";Promise.nodeify=function(n){return function(){var e=Array.prototype.slice.call(arguments),r="function"==typeof e[e.length-1]?e.pop():null,t=this;try{return n.apply(this,arguments).nodeify(r,t)}catch(o){if(null===r||"undefined"==typeof r)return new Promise(function(n,e){e(o)});asap(function(){r.call(t,o)})}}},Promise.prototype.nodeify=function(n,e){return"function"!=typeof n?this:void this.then(function(r){asap(function(){n.call(e,null,r)})},function(r){asap(function(){n.call(e,r)})})};
+},{"./core.js":5,"asap":12}],11:[function(require,module,exports){
+"use strict";var Promise=require("./core.js");module.exports=Promise,Promise.enableSynchronous=function(){Promise.prototype.isPending=function(){return 0==this.getState()},Promise.prototype.isFulfilled=function(){return 1==this.getState()},Promise.prototype.isRejected=function(){return 2==this.getState()},Promise.prototype.getValue=function(){if(3===this._81)return this._65.getValue();if(!this.isFulfilled())throw new Error("Cannot get a value of an unfulfilled promise.");return this._65},Promise.prototype.getReason=function(){if(3===this._81)return this._65.getReason();if(!this.isRejected())throw new Error("Cannot get a rejection reason of a non-rejected promise.");return this._65},Promise.prototype.getState=function(){return 3===this._81?this._65.getState():-1===this._81||-2===this._81?0:this._81}},Promise.disableSynchronous=function(){Promise.prototype.isPending=void 0,Promise.prototype.isFulfilled=void 0,Promise.prototype.isRejected=void 0,Promise.prototype.getValue=void 0,Promise.prototype.getReason=void 0,Promise.prototype.getState=void 0};
+},{"./core.js":5}],12:[function(require,module,exports){
+"use strict";function throwFirstError(){if(pendingErrors.length)throw pendingErrors.shift()}function asap(r){var s;s=freeTasks.length?freeTasks.pop():new RawTask,s.task=r,rawAsap(s)}function RawTask(){this.task=null}var rawAsap=require("./raw"),freeTasks=[],pendingErrors=[],requestErrorThrow=rawAsap.makeRequestCallFromTimer(throwFirstError);module.exports=asap,RawTask.prototype.call=function(){try{this.task.call()}catch(r){asap.onerror?asap.onerror(r):(pendingErrors.push(r),requestErrorThrow())}finally{this.task=null,freeTasks[freeTasks.length]=this}};
+},{"./raw":13}],13:[function(require,module,exports){
+(function (global){
+"use strict";function rawAsap(e){queue.length||(requestFlush(),flushing=!0),queue[queue.length]=e}function flush(){for(;index<queue.length;){var e=index;if(index+=1,queue[e].call(),index>capacity){for(var u=0,r=queue.length-index;r>u;u++)queue[u]=queue[u+index];queue.length-=index,index=0}}queue.length=0,index=0,flushing=!1}function makeRequestCallFromMutationObserver(e){var u=1,r=new BrowserMutationObserver(e),t=document.createTextNode("");return r.observe(t,{characterData:!0}),function(){u=-u,t.data=u}}function makeRequestCallFromTimer(e){return function(){function u(){clearTimeout(r),clearInterval(t),e()}var r=setTimeout(u,0),t=setInterval(u,50)}}module.exports=rawAsap;var queue=[],flushing=!1,requestFlush,index=0,capacity=1024,BrowserMutationObserver=global.MutationObserver||global.WebKitMutationObserver;requestFlush="function"==typeof BrowserMutationObserver?makeRequestCallFromMutationObserver(flush):makeRequestCallFromTimer(flush),rawAsap.requestFlush=requestFlush,rawAsap.makeRequestCallFromTimer=makeRequestCallFromTimer;
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{}],14:[function(require,module,exports){
+"use strict";var Stringify=require("./stringify"),Parse=require("./parse");module.exports={stringify:Stringify,parse:Parse};
+},{"./parse":15,"./stringify":16}],15:[function(require,module,exports){
+"use strict";var Utils=require("./utils"),internals={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1};internals.parseValues=function(e,t){for(var r={},l=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),a=0;a<l.length;++a){var i=l[a],n=-1===i.indexOf("]=")?i.indexOf("="):i.indexOf("]=")+1;if(-1===n)r[Utils.decode(i)]="",t.strictNullHandling&&(r[Utils.decode(i)]=null);else{var s=Utils.decode(i.slice(0,n)),o=Utils.decode(i.slice(n+1));Object.prototype.hasOwnProperty.call(r,s)?r[s]=[].concat(r[s]).concat(o):r[s]=o}}return r},internals.parseObject=function(e,t,r){if(!e.length)return t;var l,a=e.shift();if("[]"===a)l=[],l=l.concat(internals.parseObject(e,t,r));else{l=r.plainObjects?Object.create(null):{};var i="["===a[0]&&"]"===a[a.length-1]?a.slice(1,a.length-1):a,n=parseInt(i,10);!isNaN(n)&&a!==i&&String(n)===i&&n>=0&&r.parseArrays&&n<=r.arrayLimit?(l=[],l[n]=internals.parseObject(e,t,r)):l[i]=internals.parseObject(e,t,r)}return l},internals.parseKeys=function(e,t,r){if(e){var l=r.allowDots?e.replace(/\.([^\.\[]+)/g,"[$1]"):e,a=/^([^\[\]]*)/,i=/(\[[^\[\]]*\])/g,n=a.exec(l),s=[];if(n[1]){if(!r.plainObjects&&Object.prototype.hasOwnProperty(n[1])&&!r.allowPrototypes)return;s.push(n[1])}for(var o=0;null!==(n=i.exec(l))&&o<r.depth;)o+=1,(r.plainObjects||!Object.prototype.hasOwnProperty(n[1].replace(/\[|\]/g,""))||r.allowPrototypes)&&s.push(n[1]);return n&&s.push("["+l.slice(n.index)+"]"),internals.parseObject(s,t,r)}},module.exports=function(e,t){var r=t||{};if(r.delimiter="string"==typeof r.delimiter||Utils.isRegExp(r.delimiter)?r.delimiter:internals.delimiter,r.depth="number"==typeof r.depth?r.depth:internals.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:internals.arrayLimit,r.parseArrays=r.parseArrays!==!1,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:internals.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:internals.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:internals.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:internals.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:internals.strictNullHandling,""===e||null===e||"undefined"==typeof e)return r.plainObjects?Object.create(null):{};for(var l="string"==typeof e?internals.parseValues(e,r):e,a=r.plainObjects?Object.create(null):{},i=Object.keys(l),n=0;n<i.length;++n){var s=i[n],o=internals.parseKeys(s,l[s],r);a=Utils.merge(a,o,r)}return Utils.compact(a)};
+},{"./utils":17}],16:[function(require,module,exports){
+"use strict";var Utils=require("./utils"),internals={delimiter:"&",arrayPrefixGenerators:{brackets:function(e){return e+"[]"},indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},strictNullHandling:!1,skipNulls:!1,encode:!0};internals.stringify=function(e,r,n,t,i,l,a,s,o){var f=e;if("function"==typeof a)f=a(r,f);else if(Utils.isBuffer(f))f=String(f);else if(f instanceof Date)f=f.toISOString();else if(null===f){if(t)return l?Utils.encode(r):r;f=""}if("string"==typeof f||"number"==typeof f||"boolean"==typeof f)return l?[Utils.encode(r)+"="+Utils.encode(f)]:[r+"="+f];var u=[];if("undefined"==typeof f)return u;var c;if(Array.isArray(a))c=a;else{var y=Object.keys(f);c=s?y.sort(s):y}for(var d=0;d<c.length;++d){var p=c[d];i&&null===f[p]||(u=Array.isArray(f)?u.concat(internals.stringify(f[p],n(r,p),n,t,i,l,a,s,o)):u.concat(internals.stringify(f[p],r+(o?"."+p:"["+p+"]"),n,t,i,l,a,s,o)))}return u},module.exports=function(e,r){var n,t,i=e,l=r||{},a="undefined"==typeof l.delimiter?internals.delimiter:l.delimiter,s="boolean"==typeof l.strictNullHandling?l.strictNullHandling:internals.strictNullHandling,o="boolean"==typeof l.skipNulls?l.skipNulls:internals.skipNulls,f="boolean"==typeof l.encode?l.encode:internals.encode,u="function"==typeof l.sort?l.sort:null,c="undefined"==typeof l.allowDots?!1:l.allowDots;"function"==typeof l.filter?(t=l.filter,i=t("",i)):Array.isArray(l.filter)&&(n=t=l.filter);var y=[];if("object"!=typeof i||null===i)return"";var d;d=l.arrayFormat in internals.arrayPrefixGenerators?l.arrayFormat:"indices"in l?l.indices?"indices":"repeat":"indices";var p=internals.arrayPrefixGenerators[d];n||(n=Object.keys(i)),u&&n.sort(u);for(var g=0;g<n.length;++g){var v=n[g];o&&null===i[v]||(y=y.concat(internals.stringify(i[v],v,p,s,o,f,t,u,c)))}return y.join(a)};
+},{"./utils":17}],17:[function(require,module,exports){
+"use strict";var hexTable=function(){for(var e=new Array(256),r=0;256>r;++r)e[r]="%"+((16>r?"0":"")+r.toString(16)).toUpperCase();return e}();exports.arrayToObject=function(e,r){for(var t=r.plainObjects?Object.create(null):{},n=0;n<e.length;++n)"undefined"!=typeof e[n]&&(t[n]=e[n]);return t},exports.merge=function(e,r,t){if(!r)return e;if("object"!=typeof r){if(Array.isArray(e))e.push(r);else{if("object"!=typeof e)return[e,r];e[r]=!0}return e}if("object"!=typeof e)return[e].concat(r);var n=e;return Array.isArray(e)&&!Array.isArray(r)&&(n=exports.arrayToObject(e,t)),Object.keys(r).reduce(function(e,n){var o=r[n];return Object.prototype.hasOwnProperty.call(e,n)?e[n]=exports.merge(e[n],o,t):e[n]=o,e},n)},exports.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(r){return e}},exports.encode=function(e){if(0===e.length)return e;for(var r="string"==typeof e?e:String(e),t="",n=0;n<r.length;++n){var o=r.charCodeAt(n);45===o||46===o||95===o||126===o||o>=48&&57>=o||o>=65&&90>=o||o>=97&&122>=o?t+=r.charAt(n):128>o?t+=hexTable[o]:2048>o?t+=hexTable[192|o>>6]+hexTable[128|63&o]:55296>o||o>=57344?t+=hexTable[224|o>>12]+hexTable[128|o>>6&63]+hexTable[128|63&o]:(n+=1,o=65536+((1023&o)<<10|1023&r.charCodeAt(n)),t+=hexTable[240|o>>18]+hexTable[128|o>>12&63]+hexTable[128|o>>6&63]+hexTable[128|63&o])}return t},exports.compact=function(e,r){if("object"!=typeof e||null===e)return e;var t=r||[],n=t.indexOf(e);if(-1!==n)return t[n];if(t.push(e),Array.isArray(e)){for(var o=[],a=0;a<e.length;++a)"undefined"!=typeof e[a]&&o.push(e[a]);return o}for(var c=Object.keys(e),u=0;u<c.length;++u){var f=c[u];e[f]=exports.compact(e[f],t)}return e},exports.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},exports.isBuffer=function(e){return null===e||"undefined"==typeof e?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))};
+},{}]},{},[1])(1)
+});
+
+
+//# sourceMappingURL=request.min.js.map \ No newline at end of file
diff --git a/node_modules/then-request/dist/request.min.js.map b/node_modules/then-request/dist/request.min.js.map
new file mode 100644
index 0000000..914311e
--- /dev/null
+++ b/node_modules/then-request/dist/request.min.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","browser.js","lib/handle-qs.js","node_modules/promise/index.js","node_modules/http-response-object/index.js","node_modules/promise/lib/index.js","node_modules/qs/lib/index.js","node_modules/promise/lib/core.js","node_modules/promise/lib/done.js","node_modules/promise/lib/finally.js","node_modules/promise/lib/es6-extensions.js","node_modules/promise/lib/node-extensions.js","node_modules/promise/lib/synchronous.js","node_modules/qs/lib/stringify.js","node_modules/qs/lib/parse.js","node_modules/qs/lib/utils.js","node_modules/promise/node_modules/asap/browser-asap.js","node_modules/promise/node_modules/asap/browser-raw.js"],"names":["doRequest","method","url","options","callback","result","Promise","resolve","reject","attempt","n","qs","headers","timeout","nodeify","err","res","retry","statusCode","maxRetries","delay","retryDelay","setTimeout","xhr","window","XMLHttpRequest","TypeError","undefined","toUpperCase","match","crossDomain","exec","location","host","handleQs","json","body","JSON","stringify","start","Date","now","ontimeout","duration","Error","onreadystatechange","readyState","getAllResponseHeaders","split","forEach","header","h","length","toLowerCase","slice","join","trim","Response","status","responseText","open","name","setRequestHeader","send","getBody","then","require","module","exports","query","end","baseQs","parse","i","this","key","prototype","encoding","toString","Stringify","Parse","noop","getThen","obj","ex","LAST_ERROR","IS_ERROR","tryCallOne","fn","a","tryCallTwo","b","_45","_81","_65","_54","doResolve","safeThen","self","onFulfilled","onRejected","constructor","handle","Handler","deferred","_10","push","handleResolved","asap","cb","promise","ret","newValue","finale","bind","_97","done","value","reason","_61","arguments","apply","f","valuePromise","p","TRUE","FALSE","NULL","UNDEFINED","ZERO","EMPTYSTRING","all","arr","args","Array","call","val","remaining","race","values","denodeifyWithCount","argumentCount","concat","callbackFn","Function","denodeifyWithoutCount","fnLength","Math","max","map","_","index","denodeify","Infinity","pop","ctx","enableSynchronous","isPending","getState","isFulfilled","isRejected","getValue","getReason","disableSynchronous","Utils","internals","delimiter","arrayPrefixGenerators","brackets","prefix","indices","repeat","strictNullHandling","skipNulls","encode","object","generateArrayPrefix","filter","sort","allowDots","isBuffer","String","toISOString","objKeys","isArray","keys","Object","opts","arrayFormat","depth","arrayLimit","parameterLimit","plainObjects","allowPrototypes","parseValues","str","parts","part","pos","indexOf","decode","hasOwnProperty","parseObject","chain","root","shift","create","cleanRoot","parseInt","isNaN","parseArrays","parseKeys","givenKey","replace","parent","child","segment","isRegExp","tempObj","newObj","merge","compact","hexTable","array","arrayToObject","source","target","mergeTarget","reduce","acc","decodeURIComponent","e","string","out","c","charCodeAt","charAt","references","refs","lookup","compacted","j","throwFirstError","pendingErrors","task","rawTask","freeTasks","RawTask","rawAsap","requestErrorThrow","makeRequestCallFromTimer","error","onerror","queue","requestFlush","flushing","flush","currentIndex","capacity","scan","newLength","makeRequestCallFromMutationObserver","toggle","observer","BrowserMutationObserver","node","document","createTextNode","observe","characterData","data","handleTimer","clearTimeout","timeoutHandle","clearInterval","intervalHandle","setInterval","global","MutationObserver","WebKitMutationObserver"],"mappings":"AAAA;ACAA,YAOA,SAASA,WAAUC,EAAQC,EAAKC,EAASC,GACvC,GAAIC,GAAS,GAAIC,SAAQ,SAAUC,EAASC,GA6B1C,QAASC,GAAQC,GACfV,UAAUC,EAAQC,GAChBS,GAAIR,EAAQQ,GACZC,QAAST,EAAQS,QACjBC,QAASV,EAAQU,UAChBC,QAAQ,SAAUC,EAAKC,GACxB,GAAIC,GAAQF,GAAOC,EAAIE,YAAc,GAOrC,IAN6B,kBAAlBf,GAAQc,QACjBA,EAAQd,EAAQc,MAAMF,EAAKC,EAAKN,EAAI,IAElCA,IAA2B,EAArBP,EAAQgB,cAChBF,GAAQ,GAENA,EAAO,CACT,GAAIG,GAAQjB,EAAQkB,UACc,mBAAvBlB,GAAQkB,aACjBD,EAAQjB,EAAQkB,WAAWN,EAAKC,EAAKN,EAAI,IAE3CU,EAAQA,GAAS,IACjBE,WAAW,WACTb,EAAQC,EAAI,IACXU,OAECL,GAAKP,EAAOO,GACXR,EAAQS,KApDnB,GAAIO,GAAM,GAAIC,QAAOC,cAIrB,IAAsB,gBAAXxB,GACT,KAAM,IAAIyB,WAAU,+BAEtB,IAAmB,gBAARxB,GACT,KAAM,IAAIwB,WAAU,iCAStB,IAPuB,kBAAZv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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;o<r.length;o++)s(r[o]);return s})","'use strict';\n\nvar Promise = require('promise');\nvar Response = require('http-response-object');\nvar handleQs = require('./lib/handle-qs.js');\n\nmodule.exports = doRequest;\nfunction doRequest(method, url, options, callback) {\n var result = new Promise(function (resolve, reject) {\n var xhr = new window.XMLHttpRequest();\n\n // check types of arguments\n\n if (typeof method !== 'string') {\n throw new TypeError('The method must be a string.');\n }\n if (typeof url !== 'string') {\n throw new TypeError('The URL/path must be a string.');\n }\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (options === null || options === undefined) {\n options = {};\n }\n if (typeof options !== 'object') {\n throw new TypeError('Options must be an object (or null).');\n }\n if (typeof callback !== 'function') {\n callback = undefined;\n }\n\n method = method.toUpperCase();\n options.headers = options.headers || {};\n\n\n function attempt(n) {\n doRequest(method, url, {\n qs: options.qs,\n headers: options.headers,\n timeout: options.timeout\n }).nodeify(function (err, res) {\n var retry = err || res.statusCode >= 400;\n if (typeof options.retry === 'function') {\n retry = options.retry(err, res, n + 1);\n }\n if (n >= (options.maxRetries | 5)) {\n retry = false;\n }\n if (retry) {\n var delay = options.retryDelay;\n if (typeof options.retryDelay === 'function') {\n delay = options.retryDelay(err, res, n + 1);\n }\n delay = delay || 200;\n setTimeout(function () {\n attempt(n + 1);\n }, delay);\n } else {\n if (err) reject(err);\n else resolve(res);\n }\n });\n }\n if (options.retry && method === 'GET') {\n return attempt(0);\n }\n\n // handle cross domain\n\n var match;\n var crossDomain = !!((match = /^([\\w-]+:)?\\/\\/([^\\/]+)/.exec(url)) && (match[2] != window.location.host));\n if (!crossDomain) options.headers['X-Requested-With'] = 'XMLHttpRequest';\n\n // handle query string\n if (options.qs) {\n url = handleQs(url, options.qs);\n }\n\n // handle json body\n if (options.json) {\n options.body = JSON.stringify(options.json);\n options.headers['Content-Type'] = 'application/json';\n }\n\n if (options.timeout) {\n xhr.timeout = options.timeout;\n var start = Date.now();\n xhr.ontimeout = function () {\n var duration = Date.now() - start;\n var err = new Error('Request timed out after ' + duration + 'ms');\n err.timeout = true;\n err.duration = duration;\n reject(err);\n };\n }\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n var headers = {};\n xhr.getAllResponseHeaders().split('\\r\\n').forEach(function (header) {\n var h = header.split(':');\n if (h.length > 1) {\n headers[h[0].toLowerCase()] = h.slice(1).join(':').trim();\n }\n });\n var res = new Response(xhr.status, headers, xhr.responseText);\n res.url = url;\n resolve(res);\n }\n };\n\n // method, url, async\n xhr.open(method, url, true);\n\n for (var name in options.headers) {\n xhr.setRequestHeader(name, options.headers[name]);\n }\n\n // avoid sending empty string (#319)\n xhr.send(options.body ? options.body : null);\n });\n result.getBody = function () {\n return result.then(function (res) { return res.getBody(); });\n };\n return result.nodeify(callback);\n}\n","'use strict';\n\nvar parse = require('qs').parse;\nvar stringify = require('qs').stringify;\n\nmodule.exports = handleQs;\nfunction handleQs(url, query) {\n url = url.split('?');\n var start = url[0];\n var qs = (url[1] || '').split('#')[0];\n var end = url[1] && url[1].split('#').length > 1 ? '#' + url[1].split('#')[1] : '';\n\n var baseQs = parse(qs);\n for (var i in query) {\n baseQs[i] = query[i];\n }\n qs = stringify(baseQs);\n if (qs !== '') {\n qs = '?' + qs;\n }\n return start + qs + end;\n}\n","'use strict';\n\nmodule.exports = require('./lib')\n","'use strict';\n\nmodule.exports = Response;\n\n/**\n * A response from a web request\n *\n * @param {Number} statusCode\n * @param {Object} headers\n * @param {Buffer} body\n * @param {String} url\n */\nfunction Response(statusCode, headers, body, url) {\n if (typeof statusCode !== 'number') {\n throw new TypeError('statusCode must be a number but was ' + (typeof statusCode));\n }\n if (headers === null) {\n throw new TypeError('headers cannot be null');\n }\n if (typeof headers !== 'object') {\n throw new TypeError('headers must be an object but was ' + (typeof headers));\n }\n this.statusCode = statusCode;\n this.headers = {};\n for (var key in headers) {\n this.headers[key.toLowerCase()] = headers[key];\n }\n this.body = body;\n this.url = url;\n}\n\nResponse.prototype.getBody = function (encoding) {\n if (this.statusCode >= 300) {\n var err = new Error('Server responded with status code '\n + this.statusCode + ':\\n' + this.body.toString());\n err.statusCode = this.statusCode;\n err.headers = this.headers;\n err.body = this.body;\n err.url = this.url;\n throw err;\n }\n return encoding ? this.body.toString(encoding) : this.body;\n};\n","'use strict';\n\nmodule.exports = require('./core.js');\nrequire('./done.js');\nrequire('./finally.js');\nrequire('./es6-extensions.js');\nrequire('./node-extensions.js');\nrequire('./synchronous.js');\n","'use strict';\n\nvar Stringify = require('./stringify');\nvar Parse = require('./parse');\n\nmodule.exports = {\n stringify: Stringify,\n parse: Parse\n};\n","'use strict';\n\nvar asap = require('asap/raw');\n\nfunction noop() {}\n\n// States:\n//\n// 0 - pending\n// 1 - fulfilled with _value\n// 2 - rejected with _value\n// 3 - adopted the state of another promise, _value\n//\n// once the state is no longer pending (0) it is immutable\n\n// All `_` prefixed properties will be reduced to `_{random number}`\n// at build time to obfuscate them and discourage their use.\n// We don't use symbols or Object.defineProperty to fully hide them\n// because the performance isn't good enough.\n\n\n// to avoid using try/catch inside critical functions, we\n// extract them to here.\nvar LAST_ERROR = null;\nvar IS_ERROR = {};\nfunction getThen(obj) {\n try {\n return obj.then;\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\n\nfunction tryCallOne(fn, a) {\n try {\n return fn(a);\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\nfunction tryCallTwo(fn, a, b) {\n try {\n fn(a, b);\n } catch (ex) {\n LAST_ERROR = ex;\n return IS_ERROR;\n }\n}\n\nmodule.exports = Promise;\n\nfunction Promise(fn) {\n if (typeof this !== 'object') {\n throw new TypeError('Promises must be constructed via new');\n }\n if (typeof fn !== 'function') {\n throw new TypeError('not a function');\n }\n this._45 = 0;\n this._81 = 0;\n this._65 = null;\n this._54 = null;\n if (fn === noop) return;\n doResolve(fn, this);\n}\nPromise._10 = null;\nPromise._97 = null;\nPromise._61 = noop;\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n if (this.constructor !== Promise) {\n return safeThen(this, onFulfilled, onRejected);\n }\n var res = new Promise(noop);\n handle(this, new Handler(onFulfilled, onRejected, res));\n return res;\n};\n\nfunction safeThen(self, onFulfilled, onRejected) {\n return new self.constructor(function (resolve, reject) {\n var res = new Promise(noop);\n res.then(resolve, reject);\n handle(self, new Handler(onFulfilled, onRejected, res));\n });\n};\nfunction handle(self, deferred) {\n while (self._81 === 3) {\n self = self._65;\n }\n if (Promise._10) {\n Promise._10(self);\n }\n if (self._81 === 0) {\n if (self._45 === 0) {\n self._45 = 1;\n self._54 = deferred;\n return;\n }\n if (self._45 === 1) {\n self._45 = 2;\n self._54 = [self._54, deferred];\n return;\n }\n self._54.push(deferred);\n return;\n }\n handleResolved(self, deferred);\n}\n\nfunction handleResolved(self, deferred) {\n asap(function() {\n var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n if (self._81 === 1) {\n resolve(deferred.promise, self._65);\n } else {\n reject(deferred.promise, self._65);\n }\n return;\n }\n var ret = tryCallOne(cb, self._65);\n if (ret === IS_ERROR) {\n reject(deferred.promise, LAST_ERROR);\n } else {\n resolve(deferred.promise, ret);\n }\n });\n}\nfunction resolve(self, newValue) {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self) {\n return reject(\n self,\n new TypeError('A promise cannot be resolved with itself.')\n );\n }\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = getThen(newValue);\n if (then === IS_ERROR) {\n return reject(self, LAST_ERROR);\n }\n if (\n then === self.then &&\n newValue instanceof Promise\n ) {\n self._81 = 3;\n self._65 = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(then.bind(newValue), self);\n return;\n }\n }\n self._81 = 1;\n self._65 = newValue;\n finale(self);\n}\n\nfunction reject(self, newValue) {\n self._81 = 2;\n self._65 = newValue;\n if (Promise._97) {\n Promise._97(self, newValue);\n }\n finale(self);\n}\nfunction finale(self) {\n if (self._45 === 1) {\n handle(self, self._54);\n self._54 = null;\n }\n if (self._45 === 2) {\n for (var i = 0; i < self._54.length; i++) {\n handle(self, self._54[i]);\n }\n self._54 = null;\n }\n}\n\nfunction Handler(onFulfilled, onRejected, promise){\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n })\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n}\n","'use strict';\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\nPromise.prototype.done = function (onFulfilled, onRejected) {\n var self = arguments.length ? this.then.apply(this, arguments) : this;\n self.then(null, function (err) {\n setTimeout(function () {\n throw err;\n }, 0);\n });\n};\n","'use strict';\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\nPromise.prototype['finally'] = function (f) {\n return this.then(function (value) {\n return Promise.resolve(f()).then(function () {\n return value;\n });\n }, function (err) {\n return Promise.resolve(f()).then(function () {\n throw err;\n });\n });\n};\n","'use strict';\n\n//This file contains the ES6 extensions to the core Promises/A+ API\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nvar TRUE = valuePromise(true);\nvar FALSE = valuePromise(false);\nvar NULL = valuePromise(null);\nvar UNDEFINED = valuePromise(undefined);\nvar ZERO = valuePromise(0);\nvar EMPTYSTRING = valuePromise('');\n\nfunction valuePromise(value) {\n var p = new Promise(Promise._61);\n p._81 = 1;\n p._65 = value;\n return p;\n}\nPromise.resolve = function (value) {\n if (value instanceof Promise) return value;\n\n if (value === null) return NULL;\n if (value === undefined) return UNDEFINED;\n if (value === true) return TRUE;\n if (value === false) return FALSE;\n if (value === 0) return ZERO;\n if (value === '') return EMPTYSTRING;\n\n if (typeof value === 'object' || typeof value === 'function') {\n try {\n var then = value.then;\n if (typeof then === 'function') {\n return new Promise(then.bind(value));\n }\n } catch (ex) {\n return new Promise(function (resolve, reject) {\n reject(ex);\n });\n }\n }\n return valuePromise(value);\n};\n\nPromise.all = function (arr) {\n var args = Array.prototype.slice.call(arr);\n\n return new Promise(function (resolve, reject) {\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n function res(i, val) {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n if (val instanceof Promise && val.then === Promise.prototype.then) {\n while (val._81 === 3) {\n val = val._65;\n }\n if (val._81 === 1) return res(i, val._65);\n if (val._81 === 2) reject(val._65);\n val.then(function (val) {\n res(i, val);\n }, reject);\n return;\n } else {\n var then = val.then;\n if (typeof then === 'function') {\n var p = new Promise(then.bind(val));\n p.then(function (val) {\n res(i, val);\n }, reject);\n return;\n }\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n }\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.reject = function (value) {\n return new Promise(function (resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function (values) {\n return new Promise(function (resolve, reject) {\n values.forEach(function(value){\n Promise.resolve(value).then(resolve, reject);\n });\n });\n};\n\n/* Prototype Methods */\n\nPromise.prototype['catch'] = function (onRejected) {\n return this.then(null, onRejected);\n};\n","'use strict';\n\n// This file contains then/promise specific extensions that are only useful\n// for node.js interop\n\nvar Promise = require('./core.js');\nvar asap = require('asap');\n\nmodule.exports = Promise;\n\n/* Static Functions */\n\nPromise.denodeify = function (fn, argumentCount) {\n if (\n typeof argumentCount === 'number' && argumentCount !== Infinity\n ) {\n return denodeifyWithCount(fn, argumentCount);\n } else {\n return denodeifyWithoutCount(fn);\n }\n}\n\nvar callbackFn = (\n 'function (err, res) {' +\n 'if (err) { rj(err); } else { rs(res); }' +\n '}'\n);\nfunction denodeifyWithCount(fn, argumentCount) {\n var args = [];\n for (var i = 0; i < argumentCount; i++) {\n args.push('a' + i);\n }\n var body = [\n 'return function (' + args.join(',') + ') {',\n 'var self = this;',\n 'return new Promise(function (rs, rj) {',\n 'var res = fn.call(',\n ['self'].concat(args).concat([callbackFn]).join(','),\n ');',\n 'if (res &&',\n '(typeof res === \"object\" || typeof res === \"function\") &&',\n 'typeof res.then === \"function\"',\n ') {rs(res);}',\n '});',\n '};'\n ].join('');\n return Function(['Promise', 'fn'], body)(Promise, fn);\n}\nfunction denodeifyWithoutCount(fn) {\n var fnLength = Math.max(fn.length - 1, 3);\n var args = [];\n for (var i = 0; i < fnLength; i++) {\n args.push('a' + i);\n }\n var body = [\n 'return function (' + args.join(',') + ') {',\n 'var self = this;',\n 'var args;',\n 'var argLength = arguments.length;',\n 'if (arguments.length > ' + fnLength + ') {',\n 'args = new Array(arguments.length + 1);',\n 'for (var i = 0; i < arguments.length; i++) {',\n 'args[i] = arguments[i];',\n '}',\n '}',\n 'return new Promise(function (rs, rj) {',\n 'var cb = ' + callbackFn + ';',\n 'var res;',\n 'switch (argLength) {',\n args.concat(['extra']).map(function (_, index) {\n return (\n 'case ' + (index) + ':' +\n 'res = fn.call(' + ['self'].concat(args.slice(0, index)).concat('cb').join(',') + ');' +\n 'break;'\n );\n }).join(''),\n 'default:',\n 'args[argLength] = cb;',\n 'res = fn.apply(self, args);',\n '}',\n \n 'if (res &&',\n '(typeof res === \"object\" || typeof res === \"function\") &&',\n 'typeof res.then === \"function\"',\n ') {rs(res);}',\n '});',\n '};'\n ].join('');\n\n return Function(\n ['Promise', 'fn'],\n body\n )(Promise, fn);\n}\n\nPromise.nodeify = function (fn) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n var callback =\n typeof args[args.length - 1] === 'function' ? args.pop() : null;\n var ctx = this;\n try {\n return fn.apply(this, arguments).nodeify(callback, ctx);\n } catch (ex) {\n if (callback === null || typeof callback == 'undefined') {\n return new Promise(function (resolve, reject) {\n reject(ex);\n });\n } else {\n asap(function () {\n callback.call(ctx, ex);\n })\n }\n }\n }\n}\n\nPromise.prototype.nodeify = function (callback, ctx) {\n if (typeof callback != 'function') return this;\n\n this.then(function (value) {\n asap(function () {\n callback.call(ctx, null, value);\n });\n }, function (err) {\n asap(function () {\n callback.call(ctx, err);\n });\n });\n}\n","'use strict';\n\nvar Promise = require('./core.js');\n\nmodule.exports = Promise;\nPromise.enableSynchronous = function () {\n Promise.prototype.isPending = function() {\n return this.getState() == 0;\n };\n\n Promise.prototype.isFulfilled = function() {\n return this.getState() == 1;\n };\n\n Promise.prototype.isRejected = function() {\n return this.getState() == 2;\n };\n\n Promise.prototype.getValue = function () {\n if (this._81 === 3) {\n return this._65.getValue();\n }\n\n if (!this.isFulfilled()) {\n throw new Error('Cannot get a value of an unfulfilled promise.');\n }\n\n return this._65;\n };\n\n Promise.prototype.getReason = function () {\n if (this._81 === 3) {\n return this._65.getReason();\n }\n\n if (!this.isRejected()) {\n throw new Error('Cannot get a rejection reason of a non-rejected promise.');\n }\n\n return this._65;\n };\n\n Promise.prototype.getState = function () {\n if (this._81 === 3) {\n return this._65.getState();\n }\n if (this._81 === -1 || this._81 === -2) {\n return 0;\n }\n\n return this._81;\n };\n};\n\nPromise.disableSynchronous = function() {\n Promise.prototype.isPending = undefined;\n Promise.prototype.isFulfilled = undefined;\n Promise.prototype.isRejected = undefined;\n Promise.prototype.getValue = undefined;\n Promise.prototype.getReason = undefined;\n Promise.prototype.getState = undefined;\n};\n","'use strict';\n\nvar Utils = require('./utils');\n\nvar internals = {\n delimiter: '&',\n arrayPrefixGenerators: {\n brackets: function (prefix) {\n return prefix + '[]';\n },\n indices: function (prefix, key) {\n return prefix + '[' + key + ']';\n },\n repeat: function (prefix) {\n return prefix;\n }\n },\n strictNullHandling: false,\n skipNulls: false,\n encode: true\n};\n\ninternals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (Utils.isBuffer(obj)) {\n obj = String(obj);\n } else if (obj instanceof Date) {\n obj = obj.toISOString();\n } else if (obj === null) {\n if (strictNullHandling) {\n return encode ? Utils.encode(prefix) : prefix;\n }\n\n obj = '';\n }\n\n if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') {\n if (encode) {\n return [Utils.encode(prefix) + '=' + Utils.encode(obj)];\n }\n return [prefix + '=' + obj];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (Array.isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n if (Array.isArray(obj)) {\n values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));\n } else {\n values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));\n }\n }\n\n return values;\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = opts || {};\n var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter;\n var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;\n var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls;\n var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode;\n var sort = typeof options.sort === 'function' ? options.sort : null;\n var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;\n var objKeys;\n var filter;\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (Array.isArray(options.filter)) {\n objKeys = filter = options.filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (options.arrayFormat in internals.arrayPrefixGenerators) {\n arrayFormat = options.arrayFormat;\n } else if ('indices' in options) {\n arrayFormat = options.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (sort) {\n objKeys.sort(sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots));\n }\n\n return keys.join(delimiter);\n};\n","'use strict';\n\nvar Utils = require('./utils');\n\nvar internals = {\n delimiter: '&',\n depth: 5,\n arrayLimit: 20,\n parameterLimit: 1000,\n strictNullHandling: false,\n plainObjects: false,\n allowPrototypes: false,\n allowDots: false\n};\n\ninternals.parseValues = function (str, options) {\n var obj = {};\n var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit);\n\n for (var i = 0; i < parts.length; ++i) {\n var part = parts[i];\n var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;\n\n if (pos === -1) {\n obj[Utils.decode(part)] = '';\n\n if (options.strictNullHandling) {\n obj[Utils.decode(part)] = null;\n }\n } else {\n var key = Utils.decode(part.slice(0, pos));\n var val = Utils.decode(part.slice(pos + 1));\n\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n obj[key] = [].concat(obj[key]).concat(val);\n } else {\n obj[key] = val;\n }\n }\n }\n\n return obj;\n};\n\ninternals.parseObject = function (chain, val, options) {\n if (!chain.length) {\n return val;\n }\n\n var root = chain.shift();\n\n var obj;\n if (root === '[]') {\n obj = [];\n obj = obj.concat(internals.parseObject(chain, val, options));\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;\n var index = parseInt(cleanRoot, 10);\n if (\n !isNaN(index) &&\n root !== cleanRoot &&\n String(index) === cleanRoot &&\n index >= 0 &&\n (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = internals.parseObject(chain, val, options);\n } else {\n obj[cleanRoot] = internals.parseObject(chain, val, options);\n }\n }\n\n return obj;\n};\n\ninternals.parseKeys = function (givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^\\.\\[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var parent = /^([^\\[\\]]*)/;\n var child = /(\\[[^\\[\\]]*\\])/g;\n\n // Get the parent\n\n var segment = parent.exec(key);\n\n // Stash the parent if it exists\n\n var keys = [];\n if (segment[1]) {\n // If we aren't using plain objects, optionally prefix keys\n // that would overwrite object prototype properties\n if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(segment[1]);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while ((segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\\[|\\]/g, ''))) {\n if (!options.allowPrototypes) {\n continue;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return internals.parseObject(keys, val, options);\n};\n\nmodule.exports = function (str, opts) {\n var options = opts || {};\n options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter;\n options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;\n options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;\n options.parseArrays = options.parseArrays !== false;\n options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots;\n options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects;\n options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes;\n options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;\n options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;\n\n if (\n str === '' ||\n str === null ||\n typeof str === 'undefined'\n ) {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = internals.parseKeys(key, tempObj[key], options);\n obj = Utils.merge(obj, newObj, options);\n }\n\n return Utils.compact(obj);\n};\n","'use strict';\n\nvar hexTable = (function () {\n var array = new Array(256);\n for (var i = 0; i < 256; ++i) {\n array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();\n }\n\n return array;\n}());\n\nexports.arrayToObject = function (source, options) {\n var obj = options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nexports.merge = function (target, source, options) {\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (Array.isArray(target)) {\n target.push(source);\n } else if (typeof target === 'object') {\n target[source] = true;\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (Array.isArray(target) && !Array.isArray(source)) {\n mergeTarget = exports.arrayToObject(target, options);\n }\n\n\treturn Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (Object.prototype.hasOwnProperty.call(acc, key)) {\n acc[key] = exports.merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n\t\treturn acc;\n }, mergeTarget);\n};\n\nexports.decode = function (str) {\n try {\n return decodeURIComponent(str.replace(/\\+/g, ' '));\n } catch (e) {\n return str;\n }\n};\n\nexports.encode = function (str) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = typeof str === 'string' ? str : String(str);\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D || // -\n c === 0x2E || // .\n c === 0x5F || // _\n c === 0x7E || // ~\n (c >= 0x30 && c <= 0x39) || // 0-9\n (c >= 0x41 && c <= 0x5A) || // a-z\n (c >= 0x61 && c <= 0x7A) // A-Z\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n }\n\n return out;\n};\n\nexports.compact = function (obj, references) {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n var refs = references || [];\n var lookup = refs.indexOf(obj);\n if (lookup !== -1) {\n return refs[lookup];\n }\n\n refs.push(obj);\n\n if (Array.isArray(obj)) {\n var compacted = [];\n\n for (var i = 0; i < obj.length; ++i) {\n if (typeof obj[i] !== 'undefined') {\n compacted.push(obj[i]);\n }\n }\n\n return compacted;\n }\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n obj[key] = exports.compact(obj[key], refs);\n }\n\n return obj;\n};\n\nexports.isRegExp = function (obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nexports.isBuffer = function (obj) {\n if (obj === null || typeof obj === 'undefined') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n","\"use strict\";\n\n// rawAsap provides everything we need except exception management.\nvar rawAsap = require(\"./raw\");\n// RawTasks are recycled to reduce GC churn.\nvar freeTasks = [];\n// We queue errors to ensure they are thrown in right order (FIFO).\n// Array-as-queue is good enough here, since we are just dealing with exceptions.\nvar pendingErrors = [];\nvar requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);\n\nfunction throwFirstError() {\n if (pendingErrors.length) {\n throw pendingErrors.shift();\n }\n}\n\n/**\n * Calls a task as soon as possible after returning, in its own event, with priority\n * over other events like animation, reflow, and repaint. An error thrown from an\n * event will not interrupt, nor even substantially slow down the processing of\n * other events, but will be rather postponed to a lower priority event.\n * @param {{call}} task A callable object, typically a function that takes no\n * arguments.\n */\nmodule.exports = asap;\nfunction asap(task) {\n var rawTask;\n if (freeTasks.length) {\n rawTask = freeTasks.pop();\n } else {\n rawTask = new RawTask();\n }\n rawTask.task = task;\n rawAsap(rawTask);\n}\n\n// We wrap tasks with recyclable task objects. A task object implements\n// `call`, just like a function.\nfunction RawTask() {\n this.task = null;\n}\n\n// The sole purpose of wrapping the task is to catch the exception and recycle\n// the task object after its single use.\nRawTask.prototype.call = function () {\n try {\n this.task.call();\n } catch (error) {\n if (asap.onerror) {\n // This hook exists purely for testing purposes.\n // Its name will be periodically randomized to break any code that\n // depends on its existence.\n asap.onerror(error);\n } else {\n // In a web browser, exceptions are not fatal. However, to avoid\n // slowing down the queue of pending tasks, we rethrow the error in a\n // lower priority turn.\n pendingErrors.push(error);\n requestErrorThrow();\n }\n } finally {\n this.task = null;\n freeTasks[freeTasks.length] = this;\n }\n};\n","\"use strict\";\n\n// Use the fastest means possible to execute a task in its own turn, with\n// priority over other events including IO, animation, reflow, and redraw\n// events in browsers.\n//\n// An exception thrown by a task will permanently interrupt the processing of\n// subsequent tasks. The higher level `asap` function ensures that if an\n// exception is thrown by a task, that the task queue will continue flushing as\n// soon as possible, but if you use `rawAsap` directly, you are responsible to\n// either ensure that no exceptions are thrown from your task, or to manually\n// call `rawAsap.requestFlush` if an exception is thrown.\nmodule.exports = rawAsap;\nfunction rawAsap(task) {\n if (!queue.length) {\n requestFlush();\n flushing = true;\n }\n // Equivalent to push, but avoids a function call.\n queue[queue.length] = task;\n}\n\nvar queue = [];\n// Once a flush has been requested, no further calls to `requestFlush` are\n// necessary until the next `flush` completes.\nvar flushing = false;\n// `requestFlush` is an implementation-specific method that attempts to kick\n// off a `flush` event as quickly as possible. `flush` will attempt to exhaust\n// the event queue before yielding to the browser's own event loop.\nvar requestFlush;\n// The position of the next task to execute in the task queue. This is\n// preserved between calls to `flush` so that it can be resumed if\n// a task throws an exception.\nvar index = 0;\n// If a task schedules additional tasks recursively, the task queue can grow\n// unbounded. To prevent memory exhaustion, the task queue will periodically\n// truncate already-completed tasks.\nvar capacity = 1024;\n\n// The flush function processes all tasks that have been scheduled with\n// `rawAsap` unless and until one of those tasks throws an exception.\n// If a task throws an exception, `flush` ensures that its state will remain\n// consistent and will resume where it left off when called again.\n// However, `flush` does not make any arrangements to be called again if an\n// exception is thrown.\nfunction flush() {\n while (index < queue.length) {\n var currentIndex = index;\n // Advance the index before calling the task. This ensures that we will\n // begin flushing on the next task the task throws an error.\n index = index + 1;\n queue[currentIndex].call();\n // Prevent leaking memory for long chains of recursive calls to `asap`.\n // If we call `asap` within tasks scheduled by `asap`, the queue will\n // grow, but to avoid an O(n) walk for every task we execute, we don't\n // shift tasks off the queue after they have been executed.\n // Instead, we periodically shift 1024 tasks off the queue.\n if (index > capacity) {\n // Manually shift all values starting at the index back to the\n // beginning of the queue.\n for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {\n queue[scan] = queue[scan + index];\n }\n queue.length -= index;\n index = 0;\n }\n }\n queue.length = 0;\n index = 0;\n flushing = false;\n}\n\n// `requestFlush` is implemented using a strategy based on data collected from\n// every available SauceLabs Selenium web driver worker at time of writing.\n// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593\n\n// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that\n// have WebKitMutationObserver but not un-prefixed MutationObserver.\n// Must use `global` instead of `window` to work in both frames and web\n// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.\nvar BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver;\n\n// MutationObservers are desirable because they have high priority and work\n// reliably everywhere they are implemented.\n// They are implemented in all modern browsers.\n//\n// - Android 4-4.3\n// - Chrome 26-34\n// - Firefox 14-29\n// - Internet Explorer 11\n// - iPad Safari 6-7.1\n// - iPhone Safari 7-7.1\n// - Safari 6-7\nif (typeof BrowserMutationObserver === \"function\") {\n requestFlush = makeRequestCallFromMutationObserver(flush);\n\n// MessageChannels are desirable because they give direct access to the HTML\n// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera\n// 11-12, and in web workers in many engines.\n// Although message channels yield to any queued rendering and IO tasks, they\n// would be better than imposing the 4ms delay of timers.\n// However, they do not work reliably in Internet Explorer or Safari.\n\n// Internet Explorer 10 is the only browser that has setImmediate but does\n// not have MutationObservers.\n// Although setImmediate yields to the browser's renderer, it would be\n// preferrable to falling back to setTimeout since it does not have\n// the minimum 4ms penalty.\n// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and\n// Desktop to a lesser extent) that renders both setImmediate and\n// MessageChannel useless for the purposes of ASAP.\n// https://github.com/kriskowal/q/issues/396\n\n// Timers are implemented universally.\n// We fall back to timers in workers in most engines, and in foreground\n// contexts in the following browsers.\n// However, note that even this simple case requires nuances to operate in a\n// broad spectrum of browsers.\n//\n// - Firefox 3-13\n// - Internet Explorer 6-9\n// - iPad Safari 4.3\n// - Lynx 2.8.7\n} else {\n requestFlush = makeRequestCallFromTimer(flush);\n}\n\n// `requestFlush` requests that the high priority event queue be flushed as\n// soon as possible.\n// This is useful to prevent an error thrown in a task from stalling the event\n// queue if the exception handled by Node.js’s\n// `process.on(\"uncaughtException\")` or by a domain.\nrawAsap.requestFlush = requestFlush;\n\n// To request a high priority event, we induce a mutation observer by toggling\n// the text of a text node between \"1\" and \"-1\".\nfunction makeRequestCallFromMutationObserver(callback) {\n var toggle = 1;\n var observer = new BrowserMutationObserver(callback);\n var node = document.createTextNode(\"\");\n observer.observe(node, {characterData: true});\n return function requestCall() {\n toggle = -toggle;\n node.data = toggle;\n };\n}\n\n// The message channel technique was discovered by Malte Ubl and was the\n// original foundation for this library.\n// http://www.nonblocking.io/2011/06/windownexttick.html\n\n// Safari 6.0.5 (at least) intermittently fails to create message ports on a\n// page's first load. Thankfully, this version of Safari supports\n// MutationObservers, so we don't need to fall back in that case.\n\n// function makeRequestCallFromMessageChannel(callback) {\n// var channel = new MessageChannel();\n// channel.port1.onmessage = callback;\n// return function requestCall() {\n// channel.port2.postMessage(0);\n// };\n// }\n\n// For reasons explained above, we are also unable to use `setImmediate`\n// under any circumstances.\n// Even if we were, there is another bug in Internet Explorer 10.\n// It is not sufficient to assign `setImmediate` to `requestFlush` because\n// `setImmediate` must be called *by name* and therefore must be wrapped in a\n// closure.\n// Never forget.\n\n// function makeRequestCallFromSetImmediate(callback) {\n// return function requestCall() {\n// setImmediate(callback);\n// };\n// }\n\n// Safari 6.0 has a problem where timers will get lost while the user is\n// scrolling. This problem does not impact ASAP because Safari 6.0 supports\n// mutation observers, so that implementation is used instead.\n// However, if we ever elect to use timers in Safari, the prevalent work-around\n// is to add a scroll event listener that calls for a flush.\n\n// `setTimeout` does not call the passed callback if the delay is less than\n// approximately 7 in web workers in Firefox 8 through 18, and sometimes not\n// even then.\n\nfunction makeRequestCallFromTimer(callback) {\n return function requestCall() {\n // We dispatch a timeout with a specified delay of 0 for engines that\n // can reliably accommodate that request. This will usually be snapped\n // to a 4 milisecond delay, but once we're flushing, there's no delay\n // between events.\n var timeoutHandle = setTimeout(handleTimer, 0);\n // However, since this timer gets frequently dropped in Firefox\n // workers, we enlist an interval handle that will try to fire\n // an event 20 times per second until it succeeds.\n var intervalHandle = setInterval(handleTimer, 50);\n\n function handleTimer() {\n // Whichever timer succeeds will cancel both timers and\n // execute the callback.\n clearTimeout(timeoutHandle);\n clearInterval(intervalHandle);\n callback();\n }\n };\n}\n\n// This is for `asap.js` only.\n// Its name will be periodically randomized to break any code that depends on\n// its existence.\nrawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;\n\n// ASAP was originally a nextTick shim included in Q. This was factored out\n// into this ASAP package. It was later adapted to RSVP which made further\n// amendments. These decisions, particularly to marginalize MessageChannel and\n// to capture the MutationObserver implementation in a closure, were integrated\n// back into ASAP proper.\n// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js\n"]} \ No newline at end of file
diff --git a/node_modules/then-request/index.js b/node_modules/then-request/index.js
new file mode 100644
index 0000000..fc0657b
--- /dev/null
+++ b/node_modules/then-request/index.js
@@ -0,0 +1,93 @@
+'use strict';
+
+var assert = require('assert');
+var parseUrl = require('url').parse;
+var Promise = require('promise');
+var concat = require('concat-stream');
+var Response = require('http-response-object');
+var caseless = require('caseless');
+var handleQs = require('./lib/handle-qs.js');
+
+module.exports = doRequest;
+module.exports._request = require('http-basic');
+function doRequest(method, url, options, callback) {
+ var result = new Promise(function (resolve, reject) {
+ // check types of arguments
+
+ if (typeof method !== 'string') {
+ throw new TypeError('The method must be a string.');
+ }
+ if (typeof url !== 'string') {
+ throw new TypeError('The URL/path must be a string.');
+ }
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ }
+ if (options === null || options === undefined) {
+ options = {};
+ }
+ if (typeof options !== 'object') {
+ throw new TypeError('Options must be an object (or null).');
+ }
+ if (typeof callback !== 'function') {
+ callback = undefined;
+ }
+
+ method = method.toUpperCase();
+ options.headers = options.headers || {};
+ var headers = caseless(options.headers);
+
+ // handle query string
+ if (options.qs) {
+ url = handleQs(url, options.qs);
+ }
+
+ // handle json body
+ if (options.json) {
+ options.body = JSON.stringify(options.json);
+ headers.set('Content-Type', 'application/json');
+ }
+
+ var body = options.body ? options.body : new Buffer(0);
+ if (typeof body === 'string') body = new Buffer(body);
+ assert(Buffer.isBuffer(body), 'body should be a Buffer or a String');
+ if (!headers.has('Content-Length')) {
+ headers.set('Content-Length', body.length);
+ }
+
+ var req = module.exports._request(method, url, {
+ allowRedirectHeaders: options.allowRedirectHeaders,
+ headers: options.headers,
+ followRedirects: options.followRedirects !== false,
+ maxRedirects: options.maxRedirects,
+ gzip: options.gzip !== false,
+ cache: options.cache,
+ timeout: options.timeout,
+ socketTimeout: options.socketTimeout,
+ retry: options.retry,
+ retryDelay: options.retryDelay,
+ maxRetries: options.maxRetries
+ }, function (err, res) {
+ if (err) return reject(err);
+ res.body.on('error', reject);
+ res.body.pipe(concat(function (body) {
+ resolve(
+ new Response(
+ res.statusCode,
+ res.headers, Array.isArray(body) ? new Buffer(0) : body,
+ result.url
+ )
+ );
+ }));
+ });
+
+ if (req) {
+ req.end(body);
+ }
+ });
+ result.getBody = function (encoding) {
+ return result.then(function (res) { return res.getBody(encoding); });
+ };
+ return result.nodeify(callback);
+}
diff --git a/node_modules/then-request/lib/handle-qs.js b/node_modules/then-request/lib/handle-qs.js
new file mode 100644
index 0000000..9163520
--- /dev/null
+++ b/node_modules/then-request/lib/handle-qs.js
@@ -0,0 +1,22 @@
+'use strict';
+
+var parse = require('qs').parse;
+var stringify = require('qs').stringify;
+
+module.exports = handleQs;
+function handleQs(url, query) {
+ url = url.split('?');
+ var start = url[0];
+ var qs = (url[1] || '').split('#')[0];
+ var end = url[1] && url[1].split('#').length > 1 ? '#' + url[1].split('#')[1] : '';
+
+ var baseQs = parse(qs);
+ for (var i in query) {
+ baseQs[i] = query[i];
+ }
+ qs = stringify(baseQs);
+ if (qs !== '') {
+ qs = '?' + qs;
+ }
+ return start + qs + end;
+}
diff --git a/node_modules/then-request/package.json b/node_modules/then-request/package.json
new file mode 100644
index 0000000..19e8cee
--- /dev/null
+++ b/node_modules/then-request/package.json
@@ -0,0 +1,69 @@
+{
+ "_from": "then-request@^2.0.1",
+ "_id": "[email protected]",
+ "_inBundle": false,
+ "_integrity": "sha1-ZnizL6DKIY/laZgbvYhxtZQGDYE=",
+ "_location": "/then-request",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "then-request@^2.0.1",
+ "name": "then-request",
+ "escapedName": "then-request",
+ "rawSpec": "^2.0.1",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.1"
+ },
+ "_requiredBy": [
+ "/sync-request"
+ ],
+ "_resolved": "https://registry.npmjs.org/then-request/-/then-request-2.2.0.tgz",
+ "_shasum": "6678b32fa0ca218fe569981bbd8871b594060d81",
+ "_spec": "then-request@^2.0.1",
+ "_where": "E:\\Documents\\GitHub\\s5nical\\node_modules\\sync-request",
+ "author": {
+ "name": "ForbesLindesay"
+ },
+ "browser": "./browser.js",
+ "bugs": {
+ "url": "https://github.com/then/then-request/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "caseless": "~0.11.0",
+ "concat-stream": "^1.4.7",
+ "http-basic": "^2.5.1",
+ "http-response-object": "^1.1.0",
+ "promise": "^7.1.1",
+ "qs": "^6.1.0"
+ },
+ "deprecated": false,
+ "description": "A request library that returns promises, inspired by request",
+ "devDependencies": {
+ "browserify": "^8.1.1",
+ "exorcist": "^0.1.6",
+ "istanbul": "^0.3.5",
+ "minifyify": "^6.0.0",
+ "mkdirp": "^0.5.0",
+ "rimraf": "^2.2.8",
+ "testit": "^1.2.0"
+ },
+ "homepage": "https://github.com/then/then-request#readme",
+ "keywords": [],
+ "license": "MIT",
+ "name": "then-request",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/then/then-request.git"
+ },
+ "scripts": {
+ "build": "npm run build:full && npm run build:min",
+ "build:full": "browserify -d --standalone request browser.js | exorcist -u request.js.map dist/request.js.map > dist/request.js",
+ "build:min": "browserify -d --standalone request browser.js -p [minifyify --compressPath . --map request.min.js.map --output dist/request.min.js.map] > dist/request.min.js",
+ "prebuild": "rimraf dist && mkdirp dist",
+ "prepublish": "npm run build",
+ "test": "node test/index.js && istanbul cover test/index.js"
+ },
+ "version": "2.2.0"
+}
diff --git a/node_modules/then-request/test/browser.js b/node_modules/then-request/test/browser.js
new file mode 100644
index 0000000..cd586c2
--- /dev/null
+++ b/node_modules/then-request/test/browser.js
@@ -0,0 +1,53 @@
+'use strict';
+
+var assert = require('assert');
+var getResponse = require('./get-mock-response.js');
+var window = (global.window = {});
+
+window.XMLHttpRequest = XMLHttpRequest;
+function XMLHttpRequest() {
+ assert(arguments.length === 0);
+ this._headers = {};
+ this._responseHeaders = '';
+};
+// XMLHttpRequest.prototype.onreadystatechange gets assigned by user
+XMLHttpRequest.prototype.open = function (method, url, async) {
+ assert(async === true, 'All requests must be async');
+ this._method = method;
+ this._url = url;
+};
+XMLHttpRequest.prototype.setRequestHeader = function (name, value) {
+ this._headers[name] = value;
+};
+XMLHttpRequest.prototype.send = function (body) {
+ assert(typeof body === 'string' || body === null, 'body must be a string or null');
+ this.readyState = 3;
+ this.onreadystatechange();
+ this.readyState = 4;
+ var res = getResponse(this._method, this._url, this._headers, body, {isClient: true});
+ this.status = res.statusCode;
+ this._responseHeaders = Object.keys(res.headers).map(function (header) {
+ return header + ': ' + res.headers[header];
+ }).join('\r\n');
+ this.responseText = res.body;
+ this.onreadystatechange();
+};
+XMLHttpRequest.prototype.getAllResponseHeaders = function () {
+ return this._responseHeaders;
+}
+window.location = {};
+window.location.host = 'http://example.com';
+
+
+/*
+if (xhr.readyState === 4) {
+ var headers = {};
+ xhr.getAllResponseHeaders().split('\r\n').forEach(function (header) {
+ var h = header.split(':');
+ if (h.length > 1) {
+ headers[h[0].toLowerCase()] = h.slice(1).join(':').trim();
+ }
+ });
+ resolve(new Response(xhr.status, headers, xhr.responseText));
+}
+*/
diff --git a/node_modules/then-request/test/get-mock-response.js b/node_modules/then-request/test/get-mock-response.js
new file mode 100644
index 0000000..cb58c4d
--- /dev/null
+++ b/node_modules/then-request/test/get-mock-response.js
@@ -0,0 +1,20 @@
+'use strict';
+
+var assert = require('assert');
+var Response = require('http-response-object');
+
+module.exports = getResponse;
+function getResponse(method, url, headers, body, options) {
+ var isClient = options.isClient;
+ if (method === 'GET' && url === 'http://example.com') {
+ return new Response(200, {FoO: 'bar'}, 'body');
+ }
+ if (method === 'GET' && url === 'http://example.com?foo=baz') {
+ return new Response(200, {FoO: 'baz'}, 'body');
+ }
+ if (method === 'POST' && url === 'http://example.com') {
+ assert(headers['Content-Type'] === 'application/json');
+ assert(JSON.parse(body.toString()).foo === 'baz');
+ return new Response(200, {}, 'json body');
+ }
+}
diff --git a/node_modules/then-request/test/index.js b/node_modules/then-request/test/index.js
new file mode 100644
index 0000000..019a2f8
--- /dev/null
+++ b/node_modules/then-request/test/index.js
@@ -0,0 +1,97 @@
+'use strict';
+
+var assert = require('assert');
+var test = require('testit');
+var Promise = require('promise');
+
+test('./lib/handle-qs.js', function () {
+ var handleQs = require('../lib/handle-qs.js');
+
+ assert(handleQs('http://example.com/', {}) === 'http://example.com/');
+ assert(handleQs('http://example.com/?foo=bar', {}) === 'http://example.com/?foo=bar');
+ assert(handleQs('http://example.com/', {foo: 'bar'}) === 'http://example.com/?foo=bar');
+ assert(handleQs('http://example.com/', {foo: {bar: 'baz'}}) === 'http://example.com/?foo%5Bbar%5D=baz');
+ assert(handleQs('http://example.com/', {foo: 'bar', bing: 'bong'}) === 'http://example.com/?foo=bar&bing=bong');
+ assert(handleQs('http://example.com/?foo=bar', {bing: 'bong'}) === 'http://example.com/?foo=bar&bing=bong');
+ assert(handleQs('http://example.com/?foo=bar#ding', {bing: 'bong'}) === 'http://example.com/?foo=bar&bing=bong#ding');
+});
+
+
+require('./browser.js');
+require('./server.js');
+
+function testEnv(env) {
+ var request = require(env === 'browser' ? '../browser.js' : '../index.js');
+ test(env + ' - GET', function () {
+ return request('GET', 'http://example.com').then(function (res) {
+ assert(res.statusCode === 200);
+ assert(res.headers['foo'] === 'bar');
+ assert(res.body.toString() === 'body');
+ });
+ });
+ test(env + ' - GET query', function () {
+ return request('GET', 'http://example.com', {qs: {foo: 'baz'}}).then(function (res) {
+ assert(res.statusCode === 200);
+ assert(res.headers['foo'] === 'baz');
+ assert(res.body.toString() === 'body');
+ });
+ });
+ test(env + ' - GET -> .getBody("utf8")', function () {
+ return request('GET', 'http://example.com').getBody('utf8').then(function (body) {
+ assert(body === 'body');
+ });
+ });
+ test(env + ' - POST json', function () {
+ return request('POST', 'http://example.com', {json: {foo: 'baz'}}).then(function (res) {
+ assert(res.statusCode === 200);
+ assert(res.body.toString() === 'json body');
+ });
+ });
+
+
+ test(env + ' - invalid method', function () {
+ return request({}, 'http://example.com').then(function (res) {
+ throw new Error('Expected an error');
+ }, function (err) {
+ assert(err instanceof TypeError);
+ });
+ });
+ test(env + ' - invalid url', function () {
+ return request('GET', {}).then(function (res) {
+ throw new Error('Expected an error');
+ }, function (err) {
+ assert(err instanceof TypeError);
+ });
+ });
+ test(env + ' - invalid options', function () {
+ return request('GET', 'http://example.com', 'options').then(function (res) {
+ throw new Error('Expected an error');
+ }, function (err) {
+ assert(err instanceof TypeError);
+ });
+ });
+ test(env + ' - Callbacks', function () {
+ return new Promise(function (resolve, reject) {
+ return request('GET', 'http://example.com', function (err, res) {
+ if (err) return reject(err);
+ assert(res.statusCode === 200);
+ assert(res.headers['foo'] === 'bar');
+ assert(res.body.toString() === 'body');
+ resolve(null);
+ });
+ });
+ });
+ test(env + ' - Callbacks', function () {
+ return new Promise(function (resolve, reject) {
+ return request('GET', 'http://example.com', {}, function (err, res) {
+ if (err) return reject(err);
+ assert(res.statusCode === 200);
+ assert(res.headers['foo'] === 'bar');
+ assert(res.body.toString() === 'body');
+ resolve(null);
+ });
+ });
+ });
+}
+testEnv('browser');
+testEnv('server');
diff --git a/node_modules/then-request/test/server.js b/node_modules/then-request/test/server.js
new file mode 100644
index 0000000..614bb39
--- /dev/null
+++ b/node_modules/then-request/test/server.js
@@ -0,0 +1,25 @@
+'use strict';
+
+var assert = require('assert');
+var PassThrough = require('stream').PassThrough;
+var getResponse = require('./get-mock-response.js');
+
+require('../index.js')._request = function (method, url, options, callback) {
+ assert(typeof callback === 'function');
+ var duplex = !(method === 'GET' || method === 'DELETE' || method === 'HEAD');
+ if (duplex) {
+ return {
+ end: function (body) {
+ gotResponse(getResponse(method, url, options.headers, body, {isClient: false}));
+ }
+ };
+ } else {
+ gotResponse(getResponse(method, url, options.headers, null, {isClient: false}));
+ }
+ function gotResponse(res) {
+ var stream = new PassThrough();
+ stream.end(res.body);
+ res.body = stream;
+ callback(null, res);
+ }
+};