@reachfive/identity-ui 1.19.0 → 1.20.0
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/CHANGELOG.md +22 -1
- package/cjs/identity-ui.js +121 -1768
- package/es/identity-ui.js +122 -1769
- package/index.d.ts +485 -14
- package/package.json +13 -4
- package/umd/identity-ui.js +13408 -5648
- package/umd/identity-ui.min.js +1 -1
package/cjs/identity-ui.js
CHANGED
|
@@ -20,8 +20,10 @@ var validator = require('validator');
|
|
|
20
20
|
var validator__default = _interopDefault(validator);
|
|
21
21
|
var libphonenumber = require('libphonenumber-js');
|
|
22
22
|
var lodashEs = require('lodash-es');
|
|
23
|
+
var luxon = require('luxon');
|
|
23
24
|
var charInfo = require('char-info');
|
|
24
25
|
var zxcvbn = _interopDefault(require('@reachfive/zxcvbn'));
|
|
26
|
+
require('Buffer');
|
|
25
27
|
|
|
26
28
|
function ownKeys(object, enumerableOnly) {
|
|
27
29
|
var keys = Object.keys(object);
|
|
@@ -2825,7 +2827,13 @@ var UserError = /*#__PURE__*/function (_Error) {
|
|
|
2825
2827
|
_this.isUserError = true;
|
|
2826
2828
|
return _this;
|
|
2827
2829
|
}
|
|
2828
|
-
|
|
2830
|
+
_createClass(UserError, null, [{
|
|
2831
|
+
key: "fromAppError",
|
|
2832
|
+
value: function fromAppError(appError) {
|
|
2833
|
+
return new UserError(appError.errorUserMsg || appError.errorDescription || appError.error);
|
|
2834
|
+
}
|
|
2835
|
+
}]);
|
|
2836
|
+
return UserError;
|
|
2829
2837
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
2830
2838
|
|
|
2831
2839
|
/** `Object#toString` result references. */
|
|
@@ -3408,6 +3416,7 @@ function get(object, path, defaultValue) {
|
|
|
3408
3416
|
return result === undefined ? defaultValue : result;
|
|
3409
3417
|
}
|
|
3410
3418
|
|
|
3419
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3411
3420
|
var white = '#fff';
|
|
3412
3421
|
var gray200 = '#e9ecef';
|
|
3413
3422
|
var gray400 = '#ced4da';
|
|
@@ -3415,6 +3424,8 @@ var gray500 = '#adb5bd';
|
|
|
3415
3424
|
var gray600 = '#868e96';
|
|
3416
3425
|
var gray700 = '#495057';
|
|
3417
3426
|
var gray900 = '#212529';
|
|
3427
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
3428
|
+
|
|
3418
3429
|
var inputBtnFocusBoxShadow = function inputBtnFocusBoxShadow(borderColor) {
|
|
3419
3430
|
return "0 0 0 3px ".concat(polished.transparentize(0.5, borderColor));
|
|
3420
3431
|
};
|
|
@@ -3805,7 +3816,7 @@ var WidgetContent = styled__default(function (_ref) {
|
|
|
3805
3816
|
}, function (props) {
|
|
3806
3817
|
return props.standalone && "\n padding: ".concat(props.theme.get('spacing') * 2, "px;\n border-radius: ").concat(props.theme.get('borderRadius'), "px;\n background-color: ").concat(props.theme.get('backgroundColor'), ";\n max-width: ").concat(props.theme.get('maxWidth'), "px;\n box-sizing: border-box;\n margin: 0 auto;\n ");
|
|
3807
3818
|
});
|
|
3808
|
-
|
|
3819
|
+
function widgetContainer(_ref2) {
|
|
3809
3820
|
var name = _ref2.name,
|
|
3810
3821
|
_ref2$standalone = _ref2.standalone,
|
|
3811
3822
|
standalone = _ref2$standalone === void 0 ? true : _ref2$standalone,
|
|
@@ -3827,7 +3838,7 @@ var WidgetContainer = (function (_ref2) {
|
|
|
3827
3838
|
transition: state
|
|
3828
3839
|
}, title && /*#__PURE__*/React__default.createElement(Heading, null, title), !noIntro && intro && /*#__PURE__*/React__default.createElement(Intro, null, intro), children);
|
|
3829
3840
|
});
|
|
3830
|
-
}
|
|
3841
|
+
}
|
|
3831
3842
|
|
|
3832
3843
|
var _excluded = ["component", "prepare"],
|
|
3833
3844
|
_excluded2 = ["i18n", "theme"],
|
|
@@ -3860,7 +3871,7 @@ function createWidget(_ref) {
|
|
|
3860
3871
|
i18n: resolveI18n(context.defaultI18n, i18n),
|
|
3861
3872
|
theme: resolveTheme(theme)
|
|
3862
3873
|
});
|
|
3863
|
-
return /*#__PURE__*/React__default.createElement(
|
|
3874
|
+
return /*#__PURE__*/React__default.createElement(widgetContainer, _extends({}, widgetAttrs, fullProps), /*#__PURE__*/React__default.createElement(Component, fullProps));
|
|
3864
3875
|
});
|
|
3865
3876
|
};
|
|
3866
3877
|
}
|
|
@@ -3882,11 +3893,11 @@ function multiViewWidget(_ref3) {
|
|
|
3882
3893
|
onStartup = _ref3.onStartup,
|
|
3883
3894
|
handlers = _ref3.handlers;
|
|
3884
3895
|
return _class = /*#__PURE__*/function (_React$Component) {
|
|
3885
|
-
_inherits(
|
|
3886
|
-
var _super = _createSuper(
|
|
3887
|
-
function
|
|
3896
|
+
_inherits(MultiViewWidget, _React$Component);
|
|
3897
|
+
var _super = _createSuper(MultiViewWidget);
|
|
3898
|
+
function MultiViewWidget() {
|
|
3888
3899
|
var _this;
|
|
3889
|
-
_classCallCheck(this,
|
|
3900
|
+
_classCallCheck(this, MultiViewWidget);
|
|
3890
3901
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3891
3902
|
args[_key] = arguments[_key];
|
|
3892
3903
|
}
|
|
@@ -3904,7 +3915,7 @@ function multiViewWidget(_ref3) {
|
|
|
3904
3915
|
});
|
|
3905
3916
|
return _this;
|
|
3906
3917
|
}
|
|
3907
|
-
_createClass(
|
|
3918
|
+
_createClass(MultiViewWidget, [{
|
|
3908
3919
|
key: "getChildContext",
|
|
3909
3920
|
value: function getChildContext() {
|
|
3910
3921
|
return {
|
|
@@ -3926,7 +3937,7 @@ function multiViewWidget(_ref3) {
|
|
|
3926
3937
|
}));
|
|
3927
3938
|
}
|
|
3928
3939
|
}]);
|
|
3929
|
-
return
|
|
3940
|
+
return MultiViewWidget;
|
|
3930
3941
|
}(React__default.Component), _defineProperty(_class, "childContextTypes", {
|
|
3931
3942
|
goTo: PropTypes.func.isRequired
|
|
3932
3943
|
}), _class;
|
|
@@ -4126,7 +4137,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
4126
4137
|
}
|
|
4127
4138
|
|
|
4128
4139
|
/** Built-in value references. */
|
|
4129
|
-
var Uint8Array
|
|
4140
|
+
var Uint8Array = root.Uint8Array;
|
|
4130
4141
|
|
|
4131
4142
|
/**
|
|
4132
4143
|
* Converts `map` to its key-value pairs.
|
|
@@ -4191,7 +4202,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
4191
4202
|
object = object.buffer;
|
|
4192
4203
|
other = other.buffer;
|
|
4193
4204
|
case arrayBufferTag:
|
|
4194
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array
|
|
4205
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
4195
4206
|
return false;
|
|
4196
4207
|
}
|
|
4197
4208
|
return true;
|
|
@@ -6524,7 +6535,7 @@ var SocialButton = withTheme(function (_ref3) {
|
|
|
6524
6535
|
textVisible: textVisible,
|
|
6525
6536
|
width: width,
|
|
6526
6537
|
height: height,
|
|
6527
|
-
onClick: function onClick(
|
|
6538
|
+
onClick: function onClick() {
|
|
6528
6539
|
return _onClick(provider.key);
|
|
6529
6540
|
}
|
|
6530
6541
|
}, /*#__PURE__*/React__default.createElement(SocialButtonIcon, {
|
|
@@ -6538,18 +6549,21 @@ var SocialButtons = styled__default(function (_ref4) {
|
|
|
6538
6549
|
className = _ref4.className;
|
|
6539
6550
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
6540
6551
|
className: classes(['r5-social-buttons', className])
|
|
6541
|
-
}, providers.
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6552
|
+
}, providers.flatMap(function (providerKey) {
|
|
6553
|
+
var _providerKey$split = providerKey.split(':'),
|
|
6554
|
+
_providerKey$split2 = _slicedToArray(_providerKey$split, 1),
|
|
6555
|
+
providerName = _providerKey$split2[0];
|
|
6556
|
+
if (providerName === 'bconnect' && queryParams['bconnectActivation'] !== 'true') return [];else if (socialButtons[providerName] === undefined) {
|
|
6557
|
+
console.error("".concat(providerName, " provider not found."));
|
|
6558
|
+
return [];
|
|
6559
|
+
} else return [/*#__PURE__*/React__default.createElement(SocialButton, {
|
|
6560
|
+
provider: socialButtons[providerName],
|
|
6549
6561
|
count: providers.length,
|
|
6550
|
-
onClick:
|
|
6562
|
+
onClick: function onClick() {
|
|
6563
|
+
return clickHandler(providerKey);
|
|
6564
|
+
},
|
|
6551
6565
|
key: providerKey
|
|
6552
|
-
});
|
|
6566
|
+
})];
|
|
6553
6567
|
}));
|
|
6554
6568
|
})(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n text-align: center;\n ", "\n"])), function (props) {
|
|
6555
6569
|
return props.theme.get('socialButton.inline') && 'margin: 0 -4px';
|
|
@@ -7308,7 +7322,7 @@ function formatISO8601Date(year, month, day) {
|
|
|
7308
7322
|
return null;
|
|
7309
7323
|
}
|
|
7310
7324
|
function specializeIdentifierData(data) {
|
|
7311
|
-
return
|
|
7325
|
+
return data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
7312
7326
|
identifier: undefined
|
|
7313
7327
|
}, isValidEmail(data.identifier) ? {
|
|
7314
7328
|
email: data.identifier
|
|
@@ -7355,7 +7369,7 @@ var Validator = /*#__PURE__*/function () {
|
|
|
7355
7369
|
parameters = _ref$parameters === void 0 ? [] : _ref$parameters;
|
|
7356
7370
|
_classCallCheck(this, Validator);
|
|
7357
7371
|
this.rule = rule;
|
|
7358
|
-
this.hint = !isFunction(hint) ? function (
|
|
7372
|
+
this.hint = !isFunction(hint) ? function () {
|
|
7359
7373
|
return hint;
|
|
7360
7374
|
} : hint;
|
|
7361
7375
|
this.parameters = parameters;
|
|
@@ -7629,8 +7643,7 @@ var createField = function createField(_ref) {
|
|
|
7629
7643
|
return mapping.unbind(model, format.unbind(value));
|
|
7630
7644
|
},
|
|
7631
7645
|
validate: function validate(_ref5, ctx) {
|
|
7632
|
-
var value = _ref5.value
|
|
7633
|
-
isDirty = _ref5.isDirty;
|
|
7646
|
+
var value = _ref5.value;
|
|
7634
7647
|
return required$1 || isValued(value) ? fullValidator(value, ctx) : {};
|
|
7635
7648
|
}
|
|
7636
7649
|
};
|
|
@@ -7821,7 +7834,7 @@ function initCloneArray(array) {
|
|
|
7821
7834
|
*/
|
|
7822
7835
|
function cloneArrayBuffer(arrayBuffer) {
|
|
7823
7836
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
7824
|
-
new Uint8Array
|
|
7837
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
7825
7838
|
return result;
|
|
7826
7839
|
}
|
|
7827
7840
|
|
|
@@ -8286,7 +8299,7 @@ var omit = flatRest(function (object, paths) {
|
|
|
8286
8299
|
});
|
|
8287
8300
|
|
|
8288
8301
|
var _excluded$2 = ["options", "placeholder"],
|
|
8289
|
-
_excluded2$1 = ["options", "onChange", "value", "
|
|
8302
|
+
_excluded2$1 = ["options", "onChange", "value", "inputId"];
|
|
8290
8303
|
var _templateObject$5, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8, _templateObject9, _templateObject10;
|
|
8291
8304
|
var errorFadeIn = styled.keyframes(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n"])));
|
|
8292
8305
|
var FormError = withTheme(styled__default.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n padding-top: 3px;\n animation: ", " 0.3s both;\n color: ", ";\n"])), errorFadeIn, function (props) {
|
|
@@ -8413,7 +8426,6 @@ var RadioGroup = function RadioGroup(_ref6) {
|
|
|
8413
8426
|
var options = _ref6.options,
|
|
8414
8427
|
onChange = _ref6.onChange,
|
|
8415
8428
|
value = _ref6.value,
|
|
8416
|
-
name = _ref6.name,
|
|
8417
8429
|
inputId = _ref6.inputId,
|
|
8418
8430
|
props = _objectWithoutProperties(_ref6, _excluded2$1);
|
|
8419
8431
|
var handleChange = function handleChange(event) {
|
|
@@ -8620,13 +8632,13 @@ function checkboxField(config) {
|
|
|
8620
8632
|
*/
|
|
8621
8633
|
|
|
8622
8634
|
function specializeRawIdentifier(withPhoneNumber, inputValue) {
|
|
8623
|
-
var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (
|
|
8635
|
+
var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
8624
8636
|
return undefined;
|
|
8625
8637
|
};
|
|
8626
|
-
var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (
|
|
8638
|
+
var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
|
|
8627
8639
|
return undefined;
|
|
8628
8640
|
};
|
|
8629
|
-
var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (
|
|
8641
|
+
var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
8630
8642
|
return undefined;
|
|
8631
8643
|
};
|
|
8632
8644
|
if (withPhoneNumber && /^\+?[0-9]+$/.test(inputValue)) {
|
|
@@ -8695,7 +8707,9 @@ var IdentifierField = /*#__PURE__*/function (_React$Component) {
|
|
|
8695
8707
|
var parsed = libphonenumber.parse(userInput, country);
|
|
8696
8708
|
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') : userInput;
|
|
8697
8709
|
this.asYouType(phoneValue);
|
|
8698
|
-
} catch (e) {
|
|
8710
|
+
} catch (e) {
|
|
8711
|
+
console.error(e);
|
|
8712
|
+
}
|
|
8699
8713
|
}
|
|
8700
8714
|
}, {
|
|
8701
8715
|
key: "componentWillUnmount",
|
|
@@ -8756,17 +8770,17 @@ function identifierField(props, config) {
|
|
|
8756
8770
|
label: 'identifier',
|
|
8757
8771
|
format: {
|
|
8758
8772
|
bind: function bind(x) {
|
|
8759
|
-
return specializeRawIdentifier(props.withPhoneNumber, x, function (
|
|
8773
|
+
return specializeRawIdentifier(props.withPhoneNumber, x, function () {
|
|
8760
8774
|
return {
|
|
8761
8775
|
country: config.countryCode,
|
|
8762
8776
|
isValid: true
|
|
8763
8777
|
};
|
|
8764
|
-
}, function (
|
|
8778
|
+
}, function () {
|
|
8765
8779
|
return {
|
|
8766
8780
|
country: config.countryCode,
|
|
8767
8781
|
isValid: true
|
|
8768
8782
|
};
|
|
8769
|
-
}, function (
|
|
8783
|
+
}, function () {
|
|
8770
8784
|
return {
|
|
8771
8785
|
country: config.countryCode,
|
|
8772
8786
|
isValid: true
|
|
@@ -8794,11 +8808,11 @@ function identifierField(props, config) {
|
|
|
8794
8808
|
});
|
|
8795
8809
|
},
|
|
8796
8810
|
hint: function hint(value) {
|
|
8797
|
-
return specializeRefinedIdentifier(value, function (
|
|
8811
|
+
return specializeRefinedIdentifier(value, function () {
|
|
8798
8812
|
return 'phone';
|
|
8799
|
-
}, function (
|
|
8813
|
+
}, function () {
|
|
8800
8814
|
return 'email';
|
|
8801
|
-
}, function (
|
|
8815
|
+
}, function () {
|
|
8802
8816
|
return 'identifier';
|
|
8803
8817
|
});
|
|
8804
8818
|
}
|
|
@@ -8962,8 +8976,7 @@ var LoginForm = createForm({
|
|
|
8962
8976
|
defaultIdentifier = _ref.defaultIdentifier,
|
|
8963
8977
|
i18n = _ref.i18n,
|
|
8964
8978
|
config = _ref.config,
|
|
8965
|
-
allowCustomIdentifier = _ref.allowCustomIdentifier
|
|
8966
|
-
customIdentifierLabel = _ref.customIdentifierLabel;
|
|
8979
|
+
allowCustomIdentifier = _ref.allowCustomIdentifier;
|
|
8967
8980
|
return [showIdentifier && config.sms ? identifierField({
|
|
8968
8981
|
defaultValue: defaultIdentifier,
|
|
8969
8982
|
withPhoneNumber: true,
|
|
@@ -9039,8 +9052,7 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9039
9052
|
_this$props$session = _this$props.session,
|
|
9040
9053
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9041
9054
|
i18n = _this$props.i18n,
|
|
9042
|
-
allowCustomIdentifier = _this$props.allowCustomIdentifier
|
|
9043
|
-
customIdentifierLabel = _this$props.customIdentifierLabel;
|
|
9055
|
+
allowCustomIdentifier = _this$props.allowCustomIdentifier;
|
|
9044
9056
|
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9045
9057
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(SocialButtons$1, {
|
|
9046
9058
|
providers: socialProviders,
|
|
@@ -9740,25 +9752,15 @@ var BirthdateField = function BirthdateField(props) {
|
|
|
9740
9752
|
"data-testid": "".concat(BIRTHDAY_PATH, ".year")
|
|
9741
9753
|
}))));
|
|
9742
9754
|
};
|
|
9743
|
-
var
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
return 'birthdate.dayOfMonth';
|
|
9751
|
-
};
|
|
9752
|
-
var validateYear = function validateYear(year) {
|
|
9753
|
-
if (validator.isNumeric(year)) {
|
|
9754
|
-
var yearNbr = parseInt(year);
|
|
9755
|
-
var currentYear = new Date().getFullYear();
|
|
9756
|
-
var age = currentYear - yearNbr;
|
|
9757
|
-
if (age > 5 && age < 130) {
|
|
9758
|
-
return false;
|
|
9759
|
-
}
|
|
9755
|
+
var validateLimitAge = function validateLimitAge(day, month, year) {
|
|
9756
|
+
var yearNbr = parseInt(year, 10);
|
|
9757
|
+
var dayNbr = parseInt(day, 10);
|
|
9758
|
+
var monthNbr = parseInt(month, 10);
|
|
9759
|
+
var age = luxon.DateTime.now().diff(luxon.DateTime.local(yearNbr, monthNbr, dayNbr), "years").years;
|
|
9760
|
+
if (age < 6 || age > 129) {
|
|
9761
|
+
return 'birthdate.yearLimit';
|
|
9760
9762
|
}
|
|
9761
|
-
return
|
|
9763
|
+
return false;
|
|
9762
9764
|
};
|
|
9763
9765
|
var format = function format(_ref3) {
|
|
9764
9766
|
var day = _ref3.day,
|
|
@@ -9840,25 +9842,15 @@ function birthdateField(_ref4) {
|
|
|
9840
9842
|
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, field, true));
|
|
9841
9843
|
}, {})) : {};
|
|
9842
9844
|
}
|
|
9843
|
-
if (isSubmitted || day.isDirty) {
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
error: i18n("validation.".concat(dayError)),
|
|
9848
|
-
day: true
|
|
9849
|
-
};
|
|
9850
|
-
}
|
|
9851
|
-
}
|
|
9852
|
-
if (isSubmitted || year.isDirty) {
|
|
9853
|
-
var yearError = validateYear(year.value);
|
|
9854
|
-
if (yearError) {
|
|
9845
|
+
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9846
|
+
if (!validator.isNumeric(year.value.toString()) || !luxon.DateTime.fromObject({
|
|
9847
|
+
year: parseInt(year.value, 10)
|
|
9848
|
+
}).isValid) {
|
|
9855
9849
|
return {
|
|
9856
|
-
error: i18n("validation."
|
|
9850
|
+
error: i18n("validation.birthdate.year"),
|
|
9857
9851
|
year: true
|
|
9858
9852
|
};
|
|
9859
9853
|
}
|
|
9860
|
-
}
|
|
9861
|
-
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9862
9854
|
var birthdate = format(state);
|
|
9863
9855
|
if (!birthdate || !validator.isISO8601(birthdate)) {
|
|
9864
9856
|
return {
|
|
@@ -9866,6 +9858,22 @@ function birthdateField(_ref4) {
|
|
|
9866
9858
|
day: true
|
|
9867
9859
|
};
|
|
9868
9860
|
}
|
|
9861
|
+
if (!(validator.isNumeric(month.value.toString()) && validator.isNumeric(day.value.toString())) || !luxon.DateTime.fromObject({
|
|
9862
|
+
year: year.value,
|
|
9863
|
+
month: month.value,
|
|
9864
|
+
day: day.value
|
|
9865
|
+
}).isValid) {
|
|
9866
|
+
return {
|
|
9867
|
+
error: i18n("validation.birthdate.dayOfMonth"),
|
|
9868
|
+
day: true
|
|
9869
|
+
};
|
|
9870
|
+
}
|
|
9871
|
+
var limitAge = validateLimitAge(day.value, month.value, year.value);
|
|
9872
|
+
if (limitAge) {
|
|
9873
|
+
return {
|
|
9874
|
+
error: i18n("validation.".concat(limitAge))
|
|
9875
|
+
};
|
|
9876
|
+
}
|
|
9869
9877
|
}
|
|
9870
9878
|
return {};
|
|
9871
9879
|
}
|
|
@@ -9910,7 +9918,9 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
9910
9918
|
var parsed = libphonenumber.parse(raw, country);
|
|
9911
9919
|
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') : raw;
|
|
9912
9920
|
this.asYouType(phoneValue);
|
|
9913
|
-
} catch (e) {
|
|
9921
|
+
} catch (e) {
|
|
9922
|
+
console.error(e);
|
|
9923
|
+
}
|
|
9914
9924
|
}
|
|
9915
9925
|
}, {
|
|
9916
9926
|
key: "componentWillUnmount",
|
|
@@ -10025,7 +10035,7 @@ var PasswordPolicyRules = withI18n(withTheme(styled__default(function (_ref3) {
|
|
|
10025
10035
|
checked: props.strength >= props.minStrength
|
|
10026
10036
|
}), /*#__PURE__*/React__default.createElement(Label, {
|
|
10027
10037
|
visible: true
|
|
10028
|
-
}, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key
|
|
10038
|
+
}, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key) {
|
|
10029
10039
|
var rule = props.rules[key];
|
|
10030
10040
|
return /*#__PURE__*/React__default.createElement(PasswordPolicyRule, {
|
|
10031
10041
|
key: key
|
|
@@ -10097,7 +10107,7 @@ var PasswordField = /*#__PURE__*/function (_React$Component) {
|
|
|
10097
10107
|
}
|
|
10098
10108
|
_createClass(PasswordField, [{
|
|
10099
10109
|
key: "componentDidUpdate",
|
|
10100
|
-
value: function componentDidUpdate(prevProps
|
|
10110
|
+
value: function componentDidUpdate(prevProps) {
|
|
10101
10111
|
var blacklistUpdated = lodashEs.isEqual(prevProps.blacklist, this.props.blacklist);
|
|
10102
10112
|
if (!blacklistUpdated) {
|
|
10103
10113
|
var _this$props = this.props,
|
|
@@ -10602,8 +10612,8 @@ var resolveField = function resolveField(fieldConfig, config) {
|
|
|
10602
10612
|
var camelPathSplit = camelPath.split('.v'); // TODO What if consent start with a `v`?
|
|
10603
10613
|
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
10604
10614
|
// Find most recent consent version if not given
|
|
10605
|
-
var highestConsentVersion = consentField.versions[0].versionId;
|
|
10606
10615
|
if (consentField) {
|
|
10616
|
+
var highestConsentVersion = consentField.versions[0].versionId;
|
|
10607
10617
|
return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1] || highestConsentVersion);
|
|
10608
10618
|
}
|
|
10609
10619
|
throw new UserError("Unknown field: ".concat(fieldConfig.key));
|
|
@@ -11136,7 +11146,7 @@ var MfaStepUpView = /*#__PURE__*/function (_React$Component) {
|
|
|
11136
11146
|
args[_key] = arguments[_key];
|
|
11137
11147
|
}
|
|
11138
11148
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11139
|
-
_defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function (
|
|
11149
|
+
_defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function () {
|
|
11140
11150
|
return _this.props.apiClient.getMfaStepUpToken({
|
|
11141
11151
|
options: _this.props.auth,
|
|
11142
11152
|
accessToken: _this.props.accessToken
|
|
@@ -11323,7 +11333,7 @@ var MainView = /*#__PURE__*/function (_React$Component) {
|
|
|
11323
11333
|
args[_key] = arguments[_key];
|
|
11324
11334
|
}
|
|
11325
11335
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11326
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
11336
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11327
11337
|
var _this$props = _this.props,
|
|
11328
11338
|
apiClient = _this$props.apiClient,
|
|
11329
11339
|
accessToken = _this$props.accessToken,
|
|
@@ -11339,11 +11349,19 @@ var MainView = /*#__PURE__*/function (_React$Component) {
|
|
|
11339
11349
|
return _this;
|
|
11340
11350
|
}
|
|
11341
11351
|
_createClass(MainView, [{
|
|
11352
|
+
key: "componentDidMount",
|
|
11353
|
+
value: function componentDidMount() {
|
|
11354
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
11355
|
+
}
|
|
11356
|
+
}, {
|
|
11342
11357
|
key: "render",
|
|
11343
11358
|
value: function render() {
|
|
11359
|
+
var _this2 = this;
|
|
11344
11360
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Intro, null, this.props.i18n('emailEditor.intro')), /*#__PURE__*/React__default.createElement(EmailEditorForm, {
|
|
11345
11361
|
showLabels: this.props.showLabels,
|
|
11346
|
-
handler:
|
|
11362
|
+
handler: function handler(data) {
|
|
11363
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "update_email");
|
|
11364
|
+
},
|
|
11347
11365
|
onSuccess: this.handleSuccess
|
|
11348
11366
|
}));
|
|
11349
11367
|
}
|
|
@@ -11510,7 +11528,7 @@ var MainView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
11510
11528
|
accessToken = _this$props.accessToken;
|
|
11511
11529
|
return apiClient.updatePhoneNumber(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11512
11530
|
accessToken: accessToken
|
|
11513
|
-
})).then(function (
|
|
11531
|
+
})).then(function () {
|
|
11514
11532
|
return data;
|
|
11515
11533
|
});
|
|
11516
11534
|
});
|
|
@@ -11679,7 +11697,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11679
11697
|
}
|
|
11680
11698
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11681
11699
|
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11682
|
-
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (
|
|
11700
|
+
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function () {
|
|
11683
11701
|
return data;
|
|
11684
11702
|
});
|
|
11685
11703
|
});
|
|
@@ -12311,7 +12329,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12311
12329
|
args[_key] = arguments[_key];
|
|
12312
12330
|
}
|
|
12313
12331
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
12314
|
-
_defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function (
|
|
12332
|
+
_defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function () {
|
|
12315
12333
|
return _this.props.apiClient.startMfaEmailRegistration({
|
|
12316
12334
|
accessToken: _this.props.accessToken
|
|
12317
12335
|
});
|
|
@@ -12321,7 +12339,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12321
12339
|
accessToken: _this.props.accessToken
|
|
12322
12340
|
}, data));
|
|
12323
12341
|
});
|
|
12324
|
-
_defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function (
|
|
12342
|
+
_defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function () {
|
|
12325
12343
|
return _this.props.apiClient.removeMfaEmail({
|
|
12326
12344
|
accessToken: _this.props.accessToken
|
|
12327
12345
|
});
|
|
@@ -12367,7 +12385,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12367
12385
|
}
|
|
12368
12386
|
}))), /*#__PURE__*/React__default.createElement(DivCredentialBlock, null, showRemoveMfaCredentials && config.mfaEmailEnabled && isEmailCredentialRegistered && /*#__PURE__*/React__default.createElement("div", null, showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('mfa.email.remove.explain')), /*#__PURE__*/React__default.createElement(EmailCredentialRemovalForm, {
|
|
12369
12387
|
handler: this.onEmailRemoval,
|
|
12370
|
-
onSuccess: function onSuccess(
|
|
12388
|
+
onSuccess: function onSuccess() {
|
|
12371
12389
|
return _this2.props.goTo('credential-removed', {
|
|
12372
12390
|
credentialType: 'email'
|
|
12373
12391
|
});
|
|
@@ -12376,7 +12394,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12376
12394
|
handler: function handler(data) {
|
|
12377
12395
|
return _this2.onPhoneNumberRemoval(_objectSpread2(_objectSpread2({}, data), phoneNumberCredentialRegistered));
|
|
12378
12396
|
},
|
|
12379
|
-
onSuccess: function onSuccess(
|
|
12397
|
+
onSuccess: function onSuccess() {
|
|
12380
12398
|
return _this2.props.goTo('credential-removed', {
|
|
12381
12399
|
credentialType: 'sms'
|
|
12382
12400
|
});
|
|
@@ -12459,7 +12477,9 @@ var mfaCredentialsWidget = createMultiViewWidget({
|
|
|
12459
12477
|
},
|
|
12460
12478
|
prepare: function prepare(options, _ref3) {
|
|
12461
12479
|
var apiClient = _ref3.apiClient;
|
|
12462
|
-
return apiClient.listMfaCredentials(options.accessToken)
|
|
12480
|
+
return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
|
|
12481
|
+
throw new UserError.fromAppError(error);
|
|
12482
|
+
}).then(function (credentials) {
|
|
12463
12483
|
return deepDefaults(_objectSpread2(_objectSpread2({
|
|
12464
12484
|
showIntro: true,
|
|
12465
12485
|
showRemoveMfaCredentials: true
|
|
@@ -12546,7 +12566,9 @@ var mfaListWidget = createWidget({
|
|
|
12546
12566
|
component: MfaList,
|
|
12547
12567
|
prepare: function prepare(options, _ref3) {
|
|
12548
12568
|
var apiClient = _ref3.apiClient;
|
|
12549
|
-
return apiClient.listMfaCredentials(options.accessToken)
|
|
12569
|
+
return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
|
|
12570
|
+
throw new UserError.fromAppError(error);
|
|
12571
|
+
}).then(function (credentials) {
|
|
12550
12572
|
return _objectSpread2(_objectSpread2({}, options), credentials);
|
|
12551
12573
|
});
|
|
12552
12574
|
}
|
|
@@ -12557,7 +12579,7 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12557
12579
|
_classCallCheck(this, UiClient);
|
|
12558
12580
|
this.config = config;
|
|
12559
12581
|
this.urlParser = urlParser;
|
|
12560
|
-
this.
|
|
12582
|
+
this.core = coreClient;
|
|
12561
12583
|
this.defaultI18n = defaultI18n;
|
|
12562
12584
|
}
|
|
12563
12585
|
|
|
@@ -12664,7 +12686,7 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12664
12686
|
_context.next = 9;
|
|
12665
12687
|
return widget(options, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
12666
12688
|
config: config,
|
|
12667
|
-
apiClient: this.
|
|
12689
|
+
apiClient: this.core,
|
|
12668
12690
|
defaultI18n: this.defaultI18n
|
|
12669
12691
|
}));
|
|
12670
12692
|
case 9:
|
|
@@ -12717,10 +12739,10 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12717
12739
|
return Promise.resolve(_this.urlParser.parseUrlFragment(window.location.href)).then(function (authResult) {
|
|
12718
12740
|
// Avoid authentication triggering when an authentication response is present
|
|
12719
12741
|
if (authResult) return;
|
|
12720
|
-
_this.
|
|
12742
|
+
_this.core.getSessionInfo().then(function (session) {
|
|
12721
12743
|
var reAuthenticate = auth && auth.prompt && auth.prompt === 'login';
|
|
12722
12744
|
if (session.isAuthenticated && !reAuthenticate) {
|
|
12723
|
-
_this.
|
|
12745
|
+
_this.core.loginFromSession(auth);
|
|
12724
12746
|
} else {
|
|
12725
12747
|
showAuthWidget(session);
|
|
12726
12748
|
}
|
|
@@ -12738,1676 +12760,6 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12738
12760
|
return UiClient;
|
|
12739
12761
|
}();
|
|
12740
12762
|
|
|
12741
|
-
var lookup = [];
|
|
12742
|
-
var revLookup = [];
|
|
12743
|
-
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
12744
|
-
var inited = false;
|
|
12745
|
-
function init() {
|
|
12746
|
-
inited = true;
|
|
12747
|
-
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
12748
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
12749
|
-
lookup[i] = code[i];
|
|
12750
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
12751
|
-
}
|
|
12752
|
-
revLookup['-'.charCodeAt(0)] = 62;
|
|
12753
|
-
revLookup['_'.charCodeAt(0)] = 63;
|
|
12754
|
-
}
|
|
12755
|
-
function toByteArray(b64) {
|
|
12756
|
-
if (!inited) {
|
|
12757
|
-
init();
|
|
12758
|
-
}
|
|
12759
|
-
var i, j, l, tmp, placeHolders, arr;
|
|
12760
|
-
var len = b64.length;
|
|
12761
|
-
if (len % 4 > 0) {
|
|
12762
|
-
throw new Error('Invalid string. Length must be a multiple of 4');
|
|
12763
|
-
}
|
|
12764
|
-
|
|
12765
|
-
// the number of equal signs (place holders)
|
|
12766
|
-
// if there are two placeholders, than the two characters before it
|
|
12767
|
-
// represent one byte
|
|
12768
|
-
// if there is only one, then the three characters before it represent 2 bytes
|
|
12769
|
-
// this is just a cheap hack to not do indexOf twice
|
|
12770
|
-
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
|
|
12771
|
-
|
|
12772
|
-
// base64 is 4/3 + up to two characters of the original data
|
|
12773
|
-
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
12774
|
-
|
|
12775
|
-
// if there are placeholders, only get up to the last complete 4 chars
|
|
12776
|
-
l = placeHolders > 0 ? len - 4 : len;
|
|
12777
|
-
var L = 0;
|
|
12778
|
-
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
12779
|
-
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
12780
|
-
arr[L++] = tmp >> 16 & 0xFF;
|
|
12781
|
-
arr[L++] = tmp >> 8 & 0xFF;
|
|
12782
|
-
arr[L++] = tmp & 0xFF;
|
|
12783
|
-
}
|
|
12784
|
-
if (placeHolders === 2) {
|
|
12785
|
-
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
12786
|
-
arr[L++] = tmp & 0xFF;
|
|
12787
|
-
} else if (placeHolders === 1) {
|
|
12788
|
-
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
12789
|
-
arr[L++] = tmp >> 8 & 0xFF;
|
|
12790
|
-
arr[L++] = tmp & 0xFF;
|
|
12791
|
-
}
|
|
12792
|
-
return arr;
|
|
12793
|
-
}
|
|
12794
|
-
function tripletToBase64(num) {
|
|
12795
|
-
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
|
|
12796
|
-
}
|
|
12797
|
-
function encodeChunk(uint8, start, end) {
|
|
12798
|
-
var tmp;
|
|
12799
|
-
var output = [];
|
|
12800
|
-
for (var i = start; i < end; i += 3) {
|
|
12801
|
-
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
|
|
12802
|
-
output.push(tripletToBase64(tmp));
|
|
12803
|
-
}
|
|
12804
|
-
return output.join('');
|
|
12805
|
-
}
|
|
12806
|
-
function fromByteArray(uint8) {
|
|
12807
|
-
if (!inited) {
|
|
12808
|
-
init();
|
|
12809
|
-
}
|
|
12810
|
-
var tmp;
|
|
12811
|
-
var len = uint8.length;
|
|
12812
|
-
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
12813
|
-
var output = '';
|
|
12814
|
-
var parts = [];
|
|
12815
|
-
var maxChunkLength = 16383; // must be multiple of 3
|
|
12816
|
-
|
|
12817
|
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
12818
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
12819
|
-
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
12820
|
-
}
|
|
12821
|
-
|
|
12822
|
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
12823
|
-
if (extraBytes === 1) {
|
|
12824
|
-
tmp = uint8[len - 1];
|
|
12825
|
-
output += lookup[tmp >> 2];
|
|
12826
|
-
output += lookup[tmp << 4 & 0x3F];
|
|
12827
|
-
output += '==';
|
|
12828
|
-
} else if (extraBytes === 2) {
|
|
12829
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
12830
|
-
output += lookup[tmp >> 10];
|
|
12831
|
-
output += lookup[tmp >> 4 & 0x3F];
|
|
12832
|
-
output += lookup[tmp << 2 & 0x3F];
|
|
12833
|
-
output += '=';
|
|
12834
|
-
}
|
|
12835
|
-
parts.push(output);
|
|
12836
|
-
return parts.join('');
|
|
12837
|
-
}
|
|
12838
|
-
|
|
12839
|
-
function read(buffer, offset, isLE, mLen, nBytes) {
|
|
12840
|
-
var e, m;
|
|
12841
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
12842
|
-
var eMax = (1 << eLen) - 1;
|
|
12843
|
-
var eBias = eMax >> 1;
|
|
12844
|
-
var nBits = -7;
|
|
12845
|
-
var i = isLE ? nBytes - 1 : 0;
|
|
12846
|
-
var d = isLE ? -1 : 1;
|
|
12847
|
-
var s = buffer[offset + i];
|
|
12848
|
-
i += d;
|
|
12849
|
-
e = s & (1 << -nBits) - 1;
|
|
12850
|
-
s >>= -nBits;
|
|
12851
|
-
nBits += eLen;
|
|
12852
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12853
|
-
m = e & (1 << -nBits) - 1;
|
|
12854
|
-
e >>= -nBits;
|
|
12855
|
-
nBits += mLen;
|
|
12856
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12857
|
-
if (e === 0) {
|
|
12858
|
-
e = 1 - eBias;
|
|
12859
|
-
} else if (e === eMax) {
|
|
12860
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
12861
|
-
} else {
|
|
12862
|
-
m = m + Math.pow(2, mLen);
|
|
12863
|
-
e = e - eBias;
|
|
12864
|
-
}
|
|
12865
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
12866
|
-
}
|
|
12867
|
-
function write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
12868
|
-
var e, m, c;
|
|
12869
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
12870
|
-
var eMax = (1 << eLen) - 1;
|
|
12871
|
-
var eBias = eMax >> 1;
|
|
12872
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
12873
|
-
var i = isLE ? 0 : nBytes - 1;
|
|
12874
|
-
var d = isLE ? 1 : -1;
|
|
12875
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
12876
|
-
value = Math.abs(value);
|
|
12877
|
-
if (isNaN(value) || value === Infinity) {
|
|
12878
|
-
m = isNaN(value) ? 1 : 0;
|
|
12879
|
-
e = eMax;
|
|
12880
|
-
} else {
|
|
12881
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
12882
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
12883
|
-
e--;
|
|
12884
|
-
c *= 2;
|
|
12885
|
-
}
|
|
12886
|
-
if (e + eBias >= 1) {
|
|
12887
|
-
value += rt / c;
|
|
12888
|
-
} else {
|
|
12889
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
12890
|
-
}
|
|
12891
|
-
if (value * c >= 2) {
|
|
12892
|
-
e++;
|
|
12893
|
-
c /= 2;
|
|
12894
|
-
}
|
|
12895
|
-
if (e + eBias >= eMax) {
|
|
12896
|
-
m = 0;
|
|
12897
|
-
e = eMax;
|
|
12898
|
-
} else if (e + eBias >= 1) {
|
|
12899
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
12900
|
-
e = e + eBias;
|
|
12901
|
-
} else {
|
|
12902
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
12903
|
-
e = 0;
|
|
12904
|
-
}
|
|
12905
|
-
}
|
|
12906
|
-
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
12907
|
-
e = e << mLen | m;
|
|
12908
|
-
eLen += mLen;
|
|
12909
|
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
12910
|
-
buffer[offset + i - d] |= s * 128;
|
|
12911
|
-
}
|
|
12912
|
-
|
|
12913
|
-
var toString$1 = {}.toString;
|
|
12914
|
-
var isArray$1 = Array.isArray || function (arr) {
|
|
12915
|
-
return toString$1.call(arr) == '[object Array]';
|
|
12916
|
-
};
|
|
12917
|
-
|
|
12918
|
-
var INSPECT_MAX_BYTES = 50;
|
|
12919
|
-
|
|
12920
|
-
/**
|
|
12921
|
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
12922
|
-
* === true Use Uint8Array implementation (fastest)
|
|
12923
|
-
* === false Use Object implementation (most compatible, even IE6)
|
|
12924
|
-
*
|
|
12925
|
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
12926
|
-
* Opera 11.6+, iOS 4.2+.
|
|
12927
|
-
*
|
|
12928
|
-
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
12929
|
-
* when the browser supports typed arrays.
|
|
12930
|
-
*
|
|
12931
|
-
* Note:
|
|
12932
|
-
*
|
|
12933
|
-
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
12934
|
-
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
12935
|
-
*
|
|
12936
|
-
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
12937
|
-
*
|
|
12938
|
-
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
12939
|
-
* incorrect length in some situations.
|
|
12940
|
-
|
|
12941
|
-
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
12942
|
-
* get the Object implementation, which is slower but behaves correctly.
|
|
12943
|
-
*/
|
|
12944
|
-
Buffer$2.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
|
|
12945
|
-
|
|
12946
|
-
function kMaxLength() {
|
|
12947
|
-
return Buffer$2.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
|
|
12948
|
-
}
|
|
12949
|
-
function createBuffer(that, length) {
|
|
12950
|
-
if (kMaxLength() < length) {
|
|
12951
|
-
throw new RangeError('Invalid typed array length');
|
|
12952
|
-
}
|
|
12953
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
12954
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
12955
|
-
that = new Uint8Array(length);
|
|
12956
|
-
that.__proto__ = Buffer$2.prototype;
|
|
12957
|
-
} else {
|
|
12958
|
-
// Fallback: Return an object instance of the Buffer class
|
|
12959
|
-
if (that === null) {
|
|
12960
|
-
that = new Buffer$2(length);
|
|
12961
|
-
}
|
|
12962
|
-
that.length = length;
|
|
12963
|
-
}
|
|
12964
|
-
return that;
|
|
12965
|
-
}
|
|
12966
|
-
|
|
12967
|
-
/**
|
|
12968
|
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
12969
|
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
12970
|
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
12971
|
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
12972
|
-
* returns a single octet.
|
|
12973
|
-
*
|
|
12974
|
-
* The `Uint8Array` prototype remains unmodified.
|
|
12975
|
-
*/
|
|
12976
|
-
|
|
12977
|
-
function Buffer$2(arg, encodingOrOffset, length) {
|
|
12978
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$2)) {
|
|
12979
|
-
return new Buffer$2(arg, encodingOrOffset, length);
|
|
12980
|
-
}
|
|
12981
|
-
|
|
12982
|
-
// Common case.
|
|
12983
|
-
if (typeof arg === 'number') {
|
|
12984
|
-
if (typeof encodingOrOffset === 'string') {
|
|
12985
|
-
throw new Error('If encoding is specified then the first argument must be a string');
|
|
12986
|
-
}
|
|
12987
|
-
return allocUnsafe$1(this, arg);
|
|
12988
|
-
}
|
|
12989
|
-
return from(this, arg, encodingOrOffset, length);
|
|
12990
|
-
}
|
|
12991
|
-
Buffer$2.poolSize = 8192; // not used by this implementation
|
|
12992
|
-
|
|
12993
|
-
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
12994
|
-
Buffer$2._augment = function (arr) {
|
|
12995
|
-
arr.__proto__ = Buffer$2.prototype;
|
|
12996
|
-
return arr;
|
|
12997
|
-
};
|
|
12998
|
-
function from(that, value, encodingOrOffset, length) {
|
|
12999
|
-
if (typeof value === 'number') {
|
|
13000
|
-
throw new TypeError('"value" argument must not be a number');
|
|
13001
|
-
}
|
|
13002
|
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
13003
|
-
return fromArrayBuffer(that, value, encodingOrOffset, length);
|
|
13004
|
-
}
|
|
13005
|
-
if (typeof value === 'string') {
|
|
13006
|
-
return fromString(that, value, encodingOrOffset);
|
|
13007
|
-
}
|
|
13008
|
-
return fromObject(that, value);
|
|
13009
|
-
}
|
|
13010
|
-
|
|
13011
|
-
/**
|
|
13012
|
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
13013
|
-
* if value is a number.
|
|
13014
|
-
* Buffer.from(str[, encoding])
|
|
13015
|
-
* Buffer.from(array)
|
|
13016
|
-
* Buffer.from(buffer)
|
|
13017
|
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
13018
|
-
**/
|
|
13019
|
-
Buffer$2.from = function (value, encodingOrOffset, length) {
|
|
13020
|
-
return from(null, value, encodingOrOffset, length);
|
|
13021
|
-
};
|
|
13022
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13023
|
-
Buffer$2.prototype.__proto__ = Uint8Array.prototype;
|
|
13024
|
-
Buffer$2.__proto__ = Uint8Array;
|
|
13025
|
-
}
|
|
13026
|
-
function assertSize(size) {
|
|
13027
|
-
if (typeof size !== 'number') {
|
|
13028
|
-
throw new TypeError('"size" argument must be a number');
|
|
13029
|
-
} else if (size < 0) {
|
|
13030
|
-
throw new RangeError('"size" argument must not be negative');
|
|
13031
|
-
}
|
|
13032
|
-
}
|
|
13033
|
-
function alloc(that, size, fill, encoding) {
|
|
13034
|
-
assertSize(size);
|
|
13035
|
-
if (size <= 0) {
|
|
13036
|
-
return createBuffer(that, size);
|
|
13037
|
-
}
|
|
13038
|
-
if (fill !== undefined) {
|
|
13039
|
-
// Only pay attention to encoding if it's a string. This
|
|
13040
|
-
// prevents accidentally sending in a number that would
|
|
13041
|
-
// be interpretted as a start offset.
|
|
13042
|
-
return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
|
|
13043
|
-
}
|
|
13044
|
-
return createBuffer(that, size);
|
|
13045
|
-
}
|
|
13046
|
-
|
|
13047
|
-
/**
|
|
13048
|
-
* Creates a new filled Buffer instance.
|
|
13049
|
-
* alloc(size[, fill[, encoding]])
|
|
13050
|
-
**/
|
|
13051
|
-
Buffer$2.alloc = function (size, fill, encoding) {
|
|
13052
|
-
return alloc(null, size, fill, encoding);
|
|
13053
|
-
};
|
|
13054
|
-
function allocUnsafe$1(that, size) {
|
|
13055
|
-
assertSize(size);
|
|
13056
|
-
that = createBuffer(that, size < 0 ? 0 : checked$1(size) | 0);
|
|
13057
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13058
|
-
for (var i = 0; i < size; ++i) {
|
|
13059
|
-
that[i] = 0;
|
|
13060
|
-
}
|
|
13061
|
-
}
|
|
13062
|
-
return that;
|
|
13063
|
-
}
|
|
13064
|
-
|
|
13065
|
-
/**
|
|
13066
|
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13067
|
-
* */
|
|
13068
|
-
Buffer$2.allocUnsafe = function (size) {
|
|
13069
|
-
return allocUnsafe$1(null, size);
|
|
13070
|
-
};
|
|
13071
|
-
/**
|
|
13072
|
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13073
|
-
*/
|
|
13074
|
-
Buffer$2.allocUnsafeSlow = function (size) {
|
|
13075
|
-
return allocUnsafe$1(null, size);
|
|
13076
|
-
};
|
|
13077
|
-
function fromString(that, string, encoding) {
|
|
13078
|
-
if (typeof encoding !== 'string' || encoding === '') {
|
|
13079
|
-
encoding = 'utf8';
|
|
13080
|
-
}
|
|
13081
|
-
if (!Buffer$2.isEncoding(encoding)) {
|
|
13082
|
-
throw new TypeError('"encoding" must be a valid string encoding');
|
|
13083
|
-
}
|
|
13084
|
-
var length = byteLength(string, encoding) | 0;
|
|
13085
|
-
that = createBuffer(that, length);
|
|
13086
|
-
var actual = that.write(string, encoding);
|
|
13087
|
-
if (actual !== length) {
|
|
13088
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
13089
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
13090
|
-
// 'abxxcd' will be treated as 'ab')
|
|
13091
|
-
that = that.slice(0, actual);
|
|
13092
|
-
}
|
|
13093
|
-
return that;
|
|
13094
|
-
}
|
|
13095
|
-
function fromArrayLike(that, array) {
|
|
13096
|
-
var length = array.length < 0 ? 0 : checked$1(array.length) | 0;
|
|
13097
|
-
that = createBuffer(that, length);
|
|
13098
|
-
for (var i = 0; i < length; i += 1) {
|
|
13099
|
-
that[i] = array[i] & 255;
|
|
13100
|
-
}
|
|
13101
|
-
return that;
|
|
13102
|
-
}
|
|
13103
|
-
function fromArrayBuffer(that, array, byteOffset, length) {
|
|
13104
|
-
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
|
|
13105
|
-
|
|
13106
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
13107
|
-
throw new RangeError('\'offset\' is out of bounds');
|
|
13108
|
-
}
|
|
13109
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
13110
|
-
throw new RangeError('\'length\' is out of bounds');
|
|
13111
|
-
}
|
|
13112
|
-
if (byteOffset === undefined && length === undefined) {
|
|
13113
|
-
array = new Uint8Array(array);
|
|
13114
|
-
} else if (length === undefined) {
|
|
13115
|
-
array = new Uint8Array(array, byteOffset);
|
|
13116
|
-
} else {
|
|
13117
|
-
array = new Uint8Array(array, byteOffset, length);
|
|
13118
|
-
}
|
|
13119
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13120
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
13121
|
-
that = array;
|
|
13122
|
-
that.__proto__ = Buffer$2.prototype;
|
|
13123
|
-
} else {
|
|
13124
|
-
// Fallback: Return an object instance of the Buffer class
|
|
13125
|
-
that = fromArrayLike(that, array);
|
|
13126
|
-
}
|
|
13127
|
-
return that;
|
|
13128
|
-
}
|
|
13129
|
-
function fromObject(that, obj) {
|
|
13130
|
-
if (internalIsBuffer(obj)) {
|
|
13131
|
-
var len = checked$1(obj.length) | 0;
|
|
13132
|
-
that = createBuffer(that, len);
|
|
13133
|
-
if (that.length === 0) {
|
|
13134
|
-
return that;
|
|
13135
|
-
}
|
|
13136
|
-
obj.copy(that, 0, 0, len);
|
|
13137
|
-
return that;
|
|
13138
|
-
}
|
|
13139
|
-
if (obj) {
|
|
13140
|
-
if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
|
|
13141
|
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
13142
|
-
return createBuffer(that, 0);
|
|
13143
|
-
}
|
|
13144
|
-
return fromArrayLike(that, obj);
|
|
13145
|
-
}
|
|
13146
|
-
if (obj.type === 'Buffer' && isArray$1(obj.data)) {
|
|
13147
|
-
return fromArrayLike(that, obj.data);
|
|
13148
|
-
}
|
|
13149
|
-
}
|
|
13150
|
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
|
|
13151
|
-
}
|
|
13152
|
-
function checked$1(length) {
|
|
13153
|
-
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
13154
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
13155
|
-
if (length >= kMaxLength()) {
|
|
13156
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
|
|
13157
|
-
}
|
|
13158
|
-
return length | 0;
|
|
13159
|
-
}
|
|
13160
|
-
Buffer$2.isBuffer = isBuffer$1;
|
|
13161
|
-
function internalIsBuffer(b) {
|
|
13162
|
-
return !!(b != null && b._isBuffer);
|
|
13163
|
-
}
|
|
13164
|
-
Buffer$2.compare = function compare(a, b) {
|
|
13165
|
-
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
13166
|
-
throw new TypeError('Arguments must be Buffers');
|
|
13167
|
-
}
|
|
13168
|
-
if (a === b) return 0;
|
|
13169
|
-
var x = a.length;
|
|
13170
|
-
var y = b.length;
|
|
13171
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
13172
|
-
if (a[i] !== b[i]) {
|
|
13173
|
-
x = a[i];
|
|
13174
|
-
y = b[i];
|
|
13175
|
-
break;
|
|
13176
|
-
}
|
|
13177
|
-
}
|
|
13178
|
-
if (x < y) return -1;
|
|
13179
|
-
if (y < x) return 1;
|
|
13180
|
-
return 0;
|
|
13181
|
-
};
|
|
13182
|
-
Buffer$2.isEncoding = function isEncoding(encoding) {
|
|
13183
|
-
switch (String(encoding).toLowerCase()) {
|
|
13184
|
-
case 'hex':
|
|
13185
|
-
case 'utf8':
|
|
13186
|
-
case 'utf-8':
|
|
13187
|
-
case 'ascii':
|
|
13188
|
-
case 'latin1':
|
|
13189
|
-
case 'binary':
|
|
13190
|
-
case 'base64':
|
|
13191
|
-
case 'ucs2':
|
|
13192
|
-
case 'ucs-2':
|
|
13193
|
-
case 'utf16le':
|
|
13194
|
-
case 'utf-16le':
|
|
13195
|
-
return true;
|
|
13196
|
-
default:
|
|
13197
|
-
return false;
|
|
13198
|
-
}
|
|
13199
|
-
};
|
|
13200
|
-
Buffer$2.concat = function concat(list, length) {
|
|
13201
|
-
if (!isArray$1(list)) {
|
|
13202
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13203
|
-
}
|
|
13204
|
-
if (list.length === 0) {
|
|
13205
|
-
return Buffer$2.alloc(0);
|
|
13206
|
-
}
|
|
13207
|
-
var i;
|
|
13208
|
-
if (length === undefined) {
|
|
13209
|
-
length = 0;
|
|
13210
|
-
for (i = 0; i < list.length; ++i) {
|
|
13211
|
-
length += list[i].length;
|
|
13212
|
-
}
|
|
13213
|
-
}
|
|
13214
|
-
var buffer = Buffer$2.allocUnsafe(length);
|
|
13215
|
-
var pos = 0;
|
|
13216
|
-
for (i = 0; i < list.length; ++i) {
|
|
13217
|
-
var buf = list[i];
|
|
13218
|
-
if (!internalIsBuffer(buf)) {
|
|
13219
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13220
|
-
}
|
|
13221
|
-
buf.copy(buffer, pos);
|
|
13222
|
-
pos += buf.length;
|
|
13223
|
-
}
|
|
13224
|
-
return buffer;
|
|
13225
|
-
};
|
|
13226
|
-
function byteLength(string, encoding) {
|
|
13227
|
-
if (internalIsBuffer(string)) {
|
|
13228
|
-
return string.length;
|
|
13229
|
-
}
|
|
13230
|
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
13231
|
-
return string.byteLength;
|
|
13232
|
-
}
|
|
13233
|
-
if (typeof string !== 'string') {
|
|
13234
|
-
string = '' + string;
|
|
13235
|
-
}
|
|
13236
|
-
var len = string.length;
|
|
13237
|
-
if (len === 0) return 0;
|
|
13238
|
-
|
|
13239
|
-
// Use a for loop to avoid recursion
|
|
13240
|
-
var loweredCase = false;
|
|
13241
|
-
for (;;) {
|
|
13242
|
-
switch (encoding) {
|
|
13243
|
-
case 'ascii':
|
|
13244
|
-
case 'latin1':
|
|
13245
|
-
case 'binary':
|
|
13246
|
-
return len;
|
|
13247
|
-
case 'utf8':
|
|
13248
|
-
case 'utf-8':
|
|
13249
|
-
case undefined:
|
|
13250
|
-
return utf8ToBytes(string).length;
|
|
13251
|
-
case 'ucs2':
|
|
13252
|
-
case 'ucs-2':
|
|
13253
|
-
case 'utf16le':
|
|
13254
|
-
case 'utf-16le':
|
|
13255
|
-
return len * 2;
|
|
13256
|
-
case 'hex':
|
|
13257
|
-
return len >>> 1;
|
|
13258
|
-
case 'base64':
|
|
13259
|
-
return base64ToBytes(string).length;
|
|
13260
|
-
default:
|
|
13261
|
-
if (loweredCase) return utf8ToBytes(string).length; // assume utf8
|
|
13262
|
-
encoding = ('' + encoding).toLowerCase();
|
|
13263
|
-
loweredCase = true;
|
|
13264
|
-
}
|
|
13265
|
-
}
|
|
13266
|
-
}
|
|
13267
|
-
Buffer$2.byteLength = byteLength;
|
|
13268
|
-
function slowToString(encoding, start, end) {
|
|
13269
|
-
var loweredCase = false;
|
|
13270
|
-
|
|
13271
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
13272
|
-
// property of a typed array.
|
|
13273
|
-
|
|
13274
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
13275
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
13276
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
13277
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
13278
|
-
if (start === undefined || start < 0) {
|
|
13279
|
-
start = 0;
|
|
13280
|
-
}
|
|
13281
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
13282
|
-
// coercion fail below.
|
|
13283
|
-
if (start > this.length) {
|
|
13284
|
-
return '';
|
|
13285
|
-
}
|
|
13286
|
-
if (end === undefined || end > this.length) {
|
|
13287
|
-
end = this.length;
|
|
13288
|
-
}
|
|
13289
|
-
if (end <= 0) {
|
|
13290
|
-
return '';
|
|
13291
|
-
}
|
|
13292
|
-
|
|
13293
|
-
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
13294
|
-
end >>>= 0;
|
|
13295
|
-
start >>>= 0;
|
|
13296
|
-
if (end <= start) {
|
|
13297
|
-
return '';
|
|
13298
|
-
}
|
|
13299
|
-
if (!encoding) encoding = 'utf8';
|
|
13300
|
-
while (true) {
|
|
13301
|
-
switch (encoding) {
|
|
13302
|
-
case 'hex':
|
|
13303
|
-
return hexSlice(this, start, end);
|
|
13304
|
-
case 'utf8':
|
|
13305
|
-
case 'utf-8':
|
|
13306
|
-
return utf8Slice(this, start, end);
|
|
13307
|
-
case 'ascii':
|
|
13308
|
-
return asciiSlice(this, start, end);
|
|
13309
|
-
case 'latin1':
|
|
13310
|
-
case 'binary':
|
|
13311
|
-
return latin1Slice(this, start, end);
|
|
13312
|
-
case 'base64':
|
|
13313
|
-
return base64Slice(this, start, end);
|
|
13314
|
-
case 'ucs2':
|
|
13315
|
-
case 'ucs-2':
|
|
13316
|
-
case 'utf16le':
|
|
13317
|
-
case 'utf-16le':
|
|
13318
|
-
return utf16leSlice(this, start, end);
|
|
13319
|
-
default:
|
|
13320
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13321
|
-
encoding = (encoding + '').toLowerCase();
|
|
13322
|
-
loweredCase = true;
|
|
13323
|
-
}
|
|
13324
|
-
}
|
|
13325
|
-
}
|
|
13326
|
-
|
|
13327
|
-
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
13328
|
-
// Buffer instances.
|
|
13329
|
-
Buffer$2.prototype._isBuffer = true;
|
|
13330
|
-
function swap(b, n, m) {
|
|
13331
|
-
var i = b[n];
|
|
13332
|
-
b[n] = b[m];
|
|
13333
|
-
b[m] = i;
|
|
13334
|
-
}
|
|
13335
|
-
Buffer$2.prototype.swap16 = function swap16() {
|
|
13336
|
-
var len = this.length;
|
|
13337
|
-
if (len % 2 !== 0) {
|
|
13338
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits');
|
|
13339
|
-
}
|
|
13340
|
-
for (var i = 0; i < len; i += 2) {
|
|
13341
|
-
swap(this, i, i + 1);
|
|
13342
|
-
}
|
|
13343
|
-
return this;
|
|
13344
|
-
};
|
|
13345
|
-
Buffer$2.prototype.swap32 = function swap32() {
|
|
13346
|
-
var len = this.length;
|
|
13347
|
-
if (len % 4 !== 0) {
|
|
13348
|
-
throw new RangeError('Buffer size must be a multiple of 32-bits');
|
|
13349
|
-
}
|
|
13350
|
-
for (var i = 0; i < len; i += 4) {
|
|
13351
|
-
swap(this, i, i + 3);
|
|
13352
|
-
swap(this, i + 1, i + 2);
|
|
13353
|
-
}
|
|
13354
|
-
return this;
|
|
13355
|
-
};
|
|
13356
|
-
Buffer$2.prototype.swap64 = function swap64() {
|
|
13357
|
-
var len = this.length;
|
|
13358
|
-
if (len % 8 !== 0) {
|
|
13359
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits');
|
|
13360
|
-
}
|
|
13361
|
-
for (var i = 0; i < len; i += 8) {
|
|
13362
|
-
swap(this, i, i + 7);
|
|
13363
|
-
swap(this, i + 1, i + 6);
|
|
13364
|
-
swap(this, i + 2, i + 5);
|
|
13365
|
-
swap(this, i + 3, i + 4);
|
|
13366
|
-
}
|
|
13367
|
-
return this;
|
|
13368
|
-
};
|
|
13369
|
-
Buffer$2.prototype.toString = function toString() {
|
|
13370
|
-
var length = this.length | 0;
|
|
13371
|
-
if (length === 0) return '';
|
|
13372
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
13373
|
-
return slowToString.apply(this, arguments);
|
|
13374
|
-
};
|
|
13375
|
-
Buffer$2.prototype.equals = function equals(b) {
|
|
13376
|
-
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
|
|
13377
|
-
if (this === b) return true;
|
|
13378
|
-
return Buffer$2.compare(this, b) === 0;
|
|
13379
|
-
};
|
|
13380
|
-
Buffer$2.prototype.inspect = function inspect() {
|
|
13381
|
-
var str = '';
|
|
13382
|
-
var max = INSPECT_MAX_BYTES;
|
|
13383
|
-
if (this.length > 0) {
|
|
13384
|
-
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
|
|
13385
|
-
if (this.length > max) str += ' ... ';
|
|
13386
|
-
}
|
|
13387
|
-
return '<Buffer ' + str + '>';
|
|
13388
|
-
};
|
|
13389
|
-
Buffer$2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
13390
|
-
if (!internalIsBuffer(target)) {
|
|
13391
|
-
throw new TypeError('Argument must be a Buffer');
|
|
13392
|
-
}
|
|
13393
|
-
if (start === undefined) {
|
|
13394
|
-
start = 0;
|
|
13395
|
-
}
|
|
13396
|
-
if (end === undefined) {
|
|
13397
|
-
end = target ? target.length : 0;
|
|
13398
|
-
}
|
|
13399
|
-
if (thisStart === undefined) {
|
|
13400
|
-
thisStart = 0;
|
|
13401
|
-
}
|
|
13402
|
-
if (thisEnd === undefined) {
|
|
13403
|
-
thisEnd = this.length;
|
|
13404
|
-
}
|
|
13405
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
13406
|
-
throw new RangeError('out of range index');
|
|
13407
|
-
}
|
|
13408
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
13409
|
-
return 0;
|
|
13410
|
-
}
|
|
13411
|
-
if (thisStart >= thisEnd) {
|
|
13412
|
-
return -1;
|
|
13413
|
-
}
|
|
13414
|
-
if (start >= end) {
|
|
13415
|
-
return 1;
|
|
13416
|
-
}
|
|
13417
|
-
start >>>= 0;
|
|
13418
|
-
end >>>= 0;
|
|
13419
|
-
thisStart >>>= 0;
|
|
13420
|
-
thisEnd >>>= 0;
|
|
13421
|
-
if (this === target) return 0;
|
|
13422
|
-
var x = thisEnd - thisStart;
|
|
13423
|
-
var y = end - start;
|
|
13424
|
-
var len = Math.min(x, y);
|
|
13425
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
13426
|
-
var targetCopy = target.slice(start, end);
|
|
13427
|
-
for (var i = 0; i < len; ++i) {
|
|
13428
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
13429
|
-
x = thisCopy[i];
|
|
13430
|
-
y = targetCopy[i];
|
|
13431
|
-
break;
|
|
13432
|
-
}
|
|
13433
|
-
}
|
|
13434
|
-
if (x < y) return -1;
|
|
13435
|
-
if (y < x) return 1;
|
|
13436
|
-
return 0;
|
|
13437
|
-
};
|
|
13438
|
-
|
|
13439
|
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
13440
|
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
13441
|
-
//
|
|
13442
|
-
// Arguments:
|
|
13443
|
-
// - buffer - a Buffer to search
|
|
13444
|
-
// - val - a string, Buffer, or number
|
|
13445
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
13446
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
13447
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
13448
|
-
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
13449
|
-
// Empty buffer means no match
|
|
13450
|
-
if (buffer.length === 0) return -1;
|
|
13451
|
-
|
|
13452
|
-
// Normalize byteOffset
|
|
13453
|
-
if (typeof byteOffset === 'string') {
|
|
13454
|
-
encoding = byteOffset;
|
|
13455
|
-
byteOffset = 0;
|
|
13456
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
13457
|
-
byteOffset = 0x7fffffff;
|
|
13458
|
-
} else if (byteOffset < -0x80000000) {
|
|
13459
|
-
byteOffset = -0x80000000;
|
|
13460
|
-
}
|
|
13461
|
-
byteOffset = +byteOffset; // Coerce to Number.
|
|
13462
|
-
if (isNaN(byteOffset)) {
|
|
13463
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
13464
|
-
byteOffset = dir ? 0 : buffer.length - 1;
|
|
13465
|
-
}
|
|
13466
|
-
|
|
13467
|
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
13468
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
13469
|
-
if (byteOffset >= buffer.length) {
|
|
13470
|
-
if (dir) return -1;else byteOffset = buffer.length - 1;
|
|
13471
|
-
} else if (byteOffset < 0) {
|
|
13472
|
-
if (dir) byteOffset = 0;else return -1;
|
|
13473
|
-
}
|
|
13474
|
-
|
|
13475
|
-
// Normalize val
|
|
13476
|
-
if (typeof val === 'string') {
|
|
13477
|
-
val = Buffer$2.from(val, encoding);
|
|
13478
|
-
}
|
|
13479
|
-
|
|
13480
|
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
13481
|
-
if (internalIsBuffer(val)) {
|
|
13482
|
-
// Special case: looking for empty string/buffer always fails
|
|
13483
|
-
if (val.length === 0) {
|
|
13484
|
-
return -1;
|
|
13485
|
-
}
|
|
13486
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
13487
|
-
} else if (typeof val === 'number') {
|
|
13488
|
-
val = val & 0xFF; // Search for a byte value [0-255]
|
|
13489
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
|
|
13490
|
-
if (dir) {
|
|
13491
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
13492
|
-
} else {
|
|
13493
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
13494
|
-
}
|
|
13495
|
-
}
|
|
13496
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
13497
|
-
}
|
|
13498
|
-
throw new TypeError('val must be string, number or Buffer');
|
|
13499
|
-
}
|
|
13500
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
13501
|
-
var indexSize = 1;
|
|
13502
|
-
var arrLength = arr.length;
|
|
13503
|
-
var valLength = val.length;
|
|
13504
|
-
if (encoding !== undefined) {
|
|
13505
|
-
encoding = String(encoding).toLowerCase();
|
|
13506
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
13507
|
-
if (arr.length < 2 || val.length < 2) {
|
|
13508
|
-
return -1;
|
|
13509
|
-
}
|
|
13510
|
-
indexSize = 2;
|
|
13511
|
-
arrLength /= 2;
|
|
13512
|
-
valLength /= 2;
|
|
13513
|
-
byteOffset /= 2;
|
|
13514
|
-
}
|
|
13515
|
-
}
|
|
13516
|
-
function read(buf, i) {
|
|
13517
|
-
if (indexSize === 1) {
|
|
13518
|
-
return buf[i];
|
|
13519
|
-
} else {
|
|
13520
|
-
return buf.readUInt16BE(i * indexSize);
|
|
13521
|
-
}
|
|
13522
|
-
}
|
|
13523
|
-
var i;
|
|
13524
|
-
if (dir) {
|
|
13525
|
-
var foundIndex = -1;
|
|
13526
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
13527
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
13528
|
-
if (foundIndex === -1) foundIndex = i;
|
|
13529
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
13530
|
-
} else {
|
|
13531
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
13532
|
-
foundIndex = -1;
|
|
13533
|
-
}
|
|
13534
|
-
}
|
|
13535
|
-
} else {
|
|
13536
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
13537
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
13538
|
-
var found = true;
|
|
13539
|
-
for (var j = 0; j < valLength; j++) {
|
|
13540
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
13541
|
-
found = false;
|
|
13542
|
-
break;
|
|
13543
|
-
}
|
|
13544
|
-
}
|
|
13545
|
-
if (found) return i;
|
|
13546
|
-
}
|
|
13547
|
-
}
|
|
13548
|
-
return -1;
|
|
13549
|
-
}
|
|
13550
|
-
Buffer$2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
13551
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
13552
|
-
};
|
|
13553
|
-
Buffer$2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
13554
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
13555
|
-
};
|
|
13556
|
-
Buffer$2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
13557
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
13558
|
-
};
|
|
13559
|
-
function hexWrite(buf, string, offset, length) {
|
|
13560
|
-
offset = Number(offset) || 0;
|
|
13561
|
-
var remaining = buf.length - offset;
|
|
13562
|
-
if (!length) {
|
|
13563
|
-
length = remaining;
|
|
13564
|
-
} else {
|
|
13565
|
-
length = Number(length);
|
|
13566
|
-
if (length > remaining) {
|
|
13567
|
-
length = remaining;
|
|
13568
|
-
}
|
|
13569
|
-
}
|
|
13570
|
-
|
|
13571
|
-
// must be an even number of digits
|
|
13572
|
-
var strLen = string.length;
|
|
13573
|
-
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
|
|
13574
|
-
if (length > strLen / 2) {
|
|
13575
|
-
length = strLen / 2;
|
|
13576
|
-
}
|
|
13577
|
-
for (var i = 0; i < length; ++i) {
|
|
13578
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
13579
|
-
if (isNaN(parsed)) return i;
|
|
13580
|
-
buf[offset + i] = parsed;
|
|
13581
|
-
}
|
|
13582
|
-
return i;
|
|
13583
|
-
}
|
|
13584
|
-
function utf8Write(buf, string, offset, length) {
|
|
13585
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
13586
|
-
}
|
|
13587
|
-
function asciiWrite(buf, string, offset, length) {
|
|
13588
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
13589
|
-
}
|
|
13590
|
-
function latin1Write(buf, string, offset, length) {
|
|
13591
|
-
return asciiWrite(buf, string, offset, length);
|
|
13592
|
-
}
|
|
13593
|
-
function base64Write(buf, string, offset, length) {
|
|
13594
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
13595
|
-
}
|
|
13596
|
-
function ucs2Write(buf, string, offset, length) {
|
|
13597
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
13598
|
-
}
|
|
13599
|
-
Buffer$2.prototype.write = function write(string, offset, length, encoding) {
|
|
13600
|
-
// Buffer#write(string)
|
|
13601
|
-
if (offset === undefined) {
|
|
13602
|
-
encoding = 'utf8';
|
|
13603
|
-
length = this.length;
|
|
13604
|
-
offset = 0;
|
|
13605
|
-
// Buffer#write(string, encoding)
|
|
13606
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
13607
|
-
encoding = offset;
|
|
13608
|
-
length = this.length;
|
|
13609
|
-
offset = 0;
|
|
13610
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
13611
|
-
} else if (isFinite(offset)) {
|
|
13612
|
-
offset = offset | 0;
|
|
13613
|
-
if (isFinite(length)) {
|
|
13614
|
-
length = length | 0;
|
|
13615
|
-
if (encoding === undefined) encoding = 'utf8';
|
|
13616
|
-
} else {
|
|
13617
|
-
encoding = length;
|
|
13618
|
-
length = undefined;
|
|
13619
|
-
}
|
|
13620
|
-
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
13621
|
-
} else {
|
|
13622
|
-
throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
|
|
13623
|
-
}
|
|
13624
|
-
var remaining = this.length - offset;
|
|
13625
|
-
if (length === undefined || length > remaining) length = remaining;
|
|
13626
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
13627
|
-
throw new RangeError('Attempt to write outside buffer bounds');
|
|
13628
|
-
}
|
|
13629
|
-
if (!encoding) encoding = 'utf8';
|
|
13630
|
-
var loweredCase = false;
|
|
13631
|
-
for (;;) {
|
|
13632
|
-
switch (encoding) {
|
|
13633
|
-
case 'hex':
|
|
13634
|
-
return hexWrite(this, string, offset, length);
|
|
13635
|
-
case 'utf8':
|
|
13636
|
-
case 'utf-8':
|
|
13637
|
-
return utf8Write(this, string, offset, length);
|
|
13638
|
-
case 'ascii':
|
|
13639
|
-
return asciiWrite(this, string, offset, length);
|
|
13640
|
-
case 'latin1':
|
|
13641
|
-
case 'binary':
|
|
13642
|
-
return latin1Write(this, string, offset, length);
|
|
13643
|
-
case 'base64':
|
|
13644
|
-
// Warning: maxLength not taken into account in base64Write
|
|
13645
|
-
return base64Write(this, string, offset, length);
|
|
13646
|
-
case 'ucs2':
|
|
13647
|
-
case 'ucs-2':
|
|
13648
|
-
case 'utf16le':
|
|
13649
|
-
case 'utf-16le':
|
|
13650
|
-
return ucs2Write(this, string, offset, length);
|
|
13651
|
-
default:
|
|
13652
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13653
|
-
encoding = ('' + encoding).toLowerCase();
|
|
13654
|
-
loweredCase = true;
|
|
13655
|
-
}
|
|
13656
|
-
}
|
|
13657
|
-
};
|
|
13658
|
-
Buffer$2.prototype.toJSON = function toJSON() {
|
|
13659
|
-
return {
|
|
13660
|
-
type: 'Buffer',
|
|
13661
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
13662
|
-
};
|
|
13663
|
-
};
|
|
13664
|
-
function base64Slice(buf, start, end) {
|
|
13665
|
-
if (start === 0 && end === buf.length) {
|
|
13666
|
-
return fromByteArray(buf);
|
|
13667
|
-
} else {
|
|
13668
|
-
return fromByteArray(buf.slice(start, end));
|
|
13669
|
-
}
|
|
13670
|
-
}
|
|
13671
|
-
function utf8Slice(buf, start, end) {
|
|
13672
|
-
end = Math.min(buf.length, end);
|
|
13673
|
-
var res = [];
|
|
13674
|
-
var i = start;
|
|
13675
|
-
while (i < end) {
|
|
13676
|
-
var firstByte = buf[i];
|
|
13677
|
-
var codePoint = null;
|
|
13678
|
-
var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
|
|
13679
|
-
if (i + bytesPerSequence <= end) {
|
|
13680
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
13681
|
-
switch (bytesPerSequence) {
|
|
13682
|
-
case 1:
|
|
13683
|
-
if (firstByte < 0x80) {
|
|
13684
|
-
codePoint = firstByte;
|
|
13685
|
-
}
|
|
13686
|
-
break;
|
|
13687
|
-
case 2:
|
|
13688
|
-
secondByte = buf[i + 1];
|
|
13689
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
13690
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
|
|
13691
|
-
if (tempCodePoint > 0x7F) {
|
|
13692
|
-
codePoint = tempCodePoint;
|
|
13693
|
-
}
|
|
13694
|
-
}
|
|
13695
|
-
break;
|
|
13696
|
-
case 3:
|
|
13697
|
-
secondByte = buf[i + 1];
|
|
13698
|
-
thirdByte = buf[i + 2];
|
|
13699
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
13700
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
|
|
13701
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
13702
|
-
codePoint = tempCodePoint;
|
|
13703
|
-
}
|
|
13704
|
-
}
|
|
13705
|
-
break;
|
|
13706
|
-
case 4:
|
|
13707
|
-
secondByte = buf[i + 1];
|
|
13708
|
-
thirdByte = buf[i + 2];
|
|
13709
|
-
fourthByte = buf[i + 3];
|
|
13710
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
13711
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
|
|
13712
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
13713
|
-
codePoint = tempCodePoint;
|
|
13714
|
-
}
|
|
13715
|
-
}
|
|
13716
|
-
}
|
|
13717
|
-
}
|
|
13718
|
-
if (codePoint === null) {
|
|
13719
|
-
// we did not generate a valid codePoint so insert a
|
|
13720
|
-
// replacement char (U+FFFD) and advance only 1 byte
|
|
13721
|
-
codePoint = 0xFFFD;
|
|
13722
|
-
bytesPerSequence = 1;
|
|
13723
|
-
} else if (codePoint > 0xFFFF) {
|
|
13724
|
-
// encode to utf16 (surrogate pair dance)
|
|
13725
|
-
codePoint -= 0x10000;
|
|
13726
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
13727
|
-
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
13728
|
-
}
|
|
13729
|
-
res.push(codePoint);
|
|
13730
|
-
i += bytesPerSequence;
|
|
13731
|
-
}
|
|
13732
|
-
return decodeCodePointsArray(res);
|
|
13733
|
-
}
|
|
13734
|
-
|
|
13735
|
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
13736
|
-
// the lowest limit is Chrome, with 0x10000 args.
|
|
13737
|
-
// We go 1 magnitude less, for safety
|
|
13738
|
-
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
13739
|
-
function decodeCodePointsArray(codePoints) {
|
|
13740
|
-
var len = codePoints.length;
|
|
13741
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
13742
|
-
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
|
|
13743
|
-
}
|
|
13744
|
-
|
|
13745
|
-
// Decode in chunks to avoid "call stack size exceeded".
|
|
13746
|
-
var res = '';
|
|
13747
|
-
var i = 0;
|
|
13748
|
-
while (i < len) {
|
|
13749
|
-
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
|
|
13750
|
-
}
|
|
13751
|
-
return res;
|
|
13752
|
-
}
|
|
13753
|
-
function asciiSlice(buf, start, end) {
|
|
13754
|
-
var ret = '';
|
|
13755
|
-
end = Math.min(buf.length, end);
|
|
13756
|
-
for (var i = start; i < end; ++i) {
|
|
13757
|
-
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
13758
|
-
}
|
|
13759
|
-
return ret;
|
|
13760
|
-
}
|
|
13761
|
-
function latin1Slice(buf, start, end) {
|
|
13762
|
-
var ret = '';
|
|
13763
|
-
end = Math.min(buf.length, end);
|
|
13764
|
-
for (var i = start; i < end; ++i) {
|
|
13765
|
-
ret += String.fromCharCode(buf[i]);
|
|
13766
|
-
}
|
|
13767
|
-
return ret;
|
|
13768
|
-
}
|
|
13769
|
-
function hexSlice(buf, start, end) {
|
|
13770
|
-
var len = buf.length;
|
|
13771
|
-
if (!start || start < 0) start = 0;
|
|
13772
|
-
if (!end || end < 0 || end > len) end = len;
|
|
13773
|
-
var out = '';
|
|
13774
|
-
for (var i = start; i < end; ++i) {
|
|
13775
|
-
out += toHex(buf[i]);
|
|
13776
|
-
}
|
|
13777
|
-
return out;
|
|
13778
|
-
}
|
|
13779
|
-
function utf16leSlice(buf, start, end) {
|
|
13780
|
-
var bytes = buf.slice(start, end);
|
|
13781
|
-
var res = '';
|
|
13782
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
13783
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
13784
|
-
}
|
|
13785
|
-
return res;
|
|
13786
|
-
}
|
|
13787
|
-
Buffer$2.prototype.slice = function slice(start, end) {
|
|
13788
|
-
var len = this.length;
|
|
13789
|
-
start = ~~start;
|
|
13790
|
-
end = end === undefined ? len : ~~end;
|
|
13791
|
-
if (start < 0) {
|
|
13792
|
-
start += len;
|
|
13793
|
-
if (start < 0) start = 0;
|
|
13794
|
-
} else if (start > len) {
|
|
13795
|
-
start = len;
|
|
13796
|
-
}
|
|
13797
|
-
if (end < 0) {
|
|
13798
|
-
end += len;
|
|
13799
|
-
if (end < 0) end = 0;
|
|
13800
|
-
} else if (end > len) {
|
|
13801
|
-
end = len;
|
|
13802
|
-
}
|
|
13803
|
-
if (end < start) end = start;
|
|
13804
|
-
var newBuf;
|
|
13805
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13806
|
-
newBuf = this.subarray(start, end);
|
|
13807
|
-
newBuf.__proto__ = Buffer$2.prototype;
|
|
13808
|
-
} else {
|
|
13809
|
-
var sliceLen = end - start;
|
|
13810
|
-
newBuf = new Buffer$2(sliceLen, undefined);
|
|
13811
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
13812
|
-
newBuf[i] = this[i + start];
|
|
13813
|
-
}
|
|
13814
|
-
}
|
|
13815
|
-
return newBuf;
|
|
13816
|
-
};
|
|
13817
|
-
|
|
13818
|
-
/*
|
|
13819
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
13820
|
-
*/
|
|
13821
|
-
function checkOffset(offset, ext, length) {
|
|
13822
|
-
if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
|
|
13823
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
|
|
13824
|
-
}
|
|
13825
|
-
Buffer$2.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
|
|
13826
|
-
offset = offset | 0;
|
|
13827
|
-
byteLength = byteLength | 0;
|
|
13828
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13829
|
-
var val = this[offset];
|
|
13830
|
-
var mul = 1;
|
|
13831
|
-
var i = 0;
|
|
13832
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13833
|
-
val += this[offset + i] * mul;
|
|
13834
|
-
}
|
|
13835
|
-
return val;
|
|
13836
|
-
};
|
|
13837
|
-
Buffer$2.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
|
|
13838
|
-
offset = offset | 0;
|
|
13839
|
-
byteLength = byteLength | 0;
|
|
13840
|
-
if (!noAssert) {
|
|
13841
|
-
checkOffset(offset, byteLength, this.length);
|
|
13842
|
-
}
|
|
13843
|
-
var val = this[offset + --byteLength];
|
|
13844
|
-
var mul = 1;
|
|
13845
|
-
while (byteLength > 0 && (mul *= 0x100)) {
|
|
13846
|
-
val += this[offset + --byteLength] * mul;
|
|
13847
|
-
}
|
|
13848
|
-
return val;
|
|
13849
|
-
};
|
|
13850
|
-
Buffer$2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
13851
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13852
|
-
return this[offset];
|
|
13853
|
-
};
|
|
13854
|
-
Buffer$2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
13855
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13856
|
-
return this[offset] | this[offset + 1] << 8;
|
|
13857
|
-
};
|
|
13858
|
-
Buffer$2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
13859
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13860
|
-
return this[offset] << 8 | this[offset + 1];
|
|
13861
|
-
};
|
|
13862
|
-
Buffer$2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
13863
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13864
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
|
|
13865
|
-
};
|
|
13866
|
-
Buffer$2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
13867
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13868
|
-
return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
13869
|
-
};
|
|
13870
|
-
Buffer$2.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
|
|
13871
|
-
offset = offset | 0;
|
|
13872
|
-
byteLength = byteLength | 0;
|
|
13873
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13874
|
-
var val = this[offset];
|
|
13875
|
-
var mul = 1;
|
|
13876
|
-
var i = 0;
|
|
13877
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13878
|
-
val += this[offset + i] * mul;
|
|
13879
|
-
}
|
|
13880
|
-
mul *= 0x80;
|
|
13881
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13882
|
-
return val;
|
|
13883
|
-
};
|
|
13884
|
-
Buffer$2.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
|
|
13885
|
-
offset = offset | 0;
|
|
13886
|
-
byteLength = byteLength | 0;
|
|
13887
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13888
|
-
var i = byteLength;
|
|
13889
|
-
var mul = 1;
|
|
13890
|
-
var val = this[offset + --i];
|
|
13891
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
13892
|
-
val += this[offset + --i] * mul;
|
|
13893
|
-
}
|
|
13894
|
-
mul *= 0x80;
|
|
13895
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13896
|
-
return val;
|
|
13897
|
-
};
|
|
13898
|
-
Buffer$2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
13899
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13900
|
-
if (!(this[offset] & 0x80)) return this[offset];
|
|
13901
|
-
return (0xff - this[offset] + 1) * -1;
|
|
13902
|
-
};
|
|
13903
|
-
Buffer$2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
13904
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13905
|
-
var val = this[offset] | this[offset + 1] << 8;
|
|
13906
|
-
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
13907
|
-
};
|
|
13908
|
-
Buffer$2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
13909
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13910
|
-
var val = this[offset + 1] | this[offset] << 8;
|
|
13911
|
-
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
13912
|
-
};
|
|
13913
|
-
Buffer$2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
13914
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13915
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
13916
|
-
};
|
|
13917
|
-
Buffer$2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
13918
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13919
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
13920
|
-
};
|
|
13921
|
-
Buffer$2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
13922
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13923
|
-
return read(this, offset, true, 23, 4);
|
|
13924
|
-
};
|
|
13925
|
-
Buffer$2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
13926
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13927
|
-
return read(this, offset, false, 23, 4);
|
|
13928
|
-
};
|
|
13929
|
-
Buffer$2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
13930
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
13931
|
-
return read(this, offset, true, 52, 8);
|
|
13932
|
-
};
|
|
13933
|
-
Buffer$2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
13934
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
13935
|
-
return read(this, offset, false, 52, 8);
|
|
13936
|
-
};
|
|
13937
|
-
function checkInt(buf, value, offset, ext, max, min) {
|
|
13938
|
-
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
13939
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
13940
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
13941
|
-
}
|
|
13942
|
-
Buffer$2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
|
|
13943
|
-
value = +value;
|
|
13944
|
-
offset = offset | 0;
|
|
13945
|
-
byteLength = byteLength | 0;
|
|
13946
|
-
if (!noAssert) {
|
|
13947
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
13948
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
13949
|
-
}
|
|
13950
|
-
var mul = 1;
|
|
13951
|
-
var i = 0;
|
|
13952
|
-
this[offset] = value & 0xFF;
|
|
13953
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13954
|
-
this[offset + i] = value / mul & 0xFF;
|
|
13955
|
-
}
|
|
13956
|
-
return offset + byteLength;
|
|
13957
|
-
};
|
|
13958
|
-
Buffer$2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
|
|
13959
|
-
value = +value;
|
|
13960
|
-
offset = offset | 0;
|
|
13961
|
-
byteLength = byteLength | 0;
|
|
13962
|
-
if (!noAssert) {
|
|
13963
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
13964
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
13965
|
-
}
|
|
13966
|
-
var i = byteLength - 1;
|
|
13967
|
-
var mul = 1;
|
|
13968
|
-
this[offset + i] = value & 0xFF;
|
|
13969
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
13970
|
-
this[offset + i] = value / mul & 0xFF;
|
|
13971
|
-
}
|
|
13972
|
-
return offset + byteLength;
|
|
13973
|
-
};
|
|
13974
|
-
Buffer$2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
13975
|
-
value = +value;
|
|
13976
|
-
offset = offset | 0;
|
|
13977
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
13978
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
13979
|
-
this[offset] = value & 0xff;
|
|
13980
|
-
return offset + 1;
|
|
13981
|
-
};
|
|
13982
|
-
function objectWriteUInt16(buf, value, offset, littleEndian) {
|
|
13983
|
-
if (value < 0) value = 0xffff + value + 1;
|
|
13984
|
-
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
13985
|
-
buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
|
|
13986
|
-
}
|
|
13987
|
-
}
|
|
13988
|
-
Buffer$2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
13989
|
-
value = +value;
|
|
13990
|
-
offset = offset | 0;
|
|
13991
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
13992
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13993
|
-
this[offset] = value & 0xff;
|
|
13994
|
-
this[offset + 1] = value >>> 8;
|
|
13995
|
-
} else {
|
|
13996
|
-
objectWriteUInt16(this, value, offset, true);
|
|
13997
|
-
}
|
|
13998
|
-
return offset + 2;
|
|
13999
|
-
};
|
|
14000
|
-
Buffer$2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
14001
|
-
value = +value;
|
|
14002
|
-
offset = offset | 0;
|
|
14003
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
14004
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14005
|
-
this[offset] = value >>> 8;
|
|
14006
|
-
this[offset + 1] = value & 0xff;
|
|
14007
|
-
} else {
|
|
14008
|
-
objectWriteUInt16(this, value, offset, false);
|
|
14009
|
-
}
|
|
14010
|
-
return offset + 2;
|
|
14011
|
-
};
|
|
14012
|
-
function objectWriteUInt32(buf, value, offset, littleEndian) {
|
|
14013
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
14014
|
-
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
14015
|
-
buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
|
|
14016
|
-
}
|
|
14017
|
-
}
|
|
14018
|
-
Buffer$2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
14019
|
-
value = +value;
|
|
14020
|
-
offset = offset | 0;
|
|
14021
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
14022
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14023
|
-
this[offset + 3] = value >>> 24;
|
|
14024
|
-
this[offset + 2] = value >>> 16;
|
|
14025
|
-
this[offset + 1] = value >>> 8;
|
|
14026
|
-
this[offset] = value & 0xff;
|
|
14027
|
-
} else {
|
|
14028
|
-
objectWriteUInt32(this, value, offset, true);
|
|
14029
|
-
}
|
|
14030
|
-
return offset + 4;
|
|
14031
|
-
};
|
|
14032
|
-
Buffer$2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
14033
|
-
value = +value;
|
|
14034
|
-
offset = offset | 0;
|
|
14035
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
14036
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14037
|
-
this[offset] = value >>> 24;
|
|
14038
|
-
this[offset + 1] = value >>> 16;
|
|
14039
|
-
this[offset + 2] = value >>> 8;
|
|
14040
|
-
this[offset + 3] = value & 0xff;
|
|
14041
|
-
} else {
|
|
14042
|
-
objectWriteUInt32(this, value, offset, false);
|
|
14043
|
-
}
|
|
14044
|
-
return offset + 4;
|
|
14045
|
-
};
|
|
14046
|
-
Buffer$2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
|
|
14047
|
-
value = +value;
|
|
14048
|
-
offset = offset | 0;
|
|
14049
|
-
if (!noAssert) {
|
|
14050
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14051
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14052
|
-
}
|
|
14053
|
-
var i = 0;
|
|
14054
|
-
var mul = 1;
|
|
14055
|
-
var sub = 0;
|
|
14056
|
-
this[offset] = value & 0xFF;
|
|
14057
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
14058
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
14059
|
-
sub = 1;
|
|
14060
|
-
}
|
|
14061
|
-
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14062
|
-
}
|
|
14063
|
-
return offset + byteLength;
|
|
14064
|
-
};
|
|
14065
|
-
Buffer$2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
|
|
14066
|
-
value = +value;
|
|
14067
|
-
offset = offset | 0;
|
|
14068
|
-
if (!noAssert) {
|
|
14069
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14070
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14071
|
-
}
|
|
14072
|
-
var i = byteLength - 1;
|
|
14073
|
-
var mul = 1;
|
|
14074
|
-
var sub = 0;
|
|
14075
|
-
this[offset + i] = value & 0xFF;
|
|
14076
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
14077
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
14078
|
-
sub = 1;
|
|
14079
|
-
}
|
|
14080
|
-
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14081
|
-
}
|
|
14082
|
-
return offset + byteLength;
|
|
14083
|
-
};
|
|
14084
|
-
Buffer$2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
14085
|
-
value = +value;
|
|
14086
|
-
offset = offset | 0;
|
|
14087
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
|
|
14088
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
14089
|
-
if (value < 0) value = 0xff + value + 1;
|
|
14090
|
-
this[offset] = value & 0xff;
|
|
14091
|
-
return offset + 1;
|
|
14092
|
-
};
|
|
14093
|
-
Buffer$2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
14094
|
-
value = +value;
|
|
14095
|
-
offset = offset | 0;
|
|
14096
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14097
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14098
|
-
this[offset] = value & 0xff;
|
|
14099
|
-
this[offset + 1] = value >>> 8;
|
|
14100
|
-
} else {
|
|
14101
|
-
objectWriteUInt16(this, value, offset, true);
|
|
14102
|
-
}
|
|
14103
|
-
return offset + 2;
|
|
14104
|
-
};
|
|
14105
|
-
Buffer$2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
14106
|
-
value = +value;
|
|
14107
|
-
offset = offset | 0;
|
|
14108
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14109
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14110
|
-
this[offset] = value >>> 8;
|
|
14111
|
-
this[offset + 1] = value & 0xff;
|
|
14112
|
-
} else {
|
|
14113
|
-
objectWriteUInt16(this, value, offset, false);
|
|
14114
|
-
}
|
|
14115
|
-
return offset + 2;
|
|
14116
|
-
};
|
|
14117
|
-
Buffer$2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
14118
|
-
value = +value;
|
|
14119
|
-
offset = offset | 0;
|
|
14120
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14121
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14122
|
-
this[offset] = value & 0xff;
|
|
14123
|
-
this[offset + 1] = value >>> 8;
|
|
14124
|
-
this[offset + 2] = value >>> 16;
|
|
14125
|
-
this[offset + 3] = value >>> 24;
|
|
14126
|
-
} else {
|
|
14127
|
-
objectWriteUInt32(this, value, offset, true);
|
|
14128
|
-
}
|
|
14129
|
-
return offset + 4;
|
|
14130
|
-
};
|
|
14131
|
-
Buffer$2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
14132
|
-
value = +value;
|
|
14133
|
-
offset = offset | 0;
|
|
14134
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14135
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
14136
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14137
|
-
this[offset] = value >>> 24;
|
|
14138
|
-
this[offset + 1] = value >>> 16;
|
|
14139
|
-
this[offset + 2] = value >>> 8;
|
|
14140
|
-
this[offset + 3] = value & 0xff;
|
|
14141
|
-
} else {
|
|
14142
|
-
objectWriteUInt32(this, value, offset, false);
|
|
14143
|
-
}
|
|
14144
|
-
return offset + 4;
|
|
14145
|
-
};
|
|
14146
|
-
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
14147
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
14148
|
-
if (offset < 0) throw new RangeError('Index out of range');
|
|
14149
|
-
}
|
|
14150
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
14151
|
-
if (!noAssert) {
|
|
14152
|
-
checkIEEE754(buf, value, offset, 4);
|
|
14153
|
-
}
|
|
14154
|
-
write(buf, value, offset, littleEndian, 23, 4);
|
|
14155
|
-
return offset + 4;
|
|
14156
|
-
}
|
|
14157
|
-
Buffer$2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
14158
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
14159
|
-
};
|
|
14160
|
-
Buffer$2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
14161
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
14162
|
-
};
|
|
14163
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
14164
|
-
if (!noAssert) {
|
|
14165
|
-
checkIEEE754(buf, value, offset, 8);
|
|
14166
|
-
}
|
|
14167
|
-
write(buf, value, offset, littleEndian, 52, 8);
|
|
14168
|
-
return offset + 8;
|
|
14169
|
-
}
|
|
14170
|
-
Buffer$2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
14171
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
14172
|
-
};
|
|
14173
|
-
Buffer$2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
14174
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
14175
|
-
};
|
|
14176
|
-
|
|
14177
|
-
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
14178
|
-
Buffer$2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
14179
|
-
if (!start) start = 0;
|
|
14180
|
-
if (!end && end !== 0) end = this.length;
|
|
14181
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
14182
|
-
if (!targetStart) targetStart = 0;
|
|
14183
|
-
if (end > 0 && end < start) end = start;
|
|
14184
|
-
|
|
14185
|
-
// Copy 0 bytes; we're done
|
|
14186
|
-
if (end === start) return 0;
|
|
14187
|
-
if (target.length === 0 || this.length === 0) return 0;
|
|
14188
|
-
|
|
14189
|
-
// Fatal error conditions
|
|
14190
|
-
if (targetStart < 0) {
|
|
14191
|
-
throw new RangeError('targetStart out of bounds');
|
|
14192
|
-
}
|
|
14193
|
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
|
|
14194
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds');
|
|
14195
|
-
|
|
14196
|
-
// Are we oob?
|
|
14197
|
-
if (end > this.length) end = this.length;
|
|
14198
|
-
if (target.length - targetStart < end - start) {
|
|
14199
|
-
end = target.length - targetStart + start;
|
|
14200
|
-
}
|
|
14201
|
-
var len = end - start;
|
|
14202
|
-
var i;
|
|
14203
|
-
if (this === target && start < targetStart && targetStart < end) {
|
|
14204
|
-
// descending copy from end
|
|
14205
|
-
for (i = len - 1; i >= 0; --i) {
|
|
14206
|
-
target[i + targetStart] = this[i + start];
|
|
14207
|
-
}
|
|
14208
|
-
} else if (len < 1000 || !Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14209
|
-
// ascending copy from start
|
|
14210
|
-
for (i = 0; i < len; ++i) {
|
|
14211
|
-
target[i + targetStart] = this[i + start];
|
|
14212
|
-
}
|
|
14213
|
-
} else {
|
|
14214
|
-
Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
|
|
14215
|
-
}
|
|
14216
|
-
return len;
|
|
14217
|
-
};
|
|
14218
|
-
|
|
14219
|
-
// Usage:
|
|
14220
|
-
// buffer.fill(number[, offset[, end]])
|
|
14221
|
-
// buffer.fill(buffer[, offset[, end]])
|
|
14222
|
-
// buffer.fill(string[, offset[, end]][, encoding])
|
|
14223
|
-
Buffer$2.prototype.fill = function fill(val, start, end, encoding) {
|
|
14224
|
-
// Handle string cases:
|
|
14225
|
-
if (typeof val === 'string') {
|
|
14226
|
-
if (typeof start === 'string') {
|
|
14227
|
-
encoding = start;
|
|
14228
|
-
start = 0;
|
|
14229
|
-
end = this.length;
|
|
14230
|
-
} else if (typeof end === 'string') {
|
|
14231
|
-
encoding = end;
|
|
14232
|
-
end = this.length;
|
|
14233
|
-
}
|
|
14234
|
-
if (val.length === 1) {
|
|
14235
|
-
var code = val.charCodeAt(0);
|
|
14236
|
-
if (code < 256) {
|
|
14237
|
-
val = code;
|
|
14238
|
-
}
|
|
14239
|
-
}
|
|
14240
|
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
14241
|
-
throw new TypeError('encoding must be a string');
|
|
14242
|
-
}
|
|
14243
|
-
if (typeof encoding === 'string' && !Buffer$2.isEncoding(encoding)) {
|
|
14244
|
-
throw new TypeError('Unknown encoding: ' + encoding);
|
|
14245
|
-
}
|
|
14246
|
-
} else if (typeof val === 'number') {
|
|
14247
|
-
val = val & 255;
|
|
14248
|
-
}
|
|
14249
|
-
|
|
14250
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
14251
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
14252
|
-
throw new RangeError('Out of range index');
|
|
14253
|
-
}
|
|
14254
|
-
if (end <= start) {
|
|
14255
|
-
return this;
|
|
14256
|
-
}
|
|
14257
|
-
start = start >>> 0;
|
|
14258
|
-
end = end === undefined ? this.length : end >>> 0;
|
|
14259
|
-
if (!val) val = 0;
|
|
14260
|
-
var i;
|
|
14261
|
-
if (typeof val === 'number') {
|
|
14262
|
-
for (i = start; i < end; ++i) {
|
|
14263
|
-
this[i] = val;
|
|
14264
|
-
}
|
|
14265
|
-
} else {
|
|
14266
|
-
var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer$2(val, encoding).toString());
|
|
14267
|
-
var len = bytes.length;
|
|
14268
|
-
for (i = 0; i < end - start; ++i) {
|
|
14269
|
-
this[i + start] = bytes[i % len];
|
|
14270
|
-
}
|
|
14271
|
-
}
|
|
14272
|
-
return this;
|
|
14273
|
-
};
|
|
14274
|
-
|
|
14275
|
-
// HELPER FUNCTIONS
|
|
14276
|
-
// ================
|
|
14277
|
-
|
|
14278
|
-
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
14279
|
-
function base64clean(str) {
|
|
14280
|
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
14281
|
-
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
|
|
14282
|
-
// Node converts strings with length < 2 to ''
|
|
14283
|
-
if (str.length < 2) return '';
|
|
14284
|
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
14285
|
-
while (str.length % 4 !== 0) {
|
|
14286
|
-
str = str + '=';
|
|
14287
|
-
}
|
|
14288
|
-
return str;
|
|
14289
|
-
}
|
|
14290
|
-
function stringtrim(str) {
|
|
14291
|
-
if (str.trim) return str.trim();
|
|
14292
|
-
return str.replace(/^\s+|\s+$/g, '');
|
|
14293
|
-
}
|
|
14294
|
-
function toHex(n) {
|
|
14295
|
-
if (n < 16) return '0' + n.toString(16);
|
|
14296
|
-
return n.toString(16);
|
|
14297
|
-
}
|
|
14298
|
-
function utf8ToBytes(string, units) {
|
|
14299
|
-
units = units || Infinity;
|
|
14300
|
-
var codePoint;
|
|
14301
|
-
var length = string.length;
|
|
14302
|
-
var leadSurrogate = null;
|
|
14303
|
-
var bytes = [];
|
|
14304
|
-
for (var i = 0; i < length; ++i) {
|
|
14305
|
-
codePoint = string.charCodeAt(i);
|
|
14306
|
-
|
|
14307
|
-
// is surrogate component
|
|
14308
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
14309
|
-
// last char was a lead
|
|
14310
|
-
if (!leadSurrogate) {
|
|
14311
|
-
// no lead yet
|
|
14312
|
-
if (codePoint > 0xDBFF) {
|
|
14313
|
-
// unexpected trail
|
|
14314
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14315
|
-
continue;
|
|
14316
|
-
} else if (i + 1 === length) {
|
|
14317
|
-
// unpaired lead
|
|
14318
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14319
|
-
continue;
|
|
14320
|
-
}
|
|
14321
|
-
|
|
14322
|
-
// valid lead
|
|
14323
|
-
leadSurrogate = codePoint;
|
|
14324
|
-
continue;
|
|
14325
|
-
}
|
|
14326
|
-
|
|
14327
|
-
// 2 leads in a row
|
|
14328
|
-
if (codePoint < 0xDC00) {
|
|
14329
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14330
|
-
leadSurrogate = codePoint;
|
|
14331
|
-
continue;
|
|
14332
|
-
}
|
|
14333
|
-
|
|
14334
|
-
// valid surrogate pair
|
|
14335
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
14336
|
-
} else if (leadSurrogate) {
|
|
14337
|
-
// valid bmp char, but last char was a lead
|
|
14338
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14339
|
-
}
|
|
14340
|
-
leadSurrogate = null;
|
|
14341
|
-
|
|
14342
|
-
// encode utf8
|
|
14343
|
-
if (codePoint < 0x80) {
|
|
14344
|
-
if ((units -= 1) < 0) break;
|
|
14345
|
-
bytes.push(codePoint);
|
|
14346
|
-
} else if (codePoint < 0x800) {
|
|
14347
|
-
if ((units -= 2) < 0) break;
|
|
14348
|
-
bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
|
|
14349
|
-
} else if (codePoint < 0x10000) {
|
|
14350
|
-
if ((units -= 3) < 0) break;
|
|
14351
|
-
bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14352
|
-
} else if (codePoint < 0x110000) {
|
|
14353
|
-
if ((units -= 4) < 0) break;
|
|
14354
|
-
bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14355
|
-
} else {
|
|
14356
|
-
throw new Error('Invalid code point');
|
|
14357
|
-
}
|
|
14358
|
-
}
|
|
14359
|
-
return bytes;
|
|
14360
|
-
}
|
|
14361
|
-
function asciiToBytes(str) {
|
|
14362
|
-
var byteArray = [];
|
|
14363
|
-
for (var i = 0; i < str.length; ++i) {
|
|
14364
|
-
// Node's code seems to be doing this and not & 0x7F..
|
|
14365
|
-
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
14366
|
-
}
|
|
14367
|
-
return byteArray;
|
|
14368
|
-
}
|
|
14369
|
-
function utf16leToBytes(str, units) {
|
|
14370
|
-
var c, hi, lo;
|
|
14371
|
-
var byteArray = [];
|
|
14372
|
-
for (var i = 0; i < str.length; ++i) {
|
|
14373
|
-
if ((units -= 2) < 0) break;
|
|
14374
|
-
c = str.charCodeAt(i);
|
|
14375
|
-
hi = c >> 8;
|
|
14376
|
-
lo = c % 256;
|
|
14377
|
-
byteArray.push(lo);
|
|
14378
|
-
byteArray.push(hi);
|
|
14379
|
-
}
|
|
14380
|
-
return byteArray;
|
|
14381
|
-
}
|
|
14382
|
-
function base64ToBytes(str) {
|
|
14383
|
-
return toByteArray(base64clean(str));
|
|
14384
|
-
}
|
|
14385
|
-
function blitBuffer(src, dst, offset, length) {
|
|
14386
|
-
for (var i = 0; i < length; ++i) {
|
|
14387
|
-
if (i + offset >= dst.length || i >= src.length) break;
|
|
14388
|
-
dst[i + offset] = src[i];
|
|
14389
|
-
}
|
|
14390
|
-
return i;
|
|
14391
|
-
}
|
|
14392
|
-
function isnan(val) {
|
|
14393
|
-
return val !== val; // eslint-disable-line no-self-compare
|
|
14394
|
-
}
|
|
14395
|
-
|
|
14396
|
-
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
|
14397
|
-
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|
14398
|
-
// Object.prototype.constructor. Remove this eventually
|
|
14399
|
-
function isBuffer$1(obj) {
|
|
14400
|
-
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
|
|
14401
|
-
}
|
|
14402
|
-
function isFastBuffer(obj) {
|
|
14403
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
|
|
14404
|
-
}
|
|
14405
|
-
|
|
14406
|
-
// For Node v0.10 support. Remove this eventually.
|
|
14407
|
-
function isSlowBuffer(obj) {
|
|
14408
|
-
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
|
|
14409
|
-
}
|
|
14410
|
-
|
|
14411
12763
|
/**
|
|
14412
12764
|
* return an decoded URL Safe Base64 as UTF-8 encoded string
|
|
14413
12765
|
*/
|
|
@@ -14415,8 +12767,8 @@ function decodeBase64UrlSafe(base64) {
|
|
|
14415
12767
|
// Add removed at end '='
|
|
14416
12768
|
// base64 += Array(5 - base64.length % 4).join('=');
|
|
14417
12769
|
|
|
14418
|
-
base64 = base64.replace(
|
|
14419
|
-
.replace(
|
|
12770
|
+
base64 = base64.replace(/-/g, '+') // Convert '-' to '+'
|
|
12771
|
+
.replace(/_/g, '/'); // Convert '_' to '/'
|
|
14420
12772
|
|
|
14421
12773
|
return decodeBase64(base64); // Cf: https://developer.mozilla.org/fr/docs/D%C3%A9coder_encoder_en_base64
|
|
14422
12774
|
}
|
|
@@ -14672,6 +13024,7 @@ function createClient(creationConfig) {
|
|
|
14672
13024
|
})["catch"](console.error);
|
|
14673
13025
|
});
|
|
14674
13026
|
return {
|
|
13027
|
+
core: coreClient,
|
|
14675
13028
|
showAuth: function showAuth(options) {
|
|
14676
13029
|
return client.then(function (client) {
|
|
14677
13030
|
return client.showAuth(options);
|