@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/es/identity-ui.js
CHANGED
|
@@ -8,11 +8,13 @@ import styled, { keyframes, css } from 'styled-components';
|
|
|
8
8
|
import { Transition } from 'react-transition-group';
|
|
9
9
|
import classes from 'classnames';
|
|
10
10
|
import { Remarkable } from 'remarkable';
|
|
11
|
-
import validator, {
|
|
11
|
+
import validator, { isNumeric, isISO8601 } from 'validator';
|
|
12
12
|
import { isValidNumber, AsYouType, format as format$1, parse } from 'libphonenumber-js';
|
|
13
13
|
import { isEqual } from 'lodash-es';
|
|
14
|
+
import { DateTime } from 'luxon';
|
|
14
15
|
import { isLower, isUpper, isDigit } from 'char-info';
|
|
15
16
|
import zxcvbn from '@reachfive/zxcvbn';
|
|
17
|
+
import 'Buffer';
|
|
16
18
|
|
|
17
19
|
function ownKeys(object, enumerableOnly) {
|
|
18
20
|
var keys = Object.keys(object);
|
|
@@ -2816,7 +2818,13 @@ var UserError = /*#__PURE__*/function (_Error) {
|
|
|
2816
2818
|
_this.isUserError = true;
|
|
2817
2819
|
return _this;
|
|
2818
2820
|
}
|
|
2819
|
-
|
|
2821
|
+
_createClass(UserError, null, [{
|
|
2822
|
+
key: "fromAppError",
|
|
2823
|
+
value: function fromAppError(appError) {
|
|
2824
|
+
return new UserError(appError.errorUserMsg || appError.errorDescription || appError.error);
|
|
2825
|
+
}
|
|
2826
|
+
}]);
|
|
2827
|
+
return UserError;
|
|
2820
2828
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
2821
2829
|
|
|
2822
2830
|
/** `Object#toString` result references. */
|
|
@@ -3399,6 +3407,7 @@ function get(object, path, defaultValue) {
|
|
|
3399
3407
|
return result === undefined ? defaultValue : result;
|
|
3400
3408
|
}
|
|
3401
3409
|
|
|
3410
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3402
3411
|
var white = '#fff';
|
|
3403
3412
|
var gray200 = '#e9ecef';
|
|
3404
3413
|
var gray400 = '#ced4da';
|
|
@@ -3406,6 +3415,8 @@ var gray500 = '#adb5bd';
|
|
|
3406
3415
|
var gray600 = '#868e96';
|
|
3407
3416
|
var gray700 = '#495057';
|
|
3408
3417
|
var gray900 = '#212529';
|
|
3418
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
3419
|
+
|
|
3409
3420
|
var inputBtnFocusBoxShadow = function inputBtnFocusBoxShadow(borderColor) {
|
|
3410
3421
|
return "0 0 0 3px ".concat(transparentize(0.5, borderColor));
|
|
3411
3422
|
};
|
|
@@ -3796,7 +3807,7 @@ var WidgetContent = styled(function (_ref) {
|
|
|
3796
3807
|
}, function (props) {
|
|
3797
3808
|
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 ");
|
|
3798
3809
|
});
|
|
3799
|
-
|
|
3810
|
+
function widgetContainer(_ref2) {
|
|
3800
3811
|
var name = _ref2.name,
|
|
3801
3812
|
_ref2$standalone = _ref2.standalone,
|
|
3802
3813
|
standalone = _ref2$standalone === void 0 ? true : _ref2$standalone,
|
|
@@ -3818,7 +3829,7 @@ var WidgetContainer = (function (_ref2) {
|
|
|
3818
3829
|
transition: state
|
|
3819
3830
|
}, title && /*#__PURE__*/React__default.createElement(Heading, null, title), !noIntro && intro && /*#__PURE__*/React__default.createElement(Intro, null, intro), children);
|
|
3820
3831
|
});
|
|
3821
|
-
}
|
|
3832
|
+
}
|
|
3822
3833
|
|
|
3823
3834
|
var _excluded = ["component", "prepare"],
|
|
3824
3835
|
_excluded2 = ["i18n", "theme"],
|
|
@@ -3851,7 +3862,7 @@ function createWidget(_ref) {
|
|
|
3851
3862
|
i18n: resolveI18n(context.defaultI18n, i18n),
|
|
3852
3863
|
theme: resolveTheme(theme)
|
|
3853
3864
|
});
|
|
3854
|
-
return /*#__PURE__*/React__default.createElement(
|
|
3865
|
+
return /*#__PURE__*/React__default.createElement(widgetContainer, _extends({}, widgetAttrs, fullProps), /*#__PURE__*/React__default.createElement(Component, fullProps));
|
|
3855
3866
|
});
|
|
3856
3867
|
};
|
|
3857
3868
|
}
|
|
@@ -3873,11 +3884,11 @@ function multiViewWidget(_ref3) {
|
|
|
3873
3884
|
onStartup = _ref3.onStartup,
|
|
3874
3885
|
handlers = _ref3.handlers;
|
|
3875
3886
|
return _class = /*#__PURE__*/function (_React$Component) {
|
|
3876
|
-
_inherits(
|
|
3877
|
-
var _super = _createSuper(
|
|
3878
|
-
function
|
|
3887
|
+
_inherits(MultiViewWidget, _React$Component);
|
|
3888
|
+
var _super = _createSuper(MultiViewWidget);
|
|
3889
|
+
function MultiViewWidget() {
|
|
3879
3890
|
var _this;
|
|
3880
|
-
_classCallCheck(this,
|
|
3891
|
+
_classCallCheck(this, MultiViewWidget);
|
|
3881
3892
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3882
3893
|
args[_key] = arguments[_key];
|
|
3883
3894
|
}
|
|
@@ -3895,7 +3906,7 @@ function multiViewWidget(_ref3) {
|
|
|
3895
3906
|
});
|
|
3896
3907
|
return _this;
|
|
3897
3908
|
}
|
|
3898
|
-
_createClass(
|
|
3909
|
+
_createClass(MultiViewWidget, [{
|
|
3899
3910
|
key: "getChildContext",
|
|
3900
3911
|
value: function getChildContext() {
|
|
3901
3912
|
return {
|
|
@@ -3917,7 +3928,7 @@ function multiViewWidget(_ref3) {
|
|
|
3917
3928
|
}));
|
|
3918
3929
|
}
|
|
3919
3930
|
}]);
|
|
3920
|
-
return
|
|
3931
|
+
return MultiViewWidget;
|
|
3921
3932
|
}(React__default.Component), _defineProperty(_class, "childContextTypes", {
|
|
3922
3933
|
goTo: PropTypes.func.isRequired
|
|
3923
3934
|
}), _class;
|
|
@@ -4117,7 +4128,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
4117
4128
|
}
|
|
4118
4129
|
|
|
4119
4130
|
/** Built-in value references. */
|
|
4120
|
-
var Uint8Array
|
|
4131
|
+
var Uint8Array = root.Uint8Array;
|
|
4121
4132
|
|
|
4122
4133
|
/**
|
|
4123
4134
|
* Converts `map` to its key-value pairs.
|
|
@@ -4182,7 +4193,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
4182
4193
|
object = object.buffer;
|
|
4183
4194
|
other = other.buffer;
|
|
4184
4195
|
case arrayBufferTag:
|
|
4185
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array
|
|
4196
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
4186
4197
|
return false;
|
|
4187
4198
|
}
|
|
4188
4199
|
return true;
|
|
@@ -6515,7 +6526,7 @@ var SocialButton = withTheme(function (_ref3) {
|
|
|
6515
6526
|
textVisible: textVisible,
|
|
6516
6527
|
width: width,
|
|
6517
6528
|
height: height,
|
|
6518
|
-
onClick: function onClick(
|
|
6529
|
+
onClick: function onClick() {
|
|
6519
6530
|
return _onClick(provider.key);
|
|
6520
6531
|
}
|
|
6521
6532
|
}, /*#__PURE__*/React__default.createElement(SocialButtonIcon, {
|
|
@@ -6529,18 +6540,21 @@ var SocialButtons = styled(function (_ref4) {
|
|
|
6529
6540
|
className = _ref4.className;
|
|
6530
6541
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
6531
6542
|
className: classes(['r5-social-buttons', className])
|
|
6532
|
-
}, providers.
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6543
|
+
}, providers.flatMap(function (providerKey) {
|
|
6544
|
+
var _providerKey$split = providerKey.split(':'),
|
|
6545
|
+
_providerKey$split2 = _slicedToArray(_providerKey$split, 1),
|
|
6546
|
+
providerName = _providerKey$split2[0];
|
|
6547
|
+
if (providerName === 'bconnect' && queryParams['bconnectActivation'] !== 'true') return [];else if (socialButtons[providerName] === undefined) {
|
|
6548
|
+
console.error("".concat(providerName, " provider not found."));
|
|
6549
|
+
return [];
|
|
6550
|
+
} else return [/*#__PURE__*/React__default.createElement(SocialButton, {
|
|
6551
|
+
provider: socialButtons[providerName],
|
|
6540
6552
|
count: providers.length,
|
|
6541
|
-
onClick:
|
|
6553
|
+
onClick: function onClick() {
|
|
6554
|
+
return clickHandler(providerKey);
|
|
6555
|
+
},
|
|
6542
6556
|
key: providerKey
|
|
6543
|
-
});
|
|
6557
|
+
})];
|
|
6544
6558
|
}));
|
|
6545
6559
|
})(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n text-align: center;\n ", "\n"])), function (props) {
|
|
6546
6560
|
return props.theme.get('socialButton.inline') && 'margin: 0 -4px';
|
|
@@ -7299,7 +7313,7 @@ function formatISO8601Date(year, month, day) {
|
|
|
7299
7313
|
return null;
|
|
7300
7314
|
}
|
|
7301
7315
|
function specializeIdentifierData(data) {
|
|
7302
|
-
return
|
|
7316
|
+
return data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
7303
7317
|
identifier: undefined
|
|
7304
7318
|
}, isValidEmail(data.identifier) ? {
|
|
7305
7319
|
email: data.identifier
|
|
@@ -7346,7 +7360,7 @@ var Validator = /*#__PURE__*/function () {
|
|
|
7346
7360
|
parameters = _ref$parameters === void 0 ? [] : _ref$parameters;
|
|
7347
7361
|
_classCallCheck(this, Validator);
|
|
7348
7362
|
this.rule = rule;
|
|
7349
|
-
this.hint = !isFunction(hint) ? function (
|
|
7363
|
+
this.hint = !isFunction(hint) ? function () {
|
|
7350
7364
|
return hint;
|
|
7351
7365
|
} : hint;
|
|
7352
7366
|
this.parameters = parameters;
|
|
@@ -7620,8 +7634,7 @@ var createField = function createField(_ref) {
|
|
|
7620
7634
|
return mapping.unbind(model, format.unbind(value));
|
|
7621
7635
|
},
|
|
7622
7636
|
validate: function validate(_ref5, ctx) {
|
|
7623
|
-
var value = _ref5.value
|
|
7624
|
-
isDirty = _ref5.isDirty;
|
|
7637
|
+
var value = _ref5.value;
|
|
7625
7638
|
return required$1 || isValued(value) ? fullValidator(value, ctx) : {};
|
|
7626
7639
|
}
|
|
7627
7640
|
};
|
|
@@ -7812,7 +7825,7 @@ function initCloneArray(array) {
|
|
|
7812
7825
|
*/
|
|
7813
7826
|
function cloneArrayBuffer(arrayBuffer) {
|
|
7814
7827
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
7815
|
-
new Uint8Array
|
|
7828
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
7816
7829
|
return result;
|
|
7817
7830
|
}
|
|
7818
7831
|
|
|
@@ -8277,7 +8290,7 @@ var omit = flatRest(function (object, paths) {
|
|
|
8277
8290
|
});
|
|
8278
8291
|
|
|
8279
8292
|
var _excluded$2 = ["options", "placeholder"],
|
|
8280
|
-
_excluded2$1 = ["options", "onChange", "value", "
|
|
8293
|
+
_excluded2$1 = ["options", "onChange", "value", "inputId"];
|
|
8281
8294
|
var _templateObject$5, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8, _templateObject9, _templateObject10;
|
|
8282
8295
|
var errorFadeIn = keyframes(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n"])));
|
|
8283
8296
|
var FormError = withTheme(styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n padding-top: 3px;\n animation: ", " 0.3s both;\n color: ", ";\n"])), errorFadeIn, function (props) {
|
|
@@ -8404,7 +8417,6 @@ var RadioGroup = function RadioGroup(_ref6) {
|
|
|
8404
8417
|
var options = _ref6.options,
|
|
8405
8418
|
onChange = _ref6.onChange,
|
|
8406
8419
|
value = _ref6.value,
|
|
8407
|
-
name = _ref6.name,
|
|
8408
8420
|
inputId = _ref6.inputId,
|
|
8409
8421
|
props = _objectWithoutProperties(_ref6, _excluded2$1);
|
|
8410
8422
|
var handleChange = function handleChange(event) {
|
|
@@ -8611,13 +8623,13 @@ function checkboxField(config) {
|
|
|
8611
8623
|
*/
|
|
8612
8624
|
|
|
8613
8625
|
function specializeRawIdentifier(withPhoneNumber, inputValue) {
|
|
8614
|
-
var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (
|
|
8626
|
+
var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
8615
8627
|
return undefined;
|
|
8616
8628
|
};
|
|
8617
|
-
var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (
|
|
8629
|
+
var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
|
|
8618
8630
|
return undefined;
|
|
8619
8631
|
};
|
|
8620
|
-
var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (
|
|
8632
|
+
var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
8621
8633
|
return undefined;
|
|
8622
8634
|
};
|
|
8623
8635
|
if (withPhoneNumber && /^\+?[0-9]+$/.test(inputValue)) {
|
|
@@ -8686,7 +8698,9 @@ var IdentifierField = /*#__PURE__*/function (_React$Component) {
|
|
|
8686
8698
|
var parsed = parse(userInput, country);
|
|
8687
8699
|
var phoneValue = country === parsed.country ? format$1(parsed, 'National') : userInput;
|
|
8688
8700
|
this.asYouType(phoneValue);
|
|
8689
|
-
} catch (e) {
|
|
8701
|
+
} catch (e) {
|
|
8702
|
+
console.error(e);
|
|
8703
|
+
}
|
|
8690
8704
|
}
|
|
8691
8705
|
}, {
|
|
8692
8706
|
key: "componentWillUnmount",
|
|
@@ -8747,17 +8761,17 @@ function identifierField(props, config) {
|
|
|
8747
8761
|
label: 'identifier',
|
|
8748
8762
|
format: {
|
|
8749
8763
|
bind: function bind(x) {
|
|
8750
|
-
return specializeRawIdentifier(props.withPhoneNumber, x, function (
|
|
8764
|
+
return specializeRawIdentifier(props.withPhoneNumber, x, function () {
|
|
8751
8765
|
return {
|
|
8752
8766
|
country: config.countryCode,
|
|
8753
8767
|
isValid: true
|
|
8754
8768
|
};
|
|
8755
|
-
}, function (
|
|
8769
|
+
}, function () {
|
|
8756
8770
|
return {
|
|
8757
8771
|
country: config.countryCode,
|
|
8758
8772
|
isValid: true
|
|
8759
8773
|
};
|
|
8760
|
-
}, function (
|
|
8774
|
+
}, function () {
|
|
8761
8775
|
return {
|
|
8762
8776
|
country: config.countryCode,
|
|
8763
8777
|
isValid: true
|
|
@@ -8785,11 +8799,11 @@ function identifierField(props, config) {
|
|
|
8785
8799
|
});
|
|
8786
8800
|
},
|
|
8787
8801
|
hint: function hint(value) {
|
|
8788
|
-
return specializeRefinedIdentifier(value, function (
|
|
8802
|
+
return specializeRefinedIdentifier(value, function () {
|
|
8789
8803
|
return 'phone';
|
|
8790
|
-
}, function (
|
|
8804
|
+
}, function () {
|
|
8791
8805
|
return 'email';
|
|
8792
|
-
}, function (
|
|
8806
|
+
}, function () {
|
|
8793
8807
|
return 'identifier';
|
|
8794
8808
|
});
|
|
8795
8809
|
}
|
|
@@ -8953,8 +8967,7 @@ var LoginForm = createForm({
|
|
|
8953
8967
|
defaultIdentifier = _ref.defaultIdentifier,
|
|
8954
8968
|
i18n = _ref.i18n,
|
|
8955
8969
|
config = _ref.config,
|
|
8956
|
-
allowCustomIdentifier = _ref.allowCustomIdentifier
|
|
8957
|
-
customIdentifierLabel = _ref.customIdentifierLabel;
|
|
8970
|
+
allowCustomIdentifier = _ref.allowCustomIdentifier;
|
|
8958
8971
|
return [showIdentifier && config.sms ? identifierField({
|
|
8959
8972
|
defaultValue: defaultIdentifier,
|
|
8960
8973
|
withPhoneNumber: true,
|
|
@@ -9030,8 +9043,7 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9030
9043
|
_this$props$session = _this$props.session,
|
|
9031
9044
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9032
9045
|
i18n = _this$props.i18n,
|
|
9033
|
-
allowCustomIdentifier = _this$props.allowCustomIdentifier
|
|
9034
|
-
customIdentifierLabel = _this$props.customIdentifierLabel;
|
|
9046
|
+
allowCustomIdentifier = _this$props.allowCustomIdentifier;
|
|
9035
9047
|
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9036
9048
|
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, {
|
|
9037
9049
|
providers: socialProviders,
|
|
@@ -9731,25 +9743,15 @@ var BirthdateField = function BirthdateField(props) {
|
|
|
9731
9743
|
"data-testid": "".concat(BIRTHDAY_PATH, ".year")
|
|
9732
9744
|
}))));
|
|
9733
9745
|
};
|
|
9734
|
-
var
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
return 'birthdate.dayOfMonth';
|
|
9742
|
-
};
|
|
9743
|
-
var validateYear = function validateYear(year) {
|
|
9744
|
-
if (isNumeric(year)) {
|
|
9745
|
-
var yearNbr = parseInt(year);
|
|
9746
|
-
var currentYear = new Date().getFullYear();
|
|
9747
|
-
var age = currentYear - yearNbr;
|
|
9748
|
-
if (age > 5 && age < 130) {
|
|
9749
|
-
return false;
|
|
9750
|
-
}
|
|
9746
|
+
var validateLimitAge = function validateLimitAge(day, month, year) {
|
|
9747
|
+
var yearNbr = parseInt(year, 10);
|
|
9748
|
+
var dayNbr = parseInt(day, 10);
|
|
9749
|
+
var monthNbr = parseInt(month, 10);
|
|
9750
|
+
var age = DateTime.now().diff(DateTime.local(yearNbr, monthNbr, dayNbr), "years").years;
|
|
9751
|
+
if (age < 6 || age > 129) {
|
|
9752
|
+
return 'birthdate.yearLimit';
|
|
9751
9753
|
}
|
|
9752
|
-
return
|
|
9754
|
+
return false;
|
|
9753
9755
|
};
|
|
9754
9756
|
var format = function format(_ref3) {
|
|
9755
9757
|
var day = _ref3.day,
|
|
@@ -9831,25 +9833,15 @@ function birthdateField(_ref4) {
|
|
|
9831
9833
|
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, field, true));
|
|
9832
9834
|
}, {})) : {};
|
|
9833
9835
|
}
|
|
9834
|
-
if (isSubmitted || day.isDirty) {
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
error: i18n("validation.".concat(dayError)),
|
|
9839
|
-
day: true
|
|
9840
|
-
};
|
|
9841
|
-
}
|
|
9842
|
-
}
|
|
9843
|
-
if (isSubmitted || year.isDirty) {
|
|
9844
|
-
var yearError = validateYear(year.value);
|
|
9845
|
-
if (yearError) {
|
|
9836
|
+
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9837
|
+
if (!isNumeric(year.value.toString()) || !DateTime.fromObject({
|
|
9838
|
+
year: parseInt(year.value, 10)
|
|
9839
|
+
}).isValid) {
|
|
9846
9840
|
return {
|
|
9847
|
-
error: i18n("validation."
|
|
9841
|
+
error: i18n("validation.birthdate.year"),
|
|
9848
9842
|
year: true
|
|
9849
9843
|
};
|
|
9850
9844
|
}
|
|
9851
|
-
}
|
|
9852
|
-
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9853
9845
|
var birthdate = format(state);
|
|
9854
9846
|
if (!birthdate || !isISO8601(birthdate)) {
|
|
9855
9847
|
return {
|
|
@@ -9857,6 +9849,22 @@ function birthdateField(_ref4) {
|
|
|
9857
9849
|
day: true
|
|
9858
9850
|
};
|
|
9859
9851
|
}
|
|
9852
|
+
if (!(isNumeric(month.value.toString()) && isNumeric(day.value.toString())) || !DateTime.fromObject({
|
|
9853
|
+
year: year.value,
|
|
9854
|
+
month: month.value,
|
|
9855
|
+
day: day.value
|
|
9856
|
+
}).isValid) {
|
|
9857
|
+
return {
|
|
9858
|
+
error: i18n("validation.birthdate.dayOfMonth"),
|
|
9859
|
+
day: true
|
|
9860
|
+
};
|
|
9861
|
+
}
|
|
9862
|
+
var limitAge = validateLimitAge(day.value, month.value, year.value);
|
|
9863
|
+
if (limitAge) {
|
|
9864
|
+
return {
|
|
9865
|
+
error: i18n("validation.".concat(limitAge))
|
|
9866
|
+
};
|
|
9867
|
+
}
|
|
9860
9868
|
}
|
|
9861
9869
|
return {};
|
|
9862
9870
|
}
|
|
@@ -9901,7 +9909,9 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
9901
9909
|
var parsed = parse(raw, country);
|
|
9902
9910
|
var phoneValue = country === parsed.country ? format$1(parsed, 'National') : raw;
|
|
9903
9911
|
this.asYouType(phoneValue);
|
|
9904
|
-
} catch (e) {
|
|
9912
|
+
} catch (e) {
|
|
9913
|
+
console.error(e);
|
|
9914
|
+
}
|
|
9905
9915
|
}
|
|
9906
9916
|
}, {
|
|
9907
9917
|
key: "componentWillUnmount",
|
|
@@ -10016,7 +10026,7 @@ var PasswordPolicyRules = withI18n(withTheme(styled(function (_ref3) {
|
|
|
10016
10026
|
checked: props.strength >= props.minStrength
|
|
10017
10027
|
}), /*#__PURE__*/React__default.createElement(Label, {
|
|
10018
10028
|
visible: true
|
|
10019
|
-
}, 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
|
+
}, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key) {
|
|
10020
10030
|
var rule = props.rules[key];
|
|
10021
10031
|
return /*#__PURE__*/React__default.createElement(PasswordPolicyRule, {
|
|
10022
10032
|
key: key
|
|
@@ -10088,7 +10098,7 @@ var PasswordField = /*#__PURE__*/function (_React$Component) {
|
|
|
10088
10098
|
}
|
|
10089
10099
|
_createClass(PasswordField, [{
|
|
10090
10100
|
key: "componentDidUpdate",
|
|
10091
|
-
value: function componentDidUpdate(prevProps
|
|
10101
|
+
value: function componentDidUpdate(prevProps) {
|
|
10092
10102
|
var blacklistUpdated = isEqual(prevProps.blacklist, this.props.blacklist);
|
|
10093
10103
|
if (!blacklistUpdated) {
|
|
10094
10104
|
var _this$props = this.props,
|
|
@@ -10593,8 +10603,8 @@ var resolveField = function resolveField(fieldConfig, config) {
|
|
|
10593
10603
|
var camelPathSplit = camelPath.split('.v'); // TODO What if consent start with a `v`?
|
|
10594
10604
|
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
10595
10605
|
// Find most recent consent version if not given
|
|
10596
|
-
var highestConsentVersion = consentField.versions[0].versionId;
|
|
10597
10606
|
if (consentField) {
|
|
10607
|
+
var highestConsentVersion = consentField.versions[0].versionId;
|
|
10598
10608
|
return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1] || highestConsentVersion);
|
|
10599
10609
|
}
|
|
10600
10610
|
throw new UserError("Unknown field: ".concat(fieldConfig.key));
|
|
@@ -11127,7 +11137,7 @@ var MfaStepUpView = /*#__PURE__*/function (_React$Component) {
|
|
|
11127
11137
|
args[_key] = arguments[_key];
|
|
11128
11138
|
}
|
|
11129
11139
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11130
|
-
_defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function (
|
|
11140
|
+
_defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function () {
|
|
11131
11141
|
return _this.props.apiClient.getMfaStepUpToken({
|
|
11132
11142
|
options: _this.props.auth,
|
|
11133
11143
|
accessToken: _this.props.accessToken
|
|
@@ -11314,7 +11324,7 @@ var MainView = /*#__PURE__*/function (_React$Component) {
|
|
|
11314
11324
|
args[_key] = arguments[_key];
|
|
11315
11325
|
}
|
|
11316
11326
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11317
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
11327
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11318
11328
|
var _this$props = _this.props,
|
|
11319
11329
|
apiClient = _this$props.apiClient,
|
|
11320
11330
|
accessToken = _this$props.accessToken,
|
|
@@ -11330,11 +11340,19 @@ var MainView = /*#__PURE__*/function (_React$Component) {
|
|
|
11330
11340
|
return _this;
|
|
11331
11341
|
}
|
|
11332
11342
|
_createClass(MainView, [{
|
|
11343
|
+
key: "componentDidMount",
|
|
11344
|
+
value: function componentDidMount() {
|
|
11345
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
11346
|
+
}
|
|
11347
|
+
}, {
|
|
11333
11348
|
key: "render",
|
|
11334
11349
|
value: function render() {
|
|
11350
|
+
var _this2 = this;
|
|
11335
11351
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Intro, null, this.props.i18n('emailEditor.intro')), /*#__PURE__*/React__default.createElement(EmailEditorForm, {
|
|
11336
11352
|
showLabels: this.props.showLabels,
|
|
11337
|
-
handler:
|
|
11353
|
+
handler: function handler(data) {
|
|
11354
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "update_email");
|
|
11355
|
+
},
|
|
11338
11356
|
onSuccess: this.handleSuccess
|
|
11339
11357
|
}));
|
|
11340
11358
|
}
|
|
@@ -11501,7 +11519,7 @@ var MainView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
11501
11519
|
accessToken = _this$props.accessToken;
|
|
11502
11520
|
return apiClient.updatePhoneNumber(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11503
11521
|
accessToken: accessToken
|
|
11504
|
-
})).then(function (
|
|
11522
|
+
})).then(function () {
|
|
11505
11523
|
return data;
|
|
11506
11524
|
});
|
|
11507
11525
|
});
|
|
@@ -11670,7 +11688,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11670
11688
|
}
|
|
11671
11689
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11672
11690
|
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11673
|
-
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (
|
|
11691
|
+
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function () {
|
|
11674
11692
|
return data;
|
|
11675
11693
|
});
|
|
11676
11694
|
});
|
|
@@ -12302,7 +12320,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12302
12320
|
args[_key] = arguments[_key];
|
|
12303
12321
|
}
|
|
12304
12322
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
12305
|
-
_defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function (
|
|
12323
|
+
_defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function () {
|
|
12306
12324
|
return _this.props.apiClient.startMfaEmailRegistration({
|
|
12307
12325
|
accessToken: _this.props.accessToken
|
|
12308
12326
|
});
|
|
@@ -12312,7 +12330,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12312
12330
|
accessToken: _this.props.accessToken
|
|
12313
12331
|
}, data));
|
|
12314
12332
|
});
|
|
12315
|
-
_defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function (
|
|
12333
|
+
_defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function () {
|
|
12316
12334
|
return _this.props.apiClient.removeMfaEmail({
|
|
12317
12335
|
accessToken: _this.props.accessToken
|
|
12318
12336
|
});
|
|
@@ -12358,7 +12376,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12358
12376
|
}
|
|
12359
12377
|
}))), /*#__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, {
|
|
12360
12378
|
handler: this.onEmailRemoval,
|
|
12361
|
-
onSuccess: function onSuccess(
|
|
12379
|
+
onSuccess: function onSuccess() {
|
|
12362
12380
|
return _this2.props.goTo('credential-removed', {
|
|
12363
12381
|
credentialType: 'email'
|
|
12364
12382
|
});
|
|
@@ -12367,7 +12385,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12367
12385
|
handler: function handler(data) {
|
|
12368
12386
|
return _this2.onPhoneNumberRemoval(_objectSpread2(_objectSpread2({}, data), phoneNumberCredentialRegistered));
|
|
12369
12387
|
},
|
|
12370
|
-
onSuccess: function onSuccess(
|
|
12388
|
+
onSuccess: function onSuccess() {
|
|
12371
12389
|
return _this2.props.goTo('credential-removed', {
|
|
12372
12390
|
credentialType: 'sms'
|
|
12373
12391
|
});
|
|
@@ -12450,7 +12468,9 @@ var mfaCredentialsWidget = createMultiViewWidget({
|
|
|
12450
12468
|
},
|
|
12451
12469
|
prepare: function prepare(options, _ref3) {
|
|
12452
12470
|
var apiClient = _ref3.apiClient;
|
|
12453
|
-
return apiClient.listMfaCredentials(options.accessToken)
|
|
12471
|
+
return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
|
|
12472
|
+
throw new UserError.fromAppError(error);
|
|
12473
|
+
}).then(function (credentials) {
|
|
12454
12474
|
return deepDefaults(_objectSpread2(_objectSpread2({
|
|
12455
12475
|
showIntro: true,
|
|
12456
12476
|
showRemoveMfaCredentials: true
|
|
@@ -12537,7 +12557,9 @@ var mfaListWidget = createWidget({
|
|
|
12537
12557
|
component: MfaList,
|
|
12538
12558
|
prepare: function prepare(options, _ref3) {
|
|
12539
12559
|
var apiClient = _ref3.apiClient;
|
|
12540
|
-
return apiClient.listMfaCredentials(options.accessToken)
|
|
12560
|
+
return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
|
|
12561
|
+
throw new UserError.fromAppError(error);
|
|
12562
|
+
}).then(function (credentials) {
|
|
12541
12563
|
return _objectSpread2(_objectSpread2({}, options), credentials);
|
|
12542
12564
|
});
|
|
12543
12565
|
}
|
|
@@ -12548,7 +12570,7 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12548
12570
|
_classCallCheck(this, UiClient);
|
|
12549
12571
|
this.config = config;
|
|
12550
12572
|
this.urlParser = urlParser;
|
|
12551
|
-
this.
|
|
12573
|
+
this.core = coreClient;
|
|
12552
12574
|
this.defaultI18n = defaultI18n;
|
|
12553
12575
|
}
|
|
12554
12576
|
|
|
@@ -12655,7 +12677,7 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12655
12677
|
_context.next = 9;
|
|
12656
12678
|
return widget(options, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
12657
12679
|
config: config,
|
|
12658
|
-
apiClient: this.
|
|
12680
|
+
apiClient: this.core,
|
|
12659
12681
|
defaultI18n: this.defaultI18n
|
|
12660
12682
|
}));
|
|
12661
12683
|
case 9:
|
|
@@ -12708,10 +12730,10 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12708
12730
|
return Promise.resolve(_this.urlParser.parseUrlFragment(window.location.href)).then(function (authResult) {
|
|
12709
12731
|
// Avoid authentication triggering when an authentication response is present
|
|
12710
12732
|
if (authResult) return;
|
|
12711
|
-
_this.
|
|
12733
|
+
_this.core.getSessionInfo().then(function (session) {
|
|
12712
12734
|
var reAuthenticate = auth && auth.prompt && auth.prompt === 'login';
|
|
12713
12735
|
if (session.isAuthenticated && !reAuthenticate) {
|
|
12714
|
-
_this.
|
|
12736
|
+
_this.core.loginFromSession(auth);
|
|
12715
12737
|
} else {
|
|
12716
12738
|
showAuthWidget(session);
|
|
12717
12739
|
}
|
|
@@ -12729,1676 +12751,6 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12729
12751
|
return UiClient;
|
|
12730
12752
|
}();
|
|
12731
12753
|
|
|
12732
|
-
var lookup = [];
|
|
12733
|
-
var revLookup = [];
|
|
12734
|
-
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
12735
|
-
var inited = false;
|
|
12736
|
-
function init() {
|
|
12737
|
-
inited = true;
|
|
12738
|
-
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
12739
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
12740
|
-
lookup[i] = code[i];
|
|
12741
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
12742
|
-
}
|
|
12743
|
-
revLookup['-'.charCodeAt(0)] = 62;
|
|
12744
|
-
revLookup['_'.charCodeAt(0)] = 63;
|
|
12745
|
-
}
|
|
12746
|
-
function toByteArray(b64) {
|
|
12747
|
-
if (!inited) {
|
|
12748
|
-
init();
|
|
12749
|
-
}
|
|
12750
|
-
var i, j, l, tmp, placeHolders, arr;
|
|
12751
|
-
var len = b64.length;
|
|
12752
|
-
if (len % 4 > 0) {
|
|
12753
|
-
throw new Error('Invalid string. Length must be a multiple of 4');
|
|
12754
|
-
}
|
|
12755
|
-
|
|
12756
|
-
// the number of equal signs (place holders)
|
|
12757
|
-
// if there are two placeholders, than the two characters before it
|
|
12758
|
-
// represent one byte
|
|
12759
|
-
// if there is only one, then the three characters before it represent 2 bytes
|
|
12760
|
-
// this is just a cheap hack to not do indexOf twice
|
|
12761
|
-
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
|
|
12762
|
-
|
|
12763
|
-
// base64 is 4/3 + up to two characters of the original data
|
|
12764
|
-
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
12765
|
-
|
|
12766
|
-
// if there are placeholders, only get up to the last complete 4 chars
|
|
12767
|
-
l = placeHolders > 0 ? len - 4 : len;
|
|
12768
|
-
var L = 0;
|
|
12769
|
-
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
12770
|
-
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
12771
|
-
arr[L++] = tmp >> 16 & 0xFF;
|
|
12772
|
-
arr[L++] = tmp >> 8 & 0xFF;
|
|
12773
|
-
arr[L++] = tmp & 0xFF;
|
|
12774
|
-
}
|
|
12775
|
-
if (placeHolders === 2) {
|
|
12776
|
-
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
12777
|
-
arr[L++] = tmp & 0xFF;
|
|
12778
|
-
} else if (placeHolders === 1) {
|
|
12779
|
-
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
12780
|
-
arr[L++] = tmp >> 8 & 0xFF;
|
|
12781
|
-
arr[L++] = tmp & 0xFF;
|
|
12782
|
-
}
|
|
12783
|
-
return arr;
|
|
12784
|
-
}
|
|
12785
|
-
function tripletToBase64(num) {
|
|
12786
|
-
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
|
|
12787
|
-
}
|
|
12788
|
-
function encodeChunk(uint8, start, end) {
|
|
12789
|
-
var tmp;
|
|
12790
|
-
var output = [];
|
|
12791
|
-
for (var i = start; i < end; i += 3) {
|
|
12792
|
-
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
|
|
12793
|
-
output.push(tripletToBase64(tmp));
|
|
12794
|
-
}
|
|
12795
|
-
return output.join('');
|
|
12796
|
-
}
|
|
12797
|
-
function fromByteArray(uint8) {
|
|
12798
|
-
if (!inited) {
|
|
12799
|
-
init();
|
|
12800
|
-
}
|
|
12801
|
-
var tmp;
|
|
12802
|
-
var len = uint8.length;
|
|
12803
|
-
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
12804
|
-
var output = '';
|
|
12805
|
-
var parts = [];
|
|
12806
|
-
var maxChunkLength = 16383; // must be multiple of 3
|
|
12807
|
-
|
|
12808
|
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
12809
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
12810
|
-
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
12811
|
-
}
|
|
12812
|
-
|
|
12813
|
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
12814
|
-
if (extraBytes === 1) {
|
|
12815
|
-
tmp = uint8[len - 1];
|
|
12816
|
-
output += lookup[tmp >> 2];
|
|
12817
|
-
output += lookup[tmp << 4 & 0x3F];
|
|
12818
|
-
output += '==';
|
|
12819
|
-
} else if (extraBytes === 2) {
|
|
12820
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
12821
|
-
output += lookup[tmp >> 10];
|
|
12822
|
-
output += lookup[tmp >> 4 & 0x3F];
|
|
12823
|
-
output += lookup[tmp << 2 & 0x3F];
|
|
12824
|
-
output += '=';
|
|
12825
|
-
}
|
|
12826
|
-
parts.push(output);
|
|
12827
|
-
return parts.join('');
|
|
12828
|
-
}
|
|
12829
|
-
|
|
12830
|
-
function read(buffer, offset, isLE, mLen, nBytes) {
|
|
12831
|
-
var e, m;
|
|
12832
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
12833
|
-
var eMax = (1 << eLen) - 1;
|
|
12834
|
-
var eBias = eMax >> 1;
|
|
12835
|
-
var nBits = -7;
|
|
12836
|
-
var i = isLE ? nBytes - 1 : 0;
|
|
12837
|
-
var d = isLE ? -1 : 1;
|
|
12838
|
-
var s = buffer[offset + i];
|
|
12839
|
-
i += d;
|
|
12840
|
-
e = s & (1 << -nBits) - 1;
|
|
12841
|
-
s >>= -nBits;
|
|
12842
|
-
nBits += eLen;
|
|
12843
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12844
|
-
m = e & (1 << -nBits) - 1;
|
|
12845
|
-
e >>= -nBits;
|
|
12846
|
-
nBits += mLen;
|
|
12847
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12848
|
-
if (e === 0) {
|
|
12849
|
-
e = 1 - eBias;
|
|
12850
|
-
} else if (e === eMax) {
|
|
12851
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
12852
|
-
} else {
|
|
12853
|
-
m = m + Math.pow(2, mLen);
|
|
12854
|
-
e = e - eBias;
|
|
12855
|
-
}
|
|
12856
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
12857
|
-
}
|
|
12858
|
-
function write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
12859
|
-
var e, m, c;
|
|
12860
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
12861
|
-
var eMax = (1 << eLen) - 1;
|
|
12862
|
-
var eBias = eMax >> 1;
|
|
12863
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
12864
|
-
var i = isLE ? 0 : nBytes - 1;
|
|
12865
|
-
var d = isLE ? 1 : -1;
|
|
12866
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
12867
|
-
value = Math.abs(value);
|
|
12868
|
-
if (isNaN(value) || value === Infinity) {
|
|
12869
|
-
m = isNaN(value) ? 1 : 0;
|
|
12870
|
-
e = eMax;
|
|
12871
|
-
} else {
|
|
12872
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
12873
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
12874
|
-
e--;
|
|
12875
|
-
c *= 2;
|
|
12876
|
-
}
|
|
12877
|
-
if (e + eBias >= 1) {
|
|
12878
|
-
value += rt / c;
|
|
12879
|
-
} else {
|
|
12880
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
12881
|
-
}
|
|
12882
|
-
if (value * c >= 2) {
|
|
12883
|
-
e++;
|
|
12884
|
-
c /= 2;
|
|
12885
|
-
}
|
|
12886
|
-
if (e + eBias >= eMax) {
|
|
12887
|
-
m = 0;
|
|
12888
|
-
e = eMax;
|
|
12889
|
-
} else if (e + eBias >= 1) {
|
|
12890
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
12891
|
-
e = e + eBias;
|
|
12892
|
-
} else {
|
|
12893
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
12894
|
-
e = 0;
|
|
12895
|
-
}
|
|
12896
|
-
}
|
|
12897
|
-
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
12898
|
-
e = e << mLen | m;
|
|
12899
|
-
eLen += mLen;
|
|
12900
|
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
12901
|
-
buffer[offset + i - d] |= s * 128;
|
|
12902
|
-
}
|
|
12903
|
-
|
|
12904
|
-
var toString$1 = {}.toString;
|
|
12905
|
-
var isArray$1 = Array.isArray || function (arr) {
|
|
12906
|
-
return toString$1.call(arr) == '[object Array]';
|
|
12907
|
-
};
|
|
12908
|
-
|
|
12909
|
-
var INSPECT_MAX_BYTES = 50;
|
|
12910
|
-
|
|
12911
|
-
/**
|
|
12912
|
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
12913
|
-
* === true Use Uint8Array implementation (fastest)
|
|
12914
|
-
* === false Use Object implementation (most compatible, even IE6)
|
|
12915
|
-
*
|
|
12916
|
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
12917
|
-
* Opera 11.6+, iOS 4.2+.
|
|
12918
|
-
*
|
|
12919
|
-
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
12920
|
-
* when the browser supports typed arrays.
|
|
12921
|
-
*
|
|
12922
|
-
* Note:
|
|
12923
|
-
*
|
|
12924
|
-
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
12925
|
-
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
12926
|
-
*
|
|
12927
|
-
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
12928
|
-
*
|
|
12929
|
-
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
12930
|
-
* incorrect length in some situations.
|
|
12931
|
-
|
|
12932
|
-
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
12933
|
-
* get the Object implementation, which is slower but behaves correctly.
|
|
12934
|
-
*/
|
|
12935
|
-
Buffer$2.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
|
|
12936
|
-
|
|
12937
|
-
function kMaxLength() {
|
|
12938
|
-
return Buffer$2.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
|
|
12939
|
-
}
|
|
12940
|
-
function createBuffer(that, length) {
|
|
12941
|
-
if (kMaxLength() < length) {
|
|
12942
|
-
throw new RangeError('Invalid typed array length');
|
|
12943
|
-
}
|
|
12944
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
12945
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
12946
|
-
that = new Uint8Array(length);
|
|
12947
|
-
that.__proto__ = Buffer$2.prototype;
|
|
12948
|
-
} else {
|
|
12949
|
-
// Fallback: Return an object instance of the Buffer class
|
|
12950
|
-
if (that === null) {
|
|
12951
|
-
that = new Buffer$2(length);
|
|
12952
|
-
}
|
|
12953
|
-
that.length = length;
|
|
12954
|
-
}
|
|
12955
|
-
return that;
|
|
12956
|
-
}
|
|
12957
|
-
|
|
12958
|
-
/**
|
|
12959
|
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
12960
|
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
12961
|
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
12962
|
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
12963
|
-
* returns a single octet.
|
|
12964
|
-
*
|
|
12965
|
-
* The `Uint8Array` prototype remains unmodified.
|
|
12966
|
-
*/
|
|
12967
|
-
|
|
12968
|
-
function Buffer$2(arg, encodingOrOffset, length) {
|
|
12969
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$2)) {
|
|
12970
|
-
return new Buffer$2(arg, encodingOrOffset, length);
|
|
12971
|
-
}
|
|
12972
|
-
|
|
12973
|
-
// Common case.
|
|
12974
|
-
if (typeof arg === 'number') {
|
|
12975
|
-
if (typeof encodingOrOffset === 'string') {
|
|
12976
|
-
throw new Error('If encoding is specified then the first argument must be a string');
|
|
12977
|
-
}
|
|
12978
|
-
return allocUnsafe$1(this, arg);
|
|
12979
|
-
}
|
|
12980
|
-
return from(this, arg, encodingOrOffset, length);
|
|
12981
|
-
}
|
|
12982
|
-
Buffer$2.poolSize = 8192; // not used by this implementation
|
|
12983
|
-
|
|
12984
|
-
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
12985
|
-
Buffer$2._augment = function (arr) {
|
|
12986
|
-
arr.__proto__ = Buffer$2.prototype;
|
|
12987
|
-
return arr;
|
|
12988
|
-
};
|
|
12989
|
-
function from(that, value, encodingOrOffset, length) {
|
|
12990
|
-
if (typeof value === 'number') {
|
|
12991
|
-
throw new TypeError('"value" argument must not be a number');
|
|
12992
|
-
}
|
|
12993
|
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
12994
|
-
return fromArrayBuffer(that, value, encodingOrOffset, length);
|
|
12995
|
-
}
|
|
12996
|
-
if (typeof value === 'string') {
|
|
12997
|
-
return fromString(that, value, encodingOrOffset);
|
|
12998
|
-
}
|
|
12999
|
-
return fromObject(that, value);
|
|
13000
|
-
}
|
|
13001
|
-
|
|
13002
|
-
/**
|
|
13003
|
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
13004
|
-
* if value is a number.
|
|
13005
|
-
* Buffer.from(str[, encoding])
|
|
13006
|
-
* Buffer.from(array)
|
|
13007
|
-
* Buffer.from(buffer)
|
|
13008
|
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
13009
|
-
**/
|
|
13010
|
-
Buffer$2.from = function (value, encodingOrOffset, length) {
|
|
13011
|
-
return from(null, value, encodingOrOffset, length);
|
|
13012
|
-
};
|
|
13013
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13014
|
-
Buffer$2.prototype.__proto__ = Uint8Array.prototype;
|
|
13015
|
-
Buffer$2.__proto__ = Uint8Array;
|
|
13016
|
-
}
|
|
13017
|
-
function assertSize(size) {
|
|
13018
|
-
if (typeof size !== 'number') {
|
|
13019
|
-
throw new TypeError('"size" argument must be a number');
|
|
13020
|
-
} else if (size < 0) {
|
|
13021
|
-
throw new RangeError('"size" argument must not be negative');
|
|
13022
|
-
}
|
|
13023
|
-
}
|
|
13024
|
-
function alloc(that, size, fill, encoding) {
|
|
13025
|
-
assertSize(size);
|
|
13026
|
-
if (size <= 0) {
|
|
13027
|
-
return createBuffer(that, size);
|
|
13028
|
-
}
|
|
13029
|
-
if (fill !== undefined) {
|
|
13030
|
-
// Only pay attention to encoding if it's a string. This
|
|
13031
|
-
// prevents accidentally sending in a number that would
|
|
13032
|
-
// be interpretted as a start offset.
|
|
13033
|
-
return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
|
|
13034
|
-
}
|
|
13035
|
-
return createBuffer(that, size);
|
|
13036
|
-
}
|
|
13037
|
-
|
|
13038
|
-
/**
|
|
13039
|
-
* Creates a new filled Buffer instance.
|
|
13040
|
-
* alloc(size[, fill[, encoding]])
|
|
13041
|
-
**/
|
|
13042
|
-
Buffer$2.alloc = function (size, fill, encoding) {
|
|
13043
|
-
return alloc(null, size, fill, encoding);
|
|
13044
|
-
};
|
|
13045
|
-
function allocUnsafe$1(that, size) {
|
|
13046
|
-
assertSize(size);
|
|
13047
|
-
that = createBuffer(that, size < 0 ? 0 : checked$1(size) | 0);
|
|
13048
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13049
|
-
for (var i = 0; i < size; ++i) {
|
|
13050
|
-
that[i] = 0;
|
|
13051
|
-
}
|
|
13052
|
-
}
|
|
13053
|
-
return that;
|
|
13054
|
-
}
|
|
13055
|
-
|
|
13056
|
-
/**
|
|
13057
|
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13058
|
-
* */
|
|
13059
|
-
Buffer$2.allocUnsafe = function (size) {
|
|
13060
|
-
return allocUnsafe$1(null, size);
|
|
13061
|
-
};
|
|
13062
|
-
/**
|
|
13063
|
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13064
|
-
*/
|
|
13065
|
-
Buffer$2.allocUnsafeSlow = function (size) {
|
|
13066
|
-
return allocUnsafe$1(null, size);
|
|
13067
|
-
};
|
|
13068
|
-
function fromString(that, string, encoding) {
|
|
13069
|
-
if (typeof encoding !== 'string' || encoding === '') {
|
|
13070
|
-
encoding = 'utf8';
|
|
13071
|
-
}
|
|
13072
|
-
if (!Buffer$2.isEncoding(encoding)) {
|
|
13073
|
-
throw new TypeError('"encoding" must be a valid string encoding');
|
|
13074
|
-
}
|
|
13075
|
-
var length = byteLength(string, encoding) | 0;
|
|
13076
|
-
that = createBuffer(that, length);
|
|
13077
|
-
var actual = that.write(string, encoding);
|
|
13078
|
-
if (actual !== length) {
|
|
13079
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
13080
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
13081
|
-
// 'abxxcd' will be treated as 'ab')
|
|
13082
|
-
that = that.slice(0, actual);
|
|
13083
|
-
}
|
|
13084
|
-
return that;
|
|
13085
|
-
}
|
|
13086
|
-
function fromArrayLike(that, array) {
|
|
13087
|
-
var length = array.length < 0 ? 0 : checked$1(array.length) | 0;
|
|
13088
|
-
that = createBuffer(that, length);
|
|
13089
|
-
for (var i = 0; i < length; i += 1) {
|
|
13090
|
-
that[i] = array[i] & 255;
|
|
13091
|
-
}
|
|
13092
|
-
return that;
|
|
13093
|
-
}
|
|
13094
|
-
function fromArrayBuffer(that, array, byteOffset, length) {
|
|
13095
|
-
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
|
|
13096
|
-
|
|
13097
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
13098
|
-
throw new RangeError('\'offset\' is out of bounds');
|
|
13099
|
-
}
|
|
13100
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
13101
|
-
throw new RangeError('\'length\' is out of bounds');
|
|
13102
|
-
}
|
|
13103
|
-
if (byteOffset === undefined && length === undefined) {
|
|
13104
|
-
array = new Uint8Array(array);
|
|
13105
|
-
} else if (length === undefined) {
|
|
13106
|
-
array = new Uint8Array(array, byteOffset);
|
|
13107
|
-
} else {
|
|
13108
|
-
array = new Uint8Array(array, byteOffset, length);
|
|
13109
|
-
}
|
|
13110
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13111
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
13112
|
-
that = array;
|
|
13113
|
-
that.__proto__ = Buffer$2.prototype;
|
|
13114
|
-
} else {
|
|
13115
|
-
// Fallback: Return an object instance of the Buffer class
|
|
13116
|
-
that = fromArrayLike(that, array);
|
|
13117
|
-
}
|
|
13118
|
-
return that;
|
|
13119
|
-
}
|
|
13120
|
-
function fromObject(that, obj) {
|
|
13121
|
-
if (internalIsBuffer(obj)) {
|
|
13122
|
-
var len = checked$1(obj.length) | 0;
|
|
13123
|
-
that = createBuffer(that, len);
|
|
13124
|
-
if (that.length === 0) {
|
|
13125
|
-
return that;
|
|
13126
|
-
}
|
|
13127
|
-
obj.copy(that, 0, 0, len);
|
|
13128
|
-
return that;
|
|
13129
|
-
}
|
|
13130
|
-
if (obj) {
|
|
13131
|
-
if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
|
|
13132
|
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
13133
|
-
return createBuffer(that, 0);
|
|
13134
|
-
}
|
|
13135
|
-
return fromArrayLike(that, obj);
|
|
13136
|
-
}
|
|
13137
|
-
if (obj.type === 'Buffer' && isArray$1(obj.data)) {
|
|
13138
|
-
return fromArrayLike(that, obj.data);
|
|
13139
|
-
}
|
|
13140
|
-
}
|
|
13141
|
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
|
|
13142
|
-
}
|
|
13143
|
-
function checked$1(length) {
|
|
13144
|
-
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
13145
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
13146
|
-
if (length >= kMaxLength()) {
|
|
13147
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
|
|
13148
|
-
}
|
|
13149
|
-
return length | 0;
|
|
13150
|
-
}
|
|
13151
|
-
Buffer$2.isBuffer = isBuffer$1;
|
|
13152
|
-
function internalIsBuffer(b) {
|
|
13153
|
-
return !!(b != null && b._isBuffer);
|
|
13154
|
-
}
|
|
13155
|
-
Buffer$2.compare = function compare(a, b) {
|
|
13156
|
-
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
13157
|
-
throw new TypeError('Arguments must be Buffers');
|
|
13158
|
-
}
|
|
13159
|
-
if (a === b) return 0;
|
|
13160
|
-
var x = a.length;
|
|
13161
|
-
var y = b.length;
|
|
13162
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
13163
|
-
if (a[i] !== b[i]) {
|
|
13164
|
-
x = a[i];
|
|
13165
|
-
y = b[i];
|
|
13166
|
-
break;
|
|
13167
|
-
}
|
|
13168
|
-
}
|
|
13169
|
-
if (x < y) return -1;
|
|
13170
|
-
if (y < x) return 1;
|
|
13171
|
-
return 0;
|
|
13172
|
-
};
|
|
13173
|
-
Buffer$2.isEncoding = function isEncoding(encoding) {
|
|
13174
|
-
switch (String(encoding).toLowerCase()) {
|
|
13175
|
-
case 'hex':
|
|
13176
|
-
case 'utf8':
|
|
13177
|
-
case 'utf-8':
|
|
13178
|
-
case 'ascii':
|
|
13179
|
-
case 'latin1':
|
|
13180
|
-
case 'binary':
|
|
13181
|
-
case 'base64':
|
|
13182
|
-
case 'ucs2':
|
|
13183
|
-
case 'ucs-2':
|
|
13184
|
-
case 'utf16le':
|
|
13185
|
-
case 'utf-16le':
|
|
13186
|
-
return true;
|
|
13187
|
-
default:
|
|
13188
|
-
return false;
|
|
13189
|
-
}
|
|
13190
|
-
};
|
|
13191
|
-
Buffer$2.concat = function concat(list, length) {
|
|
13192
|
-
if (!isArray$1(list)) {
|
|
13193
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13194
|
-
}
|
|
13195
|
-
if (list.length === 0) {
|
|
13196
|
-
return Buffer$2.alloc(0);
|
|
13197
|
-
}
|
|
13198
|
-
var i;
|
|
13199
|
-
if (length === undefined) {
|
|
13200
|
-
length = 0;
|
|
13201
|
-
for (i = 0; i < list.length; ++i) {
|
|
13202
|
-
length += list[i].length;
|
|
13203
|
-
}
|
|
13204
|
-
}
|
|
13205
|
-
var buffer = Buffer$2.allocUnsafe(length);
|
|
13206
|
-
var pos = 0;
|
|
13207
|
-
for (i = 0; i < list.length; ++i) {
|
|
13208
|
-
var buf = list[i];
|
|
13209
|
-
if (!internalIsBuffer(buf)) {
|
|
13210
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13211
|
-
}
|
|
13212
|
-
buf.copy(buffer, pos);
|
|
13213
|
-
pos += buf.length;
|
|
13214
|
-
}
|
|
13215
|
-
return buffer;
|
|
13216
|
-
};
|
|
13217
|
-
function byteLength(string, encoding) {
|
|
13218
|
-
if (internalIsBuffer(string)) {
|
|
13219
|
-
return string.length;
|
|
13220
|
-
}
|
|
13221
|
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
13222
|
-
return string.byteLength;
|
|
13223
|
-
}
|
|
13224
|
-
if (typeof string !== 'string') {
|
|
13225
|
-
string = '' + string;
|
|
13226
|
-
}
|
|
13227
|
-
var len = string.length;
|
|
13228
|
-
if (len === 0) return 0;
|
|
13229
|
-
|
|
13230
|
-
// Use a for loop to avoid recursion
|
|
13231
|
-
var loweredCase = false;
|
|
13232
|
-
for (;;) {
|
|
13233
|
-
switch (encoding) {
|
|
13234
|
-
case 'ascii':
|
|
13235
|
-
case 'latin1':
|
|
13236
|
-
case 'binary':
|
|
13237
|
-
return len;
|
|
13238
|
-
case 'utf8':
|
|
13239
|
-
case 'utf-8':
|
|
13240
|
-
case undefined:
|
|
13241
|
-
return utf8ToBytes(string).length;
|
|
13242
|
-
case 'ucs2':
|
|
13243
|
-
case 'ucs-2':
|
|
13244
|
-
case 'utf16le':
|
|
13245
|
-
case 'utf-16le':
|
|
13246
|
-
return len * 2;
|
|
13247
|
-
case 'hex':
|
|
13248
|
-
return len >>> 1;
|
|
13249
|
-
case 'base64':
|
|
13250
|
-
return base64ToBytes(string).length;
|
|
13251
|
-
default:
|
|
13252
|
-
if (loweredCase) return utf8ToBytes(string).length; // assume utf8
|
|
13253
|
-
encoding = ('' + encoding).toLowerCase();
|
|
13254
|
-
loweredCase = true;
|
|
13255
|
-
}
|
|
13256
|
-
}
|
|
13257
|
-
}
|
|
13258
|
-
Buffer$2.byteLength = byteLength;
|
|
13259
|
-
function slowToString(encoding, start, end) {
|
|
13260
|
-
var loweredCase = false;
|
|
13261
|
-
|
|
13262
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
13263
|
-
// property of a typed array.
|
|
13264
|
-
|
|
13265
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
13266
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
13267
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
13268
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
13269
|
-
if (start === undefined || start < 0) {
|
|
13270
|
-
start = 0;
|
|
13271
|
-
}
|
|
13272
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
13273
|
-
// coercion fail below.
|
|
13274
|
-
if (start > this.length) {
|
|
13275
|
-
return '';
|
|
13276
|
-
}
|
|
13277
|
-
if (end === undefined || end > this.length) {
|
|
13278
|
-
end = this.length;
|
|
13279
|
-
}
|
|
13280
|
-
if (end <= 0) {
|
|
13281
|
-
return '';
|
|
13282
|
-
}
|
|
13283
|
-
|
|
13284
|
-
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
13285
|
-
end >>>= 0;
|
|
13286
|
-
start >>>= 0;
|
|
13287
|
-
if (end <= start) {
|
|
13288
|
-
return '';
|
|
13289
|
-
}
|
|
13290
|
-
if (!encoding) encoding = 'utf8';
|
|
13291
|
-
while (true) {
|
|
13292
|
-
switch (encoding) {
|
|
13293
|
-
case 'hex':
|
|
13294
|
-
return hexSlice(this, start, end);
|
|
13295
|
-
case 'utf8':
|
|
13296
|
-
case 'utf-8':
|
|
13297
|
-
return utf8Slice(this, start, end);
|
|
13298
|
-
case 'ascii':
|
|
13299
|
-
return asciiSlice(this, start, end);
|
|
13300
|
-
case 'latin1':
|
|
13301
|
-
case 'binary':
|
|
13302
|
-
return latin1Slice(this, start, end);
|
|
13303
|
-
case 'base64':
|
|
13304
|
-
return base64Slice(this, start, end);
|
|
13305
|
-
case 'ucs2':
|
|
13306
|
-
case 'ucs-2':
|
|
13307
|
-
case 'utf16le':
|
|
13308
|
-
case 'utf-16le':
|
|
13309
|
-
return utf16leSlice(this, start, end);
|
|
13310
|
-
default:
|
|
13311
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13312
|
-
encoding = (encoding + '').toLowerCase();
|
|
13313
|
-
loweredCase = true;
|
|
13314
|
-
}
|
|
13315
|
-
}
|
|
13316
|
-
}
|
|
13317
|
-
|
|
13318
|
-
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
13319
|
-
// Buffer instances.
|
|
13320
|
-
Buffer$2.prototype._isBuffer = true;
|
|
13321
|
-
function swap(b, n, m) {
|
|
13322
|
-
var i = b[n];
|
|
13323
|
-
b[n] = b[m];
|
|
13324
|
-
b[m] = i;
|
|
13325
|
-
}
|
|
13326
|
-
Buffer$2.prototype.swap16 = function swap16() {
|
|
13327
|
-
var len = this.length;
|
|
13328
|
-
if (len % 2 !== 0) {
|
|
13329
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits');
|
|
13330
|
-
}
|
|
13331
|
-
for (var i = 0; i < len; i += 2) {
|
|
13332
|
-
swap(this, i, i + 1);
|
|
13333
|
-
}
|
|
13334
|
-
return this;
|
|
13335
|
-
};
|
|
13336
|
-
Buffer$2.prototype.swap32 = function swap32() {
|
|
13337
|
-
var len = this.length;
|
|
13338
|
-
if (len % 4 !== 0) {
|
|
13339
|
-
throw new RangeError('Buffer size must be a multiple of 32-bits');
|
|
13340
|
-
}
|
|
13341
|
-
for (var i = 0; i < len; i += 4) {
|
|
13342
|
-
swap(this, i, i + 3);
|
|
13343
|
-
swap(this, i + 1, i + 2);
|
|
13344
|
-
}
|
|
13345
|
-
return this;
|
|
13346
|
-
};
|
|
13347
|
-
Buffer$2.prototype.swap64 = function swap64() {
|
|
13348
|
-
var len = this.length;
|
|
13349
|
-
if (len % 8 !== 0) {
|
|
13350
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits');
|
|
13351
|
-
}
|
|
13352
|
-
for (var i = 0; i < len; i += 8) {
|
|
13353
|
-
swap(this, i, i + 7);
|
|
13354
|
-
swap(this, i + 1, i + 6);
|
|
13355
|
-
swap(this, i + 2, i + 5);
|
|
13356
|
-
swap(this, i + 3, i + 4);
|
|
13357
|
-
}
|
|
13358
|
-
return this;
|
|
13359
|
-
};
|
|
13360
|
-
Buffer$2.prototype.toString = function toString() {
|
|
13361
|
-
var length = this.length | 0;
|
|
13362
|
-
if (length === 0) return '';
|
|
13363
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
13364
|
-
return slowToString.apply(this, arguments);
|
|
13365
|
-
};
|
|
13366
|
-
Buffer$2.prototype.equals = function equals(b) {
|
|
13367
|
-
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
|
|
13368
|
-
if (this === b) return true;
|
|
13369
|
-
return Buffer$2.compare(this, b) === 0;
|
|
13370
|
-
};
|
|
13371
|
-
Buffer$2.prototype.inspect = function inspect() {
|
|
13372
|
-
var str = '';
|
|
13373
|
-
var max = INSPECT_MAX_BYTES;
|
|
13374
|
-
if (this.length > 0) {
|
|
13375
|
-
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
|
|
13376
|
-
if (this.length > max) str += ' ... ';
|
|
13377
|
-
}
|
|
13378
|
-
return '<Buffer ' + str + '>';
|
|
13379
|
-
};
|
|
13380
|
-
Buffer$2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
13381
|
-
if (!internalIsBuffer(target)) {
|
|
13382
|
-
throw new TypeError('Argument must be a Buffer');
|
|
13383
|
-
}
|
|
13384
|
-
if (start === undefined) {
|
|
13385
|
-
start = 0;
|
|
13386
|
-
}
|
|
13387
|
-
if (end === undefined) {
|
|
13388
|
-
end = target ? target.length : 0;
|
|
13389
|
-
}
|
|
13390
|
-
if (thisStart === undefined) {
|
|
13391
|
-
thisStart = 0;
|
|
13392
|
-
}
|
|
13393
|
-
if (thisEnd === undefined) {
|
|
13394
|
-
thisEnd = this.length;
|
|
13395
|
-
}
|
|
13396
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
13397
|
-
throw new RangeError('out of range index');
|
|
13398
|
-
}
|
|
13399
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
13400
|
-
return 0;
|
|
13401
|
-
}
|
|
13402
|
-
if (thisStart >= thisEnd) {
|
|
13403
|
-
return -1;
|
|
13404
|
-
}
|
|
13405
|
-
if (start >= end) {
|
|
13406
|
-
return 1;
|
|
13407
|
-
}
|
|
13408
|
-
start >>>= 0;
|
|
13409
|
-
end >>>= 0;
|
|
13410
|
-
thisStart >>>= 0;
|
|
13411
|
-
thisEnd >>>= 0;
|
|
13412
|
-
if (this === target) return 0;
|
|
13413
|
-
var x = thisEnd - thisStart;
|
|
13414
|
-
var y = end - start;
|
|
13415
|
-
var len = Math.min(x, y);
|
|
13416
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
13417
|
-
var targetCopy = target.slice(start, end);
|
|
13418
|
-
for (var i = 0; i < len; ++i) {
|
|
13419
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
13420
|
-
x = thisCopy[i];
|
|
13421
|
-
y = targetCopy[i];
|
|
13422
|
-
break;
|
|
13423
|
-
}
|
|
13424
|
-
}
|
|
13425
|
-
if (x < y) return -1;
|
|
13426
|
-
if (y < x) return 1;
|
|
13427
|
-
return 0;
|
|
13428
|
-
};
|
|
13429
|
-
|
|
13430
|
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
13431
|
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
13432
|
-
//
|
|
13433
|
-
// Arguments:
|
|
13434
|
-
// - buffer - a Buffer to search
|
|
13435
|
-
// - val - a string, Buffer, or number
|
|
13436
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
13437
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
13438
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
13439
|
-
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
13440
|
-
// Empty buffer means no match
|
|
13441
|
-
if (buffer.length === 0) return -1;
|
|
13442
|
-
|
|
13443
|
-
// Normalize byteOffset
|
|
13444
|
-
if (typeof byteOffset === 'string') {
|
|
13445
|
-
encoding = byteOffset;
|
|
13446
|
-
byteOffset = 0;
|
|
13447
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
13448
|
-
byteOffset = 0x7fffffff;
|
|
13449
|
-
} else if (byteOffset < -0x80000000) {
|
|
13450
|
-
byteOffset = -0x80000000;
|
|
13451
|
-
}
|
|
13452
|
-
byteOffset = +byteOffset; // Coerce to Number.
|
|
13453
|
-
if (isNaN(byteOffset)) {
|
|
13454
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
13455
|
-
byteOffset = dir ? 0 : buffer.length - 1;
|
|
13456
|
-
}
|
|
13457
|
-
|
|
13458
|
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
13459
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
13460
|
-
if (byteOffset >= buffer.length) {
|
|
13461
|
-
if (dir) return -1;else byteOffset = buffer.length - 1;
|
|
13462
|
-
} else if (byteOffset < 0) {
|
|
13463
|
-
if (dir) byteOffset = 0;else return -1;
|
|
13464
|
-
}
|
|
13465
|
-
|
|
13466
|
-
// Normalize val
|
|
13467
|
-
if (typeof val === 'string') {
|
|
13468
|
-
val = Buffer$2.from(val, encoding);
|
|
13469
|
-
}
|
|
13470
|
-
|
|
13471
|
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
13472
|
-
if (internalIsBuffer(val)) {
|
|
13473
|
-
// Special case: looking for empty string/buffer always fails
|
|
13474
|
-
if (val.length === 0) {
|
|
13475
|
-
return -1;
|
|
13476
|
-
}
|
|
13477
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
13478
|
-
} else if (typeof val === 'number') {
|
|
13479
|
-
val = val & 0xFF; // Search for a byte value [0-255]
|
|
13480
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
|
|
13481
|
-
if (dir) {
|
|
13482
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
13483
|
-
} else {
|
|
13484
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
13485
|
-
}
|
|
13486
|
-
}
|
|
13487
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
13488
|
-
}
|
|
13489
|
-
throw new TypeError('val must be string, number or Buffer');
|
|
13490
|
-
}
|
|
13491
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
13492
|
-
var indexSize = 1;
|
|
13493
|
-
var arrLength = arr.length;
|
|
13494
|
-
var valLength = val.length;
|
|
13495
|
-
if (encoding !== undefined) {
|
|
13496
|
-
encoding = String(encoding).toLowerCase();
|
|
13497
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
13498
|
-
if (arr.length < 2 || val.length < 2) {
|
|
13499
|
-
return -1;
|
|
13500
|
-
}
|
|
13501
|
-
indexSize = 2;
|
|
13502
|
-
arrLength /= 2;
|
|
13503
|
-
valLength /= 2;
|
|
13504
|
-
byteOffset /= 2;
|
|
13505
|
-
}
|
|
13506
|
-
}
|
|
13507
|
-
function read(buf, i) {
|
|
13508
|
-
if (indexSize === 1) {
|
|
13509
|
-
return buf[i];
|
|
13510
|
-
} else {
|
|
13511
|
-
return buf.readUInt16BE(i * indexSize);
|
|
13512
|
-
}
|
|
13513
|
-
}
|
|
13514
|
-
var i;
|
|
13515
|
-
if (dir) {
|
|
13516
|
-
var foundIndex = -1;
|
|
13517
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
13518
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
13519
|
-
if (foundIndex === -1) foundIndex = i;
|
|
13520
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
13521
|
-
} else {
|
|
13522
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
13523
|
-
foundIndex = -1;
|
|
13524
|
-
}
|
|
13525
|
-
}
|
|
13526
|
-
} else {
|
|
13527
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
13528
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
13529
|
-
var found = true;
|
|
13530
|
-
for (var j = 0; j < valLength; j++) {
|
|
13531
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
13532
|
-
found = false;
|
|
13533
|
-
break;
|
|
13534
|
-
}
|
|
13535
|
-
}
|
|
13536
|
-
if (found) return i;
|
|
13537
|
-
}
|
|
13538
|
-
}
|
|
13539
|
-
return -1;
|
|
13540
|
-
}
|
|
13541
|
-
Buffer$2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
13542
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
13543
|
-
};
|
|
13544
|
-
Buffer$2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
13545
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
13546
|
-
};
|
|
13547
|
-
Buffer$2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
13548
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
13549
|
-
};
|
|
13550
|
-
function hexWrite(buf, string, offset, length) {
|
|
13551
|
-
offset = Number(offset) || 0;
|
|
13552
|
-
var remaining = buf.length - offset;
|
|
13553
|
-
if (!length) {
|
|
13554
|
-
length = remaining;
|
|
13555
|
-
} else {
|
|
13556
|
-
length = Number(length);
|
|
13557
|
-
if (length > remaining) {
|
|
13558
|
-
length = remaining;
|
|
13559
|
-
}
|
|
13560
|
-
}
|
|
13561
|
-
|
|
13562
|
-
// must be an even number of digits
|
|
13563
|
-
var strLen = string.length;
|
|
13564
|
-
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
|
|
13565
|
-
if (length > strLen / 2) {
|
|
13566
|
-
length = strLen / 2;
|
|
13567
|
-
}
|
|
13568
|
-
for (var i = 0; i < length; ++i) {
|
|
13569
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
13570
|
-
if (isNaN(parsed)) return i;
|
|
13571
|
-
buf[offset + i] = parsed;
|
|
13572
|
-
}
|
|
13573
|
-
return i;
|
|
13574
|
-
}
|
|
13575
|
-
function utf8Write(buf, string, offset, length) {
|
|
13576
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
13577
|
-
}
|
|
13578
|
-
function asciiWrite(buf, string, offset, length) {
|
|
13579
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
13580
|
-
}
|
|
13581
|
-
function latin1Write(buf, string, offset, length) {
|
|
13582
|
-
return asciiWrite(buf, string, offset, length);
|
|
13583
|
-
}
|
|
13584
|
-
function base64Write(buf, string, offset, length) {
|
|
13585
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
13586
|
-
}
|
|
13587
|
-
function ucs2Write(buf, string, offset, length) {
|
|
13588
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
13589
|
-
}
|
|
13590
|
-
Buffer$2.prototype.write = function write(string, offset, length, encoding) {
|
|
13591
|
-
// Buffer#write(string)
|
|
13592
|
-
if (offset === undefined) {
|
|
13593
|
-
encoding = 'utf8';
|
|
13594
|
-
length = this.length;
|
|
13595
|
-
offset = 0;
|
|
13596
|
-
// Buffer#write(string, encoding)
|
|
13597
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
13598
|
-
encoding = offset;
|
|
13599
|
-
length = this.length;
|
|
13600
|
-
offset = 0;
|
|
13601
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
13602
|
-
} else if (isFinite(offset)) {
|
|
13603
|
-
offset = offset | 0;
|
|
13604
|
-
if (isFinite(length)) {
|
|
13605
|
-
length = length | 0;
|
|
13606
|
-
if (encoding === undefined) encoding = 'utf8';
|
|
13607
|
-
} else {
|
|
13608
|
-
encoding = length;
|
|
13609
|
-
length = undefined;
|
|
13610
|
-
}
|
|
13611
|
-
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
13612
|
-
} else {
|
|
13613
|
-
throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
|
|
13614
|
-
}
|
|
13615
|
-
var remaining = this.length - offset;
|
|
13616
|
-
if (length === undefined || length > remaining) length = remaining;
|
|
13617
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
13618
|
-
throw new RangeError('Attempt to write outside buffer bounds');
|
|
13619
|
-
}
|
|
13620
|
-
if (!encoding) encoding = 'utf8';
|
|
13621
|
-
var loweredCase = false;
|
|
13622
|
-
for (;;) {
|
|
13623
|
-
switch (encoding) {
|
|
13624
|
-
case 'hex':
|
|
13625
|
-
return hexWrite(this, string, offset, length);
|
|
13626
|
-
case 'utf8':
|
|
13627
|
-
case 'utf-8':
|
|
13628
|
-
return utf8Write(this, string, offset, length);
|
|
13629
|
-
case 'ascii':
|
|
13630
|
-
return asciiWrite(this, string, offset, length);
|
|
13631
|
-
case 'latin1':
|
|
13632
|
-
case 'binary':
|
|
13633
|
-
return latin1Write(this, string, offset, length);
|
|
13634
|
-
case 'base64':
|
|
13635
|
-
// Warning: maxLength not taken into account in base64Write
|
|
13636
|
-
return base64Write(this, string, offset, length);
|
|
13637
|
-
case 'ucs2':
|
|
13638
|
-
case 'ucs-2':
|
|
13639
|
-
case 'utf16le':
|
|
13640
|
-
case 'utf-16le':
|
|
13641
|
-
return ucs2Write(this, string, offset, length);
|
|
13642
|
-
default:
|
|
13643
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13644
|
-
encoding = ('' + encoding).toLowerCase();
|
|
13645
|
-
loweredCase = true;
|
|
13646
|
-
}
|
|
13647
|
-
}
|
|
13648
|
-
};
|
|
13649
|
-
Buffer$2.prototype.toJSON = function toJSON() {
|
|
13650
|
-
return {
|
|
13651
|
-
type: 'Buffer',
|
|
13652
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
13653
|
-
};
|
|
13654
|
-
};
|
|
13655
|
-
function base64Slice(buf, start, end) {
|
|
13656
|
-
if (start === 0 && end === buf.length) {
|
|
13657
|
-
return fromByteArray(buf);
|
|
13658
|
-
} else {
|
|
13659
|
-
return fromByteArray(buf.slice(start, end));
|
|
13660
|
-
}
|
|
13661
|
-
}
|
|
13662
|
-
function utf8Slice(buf, start, end) {
|
|
13663
|
-
end = Math.min(buf.length, end);
|
|
13664
|
-
var res = [];
|
|
13665
|
-
var i = start;
|
|
13666
|
-
while (i < end) {
|
|
13667
|
-
var firstByte = buf[i];
|
|
13668
|
-
var codePoint = null;
|
|
13669
|
-
var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
|
|
13670
|
-
if (i + bytesPerSequence <= end) {
|
|
13671
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
13672
|
-
switch (bytesPerSequence) {
|
|
13673
|
-
case 1:
|
|
13674
|
-
if (firstByte < 0x80) {
|
|
13675
|
-
codePoint = firstByte;
|
|
13676
|
-
}
|
|
13677
|
-
break;
|
|
13678
|
-
case 2:
|
|
13679
|
-
secondByte = buf[i + 1];
|
|
13680
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
13681
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
|
|
13682
|
-
if (tempCodePoint > 0x7F) {
|
|
13683
|
-
codePoint = tempCodePoint;
|
|
13684
|
-
}
|
|
13685
|
-
}
|
|
13686
|
-
break;
|
|
13687
|
-
case 3:
|
|
13688
|
-
secondByte = buf[i + 1];
|
|
13689
|
-
thirdByte = buf[i + 2];
|
|
13690
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
13691
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
|
|
13692
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
13693
|
-
codePoint = tempCodePoint;
|
|
13694
|
-
}
|
|
13695
|
-
}
|
|
13696
|
-
break;
|
|
13697
|
-
case 4:
|
|
13698
|
-
secondByte = buf[i + 1];
|
|
13699
|
-
thirdByte = buf[i + 2];
|
|
13700
|
-
fourthByte = buf[i + 3];
|
|
13701
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
13702
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
|
|
13703
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
13704
|
-
codePoint = tempCodePoint;
|
|
13705
|
-
}
|
|
13706
|
-
}
|
|
13707
|
-
}
|
|
13708
|
-
}
|
|
13709
|
-
if (codePoint === null) {
|
|
13710
|
-
// we did not generate a valid codePoint so insert a
|
|
13711
|
-
// replacement char (U+FFFD) and advance only 1 byte
|
|
13712
|
-
codePoint = 0xFFFD;
|
|
13713
|
-
bytesPerSequence = 1;
|
|
13714
|
-
} else if (codePoint > 0xFFFF) {
|
|
13715
|
-
// encode to utf16 (surrogate pair dance)
|
|
13716
|
-
codePoint -= 0x10000;
|
|
13717
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
13718
|
-
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
13719
|
-
}
|
|
13720
|
-
res.push(codePoint);
|
|
13721
|
-
i += bytesPerSequence;
|
|
13722
|
-
}
|
|
13723
|
-
return decodeCodePointsArray(res);
|
|
13724
|
-
}
|
|
13725
|
-
|
|
13726
|
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
13727
|
-
// the lowest limit is Chrome, with 0x10000 args.
|
|
13728
|
-
// We go 1 magnitude less, for safety
|
|
13729
|
-
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
13730
|
-
function decodeCodePointsArray(codePoints) {
|
|
13731
|
-
var len = codePoints.length;
|
|
13732
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
13733
|
-
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
|
|
13734
|
-
}
|
|
13735
|
-
|
|
13736
|
-
// Decode in chunks to avoid "call stack size exceeded".
|
|
13737
|
-
var res = '';
|
|
13738
|
-
var i = 0;
|
|
13739
|
-
while (i < len) {
|
|
13740
|
-
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
|
|
13741
|
-
}
|
|
13742
|
-
return res;
|
|
13743
|
-
}
|
|
13744
|
-
function asciiSlice(buf, start, end) {
|
|
13745
|
-
var ret = '';
|
|
13746
|
-
end = Math.min(buf.length, end);
|
|
13747
|
-
for (var i = start; i < end; ++i) {
|
|
13748
|
-
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
13749
|
-
}
|
|
13750
|
-
return ret;
|
|
13751
|
-
}
|
|
13752
|
-
function latin1Slice(buf, start, end) {
|
|
13753
|
-
var ret = '';
|
|
13754
|
-
end = Math.min(buf.length, end);
|
|
13755
|
-
for (var i = start; i < end; ++i) {
|
|
13756
|
-
ret += String.fromCharCode(buf[i]);
|
|
13757
|
-
}
|
|
13758
|
-
return ret;
|
|
13759
|
-
}
|
|
13760
|
-
function hexSlice(buf, start, end) {
|
|
13761
|
-
var len = buf.length;
|
|
13762
|
-
if (!start || start < 0) start = 0;
|
|
13763
|
-
if (!end || end < 0 || end > len) end = len;
|
|
13764
|
-
var out = '';
|
|
13765
|
-
for (var i = start; i < end; ++i) {
|
|
13766
|
-
out += toHex(buf[i]);
|
|
13767
|
-
}
|
|
13768
|
-
return out;
|
|
13769
|
-
}
|
|
13770
|
-
function utf16leSlice(buf, start, end) {
|
|
13771
|
-
var bytes = buf.slice(start, end);
|
|
13772
|
-
var res = '';
|
|
13773
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
13774
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
13775
|
-
}
|
|
13776
|
-
return res;
|
|
13777
|
-
}
|
|
13778
|
-
Buffer$2.prototype.slice = function slice(start, end) {
|
|
13779
|
-
var len = this.length;
|
|
13780
|
-
start = ~~start;
|
|
13781
|
-
end = end === undefined ? len : ~~end;
|
|
13782
|
-
if (start < 0) {
|
|
13783
|
-
start += len;
|
|
13784
|
-
if (start < 0) start = 0;
|
|
13785
|
-
} else if (start > len) {
|
|
13786
|
-
start = len;
|
|
13787
|
-
}
|
|
13788
|
-
if (end < 0) {
|
|
13789
|
-
end += len;
|
|
13790
|
-
if (end < 0) end = 0;
|
|
13791
|
-
} else if (end > len) {
|
|
13792
|
-
end = len;
|
|
13793
|
-
}
|
|
13794
|
-
if (end < start) end = start;
|
|
13795
|
-
var newBuf;
|
|
13796
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13797
|
-
newBuf = this.subarray(start, end);
|
|
13798
|
-
newBuf.__proto__ = Buffer$2.prototype;
|
|
13799
|
-
} else {
|
|
13800
|
-
var sliceLen = end - start;
|
|
13801
|
-
newBuf = new Buffer$2(sliceLen, undefined);
|
|
13802
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
13803
|
-
newBuf[i] = this[i + start];
|
|
13804
|
-
}
|
|
13805
|
-
}
|
|
13806
|
-
return newBuf;
|
|
13807
|
-
};
|
|
13808
|
-
|
|
13809
|
-
/*
|
|
13810
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
13811
|
-
*/
|
|
13812
|
-
function checkOffset(offset, ext, length) {
|
|
13813
|
-
if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
|
|
13814
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
|
|
13815
|
-
}
|
|
13816
|
-
Buffer$2.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
|
|
13817
|
-
offset = offset | 0;
|
|
13818
|
-
byteLength = byteLength | 0;
|
|
13819
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13820
|
-
var val = this[offset];
|
|
13821
|
-
var mul = 1;
|
|
13822
|
-
var i = 0;
|
|
13823
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13824
|
-
val += this[offset + i] * mul;
|
|
13825
|
-
}
|
|
13826
|
-
return val;
|
|
13827
|
-
};
|
|
13828
|
-
Buffer$2.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
|
|
13829
|
-
offset = offset | 0;
|
|
13830
|
-
byteLength = byteLength | 0;
|
|
13831
|
-
if (!noAssert) {
|
|
13832
|
-
checkOffset(offset, byteLength, this.length);
|
|
13833
|
-
}
|
|
13834
|
-
var val = this[offset + --byteLength];
|
|
13835
|
-
var mul = 1;
|
|
13836
|
-
while (byteLength > 0 && (mul *= 0x100)) {
|
|
13837
|
-
val += this[offset + --byteLength] * mul;
|
|
13838
|
-
}
|
|
13839
|
-
return val;
|
|
13840
|
-
};
|
|
13841
|
-
Buffer$2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
13842
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13843
|
-
return this[offset];
|
|
13844
|
-
};
|
|
13845
|
-
Buffer$2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
13846
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13847
|
-
return this[offset] | this[offset + 1] << 8;
|
|
13848
|
-
};
|
|
13849
|
-
Buffer$2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
13850
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13851
|
-
return this[offset] << 8 | this[offset + 1];
|
|
13852
|
-
};
|
|
13853
|
-
Buffer$2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
13854
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13855
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
|
|
13856
|
-
};
|
|
13857
|
-
Buffer$2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
13858
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13859
|
-
return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
13860
|
-
};
|
|
13861
|
-
Buffer$2.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
|
|
13862
|
-
offset = offset | 0;
|
|
13863
|
-
byteLength = byteLength | 0;
|
|
13864
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13865
|
-
var val = this[offset];
|
|
13866
|
-
var mul = 1;
|
|
13867
|
-
var i = 0;
|
|
13868
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13869
|
-
val += this[offset + i] * mul;
|
|
13870
|
-
}
|
|
13871
|
-
mul *= 0x80;
|
|
13872
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13873
|
-
return val;
|
|
13874
|
-
};
|
|
13875
|
-
Buffer$2.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
|
|
13876
|
-
offset = offset | 0;
|
|
13877
|
-
byteLength = byteLength | 0;
|
|
13878
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13879
|
-
var i = byteLength;
|
|
13880
|
-
var mul = 1;
|
|
13881
|
-
var val = this[offset + --i];
|
|
13882
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
13883
|
-
val += this[offset + --i] * mul;
|
|
13884
|
-
}
|
|
13885
|
-
mul *= 0x80;
|
|
13886
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13887
|
-
return val;
|
|
13888
|
-
};
|
|
13889
|
-
Buffer$2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
13890
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13891
|
-
if (!(this[offset] & 0x80)) return this[offset];
|
|
13892
|
-
return (0xff - this[offset] + 1) * -1;
|
|
13893
|
-
};
|
|
13894
|
-
Buffer$2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
13895
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13896
|
-
var val = this[offset] | this[offset + 1] << 8;
|
|
13897
|
-
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
13898
|
-
};
|
|
13899
|
-
Buffer$2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
13900
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13901
|
-
var val = this[offset + 1] | this[offset] << 8;
|
|
13902
|
-
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
13903
|
-
};
|
|
13904
|
-
Buffer$2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
13905
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13906
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
13907
|
-
};
|
|
13908
|
-
Buffer$2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
13909
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13910
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
13911
|
-
};
|
|
13912
|
-
Buffer$2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
13913
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13914
|
-
return read(this, offset, true, 23, 4);
|
|
13915
|
-
};
|
|
13916
|
-
Buffer$2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
13917
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13918
|
-
return read(this, offset, false, 23, 4);
|
|
13919
|
-
};
|
|
13920
|
-
Buffer$2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
13921
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
13922
|
-
return read(this, offset, true, 52, 8);
|
|
13923
|
-
};
|
|
13924
|
-
Buffer$2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
13925
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
13926
|
-
return read(this, offset, false, 52, 8);
|
|
13927
|
-
};
|
|
13928
|
-
function checkInt(buf, value, offset, ext, max, min) {
|
|
13929
|
-
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
13930
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
13931
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
13932
|
-
}
|
|
13933
|
-
Buffer$2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
|
|
13934
|
-
value = +value;
|
|
13935
|
-
offset = offset | 0;
|
|
13936
|
-
byteLength = byteLength | 0;
|
|
13937
|
-
if (!noAssert) {
|
|
13938
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
13939
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
13940
|
-
}
|
|
13941
|
-
var mul = 1;
|
|
13942
|
-
var i = 0;
|
|
13943
|
-
this[offset] = value & 0xFF;
|
|
13944
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13945
|
-
this[offset + i] = value / mul & 0xFF;
|
|
13946
|
-
}
|
|
13947
|
-
return offset + byteLength;
|
|
13948
|
-
};
|
|
13949
|
-
Buffer$2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
|
|
13950
|
-
value = +value;
|
|
13951
|
-
offset = offset | 0;
|
|
13952
|
-
byteLength = byteLength | 0;
|
|
13953
|
-
if (!noAssert) {
|
|
13954
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
13955
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
13956
|
-
}
|
|
13957
|
-
var i = byteLength - 1;
|
|
13958
|
-
var mul = 1;
|
|
13959
|
-
this[offset + i] = value & 0xFF;
|
|
13960
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
13961
|
-
this[offset + i] = value / mul & 0xFF;
|
|
13962
|
-
}
|
|
13963
|
-
return offset + byteLength;
|
|
13964
|
-
};
|
|
13965
|
-
Buffer$2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
13966
|
-
value = +value;
|
|
13967
|
-
offset = offset | 0;
|
|
13968
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
13969
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
13970
|
-
this[offset] = value & 0xff;
|
|
13971
|
-
return offset + 1;
|
|
13972
|
-
};
|
|
13973
|
-
function objectWriteUInt16(buf, value, offset, littleEndian) {
|
|
13974
|
-
if (value < 0) value = 0xffff + value + 1;
|
|
13975
|
-
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
13976
|
-
buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
|
|
13977
|
-
}
|
|
13978
|
-
}
|
|
13979
|
-
Buffer$2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
13980
|
-
value = +value;
|
|
13981
|
-
offset = offset | 0;
|
|
13982
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
13983
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13984
|
-
this[offset] = value & 0xff;
|
|
13985
|
-
this[offset + 1] = value >>> 8;
|
|
13986
|
-
} else {
|
|
13987
|
-
objectWriteUInt16(this, value, offset, true);
|
|
13988
|
-
}
|
|
13989
|
-
return offset + 2;
|
|
13990
|
-
};
|
|
13991
|
-
Buffer$2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
13992
|
-
value = +value;
|
|
13993
|
-
offset = offset | 0;
|
|
13994
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
13995
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13996
|
-
this[offset] = value >>> 8;
|
|
13997
|
-
this[offset + 1] = value & 0xff;
|
|
13998
|
-
} else {
|
|
13999
|
-
objectWriteUInt16(this, value, offset, false);
|
|
14000
|
-
}
|
|
14001
|
-
return offset + 2;
|
|
14002
|
-
};
|
|
14003
|
-
function objectWriteUInt32(buf, value, offset, littleEndian) {
|
|
14004
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
14005
|
-
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
14006
|
-
buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
|
|
14007
|
-
}
|
|
14008
|
-
}
|
|
14009
|
-
Buffer$2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
14010
|
-
value = +value;
|
|
14011
|
-
offset = offset | 0;
|
|
14012
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
14013
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14014
|
-
this[offset + 3] = value >>> 24;
|
|
14015
|
-
this[offset + 2] = value >>> 16;
|
|
14016
|
-
this[offset + 1] = value >>> 8;
|
|
14017
|
-
this[offset] = value & 0xff;
|
|
14018
|
-
} else {
|
|
14019
|
-
objectWriteUInt32(this, value, offset, true);
|
|
14020
|
-
}
|
|
14021
|
-
return offset + 4;
|
|
14022
|
-
};
|
|
14023
|
-
Buffer$2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
14024
|
-
value = +value;
|
|
14025
|
-
offset = offset | 0;
|
|
14026
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
14027
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14028
|
-
this[offset] = value >>> 24;
|
|
14029
|
-
this[offset + 1] = value >>> 16;
|
|
14030
|
-
this[offset + 2] = value >>> 8;
|
|
14031
|
-
this[offset + 3] = value & 0xff;
|
|
14032
|
-
} else {
|
|
14033
|
-
objectWriteUInt32(this, value, offset, false);
|
|
14034
|
-
}
|
|
14035
|
-
return offset + 4;
|
|
14036
|
-
};
|
|
14037
|
-
Buffer$2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
|
|
14038
|
-
value = +value;
|
|
14039
|
-
offset = offset | 0;
|
|
14040
|
-
if (!noAssert) {
|
|
14041
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14042
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14043
|
-
}
|
|
14044
|
-
var i = 0;
|
|
14045
|
-
var mul = 1;
|
|
14046
|
-
var sub = 0;
|
|
14047
|
-
this[offset] = value & 0xFF;
|
|
14048
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
14049
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
14050
|
-
sub = 1;
|
|
14051
|
-
}
|
|
14052
|
-
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14053
|
-
}
|
|
14054
|
-
return offset + byteLength;
|
|
14055
|
-
};
|
|
14056
|
-
Buffer$2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
|
|
14057
|
-
value = +value;
|
|
14058
|
-
offset = offset | 0;
|
|
14059
|
-
if (!noAssert) {
|
|
14060
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14061
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14062
|
-
}
|
|
14063
|
-
var i = byteLength - 1;
|
|
14064
|
-
var mul = 1;
|
|
14065
|
-
var sub = 0;
|
|
14066
|
-
this[offset + i] = value & 0xFF;
|
|
14067
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
14068
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
14069
|
-
sub = 1;
|
|
14070
|
-
}
|
|
14071
|
-
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14072
|
-
}
|
|
14073
|
-
return offset + byteLength;
|
|
14074
|
-
};
|
|
14075
|
-
Buffer$2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
14076
|
-
value = +value;
|
|
14077
|
-
offset = offset | 0;
|
|
14078
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
|
|
14079
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
14080
|
-
if (value < 0) value = 0xff + value + 1;
|
|
14081
|
-
this[offset] = value & 0xff;
|
|
14082
|
-
return offset + 1;
|
|
14083
|
-
};
|
|
14084
|
-
Buffer$2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
14085
|
-
value = +value;
|
|
14086
|
-
offset = offset | 0;
|
|
14087
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14088
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14089
|
-
this[offset] = value & 0xff;
|
|
14090
|
-
this[offset + 1] = value >>> 8;
|
|
14091
|
-
} else {
|
|
14092
|
-
objectWriteUInt16(this, value, offset, true);
|
|
14093
|
-
}
|
|
14094
|
-
return offset + 2;
|
|
14095
|
-
};
|
|
14096
|
-
Buffer$2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
14097
|
-
value = +value;
|
|
14098
|
-
offset = offset | 0;
|
|
14099
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14100
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14101
|
-
this[offset] = value >>> 8;
|
|
14102
|
-
this[offset + 1] = value & 0xff;
|
|
14103
|
-
} else {
|
|
14104
|
-
objectWriteUInt16(this, value, offset, false);
|
|
14105
|
-
}
|
|
14106
|
-
return offset + 2;
|
|
14107
|
-
};
|
|
14108
|
-
Buffer$2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
14109
|
-
value = +value;
|
|
14110
|
-
offset = offset | 0;
|
|
14111
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14112
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14113
|
-
this[offset] = value & 0xff;
|
|
14114
|
-
this[offset + 1] = value >>> 8;
|
|
14115
|
-
this[offset + 2] = value >>> 16;
|
|
14116
|
-
this[offset + 3] = value >>> 24;
|
|
14117
|
-
} else {
|
|
14118
|
-
objectWriteUInt32(this, value, offset, true);
|
|
14119
|
-
}
|
|
14120
|
-
return offset + 4;
|
|
14121
|
-
};
|
|
14122
|
-
Buffer$2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
14123
|
-
value = +value;
|
|
14124
|
-
offset = offset | 0;
|
|
14125
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14126
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
14127
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14128
|
-
this[offset] = value >>> 24;
|
|
14129
|
-
this[offset + 1] = value >>> 16;
|
|
14130
|
-
this[offset + 2] = value >>> 8;
|
|
14131
|
-
this[offset + 3] = value & 0xff;
|
|
14132
|
-
} else {
|
|
14133
|
-
objectWriteUInt32(this, value, offset, false);
|
|
14134
|
-
}
|
|
14135
|
-
return offset + 4;
|
|
14136
|
-
};
|
|
14137
|
-
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
14138
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
14139
|
-
if (offset < 0) throw new RangeError('Index out of range');
|
|
14140
|
-
}
|
|
14141
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
14142
|
-
if (!noAssert) {
|
|
14143
|
-
checkIEEE754(buf, value, offset, 4);
|
|
14144
|
-
}
|
|
14145
|
-
write(buf, value, offset, littleEndian, 23, 4);
|
|
14146
|
-
return offset + 4;
|
|
14147
|
-
}
|
|
14148
|
-
Buffer$2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
14149
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
14150
|
-
};
|
|
14151
|
-
Buffer$2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
14152
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
14153
|
-
};
|
|
14154
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
14155
|
-
if (!noAssert) {
|
|
14156
|
-
checkIEEE754(buf, value, offset, 8);
|
|
14157
|
-
}
|
|
14158
|
-
write(buf, value, offset, littleEndian, 52, 8);
|
|
14159
|
-
return offset + 8;
|
|
14160
|
-
}
|
|
14161
|
-
Buffer$2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
14162
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
14163
|
-
};
|
|
14164
|
-
Buffer$2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
14165
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
14166
|
-
};
|
|
14167
|
-
|
|
14168
|
-
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
14169
|
-
Buffer$2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
14170
|
-
if (!start) start = 0;
|
|
14171
|
-
if (!end && end !== 0) end = this.length;
|
|
14172
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
14173
|
-
if (!targetStart) targetStart = 0;
|
|
14174
|
-
if (end > 0 && end < start) end = start;
|
|
14175
|
-
|
|
14176
|
-
// Copy 0 bytes; we're done
|
|
14177
|
-
if (end === start) return 0;
|
|
14178
|
-
if (target.length === 0 || this.length === 0) return 0;
|
|
14179
|
-
|
|
14180
|
-
// Fatal error conditions
|
|
14181
|
-
if (targetStart < 0) {
|
|
14182
|
-
throw new RangeError('targetStart out of bounds');
|
|
14183
|
-
}
|
|
14184
|
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
|
|
14185
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds');
|
|
14186
|
-
|
|
14187
|
-
// Are we oob?
|
|
14188
|
-
if (end > this.length) end = this.length;
|
|
14189
|
-
if (target.length - targetStart < end - start) {
|
|
14190
|
-
end = target.length - targetStart + start;
|
|
14191
|
-
}
|
|
14192
|
-
var len = end - start;
|
|
14193
|
-
var i;
|
|
14194
|
-
if (this === target && start < targetStart && targetStart < end) {
|
|
14195
|
-
// descending copy from end
|
|
14196
|
-
for (i = len - 1; i >= 0; --i) {
|
|
14197
|
-
target[i + targetStart] = this[i + start];
|
|
14198
|
-
}
|
|
14199
|
-
} else if (len < 1000 || !Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14200
|
-
// ascending copy from start
|
|
14201
|
-
for (i = 0; i < len; ++i) {
|
|
14202
|
-
target[i + targetStart] = this[i + start];
|
|
14203
|
-
}
|
|
14204
|
-
} else {
|
|
14205
|
-
Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
|
|
14206
|
-
}
|
|
14207
|
-
return len;
|
|
14208
|
-
};
|
|
14209
|
-
|
|
14210
|
-
// Usage:
|
|
14211
|
-
// buffer.fill(number[, offset[, end]])
|
|
14212
|
-
// buffer.fill(buffer[, offset[, end]])
|
|
14213
|
-
// buffer.fill(string[, offset[, end]][, encoding])
|
|
14214
|
-
Buffer$2.prototype.fill = function fill(val, start, end, encoding) {
|
|
14215
|
-
// Handle string cases:
|
|
14216
|
-
if (typeof val === 'string') {
|
|
14217
|
-
if (typeof start === 'string') {
|
|
14218
|
-
encoding = start;
|
|
14219
|
-
start = 0;
|
|
14220
|
-
end = this.length;
|
|
14221
|
-
} else if (typeof end === 'string') {
|
|
14222
|
-
encoding = end;
|
|
14223
|
-
end = this.length;
|
|
14224
|
-
}
|
|
14225
|
-
if (val.length === 1) {
|
|
14226
|
-
var code = val.charCodeAt(0);
|
|
14227
|
-
if (code < 256) {
|
|
14228
|
-
val = code;
|
|
14229
|
-
}
|
|
14230
|
-
}
|
|
14231
|
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
14232
|
-
throw new TypeError('encoding must be a string');
|
|
14233
|
-
}
|
|
14234
|
-
if (typeof encoding === 'string' && !Buffer$2.isEncoding(encoding)) {
|
|
14235
|
-
throw new TypeError('Unknown encoding: ' + encoding);
|
|
14236
|
-
}
|
|
14237
|
-
} else if (typeof val === 'number') {
|
|
14238
|
-
val = val & 255;
|
|
14239
|
-
}
|
|
14240
|
-
|
|
14241
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
14242
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
14243
|
-
throw new RangeError('Out of range index');
|
|
14244
|
-
}
|
|
14245
|
-
if (end <= start) {
|
|
14246
|
-
return this;
|
|
14247
|
-
}
|
|
14248
|
-
start = start >>> 0;
|
|
14249
|
-
end = end === undefined ? this.length : end >>> 0;
|
|
14250
|
-
if (!val) val = 0;
|
|
14251
|
-
var i;
|
|
14252
|
-
if (typeof val === 'number') {
|
|
14253
|
-
for (i = start; i < end; ++i) {
|
|
14254
|
-
this[i] = val;
|
|
14255
|
-
}
|
|
14256
|
-
} else {
|
|
14257
|
-
var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer$2(val, encoding).toString());
|
|
14258
|
-
var len = bytes.length;
|
|
14259
|
-
for (i = 0; i < end - start; ++i) {
|
|
14260
|
-
this[i + start] = bytes[i % len];
|
|
14261
|
-
}
|
|
14262
|
-
}
|
|
14263
|
-
return this;
|
|
14264
|
-
};
|
|
14265
|
-
|
|
14266
|
-
// HELPER FUNCTIONS
|
|
14267
|
-
// ================
|
|
14268
|
-
|
|
14269
|
-
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
14270
|
-
function base64clean(str) {
|
|
14271
|
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
14272
|
-
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
|
|
14273
|
-
// Node converts strings with length < 2 to ''
|
|
14274
|
-
if (str.length < 2) return '';
|
|
14275
|
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
14276
|
-
while (str.length % 4 !== 0) {
|
|
14277
|
-
str = str + '=';
|
|
14278
|
-
}
|
|
14279
|
-
return str;
|
|
14280
|
-
}
|
|
14281
|
-
function stringtrim(str) {
|
|
14282
|
-
if (str.trim) return str.trim();
|
|
14283
|
-
return str.replace(/^\s+|\s+$/g, '');
|
|
14284
|
-
}
|
|
14285
|
-
function toHex(n) {
|
|
14286
|
-
if (n < 16) return '0' + n.toString(16);
|
|
14287
|
-
return n.toString(16);
|
|
14288
|
-
}
|
|
14289
|
-
function utf8ToBytes(string, units) {
|
|
14290
|
-
units = units || Infinity;
|
|
14291
|
-
var codePoint;
|
|
14292
|
-
var length = string.length;
|
|
14293
|
-
var leadSurrogate = null;
|
|
14294
|
-
var bytes = [];
|
|
14295
|
-
for (var i = 0; i < length; ++i) {
|
|
14296
|
-
codePoint = string.charCodeAt(i);
|
|
14297
|
-
|
|
14298
|
-
// is surrogate component
|
|
14299
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
14300
|
-
// last char was a lead
|
|
14301
|
-
if (!leadSurrogate) {
|
|
14302
|
-
// no lead yet
|
|
14303
|
-
if (codePoint > 0xDBFF) {
|
|
14304
|
-
// unexpected trail
|
|
14305
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14306
|
-
continue;
|
|
14307
|
-
} else if (i + 1 === length) {
|
|
14308
|
-
// unpaired lead
|
|
14309
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14310
|
-
continue;
|
|
14311
|
-
}
|
|
14312
|
-
|
|
14313
|
-
// valid lead
|
|
14314
|
-
leadSurrogate = codePoint;
|
|
14315
|
-
continue;
|
|
14316
|
-
}
|
|
14317
|
-
|
|
14318
|
-
// 2 leads in a row
|
|
14319
|
-
if (codePoint < 0xDC00) {
|
|
14320
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14321
|
-
leadSurrogate = codePoint;
|
|
14322
|
-
continue;
|
|
14323
|
-
}
|
|
14324
|
-
|
|
14325
|
-
// valid surrogate pair
|
|
14326
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
14327
|
-
} else if (leadSurrogate) {
|
|
14328
|
-
// valid bmp char, but last char was a lead
|
|
14329
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14330
|
-
}
|
|
14331
|
-
leadSurrogate = null;
|
|
14332
|
-
|
|
14333
|
-
// encode utf8
|
|
14334
|
-
if (codePoint < 0x80) {
|
|
14335
|
-
if ((units -= 1) < 0) break;
|
|
14336
|
-
bytes.push(codePoint);
|
|
14337
|
-
} else if (codePoint < 0x800) {
|
|
14338
|
-
if ((units -= 2) < 0) break;
|
|
14339
|
-
bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
|
|
14340
|
-
} else if (codePoint < 0x10000) {
|
|
14341
|
-
if ((units -= 3) < 0) break;
|
|
14342
|
-
bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14343
|
-
} else if (codePoint < 0x110000) {
|
|
14344
|
-
if ((units -= 4) < 0) break;
|
|
14345
|
-
bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14346
|
-
} else {
|
|
14347
|
-
throw new Error('Invalid code point');
|
|
14348
|
-
}
|
|
14349
|
-
}
|
|
14350
|
-
return bytes;
|
|
14351
|
-
}
|
|
14352
|
-
function asciiToBytes(str) {
|
|
14353
|
-
var byteArray = [];
|
|
14354
|
-
for (var i = 0; i < str.length; ++i) {
|
|
14355
|
-
// Node's code seems to be doing this and not & 0x7F..
|
|
14356
|
-
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
14357
|
-
}
|
|
14358
|
-
return byteArray;
|
|
14359
|
-
}
|
|
14360
|
-
function utf16leToBytes(str, units) {
|
|
14361
|
-
var c, hi, lo;
|
|
14362
|
-
var byteArray = [];
|
|
14363
|
-
for (var i = 0; i < str.length; ++i) {
|
|
14364
|
-
if ((units -= 2) < 0) break;
|
|
14365
|
-
c = str.charCodeAt(i);
|
|
14366
|
-
hi = c >> 8;
|
|
14367
|
-
lo = c % 256;
|
|
14368
|
-
byteArray.push(lo);
|
|
14369
|
-
byteArray.push(hi);
|
|
14370
|
-
}
|
|
14371
|
-
return byteArray;
|
|
14372
|
-
}
|
|
14373
|
-
function base64ToBytes(str) {
|
|
14374
|
-
return toByteArray(base64clean(str));
|
|
14375
|
-
}
|
|
14376
|
-
function blitBuffer(src, dst, offset, length) {
|
|
14377
|
-
for (var i = 0; i < length; ++i) {
|
|
14378
|
-
if (i + offset >= dst.length || i >= src.length) break;
|
|
14379
|
-
dst[i + offset] = src[i];
|
|
14380
|
-
}
|
|
14381
|
-
return i;
|
|
14382
|
-
}
|
|
14383
|
-
function isnan(val) {
|
|
14384
|
-
return val !== val; // eslint-disable-line no-self-compare
|
|
14385
|
-
}
|
|
14386
|
-
|
|
14387
|
-
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
|
14388
|
-
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|
14389
|
-
// Object.prototype.constructor. Remove this eventually
|
|
14390
|
-
function isBuffer$1(obj) {
|
|
14391
|
-
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
|
|
14392
|
-
}
|
|
14393
|
-
function isFastBuffer(obj) {
|
|
14394
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
|
|
14395
|
-
}
|
|
14396
|
-
|
|
14397
|
-
// For Node v0.10 support. Remove this eventually.
|
|
14398
|
-
function isSlowBuffer(obj) {
|
|
14399
|
-
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
|
|
14400
|
-
}
|
|
14401
|
-
|
|
14402
12754
|
/**
|
|
14403
12755
|
* return an decoded URL Safe Base64 as UTF-8 encoded string
|
|
14404
12756
|
*/
|
|
@@ -14406,8 +12758,8 @@ function decodeBase64UrlSafe(base64) {
|
|
|
14406
12758
|
// Add removed at end '='
|
|
14407
12759
|
// base64 += Array(5 - base64.length % 4).join('=');
|
|
14408
12760
|
|
|
14409
|
-
base64 = base64.replace(
|
|
14410
|
-
.replace(
|
|
12761
|
+
base64 = base64.replace(/-/g, '+') // Convert '-' to '+'
|
|
12762
|
+
.replace(/_/g, '/'); // Convert '_' to '/'
|
|
14411
12763
|
|
|
14412
12764
|
return decodeBase64(base64); // Cf: https://developer.mozilla.org/fr/docs/D%C3%A9coder_encoder_en_base64
|
|
14413
12765
|
}
|
|
@@ -14663,6 +13015,7 @@ function createClient(creationConfig) {
|
|
|
14663
13015
|
})["catch"](console.error);
|
|
14664
13016
|
});
|
|
14665
13017
|
return {
|
|
13018
|
+
core: coreClient,
|
|
14666
13019
|
showAuth: function showAuth(options) {
|
|
14667
13020
|
return client.then(function (client) {
|
|
14668
13021
|
return client.showAuth(options);
|