@reachfive/identity-ui 1.18.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 +32 -1
- package/cjs/identity-ui.js +187 -1790
- package/es/identity-ui.js +188 -1791
- package/index.d.ts +485 -14
- package/package.json +13 -4
- package/umd/identity-ui.js +13596 -5792
- package/umd/identity-ui.min.js +1 -1
package/cjs/identity-ui.js
CHANGED
|
@@ -20,8 +20,10 @@ var validator = require('validator');
|
|
|
20
20
|
var validator__default = _interopDefault(validator);
|
|
21
21
|
var libphonenumber = require('libphonenumber-js');
|
|
22
22
|
var lodashEs = require('lodash-es');
|
|
23
|
+
var luxon = require('luxon');
|
|
23
24
|
var charInfo = require('char-info');
|
|
24
25
|
var zxcvbn = _interopDefault(require('@reachfive/zxcvbn'));
|
|
26
|
+
require('Buffer');
|
|
25
27
|
|
|
26
28
|
function ownKeys(object, enumerableOnly) {
|
|
27
29
|
var keys = Object.keys(object);
|
|
@@ -2825,7 +2827,13 @@ var UserError = /*#__PURE__*/function (_Error) {
|
|
|
2825
2827
|
_this.isUserError = true;
|
|
2826
2828
|
return _this;
|
|
2827
2829
|
}
|
|
2828
|
-
|
|
2830
|
+
_createClass(UserError, null, [{
|
|
2831
|
+
key: "fromAppError",
|
|
2832
|
+
value: function fromAppError(appError) {
|
|
2833
|
+
return new UserError(appError.errorUserMsg || appError.errorDescription || appError.error);
|
|
2834
|
+
}
|
|
2835
|
+
}]);
|
|
2836
|
+
return UserError;
|
|
2829
2837
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
2830
2838
|
|
|
2831
2839
|
/** `Object#toString` result references. */
|
|
@@ -3408,6 +3416,7 @@ function get(object, path, defaultValue) {
|
|
|
3408
3416
|
return result === undefined ? defaultValue : result;
|
|
3409
3417
|
}
|
|
3410
3418
|
|
|
3419
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3411
3420
|
var white = '#fff';
|
|
3412
3421
|
var gray200 = '#e9ecef';
|
|
3413
3422
|
var gray400 = '#ced4da';
|
|
@@ -3415,6 +3424,8 @@ var gray500 = '#adb5bd';
|
|
|
3415
3424
|
var gray600 = '#868e96';
|
|
3416
3425
|
var gray700 = '#495057';
|
|
3417
3426
|
var gray900 = '#212529';
|
|
3427
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
3428
|
+
|
|
3418
3429
|
var inputBtnFocusBoxShadow = function inputBtnFocusBoxShadow(borderColor) {
|
|
3419
3430
|
return "0 0 0 3px ".concat(polished.transparentize(0.5, borderColor));
|
|
3420
3431
|
};
|
|
@@ -3805,7 +3816,7 @@ var WidgetContent = styled__default(function (_ref) {
|
|
|
3805
3816
|
}, function (props) {
|
|
3806
3817
|
return props.standalone && "\n padding: ".concat(props.theme.get('spacing') * 2, "px;\n border-radius: ").concat(props.theme.get('borderRadius'), "px;\n background-color: ").concat(props.theme.get('backgroundColor'), ";\n max-width: ").concat(props.theme.get('maxWidth'), "px;\n box-sizing: border-box;\n margin: 0 auto;\n ");
|
|
3807
3818
|
});
|
|
3808
|
-
|
|
3819
|
+
function widgetContainer(_ref2) {
|
|
3809
3820
|
var name = _ref2.name,
|
|
3810
3821
|
_ref2$standalone = _ref2.standalone,
|
|
3811
3822
|
standalone = _ref2$standalone === void 0 ? true : _ref2$standalone,
|
|
@@ -3827,7 +3838,7 @@ var WidgetContainer = (function (_ref2) {
|
|
|
3827
3838
|
transition: state
|
|
3828
3839
|
}, title && /*#__PURE__*/React__default.createElement(Heading, null, title), !noIntro && intro && /*#__PURE__*/React__default.createElement(Intro, null, intro), children);
|
|
3829
3840
|
});
|
|
3830
|
-
}
|
|
3841
|
+
}
|
|
3831
3842
|
|
|
3832
3843
|
var _excluded = ["component", "prepare"],
|
|
3833
3844
|
_excluded2 = ["i18n", "theme"],
|
|
@@ -3860,7 +3871,7 @@ function createWidget(_ref) {
|
|
|
3860
3871
|
i18n: resolveI18n(context.defaultI18n, i18n),
|
|
3861
3872
|
theme: resolveTheme(theme)
|
|
3862
3873
|
});
|
|
3863
|
-
return /*#__PURE__*/React__default.createElement(
|
|
3874
|
+
return /*#__PURE__*/React__default.createElement(widgetContainer, _extends({}, widgetAttrs, fullProps), /*#__PURE__*/React__default.createElement(Component, fullProps));
|
|
3864
3875
|
});
|
|
3865
3876
|
};
|
|
3866
3877
|
}
|
|
@@ -3882,11 +3893,11 @@ function multiViewWidget(_ref3) {
|
|
|
3882
3893
|
onStartup = _ref3.onStartup,
|
|
3883
3894
|
handlers = _ref3.handlers;
|
|
3884
3895
|
return _class = /*#__PURE__*/function (_React$Component) {
|
|
3885
|
-
_inherits(
|
|
3886
|
-
var _super = _createSuper(
|
|
3887
|
-
function
|
|
3896
|
+
_inherits(MultiViewWidget, _React$Component);
|
|
3897
|
+
var _super = _createSuper(MultiViewWidget);
|
|
3898
|
+
function MultiViewWidget() {
|
|
3888
3899
|
var _this;
|
|
3889
|
-
_classCallCheck(this,
|
|
3900
|
+
_classCallCheck(this, MultiViewWidget);
|
|
3890
3901
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3891
3902
|
args[_key] = arguments[_key];
|
|
3892
3903
|
}
|
|
@@ -3904,7 +3915,7 @@ function multiViewWidget(_ref3) {
|
|
|
3904
3915
|
});
|
|
3905
3916
|
return _this;
|
|
3906
3917
|
}
|
|
3907
|
-
_createClass(
|
|
3918
|
+
_createClass(MultiViewWidget, [{
|
|
3908
3919
|
key: "getChildContext",
|
|
3909
3920
|
value: function getChildContext() {
|
|
3910
3921
|
return {
|
|
@@ -3926,7 +3937,7 @@ function multiViewWidget(_ref3) {
|
|
|
3926
3937
|
}));
|
|
3927
3938
|
}
|
|
3928
3939
|
}]);
|
|
3929
|
-
return
|
|
3940
|
+
return MultiViewWidget;
|
|
3930
3941
|
}(React__default.Component), _defineProperty(_class, "childContextTypes", {
|
|
3931
3942
|
goTo: PropTypes.func.isRequired
|
|
3932
3943
|
}), _class;
|
|
@@ -4126,7 +4137,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
4126
4137
|
}
|
|
4127
4138
|
|
|
4128
4139
|
/** Built-in value references. */
|
|
4129
|
-
var Uint8Array
|
|
4140
|
+
var Uint8Array = root.Uint8Array;
|
|
4130
4141
|
|
|
4131
4142
|
/**
|
|
4132
4143
|
* Converts `map` to its key-value pairs.
|
|
@@ -4191,7 +4202,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
4191
4202
|
object = object.buffer;
|
|
4192
4203
|
other = other.buffer;
|
|
4193
4204
|
case arrayBufferTag:
|
|
4194
|
-
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array
|
|
4205
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
4195
4206
|
return false;
|
|
4196
4207
|
}
|
|
4197
4208
|
return true;
|
|
@@ -6235,103 +6246,116 @@ var microsoft = {
|
|
|
6235
6246
|
icon: icon$a
|
|
6236
6247
|
};
|
|
6237
6248
|
|
|
6238
|
-
var icon$b = "data:image/svg+xml,%
|
|
6249
|
+
var icon$b = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20width%3D%22800px%22%20height%3D%22800px%22%20viewBox%3D%220%200%20512%20512%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M9%2032V480H181.366V255.862L331.358%20480H504V32H331.358V255.862L181.366%2032H9Z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E";
|
|
6250
|
+
|
|
6251
|
+
var naver = {
|
|
6252
|
+
key: 'naver',
|
|
6253
|
+
name: 'Naver',
|
|
6254
|
+
color: '#19CE60',
|
|
6255
|
+
icon: icon$b,
|
|
6256
|
+
windowSize: {
|
|
6257
|
+
width: 450,
|
|
6258
|
+
height: 400
|
|
6259
|
+
}
|
|
6260
|
+
};
|
|
6261
|
+
|
|
6262
|
+
var icon$c = "data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%201500%20750%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M%20145.507812%20616.734375%20C%2093.640625%20616.734375%2051.414062%20574.609375%2051.414062%20520.867188%20C%2051.414062%20467.121094%2093.640625%20424.894531%20145.507812%20424.894531%20C%20197.03125%20424.894531%20239.46875%20467.121094%20239.46875%20520.867188%20C%20239.46875%20574.609375%20197.03125%20616.734375%20145.507812%20616.734375%20M%20145.507812%20375.074219%20C%2063.894531%20375.074219%200%20439.054688%200%20520.867188%20C%200%20602.574219%2063.894531%20666.65625%20145.507812%20666.65625%20C%20226.910156%20666.65625%20290.804688%20602.574219%20290.804688%20520.867188%20C%20290.804688%20439.054688%20226.910156%20375.074219%20145.507812%20375.074219%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%20893.976562%20517.019531%20C%20893.496094%20438.929688%20830.347656%20375.402344%20753.089844%20375.402344%20C%20673.589844%20375.402344%20611.269531%20439.15625%20611.269531%20520.511719%20C%20611.269531%20558.714844%20625.914062%20594.980469%20652.265625%20622.667969%20C%20679.09375%20650.6875%20714.476562%20666.128906%20752.128906%20666.128906%20C%20795.101562%20666.128906%20855.308594%20645.53125%20883.929688%20587.082031%20L%20884.679688%20585.195312%20L%20827.0625%20585.195312%20L%20826.714844%20585.625%20C%20811.242188%20604.109375%20782.035156%20616.582031%20754.214844%20616.582031%20C%20718.886719%20616.582031%20676.503906%20593.320312%20664.90625%20540.808594%20L%20892.855469%20540.808594%20C%20893.363281%20535.375%20893.976562%20524.511719%20893.976562%20517.019531%20M%20666.589844%20494.433594%20C%20673.589844%20459.25%20707.316406%20424.894531%20752.664062%20424.894531%20C%20797.933594%20424.894531%20831.632812%20459.25%20838.554688%20494.433594%20Z%20M%20666.589844%20494.433594%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%20451.410156%20423.234375%20C%20400.050781%20423.234375%20373.941406%20450.722656%20373.941406%20505.148438%20L%20373.941406%20666.253906%20L%20321.1875%20666.253906%20L%20321.1875%20501.351562%20C%20321.695312%20472.453125%20326.828125%20452.007812%20338.640625%20432.816406%20C%20352.613281%20411.265625%20385.804688%20375%20451.410156%20375%20C%20516.855469%20375%20550.15625%20411.265625%20564.105469%20432.816406%20C%20575.808594%20452.007812%20581.101562%20472.453125%20581.421875%20501.351562%20L%20581.421875%20666.253906%20L%20528.722656%20666.253906%20L%20528.722656%20505.148438%20C%20528.722656%20450.722656%20502.773438%20423.234375%20451.410156%20423.234375%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M%201168.1875%20375.074219%20L%201057.015625%20645.933594%20L%201029.546875%20712.957031%20L%201014.367188%20750%20L%20959.53125%20750%20L%201002.074219%20645.984375%20L%20888.445312%20375.074219%20L%20946.382812%20375.074219%20L%201029.570312%20578.734375%20L%201112.921875%20375.074219%20Z%20M%201168.1875%20375.074219%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6239
6263
|
|
|
6240
6264
|
var oney = {
|
|
6241
6265
|
key: 'oney',
|
|
6242
6266
|
name: 'Oney',
|
|
6243
6267
|
color: '#8bbc06',
|
|
6244
|
-
icon: icon$
|
|
6268
|
+
icon: icon$c
|
|
6245
6269
|
};
|
|
6246
6270
|
|
|
6247
|
-
var icon$
|
|
6271
|
+
var icon$d = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%22350%22%20height%3D%22350%22%3E%20%20%20%20%3Cpath%20id%3D%22background%22%20style%3D%22fill%3A%20rgb%28255%2C%20255%2C%20255%29%3B%22%20d%3D%22M%20350%2C350%200%2C350%200%2C0%20l%20350%2C0%200%2C350%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_o%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%2043.07789%2C321.77478%20c%20-12.673527%2C0%20-24.106883%2C-8.06959%20-24.106883%2C-25.70382%200%2C-17.63421%2011.433356%2C-25.7038%2024.106883%2C-25.7038%2012.673527%2C0%2024.089894%2C8.06959%2024.089894%2C25.7038%200%2C17.63422%20-11.416367%2C25.70382%20-24.089894%2C25.70382%20m%200%2C-40.56887%20c%20-9.581594%2C0%20-11.331424%2C8.63023%20-11.331424%2C14.86505%200%2C6.23485%201.74983%2C14.88207%2011.331424%2C14.88207%209.581594%2C0%2011.331424%2C-8.64722%2011.331424%2C-14.88207%200%2C-6.23482%20-1.74983%2C-14.86505%20-11.331424%2C-14.86505%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_r%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%2075.959576%2C271.65166%2012.197845%2C0%200%2C5.72518%20c%202.327444%2C-3.09194%208.052616%2C-6.72751%2013.421029%2C-6.72751%200.50966%2C0%201.13824%2C0%201.66489%2C0.068%20l%200%2C12.04495%20-0.62858%2C0%20c%20-5.572279%2C0%20-11.671202%2C0.86642%20-13.641884%2C5.19853%20l%200%2C32.39734%20-13.0133%2C0%200%2C-48.70644%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_a%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20137.30386%2C316.11774%20c%20-4.96068%2C3.26181%20-10.32909%2C4.84176%20-16.10523%2C4.84176%20-9.08892%2C0%20-14.47432%2C-6.04795%20-14.47432%2C-14.16853%200%2C-10.9067%2010.0233%2C-16.66585%2030.68149%2C-18.9933%20l%200%2C-2.71819%20c%200%2C-3.53364%20-2.68421%2C-5.60624%20-7.64489%2C-5.60624%20-4.96069%2C0%20-8.98699%2C1.97068%20-11.89205%2C5.60624%20l%20-8.64722%2C-4.9267%20c%204.53597%2C-6.35375%2011.45034%2C-9.53062%2020.74313%2C-9.53062%2012.70751%2C0%2019.84274%2C5.50432%2019.84274%2C14.45732%200%2C0%20-0.017%2C35.21747%200%2C35.3024%20l%20-11.36541%2C0%20-1.13824%2C-4.26414%20z%20m%20-17.95699%2C-10.26115%20c%200%2C3.27881%202.05563%2C6.33676%205.77614%2C6.33676%204.02631%2C0%207.95068%2C-1.66487%2011.87506%2C-5.13056%20l%200%2C-11.53528%20c%20-11.97699%2C1.47801%20-17.6512%2C4.56993%20-17.6512%2C10.32909%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_n%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20159.93783%2C272.9496%2010.6179%2C-1.46103%201.17222%2C5.77615%20c%205.98%2C-4.38307%2010.73682%2C-6.71052%2016.71682%2C-6.71052%2010.0233%2C0%2015.20483%2C5.31745%2015.20483%2C15.85039%20l%200%2C33.90934%20-12.82642%2C0%200%2C-31.68381%20c%200%2C-5.96302%20-1.54596%2C-8.64723%20-6.18386%2C-8.64723%20-3.82245%2C0%20-7.64489%2C1.73284%20-12.01097%2C5.4024%20l%200%2C34.92864%20-12.69052%2C0%200%2C-47.36433%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_g%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20235.02253%2C309.88953%20c%209.7175%2C-0.0679%2010.54995%2C-9.97234%2010.54995%2C-16.41103%200%2C-7.64489%20-3.72052%2C-13.81176%20-10.63489%2C-13.81176%20-4.60393%2C0%20-9.75148%2C3.36374%20-9.75148%2C14.33841%200%2C5.99699%200.42471%2C15.96931%209.83642%2C15.88438%20m%2022.86671%2C-38.41132%200%2C46.12416%20c%200%2C8.12057%20-0.64557%2C21.55859%20-23.83506%2C21.67751%20-9.5816%2C0.068%20-18.46666%2C-3.77148%20-20.23348%2C-12.12989%20l%2012.63955%2C-2.03864%20c%200.52665%2C2.3954%202.00466%2C4.77381%209.17387%2C4.77381%206.64256%2C0%209.83642%2C-3.17687%209.83642%2C-10.78779%20l%200%2C-5.6742%20-0.16988%2C-0.16989%20c%20-2.03864%2C3.65256%20-5.13057%2C7.10125%20-12.5716%2C7.10125%20-11.3654%2C0%20-20.30142%2C-7.88273%20-20.30142%2C-24.34472%200%2C-16.29211%209.22483%2C-25.41501%2019.57091%2C-25.432%209.73449%2C-0.017%2013.3191%2C4.41705%2014.16853%2C6.74449%20l%20-0.16989%2C-0.017%201.07029%2C-5.8271%2010.82176%2C0%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_e%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20288.54015%2C321.24644%20c%20-14.3554%2C0%20-22.91768%2C-9.24183%20-22.91768%2C-25.26212%200%2C-16.20717%208.66421%2C-25.432%2022.71382%2C-25.432%2014.0496%2C0%2022.40802%2C8.95302%2022.40802%2C24.78643%200%2C0.84943%20-0.10194%2C1.68188%20-0.10194%2C2.51432%20l%20-32.43131%2C0%20c%200.0849%2C9.24182%203.92437%2C13.89671%2011.46733%2C13.89671%204.84176%2C0%208.05262%2C-1.95369%2011.0596%2C-6.23483%20l%209.37774%2C5.19852%20c%20-4.12824%2C6.91438%20-11.56927%2C10.53296%20-21.57558%2C10.53296%20m%209.61557%2C-31.70081%20c%200%2C-6.50665%20-3.7375%2C-10.34608%20-9.81943%2C-10.34608%20-5.79313%2C0%20-9.41171%2C3.75449%20-9.92137%2C10.34608%20l%2019.7408%2C0%20z%22%2F%3E%20%20%20%20%3Cpath%20id%3D%22letter_TM%22%20style%3D%22fill%3A%20rgb%28255%2C%20102%2C%200%29%3B%22%20d%3D%22m%20332.69028%2C253.16977%20-4.72284%2C12.21483%20-4.80779%2C-12.21483%20-4.11125%2C0%200%2C16.10523%202.66722%2C0%200%2C-13.43801%200.0679%2C0%205.28347%2C13.43801%201.69886%2C0%205.24949%2C-13.43801%200.0849%2C0%200%2C13.43801%202.65023%2C0%200%2C-16.10523%20-4.06029%2C0%20z%20m%20-29.64518%2C0%200%2C2.14057%205.02864%2C0%200%2C13.96466%202.66721%2C0%200%2C-13.96466%205.04563%2C0%200%2C-2.14057%20-12.74148%2C0%20z%22%2F%3E%3C%2Fsvg%3E";
|
|
6248
6272
|
|
|
6249
6273
|
var orange = {
|
|
6250
6274
|
key: 'orange',
|
|
6251
6275
|
name: 'Orange',
|
|
6252
6276
|
color: '#ff6600',
|
|
6253
|
-
icon: icon$
|
|
6277
|
+
icon: icon$d,
|
|
6254
6278
|
hidden: true
|
|
6255
6279
|
};
|
|
6256
6280
|
|
|
6257
|
-
var icon$
|
|
6281
|
+
var icon$e = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1647%20646q18%2084-4%20204-87%20444-565%20444h-44q-25%200-44%2016.5t-24%2042.5l-4%2019-55%20346-2%2015q-5%2026-24.5%2042.5t-44.5%2016.5h-251q-21%200-33-15t-9-36q9-56%2026.5-168t26.5-168%2027-167.5%2027-167.5q5-37%2043-37h131q133%202%20236-21%20175-39%20287-144%20102-95%20155-246%2024-70%2035-133%201-6%202.5-7.5t3.5-1%206%203.5q79%2059%2098%20162zm-172-282q0%20107-46%20236-80%20233-302%20315-113%2040-252%2042%200%201-90%201l-90-1q-100%200-118%2096-2%208-85%20530-1%2010-12%2010h-295q-22%200-36.5-16.5t-11.5-38.5l232-1471q5-29%2027.5-48t51.5-19h598q34%200%2097.5%2013t111.5%2032q107%2041%20163.5%20123t56.5%20196z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6258
6282
|
|
|
6259
6283
|
var paypal = {
|
|
6260
6284
|
key: 'paypal',
|
|
6261
6285
|
name: 'PayPal',
|
|
6262
6286
|
color: '#003087',
|
|
6263
|
-
icon: icon$
|
|
6287
|
+
icon: icon$e
|
|
6264
6288
|
};
|
|
6265
6289
|
|
|
6266
|
-
var icon$
|
|
6290
|
+
var icon$f = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M270%20806q-8-19-8-52%200-20%2011-49t24-45q-1-22%207.5-53t22.5-43q0-139%2092.5-288.5t217.5-209.5q139-66%20324-66%20133%200%20266%2055%2049%2021%2090%2048t71%2056%2055%2068%2042%2074%2032.5%2084.5%2025.5%2089.5%2022%2098l1%205q55%2083%2055%20150%200%2014-9%2040t-9%2038q0%201%201.5%203.5t3.5%205%202%203.5q77%20114%20120.5%20214.5t43.5%20208.5q0%2043-19.5%20100t-55.5%2057q-9%200-19.5-7.5t-19-17.5-19-26-16-26.5-13.5-26-9-17.5q-1-1-3-1l-5%204q-59%20154-132%20223%2020%2020%2061.5%2038.5t69%2041.5%2035.5%2065q-2%204-4%2016t-7%2018q-64%2097-302%2097-53%200-110.5-9t-98-20-104.5-30q-15-5-23-7-14-4-46-4.5t-40-1.5q-41%2045-127.5%2065t-168.5%2020q-35%200-69-1.5t-93-9-101-20.5-74.5-40-32.5-64q0-40%2010-59.5t41-48.5q11-2%2040.5-13t49.5-12q4%200%2014-2%202-2%202-4l-2-3q-48-11-108-105.5t-73-156.5l-5-3q-4%200-12%2020-18%2041-54.5%2074.5t-77.5%2037.5h-1q-4%200-6-4.5t-5-5.5q-23-54-23-100%200-275%20252-466z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6267
6291
|
|
|
6268
6292
|
var qq = {
|
|
6269
6293
|
key: 'qq',
|
|
6270
6294
|
name: 'QQ',
|
|
6271
6295
|
color: '#0071c3',
|
|
6272
|
-
icon: icon$
|
|
6296
|
+
icon: icon$f,
|
|
6273
6297
|
windowSize: {
|
|
6274
6298
|
width: 450,
|
|
6275
6299
|
height: 400
|
|
6276
6300
|
}
|
|
6277
6301
|
};
|
|
6278
6302
|
|
|
6279
|
-
var icon$
|
|
6303
|
+
var icon$g = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1684%20408q-67%2098-162%20167%201%2014%201%2042%200%20130-38%20259.5t-115.5%20248.5-184.5%20210.5-258%20146-323%2054.5q-271%200-496-145%2035%204%2078%204%20225%200%20401-138-105-2-188-64.5t-114-159.5q33%205%2061%205%2043%200%2085-11-112-23-185.5-111.5t-73.5-205.5v-4q68%2038%20146%2041-66-44-105-115t-39-154q0-88%2044-163%20121%20149%20294.5%20238.5t371.5%2099.5q-8-38-8-74%200-134%2094.5-228.5t228.5-94.5q140%200%20236%20102%20109-21%20205-78-37%20115-142%20178%2093-10%20186-50z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6280
6304
|
|
|
6281
6305
|
var twitter = {
|
|
6282
6306
|
key: 'twitter',
|
|
6283
6307
|
name: 'Twitter',
|
|
6284
6308
|
color: '#55acee',
|
|
6285
|
-
icon: icon$
|
|
6309
|
+
icon: icon$g,
|
|
6286
6310
|
windowSize: {
|
|
6287
6311
|
width: 800,
|
|
6288
6312
|
height: 440
|
|
6289
6313
|
}
|
|
6290
6314
|
};
|
|
6291
6315
|
|
|
6292
|
-
var icon$
|
|
6316
|
+
var icon$h = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1853%20520q23%2064-150%20294-24%2032-65%2085-78%20100-90%20131-17%2041%2014%2081%2017%2021%2081%2082h1l1%201%201%201%202%202q141%20131%20191%20221%203%205%206.5%2012.5t7%2026.5-.5%2034-25%2027.5-59%2012.5l-256%204q-24%205-56-5t-52-22l-20-12q-30-21-70-64t-68.5-77.5-61-58-56.5-15.5q-3%201-8%203.5t-17%2014.5-21.5%2029.5-17%2052-6.5%2077.5q0%2015-3.5%2027.5t-7.5%2018.5l-4%205q-18%2019-53%2022h-115q-71%204-146-16.5t-131.5-53-103-66-70.5-57.5l-25-24q-10-10-27.5-30t-71.5-91-106-151-122.5-211-130.5-272q-6-16-6-27t3-16l4-6q15-19%2057-19l274-2q12%202%2023%206.5t16%208.5l5%203q16%2011%2024%2032%2020%2050%2046%20103.5t41%2081.5l16%2029q29%2060%2056%20104t48.5%2068.5%2041.5%2038.5%2034%2014%2027-5q2-1%205-5t12-22%2013.5-47%209.5-81%200-125q-2-40-9-73t-14-46l-6-12q-25-34-85-43-13-2%205-24%2017-19%2038-30%2053-26%20239-24%2082%201%20135%2013%2020%205%2033.5%2013.5t20.5%2024%2010.5%2032%203.5%2045.5-1%2055-2.5%2070.5-1.5%2082.5q0%2011-1%2042t-.5%2048%203.5%2040.5%2011.5%2039%2022.5%2024.5q8%202%2017%204t26-11%2038-34.5%2052-67%2068-107.5q60-104%20107-225%204-10%2010-17.5t11-10.5l4-3%205-2.5%2013-3%2020-.5%20288-2q39-5%2064%202.5t31%2016.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6293
6317
|
|
|
6294
6318
|
var vkontakte = {
|
|
6295
6319
|
key: 'vkontakte',
|
|
6296
6320
|
fontKey: 'vk',
|
|
6297
6321
|
name: 'VKontakte',
|
|
6298
6322
|
color: '#45668e',
|
|
6299
|
-
icon: icon$
|
|
6323
|
+
icon: icon$h,
|
|
6300
6324
|
windowSize: {
|
|
6301
6325
|
width: 655,
|
|
6302
6326
|
height: 430
|
|
6303
6327
|
}
|
|
6304
6328
|
};
|
|
6305
6329
|
|
|
6306
|
-
var icon$
|
|
6330
|
+
var icon$i = "data:image/svg+xml,%3Csvg%20width%3D%222048%22%20height%3D%221792%22%20viewBox%3D%220%200%202048%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M580%20461q0-41-25-66t-66-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2066-24.5t25-65.5zm743%20507q0-28-25.5-50t-65.5-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q40%200%2065.5-22t25.5-51zm-236-507q0-41-24.5-66t-65.5-25q-43%200-76%2025.5t-33%2065.5q0%2039%2033%2064.5t76%2025.5q41%200%2065.5-24.5t24.5-65.5zm635%20507q0-28-26-50t-65-22q-27%200-49.5%2022.5t-22.5%2049.5q0%2028%2022.5%2050.5t49.5%2022.5q39%200%2065-22t26-51zm-266-397q-31-4-70-4-169%200-311%2077t-223.5%20208.5-81.5%20287.5q0%2078%2023%20152-35%203-68%203-26%200-50-1.5t-55-6.5-44.5-7-54.5-10.5-50-10.5l-253%20127%2072-218q-290-203-290-490%200-169%2097.5-311t264-223.5%20363.5-81.5q176%200%20332.5%2066t262%20182.5%20136.5%20260.5zm592%20561q0%20117-68.5%20223.5t-185.5%20193.5l55%20181-199-109q-150%2037-218%2037-169%200-311-70.5t-223.5-191.5-81.5-264%2081.5-264%20223.5-191.5%20311-70.5q161%200%20303%2070.5t227.5%20192%2085.5%20263.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6307
6331
|
|
|
6308
6332
|
var wechat = {
|
|
6309
6333
|
key: 'wechat',
|
|
6310
6334
|
name: 'WeChat',
|
|
6311
6335
|
color: '#44b549',
|
|
6312
|
-
icon: icon$
|
|
6336
|
+
icon: icon$i,
|
|
6313
6337
|
windowSize: {
|
|
6314
6338
|
width: 450,
|
|
6315
6339
|
height: 400
|
|
6316
6340
|
}
|
|
6317
6341
|
};
|
|
6318
6342
|
|
|
6319
|
-
var icon$
|
|
6343
|
+
var icon$j = "data:image/svg+xml,%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M675%201284q21-34%2011-69t-45-50q-34-14-73-1t-60%2046q-22%2034-13%2068.5t43%2050.5%2074.5%202.5%2062.5-47.5zm94-121q8-13%203.5-26.5t-17.5-18.5q-14-5-28.5.5t-21.5%2018.5q-17%2031%2013%2045%2014%205%2029-.5t22-18.5zm174%20107q-45%20102-158%20150t-224%2012q-107-34-147.5-126.5t6.5-187.5q47-93%20151.5-139t210.5-19q111%2029%20158.5%20119.5t2.5%20190.5zm312-160q-9-96-89-170t-208.5-109-274.5-21q-223%2023-369.5%20141.5t-132.5%20264.5q9%2096%2089%20170t208.5%20109%20274.5%2021q223-23%20369.5-141.5t132.5-264.5zm308%204q0%2068-37%20139.5t-109%20137-168.5%20117.5-226%2083-270.5%2031-275-33.5-240.5-93-171.5-151-65-199.5q0-115%2069.5-245t197.5-258q169-169%20341.5-236t246.5%207q65%2064%2020%20209-4%2014-1%2020t10%207%2014.5-.5%2013.5-3.5l6-2q139-59%20246-59t153%2061q45%2063%200%20178-2%2013-4.5%2020t4.5%2012.5%2012%207.5%2017%206q57%2018%20103%2047t80%2081.5%2034%20116.5zm-74-624q42%2047%2054.5%20108.5t-6.5%20117.5q-8%2023-29.5%2034t-44.5%204q-23-8-34-29.5t-4-44.5q20-63-24-111t-107-35q-24%205-45-8t-25-37q-5-24%208-44.5t37-25.5q60-13%20119%205.5t101%2065.5zm181-163q87%2096%20112.5%20222.5t-13.5%20241.5q-9%2027-34%2040t-52%204-40-34-5-52q28-82%2010-172t-80-158q-62-69-148-95.5t-173-8.5q-28%206-52-9.5t-30-43.5%209.5-51.5%2043.5-29.5q123-26%20244%2011.5t208%20134.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6320
6344
|
|
|
6321
6345
|
var weibo = {
|
|
6322
6346
|
key: 'weibo',
|
|
6323
6347
|
name: 'Weibo',
|
|
6324
6348
|
color: '#e71d34',
|
|
6325
|
-
icon: icon$
|
|
6349
|
+
icon: icon$j
|
|
6326
6350
|
};
|
|
6327
6351
|
|
|
6328
|
-
var icon$
|
|
6352
|
+
var icon$k = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20width%3D%221792%22%20height%3D%221792%22%20viewBox%3D%220%200%201792%201792%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M937%201004l266-499h-112l-157%20312q-24%2048-44%2092l-42-92-155-312h-120l263%20493v324h101v-318zm727-588v960q0%20119-84.5%20203.5t-203.5%2084.5h-960q-119%200-203.5-84.5t-84.5-203.5v-960q0-119%2084.5-203.5t203.5-84.5h960q119%200%20203.5%2084.5t84.5%20203.5z%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E";
|
|
6329
6353
|
|
|
6330
6354
|
var yandex = {
|
|
6331
6355
|
key: 'yandex',
|
|
6332
6356
|
name: 'Yandex',
|
|
6333
6357
|
color: '#d43b2f',
|
|
6334
|
-
icon: icon$
|
|
6358
|
+
icon: icon$k,
|
|
6335
6359
|
windowSize: {
|
|
6336
6360
|
width: 655,
|
|
6337
6361
|
height: 700
|
|
@@ -6351,6 +6375,7 @@ var providers = /*#__PURE__*/Object.freeze({
|
|
|
6351
6375
|
linkedin: linkedin,
|
|
6352
6376
|
mailru: mailru,
|
|
6353
6377
|
microsoft: microsoft,
|
|
6378
|
+
naver: naver,
|
|
6354
6379
|
oney: oney,
|
|
6355
6380
|
orange: orange,
|
|
6356
6381
|
paypal: paypal,
|
|
@@ -6510,7 +6535,7 @@ var SocialButton = withTheme(function (_ref3) {
|
|
|
6510
6535
|
textVisible: textVisible,
|
|
6511
6536
|
width: width,
|
|
6512
6537
|
height: height,
|
|
6513
|
-
onClick: function onClick(
|
|
6538
|
+
onClick: function onClick() {
|
|
6514
6539
|
return _onClick(provider.key);
|
|
6515
6540
|
}
|
|
6516
6541
|
}, /*#__PURE__*/React__default.createElement(SocialButtonIcon, {
|
|
@@ -6524,18 +6549,21 @@ var SocialButtons = styled__default(function (_ref4) {
|
|
|
6524
6549
|
className = _ref4.className;
|
|
6525
6550
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
6526
6551
|
className: classes(['r5-social-buttons', className])
|
|
6527
|
-
}, providers.
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6552
|
+
}, providers.flatMap(function (providerKey) {
|
|
6553
|
+
var _providerKey$split = providerKey.split(':'),
|
|
6554
|
+
_providerKey$split2 = _slicedToArray(_providerKey$split, 1),
|
|
6555
|
+
providerName = _providerKey$split2[0];
|
|
6556
|
+
if (providerName === 'bconnect' && queryParams['bconnectActivation'] !== 'true') return [];else if (socialButtons[providerName] === undefined) {
|
|
6557
|
+
console.error("".concat(providerName, " provider not found."));
|
|
6558
|
+
return [];
|
|
6559
|
+
} else return [/*#__PURE__*/React__default.createElement(SocialButton, {
|
|
6560
|
+
provider: socialButtons[providerName],
|
|
6535
6561
|
count: providers.length,
|
|
6536
|
-
onClick:
|
|
6562
|
+
onClick: function onClick() {
|
|
6563
|
+
return clickHandler(providerKey);
|
|
6564
|
+
},
|
|
6537
6565
|
key: providerKey
|
|
6538
|
-
});
|
|
6566
|
+
})];
|
|
6539
6567
|
}));
|
|
6540
6568
|
})(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n text-align: center;\n ", "\n"])), function (props) {
|
|
6541
6569
|
return props.theme.get('socialButton.inline') && 'margin: 0 -4px';
|
|
@@ -7294,7 +7322,7 @@ function formatISO8601Date(year, month, day) {
|
|
|
7294
7322
|
return null;
|
|
7295
7323
|
}
|
|
7296
7324
|
function specializeIdentifierData(data) {
|
|
7297
|
-
return
|
|
7325
|
+
return data.identifier ? _objectSpread2(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
7298
7326
|
identifier: undefined
|
|
7299
7327
|
}, isValidEmail(data.identifier) ? {
|
|
7300
7328
|
email: data.identifier
|
|
@@ -7341,7 +7369,7 @@ var Validator = /*#__PURE__*/function () {
|
|
|
7341
7369
|
parameters = _ref$parameters === void 0 ? [] : _ref$parameters;
|
|
7342
7370
|
_classCallCheck(this, Validator);
|
|
7343
7371
|
this.rule = rule;
|
|
7344
|
-
this.hint = !isFunction(hint) ? function (
|
|
7372
|
+
this.hint = !isFunction(hint) ? function () {
|
|
7345
7373
|
return hint;
|
|
7346
7374
|
} : hint;
|
|
7347
7375
|
this.parameters = parameters;
|
|
@@ -7615,8 +7643,7 @@ var createField = function createField(_ref) {
|
|
|
7615
7643
|
return mapping.unbind(model, format.unbind(value));
|
|
7616
7644
|
},
|
|
7617
7645
|
validate: function validate(_ref5, ctx) {
|
|
7618
|
-
var value = _ref5.value
|
|
7619
|
-
isDirty = _ref5.isDirty;
|
|
7646
|
+
var value = _ref5.value;
|
|
7620
7647
|
return required$1 || isValued(value) ? fullValidator(value, ctx) : {};
|
|
7621
7648
|
}
|
|
7622
7649
|
};
|
|
@@ -7807,7 +7834,7 @@ function initCloneArray(array) {
|
|
|
7807
7834
|
*/
|
|
7808
7835
|
function cloneArrayBuffer(arrayBuffer) {
|
|
7809
7836
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
7810
|
-
new Uint8Array
|
|
7837
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
7811
7838
|
return result;
|
|
7812
7839
|
}
|
|
7813
7840
|
|
|
@@ -8272,7 +8299,7 @@ var omit = flatRest(function (object, paths) {
|
|
|
8272
8299
|
});
|
|
8273
8300
|
|
|
8274
8301
|
var _excluded$2 = ["options", "placeholder"],
|
|
8275
|
-
_excluded2$1 = ["options", "onChange", "value", "
|
|
8302
|
+
_excluded2$1 = ["options", "onChange", "value", "inputId"];
|
|
8276
8303
|
var _templateObject$5, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8, _templateObject9, _templateObject10;
|
|
8277
8304
|
var errorFadeIn = styled.keyframes(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n"])));
|
|
8278
8305
|
var FormError = withTheme(styled__default.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n padding-top: 3px;\n animation: ", " 0.3s both;\n color: ", ";\n"])), errorFadeIn, function (props) {
|
|
@@ -8399,7 +8426,6 @@ var RadioGroup = function RadioGroup(_ref6) {
|
|
|
8399
8426
|
var options = _ref6.options,
|
|
8400
8427
|
onChange = _ref6.onChange,
|
|
8401
8428
|
value = _ref6.value,
|
|
8402
|
-
name = _ref6.name,
|
|
8403
8429
|
inputId = _ref6.inputId,
|
|
8404
8430
|
props = _objectWithoutProperties(_ref6, _excluded2$1);
|
|
8405
8431
|
var handleChange = function handleChange(event) {
|
|
@@ -8606,13 +8632,13 @@ function checkboxField(config) {
|
|
|
8606
8632
|
*/
|
|
8607
8633
|
|
|
8608
8634
|
function specializeRawIdentifier(withPhoneNumber, inputValue) {
|
|
8609
|
-
var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (
|
|
8635
|
+
var telCall = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
8610
8636
|
return undefined;
|
|
8611
8637
|
};
|
|
8612
|
-
var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (
|
|
8638
|
+
var emailCall = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
|
|
8613
8639
|
return undefined;
|
|
8614
8640
|
};
|
|
8615
|
-
var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (
|
|
8641
|
+
var otherCall = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
|
8616
8642
|
return undefined;
|
|
8617
8643
|
};
|
|
8618
8644
|
if (withPhoneNumber && /^\+?[0-9]+$/.test(inputValue)) {
|
|
@@ -8681,7 +8707,9 @@ var IdentifierField = /*#__PURE__*/function (_React$Component) {
|
|
|
8681
8707
|
var parsed = libphonenumber.parse(userInput, country);
|
|
8682
8708
|
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') : userInput;
|
|
8683
8709
|
this.asYouType(phoneValue);
|
|
8684
|
-
} catch (e) {
|
|
8710
|
+
} catch (e) {
|
|
8711
|
+
console.error(e);
|
|
8712
|
+
}
|
|
8685
8713
|
}
|
|
8686
8714
|
}, {
|
|
8687
8715
|
key: "componentWillUnmount",
|
|
@@ -8742,17 +8770,17 @@ function identifierField(props, config) {
|
|
|
8742
8770
|
label: 'identifier',
|
|
8743
8771
|
format: {
|
|
8744
8772
|
bind: function bind(x) {
|
|
8745
|
-
return specializeRawIdentifier(props.withPhoneNumber, x, function (
|
|
8773
|
+
return specializeRawIdentifier(props.withPhoneNumber, x, function () {
|
|
8746
8774
|
return {
|
|
8747
8775
|
country: config.countryCode,
|
|
8748
8776
|
isValid: true
|
|
8749
8777
|
};
|
|
8750
|
-
}, function (
|
|
8778
|
+
}, function () {
|
|
8751
8779
|
return {
|
|
8752
8780
|
country: config.countryCode,
|
|
8753
8781
|
isValid: true
|
|
8754
8782
|
};
|
|
8755
|
-
}, function (
|
|
8783
|
+
}, function () {
|
|
8756
8784
|
return {
|
|
8757
8785
|
country: config.countryCode,
|
|
8758
8786
|
isValid: true
|
|
@@ -8780,11 +8808,11 @@ function identifierField(props, config) {
|
|
|
8780
8808
|
});
|
|
8781
8809
|
},
|
|
8782
8810
|
hint: function hint(value) {
|
|
8783
|
-
return specializeRefinedIdentifier(value, function (
|
|
8811
|
+
return specializeRefinedIdentifier(value, function () {
|
|
8784
8812
|
return 'phone';
|
|
8785
|
-
}, function (
|
|
8813
|
+
}, function () {
|
|
8786
8814
|
return 'email';
|
|
8787
|
-
}, function (
|
|
8815
|
+
}, function () {
|
|
8788
8816
|
return 'identifier';
|
|
8789
8817
|
});
|
|
8790
8818
|
}
|
|
@@ -8948,8 +8976,7 @@ var LoginForm = createForm({
|
|
|
8948
8976
|
defaultIdentifier = _ref.defaultIdentifier,
|
|
8949
8977
|
i18n = _ref.i18n,
|
|
8950
8978
|
config = _ref.config,
|
|
8951
|
-
allowCustomIdentifier = _ref.allowCustomIdentifier
|
|
8952
|
-
customIdentifierLabel = _ref.customIdentifierLabel;
|
|
8979
|
+
allowCustomIdentifier = _ref.allowCustomIdentifier;
|
|
8953
8980
|
return [showIdentifier && config.sms ? identifierField({
|
|
8954
8981
|
defaultValue: defaultIdentifier,
|
|
8955
8982
|
withPhoneNumber: true,
|
|
@@ -9025,8 +9052,7 @@ var LoginView = /*#__PURE__*/function (_React$Component) {
|
|
|
9025
9052
|
_this$props$session = _this$props.session,
|
|
9026
9053
|
session = _this$props$session === void 0 ? {} : _this$props$session,
|
|
9027
9054
|
i18n = _this$props.i18n,
|
|
9028
|
-
allowCustomIdentifier = _this$props.allowCustomIdentifier
|
|
9029
|
-
customIdentifierLabel = _this$props.customIdentifierLabel;
|
|
9055
|
+
allowCustomIdentifier = _this$props.allowCustomIdentifier;
|
|
9030
9056
|
var defaultIdentifier = session.lastLoginType === 'password' ? session.email : null;
|
|
9031
9057
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Heading, null, i18n('login.title')), socialProviders && socialProviders.length > 0 && /*#__PURE__*/React__default.createElement(SocialButtons$1, {
|
|
9032
9058
|
providers: socialProviders,
|
|
@@ -9726,25 +9752,15 @@ var BirthdateField = function BirthdateField(props) {
|
|
|
9726
9752
|
"data-testid": "".concat(BIRTHDAY_PATH, ".year")
|
|
9727
9753
|
}))));
|
|
9728
9754
|
};
|
|
9729
|
-
var
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
return 'birthdate.dayOfMonth';
|
|
9737
|
-
};
|
|
9738
|
-
var validateYear = function validateYear(year) {
|
|
9739
|
-
if (validator.isNumeric(year)) {
|
|
9740
|
-
var yearNbr = parseInt(year);
|
|
9741
|
-
var currentYear = new Date().getFullYear();
|
|
9742
|
-
var age = currentYear - yearNbr;
|
|
9743
|
-
if (age > 5 && age < 130) {
|
|
9744
|
-
return false;
|
|
9745
|
-
}
|
|
9755
|
+
var validateLimitAge = function validateLimitAge(day, month, year) {
|
|
9756
|
+
var yearNbr = parseInt(year, 10);
|
|
9757
|
+
var dayNbr = parseInt(day, 10);
|
|
9758
|
+
var monthNbr = parseInt(month, 10);
|
|
9759
|
+
var age = luxon.DateTime.now().diff(luxon.DateTime.local(yearNbr, monthNbr, dayNbr), "years").years;
|
|
9760
|
+
if (age < 6 || age > 129) {
|
|
9761
|
+
return 'birthdate.yearLimit';
|
|
9746
9762
|
}
|
|
9747
|
-
return
|
|
9763
|
+
return false;
|
|
9748
9764
|
};
|
|
9749
9765
|
var format = function format(_ref3) {
|
|
9750
9766
|
var day = _ref3.day,
|
|
@@ -9826,25 +9842,15 @@ function birthdateField(_ref4) {
|
|
|
9826
9842
|
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, field, true));
|
|
9827
9843
|
}, {})) : {};
|
|
9828
9844
|
}
|
|
9829
|
-
if (isSubmitted || day.isDirty) {
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
error: i18n("validation.".concat(dayError)),
|
|
9834
|
-
day: true
|
|
9835
|
-
};
|
|
9836
|
-
}
|
|
9837
|
-
}
|
|
9838
|
-
if (isSubmitted || year.isDirty) {
|
|
9839
|
-
var yearError = validateYear(year.value);
|
|
9840
|
-
if (yearError) {
|
|
9845
|
+
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9846
|
+
if (!validator.isNumeric(year.value.toString()) || !luxon.DateTime.fromObject({
|
|
9847
|
+
year: parseInt(year.value, 10)
|
|
9848
|
+
}).isValid) {
|
|
9841
9849
|
return {
|
|
9842
|
-
error: i18n("validation."
|
|
9850
|
+
error: i18n("validation.birthdate.year"),
|
|
9843
9851
|
year: true
|
|
9844
9852
|
};
|
|
9845
9853
|
}
|
|
9846
|
-
}
|
|
9847
|
-
if (isSubmitted || day.isDirty || month.isDirty || year.isDirty) {
|
|
9848
9854
|
var birthdate = format(state);
|
|
9849
9855
|
if (!birthdate || !validator.isISO8601(birthdate)) {
|
|
9850
9856
|
return {
|
|
@@ -9852,6 +9858,22 @@ function birthdateField(_ref4) {
|
|
|
9852
9858
|
day: true
|
|
9853
9859
|
};
|
|
9854
9860
|
}
|
|
9861
|
+
if (!(validator.isNumeric(month.value.toString()) && validator.isNumeric(day.value.toString())) || !luxon.DateTime.fromObject({
|
|
9862
|
+
year: year.value,
|
|
9863
|
+
month: month.value,
|
|
9864
|
+
day: day.value
|
|
9865
|
+
}).isValid) {
|
|
9866
|
+
return {
|
|
9867
|
+
error: i18n("validation.birthdate.dayOfMonth"),
|
|
9868
|
+
day: true
|
|
9869
|
+
};
|
|
9870
|
+
}
|
|
9871
|
+
var limitAge = validateLimitAge(day.value, month.value, year.value);
|
|
9872
|
+
if (limitAge) {
|
|
9873
|
+
return {
|
|
9874
|
+
error: i18n("validation.".concat(limitAge))
|
|
9875
|
+
};
|
|
9876
|
+
}
|
|
9855
9877
|
}
|
|
9856
9878
|
return {};
|
|
9857
9879
|
}
|
|
@@ -9896,7 +9918,9 @@ var PhoneNumberField = /*#__PURE__*/function (_React$Component) {
|
|
|
9896
9918
|
var parsed = libphonenumber.parse(raw, country);
|
|
9897
9919
|
var phoneValue = country === parsed.country ? libphonenumber.format(parsed, 'National') : raw;
|
|
9898
9920
|
this.asYouType(phoneValue);
|
|
9899
|
-
} catch (e) {
|
|
9921
|
+
} catch (e) {
|
|
9922
|
+
console.error(e);
|
|
9923
|
+
}
|
|
9900
9924
|
}
|
|
9901
9925
|
}, {
|
|
9902
9926
|
key: "componentWillUnmount",
|
|
@@ -10011,7 +10035,7 @@ var PasswordPolicyRules = withI18n(withTheme(styled__default(function (_ref3) {
|
|
|
10011
10035
|
checked: props.strength >= props.minStrength
|
|
10012
10036
|
}), /*#__PURE__*/React__default.createElement(Label, {
|
|
10013
10037
|
visible: true
|
|
10014
|
-
}, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key
|
|
10038
|
+
}, i18n('passwordStrength.minimum.required'), " ", i18n("passwordStrength.score".concat(props.minStrength)).toLowerCase(), ".")), /*#__PURE__*/React__default.createElement(PasswordPolicyIntro, null), Object.keys(props.rules).map(function (key) {
|
|
10015
10039
|
var rule = props.rules[key];
|
|
10016
10040
|
return /*#__PURE__*/React__default.createElement(PasswordPolicyRule, {
|
|
10017
10041
|
key: key
|
|
@@ -10083,7 +10107,7 @@ var PasswordField = /*#__PURE__*/function (_React$Component) {
|
|
|
10083
10107
|
}
|
|
10084
10108
|
_createClass(PasswordField, [{
|
|
10085
10109
|
key: "componentDidUpdate",
|
|
10086
|
-
value: function componentDidUpdate(prevProps
|
|
10110
|
+
value: function componentDidUpdate(prevProps) {
|
|
10087
10111
|
var blacklistUpdated = lodashEs.isEqual(prevProps.blacklist, this.props.blacklist);
|
|
10088
10112
|
if (!blacklistUpdated) {
|
|
10089
10113
|
var _this$props = this.props,
|
|
@@ -10558,8 +10582,10 @@ function consentFieldComponent(consent, fieldConfig, versionIdPath) {
|
|
|
10558
10582
|
consentCannotBeGranted: !fieldConfig.errorArchivedConsents && consent.status === 'archived'
|
|
10559
10583
|
},
|
|
10560
10584
|
type: consent.consentType,
|
|
10561
|
-
key: "consents.".concat(consent.key)
|
|
10585
|
+
key: "consents.".concat(consent.key, ".").concat(versionId),
|
|
10586
|
+
path: "consents.".concat(consent.key) // Will target the same profile consent value for different versions of the consent
|
|
10562
10587
|
});
|
|
10588
|
+
|
|
10563
10589
|
return consentField(baseConfig);
|
|
10564
10590
|
}
|
|
10565
10591
|
var findCustomField = function findCustomField(config, camelPath) {
|
|
@@ -10583,10 +10609,12 @@ var resolveField = function resolveField(fieldConfig, config) {
|
|
|
10583
10609
|
if (customField) {
|
|
10584
10610
|
return customFieldComponent(customField, fieldConfig);
|
|
10585
10611
|
}
|
|
10586
|
-
var camelPathSplit = camelPath.split('.v');
|
|
10612
|
+
var camelPathSplit = camelPath.split('.v'); // TODO What if consent start with a `v`?
|
|
10587
10613
|
var consentField = findConsentField(config, camelPathSplit[0]);
|
|
10614
|
+
// Find most recent consent version if not given
|
|
10588
10615
|
if (consentField) {
|
|
10589
|
-
|
|
10616
|
+
var highestConsentVersion = consentField.versions[0].versionId;
|
|
10617
|
+
return consentFieldComponent(consentField, fieldConfig, camelPathSplit[1] || highestConsentVersion);
|
|
10590
10618
|
}
|
|
10591
10619
|
throw new UserError("Unknown field: ".concat(fieldConfig.key));
|
|
10592
10620
|
};
|
|
@@ -11118,7 +11146,7 @@ var MfaStepUpView = /*#__PURE__*/function (_React$Component) {
|
|
|
11118
11146
|
args[_key] = arguments[_key];
|
|
11119
11147
|
}
|
|
11120
11148
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11121
|
-
_defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function (
|
|
11149
|
+
_defineProperty(_assertThisInitialized(_this), "onGetStepUpToken", function () {
|
|
11122
11150
|
return _this.props.apiClient.getMfaStepUpToken({
|
|
11123
11151
|
options: _this.props.auth,
|
|
11124
11152
|
accessToken: _this.props.accessToken
|
|
@@ -11305,7 +11333,7 @@ var MainView = /*#__PURE__*/function (_React$Component) {
|
|
|
11305
11333
|
args[_key] = arguments[_key];
|
|
11306
11334
|
}
|
|
11307
11335
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11308
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
11336
|
+
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11309
11337
|
var _this$props = _this.props,
|
|
11310
11338
|
apiClient = _this$props.apiClient,
|
|
11311
11339
|
accessToken = _this$props.accessToken,
|
|
@@ -11321,11 +11349,19 @@ var MainView = /*#__PURE__*/function (_React$Component) {
|
|
|
11321
11349
|
return _this;
|
|
11322
11350
|
}
|
|
11323
11351
|
_createClass(MainView, [{
|
|
11352
|
+
key: "componentDidMount",
|
|
11353
|
+
value: function componentDidMount() {
|
|
11354
|
+
importGoogleRecaptchaScript(this.props.recaptcha_site_key);
|
|
11355
|
+
}
|
|
11356
|
+
}, {
|
|
11324
11357
|
key: "render",
|
|
11325
11358
|
value: function render() {
|
|
11359
|
+
var _this2 = this;
|
|
11326
11360
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Intro, null, this.props.i18n('emailEditor.intro')), /*#__PURE__*/React__default.createElement(EmailEditorForm, {
|
|
11327
11361
|
showLabels: this.props.showLabels,
|
|
11328
|
-
handler:
|
|
11362
|
+
handler: function handler(data) {
|
|
11363
|
+
return ReCaptcha.handle(data, _this2.props, _this2.callback, "update_email");
|
|
11364
|
+
},
|
|
11329
11365
|
onSuccess: this.handleSuccess
|
|
11330
11366
|
}));
|
|
11331
11367
|
}
|
|
@@ -11492,7 +11528,7 @@ var MainView$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
11492
11528
|
accessToken = _this$props.accessToken;
|
|
11493
11529
|
return apiClient.updatePhoneNumber(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
11494
11530
|
accessToken: accessToken
|
|
11495
|
-
})).then(function (
|
|
11531
|
+
})).then(function () {
|
|
11496
11532
|
return data;
|
|
11497
11533
|
});
|
|
11498
11534
|
});
|
|
@@ -11661,7 +11697,7 @@ var MainView$3 = /*#__PURE__*/function (_React$Component) {
|
|
|
11661
11697
|
}
|
|
11662
11698
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11663
11699
|
_defineProperty(_assertThisInitialized(_this), "callback", function (data) {
|
|
11664
|
-
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function (
|
|
11700
|
+
return _this.props.apiClient.startPasswordless(data, _this.props.auth).then(function () {
|
|
11665
11701
|
return data;
|
|
11666
11702
|
});
|
|
11667
11703
|
});
|
|
@@ -11826,6 +11862,8 @@ var profileEditorWidget = createWidget({
|
|
|
11826
11862
|
if (haveNotAllowedFields) {
|
|
11827
11863
|
throw new UserError('These fields are not allowed: password, password_confirmation.');
|
|
11828
11864
|
}
|
|
11865
|
+
|
|
11866
|
+
// This step removes the version from the consents
|
|
11829
11867
|
var resolvedFields = buildFormFields(fields, _objectSpread2(_objectSpread2({}, config), {}, {
|
|
11830
11868
|
errorArchivedConsents: false
|
|
11831
11869
|
}));
|
|
@@ -11833,16 +11871,40 @@ var profileEditorWidget = createWidget({
|
|
|
11833
11871
|
accessToken: accessToken,
|
|
11834
11872
|
fields: computeFieldList(resolvedFields)
|
|
11835
11873
|
}).then(function (profile) {
|
|
11874
|
+
var camelProfile = camelCaseProperties(profile);
|
|
11875
|
+
var profileConsents = camelProfile && camelProfile.consents;
|
|
11876
|
+
var filteredProfileConsents = profileConsents && Object.keys(profileConsents).length && filterProfileConsents(fields, config.consentsVersions, profileConsents);
|
|
11877
|
+
var filteredOutConsentsProfile = _objectSpread2(_objectSpread2({}, profile), {}, {
|
|
11878
|
+
consents: filteredProfileConsents
|
|
11879
|
+
});
|
|
11836
11880
|
return _objectSpread2(_objectSpread2({}, opts), {}, {
|
|
11837
|
-
profile:
|
|
11881
|
+
profile: filteredOutConsentsProfile,
|
|
11838
11882
|
resolvedFields: resolvedFields.filter(function (field) {
|
|
11839
|
-
return (field.path !== 'email' || !
|
|
11883
|
+
return (field.path !== 'email' || !filteredOutConsentsProfile.email) && (field.path !== 'phone_number' || !config.sms || !filteredOutConsentsProfile.phoneNumber);
|
|
11840
11884
|
})
|
|
11841
11885
|
});
|
|
11842
11886
|
});
|
|
11843
11887
|
}
|
|
11844
11888
|
});
|
|
11845
11889
|
|
|
11890
|
+
// Filter out the profile consents with different version than the one the given consent field own
|
|
11891
|
+
var filterProfileConsents = function filterProfileConsents(fields, consentsVersions, profileConsents) {
|
|
11892
|
+
return Object.keys(profileConsents).filter(function (profileConsentKey) {
|
|
11893
|
+
var consentField = fields.find(function (field) {
|
|
11894
|
+
return field.startsWith("consents.".concat(profileConsentKey));
|
|
11895
|
+
});
|
|
11896
|
+
var consentFieldSplit = consentField.split('.v');
|
|
11897
|
+
// Find most recent consent version if not given
|
|
11898
|
+
var highestConsentVersion = consentsVersions[profileConsentKey].versions[0].versionId;
|
|
11899
|
+
var consentFieldVersion = consentFieldSplit[1] || highestConsentVersion;
|
|
11900
|
+
var profileConsentVersion = profileConsents[profileConsentKey].consentVersion.versionId;
|
|
11901
|
+
return !consentFieldVersion || parseInt(consentFieldVersion) === profileConsentVersion;
|
|
11902
|
+
}).reduce(function (filteredProfileConsents, consentKey) {
|
|
11903
|
+
filteredProfileConsents[consentKey] = profileConsents[consentKey];
|
|
11904
|
+
return filteredProfileConsents;
|
|
11905
|
+
}, {});
|
|
11906
|
+
};
|
|
11907
|
+
|
|
11846
11908
|
/** Used as the size to enable large array optimizations. */
|
|
11847
11909
|
var LARGE_ARRAY_SIZE$2 = 200;
|
|
11848
11910
|
|
|
@@ -12267,7 +12329,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12267
12329
|
args[_key] = arguments[_key];
|
|
12268
12330
|
}
|
|
12269
12331
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
12270
|
-
_defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function (
|
|
12332
|
+
_defineProperty(_assertThisInitialized(_this), "onEmailRegistering", function () {
|
|
12271
12333
|
return _this.props.apiClient.startMfaEmailRegistration({
|
|
12272
12334
|
accessToken: _this.props.accessToken
|
|
12273
12335
|
});
|
|
@@ -12277,7 +12339,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12277
12339
|
accessToken: _this.props.accessToken
|
|
12278
12340
|
}, data));
|
|
12279
12341
|
});
|
|
12280
|
-
_defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function (
|
|
12342
|
+
_defineProperty(_assertThisInitialized(_this), "onEmailRemoval", function () {
|
|
12281
12343
|
return _this.props.apiClient.removeMfaEmail({
|
|
12282
12344
|
accessToken: _this.props.accessToken
|
|
12283
12345
|
});
|
|
@@ -12323,7 +12385,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12323
12385
|
}
|
|
12324
12386
|
}))), /*#__PURE__*/React__default.createElement(DivCredentialBlock, null, showRemoveMfaCredentials && config.mfaEmailEnabled && isEmailCredentialRegistered && /*#__PURE__*/React__default.createElement("div", null, showIntro && /*#__PURE__*/React__default.createElement(Intro, null, i18n('mfa.email.remove.explain')), /*#__PURE__*/React__default.createElement(EmailCredentialRemovalForm, {
|
|
12325
12387
|
handler: this.onEmailRemoval,
|
|
12326
|
-
onSuccess: function onSuccess(
|
|
12388
|
+
onSuccess: function onSuccess() {
|
|
12327
12389
|
return _this2.props.goTo('credential-removed', {
|
|
12328
12390
|
credentialType: 'email'
|
|
12329
12391
|
});
|
|
@@ -12332,7 +12394,7 @@ var MainView$4 = /*#__PURE__*/function (_React$Component) {
|
|
|
12332
12394
|
handler: function handler(data) {
|
|
12333
12395
|
return _this2.onPhoneNumberRemoval(_objectSpread2(_objectSpread2({}, data), phoneNumberCredentialRegistered));
|
|
12334
12396
|
},
|
|
12335
|
-
onSuccess: function onSuccess(
|
|
12397
|
+
onSuccess: function onSuccess() {
|
|
12336
12398
|
return _this2.props.goTo('credential-removed', {
|
|
12337
12399
|
credentialType: 'sms'
|
|
12338
12400
|
});
|
|
@@ -12415,7 +12477,9 @@ var mfaCredentialsWidget = createMultiViewWidget({
|
|
|
12415
12477
|
},
|
|
12416
12478
|
prepare: function prepare(options, _ref3) {
|
|
12417
12479
|
var apiClient = _ref3.apiClient;
|
|
12418
|
-
return apiClient.listMfaCredentials(options.accessToken)
|
|
12480
|
+
return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
|
|
12481
|
+
throw new UserError.fromAppError(error);
|
|
12482
|
+
}).then(function (credentials) {
|
|
12419
12483
|
return deepDefaults(_objectSpread2(_objectSpread2({
|
|
12420
12484
|
showIntro: true,
|
|
12421
12485
|
showRemoveMfaCredentials: true
|
|
@@ -12502,7 +12566,9 @@ var mfaListWidget = createWidget({
|
|
|
12502
12566
|
component: MfaList,
|
|
12503
12567
|
prepare: function prepare(options, _ref3) {
|
|
12504
12568
|
var apiClient = _ref3.apiClient;
|
|
12505
|
-
return apiClient.listMfaCredentials(options.accessToken)
|
|
12569
|
+
return apiClient.listMfaCredentials(options.accessToken)["catch"](function (error) {
|
|
12570
|
+
throw new UserError.fromAppError(error);
|
|
12571
|
+
}).then(function (credentials) {
|
|
12506
12572
|
return _objectSpread2(_objectSpread2({}, options), credentials);
|
|
12507
12573
|
});
|
|
12508
12574
|
}
|
|
@@ -12513,7 +12579,7 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12513
12579
|
_classCallCheck(this, UiClient);
|
|
12514
12580
|
this.config = config;
|
|
12515
12581
|
this.urlParser = urlParser;
|
|
12516
|
-
this.
|
|
12582
|
+
this.core = coreClient;
|
|
12517
12583
|
this.defaultI18n = defaultI18n;
|
|
12518
12584
|
}
|
|
12519
12585
|
|
|
@@ -12620,7 +12686,7 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12620
12686
|
_context.next = 9;
|
|
12621
12687
|
return widget(options, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
12622
12688
|
config: config,
|
|
12623
|
-
apiClient: this.
|
|
12689
|
+
apiClient: this.core,
|
|
12624
12690
|
defaultI18n: this.defaultI18n
|
|
12625
12691
|
}));
|
|
12626
12692
|
case 9:
|
|
@@ -12673,10 +12739,10 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12673
12739
|
return Promise.resolve(_this.urlParser.parseUrlFragment(window.location.href)).then(function (authResult) {
|
|
12674
12740
|
// Avoid authentication triggering when an authentication response is present
|
|
12675
12741
|
if (authResult) return;
|
|
12676
|
-
_this.
|
|
12742
|
+
_this.core.getSessionInfo().then(function (session) {
|
|
12677
12743
|
var reAuthenticate = auth && auth.prompt && auth.prompt === 'login';
|
|
12678
12744
|
if (session.isAuthenticated && !reAuthenticate) {
|
|
12679
|
-
_this.
|
|
12745
|
+
_this.core.loginFromSession(auth);
|
|
12680
12746
|
} else {
|
|
12681
12747
|
showAuthWidget(session);
|
|
12682
12748
|
}
|
|
@@ -12694,1676 +12760,6 @@ var UiClient = /*#__PURE__*/function () {
|
|
|
12694
12760
|
return UiClient;
|
|
12695
12761
|
}();
|
|
12696
12762
|
|
|
12697
|
-
var lookup = [];
|
|
12698
|
-
var revLookup = [];
|
|
12699
|
-
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
12700
|
-
var inited = false;
|
|
12701
|
-
function init() {
|
|
12702
|
-
inited = true;
|
|
12703
|
-
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
12704
|
-
for (var i = 0, len = code.length; i < len; ++i) {
|
|
12705
|
-
lookup[i] = code[i];
|
|
12706
|
-
revLookup[code.charCodeAt(i)] = i;
|
|
12707
|
-
}
|
|
12708
|
-
revLookup['-'.charCodeAt(0)] = 62;
|
|
12709
|
-
revLookup['_'.charCodeAt(0)] = 63;
|
|
12710
|
-
}
|
|
12711
|
-
function toByteArray(b64) {
|
|
12712
|
-
if (!inited) {
|
|
12713
|
-
init();
|
|
12714
|
-
}
|
|
12715
|
-
var i, j, l, tmp, placeHolders, arr;
|
|
12716
|
-
var len = b64.length;
|
|
12717
|
-
if (len % 4 > 0) {
|
|
12718
|
-
throw new Error('Invalid string. Length must be a multiple of 4');
|
|
12719
|
-
}
|
|
12720
|
-
|
|
12721
|
-
// the number of equal signs (place holders)
|
|
12722
|
-
// if there are two placeholders, than the two characters before it
|
|
12723
|
-
// represent one byte
|
|
12724
|
-
// if there is only one, then the three characters before it represent 2 bytes
|
|
12725
|
-
// this is just a cheap hack to not do indexOf twice
|
|
12726
|
-
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
|
|
12727
|
-
|
|
12728
|
-
// base64 is 4/3 + up to two characters of the original data
|
|
12729
|
-
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
12730
|
-
|
|
12731
|
-
// if there are placeholders, only get up to the last complete 4 chars
|
|
12732
|
-
l = placeHolders > 0 ? len - 4 : len;
|
|
12733
|
-
var L = 0;
|
|
12734
|
-
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
12735
|
-
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
12736
|
-
arr[L++] = tmp >> 16 & 0xFF;
|
|
12737
|
-
arr[L++] = tmp >> 8 & 0xFF;
|
|
12738
|
-
arr[L++] = tmp & 0xFF;
|
|
12739
|
-
}
|
|
12740
|
-
if (placeHolders === 2) {
|
|
12741
|
-
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
12742
|
-
arr[L++] = tmp & 0xFF;
|
|
12743
|
-
} else if (placeHolders === 1) {
|
|
12744
|
-
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
12745
|
-
arr[L++] = tmp >> 8 & 0xFF;
|
|
12746
|
-
arr[L++] = tmp & 0xFF;
|
|
12747
|
-
}
|
|
12748
|
-
return arr;
|
|
12749
|
-
}
|
|
12750
|
-
function tripletToBase64(num) {
|
|
12751
|
-
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
|
|
12752
|
-
}
|
|
12753
|
-
function encodeChunk(uint8, start, end) {
|
|
12754
|
-
var tmp;
|
|
12755
|
-
var output = [];
|
|
12756
|
-
for (var i = start; i < end; i += 3) {
|
|
12757
|
-
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
|
|
12758
|
-
output.push(tripletToBase64(tmp));
|
|
12759
|
-
}
|
|
12760
|
-
return output.join('');
|
|
12761
|
-
}
|
|
12762
|
-
function fromByteArray(uint8) {
|
|
12763
|
-
if (!inited) {
|
|
12764
|
-
init();
|
|
12765
|
-
}
|
|
12766
|
-
var tmp;
|
|
12767
|
-
var len = uint8.length;
|
|
12768
|
-
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
12769
|
-
var output = '';
|
|
12770
|
-
var parts = [];
|
|
12771
|
-
var maxChunkLength = 16383; // must be multiple of 3
|
|
12772
|
-
|
|
12773
|
-
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
12774
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
12775
|
-
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
12776
|
-
}
|
|
12777
|
-
|
|
12778
|
-
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
12779
|
-
if (extraBytes === 1) {
|
|
12780
|
-
tmp = uint8[len - 1];
|
|
12781
|
-
output += lookup[tmp >> 2];
|
|
12782
|
-
output += lookup[tmp << 4 & 0x3F];
|
|
12783
|
-
output += '==';
|
|
12784
|
-
} else if (extraBytes === 2) {
|
|
12785
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
12786
|
-
output += lookup[tmp >> 10];
|
|
12787
|
-
output += lookup[tmp >> 4 & 0x3F];
|
|
12788
|
-
output += lookup[tmp << 2 & 0x3F];
|
|
12789
|
-
output += '=';
|
|
12790
|
-
}
|
|
12791
|
-
parts.push(output);
|
|
12792
|
-
return parts.join('');
|
|
12793
|
-
}
|
|
12794
|
-
|
|
12795
|
-
function read(buffer, offset, isLE, mLen, nBytes) {
|
|
12796
|
-
var e, m;
|
|
12797
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
12798
|
-
var eMax = (1 << eLen) - 1;
|
|
12799
|
-
var eBias = eMax >> 1;
|
|
12800
|
-
var nBits = -7;
|
|
12801
|
-
var i = isLE ? nBytes - 1 : 0;
|
|
12802
|
-
var d = isLE ? -1 : 1;
|
|
12803
|
-
var s = buffer[offset + i];
|
|
12804
|
-
i += d;
|
|
12805
|
-
e = s & (1 << -nBits) - 1;
|
|
12806
|
-
s >>= -nBits;
|
|
12807
|
-
nBits += eLen;
|
|
12808
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12809
|
-
m = e & (1 << -nBits) - 1;
|
|
12810
|
-
e >>= -nBits;
|
|
12811
|
-
nBits += mLen;
|
|
12812
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
12813
|
-
if (e === 0) {
|
|
12814
|
-
e = 1 - eBias;
|
|
12815
|
-
} else if (e === eMax) {
|
|
12816
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
12817
|
-
} else {
|
|
12818
|
-
m = m + Math.pow(2, mLen);
|
|
12819
|
-
e = e - eBias;
|
|
12820
|
-
}
|
|
12821
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
12822
|
-
}
|
|
12823
|
-
function write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
12824
|
-
var e, m, c;
|
|
12825
|
-
var eLen = nBytes * 8 - mLen - 1;
|
|
12826
|
-
var eMax = (1 << eLen) - 1;
|
|
12827
|
-
var eBias = eMax >> 1;
|
|
12828
|
-
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
12829
|
-
var i = isLE ? 0 : nBytes - 1;
|
|
12830
|
-
var d = isLE ? 1 : -1;
|
|
12831
|
-
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
12832
|
-
value = Math.abs(value);
|
|
12833
|
-
if (isNaN(value) || value === Infinity) {
|
|
12834
|
-
m = isNaN(value) ? 1 : 0;
|
|
12835
|
-
e = eMax;
|
|
12836
|
-
} else {
|
|
12837
|
-
e = Math.floor(Math.log(value) / Math.LN2);
|
|
12838
|
-
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
12839
|
-
e--;
|
|
12840
|
-
c *= 2;
|
|
12841
|
-
}
|
|
12842
|
-
if (e + eBias >= 1) {
|
|
12843
|
-
value += rt / c;
|
|
12844
|
-
} else {
|
|
12845
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
12846
|
-
}
|
|
12847
|
-
if (value * c >= 2) {
|
|
12848
|
-
e++;
|
|
12849
|
-
c /= 2;
|
|
12850
|
-
}
|
|
12851
|
-
if (e + eBias >= eMax) {
|
|
12852
|
-
m = 0;
|
|
12853
|
-
e = eMax;
|
|
12854
|
-
} else if (e + eBias >= 1) {
|
|
12855
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
12856
|
-
e = e + eBias;
|
|
12857
|
-
} else {
|
|
12858
|
-
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
12859
|
-
e = 0;
|
|
12860
|
-
}
|
|
12861
|
-
}
|
|
12862
|
-
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
12863
|
-
e = e << mLen | m;
|
|
12864
|
-
eLen += mLen;
|
|
12865
|
-
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
12866
|
-
buffer[offset + i - d] |= s * 128;
|
|
12867
|
-
}
|
|
12868
|
-
|
|
12869
|
-
var toString$1 = {}.toString;
|
|
12870
|
-
var isArray$1 = Array.isArray || function (arr) {
|
|
12871
|
-
return toString$1.call(arr) == '[object Array]';
|
|
12872
|
-
};
|
|
12873
|
-
|
|
12874
|
-
var INSPECT_MAX_BYTES = 50;
|
|
12875
|
-
|
|
12876
|
-
/**
|
|
12877
|
-
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
12878
|
-
* === true Use Uint8Array implementation (fastest)
|
|
12879
|
-
* === false Use Object implementation (most compatible, even IE6)
|
|
12880
|
-
*
|
|
12881
|
-
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
12882
|
-
* Opera 11.6+, iOS 4.2+.
|
|
12883
|
-
*
|
|
12884
|
-
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
12885
|
-
* when the browser supports typed arrays.
|
|
12886
|
-
*
|
|
12887
|
-
* Note:
|
|
12888
|
-
*
|
|
12889
|
-
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
12890
|
-
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
12891
|
-
*
|
|
12892
|
-
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
12893
|
-
*
|
|
12894
|
-
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
12895
|
-
* incorrect length in some situations.
|
|
12896
|
-
|
|
12897
|
-
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
12898
|
-
* get the Object implementation, which is slower but behaves correctly.
|
|
12899
|
-
*/
|
|
12900
|
-
Buffer$2.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
|
|
12901
|
-
|
|
12902
|
-
function kMaxLength() {
|
|
12903
|
-
return Buffer$2.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
|
|
12904
|
-
}
|
|
12905
|
-
function createBuffer(that, length) {
|
|
12906
|
-
if (kMaxLength() < length) {
|
|
12907
|
-
throw new RangeError('Invalid typed array length');
|
|
12908
|
-
}
|
|
12909
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
12910
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
12911
|
-
that = new Uint8Array(length);
|
|
12912
|
-
that.__proto__ = Buffer$2.prototype;
|
|
12913
|
-
} else {
|
|
12914
|
-
// Fallback: Return an object instance of the Buffer class
|
|
12915
|
-
if (that === null) {
|
|
12916
|
-
that = new Buffer$2(length);
|
|
12917
|
-
}
|
|
12918
|
-
that.length = length;
|
|
12919
|
-
}
|
|
12920
|
-
return that;
|
|
12921
|
-
}
|
|
12922
|
-
|
|
12923
|
-
/**
|
|
12924
|
-
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
12925
|
-
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
12926
|
-
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
12927
|
-
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
12928
|
-
* returns a single octet.
|
|
12929
|
-
*
|
|
12930
|
-
* The `Uint8Array` prototype remains unmodified.
|
|
12931
|
-
*/
|
|
12932
|
-
|
|
12933
|
-
function Buffer$2(arg, encodingOrOffset, length) {
|
|
12934
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$2)) {
|
|
12935
|
-
return new Buffer$2(arg, encodingOrOffset, length);
|
|
12936
|
-
}
|
|
12937
|
-
|
|
12938
|
-
// Common case.
|
|
12939
|
-
if (typeof arg === 'number') {
|
|
12940
|
-
if (typeof encodingOrOffset === 'string') {
|
|
12941
|
-
throw new Error('If encoding is specified then the first argument must be a string');
|
|
12942
|
-
}
|
|
12943
|
-
return allocUnsafe$1(this, arg);
|
|
12944
|
-
}
|
|
12945
|
-
return from(this, arg, encodingOrOffset, length);
|
|
12946
|
-
}
|
|
12947
|
-
Buffer$2.poolSize = 8192; // not used by this implementation
|
|
12948
|
-
|
|
12949
|
-
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
12950
|
-
Buffer$2._augment = function (arr) {
|
|
12951
|
-
arr.__proto__ = Buffer$2.prototype;
|
|
12952
|
-
return arr;
|
|
12953
|
-
};
|
|
12954
|
-
function from(that, value, encodingOrOffset, length) {
|
|
12955
|
-
if (typeof value === 'number') {
|
|
12956
|
-
throw new TypeError('"value" argument must not be a number');
|
|
12957
|
-
}
|
|
12958
|
-
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
12959
|
-
return fromArrayBuffer(that, value, encodingOrOffset, length);
|
|
12960
|
-
}
|
|
12961
|
-
if (typeof value === 'string') {
|
|
12962
|
-
return fromString(that, value, encodingOrOffset);
|
|
12963
|
-
}
|
|
12964
|
-
return fromObject(that, value);
|
|
12965
|
-
}
|
|
12966
|
-
|
|
12967
|
-
/**
|
|
12968
|
-
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
12969
|
-
* if value is a number.
|
|
12970
|
-
* Buffer.from(str[, encoding])
|
|
12971
|
-
* Buffer.from(array)
|
|
12972
|
-
* Buffer.from(buffer)
|
|
12973
|
-
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
12974
|
-
**/
|
|
12975
|
-
Buffer$2.from = function (value, encodingOrOffset, length) {
|
|
12976
|
-
return from(null, value, encodingOrOffset, length);
|
|
12977
|
-
};
|
|
12978
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
12979
|
-
Buffer$2.prototype.__proto__ = Uint8Array.prototype;
|
|
12980
|
-
Buffer$2.__proto__ = Uint8Array;
|
|
12981
|
-
}
|
|
12982
|
-
function assertSize(size) {
|
|
12983
|
-
if (typeof size !== 'number') {
|
|
12984
|
-
throw new TypeError('"size" argument must be a number');
|
|
12985
|
-
} else if (size < 0) {
|
|
12986
|
-
throw new RangeError('"size" argument must not be negative');
|
|
12987
|
-
}
|
|
12988
|
-
}
|
|
12989
|
-
function alloc(that, size, fill, encoding) {
|
|
12990
|
-
assertSize(size);
|
|
12991
|
-
if (size <= 0) {
|
|
12992
|
-
return createBuffer(that, size);
|
|
12993
|
-
}
|
|
12994
|
-
if (fill !== undefined) {
|
|
12995
|
-
// Only pay attention to encoding if it's a string. This
|
|
12996
|
-
// prevents accidentally sending in a number that would
|
|
12997
|
-
// be interpretted as a start offset.
|
|
12998
|
-
return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
|
|
12999
|
-
}
|
|
13000
|
-
return createBuffer(that, size);
|
|
13001
|
-
}
|
|
13002
|
-
|
|
13003
|
-
/**
|
|
13004
|
-
* Creates a new filled Buffer instance.
|
|
13005
|
-
* alloc(size[, fill[, encoding]])
|
|
13006
|
-
**/
|
|
13007
|
-
Buffer$2.alloc = function (size, fill, encoding) {
|
|
13008
|
-
return alloc(null, size, fill, encoding);
|
|
13009
|
-
};
|
|
13010
|
-
function allocUnsafe$1(that, size) {
|
|
13011
|
-
assertSize(size);
|
|
13012
|
-
that = createBuffer(that, size < 0 ? 0 : checked$1(size) | 0);
|
|
13013
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13014
|
-
for (var i = 0; i < size; ++i) {
|
|
13015
|
-
that[i] = 0;
|
|
13016
|
-
}
|
|
13017
|
-
}
|
|
13018
|
-
return that;
|
|
13019
|
-
}
|
|
13020
|
-
|
|
13021
|
-
/**
|
|
13022
|
-
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13023
|
-
* */
|
|
13024
|
-
Buffer$2.allocUnsafe = function (size) {
|
|
13025
|
-
return allocUnsafe$1(null, size);
|
|
13026
|
-
};
|
|
13027
|
-
/**
|
|
13028
|
-
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
13029
|
-
*/
|
|
13030
|
-
Buffer$2.allocUnsafeSlow = function (size) {
|
|
13031
|
-
return allocUnsafe$1(null, size);
|
|
13032
|
-
};
|
|
13033
|
-
function fromString(that, string, encoding) {
|
|
13034
|
-
if (typeof encoding !== 'string' || encoding === '') {
|
|
13035
|
-
encoding = 'utf8';
|
|
13036
|
-
}
|
|
13037
|
-
if (!Buffer$2.isEncoding(encoding)) {
|
|
13038
|
-
throw new TypeError('"encoding" must be a valid string encoding');
|
|
13039
|
-
}
|
|
13040
|
-
var length = byteLength(string, encoding) | 0;
|
|
13041
|
-
that = createBuffer(that, length);
|
|
13042
|
-
var actual = that.write(string, encoding);
|
|
13043
|
-
if (actual !== length) {
|
|
13044
|
-
// Writing a hex string, for example, that contains invalid characters will
|
|
13045
|
-
// cause everything after the first invalid character to be ignored. (e.g.
|
|
13046
|
-
// 'abxxcd' will be treated as 'ab')
|
|
13047
|
-
that = that.slice(0, actual);
|
|
13048
|
-
}
|
|
13049
|
-
return that;
|
|
13050
|
-
}
|
|
13051
|
-
function fromArrayLike(that, array) {
|
|
13052
|
-
var length = array.length < 0 ? 0 : checked$1(array.length) | 0;
|
|
13053
|
-
that = createBuffer(that, length);
|
|
13054
|
-
for (var i = 0; i < length; i += 1) {
|
|
13055
|
-
that[i] = array[i] & 255;
|
|
13056
|
-
}
|
|
13057
|
-
return that;
|
|
13058
|
-
}
|
|
13059
|
-
function fromArrayBuffer(that, array, byteOffset, length) {
|
|
13060
|
-
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
|
|
13061
|
-
|
|
13062
|
-
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
13063
|
-
throw new RangeError('\'offset\' is out of bounds');
|
|
13064
|
-
}
|
|
13065
|
-
if (array.byteLength < byteOffset + (length || 0)) {
|
|
13066
|
-
throw new RangeError('\'length\' is out of bounds');
|
|
13067
|
-
}
|
|
13068
|
-
if (byteOffset === undefined && length === undefined) {
|
|
13069
|
-
array = new Uint8Array(array);
|
|
13070
|
-
} else if (length === undefined) {
|
|
13071
|
-
array = new Uint8Array(array, byteOffset);
|
|
13072
|
-
} else {
|
|
13073
|
-
array = new Uint8Array(array, byteOffset, length);
|
|
13074
|
-
}
|
|
13075
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13076
|
-
// Return an augmented `Uint8Array` instance, for best performance
|
|
13077
|
-
that = array;
|
|
13078
|
-
that.__proto__ = Buffer$2.prototype;
|
|
13079
|
-
} else {
|
|
13080
|
-
// Fallback: Return an object instance of the Buffer class
|
|
13081
|
-
that = fromArrayLike(that, array);
|
|
13082
|
-
}
|
|
13083
|
-
return that;
|
|
13084
|
-
}
|
|
13085
|
-
function fromObject(that, obj) {
|
|
13086
|
-
if (internalIsBuffer(obj)) {
|
|
13087
|
-
var len = checked$1(obj.length) | 0;
|
|
13088
|
-
that = createBuffer(that, len);
|
|
13089
|
-
if (that.length === 0) {
|
|
13090
|
-
return that;
|
|
13091
|
-
}
|
|
13092
|
-
obj.copy(that, 0, 0, len);
|
|
13093
|
-
return that;
|
|
13094
|
-
}
|
|
13095
|
-
if (obj) {
|
|
13096
|
-
if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
|
|
13097
|
-
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
13098
|
-
return createBuffer(that, 0);
|
|
13099
|
-
}
|
|
13100
|
-
return fromArrayLike(that, obj);
|
|
13101
|
-
}
|
|
13102
|
-
if (obj.type === 'Buffer' && isArray$1(obj.data)) {
|
|
13103
|
-
return fromArrayLike(that, obj.data);
|
|
13104
|
-
}
|
|
13105
|
-
}
|
|
13106
|
-
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
|
|
13107
|
-
}
|
|
13108
|
-
function checked$1(length) {
|
|
13109
|
-
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
13110
|
-
// length is NaN (which is otherwise coerced to zero.)
|
|
13111
|
-
if (length >= kMaxLength()) {
|
|
13112
|
-
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
|
|
13113
|
-
}
|
|
13114
|
-
return length | 0;
|
|
13115
|
-
}
|
|
13116
|
-
Buffer$2.isBuffer = isBuffer$1;
|
|
13117
|
-
function internalIsBuffer(b) {
|
|
13118
|
-
return !!(b != null && b._isBuffer);
|
|
13119
|
-
}
|
|
13120
|
-
Buffer$2.compare = function compare(a, b) {
|
|
13121
|
-
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
13122
|
-
throw new TypeError('Arguments must be Buffers');
|
|
13123
|
-
}
|
|
13124
|
-
if (a === b) return 0;
|
|
13125
|
-
var x = a.length;
|
|
13126
|
-
var y = b.length;
|
|
13127
|
-
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
13128
|
-
if (a[i] !== b[i]) {
|
|
13129
|
-
x = a[i];
|
|
13130
|
-
y = b[i];
|
|
13131
|
-
break;
|
|
13132
|
-
}
|
|
13133
|
-
}
|
|
13134
|
-
if (x < y) return -1;
|
|
13135
|
-
if (y < x) return 1;
|
|
13136
|
-
return 0;
|
|
13137
|
-
};
|
|
13138
|
-
Buffer$2.isEncoding = function isEncoding(encoding) {
|
|
13139
|
-
switch (String(encoding).toLowerCase()) {
|
|
13140
|
-
case 'hex':
|
|
13141
|
-
case 'utf8':
|
|
13142
|
-
case 'utf-8':
|
|
13143
|
-
case 'ascii':
|
|
13144
|
-
case 'latin1':
|
|
13145
|
-
case 'binary':
|
|
13146
|
-
case 'base64':
|
|
13147
|
-
case 'ucs2':
|
|
13148
|
-
case 'ucs-2':
|
|
13149
|
-
case 'utf16le':
|
|
13150
|
-
case 'utf-16le':
|
|
13151
|
-
return true;
|
|
13152
|
-
default:
|
|
13153
|
-
return false;
|
|
13154
|
-
}
|
|
13155
|
-
};
|
|
13156
|
-
Buffer$2.concat = function concat(list, length) {
|
|
13157
|
-
if (!isArray$1(list)) {
|
|
13158
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13159
|
-
}
|
|
13160
|
-
if (list.length === 0) {
|
|
13161
|
-
return Buffer$2.alloc(0);
|
|
13162
|
-
}
|
|
13163
|
-
var i;
|
|
13164
|
-
if (length === undefined) {
|
|
13165
|
-
length = 0;
|
|
13166
|
-
for (i = 0; i < list.length; ++i) {
|
|
13167
|
-
length += list[i].length;
|
|
13168
|
-
}
|
|
13169
|
-
}
|
|
13170
|
-
var buffer = Buffer$2.allocUnsafe(length);
|
|
13171
|
-
var pos = 0;
|
|
13172
|
-
for (i = 0; i < list.length; ++i) {
|
|
13173
|
-
var buf = list[i];
|
|
13174
|
-
if (!internalIsBuffer(buf)) {
|
|
13175
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
13176
|
-
}
|
|
13177
|
-
buf.copy(buffer, pos);
|
|
13178
|
-
pos += buf.length;
|
|
13179
|
-
}
|
|
13180
|
-
return buffer;
|
|
13181
|
-
};
|
|
13182
|
-
function byteLength(string, encoding) {
|
|
13183
|
-
if (internalIsBuffer(string)) {
|
|
13184
|
-
return string.length;
|
|
13185
|
-
}
|
|
13186
|
-
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
13187
|
-
return string.byteLength;
|
|
13188
|
-
}
|
|
13189
|
-
if (typeof string !== 'string') {
|
|
13190
|
-
string = '' + string;
|
|
13191
|
-
}
|
|
13192
|
-
var len = string.length;
|
|
13193
|
-
if (len === 0) return 0;
|
|
13194
|
-
|
|
13195
|
-
// Use a for loop to avoid recursion
|
|
13196
|
-
var loweredCase = false;
|
|
13197
|
-
for (;;) {
|
|
13198
|
-
switch (encoding) {
|
|
13199
|
-
case 'ascii':
|
|
13200
|
-
case 'latin1':
|
|
13201
|
-
case 'binary':
|
|
13202
|
-
return len;
|
|
13203
|
-
case 'utf8':
|
|
13204
|
-
case 'utf-8':
|
|
13205
|
-
case undefined:
|
|
13206
|
-
return utf8ToBytes(string).length;
|
|
13207
|
-
case 'ucs2':
|
|
13208
|
-
case 'ucs-2':
|
|
13209
|
-
case 'utf16le':
|
|
13210
|
-
case 'utf-16le':
|
|
13211
|
-
return len * 2;
|
|
13212
|
-
case 'hex':
|
|
13213
|
-
return len >>> 1;
|
|
13214
|
-
case 'base64':
|
|
13215
|
-
return base64ToBytes(string).length;
|
|
13216
|
-
default:
|
|
13217
|
-
if (loweredCase) return utf8ToBytes(string).length; // assume utf8
|
|
13218
|
-
encoding = ('' + encoding).toLowerCase();
|
|
13219
|
-
loweredCase = true;
|
|
13220
|
-
}
|
|
13221
|
-
}
|
|
13222
|
-
}
|
|
13223
|
-
Buffer$2.byteLength = byteLength;
|
|
13224
|
-
function slowToString(encoding, start, end) {
|
|
13225
|
-
var loweredCase = false;
|
|
13226
|
-
|
|
13227
|
-
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
13228
|
-
// property of a typed array.
|
|
13229
|
-
|
|
13230
|
-
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
13231
|
-
// to their upper/lower bounds if the value passed is out of range.
|
|
13232
|
-
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
13233
|
-
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
13234
|
-
if (start === undefined || start < 0) {
|
|
13235
|
-
start = 0;
|
|
13236
|
-
}
|
|
13237
|
-
// Return early if start > this.length. Done here to prevent potential uint32
|
|
13238
|
-
// coercion fail below.
|
|
13239
|
-
if (start > this.length) {
|
|
13240
|
-
return '';
|
|
13241
|
-
}
|
|
13242
|
-
if (end === undefined || end > this.length) {
|
|
13243
|
-
end = this.length;
|
|
13244
|
-
}
|
|
13245
|
-
if (end <= 0) {
|
|
13246
|
-
return '';
|
|
13247
|
-
}
|
|
13248
|
-
|
|
13249
|
-
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
13250
|
-
end >>>= 0;
|
|
13251
|
-
start >>>= 0;
|
|
13252
|
-
if (end <= start) {
|
|
13253
|
-
return '';
|
|
13254
|
-
}
|
|
13255
|
-
if (!encoding) encoding = 'utf8';
|
|
13256
|
-
while (true) {
|
|
13257
|
-
switch (encoding) {
|
|
13258
|
-
case 'hex':
|
|
13259
|
-
return hexSlice(this, start, end);
|
|
13260
|
-
case 'utf8':
|
|
13261
|
-
case 'utf-8':
|
|
13262
|
-
return utf8Slice(this, start, end);
|
|
13263
|
-
case 'ascii':
|
|
13264
|
-
return asciiSlice(this, start, end);
|
|
13265
|
-
case 'latin1':
|
|
13266
|
-
case 'binary':
|
|
13267
|
-
return latin1Slice(this, start, end);
|
|
13268
|
-
case 'base64':
|
|
13269
|
-
return base64Slice(this, start, end);
|
|
13270
|
-
case 'ucs2':
|
|
13271
|
-
case 'ucs-2':
|
|
13272
|
-
case 'utf16le':
|
|
13273
|
-
case 'utf-16le':
|
|
13274
|
-
return utf16leSlice(this, start, end);
|
|
13275
|
-
default:
|
|
13276
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13277
|
-
encoding = (encoding + '').toLowerCase();
|
|
13278
|
-
loweredCase = true;
|
|
13279
|
-
}
|
|
13280
|
-
}
|
|
13281
|
-
}
|
|
13282
|
-
|
|
13283
|
-
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
13284
|
-
// Buffer instances.
|
|
13285
|
-
Buffer$2.prototype._isBuffer = true;
|
|
13286
|
-
function swap(b, n, m) {
|
|
13287
|
-
var i = b[n];
|
|
13288
|
-
b[n] = b[m];
|
|
13289
|
-
b[m] = i;
|
|
13290
|
-
}
|
|
13291
|
-
Buffer$2.prototype.swap16 = function swap16() {
|
|
13292
|
-
var len = this.length;
|
|
13293
|
-
if (len % 2 !== 0) {
|
|
13294
|
-
throw new RangeError('Buffer size must be a multiple of 16-bits');
|
|
13295
|
-
}
|
|
13296
|
-
for (var i = 0; i < len; i += 2) {
|
|
13297
|
-
swap(this, i, i + 1);
|
|
13298
|
-
}
|
|
13299
|
-
return this;
|
|
13300
|
-
};
|
|
13301
|
-
Buffer$2.prototype.swap32 = function swap32() {
|
|
13302
|
-
var len = this.length;
|
|
13303
|
-
if (len % 4 !== 0) {
|
|
13304
|
-
throw new RangeError('Buffer size must be a multiple of 32-bits');
|
|
13305
|
-
}
|
|
13306
|
-
for (var i = 0; i < len; i += 4) {
|
|
13307
|
-
swap(this, i, i + 3);
|
|
13308
|
-
swap(this, i + 1, i + 2);
|
|
13309
|
-
}
|
|
13310
|
-
return this;
|
|
13311
|
-
};
|
|
13312
|
-
Buffer$2.prototype.swap64 = function swap64() {
|
|
13313
|
-
var len = this.length;
|
|
13314
|
-
if (len % 8 !== 0) {
|
|
13315
|
-
throw new RangeError('Buffer size must be a multiple of 64-bits');
|
|
13316
|
-
}
|
|
13317
|
-
for (var i = 0; i < len; i += 8) {
|
|
13318
|
-
swap(this, i, i + 7);
|
|
13319
|
-
swap(this, i + 1, i + 6);
|
|
13320
|
-
swap(this, i + 2, i + 5);
|
|
13321
|
-
swap(this, i + 3, i + 4);
|
|
13322
|
-
}
|
|
13323
|
-
return this;
|
|
13324
|
-
};
|
|
13325
|
-
Buffer$2.prototype.toString = function toString() {
|
|
13326
|
-
var length = this.length | 0;
|
|
13327
|
-
if (length === 0) return '';
|
|
13328
|
-
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
13329
|
-
return slowToString.apply(this, arguments);
|
|
13330
|
-
};
|
|
13331
|
-
Buffer$2.prototype.equals = function equals(b) {
|
|
13332
|
-
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
|
|
13333
|
-
if (this === b) return true;
|
|
13334
|
-
return Buffer$2.compare(this, b) === 0;
|
|
13335
|
-
};
|
|
13336
|
-
Buffer$2.prototype.inspect = function inspect() {
|
|
13337
|
-
var str = '';
|
|
13338
|
-
var max = INSPECT_MAX_BYTES;
|
|
13339
|
-
if (this.length > 0) {
|
|
13340
|
-
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
|
|
13341
|
-
if (this.length > max) str += ' ... ';
|
|
13342
|
-
}
|
|
13343
|
-
return '<Buffer ' + str + '>';
|
|
13344
|
-
};
|
|
13345
|
-
Buffer$2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
|
|
13346
|
-
if (!internalIsBuffer(target)) {
|
|
13347
|
-
throw new TypeError('Argument must be a Buffer');
|
|
13348
|
-
}
|
|
13349
|
-
if (start === undefined) {
|
|
13350
|
-
start = 0;
|
|
13351
|
-
}
|
|
13352
|
-
if (end === undefined) {
|
|
13353
|
-
end = target ? target.length : 0;
|
|
13354
|
-
}
|
|
13355
|
-
if (thisStart === undefined) {
|
|
13356
|
-
thisStart = 0;
|
|
13357
|
-
}
|
|
13358
|
-
if (thisEnd === undefined) {
|
|
13359
|
-
thisEnd = this.length;
|
|
13360
|
-
}
|
|
13361
|
-
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
13362
|
-
throw new RangeError('out of range index');
|
|
13363
|
-
}
|
|
13364
|
-
if (thisStart >= thisEnd && start >= end) {
|
|
13365
|
-
return 0;
|
|
13366
|
-
}
|
|
13367
|
-
if (thisStart >= thisEnd) {
|
|
13368
|
-
return -1;
|
|
13369
|
-
}
|
|
13370
|
-
if (start >= end) {
|
|
13371
|
-
return 1;
|
|
13372
|
-
}
|
|
13373
|
-
start >>>= 0;
|
|
13374
|
-
end >>>= 0;
|
|
13375
|
-
thisStart >>>= 0;
|
|
13376
|
-
thisEnd >>>= 0;
|
|
13377
|
-
if (this === target) return 0;
|
|
13378
|
-
var x = thisEnd - thisStart;
|
|
13379
|
-
var y = end - start;
|
|
13380
|
-
var len = Math.min(x, y);
|
|
13381
|
-
var thisCopy = this.slice(thisStart, thisEnd);
|
|
13382
|
-
var targetCopy = target.slice(start, end);
|
|
13383
|
-
for (var i = 0; i < len; ++i) {
|
|
13384
|
-
if (thisCopy[i] !== targetCopy[i]) {
|
|
13385
|
-
x = thisCopy[i];
|
|
13386
|
-
y = targetCopy[i];
|
|
13387
|
-
break;
|
|
13388
|
-
}
|
|
13389
|
-
}
|
|
13390
|
-
if (x < y) return -1;
|
|
13391
|
-
if (y < x) return 1;
|
|
13392
|
-
return 0;
|
|
13393
|
-
};
|
|
13394
|
-
|
|
13395
|
-
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
13396
|
-
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
13397
|
-
//
|
|
13398
|
-
// Arguments:
|
|
13399
|
-
// - buffer - a Buffer to search
|
|
13400
|
-
// - val - a string, Buffer, or number
|
|
13401
|
-
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
13402
|
-
// - encoding - an optional encoding, relevant is val is a string
|
|
13403
|
-
// - dir - true for indexOf, false for lastIndexOf
|
|
13404
|
-
function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|
13405
|
-
// Empty buffer means no match
|
|
13406
|
-
if (buffer.length === 0) return -1;
|
|
13407
|
-
|
|
13408
|
-
// Normalize byteOffset
|
|
13409
|
-
if (typeof byteOffset === 'string') {
|
|
13410
|
-
encoding = byteOffset;
|
|
13411
|
-
byteOffset = 0;
|
|
13412
|
-
} else if (byteOffset > 0x7fffffff) {
|
|
13413
|
-
byteOffset = 0x7fffffff;
|
|
13414
|
-
} else if (byteOffset < -0x80000000) {
|
|
13415
|
-
byteOffset = -0x80000000;
|
|
13416
|
-
}
|
|
13417
|
-
byteOffset = +byteOffset; // Coerce to Number.
|
|
13418
|
-
if (isNaN(byteOffset)) {
|
|
13419
|
-
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
13420
|
-
byteOffset = dir ? 0 : buffer.length - 1;
|
|
13421
|
-
}
|
|
13422
|
-
|
|
13423
|
-
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
13424
|
-
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
13425
|
-
if (byteOffset >= buffer.length) {
|
|
13426
|
-
if (dir) return -1;else byteOffset = buffer.length - 1;
|
|
13427
|
-
} else if (byteOffset < 0) {
|
|
13428
|
-
if (dir) byteOffset = 0;else return -1;
|
|
13429
|
-
}
|
|
13430
|
-
|
|
13431
|
-
// Normalize val
|
|
13432
|
-
if (typeof val === 'string') {
|
|
13433
|
-
val = Buffer$2.from(val, encoding);
|
|
13434
|
-
}
|
|
13435
|
-
|
|
13436
|
-
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
13437
|
-
if (internalIsBuffer(val)) {
|
|
13438
|
-
// Special case: looking for empty string/buffer always fails
|
|
13439
|
-
if (val.length === 0) {
|
|
13440
|
-
return -1;
|
|
13441
|
-
}
|
|
13442
|
-
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
|
|
13443
|
-
} else if (typeof val === 'number') {
|
|
13444
|
-
val = val & 0xFF; // Search for a byte value [0-255]
|
|
13445
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
|
|
13446
|
-
if (dir) {
|
|
13447
|
-
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
|
|
13448
|
-
} else {
|
|
13449
|
-
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
|
|
13450
|
-
}
|
|
13451
|
-
}
|
|
13452
|
-
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
|
|
13453
|
-
}
|
|
13454
|
-
throw new TypeError('val must be string, number or Buffer');
|
|
13455
|
-
}
|
|
13456
|
-
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
|
|
13457
|
-
var indexSize = 1;
|
|
13458
|
-
var arrLength = arr.length;
|
|
13459
|
-
var valLength = val.length;
|
|
13460
|
-
if (encoding !== undefined) {
|
|
13461
|
-
encoding = String(encoding).toLowerCase();
|
|
13462
|
-
if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
13463
|
-
if (arr.length < 2 || val.length < 2) {
|
|
13464
|
-
return -1;
|
|
13465
|
-
}
|
|
13466
|
-
indexSize = 2;
|
|
13467
|
-
arrLength /= 2;
|
|
13468
|
-
valLength /= 2;
|
|
13469
|
-
byteOffset /= 2;
|
|
13470
|
-
}
|
|
13471
|
-
}
|
|
13472
|
-
function read(buf, i) {
|
|
13473
|
-
if (indexSize === 1) {
|
|
13474
|
-
return buf[i];
|
|
13475
|
-
} else {
|
|
13476
|
-
return buf.readUInt16BE(i * indexSize);
|
|
13477
|
-
}
|
|
13478
|
-
}
|
|
13479
|
-
var i;
|
|
13480
|
-
if (dir) {
|
|
13481
|
-
var foundIndex = -1;
|
|
13482
|
-
for (i = byteOffset; i < arrLength; i++) {
|
|
13483
|
-
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
13484
|
-
if (foundIndex === -1) foundIndex = i;
|
|
13485
|
-
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
13486
|
-
} else {
|
|
13487
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
13488
|
-
foundIndex = -1;
|
|
13489
|
-
}
|
|
13490
|
-
}
|
|
13491
|
-
} else {
|
|
13492
|
-
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
13493
|
-
for (i = byteOffset; i >= 0; i--) {
|
|
13494
|
-
var found = true;
|
|
13495
|
-
for (var j = 0; j < valLength; j++) {
|
|
13496
|
-
if (read(arr, i + j) !== read(val, j)) {
|
|
13497
|
-
found = false;
|
|
13498
|
-
break;
|
|
13499
|
-
}
|
|
13500
|
-
}
|
|
13501
|
-
if (found) return i;
|
|
13502
|
-
}
|
|
13503
|
-
}
|
|
13504
|
-
return -1;
|
|
13505
|
-
}
|
|
13506
|
-
Buffer$2.prototype.includes = function includes(val, byteOffset, encoding) {
|
|
13507
|
-
return this.indexOf(val, byteOffset, encoding) !== -1;
|
|
13508
|
-
};
|
|
13509
|
-
Buffer$2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
|
|
13510
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
|
|
13511
|
-
};
|
|
13512
|
-
Buffer$2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
|
|
13513
|
-
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
|
|
13514
|
-
};
|
|
13515
|
-
function hexWrite(buf, string, offset, length) {
|
|
13516
|
-
offset = Number(offset) || 0;
|
|
13517
|
-
var remaining = buf.length - offset;
|
|
13518
|
-
if (!length) {
|
|
13519
|
-
length = remaining;
|
|
13520
|
-
} else {
|
|
13521
|
-
length = Number(length);
|
|
13522
|
-
if (length > remaining) {
|
|
13523
|
-
length = remaining;
|
|
13524
|
-
}
|
|
13525
|
-
}
|
|
13526
|
-
|
|
13527
|
-
// must be an even number of digits
|
|
13528
|
-
var strLen = string.length;
|
|
13529
|
-
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
|
|
13530
|
-
if (length > strLen / 2) {
|
|
13531
|
-
length = strLen / 2;
|
|
13532
|
-
}
|
|
13533
|
-
for (var i = 0; i < length; ++i) {
|
|
13534
|
-
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
13535
|
-
if (isNaN(parsed)) return i;
|
|
13536
|
-
buf[offset + i] = parsed;
|
|
13537
|
-
}
|
|
13538
|
-
return i;
|
|
13539
|
-
}
|
|
13540
|
-
function utf8Write(buf, string, offset, length) {
|
|
13541
|
-
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
|
|
13542
|
-
}
|
|
13543
|
-
function asciiWrite(buf, string, offset, length) {
|
|
13544
|
-
return blitBuffer(asciiToBytes(string), buf, offset, length);
|
|
13545
|
-
}
|
|
13546
|
-
function latin1Write(buf, string, offset, length) {
|
|
13547
|
-
return asciiWrite(buf, string, offset, length);
|
|
13548
|
-
}
|
|
13549
|
-
function base64Write(buf, string, offset, length) {
|
|
13550
|
-
return blitBuffer(base64ToBytes(string), buf, offset, length);
|
|
13551
|
-
}
|
|
13552
|
-
function ucs2Write(buf, string, offset, length) {
|
|
13553
|
-
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
|
|
13554
|
-
}
|
|
13555
|
-
Buffer$2.prototype.write = function write(string, offset, length, encoding) {
|
|
13556
|
-
// Buffer#write(string)
|
|
13557
|
-
if (offset === undefined) {
|
|
13558
|
-
encoding = 'utf8';
|
|
13559
|
-
length = this.length;
|
|
13560
|
-
offset = 0;
|
|
13561
|
-
// Buffer#write(string, encoding)
|
|
13562
|
-
} else if (length === undefined && typeof offset === 'string') {
|
|
13563
|
-
encoding = offset;
|
|
13564
|
-
length = this.length;
|
|
13565
|
-
offset = 0;
|
|
13566
|
-
// Buffer#write(string, offset[, length][, encoding])
|
|
13567
|
-
} else if (isFinite(offset)) {
|
|
13568
|
-
offset = offset | 0;
|
|
13569
|
-
if (isFinite(length)) {
|
|
13570
|
-
length = length | 0;
|
|
13571
|
-
if (encoding === undefined) encoding = 'utf8';
|
|
13572
|
-
} else {
|
|
13573
|
-
encoding = length;
|
|
13574
|
-
length = undefined;
|
|
13575
|
-
}
|
|
13576
|
-
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
13577
|
-
} else {
|
|
13578
|
-
throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
|
|
13579
|
-
}
|
|
13580
|
-
var remaining = this.length - offset;
|
|
13581
|
-
if (length === undefined || length > remaining) length = remaining;
|
|
13582
|
-
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
13583
|
-
throw new RangeError('Attempt to write outside buffer bounds');
|
|
13584
|
-
}
|
|
13585
|
-
if (!encoding) encoding = 'utf8';
|
|
13586
|
-
var loweredCase = false;
|
|
13587
|
-
for (;;) {
|
|
13588
|
-
switch (encoding) {
|
|
13589
|
-
case 'hex':
|
|
13590
|
-
return hexWrite(this, string, offset, length);
|
|
13591
|
-
case 'utf8':
|
|
13592
|
-
case 'utf-8':
|
|
13593
|
-
return utf8Write(this, string, offset, length);
|
|
13594
|
-
case 'ascii':
|
|
13595
|
-
return asciiWrite(this, string, offset, length);
|
|
13596
|
-
case 'latin1':
|
|
13597
|
-
case 'binary':
|
|
13598
|
-
return latin1Write(this, string, offset, length);
|
|
13599
|
-
case 'base64':
|
|
13600
|
-
// Warning: maxLength not taken into account in base64Write
|
|
13601
|
-
return base64Write(this, string, offset, length);
|
|
13602
|
-
case 'ucs2':
|
|
13603
|
-
case 'ucs-2':
|
|
13604
|
-
case 'utf16le':
|
|
13605
|
-
case 'utf-16le':
|
|
13606
|
-
return ucs2Write(this, string, offset, length);
|
|
13607
|
-
default:
|
|
13608
|
-
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
|
|
13609
|
-
encoding = ('' + encoding).toLowerCase();
|
|
13610
|
-
loweredCase = true;
|
|
13611
|
-
}
|
|
13612
|
-
}
|
|
13613
|
-
};
|
|
13614
|
-
Buffer$2.prototype.toJSON = function toJSON() {
|
|
13615
|
-
return {
|
|
13616
|
-
type: 'Buffer',
|
|
13617
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
13618
|
-
};
|
|
13619
|
-
};
|
|
13620
|
-
function base64Slice(buf, start, end) {
|
|
13621
|
-
if (start === 0 && end === buf.length) {
|
|
13622
|
-
return fromByteArray(buf);
|
|
13623
|
-
} else {
|
|
13624
|
-
return fromByteArray(buf.slice(start, end));
|
|
13625
|
-
}
|
|
13626
|
-
}
|
|
13627
|
-
function utf8Slice(buf, start, end) {
|
|
13628
|
-
end = Math.min(buf.length, end);
|
|
13629
|
-
var res = [];
|
|
13630
|
-
var i = start;
|
|
13631
|
-
while (i < end) {
|
|
13632
|
-
var firstByte = buf[i];
|
|
13633
|
-
var codePoint = null;
|
|
13634
|
-
var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
|
|
13635
|
-
if (i + bytesPerSequence <= end) {
|
|
13636
|
-
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
13637
|
-
switch (bytesPerSequence) {
|
|
13638
|
-
case 1:
|
|
13639
|
-
if (firstByte < 0x80) {
|
|
13640
|
-
codePoint = firstByte;
|
|
13641
|
-
}
|
|
13642
|
-
break;
|
|
13643
|
-
case 2:
|
|
13644
|
-
secondByte = buf[i + 1];
|
|
13645
|
-
if ((secondByte & 0xC0) === 0x80) {
|
|
13646
|
-
tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
|
|
13647
|
-
if (tempCodePoint > 0x7F) {
|
|
13648
|
-
codePoint = tempCodePoint;
|
|
13649
|
-
}
|
|
13650
|
-
}
|
|
13651
|
-
break;
|
|
13652
|
-
case 3:
|
|
13653
|
-
secondByte = buf[i + 1];
|
|
13654
|
-
thirdByte = buf[i + 2];
|
|
13655
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
13656
|
-
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
|
|
13657
|
-
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
13658
|
-
codePoint = tempCodePoint;
|
|
13659
|
-
}
|
|
13660
|
-
}
|
|
13661
|
-
break;
|
|
13662
|
-
case 4:
|
|
13663
|
-
secondByte = buf[i + 1];
|
|
13664
|
-
thirdByte = buf[i + 2];
|
|
13665
|
-
fourthByte = buf[i + 3];
|
|
13666
|
-
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
13667
|
-
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
|
|
13668
|
-
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
13669
|
-
codePoint = tempCodePoint;
|
|
13670
|
-
}
|
|
13671
|
-
}
|
|
13672
|
-
}
|
|
13673
|
-
}
|
|
13674
|
-
if (codePoint === null) {
|
|
13675
|
-
// we did not generate a valid codePoint so insert a
|
|
13676
|
-
// replacement char (U+FFFD) and advance only 1 byte
|
|
13677
|
-
codePoint = 0xFFFD;
|
|
13678
|
-
bytesPerSequence = 1;
|
|
13679
|
-
} else if (codePoint > 0xFFFF) {
|
|
13680
|
-
// encode to utf16 (surrogate pair dance)
|
|
13681
|
-
codePoint -= 0x10000;
|
|
13682
|
-
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
13683
|
-
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
13684
|
-
}
|
|
13685
|
-
res.push(codePoint);
|
|
13686
|
-
i += bytesPerSequence;
|
|
13687
|
-
}
|
|
13688
|
-
return decodeCodePointsArray(res);
|
|
13689
|
-
}
|
|
13690
|
-
|
|
13691
|
-
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
13692
|
-
// the lowest limit is Chrome, with 0x10000 args.
|
|
13693
|
-
// We go 1 magnitude less, for safety
|
|
13694
|
-
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
13695
|
-
function decodeCodePointsArray(codePoints) {
|
|
13696
|
-
var len = codePoints.length;
|
|
13697
|
-
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
13698
|
-
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
|
|
13699
|
-
}
|
|
13700
|
-
|
|
13701
|
-
// Decode in chunks to avoid "call stack size exceeded".
|
|
13702
|
-
var res = '';
|
|
13703
|
-
var i = 0;
|
|
13704
|
-
while (i < len) {
|
|
13705
|
-
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
|
|
13706
|
-
}
|
|
13707
|
-
return res;
|
|
13708
|
-
}
|
|
13709
|
-
function asciiSlice(buf, start, end) {
|
|
13710
|
-
var ret = '';
|
|
13711
|
-
end = Math.min(buf.length, end);
|
|
13712
|
-
for (var i = start; i < end; ++i) {
|
|
13713
|
-
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
13714
|
-
}
|
|
13715
|
-
return ret;
|
|
13716
|
-
}
|
|
13717
|
-
function latin1Slice(buf, start, end) {
|
|
13718
|
-
var ret = '';
|
|
13719
|
-
end = Math.min(buf.length, end);
|
|
13720
|
-
for (var i = start; i < end; ++i) {
|
|
13721
|
-
ret += String.fromCharCode(buf[i]);
|
|
13722
|
-
}
|
|
13723
|
-
return ret;
|
|
13724
|
-
}
|
|
13725
|
-
function hexSlice(buf, start, end) {
|
|
13726
|
-
var len = buf.length;
|
|
13727
|
-
if (!start || start < 0) start = 0;
|
|
13728
|
-
if (!end || end < 0 || end > len) end = len;
|
|
13729
|
-
var out = '';
|
|
13730
|
-
for (var i = start; i < end; ++i) {
|
|
13731
|
-
out += toHex(buf[i]);
|
|
13732
|
-
}
|
|
13733
|
-
return out;
|
|
13734
|
-
}
|
|
13735
|
-
function utf16leSlice(buf, start, end) {
|
|
13736
|
-
var bytes = buf.slice(start, end);
|
|
13737
|
-
var res = '';
|
|
13738
|
-
for (var i = 0; i < bytes.length; i += 2) {
|
|
13739
|
-
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
13740
|
-
}
|
|
13741
|
-
return res;
|
|
13742
|
-
}
|
|
13743
|
-
Buffer$2.prototype.slice = function slice(start, end) {
|
|
13744
|
-
var len = this.length;
|
|
13745
|
-
start = ~~start;
|
|
13746
|
-
end = end === undefined ? len : ~~end;
|
|
13747
|
-
if (start < 0) {
|
|
13748
|
-
start += len;
|
|
13749
|
-
if (start < 0) start = 0;
|
|
13750
|
-
} else if (start > len) {
|
|
13751
|
-
start = len;
|
|
13752
|
-
}
|
|
13753
|
-
if (end < 0) {
|
|
13754
|
-
end += len;
|
|
13755
|
-
if (end < 0) end = 0;
|
|
13756
|
-
} else if (end > len) {
|
|
13757
|
-
end = len;
|
|
13758
|
-
}
|
|
13759
|
-
if (end < start) end = start;
|
|
13760
|
-
var newBuf;
|
|
13761
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13762
|
-
newBuf = this.subarray(start, end);
|
|
13763
|
-
newBuf.__proto__ = Buffer$2.prototype;
|
|
13764
|
-
} else {
|
|
13765
|
-
var sliceLen = end - start;
|
|
13766
|
-
newBuf = new Buffer$2(sliceLen, undefined);
|
|
13767
|
-
for (var i = 0; i < sliceLen; ++i) {
|
|
13768
|
-
newBuf[i] = this[i + start];
|
|
13769
|
-
}
|
|
13770
|
-
}
|
|
13771
|
-
return newBuf;
|
|
13772
|
-
};
|
|
13773
|
-
|
|
13774
|
-
/*
|
|
13775
|
-
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
13776
|
-
*/
|
|
13777
|
-
function checkOffset(offset, ext, length) {
|
|
13778
|
-
if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
|
|
13779
|
-
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
|
|
13780
|
-
}
|
|
13781
|
-
Buffer$2.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
|
|
13782
|
-
offset = offset | 0;
|
|
13783
|
-
byteLength = byteLength | 0;
|
|
13784
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13785
|
-
var val = this[offset];
|
|
13786
|
-
var mul = 1;
|
|
13787
|
-
var i = 0;
|
|
13788
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13789
|
-
val += this[offset + i] * mul;
|
|
13790
|
-
}
|
|
13791
|
-
return val;
|
|
13792
|
-
};
|
|
13793
|
-
Buffer$2.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
|
|
13794
|
-
offset = offset | 0;
|
|
13795
|
-
byteLength = byteLength | 0;
|
|
13796
|
-
if (!noAssert) {
|
|
13797
|
-
checkOffset(offset, byteLength, this.length);
|
|
13798
|
-
}
|
|
13799
|
-
var val = this[offset + --byteLength];
|
|
13800
|
-
var mul = 1;
|
|
13801
|
-
while (byteLength > 0 && (mul *= 0x100)) {
|
|
13802
|
-
val += this[offset + --byteLength] * mul;
|
|
13803
|
-
}
|
|
13804
|
-
return val;
|
|
13805
|
-
};
|
|
13806
|
-
Buffer$2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
13807
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13808
|
-
return this[offset];
|
|
13809
|
-
};
|
|
13810
|
-
Buffer$2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
13811
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13812
|
-
return this[offset] | this[offset + 1] << 8;
|
|
13813
|
-
};
|
|
13814
|
-
Buffer$2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
13815
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13816
|
-
return this[offset] << 8 | this[offset + 1];
|
|
13817
|
-
};
|
|
13818
|
-
Buffer$2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
13819
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13820
|
-
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
|
|
13821
|
-
};
|
|
13822
|
-
Buffer$2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
13823
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13824
|
-
return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
13825
|
-
};
|
|
13826
|
-
Buffer$2.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
|
|
13827
|
-
offset = offset | 0;
|
|
13828
|
-
byteLength = byteLength | 0;
|
|
13829
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13830
|
-
var val = this[offset];
|
|
13831
|
-
var mul = 1;
|
|
13832
|
-
var i = 0;
|
|
13833
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13834
|
-
val += this[offset + i] * mul;
|
|
13835
|
-
}
|
|
13836
|
-
mul *= 0x80;
|
|
13837
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13838
|
-
return val;
|
|
13839
|
-
};
|
|
13840
|
-
Buffer$2.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
|
|
13841
|
-
offset = offset | 0;
|
|
13842
|
-
byteLength = byteLength | 0;
|
|
13843
|
-
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
13844
|
-
var i = byteLength;
|
|
13845
|
-
var mul = 1;
|
|
13846
|
-
var val = this[offset + --i];
|
|
13847
|
-
while (i > 0 && (mul *= 0x100)) {
|
|
13848
|
-
val += this[offset + --i] * mul;
|
|
13849
|
-
}
|
|
13850
|
-
mul *= 0x80;
|
|
13851
|
-
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
13852
|
-
return val;
|
|
13853
|
-
};
|
|
13854
|
-
Buffer$2.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
13855
|
-
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
13856
|
-
if (!(this[offset] & 0x80)) return this[offset];
|
|
13857
|
-
return (0xff - this[offset] + 1) * -1;
|
|
13858
|
-
};
|
|
13859
|
-
Buffer$2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
13860
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13861
|
-
var val = this[offset] | this[offset + 1] << 8;
|
|
13862
|
-
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
13863
|
-
};
|
|
13864
|
-
Buffer$2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
13865
|
-
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
13866
|
-
var val = this[offset + 1] | this[offset] << 8;
|
|
13867
|
-
return val & 0x8000 ? val | 0xFFFF0000 : val;
|
|
13868
|
-
};
|
|
13869
|
-
Buffer$2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
13870
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13871
|
-
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
13872
|
-
};
|
|
13873
|
-
Buffer$2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
13874
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13875
|
-
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
13876
|
-
};
|
|
13877
|
-
Buffer$2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
13878
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13879
|
-
return read(this, offset, true, 23, 4);
|
|
13880
|
-
};
|
|
13881
|
-
Buffer$2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
13882
|
-
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
13883
|
-
return read(this, offset, false, 23, 4);
|
|
13884
|
-
};
|
|
13885
|
-
Buffer$2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
13886
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
13887
|
-
return read(this, offset, true, 52, 8);
|
|
13888
|
-
};
|
|
13889
|
-
Buffer$2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
13890
|
-
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
13891
|
-
return read(this, offset, false, 52, 8);
|
|
13892
|
-
};
|
|
13893
|
-
function checkInt(buf, value, offset, ext, max, min) {
|
|
13894
|
-
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
13895
|
-
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
13896
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
13897
|
-
}
|
|
13898
|
-
Buffer$2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
|
|
13899
|
-
value = +value;
|
|
13900
|
-
offset = offset | 0;
|
|
13901
|
-
byteLength = byteLength | 0;
|
|
13902
|
-
if (!noAssert) {
|
|
13903
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
13904
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
13905
|
-
}
|
|
13906
|
-
var mul = 1;
|
|
13907
|
-
var i = 0;
|
|
13908
|
-
this[offset] = value & 0xFF;
|
|
13909
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
13910
|
-
this[offset + i] = value / mul & 0xFF;
|
|
13911
|
-
}
|
|
13912
|
-
return offset + byteLength;
|
|
13913
|
-
};
|
|
13914
|
-
Buffer$2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
|
|
13915
|
-
value = +value;
|
|
13916
|
-
offset = offset | 0;
|
|
13917
|
-
byteLength = byteLength | 0;
|
|
13918
|
-
if (!noAssert) {
|
|
13919
|
-
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
13920
|
-
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
13921
|
-
}
|
|
13922
|
-
var i = byteLength - 1;
|
|
13923
|
-
var mul = 1;
|
|
13924
|
-
this[offset + i] = value & 0xFF;
|
|
13925
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
13926
|
-
this[offset + i] = value / mul & 0xFF;
|
|
13927
|
-
}
|
|
13928
|
-
return offset + byteLength;
|
|
13929
|
-
};
|
|
13930
|
-
Buffer$2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
13931
|
-
value = +value;
|
|
13932
|
-
offset = offset | 0;
|
|
13933
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
13934
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
13935
|
-
this[offset] = value & 0xff;
|
|
13936
|
-
return offset + 1;
|
|
13937
|
-
};
|
|
13938
|
-
function objectWriteUInt16(buf, value, offset, littleEndian) {
|
|
13939
|
-
if (value < 0) value = 0xffff + value + 1;
|
|
13940
|
-
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
13941
|
-
buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
|
|
13942
|
-
}
|
|
13943
|
-
}
|
|
13944
|
-
Buffer$2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
13945
|
-
value = +value;
|
|
13946
|
-
offset = offset | 0;
|
|
13947
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
13948
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13949
|
-
this[offset] = value & 0xff;
|
|
13950
|
-
this[offset + 1] = value >>> 8;
|
|
13951
|
-
} else {
|
|
13952
|
-
objectWriteUInt16(this, value, offset, true);
|
|
13953
|
-
}
|
|
13954
|
-
return offset + 2;
|
|
13955
|
-
};
|
|
13956
|
-
Buffer$2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
13957
|
-
value = +value;
|
|
13958
|
-
offset = offset | 0;
|
|
13959
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
13960
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13961
|
-
this[offset] = value >>> 8;
|
|
13962
|
-
this[offset + 1] = value & 0xff;
|
|
13963
|
-
} else {
|
|
13964
|
-
objectWriteUInt16(this, value, offset, false);
|
|
13965
|
-
}
|
|
13966
|
-
return offset + 2;
|
|
13967
|
-
};
|
|
13968
|
-
function objectWriteUInt32(buf, value, offset, littleEndian) {
|
|
13969
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
13970
|
-
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
13971
|
-
buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
|
|
13972
|
-
}
|
|
13973
|
-
}
|
|
13974
|
-
Buffer$2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
13975
|
-
value = +value;
|
|
13976
|
-
offset = offset | 0;
|
|
13977
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
13978
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13979
|
-
this[offset + 3] = value >>> 24;
|
|
13980
|
-
this[offset + 2] = value >>> 16;
|
|
13981
|
-
this[offset + 1] = value >>> 8;
|
|
13982
|
-
this[offset] = value & 0xff;
|
|
13983
|
-
} else {
|
|
13984
|
-
objectWriteUInt32(this, value, offset, true);
|
|
13985
|
-
}
|
|
13986
|
-
return offset + 4;
|
|
13987
|
-
};
|
|
13988
|
-
Buffer$2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
13989
|
-
value = +value;
|
|
13990
|
-
offset = offset | 0;
|
|
13991
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
13992
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
13993
|
-
this[offset] = value >>> 24;
|
|
13994
|
-
this[offset + 1] = value >>> 16;
|
|
13995
|
-
this[offset + 2] = value >>> 8;
|
|
13996
|
-
this[offset + 3] = value & 0xff;
|
|
13997
|
-
} else {
|
|
13998
|
-
objectWriteUInt32(this, value, offset, false);
|
|
13999
|
-
}
|
|
14000
|
-
return offset + 4;
|
|
14001
|
-
};
|
|
14002
|
-
Buffer$2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
|
|
14003
|
-
value = +value;
|
|
14004
|
-
offset = offset | 0;
|
|
14005
|
-
if (!noAssert) {
|
|
14006
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14007
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14008
|
-
}
|
|
14009
|
-
var i = 0;
|
|
14010
|
-
var mul = 1;
|
|
14011
|
-
var sub = 0;
|
|
14012
|
-
this[offset] = value & 0xFF;
|
|
14013
|
-
while (++i < byteLength && (mul *= 0x100)) {
|
|
14014
|
-
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
14015
|
-
sub = 1;
|
|
14016
|
-
}
|
|
14017
|
-
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14018
|
-
}
|
|
14019
|
-
return offset + byteLength;
|
|
14020
|
-
};
|
|
14021
|
-
Buffer$2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
|
|
14022
|
-
value = +value;
|
|
14023
|
-
offset = offset | 0;
|
|
14024
|
-
if (!noAssert) {
|
|
14025
|
-
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
14026
|
-
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
14027
|
-
}
|
|
14028
|
-
var i = byteLength - 1;
|
|
14029
|
-
var mul = 1;
|
|
14030
|
-
var sub = 0;
|
|
14031
|
-
this[offset + i] = value & 0xFF;
|
|
14032
|
-
while (--i >= 0 && (mul *= 0x100)) {
|
|
14033
|
-
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
14034
|
-
sub = 1;
|
|
14035
|
-
}
|
|
14036
|
-
this[offset + i] = (value / mul >> 0) - sub & 0xFF;
|
|
14037
|
-
}
|
|
14038
|
-
return offset + byteLength;
|
|
14039
|
-
};
|
|
14040
|
-
Buffer$2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
14041
|
-
value = +value;
|
|
14042
|
-
offset = offset | 0;
|
|
14043
|
-
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
|
|
14044
|
-
if (!Buffer$2.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
14045
|
-
if (value < 0) value = 0xff + value + 1;
|
|
14046
|
-
this[offset] = value & 0xff;
|
|
14047
|
-
return offset + 1;
|
|
14048
|
-
};
|
|
14049
|
-
Buffer$2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
14050
|
-
value = +value;
|
|
14051
|
-
offset = offset | 0;
|
|
14052
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14053
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14054
|
-
this[offset] = value & 0xff;
|
|
14055
|
-
this[offset + 1] = value >>> 8;
|
|
14056
|
-
} else {
|
|
14057
|
-
objectWriteUInt16(this, value, offset, true);
|
|
14058
|
-
}
|
|
14059
|
-
return offset + 2;
|
|
14060
|
-
};
|
|
14061
|
-
Buffer$2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
14062
|
-
value = +value;
|
|
14063
|
-
offset = offset | 0;
|
|
14064
|
-
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
14065
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14066
|
-
this[offset] = value >>> 8;
|
|
14067
|
-
this[offset + 1] = value & 0xff;
|
|
14068
|
-
} else {
|
|
14069
|
-
objectWriteUInt16(this, value, offset, false);
|
|
14070
|
-
}
|
|
14071
|
-
return offset + 2;
|
|
14072
|
-
};
|
|
14073
|
-
Buffer$2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
14074
|
-
value = +value;
|
|
14075
|
-
offset = offset | 0;
|
|
14076
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14077
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14078
|
-
this[offset] = value & 0xff;
|
|
14079
|
-
this[offset + 1] = value >>> 8;
|
|
14080
|
-
this[offset + 2] = value >>> 16;
|
|
14081
|
-
this[offset + 3] = value >>> 24;
|
|
14082
|
-
} else {
|
|
14083
|
-
objectWriteUInt32(this, value, offset, true);
|
|
14084
|
-
}
|
|
14085
|
-
return offset + 4;
|
|
14086
|
-
};
|
|
14087
|
-
Buffer$2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
14088
|
-
value = +value;
|
|
14089
|
-
offset = offset | 0;
|
|
14090
|
-
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
14091
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
14092
|
-
if (Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14093
|
-
this[offset] = value >>> 24;
|
|
14094
|
-
this[offset + 1] = value >>> 16;
|
|
14095
|
-
this[offset + 2] = value >>> 8;
|
|
14096
|
-
this[offset + 3] = value & 0xff;
|
|
14097
|
-
} else {
|
|
14098
|
-
objectWriteUInt32(this, value, offset, false);
|
|
14099
|
-
}
|
|
14100
|
-
return offset + 4;
|
|
14101
|
-
};
|
|
14102
|
-
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
14103
|
-
if (offset + ext > buf.length) throw new RangeError('Index out of range');
|
|
14104
|
-
if (offset < 0) throw new RangeError('Index out of range');
|
|
14105
|
-
}
|
|
14106
|
-
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
14107
|
-
if (!noAssert) {
|
|
14108
|
-
checkIEEE754(buf, value, offset, 4);
|
|
14109
|
-
}
|
|
14110
|
-
write(buf, value, offset, littleEndian, 23, 4);
|
|
14111
|
-
return offset + 4;
|
|
14112
|
-
}
|
|
14113
|
-
Buffer$2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
|
|
14114
|
-
return writeFloat(this, value, offset, true, noAssert);
|
|
14115
|
-
};
|
|
14116
|
-
Buffer$2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
|
|
14117
|
-
return writeFloat(this, value, offset, false, noAssert);
|
|
14118
|
-
};
|
|
14119
|
-
function writeDouble(buf, value, offset, littleEndian, noAssert) {
|
|
14120
|
-
if (!noAssert) {
|
|
14121
|
-
checkIEEE754(buf, value, offset, 8);
|
|
14122
|
-
}
|
|
14123
|
-
write(buf, value, offset, littleEndian, 52, 8);
|
|
14124
|
-
return offset + 8;
|
|
14125
|
-
}
|
|
14126
|
-
Buffer$2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
|
|
14127
|
-
return writeDouble(this, value, offset, true, noAssert);
|
|
14128
|
-
};
|
|
14129
|
-
Buffer$2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
|
|
14130
|
-
return writeDouble(this, value, offset, false, noAssert);
|
|
14131
|
-
};
|
|
14132
|
-
|
|
14133
|
-
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
14134
|
-
Buffer$2.prototype.copy = function copy(target, targetStart, start, end) {
|
|
14135
|
-
if (!start) start = 0;
|
|
14136
|
-
if (!end && end !== 0) end = this.length;
|
|
14137
|
-
if (targetStart >= target.length) targetStart = target.length;
|
|
14138
|
-
if (!targetStart) targetStart = 0;
|
|
14139
|
-
if (end > 0 && end < start) end = start;
|
|
14140
|
-
|
|
14141
|
-
// Copy 0 bytes; we're done
|
|
14142
|
-
if (end === start) return 0;
|
|
14143
|
-
if (target.length === 0 || this.length === 0) return 0;
|
|
14144
|
-
|
|
14145
|
-
// Fatal error conditions
|
|
14146
|
-
if (targetStart < 0) {
|
|
14147
|
-
throw new RangeError('targetStart out of bounds');
|
|
14148
|
-
}
|
|
14149
|
-
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
|
|
14150
|
-
if (end < 0) throw new RangeError('sourceEnd out of bounds');
|
|
14151
|
-
|
|
14152
|
-
// Are we oob?
|
|
14153
|
-
if (end > this.length) end = this.length;
|
|
14154
|
-
if (target.length - targetStart < end - start) {
|
|
14155
|
-
end = target.length - targetStart + start;
|
|
14156
|
-
}
|
|
14157
|
-
var len = end - start;
|
|
14158
|
-
var i;
|
|
14159
|
-
if (this === target && start < targetStart && targetStart < end) {
|
|
14160
|
-
// descending copy from end
|
|
14161
|
-
for (i = len - 1; i >= 0; --i) {
|
|
14162
|
-
target[i + targetStart] = this[i + start];
|
|
14163
|
-
}
|
|
14164
|
-
} else if (len < 1000 || !Buffer$2.TYPED_ARRAY_SUPPORT) {
|
|
14165
|
-
// ascending copy from start
|
|
14166
|
-
for (i = 0; i < len; ++i) {
|
|
14167
|
-
target[i + targetStart] = this[i + start];
|
|
14168
|
-
}
|
|
14169
|
-
} else {
|
|
14170
|
-
Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
|
|
14171
|
-
}
|
|
14172
|
-
return len;
|
|
14173
|
-
};
|
|
14174
|
-
|
|
14175
|
-
// Usage:
|
|
14176
|
-
// buffer.fill(number[, offset[, end]])
|
|
14177
|
-
// buffer.fill(buffer[, offset[, end]])
|
|
14178
|
-
// buffer.fill(string[, offset[, end]][, encoding])
|
|
14179
|
-
Buffer$2.prototype.fill = function fill(val, start, end, encoding) {
|
|
14180
|
-
// Handle string cases:
|
|
14181
|
-
if (typeof val === 'string') {
|
|
14182
|
-
if (typeof start === 'string') {
|
|
14183
|
-
encoding = start;
|
|
14184
|
-
start = 0;
|
|
14185
|
-
end = this.length;
|
|
14186
|
-
} else if (typeof end === 'string') {
|
|
14187
|
-
encoding = end;
|
|
14188
|
-
end = this.length;
|
|
14189
|
-
}
|
|
14190
|
-
if (val.length === 1) {
|
|
14191
|
-
var code = val.charCodeAt(0);
|
|
14192
|
-
if (code < 256) {
|
|
14193
|
-
val = code;
|
|
14194
|
-
}
|
|
14195
|
-
}
|
|
14196
|
-
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
14197
|
-
throw new TypeError('encoding must be a string');
|
|
14198
|
-
}
|
|
14199
|
-
if (typeof encoding === 'string' && !Buffer$2.isEncoding(encoding)) {
|
|
14200
|
-
throw new TypeError('Unknown encoding: ' + encoding);
|
|
14201
|
-
}
|
|
14202
|
-
} else if (typeof val === 'number') {
|
|
14203
|
-
val = val & 255;
|
|
14204
|
-
}
|
|
14205
|
-
|
|
14206
|
-
// Invalid ranges are not set to a default, so can range check early.
|
|
14207
|
-
if (start < 0 || this.length < start || this.length < end) {
|
|
14208
|
-
throw new RangeError('Out of range index');
|
|
14209
|
-
}
|
|
14210
|
-
if (end <= start) {
|
|
14211
|
-
return this;
|
|
14212
|
-
}
|
|
14213
|
-
start = start >>> 0;
|
|
14214
|
-
end = end === undefined ? this.length : end >>> 0;
|
|
14215
|
-
if (!val) val = 0;
|
|
14216
|
-
var i;
|
|
14217
|
-
if (typeof val === 'number') {
|
|
14218
|
-
for (i = start; i < end; ++i) {
|
|
14219
|
-
this[i] = val;
|
|
14220
|
-
}
|
|
14221
|
-
} else {
|
|
14222
|
-
var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer$2(val, encoding).toString());
|
|
14223
|
-
var len = bytes.length;
|
|
14224
|
-
for (i = 0; i < end - start; ++i) {
|
|
14225
|
-
this[i + start] = bytes[i % len];
|
|
14226
|
-
}
|
|
14227
|
-
}
|
|
14228
|
-
return this;
|
|
14229
|
-
};
|
|
14230
|
-
|
|
14231
|
-
// HELPER FUNCTIONS
|
|
14232
|
-
// ================
|
|
14233
|
-
|
|
14234
|
-
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
14235
|
-
function base64clean(str) {
|
|
14236
|
-
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
14237
|
-
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
|
|
14238
|
-
// Node converts strings with length < 2 to ''
|
|
14239
|
-
if (str.length < 2) return '';
|
|
14240
|
-
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
14241
|
-
while (str.length % 4 !== 0) {
|
|
14242
|
-
str = str + '=';
|
|
14243
|
-
}
|
|
14244
|
-
return str;
|
|
14245
|
-
}
|
|
14246
|
-
function stringtrim(str) {
|
|
14247
|
-
if (str.trim) return str.trim();
|
|
14248
|
-
return str.replace(/^\s+|\s+$/g, '');
|
|
14249
|
-
}
|
|
14250
|
-
function toHex(n) {
|
|
14251
|
-
if (n < 16) return '0' + n.toString(16);
|
|
14252
|
-
return n.toString(16);
|
|
14253
|
-
}
|
|
14254
|
-
function utf8ToBytes(string, units) {
|
|
14255
|
-
units = units || Infinity;
|
|
14256
|
-
var codePoint;
|
|
14257
|
-
var length = string.length;
|
|
14258
|
-
var leadSurrogate = null;
|
|
14259
|
-
var bytes = [];
|
|
14260
|
-
for (var i = 0; i < length; ++i) {
|
|
14261
|
-
codePoint = string.charCodeAt(i);
|
|
14262
|
-
|
|
14263
|
-
// is surrogate component
|
|
14264
|
-
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
14265
|
-
// last char was a lead
|
|
14266
|
-
if (!leadSurrogate) {
|
|
14267
|
-
// no lead yet
|
|
14268
|
-
if (codePoint > 0xDBFF) {
|
|
14269
|
-
// unexpected trail
|
|
14270
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14271
|
-
continue;
|
|
14272
|
-
} else if (i + 1 === length) {
|
|
14273
|
-
// unpaired lead
|
|
14274
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14275
|
-
continue;
|
|
14276
|
-
}
|
|
14277
|
-
|
|
14278
|
-
// valid lead
|
|
14279
|
-
leadSurrogate = codePoint;
|
|
14280
|
-
continue;
|
|
14281
|
-
}
|
|
14282
|
-
|
|
14283
|
-
// 2 leads in a row
|
|
14284
|
-
if (codePoint < 0xDC00) {
|
|
14285
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14286
|
-
leadSurrogate = codePoint;
|
|
14287
|
-
continue;
|
|
14288
|
-
}
|
|
14289
|
-
|
|
14290
|
-
// valid surrogate pair
|
|
14291
|
-
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
14292
|
-
} else if (leadSurrogate) {
|
|
14293
|
-
// valid bmp char, but last char was a lead
|
|
14294
|
-
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
14295
|
-
}
|
|
14296
|
-
leadSurrogate = null;
|
|
14297
|
-
|
|
14298
|
-
// encode utf8
|
|
14299
|
-
if (codePoint < 0x80) {
|
|
14300
|
-
if ((units -= 1) < 0) break;
|
|
14301
|
-
bytes.push(codePoint);
|
|
14302
|
-
} else if (codePoint < 0x800) {
|
|
14303
|
-
if ((units -= 2) < 0) break;
|
|
14304
|
-
bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
|
|
14305
|
-
} else if (codePoint < 0x10000) {
|
|
14306
|
-
if ((units -= 3) < 0) break;
|
|
14307
|
-
bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14308
|
-
} else if (codePoint < 0x110000) {
|
|
14309
|
-
if ((units -= 4) < 0) break;
|
|
14310
|
-
bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
|
|
14311
|
-
} else {
|
|
14312
|
-
throw new Error('Invalid code point');
|
|
14313
|
-
}
|
|
14314
|
-
}
|
|
14315
|
-
return bytes;
|
|
14316
|
-
}
|
|
14317
|
-
function asciiToBytes(str) {
|
|
14318
|
-
var byteArray = [];
|
|
14319
|
-
for (var i = 0; i < str.length; ++i) {
|
|
14320
|
-
// Node's code seems to be doing this and not & 0x7F..
|
|
14321
|
-
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
14322
|
-
}
|
|
14323
|
-
return byteArray;
|
|
14324
|
-
}
|
|
14325
|
-
function utf16leToBytes(str, units) {
|
|
14326
|
-
var c, hi, lo;
|
|
14327
|
-
var byteArray = [];
|
|
14328
|
-
for (var i = 0; i < str.length; ++i) {
|
|
14329
|
-
if ((units -= 2) < 0) break;
|
|
14330
|
-
c = str.charCodeAt(i);
|
|
14331
|
-
hi = c >> 8;
|
|
14332
|
-
lo = c % 256;
|
|
14333
|
-
byteArray.push(lo);
|
|
14334
|
-
byteArray.push(hi);
|
|
14335
|
-
}
|
|
14336
|
-
return byteArray;
|
|
14337
|
-
}
|
|
14338
|
-
function base64ToBytes(str) {
|
|
14339
|
-
return toByteArray(base64clean(str));
|
|
14340
|
-
}
|
|
14341
|
-
function blitBuffer(src, dst, offset, length) {
|
|
14342
|
-
for (var i = 0; i < length; ++i) {
|
|
14343
|
-
if (i + offset >= dst.length || i >= src.length) break;
|
|
14344
|
-
dst[i + offset] = src[i];
|
|
14345
|
-
}
|
|
14346
|
-
return i;
|
|
14347
|
-
}
|
|
14348
|
-
function isnan(val) {
|
|
14349
|
-
return val !== val; // eslint-disable-line no-self-compare
|
|
14350
|
-
}
|
|
14351
|
-
|
|
14352
|
-
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
|
14353
|
-
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|
14354
|
-
// Object.prototype.constructor. Remove this eventually
|
|
14355
|
-
function isBuffer$1(obj) {
|
|
14356
|
-
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
|
|
14357
|
-
}
|
|
14358
|
-
function isFastBuffer(obj) {
|
|
14359
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
|
|
14360
|
-
}
|
|
14361
|
-
|
|
14362
|
-
// For Node v0.10 support. Remove this eventually.
|
|
14363
|
-
function isSlowBuffer(obj) {
|
|
14364
|
-
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
|
|
14365
|
-
}
|
|
14366
|
-
|
|
14367
12763
|
/**
|
|
14368
12764
|
* return an decoded URL Safe Base64 as UTF-8 encoded string
|
|
14369
12765
|
*/
|
|
@@ -14371,8 +12767,8 @@ function decodeBase64UrlSafe(base64) {
|
|
|
14371
12767
|
// Add removed at end '='
|
|
14372
12768
|
// base64 += Array(5 - base64.length % 4).join('=');
|
|
14373
12769
|
|
|
14374
|
-
base64 = base64.replace(
|
|
14375
|
-
.replace(
|
|
12770
|
+
base64 = base64.replace(/-/g, '+') // Convert '-' to '+'
|
|
12771
|
+
.replace(/_/g, '/'); // Convert '_' to '/'
|
|
14376
12772
|
|
|
14377
12773
|
return decodeBase64(base64); // Cf: https://developer.mozilla.org/fr/docs/D%C3%A9coder_encoder_en_base64
|
|
14378
12774
|
}
|
|
@@ -14628,6 +13024,7 @@ function createClient(creationConfig) {
|
|
|
14628
13024
|
})["catch"](console.error);
|
|
14629
13025
|
});
|
|
14630
13026
|
return {
|
|
13027
|
+
core: coreClient,
|
|
14631
13028
|
showAuth: function showAuth(options) {
|
|
14632
13029
|
return client.then(function (client) {
|
|
14633
13030
|
return client.showAuth(options);
|