@pie-element/multiple-choice 9.5.2-next.31 → 9.5.2-next.39
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/configure/lib/defaults.js +2 -1
- package/configure/lib/defaults.js.map +1 -1
- package/controller/lib/defaults.js +2 -1
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +4 -1
- package/controller/lib/index.js.map +1 -1
- package/docs/demo/generate.js +1 -1
- package/docs/pie-schema.json +10 -0
- package/docs/pie-schema.json.md +8 -0
- package/lib/choice-input.js +0 -5
- package/lib/choice-input.js.map +1 -1
- package/lib/choice.js +11 -7
- package/lib/choice.js.map +1 -1
- package/lib/index.js +23 -4
- package/lib/index.js.map +1 -1
- package/lib/multiple-choice.js +77 -44
- package/lib/multiple-choice.js.map +1 -1
- package/module/configure.js +2 -1
- package/module/controller.js +4 -0
- package/module/demo.js +1 -1
- package/module/element.js +3583 -308
- package/module/print-demo.js +1 -1
- package/module/print.js +3567 -305
- package/package.json +2 -2
package/module/print.js
CHANGED
|
@@ -99,7 +99,7 @@ function createGenerateClassName$1() {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
var createMuiTheme$1 = {};
|
|
102
|
-
var defineProperty$
|
|
102
|
+
var defineProperty$2 = {
|
|
103
103
|
exports: {}
|
|
104
104
|
};
|
|
105
105
|
(function (module) {
|
|
@@ -117,8 +117,8 @@ var defineProperty$1 = {
|
|
|
117
117
|
return obj;
|
|
118
118
|
}
|
|
119
119
|
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
120
|
-
})(defineProperty$
|
|
121
|
-
getDefaultExportFromCjs(defineProperty$
|
|
120
|
+
})(defineProperty$2);
|
|
121
|
+
getDefaultExportFromCjs(defineProperty$2.exports);
|
|
122
122
|
var _extends$1 = {
|
|
123
123
|
exports: {}
|
|
124
124
|
};
|
|
@@ -353,7 +353,7 @@ Object.defineProperty(createMixins$1, "__esModule", {
|
|
|
353
353
|
value: true
|
|
354
354
|
});
|
|
355
355
|
createMixins$1.default = createMixins;
|
|
356
|
-
var _defineProperty2$d = _interopRequireDefault$I(defineProperty$
|
|
356
|
+
var _defineProperty2$d = _interopRequireDefault$I(defineProperty$2.exports);
|
|
357
357
|
var _extends3$2 = _interopRequireDefault$I(_extends$1.exports);
|
|
358
358
|
function createMixins(breakpoints, spacing, mixins) {
|
|
359
359
|
var _toolbar;
|
|
@@ -766,7 +766,7 @@ function createPalette(palette) {
|
|
|
766
766
|
}
|
|
767
767
|
var createTypography$1 = {};
|
|
768
768
|
var componentPropType$1 = {};
|
|
769
|
-
var _typeof$
|
|
769
|
+
var _typeof$3 = {
|
|
770
770
|
exports: {}
|
|
771
771
|
};
|
|
772
772
|
(function (module) {
|
|
@@ -779,8 +779,8 @@ var _typeof$1 = {
|
|
|
779
779
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
780
780
|
}
|
|
781
781
|
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
782
|
-
})(_typeof$
|
|
783
|
-
getDefaultExportFromCjs(_typeof$
|
|
782
|
+
})(_typeof$3);
|
|
783
|
+
getDefaultExportFromCjs(_typeof$3.exports);
|
|
784
784
|
var reactIs$1 = {
|
|
785
785
|
exports: {}
|
|
786
786
|
};
|
|
@@ -939,7 +939,7 @@ Object.defineProperty(componentPropType$1, "__esModule", {
|
|
|
939
939
|
value: true
|
|
940
940
|
});
|
|
941
941
|
var default_1$4 = componentPropType$1.default = void 0;
|
|
942
|
-
var _typeof2$2 = _interopRequireDefault$F(_typeof$
|
|
942
|
+
var _typeof2$2 = _interopRequireDefault$F(_typeof$3.exports);
|
|
943
943
|
var _reactIs = reactIs$1.exports;
|
|
944
944
|
function createComponentProp(isRequired) {
|
|
945
945
|
return function componentPropType(props, key, componentName, location, propFullName) {
|
|
@@ -982,7 +982,7 @@ Object.defineProperty(exactProp$1, "__esModule", {
|
|
|
982
982
|
value: true
|
|
983
983
|
});
|
|
984
984
|
var default_1$2 = exactProp$1.default = exactProp$1.specialProperty = void 0;
|
|
985
|
-
var _defineProperty2$c = _interopRequireDefault$E(defineProperty$
|
|
985
|
+
var _defineProperty2$c = _interopRequireDefault$E(defineProperty$2.exports);
|
|
986
986
|
var _extends3$1 = _interopRequireDefault$E(_extends$1.exports);
|
|
987
987
|
var specialProperty = "exact-prop: \u200B";
|
|
988
988
|
exactProp$1.specialProperty = specialProperty;
|
|
@@ -1319,7 +1319,7 @@ Object.defineProperty(createMuiTheme$1, "__esModule", {
|
|
|
1319
1319
|
value: true
|
|
1320
1320
|
});
|
|
1321
1321
|
createMuiTheme$1.default = void 0;
|
|
1322
|
-
var _defineProperty2$b = _interopRequireDefault$B(defineProperty$
|
|
1322
|
+
var _defineProperty2$b = _interopRequireDefault$B(defineProperty$2.exports);
|
|
1323
1323
|
var _extends2$f = _interopRequireDefault$B(_extends$1.exports);
|
|
1324
1324
|
var _objectWithoutProperties2$c = _interopRequireDefault$B(objectWithoutProperties.exports);
|
|
1325
1325
|
var _deepmerge$1 = _interopRequireDefault$B(umd.exports);
|
|
@@ -1874,11 +1874,11 @@ if (typeof self !== 'undefined') {
|
|
|
1874
1874
|
root = Function('return this')();
|
|
1875
1875
|
}
|
|
1876
1876
|
var result = symbolObservablePonyfill(root);
|
|
1877
|
-
var es = Object.freeze({
|
|
1877
|
+
var es$1 = Object.freeze({
|
|
1878
1878
|
__proto__: null,
|
|
1879
1879
|
'default': result
|
|
1880
1880
|
});
|
|
1881
|
-
var require$$0$8 = getAugmentedNamespace(es);
|
|
1881
|
+
var require$$0$8 = getAugmentedNamespace(es$1);
|
|
1882
1882
|
(function (exports) {
|
|
1883
1883
|
Object.defineProperty(exports, "__esModule", {
|
|
1884
1884
|
value: true
|
|
@@ -2398,12 +2398,12 @@ getDefaultExportFromCjs(moduleId);
|
|
|
2398
2398
|
})(createGenerateClassName);
|
|
2399
2399
|
getDefaultExportFromCjs(createGenerateClassName);
|
|
2400
2400
|
var Jss = {};
|
|
2401
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
2401
|
+
var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
2402
2402
|
return typeof obj;
|
|
2403
2403
|
} : function (obj) {
|
|
2404
2404
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2405
2405
|
};
|
|
2406
|
-
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
|
|
2406
|
+
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof$2(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof$2(document)) === 'object' && document.nodeType === 9;
|
|
2407
2407
|
var module$1 = Object.freeze({
|
|
2408
2408
|
__proto__: null,
|
|
2409
2409
|
isBrowser: isBrowser,
|
|
@@ -4439,7 +4439,7 @@ var interopRequireWildcard = {
|
|
|
4439
4439
|
exports: {}
|
|
4440
4440
|
};
|
|
4441
4441
|
(function (module) {
|
|
4442
|
-
var _typeof = _typeof$
|
|
4442
|
+
var _typeof = _typeof$3.exports["default"];
|
|
4443
4443
|
function _getRequireWildcardCache(nodeInterop) {
|
|
4444
4444
|
if (typeof WeakMap !== "function") return null;
|
|
4445
4445
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -4482,7 +4482,7 @@ var interopRequireWildcard = {
|
|
|
4482
4482
|
(module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4483
4483
|
})(interopRequireWildcard);
|
|
4484
4484
|
getDefaultExportFromCjs(interopRequireWildcard.exports);
|
|
4485
|
-
var classCallCheck = {
|
|
4485
|
+
var classCallCheck$1 = {
|
|
4486
4486
|
exports: {}
|
|
4487
4487
|
};
|
|
4488
4488
|
(function (module) {
|
|
@@ -4492,9 +4492,9 @@ var classCallCheck = {
|
|
|
4492
4492
|
}
|
|
4493
4493
|
}
|
|
4494
4494
|
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4495
|
-
})(classCallCheck);
|
|
4496
|
-
getDefaultExportFromCjs(classCallCheck.exports);
|
|
4497
|
-
var createClass = {
|
|
4495
|
+
})(classCallCheck$1);
|
|
4496
|
+
getDefaultExportFromCjs(classCallCheck$1.exports);
|
|
4497
|
+
var createClass$1 = {
|
|
4498
4498
|
exports: {}
|
|
4499
4499
|
};
|
|
4500
4500
|
(function (module) {
|
|
@@ -4516,12 +4516,12 @@ var createClass = {
|
|
|
4516
4516
|
return Constructor;
|
|
4517
4517
|
}
|
|
4518
4518
|
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4519
|
-
})(createClass);
|
|
4520
|
-
getDefaultExportFromCjs(createClass.exports);
|
|
4521
|
-
var possibleConstructorReturn = {
|
|
4519
|
+
})(createClass$1);
|
|
4520
|
+
getDefaultExportFromCjs(createClass$1.exports);
|
|
4521
|
+
var possibleConstructorReturn$1 = {
|
|
4522
4522
|
exports: {}
|
|
4523
4523
|
};
|
|
4524
|
-
var assertThisInitialized = {
|
|
4524
|
+
var assertThisInitialized$1 = {
|
|
4525
4525
|
exports: {}
|
|
4526
4526
|
};
|
|
4527
4527
|
(function (module) {
|
|
@@ -4532,23 +4532,23 @@ var assertThisInitialized = {
|
|
|
4532
4532
|
return self;
|
|
4533
4533
|
}
|
|
4534
4534
|
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4535
|
-
})(assertThisInitialized);
|
|
4536
|
-
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
4535
|
+
})(assertThisInitialized$1);
|
|
4536
|
+
getDefaultExportFromCjs(assertThisInitialized$1.exports);
|
|
4537
4537
|
(function (module) {
|
|
4538
|
-
var _typeof = _typeof$
|
|
4539
|
-
var assertThisInitialized
|
|
4538
|
+
var _typeof = _typeof$3.exports["default"];
|
|
4539
|
+
var assertThisInitialized = assertThisInitialized$1.exports;
|
|
4540
4540
|
function _possibleConstructorReturn(self, call) {
|
|
4541
4541
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
4542
4542
|
return call;
|
|
4543
4543
|
} else if (call !== void 0) {
|
|
4544
4544
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
4545
4545
|
}
|
|
4546
|
-
return assertThisInitialized
|
|
4546
|
+
return assertThisInitialized(self);
|
|
4547
4547
|
}
|
|
4548
4548
|
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4549
|
-
})(possibleConstructorReturn);
|
|
4550
|
-
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
4551
|
-
var getPrototypeOf$
|
|
4549
|
+
})(possibleConstructorReturn$1);
|
|
4550
|
+
getDefaultExportFromCjs(possibleConstructorReturn$1.exports);
|
|
4551
|
+
var getPrototypeOf$2 = {
|
|
4552
4552
|
exports: {}
|
|
4553
4553
|
};
|
|
4554
4554
|
(function (module) {
|
|
@@ -4559,12 +4559,12 @@ var getPrototypeOf$1 = {
|
|
|
4559
4559
|
return _getPrototypeOf(o);
|
|
4560
4560
|
}
|
|
4561
4561
|
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4562
|
-
})(getPrototypeOf$
|
|
4563
|
-
getDefaultExportFromCjs(getPrototypeOf$
|
|
4564
|
-
var inherits = {
|
|
4562
|
+
})(getPrototypeOf$2);
|
|
4563
|
+
getDefaultExportFromCjs(getPrototypeOf$2.exports);
|
|
4564
|
+
var inherits$1 = {
|
|
4565
4565
|
exports: {}
|
|
4566
4566
|
};
|
|
4567
|
-
var setPrototypeOf = {
|
|
4567
|
+
var setPrototypeOf$1 = {
|
|
4568
4568
|
exports: {}
|
|
4569
4569
|
};
|
|
4570
4570
|
(function (module) {
|
|
@@ -4576,10 +4576,10 @@ var setPrototypeOf = {
|
|
|
4576
4576
|
return _setPrototypeOf(o, p);
|
|
4577
4577
|
}
|
|
4578
4578
|
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4579
|
-
})(setPrototypeOf);
|
|
4580
|
-
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
4579
|
+
})(setPrototypeOf$1);
|
|
4580
|
+
getDefaultExportFromCjs(setPrototypeOf$1.exports);
|
|
4581
4581
|
(function (module) {
|
|
4582
|
-
var setPrototypeOf
|
|
4582
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
4583
4583
|
function _inherits(subClass, superClass) {
|
|
4584
4584
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
4585
4585
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -4594,11 +4594,11 @@ getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
|
4594
4594
|
Object.defineProperty(subClass, "prototype", {
|
|
4595
4595
|
writable: false
|
|
4596
4596
|
});
|
|
4597
|
-
if (superClass) setPrototypeOf
|
|
4597
|
+
if (superClass) setPrototypeOf(subClass, superClass);
|
|
4598
4598
|
}
|
|
4599
4599
|
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4600
|
-
})(inherits);
|
|
4601
|
-
getDefaultExportFromCjs(inherits.exports);
|
|
4600
|
+
})(inherits$1);
|
|
4601
|
+
getDefaultExportFromCjs(inherits$1.exports);
|
|
4602
4602
|
function createBroadcast(initialState) {
|
|
4603
4603
|
var listeners = {};
|
|
4604
4604
|
var id = 1;
|
|
@@ -4647,7 +4647,7 @@ Object.defineProperty(themeListener$1, "__esModule", {
|
|
|
4647
4647
|
value: true
|
|
4648
4648
|
});
|
|
4649
4649
|
themeListener$1.default = themeListener$1.CHANNEL = void 0;
|
|
4650
|
-
var _defineProperty2$a = _interopRequireDefault$y(defineProperty$
|
|
4650
|
+
var _defineProperty2$a = _interopRequireDefault$y(defineProperty$2.exports);
|
|
4651
4651
|
var CHANNEL = '__THEMING__';
|
|
4652
4652
|
themeListener$1.CHANNEL = CHANNEL;
|
|
4653
4653
|
var themeListener = {
|
|
@@ -4681,12 +4681,12 @@ Object.defineProperty(MuiThemeProvider, "__esModule", {
|
|
|
4681
4681
|
});
|
|
4682
4682
|
MuiThemeProvider.default = MuiThemeProvider.MuiThemeProviderOld = void 0;
|
|
4683
4683
|
var _extends2$e = _interopRequireDefault$x(_extends$1.exports);
|
|
4684
|
-
var _defineProperty2$9 = _interopRequireDefault$x(defineProperty$
|
|
4685
|
-
var _classCallCheck2$7 = _interopRequireDefault$x(classCallCheck.exports);
|
|
4686
|
-
var _createClass2$7 = _interopRequireDefault$x(createClass.exports);
|
|
4687
|
-
var _possibleConstructorReturn2$7 = _interopRequireDefault$x(possibleConstructorReturn.exports);
|
|
4688
|
-
var _getPrototypeOf2$3 = _interopRequireDefault$x(getPrototypeOf$
|
|
4689
|
-
var _inherits2$7 = _interopRequireDefault$x(inherits.exports);
|
|
4684
|
+
var _defineProperty2$9 = _interopRequireDefault$x(defineProperty$2.exports);
|
|
4685
|
+
var _classCallCheck2$7 = _interopRequireDefault$x(classCallCheck$1.exports);
|
|
4686
|
+
var _createClass2$7 = _interopRequireDefault$x(createClass$1.exports);
|
|
4687
|
+
var _possibleConstructorReturn2$7 = _interopRequireDefault$x(possibleConstructorReturn$1.exports);
|
|
4688
|
+
var _getPrototypeOf2$3 = _interopRequireDefault$x(getPrototypeOf$2.exports);
|
|
4689
|
+
var _inherits2$7 = _interopRequireDefault$x(inherits$1.exports);
|
|
4690
4690
|
var _react$n = _interopRequireDefault$x(require$$9$4);
|
|
4691
4691
|
var _propTypes$e = _interopRequireDefault$x(require$$10$5);
|
|
4692
4692
|
var _warning$5 = _interopRequireDefault$x(warning_1);
|
|
@@ -4845,16 +4845,16 @@ function getStatics(component) {
|
|
|
4845
4845
|
}
|
|
4846
4846
|
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
4847
4847
|
}
|
|
4848
|
-
var defineProperty = Object.defineProperty;
|
|
4848
|
+
var defineProperty$1 = Object.defineProperty;
|
|
4849
4849
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
4850
4850
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
4851
4851
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
4852
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
4852
|
+
var getPrototypeOf$1 = Object.getPrototypeOf;
|
|
4853
4853
|
var objectPrototype = Object.prototype;
|
|
4854
4854
|
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
4855
4855
|
if (typeof sourceComponent !== 'string') {
|
|
4856
4856
|
if (objectPrototype) {
|
|
4857
|
-
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
4857
|
+
var inheritedComponent = getPrototypeOf$1(sourceComponent);
|
|
4858
4858
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
4859
4859
|
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
4860
4860
|
}
|
|
@@ -4870,7 +4870,7 @@ function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
|
4870
4870
|
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
4871
4871
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
4872
4872
|
try {
|
|
4873
|
-
defineProperty(targetComponent, key, descriptor);
|
|
4873
|
+
defineProperty$1(targetComponent, key, descriptor);
|
|
4874
4874
|
} catch (e) {}
|
|
4875
4875
|
}
|
|
4876
4876
|
}
|
|
@@ -4953,7 +4953,7 @@ Object.defineProperty(getStylesCreator$1, "__esModule", {
|
|
|
4953
4953
|
});
|
|
4954
4954
|
getStylesCreator$1.default = void 0;
|
|
4955
4955
|
var _extends2$c = _interopRequireDefault$v(_extends$1.exports);
|
|
4956
|
-
var _typeof2$1 = _interopRequireDefault$v(_typeof$
|
|
4956
|
+
var _typeof2$1 = _interopRequireDefault$v(_typeof$3.exports);
|
|
4957
4957
|
var _warning$3 = _interopRequireDefault$v(warning_1);
|
|
4958
4958
|
var _deepmerge = _interopRequireDefault$v(umd.exports);
|
|
4959
4959
|
function arrayMerge(destination, source) {
|
|
@@ -5013,13 +5013,13 @@ Object.defineProperty(withStyles, "__esModule", {
|
|
|
5013
5013
|
value: true
|
|
5014
5014
|
});
|
|
5015
5015
|
withStyles.default = withStyles.sheetsManager = void 0;
|
|
5016
|
-
var _defineProperty2$8 = _interopRequireDefault$u(defineProperty$
|
|
5016
|
+
var _defineProperty2$8 = _interopRequireDefault$u(defineProperty$2.exports);
|
|
5017
5017
|
var _extends3 = _interopRequireDefault$u(_extends$1.exports);
|
|
5018
|
-
var _classCallCheck2$6 = _interopRequireDefault$u(classCallCheck.exports);
|
|
5019
|
-
var _createClass2$6 = _interopRequireDefault$u(createClass.exports);
|
|
5020
|
-
var _possibleConstructorReturn2$6 = _interopRequireDefault$u(possibleConstructorReturn.exports);
|
|
5021
|
-
var _getPrototypeOf2$2 = _interopRequireDefault$u(getPrototypeOf$
|
|
5022
|
-
var _inherits2$6 = _interopRequireDefault$u(inherits.exports);
|
|
5018
|
+
var _classCallCheck2$6 = _interopRequireDefault$u(classCallCheck$1.exports);
|
|
5019
|
+
var _createClass2$6 = _interopRequireDefault$u(createClass$1.exports);
|
|
5020
|
+
var _possibleConstructorReturn2$6 = _interopRequireDefault$u(possibleConstructorReturn$1.exports);
|
|
5021
|
+
var _getPrototypeOf2$2 = _interopRequireDefault$u(getPrototypeOf$2.exports);
|
|
5022
|
+
var _inherits2$6 = _interopRequireDefault$u(inherits$1.exports);
|
|
5023
5023
|
var _objectWithoutProperties2$b = _interopRequireDefault$u(objectWithoutProperties.exports);
|
|
5024
5024
|
var _react$m = _interopRequireDefault$u(require$$9$3);
|
|
5025
5025
|
var _propTypes$d = _interopRequireDefault$u(require$$10$4);
|
|
@@ -5280,11 +5280,11 @@ Object.defineProperty(withTheme, "__esModule", {
|
|
|
5280
5280
|
withTheme.default = void 0;
|
|
5281
5281
|
var _extends2$b = _interopRequireDefault$t(_extends$1.exports);
|
|
5282
5282
|
var _objectWithoutProperties2$a = _interopRequireDefault$t(objectWithoutProperties.exports);
|
|
5283
|
-
var _classCallCheck2$5 = _interopRequireDefault$t(classCallCheck.exports);
|
|
5284
|
-
var _createClass2$5 = _interopRequireDefault$t(createClass.exports);
|
|
5285
|
-
var _possibleConstructorReturn2$5 = _interopRequireDefault$t(possibleConstructorReturn.exports);
|
|
5286
|
-
var _getPrototypeOf2$1 = _interopRequireDefault$t(getPrototypeOf$
|
|
5287
|
-
var _inherits2$5 = _interopRequireDefault$t(inherits.exports);
|
|
5283
|
+
var _classCallCheck2$5 = _interopRequireDefault$t(classCallCheck$1.exports);
|
|
5284
|
+
var _createClass2$5 = _interopRequireDefault$t(createClass$1.exports);
|
|
5285
|
+
var _possibleConstructorReturn2$5 = _interopRequireDefault$t(possibleConstructorReturn$1.exports);
|
|
5286
|
+
var _getPrototypeOf2$1 = _interopRequireDefault$t(getPrototypeOf$2.exports);
|
|
5287
|
+
var _inherits2$5 = _interopRequireDefault$t(inherits$1.exports);
|
|
5288
5288
|
var _react$l = _interopRequireDefault$t(require$$8);
|
|
5289
5289
|
var _propTypes$c = _interopRequireDefault$t(require$$9$2);
|
|
5290
5290
|
var _hoistNonReactStatics$1 = _interopRequireDefault$t(hoistNonReactStatics_cjs);
|
|
@@ -5423,154 +5423,3386 @@ withTheme.default = _default$s;
|
|
|
5423
5423
|
var _withTheme = _interopRequireDefault(withTheme);
|
|
5424
5424
|
})(styles$b);
|
|
5425
5425
|
getDefaultExportFromCjs(styles$b);
|
|
5426
|
-
var
|
|
5427
|
-
var
|
|
5428
|
-
var
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
FormControlContext$1.default = _default$r;
|
|
5440
|
-
const require$$2$3 = _dll_react;
|
|
5441
|
-
var _interopRequireDefault$r = interopRequireDefault.exports;
|
|
5442
|
-
Object.defineProperty(withFormControlContext$1, "__esModule", {
|
|
5443
|
-
value: true
|
|
5444
|
-
});
|
|
5445
|
-
withFormControlContext$1.default = withFormControlContext;
|
|
5446
|
-
var _extends2$a = _interopRequireDefault$r(_extends$1.exports);
|
|
5447
|
-
var _react$j = _interopRequireDefault$r(require$$2$3);
|
|
5448
|
-
var _hoistNonReactStatics = _interopRequireDefault$r(hoistNonReactStatics_cjs);
|
|
5449
|
-
var _FormControlContext = _interopRequireDefault$r(FormControlContext$1);
|
|
5450
|
-
var _utils$5 = require$$7$1;
|
|
5451
|
-
function withFormControlContext(Component) {
|
|
5452
|
-
var EnhancedComponent = function EnhancedComponent(props) {
|
|
5453
|
-
return _react$j.default.createElement(_FormControlContext.default.Consumer, null, function (context) {
|
|
5454
|
-
return _react$j.default.createElement(Component, (0, _extends2$a.default)({
|
|
5455
|
-
muiFormControl: context
|
|
5456
|
-
}, props));
|
|
5457
|
-
});
|
|
5458
|
-
};
|
|
5459
|
-
{
|
|
5460
|
-
EnhancedComponent.displayName = ("WithFormControlContext(").concat((0, _utils$5.getDisplayName)(Component), ")");
|
|
5461
|
-
}
|
|
5462
|
-
(0, _hoistNonReactStatics.default)(EnhancedComponent, Component);
|
|
5463
|
-
return EnhancedComponent;
|
|
5464
|
-
}
|
|
5465
|
-
var Typography$2 = {};
|
|
5466
|
-
var Typography$1 = {};
|
|
5467
|
-
var helpers = {};
|
|
5468
|
-
var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
5469
|
-
Object.defineProperty(helpers, "__esModule", {
|
|
5470
|
-
value: true
|
|
5471
|
-
});
|
|
5472
|
-
helpers.capitalize = capitalize;
|
|
5473
|
-
helpers.contains = contains;
|
|
5474
|
-
helpers.findIndex = findIndex;
|
|
5475
|
-
helpers.find = find;
|
|
5476
|
-
helpers.createChainedFunction = createChainedFunction;
|
|
5477
|
-
var _typeof2 = _interopRequireDefault$q(_typeof$1.exports);
|
|
5478
|
-
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
5479
|
-
function capitalize(string) {
|
|
5480
|
-
if (typeof string !== 'string') {
|
|
5481
|
-
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
5426
|
+
var translator$2 = {};
|
|
5427
|
+
var translator$1 = {};
|
|
5428
|
+
var _typeof$1 = {
|
|
5429
|
+
exports: {}
|
|
5430
|
+
};
|
|
5431
|
+
(function (module) {
|
|
5432
|
+
function _typeof(obj) {
|
|
5433
|
+
"@babel/helpers - typeof";
|
|
5434
|
+
return ((module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
5435
|
+
return typeof obj;
|
|
5436
|
+
} : function (obj) {
|
|
5437
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
5438
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
5482
5439
|
}
|
|
5483
|
-
|
|
5484
|
-
}
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
function
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
if (predType === 'function' && !!pred(arr[i], i, arr) === true) {
|
|
5494
|
-
return i;
|
|
5440
|
+
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5441
|
+
})(_typeof$1);
|
|
5442
|
+
getDefaultExportFromCjs(_typeof$1.exports);
|
|
5443
|
+
var classCallCheck = {
|
|
5444
|
+
exports: {}
|
|
5445
|
+
};
|
|
5446
|
+
(function (module) {
|
|
5447
|
+
function _classCallCheck(instance, Constructor) {
|
|
5448
|
+
if (!(instance instanceof Constructor)) {
|
|
5449
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5495
5450
|
}
|
|
5496
|
-
|
|
5497
|
-
|
|
5451
|
+
}
|
|
5452
|
+
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5453
|
+
})(classCallCheck);
|
|
5454
|
+
getDefaultExportFromCjs(classCallCheck.exports);
|
|
5455
|
+
var createClass = {
|
|
5456
|
+
exports: {}
|
|
5457
|
+
};
|
|
5458
|
+
var toPropertyKey = {
|
|
5459
|
+
exports: {}
|
|
5460
|
+
};
|
|
5461
|
+
var toPrimitive = {
|
|
5462
|
+
exports: {}
|
|
5463
|
+
};
|
|
5464
|
+
(function (module) {
|
|
5465
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5466
|
+
function _toPrimitive(input, hint) {
|
|
5467
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
5468
|
+
var prim = input[Symbol.toPrimitive];
|
|
5469
|
+
if (prim !== undefined) {
|
|
5470
|
+
var res = prim.call(input, hint || "default");
|
|
5471
|
+
if (_typeof(res) !== "object") return res;
|
|
5472
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5473
|
+
}
|
|
5474
|
+
return (hint === "string" ? String : Number)(input);
|
|
5475
|
+
}
|
|
5476
|
+
(module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5477
|
+
})(toPrimitive);
|
|
5478
|
+
getDefaultExportFromCjs(toPrimitive.exports);
|
|
5479
|
+
(function (module) {
|
|
5480
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5481
|
+
var toPrimitive$1 = toPrimitive.exports;
|
|
5482
|
+
function _toPropertyKey(arg) {
|
|
5483
|
+
var key = toPrimitive$1(arg, "string");
|
|
5484
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
5485
|
+
}
|
|
5486
|
+
(module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5487
|
+
})(toPropertyKey);
|
|
5488
|
+
getDefaultExportFromCjs(toPropertyKey.exports);
|
|
5489
|
+
(function (module) {
|
|
5490
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
5491
|
+
function _defineProperties(target, props) {
|
|
5492
|
+
for (var i = 0; i < props.length; i++) {
|
|
5493
|
+
var descriptor = props[i];
|
|
5494
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
5495
|
+
descriptor.configurable = true;
|
|
5496
|
+
if (("value" in descriptor)) descriptor.writable = true;
|
|
5497
|
+
Object.defineProperty(target, toPropertyKey$1(descriptor.key), descriptor);
|
|
5498
5498
|
}
|
|
5499
|
-
|
|
5500
|
-
|
|
5499
|
+
}
|
|
5500
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
5501
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
5502
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
5503
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
5504
|
+
writable: false
|
|
5505
|
+
});
|
|
5506
|
+
return Constructor;
|
|
5507
|
+
}
|
|
5508
|
+
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5509
|
+
})(createClass);
|
|
5510
|
+
getDefaultExportFromCjs(createClass.exports);
|
|
5511
|
+
var assertThisInitialized = {
|
|
5512
|
+
exports: {}
|
|
5513
|
+
};
|
|
5514
|
+
(function (module) {
|
|
5515
|
+
function _assertThisInitialized(self) {
|
|
5516
|
+
if (self === void 0) {
|
|
5517
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
5501
5518
|
}
|
|
5519
|
+
return self;
|
|
5502
5520
|
}
|
|
5503
|
-
|
|
5504
|
-
}
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
}
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5521
|
+
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5522
|
+
})(assertThisInitialized);
|
|
5523
|
+
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
5524
|
+
var inherits = {
|
|
5525
|
+
exports: {}
|
|
5526
|
+
};
|
|
5527
|
+
var setPrototypeOf = {
|
|
5528
|
+
exports: {}
|
|
5529
|
+
};
|
|
5530
|
+
(function (module) {
|
|
5531
|
+
function _setPrototypeOf(o, p) {
|
|
5532
|
+
(module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
5533
|
+
o.__proto__ = p;
|
|
5534
|
+
return o;
|
|
5535
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5536
|
+
return _setPrototypeOf(o, p);
|
|
5512
5537
|
}
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5538
|
+
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5539
|
+
})(setPrototypeOf);
|
|
5540
|
+
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
5541
|
+
(function (module) {
|
|
5542
|
+
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
5543
|
+
function _inherits(subClass, superClass) {
|
|
5544
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
5545
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
5516
5546
|
}
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5547
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
5548
|
+
constructor: {
|
|
5549
|
+
value: subClass,
|
|
5550
|
+
writable: true,
|
|
5551
|
+
configurable: true
|
|
5521
5552
|
}
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
}
|
|
5534
|
-
|
|
5535
|
-
var
|
|
5536
|
-
var
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5553
|
+
});
|
|
5554
|
+
Object.defineProperty(subClass, "prototype", {
|
|
5555
|
+
writable: false
|
|
5556
|
+
});
|
|
5557
|
+
if (superClass) setPrototypeOf$1(subClass, superClass);
|
|
5558
|
+
}
|
|
5559
|
+
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5560
|
+
})(inherits);
|
|
5561
|
+
getDefaultExportFromCjs(inherits.exports);
|
|
5562
|
+
var possibleConstructorReturn = {
|
|
5563
|
+
exports: {}
|
|
5564
|
+
};
|
|
5565
|
+
(function (module) {
|
|
5566
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5567
|
+
var assertThisInitialized$1 = assertThisInitialized.exports;
|
|
5568
|
+
function _possibleConstructorReturn(self, call) {
|
|
5569
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
5570
|
+
return call;
|
|
5571
|
+
} else if (call !== void 0) {
|
|
5572
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
5573
|
+
}
|
|
5574
|
+
return assertThisInitialized$1(self);
|
|
5575
|
+
}
|
|
5576
|
+
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5577
|
+
})(possibleConstructorReturn);
|
|
5578
|
+
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
5579
|
+
var getPrototypeOf = {
|
|
5580
|
+
exports: {}
|
|
5581
|
+
};
|
|
5582
|
+
(function (module) {
|
|
5583
|
+
function _getPrototypeOf(o) {
|
|
5584
|
+
(module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
5585
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
5586
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5587
|
+
return _getPrototypeOf(o);
|
|
5588
|
+
}
|
|
5589
|
+
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5590
|
+
})(getPrototypeOf);
|
|
5591
|
+
getDefaultExportFromCjs(getPrototypeOf.exports);
|
|
5592
|
+
var defineProperty = {
|
|
5593
|
+
exports: {}
|
|
5594
|
+
};
|
|
5595
|
+
(function (module) {
|
|
5596
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
5597
|
+
function _defineProperty(obj, key, value) {
|
|
5598
|
+
key = toPropertyKey$1(key);
|
|
5599
|
+
if ((key in obj)) {
|
|
5600
|
+
Object.defineProperty(obj, key, {
|
|
5601
|
+
value: value,
|
|
5602
|
+
enumerable: true,
|
|
5603
|
+
configurable: true,
|
|
5604
|
+
writable: true
|
|
5605
|
+
});
|
|
5606
|
+
} else {
|
|
5607
|
+
obj[key] = value;
|
|
5608
|
+
}
|
|
5609
|
+
return obj;
|
|
5610
|
+
}
|
|
5611
|
+
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5612
|
+
})(defineProperty);
|
|
5613
|
+
getDefaultExportFromCjs(defineProperty.exports);
|
|
5614
|
+
var toArray = {
|
|
5615
|
+
exports: {}
|
|
5616
|
+
};
|
|
5617
|
+
var arrayWithHoles = {
|
|
5618
|
+
exports: {}
|
|
5619
|
+
};
|
|
5620
|
+
(function (module) {
|
|
5621
|
+
function _arrayWithHoles(arr) {
|
|
5622
|
+
if (Array.isArray(arr)) return arr;
|
|
5623
|
+
}
|
|
5624
|
+
(module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5625
|
+
})(arrayWithHoles);
|
|
5626
|
+
getDefaultExportFromCjs(arrayWithHoles.exports);
|
|
5627
|
+
var iterableToArray$1 = {
|
|
5628
|
+
exports: {}
|
|
5629
|
+
};
|
|
5630
|
+
(function (module) {
|
|
5631
|
+
function _iterableToArray(iter) {
|
|
5632
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
5633
|
+
}
|
|
5634
|
+
(module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5635
|
+
})(iterableToArray$1);
|
|
5636
|
+
getDefaultExportFromCjs(iterableToArray$1.exports);
|
|
5637
|
+
var unsupportedIterableToArray$1 = {
|
|
5638
|
+
exports: {}
|
|
5639
|
+
};
|
|
5640
|
+
var arrayLikeToArray$1 = {
|
|
5641
|
+
exports: {}
|
|
5642
|
+
};
|
|
5643
|
+
(function (module) {
|
|
5644
|
+
function _arrayLikeToArray(arr, len) {
|
|
5645
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
5646
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
5647
|
+
return arr2;
|
|
5648
|
+
}
|
|
5649
|
+
(module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5650
|
+
})(arrayLikeToArray$1);
|
|
5651
|
+
getDefaultExportFromCjs(arrayLikeToArray$1.exports);
|
|
5652
|
+
(function (module) {
|
|
5653
|
+
var arrayLikeToArray = arrayLikeToArray$1.exports;
|
|
5654
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
5655
|
+
if (!o) return;
|
|
5656
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
5657
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5658
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5659
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
5660
|
+
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray(o, minLen);
|
|
5661
|
+
}
|
|
5662
|
+
(module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5663
|
+
})(unsupportedIterableToArray$1);
|
|
5664
|
+
getDefaultExportFromCjs(unsupportedIterableToArray$1.exports);
|
|
5665
|
+
var nonIterableRest = {
|
|
5666
|
+
exports: {}
|
|
5667
|
+
};
|
|
5668
|
+
(function (module) {
|
|
5669
|
+
function _nonIterableRest() {
|
|
5670
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5671
|
+
}
|
|
5672
|
+
(module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5673
|
+
})(nonIterableRest);
|
|
5674
|
+
getDefaultExportFromCjs(nonIterableRest.exports);
|
|
5675
|
+
(function (module) {
|
|
5676
|
+
var arrayWithHoles$1 = arrayWithHoles.exports;
|
|
5677
|
+
var iterableToArray = iterableToArray$1.exports;
|
|
5678
|
+
var unsupportedIterableToArray = unsupportedIterableToArray$1.exports;
|
|
5679
|
+
var nonIterableRest$1 = nonIterableRest.exports;
|
|
5680
|
+
function _toArray(arr) {
|
|
5681
|
+
return arrayWithHoles$1(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest$1();
|
|
5682
|
+
}
|
|
5683
|
+
(module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5684
|
+
})(toArray);
|
|
5685
|
+
getDefaultExportFromCjs(toArray.exports);
|
|
5686
|
+
var _typeof = _typeof$1.exports;
|
|
5687
|
+
var _classCallCheck = classCallCheck.exports;
|
|
5688
|
+
var _createClass = createClass.exports;
|
|
5689
|
+
var _assertThisInitialized = assertThisInitialized.exports;
|
|
5690
|
+
var _inherits = inherits.exports;
|
|
5691
|
+
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
|
5692
|
+
var _getPrototypeOf = getPrototypeOf.exports;
|
|
5693
|
+
var _defineProperty = defineProperty.exports;
|
|
5694
|
+
var _toArray = toArray.exports;
|
|
5695
|
+
function _interopDefaultLegacy(e) {
|
|
5696
|
+
return e && typeof e === 'object' && ('default' in e) ? e : {
|
|
5697
|
+
'default': e
|
|
5698
|
+
};
|
|
5699
|
+
}
|
|
5700
|
+
var _typeof__default = _interopDefaultLegacy(_typeof);
|
|
5701
|
+
var _classCallCheck__default = _interopDefaultLegacy(_classCallCheck);
|
|
5702
|
+
var _createClass__default = _interopDefaultLegacy(_createClass);
|
|
5703
|
+
var _assertThisInitialized__default = _interopDefaultLegacy(_assertThisInitialized);
|
|
5704
|
+
var _inherits__default = _interopDefaultLegacy(_inherits);
|
|
5705
|
+
var _possibleConstructorReturn__default = _interopDefaultLegacy(_possibleConstructorReturn);
|
|
5706
|
+
var _getPrototypeOf__default = _interopDefaultLegacy(_getPrototypeOf);
|
|
5707
|
+
var _defineProperty__default = _interopDefaultLegacy(_defineProperty);
|
|
5708
|
+
var _toArray__default = _interopDefaultLegacy(_toArray);
|
|
5709
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
5710
|
+
var keys = Object.keys(object);
|
|
5711
|
+
if (Object.getOwnPropertySymbols) {
|
|
5712
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5713
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
5714
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
5715
|
+
})), keys.push.apply(keys, symbols));
|
|
5716
|
+
}
|
|
5717
|
+
return keys;
|
|
5718
|
+
}
|
|
5719
|
+
function _objectSpread$6(target) {
|
|
5720
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5721
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
5722
|
+
i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) {
|
|
5723
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
5724
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) {
|
|
5725
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5726
|
+
});
|
|
5727
|
+
}
|
|
5728
|
+
return target;
|
|
5729
|
+
}
|
|
5730
|
+
var consoleLogger = {
|
|
5731
|
+
type: 'logger',
|
|
5732
|
+
log: function log(args) {
|
|
5733
|
+
this.output('log', args);
|
|
5734
|
+
},
|
|
5735
|
+
warn: function warn(args) {
|
|
5736
|
+
this.output('warn', args);
|
|
5737
|
+
},
|
|
5738
|
+
error: function error(args) {
|
|
5739
|
+
this.output('error', args);
|
|
5740
|
+
},
|
|
5741
|
+
output: function output(type, args) {
|
|
5742
|
+
if (console && console[type]) console[type].apply(console, args);
|
|
5743
|
+
}
|
|
5744
|
+
};
|
|
5745
|
+
var Logger = (function () {
|
|
5746
|
+
function Logger(concreteLogger) {
|
|
5747
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5748
|
+
_classCallCheck__default["default"](this, Logger);
|
|
5749
|
+
this.init(concreteLogger, options);
|
|
5750
|
+
}
|
|
5751
|
+
_createClass__default["default"](Logger, [{
|
|
5752
|
+
key: "init",
|
|
5753
|
+
value: function init(concreteLogger) {
|
|
5754
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5755
|
+
this.prefix = options.prefix || 'i18next:';
|
|
5756
|
+
this.logger = concreteLogger || consoleLogger;
|
|
5757
|
+
this.options = options;
|
|
5758
|
+
this.debug = options.debug;
|
|
5759
|
+
}
|
|
5760
|
+
}, {
|
|
5761
|
+
key: "setDebug",
|
|
5762
|
+
value: function setDebug(bool) {
|
|
5763
|
+
this.debug = bool;
|
|
5764
|
+
}
|
|
5765
|
+
}, {
|
|
5766
|
+
key: "log",
|
|
5767
|
+
value: function log() {
|
|
5768
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5769
|
+
args[_key] = arguments[_key];
|
|
5770
|
+
}
|
|
5771
|
+
return this.forward(args, 'log', '', true);
|
|
5772
|
+
}
|
|
5773
|
+
}, {
|
|
5774
|
+
key: "warn",
|
|
5775
|
+
value: function warn() {
|
|
5776
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5777
|
+
args[_key2] = arguments[_key2];
|
|
5778
|
+
}
|
|
5779
|
+
return this.forward(args, 'warn', '', true);
|
|
5780
|
+
}
|
|
5781
|
+
}, {
|
|
5782
|
+
key: "error",
|
|
5783
|
+
value: function error() {
|
|
5784
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
5785
|
+
args[_key3] = arguments[_key3];
|
|
5786
|
+
}
|
|
5787
|
+
return this.forward(args, 'error', '');
|
|
5788
|
+
}
|
|
5789
|
+
}, {
|
|
5790
|
+
key: "deprecate",
|
|
5791
|
+
value: function deprecate() {
|
|
5792
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
5793
|
+
args[_key4] = arguments[_key4];
|
|
5794
|
+
}
|
|
5795
|
+
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
5796
|
+
}
|
|
5797
|
+
}, {
|
|
5798
|
+
key: "forward",
|
|
5799
|
+
value: function forward(args, lvl, prefix, debugOnly) {
|
|
5800
|
+
if (debugOnly && !this.debug) return null;
|
|
5801
|
+
if (typeof args[0] === 'string') args[0] = ("").concat(prefix).concat(this.prefix, " ").concat(args[0]);
|
|
5802
|
+
return this.logger[lvl](args);
|
|
5803
|
+
}
|
|
5804
|
+
}, {
|
|
5805
|
+
key: "create",
|
|
5806
|
+
value: function create(moduleName) {
|
|
5807
|
+
return new Logger(this.logger, _objectSpread$6(_objectSpread$6({}, {
|
|
5808
|
+
prefix: ("").concat(this.prefix, ":").concat(moduleName, ":")
|
|
5809
|
+
}), this.options));
|
|
5810
|
+
}
|
|
5811
|
+
}, {
|
|
5812
|
+
key: "clone",
|
|
5813
|
+
value: function clone(options) {
|
|
5814
|
+
options = options || this.options;
|
|
5815
|
+
options.prefix = options.prefix || this.prefix;
|
|
5816
|
+
return new Logger(this.logger, options);
|
|
5817
|
+
}
|
|
5818
|
+
}]);
|
|
5819
|
+
return Logger;
|
|
5820
|
+
})();
|
|
5821
|
+
var baseLogger = new Logger();
|
|
5822
|
+
var EventEmitter = (function () {
|
|
5823
|
+
function EventEmitter() {
|
|
5824
|
+
_classCallCheck__default["default"](this, EventEmitter);
|
|
5825
|
+
this.observers = {};
|
|
5826
|
+
}
|
|
5827
|
+
_createClass__default["default"](EventEmitter, [{
|
|
5828
|
+
key: "on",
|
|
5829
|
+
value: function on(events, listener) {
|
|
5830
|
+
var _this = this;
|
|
5831
|
+
events.split(' ').forEach(function (event) {
|
|
5832
|
+
_this.observers[event] = _this.observers[event] || [];
|
|
5833
|
+
_this.observers[event].push(listener);
|
|
5834
|
+
});
|
|
5835
|
+
return this;
|
|
5836
|
+
}
|
|
5837
|
+
}, {
|
|
5838
|
+
key: "off",
|
|
5839
|
+
value: function off(event, listener) {
|
|
5840
|
+
if (!this.observers[event]) return;
|
|
5841
|
+
if (!listener) {
|
|
5842
|
+
delete this.observers[event];
|
|
5843
|
+
return;
|
|
5844
|
+
}
|
|
5845
|
+
this.observers[event] = this.observers[event].filter(function (l) {
|
|
5846
|
+
return l !== listener;
|
|
5847
|
+
});
|
|
5848
|
+
}
|
|
5849
|
+
}, {
|
|
5850
|
+
key: "emit",
|
|
5851
|
+
value: function emit(event) {
|
|
5852
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5853
|
+
args[_key - 1] = arguments[_key];
|
|
5854
|
+
}
|
|
5855
|
+
if (this.observers[event]) {
|
|
5856
|
+
var cloned = [].concat(this.observers[event]);
|
|
5857
|
+
cloned.forEach(function (observer) {
|
|
5858
|
+
observer.apply(void 0, args);
|
|
5859
|
+
});
|
|
5860
|
+
}
|
|
5861
|
+
if (this.observers['*']) {
|
|
5862
|
+
var _cloned = [].concat(this.observers['*']);
|
|
5863
|
+
_cloned.forEach(function (observer) {
|
|
5864
|
+
observer.apply(observer, [event].concat(args));
|
|
5865
|
+
});
|
|
5866
|
+
}
|
|
5867
|
+
}
|
|
5868
|
+
}]);
|
|
5869
|
+
return EventEmitter;
|
|
5870
|
+
})();
|
|
5871
|
+
function defer() {
|
|
5872
|
+
var res;
|
|
5873
|
+
var rej;
|
|
5874
|
+
var promise = new Promise(function (resolve, reject) {
|
|
5875
|
+
res = resolve;
|
|
5876
|
+
rej = reject;
|
|
5877
|
+
});
|
|
5878
|
+
promise.resolve = res;
|
|
5879
|
+
promise.reject = rej;
|
|
5880
|
+
return promise;
|
|
5881
|
+
}
|
|
5882
|
+
function makeString(object) {
|
|
5883
|
+
if (object == null) return '';
|
|
5884
|
+
return '' + object;
|
|
5885
|
+
}
|
|
5886
|
+
function copy(a, s, t) {
|
|
5887
|
+
a.forEach(function (m) {
|
|
5888
|
+
if (s[m]) t[m] = s[m];
|
|
5889
|
+
});
|
|
5890
|
+
}
|
|
5891
|
+
function getLastOfPath(object, path, Empty) {
|
|
5892
|
+
function cleanKey(key) {
|
|
5893
|
+
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
5894
|
+
}
|
|
5895
|
+
function canNotTraverseDeeper() {
|
|
5896
|
+
return !object || typeof object === 'string';
|
|
5897
|
+
}
|
|
5898
|
+
var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
5899
|
+
while (stack.length > 1) {
|
|
5900
|
+
if (canNotTraverseDeeper()) return {};
|
|
5901
|
+
var key = cleanKey(stack.shift());
|
|
5902
|
+
if (!object[key] && Empty) object[key] = new Empty();
|
|
5903
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
5904
|
+
object = object[key];
|
|
5905
|
+
} else {
|
|
5906
|
+
object = {};
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5909
|
+
if (canNotTraverseDeeper()) return {};
|
|
5910
|
+
return {
|
|
5911
|
+
obj: object,
|
|
5912
|
+
k: cleanKey(stack.shift())
|
|
5913
|
+
};
|
|
5914
|
+
}
|
|
5915
|
+
function setPath(object, path, newValue) {
|
|
5916
|
+
var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
|
|
5917
|
+
obj[k] = newValue;
|
|
5918
|
+
}
|
|
5919
|
+
function pushPath(object, path, newValue, concat) {
|
|
5920
|
+
var _getLastOfPath2 = getLastOfPath(object, path, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k;
|
|
5921
|
+
obj[k] = obj[k] || [];
|
|
5922
|
+
if (concat) obj[k] = obj[k].concat(newValue);
|
|
5923
|
+
if (!concat) obj[k].push(newValue);
|
|
5924
|
+
}
|
|
5925
|
+
function getPath(object, path) {
|
|
5926
|
+
var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
|
|
5927
|
+
if (!obj) return undefined;
|
|
5928
|
+
return obj[k];
|
|
5929
|
+
}
|
|
5930
|
+
function getPathWithDefaults(data, defaultData, key) {
|
|
5931
|
+
var value = getPath(data, key);
|
|
5932
|
+
if (value !== undefined) {
|
|
5933
|
+
return value;
|
|
5934
|
+
}
|
|
5935
|
+
return getPath(defaultData, key);
|
|
5936
|
+
}
|
|
5937
|
+
function deepExtend(target, source, overwrite) {
|
|
5938
|
+
for (var prop in source) {
|
|
5939
|
+
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
5940
|
+
if ((prop in target)) {
|
|
5941
|
+
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
5942
|
+
if (overwrite) target[prop] = source[prop];
|
|
5943
|
+
} else {
|
|
5944
|
+
deepExtend(target[prop], source[prop], overwrite);
|
|
5945
|
+
}
|
|
5946
|
+
} else {
|
|
5947
|
+
target[prop] = source[prop];
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
}
|
|
5951
|
+
return target;
|
|
5952
|
+
}
|
|
5953
|
+
function regexEscape(str) {
|
|
5954
|
+
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
5955
|
+
}
|
|
5956
|
+
var _entityMap = {
|
|
5957
|
+
'&': '&',
|
|
5958
|
+
'<': '<',
|
|
5959
|
+
'>': '>',
|
|
5960
|
+
'"': '"',
|
|
5961
|
+
"'": ''',
|
|
5962
|
+
'/': '/'
|
|
5963
|
+
};
|
|
5964
|
+
function escape(data) {
|
|
5965
|
+
if (typeof data === 'string') {
|
|
5966
|
+
return data.replace(/[&<>"'\/]/g, function (s) {
|
|
5967
|
+
return _entityMap[s];
|
|
5968
|
+
});
|
|
5969
|
+
}
|
|
5970
|
+
return data;
|
|
5971
|
+
}
|
|
5972
|
+
var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
|
|
5973
|
+
var chars = [' ', ',', '?', '!', ';'];
|
|
5974
|
+
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
5975
|
+
nsSeparator = nsSeparator || '';
|
|
5976
|
+
keySeparator = keySeparator || '';
|
|
5977
|
+
var possibleChars = chars.filter(function (c) {
|
|
5978
|
+
return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
|
|
5979
|
+
});
|
|
5980
|
+
if (possibleChars.length === 0) return true;
|
|
5981
|
+
var r = new RegExp(("(").concat(possibleChars.map(function (c) {
|
|
5982
|
+
return c === '?' ? '\\?' : c;
|
|
5983
|
+
}).join('|'), ")"));
|
|
5984
|
+
var matched = !r.test(key);
|
|
5985
|
+
if (!matched) {
|
|
5986
|
+
var ki = key.indexOf(keySeparator);
|
|
5987
|
+
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
5988
|
+
matched = true;
|
|
5989
|
+
}
|
|
5990
|
+
}
|
|
5991
|
+
return matched;
|
|
5992
|
+
}
|
|
5993
|
+
function deepFind(obj, path) {
|
|
5994
|
+
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
5995
|
+
if (!obj) return undefined;
|
|
5996
|
+
if (obj[path]) return obj[path];
|
|
5997
|
+
var paths = path.split(keySeparator);
|
|
5998
|
+
var current = obj;
|
|
5999
|
+
for (var i = 0; i < paths.length; ++i) {
|
|
6000
|
+
if (!current) return undefined;
|
|
6001
|
+
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
6002
|
+
return undefined;
|
|
6003
|
+
}
|
|
6004
|
+
if (current[paths[i]] === undefined) {
|
|
6005
|
+
var j = 2;
|
|
6006
|
+
var p = paths.slice(i, i + j).join(keySeparator);
|
|
6007
|
+
var mix = current[p];
|
|
6008
|
+
while (mix === undefined && paths.length > i + j) {
|
|
6009
|
+
j++;
|
|
6010
|
+
p = paths.slice(i, i + j).join(keySeparator);
|
|
6011
|
+
mix = current[p];
|
|
6012
|
+
}
|
|
6013
|
+
if (mix === undefined) return undefined;
|
|
6014
|
+
if (mix === null) return null;
|
|
6015
|
+
if (path.endsWith(p)) {
|
|
6016
|
+
if (typeof mix === 'string') return mix;
|
|
6017
|
+
if (p && typeof mix[p] === 'string') return mix[p];
|
|
6018
|
+
}
|
|
6019
|
+
var joinedPath = paths.slice(i + j).join(keySeparator);
|
|
6020
|
+
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
6021
|
+
return undefined;
|
|
6022
|
+
}
|
|
6023
|
+
current = current[paths[i]];
|
|
6024
|
+
}
|
|
6025
|
+
return current;
|
|
6026
|
+
}
|
|
6027
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
6028
|
+
var keys = Object.keys(object);
|
|
6029
|
+
if (Object.getOwnPropertySymbols) {
|
|
6030
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6031
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6032
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
6033
|
+
})), keys.push.apply(keys, symbols));
|
|
6034
|
+
}
|
|
6035
|
+
return keys;
|
|
6036
|
+
}
|
|
6037
|
+
function _objectSpread$5(target) {
|
|
6038
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6039
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
6040
|
+
i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) {
|
|
6041
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
6042
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) {
|
|
6043
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6044
|
+
});
|
|
6045
|
+
}
|
|
6046
|
+
return target;
|
|
6047
|
+
}
|
|
6048
|
+
function _createSuper$3(Derived) {
|
|
6049
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
6050
|
+
return function _createSuperInternal() {
|
|
6051
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
6052
|
+
if (hasNativeReflectConstruct) {
|
|
6053
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
6054
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
6055
|
+
} else {
|
|
6056
|
+
result = Super.apply(this, arguments);
|
|
6057
|
+
}
|
|
6058
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
6059
|
+
};
|
|
6060
|
+
}
|
|
6061
|
+
function _isNativeReflectConstruct$3() {
|
|
6062
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
6063
|
+
if (Reflect.construct.sham) return false;
|
|
6064
|
+
if (typeof Proxy === "function") return true;
|
|
6065
|
+
try {
|
|
6066
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
6067
|
+
return true;
|
|
6068
|
+
} catch (e) {
|
|
6069
|
+
return false;
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
var ResourceStore = (function (_EventEmitter) {
|
|
6073
|
+
_inherits__default["default"](ResourceStore, _EventEmitter);
|
|
6074
|
+
var _super = _createSuper$3(ResourceStore);
|
|
6075
|
+
function ResourceStore(data) {
|
|
6076
|
+
var _this;
|
|
6077
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6078
|
+
ns: ['translation'],
|
|
6079
|
+
defaultNS: 'translation'
|
|
6080
|
+
};
|
|
6081
|
+
_classCallCheck__default["default"](this, ResourceStore);
|
|
6082
|
+
_this = _super.call(this);
|
|
6083
|
+
if (isIE10) {
|
|
6084
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
6085
|
+
}
|
|
6086
|
+
_this.data = data || ({});
|
|
6087
|
+
_this.options = options;
|
|
6088
|
+
if (_this.options.keySeparator === undefined) {
|
|
6089
|
+
_this.options.keySeparator = '.';
|
|
6090
|
+
}
|
|
6091
|
+
if (_this.options.ignoreJSONStructure === undefined) {
|
|
6092
|
+
_this.options.ignoreJSONStructure = true;
|
|
6093
|
+
}
|
|
6094
|
+
return _this;
|
|
6095
|
+
}
|
|
6096
|
+
_createClass__default["default"](ResourceStore, [{
|
|
6097
|
+
key: "addNamespaces",
|
|
6098
|
+
value: function addNamespaces(ns) {
|
|
6099
|
+
if (this.options.ns.indexOf(ns) < 0) {
|
|
6100
|
+
this.options.ns.push(ns);
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6103
|
+
}, {
|
|
6104
|
+
key: "removeNamespaces",
|
|
6105
|
+
value: function removeNamespaces(ns) {
|
|
6106
|
+
var index = this.options.ns.indexOf(ns);
|
|
6107
|
+
if (index > -1) {
|
|
6108
|
+
this.options.ns.splice(index, 1);
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
}, {
|
|
6112
|
+
key: "getResource",
|
|
6113
|
+
value: function getResource(lng, ns, key) {
|
|
6114
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6115
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6116
|
+
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
6117
|
+
var path = [lng, ns];
|
|
6118
|
+
if (key && typeof key !== 'string') path = path.concat(key);
|
|
6119
|
+
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
6120
|
+
if (lng.indexOf('.') > -1) {
|
|
6121
|
+
path = lng.split('.');
|
|
6122
|
+
}
|
|
6123
|
+
var result = getPath(this.data, path);
|
|
6124
|
+
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
6125
|
+
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
6126
|
+
}
|
|
6127
|
+
}, {
|
|
6128
|
+
key: "addResource",
|
|
6129
|
+
value: function addResource(lng, ns, key, value) {
|
|
6130
|
+
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
6131
|
+
silent: false
|
|
6132
|
+
};
|
|
6133
|
+
var keySeparator = this.options.keySeparator;
|
|
6134
|
+
if (keySeparator === undefined) keySeparator = '.';
|
|
6135
|
+
var path = [lng, ns];
|
|
6136
|
+
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
6137
|
+
if (lng.indexOf('.') > -1) {
|
|
6138
|
+
path = lng.split('.');
|
|
6139
|
+
value = ns;
|
|
6140
|
+
ns = path[1];
|
|
6141
|
+
}
|
|
6142
|
+
this.addNamespaces(ns);
|
|
6143
|
+
setPath(this.data, path, value);
|
|
6144
|
+
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
6145
|
+
}
|
|
6146
|
+
}, {
|
|
6147
|
+
key: "addResources",
|
|
6148
|
+
value: function addResources(lng, ns, resources) {
|
|
6149
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
6150
|
+
silent: false
|
|
6151
|
+
};
|
|
6152
|
+
for (var m in resources) {
|
|
6153
|
+
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
6154
|
+
silent: true
|
|
6155
|
+
});
|
|
6156
|
+
}
|
|
6157
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
6158
|
+
}
|
|
6159
|
+
}, {
|
|
6160
|
+
key: "addResourceBundle",
|
|
6161
|
+
value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
6162
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
6163
|
+
silent: false
|
|
6164
|
+
};
|
|
6165
|
+
var path = [lng, ns];
|
|
6166
|
+
if (lng.indexOf('.') > -1) {
|
|
6167
|
+
path = lng.split('.');
|
|
6168
|
+
deep = resources;
|
|
6169
|
+
resources = ns;
|
|
6170
|
+
ns = path[1];
|
|
6171
|
+
}
|
|
6172
|
+
this.addNamespaces(ns);
|
|
6173
|
+
var pack = getPath(this.data, path) || ({});
|
|
6174
|
+
if (deep) {
|
|
6175
|
+
deepExtend(pack, resources, overwrite);
|
|
6176
|
+
} else {
|
|
6177
|
+
pack = _objectSpread$5(_objectSpread$5({}, pack), resources);
|
|
6178
|
+
}
|
|
6179
|
+
setPath(this.data, path, pack);
|
|
6180
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
6181
|
+
}
|
|
6182
|
+
}, {
|
|
6183
|
+
key: "removeResourceBundle",
|
|
6184
|
+
value: function removeResourceBundle(lng, ns) {
|
|
6185
|
+
if (this.hasResourceBundle(lng, ns)) {
|
|
6186
|
+
delete this.data[lng][ns];
|
|
6187
|
+
}
|
|
6188
|
+
this.removeNamespaces(ns);
|
|
6189
|
+
this.emit('removed', lng, ns);
|
|
6190
|
+
}
|
|
6191
|
+
}, {
|
|
6192
|
+
key: "hasResourceBundle",
|
|
6193
|
+
value: function hasResourceBundle(lng, ns) {
|
|
6194
|
+
return this.getResource(lng, ns) !== undefined;
|
|
6195
|
+
}
|
|
6196
|
+
}, {
|
|
6197
|
+
key: "getResourceBundle",
|
|
6198
|
+
value: function getResourceBundle(lng, ns) {
|
|
6199
|
+
if (!ns) ns = this.options.defaultNS;
|
|
6200
|
+
if (this.options.compatibilityAPI === 'v1') return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns));
|
|
6201
|
+
return this.getResource(lng, ns);
|
|
6202
|
+
}
|
|
6203
|
+
}, {
|
|
6204
|
+
key: "getDataByLanguage",
|
|
6205
|
+
value: function getDataByLanguage(lng) {
|
|
6206
|
+
return this.data[lng];
|
|
6207
|
+
}
|
|
6208
|
+
}, {
|
|
6209
|
+
key: "hasLanguageSomeTranslations",
|
|
6210
|
+
value: function hasLanguageSomeTranslations(lng) {
|
|
6211
|
+
var data = this.getDataByLanguage(lng);
|
|
6212
|
+
var n = data && Object.keys(data) || [];
|
|
6213
|
+
return !!n.find(function (v) {
|
|
6214
|
+
return data[v] && Object.keys(data[v]).length > 0;
|
|
6215
|
+
});
|
|
6216
|
+
}
|
|
6217
|
+
}, {
|
|
6218
|
+
key: "toJSON",
|
|
6219
|
+
value: function toJSON() {
|
|
6220
|
+
return this.data;
|
|
6221
|
+
}
|
|
6222
|
+
}]);
|
|
6223
|
+
return ResourceStore;
|
|
6224
|
+
})(EventEmitter);
|
|
6225
|
+
var postProcessor = {
|
|
6226
|
+
processors: {},
|
|
6227
|
+
addPostProcessor: function addPostProcessor(module) {
|
|
6228
|
+
this.processors[module.name] = module;
|
|
6229
|
+
},
|
|
6230
|
+
handle: function handle(processors, value, key, options, translator) {
|
|
6231
|
+
var _this = this;
|
|
6232
|
+
processors.forEach(function (processor) {
|
|
6233
|
+
if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
|
|
6234
|
+
});
|
|
6235
|
+
return value;
|
|
6236
|
+
}
|
|
6237
|
+
};
|
|
6238
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
6239
|
+
var keys = Object.keys(object);
|
|
6240
|
+
if (Object.getOwnPropertySymbols) {
|
|
6241
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6242
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6243
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
6244
|
+
})), keys.push.apply(keys, symbols));
|
|
6245
|
+
}
|
|
6246
|
+
return keys;
|
|
6247
|
+
}
|
|
6248
|
+
function _objectSpread$4(target) {
|
|
6249
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6250
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
6251
|
+
i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) {
|
|
6252
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
6253
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) {
|
|
6254
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6255
|
+
});
|
|
6256
|
+
}
|
|
6257
|
+
return target;
|
|
6258
|
+
}
|
|
6259
|
+
function _createSuper$2(Derived) {
|
|
6260
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
6261
|
+
return function _createSuperInternal() {
|
|
6262
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
6263
|
+
if (hasNativeReflectConstruct) {
|
|
6264
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
6265
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
6266
|
+
} else {
|
|
6267
|
+
result = Super.apply(this, arguments);
|
|
6268
|
+
}
|
|
6269
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
function _isNativeReflectConstruct$2() {
|
|
6273
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
6274
|
+
if (Reflect.construct.sham) return false;
|
|
6275
|
+
if (typeof Proxy === "function") return true;
|
|
6276
|
+
try {
|
|
6277
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
6278
|
+
return true;
|
|
6279
|
+
} catch (e) {
|
|
6280
|
+
return false;
|
|
6281
|
+
}
|
|
6282
|
+
}
|
|
6283
|
+
var checkedLoadedFor = {};
|
|
6284
|
+
var Translator$1 = (function (_EventEmitter) {
|
|
6285
|
+
_inherits__default["default"](Translator, _EventEmitter);
|
|
6286
|
+
var _super = _createSuper$2(Translator);
|
|
6287
|
+
function Translator(services) {
|
|
6288
|
+
var _this;
|
|
6289
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6290
|
+
_classCallCheck__default["default"](this, Translator);
|
|
6291
|
+
_this = _super.call(this);
|
|
6292
|
+
if (isIE10) {
|
|
6293
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
6294
|
+
}
|
|
6295
|
+
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized__default["default"](_this));
|
|
6296
|
+
_this.options = options;
|
|
6297
|
+
if (_this.options.keySeparator === undefined) {
|
|
6298
|
+
_this.options.keySeparator = '.';
|
|
6299
|
+
}
|
|
6300
|
+
_this.logger = baseLogger.create('translator');
|
|
6301
|
+
return _this;
|
|
6302
|
+
}
|
|
6303
|
+
_createClass__default["default"](Translator, [{
|
|
6304
|
+
key: "changeLanguage",
|
|
6305
|
+
value: function changeLanguage(lng) {
|
|
6306
|
+
if (lng) this.language = lng;
|
|
6307
|
+
}
|
|
6308
|
+
}, {
|
|
6309
|
+
key: "exists",
|
|
6310
|
+
value: function exists(key) {
|
|
6311
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6312
|
+
interpolation: {}
|
|
6313
|
+
};
|
|
6314
|
+
if (key === undefined || key === null) {
|
|
6315
|
+
return false;
|
|
6316
|
+
}
|
|
6317
|
+
var resolved = this.resolve(key, options);
|
|
6318
|
+
return resolved && resolved.res !== undefined;
|
|
6319
|
+
}
|
|
6320
|
+
}, {
|
|
6321
|
+
key: "extractFromKey",
|
|
6322
|
+
value: function extractFromKey(key, options) {
|
|
6323
|
+
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
6324
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
6325
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6326
|
+
var namespaces = options.ns || this.options.defaultNS || [];
|
|
6327
|
+
var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
6328
|
+
var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
6329
|
+
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
6330
|
+
var m = key.match(this.interpolator.nestingRegexp);
|
|
6331
|
+
if (m && m.length > 0) {
|
|
6332
|
+
return {
|
|
6333
|
+
key: key,
|
|
6334
|
+
namespaces: namespaces
|
|
6335
|
+
};
|
|
6336
|
+
}
|
|
6337
|
+
var parts = key.split(nsSeparator);
|
|
6338
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
6339
|
+
key = parts.join(keySeparator);
|
|
6340
|
+
}
|
|
6341
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
6342
|
+
return {
|
|
6343
|
+
key: key,
|
|
6344
|
+
namespaces: namespaces
|
|
6345
|
+
};
|
|
6346
|
+
}
|
|
6347
|
+
}, {
|
|
6348
|
+
key: "translate",
|
|
6349
|
+
value: function translate(keys, options, lastKey) {
|
|
6350
|
+
var _this2 = this;
|
|
6351
|
+
if (_typeof__default["default"](options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
6352
|
+
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
6353
|
+
}
|
|
6354
|
+
if (_typeof__default["default"](options) === 'object') options = _objectSpread$4({}, options);
|
|
6355
|
+
if (!options) options = {};
|
|
6356
|
+
if (keys === undefined || keys === null) return '';
|
|
6357
|
+
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
6358
|
+
var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
|
|
6359
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6360
|
+
var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces;
|
|
6361
|
+
var namespace = namespaces[namespaces.length - 1];
|
|
6362
|
+
var lng = options.lng || this.language;
|
|
6363
|
+
var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
6364
|
+
if (lng && lng.toLowerCase() === 'cimode') {
|
|
6365
|
+
if (appendNamespaceToCIMode) {
|
|
6366
|
+
var nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
6367
|
+
if (returnDetails) {
|
|
6368
|
+
return {
|
|
6369
|
+
res: ("").concat(namespace).concat(nsSeparator).concat(key),
|
|
6370
|
+
usedKey: key,
|
|
6371
|
+
exactUsedKey: key,
|
|
6372
|
+
usedLng: lng,
|
|
6373
|
+
usedNS: namespace
|
|
6374
|
+
};
|
|
6375
|
+
}
|
|
6376
|
+
return ("").concat(namespace).concat(nsSeparator).concat(key);
|
|
6377
|
+
}
|
|
6378
|
+
if (returnDetails) {
|
|
6379
|
+
return {
|
|
6380
|
+
res: key,
|
|
6381
|
+
usedKey: key,
|
|
6382
|
+
exactUsedKey: key,
|
|
6383
|
+
usedLng: lng,
|
|
6384
|
+
usedNS: namespace
|
|
6385
|
+
};
|
|
6386
|
+
}
|
|
6387
|
+
return key;
|
|
6388
|
+
}
|
|
6389
|
+
var resolved = this.resolve(keys, options);
|
|
6390
|
+
var res = resolved && resolved.res;
|
|
6391
|
+
var resUsedKey = resolved && resolved.usedKey || key;
|
|
6392
|
+
var resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
6393
|
+
var resType = Object.prototype.toString.apply(res);
|
|
6394
|
+
var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
6395
|
+
var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
6396
|
+
var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
6397
|
+
var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
6398
|
+
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
6399
|
+
if (!options.returnObjects && !this.options.returnObjects) {
|
|
6400
|
+
if (!this.options.returnedObjectHandler) {
|
|
6401
|
+
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
6402
|
+
}
|
|
6403
|
+
var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
6404
|
+
ns: namespaces
|
|
6405
|
+
})) : ("key '").concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
6406
|
+
if (returnDetails) {
|
|
6407
|
+
resolved.res = r;
|
|
6408
|
+
return resolved;
|
|
6409
|
+
}
|
|
6410
|
+
return r;
|
|
6411
|
+
}
|
|
6412
|
+
if (keySeparator) {
|
|
6413
|
+
var resTypeIsArray = resType === '[object Array]';
|
|
6414
|
+
var copy = resTypeIsArray ? [] : {};
|
|
6415
|
+
var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
6416
|
+
for (var m in res) {
|
|
6417
|
+
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
6418
|
+
var deepKey = ("").concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
6419
|
+
copy[m] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), {
|
|
6420
|
+
joinArrays: false,
|
|
6421
|
+
ns: namespaces
|
|
6422
|
+
}));
|
|
6423
|
+
if (copy[m] === deepKey) copy[m] = res[m];
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
res = copy;
|
|
6427
|
+
}
|
|
6428
|
+
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
6429
|
+
res = res.join(joinArrays);
|
|
6430
|
+
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
6431
|
+
} else {
|
|
6432
|
+
var usedDefault = false;
|
|
6433
|
+
var usedKey = false;
|
|
6434
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
6435
|
+
var hasDefaultValue = Translator.hasDefaultValue(options);
|
|
6436
|
+
var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
|
|
6437
|
+
var defaultValue = options[("defaultValue").concat(defaultValueSuffix)] || options.defaultValue;
|
|
6438
|
+
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
6439
|
+
usedDefault = true;
|
|
6440
|
+
res = defaultValue;
|
|
6441
|
+
}
|
|
6442
|
+
if (!this.isValidLookup(res)) {
|
|
6443
|
+
usedKey = true;
|
|
6444
|
+
res = key;
|
|
6445
|
+
}
|
|
6446
|
+
var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
6447
|
+
var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
6448
|
+
var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
6449
|
+
if (usedKey || usedDefault || updateMissing) {
|
|
6450
|
+
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
6451
|
+
if (keySeparator) {
|
|
6452
|
+
var fk = this.resolve(key, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
6453
|
+
keySeparator: false
|
|
6454
|
+
}));
|
|
6455
|
+
if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');
|
|
6456
|
+
}
|
|
6457
|
+
var lngs = [];
|
|
6458
|
+
var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
6459
|
+
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
6460
|
+
for (var i = 0; i < fallbackLngs.length; i++) {
|
|
6461
|
+
lngs.push(fallbackLngs[i]);
|
|
6462
|
+
}
|
|
6463
|
+
} else if (this.options.saveMissingTo === 'all') {
|
|
6464
|
+
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
6465
|
+
} else {
|
|
6466
|
+
lngs.push(options.lng || this.language);
|
|
6467
|
+
}
|
|
6468
|
+
var send = function send(l, k, specificDefaultValue) {
|
|
6469
|
+
var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
6470
|
+
if (_this2.options.missingKeyHandler) {
|
|
6471
|
+
_this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
6472
|
+
} else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
|
|
6473
|
+
_this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
6474
|
+
}
|
|
6475
|
+
_this2.emit('missingKey', l, namespace, k, res);
|
|
6476
|
+
};
|
|
6477
|
+
if (this.options.saveMissing) {
|
|
6478
|
+
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
6479
|
+
lngs.forEach(function (language) {
|
|
6480
|
+
_this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
|
|
6481
|
+
send([language], key + suffix, options[("defaultValue").concat(suffix)] || defaultValue);
|
|
6482
|
+
});
|
|
6483
|
+
});
|
|
6484
|
+
} else {
|
|
6485
|
+
send(lngs, key, defaultValue);
|
|
6486
|
+
}
|
|
6487
|
+
}
|
|
6488
|
+
}
|
|
6489
|
+
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
6490
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = ("").concat(namespace, ":").concat(key);
|
|
6491
|
+
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
6492
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
6493
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? ("").concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
|
|
6494
|
+
} else {
|
|
6495
|
+
res = this.options.parseMissingKeyHandler(res);
|
|
6496
|
+
}
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
if (returnDetails) {
|
|
6500
|
+
resolved.res = res;
|
|
6501
|
+
return resolved;
|
|
6502
|
+
}
|
|
6503
|
+
return res;
|
|
6504
|
+
}
|
|
6505
|
+
}, {
|
|
6506
|
+
key: "extendTranslation",
|
|
6507
|
+
value: function extendTranslation(res, key, options, resolved, lastKey) {
|
|
6508
|
+
var _this3 = this;
|
|
6509
|
+
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
6510
|
+
res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
6511
|
+
resolved: resolved
|
|
6512
|
+
});
|
|
6513
|
+
} else if (!options.skipInterpolation) {
|
|
6514
|
+
if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), {
|
|
6515
|
+
interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation)
|
|
6516
|
+
}));
|
|
6517
|
+
var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
6518
|
+
var nestBef;
|
|
6519
|
+
if (skipOnVariables) {
|
|
6520
|
+
var nb = res.match(this.interpolator.nestingRegexp);
|
|
6521
|
+
nestBef = nb && nb.length;
|
|
6522
|
+
}
|
|
6523
|
+
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
6524
|
+
if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data);
|
|
6525
|
+
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
6526
|
+
if (skipOnVariables) {
|
|
6527
|
+
var na = res.match(this.interpolator.nestingRegexp);
|
|
6528
|
+
var nestAft = na && na.length;
|
|
6529
|
+
if (nestBef < nestAft) options.nest = false;
|
|
6530
|
+
}
|
|
6531
|
+
if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;
|
|
6532
|
+
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
6533
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6534
|
+
args[_key] = arguments[_key];
|
|
6535
|
+
}
|
|
6536
|
+
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
6537
|
+
_this3.logger.warn(("It seems you are nesting recursively key: ").concat(args[0], " in key: ").concat(key[0]));
|
|
6538
|
+
return null;
|
|
6539
|
+
}
|
|
6540
|
+
return _this3.translate.apply(_this3, args.concat([key]));
|
|
6541
|
+
}, options);
|
|
6542
|
+
if (options.interpolation) this.interpolator.reset();
|
|
6543
|
+
}
|
|
6544
|
+
var postProcess = options.postProcess || this.options.postProcess;
|
|
6545
|
+
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
6546
|
+
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
6547
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4({
|
|
6548
|
+
i18nResolved: resolved
|
|
6549
|
+
}, options) : options, this);
|
|
6550
|
+
}
|
|
6551
|
+
return res;
|
|
6552
|
+
}
|
|
6553
|
+
}, {
|
|
6554
|
+
key: "resolve",
|
|
6555
|
+
value: function resolve(keys) {
|
|
6556
|
+
var _this4 = this;
|
|
6557
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6558
|
+
var found;
|
|
6559
|
+
var usedKey;
|
|
6560
|
+
var exactUsedKey;
|
|
6561
|
+
var usedLng;
|
|
6562
|
+
var usedNS;
|
|
6563
|
+
if (typeof keys === 'string') keys = [keys];
|
|
6564
|
+
keys.forEach(function (k) {
|
|
6565
|
+
if (_this4.isValidLookup(found)) return;
|
|
6566
|
+
var extracted = _this4.extractFromKey(k, options);
|
|
6567
|
+
var key = extracted.key;
|
|
6568
|
+
usedKey = key;
|
|
6569
|
+
var namespaces = extracted.namespaces;
|
|
6570
|
+
if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
|
|
6571
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
6572
|
+
var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
|
|
6573
|
+
var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
6574
|
+
var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
|
|
6575
|
+
namespaces.forEach(function (ns) {
|
|
6576
|
+
if (_this4.isValidLookup(found)) return;
|
|
6577
|
+
usedNS = ns;
|
|
6578
|
+
if (!checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
|
|
6579
|
+
checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] = true;
|
|
6580
|
+
_this4.logger.warn(("key \"").concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(usedNS, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
|
|
6581
|
+
}
|
|
6582
|
+
codes.forEach(function (code) {
|
|
6583
|
+
if (_this4.isValidLookup(found)) return;
|
|
6584
|
+
usedLng = code;
|
|
6585
|
+
var finalKeys = [key];
|
|
6586
|
+
if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
|
|
6587
|
+
_this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
6588
|
+
} else {
|
|
6589
|
+
var pluralSuffix;
|
|
6590
|
+
if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
|
|
6591
|
+
var zeroSuffix = ("").concat(_this4.options.pluralSeparator, "zero");
|
|
6592
|
+
if (needsPluralHandling) {
|
|
6593
|
+
finalKeys.push(key + pluralSuffix);
|
|
6594
|
+
if (needsZeroSuffixLookup) {
|
|
6595
|
+
finalKeys.push(key + zeroSuffix);
|
|
6596
|
+
}
|
|
6597
|
+
}
|
|
6598
|
+
if (needsContextHandling) {
|
|
6599
|
+
var contextKey = ("").concat(key).concat(_this4.options.contextSeparator).concat(options.context);
|
|
6600
|
+
finalKeys.push(contextKey);
|
|
6601
|
+
if (needsPluralHandling) {
|
|
6602
|
+
finalKeys.push(contextKey + pluralSuffix);
|
|
6603
|
+
if (needsZeroSuffixLookup) {
|
|
6604
|
+
finalKeys.push(contextKey + zeroSuffix);
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6609
|
+
var possibleKey;
|
|
6610
|
+
while (possibleKey = finalKeys.pop()) {
|
|
6611
|
+
if (!_this4.isValidLookup(found)) {
|
|
6612
|
+
exactUsedKey = possibleKey;
|
|
6613
|
+
found = _this4.getResource(code, ns, possibleKey, options);
|
|
6614
|
+
}
|
|
6615
|
+
}
|
|
6616
|
+
});
|
|
6617
|
+
});
|
|
6618
|
+
});
|
|
6619
|
+
return {
|
|
6620
|
+
res: found,
|
|
6621
|
+
usedKey: usedKey,
|
|
6622
|
+
exactUsedKey: exactUsedKey,
|
|
6623
|
+
usedLng: usedLng,
|
|
6624
|
+
usedNS: usedNS
|
|
6625
|
+
};
|
|
6626
|
+
}
|
|
6627
|
+
}, {
|
|
6628
|
+
key: "isValidLookup",
|
|
6629
|
+
value: function isValidLookup(res) {
|
|
6630
|
+
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
6631
|
+
}
|
|
6632
|
+
}, {
|
|
6633
|
+
key: "getResource",
|
|
6634
|
+
value: function getResource(code, ns, key) {
|
|
6635
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6636
|
+
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
6637
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
6638
|
+
}
|
|
6639
|
+
}], [{
|
|
6640
|
+
key: "hasDefaultValue",
|
|
6641
|
+
value: function hasDefaultValue(options) {
|
|
6642
|
+
var prefix = 'defaultValue';
|
|
6643
|
+
for (var option in options) {
|
|
6644
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
6645
|
+
return true;
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
return false;
|
|
6649
|
+
}
|
|
6650
|
+
}]);
|
|
6651
|
+
return Translator;
|
|
6652
|
+
})(EventEmitter);
|
|
6653
|
+
function capitalize$1(string) {
|
|
6654
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
6655
|
+
}
|
|
6656
|
+
var LanguageUtil = (function () {
|
|
6657
|
+
function LanguageUtil(options) {
|
|
6658
|
+
_classCallCheck__default["default"](this, LanguageUtil);
|
|
6659
|
+
this.options = options;
|
|
6660
|
+
this.supportedLngs = this.options.supportedLngs || false;
|
|
6661
|
+
this.logger = baseLogger.create('languageUtils');
|
|
6662
|
+
}
|
|
6663
|
+
_createClass__default["default"](LanguageUtil, [{
|
|
6664
|
+
key: "getScriptPartFromCode",
|
|
6665
|
+
value: function getScriptPartFromCode(code) {
|
|
6666
|
+
if (!code || code.indexOf('-') < 0) return null;
|
|
6667
|
+
var p = code.split('-');
|
|
6668
|
+
if (p.length === 2) return null;
|
|
6669
|
+
p.pop();
|
|
6670
|
+
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
6671
|
+
return this.formatLanguageCode(p.join('-'));
|
|
6672
|
+
}
|
|
6673
|
+
}, {
|
|
6674
|
+
key: "getLanguagePartFromCode",
|
|
6675
|
+
value: function getLanguagePartFromCode(code) {
|
|
6676
|
+
if (!code || code.indexOf('-') < 0) return code;
|
|
6677
|
+
var p = code.split('-');
|
|
6678
|
+
return this.formatLanguageCode(p[0]);
|
|
6679
|
+
}
|
|
6680
|
+
}, {
|
|
6681
|
+
key: "formatLanguageCode",
|
|
6682
|
+
value: function formatLanguageCode(code) {
|
|
6683
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
6684
|
+
var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
6685
|
+
var p = code.split('-');
|
|
6686
|
+
if (this.options.lowerCaseLng) {
|
|
6687
|
+
p = p.map(function (part) {
|
|
6688
|
+
return part.toLowerCase();
|
|
6689
|
+
});
|
|
6690
|
+
} else if (p.length === 2) {
|
|
6691
|
+
p[0] = p[0].toLowerCase();
|
|
6692
|
+
p[1] = p[1].toUpperCase();
|
|
6693
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
|
|
6694
|
+
} else if (p.length === 3) {
|
|
6695
|
+
p[0] = p[0].toLowerCase();
|
|
6696
|
+
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
6697
|
+
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
6698
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
|
|
6699
|
+
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize$1(p[2].toLowerCase());
|
|
6700
|
+
}
|
|
6701
|
+
return p.join('-');
|
|
6702
|
+
}
|
|
6703
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
6704
|
+
}
|
|
6705
|
+
}, {
|
|
6706
|
+
key: "isSupportedCode",
|
|
6707
|
+
value: function isSupportedCode(code) {
|
|
6708
|
+
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
6709
|
+
code = this.getLanguagePartFromCode(code);
|
|
6710
|
+
}
|
|
6711
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
6712
|
+
}
|
|
6713
|
+
}, {
|
|
6714
|
+
key: "getBestMatchFromCodes",
|
|
6715
|
+
value: function getBestMatchFromCodes(codes) {
|
|
6716
|
+
var _this = this;
|
|
6717
|
+
if (!codes) return null;
|
|
6718
|
+
var found;
|
|
6719
|
+
codes.forEach(function (code) {
|
|
6720
|
+
if (found) return;
|
|
6721
|
+
var cleanedLng = _this.formatLanguageCode(code);
|
|
6722
|
+
if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
6723
|
+
});
|
|
6724
|
+
if (!found && this.options.supportedLngs) {
|
|
6725
|
+
codes.forEach(function (code) {
|
|
6726
|
+
if (found) return;
|
|
6727
|
+
var lngOnly = _this.getLanguagePartFromCode(code);
|
|
6728
|
+
if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
6729
|
+
found = _this.options.supportedLngs.find(function (supportedLng) {
|
|
6730
|
+
if (supportedLng === lngOnly) return supportedLng;
|
|
6731
|
+
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
|
|
6732
|
+
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
6733
|
+
});
|
|
6734
|
+
});
|
|
6735
|
+
}
|
|
6736
|
+
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
6737
|
+
return found;
|
|
6738
|
+
}
|
|
6739
|
+
}, {
|
|
6740
|
+
key: "getFallbackCodes",
|
|
6741
|
+
value: function getFallbackCodes(fallbacks, code) {
|
|
6742
|
+
if (!fallbacks) return [];
|
|
6743
|
+
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
6744
|
+
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
6745
|
+
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
6746
|
+
if (!code) return fallbacks["default"] || [];
|
|
6747
|
+
var found = fallbacks[code];
|
|
6748
|
+
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
6749
|
+
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
6750
|
+
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
6751
|
+
if (!found) found = fallbacks["default"];
|
|
6752
|
+
return found || [];
|
|
6753
|
+
}
|
|
6754
|
+
}, {
|
|
6755
|
+
key: "toResolveHierarchy",
|
|
6756
|
+
value: function toResolveHierarchy(code, fallbackCode) {
|
|
6757
|
+
var _this2 = this;
|
|
6758
|
+
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
6759
|
+
var codes = [];
|
|
6760
|
+
var addCode = function addCode(c) {
|
|
6761
|
+
if (!c) return;
|
|
6762
|
+
if (_this2.isSupportedCode(c)) {
|
|
6763
|
+
codes.push(c);
|
|
6764
|
+
} else {
|
|
6765
|
+
_this2.logger.warn(("rejecting language code not found in supportedLngs: ").concat(c));
|
|
6766
|
+
}
|
|
6767
|
+
};
|
|
6768
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
6769
|
+
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
6770
|
+
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
6771
|
+
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
6772
|
+
} else if (typeof code === 'string') {
|
|
6773
|
+
addCode(this.formatLanguageCode(code));
|
|
6774
|
+
}
|
|
6775
|
+
fallbackCodes.forEach(function (fc) {
|
|
6776
|
+
if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
|
|
6777
|
+
});
|
|
6778
|
+
return codes;
|
|
6779
|
+
}
|
|
6780
|
+
}]);
|
|
6781
|
+
return LanguageUtil;
|
|
6782
|
+
})();
|
|
6783
|
+
var sets = [{
|
|
6784
|
+
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
6785
|
+
nr: [1, 2],
|
|
6786
|
+
fc: 1
|
|
6787
|
+
}, {
|
|
6788
|
+
lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kk', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],
|
|
6789
|
+
nr: [1, 2],
|
|
6790
|
+
fc: 2
|
|
6791
|
+
}, {
|
|
6792
|
+
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
6793
|
+
nr: [1],
|
|
6794
|
+
fc: 3
|
|
6795
|
+
}, {
|
|
6796
|
+
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
6797
|
+
nr: [1, 2, 5],
|
|
6798
|
+
fc: 4
|
|
6799
|
+
}, {
|
|
6800
|
+
lngs: ['ar'],
|
|
6801
|
+
nr: [0, 1, 2, 3, 11, 100],
|
|
6802
|
+
fc: 5
|
|
6803
|
+
}, {
|
|
6804
|
+
lngs: ['cs', 'sk'],
|
|
6805
|
+
nr: [1, 2, 5],
|
|
6806
|
+
fc: 6
|
|
6807
|
+
}, {
|
|
6808
|
+
lngs: ['csb', 'pl'],
|
|
6809
|
+
nr: [1, 2, 5],
|
|
6810
|
+
fc: 7
|
|
6811
|
+
}, {
|
|
6812
|
+
lngs: ['cy'],
|
|
6813
|
+
nr: [1, 2, 3, 8],
|
|
6814
|
+
fc: 8
|
|
6815
|
+
}, {
|
|
6816
|
+
lngs: ['fr'],
|
|
6817
|
+
nr: [1, 2],
|
|
6818
|
+
fc: 9
|
|
6819
|
+
}, {
|
|
6820
|
+
lngs: ['ga'],
|
|
6821
|
+
nr: [1, 2, 3, 7, 11],
|
|
6822
|
+
fc: 10
|
|
6823
|
+
}, {
|
|
6824
|
+
lngs: ['gd'],
|
|
6825
|
+
nr: [1, 2, 3, 20],
|
|
6826
|
+
fc: 11
|
|
6827
|
+
}, {
|
|
6828
|
+
lngs: ['is'],
|
|
6829
|
+
nr: [1, 2],
|
|
6830
|
+
fc: 12
|
|
6831
|
+
}, {
|
|
6832
|
+
lngs: ['jv'],
|
|
6833
|
+
nr: [0, 1],
|
|
6834
|
+
fc: 13
|
|
6835
|
+
}, {
|
|
6836
|
+
lngs: ['kw'],
|
|
6837
|
+
nr: [1, 2, 3, 4],
|
|
6838
|
+
fc: 14
|
|
6839
|
+
}, {
|
|
6840
|
+
lngs: ['lt'],
|
|
6841
|
+
nr: [1, 2, 10],
|
|
6842
|
+
fc: 15
|
|
6843
|
+
}, {
|
|
6844
|
+
lngs: ['lv'],
|
|
6845
|
+
nr: [1, 2, 0],
|
|
6846
|
+
fc: 16
|
|
6847
|
+
}, {
|
|
6848
|
+
lngs: ['mk'],
|
|
6849
|
+
nr: [1, 2],
|
|
6850
|
+
fc: 17
|
|
6851
|
+
}, {
|
|
6852
|
+
lngs: ['mnk'],
|
|
6853
|
+
nr: [0, 1, 2],
|
|
6854
|
+
fc: 18
|
|
6855
|
+
}, {
|
|
6856
|
+
lngs: ['mt'],
|
|
6857
|
+
nr: [1, 2, 11, 20],
|
|
6858
|
+
fc: 19
|
|
6859
|
+
}, {
|
|
6860
|
+
lngs: ['or'],
|
|
6861
|
+
nr: [2, 1],
|
|
6862
|
+
fc: 2
|
|
6863
|
+
}, {
|
|
6864
|
+
lngs: ['ro'],
|
|
6865
|
+
nr: [1, 2, 20],
|
|
6866
|
+
fc: 20
|
|
6867
|
+
}, {
|
|
6868
|
+
lngs: ['sl'],
|
|
6869
|
+
nr: [5, 1, 2, 3],
|
|
6870
|
+
fc: 21
|
|
6871
|
+
}, {
|
|
6872
|
+
lngs: ['he', 'iw'],
|
|
6873
|
+
nr: [1, 2, 20, 21],
|
|
6874
|
+
fc: 22
|
|
6875
|
+
}];
|
|
6876
|
+
var _rulesPluralsTypes = {
|
|
6877
|
+
1: function _(n) {
|
|
6878
|
+
return Number(n > 1);
|
|
6879
|
+
},
|
|
6880
|
+
2: function _(n) {
|
|
6881
|
+
return Number(n != 1);
|
|
6882
|
+
},
|
|
6883
|
+
3: function _(n) {
|
|
6884
|
+
return 0;
|
|
6885
|
+
},
|
|
6886
|
+
4: function _(n) {
|
|
6887
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6888
|
+
},
|
|
6889
|
+
5: function _(n) {
|
|
6890
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
6891
|
+
},
|
|
6892
|
+
6: function _(n) {
|
|
6893
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
6894
|
+
},
|
|
6895
|
+
7: function _(n) {
|
|
6896
|
+
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6897
|
+
},
|
|
6898
|
+
8: function _(n) {
|
|
6899
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
6900
|
+
},
|
|
6901
|
+
9: function _(n) {
|
|
6902
|
+
return Number(n >= 2);
|
|
6903
|
+
},
|
|
6904
|
+
10: function _(n) {
|
|
6905
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
6906
|
+
},
|
|
6907
|
+
11: function _(n) {
|
|
6908
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
6909
|
+
},
|
|
6910
|
+
12: function _(n) {
|
|
6911
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
6912
|
+
},
|
|
6913
|
+
13: function _(n) {
|
|
6914
|
+
return Number(n !== 0);
|
|
6915
|
+
},
|
|
6916
|
+
14: function _(n) {
|
|
6917
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
6918
|
+
},
|
|
6919
|
+
15: function _(n) {
|
|
6920
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6921
|
+
},
|
|
6922
|
+
16: function _(n) {
|
|
6923
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
6924
|
+
},
|
|
6925
|
+
17: function _(n) {
|
|
6926
|
+
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
6927
|
+
},
|
|
6928
|
+
18: function _(n) {
|
|
6929
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
6930
|
+
},
|
|
6931
|
+
19: function _(n) {
|
|
6932
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
6933
|
+
},
|
|
6934
|
+
20: function _(n) {
|
|
6935
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
6936
|
+
},
|
|
6937
|
+
21: function _(n) {
|
|
6938
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
6939
|
+
},
|
|
6940
|
+
22: function _(n) {
|
|
6941
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
6942
|
+
}
|
|
6943
|
+
};
|
|
6944
|
+
var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
|
|
6945
|
+
var suffixesOrder = {
|
|
6946
|
+
zero: 0,
|
|
6947
|
+
one: 1,
|
|
6948
|
+
two: 2,
|
|
6949
|
+
few: 3,
|
|
6950
|
+
many: 4,
|
|
6951
|
+
other: 5
|
|
6952
|
+
};
|
|
6953
|
+
function createRules() {
|
|
6954
|
+
var rules = {};
|
|
6955
|
+
sets.forEach(function (set) {
|
|
6956
|
+
set.lngs.forEach(function (l) {
|
|
6957
|
+
rules[l] = {
|
|
6958
|
+
numbers: set.nr,
|
|
6959
|
+
plurals: _rulesPluralsTypes[set.fc]
|
|
6960
|
+
};
|
|
6961
|
+
});
|
|
6962
|
+
});
|
|
6963
|
+
return rules;
|
|
6964
|
+
}
|
|
6965
|
+
var PluralResolver = (function () {
|
|
6966
|
+
function PluralResolver(languageUtils) {
|
|
6967
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6968
|
+
_classCallCheck__default["default"](this, PluralResolver);
|
|
6969
|
+
this.languageUtils = languageUtils;
|
|
6970
|
+
this.options = options;
|
|
6971
|
+
this.logger = baseLogger.create('pluralResolver');
|
|
6972
|
+
if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
|
|
6973
|
+
this.options.compatibilityJSON = 'v3';
|
|
6974
|
+
this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');
|
|
6975
|
+
}
|
|
6976
|
+
this.rules = createRules();
|
|
6977
|
+
}
|
|
6978
|
+
_createClass__default["default"](PluralResolver, [{
|
|
6979
|
+
key: "addRule",
|
|
6980
|
+
value: function addRule(lng, obj) {
|
|
6981
|
+
this.rules[lng] = obj;
|
|
6982
|
+
}
|
|
6983
|
+
}, {
|
|
6984
|
+
key: "getRule",
|
|
6985
|
+
value: function getRule(code) {
|
|
6986
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6987
|
+
if (this.shouldUseIntlApi()) {
|
|
6988
|
+
try {
|
|
6989
|
+
return new Intl.PluralRules(code, {
|
|
6990
|
+
type: options.ordinal ? 'ordinal' : 'cardinal'
|
|
6991
|
+
});
|
|
6992
|
+
} catch (_unused) {
|
|
6993
|
+
return;
|
|
6994
|
+
}
|
|
6995
|
+
}
|
|
6996
|
+
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
6997
|
+
}
|
|
6998
|
+
}, {
|
|
6999
|
+
key: "needsPlural",
|
|
7000
|
+
value: function needsPlural(code) {
|
|
7001
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7002
|
+
var rule = this.getRule(code, options);
|
|
7003
|
+
if (this.shouldUseIntlApi()) {
|
|
7004
|
+
return rule && rule.resolvedOptions().pluralCategories.length > 1;
|
|
7005
|
+
}
|
|
7006
|
+
return rule && rule.numbers.length > 1;
|
|
7007
|
+
}
|
|
7008
|
+
}, {
|
|
7009
|
+
key: "getPluralFormsOfKey",
|
|
7010
|
+
value: function getPluralFormsOfKey(code, key) {
|
|
7011
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7012
|
+
return this.getSuffixes(code, options).map(function (suffix) {
|
|
7013
|
+
return ("").concat(key).concat(suffix);
|
|
7014
|
+
});
|
|
7015
|
+
}
|
|
7016
|
+
}, {
|
|
7017
|
+
key: "getSuffixes",
|
|
7018
|
+
value: function getSuffixes(code) {
|
|
7019
|
+
var _this = this;
|
|
7020
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7021
|
+
var rule = this.getRule(code, options);
|
|
7022
|
+
if (!rule) {
|
|
7023
|
+
return [];
|
|
7024
|
+
}
|
|
7025
|
+
if (this.shouldUseIntlApi()) {
|
|
7026
|
+
return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
|
|
7027
|
+
return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
|
|
7028
|
+
}).map(function (pluralCategory) {
|
|
7029
|
+
return ("").concat(_this.options.prepend).concat(pluralCategory);
|
|
7030
|
+
});
|
|
7031
|
+
}
|
|
7032
|
+
return rule.numbers.map(function (number) {
|
|
7033
|
+
return _this.getSuffix(code, number, options);
|
|
7034
|
+
});
|
|
7035
|
+
}
|
|
7036
|
+
}, {
|
|
7037
|
+
key: "getSuffix",
|
|
7038
|
+
value: function getSuffix(code, count) {
|
|
7039
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7040
|
+
var rule = this.getRule(code, options);
|
|
7041
|
+
if (rule) {
|
|
7042
|
+
if (this.shouldUseIntlApi()) {
|
|
7043
|
+
return ("").concat(this.options.prepend).concat(rule.select(count));
|
|
7044
|
+
}
|
|
7045
|
+
return this.getSuffixRetroCompatible(rule, count);
|
|
7046
|
+
}
|
|
7047
|
+
this.logger.warn(("no plural rule found for: ").concat(code));
|
|
7048
|
+
return '';
|
|
7049
|
+
}
|
|
7050
|
+
}, {
|
|
7051
|
+
key: "getSuffixRetroCompatible",
|
|
7052
|
+
value: function getSuffixRetroCompatible(rule, count) {
|
|
7053
|
+
var _this2 = this;
|
|
7054
|
+
var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
7055
|
+
var suffix = rule.numbers[idx];
|
|
7056
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
7057
|
+
if (suffix === 2) {
|
|
7058
|
+
suffix = 'plural';
|
|
7059
|
+
} else if (suffix === 1) {
|
|
7060
|
+
suffix = '';
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
7063
|
+
var returnSuffix = function returnSuffix() {
|
|
7064
|
+
return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
|
|
7065
|
+
};
|
|
7066
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
7067
|
+
if (suffix === 1) return '';
|
|
7068
|
+
if (typeof suffix === 'number') return ("_plural_").concat(suffix.toString());
|
|
7069
|
+
return returnSuffix();
|
|
7070
|
+
} else if (this.options.compatibilityJSON === 'v2') {
|
|
7071
|
+
return returnSuffix();
|
|
7072
|
+
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
7073
|
+
return returnSuffix();
|
|
7074
|
+
}
|
|
7075
|
+
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
7076
|
+
}
|
|
7077
|
+
}, {
|
|
7078
|
+
key: "shouldUseIntlApi",
|
|
7079
|
+
value: function shouldUseIntlApi() {
|
|
7080
|
+
return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
|
|
7081
|
+
}
|
|
7082
|
+
}]);
|
|
7083
|
+
return PluralResolver;
|
|
7084
|
+
})();
|
|
7085
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
7086
|
+
var keys = Object.keys(object);
|
|
7087
|
+
if (Object.getOwnPropertySymbols) {
|
|
7088
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7089
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7090
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7091
|
+
})), keys.push.apply(keys, symbols));
|
|
7092
|
+
}
|
|
7093
|
+
return keys;
|
|
7094
|
+
}
|
|
7095
|
+
function _objectSpread$3(target) {
|
|
7096
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7097
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7098
|
+
i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
|
|
7099
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7100
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
|
|
7101
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7102
|
+
});
|
|
7103
|
+
}
|
|
7104
|
+
return target;
|
|
7105
|
+
}
|
|
7106
|
+
function deepFindWithDefaults(data, defaultData, key) {
|
|
7107
|
+
var keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
|
|
7108
|
+
var ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
7109
|
+
var path = getPathWithDefaults(data, defaultData, key);
|
|
7110
|
+
if (!path && ignoreJSONStructure && typeof key === 'string') {
|
|
7111
|
+
path = deepFind(data, key, keySeparator);
|
|
7112
|
+
if (path === undefined) path = deepFind(defaultData, key, keySeparator);
|
|
7113
|
+
}
|
|
7114
|
+
return path;
|
|
7115
|
+
}
|
|
7116
|
+
var Interpolator = (function () {
|
|
7117
|
+
function Interpolator() {
|
|
7118
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7119
|
+
_classCallCheck__default["default"](this, Interpolator);
|
|
7120
|
+
this.logger = baseLogger.create('interpolator');
|
|
7121
|
+
this.options = options;
|
|
7122
|
+
this.format = options.interpolation && options.interpolation.format || (function (value) {
|
|
7123
|
+
return value;
|
|
7124
|
+
});
|
|
7125
|
+
this.init(options);
|
|
7126
|
+
}
|
|
7127
|
+
_createClass__default["default"](Interpolator, [{
|
|
7128
|
+
key: "init",
|
|
7129
|
+
value: function init() {
|
|
7130
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7131
|
+
if (!options.interpolation) options.interpolation = {
|
|
7132
|
+
escapeValue: true
|
|
7133
|
+
};
|
|
7134
|
+
var iOpts = options.interpolation;
|
|
7135
|
+
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
|
|
7136
|
+
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
7137
|
+
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
7138
|
+
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
7139
|
+
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
7140
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
7141
|
+
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
7142
|
+
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
7143
|
+
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
7144
|
+
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
7145
|
+
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
7146
|
+
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
7147
|
+
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
7148
|
+
this.resetRegExp();
|
|
7149
|
+
}
|
|
7150
|
+
}, {
|
|
7151
|
+
key: "reset",
|
|
7152
|
+
value: function reset() {
|
|
7153
|
+
if (this.options) this.init(this.options);
|
|
7154
|
+
}
|
|
7155
|
+
}, {
|
|
7156
|
+
key: "resetRegExp",
|
|
7157
|
+
value: function resetRegExp() {
|
|
7158
|
+
var regexpStr = ("").concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
7159
|
+
this.regexp = new RegExp(regexpStr, 'g');
|
|
7160
|
+
var regexpUnescapeStr = ("").concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
7161
|
+
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
7162
|
+
var nestingRegexpStr = ("").concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
7163
|
+
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
7164
|
+
}
|
|
7165
|
+
}, {
|
|
7166
|
+
key: "interpolate",
|
|
7167
|
+
value: function interpolate(str, data, lng, options) {
|
|
7168
|
+
var _this = this;
|
|
7169
|
+
var match;
|
|
7170
|
+
var value;
|
|
7171
|
+
var replaces;
|
|
7172
|
+
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || ({});
|
|
7173
|
+
function regexSafe(val) {
|
|
7174
|
+
return val.replace(/\$/g, '$$$$');
|
|
7175
|
+
}
|
|
7176
|
+
var handleFormat = function handleFormat(key) {
|
|
7177
|
+
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
7178
|
+
var path = deepFindWithDefaults(data, defaultData, key, _this.options.keySeparator, _this.options.ignoreJSONStructure);
|
|
7179
|
+
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
7180
|
+
interpolationkey: key
|
|
7181
|
+
})) : path;
|
|
7182
|
+
}
|
|
7183
|
+
var p = key.split(_this.formatSeparator);
|
|
7184
|
+
var k = p.shift().trim();
|
|
7185
|
+
var f = p.join(_this.formatSeparator).trim();
|
|
7186
|
+
return _this.format(deepFindWithDefaults(data, defaultData, k, _this.options.keySeparator, _this.options.ignoreJSONStructure), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
7187
|
+
interpolationkey: k
|
|
7188
|
+
}));
|
|
7189
|
+
};
|
|
7190
|
+
this.resetRegExp();
|
|
7191
|
+
var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
7192
|
+
var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
7193
|
+
var todos = [{
|
|
7194
|
+
regex: this.regexpUnescape,
|
|
7195
|
+
safeValue: function safeValue(val) {
|
|
7196
|
+
return regexSafe(val);
|
|
7197
|
+
}
|
|
7198
|
+
}, {
|
|
7199
|
+
regex: this.regexp,
|
|
7200
|
+
safeValue: function safeValue(val) {
|
|
7201
|
+
return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
|
|
7202
|
+
}
|
|
7203
|
+
}];
|
|
7204
|
+
todos.forEach(function (todo) {
|
|
7205
|
+
replaces = 0;
|
|
7206
|
+
while (match = todo.regex.exec(str)) {
|
|
7207
|
+
var matchedVar = match[1].trim();
|
|
7208
|
+
value = handleFormat(matchedVar);
|
|
7209
|
+
if (value === undefined) {
|
|
7210
|
+
if (typeof missingInterpolationHandler === 'function') {
|
|
7211
|
+
var temp = missingInterpolationHandler(str, match, options);
|
|
7212
|
+
value = typeof temp === 'string' ? temp : '';
|
|
7213
|
+
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
7214
|
+
value = '';
|
|
7215
|
+
} else if (skipOnVariables) {
|
|
7216
|
+
value = match[0];
|
|
7217
|
+
continue;
|
|
7218
|
+
} else {
|
|
7219
|
+
_this.logger.warn(("missed to pass in variable ").concat(matchedVar, " for interpolating ").concat(str));
|
|
7220
|
+
value = '';
|
|
7221
|
+
}
|
|
7222
|
+
} else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
|
|
7223
|
+
value = makeString(value);
|
|
7224
|
+
}
|
|
7225
|
+
var safeValue = todo.safeValue(value);
|
|
7226
|
+
str = str.replace(match[0], safeValue);
|
|
7227
|
+
if (skipOnVariables) {
|
|
7228
|
+
todo.regex.lastIndex += value.length;
|
|
7229
|
+
todo.regex.lastIndex -= match[0].length;
|
|
7230
|
+
} else {
|
|
7231
|
+
todo.regex.lastIndex = 0;
|
|
7232
|
+
}
|
|
7233
|
+
replaces++;
|
|
7234
|
+
if (replaces >= _this.maxReplaces) {
|
|
7235
|
+
break;
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
});
|
|
7239
|
+
return str;
|
|
7240
|
+
}
|
|
7241
|
+
}, {
|
|
7242
|
+
key: "nest",
|
|
7243
|
+
value: function nest(str, fc) {
|
|
7244
|
+
var _this2 = this;
|
|
7245
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7246
|
+
var match;
|
|
7247
|
+
var value;
|
|
7248
|
+
var clonedOptions;
|
|
7249
|
+
function handleHasOptions(key, inheritedOptions) {
|
|
7250
|
+
var sep = this.nestingOptionsSeparator;
|
|
7251
|
+
if (key.indexOf(sep) < 0) return key;
|
|
7252
|
+
var c = key.split(new RegExp(("").concat(sep, "[ ]*{")));
|
|
7253
|
+
var optionsString = ("{").concat(c[1]);
|
|
7254
|
+
key = c[0];
|
|
7255
|
+
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
7256
|
+
var matchedSingleQuotes = optionsString.match(/'/g);
|
|
7257
|
+
var matchedDoubleQuotes = optionsString.match(/"/g);
|
|
7258
|
+
if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
|
|
7259
|
+
optionsString = optionsString.replace(/'/g, '"');
|
|
7260
|
+
}
|
|
7261
|
+
try {
|
|
7262
|
+
clonedOptions = JSON.parse(optionsString);
|
|
7263
|
+
if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
|
|
7264
|
+
} catch (e) {
|
|
7265
|
+
this.logger.warn(("failed parsing options string in nesting for key ").concat(key), e);
|
|
7266
|
+
return ("").concat(key).concat(sep).concat(optionsString);
|
|
7267
|
+
}
|
|
7268
|
+
delete clonedOptions.defaultValue;
|
|
7269
|
+
return key;
|
|
7270
|
+
}
|
|
7271
|
+
while (match = this.nestingRegexp.exec(str)) {
|
|
7272
|
+
var formatters = [];
|
|
7273
|
+
clonedOptions = _objectSpread$3({}, options);
|
|
7274
|
+
clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
|
|
7275
|
+
clonedOptions.applyPostProcessor = false;
|
|
7276
|
+
delete clonedOptions.defaultValue;
|
|
7277
|
+
var doReduce = false;
|
|
7278
|
+
if (match[0].indexOf(this.formatSeparator) !== -1 && !(/{.*}/).test(match[1])) {
|
|
7279
|
+
var r = match[1].split(this.formatSeparator).map(function (elem) {
|
|
7280
|
+
return elem.trim();
|
|
7281
|
+
});
|
|
7282
|
+
match[1] = r.shift();
|
|
7283
|
+
formatters = r;
|
|
7284
|
+
doReduce = true;
|
|
7285
|
+
}
|
|
7286
|
+
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
7287
|
+
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
7288
|
+
if (typeof value !== 'string') value = makeString(value);
|
|
7289
|
+
if (!value) {
|
|
7290
|
+
this.logger.warn(("missed to resolve ").concat(match[1], " for nesting ").concat(str));
|
|
7291
|
+
value = '';
|
|
7292
|
+
}
|
|
7293
|
+
if (doReduce) {
|
|
7294
|
+
value = formatters.reduce(function (v, f) {
|
|
7295
|
+
return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
7296
|
+
interpolationkey: match[1].trim()
|
|
7297
|
+
}));
|
|
7298
|
+
}, value.trim());
|
|
7299
|
+
}
|
|
7300
|
+
str = str.replace(match[0], value);
|
|
7301
|
+
this.regexp.lastIndex = 0;
|
|
7302
|
+
}
|
|
7303
|
+
return str;
|
|
7304
|
+
}
|
|
7305
|
+
}]);
|
|
7306
|
+
return Interpolator;
|
|
7307
|
+
})();
|
|
7308
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
7309
|
+
var keys = Object.keys(object);
|
|
7310
|
+
if (Object.getOwnPropertySymbols) {
|
|
7311
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7312
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7313
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7314
|
+
})), keys.push.apply(keys, symbols));
|
|
7315
|
+
}
|
|
7316
|
+
return keys;
|
|
7317
|
+
}
|
|
7318
|
+
function _objectSpread$2(target) {
|
|
7319
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7320
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7321
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
7322
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7323
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
7324
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7325
|
+
});
|
|
7326
|
+
}
|
|
7327
|
+
return target;
|
|
7328
|
+
}
|
|
7329
|
+
function parseFormatStr(formatStr) {
|
|
7330
|
+
var formatName = formatStr.toLowerCase().trim();
|
|
7331
|
+
var formatOptions = {};
|
|
7332
|
+
if (formatStr.indexOf('(') > -1) {
|
|
7333
|
+
var p = formatStr.split('(');
|
|
7334
|
+
formatName = p[0].toLowerCase().trim();
|
|
7335
|
+
var optStr = p[1].substring(0, p[1].length - 1);
|
|
7336
|
+
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
7337
|
+
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
7338
|
+
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
7339
|
+
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
7340
|
+
} else {
|
|
7341
|
+
var opts = optStr.split(';');
|
|
7342
|
+
opts.forEach(function (opt) {
|
|
7343
|
+
if (!opt) return;
|
|
7344
|
+
var _opt$split = opt.split(':'), _opt$split2 = _toArray__default["default"](_opt$split), key = _opt$split2[0], rest = _opt$split2.slice(1);
|
|
7345
|
+
var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
7346
|
+
if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
|
|
7347
|
+
if (val === 'false') formatOptions[key.trim()] = false;
|
|
7348
|
+
if (val === 'true') formatOptions[key.trim()] = true;
|
|
7349
|
+
if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
|
|
7350
|
+
});
|
|
7351
|
+
}
|
|
7352
|
+
}
|
|
7353
|
+
return {
|
|
7354
|
+
formatName: formatName,
|
|
7355
|
+
formatOptions: formatOptions
|
|
7356
|
+
};
|
|
7357
|
+
}
|
|
7358
|
+
function createCachedFormatter(fn) {
|
|
7359
|
+
var cache = {};
|
|
7360
|
+
return function invokeFormatter(val, lng, options) {
|
|
7361
|
+
var key = lng + JSON.stringify(options);
|
|
7362
|
+
var formatter = cache[key];
|
|
7363
|
+
if (!formatter) {
|
|
7364
|
+
formatter = fn(lng, options);
|
|
7365
|
+
cache[key] = formatter;
|
|
7366
|
+
}
|
|
7367
|
+
return formatter(val);
|
|
7368
|
+
};
|
|
7369
|
+
}
|
|
7370
|
+
var Formatter = (function () {
|
|
7371
|
+
function Formatter() {
|
|
7372
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7373
|
+
_classCallCheck__default["default"](this, Formatter);
|
|
7374
|
+
this.logger = baseLogger.create('formatter');
|
|
7375
|
+
this.options = options;
|
|
7376
|
+
this.formats = {
|
|
7377
|
+
number: createCachedFormatter(function (lng, opt) {
|
|
7378
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
|
|
7379
|
+
return function (val) {
|
|
7380
|
+
return formatter.format(val);
|
|
7381
|
+
};
|
|
7382
|
+
}),
|
|
7383
|
+
currency: createCachedFormatter(function (lng, opt) {
|
|
7384
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
|
|
7385
|
+
style: 'currency'
|
|
7386
|
+
}));
|
|
7387
|
+
return function (val) {
|
|
7388
|
+
return formatter.format(val);
|
|
7389
|
+
};
|
|
7390
|
+
}),
|
|
7391
|
+
datetime: createCachedFormatter(function (lng, opt) {
|
|
7392
|
+
var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
|
|
7393
|
+
return function (val) {
|
|
7394
|
+
return formatter.format(val);
|
|
7395
|
+
};
|
|
7396
|
+
}),
|
|
7397
|
+
relativetime: createCachedFormatter(function (lng, opt) {
|
|
7398
|
+
var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
|
|
7399
|
+
return function (val) {
|
|
7400
|
+
return formatter.format(val, opt.range || 'day');
|
|
7401
|
+
};
|
|
7402
|
+
}),
|
|
7403
|
+
list: createCachedFormatter(function (lng, opt) {
|
|
7404
|
+
var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
|
|
7405
|
+
return function (val) {
|
|
7406
|
+
return formatter.format(val);
|
|
7407
|
+
};
|
|
7408
|
+
})
|
|
7409
|
+
};
|
|
7410
|
+
this.init(options);
|
|
7411
|
+
}
|
|
7412
|
+
_createClass__default["default"](Formatter, [{
|
|
7413
|
+
key: "init",
|
|
7414
|
+
value: function init(services) {
|
|
7415
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
7416
|
+
interpolation: {}
|
|
7417
|
+
};
|
|
7418
|
+
var iOpts = options.interpolation;
|
|
7419
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
7420
|
+
}
|
|
7421
|
+
}, {
|
|
7422
|
+
key: "add",
|
|
7423
|
+
value: function add(name, fc) {
|
|
7424
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
7425
|
+
}
|
|
7426
|
+
}, {
|
|
7427
|
+
key: "addCached",
|
|
7428
|
+
value: function addCached(name, fc) {
|
|
7429
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
7430
|
+
}
|
|
7431
|
+
}, {
|
|
7432
|
+
key: "format",
|
|
7433
|
+
value: function format(value, _format, lng) {
|
|
7434
|
+
var _this = this;
|
|
7435
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
7436
|
+
var formats = _format.split(this.formatSeparator);
|
|
7437
|
+
var result = formats.reduce(function (mem, f) {
|
|
7438
|
+
var _parseFormatStr = parseFormatStr(f), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions;
|
|
7439
|
+
if (_this.formats[formatName]) {
|
|
7440
|
+
var formatted = mem;
|
|
7441
|
+
try {
|
|
7442
|
+
var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || ({});
|
|
7443
|
+
var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
7444
|
+
formatted = _this.formats[formatName](mem, l, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions));
|
|
7445
|
+
} catch (error) {
|
|
7446
|
+
_this.logger.warn(error);
|
|
7447
|
+
}
|
|
7448
|
+
return formatted;
|
|
7449
|
+
} else {
|
|
7450
|
+
_this.logger.warn(("there was no format function for ").concat(formatName));
|
|
7451
|
+
}
|
|
7452
|
+
return mem;
|
|
7453
|
+
}, value);
|
|
7454
|
+
return result;
|
|
7455
|
+
}
|
|
7456
|
+
}]);
|
|
7457
|
+
return Formatter;
|
|
7458
|
+
})();
|
|
7459
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
7460
|
+
var keys = Object.keys(object);
|
|
7461
|
+
if (Object.getOwnPropertySymbols) {
|
|
7462
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7463
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7464
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7465
|
+
})), keys.push.apply(keys, symbols));
|
|
7466
|
+
}
|
|
7467
|
+
return keys;
|
|
7468
|
+
}
|
|
7469
|
+
function _objectSpread$1(target) {
|
|
7470
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7471
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7472
|
+
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
|
7473
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7474
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
|
7475
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7476
|
+
});
|
|
7477
|
+
}
|
|
7478
|
+
return target;
|
|
7479
|
+
}
|
|
7480
|
+
function _createSuper$1(Derived) {
|
|
7481
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
7482
|
+
return function _createSuperInternal() {
|
|
7483
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
7484
|
+
if (hasNativeReflectConstruct) {
|
|
7485
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
7486
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
7487
|
+
} else {
|
|
7488
|
+
result = Super.apply(this, arguments);
|
|
7489
|
+
}
|
|
7490
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
7491
|
+
};
|
|
7492
|
+
}
|
|
7493
|
+
function _isNativeReflectConstruct$1() {
|
|
7494
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
7495
|
+
if (Reflect.construct.sham) return false;
|
|
7496
|
+
if (typeof Proxy === "function") return true;
|
|
7497
|
+
try {
|
|
7498
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7499
|
+
return true;
|
|
7500
|
+
} catch (e) {
|
|
7501
|
+
return false;
|
|
7502
|
+
}
|
|
7503
|
+
}
|
|
7504
|
+
function removePending(q, name) {
|
|
7505
|
+
if (q.pending[name] !== undefined) {
|
|
7506
|
+
delete q.pending[name];
|
|
7507
|
+
q.pendingCount--;
|
|
7508
|
+
}
|
|
7509
|
+
}
|
|
7510
|
+
var Connector = (function (_EventEmitter) {
|
|
7511
|
+
_inherits__default["default"](Connector, _EventEmitter);
|
|
7512
|
+
var _super = _createSuper$1(Connector);
|
|
7513
|
+
function Connector(backend, store, services) {
|
|
7514
|
+
var _this;
|
|
7515
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
7516
|
+
_classCallCheck__default["default"](this, Connector);
|
|
7517
|
+
_this = _super.call(this);
|
|
7518
|
+
if (isIE10) {
|
|
7519
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
7520
|
+
}
|
|
7521
|
+
_this.backend = backend;
|
|
7522
|
+
_this.store = store;
|
|
7523
|
+
_this.services = services;
|
|
7524
|
+
_this.languageUtils = services.languageUtils;
|
|
7525
|
+
_this.options = options;
|
|
7526
|
+
_this.logger = baseLogger.create('backendConnector');
|
|
7527
|
+
_this.waitingReads = [];
|
|
7528
|
+
_this.maxParallelReads = options.maxParallelReads || 10;
|
|
7529
|
+
_this.readingCalls = 0;
|
|
7530
|
+
_this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
7531
|
+
_this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
7532
|
+
_this.state = {};
|
|
7533
|
+
_this.queue = [];
|
|
7534
|
+
if (_this.backend && _this.backend.init) {
|
|
7535
|
+
_this.backend.init(services, options.backend, options);
|
|
7536
|
+
}
|
|
7537
|
+
return _this;
|
|
7538
|
+
}
|
|
7539
|
+
_createClass__default["default"](Connector, [{
|
|
7540
|
+
key: "queueLoad",
|
|
7541
|
+
value: function queueLoad(languages, namespaces, options, callback) {
|
|
7542
|
+
var _this2 = this;
|
|
7543
|
+
var toLoad = {};
|
|
7544
|
+
var pending = {};
|
|
7545
|
+
var toLoadLanguages = {};
|
|
7546
|
+
var toLoadNamespaces = {};
|
|
7547
|
+
languages.forEach(function (lng) {
|
|
7548
|
+
var hasAllNamespaces = true;
|
|
7549
|
+
namespaces.forEach(function (ns) {
|
|
7550
|
+
var name = ("").concat(lng, "|").concat(ns);
|
|
7551
|
+
if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
|
|
7552
|
+
_this2.state[name] = 2;
|
|
7553
|
+
} else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
|
|
7554
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
7555
|
+
} else {
|
|
7556
|
+
_this2.state[name] = 1;
|
|
7557
|
+
hasAllNamespaces = false;
|
|
7558
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
7559
|
+
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
7560
|
+
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
7561
|
+
}
|
|
7562
|
+
});
|
|
7563
|
+
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
7564
|
+
});
|
|
7565
|
+
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
7566
|
+
this.queue.push({
|
|
7567
|
+
pending: pending,
|
|
7568
|
+
pendingCount: Object.keys(pending).length,
|
|
7569
|
+
loaded: {},
|
|
7570
|
+
errors: [],
|
|
7571
|
+
callback: callback
|
|
7572
|
+
});
|
|
7573
|
+
}
|
|
7574
|
+
return {
|
|
7575
|
+
toLoad: Object.keys(toLoad),
|
|
7576
|
+
pending: Object.keys(pending),
|
|
7577
|
+
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
7578
|
+
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
7579
|
+
};
|
|
7580
|
+
}
|
|
7581
|
+
}, {
|
|
7582
|
+
key: "loaded",
|
|
7583
|
+
value: function loaded(name, err, data) {
|
|
7584
|
+
var s = name.split('|');
|
|
7585
|
+
var lng = s[0];
|
|
7586
|
+
var ns = s[1];
|
|
7587
|
+
if (err) this.emit('failedLoading', lng, ns, err);
|
|
7588
|
+
if (data) {
|
|
7589
|
+
this.store.addResourceBundle(lng, ns, data);
|
|
7590
|
+
}
|
|
7591
|
+
this.state[name] = err ? -1 : 2;
|
|
7592
|
+
var loaded = {};
|
|
7593
|
+
this.queue.forEach(function (q) {
|
|
7594
|
+
pushPath(q.loaded, [lng], ns);
|
|
7595
|
+
removePending(q, name);
|
|
7596
|
+
if (err) q.errors.push(err);
|
|
7597
|
+
if (q.pendingCount === 0 && !q.done) {
|
|
7598
|
+
Object.keys(q.loaded).forEach(function (l) {
|
|
7599
|
+
if (!loaded[l]) loaded[l] = {};
|
|
7600
|
+
var loadedKeys = q.loaded[l];
|
|
7601
|
+
if (loadedKeys.length) {
|
|
7602
|
+
loadedKeys.forEach(function (n) {
|
|
7603
|
+
if (loaded[l][n] === undefined) loaded[l][n] = true;
|
|
7604
|
+
});
|
|
7605
|
+
}
|
|
7606
|
+
});
|
|
7607
|
+
q.done = true;
|
|
7608
|
+
if (q.errors.length) {
|
|
7609
|
+
q.callback(q.errors);
|
|
7610
|
+
} else {
|
|
7611
|
+
q.callback();
|
|
7612
|
+
}
|
|
7613
|
+
}
|
|
7614
|
+
});
|
|
7615
|
+
this.emit('loaded', loaded);
|
|
7616
|
+
this.queue = this.queue.filter(function (q) {
|
|
7617
|
+
return !q.done;
|
|
7618
|
+
});
|
|
7619
|
+
}
|
|
7620
|
+
}, {
|
|
7621
|
+
key: "read",
|
|
7622
|
+
value: function read(lng, ns, fcName) {
|
|
7623
|
+
var _this3 = this;
|
|
7624
|
+
var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
7625
|
+
var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
|
|
7626
|
+
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
7627
|
+
if (!lng.length) return callback(null, {});
|
|
7628
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
7629
|
+
this.waitingReads.push({
|
|
7630
|
+
lng: lng,
|
|
7631
|
+
ns: ns,
|
|
7632
|
+
fcName: fcName,
|
|
7633
|
+
tried: tried,
|
|
7634
|
+
wait: wait,
|
|
7635
|
+
callback: callback
|
|
7636
|
+
});
|
|
7637
|
+
return;
|
|
7638
|
+
}
|
|
7639
|
+
this.readingCalls++;
|
|
7640
|
+
var resolver = function resolver(err, data) {
|
|
7641
|
+
_this3.readingCalls--;
|
|
7642
|
+
if (_this3.waitingReads.length > 0) {
|
|
7643
|
+
var next = _this3.waitingReads.shift();
|
|
7644
|
+
_this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
7645
|
+
}
|
|
7646
|
+
if (err && data && tried < _this3.maxRetries) {
|
|
7647
|
+
setTimeout(function () {
|
|
7648
|
+
_this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
7649
|
+
}, wait);
|
|
7650
|
+
return;
|
|
7651
|
+
}
|
|
7652
|
+
callback(err, data);
|
|
7653
|
+
};
|
|
7654
|
+
var fc = this.backend[fcName].bind(this.backend);
|
|
7655
|
+
if (fc.length === 2) {
|
|
7656
|
+
try {
|
|
7657
|
+
var r = fc(lng, ns);
|
|
7658
|
+
if (r && typeof r.then === 'function') {
|
|
7659
|
+
r.then(function (data) {
|
|
7660
|
+
return resolver(null, data);
|
|
7661
|
+
})["catch"](resolver);
|
|
7662
|
+
} else {
|
|
7663
|
+
resolver(null, r);
|
|
7664
|
+
}
|
|
7665
|
+
} catch (err) {
|
|
7666
|
+
resolver(err);
|
|
7667
|
+
}
|
|
7668
|
+
return;
|
|
7669
|
+
}
|
|
7670
|
+
return fc(lng, ns, resolver);
|
|
7671
|
+
}
|
|
7672
|
+
}, {
|
|
7673
|
+
key: "prepareLoading",
|
|
7674
|
+
value: function prepareLoading(languages, namespaces) {
|
|
7675
|
+
var _this4 = this;
|
|
7676
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7677
|
+
var callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
7678
|
+
if (!this.backend) {
|
|
7679
|
+
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
7680
|
+
return callback && callback();
|
|
7681
|
+
}
|
|
7682
|
+
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
7683
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
7684
|
+
var toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
7685
|
+
if (!toLoad.toLoad.length) {
|
|
7686
|
+
if (!toLoad.pending.length) callback();
|
|
7687
|
+
return null;
|
|
7688
|
+
}
|
|
7689
|
+
toLoad.toLoad.forEach(function (name) {
|
|
7690
|
+
_this4.loadOne(name);
|
|
7691
|
+
});
|
|
7692
|
+
}
|
|
7693
|
+
}, {
|
|
7694
|
+
key: "load",
|
|
7695
|
+
value: function load(languages, namespaces, callback) {
|
|
7696
|
+
this.prepareLoading(languages, namespaces, {}, callback);
|
|
7697
|
+
}
|
|
7698
|
+
}, {
|
|
7699
|
+
key: "reload",
|
|
7700
|
+
value: function reload(languages, namespaces, callback) {
|
|
7701
|
+
this.prepareLoading(languages, namespaces, {
|
|
7702
|
+
reload: true
|
|
7703
|
+
}, callback);
|
|
7704
|
+
}
|
|
7705
|
+
}, {
|
|
7706
|
+
key: "loadOne",
|
|
7707
|
+
value: function loadOne(name) {
|
|
7708
|
+
var _this5 = this;
|
|
7709
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
7710
|
+
var s = name.split('|');
|
|
7711
|
+
var lng = s[0];
|
|
7712
|
+
var ns = s[1];
|
|
7713
|
+
this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
|
|
7714
|
+
if (err) _this5.logger.warn(("").concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
|
|
7715
|
+
if (!err && data) _this5.logger.log(("").concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
|
|
7716
|
+
_this5.loaded(name, err, data);
|
|
7717
|
+
});
|
|
7718
|
+
}
|
|
7719
|
+
}, {
|
|
7720
|
+
key: "saveMissing",
|
|
7721
|
+
value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
7722
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
7723
|
+
var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
|
|
7724
|
+
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
7725
|
+
this.logger.warn(("did not save key \"").concat(key, "\" as the namespace \"").concat(namespace, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
|
|
7726
|
+
return;
|
|
7727
|
+
}
|
|
7728
|
+
if (key === undefined || key === null || key === '') return;
|
|
7729
|
+
if (this.backend && this.backend.create) {
|
|
7730
|
+
var opts = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
7731
|
+
isUpdate: isUpdate
|
|
7732
|
+
});
|
|
7733
|
+
var fc = this.backend.create.bind(this.backend);
|
|
7734
|
+
if (fc.length < 6) {
|
|
7735
|
+
try {
|
|
7736
|
+
var r;
|
|
7737
|
+
if (fc.length === 5) {
|
|
7738
|
+
r = fc(languages, namespace, key, fallbackValue, opts);
|
|
7739
|
+
} else {
|
|
7740
|
+
r = fc(languages, namespace, key, fallbackValue);
|
|
7741
|
+
}
|
|
7742
|
+
if (r && typeof r.then === 'function') {
|
|
7743
|
+
r.then(function (data) {
|
|
7744
|
+
return clb(null, data);
|
|
7745
|
+
})["catch"](clb);
|
|
7746
|
+
} else {
|
|
7747
|
+
clb(null, r);
|
|
7748
|
+
}
|
|
7749
|
+
} catch (err) {
|
|
7750
|
+
clb(err);
|
|
7751
|
+
}
|
|
7752
|
+
} else {
|
|
7753
|
+
fc(languages, namespace, key, fallbackValue, clb, opts);
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
if (!languages || !languages[0]) return;
|
|
7757
|
+
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
7758
|
+
}
|
|
7759
|
+
}]);
|
|
7760
|
+
return Connector;
|
|
7761
|
+
})(EventEmitter);
|
|
7762
|
+
function get() {
|
|
7763
|
+
return {
|
|
7764
|
+
debug: false,
|
|
7765
|
+
initImmediate: true,
|
|
7766
|
+
ns: ['translation'],
|
|
7767
|
+
defaultNS: ['translation'],
|
|
7768
|
+
fallbackLng: ['dev'],
|
|
7769
|
+
fallbackNS: false,
|
|
7770
|
+
supportedLngs: false,
|
|
7771
|
+
nonExplicitSupportedLngs: false,
|
|
7772
|
+
load: 'all',
|
|
7773
|
+
preload: false,
|
|
7774
|
+
simplifyPluralSuffix: true,
|
|
7775
|
+
keySeparator: '.',
|
|
7776
|
+
nsSeparator: ':',
|
|
7777
|
+
pluralSeparator: '_',
|
|
7778
|
+
contextSeparator: '_',
|
|
7779
|
+
partialBundledLanguages: false,
|
|
7780
|
+
saveMissing: false,
|
|
7781
|
+
updateMissing: false,
|
|
7782
|
+
saveMissingTo: 'fallback',
|
|
7783
|
+
saveMissingPlurals: true,
|
|
7784
|
+
missingKeyHandler: false,
|
|
7785
|
+
missingInterpolationHandler: false,
|
|
7786
|
+
postProcess: false,
|
|
7787
|
+
postProcessPassResolved: false,
|
|
7788
|
+
returnNull: true,
|
|
7789
|
+
returnEmptyString: true,
|
|
7790
|
+
returnObjects: false,
|
|
7791
|
+
joinArrays: false,
|
|
7792
|
+
returnedObjectHandler: false,
|
|
7793
|
+
parseMissingKeyHandler: false,
|
|
7794
|
+
appendNamespaceToMissingKey: false,
|
|
7795
|
+
appendNamespaceToCIMode: false,
|
|
7796
|
+
overloadTranslationOptionHandler: function handle(args) {
|
|
7797
|
+
var ret = {};
|
|
7798
|
+
if (_typeof__default["default"](args[1]) === 'object') ret = args[1];
|
|
7799
|
+
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
7800
|
+
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
7801
|
+
if (_typeof__default["default"](args[2]) === 'object' || _typeof__default["default"](args[3]) === 'object') {
|
|
7802
|
+
var options = args[3] || args[2];
|
|
7803
|
+
Object.keys(options).forEach(function (key) {
|
|
7804
|
+
ret[key] = options[key];
|
|
7805
|
+
});
|
|
7806
|
+
}
|
|
7807
|
+
return ret;
|
|
7808
|
+
},
|
|
7809
|
+
interpolation: {
|
|
7810
|
+
escapeValue: true,
|
|
7811
|
+
format: function format(value, _format, lng, options) {
|
|
7812
|
+
return value;
|
|
7813
|
+
},
|
|
7814
|
+
prefix: '{{',
|
|
7815
|
+
suffix: '}}',
|
|
7816
|
+
formatSeparator: ',',
|
|
7817
|
+
unescapePrefix: '-',
|
|
7818
|
+
nestingPrefix: '$t(',
|
|
7819
|
+
nestingSuffix: ')',
|
|
7820
|
+
nestingOptionsSeparator: ',',
|
|
7821
|
+
maxReplaces: 1000,
|
|
7822
|
+
skipOnVariables: true
|
|
7823
|
+
}
|
|
7824
|
+
};
|
|
7825
|
+
}
|
|
7826
|
+
function transformOptions(options) {
|
|
7827
|
+
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
7828
|
+
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
7829
|
+
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
7830
|
+
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
7831
|
+
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
7832
|
+
}
|
|
7833
|
+
return options;
|
|
7834
|
+
}
|
|
7835
|
+
function ownKeys(object, enumerableOnly) {
|
|
7836
|
+
var keys = Object.keys(object);
|
|
7837
|
+
if (Object.getOwnPropertySymbols) {
|
|
7838
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7839
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7840
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7841
|
+
})), keys.push.apply(keys, symbols));
|
|
7842
|
+
}
|
|
7843
|
+
return keys;
|
|
7844
|
+
}
|
|
7845
|
+
function _objectSpread(target) {
|
|
7846
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7847
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7848
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
7849
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7850
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
7851
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7852
|
+
});
|
|
7853
|
+
}
|
|
7854
|
+
return target;
|
|
7855
|
+
}
|
|
7856
|
+
function _createSuper(Derived) {
|
|
7857
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
7858
|
+
return function _createSuperInternal() {
|
|
7859
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
7860
|
+
if (hasNativeReflectConstruct) {
|
|
7861
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
7862
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
7863
|
+
} else {
|
|
7864
|
+
result = Super.apply(this, arguments);
|
|
7865
|
+
}
|
|
7866
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
7867
|
+
};
|
|
7868
|
+
}
|
|
7869
|
+
function _isNativeReflectConstruct() {
|
|
7870
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
7871
|
+
if (Reflect.construct.sham) return false;
|
|
7872
|
+
if (typeof Proxy === "function") return true;
|
|
7873
|
+
try {
|
|
7874
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7875
|
+
return true;
|
|
7876
|
+
} catch (e) {
|
|
7877
|
+
return false;
|
|
7878
|
+
}
|
|
7879
|
+
}
|
|
7880
|
+
function noop$1() {}
|
|
7881
|
+
function bindMemberFunctions(inst) {
|
|
7882
|
+
var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
7883
|
+
mems.forEach(function (mem) {
|
|
7884
|
+
if (typeof inst[mem] === 'function') {
|
|
7885
|
+
inst[mem] = inst[mem].bind(inst);
|
|
7886
|
+
}
|
|
7887
|
+
});
|
|
7888
|
+
}
|
|
7889
|
+
var I18n = (function (_EventEmitter) {
|
|
7890
|
+
_inherits__default["default"](I18n, _EventEmitter);
|
|
7891
|
+
var _super = _createSuper(I18n);
|
|
7892
|
+
function I18n() {
|
|
7893
|
+
var _this;
|
|
7894
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7895
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
7896
|
+
_classCallCheck__default["default"](this, I18n);
|
|
7897
|
+
_this = _super.call(this);
|
|
7898
|
+
if (isIE10) {
|
|
7899
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
7900
|
+
}
|
|
7901
|
+
_this.options = transformOptions(options);
|
|
7902
|
+
_this.services = {};
|
|
7903
|
+
_this.logger = baseLogger;
|
|
7904
|
+
_this.modules = {
|
|
7905
|
+
external: []
|
|
7906
|
+
};
|
|
7907
|
+
bindMemberFunctions(_assertThisInitialized__default["default"](_this));
|
|
7908
|
+
if (callback && !_this.isInitialized && !options.isClone) {
|
|
7909
|
+
if (!_this.options.initImmediate) {
|
|
7910
|
+
_this.init(options, callback);
|
|
7911
|
+
return _possibleConstructorReturn__default["default"](_this, _assertThisInitialized__default["default"](_this));
|
|
7912
|
+
}
|
|
7913
|
+
setTimeout(function () {
|
|
7914
|
+
_this.init(options, callback);
|
|
7915
|
+
}, 0);
|
|
7916
|
+
}
|
|
7917
|
+
return _this;
|
|
7918
|
+
}
|
|
7919
|
+
_createClass__default["default"](I18n, [{
|
|
7920
|
+
key: "init",
|
|
7921
|
+
value: function init() {
|
|
7922
|
+
var _this2 = this;
|
|
7923
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7924
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
7925
|
+
if (typeof options === 'function') {
|
|
7926
|
+
callback = options;
|
|
7927
|
+
options = {};
|
|
7928
|
+
}
|
|
7929
|
+
if (!options.defaultNS && options.defaultNS !== false && options.ns) {
|
|
7930
|
+
if (typeof options.ns === 'string') {
|
|
7931
|
+
options.defaultNS = options.ns;
|
|
7932
|
+
} else if (options.ns.indexOf('translation') < 0) {
|
|
7933
|
+
options.defaultNS = options.ns[0];
|
|
7934
|
+
}
|
|
7935
|
+
}
|
|
7936
|
+
var defOpts = get();
|
|
7937
|
+
this.options = _objectSpread(_objectSpread(_objectSpread({}, defOpts), this.options), transformOptions(options));
|
|
7938
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
7939
|
+
this.options.interpolation = _objectSpread(_objectSpread({}, defOpts.interpolation), this.options.interpolation);
|
|
7940
|
+
}
|
|
7941
|
+
if (options.keySeparator !== undefined) {
|
|
7942
|
+
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
7943
|
+
}
|
|
7944
|
+
if (options.nsSeparator !== undefined) {
|
|
7945
|
+
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
7946
|
+
}
|
|
7947
|
+
function createClassOnDemand(ClassOrObject) {
|
|
7948
|
+
if (!ClassOrObject) return null;
|
|
7949
|
+
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
7950
|
+
return ClassOrObject;
|
|
7951
|
+
}
|
|
7952
|
+
if (!this.options.isClone) {
|
|
7953
|
+
if (this.modules.logger) {
|
|
7954
|
+
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
7955
|
+
} else {
|
|
7956
|
+
baseLogger.init(null, this.options);
|
|
7957
|
+
}
|
|
7958
|
+
var formatter;
|
|
7959
|
+
if (this.modules.formatter) {
|
|
7960
|
+
formatter = this.modules.formatter;
|
|
7961
|
+
} else if (typeof Intl !== 'undefined') {
|
|
7962
|
+
formatter = Formatter;
|
|
7963
|
+
}
|
|
7964
|
+
var lu = new LanguageUtil(this.options);
|
|
7965
|
+
this.store = new ResourceStore(this.options.resources, this.options);
|
|
7966
|
+
var s = this.services;
|
|
7967
|
+
s.logger = baseLogger;
|
|
7968
|
+
s.resourceStore = this.store;
|
|
7969
|
+
s.languageUtils = lu;
|
|
7970
|
+
s.pluralResolver = new PluralResolver(lu, {
|
|
7971
|
+
prepend: this.options.pluralSeparator,
|
|
7972
|
+
compatibilityJSON: this.options.compatibilityJSON,
|
|
7973
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
7974
|
+
});
|
|
7975
|
+
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
7976
|
+
s.formatter = createClassOnDemand(formatter);
|
|
7977
|
+
s.formatter.init(s, this.options);
|
|
7978
|
+
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
7979
|
+
}
|
|
7980
|
+
s.interpolator = new Interpolator(this.options);
|
|
7981
|
+
s.utils = {
|
|
7982
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
7983
|
+
};
|
|
7984
|
+
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
7985
|
+
s.backendConnector.on('*', function (event) {
|
|
7986
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7987
|
+
args[_key - 1] = arguments[_key];
|
|
7988
|
+
}
|
|
7989
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
7990
|
+
});
|
|
7991
|
+
if (this.modules.languageDetector) {
|
|
7992
|
+
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
7993
|
+
if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
|
|
7994
|
+
}
|
|
7995
|
+
if (this.modules.i18nFormat) {
|
|
7996
|
+
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
7997
|
+
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
7998
|
+
}
|
|
7999
|
+
this.translator = new Translator$1(this.services, this.options);
|
|
8000
|
+
this.translator.on('*', function (event) {
|
|
8001
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
8002
|
+
args[_key2 - 1] = arguments[_key2];
|
|
8003
|
+
}
|
|
8004
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
8005
|
+
});
|
|
8006
|
+
this.modules.external.forEach(function (m) {
|
|
8007
|
+
if (m.init) m.init(_this2);
|
|
8008
|
+
});
|
|
8009
|
+
}
|
|
8010
|
+
this.format = this.options.interpolation.format;
|
|
8011
|
+
if (!callback) callback = noop$1;
|
|
8012
|
+
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
8013
|
+
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8014
|
+
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
8015
|
+
}
|
|
8016
|
+
if (!this.services.languageDetector && !this.options.lng) {
|
|
8017
|
+
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
8018
|
+
}
|
|
8019
|
+
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
8020
|
+
storeApi.forEach(function (fcName) {
|
|
8021
|
+
_this2[fcName] = function () {
|
|
8022
|
+
var _this2$store;
|
|
8023
|
+
return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
|
|
8024
|
+
};
|
|
8025
|
+
});
|
|
8026
|
+
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
8027
|
+
storeApiChained.forEach(function (fcName) {
|
|
8028
|
+
_this2[fcName] = function () {
|
|
8029
|
+
var _this2$store2;
|
|
8030
|
+
(_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
|
|
8031
|
+
return _this2;
|
|
8032
|
+
};
|
|
8033
|
+
});
|
|
8034
|
+
var deferred = defer();
|
|
8035
|
+
var load = function load() {
|
|
8036
|
+
var finish = function finish(err, t) {
|
|
8037
|
+
if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
8038
|
+
_this2.isInitialized = true;
|
|
8039
|
+
if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
|
|
8040
|
+
_this2.emit('initialized', _this2.options);
|
|
8041
|
+
deferred.resolve(t);
|
|
8042
|
+
callback(err, t);
|
|
8043
|
+
};
|
|
8044
|
+
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
|
|
8045
|
+
_this2.changeLanguage(_this2.options.lng, finish);
|
|
8046
|
+
};
|
|
8047
|
+
if (this.options.resources || !this.options.initImmediate) {
|
|
8048
|
+
load();
|
|
8049
|
+
} else {
|
|
8050
|
+
setTimeout(load, 0);
|
|
8051
|
+
}
|
|
8052
|
+
return deferred;
|
|
8053
|
+
}
|
|
8054
|
+
}, {
|
|
8055
|
+
key: "loadResources",
|
|
8056
|
+
value: function loadResources(language) {
|
|
8057
|
+
var _this3 = this;
|
|
8058
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
8059
|
+
var usedCallback = callback;
|
|
8060
|
+
var usedLng = typeof language === 'string' ? language : this.language;
|
|
8061
|
+
if (typeof language === 'function') usedCallback = language;
|
|
8062
|
+
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
8063
|
+
if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
|
|
8064
|
+
var toLoad = [];
|
|
8065
|
+
var append = function append(lng) {
|
|
8066
|
+
if (!lng) return;
|
|
8067
|
+
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
8068
|
+
lngs.forEach(function (l) {
|
|
8069
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
8070
|
+
});
|
|
8071
|
+
};
|
|
8072
|
+
if (!usedLng) {
|
|
8073
|
+
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8074
|
+
fallbacks.forEach(function (l) {
|
|
8075
|
+
return append(l);
|
|
8076
|
+
});
|
|
8077
|
+
} else {
|
|
8078
|
+
append(usedLng);
|
|
8079
|
+
}
|
|
8080
|
+
if (this.options.preload) {
|
|
8081
|
+
this.options.preload.forEach(function (l) {
|
|
8082
|
+
return append(l);
|
|
8083
|
+
});
|
|
8084
|
+
}
|
|
8085
|
+
this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
|
|
8086
|
+
if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
|
|
8087
|
+
usedCallback(e);
|
|
8088
|
+
});
|
|
8089
|
+
} else {
|
|
8090
|
+
usedCallback(null);
|
|
8091
|
+
}
|
|
8092
|
+
}
|
|
8093
|
+
}, {
|
|
8094
|
+
key: "reloadResources",
|
|
8095
|
+
value: function reloadResources(lngs, ns, callback) {
|
|
8096
|
+
var deferred = defer();
|
|
8097
|
+
if (!lngs) lngs = this.languages;
|
|
8098
|
+
if (!ns) ns = this.options.ns;
|
|
8099
|
+
if (!callback) callback = noop$1;
|
|
8100
|
+
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
8101
|
+
deferred.resolve();
|
|
8102
|
+
callback(err);
|
|
8103
|
+
});
|
|
8104
|
+
return deferred;
|
|
8105
|
+
}
|
|
8106
|
+
}, {
|
|
8107
|
+
key: "use",
|
|
8108
|
+
value: function use(module) {
|
|
8109
|
+
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
8110
|
+
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
8111
|
+
if (module.type === 'backend') {
|
|
8112
|
+
this.modules.backend = module;
|
|
8113
|
+
}
|
|
8114
|
+
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
8115
|
+
this.modules.logger = module;
|
|
8116
|
+
}
|
|
8117
|
+
if (module.type === 'languageDetector') {
|
|
8118
|
+
this.modules.languageDetector = module;
|
|
8119
|
+
}
|
|
8120
|
+
if (module.type === 'i18nFormat') {
|
|
8121
|
+
this.modules.i18nFormat = module;
|
|
8122
|
+
}
|
|
8123
|
+
if (module.type === 'postProcessor') {
|
|
8124
|
+
postProcessor.addPostProcessor(module);
|
|
8125
|
+
}
|
|
8126
|
+
if (module.type === 'formatter') {
|
|
8127
|
+
this.modules.formatter = module;
|
|
8128
|
+
}
|
|
8129
|
+
if (module.type === '3rdParty') {
|
|
8130
|
+
this.modules.external.push(module);
|
|
8131
|
+
}
|
|
8132
|
+
return this;
|
|
8133
|
+
}
|
|
8134
|
+
}, {
|
|
8135
|
+
key: "setResolvedLanguage",
|
|
8136
|
+
value: function setResolvedLanguage(l) {
|
|
8137
|
+
if (!l || !this.languages) return;
|
|
8138
|
+
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
8139
|
+
for (var li = 0; li < this.languages.length; li++) {
|
|
8140
|
+
var lngInLngs = this.languages[li];
|
|
8141
|
+
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
8142
|
+
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
8143
|
+
this.resolvedLanguage = lngInLngs;
|
|
8144
|
+
break;
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
}
|
|
8148
|
+
}, {
|
|
8149
|
+
key: "changeLanguage",
|
|
8150
|
+
value: function changeLanguage(lng, callback) {
|
|
8151
|
+
var _this4 = this;
|
|
8152
|
+
this.isLanguageChangingTo = lng;
|
|
8153
|
+
var deferred = defer();
|
|
8154
|
+
this.emit('languageChanging', lng);
|
|
8155
|
+
var setLngProps = function setLngProps(l) {
|
|
8156
|
+
_this4.language = l;
|
|
8157
|
+
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
8158
|
+
_this4.resolvedLanguage = undefined;
|
|
8159
|
+
_this4.setResolvedLanguage(l);
|
|
8160
|
+
};
|
|
8161
|
+
var done = function done(err, l) {
|
|
8162
|
+
if (l) {
|
|
8163
|
+
setLngProps(l);
|
|
8164
|
+
_this4.translator.changeLanguage(l);
|
|
8165
|
+
_this4.isLanguageChangingTo = undefined;
|
|
8166
|
+
_this4.emit('languageChanged', l);
|
|
8167
|
+
_this4.logger.log('languageChanged', l);
|
|
8168
|
+
} else {
|
|
8169
|
+
_this4.isLanguageChangingTo = undefined;
|
|
8170
|
+
}
|
|
8171
|
+
deferred.resolve(function () {
|
|
8172
|
+
return _this4.t.apply(_this4, arguments);
|
|
8173
|
+
});
|
|
8174
|
+
if (callback) callback(err, function () {
|
|
8175
|
+
return _this4.t.apply(_this4, arguments);
|
|
8176
|
+
});
|
|
8177
|
+
};
|
|
8178
|
+
var setLng = function setLng(lngs) {
|
|
8179
|
+
if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
|
|
8180
|
+
var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
8181
|
+
if (l) {
|
|
8182
|
+
if (!_this4.language) {
|
|
8183
|
+
setLngProps(l);
|
|
8184
|
+
}
|
|
8185
|
+
if (!_this4.translator.language) _this4.translator.changeLanguage(l);
|
|
8186
|
+
if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l);
|
|
8187
|
+
}
|
|
8188
|
+
_this4.loadResources(l, function (err) {
|
|
8189
|
+
done(err, l);
|
|
8190
|
+
});
|
|
8191
|
+
};
|
|
8192
|
+
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
8193
|
+
setLng(this.services.languageDetector.detect());
|
|
8194
|
+
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
8195
|
+
if (this.services.languageDetector.detect.length === 0) {
|
|
8196
|
+
this.services.languageDetector.detect().then(setLng);
|
|
8197
|
+
} else {
|
|
8198
|
+
this.services.languageDetector.detect(setLng);
|
|
8199
|
+
}
|
|
8200
|
+
} else {
|
|
8201
|
+
setLng(lng);
|
|
8202
|
+
}
|
|
8203
|
+
return deferred;
|
|
8204
|
+
}
|
|
8205
|
+
}, {
|
|
8206
|
+
key: "getFixedT",
|
|
8207
|
+
value: function getFixedT(lng, ns, keyPrefix) {
|
|
8208
|
+
var _this5 = this;
|
|
8209
|
+
var fixedT = function fixedT(key, opts) {
|
|
8210
|
+
var options;
|
|
8211
|
+
if (_typeof__default["default"](opts) !== 'object') {
|
|
8212
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
8213
|
+
rest[_key3 - 2] = arguments[_key3];
|
|
8214
|
+
}
|
|
8215
|
+
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
8216
|
+
} else {
|
|
8217
|
+
options = _objectSpread({}, opts);
|
|
8218
|
+
}
|
|
8219
|
+
options.lng = options.lng || fixedT.lng;
|
|
8220
|
+
options.lngs = options.lngs || fixedT.lngs;
|
|
8221
|
+
options.ns = options.ns || fixedT.ns;
|
|
8222
|
+
options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
8223
|
+
var keySeparator = _this5.options.keySeparator || '.';
|
|
8224
|
+
var resultKey;
|
|
8225
|
+
if (options.keyPrefix && Array.isArray(key)) {
|
|
8226
|
+
resultKey = key.map(function (k) {
|
|
8227
|
+
return ("").concat(options.keyPrefix).concat(keySeparator).concat(k);
|
|
8228
|
+
});
|
|
8229
|
+
} else {
|
|
8230
|
+
resultKey = options.keyPrefix ? ("").concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
|
|
8231
|
+
}
|
|
8232
|
+
return _this5.t(resultKey, options);
|
|
8233
|
+
};
|
|
8234
|
+
if (typeof lng === 'string') {
|
|
8235
|
+
fixedT.lng = lng;
|
|
8236
|
+
} else {
|
|
8237
|
+
fixedT.lngs = lng;
|
|
8238
|
+
}
|
|
8239
|
+
fixedT.ns = ns;
|
|
8240
|
+
fixedT.keyPrefix = keyPrefix;
|
|
8241
|
+
return fixedT;
|
|
8242
|
+
}
|
|
8243
|
+
}, {
|
|
8244
|
+
key: "t",
|
|
8245
|
+
value: function t() {
|
|
8246
|
+
var _this$translator;
|
|
8247
|
+
return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
|
|
8248
|
+
}
|
|
8249
|
+
}, {
|
|
8250
|
+
key: "exists",
|
|
8251
|
+
value: function exists() {
|
|
8252
|
+
var _this$translator2;
|
|
8253
|
+
return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
|
|
8254
|
+
}
|
|
8255
|
+
}, {
|
|
8256
|
+
key: "setDefaultNamespace",
|
|
8257
|
+
value: function setDefaultNamespace(ns) {
|
|
8258
|
+
this.options.defaultNS = ns;
|
|
8259
|
+
}
|
|
8260
|
+
}, {
|
|
8261
|
+
key: "hasLoadedNamespace",
|
|
8262
|
+
value: function hasLoadedNamespace(ns) {
|
|
8263
|
+
var _this6 = this;
|
|
8264
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8265
|
+
if (!this.isInitialized) {
|
|
8266
|
+
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
8267
|
+
return false;
|
|
8268
|
+
}
|
|
8269
|
+
if (!this.languages || !this.languages.length) {
|
|
8270
|
+
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
8271
|
+
return false;
|
|
8272
|
+
}
|
|
8273
|
+
var lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
8274
|
+
var fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
8275
|
+
var lastLng = this.languages[this.languages.length - 1];
|
|
8276
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
8277
|
+
var loadNotPending = function loadNotPending(l, n) {
|
|
8278
|
+
var loadState = _this6.services.backendConnector.state[("").concat(l, "|").concat(n)];
|
|
8279
|
+
return loadState === -1 || loadState === 2;
|
|
8280
|
+
};
|
|
8281
|
+
if (options.precheck) {
|
|
8282
|
+
var preResult = options.precheck(this, loadNotPending);
|
|
8283
|
+
if (preResult !== undefined) return preResult;
|
|
8284
|
+
}
|
|
8285
|
+
if (this.hasResourceBundle(lng, ns)) return true;
|
|
8286
|
+
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
8287
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
8288
|
+
return false;
|
|
8289
|
+
}
|
|
8290
|
+
}, {
|
|
8291
|
+
key: "loadNamespaces",
|
|
8292
|
+
value: function loadNamespaces(ns, callback) {
|
|
8293
|
+
var _this7 = this;
|
|
8294
|
+
var deferred = defer();
|
|
8295
|
+
if (!this.options.ns) {
|
|
8296
|
+
if (callback) callback();
|
|
8297
|
+
return Promise.resolve();
|
|
8298
|
+
}
|
|
8299
|
+
if (typeof ns === 'string') ns = [ns];
|
|
8300
|
+
ns.forEach(function (n) {
|
|
8301
|
+
if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
|
|
8302
|
+
});
|
|
8303
|
+
this.loadResources(function (err) {
|
|
8304
|
+
deferred.resolve();
|
|
8305
|
+
if (callback) callback(err);
|
|
8306
|
+
});
|
|
8307
|
+
return deferred;
|
|
8308
|
+
}
|
|
8309
|
+
}, {
|
|
8310
|
+
key: "loadLanguages",
|
|
8311
|
+
value: function loadLanguages(lngs, callback) {
|
|
8312
|
+
var deferred = defer();
|
|
8313
|
+
if (typeof lngs === 'string') lngs = [lngs];
|
|
8314
|
+
var preloaded = this.options.preload || [];
|
|
8315
|
+
var newLngs = lngs.filter(function (lng) {
|
|
8316
|
+
return preloaded.indexOf(lng) < 0;
|
|
8317
|
+
});
|
|
8318
|
+
if (!newLngs.length) {
|
|
8319
|
+
if (callback) callback();
|
|
8320
|
+
return Promise.resolve();
|
|
8321
|
+
}
|
|
8322
|
+
this.options.preload = preloaded.concat(newLngs);
|
|
8323
|
+
this.loadResources(function (err) {
|
|
8324
|
+
deferred.resolve();
|
|
8325
|
+
if (callback) callback(err);
|
|
8326
|
+
});
|
|
8327
|
+
return deferred;
|
|
8328
|
+
}
|
|
8329
|
+
}, {
|
|
8330
|
+
key: "dir",
|
|
8331
|
+
value: function dir(lng) {
|
|
8332
|
+
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
|
|
8333
|
+
if (!lng) return 'rtl';
|
|
8334
|
+
var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
|
|
8335
|
+
var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get());
|
|
8336
|
+
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
8337
|
+
}
|
|
8338
|
+
}, {
|
|
8339
|
+
key: "cloneInstance",
|
|
8340
|
+
value: function cloneInstance() {
|
|
8341
|
+
var _this8 = this;
|
|
8342
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8343
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
8344
|
+
var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, this.options), options), {
|
|
8345
|
+
isClone: true
|
|
8346
|
+
});
|
|
8347
|
+
var clone = new I18n(mergedOptions);
|
|
8348
|
+
if (options.debug !== undefined || options.prefix !== undefined) {
|
|
8349
|
+
clone.logger = clone.logger.clone(options);
|
|
8350
|
+
}
|
|
8351
|
+
var membersToCopy = ['store', 'services', 'language'];
|
|
8352
|
+
membersToCopy.forEach(function (m) {
|
|
8353
|
+
clone[m] = _this8[m];
|
|
8354
|
+
});
|
|
8355
|
+
clone.services = _objectSpread({}, this.services);
|
|
8356
|
+
clone.services.utils = {
|
|
8357
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
8358
|
+
};
|
|
8359
|
+
clone.translator = new Translator$1(clone.services, clone.options);
|
|
8360
|
+
clone.translator.on('*', function (event) {
|
|
8361
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
8362
|
+
args[_key4 - 1] = arguments[_key4];
|
|
8363
|
+
}
|
|
8364
|
+
clone.emit.apply(clone, [event].concat(args));
|
|
8365
|
+
});
|
|
8366
|
+
clone.init(mergedOptions, callback);
|
|
8367
|
+
clone.translator.options = clone.options;
|
|
8368
|
+
clone.translator.backendConnector.services.utils = {
|
|
8369
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
8370
|
+
};
|
|
8371
|
+
return clone;
|
|
8372
|
+
}
|
|
8373
|
+
}, {
|
|
8374
|
+
key: "toJSON",
|
|
8375
|
+
value: function toJSON() {
|
|
8376
|
+
return {
|
|
8377
|
+
options: this.options,
|
|
8378
|
+
store: this.store,
|
|
8379
|
+
language: this.language,
|
|
8380
|
+
languages: this.languages,
|
|
8381
|
+
resolvedLanguage: this.resolvedLanguage
|
|
8382
|
+
};
|
|
8383
|
+
}
|
|
8384
|
+
}]);
|
|
8385
|
+
return I18n;
|
|
8386
|
+
})(EventEmitter);
|
|
8387
|
+
_defineProperty__default["default"](I18n, "createInstance", function () {
|
|
8388
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8389
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
8390
|
+
return new I18n(options, callback);
|
|
8391
|
+
});
|
|
8392
|
+
var instance = I18n.createInstance();
|
|
8393
|
+
instance.createInstance = I18n.createInstance;
|
|
8394
|
+
var i18next = instance;
|
|
8395
|
+
var en = {};
|
|
8396
|
+
(function (exports) {
|
|
8397
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8398
|
+
value: true
|
|
8399
|
+
});
|
|
8400
|
+
exports["default"] = void 0;
|
|
8401
|
+
var _default = {
|
|
8402
|
+
translation: {
|
|
8403
|
+
categorize: {
|
|
8404
|
+
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
8405
|
+
maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
|
|
8406
|
+
},
|
|
8407
|
+
ebsr: {
|
|
8408
|
+
part: 'Part {{index}}'
|
|
8409
|
+
},
|
|
8410
|
+
numberLine: {
|
|
8411
|
+
addElementLimit_one: 'You can only add {{count}} element',
|
|
8412
|
+
addElementLimit_other: 'You can only add {{count}} elements',
|
|
8413
|
+
clearAll: 'Clear all'
|
|
8414
|
+
},
|
|
8415
|
+
imageClozeAssociation: {
|
|
8416
|
+
reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
|
|
8417
|
+
reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
|
|
8418
|
+
},
|
|
8419
|
+
drawingResponse: {
|
|
8420
|
+
fillColor: 'Fill color',
|
|
8421
|
+
outlineColor: 'Outline color',
|
|
8422
|
+
noFill: 'No fill',
|
|
8423
|
+
lightblue: 'Light blue',
|
|
8424
|
+
lightyellow: 'Light yellow',
|
|
8425
|
+
red: 'Red',
|
|
8426
|
+
orange: 'Orange',
|
|
8427
|
+
yellow: 'Yellow',
|
|
8428
|
+
violet: 'Violet',
|
|
8429
|
+
blue: 'Blue',
|
|
8430
|
+
green: 'Green',
|
|
8431
|
+
white: 'White',
|
|
8432
|
+
black: 'Black',
|
|
8433
|
+
onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
|
|
8434
|
+
},
|
|
8435
|
+
charting: {
|
|
8436
|
+
addCategory: 'Add category',
|
|
8437
|
+
newLabel: 'New label',
|
|
8438
|
+
reachedLimit_other: "There can't be more than {{count}} categories."
|
|
8439
|
+
},
|
|
8440
|
+
graphing: {
|
|
8441
|
+
point: 'Point',
|
|
8442
|
+
circle: 'Circle',
|
|
8443
|
+
line: 'Line',
|
|
8444
|
+
parabola: 'Parabola',
|
|
8445
|
+
absolute: 'Absolute Value',
|
|
8446
|
+
exponential: 'Exponential',
|
|
8447
|
+
polygon: 'Polygon',
|
|
8448
|
+
ray: 'Ray',
|
|
8449
|
+
segment: 'Segment',
|
|
8450
|
+
sine: 'Sine',
|
|
8451
|
+
vector: 'Vector',
|
|
8452
|
+
label: 'Label',
|
|
8453
|
+
redo: 'Redo',
|
|
8454
|
+
reset: 'Reset'
|
|
8455
|
+
},
|
|
8456
|
+
mathInline: {
|
|
8457
|
+
primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
|
|
8458
|
+
},
|
|
8459
|
+
selectText: {
|
|
8460
|
+
correctAnswerSelected: 'Correct answer selected',
|
|
8461
|
+
correctAnswerNotSelected: 'Correct answer not selected',
|
|
8462
|
+
incorrectSelection: 'Incorrect selection'
|
|
8463
|
+
}
|
|
8464
|
+
},
|
|
8465
|
+
common: {
|
|
8466
|
+
undo: 'Undo',
|
|
8467
|
+
clearAll: 'Clear all',
|
|
8468
|
+
correct: 'Correct',
|
|
8469
|
+
incorrect: 'Incorrect',
|
|
8470
|
+
showCorrectAnswer: 'Show correct answer',
|
|
8471
|
+
hideCorrectAnswer: 'Hide correct answer',
|
|
8472
|
+
commonCorrectAnswerWithAlternates: 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
|
|
8473
|
+
warning: 'Warning',
|
|
8474
|
+
showNote: 'Show Note',
|
|
8475
|
+
hideNote: 'Hide Note',
|
|
8476
|
+
cancel: 'Cancel'
|
|
8477
|
+
}
|
|
8478
|
+
};
|
|
8479
|
+
exports["default"] = _default;
|
|
8480
|
+
})(en);
|
|
8481
|
+
getDefaultExportFromCjs(en);
|
|
8482
|
+
var es = {};
|
|
8483
|
+
(function (exports) {
|
|
8484
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8485
|
+
value: true
|
|
8486
|
+
});
|
|
8487
|
+
exports["default"] = void 0;
|
|
8488
|
+
var _default = {
|
|
8489
|
+
translation: {
|
|
8490
|
+
categorize: {
|
|
8491
|
+
limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
8492
|
+
maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
|
|
8493
|
+
},
|
|
8494
|
+
ebsr: {
|
|
8495
|
+
part: 'Parte {{index}}'
|
|
8496
|
+
},
|
|
8497
|
+
numberLine: {
|
|
8498
|
+
addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
|
|
8499
|
+
addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
|
|
8500
|
+
clearAll: 'Borrar todo'
|
|
8501
|
+
},
|
|
8502
|
+
imageClozeAssociation: {
|
|
8503
|
+
reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
8504
|
+
reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
|
|
8505
|
+
},
|
|
8506
|
+
drawingResponse: {
|
|
8507
|
+
fillColor: 'Color de relleno',
|
|
8508
|
+
outlineColor: 'Color del contorno',
|
|
8509
|
+
noFill: 'Sin relleno',
|
|
8510
|
+
lightblue: 'Azul claro',
|
|
8511
|
+
lightyellow: 'Amarillo claro',
|
|
8512
|
+
red: 'Rojo',
|
|
8513
|
+
orange: 'Naranja',
|
|
8514
|
+
yellow: 'Amarillo',
|
|
8515
|
+
violet: 'Violeta',
|
|
8516
|
+
blue: 'Azul',
|
|
8517
|
+
green: 'Verde',
|
|
8518
|
+
white: 'Blanco',
|
|
8519
|
+
black: 'Negro',
|
|
8520
|
+
onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
|
|
8521
|
+
},
|
|
8522
|
+
charting: {
|
|
8523
|
+
addCategory: 'Añadir categoría',
|
|
8524
|
+
newLabel: 'Nueva etiqueta',
|
|
8525
|
+
reachedLimit_other: 'No puede haber más de {{count}} categorías.'
|
|
8526
|
+
},
|
|
8527
|
+
graphing: {
|
|
8528
|
+
point: 'Punto',
|
|
8529
|
+
circle: 'Circulo',
|
|
8530
|
+
line: 'Línea',
|
|
8531
|
+
parabola: 'Parábola',
|
|
8532
|
+
absolute: 'Valor absoluto',
|
|
8533
|
+
exponential: 'Exponencial',
|
|
8534
|
+
polygon: 'Polígono',
|
|
8535
|
+
ray: 'Semirrecta',
|
|
8536
|
+
segment: 'Segmento ',
|
|
8537
|
+
sine: 'Seno',
|
|
8538
|
+
vector: 'Vector',
|
|
8539
|
+
label: 'Etiqueta',
|
|
8540
|
+
redo: 'Rehacer',
|
|
8541
|
+
reset: 'Reiniciar'
|
|
8542
|
+
},
|
|
8543
|
+
mathInline: {
|
|
8544
|
+
primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
|
|
8545
|
+
},
|
|
8546
|
+
selectText: {
|
|
8547
|
+
correctAnswerSelected: 'Respuesta correcta seleccionada',
|
|
8548
|
+
correctAnswerNotSelected: 'Respuesta correcta no seleccionada',
|
|
8549
|
+
incorrectSelection: 'Selección incorrecta'
|
|
8550
|
+
}
|
|
8551
|
+
},
|
|
8552
|
+
common: {
|
|
8553
|
+
undo: 'Deshacer',
|
|
8554
|
+
clearAll: 'Borrar todo',
|
|
8555
|
+
correct: 'Correct',
|
|
8556
|
+
incorrect: 'Incorrect',
|
|
8557
|
+
showCorrectAnswer: 'Mostrar respuesta correcta',
|
|
8558
|
+
hideCorrectAnswer: 'Ocultar respuesta correcta',
|
|
8559
|
+
commonCorrectAnswerWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
|
|
8560
|
+
warning: 'Advertencia',
|
|
8561
|
+
showNote: 'Mostrar Nota',
|
|
8562
|
+
hideNote: 'Ocultar Nota',
|
|
8563
|
+
cancel: 'Cancelar'
|
|
8564
|
+
}
|
|
8565
|
+
};
|
|
8566
|
+
exports["default"] = _default;
|
|
8567
|
+
})(es);
|
|
8568
|
+
getDefaultExportFromCjs(es);
|
|
8569
|
+
(function (exports) {
|
|
8570
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
8571
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8572
|
+
value: true
|
|
8573
|
+
});
|
|
8574
|
+
exports["default"] = void 0;
|
|
8575
|
+
var _defineProperty2 = _interopRequireDefault(defineProperty$2.exports);
|
|
8576
|
+
var _i18next = _interopRequireDefault(i18next);
|
|
8577
|
+
var _en = _interopRequireDefault(en);
|
|
8578
|
+
var _es = _interopRequireDefault(es);
|
|
8579
|
+
function ownKeys(object, enumerableOnly) {
|
|
8580
|
+
var keys = Object.keys(object);
|
|
8581
|
+
if (Object.getOwnPropertySymbols) {
|
|
8582
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8583
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
8584
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
8585
|
+
})), keys.push.apply(keys, symbols));
|
|
8586
|
+
}
|
|
8587
|
+
return keys;
|
|
8588
|
+
}
|
|
8589
|
+
function _objectSpread(target) {
|
|
8590
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8591
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
8592
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
8593
|
+
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
8594
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
8595
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8596
|
+
});
|
|
8597
|
+
}
|
|
8598
|
+
return target;
|
|
8599
|
+
}
|
|
8600
|
+
_i18next["default"].init({
|
|
8601
|
+
fallbackLng: "en",
|
|
8602
|
+
lng: "en",
|
|
8603
|
+
debug: true,
|
|
8604
|
+
resources: {
|
|
8605
|
+
en: _en["default"],
|
|
8606
|
+
es: _es["default"]
|
|
8607
|
+
}
|
|
8608
|
+
});
|
|
8609
|
+
var _default = {
|
|
8610
|
+
translator: _objectSpread(_objectSpread({}, _i18next["default"]), {}, {
|
|
8611
|
+
t: function t(key, options) {
|
|
8612
|
+
var lng = options.lng;
|
|
8613
|
+
switch (lng) {
|
|
8614
|
+
case "en_US":
|
|
8615
|
+
case "en-US":
|
|
8616
|
+
options.lng = "en";
|
|
8617
|
+
break;
|
|
8618
|
+
case "es_ES":
|
|
8619
|
+
case "es-ES":
|
|
8620
|
+
case "es_MX":
|
|
8621
|
+
case "es-MX":
|
|
8622
|
+
options.lng = "es";
|
|
8623
|
+
break;
|
|
8624
|
+
}
|
|
8625
|
+
return _i18next["default"].t(key, _objectSpread({
|
|
8626
|
+
lng: lng
|
|
8627
|
+
}, options));
|
|
8628
|
+
}
|
|
8629
|
+
}),
|
|
8630
|
+
languageOptions: [{
|
|
8631
|
+
value: "en_US",
|
|
8632
|
+
label: "English (US)"
|
|
8633
|
+
}, {
|
|
8634
|
+
value: "es_ES",
|
|
8635
|
+
label: "Spanish"
|
|
8636
|
+
}]
|
|
8637
|
+
};
|
|
8638
|
+
exports["default"] = _default;
|
|
8639
|
+
})(translator$1);
|
|
8640
|
+
getDefaultExportFromCjs(translator$1);
|
|
8641
|
+
(function (exports) {
|
|
8642
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
8643
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8644
|
+
value: true
|
|
8645
|
+
});
|
|
8646
|
+
Object.defineProperty(exports, "Translator", {
|
|
8647
|
+
enumerable: true,
|
|
8648
|
+
get: function get() {
|
|
8649
|
+
return _translator["default"];
|
|
8650
|
+
}
|
|
8651
|
+
});
|
|
8652
|
+
exports["default"] = void 0;
|
|
8653
|
+
var _translator = _interopRequireDefault(translator$1);
|
|
8654
|
+
var _default = _translator["default"];
|
|
8655
|
+
exports["default"] = _default;
|
|
8656
|
+
})(translator$2);
|
|
8657
|
+
var Translator = getDefaultExportFromCjs(translator$2);
|
|
8658
|
+
var FormControlLabel$3 = {};
|
|
8659
|
+
var FormControlLabel$2 = {};
|
|
8660
|
+
var withFormControlContext$1 = {};
|
|
8661
|
+
var FormControlContext$1 = {};
|
|
8662
|
+
const require$$1$8 = _dll_react;
|
|
8663
|
+
var _interopRequireDefault$s = interopRequireDefault.exports;
|
|
8664
|
+
Object.defineProperty(FormControlContext$1, "__esModule", {
|
|
8665
|
+
value: true
|
|
8666
|
+
});
|
|
8667
|
+
FormControlContext$1.default = void 0;
|
|
8668
|
+
var _react$k = _interopRequireDefault$s(require$$1$8);
|
|
8669
|
+
var FormControlContext = _react$k.default.createContext();
|
|
8670
|
+
var _default$r = FormControlContext;
|
|
8671
|
+
FormControlContext$1.default = _default$r;
|
|
8672
|
+
const require$$2$3 = _dll_react;
|
|
8673
|
+
var _interopRequireDefault$r = interopRequireDefault.exports;
|
|
8674
|
+
Object.defineProperty(withFormControlContext$1, "__esModule", {
|
|
8675
|
+
value: true
|
|
8676
|
+
});
|
|
8677
|
+
withFormControlContext$1.default = withFormControlContext;
|
|
8678
|
+
var _extends2$a = _interopRequireDefault$r(_extends$1.exports);
|
|
8679
|
+
var _react$j = _interopRequireDefault$r(require$$2$3);
|
|
8680
|
+
var _hoistNonReactStatics = _interopRequireDefault$r(hoistNonReactStatics_cjs);
|
|
8681
|
+
var _FormControlContext = _interopRequireDefault$r(FormControlContext$1);
|
|
8682
|
+
var _utils$5 = require$$7$1;
|
|
8683
|
+
function withFormControlContext(Component) {
|
|
8684
|
+
var EnhancedComponent = function EnhancedComponent(props) {
|
|
8685
|
+
return _react$j.default.createElement(_FormControlContext.default.Consumer, null, function (context) {
|
|
8686
|
+
return _react$j.default.createElement(Component, (0, _extends2$a.default)({
|
|
8687
|
+
muiFormControl: context
|
|
8688
|
+
}, props));
|
|
8689
|
+
});
|
|
8690
|
+
};
|
|
8691
|
+
{
|
|
8692
|
+
EnhancedComponent.displayName = ("WithFormControlContext(").concat((0, _utils$5.getDisplayName)(Component), ")");
|
|
8693
|
+
}
|
|
8694
|
+
(0, _hoistNonReactStatics.default)(EnhancedComponent, Component);
|
|
8695
|
+
return EnhancedComponent;
|
|
8696
|
+
}
|
|
8697
|
+
var Typography$2 = {};
|
|
8698
|
+
var Typography$1 = {};
|
|
8699
|
+
var helpers = {};
|
|
8700
|
+
var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
8701
|
+
Object.defineProperty(helpers, "__esModule", {
|
|
8702
|
+
value: true
|
|
8703
|
+
});
|
|
8704
|
+
helpers.capitalize = capitalize;
|
|
8705
|
+
helpers.contains = contains;
|
|
8706
|
+
helpers.findIndex = findIndex;
|
|
8707
|
+
helpers.find = find;
|
|
8708
|
+
helpers.createChainedFunction = createChainedFunction;
|
|
8709
|
+
var _typeof2 = _interopRequireDefault$q(_typeof$3.exports);
|
|
8710
|
+
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
8711
|
+
function capitalize(string) {
|
|
8712
|
+
if (typeof string !== 'string') {
|
|
8713
|
+
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
8714
|
+
}
|
|
8715
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
8716
|
+
}
|
|
8717
|
+
function contains(obj, pred) {
|
|
8718
|
+
return Object.keys(pred).every(function (key) {
|
|
8719
|
+
return obj.hasOwnProperty(key) && obj[key] === pred[key];
|
|
8720
|
+
});
|
|
8721
|
+
}
|
|
8722
|
+
function findIndex(arr, pred) {
|
|
8723
|
+
var predType = (0, _typeof2.default)(pred);
|
|
8724
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
8725
|
+
if (predType === 'function' && !!pred(arr[i], i, arr) === true) {
|
|
8726
|
+
return i;
|
|
8727
|
+
}
|
|
8728
|
+
if (predType === 'object' && contains(arr[i], pred)) {
|
|
8729
|
+
return i;
|
|
8730
|
+
}
|
|
8731
|
+
if (['string', 'number', 'boolean'].indexOf(predType) !== -1) {
|
|
8732
|
+
return arr.indexOf(pred);
|
|
8733
|
+
}
|
|
8734
|
+
}
|
|
8735
|
+
return -1;
|
|
8736
|
+
}
|
|
8737
|
+
function find(arr, pred) {
|
|
8738
|
+
var index = findIndex(arr, pred);
|
|
8739
|
+
return index > -1 ? arr[index] : undefined;
|
|
8740
|
+
}
|
|
8741
|
+
function createChainedFunction() {
|
|
8742
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8743
|
+
funcs[_key] = arguments[_key];
|
|
8744
|
+
}
|
|
8745
|
+
return funcs.reduce(function (acc, func) {
|
|
8746
|
+
if (func == null) {
|
|
8747
|
+
return acc;
|
|
8748
|
+
}
|
|
8749
|
+
(0, _warning$1.default)(typeof func === 'function', 'Material-UI: invalid Argument Type, must only provide functions, undefined, or null.');
|
|
8750
|
+
return function chainedFunction() {
|
|
8751
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
8752
|
+
args[_key2] = arguments[_key2];
|
|
8753
|
+
}
|
|
8754
|
+
acc.apply(this, args);
|
|
8755
|
+
func.apply(this, args);
|
|
8756
|
+
};
|
|
8757
|
+
}, function () {});
|
|
8758
|
+
}
|
|
8759
|
+
const require$$4$5 = _dll_react;
|
|
8760
|
+
const require$$5$5 = _dll_prop_types;
|
|
8761
|
+
const require$$6$5 = _dll_classnames;
|
|
8762
|
+
var _interopRequireDefault$p = interopRequireDefault.exports;
|
|
8763
|
+
Object.defineProperty(Typography$1, "__esModule", {
|
|
8764
|
+
value: true
|
|
8765
|
+
});
|
|
8766
|
+
Typography$1.default = Typography$1.styles = void 0;
|
|
8767
|
+
var _extends2$9 = _interopRequireDefault$p(_extends$1.exports);
|
|
8768
|
+
var _defineProperty2$7 = _interopRequireDefault$p(defineProperty$2.exports);
|
|
8769
|
+
var _objectWithoutProperties2$9 = _interopRequireDefault$p(objectWithoutProperties.exports);
|
|
8770
|
+
var _react$i = _interopRequireDefault$p(require$$4$5);
|
|
8771
|
+
var _propTypes$b = _interopRequireDefault$p(require$$5$5);
|
|
8772
|
+
var _classnames$9 = _interopRequireDefault$p(require$$6$5);
|
|
8773
|
+
var _utils$4 = require$$7$1;
|
|
8774
|
+
var _withStyles$8 = _interopRequireDefault$p(withStyles);
|
|
8775
|
+
var _helpers$5 = helpers;
|
|
8776
|
+
var styles$a = function styles(theme) {
|
|
8777
|
+
return {
|
|
8778
|
+
root: {
|
|
8779
|
+
display: 'block',
|
|
8780
|
+
margin: 0
|
|
8781
|
+
},
|
|
8782
|
+
display4: theme.typography.display4,
|
|
8783
|
+
display3: theme.typography.display3,
|
|
8784
|
+
display2: theme.typography.display2,
|
|
8785
|
+
display1: theme.typography.display1,
|
|
8786
|
+
headline: theme.typography.headline,
|
|
8787
|
+
title: theme.typography.title,
|
|
8788
|
+
subheading: theme.typography.subheading,
|
|
8789
|
+
body2: theme.typography.body2,
|
|
8790
|
+
body1: theme.typography.body1,
|
|
8791
|
+
caption: theme.typography.caption,
|
|
8792
|
+
button: theme.typography.button,
|
|
8793
|
+
h1: theme.typography.h1,
|
|
8794
|
+
h2: theme.typography.h2,
|
|
8795
|
+
h3: theme.typography.h3,
|
|
8796
|
+
h4: theme.typography.h4,
|
|
8797
|
+
h5: theme.typography.h5,
|
|
8798
|
+
h6: theme.typography.h6,
|
|
8799
|
+
subtitle1: theme.typography.subtitle1,
|
|
8800
|
+
subtitle2: theme.typography.subtitle2,
|
|
8801
|
+
overline: theme.typography.overline,
|
|
8802
|
+
srOnly: {
|
|
8803
|
+
position: 'absolute',
|
|
8804
|
+
height: 1,
|
|
8805
|
+
width: 1,
|
|
5574
8806
|
overflow: 'hidden'
|
|
5575
8807
|
},
|
|
5576
8808
|
alignLeft: {
|
|
@@ -5730,7 +8962,7 @@ Object.defineProperty(FormControlLabel$2, "__esModule", {
|
|
|
5730
8962
|
});
|
|
5731
8963
|
FormControlLabel$2.default = FormControlLabel$2.styles = void 0;
|
|
5732
8964
|
var _extends2$8 = _interopRequireDefault$o(_extends$1.exports);
|
|
5733
|
-
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$
|
|
8965
|
+
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$2.exports);
|
|
5734
8966
|
var _objectWithoutProperties2$8 = _interopRequireDefault$o(objectWithoutProperties.exports);
|
|
5735
8967
|
var _react$h = _interopRequireDefault$o(require$$4$4);
|
|
5736
8968
|
var _propTypes$a = _interopRequireDefault$o(require$$5$4);
|
|
@@ -5882,11 +9114,11 @@ Object.defineProperty(NoSsr$1, "__esModule", {
|
|
|
5882
9114
|
value: true
|
|
5883
9115
|
});
|
|
5884
9116
|
NoSsr$1.default = void 0;
|
|
5885
|
-
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck.exports);
|
|
5886
|
-
var _createClass2$4 = _interopRequireDefault$m(createClass.exports);
|
|
5887
|
-
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn.exports);
|
|
5888
|
-
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$
|
|
5889
|
-
var _inherits2$4 = _interopRequireDefault$m(inherits.exports);
|
|
9117
|
+
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck$1.exports);
|
|
9118
|
+
var _createClass2$4 = _interopRequireDefault$m(createClass$1.exports);
|
|
9119
|
+
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn$1.exports);
|
|
9120
|
+
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$2.exports);
|
|
9121
|
+
var _inherits2$4 = _interopRequireDefault$m(inherits$1.exports);
|
|
5890
9122
|
var _react$g = _interopRequireDefault$m(require$$6$3);
|
|
5891
9123
|
var _propTypes$9 = _interopRequireDefault$m(require$$7);
|
|
5892
9124
|
var _utils$3 = require$$7$1;
|
|
@@ -6797,13 +10029,13 @@ Object.defineProperty(Ripple$1, "__esModule", {
|
|
|
6797
10029
|
});
|
|
6798
10030
|
Ripple$1.default = void 0;
|
|
6799
10031
|
var _extends2$7 = _interopRequireDefault$i(_extends$1.exports);
|
|
6800
|
-
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$
|
|
10032
|
+
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$2.exports);
|
|
6801
10033
|
var _objectWithoutProperties2$7 = _interopRequireDefault$i(objectWithoutProperties.exports);
|
|
6802
|
-
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck.exports);
|
|
6803
|
-
var _createClass2$3 = _interopRequireDefault$i(createClass.exports);
|
|
6804
|
-
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn.exports);
|
|
6805
|
-
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$
|
|
6806
|
-
var _inherits2$3 = _interopRequireDefault$i(inherits.exports);
|
|
10034
|
+
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck$1.exports);
|
|
10035
|
+
var _createClass2$3 = _interopRequireDefault$i(createClass$1.exports);
|
|
10036
|
+
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn$1.exports);
|
|
10037
|
+
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$2.exports);
|
|
10038
|
+
var _inherits2$3 = _interopRequireDefault$i(inherits$1.exports);
|
|
6807
10039
|
var _react$d = _interopRequireDefault$i(require$$9$1);
|
|
6808
10040
|
var _propTypes$7 = _interopRequireDefault$i(require$$10$3);
|
|
6809
10041
|
var _classnames$7 = _interopRequireDefault$i(require$$11$3);
|
|
@@ -6886,12 +10118,12 @@ TouchRipple$1.default = TouchRipple$1.styles = TouchRipple$1.DELAY_RIPPLE = void
|
|
|
6886
10118
|
var _extends2$6 = _interopRequireDefault$h(_extends$1.exports);
|
|
6887
10119
|
var _objectWithoutProperties2$6 = _interopRequireDefault$h(objectWithoutProperties.exports);
|
|
6888
10120
|
var _toConsumableArray2 = _interopRequireDefault$h(toConsumableArray.exports);
|
|
6889
|
-
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck.exports);
|
|
6890
|
-
var _createClass2$2 = _interopRequireDefault$h(createClass.exports);
|
|
6891
|
-
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn.exports);
|
|
6892
|
-
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$
|
|
6893
|
-
var _inherits2$2 = _interopRequireDefault$h(inherits.exports);
|
|
6894
|
-
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized.exports);
|
|
10121
|
+
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck$1.exports);
|
|
10122
|
+
var _createClass2$2 = _interopRequireDefault$h(createClass$1.exports);
|
|
10123
|
+
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn$1.exports);
|
|
10124
|
+
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$2.exports);
|
|
10125
|
+
var _inherits2$2 = _interopRequireDefault$h(inherits$1.exports);
|
|
10126
|
+
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized$1.exports);
|
|
6895
10127
|
var _react$c = _interopRequireDefault$h(require$$10$2);
|
|
6896
10128
|
var _propTypes$6 = _interopRequireDefault$h(require$$11$2);
|
|
6897
10129
|
var _reactDom$1 = _interopRequireDefault$h(require$$12$1);
|
|
@@ -7189,14 +10421,14 @@ Object.defineProperty(ButtonBase$1, "__esModule", {
|
|
|
7189
10421
|
});
|
|
7190
10422
|
ButtonBase$1.default = ButtonBase$1.styles = void 0;
|
|
7191
10423
|
var _extends2$5 = _interopRequireDefault$g(_extends$1.exports);
|
|
7192
|
-
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$
|
|
10424
|
+
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$2.exports);
|
|
7193
10425
|
var _objectWithoutProperties2$5 = _interopRequireDefault$g(objectWithoutProperties.exports);
|
|
7194
|
-
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck.exports);
|
|
7195
|
-
var _createClass2$1 = _interopRequireDefault$g(createClass.exports);
|
|
7196
|
-
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn.exports);
|
|
7197
|
-
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$
|
|
7198
|
-
var _inherits2$1 = _interopRequireDefault$g(inherits.exports);
|
|
7199
|
-
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized.exports);
|
|
10426
|
+
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck$1.exports);
|
|
10427
|
+
var _createClass2$1 = _interopRequireDefault$g(createClass$1.exports);
|
|
10428
|
+
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn$1.exports);
|
|
10429
|
+
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$2.exports);
|
|
10430
|
+
var _inherits2$1 = _interopRequireDefault$g(inherits$1.exports);
|
|
10431
|
+
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized$1.exports);
|
|
7200
10432
|
var _react$b = _interopRequireDefault$g(require$$10$1);
|
|
7201
10433
|
var _propTypes$5 = _interopRequireDefault$g(require$$11$1);
|
|
7202
10434
|
var _reactDom = _interopRequireDefault$g(require$$12);
|
|
@@ -7514,7 +10746,7 @@ Object.defineProperty(IconButton$1, "__esModule", {
|
|
|
7514
10746
|
});
|
|
7515
10747
|
IconButton$1.default = IconButton$1.styles = void 0;
|
|
7516
10748
|
var _extends2$4 = _interopRequireDefault$f(_extends$1.exports);
|
|
7517
|
-
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$
|
|
10749
|
+
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$2.exports);
|
|
7518
10750
|
var _objectWithoutProperties2$4 = _interopRequireDefault$f(objectWithoutProperties.exports);
|
|
7519
10751
|
var _react$a = _interopRequireDefault$f(require$$4$3);
|
|
7520
10752
|
var _propTypes$4 = _interopRequireDefault$f(require$$5$3);
|
|
@@ -7640,13 +10872,13 @@ Object.defineProperty(SwitchBase$1, "__esModule", {
|
|
|
7640
10872
|
});
|
|
7641
10873
|
SwitchBase$1.default = SwitchBase$1.styles = void 0;
|
|
7642
10874
|
var _extends2$3 = _interopRequireDefault$e(_extends$1.exports);
|
|
7643
|
-
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$
|
|
10875
|
+
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$2.exports);
|
|
7644
10876
|
var _objectWithoutProperties2$3 = _interopRequireDefault$e(objectWithoutProperties.exports);
|
|
7645
|
-
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck.exports);
|
|
7646
|
-
var _createClass2 = _interopRequireDefault$e(createClass.exports);
|
|
7647
|
-
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn.exports);
|
|
7648
|
-
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$
|
|
7649
|
-
var _inherits2 = _interopRequireDefault$e(inherits.exports);
|
|
10877
|
+
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck$1.exports);
|
|
10878
|
+
var _createClass2 = _interopRequireDefault$e(createClass$1.exports);
|
|
10879
|
+
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn$1.exports);
|
|
10880
|
+
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$2.exports);
|
|
10881
|
+
var _inherits2 = _interopRequireDefault$e(inherits$1.exports);
|
|
7650
10882
|
var _react$9 = _interopRequireDefault$e(require$$9);
|
|
7651
10883
|
var _propTypes$3 = _interopRequireDefault$e(require$$10);
|
|
7652
10884
|
var _classnames$3 = _interopRequireDefault$e(require$$11);
|
|
@@ -7799,11 +11031,11 @@ var inheritsLoose = {
|
|
|
7799
11031
|
exports: {}
|
|
7800
11032
|
};
|
|
7801
11033
|
(function (module) {
|
|
7802
|
-
var setPrototypeOf
|
|
11034
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
7803
11035
|
function _inheritsLoose(subClass, superClass) {
|
|
7804
11036
|
subClass.prototype = Object.create(superClass.prototype);
|
|
7805
11037
|
subClass.prototype.constructor = subClass;
|
|
7806
|
-
setPrototypeOf
|
|
11038
|
+
setPrototypeOf(subClass, superClass);
|
|
7807
11039
|
}
|
|
7808
11040
|
(module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
7809
11041
|
})(inheritsLoose);
|
|
@@ -7948,7 +11180,7 @@ Object.defineProperty(SvgIcon$1, "__esModule", {
|
|
|
7948
11180
|
});
|
|
7949
11181
|
SvgIcon$1.default = SvgIcon$1.styles = void 0;
|
|
7950
11182
|
var _extends2$2 = _interopRequireDefault$8(_extends$1.exports);
|
|
7951
|
-
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$
|
|
11183
|
+
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$2.exports);
|
|
7952
11184
|
var _objectWithoutProperties2$2 = _interopRequireDefault$8(objectWithoutProperties.exports);
|
|
7953
11185
|
var _react$7 = _interopRequireDefault$8(require$$4$2);
|
|
7954
11186
|
var _propTypes$2 = _interopRequireDefault$8(require$$5$2);
|
|
@@ -8114,7 +11346,7 @@ Object.defineProperty(Checkbox$2, "__esModule", {
|
|
|
8114
11346
|
});
|
|
8115
11347
|
Checkbox$2.default = Checkbox$2.styles = void 0;
|
|
8116
11348
|
var _extends2$1 = _interopRequireDefault$4(_extends$1.exports);
|
|
8117
|
-
var _defineProperty2 = _interopRequireDefault$4(defineProperty$
|
|
11349
|
+
var _defineProperty2 = _interopRequireDefault$4(defineProperty$2.exports);
|
|
8118
11350
|
var _objectWithoutProperties2$1 = _interopRequireDefault$4(objectWithoutProperties.exports);
|
|
8119
11351
|
var _react$3 = _interopRequireDefault$4(require$$4$1);
|
|
8120
11352
|
var _propTypes$1 = _interopRequireDefault$4(require$$5$1);
|
|
@@ -9003,7 +12235,7 @@ const StyledCheckbox = styles$b.withStyles(inputStyles)(props => {
|
|
|
9003
12235
|
__self: undefined,
|
|
9004
12236
|
__source: {
|
|
9005
12237
|
fileName: _jsxFileName$3,
|
|
9006
|
-
lineNumber:
|
|
12238
|
+
lineNumber: 116
|
|
9007
12239
|
}
|
|
9008
12240
|
});
|
|
9009
12241
|
});
|
|
@@ -9035,7 +12267,7 @@ const StyledRadio = styles$b.withStyles(inputStyles)(props => {
|
|
|
9035
12267
|
__self: undefined,
|
|
9036
12268
|
__source: {
|
|
9037
12269
|
fileName: _jsxFileName$3,
|
|
9038
|
-
lineNumber:
|
|
12270
|
+
lineNumber: 144
|
|
9039
12271
|
}
|
|
9040
12272
|
});
|
|
9041
12273
|
});
|
|
@@ -9058,7 +12290,6 @@ class ChoiceInput extends React$4.Component {
|
|
|
9058
12290
|
hideTick: PropTypes$3.bool,
|
|
9059
12291
|
isEvaluateMode: PropTypes$3.bool,
|
|
9060
12292
|
choicesLayout: PropTypes$3.oneOf(['vertical', 'grid', 'horizontal']),
|
|
9061
|
-
updateSession: PropTypes$3.func,
|
|
9062
12293
|
isSelectionButtonBelow: PropTypes$3.bool
|
|
9063
12294
|
};
|
|
9064
12295
|
}
|
|
@@ -9077,10 +12308,6 @@ class ChoiceInput extends React$4.Component {
|
|
|
9077
12308
|
}
|
|
9078
12309
|
onToggleChoice(event) {
|
|
9079
12310
|
this.props.onChange(event);
|
|
9080
|
-
this.props.updateSession({
|
|
9081
|
-
value: this.props.value,
|
|
9082
|
-
selected: !this.props.checked
|
|
9083
|
-
});
|
|
9084
12311
|
}
|
|
9085
12312
|
generateChoiceId() {
|
|
9086
12313
|
return 'choice-' + (Math.random() * 10000).toFixed();
|
|
@@ -9099,7 +12326,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9099
12326
|
__self: this,
|
|
9100
12327
|
__source: {
|
|
9101
12328
|
fileName: _jsxFileName$3,
|
|
9102
|
-
lineNumber:
|
|
12329
|
+
lineNumber: 233
|
|
9103
12330
|
}
|
|
9104
12331
|
}, displayKey, ".", '\u00A0', React$4.createElement(PreviewPrompt$1, {
|
|
9105
12332
|
className: "label",
|
|
@@ -9108,7 +12335,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9108
12335
|
__self: this,
|
|
9109
12336
|
__source: {
|
|
9110
12337
|
fileName: _jsxFileName$3,
|
|
9111
|
-
lineNumber:
|
|
12338
|
+
lineNumber: 235
|
|
9112
12339
|
}
|
|
9113
12340
|
})) : React$4.createElement(PreviewPrompt$1, {
|
|
9114
12341
|
className: "label",
|
|
@@ -9117,7 +12344,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9117
12344
|
__self: this,
|
|
9118
12345
|
__source: {
|
|
9119
12346
|
fileName: _jsxFileName$3,
|
|
9120
|
-
lineNumber:
|
|
12347
|
+
lineNumber: 238
|
|
9121
12348
|
}
|
|
9122
12349
|
}));
|
|
9123
12350
|
return React$4.createElement('div', {
|
|
@@ -9125,28 +12352,28 @@ class ChoiceInput extends React$4.Component {
|
|
|
9125
12352
|
__self: this,
|
|
9126
12353
|
__source: {
|
|
9127
12354
|
fileName: _jsxFileName$3,
|
|
9128
|
-
lineNumber:
|
|
12355
|
+
lineNumber: 244
|
|
9129
12356
|
}
|
|
9130
12357
|
}, React$4.createElement('div', {
|
|
9131
12358
|
className: classes.row,
|
|
9132
12359
|
__self: this,
|
|
9133
12360
|
__source: {
|
|
9134
12361
|
fileName: _jsxFileName$3,
|
|
9135
|
-
lineNumber:
|
|
12362
|
+
lineNumber: 245
|
|
9136
12363
|
}
|
|
9137
12364
|
}, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
|
|
9138
12365
|
correctness: correctness,
|
|
9139
12366
|
__self: this,
|
|
9140
12367
|
__source: {
|
|
9141
12368
|
fileName: _jsxFileName$3,
|
|
9142
|
-
lineNumber:
|
|
12369
|
+
lineNumber: 246
|
|
9143
12370
|
}
|
|
9144
12371
|
}), React$4.createElement('div', {
|
|
9145
12372
|
className: classNames$2(holderClassNames, 'checkbox-holder'),
|
|
9146
12373
|
__self: this,
|
|
9147
12374
|
__source: {
|
|
9148
12375
|
fileName: _jsxFileName$3,
|
|
9149
|
-
lineNumber:
|
|
12376
|
+
lineNumber: 247
|
|
9150
12377
|
}
|
|
9151
12378
|
}, isSelectionButtonBelow ? React$4.createElement(StyledFormControlLabel, {
|
|
9152
12379
|
label: choicelabel,
|
|
@@ -9158,7 +12385,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9158
12385
|
__self: this,
|
|
9159
12386
|
__source: {
|
|
9160
12387
|
fileName: _jsxFileName$3,
|
|
9161
|
-
lineNumber:
|
|
12388
|
+
lineNumber: 255
|
|
9162
12389
|
}
|
|
9163
12390
|
}, React$4.createElement(Tag, {
|
|
9164
12391
|
accessibility: accessibility,
|
|
@@ -9174,13 +12401,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
9174
12401
|
__self: this,
|
|
9175
12402
|
__source: {
|
|
9176
12403
|
fileName: _jsxFileName$3,
|
|
9177
|
-
lineNumber:
|
|
12404
|
+
lineNumber: 256
|
|
9178
12405
|
}
|
|
9179
12406
|
}), displayKey, "."),
|
|
9180
12407
|
__self: this,
|
|
9181
12408
|
__source: {
|
|
9182
12409
|
fileName: _jsxFileName$3,
|
|
9183
|
-
lineNumber:
|
|
12410
|
+
lineNumber: 249
|
|
9184
12411
|
}
|
|
9185
12412
|
}) : React$4.createElement(StyledFormControlLabel, {
|
|
9186
12413
|
label: choicelabel,
|
|
@@ -9197,13 +12424,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
9197
12424
|
__self: this,
|
|
9198
12425
|
__source: {
|
|
9199
12426
|
fileName: _jsxFileName$3,
|
|
9200
|
-
lineNumber:
|
|
12427
|
+
lineNumber: 276
|
|
9201
12428
|
}
|
|
9202
12429
|
}),
|
|
9203
12430
|
__self: this,
|
|
9204
12431
|
__source: {
|
|
9205
12432
|
fileName: _jsxFileName$3,
|
|
9206
|
-
lineNumber:
|
|
12433
|
+
lineNumber: 271
|
|
9207
12434
|
}
|
|
9208
12435
|
}))), rationale && React$4.createElement(PreviewPrompt$1, {
|
|
9209
12436
|
className: "rationale",
|
|
@@ -9212,7 +12439,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9212
12439
|
__self: this,
|
|
9213
12440
|
__source: {
|
|
9214
12441
|
fileName: _jsxFileName$3,
|
|
9215
|
-
lineNumber:
|
|
12442
|
+
lineNumber: 290
|
|
9216
12443
|
}
|
|
9217
12444
|
}), React$4.createElement(Feedback, {
|
|
9218
12445
|
feedback: feedback,
|
|
@@ -9220,7 +12447,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9220
12447
|
__self: this,
|
|
9221
12448
|
__source: {
|
|
9222
12449
|
fileName: _jsxFileName$3,
|
|
9223
|
-
lineNumber:
|
|
12450
|
+
lineNumber: 291
|
|
9224
12451
|
}
|
|
9225
12452
|
}));
|
|
9226
12453
|
}
|
|
@@ -9238,9 +12465,7 @@ class Choice extends React$3.Component {
|
|
|
9238
12465
|
Choice.prototype.__init.call(this);
|
|
9239
12466
|
}
|
|
9240
12467
|
static __initStatic() {
|
|
9241
|
-
this.propTypes = {
|
|
9242
|
-
updateSession: PropTypes$2.func
|
|
9243
|
-
};
|
|
12468
|
+
this.propTypes = {};
|
|
9244
12469
|
}
|
|
9245
12470
|
__init() {
|
|
9246
12471
|
this.onChange = choice => {
|
|
@@ -9251,7 +12476,7 @@ class Choice extends React$3.Component {
|
|
|
9251
12476
|
};
|
|
9252
12477
|
}
|
|
9253
12478
|
render() {
|
|
9254
|
-
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns,
|
|
12479
|
+
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow, selectedAnswerBackgroundColor} = this.props;
|
|
9255
12480
|
const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
|
|
9256
12481
|
const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
|
|
9257
12482
|
const choiceProps = {
|
|
@@ -9265,7 +12490,6 @@ class Choice extends React$3.Component {
|
|
|
9265
12490
|
index,
|
|
9266
12491
|
choicesLayout,
|
|
9267
12492
|
gridColumns,
|
|
9268
|
-
updateSession,
|
|
9269
12493
|
onChange: this.onChange,
|
|
9270
12494
|
isEvaluateMode,
|
|
9271
12495
|
isSelectionButtonBelow
|
|
@@ -9274,13 +12498,17 @@ class Choice extends React$3.Component {
|
|
|
9274
12498
|
[classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
|
|
9275
12499
|
[classes.horizontalLayout]: choicesLayout === 'horizontal'
|
|
9276
12500
|
});
|
|
12501
|
+
const choiceBackground = selectedAnswerBackgroundColor && checked ? selectedAnswerBackgroundColor : 'initial';
|
|
9277
12502
|
return React$3.createElement('div', {
|
|
9278
12503
|
className: choiceClass,
|
|
9279
12504
|
key: index,
|
|
12505
|
+
style: {
|
|
12506
|
+
backgroundColor: choiceBackground
|
|
12507
|
+
},
|
|
9280
12508
|
__self: this,
|
|
9281
12509
|
__source: {
|
|
9282
12510
|
fileName: _jsxFileName$2,
|
|
9283
|
-
lineNumber:
|
|
12511
|
+
lineNumber: 65
|
|
9284
12512
|
}
|
|
9285
12513
|
}, React$3.createElement(ChoiceInput$1, {
|
|
9286
12514
|
...choiceProps,
|
|
@@ -9288,7 +12516,7 @@ class Choice extends React$3.Component {
|
|
|
9288
12516
|
__self: this,
|
|
9289
12517
|
__source: {
|
|
9290
12518
|
fileName: _jsxFileName$2,
|
|
9291
|
-
lineNumber:
|
|
12519
|
+
lineNumber: 66
|
|
9292
12520
|
}
|
|
9293
12521
|
}));
|
|
9294
12522
|
}
|
|
@@ -9309,12 +12537,15 @@ Choice.propTypes = {
|
|
|
9309
12537
|
displayKey: PropTypes$2.string,
|
|
9310
12538
|
choicesLayout: PropTypes$2.oneOf(['vertical', 'grid', 'horizontal']),
|
|
9311
12539
|
gridColumns: PropTypes$2.string,
|
|
12540
|
+
selectedAnswerBackgroundColor: PropTypes$2.string,
|
|
9312
12541
|
isSelectionButtonBelow: PropTypes$2.bool
|
|
9313
12542
|
};
|
|
9314
12543
|
var StyledChoice = styles$b.withStyles(theme => ({
|
|
9315
12544
|
choice: {
|
|
9316
12545
|
paddingTop: theme.spacing.unit * 2.5,
|
|
9317
12546
|
paddingBottom: theme.spacing.unit + 2,
|
|
12547
|
+
paddingLeft: theme.spacing.unit + 2,
|
|
12548
|
+
paddingRight: theme.spacing.unit + 2,
|
|
9318
12549
|
borderBottom: `1px solid ${theme.palette.grey[300]}`
|
|
9319
12550
|
},
|
|
9320
12551
|
noBorder: {
|
|
@@ -9335,6 +12566,7 @@ const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
|
9335
12566
|
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
9336
12567
|
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
9337
12568
|
const _jsxFileName$1 = "/home/circleci/repo/packages/multiple-choice/src/multiple-choice.jsx";
|
|
12569
|
+
const {translator} = Translator;
|
|
9338
12570
|
const styles$1 = theme => ({
|
|
9339
12571
|
main: {
|
|
9340
12572
|
color: color.text(),
|
|
@@ -9374,6 +12606,11 @@ const styles$1 = theme => ({
|
|
|
9374
12606
|
width: '1px',
|
|
9375
12607
|
height: '1px',
|
|
9376
12608
|
overflow: 'hidden'
|
|
12609
|
+
},
|
|
12610
|
+
errorText: {
|
|
12611
|
+
fontSize: theme.typography.fontSize - 2,
|
|
12612
|
+
color: theme.palette.error.main,
|
|
12613
|
+
paddingTop: theme.spacing.unit
|
|
9377
12614
|
}
|
|
9378
12615
|
});
|
|
9379
12616
|
class MultipleChoice extends React$2.Component {
|
|
@@ -9398,8 +12635,11 @@ class MultipleChoice extends React$2.Component {
|
|
|
9398
12635
|
alwaysShowCorrect: PropTypes$1.bool,
|
|
9399
12636
|
animationsDisabled: PropTypes$1.bool,
|
|
9400
12637
|
language: PropTypes$1.string,
|
|
12638
|
+
selectedAnswerBackgroundColor: PropTypes$1.string,
|
|
9401
12639
|
onShowCorrectToggle: PropTypes$1.func,
|
|
9402
|
-
isSelectionButtonBelow: PropTypes$1.bool
|
|
12640
|
+
isSelectionButtonBelow: PropTypes$1.bool,
|
|
12641
|
+
minSelections: PropTypes$1.number,
|
|
12642
|
+
maxSelections: PropTypes$1.number
|
|
9403
12643
|
};
|
|
9404
12644
|
}
|
|
9405
12645
|
constructor(props) {
|
|
@@ -9407,7 +12647,6 @@ class MultipleChoice extends React$2.Component {
|
|
|
9407
12647
|
MultipleChoice.prototype.__init.call(this);
|
|
9408
12648
|
MultipleChoice.prototype.__init2.call(this);
|
|
9409
12649
|
MultipleChoice.prototype.__init3.call(this);
|
|
9410
|
-
MultipleChoice.prototype.__init4.call(this);
|
|
9411
12650
|
this.state = {
|
|
9412
12651
|
selectedValue: null,
|
|
9413
12652
|
selectedValues: [],
|
|
@@ -9421,29 +12660,31 @@ class MultipleChoice extends React$2.Component {
|
|
|
9421
12660
|
}
|
|
9422
12661
|
__init() {
|
|
9423
12662
|
this.handleChange = event => {
|
|
9424
|
-
const target = event.target;
|
|
9425
|
-
this.setState({
|
|
9426
|
-
selectedValue: target.value
|
|
9427
|
-
});
|
|
9428
|
-
};
|
|
9429
|
-
}
|
|
9430
|
-
__init2() {
|
|
9431
|
-
this.handleChangeCheckboxes = event => {
|
|
9432
12663
|
const {value, checked} = event.target;
|
|
9433
|
-
this.
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
}
|
|
9438
|
-
|
|
12664
|
+
const {choiceMode, maxSelections, onChoiceChanged} = this.props;
|
|
12665
|
+
if (choiceMode === 'radio') {
|
|
12666
|
+
this.setState({
|
|
12667
|
+
selectedValue: value
|
|
12668
|
+
});
|
|
12669
|
+
} else {
|
|
12670
|
+
const {selectedValues} = this.state;
|
|
12671
|
+
if (checked && selectedValues.length >= maxSelections) {
|
|
12672
|
+
return;
|
|
9439
12673
|
}
|
|
9440
|
-
|
|
9441
|
-
selectedValues
|
|
9442
|
-
|
|
12674
|
+
this.setState(prevState => {
|
|
12675
|
+
const selectedValues = checked ? [...prevState.selectedValues, value] : prevState.selectedValues.filter(currentValue => currentValue !== value);
|
|
12676
|
+
return {
|
|
12677
|
+
selectedValues
|
|
12678
|
+
};
|
|
12679
|
+
});
|
|
12680
|
+
}
|
|
12681
|
+
onChoiceChanged({
|
|
12682
|
+
value,
|
|
12683
|
+
selected: checked
|
|
9443
12684
|
});
|
|
9444
12685
|
};
|
|
9445
12686
|
}
|
|
9446
|
-
|
|
12687
|
+
__init2() {
|
|
9447
12688
|
this.onToggle = () => {
|
|
9448
12689
|
if (this.props.mode === 'evaluate') {
|
|
9449
12690
|
this.setState({
|
|
@@ -9485,7 +12726,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
9485
12726
|
}
|
|
9486
12727
|
return '';
|
|
9487
12728
|
}
|
|
9488
|
-
|
|
12729
|
+
__init3() {
|
|
9489
12730
|
this.getCorrectness = (choice = {}) => {
|
|
9490
12731
|
const isCorrect = choice.correct;
|
|
9491
12732
|
const isChecked = this.isSelected(choice.value);
|
|
@@ -9526,25 +12767,26 @@ class MultipleChoice extends React$2.Component {
|
|
|
9526
12767
|
__self: this,
|
|
9527
12768
|
__source: {
|
|
9528
12769
|
fileName: _jsxFileName$1,
|
|
9529
|
-
lineNumber:
|
|
12770
|
+
lineNumber: 225
|
|
9530
12771
|
}
|
|
9531
12772
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
9532
12773
|
className: classes.srOnly,
|
|
9533
12774
|
__self: this,
|
|
9534
12775
|
__source: {
|
|
9535
12776
|
fileName: _jsxFileName$1,
|
|
9536
|
-
lineNumber:
|
|
12777
|
+
lineNumber: 227
|
|
9537
12778
|
}
|
|
9538
12779
|
}, "Multiple Select Question");
|
|
9539
12780
|
}
|
|
9540
12781
|
render() {
|
|
9541
|
-
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt,
|
|
12782
|
+
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, session} = this.props;
|
|
9542
12783
|
const {showCorrect} = this.state;
|
|
9543
12784
|
const isEvaluateMode = mode === 'evaluate';
|
|
9544
12785
|
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
9545
12786
|
const columnsStyle = gridColumns > 1 ? {
|
|
9546
12787
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
9547
12788
|
} : undefined;
|
|
12789
|
+
const selections = session.value && session.value.length || 0;
|
|
9548
12790
|
const teacherInstructionsDiv = React$2.createElement(PreviewPrompt, {
|
|
9549
12791
|
tagName: "div",
|
|
9550
12792
|
className: "prompt",
|
|
@@ -9553,7 +12795,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
9553
12795
|
__self: this,
|
|
9554
12796
|
__source: {
|
|
9555
12797
|
fileName: _jsxFileName$1,
|
|
9556
|
-
lineNumber:
|
|
12798
|
+
lineNumber: 259
|
|
9557
12799
|
}
|
|
9558
12800
|
});
|
|
9559
12801
|
return React$2.createElement('div', {
|
|
@@ -9561,21 +12803,21 @@ class MultipleChoice extends React$2.Component {
|
|
|
9561
12803
|
__self: this,
|
|
9562
12804
|
__source: {
|
|
9563
12805
|
fileName: _jsxFileName$1,
|
|
9564
|
-
lineNumber:
|
|
12806
|
+
lineNumber: 268
|
|
9565
12807
|
}
|
|
9566
12808
|
}, partLabel && React$2.createElement('h3', {
|
|
9567
12809
|
className: classes.partLabel,
|
|
9568
12810
|
__self: this,
|
|
9569
12811
|
__source: {
|
|
9570
12812
|
fileName: _jsxFileName$1,
|
|
9571
|
-
lineNumber:
|
|
12813
|
+
lineNumber: 269
|
|
9572
12814
|
}
|
|
9573
12815
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
9574
12816
|
className: classes.teacherInstructions,
|
|
9575
12817
|
__self: this,
|
|
9576
12818
|
__source: {
|
|
9577
12819
|
fileName: _jsxFileName$1,
|
|
9578
|
-
lineNumber:
|
|
12820
|
+
lineNumber: 274
|
|
9579
12821
|
}
|
|
9580
12822
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
9581
12823
|
labels: {
|
|
@@ -9585,14 +12827,14 @@ class MultipleChoice extends React$2.Component {
|
|
|
9585
12827
|
__self: this,
|
|
9586
12828
|
__source: {
|
|
9587
12829
|
fileName: _jsxFileName$1,
|
|
9588
|
-
lineNumber:
|
|
12830
|
+
lineNumber: 276
|
|
9589
12831
|
}
|
|
9590
12832
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
9591
12833
|
className: classes.fieldset,
|
|
9592
12834
|
__self: this,
|
|
9593
12835
|
__source: {
|
|
9594
12836
|
fileName: _jsxFileName$1,
|
|
9595
|
-
lineNumber:
|
|
12837
|
+
lineNumber: 290
|
|
9596
12838
|
}
|
|
9597
12839
|
}, React$2.createElement(PreviewPrompt, {
|
|
9598
12840
|
className: "prompt",
|
|
@@ -9602,7 +12844,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
9602
12844
|
__self: this,
|
|
9603
12845
|
__source: {
|
|
9604
12846
|
fileName: _jsxFileName$1,
|
|
9605
|
-
lineNumber:
|
|
12847
|
+
lineNumber: 291
|
|
9606
12848
|
}
|
|
9607
12849
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
9608
12850
|
show: showCorrectAnswerToggle,
|
|
@@ -9612,7 +12854,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
9612
12854
|
__self: this,
|
|
9613
12855
|
__source: {
|
|
9614
12856
|
fileName: _jsxFileName$1,
|
|
9615
|
-
lineNumber:
|
|
12857
|
+
lineNumber: 294
|
|
9616
12858
|
}
|
|
9617
12859
|
}), React$2.createElement('div', {
|
|
9618
12860
|
className: classNames({
|
|
@@ -9623,10 +12865,11 @@ class MultipleChoice extends React$2.Component {
|
|
|
9623
12865
|
__self: this,
|
|
9624
12866
|
__source: {
|
|
9625
12867
|
fileName: _jsxFileName$1,
|
|
9626
|
-
lineNumber:
|
|
12868
|
+
lineNumber: 302
|
|
9627
12869
|
}
|
|
9628
12870
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
9629
12871
|
choicesLayout: this.props.choicesLayout,
|
|
12872
|
+
selectedAnswerBackgroundColor: this.props.selectedAnswerBackgroundColor,
|
|
9630
12873
|
gridColumns: gridColumns,
|
|
9631
12874
|
key: `choice-${index}`,
|
|
9632
12875
|
choice: choice,
|
|
@@ -9636,8 +12879,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
9636
12879
|
isEvaluateMode: isEvaluateMode,
|
|
9637
12880
|
choiceMode: choiceMode,
|
|
9638
12881
|
disabled: disabled,
|
|
9639
|
-
|
|
9640
|
-
onChoiceChanged: this.props.choiceMode === 'radio' ? this.handleChange : this.handleChangeCheckboxes,
|
|
12882
|
+
onChoiceChanged: this.handleChange,
|
|
9641
12883
|
hideTick: choice.hideTick,
|
|
9642
12884
|
checked: this.getChecked(choice),
|
|
9643
12885
|
correctness: isEvaluateMode ? this.getCorrectness(choice) : undefined,
|
|
@@ -9646,9 +12888,29 @@ class MultipleChoice extends React$2.Component {
|
|
|
9646
12888
|
__self: this,
|
|
9647
12889
|
__source: {
|
|
9648
12890
|
fileName: _jsxFileName$1,
|
|
9649
|
-
lineNumber:
|
|
12891
|
+
lineNumber: 310
|
|
12892
|
+
}
|
|
12893
|
+
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12894
|
+
className: classes.errorText,
|
|
12895
|
+
__self: this,
|
|
12896
|
+
__source: {
|
|
12897
|
+
fileName: _jsxFileName$1,
|
|
12898
|
+
lineNumber: 334
|
|
12899
|
+
}
|
|
12900
|
+
}, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
|
|
12901
|
+
lng: language,
|
|
12902
|
+
minSelections
|
|
12903
|
+
})), choiceMode === 'checkbox' && selections >= maxSelections && React$2.createElement('div', {
|
|
12904
|
+
className: classes.errorText,
|
|
12905
|
+
__self: this,
|
|
12906
|
+
__source: {
|
|
12907
|
+
fileName: _jsxFileName$1,
|
|
12908
|
+
lineNumber: 342
|
|
9650
12909
|
}
|
|
9651
|
-
}
|
|
12910
|
+
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12911
|
+
lng: language,
|
|
12912
|
+
maxSelections
|
|
12913
|
+
})));
|
|
9652
12914
|
}
|
|
9653
12915
|
}
|
|
9654
12916
|
MultipleChoice.__initStatic();
|