@pie-element/ebsr 9.19.1-next.5 → 9.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/configure/CHANGELOG.md +11 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +2 -2
- package/lib/print.js +24 -1
- package/lib/print.js.map +1 -1
- package/module/configure.js +2 -2
- package/module/element.js +2 -2
- package/module/manifest.json +2 -2
- package/module/print.js +3454 -203
- package/package.json +4 -3
- package/src/print.js +24 -1
package/module/print.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.21.
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@4.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.21.1/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@4.23.1/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -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);
|
|
@@ -5469,14 +5469,14 @@ var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
|
5469
5469
|
Object.defineProperty(helpers, "__esModule", {
|
|
5470
5470
|
value: true
|
|
5471
5471
|
});
|
|
5472
|
-
helpers.capitalize = capitalize;
|
|
5472
|
+
helpers.capitalize = capitalize$1;
|
|
5473
5473
|
helpers.contains = contains;
|
|
5474
5474
|
helpers.findIndex = findIndex;
|
|
5475
5475
|
helpers.find = find;
|
|
5476
5476
|
helpers.createChainedFunction = createChainedFunction;
|
|
5477
|
-
var _typeof2 = _interopRequireDefault$q(_typeof$
|
|
5477
|
+
var _typeof2 = _interopRequireDefault$q(_typeof$3.exports);
|
|
5478
5478
|
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
5479
|
-
function capitalize(string) {
|
|
5479
|
+
function capitalize$1(string) {
|
|
5480
5480
|
if (typeof string !== 'string') {
|
|
5481
5481
|
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
5482
5482
|
}
|
|
@@ -5533,7 +5533,7 @@ Object.defineProperty(Typography$1, "__esModule", {
|
|
|
5533
5533
|
});
|
|
5534
5534
|
Typography$1.default = Typography$1.styles = void 0;
|
|
5535
5535
|
var _extends2$9 = _interopRequireDefault$p(_extends$1.exports);
|
|
5536
|
-
var _defineProperty2$7 = _interopRequireDefault$p(defineProperty$
|
|
5536
|
+
var _defineProperty2$7 = _interopRequireDefault$p(defineProperty$2.exports);
|
|
5537
5537
|
var _objectWithoutProperties2$9 = _interopRequireDefault$p(objectWithoutProperties.exports);
|
|
5538
5538
|
var _react$i = _interopRequireDefault$p(require$$4$5);
|
|
5539
5539
|
var _propTypes$b = _interopRequireDefault$p(require$$5$5);
|
|
@@ -5730,7 +5730,7 @@ Object.defineProperty(FormControlLabel$2, "__esModule", {
|
|
|
5730
5730
|
});
|
|
5731
5731
|
FormControlLabel$2.default = FormControlLabel$2.styles = void 0;
|
|
5732
5732
|
var _extends2$8 = _interopRequireDefault$o(_extends$1.exports);
|
|
5733
|
-
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$
|
|
5733
|
+
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$2.exports);
|
|
5734
5734
|
var _objectWithoutProperties2$8 = _interopRequireDefault$o(objectWithoutProperties.exports);
|
|
5735
5735
|
var _react$h = _interopRequireDefault$o(require$$4$4);
|
|
5736
5736
|
var _propTypes$a = _interopRequireDefault$o(require$$5$4);
|
|
@@ -5882,11 +5882,11 @@ Object.defineProperty(NoSsr$1, "__esModule", {
|
|
|
5882
5882
|
value: true
|
|
5883
5883
|
});
|
|
5884
5884
|
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);
|
|
5885
|
+
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck$1.exports);
|
|
5886
|
+
var _createClass2$4 = _interopRequireDefault$m(createClass$1.exports);
|
|
5887
|
+
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn$1.exports);
|
|
5888
|
+
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$2.exports);
|
|
5889
|
+
var _inherits2$4 = _interopRequireDefault$m(inherits$1.exports);
|
|
5890
5890
|
var _react$g = _interopRequireDefault$m(require$$6$3);
|
|
5891
5891
|
var _propTypes$9 = _interopRequireDefault$m(require$$7);
|
|
5892
5892
|
var _utils$3 = require$$7$1;
|
|
@@ -6026,7 +6026,7 @@ var toConsumableArray = {
|
|
|
6026
6026
|
var arrayWithoutHoles = {
|
|
6027
6027
|
exports: {}
|
|
6028
6028
|
};
|
|
6029
|
-
var arrayLikeToArray = {
|
|
6029
|
+
var arrayLikeToArray$1 = {
|
|
6030
6030
|
exports: {}
|
|
6031
6031
|
};
|
|
6032
6032
|
(function (module) {
|
|
@@ -6038,17 +6038,17 @@ var arrayLikeToArray = {
|
|
|
6038
6038
|
return arr2;
|
|
6039
6039
|
}
|
|
6040
6040
|
(module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
6041
|
-
})(arrayLikeToArray);
|
|
6042
|
-
getDefaultExportFromCjs(arrayLikeToArray.exports);
|
|
6041
|
+
})(arrayLikeToArray$1);
|
|
6042
|
+
getDefaultExportFromCjs(arrayLikeToArray$1.exports);
|
|
6043
6043
|
(function (module) {
|
|
6044
|
-
var arrayLikeToArray
|
|
6044
|
+
var arrayLikeToArray = arrayLikeToArray$1.exports;
|
|
6045
6045
|
function _arrayWithoutHoles(arr) {
|
|
6046
|
-
if (Array.isArray(arr)) return arrayLikeToArray
|
|
6046
|
+
if (Array.isArray(arr)) return arrayLikeToArray(arr);
|
|
6047
6047
|
}
|
|
6048
6048
|
(module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
6049
6049
|
})(arrayWithoutHoles);
|
|
6050
6050
|
getDefaultExportFromCjs(arrayWithoutHoles.exports);
|
|
6051
|
-
var iterableToArray = {
|
|
6051
|
+
var iterableToArray$1 = {
|
|
6052
6052
|
exports: {}
|
|
6053
6053
|
};
|
|
6054
6054
|
(function (module) {
|
|
@@ -6056,24 +6056,24 @@ var iterableToArray = {
|
|
|
6056
6056
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6057
6057
|
}
|
|
6058
6058
|
(module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
6059
|
-
})(iterableToArray);
|
|
6060
|
-
getDefaultExportFromCjs(iterableToArray.exports);
|
|
6061
|
-
var unsupportedIterableToArray = {
|
|
6059
|
+
})(iterableToArray$1);
|
|
6060
|
+
getDefaultExportFromCjs(iterableToArray$1.exports);
|
|
6061
|
+
var unsupportedIterableToArray$1 = {
|
|
6062
6062
|
exports: {}
|
|
6063
6063
|
};
|
|
6064
6064
|
(function (module) {
|
|
6065
|
-
var arrayLikeToArray
|
|
6065
|
+
var arrayLikeToArray = arrayLikeToArray$1.exports;
|
|
6066
6066
|
function _unsupportedIterableToArray(o, minLen) {
|
|
6067
6067
|
if (!o) return;
|
|
6068
|
-
if (typeof o === "string") return arrayLikeToArray
|
|
6068
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
6069
6069
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6070
6070
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6071
6071
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
6072
|
-
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray
|
|
6072
|
+
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray(o, minLen);
|
|
6073
6073
|
}
|
|
6074
6074
|
(module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
6075
|
-
})(unsupportedIterableToArray);
|
|
6076
|
-
getDefaultExportFromCjs(unsupportedIterableToArray.exports);
|
|
6075
|
+
})(unsupportedIterableToArray$1);
|
|
6076
|
+
getDefaultExportFromCjs(unsupportedIterableToArray$1.exports);
|
|
6077
6077
|
var nonIterableSpread = {
|
|
6078
6078
|
exports: {}
|
|
6079
6079
|
};
|
|
@@ -6086,11 +6086,11 @@ var nonIterableSpread = {
|
|
|
6086
6086
|
getDefaultExportFromCjs(nonIterableSpread.exports);
|
|
6087
6087
|
(function (module) {
|
|
6088
6088
|
var arrayWithoutHoles$1 = arrayWithoutHoles.exports;
|
|
6089
|
-
var iterableToArray
|
|
6090
|
-
var unsupportedIterableToArray
|
|
6089
|
+
var iterableToArray = iterableToArray$1.exports;
|
|
6090
|
+
var unsupportedIterableToArray = unsupportedIterableToArray$1.exports;
|
|
6091
6091
|
var nonIterableSpread$1 = nonIterableSpread.exports;
|
|
6092
6092
|
function _toConsumableArray(arr) {
|
|
6093
|
-
return arrayWithoutHoles$1(arr) || iterableToArray
|
|
6093
|
+
return arrayWithoutHoles$1(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread$1();
|
|
6094
6094
|
}
|
|
6095
6095
|
(module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
6096
6096
|
})(toConsumableArray);
|
|
@@ -6766,7 +6766,7 @@ Transition.propTypes = {
|
|
|
6766
6766
|
onExiting: PropTypes$5.func,
|
|
6767
6767
|
onExited: PropTypes$5.func
|
|
6768
6768
|
};
|
|
6769
|
-
function noop() {}
|
|
6769
|
+
function noop$1() {}
|
|
6770
6770
|
Transition.defaultProps = {
|
|
6771
6771
|
in: false,
|
|
6772
6772
|
mountOnEnter: false,
|
|
@@ -6774,12 +6774,12 @@ Transition.defaultProps = {
|
|
|
6774
6774
|
appear: false,
|
|
6775
6775
|
enter: true,
|
|
6776
6776
|
exit: true,
|
|
6777
|
-
onEnter: noop,
|
|
6778
|
-
onEntering: noop,
|
|
6779
|
-
onEntered: noop,
|
|
6780
|
-
onExit: noop,
|
|
6781
|
-
onExiting: noop,
|
|
6782
|
-
onExited: noop
|
|
6777
|
+
onEnter: noop$1,
|
|
6778
|
+
onEntering: noop$1,
|
|
6779
|
+
onEntered: noop$1,
|
|
6780
|
+
onExit: noop$1,
|
|
6781
|
+
onExiting: noop$1,
|
|
6782
|
+
onExited: noop$1
|
|
6783
6783
|
};
|
|
6784
6784
|
Transition.UNMOUNTED = 0;
|
|
6785
6785
|
Transition.EXITED = 1;
|
|
@@ -6797,13 +6797,13 @@ Object.defineProperty(Ripple$1, "__esModule", {
|
|
|
6797
6797
|
});
|
|
6798
6798
|
Ripple$1.default = void 0;
|
|
6799
6799
|
var _extends2$7 = _interopRequireDefault$i(_extends$1.exports);
|
|
6800
|
-
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$
|
|
6800
|
+
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$2.exports);
|
|
6801
6801
|
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);
|
|
6802
|
+
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck$1.exports);
|
|
6803
|
+
var _createClass2$3 = _interopRequireDefault$i(createClass$1.exports);
|
|
6804
|
+
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn$1.exports);
|
|
6805
|
+
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$2.exports);
|
|
6806
|
+
var _inherits2$3 = _interopRequireDefault$i(inherits$1.exports);
|
|
6807
6807
|
var _react$d = _interopRequireDefault$i(require$$9$1);
|
|
6808
6808
|
var _propTypes$7 = _interopRequireDefault$i(require$$10$3);
|
|
6809
6809
|
var _classnames$7 = _interopRequireDefault$i(require$$11$3);
|
|
@@ -6886,12 +6886,12 @@ TouchRipple$1.default = TouchRipple$1.styles = TouchRipple$1.DELAY_RIPPLE = void
|
|
|
6886
6886
|
var _extends2$6 = _interopRequireDefault$h(_extends$1.exports);
|
|
6887
6887
|
var _objectWithoutProperties2$6 = _interopRequireDefault$h(objectWithoutProperties.exports);
|
|
6888
6888
|
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);
|
|
6889
|
+
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck$1.exports);
|
|
6890
|
+
var _createClass2$2 = _interopRequireDefault$h(createClass$1.exports);
|
|
6891
|
+
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn$1.exports);
|
|
6892
|
+
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$2.exports);
|
|
6893
|
+
var _inherits2$2 = _interopRequireDefault$h(inherits$1.exports);
|
|
6894
|
+
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized$1.exports);
|
|
6895
6895
|
var _react$c = _interopRequireDefault$h(require$$10$2);
|
|
6896
6896
|
var _propTypes$6 = _interopRequireDefault$h(require$$11$2);
|
|
6897
6897
|
var _reactDom$1 = _interopRequireDefault$h(require$$12$1);
|
|
@@ -7189,14 +7189,14 @@ Object.defineProperty(ButtonBase$1, "__esModule", {
|
|
|
7189
7189
|
});
|
|
7190
7190
|
ButtonBase$1.default = ButtonBase$1.styles = void 0;
|
|
7191
7191
|
var _extends2$5 = _interopRequireDefault$g(_extends$1.exports);
|
|
7192
|
-
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$
|
|
7192
|
+
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$2.exports);
|
|
7193
7193
|
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);
|
|
7194
|
+
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck$1.exports);
|
|
7195
|
+
var _createClass2$1 = _interopRequireDefault$g(createClass$1.exports);
|
|
7196
|
+
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn$1.exports);
|
|
7197
|
+
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$2.exports);
|
|
7198
|
+
var _inherits2$1 = _interopRequireDefault$g(inherits$1.exports);
|
|
7199
|
+
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized$1.exports);
|
|
7200
7200
|
var _react$b = _interopRequireDefault$g(require$$10$1);
|
|
7201
7201
|
var _propTypes$5 = _interopRequireDefault$g(require$$11$1);
|
|
7202
7202
|
var _reactDom = _interopRequireDefault$g(require$$12);
|
|
@@ -7514,7 +7514,7 @@ Object.defineProperty(IconButton$1, "__esModule", {
|
|
|
7514
7514
|
});
|
|
7515
7515
|
IconButton$1.default = IconButton$1.styles = void 0;
|
|
7516
7516
|
var _extends2$4 = _interopRequireDefault$f(_extends$1.exports);
|
|
7517
|
-
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$
|
|
7517
|
+
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$2.exports);
|
|
7518
7518
|
var _objectWithoutProperties2$4 = _interopRequireDefault$f(objectWithoutProperties.exports);
|
|
7519
7519
|
var _react$a = _interopRequireDefault$f(require$$4$3);
|
|
7520
7520
|
var _propTypes$4 = _interopRequireDefault$f(require$$5$3);
|
|
@@ -7640,13 +7640,13 @@ Object.defineProperty(SwitchBase$1, "__esModule", {
|
|
|
7640
7640
|
});
|
|
7641
7641
|
SwitchBase$1.default = SwitchBase$1.styles = void 0;
|
|
7642
7642
|
var _extends2$3 = _interopRequireDefault$e(_extends$1.exports);
|
|
7643
|
-
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$
|
|
7643
|
+
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$2.exports);
|
|
7644
7644
|
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);
|
|
7645
|
+
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck$1.exports);
|
|
7646
|
+
var _createClass2 = _interopRequireDefault$e(createClass$1.exports);
|
|
7647
|
+
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn$1.exports);
|
|
7648
|
+
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$2.exports);
|
|
7649
|
+
var _inherits2 = _interopRequireDefault$e(inherits$1.exports);
|
|
7650
7650
|
var _react$9 = _interopRequireDefault$e(require$$9);
|
|
7651
7651
|
var _propTypes$3 = _interopRequireDefault$e(require$$10);
|
|
7652
7652
|
var _classnames$3 = _interopRequireDefault$e(require$$11);
|
|
@@ -7799,11 +7799,11 @@ var inheritsLoose = {
|
|
|
7799
7799
|
exports: {}
|
|
7800
7800
|
};
|
|
7801
7801
|
(function (module) {
|
|
7802
|
-
var setPrototypeOf
|
|
7802
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
7803
7803
|
function _inheritsLoose(subClass, superClass) {
|
|
7804
7804
|
subClass.prototype = Object.create(superClass.prototype);
|
|
7805
7805
|
subClass.prototype.constructor = subClass;
|
|
7806
|
-
setPrototypeOf
|
|
7806
|
+
setPrototypeOf(subClass, superClass);
|
|
7807
7807
|
}
|
|
7808
7808
|
(module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
7809
7809
|
})(inheritsLoose);
|
|
@@ -7948,7 +7948,7 @@ Object.defineProperty(SvgIcon$1, "__esModule", {
|
|
|
7948
7948
|
});
|
|
7949
7949
|
SvgIcon$1.default = SvgIcon$1.styles = void 0;
|
|
7950
7950
|
var _extends2$2 = _interopRequireDefault$8(_extends$1.exports);
|
|
7951
|
-
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$
|
|
7951
|
+
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$2.exports);
|
|
7952
7952
|
var _objectWithoutProperties2$2 = _interopRequireDefault$8(objectWithoutProperties.exports);
|
|
7953
7953
|
var _react$7 = _interopRequireDefault$8(require$$4$2);
|
|
7954
7954
|
var _propTypes$2 = _interopRequireDefault$8(require$$5$2);
|
|
@@ -8114,7 +8114,7 @@ Object.defineProperty(Checkbox$2, "__esModule", {
|
|
|
8114
8114
|
});
|
|
8115
8115
|
Checkbox$2.default = Checkbox$2.styles = void 0;
|
|
8116
8116
|
var _extends2$1 = _interopRequireDefault$4(_extends$1.exports);
|
|
8117
|
-
var _defineProperty2 = _interopRequireDefault$4(defineProperty$
|
|
8117
|
+
var _defineProperty2 = _interopRequireDefault$4(defineProperty$2.exports);
|
|
8118
8118
|
var _objectWithoutProperties2$1 = _interopRequireDefault$4(objectWithoutProperties.exports);
|
|
8119
8119
|
var _react$3 = _interopRequireDefault$4(require$$4$1);
|
|
8120
8120
|
var _propTypes$1 = _interopRequireDefault$4(require$$5$1);
|
|
@@ -9809,90 +9809,3341 @@ class SessionChangedEvent extends CustomEvent {
|
|
|
9809
9809
|
}
|
|
9810
9810
|
SessionChangedEvent.TYPE = 'session-changed';
|
|
9811
9811
|
var SessionChangedEvent_1 = lib.SessionChangedEvent = SessionChangedEvent;
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
const SESSION_CHANGED = SessionChangedEvent_1.TYPE;
|
|
9817
|
-
const log = debug('pie-element:ebsr:print');
|
|
9818
|
-
const preparePrintModel = (model, opts) => {
|
|
9819
|
-
const instr = opts.role === 'instructor';
|
|
9820
|
-
model.prompt = model.promptEnabled !== false ? model.prompt : undefined;
|
|
9821
|
-
model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
|
|
9822
|
-
model.showTeacherInstructions = instr;
|
|
9823
|
-
model.alwaysShowCorrect = instr;
|
|
9824
|
-
model.mode = instr ? 'evaluate' : 'gather';
|
|
9825
|
-
model.disabled = true;
|
|
9826
|
-
model.animationsDisabled = true;
|
|
9827
|
-
model.lockChoiceOrder = true;
|
|
9828
|
-
model.choicesLayout = model.choicesLayout || 'vertical';
|
|
9829
|
-
const choices = cloneDeep(model.choices);
|
|
9830
|
-
model.choices = choices.map(c => {
|
|
9831
|
-
c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;
|
|
9832
|
-
c.hideTick = instr;
|
|
9833
|
-
c.feedback = undefined;
|
|
9834
|
-
return c;
|
|
9835
|
-
});
|
|
9836
|
-
model.keyMode = model.choicePrefix || 'letters';
|
|
9837
|
-
return model;
|
|
9812
|
+
var translator$2 = {};
|
|
9813
|
+
var translator$1 = {};
|
|
9814
|
+
var _typeof$1 = {
|
|
9815
|
+
exports: {}
|
|
9838
9816
|
};
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9817
|
+
(function (module) {
|
|
9818
|
+
function _typeof(obj) {
|
|
9819
|
+
"@babel/helpers - typeof";
|
|
9820
|
+
return ((module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
9821
|
+
return typeof obj;
|
|
9822
|
+
} : function (obj) {
|
|
9823
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
9824
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
9843
9825
|
}
|
|
9826
|
+
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9827
|
+
})(_typeof$1);
|
|
9828
|
+
getDefaultExportFromCjs(_typeof$1.exports);
|
|
9829
|
+
var classCallCheck = {
|
|
9830
|
+
exports: {}
|
|
9844
9831
|
};
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
return isNonEmptyArray(a) && isNonEmptyArray(b);
|
|
9851
|
-
};
|
|
9852
|
-
class Ebsr extends HTMLElement {
|
|
9853
|
-
constructor() {
|
|
9854
|
-
super();
|
|
9855
|
-
Ebsr.prototype.__init.call(this);
|
|
9856
|
-
this._model = {};
|
|
9857
|
-
this._session = {};
|
|
9858
|
-
this._options = null;
|
|
9832
|
+
(function (module) {
|
|
9833
|
+
function _classCallCheck(instance, Constructor) {
|
|
9834
|
+
if (!(instance instanceof Constructor)) {
|
|
9835
|
+
throw new TypeError("Cannot call a class as a function");
|
|
9836
|
+
}
|
|
9859
9837
|
}
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9838
|
+
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9839
|
+
})(classCallCheck);
|
|
9840
|
+
getDefaultExportFromCjs(classCallCheck.exports);
|
|
9841
|
+
var createClass = {
|
|
9842
|
+
exports: {}
|
|
9843
|
+
};
|
|
9844
|
+
var toPropertyKey = {
|
|
9845
|
+
exports: {}
|
|
9846
|
+
};
|
|
9847
|
+
var toPrimitive = {
|
|
9848
|
+
exports: {}
|
|
9849
|
+
};
|
|
9850
|
+
(function (module) {
|
|
9851
|
+
var _typeof = _typeof$1.exports["default"];
|
|
9852
|
+
function _toPrimitive(input, hint) {
|
|
9853
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
9854
|
+
var prim = input[Symbol.toPrimitive];
|
|
9855
|
+
if (prim !== undefined) {
|
|
9856
|
+
var res = prim.call(input, hint || "default");
|
|
9857
|
+
if (_typeof(res) !== "object") return res;
|
|
9858
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
9859
|
+
}
|
|
9860
|
+
return (hint === "string" ? String : Number)(input);
|
|
9861
|
+
}
|
|
9862
|
+
(module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9863
|
+
})(toPrimitive);
|
|
9864
|
+
getDefaultExportFromCjs(toPrimitive.exports);
|
|
9865
|
+
(function (module) {
|
|
9866
|
+
var _typeof = _typeof$1.exports["default"];
|
|
9867
|
+
var toPrimitive$1 = toPrimitive.exports;
|
|
9868
|
+
function _toPropertyKey(arg) {
|
|
9869
|
+
var key = toPrimitive$1(arg, "string");
|
|
9870
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
9871
|
+
}
|
|
9872
|
+
(module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9873
|
+
})(toPropertyKey);
|
|
9874
|
+
getDefaultExportFromCjs(toPropertyKey.exports);
|
|
9875
|
+
(function (module) {
|
|
9876
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
9877
|
+
function _defineProperties(target, props) {
|
|
9878
|
+
for (var i = 0; i < props.length; i++) {
|
|
9879
|
+
var descriptor = props[i];
|
|
9880
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
9881
|
+
descriptor.configurable = true;
|
|
9882
|
+
if (("value" in descriptor)) descriptor.writable = true;
|
|
9883
|
+
Object.defineProperty(target, toPropertyKey$1(descriptor.key), descriptor);
|
|
9884
|
+
}
|
|
9876
9885
|
}
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9886
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
9887
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
9888
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
9889
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
9890
|
+
writable: false
|
|
9882
9891
|
});
|
|
9892
|
+
return Constructor;
|
|
9883
9893
|
}
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9894
|
+
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9895
|
+
})(createClass);
|
|
9896
|
+
getDefaultExportFromCjs(createClass.exports);
|
|
9897
|
+
var assertThisInitialized = {
|
|
9898
|
+
exports: {}
|
|
9899
|
+
};
|
|
9900
|
+
(function (module) {
|
|
9901
|
+
function _assertThisInitialized(self) {
|
|
9902
|
+
if (self === void 0) {
|
|
9903
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
9904
|
+
}
|
|
9905
|
+
return self;
|
|
9906
|
+
}
|
|
9907
|
+
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9908
|
+
})(assertThisInitialized);
|
|
9909
|
+
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
9910
|
+
var inherits = {
|
|
9911
|
+
exports: {}
|
|
9912
|
+
};
|
|
9913
|
+
var setPrototypeOf = {
|
|
9914
|
+
exports: {}
|
|
9915
|
+
};
|
|
9916
|
+
(function (module) {
|
|
9917
|
+
function _setPrototypeOf(o, p) {
|
|
9918
|
+
(module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
9919
|
+
o.__proto__ = p;
|
|
9920
|
+
return o;
|
|
9921
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9922
|
+
return _setPrototypeOf(o, p);
|
|
9923
|
+
}
|
|
9924
|
+
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9925
|
+
})(setPrototypeOf);
|
|
9926
|
+
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
9927
|
+
(function (module) {
|
|
9928
|
+
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
9929
|
+
function _inherits(subClass, superClass) {
|
|
9930
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
9931
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
9932
|
+
}
|
|
9933
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
9934
|
+
constructor: {
|
|
9935
|
+
value: subClass,
|
|
9936
|
+
writable: true,
|
|
9937
|
+
configurable: true
|
|
9938
|
+
}
|
|
9939
|
+
});
|
|
9940
|
+
Object.defineProperty(subClass, "prototype", {
|
|
9941
|
+
writable: false
|
|
9889
9942
|
});
|
|
9943
|
+
if (superClass) setPrototypeOf$1(subClass, superClass);
|
|
9890
9944
|
}
|
|
9891
|
-
|
|
9892
|
-
|
|
9945
|
+
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9946
|
+
})(inherits);
|
|
9947
|
+
getDefaultExportFromCjs(inherits.exports);
|
|
9948
|
+
var possibleConstructorReturn = {
|
|
9949
|
+
exports: {}
|
|
9950
|
+
};
|
|
9951
|
+
(function (module) {
|
|
9952
|
+
var _typeof = _typeof$1.exports["default"];
|
|
9953
|
+
var assertThisInitialized$1 = assertThisInitialized.exports;
|
|
9954
|
+
function _possibleConstructorReturn(self, call) {
|
|
9955
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
9956
|
+
return call;
|
|
9957
|
+
} else if (call !== void 0) {
|
|
9958
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
9959
|
+
}
|
|
9960
|
+
return assertThisInitialized$1(self);
|
|
9961
|
+
}
|
|
9962
|
+
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9963
|
+
})(possibleConstructorReturn);
|
|
9964
|
+
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
9965
|
+
var getPrototypeOf = {
|
|
9966
|
+
exports: {}
|
|
9967
|
+
};
|
|
9968
|
+
(function (module) {
|
|
9969
|
+
function _getPrototypeOf(o) {
|
|
9970
|
+
(module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
9971
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
9972
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9973
|
+
return _getPrototypeOf(o);
|
|
9974
|
+
}
|
|
9975
|
+
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9976
|
+
})(getPrototypeOf);
|
|
9977
|
+
getDefaultExportFromCjs(getPrototypeOf.exports);
|
|
9978
|
+
var defineProperty = {
|
|
9979
|
+
exports: {}
|
|
9980
|
+
};
|
|
9981
|
+
(function (module) {
|
|
9982
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
9983
|
+
function _defineProperty(obj, key, value) {
|
|
9984
|
+
key = toPropertyKey$1(key);
|
|
9985
|
+
if ((key in obj)) {
|
|
9986
|
+
Object.defineProperty(obj, key, {
|
|
9987
|
+
value: value,
|
|
9988
|
+
enumerable: true,
|
|
9989
|
+
configurable: true,
|
|
9990
|
+
writable: true
|
|
9991
|
+
});
|
|
9992
|
+
} else {
|
|
9993
|
+
obj[key] = value;
|
|
9994
|
+
}
|
|
9995
|
+
return obj;
|
|
9996
|
+
}
|
|
9997
|
+
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
9998
|
+
})(defineProperty);
|
|
9999
|
+
getDefaultExportFromCjs(defineProperty.exports);
|
|
10000
|
+
var toArray = {
|
|
10001
|
+
exports: {}
|
|
10002
|
+
};
|
|
10003
|
+
var arrayWithHoles = {
|
|
10004
|
+
exports: {}
|
|
10005
|
+
};
|
|
10006
|
+
(function (module) {
|
|
10007
|
+
function _arrayWithHoles(arr) {
|
|
10008
|
+
if (Array.isArray(arr)) return arr;
|
|
10009
|
+
}
|
|
10010
|
+
(module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
10011
|
+
})(arrayWithHoles);
|
|
10012
|
+
getDefaultExportFromCjs(arrayWithHoles.exports);
|
|
10013
|
+
var iterableToArray = {
|
|
10014
|
+
exports: {}
|
|
10015
|
+
};
|
|
10016
|
+
(function (module) {
|
|
10017
|
+
function _iterableToArray(iter) {
|
|
10018
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
10019
|
+
}
|
|
10020
|
+
(module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
10021
|
+
})(iterableToArray);
|
|
10022
|
+
getDefaultExportFromCjs(iterableToArray.exports);
|
|
10023
|
+
var unsupportedIterableToArray = {
|
|
10024
|
+
exports: {}
|
|
10025
|
+
};
|
|
10026
|
+
var arrayLikeToArray = {
|
|
10027
|
+
exports: {}
|
|
10028
|
+
};
|
|
10029
|
+
(function (module) {
|
|
10030
|
+
function _arrayLikeToArray(arr, len) {
|
|
10031
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
10032
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10033
|
+
return arr2;
|
|
10034
|
+
}
|
|
10035
|
+
(module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
10036
|
+
})(arrayLikeToArray);
|
|
10037
|
+
getDefaultExportFromCjs(arrayLikeToArray.exports);
|
|
10038
|
+
(function (module) {
|
|
10039
|
+
var arrayLikeToArray$1 = arrayLikeToArray.exports;
|
|
10040
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
10041
|
+
if (!o) return;
|
|
10042
|
+
if (typeof o === "string") return arrayLikeToArray$1(o, minLen);
|
|
10043
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
10044
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
10045
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10046
|
+
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray$1(o, minLen);
|
|
10047
|
+
}
|
|
10048
|
+
(module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
10049
|
+
})(unsupportedIterableToArray);
|
|
10050
|
+
getDefaultExportFromCjs(unsupportedIterableToArray.exports);
|
|
10051
|
+
var nonIterableRest = {
|
|
10052
|
+
exports: {}
|
|
10053
|
+
};
|
|
10054
|
+
(function (module) {
|
|
10055
|
+
function _nonIterableRest() {
|
|
10056
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10057
|
+
}
|
|
10058
|
+
(module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
10059
|
+
})(nonIterableRest);
|
|
10060
|
+
getDefaultExportFromCjs(nonIterableRest.exports);
|
|
10061
|
+
(function (module) {
|
|
10062
|
+
var arrayWithHoles$1 = arrayWithHoles.exports;
|
|
10063
|
+
var iterableToArray$1 = iterableToArray.exports;
|
|
10064
|
+
var unsupportedIterableToArray$1 = unsupportedIterableToArray.exports;
|
|
10065
|
+
var nonIterableRest$1 = nonIterableRest.exports;
|
|
10066
|
+
function _toArray(arr) {
|
|
10067
|
+
return arrayWithHoles$1(arr) || iterableToArray$1(arr) || unsupportedIterableToArray$1(arr) || nonIterableRest$1();
|
|
10068
|
+
}
|
|
10069
|
+
(module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
10070
|
+
})(toArray);
|
|
10071
|
+
getDefaultExportFromCjs(toArray.exports);
|
|
10072
|
+
var _typeof = _typeof$1.exports;
|
|
10073
|
+
var _classCallCheck = classCallCheck.exports;
|
|
10074
|
+
var _createClass = createClass.exports;
|
|
10075
|
+
var _assertThisInitialized = assertThisInitialized.exports;
|
|
10076
|
+
var _inherits = inherits.exports;
|
|
10077
|
+
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
|
10078
|
+
var _getPrototypeOf = getPrototypeOf.exports;
|
|
10079
|
+
var _defineProperty = defineProperty.exports;
|
|
10080
|
+
var _toArray = toArray.exports;
|
|
10081
|
+
function _interopDefaultLegacy(e) {
|
|
10082
|
+
return e && typeof e === 'object' && ('default' in e) ? e : {
|
|
10083
|
+
'default': e
|
|
10084
|
+
};
|
|
10085
|
+
}
|
|
10086
|
+
var _typeof__default = _interopDefaultLegacy(_typeof);
|
|
10087
|
+
var _classCallCheck__default = _interopDefaultLegacy(_classCallCheck);
|
|
10088
|
+
var _createClass__default = _interopDefaultLegacy(_createClass);
|
|
10089
|
+
var _assertThisInitialized__default = _interopDefaultLegacy(_assertThisInitialized);
|
|
10090
|
+
var _inherits__default = _interopDefaultLegacy(_inherits);
|
|
10091
|
+
var _possibleConstructorReturn__default = _interopDefaultLegacy(_possibleConstructorReturn);
|
|
10092
|
+
var _getPrototypeOf__default = _interopDefaultLegacy(_getPrototypeOf);
|
|
10093
|
+
var _defineProperty__default = _interopDefaultLegacy(_defineProperty);
|
|
10094
|
+
var _toArray__default = _interopDefaultLegacy(_toArray);
|
|
10095
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
10096
|
+
var keys = Object.keys(object);
|
|
10097
|
+
if (Object.getOwnPropertySymbols) {
|
|
10098
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
10099
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
10100
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10101
|
+
})), keys.push.apply(keys, symbols));
|
|
10102
|
+
}
|
|
10103
|
+
return keys;
|
|
10104
|
+
}
|
|
10105
|
+
function _objectSpread$6(target) {
|
|
10106
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
10107
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
10108
|
+
i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) {
|
|
10109
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
10110
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) {
|
|
10111
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
10112
|
+
});
|
|
10113
|
+
}
|
|
10114
|
+
return target;
|
|
10115
|
+
}
|
|
10116
|
+
var consoleLogger = {
|
|
10117
|
+
type: 'logger',
|
|
10118
|
+
log: function log(args) {
|
|
10119
|
+
this.output('log', args);
|
|
10120
|
+
},
|
|
10121
|
+
warn: function warn(args) {
|
|
10122
|
+
this.output('warn', args);
|
|
10123
|
+
},
|
|
10124
|
+
error: function error(args) {
|
|
10125
|
+
this.output('error', args);
|
|
10126
|
+
},
|
|
10127
|
+
output: function output(type, args) {
|
|
10128
|
+
if (console && console[type]) console[type].apply(console, args);
|
|
10129
|
+
}
|
|
10130
|
+
};
|
|
10131
|
+
var Logger = (function () {
|
|
10132
|
+
function Logger(concreteLogger) {
|
|
10133
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10134
|
+
_classCallCheck__default["default"](this, Logger);
|
|
10135
|
+
this.init(concreteLogger, options);
|
|
10136
|
+
}
|
|
10137
|
+
_createClass__default["default"](Logger, [{
|
|
10138
|
+
key: "init",
|
|
10139
|
+
value: function init(concreteLogger) {
|
|
10140
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10141
|
+
this.prefix = options.prefix || 'i18next:';
|
|
10142
|
+
this.logger = concreteLogger || consoleLogger;
|
|
10143
|
+
this.options = options;
|
|
10144
|
+
this.debug = options.debug;
|
|
10145
|
+
}
|
|
10146
|
+
}, {
|
|
10147
|
+
key: "setDebug",
|
|
10148
|
+
value: function setDebug(bool) {
|
|
10149
|
+
this.debug = bool;
|
|
10150
|
+
}
|
|
10151
|
+
}, {
|
|
10152
|
+
key: "log",
|
|
10153
|
+
value: function log() {
|
|
10154
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10155
|
+
args[_key] = arguments[_key];
|
|
10156
|
+
}
|
|
10157
|
+
return this.forward(args, 'log', '', true);
|
|
10158
|
+
}
|
|
10159
|
+
}, {
|
|
10160
|
+
key: "warn",
|
|
10161
|
+
value: function warn() {
|
|
10162
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
10163
|
+
args[_key2] = arguments[_key2];
|
|
10164
|
+
}
|
|
10165
|
+
return this.forward(args, 'warn', '', true);
|
|
10166
|
+
}
|
|
10167
|
+
}, {
|
|
10168
|
+
key: "error",
|
|
10169
|
+
value: function error() {
|
|
10170
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
10171
|
+
args[_key3] = arguments[_key3];
|
|
10172
|
+
}
|
|
10173
|
+
return this.forward(args, 'error', '');
|
|
10174
|
+
}
|
|
10175
|
+
}, {
|
|
10176
|
+
key: "deprecate",
|
|
10177
|
+
value: function deprecate() {
|
|
10178
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
10179
|
+
args[_key4] = arguments[_key4];
|
|
10180
|
+
}
|
|
10181
|
+
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
10182
|
+
}
|
|
10183
|
+
}, {
|
|
10184
|
+
key: "forward",
|
|
10185
|
+
value: function forward(args, lvl, prefix, debugOnly) {
|
|
10186
|
+
if (debugOnly && !this.debug) return null;
|
|
10187
|
+
if (typeof args[0] === 'string') args[0] = ("").concat(prefix).concat(this.prefix, " ").concat(args[0]);
|
|
10188
|
+
return this.logger[lvl](args);
|
|
10189
|
+
}
|
|
10190
|
+
}, {
|
|
10191
|
+
key: "create",
|
|
10192
|
+
value: function create(moduleName) {
|
|
10193
|
+
return new Logger(this.logger, _objectSpread$6(_objectSpread$6({}, {
|
|
10194
|
+
prefix: ("").concat(this.prefix, ":").concat(moduleName, ":")
|
|
10195
|
+
}), this.options));
|
|
10196
|
+
}
|
|
10197
|
+
}, {
|
|
10198
|
+
key: "clone",
|
|
10199
|
+
value: function clone(options) {
|
|
10200
|
+
options = options || this.options;
|
|
10201
|
+
options.prefix = options.prefix || this.prefix;
|
|
10202
|
+
return new Logger(this.logger, options);
|
|
10203
|
+
}
|
|
10204
|
+
}]);
|
|
10205
|
+
return Logger;
|
|
10206
|
+
})();
|
|
10207
|
+
var baseLogger = new Logger();
|
|
10208
|
+
var EventEmitter = (function () {
|
|
10209
|
+
function EventEmitter() {
|
|
10210
|
+
_classCallCheck__default["default"](this, EventEmitter);
|
|
10211
|
+
this.observers = {};
|
|
10212
|
+
}
|
|
10213
|
+
_createClass__default["default"](EventEmitter, [{
|
|
10214
|
+
key: "on",
|
|
10215
|
+
value: function on(events, listener) {
|
|
10216
|
+
var _this = this;
|
|
10217
|
+
events.split(' ').forEach(function (event) {
|
|
10218
|
+
_this.observers[event] = _this.observers[event] || [];
|
|
10219
|
+
_this.observers[event].push(listener);
|
|
10220
|
+
});
|
|
10221
|
+
return this;
|
|
10222
|
+
}
|
|
10223
|
+
}, {
|
|
10224
|
+
key: "off",
|
|
10225
|
+
value: function off(event, listener) {
|
|
10226
|
+
if (!this.observers[event]) return;
|
|
10227
|
+
if (!listener) {
|
|
10228
|
+
delete this.observers[event];
|
|
10229
|
+
return;
|
|
10230
|
+
}
|
|
10231
|
+
this.observers[event] = this.observers[event].filter(function (l) {
|
|
10232
|
+
return l !== listener;
|
|
10233
|
+
});
|
|
10234
|
+
}
|
|
10235
|
+
}, {
|
|
10236
|
+
key: "emit",
|
|
10237
|
+
value: function emit(event) {
|
|
10238
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
10239
|
+
args[_key - 1] = arguments[_key];
|
|
10240
|
+
}
|
|
10241
|
+
if (this.observers[event]) {
|
|
10242
|
+
var cloned = [].concat(this.observers[event]);
|
|
10243
|
+
cloned.forEach(function (observer) {
|
|
10244
|
+
observer.apply(void 0, args);
|
|
10245
|
+
});
|
|
10246
|
+
}
|
|
10247
|
+
if (this.observers['*']) {
|
|
10248
|
+
var _cloned = [].concat(this.observers['*']);
|
|
10249
|
+
_cloned.forEach(function (observer) {
|
|
10250
|
+
observer.apply(observer, [event].concat(args));
|
|
10251
|
+
});
|
|
10252
|
+
}
|
|
10253
|
+
}
|
|
10254
|
+
}]);
|
|
10255
|
+
return EventEmitter;
|
|
10256
|
+
})();
|
|
10257
|
+
function defer() {
|
|
10258
|
+
var res;
|
|
10259
|
+
var rej;
|
|
10260
|
+
var promise = new Promise(function (resolve, reject) {
|
|
10261
|
+
res = resolve;
|
|
10262
|
+
rej = reject;
|
|
10263
|
+
});
|
|
10264
|
+
promise.resolve = res;
|
|
10265
|
+
promise.reject = rej;
|
|
10266
|
+
return promise;
|
|
10267
|
+
}
|
|
10268
|
+
function makeString(object) {
|
|
10269
|
+
if (object == null) return '';
|
|
10270
|
+
return '' + object;
|
|
10271
|
+
}
|
|
10272
|
+
function copy(a, s, t) {
|
|
10273
|
+
a.forEach(function (m) {
|
|
10274
|
+
if (s[m]) t[m] = s[m];
|
|
10275
|
+
});
|
|
10276
|
+
}
|
|
10277
|
+
function getLastOfPath(object, path, Empty) {
|
|
10278
|
+
function cleanKey(key) {
|
|
10279
|
+
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
10280
|
+
}
|
|
10281
|
+
function canNotTraverseDeeper() {
|
|
10282
|
+
return !object || typeof object === 'string';
|
|
10283
|
+
}
|
|
10284
|
+
var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
10285
|
+
while (stack.length > 1) {
|
|
10286
|
+
if (canNotTraverseDeeper()) return {};
|
|
10287
|
+
var key = cleanKey(stack.shift());
|
|
10288
|
+
if (!object[key] && Empty) object[key] = new Empty();
|
|
10289
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
10290
|
+
object = object[key];
|
|
10291
|
+
} else {
|
|
10292
|
+
object = {};
|
|
10293
|
+
}
|
|
10294
|
+
}
|
|
10295
|
+
if (canNotTraverseDeeper()) return {};
|
|
10296
|
+
return {
|
|
10297
|
+
obj: object,
|
|
10298
|
+
k: cleanKey(stack.shift())
|
|
10299
|
+
};
|
|
10300
|
+
}
|
|
10301
|
+
function setPath(object, path, newValue) {
|
|
10302
|
+
var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
|
|
10303
|
+
obj[k] = newValue;
|
|
10304
|
+
}
|
|
10305
|
+
function pushPath(object, path, newValue, concat) {
|
|
10306
|
+
var _getLastOfPath2 = getLastOfPath(object, path, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k;
|
|
10307
|
+
obj[k] = obj[k] || [];
|
|
10308
|
+
if (concat) obj[k] = obj[k].concat(newValue);
|
|
10309
|
+
if (!concat) obj[k].push(newValue);
|
|
10310
|
+
}
|
|
10311
|
+
function getPath(object, path) {
|
|
10312
|
+
var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
|
|
10313
|
+
if (!obj) return undefined;
|
|
10314
|
+
return obj[k];
|
|
10315
|
+
}
|
|
10316
|
+
function getPathWithDefaults(data, defaultData, key) {
|
|
10317
|
+
var value = getPath(data, key);
|
|
10318
|
+
if (value !== undefined) {
|
|
10319
|
+
return value;
|
|
10320
|
+
}
|
|
10321
|
+
return getPath(defaultData, key);
|
|
10322
|
+
}
|
|
10323
|
+
function deepExtend(target, source, overwrite) {
|
|
10324
|
+
for (var prop in source) {
|
|
10325
|
+
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
10326
|
+
if ((prop in target)) {
|
|
10327
|
+
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
10328
|
+
if (overwrite) target[prop] = source[prop];
|
|
10329
|
+
} else {
|
|
10330
|
+
deepExtend(target[prop], source[prop], overwrite);
|
|
10331
|
+
}
|
|
10332
|
+
} else {
|
|
10333
|
+
target[prop] = source[prop];
|
|
10334
|
+
}
|
|
10335
|
+
}
|
|
10336
|
+
}
|
|
10337
|
+
return target;
|
|
10338
|
+
}
|
|
10339
|
+
function regexEscape(str) {
|
|
10340
|
+
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
10341
|
+
}
|
|
10342
|
+
var _entityMap = {
|
|
10343
|
+
'&': '&',
|
|
10344
|
+
'<': '<',
|
|
10345
|
+
'>': '>',
|
|
10346
|
+
'"': '"',
|
|
10347
|
+
"'": ''',
|
|
10348
|
+
'/': '/'
|
|
10349
|
+
};
|
|
10350
|
+
function escape(data) {
|
|
10351
|
+
if (typeof data === 'string') {
|
|
10352
|
+
return data.replace(/[&<>"'\/]/g, function (s) {
|
|
10353
|
+
return _entityMap[s];
|
|
10354
|
+
});
|
|
10355
|
+
}
|
|
10356
|
+
return data;
|
|
10357
|
+
}
|
|
10358
|
+
var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
|
|
10359
|
+
var chars = [' ', ',', '?', '!', ';'];
|
|
10360
|
+
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
10361
|
+
nsSeparator = nsSeparator || '';
|
|
10362
|
+
keySeparator = keySeparator || '';
|
|
10363
|
+
var possibleChars = chars.filter(function (c) {
|
|
10364
|
+
return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
|
|
10365
|
+
});
|
|
10366
|
+
if (possibleChars.length === 0) return true;
|
|
10367
|
+
var r = new RegExp(("(").concat(possibleChars.map(function (c) {
|
|
10368
|
+
return c === '?' ? '\\?' : c;
|
|
10369
|
+
}).join('|'), ")"));
|
|
10370
|
+
var matched = !r.test(key);
|
|
10371
|
+
if (!matched) {
|
|
10372
|
+
var ki = key.indexOf(keySeparator);
|
|
10373
|
+
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
10374
|
+
matched = true;
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
return matched;
|
|
10378
|
+
}
|
|
10379
|
+
function deepFind(obj, path) {
|
|
10380
|
+
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
10381
|
+
if (!obj) return undefined;
|
|
10382
|
+
if (obj[path]) return obj[path];
|
|
10383
|
+
var paths = path.split(keySeparator);
|
|
10384
|
+
var current = obj;
|
|
10385
|
+
for (var i = 0; i < paths.length; ++i) {
|
|
10386
|
+
if (!current) return undefined;
|
|
10387
|
+
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
10388
|
+
return undefined;
|
|
10389
|
+
}
|
|
10390
|
+
if (current[paths[i]] === undefined) {
|
|
10391
|
+
var j = 2;
|
|
10392
|
+
var p = paths.slice(i, i + j).join(keySeparator);
|
|
10393
|
+
var mix = current[p];
|
|
10394
|
+
while (mix === undefined && paths.length > i + j) {
|
|
10395
|
+
j++;
|
|
10396
|
+
p = paths.slice(i, i + j).join(keySeparator);
|
|
10397
|
+
mix = current[p];
|
|
10398
|
+
}
|
|
10399
|
+
if (mix === undefined) return undefined;
|
|
10400
|
+
if (mix === null) return null;
|
|
10401
|
+
if (path.endsWith(p)) {
|
|
10402
|
+
if (typeof mix === 'string') return mix;
|
|
10403
|
+
if (p && typeof mix[p] === 'string') return mix[p];
|
|
10404
|
+
}
|
|
10405
|
+
var joinedPath = paths.slice(i + j).join(keySeparator);
|
|
10406
|
+
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
10407
|
+
return undefined;
|
|
10408
|
+
}
|
|
10409
|
+
current = current[paths[i]];
|
|
10410
|
+
}
|
|
10411
|
+
return current;
|
|
10412
|
+
}
|
|
10413
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
10414
|
+
var keys = Object.keys(object);
|
|
10415
|
+
if (Object.getOwnPropertySymbols) {
|
|
10416
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
10417
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
10418
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10419
|
+
})), keys.push.apply(keys, symbols));
|
|
10420
|
+
}
|
|
10421
|
+
return keys;
|
|
10422
|
+
}
|
|
10423
|
+
function _objectSpread$5(target) {
|
|
10424
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
10425
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
10426
|
+
i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) {
|
|
10427
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
10428
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) {
|
|
10429
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
10430
|
+
});
|
|
10431
|
+
}
|
|
10432
|
+
return target;
|
|
10433
|
+
}
|
|
10434
|
+
function _createSuper$3(Derived) {
|
|
10435
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
10436
|
+
return function _createSuperInternal() {
|
|
10437
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
10438
|
+
if (hasNativeReflectConstruct) {
|
|
10439
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
10440
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
10441
|
+
} else {
|
|
10442
|
+
result = Super.apply(this, arguments);
|
|
10443
|
+
}
|
|
10444
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
10445
|
+
};
|
|
10446
|
+
}
|
|
10447
|
+
function _isNativeReflectConstruct$3() {
|
|
10448
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
10449
|
+
if (Reflect.construct.sham) return false;
|
|
10450
|
+
if (typeof Proxy === "function") return true;
|
|
10451
|
+
try {
|
|
10452
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
10453
|
+
return true;
|
|
10454
|
+
} catch (e) {
|
|
10455
|
+
return false;
|
|
10456
|
+
}
|
|
10457
|
+
}
|
|
10458
|
+
var ResourceStore = (function (_EventEmitter) {
|
|
10459
|
+
_inherits__default["default"](ResourceStore, _EventEmitter);
|
|
10460
|
+
var _super = _createSuper$3(ResourceStore);
|
|
10461
|
+
function ResourceStore(data) {
|
|
10462
|
+
var _this;
|
|
10463
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
10464
|
+
ns: ['translation'],
|
|
10465
|
+
defaultNS: 'translation'
|
|
10466
|
+
};
|
|
10467
|
+
_classCallCheck__default["default"](this, ResourceStore);
|
|
10468
|
+
_this = _super.call(this);
|
|
10469
|
+
if (isIE10) {
|
|
10470
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
10471
|
+
}
|
|
10472
|
+
_this.data = data || ({});
|
|
10473
|
+
_this.options = options;
|
|
10474
|
+
if (_this.options.keySeparator === undefined) {
|
|
10475
|
+
_this.options.keySeparator = '.';
|
|
10476
|
+
}
|
|
10477
|
+
if (_this.options.ignoreJSONStructure === undefined) {
|
|
10478
|
+
_this.options.ignoreJSONStructure = true;
|
|
10479
|
+
}
|
|
10480
|
+
return _this;
|
|
10481
|
+
}
|
|
10482
|
+
_createClass__default["default"](ResourceStore, [{
|
|
10483
|
+
key: "addNamespaces",
|
|
10484
|
+
value: function addNamespaces(ns) {
|
|
10485
|
+
if (this.options.ns.indexOf(ns) < 0) {
|
|
10486
|
+
this.options.ns.push(ns);
|
|
10487
|
+
}
|
|
10488
|
+
}
|
|
10489
|
+
}, {
|
|
10490
|
+
key: "removeNamespaces",
|
|
10491
|
+
value: function removeNamespaces(ns) {
|
|
10492
|
+
var index = this.options.ns.indexOf(ns);
|
|
10493
|
+
if (index > -1) {
|
|
10494
|
+
this.options.ns.splice(index, 1);
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
}, {
|
|
10498
|
+
key: "getResource",
|
|
10499
|
+
value: function getResource(lng, ns, key) {
|
|
10500
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
10501
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
10502
|
+
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
10503
|
+
var path = [lng, ns];
|
|
10504
|
+
if (key && typeof key !== 'string') path = path.concat(key);
|
|
10505
|
+
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
10506
|
+
if (lng.indexOf('.') > -1) {
|
|
10507
|
+
path = lng.split('.');
|
|
10508
|
+
}
|
|
10509
|
+
var result = getPath(this.data, path);
|
|
10510
|
+
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
10511
|
+
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
10512
|
+
}
|
|
10513
|
+
}, {
|
|
10514
|
+
key: "addResource",
|
|
10515
|
+
value: function addResource(lng, ns, key, value) {
|
|
10516
|
+
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
10517
|
+
silent: false
|
|
10518
|
+
};
|
|
10519
|
+
var keySeparator = this.options.keySeparator;
|
|
10520
|
+
if (keySeparator === undefined) keySeparator = '.';
|
|
10521
|
+
var path = [lng, ns];
|
|
10522
|
+
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
10523
|
+
if (lng.indexOf('.') > -1) {
|
|
10524
|
+
path = lng.split('.');
|
|
10525
|
+
value = ns;
|
|
10526
|
+
ns = path[1];
|
|
10527
|
+
}
|
|
10528
|
+
this.addNamespaces(ns);
|
|
10529
|
+
setPath(this.data, path, value);
|
|
10530
|
+
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
10531
|
+
}
|
|
10532
|
+
}, {
|
|
10533
|
+
key: "addResources",
|
|
10534
|
+
value: function addResources(lng, ns, resources) {
|
|
10535
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
10536
|
+
silent: false
|
|
10537
|
+
};
|
|
10538
|
+
for (var m in resources) {
|
|
10539
|
+
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
10540
|
+
silent: true
|
|
10541
|
+
});
|
|
10542
|
+
}
|
|
10543
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
10544
|
+
}
|
|
10545
|
+
}, {
|
|
10546
|
+
key: "addResourceBundle",
|
|
10547
|
+
value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
10548
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
10549
|
+
silent: false
|
|
10550
|
+
};
|
|
10551
|
+
var path = [lng, ns];
|
|
10552
|
+
if (lng.indexOf('.') > -1) {
|
|
10553
|
+
path = lng.split('.');
|
|
10554
|
+
deep = resources;
|
|
10555
|
+
resources = ns;
|
|
10556
|
+
ns = path[1];
|
|
10557
|
+
}
|
|
10558
|
+
this.addNamespaces(ns);
|
|
10559
|
+
var pack = getPath(this.data, path) || ({});
|
|
10560
|
+
if (deep) {
|
|
10561
|
+
deepExtend(pack, resources, overwrite);
|
|
10562
|
+
} else {
|
|
10563
|
+
pack = _objectSpread$5(_objectSpread$5({}, pack), resources);
|
|
10564
|
+
}
|
|
10565
|
+
setPath(this.data, path, pack);
|
|
10566
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
10567
|
+
}
|
|
10568
|
+
}, {
|
|
10569
|
+
key: "removeResourceBundle",
|
|
10570
|
+
value: function removeResourceBundle(lng, ns) {
|
|
10571
|
+
if (this.hasResourceBundle(lng, ns)) {
|
|
10572
|
+
delete this.data[lng][ns];
|
|
10573
|
+
}
|
|
10574
|
+
this.removeNamespaces(ns);
|
|
10575
|
+
this.emit('removed', lng, ns);
|
|
10576
|
+
}
|
|
10577
|
+
}, {
|
|
10578
|
+
key: "hasResourceBundle",
|
|
10579
|
+
value: function hasResourceBundle(lng, ns) {
|
|
10580
|
+
return this.getResource(lng, ns) !== undefined;
|
|
10581
|
+
}
|
|
10582
|
+
}, {
|
|
10583
|
+
key: "getResourceBundle",
|
|
10584
|
+
value: function getResourceBundle(lng, ns) {
|
|
10585
|
+
if (!ns) ns = this.options.defaultNS;
|
|
10586
|
+
if (this.options.compatibilityAPI === 'v1') return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns));
|
|
10587
|
+
return this.getResource(lng, ns);
|
|
10588
|
+
}
|
|
10589
|
+
}, {
|
|
10590
|
+
key: "getDataByLanguage",
|
|
10591
|
+
value: function getDataByLanguage(lng) {
|
|
10592
|
+
return this.data[lng];
|
|
10593
|
+
}
|
|
10594
|
+
}, {
|
|
10595
|
+
key: "hasLanguageSomeTranslations",
|
|
10596
|
+
value: function hasLanguageSomeTranslations(lng) {
|
|
10597
|
+
var data = this.getDataByLanguage(lng);
|
|
10598
|
+
var n = data && Object.keys(data) || [];
|
|
10599
|
+
return !!n.find(function (v) {
|
|
10600
|
+
return data[v] && Object.keys(data[v]).length > 0;
|
|
10601
|
+
});
|
|
10602
|
+
}
|
|
10603
|
+
}, {
|
|
10604
|
+
key: "toJSON",
|
|
10605
|
+
value: function toJSON() {
|
|
10606
|
+
return this.data;
|
|
10607
|
+
}
|
|
10608
|
+
}]);
|
|
10609
|
+
return ResourceStore;
|
|
10610
|
+
})(EventEmitter);
|
|
10611
|
+
var postProcessor = {
|
|
10612
|
+
processors: {},
|
|
10613
|
+
addPostProcessor: function addPostProcessor(module) {
|
|
10614
|
+
this.processors[module.name] = module;
|
|
10615
|
+
},
|
|
10616
|
+
handle: function handle(processors, value, key, options, translator) {
|
|
10617
|
+
var _this = this;
|
|
10618
|
+
processors.forEach(function (processor) {
|
|
10619
|
+
if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
|
|
10620
|
+
});
|
|
10621
|
+
return value;
|
|
10622
|
+
}
|
|
10623
|
+
};
|
|
10624
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
10625
|
+
var keys = Object.keys(object);
|
|
10626
|
+
if (Object.getOwnPropertySymbols) {
|
|
10627
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
10628
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
10629
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10630
|
+
})), keys.push.apply(keys, symbols));
|
|
10631
|
+
}
|
|
10632
|
+
return keys;
|
|
10633
|
+
}
|
|
10634
|
+
function _objectSpread$4(target) {
|
|
10635
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
10636
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
10637
|
+
i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) {
|
|
10638
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
10639
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) {
|
|
10640
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
10641
|
+
});
|
|
10642
|
+
}
|
|
10643
|
+
return target;
|
|
10644
|
+
}
|
|
10645
|
+
function _createSuper$2(Derived) {
|
|
10646
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
10647
|
+
return function _createSuperInternal() {
|
|
10648
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
10649
|
+
if (hasNativeReflectConstruct) {
|
|
10650
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
10651
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
10652
|
+
} else {
|
|
10653
|
+
result = Super.apply(this, arguments);
|
|
10654
|
+
}
|
|
10655
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
10656
|
+
};
|
|
10657
|
+
}
|
|
10658
|
+
function _isNativeReflectConstruct$2() {
|
|
10659
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
10660
|
+
if (Reflect.construct.sham) return false;
|
|
10661
|
+
if (typeof Proxy === "function") return true;
|
|
10662
|
+
try {
|
|
10663
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
10664
|
+
return true;
|
|
10665
|
+
} catch (e) {
|
|
10666
|
+
return false;
|
|
10667
|
+
}
|
|
10668
|
+
}
|
|
10669
|
+
var checkedLoadedFor = {};
|
|
10670
|
+
var Translator$1 = (function (_EventEmitter) {
|
|
10671
|
+
_inherits__default["default"](Translator, _EventEmitter);
|
|
10672
|
+
var _super = _createSuper$2(Translator);
|
|
10673
|
+
function Translator(services) {
|
|
10674
|
+
var _this;
|
|
10675
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10676
|
+
_classCallCheck__default["default"](this, Translator);
|
|
10677
|
+
_this = _super.call(this);
|
|
10678
|
+
if (isIE10) {
|
|
10679
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
10680
|
+
}
|
|
10681
|
+
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized__default["default"](_this));
|
|
10682
|
+
_this.options = options;
|
|
10683
|
+
if (_this.options.keySeparator === undefined) {
|
|
10684
|
+
_this.options.keySeparator = '.';
|
|
10685
|
+
}
|
|
10686
|
+
_this.logger = baseLogger.create('translator');
|
|
10687
|
+
return _this;
|
|
10688
|
+
}
|
|
10689
|
+
_createClass__default["default"](Translator, [{
|
|
10690
|
+
key: "changeLanguage",
|
|
10691
|
+
value: function changeLanguage(lng) {
|
|
10692
|
+
if (lng) this.language = lng;
|
|
10693
|
+
}
|
|
10694
|
+
}, {
|
|
10695
|
+
key: "exists",
|
|
10696
|
+
value: function exists(key) {
|
|
10697
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
10698
|
+
interpolation: {}
|
|
10699
|
+
};
|
|
10700
|
+
if (key === undefined || key === null) {
|
|
10701
|
+
return false;
|
|
10702
|
+
}
|
|
10703
|
+
var resolved = this.resolve(key, options);
|
|
10704
|
+
return resolved && resolved.res !== undefined;
|
|
10705
|
+
}
|
|
10706
|
+
}, {
|
|
10707
|
+
key: "extractFromKey",
|
|
10708
|
+
value: function extractFromKey(key, options) {
|
|
10709
|
+
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
10710
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
10711
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
10712
|
+
var namespaces = options.ns || this.options.defaultNS || [];
|
|
10713
|
+
var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
10714
|
+
var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
10715
|
+
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
10716
|
+
var m = key.match(this.interpolator.nestingRegexp);
|
|
10717
|
+
if (m && m.length > 0) {
|
|
10718
|
+
return {
|
|
10719
|
+
key: key,
|
|
10720
|
+
namespaces: namespaces
|
|
10721
|
+
};
|
|
10722
|
+
}
|
|
10723
|
+
var parts = key.split(nsSeparator);
|
|
10724
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
10725
|
+
key = parts.join(keySeparator);
|
|
10726
|
+
}
|
|
10727
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
10728
|
+
return {
|
|
10729
|
+
key: key,
|
|
10730
|
+
namespaces: namespaces
|
|
10731
|
+
};
|
|
10732
|
+
}
|
|
10733
|
+
}, {
|
|
10734
|
+
key: "translate",
|
|
10735
|
+
value: function translate(keys, options, lastKey) {
|
|
10736
|
+
var _this2 = this;
|
|
10737
|
+
if (_typeof__default["default"](options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
10738
|
+
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
10739
|
+
}
|
|
10740
|
+
if (_typeof__default["default"](options) === 'object') options = _objectSpread$4({}, options);
|
|
10741
|
+
if (!options) options = {};
|
|
10742
|
+
if (keys === undefined || keys === null) return '';
|
|
10743
|
+
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
10744
|
+
var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
|
|
10745
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
10746
|
+
var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces;
|
|
10747
|
+
var namespace = namespaces[namespaces.length - 1];
|
|
10748
|
+
var lng = options.lng || this.language;
|
|
10749
|
+
var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
10750
|
+
if (lng && lng.toLowerCase() === 'cimode') {
|
|
10751
|
+
if (appendNamespaceToCIMode) {
|
|
10752
|
+
var nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
10753
|
+
if (returnDetails) {
|
|
10754
|
+
return {
|
|
10755
|
+
res: ("").concat(namespace).concat(nsSeparator).concat(key),
|
|
10756
|
+
usedKey: key,
|
|
10757
|
+
exactUsedKey: key,
|
|
10758
|
+
usedLng: lng,
|
|
10759
|
+
usedNS: namespace
|
|
10760
|
+
};
|
|
10761
|
+
}
|
|
10762
|
+
return ("").concat(namespace).concat(nsSeparator).concat(key);
|
|
10763
|
+
}
|
|
10764
|
+
if (returnDetails) {
|
|
10765
|
+
return {
|
|
10766
|
+
res: key,
|
|
10767
|
+
usedKey: key,
|
|
10768
|
+
exactUsedKey: key,
|
|
10769
|
+
usedLng: lng,
|
|
10770
|
+
usedNS: namespace
|
|
10771
|
+
};
|
|
10772
|
+
}
|
|
10773
|
+
return key;
|
|
10774
|
+
}
|
|
10775
|
+
var resolved = this.resolve(keys, options);
|
|
10776
|
+
var res = resolved && resolved.res;
|
|
10777
|
+
var resUsedKey = resolved && resolved.usedKey || key;
|
|
10778
|
+
var resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
10779
|
+
var resType = Object.prototype.toString.apply(res);
|
|
10780
|
+
var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
10781
|
+
var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
10782
|
+
var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
10783
|
+
var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
10784
|
+
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
10785
|
+
if (!options.returnObjects && !this.options.returnObjects) {
|
|
10786
|
+
if (!this.options.returnedObjectHandler) {
|
|
10787
|
+
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
10788
|
+
}
|
|
10789
|
+
var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
10790
|
+
ns: namespaces
|
|
10791
|
+
})) : ("key '").concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
10792
|
+
if (returnDetails) {
|
|
10793
|
+
resolved.res = r;
|
|
10794
|
+
return resolved;
|
|
10795
|
+
}
|
|
10796
|
+
return r;
|
|
10797
|
+
}
|
|
10798
|
+
if (keySeparator) {
|
|
10799
|
+
var resTypeIsArray = resType === '[object Array]';
|
|
10800
|
+
var copy = resTypeIsArray ? [] : {};
|
|
10801
|
+
var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
10802
|
+
for (var m in res) {
|
|
10803
|
+
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
10804
|
+
var deepKey = ("").concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
10805
|
+
copy[m] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), {
|
|
10806
|
+
joinArrays: false,
|
|
10807
|
+
ns: namespaces
|
|
10808
|
+
}));
|
|
10809
|
+
if (copy[m] === deepKey) copy[m] = res[m];
|
|
10810
|
+
}
|
|
10811
|
+
}
|
|
10812
|
+
res = copy;
|
|
10813
|
+
}
|
|
10814
|
+
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
10815
|
+
res = res.join(joinArrays);
|
|
10816
|
+
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
10817
|
+
} else {
|
|
10818
|
+
var usedDefault = false;
|
|
10819
|
+
var usedKey = false;
|
|
10820
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
10821
|
+
var hasDefaultValue = Translator.hasDefaultValue(options);
|
|
10822
|
+
var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
|
|
10823
|
+
var defaultValue = options[("defaultValue").concat(defaultValueSuffix)] || options.defaultValue;
|
|
10824
|
+
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
10825
|
+
usedDefault = true;
|
|
10826
|
+
res = defaultValue;
|
|
10827
|
+
}
|
|
10828
|
+
if (!this.isValidLookup(res)) {
|
|
10829
|
+
usedKey = true;
|
|
10830
|
+
res = key;
|
|
10831
|
+
}
|
|
10832
|
+
var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
10833
|
+
var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
10834
|
+
var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
10835
|
+
if (usedKey || usedDefault || updateMissing) {
|
|
10836
|
+
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
10837
|
+
if (keySeparator) {
|
|
10838
|
+
var fk = this.resolve(key, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
10839
|
+
keySeparator: false
|
|
10840
|
+
}));
|
|
10841
|
+
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.');
|
|
10842
|
+
}
|
|
10843
|
+
var lngs = [];
|
|
10844
|
+
var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
10845
|
+
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
10846
|
+
for (var i = 0; i < fallbackLngs.length; i++) {
|
|
10847
|
+
lngs.push(fallbackLngs[i]);
|
|
10848
|
+
}
|
|
10849
|
+
} else if (this.options.saveMissingTo === 'all') {
|
|
10850
|
+
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
10851
|
+
} else {
|
|
10852
|
+
lngs.push(options.lng || this.language);
|
|
10853
|
+
}
|
|
10854
|
+
var send = function send(l, k, specificDefaultValue) {
|
|
10855
|
+
var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
10856
|
+
if (_this2.options.missingKeyHandler) {
|
|
10857
|
+
_this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
10858
|
+
} else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
|
|
10859
|
+
_this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
10860
|
+
}
|
|
10861
|
+
_this2.emit('missingKey', l, namespace, k, res);
|
|
10862
|
+
};
|
|
10863
|
+
if (this.options.saveMissing) {
|
|
10864
|
+
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
10865
|
+
lngs.forEach(function (language) {
|
|
10866
|
+
_this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
|
|
10867
|
+
send([language], key + suffix, options[("defaultValue").concat(suffix)] || defaultValue);
|
|
10868
|
+
});
|
|
10869
|
+
});
|
|
10870
|
+
} else {
|
|
10871
|
+
send(lngs, key, defaultValue);
|
|
10872
|
+
}
|
|
10873
|
+
}
|
|
10874
|
+
}
|
|
10875
|
+
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
10876
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = ("").concat(namespace, ":").concat(key);
|
|
10877
|
+
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
10878
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
10879
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? ("").concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
|
|
10880
|
+
} else {
|
|
10881
|
+
res = this.options.parseMissingKeyHandler(res);
|
|
10882
|
+
}
|
|
10883
|
+
}
|
|
10884
|
+
}
|
|
10885
|
+
if (returnDetails) {
|
|
10886
|
+
resolved.res = res;
|
|
10887
|
+
return resolved;
|
|
10888
|
+
}
|
|
10889
|
+
return res;
|
|
10890
|
+
}
|
|
10891
|
+
}, {
|
|
10892
|
+
key: "extendTranslation",
|
|
10893
|
+
value: function extendTranslation(res, key, options, resolved, lastKey) {
|
|
10894
|
+
var _this3 = this;
|
|
10895
|
+
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
10896
|
+
res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
10897
|
+
resolved: resolved
|
|
10898
|
+
});
|
|
10899
|
+
} else if (!options.skipInterpolation) {
|
|
10900
|
+
if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), {
|
|
10901
|
+
interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation)
|
|
10902
|
+
}));
|
|
10903
|
+
var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
10904
|
+
var nestBef;
|
|
10905
|
+
if (skipOnVariables) {
|
|
10906
|
+
var nb = res.match(this.interpolator.nestingRegexp);
|
|
10907
|
+
nestBef = nb && nb.length;
|
|
10908
|
+
}
|
|
10909
|
+
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
10910
|
+
if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data);
|
|
10911
|
+
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
10912
|
+
if (skipOnVariables) {
|
|
10913
|
+
var na = res.match(this.interpolator.nestingRegexp);
|
|
10914
|
+
var nestAft = na && na.length;
|
|
10915
|
+
if (nestBef < nestAft) options.nest = false;
|
|
10916
|
+
}
|
|
10917
|
+
if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;
|
|
10918
|
+
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
10919
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10920
|
+
args[_key] = arguments[_key];
|
|
10921
|
+
}
|
|
10922
|
+
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
10923
|
+
_this3.logger.warn(("It seems you are nesting recursively key: ").concat(args[0], " in key: ").concat(key[0]));
|
|
10924
|
+
return null;
|
|
10925
|
+
}
|
|
10926
|
+
return _this3.translate.apply(_this3, args.concat([key]));
|
|
10927
|
+
}, options);
|
|
10928
|
+
if (options.interpolation) this.interpolator.reset();
|
|
10929
|
+
}
|
|
10930
|
+
var postProcess = options.postProcess || this.options.postProcess;
|
|
10931
|
+
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
10932
|
+
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
10933
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4({
|
|
10934
|
+
i18nResolved: resolved
|
|
10935
|
+
}, options) : options, this);
|
|
10936
|
+
}
|
|
10937
|
+
return res;
|
|
10938
|
+
}
|
|
10939
|
+
}, {
|
|
10940
|
+
key: "resolve",
|
|
10941
|
+
value: function resolve(keys) {
|
|
10942
|
+
var _this4 = this;
|
|
10943
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10944
|
+
var found;
|
|
10945
|
+
var usedKey;
|
|
10946
|
+
var exactUsedKey;
|
|
10947
|
+
var usedLng;
|
|
10948
|
+
var usedNS;
|
|
10949
|
+
if (typeof keys === 'string') keys = [keys];
|
|
10950
|
+
keys.forEach(function (k) {
|
|
10951
|
+
if (_this4.isValidLookup(found)) return;
|
|
10952
|
+
var extracted = _this4.extractFromKey(k, options);
|
|
10953
|
+
var key = extracted.key;
|
|
10954
|
+
usedKey = key;
|
|
10955
|
+
var namespaces = extracted.namespaces;
|
|
10956
|
+
if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
|
|
10957
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
10958
|
+
var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
|
|
10959
|
+
var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
10960
|
+
var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
|
|
10961
|
+
namespaces.forEach(function (ns) {
|
|
10962
|
+
if (_this4.isValidLookup(found)) return;
|
|
10963
|
+
usedNS = ns;
|
|
10964
|
+
if (!checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
|
|
10965
|
+
checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] = true;
|
|
10966
|
+
_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!!!');
|
|
10967
|
+
}
|
|
10968
|
+
codes.forEach(function (code) {
|
|
10969
|
+
if (_this4.isValidLookup(found)) return;
|
|
10970
|
+
usedLng = code;
|
|
10971
|
+
var finalKeys = [key];
|
|
10972
|
+
if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
|
|
10973
|
+
_this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
10974
|
+
} else {
|
|
10975
|
+
var pluralSuffix;
|
|
10976
|
+
if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
|
|
10977
|
+
var zeroSuffix = ("").concat(_this4.options.pluralSeparator, "zero");
|
|
10978
|
+
if (needsPluralHandling) {
|
|
10979
|
+
finalKeys.push(key + pluralSuffix);
|
|
10980
|
+
if (needsZeroSuffixLookup) {
|
|
10981
|
+
finalKeys.push(key + zeroSuffix);
|
|
10982
|
+
}
|
|
10983
|
+
}
|
|
10984
|
+
if (needsContextHandling) {
|
|
10985
|
+
var contextKey = ("").concat(key).concat(_this4.options.contextSeparator).concat(options.context);
|
|
10986
|
+
finalKeys.push(contextKey);
|
|
10987
|
+
if (needsPluralHandling) {
|
|
10988
|
+
finalKeys.push(contextKey + pluralSuffix);
|
|
10989
|
+
if (needsZeroSuffixLookup) {
|
|
10990
|
+
finalKeys.push(contextKey + zeroSuffix);
|
|
10991
|
+
}
|
|
10992
|
+
}
|
|
10993
|
+
}
|
|
10994
|
+
}
|
|
10995
|
+
var possibleKey;
|
|
10996
|
+
while (possibleKey = finalKeys.pop()) {
|
|
10997
|
+
if (!_this4.isValidLookup(found)) {
|
|
10998
|
+
exactUsedKey = possibleKey;
|
|
10999
|
+
found = _this4.getResource(code, ns, possibleKey, options);
|
|
11000
|
+
}
|
|
11001
|
+
}
|
|
11002
|
+
});
|
|
11003
|
+
});
|
|
11004
|
+
});
|
|
11005
|
+
return {
|
|
11006
|
+
res: found,
|
|
11007
|
+
usedKey: usedKey,
|
|
11008
|
+
exactUsedKey: exactUsedKey,
|
|
11009
|
+
usedLng: usedLng,
|
|
11010
|
+
usedNS: usedNS
|
|
11011
|
+
};
|
|
11012
|
+
}
|
|
11013
|
+
}, {
|
|
11014
|
+
key: "isValidLookup",
|
|
11015
|
+
value: function isValidLookup(res) {
|
|
11016
|
+
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
11017
|
+
}
|
|
11018
|
+
}, {
|
|
11019
|
+
key: "getResource",
|
|
11020
|
+
value: function getResource(code, ns, key) {
|
|
11021
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
11022
|
+
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
11023
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
11024
|
+
}
|
|
11025
|
+
}], [{
|
|
11026
|
+
key: "hasDefaultValue",
|
|
11027
|
+
value: function hasDefaultValue(options) {
|
|
11028
|
+
var prefix = 'defaultValue';
|
|
11029
|
+
for (var option in options) {
|
|
11030
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
11031
|
+
return true;
|
|
11032
|
+
}
|
|
11033
|
+
}
|
|
11034
|
+
return false;
|
|
11035
|
+
}
|
|
11036
|
+
}]);
|
|
11037
|
+
return Translator;
|
|
11038
|
+
})(EventEmitter);
|
|
11039
|
+
function capitalize(string) {
|
|
11040
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
11041
|
+
}
|
|
11042
|
+
var LanguageUtil = (function () {
|
|
11043
|
+
function LanguageUtil(options) {
|
|
11044
|
+
_classCallCheck__default["default"](this, LanguageUtil);
|
|
11045
|
+
this.options = options;
|
|
11046
|
+
this.supportedLngs = this.options.supportedLngs || false;
|
|
11047
|
+
this.logger = baseLogger.create('languageUtils');
|
|
11048
|
+
}
|
|
11049
|
+
_createClass__default["default"](LanguageUtil, [{
|
|
11050
|
+
key: "getScriptPartFromCode",
|
|
11051
|
+
value: function getScriptPartFromCode(code) {
|
|
11052
|
+
if (!code || code.indexOf('-') < 0) return null;
|
|
11053
|
+
var p = code.split('-');
|
|
11054
|
+
if (p.length === 2) return null;
|
|
11055
|
+
p.pop();
|
|
11056
|
+
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
11057
|
+
return this.formatLanguageCode(p.join('-'));
|
|
11058
|
+
}
|
|
11059
|
+
}, {
|
|
11060
|
+
key: "getLanguagePartFromCode",
|
|
11061
|
+
value: function getLanguagePartFromCode(code) {
|
|
11062
|
+
if (!code || code.indexOf('-') < 0) return code;
|
|
11063
|
+
var p = code.split('-');
|
|
11064
|
+
return this.formatLanguageCode(p[0]);
|
|
11065
|
+
}
|
|
11066
|
+
}, {
|
|
11067
|
+
key: "formatLanguageCode",
|
|
11068
|
+
value: function formatLanguageCode(code) {
|
|
11069
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
11070
|
+
var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
11071
|
+
var p = code.split('-');
|
|
11072
|
+
if (this.options.lowerCaseLng) {
|
|
11073
|
+
p = p.map(function (part) {
|
|
11074
|
+
return part.toLowerCase();
|
|
11075
|
+
});
|
|
11076
|
+
} else if (p.length === 2) {
|
|
11077
|
+
p[0] = p[0].toLowerCase();
|
|
11078
|
+
p[1] = p[1].toUpperCase();
|
|
11079
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
11080
|
+
} else if (p.length === 3) {
|
|
11081
|
+
p[0] = p[0].toLowerCase();
|
|
11082
|
+
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
11083
|
+
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
11084
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
11085
|
+
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
|
|
11086
|
+
}
|
|
11087
|
+
return p.join('-');
|
|
11088
|
+
}
|
|
11089
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
11090
|
+
}
|
|
11091
|
+
}, {
|
|
11092
|
+
key: "isSupportedCode",
|
|
11093
|
+
value: function isSupportedCode(code) {
|
|
11094
|
+
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
11095
|
+
code = this.getLanguagePartFromCode(code);
|
|
11096
|
+
}
|
|
11097
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
11098
|
+
}
|
|
11099
|
+
}, {
|
|
11100
|
+
key: "getBestMatchFromCodes",
|
|
11101
|
+
value: function getBestMatchFromCodes(codes) {
|
|
11102
|
+
var _this = this;
|
|
11103
|
+
if (!codes) return null;
|
|
11104
|
+
var found;
|
|
11105
|
+
codes.forEach(function (code) {
|
|
11106
|
+
if (found) return;
|
|
11107
|
+
var cleanedLng = _this.formatLanguageCode(code);
|
|
11108
|
+
if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
11109
|
+
});
|
|
11110
|
+
if (!found && this.options.supportedLngs) {
|
|
11111
|
+
codes.forEach(function (code) {
|
|
11112
|
+
if (found) return;
|
|
11113
|
+
var lngOnly = _this.getLanguagePartFromCode(code);
|
|
11114
|
+
if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
11115
|
+
found = _this.options.supportedLngs.find(function (supportedLng) {
|
|
11116
|
+
if (supportedLng === lngOnly) return supportedLng;
|
|
11117
|
+
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
|
|
11118
|
+
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
11119
|
+
});
|
|
11120
|
+
});
|
|
11121
|
+
}
|
|
11122
|
+
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
11123
|
+
return found;
|
|
11124
|
+
}
|
|
11125
|
+
}, {
|
|
11126
|
+
key: "getFallbackCodes",
|
|
11127
|
+
value: function getFallbackCodes(fallbacks, code) {
|
|
11128
|
+
if (!fallbacks) return [];
|
|
11129
|
+
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
11130
|
+
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
11131
|
+
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
11132
|
+
if (!code) return fallbacks["default"] || [];
|
|
11133
|
+
var found = fallbacks[code];
|
|
11134
|
+
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
11135
|
+
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
11136
|
+
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
11137
|
+
if (!found) found = fallbacks["default"];
|
|
11138
|
+
return found || [];
|
|
11139
|
+
}
|
|
11140
|
+
}, {
|
|
11141
|
+
key: "toResolveHierarchy",
|
|
11142
|
+
value: function toResolveHierarchy(code, fallbackCode) {
|
|
11143
|
+
var _this2 = this;
|
|
11144
|
+
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
11145
|
+
var codes = [];
|
|
11146
|
+
var addCode = function addCode(c) {
|
|
11147
|
+
if (!c) return;
|
|
11148
|
+
if (_this2.isSupportedCode(c)) {
|
|
11149
|
+
codes.push(c);
|
|
11150
|
+
} else {
|
|
11151
|
+
_this2.logger.warn(("rejecting language code not found in supportedLngs: ").concat(c));
|
|
11152
|
+
}
|
|
11153
|
+
};
|
|
11154
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
11155
|
+
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
11156
|
+
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
11157
|
+
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
11158
|
+
} else if (typeof code === 'string') {
|
|
11159
|
+
addCode(this.formatLanguageCode(code));
|
|
11160
|
+
}
|
|
11161
|
+
fallbackCodes.forEach(function (fc) {
|
|
11162
|
+
if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
|
|
11163
|
+
});
|
|
11164
|
+
return codes;
|
|
11165
|
+
}
|
|
11166
|
+
}]);
|
|
11167
|
+
return LanguageUtil;
|
|
11168
|
+
})();
|
|
11169
|
+
var sets = [{
|
|
11170
|
+
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
11171
|
+
nr: [1, 2],
|
|
11172
|
+
fc: 1
|
|
11173
|
+
}, {
|
|
11174
|
+
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'],
|
|
11175
|
+
nr: [1, 2],
|
|
11176
|
+
fc: 2
|
|
11177
|
+
}, {
|
|
11178
|
+
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
11179
|
+
nr: [1],
|
|
11180
|
+
fc: 3
|
|
11181
|
+
}, {
|
|
11182
|
+
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
11183
|
+
nr: [1, 2, 5],
|
|
11184
|
+
fc: 4
|
|
11185
|
+
}, {
|
|
11186
|
+
lngs: ['ar'],
|
|
11187
|
+
nr: [0, 1, 2, 3, 11, 100],
|
|
11188
|
+
fc: 5
|
|
11189
|
+
}, {
|
|
11190
|
+
lngs: ['cs', 'sk'],
|
|
11191
|
+
nr: [1, 2, 5],
|
|
11192
|
+
fc: 6
|
|
11193
|
+
}, {
|
|
11194
|
+
lngs: ['csb', 'pl'],
|
|
11195
|
+
nr: [1, 2, 5],
|
|
11196
|
+
fc: 7
|
|
11197
|
+
}, {
|
|
11198
|
+
lngs: ['cy'],
|
|
11199
|
+
nr: [1, 2, 3, 8],
|
|
11200
|
+
fc: 8
|
|
11201
|
+
}, {
|
|
11202
|
+
lngs: ['fr'],
|
|
11203
|
+
nr: [1, 2],
|
|
11204
|
+
fc: 9
|
|
11205
|
+
}, {
|
|
11206
|
+
lngs: ['ga'],
|
|
11207
|
+
nr: [1, 2, 3, 7, 11],
|
|
11208
|
+
fc: 10
|
|
11209
|
+
}, {
|
|
11210
|
+
lngs: ['gd'],
|
|
11211
|
+
nr: [1, 2, 3, 20],
|
|
11212
|
+
fc: 11
|
|
11213
|
+
}, {
|
|
11214
|
+
lngs: ['is'],
|
|
11215
|
+
nr: [1, 2],
|
|
11216
|
+
fc: 12
|
|
11217
|
+
}, {
|
|
11218
|
+
lngs: ['jv'],
|
|
11219
|
+
nr: [0, 1],
|
|
11220
|
+
fc: 13
|
|
11221
|
+
}, {
|
|
11222
|
+
lngs: ['kw'],
|
|
11223
|
+
nr: [1, 2, 3, 4],
|
|
11224
|
+
fc: 14
|
|
11225
|
+
}, {
|
|
11226
|
+
lngs: ['lt'],
|
|
11227
|
+
nr: [1, 2, 10],
|
|
11228
|
+
fc: 15
|
|
11229
|
+
}, {
|
|
11230
|
+
lngs: ['lv'],
|
|
11231
|
+
nr: [1, 2, 0],
|
|
11232
|
+
fc: 16
|
|
11233
|
+
}, {
|
|
11234
|
+
lngs: ['mk'],
|
|
11235
|
+
nr: [1, 2],
|
|
11236
|
+
fc: 17
|
|
11237
|
+
}, {
|
|
11238
|
+
lngs: ['mnk'],
|
|
11239
|
+
nr: [0, 1, 2],
|
|
11240
|
+
fc: 18
|
|
11241
|
+
}, {
|
|
11242
|
+
lngs: ['mt'],
|
|
11243
|
+
nr: [1, 2, 11, 20],
|
|
11244
|
+
fc: 19
|
|
11245
|
+
}, {
|
|
11246
|
+
lngs: ['or'],
|
|
11247
|
+
nr: [2, 1],
|
|
11248
|
+
fc: 2
|
|
11249
|
+
}, {
|
|
11250
|
+
lngs: ['ro'],
|
|
11251
|
+
nr: [1, 2, 20],
|
|
11252
|
+
fc: 20
|
|
11253
|
+
}, {
|
|
11254
|
+
lngs: ['sl'],
|
|
11255
|
+
nr: [5, 1, 2, 3],
|
|
11256
|
+
fc: 21
|
|
11257
|
+
}, {
|
|
11258
|
+
lngs: ['he', 'iw'],
|
|
11259
|
+
nr: [1, 2, 20, 21],
|
|
11260
|
+
fc: 22
|
|
11261
|
+
}];
|
|
11262
|
+
var _rulesPluralsTypes = {
|
|
11263
|
+
1: function _(n) {
|
|
11264
|
+
return Number(n > 1);
|
|
11265
|
+
},
|
|
11266
|
+
2: function _(n) {
|
|
11267
|
+
return Number(n != 1);
|
|
11268
|
+
},
|
|
11269
|
+
3: function _(n) {
|
|
11270
|
+
return 0;
|
|
11271
|
+
},
|
|
11272
|
+
4: function _(n) {
|
|
11273
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
11274
|
+
},
|
|
11275
|
+
5: function _(n) {
|
|
11276
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
11277
|
+
},
|
|
11278
|
+
6: function _(n) {
|
|
11279
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
11280
|
+
},
|
|
11281
|
+
7: function _(n) {
|
|
11282
|
+
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
11283
|
+
},
|
|
11284
|
+
8: function _(n) {
|
|
11285
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
11286
|
+
},
|
|
11287
|
+
9: function _(n) {
|
|
11288
|
+
return Number(n >= 2);
|
|
11289
|
+
},
|
|
11290
|
+
10: function _(n) {
|
|
11291
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
11292
|
+
},
|
|
11293
|
+
11: function _(n) {
|
|
11294
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
11295
|
+
},
|
|
11296
|
+
12: function _(n) {
|
|
11297
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
11298
|
+
},
|
|
11299
|
+
13: function _(n) {
|
|
11300
|
+
return Number(n !== 0);
|
|
11301
|
+
},
|
|
11302
|
+
14: function _(n) {
|
|
11303
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
11304
|
+
},
|
|
11305
|
+
15: function _(n) {
|
|
11306
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
11307
|
+
},
|
|
11308
|
+
16: function _(n) {
|
|
11309
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
11310
|
+
},
|
|
11311
|
+
17: function _(n) {
|
|
11312
|
+
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
11313
|
+
},
|
|
11314
|
+
18: function _(n) {
|
|
11315
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
11316
|
+
},
|
|
11317
|
+
19: function _(n) {
|
|
11318
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
11319
|
+
},
|
|
11320
|
+
20: function _(n) {
|
|
11321
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
11322
|
+
},
|
|
11323
|
+
21: function _(n) {
|
|
11324
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
11325
|
+
},
|
|
11326
|
+
22: function _(n) {
|
|
11327
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
11328
|
+
}
|
|
11329
|
+
};
|
|
11330
|
+
var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
|
|
11331
|
+
var suffixesOrder = {
|
|
11332
|
+
zero: 0,
|
|
11333
|
+
one: 1,
|
|
11334
|
+
two: 2,
|
|
11335
|
+
few: 3,
|
|
11336
|
+
many: 4,
|
|
11337
|
+
other: 5
|
|
11338
|
+
};
|
|
11339
|
+
function createRules() {
|
|
11340
|
+
var rules = {};
|
|
11341
|
+
sets.forEach(function (set) {
|
|
11342
|
+
set.lngs.forEach(function (l) {
|
|
11343
|
+
rules[l] = {
|
|
11344
|
+
numbers: set.nr,
|
|
11345
|
+
plurals: _rulesPluralsTypes[set.fc]
|
|
11346
|
+
};
|
|
11347
|
+
});
|
|
11348
|
+
});
|
|
11349
|
+
return rules;
|
|
11350
|
+
}
|
|
11351
|
+
var PluralResolver = (function () {
|
|
11352
|
+
function PluralResolver(languageUtils) {
|
|
11353
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11354
|
+
_classCallCheck__default["default"](this, PluralResolver);
|
|
11355
|
+
this.languageUtils = languageUtils;
|
|
11356
|
+
this.options = options;
|
|
11357
|
+
this.logger = baseLogger.create('pluralResolver');
|
|
11358
|
+
if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
|
|
11359
|
+
this.options.compatibilityJSON = 'v3';
|
|
11360
|
+
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.');
|
|
11361
|
+
}
|
|
11362
|
+
this.rules = createRules();
|
|
11363
|
+
}
|
|
11364
|
+
_createClass__default["default"](PluralResolver, [{
|
|
11365
|
+
key: "addRule",
|
|
11366
|
+
value: function addRule(lng, obj) {
|
|
11367
|
+
this.rules[lng] = obj;
|
|
11368
|
+
}
|
|
11369
|
+
}, {
|
|
11370
|
+
key: "getRule",
|
|
11371
|
+
value: function getRule(code) {
|
|
11372
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11373
|
+
if (this.shouldUseIntlApi()) {
|
|
11374
|
+
try {
|
|
11375
|
+
return new Intl.PluralRules(code, {
|
|
11376
|
+
type: options.ordinal ? 'ordinal' : 'cardinal'
|
|
11377
|
+
});
|
|
11378
|
+
} catch (_unused) {
|
|
11379
|
+
return;
|
|
11380
|
+
}
|
|
11381
|
+
}
|
|
11382
|
+
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
11383
|
+
}
|
|
11384
|
+
}, {
|
|
11385
|
+
key: "needsPlural",
|
|
11386
|
+
value: function needsPlural(code) {
|
|
11387
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11388
|
+
var rule = this.getRule(code, options);
|
|
11389
|
+
if (this.shouldUseIntlApi()) {
|
|
11390
|
+
return rule && rule.resolvedOptions().pluralCategories.length > 1;
|
|
11391
|
+
}
|
|
11392
|
+
return rule && rule.numbers.length > 1;
|
|
11393
|
+
}
|
|
11394
|
+
}, {
|
|
11395
|
+
key: "getPluralFormsOfKey",
|
|
11396
|
+
value: function getPluralFormsOfKey(code, key) {
|
|
11397
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
11398
|
+
return this.getSuffixes(code, options).map(function (suffix) {
|
|
11399
|
+
return ("").concat(key).concat(suffix);
|
|
11400
|
+
});
|
|
11401
|
+
}
|
|
11402
|
+
}, {
|
|
11403
|
+
key: "getSuffixes",
|
|
11404
|
+
value: function getSuffixes(code) {
|
|
11405
|
+
var _this = this;
|
|
11406
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11407
|
+
var rule = this.getRule(code, options);
|
|
11408
|
+
if (!rule) {
|
|
11409
|
+
return [];
|
|
11410
|
+
}
|
|
11411
|
+
if (this.shouldUseIntlApi()) {
|
|
11412
|
+
return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
|
|
11413
|
+
return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
|
|
11414
|
+
}).map(function (pluralCategory) {
|
|
11415
|
+
return ("").concat(_this.options.prepend).concat(pluralCategory);
|
|
11416
|
+
});
|
|
11417
|
+
}
|
|
11418
|
+
return rule.numbers.map(function (number) {
|
|
11419
|
+
return _this.getSuffix(code, number, options);
|
|
11420
|
+
});
|
|
11421
|
+
}
|
|
11422
|
+
}, {
|
|
11423
|
+
key: "getSuffix",
|
|
11424
|
+
value: function getSuffix(code, count) {
|
|
11425
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
11426
|
+
var rule = this.getRule(code, options);
|
|
11427
|
+
if (rule) {
|
|
11428
|
+
if (this.shouldUseIntlApi()) {
|
|
11429
|
+
return ("").concat(this.options.prepend).concat(rule.select(count));
|
|
11430
|
+
}
|
|
11431
|
+
return this.getSuffixRetroCompatible(rule, count);
|
|
11432
|
+
}
|
|
11433
|
+
this.logger.warn(("no plural rule found for: ").concat(code));
|
|
11434
|
+
return '';
|
|
11435
|
+
}
|
|
11436
|
+
}, {
|
|
11437
|
+
key: "getSuffixRetroCompatible",
|
|
11438
|
+
value: function getSuffixRetroCompatible(rule, count) {
|
|
11439
|
+
var _this2 = this;
|
|
11440
|
+
var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
11441
|
+
var suffix = rule.numbers[idx];
|
|
11442
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
11443
|
+
if (suffix === 2) {
|
|
11444
|
+
suffix = 'plural';
|
|
11445
|
+
} else if (suffix === 1) {
|
|
11446
|
+
suffix = '';
|
|
11447
|
+
}
|
|
11448
|
+
}
|
|
11449
|
+
var returnSuffix = function returnSuffix() {
|
|
11450
|
+
return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
|
|
11451
|
+
};
|
|
11452
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
11453
|
+
if (suffix === 1) return '';
|
|
11454
|
+
if (typeof suffix === 'number') return ("_plural_").concat(suffix.toString());
|
|
11455
|
+
return returnSuffix();
|
|
11456
|
+
} else if (this.options.compatibilityJSON === 'v2') {
|
|
11457
|
+
return returnSuffix();
|
|
11458
|
+
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
11459
|
+
return returnSuffix();
|
|
11460
|
+
}
|
|
11461
|
+
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
11462
|
+
}
|
|
11463
|
+
}, {
|
|
11464
|
+
key: "shouldUseIntlApi",
|
|
11465
|
+
value: function shouldUseIntlApi() {
|
|
11466
|
+
return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
|
|
11467
|
+
}
|
|
11468
|
+
}]);
|
|
11469
|
+
return PluralResolver;
|
|
11470
|
+
})();
|
|
11471
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
11472
|
+
var keys = Object.keys(object);
|
|
11473
|
+
if (Object.getOwnPropertySymbols) {
|
|
11474
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
11475
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
11476
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
11477
|
+
})), keys.push.apply(keys, symbols));
|
|
11478
|
+
}
|
|
11479
|
+
return keys;
|
|
11480
|
+
}
|
|
11481
|
+
function _objectSpread$3(target) {
|
|
11482
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
11483
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
11484
|
+
i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
|
|
11485
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
11486
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
|
|
11487
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
11488
|
+
});
|
|
11489
|
+
}
|
|
11490
|
+
return target;
|
|
11491
|
+
}
|
|
11492
|
+
function deepFindWithDefaults(data, defaultData, key) {
|
|
11493
|
+
var keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
|
|
11494
|
+
var ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
11495
|
+
var path = getPathWithDefaults(data, defaultData, key);
|
|
11496
|
+
if (!path && ignoreJSONStructure && typeof key === 'string') {
|
|
11497
|
+
path = deepFind(data, key, keySeparator);
|
|
11498
|
+
if (path === undefined) path = deepFind(defaultData, key, keySeparator);
|
|
11499
|
+
}
|
|
11500
|
+
return path;
|
|
11501
|
+
}
|
|
11502
|
+
var Interpolator = (function () {
|
|
11503
|
+
function Interpolator() {
|
|
11504
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11505
|
+
_classCallCheck__default["default"](this, Interpolator);
|
|
11506
|
+
this.logger = baseLogger.create('interpolator');
|
|
11507
|
+
this.options = options;
|
|
11508
|
+
this.format = options.interpolation && options.interpolation.format || (function (value) {
|
|
11509
|
+
return value;
|
|
11510
|
+
});
|
|
11511
|
+
this.init(options);
|
|
11512
|
+
}
|
|
11513
|
+
_createClass__default["default"](Interpolator, [{
|
|
11514
|
+
key: "init",
|
|
11515
|
+
value: function init() {
|
|
11516
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11517
|
+
if (!options.interpolation) options.interpolation = {
|
|
11518
|
+
escapeValue: true
|
|
11519
|
+
};
|
|
11520
|
+
var iOpts = options.interpolation;
|
|
11521
|
+
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
|
|
11522
|
+
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
11523
|
+
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
11524
|
+
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
11525
|
+
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
11526
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
11527
|
+
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
11528
|
+
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
11529
|
+
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
11530
|
+
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
11531
|
+
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
11532
|
+
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
11533
|
+
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
11534
|
+
this.resetRegExp();
|
|
11535
|
+
}
|
|
11536
|
+
}, {
|
|
11537
|
+
key: "reset",
|
|
11538
|
+
value: function reset() {
|
|
11539
|
+
if (this.options) this.init(this.options);
|
|
11540
|
+
}
|
|
11541
|
+
}, {
|
|
11542
|
+
key: "resetRegExp",
|
|
11543
|
+
value: function resetRegExp() {
|
|
11544
|
+
var regexpStr = ("").concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
11545
|
+
this.regexp = new RegExp(regexpStr, 'g');
|
|
11546
|
+
var regexpUnescapeStr = ("").concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
11547
|
+
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
11548
|
+
var nestingRegexpStr = ("").concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
11549
|
+
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
11550
|
+
}
|
|
11551
|
+
}, {
|
|
11552
|
+
key: "interpolate",
|
|
11553
|
+
value: function interpolate(str, data, lng, options) {
|
|
11554
|
+
var _this = this;
|
|
11555
|
+
var match;
|
|
11556
|
+
var value;
|
|
11557
|
+
var replaces;
|
|
11558
|
+
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || ({});
|
|
11559
|
+
function regexSafe(val) {
|
|
11560
|
+
return val.replace(/\$/g, '$$$$');
|
|
11561
|
+
}
|
|
11562
|
+
var handleFormat = function handleFormat(key) {
|
|
11563
|
+
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
11564
|
+
var path = deepFindWithDefaults(data, defaultData, key, _this.options.keySeparator, _this.options.ignoreJSONStructure);
|
|
11565
|
+
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
11566
|
+
interpolationkey: key
|
|
11567
|
+
})) : path;
|
|
11568
|
+
}
|
|
11569
|
+
var p = key.split(_this.formatSeparator);
|
|
11570
|
+
var k = p.shift().trim();
|
|
11571
|
+
var f = p.join(_this.formatSeparator).trim();
|
|
11572
|
+
return _this.format(deepFindWithDefaults(data, defaultData, k, _this.options.keySeparator, _this.options.ignoreJSONStructure), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
11573
|
+
interpolationkey: k
|
|
11574
|
+
}));
|
|
11575
|
+
};
|
|
11576
|
+
this.resetRegExp();
|
|
11577
|
+
var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
11578
|
+
var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
11579
|
+
var todos = [{
|
|
11580
|
+
regex: this.regexpUnescape,
|
|
11581
|
+
safeValue: function safeValue(val) {
|
|
11582
|
+
return regexSafe(val);
|
|
11583
|
+
}
|
|
11584
|
+
}, {
|
|
11585
|
+
regex: this.regexp,
|
|
11586
|
+
safeValue: function safeValue(val) {
|
|
11587
|
+
return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
|
|
11588
|
+
}
|
|
11589
|
+
}];
|
|
11590
|
+
todos.forEach(function (todo) {
|
|
11591
|
+
replaces = 0;
|
|
11592
|
+
while (match = todo.regex.exec(str)) {
|
|
11593
|
+
var matchedVar = match[1].trim();
|
|
11594
|
+
value = handleFormat(matchedVar);
|
|
11595
|
+
if (value === undefined) {
|
|
11596
|
+
if (typeof missingInterpolationHandler === 'function') {
|
|
11597
|
+
var temp = missingInterpolationHandler(str, match, options);
|
|
11598
|
+
value = typeof temp === 'string' ? temp : '';
|
|
11599
|
+
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
11600
|
+
value = '';
|
|
11601
|
+
} else if (skipOnVariables) {
|
|
11602
|
+
value = match[0];
|
|
11603
|
+
continue;
|
|
11604
|
+
} else {
|
|
11605
|
+
_this.logger.warn(("missed to pass in variable ").concat(matchedVar, " for interpolating ").concat(str));
|
|
11606
|
+
value = '';
|
|
11607
|
+
}
|
|
11608
|
+
} else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
|
|
11609
|
+
value = makeString(value);
|
|
11610
|
+
}
|
|
11611
|
+
var safeValue = todo.safeValue(value);
|
|
11612
|
+
str = str.replace(match[0], safeValue);
|
|
11613
|
+
if (skipOnVariables) {
|
|
11614
|
+
todo.regex.lastIndex += value.length;
|
|
11615
|
+
todo.regex.lastIndex -= match[0].length;
|
|
11616
|
+
} else {
|
|
11617
|
+
todo.regex.lastIndex = 0;
|
|
11618
|
+
}
|
|
11619
|
+
replaces++;
|
|
11620
|
+
if (replaces >= _this.maxReplaces) {
|
|
11621
|
+
break;
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11624
|
+
});
|
|
11625
|
+
return str;
|
|
11626
|
+
}
|
|
11627
|
+
}, {
|
|
11628
|
+
key: "nest",
|
|
11629
|
+
value: function nest(str, fc) {
|
|
11630
|
+
var _this2 = this;
|
|
11631
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
11632
|
+
var match;
|
|
11633
|
+
var value;
|
|
11634
|
+
var clonedOptions;
|
|
11635
|
+
function handleHasOptions(key, inheritedOptions) {
|
|
11636
|
+
var sep = this.nestingOptionsSeparator;
|
|
11637
|
+
if (key.indexOf(sep) < 0) return key;
|
|
11638
|
+
var c = key.split(new RegExp(("").concat(sep, "[ ]*{")));
|
|
11639
|
+
var optionsString = ("{").concat(c[1]);
|
|
11640
|
+
key = c[0];
|
|
11641
|
+
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
11642
|
+
var matchedSingleQuotes = optionsString.match(/'/g);
|
|
11643
|
+
var matchedDoubleQuotes = optionsString.match(/"/g);
|
|
11644
|
+
if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
|
|
11645
|
+
optionsString = optionsString.replace(/'/g, '"');
|
|
11646
|
+
}
|
|
11647
|
+
try {
|
|
11648
|
+
clonedOptions = JSON.parse(optionsString);
|
|
11649
|
+
if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
|
|
11650
|
+
} catch (e) {
|
|
11651
|
+
this.logger.warn(("failed parsing options string in nesting for key ").concat(key), e);
|
|
11652
|
+
return ("").concat(key).concat(sep).concat(optionsString);
|
|
11653
|
+
}
|
|
11654
|
+
delete clonedOptions.defaultValue;
|
|
11655
|
+
return key;
|
|
11656
|
+
}
|
|
11657
|
+
while (match = this.nestingRegexp.exec(str)) {
|
|
11658
|
+
var formatters = [];
|
|
11659
|
+
clonedOptions = _objectSpread$3({}, options);
|
|
11660
|
+
clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
|
|
11661
|
+
clonedOptions.applyPostProcessor = false;
|
|
11662
|
+
delete clonedOptions.defaultValue;
|
|
11663
|
+
var doReduce = false;
|
|
11664
|
+
if (match[0].indexOf(this.formatSeparator) !== -1 && !(/{.*}/).test(match[1])) {
|
|
11665
|
+
var r = match[1].split(this.formatSeparator).map(function (elem) {
|
|
11666
|
+
return elem.trim();
|
|
11667
|
+
});
|
|
11668
|
+
match[1] = r.shift();
|
|
11669
|
+
formatters = r;
|
|
11670
|
+
doReduce = true;
|
|
11671
|
+
}
|
|
11672
|
+
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
11673
|
+
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
11674
|
+
if (typeof value !== 'string') value = makeString(value);
|
|
11675
|
+
if (!value) {
|
|
11676
|
+
this.logger.warn(("missed to resolve ").concat(match[1], " for nesting ").concat(str));
|
|
11677
|
+
value = '';
|
|
11678
|
+
}
|
|
11679
|
+
if (doReduce) {
|
|
11680
|
+
value = formatters.reduce(function (v, f) {
|
|
11681
|
+
return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
11682
|
+
interpolationkey: match[1].trim()
|
|
11683
|
+
}));
|
|
11684
|
+
}, value.trim());
|
|
11685
|
+
}
|
|
11686
|
+
str = str.replace(match[0], value);
|
|
11687
|
+
this.regexp.lastIndex = 0;
|
|
11688
|
+
}
|
|
11689
|
+
return str;
|
|
11690
|
+
}
|
|
11691
|
+
}]);
|
|
11692
|
+
return Interpolator;
|
|
11693
|
+
})();
|
|
11694
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
11695
|
+
var keys = Object.keys(object);
|
|
11696
|
+
if (Object.getOwnPropertySymbols) {
|
|
11697
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
11698
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
11699
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
11700
|
+
})), keys.push.apply(keys, symbols));
|
|
11701
|
+
}
|
|
11702
|
+
return keys;
|
|
11703
|
+
}
|
|
11704
|
+
function _objectSpread$2(target) {
|
|
11705
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
11706
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
11707
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
11708
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
11709
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
11710
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
11711
|
+
});
|
|
11712
|
+
}
|
|
11713
|
+
return target;
|
|
11714
|
+
}
|
|
11715
|
+
function parseFormatStr(formatStr) {
|
|
11716
|
+
var formatName = formatStr.toLowerCase().trim();
|
|
11717
|
+
var formatOptions = {};
|
|
11718
|
+
if (formatStr.indexOf('(') > -1) {
|
|
11719
|
+
var p = formatStr.split('(');
|
|
11720
|
+
formatName = p[0].toLowerCase().trim();
|
|
11721
|
+
var optStr = p[1].substring(0, p[1].length - 1);
|
|
11722
|
+
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
11723
|
+
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
11724
|
+
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
11725
|
+
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
11726
|
+
} else {
|
|
11727
|
+
var opts = optStr.split(';');
|
|
11728
|
+
opts.forEach(function (opt) {
|
|
11729
|
+
if (!opt) return;
|
|
11730
|
+
var _opt$split = opt.split(':'), _opt$split2 = _toArray__default["default"](_opt$split), key = _opt$split2[0], rest = _opt$split2.slice(1);
|
|
11731
|
+
var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
11732
|
+
if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
|
|
11733
|
+
if (val === 'false') formatOptions[key.trim()] = false;
|
|
11734
|
+
if (val === 'true') formatOptions[key.trim()] = true;
|
|
11735
|
+
if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
|
|
11736
|
+
});
|
|
11737
|
+
}
|
|
11738
|
+
}
|
|
11739
|
+
return {
|
|
11740
|
+
formatName: formatName,
|
|
11741
|
+
formatOptions: formatOptions
|
|
11742
|
+
};
|
|
11743
|
+
}
|
|
11744
|
+
function createCachedFormatter(fn) {
|
|
11745
|
+
var cache = {};
|
|
11746
|
+
return function invokeFormatter(val, lng, options) {
|
|
11747
|
+
var key = lng + JSON.stringify(options);
|
|
11748
|
+
var formatter = cache[key];
|
|
11749
|
+
if (!formatter) {
|
|
11750
|
+
formatter = fn(lng, options);
|
|
11751
|
+
cache[key] = formatter;
|
|
11752
|
+
}
|
|
11753
|
+
return formatter(val);
|
|
11754
|
+
};
|
|
11755
|
+
}
|
|
11756
|
+
var Formatter = (function () {
|
|
11757
|
+
function Formatter() {
|
|
11758
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11759
|
+
_classCallCheck__default["default"](this, Formatter);
|
|
11760
|
+
this.logger = baseLogger.create('formatter');
|
|
11761
|
+
this.options = options;
|
|
11762
|
+
this.formats = {
|
|
11763
|
+
number: createCachedFormatter(function (lng, opt) {
|
|
11764
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
|
|
11765
|
+
return function (val) {
|
|
11766
|
+
return formatter.format(val);
|
|
11767
|
+
};
|
|
11768
|
+
}),
|
|
11769
|
+
currency: createCachedFormatter(function (lng, opt) {
|
|
11770
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
|
|
11771
|
+
style: 'currency'
|
|
11772
|
+
}));
|
|
11773
|
+
return function (val) {
|
|
11774
|
+
return formatter.format(val);
|
|
11775
|
+
};
|
|
11776
|
+
}),
|
|
11777
|
+
datetime: createCachedFormatter(function (lng, opt) {
|
|
11778
|
+
var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
|
|
11779
|
+
return function (val) {
|
|
11780
|
+
return formatter.format(val);
|
|
11781
|
+
};
|
|
11782
|
+
}),
|
|
11783
|
+
relativetime: createCachedFormatter(function (lng, opt) {
|
|
11784
|
+
var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
|
|
11785
|
+
return function (val) {
|
|
11786
|
+
return formatter.format(val, opt.range || 'day');
|
|
11787
|
+
};
|
|
11788
|
+
}),
|
|
11789
|
+
list: createCachedFormatter(function (lng, opt) {
|
|
11790
|
+
var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
|
|
11791
|
+
return function (val) {
|
|
11792
|
+
return formatter.format(val);
|
|
11793
|
+
};
|
|
11794
|
+
})
|
|
11795
|
+
};
|
|
11796
|
+
this.init(options);
|
|
11797
|
+
}
|
|
11798
|
+
_createClass__default["default"](Formatter, [{
|
|
11799
|
+
key: "init",
|
|
11800
|
+
value: function init(services) {
|
|
11801
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
11802
|
+
interpolation: {}
|
|
11803
|
+
};
|
|
11804
|
+
var iOpts = options.interpolation;
|
|
11805
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
11806
|
+
}
|
|
11807
|
+
}, {
|
|
11808
|
+
key: "add",
|
|
11809
|
+
value: function add(name, fc) {
|
|
11810
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
11811
|
+
}
|
|
11812
|
+
}, {
|
|
11813
|
+
key: "addCached",
|
|
11814
|
+
value: function addCached(name, fc) {
|
|
11815
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
11816
|
+
}
|
|
11817
|
+
}, {
|
|
11818
|
+
key: "format",
|
|
11819
|
+
value: function format(value, _format, lng) {
|
|
11820
|
+
var _this = this;
|
|
11821
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
11822
|
+
var formats = _format.split(this.formatSeparator);
|
|
11823
|
+
var result = formats.reduce(function (mem, f) {
|
|
11824
|
+
var _parseFormatStr = parseFormatStr(f), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions;
|
|
11825
|
+
if (_this.formats[formatName]) {
|
|
11826
|
+
var formatted = mem;
|
|
11827
|
+
try {
|
|
11828
|
+
var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || ({});
|
|
11829
|
+
var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
11830
|
+
formatted = _this.formats[formatName](mem, l, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions));
|
|
11831
|
+
} catch (error) {
|
|
11832
|
+
_this.logger.warn(error);
|
|
11833
|
+
}
|
|
11834
|
+
return formatted;
|
|
11835
|
+
} else {
|
|
11836
|
+
_this.logger.warn(("there was no format function for ").concat(formatName));
|
|
11837
|
+
}
|
|
11838
|
+
return mem;
|
|
11839
|
+
}, value);
|
|
11840
|
+
return result;
|
|
11841
|
+
}
|
|
11842
|
+
}]);
|
|
11843
|
+
return Formatter;
|
|
11844
|
+
})();
|
|
11845
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
11846
|
+
var keys = Object.keys(object);
|
|
11847
|
+
if (Object.getOwnPropertySymbols) {
|
|
11848
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
11849
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
11850
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
11851
|
+
})), keys.push.apply(keys, symbols));
|
|
11852
|
+
}
|
|
11853
|
+
return keys;
|
|
11854
|
+
}
|
|
11855
|
+
function _objectSpread$1(target) {
|
|
11856
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
11857
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
11858
|
+
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
|
11859
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
11860
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
|
11861
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
11862
|
+
});
|
|
11863
|
+
}
|
|
11864
|
+
return target;
|
|
11865
|
+
}
|
|
11866
|
+
function _createSuper$1(Derived) {
|
|
11867
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
11868
|
+
return function _createSuperInternal() {
|
|
11869
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
11870
|
+
if (hasNativeReflectConstruct) {
|
|
11871
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
11872
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
11873
|
+
} else {
|
|
11874
|
+
result = Super.apply(this, arguments);
|
|
11875
|
+
}
|
|
11876
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
11877
|
+
};
|
|
11878
|
+
}
|
|
11879
|
+
function _isNativeReflectConstruct$1() {
|
|
11880
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
11881
|
+
if (Reflect.construct.sham) return false;
|
|
11882
|
+
if (typeof Proxy === "function") return true;
|
|
11883
|
+
try {
|
|
11884
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
11885
|
+
return true;
|
|
11886
|
+
} catch (e) {
|
|
11887
|
+
return false;
|
|
11888
|
+
}
|
|
11889
|
+
}
|
|
11890
|
+
function removePending(q, name) {
|
|
11891
|
+
if (q.pending[name] !== undefined) {
|
|
11892
|
+
delete q.pending[name];
|
|
11893
|
+
q.pendingCount--;
|
|
11894
|
+
}
|
|
11895
|
+
}
|
|
11896
|
+
var Connector = (function (_EventEmitter) {
|
|
11897
|
+
_inherits__default["default"](Connector, _EventEmitter);
|
|
11898
|
+
var _super = _createSuper$1(Connector);
|
|
11899
|
+
function Connector(backend, store, services) {
|
|
11900
|
+
var _this;
|
|
11901
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
11902
|
+
_classCallCheck__default["default"](this, Connector);
|
|
11903
|
+
_this = _super.call(this);
|
|
11904
|
+
if (isIE10) {
|
|
11905
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
11906
|
+
}
|
|
11907
|
+
_this.backend = backend;
|
|
11908
|
+
_this.store = store;
|
|
11909
|
+
_this.services = services;
|
|
11910
|
+
_this.languageUtils = services.languageUtils;
|
|
11911
|
+
_this.options = options;
|
|
11912
|
+
_this.logger = baseLogger.create('backendConnector');
|
|
11913
|
+
_this.waitingReads = [];
|
|
11914
|
+
_this.maxParallelReads = options.maxParallelReads || 10;
|
|
11915
|
+
_this.readingCalls = 0;
|
|
11916
|
+
_this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
11917
|
+
_this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
11918
|
+
_this.state = {};
|
|
11919
|
+
_this.queue = [];
|
|
11920
|
+
if (_this.backend && _this.backend.init) {
|
|
11921
|
+
_this.backend.init(services, options.backend, options);
|
|
11922
|
+
}
|
|
11923
|
+
return _this;
|
|
11924
|
+
}
|
|
11925
|
+
_createClass__default["default"](Connector, [{
|
|
11926
|
+
key: "queueLoad",
|
|
11927
|
+
value: function queueLoad(languages, namespaces, options, callback) {
|
|
11928
|
+
var _this2 = this;
|
|
11929
|
+
var toLoad = {};
|
|
11930
|
+
var pending = {};
|
|
11931
|
+
var toLoadLanguages = {};
|
|
11932
|
+
var toLoadNamespaces = {};
|
|
11933
|
+
languages.forEach(function (lng) {
|
|
11934
|
+
var hasAllNamespaces = true;
|
|
11935
|
+
namespaces.forEach(function (ns) {
|
|
11936
|
+
var name = ("").concat(lng, "|").concat(ns);
|
|
11937
|
+
if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
|
|
11938
|
+
_this2.state[name] = 2;
|
|
11939
|
+
} else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
|
|
11940
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
11941
|
+
} else {
|
|
11942
|
+
_this2.state[name] = 1;
|
|
11943
|
+
hasAllNamespaces = false;
|
|
11944
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
11945
|
+
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
11946
|
+
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
11947
|
+
}
|
|
11948
|
+
});
|
|
11949
|
+
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
11950
|
+
});
|
|
11951
|
+
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
11952
|
+
this.queue.push({
|
|
11953
|
+
pending: pending,
|
|
11954
|
+
pendingCount: Object.keys(pending).length,
|
|
11955
|
+
loaded: {},
|
|
11956
|
+
errors: [],
|
|
11957
|
+
callback: callback
|
|
11958
|
+
});
|
|
11959
|
+
}
|
|
11960
|
+
return {
|
|
11961
|
+
toLoad: Object.keys(toLoad),
|
|
11962
|
+
pending: Object.keys(pending),
|
|
11963
|
+
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
11964
|
+
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
11965
|
+
};
|
|
11966
|
+
}
|
|
11967
|
+
}, {
|
|
11968
|
+
key: "loaded",
|
|
11969
|
+
value: function loaded(name, err, data) {
|
|
11970
|
+
var s = name.split('|');
|
|
11971
|
+
var lng = s[0];
|
|
11972
|
+
var ns = s[1];
|
|
11973
|
+
if (err) this.emit('failedLoading', lng, ns, err);
|
|
11974
|
+
if (data) {
|
|
11975
|
+
this.store.addResourceBundle(lng, ns, data);
|
|
11976
|
+
}
|
|
11977
|
+
this.state[name] = err ? -1 : 2;
|
|
11978
|
+
var loaded = {};
|
|
11979
|
+
this.queue.forEach(function (q) {
|
|
11980
|
+
pushPath(q.loaded, [lng], ns);
|
|
11981
|
+
removePending(q, name);
|
|
11982
|
+
if (err) q.errors.push(err);
|
|
11983
|
+
if (q.pendingCount === 0 && !q.done) {
|
|
11984
|
+
Object.keys(q.loaded).forEach(function (l) {
|
|
11985
|
+
if (!loaded[l]) loaded[l] = {};
|
|
11986
|
+
var loadedKeys = q.loaded[l];
|
|
11987
|
+
if (loadedKeys.length) {
|
|
11988
|
+
loadedKeys.forEach(function (n) {
|
|
11989
|
+
if (loaded[l][n] === undefined) loaded[l][n] = true;
|
|
11990
|
+
});
|
|
11991
|
+
}
|
|
11992
|
+
});
|
|
11993
|
+
q.done = true;
|
|
11994
|
+
if (q.errors.length) {
|
|
11995
|
+
q.callback(q.errors);
|
|
11996
|
+
} else {
|
|
11997
|
+
q.callback();
|
|
11998
|
+
}
|
|
11999
|
+
}
|
|
12000
|
+
});
|
|
12001
|
+
this.emit('loaded', loaded);
|
|
12002
|
+
this.queue = this.queue.filter(function (q) {
|
|
12003
|
+
return !q.done;
|
|
12004
|
+
});
|
|
12005
|
+
}
|
|
12006
|
+
}, {
|
|
12007
|
+
key: "read",
|
|
12008
|
+
value: function read(lng, ns, fcName) {
|
|
12009
|
+
var _this3 = this;
|
|
12010
|
+
var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
12011
|
+
var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
|
|
12012
|
+
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
12013
|
+
if (!lng.length) return callback(null, {});
|
|
12014
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
12015
|
+
this.waitingReads.push({
|
|
12016
|
+
lng: lng,
|
|
12017
|
+
ns: ns,
|
|
12018
|
+
fcName: fcName,
|
|
12019
|
+
tried: tried,
|
|
12020
|
+
wait: wait,
|
|
12021
|
+
callback: callback
|
|
12022
|
+
});
|
|
12023
|
+
return;
|
|
12024
|
+
}
|
|
12025
|
+
this.readingCalls++;
|
|
12026
|
+
var resolver = function resolver(err, data) {
|
|
12027
|
+
_this3.readingCalls--;
|
|
12028
|
+
if (_this3.waitingReads.length > 0) {
|
|
12029
|
+
var next = _this3.waitingReads.shift();
|
|
12030
|
+
_this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
12031
|
+
}
|
|
12032
|
+
if (err && data && tried < _this3.maxRetries) {
|
|
12033
|
+
setTimeout(function () {
|
|
12034
|
+
_this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
12035
|
+
}, wait);
|
|
12036
|
+
return;
|
|
12037
|
+
}
|
|
12038
|
+
callback(err, data);
|
|
12039
|
+
};
|
|
12040
|
+
var fc = this.backend[fcName].bind(this.backend);
|
|
12041
|
+
if (fc.length === 2) {
|
|
12042
|
+
try {
|
|
12043
|
+
var r = fc(lng, ns);
|
|
12044
|
+
if (r && typeof r.then === 'function') {
|
|
12045
|
+
r.then(function (data) {
|
|
12046
|
+
return resolver(null, data);
|
|
12047
|
+
})["catch"](resolver);
|
|
12048
|
+
} else {
|
|
12049
|
+
resolver(null, r);
|
|
12050
|
+
}
|
|
12051
|
+
} catch (err) {
|
|
12052
|
+
resolver(err);
|
|
12053
|
+
}
|
|
12054
|
+
return;
|
|
12055
|
+
}
|
|
12056
|
+
return fc(lng, ns, resolver);
|
|
12057
|
+
}
|
|
12058
|
+
}, {
|
|
12059
|
+
key: "prepareLoading",
|
|
12060
|
+
value: function prepareLoading(languages, namespaces) {
|
|
12061
|
+
var _this4 = this;
|
|
12062
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
12063
|
+
var callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
12064
|
+
if (!this.backend) {
|
|
12065
|
+
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
12066
|
+
return callback && callback();
|
|
12067
|
+
}
|
|
12068
|
+
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
12069
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
12070
|
+
var toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
12071
|
+
if (!toLoad.toLoad.length) {
|
|
12072
|
+
if (!toLoad.pending.length) callback();
|
|
12073
|
+
return null;
|
|
12074
|
+
}
|
|
12075
|
+
toLoad.toLoad.forEach(function (name) {
|
|
12076
|
+
_this4.loadOne(name);
|
|
12077
|
+
});
|
|
12078
|
+
}
|
|
12079
|
+
}, {
|
|
12080
|
+
key: "load",
|
|
12081
|
+
value: function load(languages, namespaces, callback) {
|
|
12082
|
+
this.prepareLoading(languages, namespaces, {}, callback);
|
|
12083
|
+
}
|
|
12084
|
+
}, {
|
|
12085
|
+
key: "reload",
|
|
12086
|
+
value: function reload(languages, namespaces, callback) {
|
|
12087
|
+
this.prepareLoading(languages, namespaces, {
|
|
12088
|
+
reload: true
|
|
12089
|
+
}, callback);
|
|
12090
|
+
}
|
|
12091
|
+
}, {
|
|
12092
|
+
key: "loadOne",
|
|
12093
|
+
value: function loadOne(name) {
|
|
12094
|
+
var _this5 = this;
|
|
12095
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
12096
|
+
var s = name.split('|');
|
|
12097
|
+
var lng = s[0];
|
|
12098
|
+
var ns = s[1];
|
|
12099
|
+
this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
|
|
12100
|
+
if (err) _this5.logger.warn(("").concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
|
|
12101
|
+
if (!err && data) _this5.logger.log(("").concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
|
|
12102
|
+
_this5.loaded(name, err, data);
|
|
12103
|
+
});
|
|
12104
|
+
}
|
|
12105
|
+
}, {
|
|
12106
|
+
key: "saveMissing",
|
|
12107
|
+
value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
12108
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
12109
|
+
var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
|
|
12110
|
+
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
12111
|
+
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!!!');
|
|
12112
|
+
return;
|
|
12113
|
+
}
|
|
12114
|
+
if (key === undefined || key === null || key === '') return;
|
|
12115
|
+
if (this.backend && this.backend.create) {
|
|
12116
|
+
var opts = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
12117
|
+
isUpdate: isUpdate
|
|
12118
|
+
});
|
|
12119
|
+
var fc = this.backend.create.bind(this.backend);
|
|
12120
|
+
if (fc.length < 6) {
|
|
12121
|
+
try {
|
|
12122
|
+
var r;
|
|
12123
|
+
if (fc.length === 5) {
|
|
12124
|
+
r = fc(languages, namespace, key, fallbackValue, opts);
|
|
12125
|
+
} else {
|
|
12126
|
+
r = fc(languages, namespace, key, fallbackValue);
|
|
12127
|
+
}
|
|
12128
|
+
if (r && typeof r.then === 'function') {
|
|
12129
|
+
r.then(function (data) {
|
|
12130
|
+
return clb(null, data);
|
|
12131
|
+
})["catch"](clb);
|
|
12132
|
+
} else {
|
|
12133
|
+
clb(null, r);
|
|
12134
|
+
}
|
|
12135
|
+
} catch (err) {
|
|
12136
|
+
clb(err);
|
|
12137
|
+
}
|
|
12138
|
+
} else {
|
|
12139
|
+
fc(languages, namespace, key, fallbackValue, clb, opts);
|
|
12140
|
+
}
|
|
12141
|
+
}
|
|
12142
|
+
if (!languages || !languages[0]) return;
|
|
12143
|
+
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
12144
|
+
}
|
|
12145
|
+
}]);
|
|
12146
|
+
return Connector;
|
|
12147
|
+
})(EventEmitter);
|
|
12148
|
+
function get$1() {
|
|
12149
|
+
return {
|
|
12150
|
+
debug: false,
|
|
12151
|
+
initImmediate: true,
|
|
12152
|
+
ns: ['translation'],
|
|
12153
|
+
defaultNS: ['translation'],
|
|
12154
|
+
fallbackLng: ['dev'],
|
|
12155
|
+
fallbackNS: false,
|
|
12156
|
+
supportedLngs: false,
|
|
12157
|
+
nonExplicitSupportedLngs: false,
|
|
12158
|
+
load: 'all',
|
|
12159
|
+
preload: false,
|
|
12160
|
+
simplifyPluralSuffix: true,
|
|
12161
|
+
keySeparator: '.',
|
|
12162
|
+
nsSeparator: ':',
|
|
12163
|
+
pluralSeparator: '_',
|
|
12164
|
+
contextSeparator: '_',
|
|
12165
|
+
partialBundledLanguages: false,
|
|
12166
|
+
saveMissing: false,
|
|
12167
|
+
updateMissing: false,
|
|
12168
|
+
saveMissingTo: 'fallback',
|
|
12169
|
+
saveMissingPlurals: true,
|
|
12170
|
+
missingKeyHandler: false,
|
|
12171
|
+
missingInterpolationHandler: false,
|
|
12172
|
+
postProcess: false,
|
|
12173
|
+
postProcessPassResolved: false,
|
|
12174
|
+
returnNull: true,
|
|
12175
|
+
returnEmptyString: true,
|
|
12176
|
+
returnObjects: false,
|
|
12177
|
+
joinArrays: false,
|
|
12178
|
+
returnedObjectHandler: false,
|
|
12179
|
+
parseMissingKeyHandler: false,
|
|
12180
|
+
appendNamespaceToMissingKey: false,
|
|
12181
|
+
appendNamespaceToCIMode: false,
|
|
12182
|
+
overloadTranslationOptionHandler: function handle(args) {
|
|
12183
|
+
var ret = {};
|
|
12184
|
+
if (_typeof__default["default"](args[1]) === 'object') ret = args[1];
|
|
12185
|
+
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
12186
|
+
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
12187
|
+
if (_typeof__default["default"](args[2]) === 'object' || _typeof__default["default"](args[3]) === 'object') {
|
|
12188
|
+
var options = args[3] || args[2];
|
|
12189
|
+
Object.keys(options).forEach(function (key) {
|
|
12190
|
+
ret[key] = options[key];
|
|
12191
|
+
});
|
|
12192
|
+
}
|
|
12193
|
+
return ret;
|
|
12194
|
+
},
|
|
12195
|
+
interpolation: {
|
|
12196
|
+
escapeValue: true,
|
|
12197
|
+
format: function format(value, _format, lng, options) {
|
|
12198
|
+
return value;
|
|
12199
|
+
},
|
|
12200
|
+
prefix: '{{',
|
|
12201
|
+
suffix: '}}',
|
|
12202
|
+
formatSeparator: ',',
|
|
12203
|
+
unescapePrefix: '-',
|
|
12204
|
+
nestingPrefix: '$t(',
|
|
12205
|
+
nestingSuffix: ')',
|
|
12206
|
+
nestingOptionsSeparator: ',',
|
|
12207
|
+
maxReplaces: 1000,
|
|
12208
|
+
skipOnVariables: true
|
|
12209
|
+
}
|
|
12210
|
+
};
|
|
12211
|
+
}
|
|
12212
|
+
function transformOptions(options) {
|
|
12213
|
+
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
12214
|
+
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
12215
|
+
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
12216
|
+
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
12217
|
+
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
12218
|
+
}
|
|
12219
|
+
return options;
|
|
12220
|
+
}
|
|
12221
|
+
function ownKeys(object, enumerableOnly) {
|
|
12222
|
+
var keys = Object.keys(object);
|
|
12223
|
+
if (Object.getOwnPropertySymbols) {
|
|
12224
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
12225
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
12226
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
12227
|
+
})), keys.push.apply(keys, symbols));
|
|
12228
|
+
}
|
|
12229
|
+
return keys;
|
|
12230
|
+
}
|
|
12231
|
+
function _objectSpread(target) {
|
|
12232
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
12233
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
12234
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
12235
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
12236
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
12237
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
12238
|
+
});
|
|
12239
|
+
}
|
|
12240
|
+
return target;
|
|
12241
|
+
}
|
|
12242
|
+
function _createSuper(Derived) {
|
|
12243
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
12244
|
+
return function _createSuperInternal() {
|
|
12245
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
12246
|
+
if (hasNativeReflectConstruct) {
|
|
12247
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
12248
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
12249
|
+
} else {
|
|
12250
|
+
result = Super.apply(this, arguments);
|
|
12251
|
+
}
|
|
12252
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
12253
|
+
};
|
|
12254
|
+
}
|
|
12255
|
+
function _isNativeReflectConstruct() {
|
|
12256
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
12257
|
+
if (Reflect.construct.sham) return false;
|
|
12258
|
+
if (typeof Proxy === "function") return true;
|
|
12259
|
+
try {
|
|
12260
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
12261
|
+
return true;
|
|
12262
|
+
} catch (e) {
|
|
12263
|
+
return false;
|
|
12264
|
+
}
|
|
12265
|
+
}
|
|
12266
|
+
function noop() {}
|
|
12267
|
+
function bindMemberFunctions(inst) {
|
|
12268
|
+
var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
12269
|
+
mems.forEach(function (mem) {
|
|
12270
|
+
if (typeof inst[mem] === 'function') {
|
|
12271
|
+
inst[mem] = inst[mem].bind(inst);
|
|
12272
|
+
}
|
|
12273
|
+
});
|
|
12274
|
+
}
|
|
12275
|
+
var I18n = (function (_EventEmitter) {
|
|
12276
|
+
_inherits__default["default"](I18n, _EventEmitter);
|
|
12277
|
+
var _super = _createSuper(I18n);
|
|
12278
|
+
function I18n() {
|
|
12279
|
+
var _this;
|
|
12280
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12281
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
12282
|
+
_classCallCheck__default["default"](this, I18n);
|
|
12283
|
+
_this = _super.call(this);
|
|
12284
|
+
if (isIE10) {
|
|
12285
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
12286
|
+
}
|
|
12287
|
+
_this.options = transformOptions(options);
|
|
12288
|
+
_this.services = {};
|
|
12289
|
+
_this.logger = baseLogger;
|
|
12290
|
+
_this.modules = {
|
|
12291
|
+
external: []
|
|
12292
|
+
};
|
|
12293
|
+
bindMemberFunctions(_assertThisInitialized__default["default"](_this));
|
|
12294
|
+
if (callback && !_this.isInitialized && !options.isClone) {
|
|
12295
|
+
if (!_this.options.initImmediate) {
|
|
12296
|
+
_this.init(options, callback);
|
|
12297
|
+
return _possibleConstructorReturn__default["default"](_this, _assertThisInitialized__default["default"](_this));
|
|
12298
|
+
}
|
|
12299
|
+
setTimeout(function () {
|
|
12300
|
+
_this.init(options, callback);
|
|
12301
|
+
}, 0);
|
|
12302
|
+
}
|
|
12303
|
+
return _this;
|
|
12304
|
+
}
|
|
12305
|
+
_createClass__default["default"](I18n, [{
|
|
12306
|
+
key: "init",
|
|
12307
|
+
value: function init() {
|
|
12308
|
+
var _this2 = this;
|
|
12309
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12310
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
12311
|
+
if (typeof options === 'function') {
|
|
12312
|
+
callback = options;
|
|
12313
|
+
options = {};
|
|
12314
|
+
}
|
|
12315
|
+
if (!options.defaultNS && options.defaultNS !== false && options.ns) {
|
|
12316
|
+
if (typeof options.ns === 'string') {
|
|
12317
|
+
options.defaultNS = options.ns;
|
|
12318
|
+
} else if (options.ns.indexOf('translation') < 0) {
|
|
12319
|
+
options.defaultNS = options.ns[0];
|
|
12320
|
+
}
|
|
12321
|
+
}
|
|
12322
|
+
var defOpts = get$1();
|
|
12323
|
+
this.options = _objectSpread(_objectSpread(_objectSpread({}, defOpts), this.options), transformOptions(options));
|
|
12324
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
12325
|
+
this.options.interpolation = _objectSpread(_objectSpread({}, defOpts.interpolation), this.options.interpolation);
|
|
12326
|
+
}
|
|
12327
|
+
if (options.keySeparator !== undefined) {
|
|
12328
|
+
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
12329
|
+
}
|
|
12330
|
+
if (options.nsSeparator !== undefined) {
|
|
12331
|
+
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
12332
|
+
}
|
|
12333
|
+
function createClassOnDemand(ClassOrObject) {
|
|
12334
|
+
if (!ClassOrObject) return null;
|
|
12335
|
+
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
12336
|
+
return ClassOrObject;
|
|
12337
|
+
}
|
|
12338
|
+
if (!this.options.isClone) {
|
|
12339
|
+
if (this.modules.logger) {
|
|
12340
|
+
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
12341
|
+
} else {
|
|
12342
|
+
baseLogger.init(null, this.options);
|
|
12343
|
+
}
|
|
12344
|
+
var formatter;
|
|
12345
|
+
if (this.modules.formatter) {
|
|
12346
|
+
formatter = this.modules.formatter;
|
|
12347
|
+
} else if (typeof Intl !== 'undefined') {
|
|
12348
|
+
formatter = Formatter;
|
|
12349
|
+
}
|
|
12350
|
+
var lu = new LanguageUtil(this.options);
|
|
12351
|
+
this.store = new ResourceStore(this.options.resources, this.options);
|
|
12352
|
+
var s = this.services;
|
|
12353
|
+
s.logger = baseLogger;
|
|
12354
|
+
s.resourceStore = this.store;
|
|
12355
|
+
s.languageUtils = lu;
|
|
12356
|
+
s.pluralResolver = new PluralResolver(lu, {
|
|
12357
|
+
prepend: this.options.pluralSeparator,
|
|
12358
|
+
compatibilityJSON: this.options.compatibilityJSON,
|
|
12359
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
12360
|
+
});
|
|
12361
|
+
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
12362
|
+
s.formatter = createClassOnDemand(formatter);
|
|
12363
|
+
s.formatter.init(s, this.options);
|
|
12364
|
+
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
12365
|
+
}
|
|
12366
|
+
s.interpolator = new Interpolator(this.options);
|
|
12367
|
+
s.utils = {
|
|
12368
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
12369
|
+
};
|
|
12370
|
+
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
12371
|
+
s.backendConnector.on('*', function (event) {
|
|
12372
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
12373
|
+
args[_key - 1] = arguments[_key];
|
|
12374
|
+
}
|
|
12375
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
12376
|
+
});
|
|
12377
|
+
if (this.modules.languageDetector) {
|
|
12378
|
+
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
12379
|
+
if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
|
|
12380
|
+
}
|
|
12381
|
+
if (this.modules.i18nFormat) {
|
|
12382
|
+
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
12383
|
+
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
12384
|
+
}
|
|
12385
|
+
this.translator = new Translator$1(this.services, this.options);
|
|
12386
|
+
this.translator.on('*', function (event) {
|
|
12387
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
12388
|
+
args[_key2 - 1] = arguments[_key2];
|
|
12389
|
+
}
|
|
12390
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
12391
|
+
});
|
|
12392
|
+
this.modules.external.forEach(function (m) {
|
|
12393
|
+
if (m.init) m.init(_this2);
|
|
12394
|
+
});
|
|
12395
|
+
}
|
|
12396
|
+
this.format = this.options.interpolation.format;
|
|
12397
|
+
if (!callback) callback = noop;
|
|
12398
|
+
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
12399
|
+
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
12400
|
+
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
12401
|
+
}
|
|
12402
|
+
if (!this.services.languageDetector && !this.options.lng) {
|
|
12403
|
+
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
12404
|
+
}
|
|
12405
|
+
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
12406
|
+
storeApi.forEach(function (fcName) {
|
|
12407
|
+
_this2[fcName] = function () {
|
|
12408
|
+
var _this2$store;
|
|
12409
|
+
return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
|
|
12410
|
+
};
|
|
12411
|
+
});
|
|
12412
|
+
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
12413
|
+
storeApiChained.forEach(function (fcName) {
|
|
12414
|
+
_this2[fcName] = function () {
|
|
12415
|
+
var _this2$store2;
|
|
12416
|
+
(_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
|
|
12417
|
+
return _this2;
|
|
12418
|
+
};
|
|
12419
|
+
});
|
|
12420
|
+
var deferred = defer();
|
|
12421
|
+
var load = function load() {
|
|
12422
|
+
var finish = function finish(err, t) {
|
|
12423
|
+
if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
12424
|
+
_this2.isInitialized = true;
|
|
12425
|
+
if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
|
|
12426
|
+
_this2.emit('initialized', _this2.options);
|
|
12427
|
+
deferred.resolve(t);
|
|
12428
|
+
callback(err, t);
|
|
12429
|
+
};
|
|
12430
|
+
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
|
|
12431
|
+
_this2.changeLanguage(_this2.options.lng, finish);
|
|
12432
|
+
};
|
|
12433
|
+
if (this.options.resources || !this.options.initImmediate) {
|
|
12434
|
+
load();
|
|
12435
|
+
} else {
|
|
12436
|
+
setTimeout(load, 0);
|
|
12437
|
+
}
|
|
12438
|
+
return deferred;
|
|
12439
|
+
}
|
|
12440
|
+
}, {
|
|
12441
|
+
key: "loadResources",
|
|
12442
|
+
value: function loadResources(language) {
|
|
12443
|
+
var _this3 = this;
|
|
12444
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
12445
|
+
var usedCallback = callback;
|
|
12446
|
+
var usedLng = typeof language === 'string' ? language : this.language;
|
|
12447
|
+
if (typeof language === 'function') usedCallback = language;
|
|
12448
|
+
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
12449
|
+
if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
|
|
12450
|
+
var toLoad = [];
|
|
12451
|
+
var append = function append(lng) {
|
|
12452
|
+
if (!lng) return;
|
|
12453
|
+
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
12454
|
+
lngs.forEach(function (l) {
|
|
12455
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
12456
|
+
});
|
|
12457
|
+
};
|
|
12458
|
+
if (!usedLng) {
|
|
12459
|
+
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
12460
|
+
fallbacks.forEach(function (l) {
|
|
12461
|
+
return append(l);
|
|
12462
|
+
});
|
|
12463
|
+
} else {
|
|
12464
|
+
append(usedLng);
|
|
12465
|
+
}
|
|
12466
|
+
if (this.options.preload) {
|
|
12467
|
+
this.options.preload.forEach(function (l) {
|
|
12468
|
+
return append(l);
|
|
12469
|
+
});
|
|
12470
|
+
}
|
|
12471
|
+
this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
|
|
12472
|
+
if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
|
|
12473
|
+
usedCallback(e);
|
|
12474
|
+
});
|
|
12475
|
+
} else {
|
|
12476
|
+
usedCallback(null);
|
|
12477
|
+
}
|
|
12478
|
+
}
|
|
12479
|
+
}, {
|
|
12480
|
+
key: "reloadResources",
|
|
12481
|
+
value: function reloadResources(lngs, ns, callback) {
|
|
12482
|
+
var deferred = defer();
|
|
12483
|
+
if (!lngs) lngs = this.languages;
|
|
12484
|
+
if (!ns) ns = this.options.ns;
|
|
12485
|
+
if (!callback) callback = noop;
|
|
12486
|
+
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
12487
|
+
deferred.resolve();
|
|
12488
|
+
callback(err);
|
|
12489
|
+
});
|
|
12490
|
+
return deferred;
|
|
12491
|
+
}
|
|
12492
|
+
}, {
|
|
12493
|
+
key: "use",
|
|
12494
|
+
value: function use(module) {
|
|
12495
|
+
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
12496
|
+
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
12497
|
+
if (module.type === 'backend') {
|
|
12498
|
+
this.modules.backend = module;
|
|
12499
|
+
}
|
|
12500
|
+
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
12501
|
+
this.modules.logger = module;
|
|
12502
|
+
}
|
|
12503
|
+
if (module.type === 'languageDetector') {
|
|
12504
|
+
this.modules.languageDetector = module;
|
|
12505
|
+
}
|
|
12506
|
+
if (module.type === 'i18nFormat') {
|
|
12507
|
+
this.modules.i18nFormat = module;
|
|
12508
|
+
}
|
|
12509
|
+
if (module.type === 'postProcessor') {
|
|
12510
|
+
postProcessor.addPostProcessor(module);
|
|
12511
|
+
}
|
|
12512
|
+
if (module.type === 'formatter') {
|
|
12513
|
+
this.modules.formatter = module;
|
|
12514
|
+
}
|
|
12515
|
+
if (module.type === '3rdParty') {
|
|
12516
|
+
this.modules.external.push(module);
|
|
12517
|
+
}
|
|
12518
|
+
return this;
|
|
12519
|
+
}
|
|
12520
|
+
}, {
|
|
12521
|
+
key: "setResolvedLanguage",
|
|
12522
|
+
value: function setResolvedLanguage(l) {
|
|
12523
|
+
if (!l || !this.languages) return;
|
|
12524
|
+
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
12525
|
+
for (var li = 0; li < this.languages.length; li++) {
|
|
12526
|
+
var lngInLngs = this.languages[li];
|
|
12527
|
+
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
12528
|
+
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
12529
|
+
this.resolvedLanguage = lngInLngs;
|
|
12530
|
+
break;
|
|
12531
|
+
}
|
|
12532
|
+
}
|
|
12533
|
+
}
|
|
12534
|
+
}, {
|
|
12535
|
+
key: "changeLanguage",
|
|
12536
|
+
value: function changeLanguage(lng, callback) {
|
|
12537
|
+
var _this4 = this;
|
|
12538
|
+
this.isLanguageChangingTo = lng;
|
|
12539
|
+
var deferred = defer();
|
|
12540
|
+
this.emit('languageChanging', lng);
|
|
12541
|
+
var setLngProps = function setLngProps(l) {
|
|
12542
|
+
_this4.language = l;
|
|
12543
|
+
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
12544
|
+
_this4.resolvedLanguage = undefined;
|
|
12545
|
+
_this4.setResolvedLanguage(l);
|
|
12546
|
+
};
|
|
12547
|
+
var done = function done(err, l) {
|
|
12548
|
+
if (l) {
|
|
12549
|
+
setLngProps(l);
|
|
12550
|
+
_this4.translator.changeLanguage(l);
|
|
12551
|
+
_this4.isLanguageChangingTo = undefined;
|
|
12552
|
+
_this4.emit('languageChanged', l);
|
|
12553
|
+
_this4.logger.log('languageChanged', l);
|
|
12554
|
+
} else {
|
|
12555
|
+
_this4.isLanguageChangingTo = undefined;
|
|
12556
|
+
}
|
|
12557
|
+
deferred.resolve(function () {
|
|
12558
|
+
return _this4.t.apply(_this4, arguments);
|
|
12559
|
+
});
|
|
12560
|
+
if (callback) callback(err, function () {
|
|
12561
|
+
return _this4.t.apply(_this4, arguments);
|
|
12562
|
+
});
|
|
12563
|
+
};
|
|
12564
|
+
var setLng = function setLng(lngs) {
|
|
12565
|
+
if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
|
|
12566
|
+
var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
12567
|
+
if (l) {
|
|
12568
|
+
if (!_this4.language) {
|
|
12569
|
+
setLngProps(l);
|
|
12570
|
+
}
|
|
12571
|
+
if (!_this4.translator.language) _this4.translator.changeLanguage(l);
|
|
12572
|
+
if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l);
|
|
12573
|
+
}
|
|
12574
|
+
_this4.loadResources(l, function (err) {
|
|
12575
|
+
done(err, l);
|
|
12576
|
+
});
|
|
12577
|
+
};
|
|
12578
|
+
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
12579
|
+
setLng(this.services.languageDetector.detect());
|
|
12580
|
+
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
12581
|
+
if (this.services.languageDetector.detect.length === 0) {
|
|
12582
|
+
this.services.languageDetector.detect().then(setLng);
|
|
12583
|
+
} else {
|
|
12584
|
+
this.services.languageDetector.detect(setLng);
|
|
12585
|
+
}
|
|
12586
|
+
} else {
|
|
12587
|
+
setLng(lng);
|
|
12588
|
+
}
|
|
12589
|
+
return deferred;
|
|
12590
|
+
}
|
|
12591
|
+
}, {
|
|
12592
|
+
key: "getFixedT",
|
|
12593
|
+
value: function getFixedT(lng, ns, keyPrefix) {
|
|
12594
|
+
var _this5 = this;
|
|
12595
|
+
var fixedT = function fixedT(key, opts) {
|
|
12596
|
+
var options;
|
|
12597
|
+
if (_typeof__default["default"](opts) !== 'object') {
|
|
12598
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
12599
|
+
rest[_key3 - 2] = arguments[_key3];
|
|
12600
|
+
}
|
|
12601
|
+
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
12602
|
+
} else {
|
|
12603
|
+
options = _objectSpread({}, opts);
|
|
12604
|
+
}
|
|
12605
|
+
options.lng = options.lng || fixedT.lng;
|
|
12606
|
+
options.lngs = options.lngs || fixedT.lngs;
|
|
12607
|
+
options.ns = options.ns || fixedT.ns;
|
|
12608
|
+
options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
12609
|
+
var keySeparator = _this5.options.keySeparator || '.';
|
|
12610
|
+
var resultKey;
|
|
12611
|
+
if (options.keyPrefix && Array.isArray(key)) {
|
|
12612
|
+
resultKey = key.map(function (k) {
|
|
12613
|
+
return ("").concat(options.keyPrefix).concat(keySeparator).concat(k);
|
|
12614
|
+
});
|
|
12615
|
+
} else {
|
|
12616
|
+
resultKey = options.keyPrefix ? ("").concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
|
|
12617
|
+
}
|
|
12618
|
+
return _this5.t(resultKey, options);
|
|
12619
|
+
};
|
|
12620
|
+
if (typeof lng === 'string') {
|
|
12621
|
+
fixedT.lng = lng;
|
|
12622
|
+
} else {
|
|
12623
|
+
fixedT.lngs = lng;
|
|
12624
|
+
}
|
|
12625
|
+
fixedT.ns = ns;
|
|
12626
|
+
fixedT.keyPrefix = keyPrefix;
|
|
12627
|
+
return fixedT;
|
|
12628
|
+
}
|
|
12629
|
+
}, {
|
|
12630
|
+
key: "t",
|
|
12631
|
+
value: function t() {
|
|
12632
|
+
var _this$translator;
|
|
12633
|
+
return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
|
|
12634
|
+
}
|
|
12635
|
+
}, {
|
|
12636
|
+
key: "exists",
|
|
12637
|
+
value: function exists() {
|
|
12638
|
+
var _this$translator2;
|
|
12639
|
+
return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
|
|
12640
|
+
}
|
|
12641
|
+
}, {
|
|
12642
|
+
key: "setDefaultNamespace",
|
|
12643
|
+
value: function setDefaultNamespace(ns) {
|
|
12644
|
+
this.options.defaultNS = ns;
|
|
12645
|
+
}
|
|
12646
|
+
}, {
|
|
12647
|
+
key: "hasLoadedNamespace",
|
|
12648
|
+
value: function hasLoadedNamespace(ns) {
|
|
12649
|
+
var _this6 = this;
|
|
12650
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12651
|
+
if (!this.isInitialized) {
|
|
12652
|
+
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
12653
|
+
return false;
|
|
12654
|
+
}
|
|
12655
|
+
if (!this.languages || !this.languages.length) {
|
|
12656
|
+
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
12657
|
+
return false;
|
|
12658
|
+
}
|
|
12659
|
+
var lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
12660
|
+
var fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
12661
|
+
var lastLng = this.languages[this.languages.length - 1];
|
|
12662
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
12663
|
+
var loadNotPending = function loadNotPending(l, n) {
|
|
12664
|
+
var loadState = _this6.services.backendConnector.state[("").concat(l, "|").concat(n)];
|
|
12665
|
+
return loadState === -1 || loadState === 2;
|
|
12666
|
+
};
|
|
12667
|
+
if (options.precheck) {
|
|
12668
|
+
var preResult = options.precheck(this, loadNotPending);
|
|
12669
|
+
if (preResult !== undefined) return preResult;
|
|
12670
|
+
}
|
|
12671
|
+
if (this.hasResourceBundle(lng, ns)) return true;
|
|
12672
|
+
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
12673
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
12674
|
+
return false;
|
|
12675
|
+
}
|
|
12676
|
+
}, {
|
|
12677
|
+
key: "loadNamespaces",
|
|
12678
|
+
value: function loadNamespaces(ns, callback) {
|
|
12679
|
+
var _this7 = this;
|
|
12680
|
+
var deferred = defer();
|
|
12681
|
+
if (!this.options.ns) {
|
|
12682
|
+
if (callback) callback();
|
|
12683
|
+
return Promise.resolve();
|
|
12684
|
+
}
|
|
12685
|
+
if (typeof ns === 'string') ns = [ns];
|
|
12686
|
+
ns.forEach(function (n) {
|
|
12687
|
+
if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
|
|
12688
|
+
});
|
|
12689
|
+
this.loadResources(function (err) {
|
|
12690
|
+
deferred.resolve();
|
|
12691
|
+
if (callback) callback(err);
|
|
12692
|
+
});
|
|
12693
|
+
return deferred;
|
|
12694
|
+
}
|
|
12695
|
+
}, {
|
|
12696
|
+
key: "loadLanguages",
|
|
12697
|
+
value: function loadLanguages(lngs, callback) {
|
|
12698
|
+
var deferred = defer();
|
|
12699
|
+
if (typeof lngs === 'string') lngs = [lngs];
|
|
12700
|
+
var preloaded = this.options.preload || [];
|
|
12701
|
+
var newLngs = lngs.filter(function (lng) {
|
|
12702
|
+
return preloaded.indexOf(lng) < 0;
|
|
12703
|
+
});
|
|
12704
|
+
if (!newLngs.length) {
|
|
12705
|
+
if (callback) callback();
|
|
12706
|
+
return Promise.resolve();
|
|
12707
|
+
}
|
|
12708
|
+
this.options.preload = preloaded.concat(newLngs);
|
|
12709
|
+
this.loadResources(function (err) {
|
|
12710
|
+
deferred.resolve();
|
|
12711
|
+
if (callback) callback(err);
|
|
12712
|
+
});
|
|
12713
|
+
return deferred;
|
|
12714
|
+
}
|
|
12715
|
+
}, {
|
|
12716
|
+
key: "dir",
|
|
12717
|
+
value: function dir(lng) {
|
|
12718
|
+
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
|
|
12719
|
+
if (!lng) return 'rtl';
|
|
12720
|
+
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'];
|
|
12721
|
+
var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get$1());
|
|
12722
|
+
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
12723
|
+
}
|
|
12724
|
+
}, {
|
|
12725
|
+
key: "cloneInstance",
|
|
12726
|
+
value: function cloneInstance() {
|
|
12727
|
+
var _this8 = this;
|
|
12728
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12729
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
12730
|
+
var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, this.options), options), {
|
|
12731
|
+
isClone: true
|
|
12732
|
+
});
|
|
12733
|
+
var clone = new I18n(mergedOptions);
|
|
12734
|
+
if (options.debug !== undefined || options.prefix !== undefined) {
|
|
12735
|
+
clone.logger = clone.logger.clone(options);
|
|
12736
|
+
}
|
|
12737
|
+
var membersToCopy = ['store', 'services', 'language'];
|
|
12738
|
+
membersToCopy.forEach(function (m) {
|
|
12739
|
+
clone[m] = _this8[m];
|
|
12740
|
+
});
|
|
12741
|
+
clone.services = _objectSpread({}, this.services);
|
|
12742
|
+
clone.services.utils = {
|
|
12743
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
12744
|
+
};
|
|
12745
|
+
clone.translator = new Translator$1(clone.services, clone.options);
|
|
12746
|
+
clone.translator.on('*', function (event) {
|
|
12747
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
12748
|
+
args[_key4 - 1] = arguments[_key4];
|
|
12749
|
+
}
|
|
12750
|
+
clone.emit.apply(clone, [event].concat(args));
|
|
12751
|
+
});
|
|
12752
|
+
clone.init(mergedOptions, callback);
|
|
12753
|
+
clone.translator.options = clone.options;
|
|
12754
|
+
clone.translator.backendConnector.services.utils = {
|
|
12755
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
12756
|
+
};
|
|
12757
|
+
return clone;
|
|
12758
|
+
}
|
|
12759
|
+
}, {
|
|
12760
|
+
key: "toJSON",
|
|
12761
|
+
value: function toJSON() {
|
|
12762
|
+
return {
|
|
12763
|
+
options: this.options,
|
|
12764
|
+
store: this.store,
|
|
12765
|
+
language: this.language,
|
|
12766
|
+
languages: this.languages,
|
|
12767
|
+
resolvedLanguage: this.resolvedLanguage
|
|
12768
|
+
};
|
|
12769
|
+
}
|
|
12770
|
+
}]);
|
|
12771
|
+
return I18n;
|
|
12772
|
+
})(EventEmitter);
|
|
12773
|
+
_defineProperty__default["default"](I18n, "createInstance", function () {
|
|
12774
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12775
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
12776
|
+
return new I18n(options, callback);
|
|
12777
|
+
});
|
|
12778
|
+
var instance = I18n.createInstance();
|
|
12779
|
+
instance.createInstance = I18n.createInstance;
|
|
12780
|
+
var i18next = instance;
|
|
12781
|
+
var en = {};
|
|
12782
|
+
(function (exports) {
|
|
12783
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12784
|
+
value: true
|
|
12785
|
+
});
|
|
12786
|
+
exports["default"] = void 0;
|
|
12787
|
+
var _default = {
|
|
12788
|
+
translation: {
|
|
12789
|
+
categorize: {
|
|
12790
|
+
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
12791
|
+
maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
|
|
12792
|
+
},
|
|
12793
|
+
ebsr: {
|
|
12794
|
+
part: 'Part {{index}}'
|
|
12795
|
+
},
|
|
12796
|
+
numberLine: {
|
|
12797
|
+
addElementLimit_one: 'You can only add {{count}} element',
|
|
12798
|
+
addElementLimit_other: 'You can only add {{count}} elements',
|
|
12799
|
+
clearAll: 'Clear all'
|
|
12800
|
+
},
|
|
12801
|
+
imageClozeAssociation: {
|
|
12802
|
+
reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
|
|
12803
|
+
reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
|
|
12804
|
+
},
|
|
12805
|
+
drawingResponse: {
|
|
12806
|
+
fillColor: 'Fill color',
|
|
12807
|
+
outlineColor: 'Outline color',
|
|
12808
|
+
noFill: 'No fill',
|
|
12809
|
+
lightblue: 'Light blue',
|
|
12810
|
+
lightyellow: 'Light yellow',
|
|
12811
|
+
red: 'Red',
|
|
12812
|
+
orange: 'Orange',
|
|
12813
|
+
yellow: 'Yellow',
|
|
12814
|
+
violet: 'Violet',
|
|
12815
|
+
blue: 'Blue',
|
|
12816
|
+
green: 'Green',
|
|
12817
|
+
white: 'White',
|
|
12818
|
+
black: 'Black',
|
|
12819
|
+
onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
|
|
12820
|
+
},
|
|
12821
|
+
charting: {
|
|
12822
|
+
addCategory: 'Add category',
|
|
12823
|
+
newLabel: 'New label',
|
|
12824
|
+
reachedLimit_other: "There can't be more than {{count}} categories."
|
|
12825
|
+
},
|
|
12826
|
+
graphing: {
|
|
12827
|
+
point: 'Point',
|
|
12828
|
+
circle: 'Circle',
|
|
12829
|
+
line: 'Line',
|
|
12830
|
+
parabola: 'Parabola',
|
|
12831
|
+
absolute: 'Absolute Value',
|
|
12832
|
+
exponential: 'Exponential',
|
|
12833
|
+
polygon: 'Polygon',
|
|
12834
|
+
ray: 'Ray',
|
|
12835
|
+
segment: 'Segment',
|
|
12836
|
+
sine: 'Sine',
|
|
12837
|
+
vector: 'Vector',
|
|
12838
|
+
label: 'Label',
|
|
12839
|
+
redo: 'Redo',
|
|
12840
|
+
reset: 'Reset'
|
|
12841
|
+
},
|
|
12842
|
+
mathInline: {
|
|
12843
|
+
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.'
|
|
12844
|
+
},
|
|
12845
|
+
selectText: {
|
|
12846
|
+
correctAnswerSelected: 'Correct answer selected',
|
|
12847
|
+
correctAnswerNotSelected: 'Correct answer not selected',
|
|
12848
|
+
incorrectSelection: 'Incorrect selection'
|
|
12849
|
+
}
|
|
12850
|
+
},
|
|
12851
|
+
common: {
|
|
12852
|
+
undo: 'Undo',
|
|
12853
|
+
clearAll: 'Clear all',
|
|
12854
|
+
correct: 'Correct',
|
|
12855
|
+
incorrect: 'Incorrect',
|
|
12856
|
+
showCorrectAnswer: 'Show correct answer',
|
|
12857
|
+
hideCorrectAnswer: 'Hide correct answer',
|
|
12858
|
+
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.',
|
|
12859
|
+
warning: 'Warning',
|
|
12860
|
+
showNote: 'Show Note',
|
|
12861
|
+
hideNote: 'Hide Note',
|
|
12862
|
+
cancel: 'Cancel'
|
|
12863
|
+
}
|
|
12864
|
+
};
|
|
12865
|
+
exports["default"] = _default;
|
|
12866
|
+
})(en);
|
|
12867
|
+
getDefaultExportFromCjs(en);
|
|
12868
|
+
var es = {};
|
|
12869
|
+
(function (exports) {
|
|
12870
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12871
|
+
value: true
|
|
12872
|
+
});
|
|
12873
|
+
exports["default"] = void 0;
|
|
12874
|
+
var _default = {
|
|
12875
|
+
translation: {
|
|
12876
|
+
categorize: {
|
|
12877
|
+
limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
12878
|
+
maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
|
|
12879
|
+
},
|
|
12880
|
+
ebsr: {
|
|
12881
|
+
part: 'Parte {{index}}'
|
|
12882
|
+
},
|
|
12883
|
+
numberLine: {
|
|
12884
|
+
addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
|
|
12885
|
+
addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
|
|
12886
|
+
clearAll: 'Borrar todo'
|
|
12887
|
+
},
|
|
12888
|
+
imageClozeAssociation: {
|
|
12889
|
+
reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
12890
|
+
reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
|
|
12891
|
+
},
|
|
12892
|
+
drawingResponse: {
|
|
12893
|
+
fillColor: 'Color de relleno',
|
|
12894
|
+
outlineColor: 'Color del contorno',
|
|
12895
|
+
noFill: 'Sin relleno',
|
|
12896
|
+
lightblue: 'Azul claro',
|
|
12897
|
+
lightyellow: 'Amarillo claro',
|
|
12898
|
+
red: 'Rojo',
|
|
12899
|
+
orange: 'Naranja',
|
|
12900
|
+
yellow: 'Amarillo',
|
|
12901
|
+
violet: 'Violeta',
|
|
12902
|
+
blue: 'Azul',
|
|
12903
|
+
green: 'Verde',
|
|
12904
|
+
white: 'Blanco',
|
|
12905
|
+
black: 'Negro',
|
|
12906
|
+
onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
|
|
12907
|
+
},
|
|
12908
|
+
charting: {
|
|
12909
|
+
addCategory: 'Añadir categoría',
|
|
12910
|
+
newLabel: 'Nueva etiqueta',
|
|
12911
|
+
reachedLimit_other: 'No puede haber más de {{count}} categorías.'
|
|
12912
|
+
},
|
|
12913
|
+
graphing: {
|
|
12914
|
+
point: 'Punto',
|
|
12915
|
+
circle: 'Circulo',
|
|
12916
|
+
line: 'Línea',
|
|
12917
|
+
parabola: 'Parábola',
|
|
12918
|
+
absolute: 'Valor absoluto',
|
|
12919
|
+
exponential: 'Exponencial',
|
|
12920
|
+
polygon: 'Polígono',
|
|
12921
|
+
ray: 'Semirrecta',
|
|
12922
|
+
segment: 'Segmento ',
|
|
12923
|
+
sine: 'Seno',
|
|
12924
|
+
vector: 'Vector',
|
|
12925
|
+
label: 'Etiqueta',
|
|
12926
|
+
redo: 'Rehacer',
|
|
12927
|
+
reset: 'Reiniciar'
|
|
12928
|
+
},
|
|
12929
|
+
mathInline: {
|
|
12930
|
+
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.'
|
|
12931
|
+
},
|
|
12932
|
+
selectText: {
|
|
12933
|
+
correctAnswerSelected: 'Respuesta correcta seleccionada',
|
|
12934
|
+
correctAnswerNotSelected: 'Respuesta correcta no seleccionada',
|
|
12935
|
+
incorrectSelection: 'Selección incorrecta'
|
|
12936
|
+
}
|
|
12937
|
+
},
|
|
12938
|
+
common: {
|
|
12939
|
+
undo: 'Deshacer',
|
|
12940
|
+
clearAll: 'Borrar todo',
|
|
12941
|
+
correct: 'Correct',
|
|
12942
|
+
incorrect: 'Incorrect',
|
|
12943
|
+
showCorrectAnswer: 'Mostrar respuesta correcta',
|
|
12944
|
+
hideCorrectAnswer: 'Ocultar respuesta correcta',
|
|
12945
|
+
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.',
|
|
12946
|
+
warning: 'Advertencia',
|
|
12947
|
+
showNote: 'Mostrar Nota',
|
|
12948
|
+
hideNote: 'Ocultar Nota',
|
|
12949
|
+
cancel: 'Cancelar'
|
|
12950
|
+
}
|
|
12951
|
+
};
|
|
12952
|
+
exports["default"] = _default;
|
|
12953
|
+
})(es);
|
|
12954
|
+
getDefaultExportFromCjs(es);
|
|
12955
|
+
(function (exports) {
|
|
12956
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
12957
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12958
|
+
value: true
|
|
12959
|
+
});
|
|
12960
|
+
exports["default"] = void 0;
|
|
12961
|
+
var _defineProperty2 = _interopRequireDefault(defineProperty$2.exports);
|
|
12962
|
+
var _i18next = _interopRequireDefault(i18next);
|
|
12963
|
+
var _en = _interopRequireDefault(en);
|
|
12964
|
+
var _es = _interopRequireDefault(es);
|
|
12965
|
+
function ownKeys(object, enumerableOnly) {
|
|
12966
|
+
var keys = Object.keys(object);
|
|
12967
|
+
if (Object.getOwnPropertySymbols) {
|
|
12968
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
12969
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
12970
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
12971
|
+
})), keys.push.apply(keys, symbols));
|
|
12972
|
+
}
|
|
12973
|
+
return keys;
|
|
12974
|
+
}
|
|
12975
|
+
function _objectSpread(target) {
|
|
12976
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
12977
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
12978
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
12979
|
+
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
12980
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
12981
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
12982
|
+
});
|
|
12983
|
+
}
|
|
12984
|
+
return target;
|
|
12985
|
+
}
|
|
12986
|
+
_i18next["default"].init({
|
|
12987
|
+
fallbackLng: "en",
|
|
12988
|
+
lng: "en",
|
|
12989
|
+
debug: true,
|
|
12990
|
+
resources: {
|
|
12991
|
+
en: _en["default"],
|
|
12992
|
+
es: _es["default"]
|
|
12993
|
+
}
|
|
12994
|
+
});
|
|
12995
|
+
var _default = {
|
|
12996
|
+
translator: _objectSpread(_objectSpread({}, _i18next["default"]), {}, {
|
|
12997
|
+
t: function t(key, options) {
|
|
12998
|
+
var lng = options.lng;
|
|
12999
|
+
switch (lng) {
|
|
13000
|
+
case "en_US":
|
|
13001
|
+
case "en-US":
|
|
13002
|
+
options.lng = "en";
|
|
13003
|
+
break;
|
|
13004
|
+
case "es_ES":
|
|
13005
|
+
case "es-ES":
|
|
13006
|
+
case "es_MX":
|
|
13007
|
+
case "es-MX":
|
|
13008
|
+
options.lng = "es";
|
|
13009
|
+
break;
|
|
13010
|
+
}
|
|
13011
|
+
return _i18next["default"].t(key, _objectSpread({
|
|
13012
|
+
lng: lng
|
|
13013
|
+
}, options));
|
|
13014
|
+
}
|
|
13015
|
+
}),
|
|
13016
|
+
languageOptions: [{
|
|
13017
|
+
value: "en_US",
|
|
13018
|
+
label: "English (US)"
|
|
13019
|
+
}, {
|
|
13020
|
+
value: "es_ES",
|
|
13021
|
+
label: "Spanish"
|
|
13022
|
+
}]
|
|
13023
|
+
};
|
|
13024
|
+
exports["default"] = _default;
|
|
13025
|
+
})(translator$1);
|
|
13026
|
+
getDefaultExportFromCjs(translator$1);
|
|
13027
|
+
(function (exports) {
|
|
13028
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
13029
|
+
Object.defineProperty(exports, "__esModule", {
|
|
13030
|
+
value: true
|
|
13031
|
+
});
|
|
13032
|
+
Object.defineProperty(exports, "Translator", {
|
|
13033
|
+
enumerable: true,
|
|
13034
|
+
get: function get() {
|
|
13035
|
+
return _translator["default"];
|
|
13036
|
+
}
|
|
13037
|
+
});
|
|
13038
|
+
exports["default"] = void 0;
|
|
13039
|
+
var _translator = _interopRequireDefault(translator$1);
|
|
13040
|
+
var _default = _translator["default"];
|
|
13041
|
+
exports["default"] = _default;
|
|
13042
|
+
})(translator$2);
|
|
13043
|
+
var Translator = getDefaultExportFromCjs(translator$2);
|
|
13044
|
+
const {cloneDeep: cloneDeep} = _dll_lodash;
|
|
13045
|
+
const {get: get} = _dll_lodash;
|
|
13046
|
+
const debug = _dll_debug;
|
|
13047
|
+
const MC_TAG_NAME = 'ebsr-multiple-choice';
|
|
13048
|
+
const SESSION_CHANGED = SessionChangedEvent_1.TYPE;
|
|
13049
|
+
const {translator} = Translator;
|
|
13050
|
+
const log = debug('pie-element:ebsr:print');
|
|
13051
|
+
const preparePrintModel = (model, opts) => {
|
|
13052
|
+
const instr = opts.role === 'instructor';
|
|
13053
|
+
model.prompt = model.promptEnabled !== false ? model.prompt : undefined;
|
|
13054
|
+
model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
|
|
13055
|
+
model.showTeacherInstructions = instr;
|
|
13056
|
+
model.alwaysShowCorrect = instr;
|
|
13057
|
+
model.mode = instr ? 'evaluate' : 'gather';
|
|
13058
|
+
model.disabled = true;
|
|
13059
|
+
model.animationsDisabled = true;
|
|
13060
|
+
model.lockChoiceOrder = true;
|
|
13061
|
+
model.choicesLayout = model.choicesLayout || 'vertical';
|
|
13062
|
+
const choices = cloneDeep(model.choices);
|
|
13063
|
+
model.choices = choices.map(c => {
|
|
13064
|
+
c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;
|
|
13065
|
+
c.hideTick = instr;
|
|
13066
|
+
c.feedback = undefined;
|
|
13067
|
+
return c;
|
|
13068
|
+
});
|
|
13069
|
+
model.keyMode = model.choicePrefix || 'letters';
|
|
13070
|
+
return model;
|
|
13071
|
+
};
|
|
13072
|
+
class EbsrMC extends MultipleChoice {}
|
|
13073
|
+
const defineMultipleChoice = () => {
|
|
13074
|
+
if (!customElements.get(MC_TAG_NAME)) {
|
|
13075
|
+
customElements.define(MC_TAG_NAME, EbsrMC);
|
|
13076
|
+
}
|
|
13077
|
+
};
|
|
13078
|
+
defineMultipleChoice();
|
|
13079
|
+
const isNonEmptyArray = a => Array.isArray(a) && a.length > 0;
|
|
13080
|
+
const isSessionComplete = session => {
|
|
13081
|
+
const a = get(session, 'value.partA.value');
|
|
13082
|
+
const b = get(session, 'value.partB.value');
|
|
13083
|
+
return isNonEmptyArray(a) && isNonEmptyArray(b);
|
|
13084
|
+
};
|
|
13085
|
+
class Ebsr extends HTMLElement {
|
|
13086
|
+
constructor() {
|
|
13087
|
+
super();
|
|
13088
|
+
Ebsr.prototype.__init.call(this);
|
|
13089
|
+
this._model = {};
|
|
13090
|
+
this._session = {};
|
|
13091
|
+
this._options = null;
|
|
13092
|
+
}
|
|
13093
|
+
__init() {
|
|
13094
|
+
this.onSessionUpdated = e => {
|
|
13095
|
+
if (e.target === this) {
|
|
13096
|
+
return;
|
|
13097
|
+
}
|
|
13098
|
+
e.preventDefault();
|
|
13099
|
+
e.stopImmediatePropagation();
|
|
13100
|
+
const id = e.target.getAttribute('id');
|
|
13101
|
+
if (id) {
|
|
13102
|
+
const key = `part${id.toUpperCase()}`;
|
|
13103
|
+
if (e.update) {
|
|
13104
|
+
this._model[key] = e.update;
|
|
13105
|
+
}
|
|
13106
|
+
this.dispatchSessionChanged(e.srcElement._session, key);
|
|
13107
|
+
}
|
|
13108
|
+
};
|
|
13109
|
+
}
|
|
13110
|
+
set model(m) {
|
|
13111
|
+
this._model = m;
|
|
13112
|
+
customElements.whenDefined(MC_TAG_NAME).then(() => {
|
|
13113
|
+
this.setPartModel(this.partA, 'partA');
|
|
13114
|
+
this.setPartModel(this.partB, 'partB');
|
|
13115
|
+
});
|
|
13116
|
+
}
|
|
13117
|
+
set session(s) {
|
|
13118
|
+
this._session = s;
|
|
13119
|
+
customElements.whenDefined(MC_TAG_NAME).then(() => {
|
|
13120
|
+
this.setPartSession(this.partA, 'partA');
|
|
13121
|
+
this.setPartSession(this.partB, 'partB');
|
|
13122
|
+
});
|
|
13123
|
+
}
|
|
13124
|
+
setPartModel(part, key) {
|
|
13125
|
+
if (this._model && this._model[key] && part) {
|
|
13126
|
+
let labels = {
|
|
13127
|
+
'partA': undefined,
|
|
13128
|
+
'partB': undefined
|
|
13129
|
+
};
|
|
13130
|
+
if (this._model.partLabels) {
|
|
13131
|
+
const language = this._model.language;
|
|
13132
|
+
labels = {
|
|
13133
|
+
'partA': translator.t('ebsr.part', {
|
|
13134
|
+
lng: language,
|
|
13135
|
+
index: this._model.partLabelType === 'Letters' ? 'A' : '1'
|
|
13136
|
+
}),
|
|
13137
|
+
'partB': translator.t('ebsr.part', {
|
|
13138
|
+
lng: language,
|
|
13139
|
+
index: this._model.partLabelType === 'Letters' ? 'B' : '2'
|
|
13140
|
+
})
|
|
13141
|
+
};
|
|
13142
|
+
}
|
|
9893
13143
|
part.model = {
|
|
9894
13144
|
...preparePrintModel(this._model[key], this._options),
|
|
9895
|
-
keyMode: this._model[key].choicePrefix
|
|
13145
|
+
keyMode: this._model[key].choicePrefix,
|
|
13146
|
+
partLabel: labels[key]
|
|
9896
13147
|
};
|
|
9897
13148
|
if (!part._session) {
|
|
9898
13149
|
part.session = {};
|