contentful 9.1.22 → 9.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contentful.browser.js +4147 -196
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +10 -1
- package/dist/contentful.node.js +2266 -323
- package/dist/contentful.node.js.map +1 -1
- package/dist/contentful.node.min.js +13 -1
- package/dist/es-modules/contentful.js +1 -1
- package/package.json +2 -2
|
@@ -124,9 +124,10 @@ var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "../node_modules
|
|
|
124
124
|
var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "../node_modules/axios/lib/core/buildFullPath.js");
|
|
125
125
|
var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "../node_modules/axios/lib/helpers/parseHeaders.js");
|
|
126
126
|
var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "../node_modules/axios/lib/helpers/isURLSameOrigin.js");
|
|
127
|
-
var
|
|
127
|
+
var url = __webpack_require__(/*! url */ "../node_modules/url/url.js");
|
|
128
128
|
var transitionalDefaults = __webpack_require__(/*! ../defaults/transitional */ "../node_modules/axios/lib/defaults/transitional.js");
|
|
129
|
-
var
|
|
129
|
+
var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "../node_modules/axios/lib/core/AxiosError.js");
|
|
130
|
+
var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "../node_modules/axios/lib/cancel/CanceledError.js");
|
|
130
131
|
|
|
131
132
|
module.exports = function xhrAdapter(config) {
|
|
132
133
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
@@ -144,10 +145,6 @@ module.exports = function xhrAdapter(config) {
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
if (utils.isFormData(requestData)) {
|
|
148
|
-
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
149
|
-
}
|
|
150
|
-
|
|
151
148
|
var request = new XMLHttpRequest();
|
|
152
149
|
|
|
153
150
|
// HTTP basic authentication
|
|
@@ -158,6 +155,9 @@ module.exports = function xhrAdapter(config) {
|
|
|
158
155
|
}
|
|
159
156
|
|
|
160
157
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
158
|
+
var parsed = url.parse(fullPath);
|
|
159
|
+
var protocol = utils.getProtocol(parsed.protocol);
|
|
160
|
+
|
|
161
161
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
162
162
|
|
|
163
163
|
// Set the request timeout in MS
|
|
@@ -221,7 +221,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
reject(
|
|
224
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
225
225
|
|
|
226
226
|
// Clean up request
|
|
227
227
|
request = null;
|
|
@@ -231,7 +231,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
231
231
|
request.onerror = function handleError() {
|
|
232
232
|
// Real errors are hidden from us by the browser
|
|
233
233
|
// onerror should only fire if it's a network error
|
|
234
|
-
reject(
|
|
234
|
+
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, request));
|
|
235
235
|
|
|
236
236
|
// Clean up request
|
|
237
237
|
request = null;
|
|
@@ -244,10 +244,10 @@ module.exports = function xhrAdapter(config) {
|
|
|
244
244
|
if (config.timeoutErrorMessage) {
|
|
245
245
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
246
246
|
}
|
|
247
|
-
reject(
|
|
247
|
+
reject(new AxiosError(
|
|
248
248
|
timeoutErrorMessage,
|
|
249
|
+
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
249
250
|
config,
|
|
250
|
-
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
251
251
|
request));
|
|
252
252
|
|
|
253
253
|
// Clean up request
|
|
@@ -308,7 +308,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
308
308
|
if (!request) {
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
reject(!cancel || (cancel && cancel.type) ? new
|
|
311
|
+
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
|
|
312
312
|
request.abort();
|
|
313
313
|
request = null;
|
|
314
314
|
};
|
|
@@ -323,6 +323,16 @@ module.exports = function xhrAdapter(config) {
|
|
|
323
323
|
requestData = null;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
if (parsed.path === null) {
|
|
327
|
+
reject(new AxiosError('Malformed URL ' + fullPath, AxiosError.ERR_BAD_REQUEST, config));
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (!utils.supportedProtocols.includes(protocol)) {
|
|
332
|
+
reject(new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config));
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
|
|
326
336
|
// Send the request
|
|
327
337
|
request.send(requestData);
|
|
328
338
|
});
|
|
@@ -378,10 +388,17 @@ var axios = createInstance(defaults);
|
|
|
378
388
|
axios.Axios = Axios;
|
|
379
389
|
|
|
380
390
|
// Expose Cancel & CancelToken
|
|
381
|
-
axios.
|
|
391
|
+
axios.CanceledError = __webpack_require__(/*! ./cancel/CanceledError */ "../node_modules/axios/lib/cancel/CanceledError.js");
|
|
382
392
|
axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "../node_modules/axios/lib/cancel/CancelToken.js");
|
|
383
393
|
axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "../node_modules/axios/lib/cancel/isCancel.js");
|
|
384
394
|
axios.VERSION = __webpack_require__(/*! ./env/data */ "../node_modules/axios/lib/env/data.js").version;
|
|
395
|
+
axios.toFormData = __webpack_require__(/*! ./helpers/toFormData */ "../node_modules/axios/lib/helpers/toFormData.js");
|
|
396
|
+
|
|
397
|
+
// Expose AxiosError class
|
|
398
|
+
axios.AxiosError = __webpack_require__(/*! ../lib/core/AxiosError */ "../node_modules/axios/lib/core/AxiosError.js");
|
|
399
|
+
|
|
400
|
+
// alias for CanceledError for backward compatibility
|
|
401
|
+
axios.Cancel = axios.CanceledError;
|
|
385
402
|
|
|
386
403
|
// Expose all/spread
|
|
387
404
|
axios.all = function all(promises) {
|
|
@@ -398,37 +415,6 @@ module.exports = axios;
|
|
|
398
415
|
module.exports.default = axios;
|
|
399
416
|
|
|
400
417
|
|
|
401
|
-
/***/ }),
|
|
402
|
-
|
|
403
|
-
/***/ "../node_modules/axios/lib/cancel/Cancel.js":
|
|
404
|
-
/*!**************************************************!*\
|
|
405
|
-
!*** ../node_modules/axios/lib/cancel/Cancel.js ***!
|
|
406
|
-
\**************************************************/
|
|
407
|
-
/*! no static exports found */
|
|
408
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
409
|
-
|
|
410
|
-
"use strict";
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
415
|
-
*
|
|
416
|
-
* @class
|
|
417
|
-
* @param {string=} message The message.
|
|
418
|
-
*/
|
|
419
|
-
function Cancel(message) {
|
|
420
|
-
this.message = message;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
Cancel.prototype.toString = function toString() {
|
|
424
|
-
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
Cancel.prototype.__CANCEL__ = true;
|
|
428
|
-
|
|
429
|
-
module.exports = Cancel;
|
|
430
|
-
|
|
431
|
-
|
|
432
418
|
/***/ }),
|
|
433
419
|
|
|
434
420
|
/***/ "../node_modules/axios/lib/cancel/CancelToken.js":
|
|
@@ -441,7 +427,7 @@ module.exports = Cancel;
|
|
|
441
427
|
"use strict";
|
|
442
428
|
|
|
443
429
|
|
|
444
|
-
var
|
|
430
|
+
var CanceledError = __webpack_require__(/*! ./CanceledError */ "../node_modules/axios/lib/cancel/CanceledError.js");
|
|
445
431
|
|
|
446
432
|
/**
|
|
447
433
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
@@ -497,13 +483,13 @@ function CancelToken(executor) {
|
|
|
497
483
|
return;
|
|
498
484
|
}
|
|
499
485
|
|
|
500
|
-
token.reason = new
|
|
486
|
+
token.reason = new CanceledError(message);
|
|
501
487
|
resolvePromise(token.reason);
|
|
502
488
|
});
|
|
503
489
|
}
|
|
504
490
|
|
|
505
491
|
/**
|
|
506
|
-
* Throws a `
|
|
492
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
507
493
|
*/
|
|
508
494
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
509
495
|
if (this.reason) {
|
|
@@ -560,6 +546,40 @@ CancelToken.source = function source() {
|
|
|
560
546
|
module.exports = CancelToken;
|
|
561
547
|
|
|
562
548
|
|
|
549
|
+
/***/ }),
|
|
550
|
+
|
|
551
|
+
/***/ "../node_modules/axios/lib/cancel/CanceledError.js":
|
|
552
|
+
/*!*********************************************************!*\
|
|
553
|
+
!*** ../node_modules/axios/lib/cancel/CanceledError.js ***!
|
|
554
|
+
\*********************************************************/
|
|
555
|
+
/*! no static exports found */
|
|
556
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
557
|
+
|
|
558
|
+
"use strict";
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "../node_modules/axios/lib/core/AxiosError.js");
|
|
562
|
+
var utils = __webpack_require__(/*! ../utils */ "../node_modules/axios/lib/utils.js");
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
566
|
+
*
|
|
567
|
+
* @class
|
|
568
|
+
* @param {string=} message The message.
|
|
569
|
+
*/
|
|
570
|
+
function CanceledError(message) {
|
|
571
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
572
|
+
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED);
|
|
573
|
+
this.name = 'CanceledError';
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
577
|
+
__CANCEL__: true
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
module.exports = CanceledError;
|
|
581
|
+
|
|
582
|
+
|
|
563
583
|
/***/ }),
|
|
564
584
|
|
|
565
585
|
/***/ "../node_modules/axios/lib/cancel/isCancel.js":
|
|
@@ -594,6 +614,7 @@ var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "../node_modules/a
|
|
|
594
614
|
var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "../node_modules/axios/lib/core/InterceptorManager.js");
|
|
595
615
|
var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "../node_modules/axios/lib/core/dispatchRequest.js");
|
|
596
616
|
var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "../node_modules/axios/lib/core/mergeConfig.js");
|
|
617
|
+
var buildFullPath = __webpack_require__(/*! ./buildFullPath */ "../node_modules/axios/lib/core/buildFullPath.js");
|
|
597
618
|
var validator = __webpack_require__(/*! ../helpers/validator */ "../node_modules/axios/lib/helpers/validator.js");
|
|
598
619
|
|
|
599
620
|
var validators = validator.validators;
|
|
@@ -708,7 +729,8 @@ Axios.prototype.request = function request(configOrUrl, config) {
|
|
|
708
729
|
|
|
709
730
|
Axios.prototype.getUri = function getUri(config) {
|
|
710
731
|
config = mergeConfig(this.defaults, config);
|
|
711
|
-
|
|
732
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
733
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
712
734
|
};
|
|
713
735
|
|
|
714
736
|
// Provide aliases for supported request methods
|
|
@@ -725,18 +747,126 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
725
747
|
|
|
726
748
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
727
749
|
/*eslint func-names:0*/
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
750
|
+
|
|
751
|
+
function generateHTTPMethod(isForm) {
|
|
752
|
+
return function httpMethod(url, data, config) {
|
|
753
|
+
return this.request(mergeConfig(config || {}, {
|
|
754
|
+
method: method,
|
|
755
|
+
headers: isForm ? {
|
|
756
|
+
'Content-Type': 'multipart/form-data'
|
|
757
|
+
} : {},
|
|
758
|
+
url: url,
|
|
759
|
+
data: data
|
|
760
|
+
}));
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
765
|
+
|
|
766
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
735
767
|
});
|
|
736
768
|
|
|
737
769
|
module.exports = Axios;
|
|
738
770
|
|
|
739
771
|
|
|
772
|
+
/***/ }),
|
|
773
|
+
|
|
774
|
+
/***/ "../node_modules/axios/lib/core/AxiosError.js":
|
|
775
|
+
/*!****************************************************!*\
|
|
776
|
+
!*** ../node_modules/axios/lib/core/AxiosError.js ***!
|
|
777
|
+
\****************************************************/
|
|
778
|
+
/*! no static exports found */
|
|
779
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
780
|
+
|
|
781
|
+
"use strict";
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
var utils = __webpack_require__(/*! ../utils */ "../node_modules/axios/lib/utils.js");
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
788
|
+
*
|
|
789
|
+
* @param {string} message The error message.
|
|
790
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
791
|
+
* @param {Object} [config] The config.
|
|
792
|
+
* @param {Object} [request] The request.
|
|
793
|
+
* @param {Object} [response] The response.
|
|
794
|
+
* @returns {Error} The created error.
|
|
795
|
+
*/
|
|
796
|
+
function AxiosError(message, code, config, request, response) {
|
|
797
|
+
Error.call(this);
|
|
798
|
+
this.message = message;
|
|
799
|
+
this.name = 'AxiosError';
|
|
800
|
+
code && (this.code = code);
|
|
801
|
+
config && (this.config = config);
|
|
802
|
+
request && (this.request = request);
|
|
803
|
+
response && (this.response = response);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
utils.inherits(AxiosError, Error, {
|
|
807
|
+
toJSON: function toJSON() {
|
|
808
|
+
return {
|
|
809
|
+
// Standard
|
|
810
|
+
message: this.message,
|
|
811
|
+
name: this.name,
|
|
812
|
+
// Microsoft
|
|
813
|
+
description: this.description,
|
|
814
|
+
number: this.number,
|
|
815
|
+
// Mozilla
|
|
816
|
+
fileName: this.fileName,
|
|
817
|
+
lineNumber: this.lineNumber,
|
|
818
|
+
columnNumber: this.columnNumber,
|
|
819
|
+
stack: this.stack,
|
|
820
|
+
// Axios
|
|
821
|
+
config: this.config,
|
|
822
|
+
code: this.code,
|
|
823
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
var prototype = AxiosError.prototype;
|
|
829
|
+
var descriptors = {};
|
|
830
|
+
|
|
831
|
+
[
|
|
832
|
+
'ERR_BAD_OPTION_VALUE',
|
|
833
|
+
'ERR_BAD_OPTION',
|
|
834
|
+
'ECONNABORTED',
|
|
835
|
+
'ETIMEDOUT',
|
|
836
|
+
'ERR_NETWORK',
|
|
837
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
838
|
+
'ERR_DEPRECATED',
|
|
839
|
+
'ERR_BAD_RESPONSE',
|
|
840
|
+
'ERR_BAD_REQUEST',
|
|
841
|
+
'ERR_CANCELED'
|
|
842
|
+
// eslint-disable-next-line func-names
|
|
843
|
+
].forEach(function(code) {
|
|
844
|
+
descriptors[code] = {value: code};
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
848
|
+
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
|
849
|
+
|
|
850
|
+
// eslint-disable-next-line func-names
|
|
851
|
+
AxiosError.from = function(error, code, config, request, response, customProps) {
|
|
852
|
+
var axiosError = Object.create(prototype);
|
|
853
|
+
|
|
854
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
855
|
+
return obj !== Error.prototype;
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
AxiosError.call(axiosError, error.message, code, config, request, response);
|
|
859
|
+
|
|
860
|
+
axiosError.name = error.name;
|
|
861
|
+
|
|
862
|
+
customProps && Object.assign(axiosError, customProps);
|
|
863
|
+
|
|
864
|
+
return axiosError;
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
module.exports = AxiosError;
|
|
868
|
+
|
|
869
|
+
|
|
740
870
|
/***/ }),
|
|
741
871
|
|
|
742
872
|
/***/ "../node_modules/axios/lib/core/InterceptorManager.js":
|
|
@@ -835,36 +965,6 @@ module.exports = function buildFullPath(baseURL, requestedURL) {
|
|
|
835
965
|
};
|
|
836
966
|
|
|
837
967
|
|
|
838
|
-
/***/ }),
|
|
839
|
-
|
|
840
|
-
/***/ "../node_modules/axios/lib/core/createError.js":
|
|
841
|
-
/*!*****************************************************!*\
|
|
842
|
-
!*** ../node_modules/axios/lib/core/createError.js ***!
|
|
843
|
-
\*****************************************************/
|
|
844
|
-
/*! no static exports found */
|
|
845
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
846
|
-
|
|
847
|
-
"use strict";
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
var enhanceError = __webpack_require__(/*! ./enhanceError */ "../node_modules/axios/lib/core/enhanceError.js");
|
|
851
|
-
|
|
852
|
-
/**
|
|
853
|
-
* Create an Error with the specified message, config, error code, request and response.
|
|
854
|
-
*
|
|
855
|
-
* @param {string} message The error message.
|
|
856
|
-
* @param {Object} config The config.
|
|
857
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
858
|
-
* @param {Object} [request] The request.
|
|
859
|
-
* @param {Object} [response] The response.
|
|
860
|
-
* @returns {Error} The created error.
|
|
861
|
-
*/
|
|
862
|
-
module.exports = function createError(message, config, code, request, response) {
|
|
863
|
-
var error = new Error(message);
|
|
864
|
-
return enhanceError(error, config, code, request, response);
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
|
|
868
968
|
/***/ }),
|
|
869
969
|
|
|
870
970
|
/***/ "../node_modules/axios/lib/core/dispatchRequest.js":
|
|
@@ -881,10 +981,10 @@ var utils = __webpack_require__(/*! ./../utils */ "../node_modules/axios/lib/uti
|
|
|
881
981
|
var transformData = __webpack_require__(/*! ./transformData */ "../node_modules/axios/lib/core/transformData.js");
|
|
882
982
|
var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "../node_modules/axios/lib/cancel/isCancel.js");
|
|
883
983
|
var defaults = __webpack_require__(/*! ../defaults */ "../node_modules/axios/lib/defaults/index.js");
|
|
884
|
-
var
|
|
984
|
+
var CanceledError = __webpack_require__(/*! ../cancel/CanceledError */ "../node_modules/axios/lib/cancel/CanceledError.js");
|
|
885
985
|
|
|
886
986
|
/**
|
|
887
|
-
* Throws a `
|
|
987
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
888
988
|
*/
|
|
889
989
|
function throwIfCancellationRequested(config) {
|
|
890
990
|
if (config.cancelToken) {
|
|
@@ -892,7 +992,7 @@ function throwIfCancellationRequested(config) {
|
|
|
892
992
|
}
|
|
893
993
|
|
|
894
994
|
if (config.signal && config.signal.aborted) {
|
|
895
|
-
throw new
|
|
995
|
+
throw new CanceledError();
|
|
896
996
|
}
|
|
897
997
|
}
|
|
898
998
|
|
|
@@ -964,61 +1064,6 @@ module.exports = function dispatchRequest(config) {
|
|
|
964
1064
|
};
|
|
965
1065
|
|
|
966
1066
|
|
|
967
|
-
/***/ }),
|
|
968
|
-
|
|
969
|
-
/***/ "../node_modules/axios/lib/core/enhanceError.js":
|
|
970
|
-
/*!******************************************************!*\
|
|
971
|
-
!*** ../node_modules/axios/lib/core/enhanceError.js ***!
|
|
972
|
-
\******************************************************/
|
|
973
|
-
/*! no static exports found */
|
|
974
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
975
|
-
|
|
976
|
-
"use strict";
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
/**
|
|
980
|
-
* Update an Error with the specified config, error code, and response.
|
|
981
|
-
*
|
|
982
|
-
* @param {Error} error The error to update.
|
|
983
|
-
* @param {Object} config The config.
|
|
984
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
985
|
-
* @param {Object} [request] The request.
|
|
986
|
-
* @param {Object} [response] The response.
|
|
987
|
-
* @returns {Error} The error.
|
|
988
|
-
*/
|
|
989
|
-
module.exports = function enhanceError(error, config, code, request, response) {
|
|
990
|
-
error.config = config;
|
|
991
|
-
if (code) {
|
|
992
|
-
error.code = code;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
error.request = request;
|
|
996
|
-
error.response = response;
|
|
997
|
-
error.isAxiosError = true;
|
|
998
|
-
|
|
999
|
-
error.toJSON = function toJSON() {
|
|
1000
|
-
return {
|
|
1001
|
-
// Standard
|
|
1002
|
-
message: this.message,
|
|
1003
|
-
name: this.name,
|
|
1004
|
-
// Microsoft
|
|
1005
|
-
description: this.description,
|
|
1006
|
-
number: this.number,
|
|
1007
|
-
// Mozilla
|
|
1008
|
-
fileName: this.fileName,
|
|
1009
|
-
lineNumber: this.lineNumber,
|
|
1010
|
-
columnNumber: this.columnNumber,
|
|
1011
|
-
stack: this.stack,
|
|
1012
|
-
// Axios
|
|
1013
|
-
config: this.config,
|
|
1014
|
-
code: this.code,
|
|
1015
|
-
status: this.response && this.response.status ? this.response.status : null
|
|
1016
|
-
};
|
|
1017
|
-
};
|
|
1018
|
-
return error;
|
|
1019
|
-
};
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
1067
|
/***/ }),
|
|
1023
1068
|
|
|
1024
1069
|
/***/ "../node_modules/axios/lib/core/mergeConfig.js":
|
|
@@ -1111,6 +1156,7 @@ module.exports = function mergeConfig(config1, config2) {
|
|
|
1111
1156
|
'decompress': defaultToConfig2,
|
|
1112
1157
|
'maxContentLength': defaultToConfig2,
|
|
1113
1158
|
'maxBodyLength': defaultToConfig2,
|
|
1159
|
+
'beforeRedirect': defaultToConfig2,
|
|
1114
1160
|
'transport': defaultToConfig2,
|
|
1115
1161
|
'httpAgent': defaultToConfig2,
|
|
1116
1162
|
'httpsAgent': defaultToConfig2,
|
|
@@ -1142,7 +1188,7 @@ module.exports = function mergeConfig(config1, config2) {
|
|
|
1142
1188
|
"use strict";
|
|
1143
1189
|
|
|
1144
1190
|
|
|
1145
|
-
var
|
|
1191
|
+
var AxiosError = __webpack_require__(/*! ./AxiosError */ "../node_modules/axios/lib/core/AxiosError.js");
|
|
1146
1192
|
|
|
1147
1193
|
/**
|
|
1148
1194
|
* Resolve or reject a Promise based on response status.
|
|
@@ -1156,10 +1202,10 @@ module.exports = function settle(resolve, reject, response) {
|
|
|
1156
1202
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
1157
1203
|
resolve(response);
|
|
1158
1204
|
} else {
|
|
1159
|
-
reject(
|
|
1205
|
+
reject(new AxiosError(
|
|
1160
1206
|
'Request failed with status code ' + response.status,
|
|
1207
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
1161
1208
|
response.config,
|
|
1162
|
-
null,
|
|
1163
1209
|
response.request,
|
|
1164
1210
|
response
|
|
1165
1211
|
));
|
|
@@ -1215,8 +1261,9 @@ module.exports = function transformData(data, headers, fns) {
|
|
|
1215
1261
|
|
|
1216
1262
|
var utils = __webpack_require__(/*! ../utils */ "../node_modules/axios/lib/utils.js");
|
|
1217
1263
|
var normalizeHeaderName = __webpack_require__(/*! ../helpers/normalizeHeaderName */ "../node_modules/axios/lib/helpers/normalizeHeaderName.js");
|
|
1218
|
-
var
|
|
1264
|
+
var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "../node_modules/axios/lib/core/AxiosError.js");
|
|
1219
1265
|
var transitionalDefaults = __webpack_require__(/*! ./transitional */ "../node_modules/axios/lib/defaults/transitional.js");
|
|
1266
|
+
var toFormData = __webpack_require__(/*! ../helpers/toFormData */ "../node_modules/axios/lib/helpers/toFormData.js");
|
|
1220
1267
|
|
|
1221
1268
|
var DEFAULT_CONTENT_TYPE = {
|
|
1222
1269
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
@@ -1281,10 +1328,20 @@ var defaults = {
|
|
|
1281
1328
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
1282
1329
|
return data.toString();
|
|
1283
1330
|
}
|
|
1284
|
-
|
|
1331
|
+
|
|
1332
|
+
var isObjectPayload = utils.isObject(data);
|
|
1333
|
+
var contentType = headers && headers['Content-Type'];
|
|
1334
|
+
|
|
1335
|
+
var isFileList;
|
|
1336
|
+
|
|
1337
|
+
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
|
|
1338
|
+
var _FormData = this.env && this.env.FormData;
|
|
1339
|
+
return toFormData(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
|
|
1340
|
+
} else if (isObjectPayload || contentType === 'application/json') {
|
|
1285
1341
|
setContentTypeIfUnset(headers, 'application/json');
|
|
1286
1342
|
return stringifySafely(data);
|
|
1287
1343
|
}
|
|
1344
|
+
|
|
1288
1345
|
return data;
|
|
1289
1346
|
}],
|
|
1290
1347
|
|
|
@@ -1300,7 +1357,7 @@ var defaults = {
|
|
|
1300
1357
|
} catch (e) {
|
|
1301
1358
|
if (strictJSONParsing) {
|
|
1302
1359
|
if (e.name === 'SyntaxError') {
|
|
1303
|
-
throw
|
|
1360
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1304
1361
|
}
|
|
1305
1362
|
throw e;
|
|
1306
1363
|
}
|
|
@@ -1322,6 +1379,10 @@ var defaults = {
|
|
|
1322
1379
|
maxContentLength: -1,
|
|
1323
1380
|
maxBodyLength: -1,
|
|
1324
1381
|
|
|
1382
|
+
env: {
|
|
1383
|
+
FormData: __webpack_require__(/*! ./env/FormData */ "../node_modules/axios/lib/helpers/null.js")
|
|
1384
|
+
},
|
|
1385
|
+
|
|
1325
1386
|
validateStatus: function validateStatus(status) {
|
|
1326
1387
|
return status >= 200 && status < 300;
|
|
1327
1388
|
},
|
|
@@ -1374,7 +1435,7 @@ module.exports = {
|
|
|
1374
1435
|
/***/ (function(module, exports) {
|
|
1375
1436
|
|
|
1376
1437
|
module.exports = {
|
|
1377
|
-
"version": "0.
|
|
1438
|
+
"version": "0.27.0"
|
|
1378
1439
|
};
|
|
1379
1440
|
|
|
1380
1441
|
/***/ }),
|
|
@@ -1728,6 +1789,19 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
|
1728
1789
|
};
|
|
1729
1790
|
|
|
1730
1791
|
|
|
1792
|
+
/***/ }),
|
|
1793
|
+
|
|
1794
|
+
/***/ "../node_modules/axios/lib/helpers/null.js":
|
|
1795
|
+
/*!*************************************************!*\
|
|
1796
|
+
!*** ../node_modules/axios/lib/helpers/null.js ***!
|
|
1797
|
+
\*************************************************/
|
|
1798
|
+
/*! no static exports found */
|
|
1799
|
+
/***/ (function(module, exports) {
|
|
1800
|
+
|
|
1801
|
+
// eslint-disable-next-line strict
|
|
1802
|
+
module.exports = null;
|
|
1803
|
+
|
|
1804
|
+
|
|
1731
1805
|
/***/ }),
|
|
1732
1806
|
|
|
1733
1807
|
/***/ "../node_modules/axios/lib/helpers/parseHeaders.js":
|
|
@@ -1832,6 +1906,91 @@ module.exports = function spread(callback) {
|
|
|
1832
1906
|
};
|
|
1833
1907
|
|
|
1834
1908
|
|
|
1909
|
+
/***/ }),
|
|
1910
|
+
|
|
1911
|
+
/***/ "../node_modules/axios/lib/helpers/toFormData.js":
|
|
1912
|
+
/*!*******************************************************!*\
|
|
1913
|
+
!*** ../node_modules/axios/lib/helpers/toFormData.js ***!
|
|
1914
|
+
\*******************************************************/
|
|
1915
|
+
/*! no static exports found */
|
|
1916
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1917
|
+
|
|
1918
|
+
"use strict";
|
|
1919
|
+
/* WEBPACK VAR INJECTION */(function(Buffer) {
|
|
1920
|
+
|
|
1921
|
+
var utils = __webpack_require__(/*! ../utils */ "../node_modules/axios/lib/utils.js");
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* Convert a data object to FormData
|
|
1925
|
+
* @param {Object} obj
|
|
1926
|
+
* @param {?Object} [formData]
|
|
1927
|
+
* @returns {Object}
|
|
1928
|
+
**/
|
|
1929
|
+
|
|
1930
|
+
function toFormData(obj, formData) {
|
|
1931
|
+
// eslint-disable-next-line no-param-reassign
|
|
1932
|
+
formData = formData || new FormData();
|
|
1933
|
+
|
|
1934
|
+
var stack = [];
|
|
1935
|
+
|
|
1936
|
+
function convertValue(value) {
|
|
1937
|
+
if (value === null) return '';
|
|
1938
|
+
|
|
1939
|
+
if (utils.isDate(value)) {
|
|
1940
|
+
return value.toISOString();
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
1944
|
+
return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
return value;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
function build(data, parentKey) {
|
|
1951
|
+
if (utils.isPlainObject(data) || utils.isArray(data)) {
|
|
1952
|
+
if (stack.indexOf(data) !== -1) {
|
|
1953
|
+
throw Error('Circular reference detected in ' + parentKey);
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
stack.push(data);
|
|
1957
|
+
|
|
1958
|
+
utils.forEach(data, function each(value, key) {
|
|
1959
|
+
if (utils.isUndefined(value)) return;
|
|
1960
|
+
var fullKey = parentKey ? parentKey + '.' + key : key;
|
|
1961
|
+
var arr;
|
|
1962
|
+
|
|
1963
|
+
if (value && !parentKey && typeof value === 'object') {
|
|
1964
|
+
if (utils.endsWith(key, '{}')) {
|
|
1965
|
+
// eslint-disable-next-line no-param-reassign
|
|
1966
|
+
value = JSON.stringify(value);
|
|
1967
|
+
} else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
|
|
1968
|
+
// eslint-disable-next-line func-names
|
|
1969
|
+
arr.forEach(function(el) {
|
|
1970
|
+
!utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
|
|
1971
|
+
});
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
build(value, fullKey);
|
|
1977
|
+
});
|
|
1978
|
+
|
|
1979
|
+
stack.pop();
|
|
1980
|
+
} else {
|
|
1981
|
+
formData.append(parentKey, convertValue(data));
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
build(obj);
|
|
1986
|
+
|
|
1987
|
+
return formData;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
module.exports = toFormData;
|
|
1991
|
+
|
|
1992
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node-libs-browser/node_modules/buffer/index.js */ "../node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer))
|
|
1993
|
+
|
|
1835
1994
|
/***/ }),
|
|
1836
1995
|
|
|
1837
1996
|
/***/ "../node_modules/axios/lib/helpers/validator.js":
|
|
@@ -1845,6 +2004,7 @@ module.exports = function spread(callback) {
|
|
|
1845
2004
|
|
|
1846
2005
|
|
|
1847
2006
|
var VERSION = __webpack_require__(/*! ../env/data */ "../node_modules/axios/lib/env/data.js").version;
|
|
2007
|
+
var AxiosError = __webpack_require__(/*! ../core/AxiosError */ "../node_modules/axios/lib/core/AxiosError.js");
|
|
1848
2008
|
|
|
1849
2009
|
var validators = {};
|
|
1850
2010
|
|
|
@@ -1872,7 +2032,10 @@ validators.transitional = function transitional(validator, version, message) {
|
|
|
1872
2032
|
// eslint-disable-next-line func-names
|
|
1873
2033
|
return function(value, opt, opts) {
|
|
1874
2034
|
if (validator === false) {
|
|
1875
|
-
throw new
|
|
2035
|
+
throw new AxiosError(
|
|
2036
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
2037
|
+
AxiosError.ERR_DEPRECATED
|
|
2038
|
+
);
|
|
1876
2039
|
}
|
|
1877
2040
|
|
|
1878
2041
|
if (version && !deprecatedWarnings[opt]) {
|
|
@@ -1899,7 +2062,7 @@ validators.transitional = function transitional(validator, version, message) {
|
|
|
1899
2062
|
|
|
1900
2063
|
function assertOptions(options, schema, allowUnknown) {
|
|
1901
2064
|
if (typeof options !== 'object') {
|
|
1902
|
-
throw new
|
|
2065
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1903
2066
|
}
|
|
1904
2067
|
var keys = Object.keys(options);
|
|
1905
2068
|
var i = keys.length;
|
|
@@ -1910,12 +2073,12 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
1910
2073
|
var value = options[opt];
|
|
1911
2074
|
var result = value === undefined || validator(value, opt, options);
|
|
1912
2075
|
if (result !== true) {
|
|
1913
|
-
throw new
|
|
2076
|
+
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
1914
2077
|
}
|
|
1915
2078
|
continue;
|
|
1916
2079
|
}
|
|
1917
2080
|
if (allowUnknown !== true) {
|
|
1918
|
-
throw
|
|
2081
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
1919
2082
|
}
|
|
1920
2083
|
}
|
|
1921
2084
|
}
|
|
@@ -1944,13 +2107,45 @@ var bind = __webpack_require__(/*! ./helpers/bind */ "../node_modules/axios/lib/
|
|
|
1944
2107
|
|
|
1945
2108
|
var toString = Object.prototype.toString;
|
|
1946
2109
|
|
|
2110
|
+
// eslint-disable-next-line func-names
|
|
2111
|
+
var kindOf = (function(cache) {
|
|
2112
|
+
// eslint-disable-next-line func-names
|
|
2113
|
+
return function(thing) {
|
|
2114
|
+
var str = toString.call(thing);
|
|
2115
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
2116
|
+
};
|
|
2117
|
+
})(Object.create(null));
|
|
2118
|
+
|
|
2119
|
+
function kindOfTest(type) {
|
|
2120
|
+
type = type.toLowerCase();
|
|
2121
|
+
return function isKindOf(thing) {
|
|
2122
|
+
return kindOf(thing) === type;
|
|
2123
|
+
};
|
|
2124
|
+
}
|
|
2125
|
+
|
|
1947
2126
|
/**
|
|
1948
|
-
*
|
|
1949
|
-
*
|
|
1950
|
-
* @param {Object} val The value to test
|
|
1951
|
-
* @returns {boolean} True if value is an Array, otherwise false
|
|
2127
|
+
* Array with axios supported protocols.
|
|
1952
2128
|
*/
|
|
1953
|
-
|
|
2129
|
+
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
|
2130
|
+
|
|
2131
|
+
/**
|
|
2132
|
+
* Returns URL protocol passed as param if is not undefined or null,
|
|
2133
|
+
* otherwise just returns 'http:'
|
|
2134
|
+
*
|
|
2135
|
+
* @param {String} protocol The String value of URL protocol
|
|
2136
|
+
* @returns {String} Protocol if the value is not undefined or null
|
|
2137
|
+
*/
|
|
2138
|
+
function getProtocol(protocol) {
|
|
2139
|
+
return protocol || 'http:';
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* Determine if a value is an Array
|
|
2144
|
+
*
|
|
2145
|
+
* @param {Object} val The value to test
|
|
2146
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
|
2147
|
+
*/
|
|
2148
|
+
function isArray(val) {
|
|
1954
2149
|
return Array.isArray(val);
|
|
1955
2150
|
}
|
|
1956
2151
|
|
|
@@ -1978,22 +2173,12 @@ function isBuffer(val) {
|
|
|
1978
2173
|
/**
|
|
1979
2174
|
* Determine if a value is an ArrayBuffer
|
|
1980
2175
|
*
|
|
2176
|
+
* @function
|
|
1981
2177
|
* @param {Object} val The value to test
|
|
1982
2178
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
1983
2179
|
*/
|
|
1984
|
-
|
|
1985
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
|
1986
|
-
}
|
|
2180
|
+
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
1987
2181
|
|
|
1988
|
-
/**
|
|
1989
|
-
* Determine if a value is a FormData
|
|
1990
|
-
*
|
|
1991
|
-
* @param {Object} val The value to test
|
|
1992
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
1993
|
-
*/
|
|
1994
|
-
function isFormData(val) {
|
|
1995
|
-
return toString.call(val) === '[object FormData]';
|
|
1996
|
-
}
|
|
1997
2182
|
|
|
1998
2183
|
/**
|
|
1999
2184
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -2048,7 +2233,7 @@ function isObject(val) {
|
|
|
2048
2233
|
* @return {boolean} True if value is a plain Object, otherwise false
|
|
2049
2234
|
*/
|
|
2050
2235
|
function isPlainObject(val) {
|
|
2051
|
-
if (
|
|
2236
|
+
if (kindOf(val) !== 'object') {
|
|
2052
2237
|
return false;
|
|
2053
2238
|
}
|
|
2054
2239
|
|
|
@@ -2059,32 +2244,38 @@ function isPlainObject(val) {
|
|
|
2059
2244
|
/**
|
|
2060
2245
|
* Determine if a value is a Date
|
|
2061
2246
|
*
|
|
2247
|
+
* @function
|
|
2062
2248
|
* @param {Object} val The value to test
|
|
2063
2249
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
2064
2250
|
*/
|
|
2065
|
-
|
|
2066
|
-
return toString.call(val) === '[object Date]';
|
|
2067
|
-
}
|
|
2251
|
+
var isDate = kindOfTest('Date');
|
|
2068
2252
|
|
|
2069
2253
|
/**
|
|
2070
2254
|
* Determine if a value is a File
|
|
2071
2255
|
*
|
|
2256
|
+
* @function
|
|
2072
2257
|
* @param {Object} val The value to test
|
|
2073
2258
|
* @returns {boolean} True if value is a File, otherwise false
|
|
2074
2259
|
*/
|
|
2075
|
-
|
|
2076
|
-
return toString.call(val) === '[object File]';
|
|
2077
|
-
}
|
|
2260
|
+
var isFile = kindOfTest('File');
|
|
2078
2261
|
|
|
2079
2262
|
/**
|
|
2080
2263
|
* Determine if a value is a Blob
|
|
2081
2264
|
*
|
|
2265
|
+
* @function
|
|
2082
2266
|
* @param {Object} val The value to test
|
|
2083
2267
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
2084
2268
|
*/
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2269
|
+
var isBlob = kindOfTest('Blob');
|
|
2270
|
+
|
|
2271
|
+
/**
|
|
2272
|
+
* Determine if a value is a FileList
|
|
2273
|
+
*
|
|
2274
|
+
* @function
|
|
2275
|
+
* @param {Object} val The value to test
|
|
2276
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
2277
|
+
*/
|
|
2278
|
+
var isFileList = kindOfTest('FileList');
|
|
2088
2279
|
|
|
2089
2280
|
/**
|
|
2090
2281
|
* Determine if a value is a Function
|
|
@@ -2107,14 +2298,27 @@ function isStream(val) {
|
|
|
2107
2298
|
}
|
|
2108
2299
|
|
|
2109
2300
|
/**
|
|
2110
|
-
* Determine if a value is a
|
|
2301
|
+
* Determine if a value is a FormData
|
|
2111
2302
|
*
|
|
2303
|
+
* @param {Object} thing The value to test
|
|
2304
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
|
2305
|
+
*/
|
|
2306
|
+
function isFormData(thing) {
|
|
2307
|
+
var pattern = '[object FormData]';
|
|
2308
|
+
return thing && (
|
|
2309
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
2310
|
+
toString.call(thing) === pattern ||
|
|
2311
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
|
2312
|
+
);
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
/**
|
|
2316
|
+
* Determine if a value is a URLSearchParams object
|
|
2317
|
+
* @function
|
|
2112
2318
|
* @param {Object} val The value to test
|
|
2113
2319
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
2114
2320
|
*/
|
|
2115
|
-
|
|
2116
|
-
return toString.call(val) === '[object URLSearchParams]';
|
|
2117
|
-
}
|
|
2321
|
+
var isURLSearchParams = kindOfTest('URLSearchParams');
|
|
2118
2322
|
|
|
2119
2323
|
/**
|
|
2120
2324
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -2261,7 +2465,97 @@ function stripBOM(content) {
|
|
|
2261
2465
|
return content;
|
|
2262
2466
|
}
|
|
2263
2467
|
|
|
2468
|
+
/**
|
|
2469
|
+
* Inherit the prototype methods from one constructor into another
|
|
2470
|
+
* @param {function} constructor
|
|
2471
|
+
* @param {function} superConstructor
|
|
2472
|
+
* @param {object} [props]
|
|
2473
|
+
* @param {object} [descriptors]
|
|
2474
|
+
*/
|
|
2475
|
+
|
|
2476
|
+
function inherits(constructor, superConstructor, props, descriptors) {
|
|
2477
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
2478
|
+
constructor.prototype.constructor = constructor;
|
|
2479
|
+
props && Object.assign(constructor.prototype, props);
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* Resolve object with deep prototype chain to a flat object
|
|
2484
|
+
* @param {Object} sourceObj source object
|
|
2485
|
+
* @param {Object} [destObj]
|
|
2486
|
+
* @param {Function} [filter]
|
|
2487
|
+
* @returns {Object}
|
|
2488
|
+
*/
|
|
2489
|
+
|
|
2490
|
+
function toFlatObject(sourceObj, destObj, filter) {
|
|
2491
|
+
var props;
|
|
2492
|
+
var i;
|
|
2493
|
+
var prop;
|
|
2494
|
+
var merged = {};
|
|
2495
|
+
|
|
2496
|
+
destObj = destObj || {};
|
|
2497
|
+
|
|
2498
|
+
do {
|
|
2499
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
2500
|
+
i = props.length;
|
|
2501
|
+
while (i-- > 0) {
|
|
2502
|
+
prop = props[i];
|
|
2503
|
+
if (!merged[prop]) {
|
|
2504
|
+
destObj[prop] = sourceObj[prop];
|
|
2505
|
+
merged[prop] = true;
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
sourceObj = Object.getPrototypeOf(sourceObj);
|
|
2509
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
2510
|
+
|
|
2511
|
+
return destObj;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
/*
|
|
2515
|
+
* determines whether a string ends with the characters of a specified string
|
|
2516
|
+
* @param {String} str
|
|
2517
|
+
* @param {String} searchString
|
|
2518
|
+
* @param {Number} [position= 0]
|
|
2519
|
+
* @returns {boolean}
|
|
2520
|
+
*/
|
|
2521
|
+
function endsWith(str, searchString, position) {
|
|
2522
|
+
str = String(str);
|
|
2523
|
+
if (position === undefined || position > str.length) {
|
|
2524
|
+
position = str.length;
|
|
2525
|
+
}
|
|
2526
|
+
position -= searchString.length;
|
|
2527
|
+
var lastIndex = str.indexOf(searchString, position);
|
|
2528
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
|
|
2532
|
+
/**
|
|
2533
|
+
* Returns new array from array like object
|
|
2534
|
+
* @param {*} [thing]
|
|
2535
|
+
* @returns {Array}
|
|
2536
|
+
*/
|
|
2537
|
+
function toArray(thing) {
|
|
2538
|
+
if (!thing) return null;
|
|
2539
|
+
var i = thing.length;
|
|
2540
|
+
if (isUndefined(i)) return null;
|
|
2541
|
+
var arr = new Array(i);
|
|
2542
|
+
while (i-- > 0) {
|
|
2543
|
+
arr[i] = thing[i];
|
|
2544
|
+
}
|
|
2545
|
+
return arr;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
// eslint-disable-next-line func-names
|
|
2549
|
+
var isTypedArray = (function(TypedArray) {
|
|
2550
|
+
// eslint-disable-next-line func-names
|
|
2551
|
+
return function(thing) {
|
|
2552
|
+
return TypedArray && thing instanceof TypedArray;
|
|
2553
|
+
};
|
|
2554
|
+
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
|
2555
|
+
|
|
2264
2556
|
module.exports = {
|
|
2557
|
+
supportedProtocols: supportedProtocols,
|
|
2558
|
+
getProtocol: getProtocol,
|
|
2265
2559
|
isArray: isArray,
|
|
2266
2560
|
isArrayBuffer: isArrayBuffer,
|
|
2267
2561
|
isBuffer: isBuffer,
|
|
@@ -2283,10 +2577,180 @@ module.exports = {
|
|
|
2283
2577
|
merge: merge,
|
|
2284
2578
|
extend: extend,
|
|
2285
2579
|
trim: trim,
|
|
2286
|
-
stripBOM: stripBOM
|
|
2580
|
+
stripBOM: stripBOM,
|
|
2581
|
+
inherits: inherits,
|
|
2582
|
+
toFlatObject: toFlatObject,
|
|
2583
|
+
kindOf: kindOf,
|
|
2584
|
+
kindOfTest: kindOfTest,
|
|
2585
|
+
endsWith: endsWith,
|
|
2586
|
+
toArray: toArray,
|
|
2587
|
+
isTypedArray: isTypedArray,
|
|
2588
|
+
isFileList: isFileList
|
|
2287
2589
|
};
|
|
2288
2590
|
|
|
2289
2591
|
|
|
2592
|
+
/***/ }),
|
|
2593
|
+
|
|
2594
|
+
/***/ "../node_modules/base64-js/index.js":
|
|
2595
|
+
/*!******************************************!*\
|
|
2596
|
+
!*** ../node_modules/base64-js/index.js ***!
|
|
2597
|
+
\******************************************/
|
|
2598
|
+
/*! no static exports found */
|
|
2599
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2600
|
+
|
|
2601
|
+
"use strict";
|
|
2602
|
+
|
|
2603
|
+
|
|
2604
|
+
exports.byteLength = byteLength
|
|
2605
|
+
exports.toByteArray = toByteArray
|
|
2606
|
+
exports.fromByteArray = fromByteArray
|
|
2607
|
+
|
|
2608
|
+
var lookup = []
|
|
2609
|
+
var revLookup = []
|
|
2610
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
|
2611
|
+
|
|
2612
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
|
2613
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
|
2614
|
+
lookup[i] = code[i]
|
|
2615
|
+
revLookup[code.charCodeAt(i)] = i
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
// Support decoding URL-safe base64 strings, as Node.js does.
|
|
2619
|
+
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
|
2620
|
+
revLookup['-'.charCodeAt(0)] = 62
|
|
2621
|
+
revLookup['_'.charCodeAt(0)] = 63
|
|
2622
|
+
|
|
2623
|
+
function getLens (b64) {
|
|
2624
|
+
var len = b64.length
|
|
2625
|
+
|
|
2626
|
+
if (len % 4 > 0) {
|
|
2627
|
+
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
// Trim off extra bytes after placeholder bytes are found
|
|
2631
|
+
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
2632
|
+
var validLen = b64.indexOf('=')
|
|
2633
|
+
if (validLen === -1) validLen = len
|
|
2634
|
+
|
|
2635
|
+
var placeHoldersLen = validLen === len
|
|
2636
|
+
? 0
|
|
2637
|
+
: 4 - (validLen % 4)
|
|
2638
|
+
|
|
2639
|
+
return [validLen, placeHoldersLen]
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
// base64 is 4/3 + up to two characters of the original data
|
|
2643
|
+
function byteLength (b64) {
|
|
2644
|
+
var lens = getLens(b64)
|
|
2645
|
+
var validLen = lens[0]
|
|
2646
|
+
var placeHoldersLen = lens[1]
|
|
2647
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
function _byteLength (b64, validLen, placeHoldersLen) {
|
|
2651
|
+
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
function toByteArray (b64) {
|
|
2655
|
+
var tmp
|
|
2656
|
+
var lens = getLens(b64)
|
|
2657
|
+
var validLen = lens[0]
|
|
2658
|
+
var placeHoldersLen = lens[1]
|
|
2659
|
+
|
|
2660
|
+
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
|
2661
|
+
|
|
2662
|
+
var curByte = 0
|
|
2663
|
+
|
|
2664
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
|
2665
|
+
var len = placeHoldersLen > 0
|
|
2666
|
+
? validLen - 4
|
|
2667
|
+
: validLen
|
|
2668
|
+
|
|
2669
|
+
var i
|
|
2670
|
+
for (i = 0; i < len; i += 4) {
|
|
2671
|
+
tmp =
|
|
2672
|
+
(revLookup[b64.charCodeAt(i)] << 18) |
|
|
2673
|
+
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
|
2674
|
+
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
|
2675
|
+
revLookup[b64.charCodeAt(i + 3)]
|
|
2676
|
+
arr[curByte++] = (tmp >> 16) & 0xFF
|
|
2677
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
|
2678
|
+
arr[curByte++] = tmp & 0xFF
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
if (placeHoldersLen === 2) {
|
|
2682
|
+
tmp =
|
|
2683
|
+
(revLookup[b64.charCodeAt(i)] << 2) |
|
|
2684
|
+
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
|
2685
|
+
arr[curByte++] = tmp & 0xFF
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
if (placeHoldersLen === 1) {
|
|
2689
|
+
tmp =
|
|
2690
|
+
(revLookup[b64.charCodeAt(i)] << 10) |
|
|
2691
|
+
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
|
2692
|
+
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
|
2693
|
+
arr[curByte++] = (tmp >> 8) & 0xFF
|
|
2694
|
+
arr[curByte++] = tmp & 0xFF
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
return arr
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
function tripletToBase64 (num) {
|
|
2701
|
+
return lookup[num >> 18 & 0x3F] +
|
|
2702
|
+
lookup[num >> 12 & 0x3F] +
|
|
2703
|
+
lookup[num >> 6 & 0x3F] +
|
|
2704
|
+
lookup[num & 0x3F]
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
function encodeChunk (uint8, start, end) {
|
|
2708
|
+
var tmp
|
|
2709
|
+
var output = []
|
|
2710
|
+
for (var i = start; i < end; i += 3) {
|
|
2711
|
+
tmp =
|
|
2712
|
+
((uint8[i] << 16) & 0xFF0000) +
|
|
2713
|
+
((uint8[i + 1] << 8) & 0xFF00) +
|
|
2714
|
+
(uint8[i + 2] & 0xFF)
|
|
2715
|
+
output.push(tripletToBase64(tmp))
|
|
2716
|
+
}
|
|
2717
|
+
return output.join('')
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
function fromByteArray (uint8) {
|
|
2721
|
+
var tmp
|
|
2722
|
+
var len = uint8.length
|
|
2723
|
+
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
|
2724
|
+
var parts = []
|
|
2725
|
+
var maxChunkLength = 16383 // must be multiple of 3
|
|
2726
|
+
|
|
2727
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
2728
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
2729
|
+
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
2733
|
+
if (extraBytes === 1) {
|
|
2734
|
+
tmp = uint8[len - 1]
|
|
2735
|
+
parts.push(
|
|
2736
|
+
lookup[tmp >> 2] +
|
|
2737
|
+
lookup[(tmp << 4) & 0x3F] +
|
|
2738
|
+
'=='
|
|
2739
|
+
)
|
|
2740
|
+
} else if (extraBytes === 2) {
|
|
2741
|
+
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
|
2742
|
+
parts.push(
|
|
2743
|
+
lookup[tmp >> 10] +
|
|
2744
|
+
lookup[(tmp >> 4) & 0x3F] +
|
|
2745
|
+
lookup[(tmp << 2) & 0x3F] +
|
|
2746
|
+
'='
|
|
2747
|
+
)
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
return parts.join('')
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
|
|
2290
2754
|
/***/ }),
|
|
2291
2755
|
|
|
2292
2756
|
/***/ "../node_modules/call-bind/callBound.js":
|
|
@@ -4296,6 +4760,118 @@ var bind = __webpack_require__(/*! function-bind */ "../node_modules/function-bi
|
|
|
4296
4760
|
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
4297
4761
|
|
|
4298
4762
|
|
|
4763
|
+
/***/ }),
|
|
4764
|
+
|
|
4765
|
+
/***/ "../node_modules/ieee754/index.js":
|
|
4766
|
+
/*!****************************************!*\
|
|
4767
|
+
!*** ../node_modules/ieee754/index.js ***!
|
|
4768
|
+
\****************************************/
|
|
4769
|
+
/*! no static exports found */
|
|
4770
|
+
/***/ (function(module, exports) {
|
|
4771
|
+
|
|
4772
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
4773
|
+
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
4774
|
+
var e, m
|
|
4775
|
+
var eLen = (nBytes * 8) - mLen - 1
|
|
4776
|
+
var eMax = (1 << eLen) - 1
|
|
4777
|
+
var eBias = eMax >> 1
|
|
4778
|
+
var nBits = -7
|
|
4779
|
+
var i = isLE ? (nBytes - 1) : 0
|
|
4780
|
+
var d = isLE ? -1 : 1
|
|
4781
|
+
var s = buffer[offset + i]
|
|
4782
|
+
|
|
4783
|
+
i += d
|
|
4784
|
+
|
|
4785
|
+
e = s & ((1 << (-nBits)) - 1)
|
|
4786
|
+
s >>= (-nBits)
|
|
4787
|
+
nBits += eLen
|
|
4788
|
+
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
4789
|
+
|
|
4790
|
+
m = e & ((1 << (-nBits)) - 1)
|
|
4791
|
+
e >>= (-nBits)
|
|
4792
|
+
nBits += mLen
|
|
4793
|
+
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
4794
|
+
|
|
4795
|
+
if (e === 0) {
|
|
4796
|
+
e = 1 - eBias
|
|
4797
|
+
} else if (e === eMax) {
|
|
4798
|
+
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
4799
|
+
} else {
|
|
4800
|
+
m = m + Math.pow(2, mLen)
|
|
4801
|
+
e = e - eBias
|
|
4802
|
+
}
|
|
4803
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
4804
|
+
}
|
|
4805
|
+
|
|
4806
|
+
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
4807
|
+
var e, m, c
|
|
4808
|
+
var eLen = (nBytes * 8) - mLen - 1
|
|
4809
|
+
var eMax = (1 << eLen) - 1
|
|
4810
|
+
var eBias = eMax >> 1
|
|
4811
|
+
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
|
4812
|
+
var i = isLE ? 0 : (nBytes - 1)
|
|
4813
|
+
var d = isLE ? 1 : -1
|
|
4814
|
+
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
|
4815
|
+
|
|
4816
|
+
value = Math.abs(value)
|
|
4817
|
+
|
|
4818
|
+
if (isNaN(value) || value === Infinity) {
|
|
4819
|
+
m = isNaN(value) ? 1 : 0
|
|
4820
|
+
e = eMax
|
|
4821
|
+
} else {
|
|
4822
|
+
e = Math.floor(Math.log(value) / Math.LN2)
|
|
4823
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
4824
|
+
e--
|
|
4825
|
+
c *= 2
|
|
4826
|
+
}
|
|
4827
|
+
if (e + eBias >= 1) {
|
|
4828
|
+
value += rt / c
|
|
4829
|
+
} else {
|
|
4830
|
+
value += rt * Math.pow(2, 1 - eBias)
|
|
4831
|
+
}
|
|
4832
|
+
if (value * c >= 2) {
|
|
4833
|
+
e++
|
|
4834
|
+
c /= 2
|
|
4835
|
+
}
|
|
4836
|
+
|
|
4837
|
+
if (e + eBias >= eMax) {
|
|
4838
|
+
m = 0
|
|
4839
|
+
e = eMax
|
|
4840
|
+
} else if (e + eBias >= 1) {
|
|
4841
|
+
m = ((value * c) - 1) * Math.pow(2, mLen)
|
|
4842
|
+
e = e + eBias
|
|
4843
|
+
} else {
|
|
4844
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
4845
|
+
e = 0
|
|
4846
|
+
}
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
4850
|
+
|
|
4851
|
+
e = (e << mLen) | m
|
|
4852
|
+
eLen += mLen
|
|
4853
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
4854
|
+
|
|
4855
|
+
buffer[offset + i - d] |= s * 128
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
|
|
4859
|
+
/***/ }),
|
|
4860
|
+
|
|
4861
|
+
/***/ "../node_modules/isarray/index.js":
|
|
4862
|
+
/*!****************************************!*\
|
|
4863
|
+
!*** ../node_modules/isarray/index.js ***!
|
|
4864
|
+
\****************************************/
|
|
4865
|
+
/*! no static exports found */
|
|
4866
|
+
/***/ (function(module, exports) {
|
|
4867
|
+
|
|
4868
|
+
var toString = {}.toString;
|
|
4869
|
+
|
|
4870
|
+
module.exports = Array.isArray || function (arr) {
|
|
4871
|
+
return toString.call(arr) == '[object Array]';
|
|
4872
|
+
};
|
|
4873
|
+
|
|
4874
|
+
|
|
4299
4875
|
/***/ }),
|
|
4300
4876
|
|
|
4301
4877
|
/***/ "../node_modules/json-stringify-safe/stringify.js":
|
|
@@ -4587,8 +5163,2341 @@ function isString(value) {
|
|
|
4587
5163
|
(!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
|
|
4588
5164
|
}
|
|
4589
5165
|
|
|
4590
|
-
module.exports = isString;
|
|
5166
|
+
module.exports = isString;
|
|
5167
|
+
|
|
5168
|
+
|
|
5169
|
+
/***/ }),
|
|
5170
|
+
|
|
5171
|
+
/***/ "../node_modules/node-libs-browser/node_modules/buffer/index.js":
|
|
5172
|
+
/*!**********************************************************************!*\
|
|
5173
|
+
!*** ../node_modules/node-libs-browser/node_modules/buffer/index.js ***!
|
|
5174
|
+
\**********************************************************************/
|
|
5175
|
+
/*! no static exports found */
|
|
5176
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
5177
|
+
|
|
5178
|
+
"use strict";
|
|
5179
|
+
/* WEBPACK VAR INJECTION */(function(global) {/*!
|
|
5180
|
+
* The buffer module from node.js, for the browser.
|
|
5181
|
+
*
|
|
5182
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
5183
|
+
* @license MIT
|
|
5184
|
+
*/
|
|
5185
|
+
/* eslint-disable no-proto */
|
|
5186
|
+
|
|
5187
|
+
|
|
5188
|
+
|
|
5189
|
+
var base64 = __webpack_require__(/*! base64-js */ "../node_modules/base64-js/index.js")
|
|
5190
|
+
var ieee754 = __webpack_require__(/*! ieee754 */ "../node_modules/ieee754/index.js")
|
|
5191
|
+
var isArray = __webpack_require__(/*! isarray */ "../node_modules/isarray/index.js")
|
|
5192
|
+
|
|
5193
|
+
exports.Buffer = Buffer
|
|
5194
|
+
exports.SlowBuffer = SlowBuffer
|
|
5195
|
+
exports.INSPECT_MAX_BYTES = 50
|
|
5196
|
+
|
|
5197
|
+
/**
|
|
5198
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
5199
|
+
* === true Use Uint8Array implementation (fastest)
|
|
5200
|
+
* === false Use Object implementation (most compatible, even IE6)
|
|
5201
|
+
*
|
|
5202
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
5203
|
+
* Opera 11.6+, iOS 4.2+.
|
|
5204
|
+
*
|
|
5205
|
+
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
5206
|
+
* when the browser supports typed arrays.
|
|
5207
|
+
*
|
|
5208
|
+
* Note:
|
|
5209
|
+
*
|
|
5210
|
+
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
5211
|
+
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
5212
|
+
*
|
|
5213
|
+
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
5214
|
+
*
|
|
5215
|
+
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
5216
|
+
* incorrect length in some situations.
|
|
5217
|
+
|
|
5218
|
+
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
5219
|
+
* get the Object implementation, which is slower but behaves correctly.
|
|
5220
|
+
*/
|
|
5221
|
+
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
|
|
5222
|
+
? global.TYPED_ARRAY_SUPPORT
|
|
5223
|
+
: typedArraySupport()
|
|
5224
|
+
|
|
5225
|
+
/*
|
|
5226
|
+
* Export kMaxLength after typed array support is determined.
|
|
5227
|
+
*/
|
|
5228
|
+
exports.kMaxLength = kMaxLength()
|
|
5229
|
+
|
|
5230
|
+
function typedArraySupport () {
|
|
5231
|
+
try {
|
|
5232
|
+
var arr = new Uint8Array(1)
|
|
5233
|
+
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
|
|
5234
|
+
return arr.foo() === 42 && // typed array instances can be augmented
|
|
5235
|
+
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
|
|
5236
|
+
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
|
|
5237
|
+
} catch (e) {
|
|
5238
|
+
return false
|
|
5239
|
+
}
|
|
5240
|
+
}
|
|
5241
|
+
|
|
5242
|
+
function kMaxLength () {
|
|
5243
|
+
return Buffer.TYPED_ARRAY_SUPPORT
|
|
5244
|
+
? 0x7fffffff
|
|
5245
|
+
: 0x3fffffff
|
|
5246
|
+
}
|
|
5247
|
+
|
|
5248
|
+
function createBuffer (that, length) {
|
|
5249
|
+
if (kMaxLength() < length) {
|
|
5250
|
+
throw new RangeError('Invalid typed array length')
|
|
5251
|
+
}
|
|
5252
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
5253
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
|
5254
|
+
that = new Uint8Array(length)
|
|
5255
|
+
that.__proto__ = Buffer.prototype
|
|
5256
|
+
} else {
|
|
5257
|
+
// Fallback: Return an object instance of the Buffer class
|
|
5258
|
+
if (that === null) {
|
|
5259
|
+
that = new Buffer(length)
|
|
5260
|
+
}
|
|
5261
|
+
that.length = length
|
|
5262
|
+
}
|
|
5263
|
+
|
|
5264
|
+
return that
|
|
5265
|
+
}
|
|
5266
|
+
|
|
5267
|
+
/**
|
|
5268
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
5269
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
5270
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
5271
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
5272
|
+
* returns a single octet.
|
|
5273
|
+
*
|
|
5274
|
+
* The `Uint8Array` prototype remains unmodified.
|
|
5275
|
+
*/
|
|
5276
|
+
|
|
5277
|
+
function Buffer (arg, encodingOrOffset, length) {
|
|
5278
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
5279
|
+
return new Buffer(arg, encodingOrOffset, length)
|
|
5280
|
+
}
|
|
5281
|
+
|
|
5282
|
+
// Common case.
|
|
5283
|
+
if (typeof arg === 'number') {
|
|
5284
|
+
if (typeof encodingOrOffset === 'string') {
|
|
5285
|
+
throw new Error(
|
|
5286
|
+
'If encoding is specified then the first argument must be a string'
|
|
5287
|
+
)
|
|
5288
|
+
}
|
|
5289
|
+
return allocUnsafe(this, arg)
|
|
5290
|
+
}
|
|
5291
|
+
return from(this, arg, encodingOrOffset, length)
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
Buffer.poolSize = 8192 // not used by this implementation
|
|
5295
|
+
|
|
5296
|
+
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
5297
|
+
Buffer._augment = function (arr) {
|
|
5298
|
+
arr.__proto__ = Buffer.prototype
|
|
5299
|
+
return arr
|
|
5300
|
+
}
|
|
5301
|
+
|
|
5302
|
+
function from (that, value, encodingOrOffset, length) {
|
|
5303
|
+
if (typeof value === 'number') {
|
|
5304
|
+
throw new TypeError('"value" argument must not be a number')
|
|
5305
|
+
}
|
|
5306
|
+
|
|
5307
|
+
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
5308
|
+
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
|
5309
|
+
}
|
|
5310
|
+
|
|
5311
|
+
if (typeof value === 'string') {
|
|
5312
|
+
return fromString(that, value, encodingOrOffset)
|
|
5313
|
+
}
|
|
5314
|
+
|
|
5315
|
+
return fromObject(that, value)
|
|
5316
|
+
}
|
|
5317
|
+
|
|
5318
|
+
/**
|
|
5319
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
5320
|
+
* if value is a number.
|
|
5321
|
+
* Buffer.from(str[, encoding])
|
|
5322
|
+
* Buffer.from(array)
|
|
5323
|
+
* Buffer.from(buffer)
|
|
5324
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
5325
|
+
**/
|
|
5326
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
|
5327
|
+
return from(null, value, encodingOrOffset, length)
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5330
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
5331
|
+
Buffer.prototype.__proto__ = Uint8Array.prototype
|
|
5332
|
+
Buffer.__proto__ = Uint8Array
|
|
5333
|
+
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
5334
|
+
Buffer[Symbol.species] === Buffer) {
|
|
5335
|
+
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
|
|
5336
|
+
Object.defineProperty(Buffer, Symbol.species, {
|
|
5337
|
+
value: null,
|
|
5338
|
+
configurable: true
|
|
5339
|
+
})
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
|
|
5343
|
+
function assertSize (size) {
|
|
5344
|
+
if (typeof size !== 'number') {
|
|
5345
|
+
throw new TypeError('"size" argument must be a number')
|
|
5346
|
+
} else if (size < 0) {
|
|
5347
|
+
throw new RangeError('"size" argument must not be negative')
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5351
|
+
function alloc (that, size, fill, encoding) {
|
|
5352
|
+
assertSize(size)
|
|
5353
|
+
if (size <= 0) {
|
|
5354
|
+
return createBuffer(that, size)
|
|
5355
|
+
}
|
|
5356
|
+
if (fill !== undefined) {
|
|
5357
|
+
// Only pay attention to encoding if it's a string. This
|
|
5358
|
+
// prevents accidentally sending in a number that would
|
|
5359
|
+
// be interpretted as a start offset.
|
|
5360
|
+
return typeof encoding === 'string'
|
|
5361
|
+
? createBuffer(that, size).fill(fill, encoding)
|
|
5362
|
+
: createBuffer(that, size).fill(fill)
|
|
5363
|
+
}
|
|
5364
|
+
return createBuffer(that, size)
|
|
5365
|
+
}
|
|
5366
|
+
|
|
5367
|
+
/**
|
|
5368
|
+
* Creates a new filled Buffer instance.
|
|
5369
|
+
* alloc(size[, fill[, encoding]])
|
|
5370
|
+
**/
|
|
5371
|
+
Buffer.alloc = function (size, fill, encoding) {
|
|
5372
|
+
return alloc(null, size, fill, encoding)
|
|
5373
|
+
}
|
|
5374
|
+
|
|
5375
|
+
function allocUnsafe (that, size) {
|
|
5376
|
+
assertSize(size)
|
|
5377
|
+
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
|
|
5378
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
5379
|
+
for (var i = 0; i < size; ++i) {
|
|
5380
|
+
that[i] = 0
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
return that
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5386
|
+
/**
|
|
5387
|
+
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
5388
|
+
* */
|
|
5389
|
+
Buffer.allocUnsafe = function (size) {
|
|
5390
|
+
return allocUnsafe(null, size)
|
|
5391
|
+
}
|
|
5392
|
+
/**
|
|
5393
|
+
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
5394
|
+
*/
|
|
5395
|
+
Buffer.allocUnsafeSlow = function (size) {
|
|
5396
|
+
return allocUnsafe(null, size)
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5399
|
+
function fromString (that, string, encoding) {
|
|
5400
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
|
5401
|
+
encoding = 'utf8'
|
|
5402
|
+
}
|
|
5403
|
+
|
|
5404
|
+
if (!Buffer.isEncoding(encoding)) {
|
|
5405
|
+
throw new TypeError('"encoding" must be a valid string encoding')
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5408
|
+
var length = byteLength(string, encoding) | 0
|
|
5409
|
+
that = createBuffer(that, length)
|
|
5410
|
+
|
|
5411
|
+
var actual = that.write(string, encoding)
|
|
5412
|
+
|
|
5413
|
+
if (actual !== length) {
|
|
5414
|
+
// Writing a hex string, for example, that contains invalid characters will
|
|
5415
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
|
5416
|
+
// 'abxxcd' will be treated as 'ab')
|
|
5417
|
+
that = that.slice(0, actual)
|
|
5418
|
+
}
|
|
5419
|
+
|
|
5420
|
+
return that
|
|
5421
|
+
}
|
|
5422
|
+
|
|
5423
|
+
function fromArrayLike (that, array) {
|
|
5424
|
+
var length = array.length < 0 ? 0 : checked(array.length) | 0
|
|
5425
|
+
that = createBuffer(that, length)
|
|
5426
|
+
for (var i = 0; i < length; i += 1) {
|
|
5427
|
+
that[i] = array[i] & 255
|
|
5428
|
+
}
|
|
5429
|
+
return that
|
|
5430
|
+
}
|
|
5431
|
+
|
|
5432
|
+
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
5433
|
+
array.byteLength // this throws if `array` is not a valid ArrayBuffer
|
|
5434
|
+
|
|
5435
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
5436
|
+
throw new RangeError('\'offset\' is out of bounds')
|
|
5437
|
+
}
|
|
5438
|
+
|
|
5439
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
5440
|
+
throw new RangeError('\'length\' is out of bounds')
|
|
5441
|
+
}
|
|
5442
|
+
|
|
5443
|
+
if (byteOffset === undefined && length === undefined) {
|
|
5444
|
+
array = new Uint8Array(array)
|
|
5445
|
+
} else if (length === undefined) {
|
|
5446
|
+
array = new Uint8Array(array, byteOffset)
|
|
5447
|
+
} else {
|
|
5448
|
+
array = new Uint8Array(array, byteOffset, length)
|
|
5449
|
+
}
|
|
5450
|
+
|
|
5451
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
5452
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
|
5453
|
+
that = array
|
|
5454
|
+
that.__proto__ = Buffer.prototype
|
|
5455
|
+
} else {
|
|
5456
|
+
// Fallback: Return an object instance of the Buffer class
|
|
5457
|
+
that = fromArrayLike(that, array)
|
|
5458
|
+
}
|
|
5459
|
+
return that
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5462
|
+
function fromObject (that, obj) {
|
|
5463
|
+
if (Buffer.isBuffer(obj)) {
|
|
5464
|
+
var len = checked(obj.length) | 0
|
|
5465
|
+
that = createBuffer(that, len)
|
|
5466
|
+
|
|
5467
|
+
if (that.length === 0) {
|
|
5468
|
+
return that
|
|
5469
|
+
}
|
|
5470
|
+
|
|
5471
|
+
obj.copy(that, 0, 0, len)
|
|
5472
|
+
return that
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5475
|
+
if (obj) {
|
|
5476
|
+
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
5477
|
+
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
5478
|
+
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
5479
|
+
return createBuffer(that, 0)
|
|
5480
|
+
}
|
|
5481
|
+
return fromArrayLike(that, obj)
|
|
5482
|
+
}
|
|
5483
|
+
|
|
5484
|
+
if (obj.type === 'Buffer' && isArray(obj.data)) {
|
|
5485
|
+
return fromArrayLike(that, obj.data)
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5489
|
+
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
5490
|
+
}
|
|
5491
|
+
|
|
5492
|
+
function checked (length) {
|
|
5493
|
+
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
5494
|
+
// length is NaN (which is otherwise coerced to zero.)
|
|
5495
|
+
if (length >= kMaxLength()) {
|
|
5496
|
+
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
5497
|
+
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
|
5498
|
+
}
|
|
5499
|
+
return length | 0
|
|
5500
|
+
}
|
|
5501
|
+
|
|
5502
|
+
function SlowBuffer (length) {
|
|
5503
|
+
if (+length != length) { // eslint-disable-line eqeqeq
|
|
5504
|
+
length = 0
|
|
5505
|
+
}
|
|
5506
|
+
return Buffer.alloc(+length)
|
|
5507
|
+
}
|
|
5508
|
+
|
|
5509
|
+
Buffer.isBuffer = function isBuffer (b) {
|
|
5510
|
+
return !!(b != null && b._isBuffer)
|
|
5511
|
+
}
|
|
5512
|
+
|
|
5513
|
+
Buffer.compare = function compare (a, b) {
|
|
5514
|
+
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
|
|
5515
|
+
throw new TypeError('Arguments must be Buffers')
|
|
5516
|
+
}
|
|
5517
|
+
|
|
5518
|
+
if (a === b) return 0
|
|
5519
|
+
|
|
5520
|
+
var x = a.length
|
|
5521
|
+
var y = b.length
|
|
5522
|
+
|
|
5523
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
5524
|
+
if (a[i] !== b[i]) {
|
|
5525
|
+
x = a[i]
|
|
5526
|
+
y = b[i]
|
|
5527
|
+
break
|
|
5528
|
+
}
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5531
|
+
if (x < y) return -1
|
|
5532
|
+
if (y < x) return 1
|
|
5533
|
+
return 0
|
|
5534
|
+
}
|
|
5535
|
+
|
|
5536
|
+
Buffer.isEncoding = function isEncoding (encoding) {
|
|
5537
|
+
switch (String(encoding).toLowerCase()) {
|
|
5538
|
+
case 'hex':
|
|
5539
|
+
case 'utf8':
|
|
5540
|
+
case 'utf-8':
|
|
5541
|
+
case 'ascii':
|
|
5542
|
+
case 'latin1':
|
|
5543
|
+
case 'binary':
|
|
5544
|
+
case 'base64':
|
|
5545
|
+
case 'ucs2':
|
|
5546
|
+
case 'ucs-2':
|
|
5547
|
+
case 'utf16le':
|
|
5548
|
+
case 'utf-16le':
|
|
5549
|
+
return true
|
|
5550
|
+
default:
|
|
5551
|
+
return false
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
|
|
5555
|
+
Buffer.concat = function concat (list, length) {
|
|
5556
|
+
if (!isArray(list)) {
|
|
5557
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
if (list.length === 0) {
|
|
5561
|
+
return Buffer.alloc(0)
|
|
5562
|
+
}
|
|
5563
|
+
|
|
5564
|
+
var i
|
|
5565
|
+
if (length === undefined) {
|
|
5566
|
+
length = 0
|
|
5567
|
+
for (i = 0; i < list.length; ++i) {
|
|
5568
|
+
length += list[i].length
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
|
|
5572
|
+
var buffer = Buffer.allocUnsafe(length)
|
|
5573
|
+
var pos = 0
|
|
5574
|
+
for (i = 0; i < list.length; ++i) {
|
|
5575
|
+
var buf = list[i]
|
|
5576
|
+
if (!Buffer.isBuffer(buf)) {
|
|
5577
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
5578
|
+
}
|
|
5579
|
+
buf.copy(buffer, pos)
|
|
5580
|
+
pos += buf.length
|
|
5581
|
+
}
|
|
5582
|
+
return buffer
|
|
5583
|
+
}
|
|
5584
|
+
|
|
5585
|
+
function byteLength (string, encoding) {
|
|
5586
|
+
if (Buffer.isBuffer(string)) {
|
|
5587
|
+
return string.length
|
|
5588
|
+
}
|
|
5589
|
+
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
5590
|
+
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
5591
|
+
return string.byteLength
|
|
5592
|
+
}
|
|
5593
|
+
if (typeof string !== 'string') {
|
|
5594
|
+
string = '' + string
|
|
5595
|
+
}
|
|
5596
|
+
|
|
5597
|
+
var len = string.length
|
|
5598
|
+
if (len === 0) return 0
|
|
5599
|
+
|
|
5600
|
+
// Use a for loop to avoid recursion
|
|
5601
|
+
var loweredCase = false
|
|
5602
|
+
for (;;) {
|
|
5603
|
+
switch (encoding) {
|
|
5604
|
+
case 'ascii':
|
|
5605
|
+
case 'latin1':
|
|
5606
|
+
case 'binary':
|
|
5607
|
+
return len
|
|
5608
|
+
case 'utf8':
|
|
5609
|
+
case 'utf-8':
|
|
5610
|
+
case undefined:
|
|
5611
|
+
return utf8ToBytes(string).length
|
|
5612
|
+
case 'ucs2':
|
|
5613
|
+
case 'ucs-2':
|
|
5614
|
+
case 'utf16le':
|
|
5615
|
+
case 'utf-16le':
|
|
5616
|
+
return len * 2
|
|
5617
|
+
case 'hex':
|
|
5618
|
+
return len >>> 1
|
|
5619
|
+
case 'base64':
|
|
5620
|
+
return base64ToBytes(string).length
|
|
5621
|
+
default:
|
|
5622
|
+
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
|
5623
|
+
encoding = ('' + encoding).toLowerCase()
|
|
5624
|
+
loweredCase = true
|
|
5625
|
+
}
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
Buffer.byteLength = byteLength
|
|
5629
|
+
|
|
5630
|
+
function slowToString (encoding, start, end) {
|
|
5631
|
+
var loweredCase = false
|
|
5632
|
+
|
|
5633
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
5634
|
+
// property of a typed array.
|
|
5635
|
+
|
|
5636
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
5637
|
+
// to their upper/lower bounds if the value passed is out of range.
|
|
5638
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
5639
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
5640
|
+
if (start === undefined || start < 0) {
|
|
5641
|
+
start = 0
|
|
5642
|
+
}
|
|
5643
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
|
5644
|
+
// coercion fail below.
|
|
5645
|
+
if (start > this.length) {
|
|
5646
|
+
return ''
|
|
5647
|
+
}
|
|
5648
|
+
|
|
5649
|
+
if (end === undefined || end > this.length) {
|
|
5650
|
+
end = this.length
|
|
5651
|
+
}
|
|
5652
|
+
|
|
5653
|
+
if (end <= 0) {
|
|
5654
|
+
return ''
|
|
5655
|
+
}
|
|
5656
|
+
|
|
5657
|
+
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
5658
|
+
end >>>= 0
|
|
5659
|
+
start >>>= 0
|
|
5660
|
+
|
|
5661
|
+
if (end <= start) {
|
|
5662
|
+
return ''
|
|
5663
|
+
}
|
|
5664
|
+
|
|
5665
|
+
if (!encoding) encoding = 'utf8'
|
|
5666
|
+
|
|
5667
|
+
while (true) {
|
|
5668
|
+
switch (encoding) {
|
|
5669
|
+
case 'hex':
|
|
5670
|
+
return hexSlice(this, start, end)
|
|
5671
|
+
|
|
5672
|
+
case 'utf8':
|
|
5673
|
+
case 'utf-8':
|
|
5674
|
+
return utf8Slice(this, start, end)
|
|
5675
|
+
|
|
5676
|
+
case 'ascii':
|
|
5677
|
+
return asciiSlice(this, start, end)
|
|
5678
|
+
|
|
5679
|
+
case 'latin1':
|
|
5680
|
+
case 'binary':
|
|
5681
|
+
return latin1Slice(this, start, end)
|
|
5682
|
+
|
|
5683
|
+
case 'base64':
|
|
5684
|
+
return base64Slice(this, start, end)
|
|
5685
|
+
|
|
5686
|
+
case 'ucs2':
|
|
5687
|
+
case 'ucs-2':
|
|
5688
|
+
case 'utf16le':
|
|
5689
|
+
case 'utf-16le':
|
|
5690
|
+
return utf16leSlice(this, start, end)
|
|
5691
|
+
|
|
5692
|
+
default:
|
|
5693
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
5694
|
+
encoding = (encoding + '').toLowerCase()
|
|
5695
|
+
loweredCase = true
|
|
5696
|
+
}
|
|
5697
|
+
}
|
|
5698
|
+
}
|
|
5699
|
+
|
|
5700
|
+
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
5701
|
+
// Buffer instances.
|
|
5702
|
+
Buffer.prototype._isBuffer = true
|
|
5703
|
+
|
|
5704
|
+
function swap (b, n, m) {
|
|
5705
|
+
var i = b[n]
|
|
5706
|
+
b[n] = b[m]
|
|
5707
|
+
b[m] = i
|
|
5708
|
+
}
|
|
5709
|
+
|
|
5710
|
+
Buffer.prototype.swap16 = function swap16 () {
|
|
5711
|
+
var len = this.length
|
|
5712
|
+
if (len % 2 !== 0) {
|
|
5713
|
+
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
5714
|
+
}
|
|
5715
|
+
for (var i = 0; i < len; i += 2) {
|
|
5716
|
+
swap(this, i, i + 1)
|
|
5717
|
+
}
|
|
5718
|
+
return this
|
|
5719
|
+
}
|
|
5720
|
+
|
|
5721
|
+
Buffer.prototype.swap32 = function swap32 () {
|
|
5722
|
+
var len = this.length
|
|
5723
|
+
if (len % 4 !== 0) {
|
|
5724
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
5725
|
+
}
|
|
5726
|
+
for (var i = 0; i < len; i += 4) {
|
|
5727
|
+
swap(this, i, i + 3)
|
|
5728
|
+
swap(this, i + 1, i + 2)
|
|
5729
|
+
}
|
|
5730
|
+
return this
|
|
5731
|
+
}
|
|
5732
|
+
|
|
5733
|
+
Buffer.prototype.swap64 = function swap64 () {
|
|
5734
|
+
var len = this.length
|
|
5735
|
+
if (len % 8 !== 0) {
|
|
5736
|
+
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
5737
|
+
}
|
|
5738
|
+
for (var i = 0; i < len; i += 8) {
|
|
5739
|
+
swap(this, i, i + 7)
|
|
5740
|
+
swap(this, i + 1, i + 6)
|
|
5741
|
+
swap(this, i + 2, i + 5)
|
|
5742
|
+
swap(this, i + 3, i + 4)
|
|
5743
|
+
}
|
|
5744
|
+
return this
|
|
5745
|
+
}
|
|
5746
|
+
|
|
5747
|
+
Buffer.prototype.toString = function toString () {
|
|
5748
|
+
var length = this.length | 0
|
|
5749
|
+
if (length === 0) return ''
|
|
5750
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
5751
|
+
return slowToString.apply(this, arguments)
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
Buffer.prototype.equals = function equals (b) {
|
|
5755
|
+
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
5756
|
+
if (this === b) return true
|
|
5757
|
+
return Buffer.compare(this, b) === 0
|
|
5758
|
+
}
|
|
5759
|
+
|
|
5760
|
+
Buffer.prototype.inspect = function inspect () {
|
|
5761
|
+
var str = ''
|
|
5762
|
+
var max = exports.INSPECT_MAX_BYTES
|
|
5763
|
+
if (this.length > 0) {
|
|
5764
|
+
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
|
|
5765
|
+
if (this.length > max) str += ' ... '
|
|
5766
|
+
}
|
|
5767
|
+
return '<Buffer ' + str + '>'
|
|
5768
|
+
}
|
|
5769
|
+
|
|
5770
|
+
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
5771
|
+
if (!Buffer.isBuffer(target)) {
|
|
5772
|
+
throw new TypeError('Argument must be a Buffer')
|
|
5773
|
+
}
|
|
5774
|
+
|
|
5775
|
+
if (start === undefined) {
|
|
5776
|
+
start = 0
|
|
5777
|
+
}
|
|
5778
|
+
if (end === undefined) {
|
|
5779
|
+
end = target ? target.length : 0
|
|
5780
|
+
}
|
|
5781
|
+
if (thisStart === undefined) {
|
|
5782
|
+
thisStart = 0
|
|
5783
|
+
}
|
|
5784
|
+
if (thisEnd === undefined) {
|
|
5785
|
+
thisEnd = this.length
|
|
5786
|
+
}
|
|
5787
|
+
|
|
5788
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
5789
|
+
throw new RangeError('out of range index')
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5792
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
5793
|
+
return 0
|
|
5794
|
+
}
|
|
5795
|
+
if (thisStart >= thisEnd) {
|
|
5796
|
+
return -1
|
|
5797
|
+
}
|
|
5798
|
+
if (start >= end) {
|
|
5799
|
+
return 1
|
|
5800
|
+
}
|
|
5801
|
+
|
|
5802
|
+
start >>>= 0
|
|
5803
|
+
end >>>= 0
|
|
5804
|
+
thisStart >>>= 0
|
|
5805
|
+
thisEnd >>>= 0
|
|
5806
|
+
|
|
5807
|
+
if (this === target) return 0
|
|
5808
|
+
|
|
5809
|
+
var x = thisEnd - thisStart
|
|
5810
|
+
var y = end - start
|
|
5811
|
+
var len = Math.min(x, y)
|
|
5812
|
+
|
|
5813
|
+
var thisCopy = this.slice(thisStart, thisEnd)
|
|
5814
|
+
var targetCopy = target.slice(start, end)
|
|
5815
|
+
|
|
5816
|
+
for (var i = 0; i < len; ++i) {
|
|
5817
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
5818
|
+
x = thisCopy[i]
|
|
5819
|
+
y = targetCopy[i]
|
|
5820
|
+
break
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
|
|
5824
|
+
if (x < y) return -1
|
|
5825
|
+
if (y < x) return 1
|
|
5826
|
+
return 0
|
|
5827
|
+
}
|
|
5828
|
+
|
|
5829
|
+
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
5830
|
+
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
5831
|
+
//
|
|
5832
|
+
// Arguments:
|
|
5833
|
+
// - buffer - a Buffer to search
|
|
5834
|
+
// - val - a string, Buffer, or number
|
|
5835
|
+
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
5836
|
+
// - encoding - an optional encoding, relevant is val is a string
|
|
5837
|
+
// - dir - true for indexOf, false for lastIndexOf
|
|
5838
|
+
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
5839
|
+
// Empty buffer means no match
|
|
5840
|
+
if (buffer.length === 0) return -1
|
|
5841
|
+
|
|
5842
|
+
// Normalize byteOffset
|
|
5843
|
+
if (typeof byteOffset === 'string') {
|
|
5844
|
+
encoding = byteOffset
|
|
5845
|
+
byteOffset = 0
|
|
5846
|
+
} else if (byteOffset > 0x7fffffff) {
|
|
5847
|
+
byteOffset = 0x7fffffff
|
|
5848
|
+
} else if (byteOffset < -0x80000000) {
|
|
5849
|
+
byteOffset = -0x80000000
|
|
5850
|
+
}
|
|
5851
|
+
byteOffset = +byteOffset // Coerce to Number.
|
|
5852
|
+
if (isNaN(byteOffset)) {
|
|
5853
|
+
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
5854
|
+
byteOffset = dir ? 0 : (buffer.length - 1)
|
|
5855
|
+
}
|
|
5856
|
+
|
|
5857
|
+
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
5858
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
|
|
5859
|
+
if (byteOffset >= buffer.length) {
|
|
5860
|
+
if (dir) return -1
|
|
5861
|
+
else byteOffset = buffer.length - 1
|
|
5862
|
+
} else if (byteOffset < 0) {
|
|
5863
|
+
if (dir) byteOffset = 0
|
|
5864
|
+
else return -1
|
|
5865
|
+
}
|
|
5866
|
+
|
|
5867
|
+
// Normalize val
|
|
5868
|
+
if (typeof val === 'string') {
|
|
5869
|
+
val = Buffer.from(val, encoding)
|
|
5870
|
+
}
|
|
5871
|
+
|
|
5872
|
+
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
5873
|
+
if (Buffer.isBuffer(val)) {
|
|
5874
|
+
// Special case: looking for empty string/buffer always fails
|
|
5875
|
+
if (val.length === 0) {
|
|
5876
|
+
return -1
|
|
5877
|
+
}
|
|
5878
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
5879
|
+
} else if (typeof val === 'number') {
|
|
5880
|
+
val = val & 0xFF // Search for a byte value [0-255]
|
|
5881
|
+
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
|
5882
|
+
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
5883
|
+
if (dir) {
|
|
5884
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
5885
|
+
} else {
|
|
5886
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
5887
|
+
}
|
|
5888
|
+
}
|
|
5889
|
+
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
|
5890
|
+
}
|
|
5891
|
+
|
|
5892
|
+
throw new TypeError('val must be string, number or Buffer')
|
|
5893
|
+
}
|
|
5894
|
+
|
|
5895
|
+
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
5896
|
+
var indexSize = 1
|
|
5897
|
+
var arrLength = arr.length
|
|
5898
|
+
var valLength = val.length
|
|
5899
|
+
|
|
5900
|
+
if (encoding !== undefined) {
|
|
5901
|
+
encoding = String(encoding).toLowerCase()
|
|
5902
|
+
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
5903
|
+
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
5904
|
+
if (arr.length < 2 || val.length < 2) {
|
|
5905
|
+
return -1
|
|
5906
|
+
}
|
|
5907
|
+
indexSize = 2
|
|
5908
|
+
arrLength /= 2
|
|
5909
|
+
valLength /= 2
|
|
5910
|
+
byteOffset /= 2
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5914
|
+
function read (buf, i) {
|
|
5915
|
+
if (indexSize === 1) {
|
|
5916
|
+
return buf[i]
|
|
5917
|
+
} else {
|
|
5918
|
+
return buf.readUInt16BE(i * indexSize)
|
|
5919
|
+
}
|
|
5920
|
+
}
|
|
5921
|
+
|
|
5922
|
+
var i
|
|
5923
|
+
if (dir) {
|
|
5924
|
+
var foundIndex = -1
|
|
5925
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
5926
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
5927
|
+
if (foundIndex === -1) foundIndex = i
|
|
5928
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
5929
|
+
} else {
|
|
5930
|
+
if (foundIndex !== -1) i -= i - foundIndex
|
|
5931
|
+
foundIndex = -1
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
} else {
|
|
5935
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
|
|
5936
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
5937
|
+
var found = true
|
|
5938
|
+
for (var j = 0; j < valLength; j++) {
|
|
5939
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
5940
|
+
found = false
|
|
5941
|
+
break
|
|
5942
|
+
}
|
|
5943
|
+
}
|
|
5944
|
+
if (found) return i
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5947
|
+
|
|
5948
|
+
return -1
|
|
5949
|
+
}
|
|
5950
|
+
|
|
5951
|
+
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
5952
|
+
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
5953
|
+
}
|
|
5954
|
+
|
|
5955
|
+
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
5956
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
5957
|
+
}
|
|
5958
|
+
|
|
5959
|
+
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
5960
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
function hexWrite (buf, string, offset, length) {
|
|
5964
|
+
offset = Number(offset) || 0
|
|
5965
|
+
var remaining = buf.length - offset
|
|
5966
|
+
if (!length) {
|
|
5967
|
+
length = remaining
|
|
5968
|
+
} else {
|
|
5969
|
+
length = Number(length)
|
|
5970
|
+
if (length > remaining) {
|
|
5971
|
+
length = remaining
|
|
5972
|
+
}
|
|
5973
|
+
}
|
|
5974
|
+
|
|
5975
|
+
// must be an even number of digits
|
|
5976
|
+
var strLen = string.length
|
|
5977
|
+
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
|
5978
|
+
|
|
5979
|
+
if (length > strLen / 2) {
|
|
5980
|
+
length = strLen / 2
|
|
5981
|
+
}
|
|
5982
|
+
for (var i = 0; i < length; ++i) {
|
|
5983
|
+
var parsed = parseInt(string.substr(i * 2, 2), 16)
|
|
5984
|
+
if (isNaN(parsed)) return i
|
|
5985
|
+
buf[offset + i] = parsed
|
|
5986
|
+
}
|
|
5987
|
+
return i
|
|
5988
|
+
}
|
|
5989
|
+
|
|
5990
|
+
function utf8Write (buf, string, offset, length) {
|
|
5991
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
5992
|
+
}
|
|
5993
|
+
|
|
5994
|
+
function asciiWrite (buf, string, offset, length) {
|
|
5995
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
5996
|
+
}
|
|
5997
|
+
|
|
5998
|
+
function latin1Write (buf, string, offset, length) {
|
|
5999
|
+
return asciiWrite(buf, string, offset, length)
|
|
6000
|
+
}
|
|
6001
|
+
|
|
6002
|
+
function base64Write (buf, string, offset, length) {
|
|
6003
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
6004
|
+
}
|
|
6005
|
+
|
|
6006
|
+
function ucs2Write (buf, string, offset, length) {
|
|
6007
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
6008
|
+
}
|
|
6009
|
+
|
|
6010
|
+
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
6011
|
+
// Buffer#write(string)
|
|
6012
|
+
if (offset === undefined) {
|
|
6013
|
+
encoding = 'utf8'
|
|
6014
|
+
length = this.length
|
|
6015
|
+
offset = 0
|
|
6016
|
+
// Buffer#write(string, encoding)
|
|
6017
|
+
} else if (length === undefined && typeof offset === 'string') {
|
|
6018
|
+
encoding = offset
|
|
6019
|
+
length = this.length
|
|
6020
|
+
offset = 0
|
|
6021
|
+
// Buffer#write(string, offset[, length][, encoding])
|
|
6022
|
+
} else if (isFinite(offset)) {
|
|
6023
|
+
offset = offset | 0
|
|
6024
|
+
if (isFinite(length)) {
|
|
6025
|
+
length = length | 0
|
|
6026
|
+
if (encoding === undefined) encoding = 'utf8'
|
|
6027
|
+
} else {
|
|
6028
|
+
encoding = length
|
|
6029
|
+
length = undefined
|
|
6030
|
+
}
|
|
6031
|
+
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
6032
|
+
} else {
|
|
6033
|
+
throw new Error(
|
|
6034
|
+
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
6035
|
+
)
|
|
6036
|
+
}
|
|
6037
|
+
|
|
6038
|
+
var remaining = this.length - offset
|
|
6039
|
+
if (length === undefined || length > remaining) length = remaining
|
|
6040
|
+
|
|
6041
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
6042
|
+
throw new RangeError('Attempt to write outside buffer bounds')
|
|
6043
|
+
}
|
|
6044
|
+
|
|
6045
|
+
if (!encoding) encoding = 'utf8'
|
|
6046
|
+
|
|
6047
|
+
var loweredCase = false
|
|
6048
|
+
for (;;) {
|
|
6049
|
+
switch (encoding) {
|
|
6050
|
+
case 'hex':
|
|
6051
|
+
return hexWrite(this, string, offset, length)
|
|
6052
|
+
|
|
6053
|
+
case 'utf8':
|
|
6054
|
+
case 'utf-8':
|
|
6055
|
+
return utf8Write(this, string, offset, length)
|
|
6056
|
+
|
|
6057
|
+
case 'ascii':
|
|
6058
|
+
return asciiWrite(this, string, offset, length)
|
|
6059
|
+
|
|
6060
|
+
case 'latin1':
|
|
6061
|
+
case 'binary':
|
|
6062
|
+
return latin1Write(this, string, offset, length)
|
|
6063
|
+
|
|
6064
|
+
case 'base64':
|
|
6065
|
+
// Warning: maxLength not taken into account in base64Write
|
|
6066
|
+
return base64Write(this, string, offset, length)
|
|
6067
|
+
|
|
6068
|
+
case 'ucs2':
|
|
6069
|
+
case 'ucs-2':
|
|
6070
|
+
case 'utf16le':
|
|
6071
|
+
case 'utf-16le':
|
|
6072
|
+
return ucs2Write(this, string, offset, length)
|
|
6073
|
+
|
|
6074
|
+
default:
|
|
6075
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
6076
|
+
encoding = ('' + encoding).toLowerCase()
|
|
6077
|
+
loweredCase = true
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
}
|
|
6081
|
+
|
|
6082
|
+
Buffer.prototype.toJSON = function toJSON () {
|
|
6083
|
+
return {
|
|
6084
|
+
type: 'Buffer',
|
|
6085
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
6086
|
+
}
|
|
6087
|
+
}
|
|
6088
|
+
|
|
6089
|
+
function base64Slice (buf, start, end) {
|
|
6090
|
+
if (start === 0 && end === buf.length) {
|
|
6091
|
+
return base64.fromByteArray(buf)
|
|
6092
|
+
} else {
|
|
6093
|
+
return base64.fromByteArray(buf.slice(start, end))
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
|
|
6097
|
+
function utf8Slice (buf, start, end) {
|
|
6098
|
+
end = Math.min(buf.length, end)
|
|
6099
|
+
var res = []
|
|
6100
|
+
|
|
6101
|
+
var i = start
|
|
6102
|
+
while (i < end) {
|
|
6103
|
+
var firstByte = buf[i]
|
|
6104
|
+
var codePoint = null
|
|
6105
|
+
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
|
6106
|
+
: (firstByte > 0xDF) ? 3
|
|
6107
|
+
: (firstByte > 0xBF) ? 2
|
|
6108
|
+
: 1
|
|
6109
|
+
|
|
6110
|
+
if (i + bytesPerSequence <= end) {
|
|
6111
|
+
var secondByte, thirdByte, fourthByte, tempCodePoint
|
|
6112
|
+
|
|
6113
|
+
switch (bytesPerSequence) {
|
|
6114
|
+
case 1:
|
|
6115
|
+
if (firstByte < 0x80) {
|
|
6116
|
+
codePoint = firstByte
|
|
6117
|
+
}
|
|
6118
|
+
break
|
|
6119
|
+
case 2:
|
|
6120
|
+
secondByte = buf[i + 1]
|
|
6121
|
+
if ((secondByte & 0xC0) === 0x80) {
|
|
6122
|
+
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
|
|
6123
|
+
if (tempCodePoint > 0x7F) {
|
|
6124
|
+
codePoint = tempCodePoint
|
|
6125
|
+
}
|
|
6126
|
+
}
|
|
6127
|
+
break
|
|
6128
|
+
case 3:
|
|
6129
|
+
secondByte = buf[i + 1]
|
|
6130
|
+
thirdByte = buf[i + 2]
|
|
6131
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
6132
|
+
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
|
|
6133
|
+
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
6134
|
+
codePoint = tempCodePoint
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
break
|
|
6138
|
+
case 4:
|
|
6139
|
+
secondByte = buf[i + 1]
|
|
6140
|
+
thirdByte = buf[i + 2]
|
|
6141
|
+
fourthByte = buf[i + 3]
|
|
6142
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
6143
|
+
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
|
|
6144
|
+
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
6145
|
+
codePoint = tempCodePoint
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
|
|
6151
|
+
if (codePoint === null) {
|
|
6152
|
+
// we did not generate a valid codePoint so insert a
|
|
6153
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
|
6154
|
+
codePoint = 0xFFFD
|
|
6155
|
+
bytesPerSequence = 1
|
|
6156
|
+
} else if (codePoint > 0xFFFF) {
|
|
6157
|
+
// encode to utf16 (surrogate pair dance)
|
|
6158
|
+
codePoint -= 0x10000
|
|
6159
|
+
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
|
|
6160
|
+
codePoint = 0xDC00 | codePoint & 0x3FF
|
|
6161
|
+
}
|
|
6162
|
+
|
|
6163
|
+
res.push(codePoint)
|
|
6164
|
+
i += bytesPerSequence
|
|
6165
|
+
}
|
|
6166
|
+
|
|
6167
|
+
return decodeCodePointsArray(res)
|
|
6168
|
+
}
|
|
6169
|
+
|
|
6170
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
6171
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
|
6172
|
+
// We go 1 magnitude less, for safety
|
|
6173
|
+
var MAX_ARGUMENTS_LENGTH = 0x1000
|
|
6174
|
+
|
|
6175
|
+
function decodeCodePointsArray (codePoints) {
|
|
6176
|
+
var len = codePoints.length
|
|
6177
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
6178
|
+
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
6179
|
+
}
|
|
6180
|
+
|
|
6181
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
|
6182
|
+
var res = ''
|
|
6183
|
+
var i = 0
|
|
6184
|
+
while (i < len) {
|
|
6185
|
+
res += String.fromCharCode.apply(
|
|
6186
|
+
String,
|
|
6187
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
6188
|
+
)
|
|
6189
|
+
}
|
|
6190
|
+
return res
|
|
6191
|
+
}
|
|
6192
|
+
|
|
6193
|
+
function asciiSlice (buf, start, end) {
|
|
6194
|
+
var ret = ''
|
|
6195
|
+
end = Math.min(buf.length, end)
|
|
6196
|
+
|
|
6197
|
+
for (var i = start; i < end; ++i) {
|
|
6198
|
+
ret += String.fromCharCode(buf[i] & 0x7F)
|
|
6199
|
+
}
|
|
6200
|
+
return ret
|
|
6201
|
+
}
|
|
6202
|
+
|
|
6203
|
+
function latin1Slice (buf, start, end) {
|
|
6204
|
+
var ret = ''
|
|
6205
|
+
end = Math.min(buf.length, end)
|
|
6206
|
+
|
|
6207
|
+
for (var i = start; i < end; ++i) {
|
|
6208
|
+
ret += String.fromCharCode(buf[i])
|
|
6209
|
+
}
|
|
6210
|
+
return ret
|
|
6211
|
+
}
|
|
6212
|
+
|
|
6213
|
+
function hexSlice (buf, start, end) {
|
|
6214
|
+
var len = buf.length
|
|
6215
|
+
|
|
6216
|
+
if (!start || start < 0) start = 0
|
|
6217
|
+
if (!end || end < 0 || end > len) end = len
|
|
6218
|
+
|
|
6219
|
+
var out = ''
|
|
6220
|
+
for (var i = start; i < end; ++i) {
|
|
6221
|
+
out += toHex(buf[i])
|
|
6222
|
+
}
|
|
6223
|
+
return out
|
|
6224
|
+
}
|
|
6225
|
+
|
|
6226
|
+
function utf16leSlice (buf, start, end) {
|
|
6227
|
+
var bytes = buf.slice(start, end)
|
|
6228
|
+
var res = ''
|
|
6229
|
+
for (var i = 0; i < bytes.length; i += 2) {
|
|
6230
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
|
|
6231
|
+
}
|
|
6232
|
+
return res
|
|
6233
|
+
}
|
|
6234
|
+
|
|
6235
|
+
Buffer.prototype.slice = function slice (start, end) {
|
|
6236
|
+
var len = this.length
|
|
6237
|
+
start = ~~start
|
|
6238
|
+
end = end === undefined ? len : ~~end
|
|
6239
|
+
|
|
6240
|
+
if (start < 0) {
|
|
6241
|
+
start += len
|
|
6242
|
+
if (start < 0) start = 0
|
|
6243
|
+
} else if (start > len) {
|
|
6244
|
+
start = len
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6247
|
+
if (end < 0) {
|
|
6248
|
+
end += len
|
|
6249
|
+
if (end < 0) end = 0
|
|
6250
|
+
} else if (end > len) {
|
|
6251
|
+
end = len
|
|
6252
|
+
}
|
|
6253
|
+
|
|
6254
|
+
if (end < start) end = start
|
|
6255
|
+
|
|
6256
|
+
var newBuf
|
|
6257
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6258
|
+
newBuf = this.subarray(start, end)
|
|
6259
|
+
newBuf.__proto__ = Buffer.prototype
|
|
6260
|
+
} else {
|
|
6261
|
+
var sliceLen = end - start
|
|
6262
|
+
newBuf = new Buffer(sliceLen, undefined)
|
|
6263
|
+
for (var i = 0; i < sliceLen; ++i) {
|
|
6264
|
+
newBuf[i] = this[i + start]
|
|
6265
|
+
}
|
|
6266
|
+
}
|
|
6267
|
+
|
|
6268
|
+
return newBuf
|
|
6269
|
+
}
|
|
6270
|
+
|
|
6271
|
+
/*
|
|
6272
|
+
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
6273
|
+
*/
|
|
6274
|
+
function checkOffset (offset, ext, length) {
|
|
6275
|
+
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
6276
|
+
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
6277
|
+
}
|
|
6278
|
+
|
|
6279
|
+
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
6280
|
+
offset = offset | 0
|
|
6281
|
+
byteLength = byteLength | 0
|
|
6282
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
6283
|
+
|
|
6284
|
+
var val = this[offset]
|
|
6285
|
+
var mul = 1
|
|
6286
|
+
var i = 0
|
|
6287
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
6288
|
+
val += this[offset + i] * mul
|
|
6289
|
+
}
|
|
6290
|
+
|
|
6291
|
+
return val
|
|
6292
|
+
}
|
|
6293
|
+
|
|
6294
|
+
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
6295
|
+
offset = offset | 0
|
|
6296
|
+
byteLength = byteLength | 0
|
|
6297
|
+
if (!noAssert) {
|
|
6298
|
+
checkOffset(offset, byteLength, this.length)
|
|
6299
|
+
}
|
|
6300
|
+
|
|
6301
|
+
var val = this[offset + --byteLength]
|
|
6302
|
+
var mul = 1
|
|
6303
|
+
while (byteLength > 0 && (mul *= 0x100)) {
|
|
6304
|
+
val += this[offset + --byteLength] * mul
|
|
6305
|
+
}
|
|
6306
|
+
|
|
6307
|
+
return val
|
|
6308
|
+
}
|
|
6309
|
+
|
|
6310
|
+
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
6311
|
+
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
6312
|
+
return this[offset]
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
6316
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
6317
|
+
return this[offset] | (this[offset + 1] << 8)
|
|
6318
|
+
}
|
|
6319
|
+
|
|
6320
|
+
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
6321
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
6322
|
+
return (this[offset] << 8) | this[offset + 1]
|
|
6323
|
+
}
|
|
6324
|
+
|
|
6325
|
+
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
6326
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
6327
|
+
|
|
6328
|
+
return ((this[offset]) |
|
|
6329
|
+
(this[offset + 1] << 8) |
|
|
6330
|
+
(this[offset + 2] << 16)) +
|
|
6331
|
+
(this[offset + 3] * 0x1000000)
|
|
6332
|
+
}
|
|
6333
|
+
|
|
6334
|
+
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
6335
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
6336
|
+
|
|
6337
|
+
return (this[offset] * 0x1000000) +
|
|
6338
|
+
((this[offset + 1] << 16) |
|
|
6339
|
+
(this[offset + 2] << 8) |
|
|
6340
|
+
this[offset + 3])
|
|
6341
|
+
}
|
|
6342
|
+
|
|
6343
|
+
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
6344
|
+
offset = offset | 0
|
|
6345
|
+
byteLength = byteLength | 0
|
|
6346
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
6347
|
+
|
|
6348
|
+
var val = this[offset]
|
|
6349
|
+
var mul = 1
|
|
6350
|
+
var i = 0
|
|
6351
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
6352
|
+
val += this[offset + i] * mul
|
|
6353
|
+
}
|
|
6354
|
+
mul *= 0x80
|
|
6355
|
+
|
|
6356
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
6357
|
+
|
|
6358
|
+
return val
|
|
6359
|
+
}
|
|
6360
|
+
|
|
6361
|
+
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
6362
|
+
offset = offset | 0
|
|
6363
|
+
byteLength = byteLength | 0
|
|
6364
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length)
|
|
6365
|
+
|
|
6366
|
+
var i = byteLength
|
|
6367
|
+
var mul = 1
|
|
6368
|
+
var val = this[offset + --i]
|
|
6369
|
+
while (i > 0 && (mul *= 0x100)) {
|
|
6370
|
+
val += this[offset + --i] * mul
|
|
6371
|
+
}
|
|
6372
|
+
mul *= 0x80
|
|
6373
|
+
|
|
6374
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
|
|
6375
|
+
|
|
6376
|
+
return val
|
|
6377
|
+
}
|
|
6378
|
+
|
|
6379
|
+
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
6380
|
+
if (!noAssert) checkOffset(offset, 1, this.length)
|
|
6381
|
+
if (!(this[offset] & 0x80)) return (this[offset])
|
|
6382
|
+
return ((0xff - this[offset] + 1) * -1)
|
|
6383
|
+
}
|
|
6384
|
+
|
|
6385
|
+
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
6386
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
6387
|
+
var val = this[offset] | (this[offset + 1] << 8)
|
|
6388
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
6389
|
+
}
|
|
6390
|
+
|
|
6391
|
+
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
6392
|
+
if (!noAssert) checkOffset(offset, 2, this.length)
|
|
6393
|
+
var val = this[offset + 1] | (this[offset] << 8)
|
|
6394
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
6395
|
+
}
|
|
6396
|
+
|
|
6397
|
+
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
6398
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
6399
|
+
|
|
6400
|
+
return (this[offset]) |
|
|
6401
|
+
(this[offset + 1] << 8) |
|
|
6402
|
+
(this[offset + 2] << 16) |
|
|
6403
|
+
(this[offset + 3] << 24)
|
|
6404
|
+
}
|
|
6405
|
+
|
|
6406
|
+
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
6407
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
6408
|
+
|
|
6409
|
+
return (this[offset] << 24) |
|
|
6410
|
+
(this[offset + 1] << 16) |
|
|
6411
|
+
(this[offset + 2] << 8) |
|
|
6412
|
+
(this[offset + 3])
|
|
6413
|
+
}
|
|
6414
|
+
|
|
6415
|
+
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
6416
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
6417
|
+
return ieee754.read(this, offset, true, 23, 4)
|
|
6418
|
+
}
|
|
6419
|
+
|
|
6420
|
+
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
6421
|
+
if (!noAssert) checkOffset(offset, 4, this.length)
|
|
6422
|
+
return ieee754.read(this, offset, false, 23, 4)
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6425
|
+
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
6426
|
+
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
6427
|
+
return ieee754.read(this, offset, true, 52, 8)
|
|
6428
|
+
}
|
|
6429
|
+
|
|
6430
|
+
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
6431
|
+
if (!noAssert) checkOffset(offset, 8, this.length)
|
|
6432
|
+
return ieee754.read(this, offset, false, 52, 8)
|
|
6433
|
+
}
|
|
6434
|
+
|
|
6435
|
+
function checkInt (buf, value, offset, ext, max, min) {
|
|
6436
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
6437
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
6438
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
6439
|
+
}
|
|
6440
|
+
|
|
6441
|
+
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
6442
|
+
value = +value
|
|
6443
|
+
offset = offset | 0
|
|
6444
|
+
byteLength = byteLength | 0
|
|
6445
|
+
if (!noAssert) {
|
|
6446
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
6447
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
6448
|
+
}
|
|
6449
|
+
|
|
6450
|
+
var mul = 1
|
|
6451
|
+
var i = 0
|
|
6452
|
+
this[offset] = value & 0xFF
|
|
6453
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
6454
|
+
this[offset + i] = (value / mul) & 0xFF
|
|
6455
|
+
}
|
|
6456
|
+
|
|
6457
|
+
return offset + byteLength
|
|
6458
|
+
}
|
|
6459
|
+
|
|
6460
|
+
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
6461
|
+
value = +value
|
|
6462
|
+
offset = offset | 0
|
|
6463
|
+
byteLength = byteLength | 0
|
|
6464
|
+
if (!noAssert) {
|
|
6465
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1
|
|
6466
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0)
|
|
6467
|
+
}
|
|
6468
|
+
|
|
6469
|
+
var i = byteLength - 1
|
|
6470
|
+
var mul = 1
|
|
6471
|
+
this[offset + i] = value & 0xFF
|
|
6472
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
6473
|
+
this[offset + i] = (value / mul) & 0xFF
|
|
6474
|
+
}
|
|
6475
|
+
|
|
6476
|
+
return offset + byteLength
|
|
6477
|
+
}
|
|
6478
|
+
|
|
6479
|
+
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
6480
|
+
value = +value
|
|
6481
|
+
offset = offset | 0
|
|
6482
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
|
|
6483
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
|
6484
|
+
this[offset] = (value & 0xff)
|
|
6485
|
+
return offset + 1
|
|
6486
|
+
}
|
|
6487
|
+
|
|
6488
|
+
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
|
6489
|
+
if (value < 0) value = 0xffff + value + 1
|
|
6490
|
+
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
6491
|
+
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
|
6492
|
+
(littleEndian ? i : 1 - i) * 8
|
|
6493
|
+
}
|
|
6494
|
+
}
|
|
6495
|
+
|
|
6496
|
+
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
6497
|
+
value = +value
|
|
6498
|
+
offset = offset | 0
|
|
6499
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
6500
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6501
|
+
this[offset] = (value & 0xff)
|
|
6502
|
+
this[offset + 1] = (value >>> 8)
|
|
6503
|
+
} else {
|
|
6504
|
+
objectWriteUInt16(this, value, offset, true)
|
|
6505
|
+
}
|
|
6506
|
+
return offset + 2
|
|
6507
|
+
}
|
|
6508
|
+
|
|
6509
|
+
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
6510
|
+
value = +value
|
|
6511
|
+
offset = offset | 0
|
|
6512
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
|
|
6513
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6514
|
+
this[offset] = (value >>> 8)
|
|
6515
|
+
this[offset + 1] = (value & 0xff)
|
|
6516
|
+
} else {
|
|
6517
|
+
objectWriteUInt16(this, value, offset, false)
|
|
6518
|
+
}
|
|
6519
|
+
return offset + 2
|
|
6520
|
+
}
|
|
6521
|
+
|
|
6522
|
+
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
|
6523
|
+
if (value < 0) value = 0xffffffff + value + 1
|
|
6524
|
+
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
6525
|
+
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
|
|
6529
|
+
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
6530
|
+
value = +value
|
|
6531
|
+
offset = offset | 0
|
|
6532
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
6533
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6534
|
+
this[offset + 3] = (value >>> 24)
|
|
6535
|
+
this[offset + 2] = (value >>> 16)
|
|
6536
|
+
this[offset + 1] = (value >>> 8)
|
|
6537
|
+
this[offset] = (value & 0xff)
|
|
6538
|
+
} else {
|
|
6539
|
+
objectWriteUInt32(this, value, offset, true)
|
|
6540
|
+
}
|
|
6541
|
+
return offset + 4
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6544
|
+
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
6545
|
+
value = +value
|
|
6546
|
+
offset = offset | 0
|
|
6547
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
|
|
6548
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6549
|
+
this[offset] = (value >>> 24)
|
|
6550
|
+
this[offset + 1] = (value >>> 16)
|
|
6551
|
+
this[offset + 2] = (value >>> 8)
|
|
6552
|
+
this[offset + 3] = (value & 0xff)
|
|
6553
|
+
} else {
|
|
6554
|
+
objectWriteUInt32(this, value, offset, false)
|
|
6555
|
+
}
|
|
6556
|
+
return offset + 4
|
|
6557
|
+
}
|
|
6558
|
+
|
|
6559
|
+
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
6560
|
+
value = +value
|
|
6561
|
+
offset = offset | 0
|
|
6562
|
+
if (!noAssert) {
|
|
6563
|
+
var limit = Math.pow(2, 8 * byteLength - 1)
|
|
6564
|
+
|
|
6565
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
6566
|
+
}
|
|
6567
|
+
|
|
6568
|
+
var i = 0
|
|
6569
|
+
var mul = 1
|
|
6570
|
+
var sub = 0
|
|
6571
|
+
this[offset] = value & 0xFF
|
|
6572
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
6573
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
6574
|
+
sub = 1
|
|
6575
|
+
}
|
|
6576
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
6577
|
+
}
|
|
6578
|
+
|
|
6579
|
+
return offset + byteLength
|
|
6580
|
+
}
|
|
6581
|
+
|
|
6582
|
+
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
6583
|
+
value = +value
|
|
6584
|
+
offset = offset | 0
|
|
6585
|
+
if (!noAssert) {
|
|
6586
|
+
var limit = Math.pow(2, 8 * byteLength - 1)
|
|
6587
|
+
|
|
6588
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit)
|
|
6589
|
+
}
|
|
6590
|
+
|
|
6591
|
+
var i = byteLength - 1
|
|
6592
|
+
var mul = 1
|
|
6593
|
+
var sub = 0
|
|
6594
|
+
this[offset + i] = value & 0xFF
|
|
6595
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
6596
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
6597
|
+
sub = 1
|
|
6598
|
+
}
|
|
6599
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
|
|
6600
|
+
}
|
|
6601
|
+
|
|
6602
|
+
return offset + byteLength
|
|
6603
|
+
}
|
|
6604
|
+
|
|
6605
|
+
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
6606
|
+
value = +value
|
|
6607
|
+
offset = offset | 0
|
|
6608
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
|
|
6609
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
|
|
6610
|
+
if (value < 0) value = 0xff + value + 1
|
|
6611
|
+
this[offset] = (value & 0xff)
|
|
6612
|
+
return offset + 1
|
|
6613
|
+
}
|
|
6614
|
+
|
|
6615
|
+
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
6616
|
+
value = +value
|
|
6617
|
+
offset = offset | 0
|
|
6618
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
6619
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6620
|
+
this[offset] = (value & 0xff)
|
|
6621
|
+
this[offset + 1] = (value >>> 8)
|
|
6622
|
+
} else {
|
|
6623
|
+
objectWriteUInt16(this, value, offset, true)
|
|
6624
|
+
}
|
|
6625
|
+
return offset + 2
|
|
6626
|
+
}
|
|
6627
|
+
|
|
6628
|
+
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
6629
|
+
value = +value
|
|
6630
|
+
offset = offset | 0
|
|
6631
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
|
|
6632
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6633
|
+
this[offset] = (value >>> 8)
|
|
6634
|
+
this[offset + 1] = (value & 0xff)
|
|
6635
|
+
} else {
|
|
6636
|
+
objectWriteUInt16(this, value, offset, false)
|
|
6637
|
+
}
|
|
6638
|
+
return offset + 2
|
|
6639
|
+
}
|
|
6640
|
+
|
|
6641
|
+
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
6642
|
+
value = +value
|
|
6643
|
+
offset = offset | 0
|
|
6644
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
6645
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6646
|
+
this[offset] = (value & 0xff)
|
|
6647
|
+
this[offset + 1] = (value >>> 8)
|
|
6648
|
+
this[offset + 2] = (value >>> 16)
|
|
6649
|
+
this[offset + 3] = (value >>> 24)
|
|
6650
|
+
} else {
|
|
6651
|
+
objectWriteUInt32(this, value, offset, true)
|
|
6652
|
+
}
|
|
6653
|
+
return offset + 4
|
|
6654
|
+
}
|
|
6655
|
+
|
|
6656
|
+
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
6657
|
+
value = +value
|
|
6658
|
+
offset = offset | 0
|
|
6659
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
|
|
6660
|
+
if (value < 0) value = 0xffffffff + value + 1
|
|
6661
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6662
|
+
this[offset] = (value >>> 24)
|
|
6663
|
+
this[offset + 1] = (value >>> 16)
|
|
6664
|
+
this[offset + 2] = (value >>> 8)
|
|
6665
|
+
this[offset + 3] = (value & 0xff)
|
|
6666
|
+
} else {
|
|
6667
|
+
objectWriteUInt32(this, value, offset, false)
|
|
6668
|
+
}
|
|
6669
|
+
return offset + 4
|
|
6670
|
+
}
|
|
6671
|
+
|
|
6672
|
+
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
6673
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
6674
|
+
if (offset < 0) throw new RangeError('Index out of range')
|
|
6675
|
+
}
|
|
6676
|
+
|
|
6677
|
+
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
6678
|
+
if (!noAssert) {
|
|
6679
|
+
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
|
|
6680
|
+
}
|
|
6681
|
+
ieee754.write(buf, value, offset, littleEndian, 23, 4)
|
|
6682
|
+
return offset + 4
|
|
6683
|
+
}
|
|
6684
|
+
|
|
6685
|
+
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
6686
|
+
return writeFloat(this, value, offset, true, noAssert)
|
|
6687
|
+
}
|
|
6688
|
+
|
|
6689
|
+
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
6690
|
+
return writeFloat(this, value, offset, false, noAssert)
|
|
6691
|
+
}
|
|
6692
|
+
|
|
6693
|
+
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
6694
|
+
if (!noAssert) {
|
|
6695
|
+
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
|
|
6696
|
+
}
|
|
6697
|
+
ieee754.write(buf, value, offset, littleEndian, 52, 8)
|
|
6698
|
+
return offset + 8
|
|
6699
|
+
}
|
|
6700
|
+
|
|
6701
|
+
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
6702
|
+
return writeDouble(this, value, offset, true, noAssert)
|
|
6703
|
+
}
|
|
6704
|
+
|
|
6705
|
+
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
6706
|
+
return writeDouble(this, value, offset, false, noAssert)
|
|
6707
|
+
}
|
|
6708
|
+
|
|
6709
|
+
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
6710
|
+
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
6711
|
+
if (!start) start = 0
|
|
6712
|
+
if (!end && end !== 0) end = this.length
|
|
6713
|
+
if (targetStart >= target.length) targetStart = target.length
|
|
6714
|
+
if (!targetStart) targetStart = 0
|
|
6715
|
+
if (end > 0 && end < start) end = start
|
|
6716
|
+
|
|
6717
|
+
// Copy 0 bytes; we're done
|
|
6718
|
+
if (end === start) return 0
|
|
6719
|
+
if (target.length === 0 || this.length === 0) return 0
|
|
6720
|
+
|
|
6721
|
+
// Fatal error conditions
|
|
6722
|
+
if (targetStart < 0) {
|
|
6723
|
+
throw new RangeError('targetStart out of bounds')
|
|
6724
|
+
}
|
|
6725
|
+
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
6726
|
+
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
6727
|
+
|
|
6728
|
+
// Are we oob?
|
|
6729
|
+
if (end > this.length) end = this.length
|
|
6730
|
+
if (target.length - targetStart < end - start) {
|
|
6731
|
+
end = target.length - targetStart + start
|
|
6732
|
+
}
|
|
6733
|
+
|
|
6734
|
+
var len = end - start
|
|
6735
|
+
var i
|
|
6736
|
+
|
|
6737
|
+
if (this === target && start < targetStart && targetStart < end) {
|
|
6738
|
+
// descending copy from end
|
|
6739
|
+
for (i = len - 1; i >= 0; --i) {
|
|
6740
|
+
target[i + targetStart] = this[i + start]
|
|
6741
|
+
}
|
|
6742
|
+
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
6743
|
+
// ascending copy from start
|
|
6744
|
+
for (i = 0; i < len; ++i) {
|
|
6745
|
+
target[i + targetStart] = this[i + start]
|
|
6746
|
+
}
|
|
6747
|
+
} else {
|
|
6748
|
+
Uint8Array.prototype.set.call(
|
|
6749
|
+
target,
|
|
6750
|
+
this.subarray(start, start + len),
|
|
6751
|
+
targetStart
|
|
6752
|
+
)
|
|
6753
|
+
}
|
|
6754
|
+
|
|
6755
|
+
return len
|
|
6756
|
+
}
|
|
6757
|
+
|
|
6758
|
+
// Usage:
|
|
6759
|
+
// buffer.fill(number[, offset[, end]])
|
|
6760
|
+
// buffer.fill(buffer[, offset[, end]])
|
|
6761
|
+
// buffer.fill(string[, offset[, end]][, encoding])
|
|
6762
|
+
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
6763
|
+
// Handle string cases:
|
|
6764
|
+
if (typeof val === 'string') {
|
|
6765
|
+
if (typeof start === 'string') {
|
|
6766
|
+
encoding = start
|
|
6767
|
+
start = 0
|
|
6768
|
+
end = this.length
|
|
6769
|
+
} else if (typeof end === 'string') {
|
|
6770
|
+
encoding = end
|
|
6771
|
+
end = this.length
|
|
6772
|
+
}
|
|
6773
|
+
if (val.length === 1) {
|
|
6774
|
+
var code = val.charCodeAt(0)
|
|
6775
|
+
if (code < 256) {
|
|
6776
|
+
val = code
|
|
6777
|
+
}
|
|
6778
|
+
}
|
|
6779
|
+
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
6780
|
+
throw new TypeError('encoding must be a string')
|
|
6781
|
+
}
|
|
6782
|
+
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
6783
|
+
throw new TypeError('Unknown encoding: ' + encoding)
|
|
6784
|
+
}
|
|
6785
|
+
} else if (typeof val === 'number') {
|
|
6786
|
+
val = val & 255
|
|
6787
|
+
}
|
|
6788
|
+
|
|
6789
|
+
// Invalid ranges are not set to a default, so can range check early.
|
|
6790
|
+
if (start < 0 || this.length < start || this.length < end) {
|
|
6791
|
+
throw new RangeError('Out of range index')
|
|
6792
|
+
}
|
|
6793
|
+
|
|
6794
|
+
if (end <= start) {
|
|
6795
|
+
return this
|
|
6796
|
+
}
|
|
6797
|
+
|
|
6798
|
+
start = start >>> 0
|
|
6799
|
+
end = end === undefined ? this.length : end >>> 0
|
|
6800
|
+
|
|
6801
|
+
if (!val) val = 0
|
|
6802
|
+
|
|
6803
|
+
var i
|
|
6804
|
+
if (typeof val === 'number') {
|
|
6805
|
+
for (i = start; i < end; ++i) {
|
|
6806
|
+
this[i] = val
|
|
6807
|
+
}
|
|
6808
|
+
} else {
|
|
6809
|
+
var bytes = Buffer.isBuffer(val)
|
|
6810
|
+
? val
|
|
6811
|
+
: utf8ToBytes(new Buffer(val, encoding).toString())
|
|
6812
|
+
var len = bytes.length
|
|
6813
|
+
for (i = 0; i < end - start; ++i) {
|
|
6814
|
+
this[i + start] = bytes[i % len]
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6817
|
+
|
|
6818
|
+
return this
|
|
6819
|
+
}
|
|
6820
|
+
|
|
6821
|
+
// HELPER FUNCTIONS
|
|
6822
|
+
// ================
|
|
6823
|
+
|
|
6824
|
+
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
|
|
6825
|
+
|
|
6826
|
+
function base64clean (str) {
|
|
6827
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
6828
|
+
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
|
|
6829
|
+
// Node converts strings with length < 2 to ''
|
|
6830
|
+
if (str.length < 2) return ''
|
|
6831
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
6832
|
+
while (str.length % 4 !== 0) {
|
|
6833
|
+
str = str + '='
|
|
6834
|
+
}
|
|
6835
|
+
return str
|
|
6836
|
+
}
|
|
6837
|
+
|
|
6838
|
+
function stringtrim (str) {
|
|
6839
|
+
if (str.trim) return str.trim()
|
|
6840
|
+
return str.replace(/^\s+|\s+$/g, '')
|
|
6841
|
+
}
|
|
6842
|
+
|
|
6843
|
+
function toHex (n) {
|
|
6844
|
+
if (n < 16) return '0' + n.toString(16)
|
|
6845
|
+
return n.toString(16)
|
|
6846
|
+
}
|
|
6847
|
+
|
|
6848
|
+
function utf8ToBytes (string, units) {
|
|
6849
|
+
units = units || Infinity
|
|
6850
|
+
var codePoint
|
|
6851
|
+
var length = string.length
|
|
6852
|
+
var leadSurrogate = null
|
|
6853
|
+
var bytes = []
|
|
6854
|
+
|
|
6855
|
+
for (var i = 0; i < length; ++i) {
|
|
6856
|
+
codePoint = string.charCodeAt(i)
|
|
6857
|
+
|
|
6858
|
+
// is surrogate component
|
|
6859
|
+
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
6860
|
+
// last char was a lead
|
|
6861
|
+
if (!leadSurrogate) {
|
|
6862
|
+
// no lead yet
|
|
6863
|
+
if (codePoint > 0xDBFF) {
|
|
6864
|
+
// unexpected trail
|
|
6865
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
6866
|
+
continue
|
|
6867
|
+
} else if (i + 1 === length) {
|
|
6868
|
+
// unpaired lead
|
|
6869
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
6870
|
+
continue
|
|
6871
|
+
}
|
|
6872
|
+
|
|
6873
|
+
// valid lead
|
|
6874
|
+
leadSurrogate = codePoint
|
|
6875
|
+
|
|
6876
|
+
continue
|
|
6877
|
+
}
|
|
6878
|
+
|
|
6879
|
+
// 2 leads in a row
|
|
6880
|
+
if (codePoint < 0xDC00) {
|
|
6881
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
6882
|
+
leadSurrogate = codePoint
|
|
6883
|
+
continue
|
|
6884
|
+
}
|
|
6885
|
+
|
|
6886
|
+
// valid surrogate pair
|
|
6887
|
+
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
|
|
6888
|
+
} else if (leadSurrogate) {
|
|
6889
|
+
// valid bmp char, but last char was a lead
|
|
6890
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
|
|
6891
|
+
}
|
|
6892
|
+
|
|
6893
|
+
leadSurrogate = null
|
|
6894
|
+
|
|
6895
|
+
// encode utf8
|
|
6896
|
+
if (codePoint < 0x80) {
|
|
6897
|
+
if ((units -= 1) < 0) break
|
|
6898
|
+
bytes.push(codePoint)
|
|
6899
|
+
} else if (codePoint < 0x800) {
|
|
6900
|
+
if ((units -= 2) < 0) break
|
|
6901
|
+
bytes.push(
|
|
6902
|
+
codePoint >> 0x6 | 0xC0,
|
|
6903
|
+
codePoint & 0x3F | 0x80
|
|
6904
|
+
)
|
|
6905
|
+
} else if (codePoint < 0x10000) {
|
|
6906
|
+
if ((units -= 3) < 0) break
|
|
6907
|
+
bytes.push(
|
|
6908
|
+
codePoint >> 0xC | 0xE0,
|
|
6909
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
|
6910
|
+
codePoint & 0x3F | 0x80
|
|
6911
|
+
)
|
|
6912
|
+
} else if (codePoint < 0x110000) {
|
|
6913
|
+
if ((units -= 4) < 0) break
|
|
6914
|
+
bytes.push(
|
|
6915
|
+
codePoint >> 0x12 | 0xF0,
|
|
6916
|
+
codePoint >> 0xC & 0x3F | 0x80,
|
|
6917
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
|
6918
|
+
codePoint & 0x3F | 0x80
|
|
6919
|
+
)
|
|
6920
|
+
} else {
|
|
6921
|
+
throw new Error('Invalid code point')
|
|
6922
|
+
}
|
|
6923
|
+
}
|
|
6924
|
+
|
|
6925
|
+
return bytes
|
|
6926
|
+
}
|
|
6927
|
+
|
|
6928
|
+
function asciiToBytes (str) {
|
|
6929
|
+
var byteArray = []
|
|
6930
|
+
for (var i = 0; i < str.length; ++i) {
|
|
6931
|
+
// Node's code seems to be doing this and not & 0x7F..
|
|
6932
|
+
byteArray.push(str.charCodeAt(i) & 0xFF)
|
|
6933
|
+
}
|
|
6934
|
+
return byteArray
|
|
6935
|
+
}
|
|
6936
|
+
|
|
6937
|
+
function utf16leToBytes (str, units) {
|
|
6938
|
+
var c, hi, lo
|
|
6939
|
+
var byteArray = []
|
|
6940
|
+
for (var i = 0; i < str.length; ++i) {
|
|
6941
|
+
if ((units -= 2) < 0) break
|
|
6942
|
+
|
|
6943
|
+
c = str.charCodeAt(i)
|
|
6944
|
+
hi = c >> 8
|
|
6945
|
+
lo = c % 256
|
|
6946
|
+
byteArray.push(lo)
|
|
6947
|
+
byteArray.push(hi)
|
|
6948
|
+
}
|
|
6949
|
+
|
|
6950
|
+
return byteArray
|
|
6951
|
+
}
|
|
6952
|
+
|
|
6953
|
+
function base64ToBytes (str) {
|
|
6954
|
+
return base64.toByteArray(base64clean(str))
|
|
6955
|
+
}
|
|
6956
|
+
|
|
6957
|
+
function blitBuffer (src, dst, offset, length) {
|
|
6958
|
+
for (var i = 0; i < length; ++i) {
|
|
6959
|
+
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
6960
|
+
dst[i + offset] = src[i]
|
|
6961
|
+
}
|
|
6962
|
+
return i
|
|
6963
|
+
}
|
|
6964
|
+
|
|
6965
|
+
function isnan (val) {
|
|
6966
|
+
return val !== val // eslint-disable-line no-self-compare
|
|
6967
|
+
}
|
|
6968
|
+
|
|
6969
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js")))
|
|
6970
|
+
|
|
6971
|
+
/***/ }),
|
|
6972
|
+
|
|
6973
|
+
/***/ "../node_modules/node-libs-browser/node_modules/punycode/punycode.js":
|
|
6974
|
+
/*!***************************************************************************!*\
|
|
6975
|
+
!*** ../node_modules/node-libs-browser/node_modules/punycode/punycode.js ***!
|
|
6976
|
+
\***************************************************************************/
|
|
6977
|
+
/*! no static exports found */
|
|
6978
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
6979
|
+
|
|
6980
|
+
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
6981
|
+
;(function(root) {
|
|
6982
|
+
|
|
6983
|
+
/** Detect free variables */
|
|
6984
|
+
var freeExports = true && exports &&
|
|
6985
|
+
!exports.nodeType && exports;
|
|
6986
|
+
var freeModule = true && module &&
|
|
6987
|
+
!module.nodeType && module;
|
|
6988
|
+
var freeGlobal = typeof global == 'object' && global;
|
|
6989
|
+
if (
|
|
6990
|
+
freeGlobal.global === freeGlobal ||
|
|
6991
|
+
freeGlobal.window === freeGlobal ||
|
|
6992
|
+
freeGlobal.self === freeGlobal
|
|
6993
|
+
) {
|
|
6994
|
+
root = freeGlobal;
|
|
6995
|
+
}
|
|
6996
|
+
|
|
6997
|
+
/**
|
|
6998
|
+
* The `punycode` object.
|
|
6999
|
+
* @name punycode
|
|
7000
|
+
* @type Object
|
|
7001
|
+
*/
|
|
7002
|
+
var punycode,
|
|
7003
|
+
|
|
7004
|
+
/** Highest positive signed 32-bit float value */
|
|
7005
|
+
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
|
7006
|
+
|
|
7007
|
+
/** Bootstring parameters */
|
|
7008
|
+
base = 36,
|
|
7009
|
+
tMin = 1,
|
|
7010
|
+
tMax = 26,
|
|
7011
|
+
skew = 38,
|
|
7012
|
+
damp = 700,
|
|
7013
|
+
initialBias = 72,
|
|
7014
|
+
initialN = 128, // 0x80
|
|
7015
|
+
delimiter = '-', // '\x2D'
|
|
7016
|
+
|
|
7017
|
+
/** Regular expressions */
|
|
7018
|
+
regexPunycode = /^xn--/,
|
|
7019
|
+
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
|
7020
|
+
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
|
7021
|
+
|
|
7022
|
+
/** Error messages */
|
|
7023
|
+
errors = {
|
|
7024
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
7025
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
7026
|
+
'invalid-input': 'Invalid input'
|
|
7027
|
+
},
|
|
7028
|
+
|
|
7029
|
+
/** Convenience shortcuts */
|
|
7030
|
+
baseMinusTMin = base - tMin,
|
|
7031
|
+
floor = Math.floor,
|
|
7032
|
+
stringFromCharCode = String.fromCharCode,
|
|
7033
|
+
|
|
7034
|
+
/** Temporary variable */
|
|
7035
|
+
key;
|
|
7036
|
+
|
|
7037
|
+
/*--------------------------------------------------------------------------*/
|
|
7038
|
+
|
|
7039
|
+
/**
|
|
7040
|
+
* A generic error utility function.
|
|
7041
|
+
* @private
|
|
7042
|
+
* @param {String} type The error type.
|
|
7043
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
7044
|
+
*/
|
|
7045
|
+
function error(type) {
|
|
7046
|
+
throw new RangeError(errors[type]);
|
|
7047
|
+
}
|
|
7048
|
+
|
|
7049
|
+
/**
|
|
7050
|
+
* A generic `Array#map` utility function.
|
|
7051
|
+
* @private
|
|
7052
|
+
* @param {Array} array The array to iterate over.
|
|
7053
|
+
* @param {Function} callback The function that gets called for every array
|
|
7054
|
+
* item.
|
|
7055
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
7056
|
+
*/
|
|
7057
|
+
function map(array, fn) {
|
|
7058
|
+
var length = array.length;
|
|
7059
|
+
var result = [];
|
|
7060
|
+
while (length--) {
|
|
7061
|
+
result[length] = fn(array[length]);
|
|
7062
|
+
}
|
|
7063
|
+
return result;
|
|
7064
|
+
}
|
|
7065
|
+
|
|
7066
|
+
/**
|
|
7067
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
7068
|
+
* addresses.
|
|
7069
|
+
* @private
|
|
7070
|
+
* @param {String} domain The domain name or email address.
|
|
7071
|
+
* @param {Function} callback The function that gets called for every
|
|
7072
|
+
* character.
|
|
7073
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
7074
|
+
* function.
|
|
7075
|
+
*/
|
|
7076
|
+
function mapDomain(string, fn) {
|
|
7077
|
+
var parts = string.split('@');
|
|
7078
|
+
var result = '';
|
|
7079
|
+
if (parts.length > 1) {
|
|
7080
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
7081
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
7082
|
+
result = parts[0] + '@';
|
|
7083
|
+
string = parts[1];
|
|
7084
|
+
}
|
|
7085
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
7086
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
7087
|
+
var labels = string.split('.');
|
|
7088
|
+
var encoded = map(labels, fn).join('.');
|
|
7089
|
+
return result + encoded;
|
|
7090
|
+
}
|
|
7091
|
+
|
|
7092
|
+
/**
|
|
7093
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
7094
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
7095
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
7096
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
7097
|
+
* matching UTF-16.
|
|
7098
|
+
* @see `punycode.ucs2.encode`
|
|
7099
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
7100
|
+
* @memberOf punycode.ucs2
|
|
7101
|
+
* @name decode
|
|
7102
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
7103
|
+
* @returns {Array} The new array of code points.
|
|
7104
|
+
*/
|
|
7105
|
+
function ucs2decode(string) {
|
|
7106
|
+
var output = [],
|
|
7107
|
+
counter = 0,
|
|
7108
|
+
length = string.length,
|
|
7109
|
+
value,
|
|
7110
|
+
extra;
|
|
7111
|
+
while (counter < length) {
|
|
7112
|
+
value = string.charCodeAt(counter++);
|
|
7113
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
7114
|
+
// high surrogate, and there is a next character
|
|
7115
|
+
extra = string.charCodeAt(counter++);
|
|
7116
|
+
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
|
7117
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
7118
|
+
} else {
|
|
7119
|
+
// unmatched surrogate; only append this code unit, in case the next
|
|
7120
|
+
// code unit is the high surrogate of a surrogate pair
|
|
7121
|
+
output.push(value);
|
|
7122
|
+
counter--;
|
|
7123
|
+
}
|
|
7124
|
+
} else {
|
|
7125
|
+
output.push(value);
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
return output;
|
|
7129
|
+
}
|
|
7130
|
+
|
|
7131
|
+
/**
|
|
7132
|
+
* Creates a string based on an array of numeric code points.
|
|
7133
|
+
* @see `punycode.ucs2.decode`
|
|
7134
|
+
* @memberOf punycode.ucs2
|
|
7135
|
+
* @name encode
|
|
7136
|
+
* @param {Array} codePoints The array of numeric code points.
|
|
7137
|
+
* @returns {String} The new Unicode string (UCS-2).
|
|
7138
|
+
*/
|
|
7139
|
+
function ucs2encode(array) {
|
|
7140
|
+
return map(array, function(value) {
|
|
7141
|
+
var output = '';
|
|
7142
|
+
if (value > 0xFFFF) {
|
|
7143
|
+
value -= 0x10000;
|
|
7144
|
+
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
|
7145
|
+
value = 0xDC00 | value & 0x3FF;
|
|
7146
|
+
}
|
|
7147
|
+
output += stringFromCharCode(value);
|
|
7148
|
+
return output;
|
|
7149
|
+
}).join('');
|
|
7150
|
+
}
|
|
7151
|
+
|
|
7152
|
+
/**
|
|
7153
|
+
* Converts a basic code point into a digit/integer.
|
|
7154
|
+
* @see `digitToBasic()`
|
|
7155
|
+
* @private
|
|
7156
|
+
* @param {Number} codePoint The basic numeric code point value.
|
|
7157
|
+
* @returns {Number} The numeric value of a basic code point (for use in
|
|
7158
|
+
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
7159
|
+
* the code point does not represent a value.
|
|
7160
|
+
*/
|
|
7161
|
+
function basicToDigit(codePoint) {
|
|
7162
|
+
if (codePoint - 48 < 10) {
|
|
7163
|
+
return codePoint - 22;
|
|
7164
|
+
}
|
|
7165
|
+
if (codePoint - 65 < 26) {
|
|
7166
|
+
return codePoint - 65;
|
|
7167
|
+
}
|
|
7168
|
+
if (codePoint - 97 < 26) {
|
|
7169
|
+
return codePoint - 97;
|
|
7170
|
+
}
|
|
7171
|
+
return base;
|
|
7172
|
+
}
|
|
7173
|
+
|
|
7174
|
+
/**
|
|
7175
|
+
* Converts a digit/integer into a basic code point.
|
|
7176
|
+
* @see `basicToDigit()`
|
|
7177
|
+
* @private
|
|
7178
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
7179
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
7180
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
7181
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
7182
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
7183
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
7184
|
+
*/
|
|
7185
|
+
function digitToBasic(digit, flag) {
|
|
7186
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
7187
|
+
// 26..35 map to ASCII 0..9
|
|
7188
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
7189
|
+
}
|
|
7190
|
+
|
|
7191
|
+
/**
|
|
7192
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
7193
|
+
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
7194
|
+
* @private
|
|
7195
|
+
*/
|
|
7196
|
+
function adapt(delta, numPoints, firstTime) {
|
|
7197
|
+
var k = 0;
|
|
7198
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
7199
|
+
delta += floor(delta / numPoints);
|
|
7200
|
+
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
7201
|
+
delta = floor(delta / baseMinusTMin);
|
|
7202
|
+
}
|
|
7203
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
7204
|
+
}
|
|
7205
|
+
|
|
7206
|
+
/**
|
|
7207
|
+
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
7208
|
+
* symbols.
|
|
7209
|
+
* @memberOf punycode
|
|
7210
|
+
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
7211
|
+
* @returns {String} The resulting string of Unicode symbols.
|
|
7212
|
+
*/
|
|
7213
|
+
function decode(input) {
|
|
7214
|
+
// Don't use UCS-2
|
|
7215
|
+
var output = [],
|
|
7216
|
+
inputLength = input.length,
|
|
7217
|
+
out,
|
|
7218
|
+
i = 0,
|
|
7219
|
+
n = initialN,
|
|
7220
|
+
bias = initialBias,
|
|
7221
|
+
basic,
|
|
7222
|
+
j,
|
|
7223
|
+
index,
|
|
7224
|
+
oldi,
|
|
7225
|
+
w,
|
|
7226
|
+
k,
|
|
7227
|
+
digit,
|
|
7228
|
+
t,
|
|
7229
|
+
/** Cached calculation results */
|
|
7230
|
+
baseMinusT;
|
|
7231
|
+
|
|
7232
|
+
// Handle the basic code points: let `basic` be the number of input code
|
|
7233
|
+
// points before the last delimiter, or `0` if there is none, then copy
|
|
7234
|
+
// the first basic code points to the output.
|
|
7235
|
+
|
|
7236
|
+
basic = input.lastIndexOf(delimiter);
|
|
7237
|
+
if (basic < 0) {
|
|
7238
|
+
basic = 0;
|
|
7239
|
+
}
|
|
7240
|
+
|
|
7241
|
+
for (j = 0; j < basic; ++j) {
|
|
7242
|
+
// if it's not a basic code point
|
|
7243
|
+
if (input.charCodeAt(j) >= 0x80) {
|
|
7244
|
+
error('not-basic');
|
|
7245
|
+
}
|
|
7246
|
+
output.push(input.charCodeAt(j));
|
|
7247
|
+
}
|
|
7248
|
+
|
|
7249
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
7250
|
+
// points were copied; start at the beginning otherwise.
|
|
7251
|
+
|
|
7252
|
+
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
|
7253
|
+
|
|
7254
|
+
// `index` is the index of the next character to be consumed.
|
|
7255
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
7256
|
+
// which gets added to `i`. The overflow checking is easier
|
|
7257
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
7258
|
+
// value at the end to obtain `delta`.
|
|
7259
|
+
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
|
7260
|
+
|
|
7261
|
+
if (index >= inputLength) {
|
|
7262
|
+
error('invalid-input');
|
|
7263
|
+
}
|
|
7264
|
+
|
|
7265
|
+
digit = basicToDigit(input.charCodeAt(index++));
|
|
7266
|
+
|
|
7267
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
7268
|
+
error('overflow');
|
|
7269
|
+
}
|
|
7270
|
+
|
|
7271
|
+
i += digit * w;
|
|
7272
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
7273
|
+
|
|
7274
|
+
if (digit < t) {
|
|
7275
|
+
break;
|
|
7276
|
+
}
|
|
7277
|
+
|
|
7278
|
+
baseMinusT = base - t;
|
|
7279
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
7280
|
+
error('overflow');
|
|
7281
|
+
}
|
|
7282
|
+
|
|
7283
|
+
w *= baseMinusT;
|
|
7284
|
+
|
|
7285
|
+
}
|
|
7286
|
+
|
|
7287
|
+
out = output.length + 1;
|
|
7288
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
7289
|
+
|
|
7290
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
7291
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
7292
|
+
if (floor(i / out) > maxInt - n) {
|
|
7293
|
+
error('overflow');
|
|
7294
|
+
}
|
|
7295
|
+
|
|
7296
|
+
n += floor(i / out);
|
|
7297
|
+
i %= out;
|
|
7298
|
+
|
|
7299
|
+
// Insert `n` at position `i` of the output
|
|
7300
|
+
output.splice(i++, 0, n);
|
|
7301
|
+
|
|
7302
|
+
}
|
|
7303
|
+
|
|
7304
|
+
return ucs2encode(output);
|
|
7305
|
+
}
|
|
7306
|
+
|
|
7307
|
+
/**
|
|
7308
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
7309
|
+
* Punycode string of ASCII-only symbols.
|
|
7310
|
+
* @memberOf punycode
|
|
7311
|
+
* @param {String} input The string of Unicode symbols.
|
|
7312
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
7313
|
+
*/
|
|
7314
|
+
function encode(input) {
|
|
7315
|
+
var n,
|
|
7316
|
+
delta,
|
|
7317
|
+
handledCPCount,
|
|
7318
|
+
basicLength,
|
|
7319
|
+
bias,
|
|
7320
|
+
j,
|
|
7321
|
+
m,
|
|
7322
|
+
q,
|
|
7323
|
+
k,
|
|
7324
|
+
t,
|
|
7325
|
+
currentValue,
|
|
7326
|
+
output = [],
|
|
7327
|
+
/** `inputLength` will hold the number of code points in `input`. */
|
|
7328
|
+
inputLength,
|
|
7329
|
+
/** Cached calculation results */
|
|
7330
|
+
handledCPCountPlusOne,
|
|
7331
|
+
baseMinusT,
|
|
7332
|
+
qMinusT;
|
|
7333
|
+
|
|
7334
|
+
// Convert the input in UCS-2 to Unicode
|
|
7335
|
+
input = ucs2decode(input);
|
|
7336
|
+
|
|
7337
|
+
// Cache the length
|
|
7338
|
+
inputLength = input.length;
|
|
7339
|
+
|
|
7340
|
+
// Initialize the state
|
|
7341
|
+
n = initialN;
|
|
7342
|
+
delta = 0;
|
|
7343
|
+
bias = initialBias;
|
|
7344
|
+
|
|
7345
|
+
// Handle the basic code points
|
|
7346
|
+
for (j = 0; j < inputLength; ++j) {
|
|
7347
|
+
currentValue = input[j];
|
|
7348
|
+
if (currentValue < 0x80) {
|
|
7349
|
+
output.push(stringFromCharCode(currentValue));
|
|
7350
|
+
}
|
|
7351
|
+
}
|
|
7352
|
+
|
|
7353
|
+
handledCPCount = basicLength = output.length;
|
|
7354
|
+
|
|
7355
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
7356
|
+
// `basicLength` is the number of basic code points.
|
|
7357
|
+
|
|
7358
|
+
// Finish the basic string - if it is not empty - with a delimiter
|
|
7359
|
+
if (basicLength) {
|
|
7360
|
+
output.push(delimiter);
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7363
|
+
// Main encoding loop:
|
|
7364
|
+
while (handledCPCount < inputLength) {
|
|
7365
|
+
|
|
7366
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
7367
|
+
// larger one:
|
|
7368
|
+
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
|
7369
|
+
currentValue = input[j];
|
|
7370
|
+
if (currentValue >= n && currentValue < m) {
|
|
7371
|
+
m = currentValue;
|
|
7372
|
+
}
|
|
7373
|
+
}
|
|
7374
|
+
|
|
7375
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
7376
|
+
// but guard against overflow
|
|
7377
|
+
handledCPCountPlusOne = handledCPCount + 1;
|
|
7378
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
7379
|
+
error('overflow');
|
|
7380
|
+
}
|
|
7381
|
+
|
|
7382
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
7383
|
+
n = m;
|
|
7384
|
+
|
|
7385
|
+
for (j = 0; j < inputLength; ++j) {
|
|
7386
|
+
currentValue = input[j];
|
|
7387
|
+
|
|
7388
|
+
if (currentValue < n && ++delta > maxInt) {
|
|
7389
|
+
error('overflow');
|
|
7390
|
+
}
|
|
7391
|
+
|
|
7392
|
+
if (currentValue == n) {
|
|
7393
|
+
// Represent delta as a generalized variable-length integer
|
|
7394
|
+
for (q = delta, k = base; /* no condition */; k += base) {
|
|
7395
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
7396
|
+
if (q < t) {
|
|
7397
|
+
break;
|
|
7398
|
+
}
|
|
7399
|
+
qMinusT = q - t;
|
|
7400
|
+
baseMinusT = base - t;
|
|
7401
|
+
output.push(
|
|
7402
|
+
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
7403
|
+
);
|
|
7404
|
+
q = floor(qMinusT / baseMinusT);
|
|
7405
|
+
}
|
|
7406
|
+
|
|
7407
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
7408
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
7409
|
+
delta = 0;
|
|
7410
|
+
++handledCPCount;
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
|
|
7414
|
+
++delta;
|
|
7415
|
+
++n;
|
|
7416
|
+
|
|
7417
|
+
}
|
|
7418
|
+
return output.join('');
|
|
7419
|
+
}
|
|
7420
|
+
|
|
7421
|
+
/**
|
|
7422
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
7423
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
7424
|
+
* it doesn't matter if you call it on a string that has already been
|
|
7425
|
+
* converted to Unicode.
|
|
7426
|
+
* @memberOf punycode
|
|
7427
|
+
* @param {String} input The Punycoded domain name or email address to
|
|
7428
|
+
* convert to Unicode.
|
|
7429
|
+
* @returns {String} The Unicode representation of the given Punycode
|
|
7430
|
+
* string.
|
|
7431
|
+
*/
|
|
7432
|
+
function toUnicode(input) {
|
|
7433
|
+
return mapDomain(input, function(string) {
|
|
7434
|
+
return regexPunycode.test(string)
|
|
7435
|
+
? decode(string.slice(4).toLowerCase())
|
|
7436
|
+
: string;
|
|
7437
|
+
});
|
|
7438
|
+
}
|
|
7439
|
+
|
|
7440
|
+
/**
|
|
7441
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
7442
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
7443
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
7444
|
+
* ASCII.
|
|
7445
|
+
* @memberOf punycode
|
|
7446
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
7447
|
+
* Unicode string.
|
|
7448
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
7449
|
+
* email address.
|
|
7450
|
+
*/
|
|
7451
|
+
function toASCII(input) {
|
|
7452
|
+
return mapDomain(input, function(string) {
|
|
7453
|
+
return regexNonASCII.test(string)
|
|
7454
|
+
? 'xn--' + encode(string)
|
|
7455
|
+
: string;
|
|
7456
|
+
});
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7459
|
+
/*--------------------------------------------------------------------------*/
|
|
7460
|
+
|
|
7461
|
+
/** Define the public API */
|
|
7462
|
+
punycode = {
|
|
7463
|
+
/**
|
|
7464
|
+
* A string representing the current Punycode.js version number.
|
|
7465
|
+
* @memberOf punycode
|
|
7466
|
+
* @type String
|
|
7467
|
+
*/
|
|
7468
|
+
'version': '1.4.1',
|
|
7469
|
+
/**
|
|
7470
|
+
* An object of methods to convert from JavaScript's internal character
|
|
7471
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
7472
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
7473
|
+
* @memberOf punycode
|
|
7474
|
+
* @type Object
|
|
7475
|
+
*/
|
|
7476
|
+
'ucs2': {
|
|
7477
|
+
'decode': ucs2decode,
|
|
7478
|
+
'encode': ucs2encode
|
|
7479
|
+
},
|
|
7480
|
+
'decode': decode,
|
|
7481
|
+
'encode': encode,
|
|
7482
|
+
'toASCII': toASCII,
|
|
7483
|
+
'toUnicode': toUnicode
|
|
7484
|
+
};
|
|
7485
|
+
|
|
7486
|
+
/** Expose `punycode` */
|
|
7487
|
+
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
7488
|
+
// like the following:
|
|
7489
|
+
if (
|
|
7490
|
+
true
|
|
7491
|
+
) {
|
|
7492
|
+
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
|
7493
|
+
return punycode;
|
|
7494
|
+
}).call(exports, __webpack_require__, exports, module),
|
|
7495
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
7496
|
+
} else {}
|
|
7497
|
+
|
|
7498
|
+
}(this));
|
|
4591
7499
|
|
|
7500
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/module.js */ "../node_modules/webpack/buildin/module.js")(module), __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js")))
|
|
4592
7501
|
|
|
4593
7502
|
/***/ }),
|
|
4594
7503
|
|
|
@@ -5584,7 +8493,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
5584
8493
|
) {
|
|
5585
8494
|
obj = [];
|
|
5586
8495
|
obj[index] = leaf;
|
|
5587
|
-
} else {
|
|
8496
|
+
} else if (cleanRoot !== '__proto__') {
|
|
5588
8497
|
obj[cleanRoot] = leaf;
|
|
5589
8498
|
}
|
|
5590
8499
|
}
|
|
@@ -5742,6 +8651,7 @@ var arrayPrefixGenerators = {
|
|
|
5742
8651
|
};
|
|
5743
8652
|
|
|
5744
8653
|
var isArray = Array.isArray;
|
|
8654
|
+
var split = String.prototype.split;
|
|
5745
8655
|
var push = Array.prototype.push;
|
|
5746
8656
|
var pushToArray = function (arr, valueOrArray) {
|
|
5747
8657
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
@@ -5778,6 +8688,8 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
|
5778
8688
|
|| typeof v === 'bigint';
|
|
5779
8689
|
};
|
|
5780
8690
|
|
|
8691
|
+
var sentinel = {};
|
|
8692
|
+
|
|
5781
8693
|
var stringify = function stringify(
|
|
5782
8694
|
object,
|
|
5783
8695
|
prefix,
|
|
@@ -5797,8 +8709,23 @@ var stringify = function stringify(
|
|
|
5797
8709
|
) {
|
|
5798
8710
|
var obj = object;
|
|
5799
8711
|
|
|
5800
|
-
|
|
5801
|
-
|
|
8712
|
+
var tmpSc = sideChannel;
|
|
8713
|
+
var step = 0;
|
|
8714
|
+
var findFlag = false;
|
|
8715
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
|
8716
|
+
// Where object last appeared in the ref tree
|
|
8717
|
+
var pos = tmpSc.get(object);
|
|
8718
|
+
step += 1;
|
|
8719
|
+
if (typeof pos !== 'undefined') {
|
|
8720
|
+
if (pos === step) {
|
|
8721
|
+
throw new RangeError('Cyclic object value');
|
|
8722
|
+
} else {
|
|
8723
|
+
findFlag = true; // Break while
|
|
8724
|
+
}
|
|
8725
|
+
}
|
|
8726
|
+
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
8727
|
+
step = 0;
|
|
8728
|
+
}
|
|
5802
8729
|
}
|
|
5803
8730
|
|
|
5804
8731
|
if (typeof filter === 'function') {
|
|
@@ -5825,6 +8752,14 @@ var stringify = function stringify(
|
|
|
5825
8752
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
5826
8753
|
if (encoder) {
|
|
5827
8754
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
8755
|
+
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
|
8756
|
+
var valuesArray = split.call(String(obj), ',');
|
|
8757
|
+
var valuesJoined = '';
|
|
8758
|
+
for (var i = 0; i < valuesArray.length; ++i) {
|
|
8759
|
+
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
8760
|
+
}
|
|
8761
|
+
return [formatter(keyValue) + '=' + valuesJoined];
|
|
8762
|
+
}
|
|
5828
8763
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
5829
8764
|
}
|
|
5830
8765
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
@@ -5839,7 +8774,7 @@ var stringify = function stringify(
|
|
|
5839
8774
|
var objKeys;
|
|
5840
8775
|
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
5841
8776
|
// we need to join elements in
|
|
5842
|
-
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
|
|
8777
|
+
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
5843
8778
|
} else if (isArray(filter)) {
|
|
5844
8779
|
objKeys = filter;
|
|
5845
8780
|
} else {
|
|
@@ -5847,9 +8782,9 @@ var stringify = function stringify(
|
|
|
5847
8782
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
5848
8783
|
}
|
|
5849
8784
|
|
|
5850
|
-
for (var
|
|
5851
|
-
var key = objKeys[
|
|
5852
|
-
var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
|
|
8785
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
8786
|
+
var key = objKeys[j];
|
|
8787
|
+
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
5853
8788
|
|
|
5854
8789
|
if (skipNulls && value === null) {
|
|
5855
8790
|
continue;
|
|
@@ -5859,8 +8794,9 @@ var stringify = function stringify(
|
|
|
5859
8794
|
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
|
|
5860
8795
|
: prefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
5861
8796
|
|
|
5862
|
-
sideChannel.set(object,
|
|
8797
|
+
sideChannel.set(object, step);
|
|
5863
8798
|
var valueSideChannel = getSideChannel();
|
|
8799
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
5864
8800
|
pushToArray(values, stringify(
|
|
5865
8801
|
value,
|
|
5866
8802
|
keyPrefix,
|
|
@@ -5888,7 +8824,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
|
5888
8824
|
return defaults;
|
|
5889
8825
|
}
|
|
5890
8826
|
|
|
5891
|
-
if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
|
|
8827
|
+
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
5892
8828
|
throw new TypeError('Encoder has to be a function.');
|
|
5893
8829
|
}
|
|
5894
8830
|
|
|
@@ -6202,6 +9138,7 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
|
6202
9138
|
|
|
6203
9139
|
i += 1;
|
|
6204
9140
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
9141
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
6205
9142
|
out += hexTable[0xF0 | (c >> 18)]
|
|
6206
9143
|
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
6207
9144
|
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
@@ -6276,6 +9213,215 @@ module.exports = {
|
|
|
6276
9213
|
};
|
|
6277
9214
|
|
|
6278
9215
|
|
|
9216
|
+
/***/ }),
|
|
9217
|
+
|
|
9218
|
+
/***/ "../node_modules/querystring-es3/decode.js":
|
|
9219
|
+
/*!*************************************************!*\
|
|
9220
|
+
!*** ../node_modules/querystring-es3/decode.js ***!
|
|
9221
|
+
\*************************************************/
|
|
9222
|
+
/*! no static exports found */
|
|
9223
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9224
|
+
|
|
9225
|
+
"use strict";
|
|
9226
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
9227
|
+
//
|
|
9228
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9229
|
+
// copy of this software and associated documentation files (the
|
|
9230
|
+
// "Software"), to deal in the Software without restriction, including
|
|
9231
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
9232
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
9233
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9234
|
+
// following conditions:
|
|
9235
|
+
//
|
|
9236
|
+
// The above copyright notice and this permission notice shall be included
|
|
9237
|
+
// in all copies or substantial portions of the Software.
|
|
9238
|
+
//
|
|
9239
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
9240
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
9241
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
9242
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
9243
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
9244
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
9245
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9246
|
+
|
|
9247
|
+
|
|
9248
|
+
|
|
9249
|
+
// If obj.hasOwnProperty has been overridden, then calling
|
|
9250
|
+
// obj.hasOwnProperty(prop) will break.
|
|
9251
|
+
// See: https://github.com/joyent/node/issues/1707
|
|
9252
|
+
function hasOwnProperty(obj, prop) {
|
|
9253
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
9254
|
+
}
|
|
9255
|
+
|
|
9256
|
+
module.exports = function(qs, sep, eq, options) {
|
|
9257
|
+
sep = sep || '&';
|
|
9258
|
+
eq = eq || '=';
|
|
9259
|
+
var obj = {};
|
|
9260
|
+
|
|
9261
|
+
if (typeof qs !== 'string' || qs.length === 0) {
|
|
9262
|
+
return obj;
|
|
9263
|
+
}
|
|
9264
|
+
|
|
9265
|
+
var regexp = /\+/g;
|
|
9266
|
+
qs = qs.split(sep);
|
|
9267
|
+
|
|
9268
|
+
var maxKeys = 1000;
|
|
9269
|
+
if (options && typeof options.maxKeys === 'number') {
|
|
9270
|
+
maxKeys = options.maxKeys;
|
|
9271
|
+
}
|
|
9272
|
+
|
|
9273
|
+
var len = qs.length;
|
|
9274
|
+
// maxKeys <= 0 means that we should not limit keys count
|
|
9275
|
+
if (maxKeys > 0 && len > maxKeys) {
|
|
9276
|
+
len = maxKeys;
|
|
9277
|
+
}
|
|
9278
|
+
|
|
9279
|
+
for (var i = 0; i < len; ++i) {
|
|
9280
|
+
var x = qs[i].replace(regexp, '%20'),
|
|
9281
|
+
idx = x.indexOf(eq),
|
|
9282
|
+
kstr, vstr, k, v;
|
|
9283
|
+
|
|
9284
|
+
if (idx >= 0) {
|
|
9285
|
+
kstr = x.substr(0, idx);
|
|
9286
|
+
vstr = x.substr(idx + 1);
|
|
9287
|
+
} else {
|
|
9288
|
+
kstr = x;
|
|
9289
|
+
vstr = '';
|
|
9290
|
+
}
|
|
9291
|
+
|
|
9292
|
+
k = decodeURIComponent(kstr);
|
|
9293
|
+
v = decodeURIComponent(vstr);
|
|
9294
|
+
|
|
9295
|
+
if (!hasOwnProperty(obj, k)) {
|
|
9296
|
+
obj[k] = v;
|
|
9297
|
+
} else if (isArray(obj[k])) {
|
|
9298
|
+
obj[k].push(v);
|
|
9299
|
+
} else {
|
|
9300
|
+
obj[k] = [obj[k], v];
|
|
9301
|
+
}
|
|
9302
|
+
}
|
|
9303
|
+
|
|
9304
|
+
return obj;
|
|
9305
|
+
};
|
|
9306
|
+
|
|
9307
|
+
var isArray = Array.isArray || function (xs) {
|
|
9308
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
9309
|
+
};
|
|
9310
|
+
|
|
9311
|
+
|
|
9312
|
+
/***/ }),
|
|
9313
|
+
|
|
9314
|
+
/***/ "../node_modules/querystring-es3/encode.js":
|
|
9315
|
+
/*!*************************************************!*\
|
|
9316
|
+
!*** ../node_modules/querystring-es3/encode.js ***!
|
|
9317
|
+
\*************************************************/
|
|
9318
|
+
/*! no static exports found */
|
|
9319
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9320
|
+
|
|
9321
|
+
"use strict";
|
|
9322
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
9323
|
+
//
|
|
9324
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9325
|
+
// copy of this software and associated documentation files (the
|
|
9326
|
+
// "Software"), to deal in the Software without restriction, including
|
|
9327
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
9328
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
9329
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9330
|
+
// following conditions:
|
|
9331
|
+
//
|
|
9332
|
+
// The above copyright notice and this permission notice shall be included
|
|
9333
|
+
// in all copies or substantial portions of the Software.
|
|
9334
|
+
//
|
|
9335
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
9336
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
9337
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
9338
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
9339
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
9340
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
9341
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9342
|
+
|
|
9343
|
+
|
|
9344
|
+
|
|
9345
|
+
var stringifyPrimitive = function(v) {
|
|
9346
|
+
switch (typeof v) {
|
|
9347
|
+
case 'string':
|
|
9348
|
+
return v;
|
|
9349
|
+
|
|
9350
|
+
case 'boolean':
|
|
9351
|
+
return v ? 'true' : 'false';
|
|
9352
|
+
|
|
9353
|
+
case 'number':
|
|
9354
|
+
return isFinite(v) ? v : '';
|
|
9355
|
+
|
|
9356
|
+
default:
|
|
9357
|
+
return '';
|
|
9358
|
+
}
|
|
9359
|
+
};
|
|
9360
|
+
|
|
9361
|
+
module.exports = function(obj, sep, eq, name) {
|
|
9362
|
+
sep = sep || '&';
|
|
9363
|
+
eq = eq || '=';
|
|
9364
|
+
if (obj === null) {
|
|
9365
|
+
obj = undefined;
|
|
9366
|
+
}
|
|
9367
|
+
|
|
9368
|
+
if (typeof obj === 'object') {
|
|
9369
|
+
return map(objectKeys(obj), function(k) {
|
|
9370
|
+
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
|
9371
|
+
if (isArray(obj[k])) {
|
|
9372
|
+
return map(obj[k], function(v) {
|
|
9373
|
+
return ks + encodeURIComponent(stringifyPrimitive(v));
|
|
9374
|
+
}).join(sep);
|
|
9375
|
+
} else {
|
|
9376
|
+
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
|
9377
|
+
}
|
|
9378
|
+
}).join(sep);
|
|
9379
|
+
|
|
9380
|
+
}
|
|
9381
|
+
|
|
9382
|
+
if (!name) return '';
|
|
9383
|
+
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
|
9384
|
+
encodeURIComponent(stringifyPrimitive(obj));
|
|
9385
|
+
};
|
|
9386
|
+
|
|
9387
|
+
var isArray = Array.isArray || function (xs) {
|
|
9388
|
+
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
9389
|
+
};
|
|
9390
|
+
|
|
9391
|
+
function map (xs, f) {
|
|
9392
|
+
if (xs.map) return xs.map(f);
|
|
9393
|
+
var res = [];
|
|
9394
|
+
for (var i = 0; i < xs.length; i++) {
|
|
9395
|
+
res.push(f(xs[i], i));
|
|
9396
|
+
}
|
|
9397
|
+
return res;
|
|
9398
|
+
}
|
|
9399
|
+
|
|
9400
|
+
var objectKeys = Object.keys || function (obj) {
|
|
9401
|
+
var res = [];
|
|
9402
|
+
for (var key in obj) {
|
|
9403
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
|
9404
|
+
}
|
|
9405
|
+
return res;
|
|
9406
|
+
};
|
|
9407
|
+
|
|
9408
|
+
|
|
9409
|
+
/***/ }),
|
|
9410
|
+
|
|
9411
|
+
/***/ "../node_modules/querystring-es3/index.js":
|
|
9412
|
+
/*!************************************************!*\
|
|
9413
|
+
!*** ../node_modules/querystring-es3/index.js ***!
|
|
9414
|
+
\************************************************/
|
|
9415
|
+
/*! no static exports found */
|
|
9416
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9417
|
+
|
|
9418
|
+
"use strict";
|
|
9419
|
+
|
|
9420
|
+
|
|
9421
|
+
exports.decode = exports.parse = __webpack_require__(/*! ./decode */ "../node_modules/querystring-es3/decode.js");
|
|
9422
|
+
exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ "../node_modules/querystring-es3/encode.js");
|
|
9423
|
+
|
|
9424
|
+
|
|
6279
9425
|
/***/ }),
|
|
6280
9426
|
|
|
6281
9427
|
/***/ "../node_modules/side-channel/index.js":
|
|
@@ -6412,6 +9558,778 @@ module.exports = function getSideChannel() {
|
|
|
6412
9558
|
};
|
|
6413
9559
|
|
|
6414
9560
|
|
|
9561
|
+
/***/ }),
|
|
9562
|
+
|
|
9563
|
+
/***/ "../node_modules/url/url.js":
|
|
9564
|
+
/*!**********************************!*\
|
|
9565
|
+
!*** ../node_modules/url/url.js ***!
|
|
9566
|
+
\**********************************/
|
|
9567
|
+
/*! no static exports found */
|
|
9568
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
9569
|
+
|
|
9570
|
+
"use strict";
|
|
9571
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
9572
|
+
//
|
|
9573
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9574
|
+
// copy of this software and associated documentation files (the
|
|
9575
|
+
// "Software"), to deal in the Software without restriction, including
|
|
9576
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
9577
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
9578
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9579
|
+
// following conditions:
|
|
9580
|
+
//
|
|
9581
|
+
// The above copyright notice and this permission notice shall be included
|
|
9582
|
+
// in all copies or substantial portions of the Software.
|
|
9583
|
+
//
|
|
9584
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
9585
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
9586
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
9587
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
9588
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
9589
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
9590
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9591
|
+
|
|
9592
|
+
|
|
9593
|
+
|
|
9594
|
+
var punycode = __webpack_require__(/*! punycode */ "../node_modules/node-libs-browser/node_modules/punycode/punycode.js");
|
|
9595
|
+
var util = __webpack_require__(/*! ./util */ "../node_modules/url/util.js");
|
|
9596
|
+
|
|
9597
|
+
exports.parse = urlParse;
|
|
9598
|
+
exports.resolve = urlResolve;
|
|
9599
|
+
exports.resolveObject = urlResolveObject;
|
|
9600
|
+
exports.format = urlFormat;
|
|
9601
|
+
|
|
9602
|
+
exports.Url = Url;
|
|
9603
|
+
|
|
9604
|
+
function Url() {
|
|
9605
|
+
this.protocol = null;
|
|
9606
|
+
this.slashes = null;
|
|
9607
|
+
this.auth = null;
|
|
9608
|
+
this.host = null;
|
|
9609
|
+
this.port = null;
|
|
9610
|
+
this.hostname = null;
|
|
9611
|
+
this.hash = null;
|
|
9612
|
+
this.search = null;
|
|
9613
|
+
this.query = null;
|
|
9614
|
+
this.pathname = null;
|
|
9615
|
+
this.path = null;
|
|
9616
|
+
this.href = null;
|
|
9617
|
+
}
|
|
9618
|
+
|
|
9619
|
+
// Reference: RFC 3986, RFC 1808, RFC 2396
|
|
9620
|
+
|
|
9621
|
+
// define these here so at least they only have to be
|
|
9622
|
+
// compiled once on the first module load.
|
|
9623
|
+
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
|
9624
|
+
portPattern = /:[0-9]*$/,
|
|
9625
|
+
|
|
9626
|
+
// Special case for a simple path URL
|
|
9627
|
+
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
|
9628
|
+
|
|
9629
|
+
// RFC 2396: characters reserved for delimiting URLs.
|
|
9630
|
+
// We actually just auto-escape these.
|
|
9631
|
+
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
|
9632
|
+
|
|
9633
|
+
// RFC 2396: characters not allowed for various reasons.
|
|
9634
|
+
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
|
9635
|
+
|
|
9636
|
+
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
|
9637
|
+
autoEscape = ['\''].concat(unwise),
|
|
9638
|
+
// Characters that are never ever allowed in a hostname.
|
|
9639
|
+
// Note that any invalid chars are also handled, but these
|
|
9640
|
+
// are the ones that are *expected* to be seen, so we fast-path
|
|
9641
|
+
// them.
|
|
9642
|
+
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
|
9643
|
+
hostEndingChars = ['/', '?', '#'],
|
|
9644
|
+
hostnameMaxLen = 255,
|
|
9645
|
+
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
|
9646
|
+
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
|
9647
|
+
// protocols that can allow "unsafe" and "unwise" chars.
|
|
9648
|
+
unsafeProtocol = {
|
|
9649
|
+
'javascript': true,
|
|
9650
|
+
'javascript:': true
|
|
9651
|
+
},
|
|
9652
|
+
// protocols that never have a hostname.
|
|
9653
|
+
hostlessProtocol = {
|
|
9654
|
+
'javascript': true,
|
|
9655
|
+
'javascript:': true
|
|
9656
|
+
},
|
|
9657
|
+
// protocols that always contain a // bit.
|
|
9658
|
+
slashedProtocol = {
|
|
9659
|
+
'http': true,
|
|
9660
|
+
'https': true,
|
|
9661
|
+
'ftp': true,
|
|
9662
|
+
'gopher': true,
|
|
9663
|
+
'file': true,
|
|
9664
|
+
'http:': true,
|
|
9665
|
+
'https:': true,
|
|
9666
|
+
'ftp:': true,
|
|
9667
|
+
'gopher:': true,
|
|
9668
|
+
'file:': true
|
|
9669
|
+
},
|
|
9670
|
+
querystring = __webpack_require__(/*! querystring */ "../node_modules/querystring-es3/index.js");
|
|
9671
|
+
|
|
9672
|
+
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
|
9673
|
+
if (url && util.isObject(url) && url instanceof Url) return url;
|
|
9674
|
+
|
|
9675
|
+
var u = new Url;
|
|
9676
|
+
u.parse(url, parseQueryString, slashesDenoteHost);
|
|
9677
|
+
return u;
|
|
9678
|
+
}
|
|
9679
|
+
|
|
9680
|
+
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
|
9681
|
+
if (!util.isString(url)) {
|
|
9682
|
+
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
|
9683
|
+
}
|
|
9684
|
+
|
|
9685
|
+
// Copy chrome, IE, opera backslash-handling behavior.
|
|
9686
|
+
// Back slashes before the query string get converted to forward slashes
|
|
9687
|
+
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
|
9688
|
+
var queryIndex = url.indexOf('?'),
|
|
9689
|
+
splitter =
|
|
9690
|
+
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
|
9691
|
+
uSplit = url.split(splitter),
|
|
9692
|
+
slashRegex = /\\/g;
|
|
9693
|
+
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
|
9694
|
+
url = uSplit.join(splitter);
|
|
9695
|
+
|
|
9696
|
+
var rest = url;
|
|
9697
|
+
|
|
9698
|
+
// trim before proceeding.
|
|
9699
|
+
// This is to support parse stuff like " http://foo.com \n"
|
|
9700
|
+
rest = rest.trim();
|
|
9701
|
+
|
|
9702
|
+
if (!slashesDenoteHost && url.split('#').length === 1) {
|
|
9703
|
+
// Try fast path regexp
|
|
9704
|
+
var simplePath = simplePathPattern.exec(rest);
|
|
9705
|
+
if (simplePath) {
|
|
9706
|
+
this.path = rest;
|
|
9707
|
+
this.href = rest;
|
|
9708
|
+
this.pathname = simplePath[1];
|
|
9709
|
+
if (simplePath[2]) {
|
|
9710
|
+
this.search = simplePath[2];
|
|
9711
|
+
if (parseQueryString) {
|
|
9712
|
+
this.query = querystring.parse(this.search.substr(1));
|
|
9713
|
+
} else {
|
|
9714
|
+
this.query = this.search.substr(1);
|
|
9715
|
+
}
|
|
9716
|
+
} else if (parseQueryString) {
|
|
9717
|
+
this.search = '';
|
|
9718
|
+
this.query = {};
|
|
9719
|
+
}
|
|
9720
|
+
return this;
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9723
|
+
|
|
9724
|
+
var proto = protocolPattern.exec(rest);
|
|
9725
|
+
if (proto) {
|
|
9726
|
+
proto = proto[0];
|
|
9727
|
+
var lowerProto = proto.toLowerCase();
|
|
9728
|
+
this.protocol = lowerProto;
|
|
9729
|
+
rest = rest.substr(proto.length);
|
|
9730
|
+
}
|
|
9731
|
+
|
|
9732
|
+
// figure out if it's got a host
|
|
9733
|
+
// user@server is *always* interpreted as a hostname, and url
|
|
9734
|
+
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
|
9735
|
+
// how the browser resolves relative URLs.
|
|
9736
|
+
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
|
9737
|
+
var slashes = rest.substr(0, 2) === '//';
|
|
9738
|
+
if (slashes && !(proto && hostlessProtocol[proto])) {
|
|
9739
|
+
rest = rest.substr(2);
|
|
9740
|
+
this.slashes = true;
|
|
9741
|
+
}
|
|
9742
|
+
}
|
|
9743
|
+
|
|
9744
|
+
if (!hostlessProtocol[proto] &&
|
|
9745
|
+
(slashes || (proto && !slashedProtocol[proto]))) {
|
|
9746
|
+
|
|
9747
|
+
// there's a hostname.
|
|
9748
|
+
// the first instance of /, ?, ;, or # ends the host.
|
|
9749
|
+
//
|
|
9750
|
+
// If there is an @ in the hostname, then non-host chars *are* allowed
|
|
9751
|
+
// to the left of the last @ sign, unless some host-ending character
|
|
9752
|
+
// comes *before* the @-sign.
|
|
9753
|
+
// URLs are obnoxious.
|
|
9754
|
+
//
|
|
9755
|
+
// ex:
|
|
9756
|
+
// http://a@b@c/ => user:a@b host:c
|
|
9757
|
+
// http://a@b?@c => user:a host:c path:/?@c
|
|
9758
|
+
|
|
9759
|
+
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
|
9760
|
+
// Review our test case against browsers more comprehensively.
|
|
9761
|
+
|
|
9762
|
+
// find the first instance of any hostEndingChars
|
|
9763
|
+
var hostEnd = -1;
|
|
9764
|
+
for (var i = 0; i < hostEndingChars.length; i++) {
|
|
9765
|
+
var hec = rest.indexOf(hostEndingChars[i]);
|
|
9766
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
9767
|
+
hostEnd = hec;
|
|
9768
|
+
}
|
|
9769
|
+
|
|
9770
|
+
// at this point, either we have an explicit point where the
|
|
9771
|
+
// auth portion cannot go past, or the last @ char is the decider.
|
|
9772
|
+
var auth, atSign;
|
|
9773
|
+
if (hostEnd === -1) {
|
|
9774
|
+
// atSign can be anywhere.
|
|
9775
|
+
atSign = rest.lastIndexOf('@');
|
|
9776
|
+
} else {
|
|
9777
|
+
// atSign must be in auth portion.
|
|
9778
|
+
// http://a@b/c@d => host:b auth:a path:/c@d
|
|
9779
|
+
atSign = rest.lastIndexOf('@', hostEnd);
|
|
9780
|
+
}
|
|
9781
|
+
|
|
9782
|
+
// Now we have a portion which is definitely the auth.
|
|
9783
|
+
// Pull that off.
|
|
9784
|
+
if (atSign !== -1) {
|
|
9785
|
+
auth = rest.slice(0, atSign);
|
|
9786
|
+
rest = rest.slice(atSign + 1);
|
|
9787
|
+
this.auth = decodeURIComponent(auth);
|
|
9788
|
+
}
|
|
9789
|
+
|
|
9790
|
+
// the host is the remaining to the left of the first non-host char
|
|
9791
|
+
hostEnd = -1;
|
|
9792
|
+
for (var i = 0; i < nonHostChars.length; i++) {
|
|
9793
|
+
var hec = rest.indexOf(nonHostChars[i]);
|
|
9794
|
+
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
|
9795
|
+
hostEnd = hec;
|
|
9796
|
+
}
|
|
9797
|
+
// if we still have not hit it, then the entire thing is a host.
|
|
9798
|
+
if (hostEnd === -1)
|
|
9799
|
+
hostEnd = rest.length;
|
|
9800
|
+
|
|
9801
|
+
this.host = rest.slice(0, hostEnd);
|
|
9802
|
+
rest = rest.slice(hostEnd);
|
|
9803
|
+
|
|
9804
|
+
// pull out port.
|
|
9805
|
+
this.parseHost();
|
|
9806
|
+
|
|
9807
|
+
// we've indicated that there is a hostname,
|
|
9808
|
+
// so even if it's empty, it has to be present.
|
|
9809
|
+
this.hostname = this.hostname || '';
|
|
9810
|
+
|
|
9811
|
+
// if hostname begins with [ and ends with ]
|
|
9812
|
+
// assume that it's an IPv6 address.
|
|
9813
|
+
var ipv6Hostname = this.hostname[0] === '[' &&
|
|
9814
|
+
this.hostname[this.hostname.length - 1] === ']';
|
|
9815
|
+
|
|
9816
|
+
// validate a little.
|
|
9817
|
+
if (!ipv6Hostname) {
|
|
9818
|
+
var hostparts = this.hostname.split(/\./);
|
|
9819
|
+
for (var i = 0, l = hostparts.length; i < l; i++) {
|
|
9820
|
+
var part = hostparts[i];
|
|
9821
|
+
if (!part) continue;
|
|
9822
|
+
if (!part.match(hostnamePartPattern)) {
|
|
9823
|
+
var newpart = '';
|
|
9824
|
+
for (var j = 0, k = part.length; j < k; j++) {
|
|
9825
|
+
if (part.charCodeAt(j) > 127) {
|
|
9826
|
+
// we replace non-ASCII char with a temporary placeholder
|
|
9827
|
+
// we need this to make sure size of hostname is not
|
|
9828
|
+
// broken by replacing non-ASCII by nothing
|
|
9829
|
+
newpart += 'x';
|
|
9830
|
+
} else {
|
|
9831
|
+
newpart += part[j];
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9834
|
+
// we test again with ASCII char only
|
|
9835
|
+
if (!newpart.match(hostnamePartPattern)) {
|
|
9836
|
+
var validParts = hostparts.slice(0, i);
|
|
9837
|
+
var notHost = hostparts.slice(i + 1);
|
|
9838
|
+
var bit = part.match(hostnamePartStart);
|
|
9839
|
+
if (bit) {
|
|
9840
|
+
validParts.push(bit[1]);
|
|
9841
|
+
notHost.unshift(bit[2]);
|
|
9842
|
+
}
|
|
9843
|
+
if (notHost.length) {
|
|
9844
|
+
rest = '/' + notHost.join('.') + rest;
|
|
9845
|
+
}
|
|
9846
|
+
this.hostname = validParts.join('.');
|
|
9847
|
+
break;
|
|
9848
|
+
}
|
|
9849
|
+
}
|
|
9850
|
+
}
|
|
9851
|
+
}
|
|
9852
|
+
|
|
9853
|
+
if (this.hostname.length > hostnameMaxLen) {
|
|
9854
|
+
this.hostname = '';
|
|
9855
|
+
} else {
|
|
9856
|
+
// hostnames are always lower case.
|
|
9857
|
+
this.hostname = this.hostname.toLowerCase();
|
|
9858
|
+
}
|
|
9859
|
+
|
|
9860
|
+
if (!ipv6Hostname) {
|
|
9861
|
+
// IDNA Support: Returns a punycoded representation of "domain".
|
|
9862
|
+
// It only converts parts of the domain name that
|
|
9863
|
+
// have non-ASCII characters, i.e. it doesn't matter if
|
|
9864
|
+
// you call it with a domain that already is ASCII-only.
|
|
9865
|
+
this.hostname = punycode.toASCII(this.hostname);
|
|
9866
|
+
}
|
|
9867
|
+
|
|
9868
|
+
var p = this.port ? ':' + this.port : '';
|
|
9869
|
+
var h = this.hostname || '';
|
|
9870
|
+
this.host = h + p;
|
|
9871
|
+
this.href += this.host;
|
|
9872
|
+
|
|
9873
|
+
// strip [ and ] from the hostname
|
|
9874
|
+
// the host field still retains them, though
|
|
9875
|
+
if (ipv6Hostname) {
|
|
9876
|
+
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
|
9877
|
+
if (rest[0] !== '/') {
|
|
9878
|
+
rest = '/' + rest;
|
|
9879
|
+
}
|
|
9880
|
+
}
|
|
9881
|
+
}
|
|
9882
|
+
|
|
9883
|
+
// now rest is set to the post-host stuff.
|
|
9884
|
+
// chop off any delim chars.
|
|
9885
|
+
if (!unsafeProtocol[lowerProto]) {
|
|
9886
|
+
|
|
9887
|
+
// First, make 100% sure that any "autoEscape" chars get
|
|
9888
|
+
// escaped, even if encodeURIComponent doesn't think they
|
|
9889
|
+
// need to be.
|
|
9890
|
+
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
|
9891
|
+
var ae = autoEscape[i];
|
|
9892
|
+
if (rest.indexOf(ae) === -1)
|
|
9893
|
+
continue;
|
|
9894
|
+
var esc = encodeURIComponent(ae);
|
|
9895
|
+
if (esc === ae) {
|
|
9896
|
+
esc = escape(ae);
|
|
9897
|
+
}
|
|
9898
|
+
rest = rest.split(ae).join(esc);
|
|
9899
|
+
}
|
|
9900
|
+
}
|
|
9901
|
+
|
|
9902
|
+
|
|
9903
|
+
// chop off from the tail first.
|
|
9904
|
+
var hash = rest.indexOf('#');
|
|
9905
|
+
if (hash !== -1) {
|
|
9906
|
+
// got a fragment string.
|
|
9907
|
+
this.hash = rest.substr(hash);
|
|
9908
|
+
rest = rest.slice(0, hash);
|
|
9909
|
+
}
|
|
9910
|
+
var qm = rest.indexOf('?');
|
|
9911
|
+
if (qm !== -1) {
|
|
9912
|
+
this.search = rest.substr(qm);
|
|
9913
|
+
this.query = rest.substr(qm + 1);
|
|
9914
|
+
if (parseQueryString) {
|
|
9915
|
+
this.query = querystring.parse(this.query);
|
|
9916
|
+
}
|
|
9917
|
+
rest = rest.slice(0, qm);
|
|
9918
|
+
} else if (parseQueryString) {
|
|
9919
|
+
// no query string, but parseQueryString still requested
|
|
9920
|
+
this.search = '';
|
|
9921
|
+
this.query = {};
|
|
9922
|
+
}
|
|
9923
|
+
if (rest) this.pathname = rest;
|
|
9924
|
+
if (slashedProtocol[lowerProto] &&
|
|
9925
|
+
this.hostname && !this.pathname) {
|
|
9926
|
+
this.pathname = '/';
|
|
9927
|
+
}
|
|
9928
|
+
|
|
9929
|
+
//to support http.request
|
|
9930
|
+
if (this.pathname || this.search) {
|
|
9931
|
+
var p = this.pathname || '';
|
|
9932
|
+
var s = this.search || '';
|
|
9933
|
+
this.path = p + s;
|
|
9934
|
+
}
|
|
9935
|
+
|
|
9936
|
+
// finally, reconstruct the href based on what has been validated.
|
|
9937
|
+
this.href = this.format();
|
|
9938
|
+
return this;
|
|
9939
|
+
};
|
|
9940
|
+
|
|
9941
|
+
// format a parsed object into a url string
|
|
9942
|
+
function urlFormat(obj) {
|
|
9943
|
+
// ensure it's an object, and not a string url.
|
|
9944
|
+
// If it's an obj, this is a no-op.
|
|
9945
|
+
// this way, you can call url_format() on strings
|
|
9946
|
+
// to clean up potentially wonky urls.
|
|
9947
|
+
if (util.isString(obj)) obj = urlParse(obj);
|
|
9948
|
+
if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
|
9949
|
+
return obj.format();
|
|
9950
|
+
}
|
|
9951
|
+
|
|
9952
|
+
Url.prototype.format = function() {
|
|
9953
|
+
var auth = this.auth || '';
|
|
9954
|
+
if (auth) {
|
|
9955
|
+
auth = encodeURIComponent(auth);
|
|
9956
|
+
auth = auth.replace(/%3A/i, ':');
|
|
9957
|
+
auth += '@';
|
|
9958
|
+
}
|
|
9959
|
+
|
|
9960
|
+
var protocol = this.protocol || '',
|
|
9961
|
+
pathname = this.pathname || '',
|
|
9962
|
+
hash = this.hash || '',
|
|
9963
|
+
host = false,
|
|
9964
|
+
query = '';
|
|
9965
|
+
|
|
9966
|
+
if (this.host) {
|
|
9967
|
+
host = auth + this.host;
|
|
9968
|
+
} else if (this.hostname) {
|
|
9969
|
+
host = auth + (this.hostname.indexOf(':') === -1 ?
|
|
9970
|
+
this.hostname :
|
|
9971
|
+
'[' + this.hostname + ']');
|
|
9972
|
+
if (this.port) {
|
|
9973
|
+
host += ':' + this.port;
|
|
9974
|
+
}
|
|
9975
|
+
}
|
|
9976
|
+
|
|
9977
|
+
if (this.query &&
|
|
9978
|
+
util.isObject(this.query) &&
|
|
9979
|
+
Object.keys(this.query).length) {
|
|
9980
|
+
query = querystring.stringify(this.query);
|
|
9981
|
+
}
|
|
9982
|
+
|
|
9983
|
+
var search = this.search || (query && ('?' + query)) || '';
|
|
9984
|
+
|
|
9985
|
+
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
|
9986
|
+
|
|
9987
|
+
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
|
9988
|
+
// unless they had them to begin with.
|
|
9989
|
+
if (this.slashes ||
|
|
9990
|
+
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
|
9991
|
+
host = '//' + (host || '');
|
|
9992
|
+
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
|
9993
|
+
} else if (!host) {
|
|
9994
|
+
host = '';
|
|
9995
|
+
}
|
|
9996
|
+
|
|
9997
|
+
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
|
9998
|
+
if (search && search.charAt(0) !== '?') search = '?' + search;
|
|
9999
|
+
|
|
10000
|
+
pathname = pathname.replace(/[?#]/g, function(match) {
|
|
10001
|
+
return encodeURIComponent(match);
|
|
10002
|
+
});
|
|
10003
|
+
search = search.replace('#', '%23');
|
|
10004
|
+
|
|
10005
|
+
return protocol + host + pathname + search + hash;
|
|
10006
|
+
};
|
|
10007
|
+
|
|
10008
|
+
function urlResolve(source, relative) {
|
|
10009
|
+
return urlParse(source, false, true).resolve(relative);
|
|
10010
|
+
}
|
|
10011
|
+
|
|
10012
|
+
Url.prototype.resolve = function(relative) {
|
|
10013
|
+
return this.resolveObject(urlParse(relative, false, true)).format();
|
|
10014
|
+
};
|
|
10015
|
+
|
|
10016
|
+
function urlResolveObject(source, relative) {
|
|
10017
|
+
if (!source) return relative;
|
|
10018
|
+
return urlParse(source, false, true).resolveObject(relative);
|
|
10019
|
+
}
|
|
10020
|
+
|
|
10021
|
+
Url.prototype.resolveObject = function(relative) {
|
|
10022
|
+
if (util.isString(relative)) {
|
|
10023
|
+
var rel = new Url();
|
|
10024
|
+
rel.parse(relative, false, true);
|
|
10025
|
+
relative = rel;
|
|
10026
|
+
}
|
|
10027
|
+
|
|
10028
|
+
var result = new Url();
|
|
10029
|
+
var tkeys = Object.keys(this);
|
|
10030
|
+
for (var tk = 0; tk < tkeys.length; tk++) {
|
|
10031
|
+
var tkey = tkeys[tk];
|
|
10032
|
+
result[tkey] = this[tkey];
|
|
10033
|
+
}
|
|
10034
|
+
|
|
10035
|
+
// hash is always overridden, no matter what.
|
|
10036
|
+
// even href="" will remove it.
|
|
10037
|
+
result.hash = relative.hash;
|
|
10038
|
+
|
|
10039
|
+
// if the relative url is empty, then there's nothing left to do here.
|
|
10040
|
+
if (relative.href === '') {
|
|
10041
|
+
result.href = result.format();
|
|
10042
|
+
return result;
|
|
10043
|
+
}
|
|
10044
|
+
|
|
10045
|
+
// hrefs like //foo/bar always cut to the protocol.
|
|
10046
|
+
if (relative.slashes && !relative.protocol) {
|
|
10047
|
+
// take everything except the protocol from relative
|
|
10048
|
+
var rkeys = Object.keys(relative);
|
|
10049
|
+
for (var rk = 0; rk < rkeys.length; rk++) {
|
|
10050
|
+
var rkey = rkeys[rk];
|
|
10051
|
+
if (rkey !== 'protocol')
|
|
10052
|
+
result[rkey] = relative[rkey];
|
|
10053
|
+
}
|
|
10054
|
+
|
|
10055
|
+
//urlParse appends trailing / to urls like http://www.example.com
|
|
10056
|
+
if (slashedProtocol[result.protocol] &&
|
|
10057
|
+
result.hostname && !result.pathname) {
|
|
10058
|
+
result.path = result.pathname = '/';
|
|
10059
|
+
}
|
|
10060
|
+
|
|
10061
|
+
result.href = result.format();
|
|
10062
|
+
return result;
|
|
10063
|
+
}
|
|
10064
|
+
|
|
10065
|
+
if (relative.protocol && relative.protocol !== result.protocol) {
|
|
10066
|
+
// if it's a known url protocol, then changing
|
|
10067
|
+
// the protocol does weird things
|
|
10068
|
+
// first, if it's not file:, then we MUST have a host,
|
|
10069
|
+
// and if there was a path
|
|
10070
|
+
// to begin with, then we MUST have a path.
|
|
10071
|
+
// if it is file:, then the host is dropped,
|
|
10072
|
+
// because that's known to be hostless.
|
|
10073
|
+
// anything else is assumed to be absolute.
|
|
10074
|
+
if (!slashedProtocol[relative.protocol]) {
|
|
10075
|
+
var keys = Object.keys(relative);
|
|
10076
|
+
for (var v = 0; v < keys.length; v++) {
|
|
10077
|
+
var k = keys[v];
|
|
10078
|
+
result[k] = relative[k];
|
|
10079
|
+
}
|
|
10080
|
+
result.href = result.format();
|
|
10081
|
+
return result;
|
|
10082
|
+
}
|
|
10083
|
+
|
|
10084
|
+
result.protocol = relative.protocol;
|
|
10085
|
+
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
|
10086
|
+
var relPath = (relative.pathname || '').split('/');
|
|
10087
|
+
while (relPath.length && !(relative.host = relPath.shift()));
|
|
10088
|
+
if (!relative.host) relative.host = '';
|
|
10089
|
+
if (!relative.hostname) relative.hostname = '';
|
|
10090
|
+
if (relPath[0] !== '') relPath.unshift('');
|
|
10091
|
+
if (relPath.length < 2) relPath.unshift('');
|
|
10092
|
+
result.pathname = relPath.join('/');
|
|
10093
|
+
} else {
|
|
10094
|
+
result.pathname = relative.pathname;
|
|
10095
|
+
}
|
|
10096
|
+
result.search = relative.search;
|
|
10097
|
+
result.query = relative.query;
|
|
10098
|
+
result.host = relative.host || '';
|
|
10099
|
+
result.auth = relative.auth;
|
|
10100
|
+
result.hostname = relative.hostname || relative.host;
|
|
10101
|
+
result.port = relative.port;
|
|
10102
|
+
// to support http.request
|
|
10103
|
+
if (result.pathname || result.search) {
|
|
10104
|
+
var p = result.pathname || '';
|
|
10105
|
+
var s = result.search || '';
|
|
10106
|
+
result.path = p + s;
|
|
10107
|
+
}
|
|
10108
|
+
result.slashes = result.slashes || relative.slashes;
|
|
10109
|
+
result.href = result.format();
|
|
10110
|
+
return result;
|
|
10111
|
+
}
|
|
10112
|
+
|
|
10113
|
+
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
|
10114
|
+
isRelAbs = (
|
|
10115
|
+
relative.host ||
|
|
10116
|
+
relative.pathname && relative.pathname.charAt(0) === '/'
|
|
10117
|
+
),
|
|
10118
|
+
mustEndAbs = (isRelAbs || isSourceAbs ||
|
|
10119
|
+
(result.host && relative.pathname)),
|
|
10120
|
+
removeAllDots = mustEndAbs,
|
|
10121
|
+
srcPath = result.pathname && result.pathname.split('/') || [],
|
|
10122
|
+
relPath = relative.pathname && relative.pathname.split('/') || [],
|
|
10123
|
+
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
|
10124
|
+
|
|
10125
|
+
// if the url is a non-slashed url, then relative
|
|
10126
|
+
// links like ../.. should be able
|
|
10127
|
+
// to crawl up to the hostname, as well. This is strange.
|
|
10128
|
+
// result.protocol has already been set by now.
|
|
10129
|
+
// Later on, put the first path part into the host field.
|
|
10130
|
+
if (psychotic) {
|
|
10131
|
+
result.hostname = '';
|
|
10132
|
+
result.port = null;
|
|
10133
|
+
if (result.host) {
|
|
10134
|
+
if (srcPath[0] === '') srcPath[0] = result.host;
|
|
10135
|
+
else srcPath.unshift(result.host);
|
|
10136
|
+
}
|
|
10137
|
+
result.host = '';
|
|
10138
|
+
if (relative.protocol) {
|
|
10139
|
+
relative.hostname = null;
|
|
10140
|
+
relative.port = null;
|
|
10141
|
+
if (relative.host) {
|
|
10142
|
+
if (relPath[0] === '') relPath[0] = relative.host;
|
|
10143
|
+
else relPath.unshift(relative.host);
|
|
10144
|
+
}
|
|
10145
|
+
relative.host = null;
|
|
10146
|
+
}
|
|
10147
|
+
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
|
10148
|
+
}
|
|
10149
|
+
|
|
10150
|
+
if (isRelAbs) {
|
|
10151
|
+
// it's absolute.
|
|
10152
|
+
result.host = (relative.host || relative.host === '') ?
|
|
10153
|
+
relative.host : result.host;
|
|
10154
|
+
result.hostname = (relative.hostname || relative.hostname === '') ?
|
|
10155
|
+
relative.hostname : result.hostname;
|
|
10156
|
+
result.search = relative.search;
|
|
10157
|
+
result.query = relative.query;
|
|
10158
|
+
srcPath = relPath;
|
|
10159
|
+
// fall through to the dot-handling below.
|
|
10160
|
+
} else if (relPath.length) {
|
|
10161
|
+
// it's relative
|
|
10162
|
+
// throw away the existing file, and take the new path instead.
|
|
10163
|
+
if (!srcPath) srcPath = [];
|
|
10164
|
+
srcPath.pop();
|
|
10165
|
+
srcPath = srcPath.concat(relPath);
|
|
10166
|
+
result.search = relative.search;
|
|
10167
|
+
result.query = relative.query;
|
|
10168
|
+
} else if (!util.isNullOrUndefined(relative.search)) {
|
|
10169
|
+
// just pull out the search.
|
|
10170
|
+
// like href='?foo'.
|
|
10171
|
+
// Put this after the other two cases because it simplifies the booleans
|
|
10172
|
+
if (psychotic) {
|
|
10173
|
+
result.hostname = result.host = srcPath.shift();
|
|
10174
|
+
//occationaly the auth can get stuck only in host
|
|
10175
|
+
//this especially happens in cases like
|
|
10176
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
10177
|
+
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
10178
|
+
result.host.split('@') : false;
|
|
10179
|
+
if (authInHost) {
|
|
10180
|
+
result.auth = authInHost.shift();
|
|
10181
|
+
result.host = result.hostname = authInHost.shift();
|
|
10182
|
+
}
|
|
10183
|
+
}
|
|
10184
|
+
result.search = relative.search;
|
|
10185
|
+
result.query = relative.query;
|
|
10186
|
+
//to support http.request
|
|
10187
|
+
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
|
10188
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
10189
|
+
(result.search ? result.search : '');
|
|
10190
|
+
}
|
|
10191
|
+
result.href = result.format();
|
|
10192
|
+
return result;
|
|
10193
|
+
}
|
|
10194
|
+
|
|
10195
|
+
if (!srcPath.length) {
|
|
10196
|
+
// no path at all. easy.
|
|
10197
|
+
// we've already handled the other stuff above.
|
|
10198
|
+
result.pathname = null;
|
|
10199
|
+
//to support http.request
|
|
10200
|
+
if (result.search) {
|
|
10201
|
+
result.path = '/' + result.search;
|
|
10202
|
+
} else {
|
|
10203
|
+
result.path = null;
|
|
10204
|
+
}
|
|
10205
|
+
result.href = result.format();
|
|
10206
|
+
return result;
|
|
10207
|
+
}
|
|
10208
|
+
|
|
10209
|
+
// if a url ENDs in . or .., then it must get a trailing slash.
|
|
10210
|
+
// however, if it ends in anything else non-slashy,
|
|
10211
|
+
// then it must NOT get a trailing slash.
|
|
10212
|
+
var last = srcPath.slice(-1)[0];
|
|
10213
|
+
var hasTrailingSlash = (
|
|
10214
|
+
(result.host || relative.host || srcPath.length > 1) &&
|
|
10215
|
+
(last === '.' || last === '..') || last === '');
|
|
10216
|
+
|
|
10217
|
+
// strip single dots, resolve double dots to parent dir
|
|
10218
|
+
// if the path tries to go above the root, `up` ends up > 0
|
|
10219
|
+
var up = 0;
|
|
10220
|
+
for (var i = srcPath.length; i >= 0; i--) {
|
|
10221
|
+
last = srcPath[i];
|
|
10222
|
+
if (last === '.') {
|
|
10223
|
+
srcPath.splice(i, 1);
|
|
10224
|
+
} else if (last === '..') {
|
|
10225
|
+
srcPath.splice(i, 1);
|
|
10226
|
+
up++;
|
|
10227
|
+
} else if (up) {
|
|
10228
|
+
srcPath.splice(i, 1);
|
|
10229
|
+
up--;
|
|
10230
|
+
}
|
|
10231
|
+
}
|
|
10232
|
+
|
|
10233
|
+
// if the path is allowed to go above the root, restore leading ..s
|
|
10234
|
+
if (!mustEndAbs && !removeAllDots) {
|
|
10235
|
+
for (; up--; up) {
|
|
10236
|
+
srcPath.unshift('..');
|
|
10237
|
+
}
|
|
10238
|
+
}
|
|
10239
|
+
|
|
10240
|
+
if (mustEndAbs && srcPath[0] !== '' &&
|
|
10241
|
+
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
|
10242
|
+
srcPath.unshift('');
|
|
10243
|
+
}
|
|
10244
|
+
|
|
10245
|
+
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
|
10246
|
+
srcPath.push('');
|
|
10247
|
+
}
|
|
10248
|
+
|
|
10249
|
+
var isAbsolute = srcPath[0] === '' ||
|
|
10250
|
+
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
|
10251
|
+
|
|
10252
|
+
// put the host back
|
|
10253
|
+
if (psychotic) {
|
|
10254
|
+
result.hostname = result.host = isAbsolute ? '' :
|
|
10255
|
+
srcPath.length ? srcPath.shift() : '';
|
|
10256
|
+
//occationaly the auth can get stuck only in host
|
|
10257
|
+
//this especially happens in cases like
|
|
10258
|
+
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
|
10259
|
+
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
|
10260
|
+
result.host.split('@') : false;
|
|
10261
|
+
if (authInHost) {
|
|
10262
|
+
result.auth = authInHost.shift();
|
|
10263
|
+
result.host = result.hostname = authInHost.shift();
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
|
|
10267
|
+
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
|
10268
|
+
|
|
10269
|
+
if (mustEndAbs && !isAbsolute) {
|
|
10270
|
+
srcPath.unshift('');
|
|
10271
|
+
}
|
|
10272
|
+
|
|
10273
|
+
if (!srcPath.length) {
|
|
10274
|
+
result.pathname = null;
|
|
10275
|
+
result.path = null;
|
|
10276
|
+
} else {
|
|
10277
|
+
result.pathname = srcPath.join('/');
|
|
10278
|
+
}
|
|
10279
|
+
|
|
10280
|
+
//to support request.http
|
|
10281
|
+
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
|
10282
|
+
result.path = (result.pathname ? result.pathname : '') +
|
|
10283
|
+
(result.search ? result.search : '');
|
|
10284
|
+
}
|
|
10285
|
+
result.auth = relative.auth || result.auth;
|
|
10286
|
+
result.slashes = result.slashes || relative.slashes;
|
|
10287
|
+
result.href = result.format();
|
|
10288
|
+
return result;
|
|
10289
|
+
};
|
|
10290
|
+
|
|
10291
|
+
Url.prototype.parseHost = function() {
|
|
10292
|
+
var host = this.host;
|
|
10293
|
+
var port = portPattern.exec(host);
|
|
10294
|
+
if (port) {
|
|
10295
|
+
port = port[0];
|
|
10296
|
+
if (port !== ':') {
|
|
10297
|
+
this.port = port.substr(1);
|
|
10298
|
+
}
|
|
10299
|
+
host = host.substr(0, host.length - port.length);
|
|
10300
|
+
}
|
|
10301
|
+
if (host) this.hostname = host;
|
|
10302
|
+
};
|
|
10303
|
+
|
|
10304
|
+
|
|
10305
|
+
/***/ }),
|
|
10306
|
+
|
|
10307
|
+
/***/ "../node_modules/url/util.js":
|
|
10308
|
+
/*!***********************************!*\
|
|
10309
|
+
!*** ../node_modules/url/util.js ***!
|
|
10310
|
+
\***********************************/
|
|
10311
|
+
/*! no static exports found */
|
|
10312
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
10313
|
+
|
|
10314
|
+
"use strict";
|
|
10315
|
+
|
|
10316
|
+
|
|
10317
|
+
module.exports = {
|
|
10318
|
+
isString: function(arg) {
|
|
10319
|
+
return typeof(arg) === 'string';
|
|
10320
|
+
},
|
|
10321
|
+
isObject: function(arg) {
|
|
10322
|
+
return typeof(arg) === 'object' && arg !== null;
|
|
10323
|
+
},
|
|
10324
|
+
isNull: function(arg) {
|
|
10325
|
+
return arg === null;
|
|
10326
|
+
},
|
|
10327
|
+
isNullOrUndefined: function(arg) {
|
|
10328
|
+
return arg == null;
|
|
10329
|
+
}
|
|
10330
|
+
};
|
|
10331
|
+
|
|
10332
|
+
|
|
6415
10333
|
/***/ }),
|
|
6416
10334
|
|
|
6417
10335
|
/***/ "../node_modules/webpack/buildin/global.js":
|
|
@@ -6443,6 +10361,39 @@ try {
|
|
|
6443
10361
|
module.exports = g;
|
|
6444
10362
|
|
|
6445
10363
|
|
|
10364
|
+
/***/ }),
|
|
10365
|
+
|
|
10366
|
+
/***/ "../node_modules/webpack/buildin/module.js":
|
|
10367
|
+
/*!*************************************************!*\
|
|
10368
|
+
!*** ../node_modules/webpack/buildin/module.js ***!
|
|
10369
|
+
\*************************************************/
|
|
10370
|
+
/*! no static exports found */
|
|
10371
|
+
/***/ (function(module, exports) {
|
|
10372
|
+
|
|
10373
|
+
module.exports = function(module) {
|
|
10374
|
+
if (!module.webpackPolyfill) {
|
|
10375
|
+
module.deprecate = function() {};
|
|
10376
|
+
module.paths = [];
|
|
10377
|
+
// module.parent = undefined by default
|
|
10378
|
+
if (!module.children) module.children = [];
|
|
10379
|
+
Object.defineProperty(module, "loaded", {
|
|
10380
|
+
enumerable: true,
|
|
10381
|
+
get: function() {
|
|
10382
|
+
return module.l;
|
|
10383
|
+
}
|
|
10384
|
+
});
|
|
10385
|
+
Object.defineProperty(module, "id", {
|
|
10386
|
+
enumerable: true,
|
|
10387
|
+
get: function() {
|
|
10388
|
+
return module.i;
|
|
10389
|
+
}
|
|
10390
|
+
});
|
|
10391
|
+
module.webpackPolyfill = 1;
|
|
10392
|
+
}
|
|
10393
|
+
return module;
|
|
10394
|
+
};
|
|
10395
|
+
|
|
10396
|
+
|
|
6446
10397
|
/***/ }),
|
|
6447
10398
|
|
|
6448
10399
|
/***/ "./contentful.js":
|
|
@@ -6528,7 +10479,7 @@ function createClient(params) {
|
|
|
6528
10479
|
|
|
6529
10480
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
6530
10481
|
|
|
6531
|
-
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.1.
|
|
10482
|
+
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.1.25"}`, config.application, config.integration);
|
|
6532
10483
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
6533
10484
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
6534
10485
|
'X-Contentful-User-Agent': userAgentHeader
|