@pie-element/ebsr 10.2.6-next.9 → 10.2.6
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 +11 -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/module/configure.js +1 -1
- package/module/controller.js +12 -0
- package/module/element.js +3596 -309
- package/module/manifest.json +1 -1
- package/module/print.js +7337 -7282
- package/package.json +4 -4
package/module/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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@2.4.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@5.4.
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.4.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;
|
|
@@ -136,7 +136,7 @@ function createGenerateClassName$1() {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
var createMuiTheme$1 = {};
|
|
139
|
-
var defineProperty$
|
|
139
|
+
var defineProperty$2 = {
|
|
140
140
|
exports: {}
|
|
141
141
|
};
|
|
142
142
|
(function (module) {
|
|
@@ -154,8 +154,8 @@ var defineProperty$1 = {
|
|
|
154
154
|
return obj;
|
|
155
155
|
}
|
|
156
156
|
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
157
|
-
})(defineProperty$
|
|
158
|
-
getDefaultExportFromCjs(defineProperty$
|
|
157
|
+
})(defineProperty$2);
|
|
158
|
+
getDefaultExportFromCjs(defineProperty$2.exports);
|
|
159
159
|
var _extends$1 = {
|
|
160
160
|
exports: {}
|
|
161
161
|
};
|
|
@@ -390,7 +390,7 @@ Object.defineProperty(createMixins$1, "__esModule", {
|
|
|
390
390
|
value: true
|
|
391
391
|
});
|
|
392
392
|
createMixins$1.default = createMixins;
|
|
393
|
-
var _defineProperty2$d = _interopRequireDefault$I(defineProperty$
|
|
393
|
+
var _defineProperty2$d = _interopRequireDefault$I(defineProperty$2.exports);
|
|
394
394
|
var _extends3$2 = _interopRequireDefault$I(_extends$1.exports);
|
|
395
395
|
function createMixins(breakpoints, spacing, mixins) {
|
|
396
396
|
var _toolbar;
|
|
@@ -803,7 +803,7 @@ function createPalette(palette) {
|
|
|
803
803
|
}
|
|
804
804
|
var createTypography$1 = {};
|
|
805
805
|
var componentPropType$1 = {};
|
|
806
|
-
var _typeof$
|
|
806
|
+
var _typeof$3 = {
|
|
807
807
|
exports: {}
|
|
808
808
|
};
|
|
809
809
|
(function (module) {
|
|
@@ -816,8 +816,8 @@ var _typeof$1 = {
|
|
|
816
816
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
817
817
|
}
|
|
818
818
|
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
819
|
-
})(_typeof$
|
|
820
|
-
getDefaultExportFromCjs(_typeof$
|
|
819
|
+
})(_typeof$3);
|
|
820
|
+
getDefaultExportFromCjs(_typeof$3.exports);
|
|
821
821
|
var reactIs$1 = {
|
|
822
822
|
exports: {}
|
|
823
823
|
};
|
|
@@ -976,7 +976,7 @@ Object.defineProperty(componentPropType$1, "__esModule", {
|
|
|
976
976
|
value: true
|
|
977
977
|
});
|
|
978
978
|
var default_1$4 = componentPropType$1.default = void 0;
|
|
979
|
-
var _typeof2$2 = _interopRequireDefault$F(_typeof$
|
|
979
|
+
var _typeof2$2 = _interopRequireDefault$F(_typeof$3.exports);
|
|
980
980
|
var _reactIs = reactIs$1.exports;
|
|
981
981
|
function createComponentProp(isRequired) {
|
|
982
982
|
return function componentPropType(props, key, componentName, location, propFullName) {
|
|
@@ -1019,7 +1019,7 @@ Object.defineProperty(exactProp$1, "__esModule", {
|
|
|
1019
1019
|
value: true
|
|
1020
1020
|
});
|
|
1021
1021
|
var default_1$2 = exactProp$1.default = exactProp$1.specialProperty = void 0;
|
|
1022
|
-
var _defineProperty2$c = _interopRequireDefault$E(defineProperty$
|
|
1022
|
+
var _defineProperty2$c = _interopRequireDefault$E(defineProperty$2.exports);
|
|
1023
1023
|
var _extends3$1 = _interopRequireDefault$E(_extends$1.exports);
|
|
1024
1024
|
var specialProperty = "exact-prop: \u200B";
|
|
1025
1025
|
exactProp$1.specialProperty = specialProperty;
|
|
@@ -1356,7 +1356,7 @@ Object.defineProperty(createMuiTheme$1, "__esModule", {
|
|
|
1356
1356
|
value: true
|
|
1357
1357
|
});
|
|
1358
1358
|
createMuiTheme$1.default = void 0;
|
|
1359
|
-
var _defineProperty2$b = _interopRequireDefault$B(defineProperty$
|
|
1359
|
+
var _defineProperty2$b = _interopRequireDefault$B(defineProperty$2.exports);
|
|
1360
1360
|
var _extends2$f = _interopRequireDefault$B(_extends$1.exports);
|
|
1361
1361
|
var _objectWithoutProperties2$c = _interopRequireDefault$B(objectWithoutProperties.exports);
|
|
1362
1362
|
var _deepmerge$1 = _interopRequireDefault$B(umd.exports);
|
|
@@ -1911,11 +1911,11 @@ if (typeof self !== 'undefined') {
|
|
|
1911
1911
|
root = Function('return this')();
|
|
1912
1912
|
}
|
|
1913
1913
|
var result = symbolObservablePonyfill(root);
|
|
1914
|
-
var es = Object.freeze({
|
|
1914
|
+
var es$1 = Object.freeze({
|
|
1915
1915
|
__proto__: null,
|
|
1916
1916
|
'default': result
|
|
1917
1917
|
});
|
|
1918
|
-
var require$$0$8 = getAugmentedNamespace(es);
|
|
1918
|
+
var require$$0$8 = getAugmentedNamespace(es$1);
|
|
1919
1919
|
(function (exports) {
|
|
1920
1920
|
Object.defineProperty(exports, "__esModule", {
|
|
1921
1921
|
value: true
|
|
@@ -2435,12 +2435,12 @@ getDefaultExportFromCjs(moduleId);
|
|
|
2435
2435
|
})(createGenerateClassName);
|
|
2436
2436
|
getDefaultExportFromCjs(createGenerateClassName);
|
|
2437
2437
|
var Jss = {};
|
|
2438
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
2438
|
+
var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
2439
2439
|
return typeof obj;
|
|
2440
2440
|
} : function (obj) {
|
|
2441
2441
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2442
2442
|
};
|
|
2443
|
-
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
|
|
2443
|
+
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof$2(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof$2(document)) === 'object' && document.nodeType === 9;
|
|
2444
2444
|
var module$1 = Object.freeze({
|
|
2445
2445
|
__proto__: null,
|
|
2446
2446
|
isBrowser: isBrowser,
|
|
@@ -4476,7 +4476,7 @@ var interopRequireWildcard = {
|
|
|
4476
4476
|
exports: {}
|
|
4477
4477
|
};
|
|
4478
4478
|
(function (module) {
|
|
4479
|
-
var _typeof = _typeof$
|
|
4479
|
+
var _typeof = _typeof$3.exports["default"];
|
|
4480
4480
|
function _getRequireWildcardCache(nodeInterop) {
|
|
4481
4481
|
if (typeof WeakMap !== "function") return null;
|
|
4482
4482
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -4519,7 +4519,7 @@ var interopRequireWildcard = {
|
|
|
4519
4519
|
(module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4520
4520
|
})(interopRequireWildcard);
|
|
4521
4521
|
getDefaultExportFromCjs(interopRequireWildcard.exports);
|
|
4522
|
-
var classCallCheck = {
|
|
4522
|
+
var classCallCheck$1 = {
|
|
4523
4523
|
exports: {}
|
|
4524
4524
|
};
|
|
4525
4525
|
(function (module) {
|
|
@@ -4529,9 +4529,9 @@ var classCallCheck = {
|
|
|
4529
4529
|
}
|
|
4530
4530
|
}
|
|
4531
4531
|
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4532
|
-
})(classCallCheck);
|
|
4533
|
-
getDefaultExportFromCjs(classCallCheck.exports);
|
|
4534
|
-
var createClass = {
|
|
4532
|
+
})(classCallCheck$1);
|
|
4533
|
+
getDefaultExportFromCjs(classCallCheck$1.exports);
|
|
4534
|
+
var createClass$1 = {
|
|
4535
4535
|
exports: {}
|
|
4536
4536
|
};
|
|
4537
4537
|
(function (module) {
|
|
@@ -4553,12 +4553,12 @@ var createClass = {
|
|
|
4553
4553
|
return Constructor;
|
|
4554
4554
|
}
|
|
4555
4555
|
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4556
|
-
})(createClass);
|
|
4557
|
-
getDefaultExportFromCjs(createClass.exports);
|
|
4558
|
-
var possibleConstructorReturn = {
|
|
4556
|
+
})(createClass$1);
|
|
4557
|
+
getDefaultExportFromCjs(createClass$1.exports);
|
|
4558
|
+
var possibleConstructorReturn$1 = {
|
|
4559
4559
|
exports: {}
|
|
4560
4560
|
};
|
|
4561
|
-
var assertThisInitialized = {
|
|
4561
|
+
var assertThisInitialized$1 = {
|
|
4562
4562
|
exports: {}
|
|
4563
4563
|
};
|
|
4564
4564
|
(function (module) {
|
|
@@ -4569,23 +4569,23 @@ var assertThisInitialized = {
|
|
|
4569
4569
|
return self;
|
|
4570
4570
|
}
|
|
4571
4571
|
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4572
|
-
})(assertThisInitialized);
|
|
4573
|
-
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
4572
|
+
})(assertThisInitialized$1);
|
|
4573
|
+
getDefaultExportFromCjs(assertThisInitialized$1.exports);
|
|
4574
4574
|
(function (module) {
|
|
4575
|
-
var _typeof = _typeof$
|
|
4576
|
-
var assertThisInitialized
|
|
4575
|
+
var _typeof = _typeof$3.exports["default"];
|
|
4576
|
+
var assertThisInitialized = assertThisInitialized$1.exports;
|
|
4577
4577
|
function _possibleConstructorReturn(self, call) {
|
|
4578
4578
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
4579
4579
|
return call;
|
|
4580
4580
|
} else if (call !== void 0) {
|
|
4581
4581
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
4582
4582
|
}
|
|
4583
|
-
return assertThisInitialized
|
|
4583
|
+
return assertThisInitialized(self);
|
|
4584
4584
|
}
|
|
4585
4585
|
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4586
|
-
})(possibleConstructorReturn);
|
|
4587
|
-
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
4588
|
-
var getPrototypeOf$
|
|
4586
|
+
})(possibleConstructorReturn$1);
|
|
4587
|
+
getDefaultExportFromCjs(possibleConstructorReturn$1.exports);
|
|
4588
|
+
var getPrototypeOf$2 = {
|
|
4589
4589
|
exports: {}
|
|
4590
4590
|
};
|
|
4591
4591
|
(function (module) {
|
|
@@ -4596,12 +4596,12 @@ var getPrototypeOf$1 = {
|
|
|
4596
4596
|
return _getPrototypeOf(o);
|
|
4597
4597
|
}
|
|
4598
4598
|
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4599
|
-
})(getPrototypeOf$
|
|
4600
|
-
getDefaultExportFromCjs(getPrototypeOf$
|
|
4601
|
-
var inherits = {
|
|
4599
|
+
})(getPrototypeOf$2);
|
|
4600
|
+
getDefaultExportFromCjs(getPrototypeOf$2.exports);
|
|
4601
|
+
var inherits$1 = {
|
|
4602
4602
|
exports: {}
|
|
4603
4603
|
};
|
|
4604
|
-
var setPrototypeOf = {
|
|
4604
|
+
var setPrototypeOf$1 = {
|
|
4605
4605
|
exports: {}
|
|
4606
4606
|
};
|
|
4607
4607
|
(function (module) {
|
|
@@ -4613,10 +4613,10 @@ var setPrototypeOf = {
|
|
|
4613
4613
|
return _setPrototypeOf(o, p);
|
|
4614
4614
|
}
|
|
4615
4615
|
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4616
|
-
})(setPrototypeOf);
|
|
4617
|
-
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
4616
|
+
})(setPrototypeOf$1);
|
|
4617
|
+
getDefaultExportFromCjs(setPrototypeOf$1.exports);
|
|
4618
4618
|
(function (module) {
|
|
4619
|
-
var setPrototypeOf
|
|
4619
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
4620
4620
|
function _inherits(subClass, superClass) {
|
|
4621
4621
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
4622
4622
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -4631,11 +4631,11 @@ getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
|
4631
4631
|
Object.defineProperty(subClass, "prototype", {
|
|
4632
4632
|
writable: false
|
|
4633
4633
|
});
|
|
4634
|
-
if (superClass) setPrototypeOf
|
|
4634
|
+
if (superClass) setPrototypeOf(subClass, superClass);
|
|
4635
4635
|
}
|
|
4636
4636
|
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
4637
|
-
})(inherits);
|
|
4638
|
-
getDefaultExportFromCjs(inherits.exports);
|
|
4637
|
+
})(inherits$1);
|
|
4638
|
+
getDefaultExportFromCjs(inherits$1.exports);
|
|
4639
4639
|
function createBroadcast(initialState) {
|
|
4640
4640
|
var listeners = {};
|
|
4641
4641
|
var id = 1;
|
|
@@ -4684,7 +4684,7 @@ Object.defineProperty(themeListener$1, "__esModule", {
|
|
|
4684
4684
|
value: true
|
|
4685
4685
|
});
|
|
4686
4686
|
themeListener$1.default = themeListener$1.CHANNEL = void 0;
|
|
4687
|
-
var _defineProperty2$a = _interopRequireDefault$y(defineProperty$
|
|
4687
|
+
var _defineProperty2$a = _interopRequireDefault$y(defineProperty$2.exports);
|
|
4688
4688
|
var CHANNEL = '__THEMING__';
|
|
4689
4689
|
themeListener$1.CHANNEL = CHANNEL;
|
|
4690
4690
|
var themeListener = {
|
|
@@ -4718,12 +4718,12 @@ Object.defineProperty(MuiThemeProvider, "__esModule", {
|
|
|
4718
4718
|
});
|
|
4719
4719
|
MuiThemeProvider.default = MuiThemeProvider.MuiThemeProviderOld = void 0;
|
|
4720
4720
|
var _extends2$e = _interopRequireDefault$x(_extends$1.exports);
|
|
4721
|
-
var _defineProperty2$9 = _interopRequireDefault$x(defineProperty$
|
|
4722
|
-
var _classCallCheck2$7 = _interopRequireDefault$x(classCallCheck.exports);
|
|
4723
|
-
var _createClass2$7 = _interopRequireDefault$x(createClass.exports);
|
|
4724
|
-
var _possibleConstructorReturn2$7 = _interopRequireDefault$x(possibleConstructorReturn.exports);
|
|
4725
|
-
var _getPrototypeOf2$3 = _interopRequireDefault$x(getPrototypeOf$
|
|
4726
|
-
var _inherits2$7 = _interopRequireDefault$x(inherits.exports);
|
|
4721
|
+
var _defineProperty2$9 = _interopRequireDefault$x(defineProperty$2.exports);
|
|
4722
|
+
var _classCallCheck2$7 = _interopRequireDefault$x(classCallCheck$1.exports);
|
|
4723
|
+
var _createClass2$7 = _interopRequireDefault$x(createClass$1.exports);
|
|
4724
|
+
var _possibleConstructorReturn2$7 = _interopRequireDefault$x(possibleConstructorReturn$1.exports);
|
|
4725
|
+
var _getPrototypeOf2$3 = _interopRequireDefault$x(getPrototypeOf$2.exports);
|
|
4726
|
+
var _inherits2$7 = _interopRequireDefault$x(inherits$1.exports);
|
|
4727
4727
|
var _react$n = _interopRequireDefault$x(require$$9$4);
|
|
4728
4728
|
var _propTypes$e = _interopRequireDefault$x(require$$10$5);
|
|
4729
4729
|
var _warning$5 = _interopRequireDefault$x(warning_1);
|
|
@@ -4882,16 +4882,16 @@ function getStatics(component) {
|
|
|
4882
4882
|
}
|
|
4883
4883
|
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
|
|
4884
4884
|
}
|
|
4885
|
-
var defineProperty = Object.defineProperty;
|
|
4885
|
+
var defineProperty$1 = Object.defineProperty;
|
|
4886
4886
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
4887
4887
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
4888
4888
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
4889
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
4889
|
+
var getPrototypeOf$1 = Object.getPrototypeOf;
|
|
4890
4890
|
var objectPrototype = Object.prototype;
|
|
4891
4891
|
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
4892
4892
|
if (typeof sourceComponent !== 'string') {
|
|
4893
4893
|
if (objectPrototype) {
|
|
4894
|
-
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
4894
|
+
var inheritedComponent = getPrototypeOf$1(sourceComponent);
|
|
4895
4895
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
4896
4896
|
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
4897
4897
|
}
|
|
@@ -4907,7 +4907,7 @@ function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
|
4907
4907
|
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
4908
4908
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
4909
4909
|
try {
|
|
4910
|
-
defineProperty(targetComponent, key, descriptor);
|
|
4910
|
+
defineProperty$1(targetComponent, key, descriptor);
|
|
4911
4911
|
} catch (e) {}
|
|
4912
4912
|
}
|
|
4913
4913
|
}
|
|
@@ -4990,7 +4990,7 @@ Object.defineProperty(getStylesCreator$1, "__esModule", {
|
|
|
4990
4990
|
});
|
|
4991
4991
|
getStylesCreator$1.default = void 0;
|
|
4992
4992
|
var _extends2$c = _interopRequireDefault$v(_extends$1.exports);
|
|
4993
|
-
var _typeof2$1 = _interopRequireDefault$v(_typeof$
|
|
4993
|
+
var _typeof2$1 = _interopRequireDefault$v(_typeof$3.exports);
|
|
4994
4994
|
var _warning$3 = _interopRequireDefault$v(warning_1);
|
|
4995
4995
|
var _deepmerge = _interopRequireDefault$v(umd.exports);
|
|
4996
4996
|
function arrayMerge(destination, source) {
|
|
@@ -5050,13 +5050,13 @@ Object.defineProperty(withStyles, "__esModule", {
|
|
|
5050
5050
|
value: true
|
|
5051
5051
|
});
|
|
5052
5052
|
withStyles.default = withStyles.sheetsManager = void 0;
|
|
5053
|
-
var _defineProperty2$8 = _interopRequireDefault$u(defineProperty$
|
|
5053
|
+
var _defineProperty2$8 = _interopRequireDefault$u(defineProperty$2.exports);
|
|
5054
5054
|
var _extends3 = _interopRequireDefault$u(_extends$1.exports);
|
|
5055
|
-
var _classCallCheck2$6 = _interopRequireDefault$u(classCallCheck.exports);
|
|
5056
|
-
var _createClass2$6 = _interopRequireDefault$u(createClass.exports);
|
|
5057
|
-
var _possibleConstructorReturn2$6 = _interopRequireDefault$u(possibleConstructorReturn.exports);
|
|
5058
|
-
var _getPrototypeOf2$2 = _interopRequireDefault$u(getPrototypeOf$
|
|
5059
|
-
var _inherits2$6 = _interopRequireDefault$u(inherits.exports);
|
|
5055
|
+
var _classCallCheck2$6 = _interopRequireDefault$u(classCallCheck$1.exports);
|
|
5056
|
+
var _createClass2$6 = _interopRequireDefault$u(createClass$1.exports);
|
|
5057
|
+
var _possibleConstructorReturn2$6 = _interopRequireDefault$u(possibleConstructorReturn$1.exports);
|
|
5058
|
+
var _getPrototypeOf2$2 = _interopRequireDefault$u(getPrototypeOf$2.exports);
|
|
5059
|
+
var _inherits2$6 = _interopRequireDefault$u(inherits$1.exports);
|
|
5060
5060
|
var _objectWithoutProperties2$b = _interopRequireDefault$u(objectWithoutProperties.exports);
|
|
5061
5061
|
var _react$m = _interopRequireDefault$u(require$$9$3);
|
|
5062
5062
|
var _propTypes$d = _interopRequireDefault$u(require$$10$4);
|
|
@@ -5317,11 +5317,11 @@ Object.defineProperty(withTheme, "__esModule", {
|
|
|
5317
5317
|
withTheme.default = void 0;
|
|
5318
5318
|
var _extends2$b = _interopRequireDefault$t(_extends$1.exports);
|
|
5319
5319
|
var _objectWithoutProperties2$a = _interopRequireDefault$t(objectWithoutProperties.exports);
|
|
5320
|
-
var _classCallCheck2$5 = _interopRequireDefault$t(classCallCheck.exports);
|
|
5321
|
-
var _createClass2$5 = _interopRequireDefault$t(createClass.exports);
|
|
5322
|
-
var _possibleConstructorReturn2$5 = _interopRequireDefault$t(possibleConstructorReturn.exports);
|
|
5323
|
-
var _getPrototypeOf2$1 = _interopRequireDefault$t(getPrototypeOf$
|
|
5324
|
-
var _inherits2$5 = _interopRequireDefault$t(inherits.exports);
|
|
5320
|
+
var _classCallCheck2$5 = _interopRequireDefault$t(classCallCheck$1.exports);
|
|
5321
|
+
var _createClass2$5 = _interopRequireDefault$t(createClass$1.exports);
|
|
5322
|
+
var _possibleConstructorReturn2$5 = _interopRequireDefault$t(possibleConstructorReturn$1.exports);
|
|
5323
|
+
var _getPrototypeOf2$1 = _interopRequireDefault$t(getPrototypeOf$2.exports);
|
|
5324
|
+
var _inherits2$5 = _interopRequireDefault$t(inherits$1.exports);
|
|
5325
5325
|
var _react$l = _interopRequireDefault$t(require$$8);
|
|
5326
5326
|
var _propTypes$c = _interopRequireDefault$t(require$$9$2);
|
|
5327
5327
|
var _hoistNonReactStatics$1 = _interopRequireDefault$t(hoistNonReactStatics_cjs);
|
|
@@ -5460,154 +5460,3398 @@ withTheme.default = _default$s;
|
|
|
5460
5460
|
var _withTheme = _interopRequireDefault(withTheme);
|
|
5461
5461
|
})(styles$b);
|
|
5462
5462
|
getDefaultExportFromCjs(styles$b);
|
|
5463
|
-
var
|
|
5464
|
-
var
|
|
5465
|
-
var
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
FormControlContext$1.default = _default$r;
|
|
5477
|
-
const require$$2$3 = _dll_react;
|
|
5478
|
-
var _interopRequireDefault$r = interopRequireDefault.exports;
|
|
5479
|
-
Object.defineProperty(withFormControlContext$1, "__esModule", {
|
|
5480
|
-
value: true
|
|
5481
|
-
});
|
|
5482
|
-
withFormControlContext$1.default = withFormControlContext;
|
|
5483
|
-
var _extends2$a = _interopRequireDefault$r(_extends$1.exports);
|
|
5484
|
-
var _react$j = _interopRequireDefault$r(require$$2$3);
|
|
5485
|
-
var _hoistNonReactStatics = _interopRequireDefault$r(hoistNonReactStatics_cjs);
|
|
5486
|
-
var _FormControlContext = _interopRequireDefault$r(FormControlContext$1);
|
|
5487
|
-
var _utils$5 = require$$7$1;
|
|
5488
|
-
function withFormControlContext(Component) {
|
|
5489
|
-
var EnhancedComponent = function EnhancedComponent(props) {
|
|
5490
|
-
return _react$j.default.createElement(_FormControlContext.default.Consumer, null, function (context) {
|
|
5491
|
-
return _react$j.default.createElement(Component, (0, _extends2$a.default)({
|
|
5492
|
-
muiFormControl: context
|
|
5493
|
-
}, props));
|
|
5494
|
-
});
|
|
5495
|
-
};
|
|
5496
|
-
{
|
|
5497
|
-
EnhancedComponent.displayName = ("WithFormControlContext(").concat((0, _utils$5.getDisplayName)(Component), ")");
|
|
5498
|
-
}
|
|
5499
|
-
(0, _hoistNonReactStatics.default)(EnhancedComponent, Component);
|
|
5500
|
-
return EnhancedComponent;
|
|
5501
|
-
}
|
|
5502
|
-
var Typography$2 = {};
|
|
5503
|
-
var Typography$1 = {};
|
|
5504
|
-
var helpers = {};
|
|
5505
|
-
var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
5506
|
-
Object.defineProperty(helpers, "__esModule", {
|
|
5507
|
-
value: true
|
|
5508
|
-
});
|
|
5509
|
-
helpers.capitalize = capitalize;
|
|
5510
|
-
helpers.contains = contains;
|
|
5511
|
-
helpers.findIndex = findIndex;
|
|
5512
|
-
helpers.find = find;
|
|
5513
|
-
helpers.createChainedFunction = createChainedFunction;
|
|
5514
|
-
var _typeof2 = _interopRequireDefault$q(_typeof$1.exports);
|
|
5515
|
-
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
5516
|
-
function capitalize(string) {
|
|
5517
|
-
if (typeof string !== 'string') {
|
|
5518
|
-
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
5463
|
+
var translator$2 = {};
|
|
5464
|
+
var translator$1 = {};
|
|
5465
|
+
var _typeof$1 = {
|
|
5466
|
+
exports: {}
|
|
5467
|
+
};
|
|
5468
|
+
(function (module) {
|
|
5469
|
+
function _typeof(obj) {
|
|
5470
|
+
"@babel/helpers - typeof";
|
|
5471
|
+
return ((module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
5472
|
+
return typeof obj;
|
|
5473
|
+
} : function (obj) {
|
|
5474
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
5475
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj));
|
|
5519
5476
|
}
|
|
5520
|
-
|
|
5521
|
-
}
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
function
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
if (predType === 'function' && !!pred(arr[i], i, arr) === true) {
|
|
5531
|
-
return i;
|
|
5477
|
+
(module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5478
|
+
})(_typeof$1);
|
|
5479
|
+
getDefaultExportFromCjs(_typeof$1.exports);
|
|
5480
|
+
var classCallCheck = {
|
|
5481
|
+
exports: {}
|
|
5482
|
+
};
|
|
5483
|
+
(function (module) {
|
|
5484
|
+
function _classCallCheck(instance, Constructor) {
|
|
5485
|
+
if (!(instance instanceof Constructor)) {
|
|
5486
|
+
throw new TypeError("Cannot call a class as a function");
|
|
5532
5487
|
}
|
|
5533
|
-
|
|
5534
|
-
|
|
5488
|
+
}
|
|
5489
|
+
(module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5490
|
+
})(classCallCheck);
|
|
5491
|
+
getDefaultExportFromCjs(classCallCheck.exports);
|
|
5492
|
+
var createClass = {
|
|
5493
|
+
exports: {}
|
|
5494
|
+
};
|
|
5495
|
+
var toPropertyKey = {
|
|
5496
|
+
exports: {}
|
|
5497
|
+
};
|
|
5498
|
+
var toPrimitive = {
|
|
5499
|
+
exports: {}
|
|
5500
|
+
};
|
|
5501
|
+
(function (module) {
|
|
5502
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5503
|
+
function _toPrimitive(input, hint) {
|
|
5504
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
5505
|
+
var prim = input[Symbol.toPrimitive];
|
|
5506
|
+
if (prim !== undefined) {
|
|
5507
|
+
var res = prim.call(input, hint || "default");
|
|
5508
|
+
if (_typeof(res) !== "object") return res;
|
|
5509
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5510
|
+
}
|
|
5511
|
+
return (hint === "string" ? String : Number)(input);
|
|
5512
|
+
}
|
|
5513
|
+
(module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5514
|
+
})(toPrimitive);
|
|
5515
|
+
getDefaultExportFromCjs(toPrimitive.exports);
|
|
5516
|
+
(function (module) {
|
|
5517
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5518
|
+
var toPrimitive$1 = toPrimitive.exports;
|
|
5519
|
+
function _toPropertyKey(arg) {
|
|
5520
|
+
var key = toPrimitive$1(arg, "string");
|
|
5521
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
5522
|
+
}
|
|
5523
|
+
(module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5524
|
+
})(toPropertyKey);
|
|
5525
|
+
getDefaultExportFromCjs(toPropertyKey.exports);
|
|
5526
|
+
(function (module) {
|
|
5527
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
5528
|
+
function _defineProperties(target, props) {
|
|
5529
|
+
for (var i = 0; i < props.length; i++) {
|
|
5530
|
+
var descriptor = props[i];
|
|
5531
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
5532
|
+
descriptor.configurable = true;
|
|
5533
|
+
if (("value" in descriptor)) descriptor.writable = true;
|
|
5534
|
+
Object.defineProperty(target, toPropertyKey$1(descriptor.key), descriptor);
|
|
5535
5535
|
}
|
|
5536
|
-
|
|
5537
|
-
|
|
5536
|
+
}
|
|
5537
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
5538
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
5539
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
5540
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
5541
|
+
writable: false
|
|
5542
|
+
});
|
|
5543
|
+
return Constructor;
|
|
5544
|
+
}
|
|
5545
|
+
(module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5546
|
+
})(createClass);
|
|
5547
|
+
getDefaultExportFromCjs(createClass.exports);
|
|
5548
|
+
var assertThisInitialized = {
|
|
5549
|
+
exports: {}
|
|
5550
|
+
};
|
|
5551
|
+
(function (module) {
|
|
5552
|
+
function _assertThisInitialized(self) {
|
|
5553
|
+
if (self === void 0) {
|
|
5554
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
5538
5555
|
}
|
|
5556
|
+
return self;
|
|
5539
5557
|
}
|
|
5540
|
-
|
|
5541
|
-
}
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
}
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5558
|
+
(module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5559
|
+
})(assertThisInitialized);
|
|
5560
|
+
getDefaultExportFromCjs(assertThisInitialized.exports);
|
|
5561
|
+
var inherits = {
|
|
5562
|
+
exports: {}
|
|
5563
|
+
};
|
|
5564
|
+
var setPrototypeOf = {
|
|
5565
|
+
exports: {}
|
|
5566
|
+
};
|
|
5567
|
+
(function (module) {
|
|
5568
|
+
function _setPrototypeOf(o, p) {
|
|
5569
|
+
(module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
5570
|
+
o.__proto__ = p;
|
|
5571
|
+
return o;
|
|
5572
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5573
|
+
return _setPrototypeOf(o, p);
|
|
5549
5574
|
}
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5575
|
+
(module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5576
|
+
})(setPrototypeOf);
|
|
5577
|
+
getDefaultExportFromCjs(setPrototypeOf.exports);
|
|
5578
|
+
(function (module) {
|
|
5579
|
+
var setPrototypeOf$1 = setPrototypeOf.exports;
|
|
5580
|
+
function _inherits(subClass, superClass) {
|
|
5581
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
5582
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
5553
5583
|
}
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5584
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
5585
|
+
constructor: {
|
|
5586
|
+
value: subClass,
|
|
5587
|
+
writable: true,
|
|
5588
|
+
configurable: true
|
|
5558
5589
|
}
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
}
|
|
5571
|
-
|
|
5572
|
-
var
|
|
5573
|
-
var
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5590
|
+
});
|
|
5591
|
+
Object.defineProperty(subClass, "prototype", {
|
|
5592
|
+
writable: false
|
|
5593
|
+
});
|
|
5594
|
+
if (superClass) setPrototypeOf$1(subClass, superClass);
|
|
5595
|
+
}
|
|
5596
|
+
(module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5597
|
+
})(inherits);
|
|
5598
|
+
getDefaultExportFromCjs(inherits.exports);
|
|
5599
|
+
var possibleConstructorReturn = {
|
|
5600
|
+
exports: {}
|
|
5601
|
+
};
|
|
5602
|
+
(function (module) {
|
|
5603
|
+
var _typeof = _typeof$1.exports["default"];
|
|
5604
|
+
var assertThisInitialized$1 = assertThisInitialized.exports;
|
|
5605
|
+
function _possibleConstructorReturn(self, call) {
|
|
5606
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
5607
|
+
return call;
|
|
5608
|
+
} else if (call !== void 0) {
|
|
5609
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
5610
|
+
}
|
|
5611
|
+
return assertThisInitialized$1(self);
|
|
5612
|
+
}
|
|
5613
|
+
(module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5614
|
+
})(possibleConstructorReturn);
|
|
5615
|
+
getDefaultExportFromCjs(possibleConstructorReturn.exports);
|
|
5616
|
+
var getPrototypeOf = {
|
|
5617
|
+
exports: {}
|
|
5618
|
+
};
|
|
5619
|
+
(function (module) {
|
|
5620
|
+
function _getPrototypeOf(o) {
|
|
5621
|
+
(module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
5622
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
5623
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5624
|
+
return _getPrototypeOf(o);
|
|
5625
|
+
}
|
|
5626
|
+
(module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5627
|
+
})(getPrototypeOf);
|
|
5628
|
+
getDefaultExportFromCjs(getPrototypeOf.exports);
|
|
5629
|
+
var defineProperty = {
|
|
5630
|
+
exports: {}
|
|
5631
|
+
};
|
|
5632
|
+
(function (module) {
|
|
5633
|
+
var toPropertyKey$1 = toPropertyKey.exports;
|
|
5634
|
+
function _defineProperty(obj, key, value) {
|
|
5635
|
+
key = toPropertyKey$1(key);
|
|
5636
|
+
if ((key in obj)) {
|
|
5637
|
+
Object.defineProperty(obj, key, {
|
|
5638
|
+
value: value,
|
|
5639
|
+
enumerable: true,
|
|
5640
|
+
configurable: true,
|
|
5641
|
+
writable: true
|
|
5642
|
+
});
|
|
5643
|
+
} else {
|
|
5644
|
+
obj[key] = value;
|
|
5645
|
+
}
|
|
5646
|
+
return obj;
|
|
5647
|
+
}
|
|
5648
|
+
(module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5649
|
+
})(defineProperty);
|
|
5650
|
+
getDefaultExportFromCjs(defineProperty.exports);
|
|
5651
|
+
var toArray = {
|
|
5652
|
+
exports: {}
|
|
5653
|
+
};
|
|
5654
|
+
var arrayWithHoles = {
|
|
5655
|
+
exports: {}
|
|
5656
|
+
};
|
|
5657
|
+
(function (module) {
|
|
5658
|
+
function _arrayWithHoles(arr) {
|
|
5659
|
+
if (Array.isArray(arr)) return arr;
|
|
5660
|
+
}
|
|
5661
|
+
(module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5662
|
+
})(arrayWithHoles);
|
|
5663
|
+
getDefaultExportFromCjs(arrayWithHoles.exports);
|
|
5664
|
+
var iterableToArray$1 = {
|
|
5665
|
+
exports: {}
|
|
5666
|
+
};
|
|
5667
|
+
(function (module) {
|
|
5668
|
+
function _iterableToArray(iter) {
|
|
5669
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
5670
|
+
}
|
|
5671
|
+
(module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5672
|
+
})(iterableToArray$1);
|
|
5673
|
+
getDefaultExportFromCjs(iterableToArray$1.exports);
|
|
5674
|
+
var unsupportedIterableToArray$1 = {
|
|
5675
|
+
exports: {}
|
|
5676
|
+
};
|
|
5677
|
+
var arrayLikeToArray$1 = {
|
|
5678
|
+
exports: {}
|
|
5679
|
+
};
|
|
5680
|
+
(function (module) {
|
|
5681
|
+
function _arrayLikeToArray(arr, len) {
|
|
5682
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
5683
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
5684
|
+
return arr2;
|
|
5685
|
+
}
|
|
5686
|
+
(module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5687
|
+
})(arrayLikeToArray$1);
|
|
5688
|
+
getDefaultExportFromCjs(arrayLikeToArray$1.exports);
|
|
5689
|
+
(function (module) {
|
|
5690
|
+
var arrayLikeToArray = arrayLikeToArray$1.exports;
|
|
5691
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
5692
|
+
if (!o) return;
|
|
5693
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
5694
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5695
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5696
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
5697
|
+
if (n === "Arguments" || (/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/).test(n)) return arrayLikeToArray(o, minLen);
|
|
5698
|
+
}
|
|
5699
|
+
(module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5700
|
+
})(unsupportedIterableToArray$1);
|
|
5701
|
+
getDefaultExportFromCjs(unsupportedIterableToArray$1.exports);
|
|
5702
|
+
var nonIterableRest = {
|
|
5703
|
+
exports: {}
|
|
5704
|
+
};
|
|
5705
|
+
(function (module) {
|
|
5706
|
+
function _nonIterableRest() {
|
|
5707
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5708
|
+
}
|
|
5709
|
+
(module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5710
|
+
})(nonIterableRest);
|
|
5711
|
+
getDefaultExportFromCjs(nonIterableRest.exports);
|
|
5712
|
+
(function (module) {
|
|
5713
|
+
var arrayWithHoles$1 = arrayWithHoles.exports;
|
|
5714
|
+
var iterableToArray = iterableToArray$1.exports;
|
|
5715
|
+
var unsupportedIterableToArray = unsupportedIterableToArray$1.exports;
|
|
5716
|
+
var nonIterableRest$1 = nonIterableRest.exports;
|
|
5717
|
+
function _toArray(arr) {
|
|
5718
|
+
return arrayWithHoles$1(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest$1();
|
|
5719
|
+
}
|
|
5720
|
+
(module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
5721
|
+
})(toArray);
|
|
5722
|
+
getDefaultExportFromCjs(toArray.exports);
|
|
5723
|
+
var _typeof = _typeof$1.exports;
|
|
5724
|
+
var _classCallCheck = classCallCheck.exports;
|
|
5725
|
+
var _createClass = createClass.exports;
|
|
5726
|
+
var _assertThisInitialized = assertThisInitialized.exports;
|
|
5727
|
+
var _inherits = inherits.exports;
|
|
5728
|
+
var _possibleConstructorReturn = possibleConstructorReturn.exports;
|
|
5729
|
+
var _getPrototypeOf = getPrototypeOf.exports;
|
|
5730
|
+
var _defineProperty = defineProperty.exports;
|
|
5731
|
+
var _toArray = toArray.exports;
|
|
5732
|
+
function _interopDefaultLegacy(e) {
|
|
5733
|
+
return e && typeof e === 'object' && ('default' in e) ? e : {
|
|
5734
|
+
'default': e
|
|
5735
|
+
};
|
|
5736
|
+
}
|
|
5737
|
+
var _typeof__default = _interopDefaultLegacy(_typeof);
|
|
5738
|
+
var _classCallCheck__default = _interopDefaultLegacy(_classCallCheck);
|
|
5739
|
+
var _createClass__default = _interopDefaultLegacy(_createClass);
|
|
5740
|
+
var _assertThisInitialized__default = _interopDefaultLegacy(_assertThisInitialized);
|
|
5741
|
+
var _inherits__default = _interopDefaultLegacy(_inherits);
|
|
5742
|
+
var _possibleConstructorReturn__default = _interopDefaultLegacy(_possibleConstructorReturn);
|
|
5743
|
+
var _getPrototypeOf__default = _interopDefaultLegacy(_getPrototypeOf);
|
|
5744
|
+
var _defineProperty__default = _interopDefaultLegacy(_defineProperty);
|
|
5745
|
+
var _toArray__default = _interopDefaultLegacy(_toArray);
|
|
5746
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
5747
|
+
var keys = Object.keys(object);
|
|
5748
|
+
if (Object.getOwnPropertySymbols) {
|
|
5749
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5750
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
5751
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
5752
|
+
})), keys.push.apply(keys, symbols));
|
|
5753
|
+
}
|
|
5754
|
+
return keys;
|
|
5755
|
+
}
|
|
5756
|
+
function _objectSpread$6(target) {
|
|
5757
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5758
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
5759
|
+
i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) {
|
|
5760
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
5761
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) {
|
|
5762
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5763
|
+
});
|
|
5764
|
+
}
|
|
5765
|
+
return target;
|
|
5766
|
+
}
|
|
5767
|
+
var consoleLogger = {
|
|
5768
|
+
type: 'logger',
|
|
5769
|
+
log: function log(args) {
|
|
5770
|
+
this.output('log', args);
|
|
5771
|
+
},
|
|
5772
|
+
warn: function warn(args) {
|
|
5773
|
+
this.output('warn', args);
|
|
5774
|
+
},
|
|
5775
|
+
error: function error(args) {
|
|
5776
|
+
this.output('error', args);
|
|
5777
|
+
},
|
|
5778
|
+
output: function output(type, args) {
|
|
5779
|
+
if (console && console[type]) console[type].apply(console, args);
|
|
5780
|
+
}
|
|
5781
|
+
};
|
|
5782
|
+
var Logger = (function () {
|
|
5783
|
+
function Logger(concreteLogger) {
|
|
5784
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5785
|
+
_classCallCheck__default["default"](this, Logger);
|
|
5786
|
+
this.init(concreteLogger, options);
|
|
5787
|
+
}
|
|
5788
|
+
_createClass__default["default"](Logger, [{
|
|
5789
|
+
key: "init",
|
|
5790
|
+
value: function init(concreteLogger) {
|
|
5791
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5792
|
+
this.prefix = options.prefix || 'i18next:';
|
|
5793
|
+
this.logger = concreteLogger || consoleLogger;
|
|
5794
|
+
this.options = options;
|
|
5795
|
+
this.debug = options.debug;
|
|
5796
|
+
}
|
|
5797
|
+
}, {
|
|
5798
|
+
key: "setDebug",
|
|
5799
|
+
value: function setDebug(bool) {
|
|
5800
|
+
this.debug = bool;
|
|
5801
|
+
}
|
|
5802
|
+
}, {
|
|
5803
|
+
key: "log",
|
|
5804
|
+
value: function log() {
|
|
5805
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5806
|
+
args[_key] = arguments[_key];
|
|
5807
|
+
}
|
|
5808
|
+
return this.forward(args, 'log', '', true);
|
|
5809
|
+
}
|
|
5810
|
+
}, {
|
|
5811
|
+
key: "warn",
|
|
5812
|
+
value: function warn() {
|
|
5813
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5814
|
+
args[_key2] = arguments[_key2];
|
|
5815
|
+
}
|
|
5816
|
+
return this.forward(args, 'warn', '', true);
|
|
5817
|
+
}
|
|
5818
|
+
}, {
|
|
5819
|
+
key: "error",
|
|
5820
|
+
value: function error() {
|
|
5821
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
5822
|
+
args[_key3] = arguments[_key3];
|
|
5823
|
+
}
|
|
5824
|
+
return this.forward(args, 'error', '');
|
|
5825
|
+
}
|
|
5826
|
+
}, {
|
|
5827
|
+
key: "deprecate",
|
|
5828
|
+
value: function deprecate() {
|
|
5829
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
5830
|
+
args[_key4] = arguments[_key4];
|
|
5831
|
+
}
|
|
5832
|
+
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
5833
|
+
}
|
|
5834
|
+
}, {
|
|
5835
|
+
key: "forward",
|
|
5836
|
+
value: function forward(args, lvl, prefix, debugOnly) {
|
|
5837
|
+
if (debugOnly && !this.debug) return null;
|
|
5838
|
+
if (typeof args[0] === 'string') args[0] = ("").concat(prefix).concat(this.prefix, " ").concat(args[0]);
|
|
5839
|
+
return this.logger[lvl](args);
|
|
5840
|
+
}
|
|
5841
|
+
}, {
|
|
5842
|
+
key: "create",
|
|
5843
|
+
value: function create(moduleName) {
|
|
5844
|
+
return new Logger(this.logger, _objectSpread$6(_objectSpread$6({}, {
|
|
5845
|
+
prefix: ("").concat(this.prefix, ":").concat(moduleName, ":")
|
|
5846
|
+
}), this.options));
|
|
5847
|
+
}
|
|
5848
|
+
}, {
|
|
5849
|
+
key: "clone",
|
|
5850
|
+
value: function clone(options) {
|
|
5851
|
+
options = options || this.options;
|
|
5852
|
+
options.prefix = options.prefix || this.prefix;
|
|
5853
|
+
return new Logger(this.logger, options);
|
|
5854
|
+
}
|
|
5855
|
+
}]);
|
|
5856
|
+
return Logger;
|
|
5857
|
+
})();
|
|
5858
|
+
var baseLogger = new Logger();
|
|
5859
|
+
var EventEmitter = (function () {
|
|
5860
|
+
function EventEmitter() {
|
|
5861
|
+
_classCallCheck__default["default"](this, EventEmitter);
|
|
5862
|
+
this.observers = {};
|
|
5863
|
+
}
|
|
5864
|
+
_createClass__default["default"](EventEmitter, [{
|
|
5865
|
+
key: "on",
|
|
5866
|
+
value: function on(events, listener) {
|
|
5867
|
+
var _this = this;
|
|
5868
|
+
events.split(' ').forEach(function (event) {
|
|
5869
|
+
_this.observers[event] = _this.observers[event] || [];
|
|
5870
|
+
_this.observers[event].push(listener);
|
|
5871
|
+
});
|
|
5872
|
+
return this;
|
|
5873
|
+
}
|
|
5874
|
+
}, {
|
|
5875
|
+
key: "off",
|
|
5876
|
+
value: function off(event, listener) {
|
|
5877
|
+
if (!this.observers[event]) return;
|
|
5878
|
+
if (!listener) {
|
|
5879
|
+
delete this.observers[event];
|
|
5880
|
+
return;
|
|
5881
|
+
}
|
|
5882
|
+
this.observers[event] = this.observers[event].filter(function (l) {
|
|
5883
|
+
return l !== listener;
|
|
5884
|
+
});
|
|
5885
|
+
}
|
|
5886
|
+
}, {
|
|
5887
|
+
key: "emit",
|
|
5888
|
+
value: function emit(event) {
|
|
5889
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5890
|
+
args[_key - 1] = arguments[_key];
|
|
5891
|
+
}
|
|
5892
|
+
if (this.observers[event]) {
|
|
5893
|
+
var cloned = [].concat(this.observers[event]);
|
|
5894
|
+
cloned.forEach(function (observer) {
|
|
5895
|
+
observer.apply(void 0, args);
|
|
5896
|
+
});
|
|
5897
|
+
}
|
|
5898
|
+
if (this.observers['*']) {
|
|
5899
|
+
var _cloned = [].concat(this.observers['*']);
|
|
5900
|
+
_cloned.forEach(function (observer) {
|
|
5901
|
+
observer.apply(observer, [event].concat(args));
|
|
5902
|
+
});
|
|
5903
|
+
}
|
|
5904
|
+
}
|
|
5905
|
+
}]);
|
|
5906
|
+
return EventEmitter;
|
|
5907
|
+
})();
|
|
5908
|
+
function defer() {
|
|
5909
|
+
var res;
|
|
5910
|
+
var rej;
|
|
5911
|
+
var promise = new Promise(function (resolve, reject) {
|
|
5912
|
+
res = resolve;
|
|
5913
|
+
rej = reject;
|
|
5914
|
+
});
|
|
5915
|
+
promise.resolve = res;
|
|
5916
|
+
promise.reject = rej;
|
|
5917
|
+
return promise;
|
|
5918
|
+
}
|
|
5919
|
+
function makeString(object) {
|
|
5920
|
+
if (object == null) return '';
|
|
5921
|
+
return '' + object;
|
|
5922
|
+
}
|
|
5923
|
+
function copy(a, s, t) {
|
|
5924
|
+
a.forEach(function (m) {
|
|
5925
|
+
if (s[m]) t[m] = s[m];
|
|
5926
|
+
});
|
|
5927
|
+
}
|
|
5928
|
+
function getLastOfPath(object, path, Empty) {
|
|
5929
|
+
function cleanKey(key) {
|
|
5930
|
+
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
5931
|
+
}
|
|
5932
|
+
function canNotTraverseDeeper() {
|
|
5933
|
+
return !object || typeof object === 'string';
|
|
5934
|
+
}
|
|
5935
|
+
var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
5936
|
+
while (stack.length > 1) {
|
|
5937
|
+
if (canNotTraverseDeeper()) return {};
|
|
5938
|
+
var key = cleanKey(stack.shift());
|
|
5939
|
+
if (!object[key] && Empty) object[key] = new Empty();
|
|
5940
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
5941
|
+
object = object[key];
|
|
5942
|
+
} else {
|
|
5943
|
+
object = {};
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
if (canNotTraverseDeeper()) return {};
|
|
5947
|
+
return {
|
|
5948
|
+
obj: object,
|
|
5949
|
+
k: cleanKey(stack.shift())
|
|
5950
|
+
};
|
|
5951
|
+
}
|
|
5952
|
+
function setPath(object, path, newValue) {
|
|
5953
|
+
var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k;
|
|
5954
|
+
obj[k] = newValue;
|
|
5955
|
+
}
|
|
5956
|
+
function pushPath(object, path, newValue, concat) {
|
|
5957
|
+
var _getLastOfPath2 = getLastOfPath(object, path, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k;
|
|
5958
|
+
obj[k] = obj[k] || [];
|
|
5959
|
+
if (concat) obj[k] = obj[k].concat(newValue);
|
|
5960
|
+
if (!concat) obj[k].push(newValue);
|
|
5961
|
+
}
|
|
5962
|
+
function getPath(object, path) {
|
|
5963
|
+
var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k;
|
|
5964
|
+
if (!obj) return undefined;
|
|
5965
|
+
return obj[k];
|
|
5966
|
+
}
|
|
5967
|
+
function getPathWithDefaults(data, defaultData, key) {
|
|
5968
|
+
var value = getPath(data, key);
|
|
5969
|
+
if (value !== undefined) {
|
|
5970
|
+
return value;
|
|
5971
|
+
}
|
|
5972
|
+
return getPath(defaultData, key);
|
|
5973
|
+
}
|
|
5974
|
+
function deepExtend(target, source, overwrite) {
|
|
5975
|
+
for (var prop in source) {
|
|
5976
|
+
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
5977
|
+
if ((prop in target)) {
|
|
5978
|
+
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
5979
|
+
if (overwrite) target[prop] = source[prop];
|
|
5980
|
+
} else {
|
|
5981
|
+
deepExtend(target[prop], source[prop], overwrite);
|
|
5982
|
+
}
|
|
5983
|
+
} else {
|
|
5984
|
+
target[prop] = source[prop];
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
return target;
|
|
5989
|
+
}
|
|
5990
|
+
function regexEscape(str) {
|
|
5991
|
+
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
5992
|
+
}
|
|
5993
|
+
var _entityMap = {
|
|
5994
|
+
'&': '&',
|
|
5995
|
+
'<': '<',
|
|
5996
|
+
'>': '>',
|
|
5997
|
+
'"': '"',
|
|
5998
|
+
"'": ''',
|
|
5999
|
+
'/': '/'
|
|
6000
|
+
};
|
|
6001
|
+
function escape(data) {
|
|
6002
|
+
if (typeof data === 'string') {
|
|
6003
|
+
return data.replace(/[&<>"'\/]/g, function (s) {
|
|
6004
|
+
return _entityMap[s];
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
return data;
|
|
6008
|
+
}
|
|
6009
|
+
var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
|
|
6010
|
+
var chars = [' ', ',', '?', '!', ';'];
|
|
6011
|
+
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
6012
|
+
nsSeparator = nsSeparator || '';
|
|
6013
|
+
keySeparator = keySeparator || '';
|
|
6014
|
+
var possibleChars = chars.filter(function (c) {
|
|
6015
|
+
return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
|
|
6016
|
+
});
|
|
6017
|
+
if (possibleChars.length === 0) return true;
|
|
6018
|
+
var r = new RegExp(("(").concat(possibleChars.map(function (c) {
|
|
6019
|
+
return c === '?' ? '\\?' : c;
|
|
6020
|
+
}).join('|'), ")"));
|
|
6021
|
+
var matched = !r.test(key);
|
|
6022
|
+
if (!matched) {
|
|
6023
|
+
var ki = key.indexOf(keySeparator);
|
|
6024
|
+
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
6025
|
+
matched = true;
|
|
6026
|
+
}
|
|
6027
|
+
}
|
|
6028
|
+
return matched;
|
|
6029
|
+
}
|
|
6030
|
+
function deepFind(obj, path) {
|
|
6031
|
+
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
6032
|
+
if (!obj) return undefined;
|
|
6033
|
+
if (obj[path]) return obj[path];
|
|
6034
|
+
var paths = path.split(keySeparator);
|
|
6035
|
+
var current = obj;
|
|
6036
|
+
for (var i = 0; i < paths.length; ++i) {
|
|
6037
|
+
if (!current) return undefined;
|
|
6038
|
+
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
6039
|
+
return undefined;
|
|
6040
|
+
}
|
|
6041
|
+
if (current[paths[i]] === undefined) {
|
|
6042
|
+
var j = 2;
|
|
6043
|
+
var p = paths.slice(i, i + j).join(keySeparator);
|
|
6044
|
+
var mix = current[p];
|
|
6045
|
+
while (mix === undefined && paths.length > i + j) {
|
|
6046
|
+
j++;
|
|
6047
|
+
p = paths.slice(i, i + j).join(keySeparator);
|
|
6048
|
+
mix = current[p];
|
|
6049
|
+
}
|
|
6050
|
+
if (mix === undefined) return undefined;
|
|
6051
|
+
if (mix === null) return null;
|
|
6052
|
+
if (path.endsWith(p)) {
|
|
6053
|
+
if (typeof mix === 'string') return mix;
|
|
6054
|
+
if (p && typeof mix[p] === 'string') return mix[p];
|
|
6055
|
+
}
|
|
6056
|
+
var joinedPath = paths.slice(i + j).join(keySeparator);
|
|
6057
|
+
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
6058
|
+
return undefined;
|
|
6059
|
+
}
|
|
6060
|
+
current = current[paths[i]];
|
|
6061
|
+
}
|
|
6062
|
+
return current;
|
|
6063
|
+
}
|
|
6064
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
6065
|
+
var keys = Object.keys(object);
|
|
6066
|
+
if (Object.getOwnPropertySymbols) {
|
|
6067
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6068
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6069
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
6070
|
+
})), keys.push.apply(keys, symbols));
|
|
6071
|
+
}
|
|
6072
|
+
return keys;
|
|
6073
|
+
}
|
|
6074
|
+
function _objectSpread$5(target) {
|
|
6075
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6076
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
6077
|
+
i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) {
|
|
6078
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
6079
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) {
|
|
6080
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6081
|
+
});
|
|
6082
|
+
}
|
|
6083
|
+
return target;
|
|
6084
|
+
}
|
|
6085
|
+
function _createSuper$3(Derived) {
|
|
6086
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
|
|
6087
|
+
return function _createSuperInternal() {
|
|
6088
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
6089
|
+
if (hasNativeReflectConstruct) {
|
|
6090
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
6091
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
6092
|
+
} else {
|
|
6093
|
+
result = Super.apply(this, arguments);
|
|
6094
|
+
}
|
|
6095
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
6096
|
+
};
|
|
6097
|
+
}
|
|
6098
|
+
function _isNativeReflectConstruct$3() {
|
|
6099
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
6100
|
+
if (Reflect.construct.sham) return false;
|
|
6101
|
+
if (typeof Proxy === "function") return true;
|
|
6102
|
+
try {
|
|
6103
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
6104
|
+
return true;
|
|
6105
|
+
} catch (e) {
|
|
6106
|
+
return false;
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
var ResourceStore = (function (_EventEmitter) {
|
|
6110
|
+
_inherits__default["default"](ResourceStore, _EventEmitter);
|
|
6111
|
+
var _super = _createSuper$3(ResourceStore);
|
|
6112
|
+
function ResourceStore(data) {
|
|
6113
|
+
var _this;
|
|
6114
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6115
|
+
ns: ['translation'],
|
|
6116
|
+
defaultNS: 'translation'
|
|
6117
|
+
};
|
|
6118
|
+
_classCallCheck__default["default"](this, ResourceStore);
|
|
6119
|
+
_this = _super.call(this);
|
|
6120
|
+
if (isIE10) {
|
|
6121
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
6122
|
+
}
|
|
6123
|
+
_this.data = data || ({});
|
|
6124
|
+
_this.options = options;
|
|
6125
|
+
if (_this.options.keySeparator === undefined) {
|
|
6126
|
+
_this.options.keySeparator = '.';
|
|
6127
|
+
}
|
|
6128
|
+
if (_this.options.ignoreJSONStructure === undefined) {
|
|
6129
|
+
_this.options.ignoreJSONStructure = true;
|
|
6130
|
+
}
|
|
6131
|
+
return _this;
|
|
6132
|
+
}
|
|
6133
|
+
_createClass__default["default"](ResourceStore, [{
|
|
6134
|
+
key: "addNamespaces",
|
|
6135
|
+
value: function addNamespaces(ns) {
|
|
6136
|
+
if (this.options.ns.indexOf(ns) < 0) {
|
|
6137
|
+
this.options.ns.push(ns);
|
|
6138
|
+
}
|
|
6139
|
+
}
|
|
6140
|
+
}, {
|
|
6141
|
+
key: "removeNamespaces",
|
|
6142
|
+
value: function removeNamespaces(ns) {
|
|
6143
|
+
var index = this.options.ns.indexOf(ns);
|
|
6144
|
+
if (index > -1) {
|
|
6145
|
+
this.options.ns.splice(index, 1);
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
6148
|
+
}, {
|
|
6149
|
+
key: "getResource",
|
|
6150
|
+
value: function getResource(lng, ns, key) {
|
|
6151
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6152
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6153
|
+
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
6154
|
+
var path = [lng, ns];
|
|
6155
|
+
if (key && typeof key !== 'string') path = path.concat(key);
|
|
6156
|
+
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
6157
|
+
if (lng.indexOf('.') > -1) {
|
|
6158
|
+
path = lng.split('.');
|
|
6159
|
+
}
|
|
6160
|
+
var result = getPath(this.data, path);
|
|
6161
|
+
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
6162
|
+
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
6163
|
+
}
|
|
6164
|
+
}, {
|
|
6165
|
+
key: "addResource",
|
|
6166
|
+
value: function addResource(lng, ns, key, value) {
|
|
6167
|
+
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
6168
|
+
silent: false
|
|
6169
|
+
};
|
|
6170
|
+
var keySeparator = this.options.keySeparator;
|
|
6171
|
+
if (keySeparator === undefined) keySeparator = '.';
|
|
6172
|
+
var path = [lng, ns];
|
|
6173
|
+
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
6174
|
+
if (lng.indexOf('.') > -1) {
|
|
6175
|
+
path = lng.split('.');
|
|
6176
|
+
value = ns;
|
|
6177
|
+
ns = path[1];
|
|
6178
|
+
}
|
|
6179
|
+
this.addNamespaces(ns);
|
|
6180
|
+
setPath(this.data, path, value);
|
|
6181
|
+
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
6182
|
+
}
|
|
6183
|
+
}, {
|
|
6184
|
+
key: "addResources",
|
|
6185
|
+
value: function addResources(lng, ns, resources) {
|
|
6186
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
6187
|
+
silent: false
|
|
6188
|
+
};
|
|
6189
|
+
for (var m in resources) {
|
|
6190
|
+
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
6191
|
+
silent: true
|
|
6192
|
+
});
|
|
6193
|
+
}
|
|
6194
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
6195
|
+
}
|
|
6196
|
+
}, {
|
|
6197
|
+
key: "addResourceBundle",
|
|
6198
|
+
value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
6199
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
6200
|
+
silent: false
|
|
6201
|
+
};
|
|
6202
|
+
var path = [lng, ns];
|
|
6203
|
+
if (lng.indexOf('.') > -1) {
|
|
6204
|
+
path = lng.split('.');
|
|
6205
|
+
deep = resources;
|
|
6206
|
+
resources = ns;
|
|
6207
|
+
ns = path[1];
|
|
6208
|
+
}
|
|
6209
|
+
this.addNamespaces(ns);
|
|
6210
|
+
var pack = getPath(this.data, path) || ({});
|
|
6211
|
+
if (deep) {
|
|
6212
|
+
deepExtend(pack, resources, overwrite);
|
|
6213
|
+
} else {
|
|
6214
|
+
pack = _objectSpread$5(_objectSpread$5({}, pack), resources);
|
|
6215
|
+
}
|
|
6216
|
+
setPath(this.data, path, pack);
|
|
6217
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
6218
|
+
}
|
|
6219
|
+
}, {
|
|
6220
|
+
key: "removeResourceBundle",
|
|
6221
|
+
value: function removeResourceBundle(lng, ns) {
|
|
6222
|
+
if (this.hasResourceBundle(lng, ns)) {
|
|
6223
|
+
delete this.data[lng][ns];
|
|
6224
|
+
}
|
|
6225
|
+
this.removeNamespaces(ns);
|
|
6226
|
+
this.emit('removed', lng, ns);
|
|
6227
|
+
}
|
|
6228
|
+
}, {
|
|
6229
|
+
key: "hasResourceBundle",
|
|
6230
|
+
value: function hasResourceBundle(lng, ns) {
|
|
6231
|
+
return this.getResource(lng, ns) !== undefined;
|
|
6232
|
+
}
|
|
6233
|
+
}, {
|
|
6234
|
+
key: "getResourceBundle",
|
|
6235
|
+
value: function getResourceBundle(lng, ns) {
|
|
6236
|
+
if (!ns) ns = this.options.defaultNS;
|
|
6237
|
+
if (this.options.compatibilityAPI === 'v1') return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns));
|
|
6238
|
+
return this.getResource(lng, ns);
|
|
6239
|
+
}
|
|
6240
|
+
}, {
|
|
6241
|
+
key: "getDataByLanguage",
|
|
6242
|
+
value: function getDataByLanguage(lng) {
|
|
6243
|
+
return this.data[lng];
|
|
6244
|
+
}
|
|
6245
|
+
}, {
|
|
6246
|
+
key: "hasLanguageSomeTranslations",
|
|
6247
|
+
value: function hasLanguageSomeTranslations(lng) {
|
|
6248
|
+
var data = this.getDataByLanguage(lng);
|
|
6249
|
+
var n = data && Object.keys(data) || [];
|
|
6250
|
+
return !!n.find(function (v) {
|
|
6251
|
+
return data[v] && Object.keys(data[v]).length > 0;
|
|
6252
|
+
});
|
|
6253
|
+
}
|
|
6254
|
+
}, {
|
|
6255
|
+
key: "toJSON",
|
|
6256
|
+
value: function toJSON() {
|
|
6257
|
+
return this.data;
|
|
6258
|
+
}
|
|
6259
|
+
}]);
|
|
6260
|
+
return ResourceStore;
|
|
6261
|
+
})(EventEmitter);
|
|
6262
|
+
var postProcessor = {
|
|
6263
|
+
processors: {},
|
|
6264
|
+
addPostProcessor: function addPostProcessor(module) {
|
|
6265
|
+
this.processors[module.name] = module;
|
|
6266
|
+
},
|
|
6267
|
+
handle: function handle(processors, value, key, options, translator) {
|
|
6268
|
+
var _this = this;
|
|
6269
|
+
processors.forEach(function (processor) {
|
|
6270
|
+
if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
|
|
6271
|
+
});
|
|
6272
|
+
return value;
|
|
6273
|
+
}
|
|
6274
|
+
};
|
|
6275
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
6276
|
+
var keys = Object.keys(object);
|
|
6277
|
+
if (Object.getOwnPropertySymbols) {
|
|
6278
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
6279
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6280
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
6281
|
+
})), keys.push.apply(keys, symbols));
|
|
6282
|
+
}
|
|
6283
|
+
return keys;
|
|
6284
|
+
}
|
|
6285
|
+
function _objectSpread$4(target) {
|
|
6286
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6287
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
6288
|
+
i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) {
|
|
6289
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
6290
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) {
|
|
6291
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6292
|
+
});
|
|
6293
|
+
}
|
|
6294
|
+
return target;
|
|
6295
|
+
}
|
|
6296
|
+
function _createSuper$2(Derived) {
|
|
6297
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
|
|
6298
|
+
return function _createSuperInternal() {
|
|
6299
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
6300
|
+
if (hasNativeReflectConstruct) {
|
|
6301
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
6302
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
6303
|
+
} else {
|
|
6304
|
+
result = Super.apply(this, arguments);
|
|
6305
|
+
}
|
|
6306
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
6307
|
+
};
|
|
6308
|
+
}
|
|
6309
|
+
function _isNativeReflectConstruct$2() {
|
|
6310
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
6311
|
+
if (Reflect.construct.sham) return false;
|
|
6312
|
+
if (typeof Proxy === "function") return true;
|
|
6313
|
+
try {
|
|
6314
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
6315
|
+
return true;
|
|
6316
|
+
} catch (e) {
|
|
6317
|
+
return false;
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6320
|
+
var checkedLoadedFor = {};
|
|
6321
|
+
var Translator$1 = (function (_EventEmitter) {
|
|
6322
|
+
_inherits__default["default"](Translator, _EventEmitter);
|
|
6323
|
+
var _super = _createSuper$2(Translator);
|
|
6324
|
+
function Translator(services) {
|
|
6325
|
+
var _this;
|
|
6326
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6327
|
+
_classCallCheck__default["default"](this, Translator);
|
|
6328
|
+
_this = _super.call(this);
|
|
6329
|
+
if (isIE10) {
|
|
6330
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
6331
|
+
}
|
|
6332
|
+
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized__default["default"](_this));
|
|
6333
|
+
_this.options = options;
|
|
6334
|
+
if (_this.options.keySeparator === undefined) {
|
|
6335
|
+
_this.options.keySeparator = '.';
|
|
6336
|
+
}
|
|
6337
|
+
_this.logger = baseLogger.create('translator');
|
|
6338
|
+
return _this;
|
|
6339
|
+
}
|
|
6340
|
+
_createClass__default["default"](Translator, [{
|
|
6341
|
+
key: "changeLanguage",
|
|
6342
|
+
value: function changeLanguage(lng) {
|
|
6343
|
+
if (lng) this.language = lng;
|
|
6344
|
+
}
|
|
6345
|
+
}, {
|
|
6346
|
+
key: "exists",
|
|
6347
|
+
value: function exists(key) {
|
|
6348
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
6349
|
+
interpolation: {}
|
|
6350
|
+
};
|
|
6351
|
+
if (key === undefined || key === null) {
|
|
6352
|
+
return false;
|
|
6353
|
+
}
|
|
6354
|
+
var resolved = this.resolve(key, options);
|
|
6355
|
+
return resolved && resolved.res !== undefined;
|
|
6356
|
+
}
|
|
6357
|
+
}, {
|
|
6358
|
+
key: "extractFromKey",
|
|
6359
|
+
value: function extractFromKey(key, options) {
|
|
6360
|
+
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
6361
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
6362
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6363
|
+
var namespaces = options.ns || this.options.defaultNS || [];
|
|
6364
|
+
var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
6365
|
+
var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
6366
|
+
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
6367
|
+
var m = key.match(this.interpolator.nestingRegexp);
|
|
6368
|
+
if (m && m.length > 0) {
|
|
6369
|
+
return {
|
|
6370
|
+
key: key,
|
|
6371
|
+
namespaces: namespaces
|
|
6372
|
+
};
|
|
6373
|
+
}
|
|
6374
|
+
var parts = key.split(nsSeparator);
|
|
6375
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
6376
|
+
key = parts.join(keySeparator);
|
|
6377
|
+
}
|
|
6378
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
6379
|
+
return {
|
|
6380
|
+
key: key,
|
|
6381
|
+
namespaces: namespaces
|
|
6382
|
+
};
|
|
6383
|
+
}
|
|
6384
|
+
}, {
|
|
6385
|
+
key: "translate",
|
|
6386
|
+
value: function translate(keys, options, lastKey) {
|
|
6387
|
+
var _this2 = this;
|
|
6388
|
+
if (_typeof__default["default"](options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
6389
|
+
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
6390
|
+
}
|
|
6391
|
+
if (_typeof__default["default"](options) === 'object') options = _objectSpread$4({}, options);
|
|
6392
|
+
if (!options) options = {};
|
|
6393
|
+
if (keys === undefined || keys === null) return '';
|
|
6394
|
+
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
6395
|
+
var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
|
|
6396
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
6397
|
+
var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces;
|
|
6398
|
+
var namespace = namespaces[namespaces.length - 1];
|
|
6399
|
+
var lng = options.lng || this.language;
|
|
6400
|
+
var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
6401
|
+
if (lng && lng.toLowerCase() === 'cimode') {
|
|
6402
|
+
if (appendNamespaceToCIMode) {
|
|
6403
|
+
var nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
6404
|
+
if (returnDetails) {
|
|
6405
|
+
return {
|
|
6406
|
+
res: ("").concat(namespace).concat(nsSeparator).concat(key),
|
|
6407
|
+
usedKey: key,
|
|
6408
|
+
exactUsedKey: key,
|
|
6409
|
+
usedLng: lng,
|
|
6410
|
+
usedNS: namespace
|
|
6411
|
+
};
|
|
6412
|
+
}
|
|
6413
|
+
return ("").concat(namespace).concat(nsSeparator).concat(key);
|
|
6414
|
+
}
|
|
6415
|
+
if (returnDetails) {
|
|
6416
|
+
return {
|
|
6417
|
+
res: key,
|
|
6418
|
+
usedKey: key,
|
|
6419
|
+
exactUsedKey: key,
|
|
6420
|
+
usedLng: lng,
|
|
6421
|
+
usedNS: namespace
|
|
6422
|
+
};
|
|
6423
|
+
}
|
|
6424
|
+
return key;
|
|
6425
|
+
}
|
|
6426
|
+
var resolved = this.resolve(keys, options);
|
|
6427
|
+
var res = resolved && resolved.res;
|
|
6428
|
+
var resUsedKey = resolved && resolved.usedKey || key;
|
|
6429
|
+
var resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
6430
|
+
var resType = Object.prototype.toString.apply(res);
|
|
6431
|
+
var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
6432
|
+
var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
6433
|
+
var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
6434
|
+
var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
6435
|
+
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
6436
|
+
if (!options.returnObjects && !this.options.returnObjects) {
|
|
6437
|
+
if (!this.options.returnedObjectHandler) {
|
|
6438
|
+
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
6439
|
+
}
|
|
6440
|
+
var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
6441
|
+
ns: namespaces
|
|
6442
|
+
})) : ("key '").concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
6443
|
+
if (returnDetails) {
|
|
6444
|
+
resolved.res = r;
|
|
6445
|
+
return resolved;
|
|
6446
|
+
}
|
|
6447
|
+
return r;
|
|
6448
|
+
}
|
|
6449
|
+
if (keySeparator) {
|
|
6450
|
+
var resTypeIsArray = resType === '[object Array]';
|
|
6451
|
+
var copy = resTypeIsArray ? [] : {};
|
|
6452
|
+
var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
6453
|
+
for (var m in res) {
|
|
6454
|
+
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
6455
|
+
var deepKey = ("").concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
6456
|
+
copy[m] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), {
|
|
6457
|
+
joinArrays: false,
|
|
6458
|
+
ns: namespaces
|
|
6459
|
+
}));
|
|
6460
|
+
if (copy[m] === deepKey) copy[m] = res[m];
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
res = copy;
|
|
6464
|
+
}
|
|
6465
|
+
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
6466
|
+
res = res.join(joinArrays);
|
|
6467
|
+
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
6468
|
+
} else {
|
|
6469
|
+
var usedDefault = false;
|
|
6470
|
+
var usedKey = false;
|
|
6471
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
6472
|
+
var hasDefaultValue = Translator.hasDefaultValue(options);
|
|
6473
|
+
var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
|
|
6474
|
+
var defaultValue = options[("defaultValue").concat(defaultValueSuffix)] || options.defaultValue;
|
|
6475
|
+
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
6476
|
+
usedDefault = true;
|
|
6477
|
+
res = defaultValue;
|
|
6478
|
+
}
|
|
6479
|
+
if (!this.isValidLookup(res)) {
|
|
6480
|
+
usedKey = true;
|
|
6481
|
+
res = key;
|
|
6482
|
+
}
|
|
6483
|
+
var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
6484
|
+
var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
6485
|
+
var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
6486
|
+
if (usedKey || usedDefault || updateMissing) {
|
|
6487
|
+
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
6488
|
+
if (keySeparator) {
|
|
6489
|
+
var fk = this.resolve(key, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
6490
|
+
keySeparator: false
|
|
6491
|
+
}));
|
|
6492
|
+
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.');
|
|
6493
|
+
}
|
|
6494
|
+
var lngs = [];
|
|
6495
|
+
var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
6496
|
+
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
6497
|
+
for (var i = 0; i < fallbackLngs.length; i++) {
|
|
6498
|
+
lngs.push(fallbackLngs[i]);
|
|
6499
|
+
}
|
|
6500
|
+
} else if (this.options.saveMissingTo === 'all') {
|
|
6501
|
+
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
6502
|
+
} else {
|
|
6503
|
+
lngs.push(options.lng || this.language);
|
|
6504
|
+
}
|
|
6505
|
+
var send = function send(l, k, specificDefaultValue) {
|
|
6506
|
+
var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
6507
|
+
if (_this2.options.missingKeyHandler) {
|
|
6508
|
+
_this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
6509
|
+
} else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
|
|
6510
|
+
_this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
6511
|
+
}
|
|
6512
|
+
_this2.emit('missingKey', l, namespace, k, res);
|
|
6513
|
+
};
|
|
6514
|
+
if (this.options.saveMissing) {
|
|
6515
|
+
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
6516
|
+
lngs.forEach(function (language) {
|
|
6517
|
+
_this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
|
|
6518
|
+
send([language], key + suffix, options[("defaultValue").concat(suffix)] || defaultValue);
|
|
6519
|
+
});
|
|
6520
|
+
});
|
|
6521
|
+
} else {
|
|
6522
|
+
send(lngs, key, defaultValue);
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
}
|
|
6526
|
+
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
6527
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = ("").concat(namespace, ":").concat(key);
|
|
6528
|
+
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
6529
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
6530
|
+
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? ("").concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
|
|
6531
|
+
} else {
|
|
6532
|
+
res = this.options.parseMissingKeyHandler(res);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
if (returnDetails) {
|
|
6537
|
+
resolved.res = res;
|
|
6538
|
+
return resolved;
|
|
6539
|
+
}
|
|
6540
|
+
return res;
|
|
6541
|
+
}
|
|
6542
|
+
}, {
|
|
6543
|
+
key: "extendTranslation",
|
|
6544
|
+
value: function extendTranslation(res, key, options, resolved, lastKey) {
|
|
6545
|
+
var _this3 = this;
|
|
6546
|
+
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
6547
|
+
res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
6548
|
+
resolved: resolved
|
|
6549
|
+
});
|
|
6550
|
+
} else if (!options.skipInterpolation) {
|
|
6551
|
+
if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), {
|
|
6552
|
+
interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation)
|
|
6553
|
+
}));
|
|
6554
|
+
var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
6555
|
+
var nestBef;
|
|
6556
|
+
if (skipOnVariables) {
|
|
6557
|
+
var nb = res.match(this.interpolator.nestingRegexp);
|
|
6558
|
+
nestBef = nb && nb.length;
|
|
6559
|
+
}
|
|
6560
|
+
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
6561
|
+
if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data);
|
|
6562
|
+
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
6563
|
+
if (skipOnVariables) {
|
|
6564
|
+
var na = res.match(this.interpolator.nestingRegexp);
|
|
6565
|
+
var nestAft = na && na.length;
|
|
6566
|
+
if (nestBef < nestAft) options.nest = false;
|
|
6567
|
+
}
|
|
6568
|
+
if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;
|
|
6569
|
+
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
6570
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6571
|
+
args[_key] = arguments[_key];
|
|
6572
|
+
}
|
|
6573
|
+
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
6574
|
+
_this3.logger.warn(("It seems you are nesting recursively key: ").concat(args[0], " in key: ").concat(key[0]));
|
|
6575
|
+
return null;
|
|
6576
|
+
}
|
|
6577
|
+
return _this3.translate.apply(_this3, args.concat([key]));
|
|
6578
|
+
}, options);
|
|
6579
|
+
if (options.interpolation) this.interpolator.reset();
|
|
6580
|
+
}
|
|
6581
|
+
var postProcess = options.postProcess || this.options.postProcess;
|
|
6582
|
+
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
6583
|
+
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
6584
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4({
|
|
6585
|
+
i18nResolved: resolved
|
|
6586
|
+
}, options) : options, this);
|
|
6587
|
+
}
|
|
6588
|
+
return res;
|
|
6589
|
+
}
|
|
6590
|
+
}, {
|
|
6591
|
+
key: "resolve",
|
|
6592
|
+
value: function resolve(keys) {
|
|
6593
|
+
var _this4 = this;
|
|
6594
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6595
|
+
var found;
|
|
6596
|
+
var usedKey;
|
|
6597
|
+
var exactUsedKey;
|
|
6598
|
+
var usedLng;
|
|
6599
|
+
var usedNS;
|
|
6600
|
+
if (typeof keys === 'string') keys = [keys];
|
|
6601
|
+
keys.forEach(function (k) {
|
|
6602
|
+
if (_this4.isValidLookup(found)) return;
|
|
6603
|
+
var extracted = _this4.extractFromKey(k, options);
|
|
6604
|
+
var key = extracted.key;
|
|
6605
|
+
usedKey = key;
|
|
6606
|
+
var namespaces = extracted.namespaces;
|
|
6607
|
+
if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
|
|
6608
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
6609
|
+
var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
|
|
6610
|
+
var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
6611
|
+
var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
|
|
6612
|
+
namespaces.forEach(function (ns) {
|
|
6613
|
+
if (_this4.isValidLookup(found)) return;
|
|
6614
|
+
usedNS = ns;
|
|
6615
|
+
if (!checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
|
|
6616
|
+
checkedLoadedFor[("").concat(codes[0], "-").concat(ns)] = true;
|
|
6617
|
+
_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!!!');
|
|
6618
|
+
}
|
|
6619
|
+
codes.forEach(function (code) {
|
|
6620
|
+
if (_this4.isValidLookup(found)) return;
|
|
6621
|
+
usedLng = code;
|
|
6622
|
+
var finalKeys = [key];
|
|
6623
|
+
if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
|
|
6624
|
+
_this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
6625
|
+
} else {
|
|
6626
|
+
var pluralSuffix;
|
|
6627
|
+
if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
|
|
6628
|
+
var zeroSuffix = ("").concat(_this4.options.pluralSeparator, "zero");
|
|
6629
|
+
if (needsPluralHandling) {
|
|
6630
|
+
finalKeys.push(key + pluralSuffix);
|
|
6631
|
+
if (needsZeroSuffixLookup) {
|
|
6632
|
+
finalKeys.push(key + zeroSuffix);
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
if (needsContextHandling) {
|
|
6636
|
+
var contextKey = ("").concat(key).concat(_this4.options.contextSeparator).concat(options.context);
|
|
6637
|
+
finalKeys.push(contextKey);
|
|
6638
|
+
if (needsPluralHandling) {
|
|
6639
|
+
finalKeys.push(contextKey + pluralSuffix);
|
|
6640
|
+
if (needsZeroSuffixLookup) {
|
|
6641
|
+
finalKeys.push(contextKey + zeroSuffix);
|
|
6642
|
+
}
|
|
6643
|
+
}
|
|
6644
|
+
}
|
|
6645
|
+
}
|
|
6646
|
+
var possibleKey;
|
|
6647
|
+
while (possibleKey = finalKeys.pop()) {
|
|
6648
|
+
if (!_this4.isValidLookup(found)) {
|
|
6649
|
+
exactUsedKey = possibleKey;
|
|
6650
|
+
found = _this4.getResource(code, ns, possibleKey, options);
|
|
6651
|
+
}
|
|
6652
|
+
}
|
|
6653
|
+
});
|
|
6654
|
+
});
|
|
6655
|
+
});
|
|
6656
|
+
return {
|
|
6657
|
+
res: found,
|
|
6658
|
+
usedKey: usedKey,
|
|
6659
|
+
exactUsedKey: exactUsedKey,
|
|
6660
|
+
usedLng: usedLng,
|
|
6661
|
+
usedNS: usedNS
|
|
6662
|
+
};
|
|
6663
|
+
}
|
|
6664
|
+
}, {
|
|
6665
|
+
key: "isValidLookup",
|
|
6666
|
+
value: function isValidLookup(res) {
|
|
6667
|
+
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
6668
|
+
}
|
|
6669
|
+
}, {
|
|
6670
|
+
key: "getResource",
|
|
6671
|
+
value: function getResource(code, ns, key) {
|
|
6672
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6673
|
+
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
6674
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
6675
|
+
}
|
|
6676
|
+
}], [{
|
|
6677
|
+
key: "hasDefaultValue",
|
|
6678
|
+
value: function hasDefaultValue(options) {
|
|
6679
|
+
var prefix = 'defaultValue';
|
|
6680
|
+
for (var option in options) {
|
|
6681
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
6682
|
+
return true;
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
return false;
|
|
6686
|
+
}
|
|
6687
|
+
}]);
|
|
6688
|
+
return Translator;
|
|
6689
|
+
})(EventEmitter);
|
|
6690
|
+
function capitalize$1(string) {
|
|
6691
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
6692
|
+
}
|
|
6693
|
+
var LanguageUtil = (function () {
|
|
6694
|
+
function LanguageUtil(options) {
|
|
6695
|
+
_classCallCheck__default["default"](this, LanguageUtil);
|
|
6696
|
+
this.options = options;
|
|
6697
|
+
this.supportedLngs = this.options.supportedLngs || false;
|
|
6698
|
+
this.logger = baseLogger.create('languageUtils');
|
|
6699
|
+
}
|
|
6700
|
+
_createClass__default["default"](LanguageUtil, [{
|
|
6701
|
+
key: "getScriptPartFromCode",
|
|
6702
|
+
value: function getScriptPartFromCode(code) {
|
|
6703
|
+
if (!code || code.indexOf('-') < 0) return null;
|
|
6704
|
+
var p = code.split('-');
|
|
6705
|
+
if (p.length === 2) return null;
|
|
6706
|
+
p.pop();
|
|
6707
|
+
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
6708
|
+
return this.formatLanguageCode(p.join('-'));
|
|
6709
|
+
}
|
|
6710
|
+
}, {
|
|
6711
|
+
key: "getLanguagePartFromCode",
|
|
6712
|
+
value: function getLanguagePartFromCode(code) {
|
|
6713
|
+
if (!code || code.indexOf('-') < 0) return code;
|
|
6714
|
+
var p = code.split('-');
|
|
6715
|
+
return this.formatLanguageCode(p[0]);
|
|
6716
|
+
}
|
|
6717
|
+
}, {
|
|
6718
|
+
key: "formatLanguageCode",
|
|
6719
|
+
value: function formatLanguageCode(code) {
|
|
6720
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
6721
|
+
var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
6722
|
+
var p = code.split('-');
|
|
6723
|
+
if (this.options.lowerCaseLng) {
|
|
6724
|
+
p = p.map(function (part) {
|
|
6725
|
+
return part.toLowerCase();
|
|
6726
|
+
});
|
|
6727
|
+
} else if (p.length === 2) {
|
|
6728
|
+
p[0] = p[0].toLowerCase();
|
|
6729
|
+
p[1] = p[1].toUpperCase();
|
|
6730
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
|
|
6731
|
+
} else if (p.length === 3) {
|
|
6732
|
+
p[0] = p[0].toLowerCase();
|
|
6733
|
+
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
6734
|
+
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
6735
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize$1(p[1].toLowerCase());
|
|
6736
|
+
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize$1(p[2].toLowerCase());
|
|
6737
|
+
}
|
|
6738
|
+
return p.join('-');
|
|
6739
|
+
}
|
|
6740
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
6741
|
+
}
|
|
6742
|
+
}, {
|
|
6743
|
+
key: "isSupportedCode",
|
|
6744
|
+
value: function isSupportedCode(code) {
|
|
6745
|
+
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
6746
|
+
code = this.getLanguagePartFromCode(code);
|
|
6747
|
+
}
|
|
6748
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
6749
|
+
}
|
|
6750
|
+
}, {
|
|
6751
|
+
key: "getBestMatchFromCodes",
|
|
6752
|
+
value: function getBestMatchFromCodes(codes) {
|
|
6753
|
+
var _this = this;
|
|
6754
|
+
if (!codes) return null;
|
|
6755
|
+
var found;
|
|
6756
|
+
codes.forEach(function (code) {
|
|
6757
|
+
if (found) return;
|
|
6758
|
+
var cleanedLng = _this.formatLanguageCode(code);
|
|
6759
|
+
if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
6760
|
+
});
|
|
6761
|
+
if (!found && this.options.supportedLngs) {
|
|
6762
|
+
codes.forEach(function (code) {
|
|
6763
|
+
if (found) return;
|
|
6764
|
+
var lngOnly = _this.getLanguagePartFromCode(code);
|
|
6765
|
+
if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
6766
|
+
found = _this.options.supportedLngs.find(function (supportedLng) {
|
|
6767
|
+
if (supportedLng === lngOnly) return supportedLng;
|
|
6768
|
+
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
|
|
6769
|
+
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
6770
|
+
});
|
|
6771
|
+
});
|
|
6772
|
+
}
|
|
6773
|
+
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
6774
|
+
return found;
|
|
6775
|
+
}
|
|
6776
|
+
}, {
|
|
6777
|
+
key: "getFallbackCodes",
|
|
6778
|
+
value: function getFallbackCodes(fallbacks, code) {
|
|
6779
|
+
if (!fallbacks) return [];
|
|
6780
|
+
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
6781
|
+
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
6782
|
+
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
6783
|
+
if (!code) return fallbacks["default"] || [];
|
|
6784
|
+
var found = fallbacks[code];
|
|
6785
|
+
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
6786
|
+
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
6787
|
+
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
6788
|
+
if (!found) found = fallbacks["default"];
|
|
6789
|
+
return found || [];
|
|
6790
|
+
}
|
|
6791
|
+
}, {
|
|
6792
|
+
key: "toResolveHierarchy",
|
|
6793
|
+
value: function toResolveHierarchy(code, fallbackCode) {
|
|
6794
|
+
var _this2 = this;
|
|
6795
|
+
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
6796
|
+
var codes = [];
|
|
6797
|
+
var addCode = function addCode(c) {
|
|
6798
|
+
if (!c) return;
|
|
6799
|
+
if (_this2.isSupportedCode(c)) {
|
|
6800
|
+
codes.push(c);
|
|
6801
|
+
} else {
|
|
6802
|
+
_this2.logger.warn(("rejecting language code not found in supportedLngs: ").concat(c));
|
|
6803
|
+
}
|
|
6804
|
+
};
|
|
6805
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
6806
|
+
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
6807
|
+
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
6808
|
+
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
6809
|
+
} else if (typeof code === 'string') {
|
|
6810
|
+
addCode(this.formatLanguageCode(code));
|
|
6811
|
+
}
|
|
6812
|
+
fallbackCodes.forEach(function (fc) {
|
|
6813
|
+
if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
|
|
6814
|
+
});
|
|
6815
|
+
return codes;
|
|
6816
|
+
}
|
|
6817
|
+
}]);
|
|
6818
|
+
return LanguageUtil;
|
|
6819
|
+
})();
|
|
6820
|
+
var sets = [{
|
|
6821
|
+
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
6822
|
+
nr: [1, 2],
|
|
6823
|
+
fc: 1
|
|
6824
|
+
}, {
|
|
6825
|
+
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'],
|
|
6826
|
+
nr: [1, 2],
|
|
6827
|
+
fc: 2
|
|
6828
|
+
}, {
|
|
6829
|
+
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
6830
|
+
nr: [1],
|
|
6831
|
+
fc: 3
|
|
6832
|
+
}, {
|
|
6833
|
+
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
6834
|
+
nr: [1, 2, 5],
|
|
6835
|
+
fc: 4
|
|
6836
|
+
}, {
|
|
6837
|
+
lngs: ['ar'],
|
|
6838
|
+
nr: [0, 1, 2, 3, 11, 100],
|
|
6839
|
+
fc: 5
|
|
6840
|
+
}, {
|
|
6841
|
+
lngs: ['cs', 'sk'],
|
|
6842
|
+
nr: [1, 2, 5],
|
|
6843
|
+
fc: 6
|
|
6844
|
+
}, {
|
|
6845
|
+
lngs: ['csb', 'pl'],
|
|
6846
|
+
nr: [1, 2, 5],
|
|
6847
|
+
fc: 7
|
|
6848
|
+
}, {
|
|
6849
|
+
lngs: ['cy'],
|
|
6850
|
+
nr: [1, 2, 3, 8],
|
|
6851
|
+
fc: 8
|
|
6852
|
+
}, {
|
|
6853
|
+
lngs: ['fr'],
|
|
6854
|
+
nr: [1, 2],
|
|
6855
|
+
fc: 9
|
|
6856
|
+
}, {
|
|
6857
|
+
lngs: ['ga'],
|
|
6858
|
+
nr: [1, 2, 3, 7, 11],
|
|
6859
|
+
fc: 10
|
|
6860
|
+
}, {
|
|
6861
|
+
lngs: ['gd'],
|
|
6862
|
+
nr: [1, 2, 3, 20],
|
|
6863
|
+
fc: 11
|
|
6864
|
+
}, {
|
|
6865
|
+
lngs: ['is'],
|
|
6866
|
+
nr: [1, 2],
|
|
6867
|
+
fc: 12
|
|
6868
|
+
}, {
|
|
6869
|
+
lngs: ['jv'],
|
|
6870
|
+
nr: [0, 1],
|
|
6871
|
+
fc: 13
|
|
6872
|
+
}, {
|
|
6873
|
+
lngs: ['kw'],
|
|
6874
|
+
nr: [1, 2, 3, 4],
|
|
6875
|
+
fc: 14
|
|
6876
|
+
}, {
|
|
6877
|
+
lngs: ['lt'],
|
|
6878
|
+
nr: [1, 2, 10],
|
|
6879
|
+
fc: 15
|
|
6880
|
+
}, {
|
|
6881
|
+
lngs: ['lv'],
|
|
6882
|
+
nr: [1, 2, 0],
|
|
6883
|
+
fc: 16
|
|
6884
|
+
}, {
|
|
6885
|
+
lngs: ['mk'],
|
|
6886
|
+
nr: [1, 2],
|
|
6887
|
+
fc: 17
|
|
6888
|
+
}, {
|
|
6889
|
+
lngs: ['mnk'],
|
|
6890
|
+
nr: [0, 1, 2],
|
|
6891
|
+
fc: 18
|
|
6892
|
+
}, {
|
|
6893
|
+
lngs: ['mt'],
|
|
6894
|
+
nr: [1, 2, 11, 20],
|
|
6895
|
+
fc: 19
|
|
6896
|
+
}, {
|
|
6897
|
+
lngs: ['or'],
|
|
6898
|
+
nr: [2, 1],
|
|
6899
|
+
fc: 2
|
|
6900
|
+
}, {
|
|
6901
|
+
lngs: ['ro'],
|
|
6902
|
+
nr: [1, 2, 20],
|
|
6903
|
+
fc: 20
|
|
6904
|
+
}, {
|
|
6905
|
+
lngs: ['sl'],
|
|
6906
|
+
nr: [5, 1, 2, 3],
|
|
6907
|
+
fc: 21
|
|
6908
|
+
}, {
|
|
6909
|
+
lngs: ['he', 'iw'],
|
|
6910
|
+
nr: [1, 2, 20, 21],
|
|
6911
|
+
fc: 22
|
|
6912
|
+
}];
|
|
6913
|
+
var _rulesPluralsTypes = {
|
|
6914
|
+
1: function _(n) {
|
|
6915
|
+
return Number(n > 1);
|
|
6916
|
+
},
|
|
6917
|
+
2: function _(n) {
|
|
6918
|
+
return Number(n != 1);
|
|
6919
|
+
},
|
|
6920
|
+
3: function _(n) {
|
|
6921
|
+
return 0;
|
|
6922
|
+
},
|
|
6923
|
+
4: function _(n) {
|
|
6924
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6925
|
+
},
|
|
6926
|
+
5: function _(n) {
|
|
6927
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
6928
|
+
},
|
|
6929
|
+
6: function _(n) {
|
|
6930
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
6931
|
+
},
|
|
6932
|
+
7: function _(n) {
|
|
6933
|
+
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6934
|
+
},
|
|
6935
|
+
8: function _(n) {
|
|
6936
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
6937
|
+
},
|
|
6938
|
+
9: function _(n) {
|
|
6939
|
+
return Number(n >= 2);
|
|
6940
|
+
},
|
|
6941
|
+
10: function _(n) {
|
|
6942
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
6943
|
+
},
|
|
6944
|
+
11: function _(n) {
|
|
6945
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
6946
|
+
},
|
|
6947
|
+
12: function _(n) {
|
|
6948
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
6949
|
+
},
|
|
6950
|
+
13: function _(n) {
|
|
6951
|
+
return Number(n !== 0);
|
|
6952
|
+
},
|
|
6953
|
+
14: function _(n) {
|
|
6954
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
6955
|
+
},
|
|
6956
|
+
15: function _(n) {
|
|
6957
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
6958
|
+
},
|
|
6959
|
+
16: function _(n) {
|
|
6960
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
6961
|
+
},
|
|
6962
|
+
17: function _(n) {
|
|
6963
|
+
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
6964
|
+
},
|
|
6965
|
+
18: function _(n) {
|
|
6966
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
6967
|
+
},
|
|
6968
|
+
19: function _(n) {
|
|
6969
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
6970
|
+
},
|
|
6971
|
+
20: function _(n) {
|
|
6972
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
6973
|
+
},
|
|
6974
|
+
21: function _(n) {
|
|
6975
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
6976
|
+
},
|
|
6977
|
+
22: function _(n) {
|
|
6978
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
6979
|
+
}
|
|
6980
|
+
};
|
|
6981
|
+
var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
|
|
6982
|
+
var suffixesOrder = {
|
|
6983
|
+
zero: 0,
|
|
6984
|
+
one: 1,
|
|
6985
|
+
two: 2,
|
|
6986
|
+
few: 3,
|
|
6987
|
+
many: 4,
|
|
6988
|
+
other: 5
|
|
6989
|
+
};
|
|
6990
|
+
function createRules() {
|
|
6991
|
+
var rules = {};
|
|
6992
|
+
sets.forEach(function (set) {
|
|
6993
|
+
set.lngs.forEach(function (l) {
|
|
6994
|
+
rules[l] = {
|
|
6995
|
+
numbers: set.nr,
|
|
6996
|
+
plurals: _rulesPluralsTypes[set.fc]
|
|
6997
|
+
};
|
|
6998
|
+
});
|
|
6999
|
+
});
|
|
7000
|
+
return rules;
|
|
7001
|
+
}
|
|
7002
|
+
var PluralResolver = (function () {
|
|
7003
|
+
function PluralResolver(languageUtils) {
|
|
7004
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7005
|
+
_classCallCheck__default["default"](this, PluralResolver);
|
|
7006
|
+
this.languageUtils = languageUtils;
|
|
7007
|
+
this.options = options;
|
|
7008
|
+
this.logger = baseLogger.create('pluralResolver');
|
|
7009
|
+
if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
|
|
7010
|
+
this.options.compatibilityJSON = 'v3';
|
|
7011
|
+
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.');
|
|
7012
|
+
}
|
|
7013
|
+
this.rules = createRules();
|
|
7014
|
+
}
|
|
7015
|
+
_createClass__default["default"](PluralResolver, [{
|
|
7016
|
+
key: "addRule",
|
|
7017
|
+
value: function addRule(lng, obj) {
|
|
7018
|
+
this.rules[lng] = obj;
|
|
7019
|
+
}
|
|
7020
|
+
}, {
|
|
7021
|
+
key: "getRule",
|
|
7022
|
+
value: function getRule(code) {
|
|
7023
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7024
|
+
if (this.shouldUseIntlApi()) {
|
|
7025
|
+
try {
|
|
7026
|
+
return new Intl.PluralRules(code, {
|
|
7027
|
+
type: options.ordinal ? 'ordinal' : 'cardinal'
|
|
7028
|
+
});
|
|
7029
|
+
} catch (_unused) {
|
|
7030
|
+
return;
|
|
7031
|
+
}
|
|
7032
|
+
}
|
|
7033
|
+
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
7034
|
+
}
|
|
7035
|
+
}, {
|
|
7036
|
+
key: "needsPlural",
|
|
7037
|
+
value: function needsPlural(code) {
|
|
7038
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7039
|
+
var rule = this.getRule(code, options);
|
|
7040
|
+
if (this.shouldUseIntlApi()) {
|
|
7041
|
+
return rule && rule.resolvedOptions().pluralCategories.length > 1;
|
|
7042
|
+
}
|
|
7043
|
+
return rule && rule.numbers.length > 1;
|
|
7044
|
+
}
|
|
7045
|
+
}, {
|
|
7046
|
+
key: "getPluralFormsOfKey",
|
|
7047
|
+
value: function getPluralFormsOfKey(code, key) {
|
|
7048
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7049
|
+
return this.getSuffixes(code, options).map(function (suffix) {
|
|
7050
|
+
return ("").concat(key).concat(suffix);
|
|
7051
|
+
});
|
|
7052
|
+
}
|
|
7053
|
+
}, {
|
|
7054
|
+
key: "getSuffixes",
|
|
7055
|
+
value: function getSuffixes(code) {
|
|
7056
|
+
var _this = this;
|
|
7057
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7058
|
+
var rule = this.getRule(code, options);
|
|
7059
|
+
if (!rule) {
|
|
7060
|
+
return [];
|
|
7061
|
+
}
|
|
7062
|
+
if (this.shouldUseIntlApi()) {
|
|
7063
|
+
return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
|
|
7064
|
+
return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
|
|
7065
|
+
}).map(function (pluralCategory) {
|
|
7066
|
+
return ("").concat(_this.options.prepend).concat(pluralCategory);
|
|
7067
|
+
});
|
|
7068
|
+
}
|
|
7069
|
+
return rule.numbers.map(function (number) {
|
|
7070
|
+
return _this.getSuffix(code, number, options);
|
|
7071
|
+
});
|
|
7072
|
+
}
|
|
7073
|
+
}, {
|
|
7074
|
+
key: "getSuffix",
|
|
7075
|
+
value: function getSuffix(code, count) {
|
|
7076
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7077
|
+
var rule = this.getRule(code, options);
|
|
7078
|
+
if (rule) {
|
|
7079
|
+
if (this.shouldUseIntlApi()) {
|
|
7080
|
+
return ("").concat(this.options.prepend).concat(rule.select(count));
|
|
7081
|
+
}
|
|
7082
|
+
return this.getSuffixRetroCompatible(rule, count);
|
|
7083
|
+
}
|
|
7084
|
+
this.logger.warn(("no plural rule found for: ").concat(code));
|
|
7085
|
+
return '';
|
|
7086
|
+
}
|
|
7087
|
+
}, {
|
|
7088
|
+
key: "getSuffixRetroCompatible",
|
|
7089
|
+
value: function getSuffixRetroCompatible(rule, count) {
|
|
7090
|
+
var _this2 = this;
|
|
7091
|
+
var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
7092
|
+
var suffix = rule.numbers[idx];
|
|
7093
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
7094
|
+
if (suffix === 2) {
|
|
7095
|
+
suffix = 'plural';
|
|
7096
|
+
} else if (suffix === 1) {
|
|
7097
|
+
suffix = '';
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
7100
|
+
var returnSuffix = function returnSuffix() {
|
|
7101
|
+
return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
|
|
7102
|
+
};
|
|
7103
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
7104
|
+
if (suffix === 1) return '';
|
|
7105
|
+
if (typeof suffix === 'number') return ("_plural_").concat(suffix.toString());
|
|
7106
|
+
return returnSuffix();
|
|
7107
|
+
} else if (this.options.compatibilityJSON === 'v2') {
|
|
7108
|
+
return returnSuffix();
|
|
7109
|
+
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
7110
|
+
return returnSuffix();
|
|
7111
|
+
}
|
|
7112
|
+
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
7113
|
+
}
|
|
7114
|
+
}, {
|
|
7115
|
+
key: "shouldUseIntlApi",
|
|
7116
|
+
value: function shouldUseIntlApi() {
|
|
7117
|
+
return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
|
|
7118
|
+
}
|
|
7119
|
+
}]);
|
|
7120
|
+
return PluralResolver;
|
|
7121
|
+
})();
|
|
7122
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
7123
|
+
var keys = Object.keys(object);
|
|
7124
|
+
if (Object.getOwnPropertySymbols) {
|
|
7125
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7126
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7127
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7128
|
+
})), keys.push.apply(keys, symbols));
|
|
7129
|
+
}
|
|
7130
|
+
return keys;
|
|
7131
|
+
}
|
|
7132
|
+
function _objectSpread$3(target) {
|
|
7133
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7134
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7135
|
+
i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
|
|
7136
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7137
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
|
|
7138
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7139
|
+
});
|
|
7140
|
+
}
|
|
7141
|
+
return target;
|
|
7142
|
+
}
|
|
7143
|
+
function deepFindWithDefaults(data, defaultData, key) {
|
|
7144
|
+
var keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
|
|
7145
|
+
var ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
7146
|
+
var path = getPathWithDefaults(data, defaultData, key);
|
|
7147
|
+
if (!path && ignoreJSONStructure && typeof key === 'string') {
|
|
7148
|
+
path = deepFind(data, key, keySeparator);
|
|
7149
|
+
if (path === undefined) path = deepFind(defaultData, key, keySeparator);
|
|
7150
|
+
}
|
|
7151
|
+
return path;
|
|
7152
|
+
}
|
|
7153
|
+
var Interpolator = (function () {
|
|
7154
|
+
function Interpolator() {
|
|
7155
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7156
|
+
_classCallCheck__default["default"](this, Interpolator);
|
|
7157
|
+
this.logger = baseLogger.create('interpolator');
|
|
7158
|
+
this.options = options;
|
|
7159
|
+
this.format = options.interpolation && options.interpolation.format || (function (value) {
|
|
7160
|
+
return value;
|
|
7161
|
+
});
|
|
7162
|
+
this.init(options);
|
|
7163
|
+
}
|
|
7164
|
+
_createClass__default["default"](Interpolator, [{
|
|
7165
|
+
key: "init",
|
|
7166
|
+
value: function init() {
|
|
7167
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7168
|
+
if (!options.interpolation) options.interpolation = {
|
|
7169
|
+
escapeValue: true
|
|
7170
|
+
};
|
|
7171
|
+
var iOpts = options.interpolation;
|
|
7172
|
+
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
|
|
7173
|
+
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
7174
|
+
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
7175
|
+
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
7176
|
+
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
7177
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
7178
|
+
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
7179
|
+
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
7180
|
+
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
7181
|
+
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
7182
|
+
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
7183
|
+
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
7184
|
+
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
7185
|
+
this.resetRegExp();
|
|
7186
|
+
}
|
|
7187
|
+
}, {
|
|
7188
|
+
key: "reset",
|
|
7189
|
+
value: function reset() {
|
|
7190
|
+
if (this.options) this.init(this.options);
|
|
7191
|
+
}
|
|
7192
|
+
}, {
|
|
7193
|
+
key: "resetRegExp",
|
|
7194
|
+
value: function resetRegExp() {
|
|
7195
|
+
var regexpStr = ("").concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
7196
|
+
this.regexp = new RegExp(regexpStr, 'g');
|
|
7197
|
+
var regexpUnescapeStr = ("").concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
7198
|
+
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
7199
|
+
var nestingRegexpStr = ("").concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
7200
|
+
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
7201
|
+
}
|
|
7202
|
+
}, {
|
|
7203
|
+
key: "interpolate",
|
|
7204
|
+
value: function interpolate(str, data, lng, options) {
|
|
7205
|
+
var _this = this;
|
|
7206
|
+
var match;
|
|
7207
|
+
var value;
|
|
7208
|
+
var replaces;
|
|
7209
|
+
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || ({});
|
|
7210
|
+
function regexSafe(val) {
|
|
7211
|
+
return val.replace(/\$/g, '$$$$');
|
|
7212
|
+
}
|
|
7213
|
+
var handleFormat = function handleFormat(key) {
|
|
7214
|
+
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
7215
|
+
var path = deepFindWithDefaults(data, defaultData, key, _this.options.keySeparator, _this.options.ignoreJSONStructure);
|
|
7216
|
+
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
7217
|
+
interpolationkey: key
|
|
7218
|
+
})) : path;
|
|
7219
|
+
}
|
|
7220
|
+
var p = key.split(_this.formatSeparator);
|
|
7221
|
+
var k = p.shift().trim();
|
|
7222
|
+
var f = p.join(_this.formatSeparator).trim();
|
|
7223
|
+
return _this.format(deepFindWithDefaults(data, defaultData, k, _this.options.keySeparator, _this.options.ignoreJSONStructure), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
7224
|
+
interpolationkey: k
|
|
7225
|
+
}));
|
|
7226
|
+
};
|
|
7227
|
+
this.resetRegExp();
|
|
7228
|
+
var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
7229
|
+
var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
7230
|
+
var todos = [{
|
|
7231
|
+
regex: this.regexpUnescape,
|
|
7232
|
+
safeValue: function safeValue(val) {
|
|
7233
|
+
return regexSafe(val);
|
|
7234
|
+
}
|
|
7235
|
+
}, {
|
|
7236
|
+
regex: this.regexp,
|
|
7237
|
+
safeValue: function safeValue(val) {
|
|
7238
|
+
return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
|
|
7239
|
+
}
|
|
7240
|
+
}];
|
|
7241
|
+
todos.forEach(function (todo) {
|
|
7242
|
+
replaces = 0;
|
|
7243
|
+
while (match = todo.regex.exec(str)) {
|
|
7244
|
+
var matchedVar = match[1].trim();
|
|
7245
|
+
value = handleFormat(matchedVar);
|
|
7246
|
+
if (value === undefined) {
|
|
7247
|
+
if (typeof missingInterpolationHandler === 'function') {
|
|
7248
|
+
var temp = missingInterpolationHandler(str, match, options);
|
|
7249
|
+
value = typeof temp === 'string' ? temp : '';
|
|
7250
|
+
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
7251
|
+
value = '';
|
|
7252
|
+
} else if (skipOnVariables) {
|
|
7253
|
+
value = match[0];
|
|
7254
|
+
continue;
|
|
7255
|
+
} else {
|
|
7256
|
+
_this.logger.warn(("missed to pass in variable ").concat(matchedVar, " for interpolating ").concat(str));
|
|
7257
|
+
value = '';
|
|
7258
|
+
}
|
|
7259
|
+
} else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
|
|
7260
|
+
value = makeString(value);
|
|
7261
|
+
}
|
|
7262
|
+
var safeValue = todo.safeValue(value);
|
|
7263
|
+
str = str.replace(match[0], safeValue);
|
|
7264
|
+
if (skipOnVariables) {
|
|
7265
|
+
todo.regex.lastIndex += value.length;
|
|
7266
|
+
todo.regex.lastIndex -= match[0].length;
|
|
7267
|
+
} else {
|
|
7268
|
+
todo.regex.lastIndex = 0;
|
|
7269
|
+
}
|
|
7270
|
+
replaces++;
|
|
7271
|
+
if (replaces >= _this.maxReplaces) {
|
|
7272
|
+
break;
|
|
7273
|
+
}
|
|
7274
|
+
}
|
|
7275
|
+
});
|
|
7276
|
+
return str;
|
|
7277
|
+
}
|
|
7278
|
+
}, {
|
|
7279
|
+
key: "nest",
|
|
7280
|
+
value: function nest(str, fc) {
|
|
7281
|
+
var _this2 = this;
|
|
7282
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7283
|
+
var match;
|
|
7284
|
+
var value;
|
|
7285
|
+
var clonedOptions;
|
|
7286
|
+
function handleHasOptions(key, inheritedOptions) {
|
|
7287
|
+
var sep = this.nestingOptionsSeparator;
|
|
7288
|
+
if (key.indexOf(sep) < 0) return key;
|
|
7289
|
+
var c = key.split(new RegExp(("").concat(sep, "[ ]*{")));
|
|
7290
|
+
var optionsString = ("{").concat(c[1]);
|
|
7291
|
+
key = c[0];
|
|
7292
|
+
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
7293
|
+
var matchedSingleQuotes = optionsString.match(/'/g);
|
|
7294
|
+
var matchedDoubleQuotes = optionsString.match(/"/g);
|
|
7295
|
+
if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
|
|
7296
|
+
optionsString = optionsString.replace(/'/g, '"');
|
|
7297
|
+
}
|
|
7298
|
+
try {
|
|
7299
|
+
clonedOptions = JSON.parse(optionsString);
|
|
7300
|
+
if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
|
|
7301
|
+
} catch (e) {
|
|
7302
|
+
this.logger.warn(("failed parsing options string in nesting for key ").concat(key), e);
|
|
7303
|
+
return ("").concat(key).concat(sep).concat(optionsString);
|
|
7304
|
+
}
|
|
7305
|
+
delete clonedOptions.defaultValue;
|
|
7306
|
+
return key;
|
|
7307
|
+
}
|
|
7308
|
+
while (match = this.nestingRegexp.exec(str)) {
|
|
7309
|
+
var formatters = [];
|
|
7310
|
+
clonedOptions = _objectSpread$3({}, options);
|
|
7311
|
+
clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
|
|
7312
|
+
clonedOptions.applyPostProcessor = false;
|
|
7313
|
+
delete clonedOptions.defaultValue;
|
|
7314
|
+
var doReduce = false;
|
|
7315
|
+
if (match[0].indexOf(this.formatSeparator) !== -1 && !(/{.*}/).test(match[1])) {
|
|
7316
|
+
var r = match[1].split(this.formatSeparator).map(function (elem) {
|
|
7317
|
+
return elem.trim();
|
|
7318
|
+
});
|
|
7319
|
+
match[1] = r.shift();
|
|
7320
|
+
formatters = r;
|
|
7321
|
+
doReduce = true;
|
|
7322
|
+
}
|
|
7323
|
+
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
7324
|
+
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
7325
|
+
if (typeof value !== 'string') value = makeString(value);
|
|
7326
|
+
if (!value) {
|
|
7327
|
+
this.logger.warn(("missed to resolve ").concat(match[1], " for nesting ").concat(str));
|
|
7328
|
+
value = '';
|
|
7329
|
+
}
|
|
7330
|
+
if (doReduce) {
|
|
7331
|
+
value = formatters.reduce(function (v, f) {
|
|
7332
|
+
return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
7333
|
+
interpolationkey: match[1].trim()
|
|
7334
|
+
}));
|
|
7335
|
+
}, value.trim());
|
|
7336
|
+
}
|
|
7337
|
+
str = str.replace(match[0], value);
|
|
7338
|
+
this.regexp.lastIndex = 0;
|
|
7339
|
+
}
|
|
7340
|
+
return str;
|
|
7341
|
+
}
|
|
7342
|
+
}]);
|
|
7343
|
+
return Interpolator;
|
|
7344
|
+
})();
|
|
7345
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
7346
|
+
var keys = Object.keys(object);
|
|
7347
|
+
if (Object.getOwnPropertySymbols) {
|
|
7348
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7349
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7350
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7351
|
+
})), keys.push.apply(keys, symbols));
|
|
7352
|
+
}
|
|
7353
|
+
return keys;
|
|
7354
|
+
}
|
|
7355
|
+
function _objectSpread$2(target) {
|
|
7356
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7357
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7358
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
7359
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7360
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
7361
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7362
|
+
});
|
|
7363
|
+
}
|
|
7364
|
+
return target;
|
|
7365
|
+
}
|
|
7366
|
+
function parseFormatStr(formatStr) {
|
|
7367
|
+
var formatName = formatStr.toLowerCase().trim();
|
|
7368
|
+
var formatOptions = {};
|
|
7369
|
+
if (formatStr.indexOf('(') > -1) {
|
|
7370
|
+
var p = formatStr.split('(');
|
|
7371
|
+
formatName = p[0].toLowerCase().trim();
|
|
7372
|
+
var optStr = p[1].substring(0, p[1].length - 1);
|
|
7373
|
+
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
7374
|
+
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
7375
|
+
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
7376
|
+
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
7377
|
+
} else {
|
|
7378
|
+
var opts = optStr.split(';');
|
|
7379
|
+
opts.forEach(function (opt) {
|
|
7380
|
+
if (!opt) return;
|
|
7381
|
+
var _opt$split = opt.split(':'), _opt$split2 = _toArray__default["default"](_opt$split), key = _opt$split2[0], rest = _opt$split2.slice(1);
|
|
7382
|
+
var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
7383
|
+
if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
|
|
7384
|
+
if (val === 'false') formatOptions[key.trim()] = false;
|
|
7385
|
+
if (val === 'true') formatOptions[key.trim()] = true;
|
|
7386
|
+
if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
|
|
7387
|
+
});
|
|
7388
|
+
}
|
|
7389
|
+
}
|
|
7390
|
+
return {
|
|
7391
|
+
formatName: formatName,
|
|
7392
|
+
formatOptions: formatOptions
|
|
7393
|
+
};
|
|
7394
|
+
}
|
|
7395
|
+
function createCachedFormatter(fn) {
|
|
7396
|
+
var cache = {};
|
|
7397
|
+
return function invokeFormatter(val, lng, options) {
|
|
7398
|
+
var key = lng + JSON.stringify(options);
|
|
7399
|
+
var formatter = cache[key];
|
|
7400
|
+
if (!formatter) {
|
|
7401
|
+
formatter = fn(lng, options);
|
|
7402
|
+
cache[key] = formatter;
|
|
7403
|
+
}
|
|
7404
|
+
return formatter(val);
|
|
7405
|
+
};
|
|
7406
|
+
}
|
|
7407
|
+
var Formatter = (function () {
|
|
7408
|
+
function Formatter() {
|
|
7409
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7410
|
+
_classCallCheck__default["default"](this, Formatter);
|
|
7411
|
+
this.logger = baseLogger.create('formatter');
|
|
7412
|
+
this.options = options;
|
|
7413
|
+
this.formats = {
|
|
7414
|
+
number: createCachedFormatter(function (lng, opt) {
|
|
7415
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
|
|
7416
|
+
return function (val) {
|
|
7417
|
+
return formatter.format(val);
|
|
7418
|
+
};
|
|
7419
|
+
}),
|
|
7420
|
+
currency: createCachedFormatter(function (lng, opt) {
|
|
7421
|
+
var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
|
|
7422
|
+
style: 'currency'
|
|
7423
|
+
}));
|
|
7424
|
+
return function (val) {
|
|
7425
|
+
return formatter.format(val);
|
|
7426
|
+
};
|
|
7427
|
+
}),
|
|
7428
|
+
datetime: createCachedFormatter(function (lng, opt) {
|
|
7429
|
+
var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
|
|
7430
|
+
return function (val) {
|
|
7431
|
+
return formatter.format(val);
|
|
7432
|
+
};
|
|
7433
|
+
}),
|
|
7434
|
+
relativetime: createCachedFormatter(function (lng, opt) {
|
|
7435
|
+
var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
|
|
7436
|
+
return function (val) {
|
|
7437
|
+
return formatter.format(val, opt.range || 'day');
|
|
7438
|
+
};
|
|
7439
|
+
}),
|
|
7440
|
+
list: createCachedFormatter(function (lng, opt) {
|
|
7441
|
+
var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
|
|
7442
|
+
return function (val) {
|
|
7443
|
+
return formatter.format(val);
|
|
7444
|
+
};
|
|
7445
|
+
})
|
|
7446
|
+
};
|
|
7447
|
+
this.init(options);
|
|
7448
|
+
}
|
|
7449
|
+
_createClass__default["default"](Formatter, [{
|
|
7450
|
+
key: "init",
|
|
7451
|
+
value: function init(services) {
|
|
7452
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
7453
|
+
interpolation: {}
|
|
7454
|
+
};
|
|
7455
|
+
var iOpts = options.interpolation;
|
|
7456
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
7457
|
+
}
|
|
7458
|
+
}, {
|
|
7459
|
+
key: "add",
|
|
7460
|
+
value: function add(name, fc) {
|
|
7461
|
+
this.formats[name.toLowerCase().trim()] = fc;
|
|
7462
|
+
}
|
|
7463
|
+
}, {
|
|
7464
|
+
key: "addCached",
|
|
7465
|
+
value: function addCached(name, fc) {
|
|
7466
|
+
this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
|
|
7467
|
+
}
|
|
7468
|
+
}, {
|
|
7469
|
+
key: "format",
|
|
7470
|
+
value: function format(value, _format, lng) {
|
|
7471
|
+
var _this = this;
|
|
7472
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
7473
|
+
var formats = _format.split(this.formatSeparator);
|
|
7474
|
+
var result = formats.reduce(function (mem, f) {
|
|
7475
|
+
var _parseFormatStr = parseFormatStr(f), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions;
|
|
7476
|
+
if (_this.formats[formatName]) {
|
|
7477
|
+
var formatted = mem;
|
|
7478
|
+
try {
|
|
7479
|
+
var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || ({});
|
|
7480
|
+
var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
7481
|
+
formatted = _this.formats[formatName](mem, l, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions));
|
|
7482
|
+
} catch (error) {
|
|
7483
|
+
_this.logger.warn(error);
|
|
7484
|
+
}
|
|
7485
|
+
return formatted;
|
|
7486
|
+
} else {
|
|
7487
|
+
_this.logger.warn(("there was no format function for ").concat(formatName));
|
|
7488
|
+
}
|
|
7489
|
+
return mem;
|
|
7490
|
+
}, value);
|
|
7491
|
+
return result;
|
|
7492
|
+
}
|
|
7493
|
+
}]);
|
|
7494
|
+
return Formatter;
|
|
7495
|
+
})();
|
|
7496
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
7497
|
+
var keys = Object.keys(object);
|
|
7498
|
+
if (Object.getOwnPropertySymbols) {
|
|
7499
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7500
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7501
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7502
|
+
})), keys.push.apply(keys, symbols));
|
|
7503
|
+
}
|
|
7504
|
+
return keys;
|
|
7505
|
+
}
|
|
7506
|
+
function _objectSpread$1(target) {
|
|
7507
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7508
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7509
|
+
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
|
7510
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7511
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
|
7512
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7513
|
+
});
|
|
7514
|
+
}
|
|
7515
|
+
return target;
|
|
7516
|
+
}
|
|
7517
|
+
function _createSuper$1(Derived) {
|
|
7518
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
|
|
7519
|
+
return function _createSuperInternal() {
|
|
7520
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
7521
|
+
if (hasNativeReflectConstruct) {
|
|
7522
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
7523
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
7524
|
+
} else {
|
|
7525
|
+
result = Super.apply(this, arguments);
|
|
7526
|
+
}
|
|
7527
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
7528
|
+
};
|
|
7529
|
+
}
|
|
7530
|
+
function _isNativeReflectConstruct$1() {
|
|
7531
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
7532
|
+
if (Reflect.construct.sham) return false;
|
|
7533
|
+
if (typeof Proxy === "function") return true;
|
|
7534
|
+
try {
|
|
7535
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7536
|
+
return true;
|
|
7537
|
+
} catch (e) {
|
|
7538
|
+
return false;
|
|
7539
|
+
}
|
|
7540
|
+
}
|
|
7541
|
+
function removePending(q, name) {
|
|
7542
|
+
if (q.pending[name] !== undefined) {
|
|
7543
|
+
delete q.pending[name];
|
|
7544
|
+
q.pendingCount--;
|
|
7545
|
+
}
|
|
7546
|
+
}
|
|
7547
|
+
var Connector = (function (_EventEmitter) {
|
|
7548
|
+
_inherits__default["default"](Connector, _EventEmitter);
|
|
7549
|
+
var _super = _createSuper$1(Connector);
|
|
7550
|
+
function Connector(backend, store, services) {
|
|
7551
|
+
var _this;
|
|
7552
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
7553
|
+
_classCallCheck__default["default"](this, Connector);
|
|
7554
|
+
_this = _super.call(this);
|
|
7555
|
+
if (isIE10) {
|
|
7556
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
7557
|
+
}
|
|
7558
|
+
_this.backend = backend;
|
|
7559
|
+
_this.store = store;
|
|
7560
|
+
_this.services = services;
|
|
7561
|
+
_this.languageUtils = services.languageUtils;
|
|
7562
|
+
_this.options = options;
|
|
7563
|
+
_this.logger = baseLogger.create('backendConnector');
|
|
7564
|
+
_this.waitingReads = [];
|
|
7565
|
+
_this.maxParallelReads = options.maxParallelReads || 10;
|
|
7566
|
+
_this.readingCalls = 0;
|
|
7567
|
+
_this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
7568
|
+
_this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
7569
|
+
_this.state = {};
|
|
7570
|
+
_this.queue = [];
|
|
7571
|
+
if (_this.backend && _this.backend.init) {
|
|
7572
|
+
_this.backend.init(services, options.backend, options);
|
|
7573
|
+
}
|
|
7574
|
+
return _this;
|
|
7575
|
+
}
|
|
7576
|
+
_createClass__default["default"](Connector, [{
|
|
7577
|
+
key: "queueLoad",
|
|
7578
|
+
value: function queueLoad(languages, namespaces, options, callback) {
|
|
7579
|
+
var _this2 = this;
|
|
7580
|
+
var toLoad = {};
|
|
7581
|
+
var pending = {};
|
|
7582
|
+
var toLoadLanguages = {};
|
|
7583
|
+
var toLoadNamespaces = {};
|
|
7584
|
+
languages.forEach(function (lng) {
|
|
7585
|
+
var hasAllNamespaces = true;
|
|
7586
|
+
namespaces.forEach(function (ns) {
|
|
7587
|
+
var name = ("").concat(lng, "|").concat(ns);
|
|
7588
|
+
if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
|
|
7589
|
+
_this2.state[name] = 2;
|
|
7590
|
+
} else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
|
|
7591
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
7592
|
+
} else {
|
|
7593
|
+
_this2.state[name] = 1;
|
|
7594
|
+
hasAllNamespaces = false;
|
|
7595
|
+
if (pending[name] === undefined) pending[name] = true;
|
|
7596
|
+
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
7597
|
+
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
7598
|
+
}
|
|
7599
|
+
});
|
|
7600
|
+
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
7601
|
+
});
|
|
7602
|
+
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
7603
|
+
this.queue.push({
|
|
7604
|
+
pending: pending,
|
|
7605
|
+
pendingCount: Object.keys(pending).length,
|
|
7606
|
+
loaded: {},
|
|
7607
|
+
errors: [],
|
|
7608
|
+
callback: callback
|
|
7609
|
+
});
|
|
7610
|
+
}
|
|
7611
|
+
return {
|
|
7612
|
+
toLoad: Object.keys(toLoad),
|
|
7613
|
+
pending: Object.keys(pending),
|
|
7614
|
+
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
7615
|
+
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
7616
|
+
};
|
|
7617
|
+
}
|
|
7618
|
+
}, {
|
|
7619
|
+
key: "loaded",
|
|
7620
|
+
value: function loaded(name, err, data) {
|
|
7621
|
+
var s = name.split('|');
|
|
7622
|
+
var lng = s[0];
|
|
7623
|
+
var ns = s[1];
|
|
7624
|
+
if (err) this.emit('failedLoading', lng, ns, err);
|
|
7625
|
+
if (data) {
|
|
7626
|
+
this.store.addResourceBundle(lng, ns, data);
|
|
7627
|
+
}
|
|
7628
|
+
this.state[name] = err ? -1 : 2;
|
|
7629
|
+
var loaded = {};
|
|
7630
|
+
this.queue.forEach(function (q) {
|
|
7631
|
+
pushPath(q.loaded, [lng], ns);
|
|
7632
|
+
removePending(q, name);
|
|
7633
|
+
if (err) q.errors.push(err);
|
|
7634
|
+
if (q.pendingCount === 0 && !q.done) {
|
|
7635
|
+
Object.keys(q.loaded).forEach(function (l) {
|
|
7636
|
+
if (!loaded[l]) loaded[l] = {};
|
|
7637
|
+
var loadedKeys = q.loaded[l];
|
|
7638
|
+
if (loadedKeys.length) {
|
|
7639
|
+
loadedKeys.forEach(function (n) {
|
|
7640
|
+
if (loaded[l][n] === undefined) loaded[l][n] = true;
|
|
7641
|
+
});
|
|
7642
|
+
}
|
|
7643
|
+
});
|
|
7644
|
+
q.done = true;
|
|
7645
|
+
if (q.errors.length) {
|
|
7646
|
+
q.callback(q.errors);
|
|
7647
|
+
} else {
|
|
7648
|
+
q.callback();
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7651
|
+
});
|
|
7652
|
+
this.emit('loaded', loaded);
|
|
7653
|
+
this.queue = this.queue.filter(function (q) {
|
|
7654
|
+
return !q.done;
|
|
7655
|
+
});
|
|
7656
|
+
}
|
|
7657
|
+
}, {
|
|
7658
|
+
key: "read",
|
|
7659
|
+
value: function read(lng, ns, fcName) {
|
|
7660
|
+
var _this3 = this;
|
|
7661
|
+
var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
7662
|
+
var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
|
|
7663
|
+
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
7664
|
+
if (!lng.length) return callback(null, {});
|
|
7665
|
+
if (this.readingCalls >= this.maxParallelReads) {
|
|
7666
|
+
this.waitingReads.push({
|
|
7667
|
+
lng: lng,
|
|
7668
|
+
ns: ns,
|
|
7669
|
+
fcName: fcName,
|
|
7670
|
+
tried: tried,
|
|
7671
|
+
wait: wait,
|
|
7672
|
+
callback: callback
|
|
7673
|
+
});
|
|
7674
|
+
return;
|
|
7675
|
+
}
|
|
7676
|
+
this.readingCalls++;
|
|
7677
|
+
var resolver = function resolver(err, data) {
|
|
7678
|
+
_this3.readingCalls--;
|
|
7679
|
+
if (_this3.waitingReads.length > 0) {
|
|
7680
|
+
var next = _this3.waitingReads.shift();
|
|
7681
|
+
_this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
7682
|
+
}
|
|
7683
|
+
if (err && data && tried < _this3.maxRetries) {
|
|
7684
|
+
setTimeout(function () {
|
|
7685
|
+
_this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
7686
|
+
}, wait);
|
|
7687
|
+
return;
|
|
7688
|
+
}
|
|
7689
|
+
callback(err, data);
|
|
7690
|
+
};
|
|
7691
|
+
var fc = this.backend[fcName].bind(this.backend);
|
|
7692
|
+
if (fc.length === 2) {
|
|
7693
|
+
try {
|
|
7694
|
+
var r = fc(lng, ns);
|
|
7695
|
+
if (r && typeof r.then === 'function') {
|
|
7696
|
+
r.then(function (data) {
|
|
7697
|
+
return resolver(null, data);
|
|
7698
|
+
})["catch"](resolver);
|
|
7699
|
+
} else {
|
|
7700
|
+
resolver(null, r);
|
|
7701
|
+
}
|
|
7702
|
+
} catch (err) {
|
|
7703
|
+
resolver(err);
|
|
7704
|
+
}
|
|
7705
|
+
return;
|
|
7706
|
+
}
|
|
7707
|
+
return fc(lng, ns, resolver);
|
|
7708
|
+
}
|
|
7709
|
+
}, {
|
|
7710
|
+
key: "prepareLoading",
|
|
7711
|
+
value: function prepareLoading(languages, namespaces) {
|
|
7712
|
+
var _this4 = this;
|
|
7713
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
7714
|
+
var callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
7715
|
+
if (!this.backend) {
|
|
7716
|
+
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
7717
|
+
return callback && callback();
|
|
7718
|
+
}
|
|
7719
|
+
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
7720
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
7721
|
+
var toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
7722
|
+
if (!toLoad.toLoad.length) {
|
|
7723
|
+
if (!toLoad.pending.length) callback();
|
|
7724
|
+
return null;
|
|
7725
|
+
}
|
|
7726
|
+
toLoad.toLoad.forEach(function (name) {
|
|
7727
|
+
_this4.loadOne(name);
|
|
7728
|
+
});
|
|
7729
|
+
}
|
|
7730
|
+
}, {
|
|
7731
|
+
key: "load",
|
|
7732
|
+
value: function load(languages, namespaces, callback) {
|
|
7733
|
+
this.prepareLoading(languages, namespaces, {}, callback);
|
|
7734
|
+
}
|
|
7735
|
+
}, {
|
|
7736
|
+
key: "reload",
|
|
7737
|
+
value: function reload(languages, namespaces, callback) {
|
|
7738
|
+
this.prepareLoading(languages, namespaces, {
|
|
7739
|
+
reload: true
|
|
7740
|
+
}, callback);
|
|
7741
|
+
}
|
|
7742
|
+
}, {
|
|
7743
|
+
key: "loadOne",
|
|
7744
|
+
value: function loadOne(name) {
|
|
7745
|
+
var _this5 = this;
|
|
7746
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
7747
|
+
var s = name.split('|');
|
|
7748
|
+
var lng = s[0];
|
|
7749
|
+
var ns = s[1];
|
|
7750
|
+
this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
|
|
7751
|
+
if (err) _this5.logger.warn(("").concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
|
|
7752
|
+
if (!err && data) _this5.logger.log(("").concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
|
|
7753
|
+
_this5.loaded(name, err, data);
|
|
7754
|
+
});
|
|
7755
|
+
}
|
|
7756
|
+
}, {
|
|
7757
|
+
key: "saveMissing",
|
|
7758
|
+
value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
7759
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
7760
|
+
var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
|
|
7761
|
+
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
7762
|
+
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!!!');
|
|
7763
|
+
return;
|
|
7764
|
+
}
|
|
7765
|
+
if (key === undefined || key === null || key === '') return;
|
|
7766
|
+
if (this.backend && this.backend.create) {
|
|
7767
|
+
var opts = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
7768
|
+
isUpdate: isUpdate
|
|
7769
|
+
});
|
|
7770
|
+
var fc = this.backend.create.bind(this.backend);
|
|
7771
|
+
if (fc.length < 6) {
|
|
7772
|
+
try {
|
|
7773
|
+
var r;
|
|
7774
|
+
if (fc.length === 5) {
|
|
7775
|
+
r = fc(languages, namespace, key, fallbackValue, opts);
|
|
7776
|
+
} else {
|
|
7777
|
+
r = fc(languages, namespace, key, fallbackValue);
|
|
7778
|
+
}
|
|
7779
|
+
if (r && typeof r.then === 'function') {
|
|
7780
|
+
r.then(function (data) {
|
|
7781
|
+
return clb(null, data);
|
|
7782
|
+
})["catch"](clb);
|
|
7783
|
+
} else {
|
|
7784
|
+
clb(null, r);
|
|
7785
|
+
}
|
|
7786
|
+
} catch (err) {
|
|
7787
|
+
clb(err);
|
|
7788
|
+
}
|
|
7789
|
+
} else {
|
|
7790
|
+
fc(languages, namespace, key, fallbackValue, clb, opts);
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7793
|
+
if (!languages || !languages[0]) return;
|
|
7794
|
+
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
7795
|
+
}
|
|
7796
|
+
}]);
|
|
7797
|
+
return Connector;
|
|
7798
|
+
})(EventEmitter);
|
|
7799
|
+
function get$1() {
|
|
7800
|
+
return {
|
|
7801
|
+
debug: false,
|
|
7802
|
+
initImmediate: true,
|
|
7803
|
+
ns: ['translation'],
|
|
7804
|
+
defaultNS: ['translation'],
|
|
7805
|
+
fallbackLng: ['dev'],
|
|
7806
|
+
fallbackNS: false,
|
|
7807
|
+
supportedLngs: false,
|
|
7808
|
+
nonExplicitSupportedLngs: false,
|
|
7809
|
+
load: 'all',
|
|
7810
|
+
preload: false,
|
|
7811
|
+
simplifyPluralSuffix: true,
|
|
7812
|
+
keySeparator: '.',
|
|
7813
|
+
nsSeparator: ':',
|
|
7814
|
+
pluralSeparator: '_',
|
|
7815
|
+
contextSeparator: '_',
|
|
7816
|
+
partialBundledLanguages: false,
|
|
7817
|
+
saveMissing: false,
|
|
7818
|
+
updateMissing: false,
|
|
7819
|
+
saveMissingTo: 'fallback',
|
|
7820
|
+
saveMissingPlurals: true,
|
|
7821
|
+
missingKeyHandler: false,
|
|
7822
|
+
missingInterpolationHandler: false,
|
|
7823
|
+
postProcess: false,
|
|
7824
|
+
postProcessPassResolved: false,
|
|
7825
|
+
returnNull: true,
|
|
7826
|
+
returnEmptyString: true,
|
|
7827
|
+
returnObjects: false,
|
|
7828
|
+
joinArrays: false,
|
|
7829
|
+
returnedObjectHandler: false,
|
|
7830
|
+
parseMissingKeyHandler: false,
|
|
7831
|
+
appendNamespaceToMissingKey: false,
|
|
7832
|
+
appendNamespaceToCIMode: false,
|
|
7833
|
+
overloadTranslationOptionHandler: function handle(args) {
|
|
7834
|
+
var ret = {};
|
|
7835
|
+
if (_typeof__default["default"](args[1]) === 'object') ret = args[1];
|
|
7836
|
+
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
7837
|
+
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
7838
|
+
if (_typeof__default["default"](args[2]) === 'object' || _typeof__default["default"](args[3]) === 'object') {
|
|
7839
|
+
var options = args[3] || args[2];
|
|
7840
|
+
Object.keys(options).forEach(function (key) {
|
|
7841
|
+
ret[key] = options[key];
|
|
7842
|
+
});
|
|
7843
|
+
}
|
|
7844
|
+
return ret;
|
|
7845
|
+
},
|
|
7846
|
+
interpolation: {
|
|
7847
|
+
escapeValue: true,
|
|
7848
|
+
format: function format(value, _format, lng, options) {
|
|
7849
|
+
return value;
|
|
7850
|
+
},
|
|
7851
|
+
prefix: '{{',
|
|
7852
|
+
suffix: '}}',
|
|
7853
|
+
formatSeparator: ',',
|
|
7854
|
+
unescapePrefix: '-',
|
|
7855
|
+
nestingPrefix: '$t(',
|
|
7856
|
+
nestingSuffix: ')',
|
|
7857
|
+
nestingOptionsSeparator: ',',
|
|
7858
|
+
maxReplaces: 1000,
|
|
7859
|
+
skipOnVariables: true
|
|
7860
|
+
}
|
|
7861
|
+
};
|
|
7862
|
+
}
|
|
7863
|
+
function transformOptions(options) {
|
|
7864
|
+
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
7865
|
+
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
7866
|
+
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
7867
|
+
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
7868
|
+
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
7869
|
+
}
|
|
7870
|
+
return options;
|
|
7871
|
+
}
|
|
7872
|
+
function ownKeys(object, enumerableOnly) {
|
|
7873
|
+
var keys = Object.keys(object);
|
|
7874
|
+
if (Object.getOwnPropertySymbols) {
|
|
7875
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7876
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7877
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7878
|
+
})), keys.push.apply(keys, symbols));
|
|
7879
|
+
}
|
|
7880
|
+
return keys;
|
|
7881
|
+
}
|
|
7882
|
+
function _objectSpread(target) {
|
|
7883
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7884
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
7885
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
7886
|
+
_defineProperty__default["default"](target, key, source[key]);
|
|
7887
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
7888
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7889
|
+
});
|
|
7890
|
+
}
|
|
7891
|
+
return target;
|
|
7892
|
+
}
|
|
7893
|
+
function _createSuper(Derived) {
|
|
7894
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
7895
|
+
return function _createSuperInternal() {
|
|
7896
|
+
var Super = _getPrototypeOf__default["default"](Derived), result;
|
|
7897
|
+
if (hasNativeReflectConstruct) {
|
|
7898
|
+
var NewTarget = _getPrototypeOf__default["default"](this).constructor;
|
|
7899
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
7900
|
+
} else {
|
|
7901
|
+
result = Super.apply(this, arguments);
|
|
7902
|
+
}
|
|
7903
|
+
return _possibleConstructorReturn__default["default"](this, result);
|
|
7904
|
+
};
|
|
7905
|
+
}
|
|
7906
|
+
function _isNativeReflectConstruct() {
|
|
7907
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
7908
|
+
if (Reflect.construct.sham) return false;
|
|
7909
|
+
if (typeof Proxy === "function") return true;
|
|
7910
|
+
try {
|
|
7911
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7912
|
+
return true;
|
|
7913
|
+
} catch (e) {
|
|
7914
|
+
return false;
|
|
7915
|
+
}
|
|
7916
|
+
}
|
|
7917
|
+
function noop$1() {}
|
|
7918
|
+
function bindMemberFunctions(inst) {
|
|
7919
|
+
var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
7920
|
+
mems.forEach(function (mem) {
|
|
7921
|
+
if (typeof inst[mem] === 'function') {
|
|
7922
|
+
inst[mem] = inst[mem].bind(inst);
|
|
7923
|
+
}
|
|
7924
|
+
});
|
|
7925
|
+
}
|
|
7926
|
+
var I18n = (function (_EventEmitter) {
|
|
7927
|
+
_inherits__default["default"](I18n, _EventEmitter);
|
|
7928
|
+
var _super = _createSuper(I18n);
|
|
7929
|
+
function I18n() {
|
|
7930
|
+
var _this;
|
|
7931
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7932
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
7933
|
+
_classCallCheck__default["default"](this, I18n);
|
|
7934
|
+
_this = _super.call(this);
|
|
7935
|
+
if (isIE10) {
|
|
7936
|
+
EventEmitter.call(_assertThisInitialized__default["default"](_this));
|
|
7937
|
+
}
|
|
7938
|
+
_this.options = transformOptions(options);
|
|
7939
|
+
_this.services = {};
|
|
7940
|
+
_this.logger = baseLogger;
|
|
7941
|
+
_this.modules = {
|
|
7942
|
+
external: []
|
|
7943
|
+
};
|
|
7944
|
+
bindMemberFunctions(_assertThisInitialized__default["default"](_this));
|
|
7945
|
+
if (callback && !_this.isInitialized && !options.isClone) {
|
|
7946
|
+
if (!_this.options.initImmediate) {
|
|
7947
|
+
_this.init(options, callback);
|
|
7948
|
+
return _possibleConstructorReturn__default["default"](_this, _assertThisInitialized__default["default"](_this));
|
|
7949
|
+
}
|
|
7950
|
+
setTimeout(function () {
|
|
7951
|
+
_this.init(options, callback);
|
|
7952
|
+
}, 0);
|
|
7953
|
+
}
|
|
7954
|
+
return _this;
|
|
7955
|
+
}
|
|
7956
|
+
_createClass__default["default"](I18n, [{
|
|
7957
|
+
key: "init",
|
|
7958
|
+
value: function init() {
|
|
7959
|
+
var _this2 = this;
|
|
7960
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7961
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
7962
|
+
if (typeof options === 'function') {
|
|
7963
|
+
callback = options;
|
|
7964
|
+
options = {};
|
|
7965
|
+
}
|
|
7966
|
+
if (!options.defaultNS && options.defaultNS !== false && options.ns) {
|
|
7967
|
+
if (typeof options.ns === 'string') {
|
|
7968
|
+
options.defaultNS = options.ns;
|
|
7969
|
+
} else if (options.ns.indexOf('translation') < 0) {
|
|
7970
|
+
options.defaultNS = options.ns[0];
|
|
7971
|
+
}
|
|
7972
|
+
}
|
|
7973
|
+
var defOpts = get$1();
|
|
7974
|
+
this.options = _objectSpread(_objectSpread(_objectSpread({}, defOpts), this.options), transformOptions(options));
|
|
7975
|
+
if (this.options.compatibilityAPI !== 'v1') {
|
|
7976
|
+
this.options.interpolation = _objectSpread(_objectSpread({}, defOpts.interpolation), this.options.interpolation);
|
|
7977
|
+
}
|
|
7978
|
+
if (options.keySeparator !== undefined) {
|
|
7979
|
+
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
7980
|
+
}
|
|
7981
|
+
if (options.nsSeparator !== undefined) {
|
|
7982
|
+
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
7983
|
+
}
|
|
7984
|
+
function createClassOnDemand(ClassOrObject) {
|
|
7985
|
+
if (!ClassOrObject) return null;
|
|
7986
|
+
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
7987
|
+
return ClassOrObject;
|
|
7988
|
+
}
|
|
7989
|
+
if (!this.options.isClone) {
|
|
7990
|
+
if (this.modules.logger) {
|
|
7991
|
+
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
7992
|
+
} else {
|
|
7993
|
+
baseLogger.init(null, this.options);
|
|
7994
|
+
}
|
|
7995
|
+
var formatter;
|
|
7996
|
+
if (this.modules.formatter) {
|
|
7997
|
+
formatter = this.modules.formatter;
|
|
7998
|
+
} else if (typeof Intl !== 'undefined') {
|
|
7999
|
+
formatter = Formatter;
|
|
8000
|
+
}
|
|
8001
|
+
var lu = new LanguageUtil(this.options);
|
|
8002
|
+
this.store = new ResourceStore(this.options.resources, this.options);
|
|
8003
|
+
var s = this.services;
|
|
8004
|
+
s.logger = baseLogger;
|
|
8005
|
+
s.resourceStore = this.store;
|
|
8006
|
+
s.languageUtils = lu;
|
|
8007
|
+
s.pluralResolver = new PluralResolver(lu, {
|
|
8008
|
+
prepend: this.options.pluralSeparator,
|
|
8009
|
+
compatibilityJSON: this.options.compatibilityJSON,
|
|
8010
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
8011
|
+
});
|
|
8012
|
+
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
8013
|
+
s.formatter = createClassOnDemand(formatter);
|
|
8014
|
+
s.formatter.init(s, this.options);
|
|
8015
|
+
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
8016
|
+
}
|
|
8017
|
+
s.interpolator = new Interpolator(this.options);
|
|
8018
|
+
s.utils = {
|
|
8019
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
8020
|
+
};
|
|
8021
|
+
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
8022
|
+
s.backendConnector.on('*', function (event) {
|
|
8023
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8024
|
+
args[_key - 1] = arguments[_key];
|
|
8025
|
+
}
|
|
8026
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
8027
|
+
});
|
|
8028
|
+
if (this.modules.languageDetector) {
|
|
8029
|
+
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
8030
|
+
if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
|
|
8031
|
+
}
|
|
8032
|
+
if (this.modules.i18nFormat) {
|
|
8033
|
+
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
8034
|
+
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
8035
|
+
}
|
|
8036
|
+
this.translator = new Translator$1(this.services, this.options);
|
|
8037
|
+
this.translator.on('*', function (event) {
|
|
8038
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
8039
|
+
args[_key2 - 1] = arguments[_key2];
|
|
8040
|
+
}
|
|
8041
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
8042
|
+
});
|
|
8043
|
+
this.modules.external.forEach(function (m) {
|
|
8044
|
+
if (m.init) m.init(_this2);
|
|
8045
|
+
});
|
|
8046
|
+
}
|
|
8047
|
+
this.format = this.options.interpolation.format;
|
|
8048
|
+
if (!callback) callback = noop$1;
|
|
8049
|
+
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
8050
|
+
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8051
|
+
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
8052
|
+
}
|
|
8053
|
+
if (!this.services.languageDetector && !this.options.lng) {
|
|
8054
|
+
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
8055
|
+
}
|
|
8056
|
+
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
8057
|
+
storeApi.forEach(function (fcName) {
|
|
8058
|
+
_this2[fcName] = function () {
|
|
8059
|
+
var _this2$store;
|
|
8060
|
+
return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
|
|
8061
|
+
};
|
|
8062
|
+
});
|
|
8063
|
+
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
8064
|
+
storeApiChained.forEach(function (fcName) {
|
|
8065
|
+
_this2[fcName] = function () {
|
|
8066
|
+
var _this2$store2;
|
|
8067
|
+
(_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
|
|
8068
|
+
return _this2;
|
|
8069
|
+
};
|
|
8070
|
+
});
|
|
8071
|
+
var deferred = defer();
|
|
8072
|
+
var load = function load() {
|
|
8073
|
+
var finish = function finish(err, t) {
|
|
8074
|
+
if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
8075
|
+
_this2.isInitialized = true;
|
|
8076
|
+
if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
|
|
8077
|
+
_this2.emit('initialized', _this2.options);
|
|
8078
|
+
deferred.resolve(t);
|
|
8079
|
+
callback(err, t);
|
|
8080
|
+
};
|
|
8081
|
+
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
|
|
8082
|
+
_this2.changeLanguage(_this2.options.lng, finish);
|
|
8083
|
+
};
|
|
8084
|
+
if (this.options.resources || !this.options.initImmediate) {
|
|
8085
|
+
load();
|
|
8086
|
+
} else {
|
|
8087
|
+
setTimeout(load, 0);
|
|
8088
|
+
}
|
|
8089
|
+
return deferred;
|
|
8090
|
+
}
|
|
8091
|
+
}, {
|
|
8092
|
+
key: "loadResources",
|
|
8093
|
+
value: function loadResources(language) {
|
|
8094
|
+
var _this3 = this;
|
|
8095
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
8096
|
+
var usedCallback = callback;
|
|
8097
|
+
var usedLng = typeof language === 'string' ? language : this.language;
|
|
8098
|
+
if (typeof language === 'function') usedCallback = language;
|
|
8099
|
+
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
8100
|
+
if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
|
|
8101
|
+
var toLoad = [];
|
|
8102
|
+
var append = function append(lng) {
|
|
8103
|
+
if (!lng) return;
|
|
8104
|
+
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
8105
|
+
lngs.forEach(function (l) {
|
|
8106
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
8107
|
+
});
|
|
8108
|
+
};
|
|
8109
|
+
if (!usedLng) {
|
|
8110
|
+
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
8111
|
+
fallbacks.forEach(function (l) {
|
|
8112
|
+
return append(l);
|
|
8113
|
+
});
|
|
8114
|
+
} else {
|
|
8115
|
+
append(usedLng);
|
|
8116
|
+
}
|
|
8117
|
+
if (this.options.preload) {
|
|
8118
|
+
this.options.preload.forEach(function (l) {
|
|
8119
|
+
return append(l);
|
|
8120
|
+
});
|
|
8121
|
+
}
|
|
8122
|
+
this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
|
|
8123
|
+
if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
|
|
8124
|
+
usedCallback(e);
|
|
8125
|
+
});
|
|
8126
|
+
} else {
|
|
8127
|
+
usedCallback(null);
|
|
8128
|
+
}
|
|
8129
|
+
}
|
|
8130
|
+
}, {
|
|
8131
|
+
key: "reloadResources",
|
|
8132
|
+
value: function reloadResources(lngs, ns, callback) {
|
|
8133
|
+
var deferred = defer();
|
|
8134
|
+
if (!lngs) lngs = this.languages;
|
|
8135
|
+
if (!ns) ns = this.options.ns;
|
|
8136
|
+
if (!callback) callback = noop$1;
|
|
8137
|
+
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
8138
|
+
deferred.resolve();
|
|
8139
|
+
callback(err);
|
|
8140
|
+
});
|
|
8141
|
+
return deferred;
|
|
8142
|
+
}
|
|
8143
|
+
}, {
|
|
8144
|
+
key: "use",
|
|
8145
|
+
value: function use(module) {
|
|
8146
|
+
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
8147
|
+
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
8148
|
+
if (module.type === 'backend') {
|
|
8149
|
+
this.modules.backend = module;
|
|
8150
|
+
}
|
|
8151
|
+
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
8152
|
+
this.modules.logger = module;
|
|
8153
|
+
}
|
|
8154
|
+
if (module.type === 'languageDetector') {
|
|
8155
|
+
this.modules.languageDetector = module;
|
|
8156
|
+
}
|
|
8157
|
+
if (module.type === 'i18nFormat') {
|
|
8158
|
+
this.modules.i18nFormat = module;
|
|
8159
|
+
}
|
|
8160
|
+
if (module.type === 'postProcessor') {
|
|
8161
|
+
postProcessor.addPostProcessor(module);
|
|
8162
|
+
}
|
|
8163
|
+
if (module.type === 'formatter') {
|
|
8164
|
+
this.modules.formatter = module;
|
|
8165
|
+
}
|
|
8166
|
+
if (module.type === '3rdParty') {
|
|
8167
|
+
this.modules.external.push(module);
|
|
8168
|
+
}
|
|
8169
|
+
return this;
|
|
8170
|
+
}
|
|
8171
|
+
}, {
|
|
8172
|
+
key: "setResolvedLanguage",
|
|
8173
|
+
value: function setResolvedLanguage(l) {
|
|
8174
|
+
if (!l || !this.languages) return;
|
|
8175
|
+
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
8176
|
+
for (var li = 0; li < this.languages.length; li++) {
|
|
8177
|
+
var lngInLngs = this.languages[li];
|
|
8178
|
+
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
8179
|
+
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
8180
|
+
this.resolvedLanguage = lngInLngs;
|
|
8181
|
+
break;
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
}
|
|
8185
|
+
}, {
|
|
8186
|
+
key: "changeLanguage",
|
|
8187
|
+
value: function changeLanguage(lng, callback) {
|
|
8188
|
+
var _this4 = this;
|
|
8189
|
+
this.isLanguageChangingTo = lng;
|
|
8190
|
+
var deferred = defer();
|
|
8191
|
+
this.emit('languageChanging', lng);
|
|
8192
|
+
var setLngProps = function setLngProps(l) {
|
|
8193
|
+
_this4.language = l;
|
|
8194
|
+
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
8195
|
+
_this4.resolvedLanguage = undefined;
|
|
8196
|
+
_this4.setResolvedLanguage(l);
|
|
8197
|
+
};
|
|
8198
|
+
var done = function done(err, l) {
|
|
8199
|
+
if (l) {
|
|
8200
|
+
setLngProps(l);
|
|
8201
|
+
_this4.translator.changeLanguage(l);
|
|
8202
|
+
_this4.isLanguageChangingTo = undefined;
|
|
8203
|
+
_this4.emit('languageChanged', l);
|
|
8204
|
+
_this4.logger.log('languageChanged', l);
|
|
8205
|
+
} else {
|
|
8206
|
+
_this4.isLanguageChangingTo = undefined;
|
|
8207
|
+
}
|
|
8208
|
+
deferred.resolve(function () {
|
|
8209
|
+
return _this4.t.apply(_this4, arguments);
|
|
8210
|
+
});
|
|
8211
|
+
if (callback) callback(err, function () {
|
|
8212
|
+
return _this4.t.apply(_this4, arguments);
|
|
8213
|
+
});
|
|
8214
|
+
};
|
|
8215
|
+
var setLng = function setLng(lngs) {
|
|
8216
|
+
if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
|
|
8217
|
+
var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
8218
|
+
if (l) {
|
|
8219
|
+
if (!_this4.language) {
|
|
8220
|
+
setLngProps(l);
|
|
8221
|
+
}
|
|
8222
|
+
if (!_this4.translator.language) _this4.translator.changeLanguage(l);
|
|
8223
|
+
if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l);
|
|
8224
|
+
}
|
|
8225
|
+
_this4.loadResources(l, function (err) {
|
|
8226
|
+
done(err, l);
|
|
8227
|
+
});
|
|
8228
|
+
};
|
|
8229
|
+
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
8230
|
+
setLng(this.services.languageDetector.detect());
|
|
8231
|
+
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
8232
|
+
if (this.services.languageDetector.detect.length === 0) {
|
|
8233
|
+
this.services.languageDetector.detect().then(setLng);
|
|
8234
|
+
} else {
|
|
8235
|
+
this.services.languageDetector.detect(setLng);
|
|
8236
|
+
}
|
|
8237
|
+
} else {
|
|
8238
|
+
setLng(lng);
|
|
8239
|
+
}
|
|
8240
|
+
return deferred;
|
|
8241
|
+
}
|
|
8242
|
+
}, {
|
|
8243
|
+
key: "getFixedT",
|
|
8244
|
+
value: function getFixedT(lng, ns, keyPrefix) {
|
|
8245
|
+
var _this5 = this;
|
|
8246
|
+
var fixedT = function fixedT(key, opts) {
|
|
8247
|
+
var options;
|
|
8248
|
+
if (_typeof__default["default"](opts) !== 'object') {
|
|
8249
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
8250
|
+
rest[_key3 - 2] = arguments[_key3];
|
|
8251
|
+
}
|
|
8252
|
+
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
8253
|
+
} else {
|
|
8254
|
+
options = _objectSpread({}, opts);
|
|
8255
|
+
}
|
|
8256
|
+
options.lng = options.lng || fixedT.lng;
|
|
8257
|
+
options.lngs = options.lngs || fixedT.lngs;
|
|
8258
|
+
options.ns = options.ns || fixedT.ns;
|
|
8259
|
+
options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
8260
|
+
var keySeparator = _this5.options.keySeparator || '.';
|
|
8261
|
+
var resultKey;
|
|
8262
|
+
if (options.keyPrefix && Array.isArray(key)) {
|
|
8263
|
+
resultKey = key.map(function (k) {
|
|
8264
|
+
return ("").concat(options.keyPrefix).concat(keySeparator).concat(k);
|
|
8265
|
+
});
|
|
8266
|
+
} else {
|
|
8267
|
+
resultKey = options.keyPrefix ? ("").concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
|
|
8268
|
+
}
|
|
8269
|
+
return _this5.t(resultKey, options);
|
|
8270
|
+
};
|
|
8271
|
+
if (typeof lng === 'string') {
|
|
8272
|
+
fixedT.lng = lng;
|
|
8273
|
+
} else {
|
|
8274
|
+
fixedT.lngs = lng;
|
|
8275
|
+
}
|
|
8276
|
+
fixedT.ns = ns;
|
|
8277
|
+
fixedT.keyPrefix = keyPrefix;
|
|
8278
|
+
return fixedT;
|
|
8279
|
+
}
|
|
8280
|
+
}, {
|
|
8281
|
+
key: "t",
|
|
8282
|
+
value: function t() {
|
|
8283
|
+
var _this$translator;
|
|
8284
|
+
return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
|
|
8285
|
+
}
|
|
8286
|
+
}, {
|
|
8287
|
+
key: "exists",
|
|
8288
|
+
value: function exists() {
|
|
8289
|
+
var _this$translator2;
|
|
8290
|
+
return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
|
|
8291
|
+
}
|
|
8292
|
+
}, {
|
|
8293
|
+
key: "setDefaultNamespace",
|
|
8294
|
+
value: function setDefaultNamespace(ns) {
|
|
8295
|
+
this.options.defaultNS = ns;
|
|
8296
|
+
}
|
|
8297
|
+
}, {
|
|
8298
|
+
key: "hasLoadedNamespace",
|
|
8299
|
+
value: function hasLoadedNamespace(ns) {
|
|
8300
|
+
var _this6 = this;
|
|
8301
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8302
|
+
if (!this.isInitialized) {
|
|
8303
|
+
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
8304
|
+
return false;
|
|
8305
|
+
}
|
|
8306
|
+
if (!this.languages || !this.languages.length) {
|
|
8307
|
+
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
8308
|
+
return false;
|
|
8309
|
+
}
|
|
8310
|
+
var lng = options.lng || this.resolvedLanguage || this.languages[0];
|
|
8311
|
+
var fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
8312
|
+
var lastLng = this.languages[this.languages.length - 1];
|
|
8313
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
8314
|
+
var loadNotPending = function loadNotPending(l, n) {
|
|
8315
|
+
var loadState = _this6.services.backendConnector.state[("").concat(l, "|").concat(n)];
|
|
8316
|
+
return loadState === -1 || loadState === 2;
|
|
8317
|
+
};
|
|
8318
|
+
if (options.precheck) {
|
|
8319
|
+
var preResult = options.precheck(this, loadNotPending);
|
|
8320
|
+
if (preResult !== undefined) return preResult;
|
|
8321
|
+
}
|
|
8322
|
+
if (this.hasResourceBundle(lng, ns)) return true;
|
|
8323
|
+
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
8324
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
8325
|
+
return false;
|
|
8326
|
+
}
|
|
8327
|
+
}, {
|
|
8328
|
+
key: "loadNamespaces",
|
|
8329
|
+
value: function loadNamespaces(ns, callback) {
|
|
8330
|
+
var _this7 = this;
|
|
8331
|
+
var deferred = defer();
|
|
8332
|
+
if (!this.options.ns) {
|
|
8333
|
+
if (callback) callback();
|
|
8334
|
+
return Promise.resolve();
|
|
8335
|
+
}
|
|
8336
|
+
if (typeof ns === 'string') ns = [ns];
|
|
8337
|
+
ns.forEach(function (n) {
|
|
8338
|
+
if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
|
|
8339
|
+
});
|
|
8340
|
+
this.loadResources(function (err) {
|
|
8341
|
+
deferred.resolve();
|
|
8342
|
+
if (callback) callback(err);
|
|
8343
|
+
});
|
|
8344
|
+
return deferred;
|
|
8345
|
+
}
|
|
8346
|
+
}, {
|
|
8347
|
+
key: "loadLanguages",
|
|
8348
|
+
value: function loadLanguages(lngs, callback) {
|
|
8349
|
+
var deferred = defer();
|
|
8350
|
+
if (typeof lngs === 'string') lngs = [lngs];
|
|
8351
|
+
var preloaded = this.options.preload || [];
|
|
8352
|
+
var newLngs = lngs.filter(function (lng) {
|
|
8353
|
+
return preloaded.indexOf(lng) < 0;
|
|
8354
|
+
});
|
|
8355
|
+
if (!newLngs.length) {
|
|
8356
|
+
if (callback) callback();
|
|
8357
|
+
return Promise.resolve();
|
|
8358
|
+
}
|
|
8359
|
+
this.options.preload = preloaded.concat(newLngs);
|
|
8360
|
+
this.loadResources(function (err) {
|
|
8361
|
+
deferred.resolve();
|
|
8362
|
+
if (callback) callback(err);
|
|
8363
|
+
});
|
|
8364
|
+
return deferred;
|
|
8365
|
+
}
|
|
8366
|
+
}, {
|
|
8367
|
+
key: "dir",
|
|
8368
|
+
value: function dir(lng) {
|
|
8369
|
+
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
|
|
8370
|
+
if (!lng) return 'rtl';
|
|
8371
|
+
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'];
|
|
8372
|
+
var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get$1());
|
|
8373
|
+
return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
8374
|
+
}
|
|
8375
|
+
}, {
|
|
8376
|
+
key: "cloneInstance",
|
|
8377
|
+
value: function cloneInstance() {
|
|
8378
|
+
var _this8 = this;
|
|
8379
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8380
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
8381
|
+
var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, this.options), options), {
|
|
8382
|
+
isClone: true
|
|
8383
|
+
});
|
|
8384
|
+
var clone = new I18n(mergedOptions);
|
|
8385
|
+
if (options.debug !== undefined || options.prefix !== undefined) {
|
|
8386
|
+
clone.logger = clone.logger.clone(options);
|
|
8387
|
+
}
|
|
8388
|
+
var membersToCopy = ['store', 'services', 'language'];
|
|
8389
|
+
membersToCopy.forEach(function (m) {
|
|
8390
|
+
clone[m] = _this8[m];
|
|
8391
|
+
});
|
|
8392
|
+
clone.services = _objectSpread({}, this.services);
|
|
8393
|
+
clone.services.utils = {
|
|
8394
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
8395
|
+
};
|
|
8396
|
+
clone.translator = new Translator$1(clone.services, clone.options);
|
|
8397
|
+
clone.translator.on('*', function (event) {
|
|
8398
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
8399
|
+
args[_key4 - 1] = arguments[_key4];
|
|
8400
|
+
}
|
|
8401
|
+
clone.emit.apply(clone, [event].concat(args));
|
|
8402
|
+
});
|
|
8403
|
+
clone.init(mergedOptions, callback);
|
|
8404
|
+
clone.translator.options = clone.options;
|
|
8405
|
+
clone.translator.backendConnector.services.utils = {
|
|
8406
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
8407
|
+
};
|
|
8408
|
+
return clone;
|
|
8409
|
+
}
|
|
8410
|
+
}, {
|
|
8411
|
+
key: "toJSON",
|
|
8412
|
+
value: function toJSON() {
|
|
8413
|
+
return {
|
|
8414
|
+
options: this.options,
|
|
8415
|
+
store: this.store,
|
|
8416
|
+
language: this.language,
|
|
8417
|
+
languages: this.languages,
|
|
8418
|
+
resolvedLanguage: this.resolvedLanguage
|
|
8419
|
+
};
|
|
8420
|
+
}
|
|
8421
|
+
}]);
|
|
8422
|
+
return I18n;
|
|
8423
|
+
})(EventEmitter);
|
|
8424
|
+
_defineProperty__default["default"](I18n, "createInstance", function () {
|
|
8425
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8426
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
8427
|
+
return new I18n(options, callback);
|
|
8428
|
+
});
|
|
8429
|
+
var instance = I18n.createInstance();
|
|
8430
|
+
instance.createInstance = I18n.createInstance;
|
|
8431
|
+
var i18next = instance;
|
|
8432
|
+
var en = {};
|
|
8433
|
+
(function (exports) {
|
|
8434
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8435
|
+
value: true
|
|
8436
|
+
});
|
|
8437
|
+
exports["default"] = void 0;
|
|
8438
|
+
var _default = {
|
|
8439
|
+
translation: {
|
|
8440
|
+
categorize: {
|
|
8441
|
+
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
8442
|
+
maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
|
|
8443
|
+
},
|
|
8444
|
+
ebsr: {
|
|
8445
|
+
part: 'Part {{index}}'
|
|
8446
|
+
},
|
|
8447
|
+
numberLine: {
|
|
8448
|
+
addElementLimit_one: 'You can only add {{count}} element',
|
|
8449
|
+
addElementLimit_other: 'You can only add {{count}} elements',
|
|
8450
|
+
clearAll: 'Clear all'
|
|
8451
|
+
},
|
|
8452
|
+
imageClozeAssociation: {
|
|
8453
|
+
reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
|
|
8454
|
+
reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
|
|
8455
|
+
},
|
|
8456
|
+
drawingResponse: {
|
|
8457
|
+
fillColor: 'Fill color',
|
|
8458
|
+
outlineColor: 'Outline color',
|
|
8459
|
+
noFill: 'No fill',
|
|
8460
|
+
lightblue: 'Light blue',
|
|
8461
|
+
lightyellow: 'Light yellow',
|
|
8462
|
+
red: 'Red',
|
|
8463
|
+
orange: 'Orange',
|
|
8464
|
+
yellow: 'Yellow',
|
|
8465
|
+
violet: 'Violet',
|
|
8466
|
+
blue: 'Blue',
|
|
8467
|
+
green: 'Green',
|
|
8468
|
+
white: 'White',
|
|
8469
|
+
black: 'Black',
|
|
8470
|
+
onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
|
|
8471
|
+
},
|
|
8472
|
+
charting: {
|
|
8473
|
+
addCategory: 'Add category',
|
|
8474
|
+
newLabel: 'New label',
|
|
8475
|
+
reachedLimit_other: "There can't be more than {{count}} categories."
|
|
8476
|
+
},
|
|
8477
|
+
graphing: {
|
|
8478
|
+
point: 'Point',
|
|
8479
|
+
circle: 'Circle',
|
|
8480
|
+
line: 'Line',
|
|
8481
|
+
parabola: 'Parabola',
|
|
8482
|
+
absolute: 'Absolute Value',
|
|
8483
|
+
exponential: 'Exponential',
|
|
8484
|
+
polygon: 'Polygon',
|
|
8485
|
+
ray: 'Ray',
|
|
8486
|
+
segment: 'Segment',
|
|
8487
|
+
sine: 'Sine',
|
|
8488
|
+
vector: 'Vector',
|
|
8489
|
+
label: 'Label',
|
|
8490
|
+
redo: 'Redo',
|
|
8491
|
+
reset: 'Reset'
|
|
8492
|
+
},
|
|
8493
|
+
mathInline: {
|
|
8494
|
+
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.'
|
|
8495
|
+
},
|
|
8496
|
+
multipleChoice: {
|
|
8497
|
+
minSelections_one: 'This question requires at least {{minSelections}} answer.',
|
|
8498
|
+
minSelections_other: 'This question requires at least {{minSelections}} answers.',
|
|
8499
|
+
maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
|
|
8500
|
+
maxSelections_other: 'Only {{maxSelections}} answers are allowed.'
|
|
8501
|
+
},
|
|
8502
|
+
selectText: {
|
|
8503
|
+
correctAnswerSelected: 'Correct answer selected',
|
|
8504
|
+
correctAnswerNotSelected: 'Correct answer not selected',
|
|
8505
|
+
incorrectSelection: 'Incorrect selection'
|
|
8506
|
+
}
|
|
8507
|
+
},
|
|
8508
|
+
common: {
|
|
8509
|
+
undo: 'Undo',
|
|
8510
|
+
clearAll: 'Clear all',
|
|
8511
|
+
correct: 'Correct',
|
|
8512
|
+
incorrect: 'Incorrect',
|
|
8513
|
+
showCorrectAnswer: 'Show correct answer',
|
|
8514
|
+
hideCorrectAnswer: 'Hide correct answer',
|
|
8515
|
+
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.',
|
|
8516
|
+
warning: 'Warning',
|
|
8517
|
+
showNote: 'Show Note',
|
|
8518
|
+
hideNote: 'Hide Note',
|
|
8519
|
+
cancel: 'Cancel'
|
|
8520
|
+
}
|
|
8521
|
+
};
|
|
8522
|
+
exports["default"] = _default;
|
|
8523
|
+
})(en);
|
|
8524
|
+
getDefaultExportFromCjs(en);
|
|
8525
|
+
var es = {};
|
|
8526
|
+
(function (exports) {
|
|
8527
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8528
|
+
value: true
|
|
8529
|
+
});
|
|
8530
|
+
exports["default"] = void 0;
|
|
8531
|
+
var _default = {
|
|
8532
|
+
translation: {
|
|
8533
|
+
categorize: {
|
|
8534
|
+
limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
8535
|
+
maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
|
|
8536
|
+
},
|
|
8537
|
+
ebsr: {
|
|
8538
|
+
part: 'Parte {{index}}'
|
|
8539
|
+
},
|
|
8540
|
+
numberLine: {
|
|
8541
|
+
addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
|
|
8542
|
+
addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
|
|
8543
|
+
clearAll: 'Borrar todo'
|
|
8544
|
+
},
|
|
8545
|
+
imageClozeAssociation: {
|
|
8546
|
+
reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
|
|
8547
|
+
reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
|
|
8548
|
+
},
|
|
8549
|
+
drawingResponse: {
|
|
8550
|
+
fillColor: 'Color de relleno',
|
|
8551
|
+
outlineColor: 'Color del contorno',
|
|
8552
|
+
noFill: 'Sin relleno',
|
|
8553
|
+
lightblue: 'Azul claro',
|
|
8554
|
+
lightyellow: 'Amarillo claro',
|
|
8555
|
+
red: 'Rojo',
|
|
8556
|
+
orange: 'Naranja',
|
|
8557
|
+
yellow: 'Amarillo',
|
|
8558
|
+
violet: 'Violeta',
|
|
8559
|
+
blue: 'Azul',
|
|
8560
|
+
green: 'Verde',
|
|
8561
|
+
white: 'Blanco',
|
|
8562
|
+
black: 'Negro',
|
|
8563
|
+
onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
|
|
8564
|
+
},
|
|
8565
|
+
charting: {
|
|
8566
|
+
addCategory: 'Añadir categoría',
|
|
8567
|
+
newLabel: 'Nueva etiqueta',
|
|
8568
|
+
reachedLimit_other: 'No puede haber más de {{count}} categorías.'
|
|
8569
|
+
},
|
|
8570
|
+
graphing: {
|
|
8571
|
+
point: 'Punto',
|
|
8572
|
+
circle: 'Circulo',
|
|
8573
|
+
line: 'Línea',
|
|
8574
|
+
parabola: 'Parábola',
|
|
8575
|
+
absolute: 'Valor absoluto',
|
|
8576
|
+
exponential: 'Exponencial',
|
|
8577
|
+
polygon: 'Polígono',
|
|
8578
|
+
ray: 'Semirrecta',
|
|
8579
|
+
segment: 'Segmento ',
|
|
8580
|
+
sine: 'Seno',
|
|
8581
|
+
vector: 'Vector',
|
|
8582
|
+
label: 'Etiqueta',
|
|
8583
|
+
redo: 'Rehacer',
|
|
8584
|
+
reset: 'Reiniciar'
|
|
8585
|
+
},
|
|
8586
|
+
mathInline: {
|
|
8587
|
+
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.'
|
|
8588
|
+
},
|
|
8589
|
+
multipleChoice: {
|
|
8590
|
+
minSelections_one: 'Esta pregunta requiere al menos {{minSelections}} respuesta.',
|
|
8591
|
+
minSelections_other: 'Esta pregunta requiere al menos {{minSelections}} respuestas.',
|
|
8592
|
+
maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
|
|
8593
|
+
maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.'
|
|
8594
|
+
},
|
|
8595
|
+
selectText: {
|
|
8596
|
+
correctAnswerSelected: 'Respuesta correcta seleccionada',
|
|
8597
|
+
correctAnswerNotSelected: 'Respuesta correcta no seleccionada',
|
|
8598
|
+
incorrectSelection: 'Selección incorrecta'
|
|
8599
|
+
}
|
|
8600
|
+
},
|
|
8601
|
+
common: {
|
|
8602
|
+
undo: 'Deshacer',
|
|
8603
|
+
clearAll: 'Borrar todo',
|
|
8604
|
+
correct: 'Correct',
|
|
8605
|
+
incorrect: 'Incorrect',
|
|
8606
|
+
showCorrectAnswer: 'Mostrar respuesta correcta',
|
|
8607
|
+
hideCorrectAnswer: 'Ocultar respuesta correcta',
|
|
8608
|
+
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.',
|
|
8609
|
+
warning: 'Advertencia',
|
|
8610
|
+
showNote: 'Mostrar Nota',
|
|
8611
|
+
hideNote: 'Ocultar Nota',
|
|
8612
|
+
cancel: 'Cancelar'
|
|
8613
|
+
}
|
|
8614
|
+
};
|
|
8615
|
+
exports["default"] = _default;
|
|
8616
|
+
})(es);
|
|
8617
|
+
getDefaultExportFromCjs(es);
|
|
8618
|
+
(function (exports) {
|
|
8619
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
8620
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8621
|
+
value: true
|
|
8622
|
+
});
|
|
8623
|
+
exports["default"] = void 0;
|
|
8624
|
+
var _defineProperty2 = _interopRequireDefault(defineProperty$2.exports);
|
|
8625
|
+
var _i18next = _interopRequireDefault(i18next);
|
|
8626
|
+
var _en = _interopRequireDefault(en);
|
|
8627
|
+
var _es = _interopRequireDefault(es);
|
|
8628
|
+
function ownKeys(object, enumerableOnly) {
|
|
8629
|
+
var keys = Object.keys(object);
|
|
8630
|
+
if (Object.getOwnPropertySymbols) {
|
|
8631
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
8632
|
+
(enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
8633
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
8634
|
+
})), keys.push.apply(keys, symbols));
|
|
8635
|
+
}
|
|
8636
|
+
return keys;
|
|
8637
|
+
}
|
|
8638
|
+
function _objectSpread(target) {
|
|
8639
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8640
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
8641
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
8642
|
+
(0, _defineProperty2["default"])(target, key, source[key]);
|
|
8643
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
8644
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
8645
|
+
});
|
|
8646
|
+
}
|
|
8647
|
+
return target;
|
|
8648
|
+
}
|
|
8649
|
+
_i18next["default"].init({
|
|
8650
|
+
fallbackLng: "en",
|
|
8651
|
+
lng: "en",
|
|
8652
|
+
debug: true,
|
|
8653
|
+
resources: {
|
|
8654
|
+
en: _en["default"],
|
|
8655
|
+
es: _es["default"]
|
|
8656
|
+
}
|
|
8657
|
+
});
|
|
8658
|
+
var _default = {
|
|
8659
|
+
translator: _objectSpread(_objectSpread({}, _i18next["default"]), {}, {
|
|
8660
|
+
t: function t(key, options) {
|
|
8661
|
+
var lng = options.lng;
|
|
8662
|
+
switch (lng) {
|
|
8663
|
+
case "en_US":
|
|
8664
|
+
case "en-US":
|
|
8665
|
+
options.lng = "en";
|
|
8666
|
+
break;
|
|
8667
|
+
case "es_ES":
|
|
8668
|
+
case "es-ES":
|
|
8669
|
+
case "es_MX":
|
|
8670
|
+
case "es-MX":
|
|
8671
|
+
options.lng = "es";
|
|
8672
|
+
break;
|
|
8673
|
+
}
|
|
8674
|
+
return _i18next["default"].t(key, _objectSpread({
|
|
8675
|
+
lng: lng
|
|
8676
|
+
}, options));
|
|
8677
|
+
}
|
|
8678
|
+
}),
|
|
8679
|
+
languageOptions: [{
|
|
8680
|
+
value: "en_US",
|
|
8681
|
+
label: "English (US)"
|
|
8682
|
+
}, {
|
|
8683
|
+
value: "es_ES",
|
|
8684
|
+
label: "Spanish"
|
|
8685
|
+
}]
|
|
8686
|
+
};
|
|
8687
|
+
exports["default"] = _default;
|
|
8688
|
+
})(translator$1);
|
|
8689
|
+
getDefaultExportFromCjs(translator$1);
|
|
8690
|
+
(function (exports) {
|
|
8691
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
8692
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8693
|
+
value: true
|
|
8694
|
+
});
|
|
8695
|
+
Object.defineProperty(exports, "Translator", {
|
|
8696
|
+
enumerable: true,
|
|
8697
|
+
get: function get() {
|
|
8698
|
+
return _translator["default"];
|
|
8699
|
+
}
|
|
8700
|
+
});
|
|
8701
|
+
exports["default"] = void 0;
|
|
8702
|
+
var _translator = _interopRequireDefault(translator$1);
|
|
8703
|
+
var _default = _translator["default"];
|
|
8704
|
+
exports["default"] = _default;
|
|
8705
|
+
})(translator$2);
|
|
8706
|
+
var Translator = getDefaultExportFromCjs(translator$2);
|
|
8707
|
+
var FormControlLabel$3 = {};
|
|
8708
|
+
var FormControlLabel$2 = {};
|
|
8709
|
+
var withFormControlContext$1 = {};
|
|
8710
|
+
var FormControlContext$1 = {};
|
|
8711
|
+
const require$$1$8 = _dll_react;
|
|
8712
|
+
var _interopRequireDefault$s = interopRequireDefault.exports;
|
|
8713
|
+
Object.defineProperty(FormControlContext$1, "__esModule", {
|
|
8714
|
+
value: true
|
|
8715
|
+
});
|
|
8716
|
+
FormControlContext$1.default = void 0;
|
|
8717
|
+
var _react$k = _interopRequireDefault$s(require$$1$8);
|
|
8718
|
+
var FormControlContext = _react$k.default.createContext();
|
|
8719
|
+
var _default$r = FormControlContext;
|
|
8720
|
+
FormControlContext$1.default = _default$r;
|
|
8721
|
+
const require$$2$3 = _dll_react;
|
|
8722
|
+
var _interopRequireDefault$r = interopRequireDefault.exports;
|
|
8723
|
+
Object.defineProperty(withFormControlContext$1, "__esModule", {
|
|
8724
|
+
value: true
|
|
8725
|
+
});
|
|
8726
|
+
withFormControlContext$1.default = withFormControlContext;
|
|
8727
|
+
var _extends2$a = _interopRequireDefault$r(_extends$1.exports);
|
|
8728
|
+
var _react$j = _interopRequireDefault$r(require$$2$3);
|
|
8729
|
+
var _hoistNonReactStatics = _interopRequireDefault$r(hoistNonReactStatics_cjs);
|
|
8730
|
+
var _FormControlContext = _interopRequireDefault$r(FormControlContext$1);
|
|
8731
|
+
var _utils$5 = require$$7$1;
|
|
8732
|
+
function withFormControlContext(Component) {
|
|
8733
|
+
var EnhancedComponent = function EnhancedComponent(props) {
|
|
8734
|
+
return _react$j.default.createElement(_FormControlContext.default.Consumer, null, function (context) {
|
|
8735
|
+
return _react$j.default.createElement(Component, (0, _extends2$a.default)({
|
|
8736
|
+
muiFormControl: context
|
|
8737
|
+
}, props));
|
|
8738
|
+
});
|
|
8739
|
+
};
|
|
8740
|
+
{
|
|
8741
|
+
EnhancedComponent.displayName = ("WithFormControlContext(").concat((0, _utils$5.getDisplayName)(Component), ")");
|
|
8742
|
+
}
|
|
8743
|
+
(0, _hoistNonReactStatics.default)(EnhancedComponent, Component);
|
|
8744
|
+
return EnhancedComponent;
|
|
8745
|
+
}
|
|
8746
|
+
var Typography$2 = {};
|
|
8747
|
+
var Typography$1 = {};
|
|
8748
|
+
var helpers = {};
|
|
8749
|
+
var _interopRequireDefault$q = interopRequireDefault.exports;
|
|
8750
|
+
Object.defineProperty(helpers, "__esModule", {
|
|
8751
|
+
value: true
|
|
8752
|
+
});
|
|
8753
|
+
helpers.capitalize = capitalize;
|
|
8754
|
+
helpers.contains = contains;
|
|
8755
|
+
helpers.findIndex = findIndex;
|
|
8756
|
+
helpers.find = find;
|
|
8757
|
+
helpers.createChainedFunction = createChainedFunction;
|
|
8758
|
+
var _typeof2 = _interopRequireDefault$q(_typeof$3.exports);
|
|
8759
|
+
var _warning$1 = _interopRequireDefault$q(warning_1);
|
|
8760
|
+
function capitalize(string) {
|
|
8761
|
+
if (typeof string !== 'string') {
|
|
8762
|
+
throw new Error('Material-UI: capitalize(string) expects a string argument.');
|
|
8763
|
+
}
|
|
8764
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
8765
|
+
}
|
|
8766
|
+
function contains(obj, pred) {
|
|
8767
|
+
return Object.keys(pred).every(function (key) {
|
|
8768
|
+
return obj.hasOwnProperty(key) && obj[key] === pred[key];
|
|
8769
|
+
});
|
|
8770
|
+
}
|
|
8771
|
+
function findIndex(arr, pred) {
|
|
8772
|
+
var predType = (0, _typeof2.default)(pred);
|
|
8773
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
8774
|
+
if (predType === 'function' && !!pred(arr[i], i, arr) === true) {
|
|
8775
|
+
return i;
|
|
8776
|
+
}
|
|
8777
|
+
if (predType === 'object' && contains(arr[i], pred)) {
|
|
8778
|
+
return i;
|
|
8779
|
+
}
|
|
8780
|
+
if (['string', 'number', 'boolean'].indexOf(predType) !== -1) {
|
|
8781
|
+
return arr.indexOf(pred);
|
|
8782
|
+
}
|
|
8783
|
+
}
|
|
8784
|
+
return -1;
|
|
8785
|
+
}
|
|
8786
|
+
function find(arr, pred) {
|
|
8787
|
+
var index = findIndex(arr, pred);
|
|
8788
|
+
return index > -1 ? arr[index] : undefined;
|
|
8789
|
+
}
|
|
8790
|
+
function createChainedFunction() {
|
|
8791
|
+
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8792
|
+
funcs[_key] = arguments[_key];
|
|
8793
|
+
}
|
|
8794
|
+
return funcs.reduce(function (acc, func) {
|
|
8795
|
+
if (func == null) {
|
|
8796
|
+
return acc;
|
|
8797
|
+
}
|
|
8798
|
+
(0, _warning$1.default)(typeof func === 'function', 'Material-UI: invalid Argument Type, must only provide functions, undefined, or null.');
|
|
8799
|
+
return function chainedFunction() {
|
|
8800
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
8801
|
+
args[_key2] = arguments[_key2];
|
|
8802
|
+
}
|
|
8803
|
+
acc.apply(this, args);
|
|
8804
|
+
func.apply(this, args);
|
|
8805
|
+
};
|
|
8806
|
+
}, function () {});
|
|
8807
|
+
}
|
|
8808
|
+
const require$$4$5 = _dll_react;
|
|
8809
|
+
const require$$5$5 = _dll_prop_types;
|
|
8810
|
+
const require$$6$5 = _dll_classnames;
|
|
8811
|
+
var _interopRequireDefault$p = interopRequireDefault.exports;
|
|
8812
|
+
Object.defineProperty(Typography$1, "__esModule", {
|
|
8813
|
+
value: true
|
|
8814
|
+
});
|
|
8815
|
+
Typography$1.default = Typography$1.styles = void 0;
|
|
8816
|
+
var _extends2$9 = _interopRequireDefault$p(_extends$1.exports);
|
|
8817
|
+
var _defineProperty2$7 = _interopRequireDefault$p(defineProperty$2.exports);
|
|
8818
|
+
var _objectWithoutProperties2$9 = _interopRequireDefault$p(objectWithoutProperties.exports);
|
|
8819
|
+
var _react$i = _interopRequireDefault$p(require$$4$5);
|
|
8820
|
+
var _propTypes$b = _interopRequireDefault$p(require$$5$5);
|
|
8821
|
+
var _classnames$9 = _interopRequireDefault$p(require$$6$5);
|
|
8822
|
+
var _utils$4 = require$$7$1;
|
|
8823
|
+
var _withStyles$8 = _interopRequireDefault$p(withStyles);
|
|
8824
|
+
var _helpers$5 = helpers;
|
|
8825
|
+
var styles$a = function styles(theme) {
|
|
8826
|
+
return {
|
|
8827
|
+
root: {
|
|
8828
|
+
display: 'block',
|
|
8829
|
+
margin: 0
|
|
8830
|
+
},
|
|
8831
|
+
display4: theme.typography.display4,
|
|
8832
|
+
display3: theme.typography.display3,
|
|
8833
|
+
display2: theme.typography.display2,
|
|
8834
|
+
display1: theme.typography.display1,
|
|
8835
|
+
headline: theme.typography.headline,
|
|
8836
|
+
title: theme.typography.title,
|
|
8837
|
+
subheading: theme.typography.subheading,
|
|
8838
|
+
body2: theme.typography.body2,
|
|
8839
|
+
body1: theme.typography.body1,
|
|
8840
|
+
caption: theme.typography.caption,
|
|
8841
|
+
button: theme.typography.button,
|
|
8842
|
+
h1: theme.typography.h1,
|
|
8843
|
+
h2: theme.typography.h2,
|
|
8844
|
+
h3: theme.typography.h3,
|
|
8845
|
+
h4: theme.typography.h4,
|
|
8846
|
+
h5: theme.typography.h5,
|
|
8847
|
+
h6: theme.typography.h6,
|
|
8848
|
+
subtitle1: theme.typography.subtitle1,
|
|
8849
|
+
subtitle2: theme.typography.subtitle2,
|
|
8850
|
+
overline: theme.typography.overline,
|
|
8851
|
+
srOnly: {
|
|
8852
|
+
position: 'absolute',
|
|
8853
|
+
height: 1,
|
|
8854
|
+
width: 1,
|
|
5611
8855
|
overflow: 'hidden'
|
|
5612
8856
|
},
|
|
5613
8857
|
alignLeft: {
|
|
@@ -5767,7 +9011,7 @@ Object.defineProperty(FormControlLabel$2, "__esModule", {
|
|
|
5767
9011
|
});
|
|
5768
9012
|
FormControlLabel$2.default = FormControlLabel$2.styles = void 0;
|
|
5769
9013
|
var _extends2$8 = _interopRequireDefault$o(_extends$1.exports);
|
|
5770
|
-
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$
|
|
9014
|
+
var _defineProperty2$6 = _interopRequireDefault$o(defineProperty$2.exports);
|
|
5771
9015
|
var _objectWithoutProperties2$8 = _interopRequireDefault$o(objectWithoutProperties.exports);
|
|
5772
9016
|
var _react$h = _interopRequireDefault$o(require$$4$4);
|
|
5773
9017
|
var _propTypes$a = _interopRequireDefault$o(require$$5$4);
|
|
@@ -5919,11 +9163,11 @@ Object.defineProperty(NoSsr$1, "__esModule", {
|
|
|
5919
9163
|
value: true
|
|
5920
9164
|
});
|
|
5921
9165
|
NoSsr$1.default = void 0;
|
|
5922
|
-
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck.exports);
|
|
5923
|
-
var _createClass2$4 = _interopRequireDefault$m(createClass.exports);
|
|
5924
|
-
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn.exports);
|
|
5925
|
-
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$
|
|
5926
|
-
var _inherits2$4 = _interopRequireDefault$m(inherits.exports);
|
|
9166
|
+
var _classCallCheck2$4 = _interopRequireDefault$m(classCallCheck$1.exports);
|
|
9167
|
+
var _createClass2$4 = _interopRequireDefault$m(createClass$1.exports);
|
|
9168
|
+
var _possibleConstructorReturn2$4 = _interopRequireDefault$m(possibleConstructorReturn$1.exports);
|
|
9169
|
+
var _getPrototypeOf3$3 = _interopRequireDefault$m(getPrototypeOf$2.exports);
|
|
9170
|
+
var _inherits2$4 = _interopRequireDefault$m(inherits$1.exports);
|
|
5927
9171
|
var _react$g = _interopRequireDefault$m(require$$6$3);
|
|
5928
9172
|
var _propTypes$9 = _interopRequireDefault$m(require$$7);
|
|
5929
9173
|
var _utils$3 = require$$7$1;
|
|
@@ -6834,13 +10078,13 @@ Object.defineProperty(Ripple$1, "__esModule", {
|
|
|
6834
10078
|
});
|
|
6835
10079
|
Ripple$1.default = void 0;
|
|
6836
10080
|
var _extends2$7 = _interopRequireDefault$i(_extends$1.exports);
|
|
6837
|
-
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$
|
|
10081
|
+
var _defineProperty2$5 = _interopRequireDefault$i(defineProperty$2.exports);
|
|
6838
10082
|
var _objectWithoutProperties2$7 = _interopRequireDefault$i(objectWithoutProperties.exports);
|
|
6839
|
-
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck.exports);
|
|
6840
|
-
var _createClass2$3 = _interopRequireDefault$i(createClass.exports);
|
|
6841
|
-
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn.exports);
|
|
6842
|
-
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$
|
|
6843
|
-
var _inherits2$3 = _interopRequireDefault$i(inherits.exports);
|
|
10083
|
+
var _classCallCheck2$3 = _interopRequireDefault$i(classCallCheck$1.exports);
|
|
10084
|
+
var _createClass2$3 = _interopRequireDefault$i(createClass$1.exports);
|
|
10085
|
+
var _possibleConstructorReturn2$3 = _interopRequireDefault$i(possibleConstructorReturn$1.exports);
|
|
10086
|
+
var _getPrototypeOf3$2 = _interopRequireDefault$i(getPrototypeOf$2.exports);
|
|
10087
|
+
var _inherits2$3 = _interopRequireDefault$i(inherits$1.exports);
|
|
6844
10088
|
var _react$d = _interopRequireDefault$i(require$$9$1);
|
|
6845
10089
|
var _propTypes$7 = _interopRequireDefault$i(require$$10$3);
|
|
6846
10090
|
var _classnames$7 = _interopRequireDefault$i(require$$11$3);
|
|
@@ -6923,12 +10167,12 @@ TouchRipple$1.default = TouchRipple$1.styles = TouchRipple$1.DELAY_RIPPLE = void
|
|
|
6923
10167
|
var _extends2$6 = _interopRequireDefault$h(_extends$1.exports);
|
|
6924
10168
|
var _objectWithoutProperties2$6 = _interopRequireDefault$h(objectWithoutProperties.exports);
|
|
6925
10169
|
var _toConsumableArray2 = _interopRequireDefault$h(toConsumableArray.exports);
|
|
6926
|
-
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck.exports);
|
|
6927
|
-
var _createClass2$2 = _interopRequireDefault$h(createClass.exports);
|
|
6928
|
-
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn.exports);
|
|
6929
|
-
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$
|
|
6930
|
-
var _inherits2$2 = _interopRequireDefault$h(inherits.exports);
|
|
6931
|
-
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized.exports);
|
|
10170
|
+
var _classCallCheck2$2 = _interopRequireDefault$h(classCallCheck$1.exports);
|
|
10171
|
+
var _createClass2$2 = _interopRequireDefault$h(createClass$1.exports);
|
|
10172
|
+
var _possibleConstructorReturn2$2 = _interopRequireDefault$h(possibleConstructorReturn$1.exports);
|
|
10173
|
+
var _getPrototypeOf3$1 = _interopRequireDefault$h(getPrototypeOf$2.exports);
|
|
10174
|
+
var _inherits2$2 = _interopRequireDefault$h(inherits$1.exports);
|
|
10175
|
+
var _assertThisInitialized2$1 = _interopRequireDefault$h(assertThisInitialized$1.exports);
|
|
6932
10176
|
var _react$c = _interopRequireDefault$h(require$$10$2);
|
|
6933
10177
|
var _propTypes$6 = _interopRequireDefault$h(require$$11$2);
|
|
6934
10178
|
var _reactDom$1 = _interopRequireDefault$h(require$$12$1);
|
|
@@ -7226,14 +10470,14 @@ Object.defineProperty(ButtonBase$1, "__esModule", {
|
|
|
7226
10470
|
});
|
|
7227
10471
|
ButtonBase$1.default = ButtonBase$1.styles = void 0;
|
|
7228
10472
|
var _extends2$5 = _interopRequireDefault$g(_extends$1.exports);
|
|
7229
|
-
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$
|
|
10473
|
+
var _defineProperty2$4 = _interopRequireDefault$g(defineProperty$2.exports);
|
|
7230
10474
|
var _objectWithoutProperties2$5 = _interopRequireDefault$g(objectWithoutProperties.exports);
|
|
7231
|
-
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck.exports);
|
|
7232
|
-
var _createClass2$1 = _interopRequireDefault$g(createClass.exports);
|
|
7233
|
-
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn.exports);
|
|
7234
|
-
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$
|
|
7235
|
-
var _inherits2$1 = _interopRequireDefault$g(inherits.exports);
|
|
7236
|
-
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized.exports);
|
|
10475
|
+
var _classCallCheck2$1 = _interopRequireDefault$g(classCallCheck$1.exports);
|
|
10476
|
+
var _createClass2$1 = _interopRequireDefault$g(createClass$1.exports);
|
|
10477
|
+
var _possibleConstructorReturn2$1 = _interopRequireDefault$g(possibleConstructorReturn$1.exports);
|
|
10478
|
+
var _getPrototypeOf3 = _interopRequireDefault$g(getPrototypeOf$2.exports);
|
|
10479
|
+
var _inherits2$1 = _interopRequireDefault$g(inherits$1.exports);
|
|
10480
|
+
var _assertThisInitialized2 = _interopRequireDefault$g(assertThisInitialized$1.exports);
|
|
7237
10481
|
var _react$b = _interopRequireDefault$g(require$$10$1);
|
|
7238
10482
|
var _propTypes$5 = _interopRequireDefault$g(require$$11$1);
|
|
7239
10483
|
var _reactDom = _interopRequireDefault$g(require$$12);
|
|
@@ -7551,7 +10795,7 @@ Object.defineProperty(IconButton$1, "__esModule", {
|
|
|
7551
10795
|
});
|
|
7552
10796
|
IconButton$1.default = IconButton$1.styles = void 0;
|
|
7553
10797
|
var _extends2$4 = _interopRequireDefault$f(_extends$1.exports);
|
|
7554
|
-
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$
|
|
10798
|
+
var _defineProperty2$3 = _interopRequireDefault$f(defineProperty$2.exports);
|
|
7555
10799
|
var _objectWithoutProperties2$4 = _interopRequireDefault$f(objectWithoutProperties.exports);
|
|
7556
10800
|
var _react$a = _interopRequireDefault$f(require$$4$3);
|
|
7557
10801
|
var _propTypes$4 = _interopRequireDefault$f(require$$5$3);
|
|
@@ -7677,13 +10921,13 @@ Object.defineProperty(SwitchBase$1, "__esModule", {
|
|
|
7677
10921
|
});
|
|
7678
10922
|
SwitchBase$1.default = SwitchBase$1.styles = void 0;
|
|
7679
10923
|
var _extends2$3 = _interopRequireDefault$e(_extends$1.exports);
|
|
7680
|
-
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$
|
|
10924
|
+
var _defineProperty2$2 = _interopRequireDefault$e(defineProperty$2.exports);
|
|
7681
10925
|
var _objectWithoutProperties2$3 = _interopRequireDefault$e(objectWithoutProperties.exports);
|
|
7682
|
-
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck.exports);
|
|
7683
|
-
var _createClass2 = _interopRequireDefault$e(createClass.exports);
|
|
7684
|
-
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn.exports);
|
|
7685
|
-
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$
|
|
7686
|
-
var _inherits2 = _interopRequireDefault$e(inherits.exports);
|
|
10926
|
+
var _classCallCheck2 = _interopRequireDefault$e(classCallCheck$1.exports);
|
|
10927
|
+
var _createClass2 = _interopRequireDefault$e(createClass$1.exports);
|
|
10928
|
+
var _possibleConstructorReturn2 = _interopRequireDefault$e(possibleConstructorReturn$1.exports);
|
|
10929
|
+
var _getPrototypeOf2 = _interopRequireDefault$e(getPrototypeOf$2.exports);
|
|
10930
|
+
var _inherits2 = _interopRequireDefault$e(inherits$1.exports);
|
|
7687
10931
|
var _react$9 = _interopRequireDefault$e(require$$9);
|
|
7688
10932
|
var _propTypes$3 = _interopRequireDefault$e(require$$10);
|
|
7689
10933
|
var _classnames$3 = _interopRequireDefault$e(require$$11);
|
|
@@ -7836,11 +11080,11 @@ var inheritsLoose = {
|
|
|
7836
11080
|
exports: {}
|
|
7837
11081
|
};
|
|
7838
11082
|
(function (module) {
|
|
7839
|
-
var setPrototypeOf
|
|
11083
|
+
var setPrototypeOf = setPrototypeOf$1.exports;
|
|
7840
11084
|
function _inheritsLoose(subClass, superClass) {
|
|
7841
11085
|
subClass.prototype = Object.create(superClass.prototype);
|
|
7842
11086
|
subClass.prototype.constructor = subClass;
|
|
7843
|
-
setPrototypeOf
|
|
11087
|
+
setPrototypeOf(subClass, superClass);
|
|
7844
11088
|
}
|
|
7845
11089
|
(module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
7846
11090
|
})(inheritsLoose);
|
|
@@ -7985,7 +11229,7 @@ Object.defineProperty(SvgIcon$1, "__esModule", {
|
|
|
7985
11229
|
});
|
|
7986
11230
|
SvgIcon$1.default = SvgIcon$1.styles = void 0;
|
|
7987
11231
|
var _extends2$2 = _interopRequireDefault$8(_extends$1.exports);
|
|
7988
|
-
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$
|
|
11232
|
+
var _defineProperty2$1 = _interopRequireDefault$8(defineProperty$2.exports);
|
|
7989
11233
|
var _objectWithoutProperties2$2 = _interopRequireDefault$8(objectWithoutProperties.exports);
|
|
7990
11234
|
var _react$7 = _interopRequireDefault$8(require$$4$2);
|
|
7991
11235
|
var _propTypes$2 = _interopRequireDefault$8(require$$5$2);
|
|
@@ -8151,7 +11395,7 @@ Object.defineProperty(Checkbox$2, "__esModule", {
|
|
|
8151
11395
|
});
|
|
8152
11396
|
Checkbox$2.default = Checkbox$2.styles = void 0;
|
|
8153
11397
|
var _extends2$1 = _interopRequireDefault$4(_extends$1.exports);
|
|
8154
|
-
var _defineProperty2 = _interopRequireDefault$4(defineProperty$
|
|
11398
|
+
var _defineProperty2 = _interopRequireDefault$4(defineProperty$2.exports);
|
|
8155
11399
|
var _objectWithoutProperties2$1 = _interopRequireDefault$4(objectWithoutProperties.exports);
|
|
8156
11400
|
var _react$3 = _interopRequireDefault$4(require$$4$1);
|
|
8157
11401
|
var _propTypes$1 = _interopRequireDefault$4(require$$5$1);
|
|
@@ -9040,7 +12284,7 @@ const StyledCheckbox = styles$b.withStyles(inputStyles)(props => {
|
|
|
9040
12284
|
__self: undefined,
|
|
9041
12285
|
__source: {
|
|
9042
12286
|
fileName: _jsxFileName$3,
|
|
9043
|
-
lineNumber:
|
|
12287
|
+
lineNumber: 116
|
|
9044
12288
|
}
|
|
9045
12289
|
});
|
|
9046
12290
|
});
|
|
@@ -9072,7 +12316,7 @@ const StyledRadio = styles$b.withStyles(inputStyles)(props => {
|
|
|
9072
12316
|
__self: undefined,
|
|
9073
12317
|
__source: {
|
|
9074
12318
|
fileName: _jsxFileName$3,
|
|
9075
|
-
lineNumber:
|
|
12319
|
+
lineNumber: 144
|
|
9076
12320
|
}
|
|
9077
12321
|
});
|
|
9078
12322
|
});
|
|
@@ -9095,7 +12339,6 @@ class ChoiceInput extends React$4.Component {
|
|
|
9095
12339
|
hideTick: PropTypes$3.bool,
|
|
9096
12340
|
isEvaluateMode: PropTypes$3.bool,
|
|
9097
12341
|
choicesLayout: PropTypes$3.oneOf(['vertical', 'grid', 'horizontal']),
|
|
9098
|
-
updateSession: PropTypes$3.func,
|
|
9099
12342
|
isSelectionButtonBelow: PropTypes$3.bool
|
|
9100
12343
|
};
|
|
9101
12344
|
}
|
|
@@ -9114,10 +12357,6 @@ class ChoiceInput extends React$4.Component {
|
|
|
9114
12357
|
}
|
|
9115
12358
|
onToggleChoice(event) {
|
|
9116
12359
|
this.props.onChange(event);
|
|
9117
|
-
this.props.updateSession({
|
|
9118
|
-
value: this.props.value,
|
|
9119
|
-
selected: !this.props.checked
|
|
9120
|
-
});
|
|
9121
12360
|
}
|
|
9122
12361
|
generateChoiceId() {
|
|
9123
12362
|
return 'choice-' + (Math.random() * 10000).toFixed();
|
|
@@ -9136,7 +12375,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9136
12375
|
__self: this,
|
|
9137
12376
|
__source: {
|
|
9138
12377
|
fileName: _jsxFileName$3,
|
|
9139
|
-
lineNumber:
|
|
12378
|
+
lineNumber: 233
|
|
9140
12379
|
}
|
|
9141
12380
|
}, displayKey, ".", '\u00A0', React$4.createElement(PreviewPrompt$1, {
|
|
9142
12381
|
className: "label",
|
|
@@ -9145,7 +12384,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9145
12384
|
__self: this,
|
|
9146
12385
|
__source: {
|
|
9147
12386
|
fileName: _jsxFileName$3,
|
|
9148
|
-
lineNumber:
|
|
12387
|
+
lineNumber: 235
|
|
9149
12388
|
}
|
|
9150
12389
|
})) : React$4.createElement(PreviewPrompt$1, {
|
|
9151
12390
|
className: "label",
|
|
@@ -9154,7 +12393,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9154
12393
|
__self: this,
|
|
9155
12394
|
__source: {
|
|
9156
12395
|
fileName: _jsxFileName$3,
|
|
9157
|
-
lineNumber:
|
|
12396
|
+
lineNumber: 238
|
|
9158
12397
|
}
|
|
9159
12398
|
}));
|
|
9160
12399
|
return React$4.createElement('div', {
|
|
@@ -9162,28 +12401,28 @@ class ChoiceInput extends React$4.Component {
|
|
|
9162
12401
|
__self: this,
|
|
9163
12402
|
__source: {
|
|
9164
12403
|
fileName: _jsxFileName$3,
|
|
9165
|
-
lineNumber:
|
|
12404
|
+
lineNumber: 244
|
|
9166
12405
|
}
|
|
9167
12406
|
}, React$4.createElement('div', {
|
|
9168
12407
|
className: classes.row,
|
|
9169
12408
|
__self: this,
|
|
9170
12409
|
__source: {
|
|
9171
12410
|
fileName: _jsxFileName$3,
|
|
9172
|
-
lineNumber:
|
|
12411
|
+
lineNumber: 245
|
|
9173
12412
|
}
|
|
9174
12413
|
}, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
|
|
9175
12414
|
correctness: correctness,
|
|
9176
12415
|
__self: this,
|
|
9177
12416
|
__source: {
|
|
9178
12417
|
fileName: _jsxFileName$3,
|
|
9179
|
-
lineNumber:
|
|
12418
|
+
lineNumber: 246
|
|
9180
12419
|
}
|
|
9181
12420
|
}), React$4.createElement('div', {
|
|
9182
12421
|
className: classNames$2(holderClassNames, 'checkbox-holder'),
|
|
9183
12422
|
__self: this,
|
|
9184
12423
|
__source: {
|
|
9185
12424
|
fileName: _jsxFileName$3,
|
|
9186
|
-
lineNumber:
|
|
12425
|
+
lineNumber: 247
|
|
9187
12426
|
}
|
|
9188
12427
|
}, isSelectionButtonBelow ? React$4.createElement(StyledFormControlLabel, {
|
|
9189
12428
|
label: choicelabel,
|
|
@@ -9195,7 +12434,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9195
12434
|
__self: this,
|
|
9196
12435
|
__source: {
|
|
9197
12436
|
fileName: _jsxFileName$3,
|
|
9198
|
-
lineNumber:
|
|
12437
|
+
lineNumber: 255
|
|
9199
12438
|
}
|
|
9200
12439
|
}, React$4.createElement(Tag, {
|
|
9201
12440
|
accessibility: accessibility,
|
|
@@ -9211,13 +12450,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
9211
12450
|
__self: this,
|
|
9212
12451
|
__source: {
|
|
9213
12452
|
fileName: _jsxFileName$3,
|
|
9214
|
-
lineNumber:
|
|
12453
|
+
lineNumber: 256
|
|
9215
12454
|
}
|
|
9216
12455
|
}), displayKey, "."),
|
|
9217
12456
|
__self: this,
|
|
9218
12457
|
__source: {
|
|
9219
12458
|
fileName: _jsxFileName$3,
|
|
9220
|
-
lineNumber:
|
|
12459
|
+
lineNumber: 249
|
|
9221
12460
|
}
|
|
9222
12461
|
}) : React$4.createElement(StyledFormControlLabel, {
|
|
9223
12462
|
label: choicelabel,
|
|
@@ -9234,13 +12473,13 @@ class ChoiceInput extends React$4.Component {
|
|
|
9234
12473
|
__self: this,
|
|
9235
12474
|
__source: {
|
|
9236
12475
|
fileName: _jsxFileName$3,
|
|
9237
|
-
lineNumber:
|
|
12476
|
+
lineNumber: 276
|
|
9238
12477
|
}
|
|
9239
12478
|
}),
|
|
9240
12479
|
__self: this,
|
|
9241
12480
|
__source: {
|
|
9242
12481
|
fileName: _jsxFileName$3,
|
|
9243
|
-
lineNumber:
|
|
12482
|
+
lineNumber: 271
|
|
9244
12483
|
}
|
|
9245
12484
|
}))), rationale && React$4.createElement(PreviewPrompt$1, {
|
|
9246
12485
|
className: "rationale",
|
|
@@ -9249,7 +12488,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9249
12488
|
__self: this,
|
|
9250
12489
|
__source: {
|
|
9251
12490
|
fileName: _jsxFileName$3,
|
|
9252
|
-
lineNumber:
|
|
12491
|
+
lineNumber: 290
|
|
9253
12492
|
}
|
|
9254
12493
|
}), React$4.createElement(Feedback, {
|
|
9255
12494
|
feedback: feedback,
|
|
@@ -9257,7 +12496,7 @@ class ChoiceInput extends React$4.Component {
|
|
|
9257
12496
|
__self: this,
|
|
9258
12497
|
__source: {
|
|
9259
12498
|
fileName: _jsxFileName$3,
|
|
9260
|
-
lineNumber:
|
|
12499
|
+
lineNumber: 291
|
|
9261
12500
|
}
|
|
9262
12501
|
}));
|
|
9263
12502
|
}
|
|
@@ -9275,9 +12514,7 @@ class Choice extends React$3.Component {
|
|
|
9275
12514
|
Choice.prototype.__init.call(this);
|
|
9276
12515
|
}
|
|
9277
12516
|
static __initStatic() {
|
|
9278
|
-
this.propTypes = {
|
|
9279
|
-
updateSession: PropTypes$2.func
|
|
9280
|
-
};
|
|
12517
|
+
this.propTypes = {};
|
|
9281
12518
|
}
|
|
9282
12519
|
__init() {
|
|
9283
12520
|
this.onChange = choice => {
|
|
@@ -9288,7 +12525,7 @@ class Choice extends React$3.Component {
|
|
|
9288
12525
|
};
|
|
9289
12526
|
}
|
|
9290
12527
|
render() {
|
|
9291
|
-
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns,
|
|
12528
|
+
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow, selectedAnswerBackgroundColor} = this.props;
|
|
9292
12529
|
const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
|
|
9293
12530
|
const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
|
|
9294
12531
|
const choiceProps = {
|
|
@@ -9302,7 +12539,6 @@ class Choice extends React$3.Component {
|
|
|
9302
12539
|
index,
|
|
9303
12540
|
choicesLayout,
|
|
9304
12541
|
gridColumns,
|
|
9305
|
-
updateSession,
|
|
9306
12542
|
onChange: this.onChange,
|
|
9307
12543
|
isEvaluateMode,
|
|
9308
12544
|
isSelectionButtonBelow
|
|
@@ -9311,13 +12547,17 @@ class Choice extends React$3.Component {
|
|
|
9311
12547
|
[classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
|
|
9312
12548
|
[classes.horizontalLayout]: choicesLayout === 'horizontal'
|
|
9313
12549
|
});
|
|
12550
|
+
const choiceBackground = selectedAnswerBackgroundColor && checked ? selectedAnswerBackgroundColor : 'initial';
|
|
9314
12551
|
return React$3.createElement('div', {
|
|
9315
12552
|
className: choiceClass,
|
|
9316
12553
|
key: index,
|
|
12554
|
+
style: {
|
|
12555
|
+
backgroundColor: choiceBackground
|
|
12556
|
+
},
|
|
9317
12557
|
__self: this,
|
|
9318
12558
|
__source: {
|
|
9319
12559
|
fileName: _jsxFileName$2,
|
|
9320
|
-
lineNumber:
|
|
12560
|
+
lineNumber: 65
|
|
9321
12561
|
}
|
|
9322
12562
|
}, React$3.createElement(ChoiceInput$1, {
|
|
9323
12563
|
...choiceProps,
|
|
@@ -9325,7 +12565,7 @@ class Choice extends React$3.Component {
|
|
|
9325
12565
|
__self: this,
|
|
9326
12566
|
__source: {
|
|
9327
12567
|
fileName: _jsxFileName$2,
|
|
9328
|
-
lineNumber:
|
|
12568
|
+
lineNumber: 66
|
|
9329
12569
|
}
|
|
9330
12570
|
}));
|
|
9331
12571
|
}
|
|
@@ -9346,12 +12586,15 @@ Choice.propTypes = {
|
|
|
9346
12586
|
displayKey: PropTypes$2.string,
|
|
9347
12587
|
choicesLayout: PropTypes$2.oneOf(['vertical', 'grid', 'horizontal']),
|
|
9348
12588
|
gridColumns: PropTypes$2.string,
|
|
12589
|
+
selectedAnswerBackgroundColor: PropTypes$2.string,
|
|
9349
12590
|
isSelectionButtonBelow: PropTypes$2.bool
|
|
9350
12591
|
};
|
|
9351
12592
|
var StyledChoice = styles$b.withStyles(theme => ({
|
|
9352
12593
|
choice: {
|
|
9353
12594
|
paddingTop: theme.spacing.unit * 2.5,
|
|
9354
12595
|
paddingBottom: theme.spacing.unit + 2,
|
|
12596
|
+
paddingLeft: theme.spacing.unit + 2,
|
|
12597
|
+
paddingRight: theme.spacing.unit + 2,
|
|
9355
12598
|
borderBottom: `1px solid ${theme.palette.grey[300]}`
|
|
9356
12599
|
},
|
|
9357
12600
|
noBorder: {
|
|
@@ -9372,6 +12615,7 @@ const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
|
9372
12615
|
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
9373
12616
|
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
9374
12617
|
const _jsxFileName$1 = "/home/circleci/repo/packages/multiple-choice/src/multiple-choice.jsx";
|
|
12618
|
+
const {translator} = Translator;
|
|
9375
12619
|
const styles$1 = theme => ({
|
|
9376
12620
|
main: {
|
|
9377
12621
|
color: color.text(),
|
|
@@ -9411,6 +12655,11 @@ const styles$1 = theme => ({
|
|
|
9411
12655
|
width: '1px',
|
|
9412
12656
|
height: '1px',
|
|
9413
12657
|
overflow: 'hidden'
|
|
12658
|
+
},
|
|
12659
|
+
errorText: {
|
|
12660
|
+
fontSize: theme.typography.fontSize - 2,
|
|
12661
|
+
color: theme.palette.error.main,
|
|
12662
|
+
paddingTop: theme.spacing.unit
|
|
9414
12663
|
}
|
|
9415
12664
|
});
|
|
9416
12665
|
class MultipleChoice$1 extends React$2.Component {
|
|
@@ -9435,8 +12684,11 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9435
12684
|
alwaysShowCorrect: PropTypes$1.bool,
|
|
9436
12685
|
animationsDisabled: PropTypes$1.bool,
|
|
9437
12686
|
language: PropTypes$1.string,
|
|
12687
|
+
selectedAnswerBackgroundColor: PropTypes$1.string,
|
|
9438
12688
|
onShowCorrectToggle: PropTypes$1.func,
|
|
9439
|
-
isSelectionButtonBelow: PropTypes$1.bool
|
|
12689
|
+
isSelectionButtonBelow: PropTypes$1.bool,
|
|
12690
|
+
minSelections: PropTypes$1.number,
|
|
12691
|
+
maxSelections: PropTypes$1.number
|
|
9440
12692
|
};
|
|
9441
12693
|
}
|
|
9442
12694
|
constructor(props) {
|
|
@@ -9444,7 +12696,6 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9444
12696
|
MultipleChoice$1.prototype.__init.call(this);
|
|
9445
12697
|
MultipleChoice$1.prototype.__init2.call(this);
|
|
9446
12698
|
MultipleChoice$1.prototype.__init3.call(this);
|
|
9447
|
-
MultipleChoice$1.prototype.__init4.call(this);
|
|
9448
12699
|
this.state = {
|
|
9449
12700
|
selectedValue: null,
|
|
9450
12701
|
selectedValues: [],
|
|
@@ -9458,29 +12709,31 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9458
12709
|
}
|
|
9459
12710
|
__init() {
|
|
9460
12711
|
this.handleChange = event => {
|
|
9461
|
-
const target = event.target;
|
|
9462
|
-
this.setState({
|
|
9463
|
-
selectedValue: target.value
|
|
9464
|
-
});
|
|
9465
|
-
};
|
|
9466
|
-
}
|
|
9467
|
-
__init2() {
|
|
9468
|
-
this.handleChangeCheckboxes = event => {
|
|
9469
12712
|
const {value, checked} = event.target;
|
|
9470
|
-
this.
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
}
|
|
9475
|
-
|
|
12713
|
+
const {choiceMode, maxSelections, onChoiceChanged} = this.props;
|
|
12714
|
+
if (choiceMode === 'radio') {
|
|
12715
|
+
this.setState({
|
|
12716
|
+
selectedValue: value
|
|
12717
|
+
});
|
|
12718
|
+
} else {
|
|
12719
|
+
const {selectedValues} = this.state;
|
|
12720
|
+
if (checked && selectedValues.length >= maxSelections) {
|
|
12721
|
+
return;
|
|
9476
12722
|
}
|
|
9477
|
-
|
|
9478
|
-
selectedValues
|
|
9479
|
-
|
|
12723
|
+
this.setState(prevState => {
|
|
12724
|
+
const selectedValues = checked ? [...prevState.selectedValues, value] : prevState.selectedValues.filter(currentValue => currentValue !== value);
|
|
12725
|
+
return {
|
|
12726
|
+
selectedValues
|
|
12727
|
+
};
|
|
12728
|
+
});
|
|
12729
|
+
}
|
|
12730
|
+
onChoiceChanged({
|
|
12731
|
+
value,
|
|
12732
|
+
selected: checked
|
|
9480
12733
|
});
|
|
9481
12734
|
};
|
|
9482
12735
|
}
|
|
9483
|
-
|
|
12736
|
+
__init2() {
|
|
9484
12737
|
this.onToggle = () => {
|
|
9485
12738
|
if (this.props.mode === 'evaluate') {
|
|
9486
12739
|
this.setState({
|
|
@@ -9522,7 +12775,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9522
12775
|
}
|
|
9523
12776
|
return '';
|
|
9524
12777
|
}
|
|
9525
|
-
|
|
12778
|
+
__init3() {
|
|
9526
12779
|
this.getCorrectness = (choice = {}) => {
|
|
9527
12780
|
const isCorrect = choice.correct;
|
|
9528
12781
|
const isChecked = this.isSelected(choice.value);
|
|
@@ -9563,25 +12816,26 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9563
12816
|
__self: this,
|
|
9564
12817
|
__source: {
|
|
9565
12818
|
fileName: _jsxFileName$1,
|
|
9566
|
-
lineNumber:
|
|
12819
|
+
lineNumber: 225
|
|
9567
12820
|
}
|
|
9568
12821
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
9569
12822
|
className: classes.srOnly,
|
|
9570
12823
|
__self: this,
|
|
9571
12824
|
__source: {
|
|
9572
12825
|
fileName: _jsxFileName$1,
|
|
9573
|
-
lineNumber:
|
|
12826
|
+
lineNumber: 227
|
|
9574
12827
|
}
|
|
9575
12828
|
}, "Multiple Select Question");
|
|
9576
12829
|
}
|
|
9577
12830
|
render() {
|
|
9578
|
-
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt,
|
|
12831
|
+
const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, session} = this.props;
|
|
9579
12832
|
const {showCorrect} = this.state;
|
|
9580
12833
|
const isEvaluateMode = mode === 'evaluate';
|
|
9581
12834
|
const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
9582
12835
|
const columnsStyle = gridColumns > 1 ? {
|
|
9583
12836
|
gridTemplateColumns: `repeat(${gridColumns}, 1fr)`
|
|
9584
12837
|
} : undefined;
|
|
12838
|
+
const selections = session.value && session.value.length || 0;
|
|
9585
12839
|
const teacherInstructionsDiv = React$2.createElement(PreviewPrompt, {
|
|
9586
12840
|
tagName: "div",
|
|
9587
12841
|
className: "prompt",
|
|
@@ -9590,7 +12844,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9590
12844
|
__self: this,
|
|
9591
12845
|
__source: {
|
|
9592
12846
|
fileName: _jsxFileName$1,
|
|
9593
|
-
lineNumber:
|
|
12847
|
+
lineNumber: 259
|
|
9594
12848
|
}
|
|
9595
12849
|
});
|
|
9596
12850
|
return React$2.createElement('div', {
|
|
@@ -9598,21 +12852,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9598
12852
|
__self: this,
|
|
9599
12853
|
__source: {
|
|
9600
12854
|
fileName: _jsxFileName$1,
|
|
9601
|
-
lineNumber:
|
|
12855
|
+
lineNumber: 268
|
|
9602
12856
|
}
|
|
9603
12857
|
}, partLabel && React$2.createElement('h3', {
|
|
9604
12858
|
className: classes.partLabel,
|
|
9605
12859
|
__self: this,
|
|
9606
12860
|
__source: {
|
|
9607
12861
|
fileName: _jsxFileName$1,
|
|
9608
|
-
lineNumber:
|
|
12862
|
+
lineNumber: 269
|
|
9609
12863
|
}
|
|
9610
12864
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
9611
12865
|
className: classes.teacherInstructions,
|
|
9612
12866
|
__self: this,
|
|
9613
12867
|
__source: {
|
|
9614
12868
|
fileName: _jsxFileName$1,
|
|
9615
|
-
lineNumber:
|
|
12869
|
+
lineNumber: 274
|
|
9616
12870
|
}
|
|
9617
12871
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
9618
12872
|
labels: {
|
|
@@ -9622,14 +12876,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9622
12876
|
__self: this,
|
|
9623
12877
|
__source: {
|
|
9624
12878
|
fileName: _jsxFileName$1,
|
|
9625
|
-
lineNumber:
|
|
12879
|
+
lineNumber: 276
|
|
9626
12880
|
}
|
|
9627
12881
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
9628
12882
|
className: classes.fieldset,
|
|
9629
12883
|
__self: this,
|
|
9630
12884
|
__source: {
|
|
9631
12885
|
fileName: _jsxFileName$1,
|
|
9632
|
-
lineNumber:
|
|
12886
|
+
lineNumber: 290
|
|
9633
12887
|
}
|
|
9634
12888
|
}, React$2.createElement(PreviewPrompt, {
|
|
9635
12889
|
className: "prompt",
|
|
@@ -9639,7 +12893,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9639
12893
|
__self: this,
|
|
9640
12894
|
__source: {
|
|
9641
12895
|
fileName: _jsxFileName$1,
|
|
9642
|
-
lineNumber:
|
|
12896
|
+
lineNumber: 291
|
|
9643
12897
|
}
|
|
9644
12898
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
9645
12899
|
show: showCorrectAnswerToggle,
|
|
@@ -9649,7 +12903,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9649
12903
|
__self: this,
|
|
9650
12904
|
__source: {
|
|
9651
12905
|
fileName: _jsxFileName$1,
|
|
9652
|
-
lineNumber:
|
|
12906
|
+
lineNumber: 294
|
|
9653
12907
|
}
|
|
9654
12908
|
}), React$2.createElement('div', {
|
|
9655
12909
|
className: classNames({
|
|
@@ -9660,10 +12914,11 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9660
12914
|
__self: this,
|
|
9661
12915
|
__source: {
|
|
9662
12916
|
fileName: _jsxFileName$1,
|
|
9663
|
-
lineNumber:
|
|
12917
|
+
lineNumber: 302
|
|
9664
12918
|
}
|
|
9665
12919
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
9666
12920
|
choicesLayout: this.props.choicesLayout,
|
|
12921
|
+
selectedAnswerBackgroundColor: this.props.selectedAnswerBackgroundColor,
|
|
9667
12922
|
gridColumns: gridColumns,
|
|
9668
12923
|
key: `choice-${index}`,
|
|
9669
12924
|
choice: choice,
|
|
@@ -9673,8 +12928,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9673
12928
|
isEvaluateMode: isEvaluateMode,
|
|
9674
12929
|
choiceMode: choiceMode,
|
|
9675
12930
|
disabled: disabled,
|
|
9676
|
-
|
|
9677
|
-
onChoiceChanged: this.props.choiceMode === 'radio' ? this.handleChange : this.handleChangeCheckboxes,
|
|
12931
|
+
onChoiceChanged: this.handleChange,
|
|
9678
12932
|
hideTick: choice.hideTick,
|
|
9679
12933
|
checked: this.getChecked(choice),
|
|
9680
12934
|
correctness: isEvaluateMode ? this.getCorrectness(choice) : undefined,
|
|
@@ -9683,9 +12937,29 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
9683
12937
|
__self: this,
|
|
9684
12938
|
__source: {
|
|
9685
12939
|
fileName: _jsxFileName$1,
|
|
9686
|
-
lineNumber:
|
|
12940
|
+
lineNumber: 310
|
|
12941
|
+
}
|
|
12942
|
+
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12943
|
+
className: classes.errorText,
|
|
12944
|
+
__self: this,
|
|
12945
|
+
__source: {
|
|
12946
|
+
fileName: _jsxFileName$1,
|
|
12947
|
+
lineNumber: 334
|
|
12948
|
+
}
|
|
12949
|
+
}, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
|
|
12950
|
+
lng: language,
|
|
12951
|
+
minSelections
|
|
12952
|
+
})), choiceMode === 'checkbox' && selections >= maxSelections && React$2.createElement('div', {
|
|
12953
|
+
className: classes.errorText,
|
|
12954
|
+
__self: this,
|
|
12955
|
+
__source: {
|
|
12956
|
+
fileName: _jsxFileName$1,
|
|
12957
|
+
lineNumber: 342
|
|
9687
12958
|
}
|
|
9688
|
-
}
|
|
12959
|
+
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12960
|
+
lng: language,
|
|
12961
|
+
maxSelections
|
|
12962
|
+
})));
|
|
9689
12963
|
}
|
|
9690
12964
|
}
|
|
9691
12965
|
MultipleChoice$1.__initStatic();
|
|
@@ -9798,7 +13072,20 @@ const {debounce: debounce} = _dll_lodash;
|
|
|
9798
13072
|
const debug$1 = _dll_debug;
|
|
9799
13073
|
const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering_accessible;
|
|
9800
13074
|
const log$1 = debug$1('pie-ui:multiple-choice');
|
|
9801
|
-
const isComplete =
|
|
13075
|
+
const isComplete = (session, model) => {
|
|
13076
|
+
if (!session || !session.value) {
|
|
13077
|
+
return false;
|
|
13078
|
+
}
|
|
13079
|
+
const {choiceMode, minSelections, maxSelections} = model || ({});
|
|
13080
|
+
const selections = session.value.length || 0;
|
|
13081
|
+
if (choiceMode === 'radio') {
|
|
13082
|
+
return !!selections;
|
|
13083
|
+
}
|
|
13084
|
+
if (selections < minSelections || selections > maxSelections) {
|
|
13085
|
+
return false;
|
|
13086
|
+
}
|
|
13087
|
+
return true;
|
|
13088
|
+
};
|
|
9802
13089
|
class MultipleChoice extends HTMLElement {
|
|
9803
13090
|
constructor() {
|
|
9804
13091
|
super();
|
|
@@ -9831,7 +13118,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
9831
13118
|
bubbles: true,
|
|
9832
13119
|
composed: true,
|
|
9833
13120
|
detail: {
|
|
9834
|
-
complete: isComplete(this._session),
|
|
13121
|
+
complete: isComplete(this._session, this._model),
|
|
9835
13122
|
component: this.tagName.toLowerCase()
|
|
9836
13123
|
}
|
|
9837
13124
|
});
|
|
@@ -9842,7 +13129,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
9842
13129
|
bubbles: true,
|
|
9843
13130
|
composed: true,
|
|
9844
13131
|
detail: {
|
|
9845
|
-
complete: isComplete(this._session),
|
|
13132
|
+
complete: isComplete(this._session, this._model),
|
|
9846
13133
|
component: this.tagName.toLowerCase(),
|
|
9847
13134
|
hasModel: this._model !== undefined
|
|
9848
13135
|
}
|