locize 2.4.6 → 3.0.1
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/.babelrc +3 -0
- package/.ts.eslintrc +37 -0
- package/CHANGELOG.md +9 -0
- package/README.md +10 -19
- package/dist/cjs/api/handleCommitKey.js +17 -0
- package/dist/cjs/api/handleCommitKeys.js +39 -0
- package/dist/cjs/api/handleConfirmInitialized.js +11 -0
- package/dist/cjs/api/handleEditKey.js +60 -0
- package/dist/cjs/api/handleIsLocizeEnabled.js +11 -0
- package/dist/cjs/api/handleRequestPopupChanges.js +21 -0
- package/dist/cjs/api/handleRequestResourceBundle.js +27 -0
- package/dist/cjs/api/handleSelectedKeys.js +27 -0
- package/dist/cjs/api/handleTurnOff.js +8 -0
- package/dist/cjs/api/handleTurnOn.js +8 -0
- package/dist/cjs/api/postMessage.js +161 -0
- package/dist/cjs/clickHandler.js +48 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.js +55 -0
- package/dist/cjs/locizePlugin.js +110 -0
- package/dist/cjs/observer.js +74 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/parser.js +122 -0
- package/dist/cjs/process.js +69 -0
- package/dist/cjs/processLegacy.js +80 -0
- package/dist/cjs/shims/uniqueID.js +31 -0
- package/dist/cjs/startStandalone.js +24 -0
- package/dist/cjs/store.js +49 -0
- package/dist/cjs/ui/elements/icons.js +48 -0
- package/dist/cjs/ui/elements/popup.js +80 -0
- package/dist/cjs/ui/elements/ribbonBox.js +67 -0
- package/dist/cjs/ui/highlightNode.js +167 -0
- package/dist/cjs/ui/mouseDistance.js +44 -0
- package/dist/cjs/ui/popup.js +113 -0
- package/dist/cjs/ui/stylesheet.js +12 -0
- package/dist/cjs/ui/utils.js +39 -0
- package/dist/cjs/uninstrumentedStore.js +43 -0
- package/dist/cjs/utils.js +138 -0
- package/dist/cjs/vars.js +22 -0
- package/dist/esm/api/handleCommitKey.js +15 -0
- package/dist/esm/api/handleCommitKeys.js +33 -0
- package/dist/esm/api/handleConfirmInitialized.js +9 -0
- package/dist/esm/api/handleEditKey.js +56 -0
- package/dist/esm/api/handleIsLocizeEnabled.js +9 -0
- package/dist/esm/api/handleRequestPopupChanges.js +19 -0
- package/dist/esm/api/handleRequestResourceBundle.js +20 -0
- package/dist/esm/api/handleSelectedKeys.js +25 -0
- package/dist/esm/api/handleTurnOff.js +6 -0
- package/dist/esm/api/handleTurnOn.js +6 -0
- package/dist/esm/api/postMessage.js +148 -0
- package/dist/esm/clickHandler.js +44 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.js +33 -0
- package/dist/esm/locizePlugin.js +99 -0
- package/dist/esm/observer.js +70 -0
- package/dist/esm/parser.js +113 -0
- package/dist/esm/process.js +61 -0
- package/dist/esm/processLegacy.js +72 -0
- package/dist/esm/shims/uniqueID.js +29 -0
- package/dist/esm/startStandalone.js +20 -0
- package/dist/esm/store.js +41 -0
- package/dist/esm/ui/elements/icons.js +39 -0
- package/dist/esm/ui/elements/popup.js +76 -0
- package/dist/esm/ui/elements/ribbonBox.js +62 -0
- package/dist/esm/ui/highlightNode.js +156 -0
- package/dist/esm/ui/mouseDistance.js +39 -0
- package/dist/esm/ui/popup.js +108 -0
- package/dist/esm/ui/stylesheet.js +8 -0
- package/dist/esm/ui/utils.js +34 -0
- package/dist/esm/uninstrumentedStore.js +35 -0
- package/dist/esm/utils.js +123 -0
- package/dist/esm/vars.js +16 -0
- package/dist/umd/locize.js +2796 -286
- package/dist/umd/locize.min.js +1 -1
- package/index.d.mts +1 -0
- package/index.d.ts +5 -6
- package/index.js +4 -4
- package/locize.js +2796 -286
- package/locize.min.js +1 -1
- package/package.json +64 -31
- package/rollup.config.js +62 -29
- package/src/api/handleCommitKey.js +17 -0
- package/src/api/handleCommitKeys.js +39 -0
- package/src/api/handleConfirmInitialized.js +10 -0
- package/src/api/handleEditKey.js +81 -0
- package/src/api/handleIsLocizeEnabled.js +13 -0
- package/src/api/handleRequestPopupChanges.js +25 -0
- package/src/api/handleRequestResourceBundle.js +11 -0
- package/src/api/handleSelectedKeys.js +32 -0
- package/src/api/handleTurnOff.js +8 -0
- package/src/api/handleTurnOn.js +8 -0
- package/src/api/index.js +19 -0
- package/src/api/postMessage.js +169 -0
- package/src/clickHandler.js +48 -0
- package/src/index.js +30 -0
- package/src/locizePlugin.js +117 -0
- package/src/observer.js +93 -0
- package/src/parser.js +162 -0
- package/src/process.js +62 -0
- package/src/processLegacy.js +69 -0
- package/src/shims/uniqueID.js +49 -0
- package/src/startStandalone.js +19 -0
- package/src/store.js +47 -0
- package/src/ui/elements/icons.js +92 -0
- package/src/ui/elements/popup.js +226 -0
- package/src/ui/elements/ribbonBox.js +76 -0
- package/src/ui/highlightNode.js +203 -0
- package/src/ui/mouseDistance.js +46 -0
- package/src/ui/popup.js +135 -0
- package/src/ui/stylesheet.js +8 -0
- package/src/ui/utils.js +37 -0
- package/src/uninstrumentedStore.js +39 -0
- package/src/utils.js +158 -0
- package/src/vars.js +18 -0
- package/tsconfig.json +4 -4
- package/.eslintrc.js +0 -20
- package/debuggingApp/README.md +0 -11
- package/debuggingApp/debugEditor.html +0 -28
- package/debuggingApp/index.html +0 -151
- package/debuggingApp/node_modules/.package-lock.json +0 -668
- package/debuggingApp/node_modules/@babel/runtime/LICENSE +0 -22
- package/debuggingApp/node_modules/@babel/runtime/README.md +0 -19
- package/debuggingApp/node_modules/@babel/runtime/helpers/AsyncGenerator.js +0 -98
- package/debuggingApp/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +0 -30
- package/debuggingApp/node_modules/@babel/runtime/helpers/applyDecs.js +0 -284
- package/debuggingApp/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/assertThisInitialized.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +0 -56
- package/debuggingApp/node_modules/@babel/runtime/helpers/asyncIterator.js +0 -50
- package/debuggingApp/node_modules/@babel/runtime/helpers/asyncToGenerator.js +0 -37
- package/debuggingApp/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -22
- package/debuggingApp/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/classNameTDZError.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -10
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -10
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -14
- package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/construct.js +0 -22
- package/debuggingApp/node_modules/@babel/runtime/helpers/createClass.js +0 -20
- package/debuggingApp/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +0 -60
- package/debuggingApp/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +0 -24
- package/debuggingApp/node_modules/@babel/runtime/helpers/createSuper.js +0 -24
- package/debuggingApp/node_modules/@babel/runtime/helpers/decorate.js +0 -400
- package/debuggingApp/node_modules/@babel/runtime/helpers/defaults.js +0 -16
- package/debuggingApp/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -24
- package/debuggingApp/node_modules/@babel/runtime/helpers/defineProperty.js +0 -16
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +0 -95
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -28
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/applyDecs.js +0 -282
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -4
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -54
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +0 -48
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -35
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +0 -4
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -20
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -6
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -6
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -4
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/construct.js +0 -18
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -18
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +0 -57
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -21
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -19
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -396
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/defaults.js +0 -14
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -22
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -14
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/extends.js +0 -16
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/get.js +0 -20
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -6
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/identity.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -18
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -6
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/instanceof.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +0 -51
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -12
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -29
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +0 -14
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/jsx.js +0 -26
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -19
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -27
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -19
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -14
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/package.json +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +0 -352
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/set.js +0 -51
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/superPropBase.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/tdz.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/temporalRef.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +0 -1
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -6
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +0 -6
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +0 -37
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +0 -50
- package/debuggingApp/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/extends.js +0 -18
- package/debuggingApp/node_modules/@babel/runtime/helpers/get.js +0 -23
- package/debuggingApp/node_modules/@babel/runtime/helpers/getPrototypeOf.js +0 -8
- package/debuggingApp/node_modules/@babel/runtime/helpers/identity.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/inherits.js +0 -21
- package/debuggingApp/node_modules/@babel/runtime/helpers/inheritsLoose.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/instanceof.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +0 -53
- package/debuggingApp/node_modules/@babel/runtime/helpers/isNativeFunction.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +0 -14
- package/debuggingApp/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -31
- package/debuggingApp/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +0 -16
- package/debuggingApp/node_modules/@babel/runtime/helpers/jsx.js +0 -29
- package/debuggingApp/node_modules/@babel/runtime/helpers/maybeArrayLike.js +0 -12
- package/debuggingApp/node_modules/@babel/runtime/helpers/newArrowCheck.js +0 -7
- package/debuggingApp/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/objectSpread.js +0 -22
- package/debuggingApp/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -29
- package/debuggingApp/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -22
- package/debuggingApp/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -16
- package/debuggingApp/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +0 -15
- package/debuggingApp/node_modules/@babel/runtime/helpers/readOnlyError.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -354
- package/debuggingApp/node_modules/@babel/runtime/helpers/set.js +0 -54
- package/debuggingApp/node_modules/@babel/runtime/helpers/setPrototypeOf.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/superPropBase.js +0 -12
- package/debuggingApp/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +0 -10
- package/debuggingApp/node_modules/@babel/runtime/helpers/tdz.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/helpers/temporalRef.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/temporalUndefined.js +0 -3
- package/debuggingApp/node_modules/@babel/runtime/helpers/toArray.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -13
- package/debuggingApp/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -16
- package/debuggingApp/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -10
- package/debuggingApp/node_modules/@babel/runtime/helpers/typeof.js +0 -11
- package/debuggingApp/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -12
- package/debuggingApp/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +0 -9
- package/debuggingApp/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +0 -42
- package/debuggingApp/node_modules/@babel/runtime/helpers/wrapRegExp.js +0 -55
- package/debuggingApp/node_modules/@babel/runtime/helpers/writeOnlyError.js +0 -5
- package/debuggingApp/node_modules/@babel/runtime/package.json +0 -876
- package/debuggingApp/node_modules/@babel/runtime/regenerator/index.js +0 -15
- package/debuggingApp/node_modules/accepts/HISTORY.md +0 -243
- package/debuggingApp/node_modules/accepts/LICENSE +0 -23
- package/debuggingApp/node_modules/accepts/README.md +0 -140
- package/debuggingApp/node_modules/accepts/index.js +0 -238
- package/debuggingApp/node_modules/accepts/package.json +0 -47
- package/debuggingApp/node_modules/array-flatten/LICENSE +0 -21
- package/debuggingApp/node_modules/array-flatten/README.md +0 -43
- package/debuggingApp/node_modules/array-flatten/array-flatten.js +0 -64
- package/debuggingApp/node_modules/array-flatten/package.json +0 -39
- package/debuggingApp/node_modules/body-parser/HISTORY.md +0 -651
- package/debuggingApp/node_modules/body-parser/LICENSE +0 -23
- package/debuggingApp/node_modules/body-parser/README.md +0 -464
- package/debuggingApp/node_modules/body-parser/SECURITY.md +0 -25
- package/debuggingApp/node_modules/body-parser/index.js +0 -157
- package/debuggingApp/node_modules/body-parser/lib/read.js +0 -205
- package/debuggingApp/node_modules/body-parser/lib/types/json.js +0 -236
- package/debuggingApp/node_modules/body-parser/lib/types/raw.js +0 -101
- package/debuggingApp/node_modules/body-parser/lib/types/text.js +0 -121
- package/debuggingApp/node_modules/body-parser/lib/types/urlencoded.js +0 -284
- package/debuggingApp/node_modules/body-parser/package.json +0 -56
- package/debuggingApp/node_modules/bytes/History.md +0 -97
- package/debuggingApp/node_modules/bytes/LICENSE +0 -23
- package/debuggingApp/node_modules/bytes/Readme.md +0 -152
- package/debuggingApp/node_modules/bytes/index.js +0 -170
- package/debuggingApp/node_modules/bytes/package.json +0 -42
- package/debuggingApp/node_modules/call-bind/.github/FUNDING.yml +0 -12
- package/debuggingApp/node_modules/call-bind/.nycrc +0 -13
- package/debuggingApp/node_modules/call-bind/CHANGELOG.md +0 -42
- package/debuggingApp/node_modules/call-bind/LICENSE +0 -21
- package/debuggingApp/node_modules/call-bind/README.md +0 -2
- package/debuggingApp/node_modules/call-bind/callBound.js +0 -15
- package/debuggingApp/node_modules/call-bind/index.js +0 -47
- package/debuggingApp/node_modules/call-bind/package.json +0 -80
- package/debuggingApp/node_modules/call-bind/test/callBound.js +0 -55
- package/debuggingApp/node_modules/call-bind/test/index.js +0 -66
- package/debuggingApp/node_modules/content-disposition/HISTORY.md +0 -60
- package/debuggingApp/node_modules/content-disposition/LICENSE +0 -22
- package/debuggingApp/node_modules/content-disposition/README.md +0 -142
- package/debuggingApp/node_modules/content-disposition/index.js +0 -458
- package/debuggingApp/node_modules/content-disposition/package.json +0 -44
- package/debuggingApp/node_modules/content-type/HISTORY.md +0 -24
- package/debuggingApp/node_modules/content-type/LICENSE +0 -22
- package/debuggingApp/node_modules/content-type/README.md +0 -92
- package/debuggingApp/node_modules/content-type/index.js +0 -222
- package/debuggingApp/node_modules/content-type/package.json +0 -40
- package/debuggingApp/node_modules/cookie/HISTORY.md +0 -142
- package/debuggingApp/node_modules/cookie/LICENSE +0 -24
- package/debuggingApp/node_modules/cookie/README.md +0 -302
- package/debuggingApp/node_modules/cookie/SECURITY.md +0 -25
- package/debuggingApp/node_modules/cookie/index.js +0 -270
- package/debuggingApp/node_modules/cookie/package.json +0 -44
- package/debuggingApp/node_modules/cookie-signature/History.md +0 -38
- package/debuggingApp/node_modules/cookie-signature/Readme.md +0 -42
- package/debuggingApp/node_modules/cookie-signature/index.js +0 -51
- package/debuggingApp/node_modules/cookie-signature/package.json +0 -18
- package/debuggingApp/node_modules/cookies/History.md +0 -62
- package/debuggingApp/node_modules/cookies/LICENSE.txt +0 -22
- package/debuggingApp/node_modules/cookies/README.md +0 -121
- package/debuggingApp/node_modules/cookies/lib/cookies.js +0 -181
- package/debuggingApp/node_modules/cookies/package.json +0 -24
- package/debuggingApp/node_modules/debug/.coveralls.yml +0 -1
- package/debuggingApp/node_modules/debug/.travis.yml +0 -14
- package/debuggingApp/node_modules/debug/CHANGELOG.md +0 -362
- package/debuggingApp/node_modules/debug/LICENSE +0 -19
- package/debuggingApp/node_modules/debug/Makefile +0 -50
- package/debuggingApp/node_modules/debug/README.md +0 -312
- package/debuggingApp/node_modules/debug/component.json +0 -19
- package/debuggingApp/node_modules/debug/node.js +0 -1
- package/debuggingApp/node_modules/debug/package.json +0 -49
- package/debuggingApp/node_modules/debug/src/browser.js +0 -185
- package/debuggingApp/node_modules/debug/src/debug.js +0 -202
- package/debuggingApp/node_modules/debug/src/index.js +0 -10
- package/debuggingApp/node_modules/debug/src/inspector-log.js +0 -15
- package/debuggingApp/node_modules/debug/src/node.js +0 -248
- package/debuggingApp/node_modules/depd/History.md +0 -103
- package/debuggingApp/node_modules/depd/LICENSE +0 -22
- package/debuggingApp/node_modules/depd/Readme.md +0 -280
- package/debuggingApp/node_modules/depd/index.js +0 -538
- package/debuggingApp/node_modules/depd/lib/browser/index.js +0 -77
- package/debuggingApp/node_modules/depd/package.json +0 -45
- package/debuggingApp/node_modules/destroy/LICENSE +0 -23
- package/debuggingApp/node_modules/destroy/README.md +0 -63
- package/debuggingApp/node_modules/destroy/index.js +0 -209
- package/debuggingApp/node_modules/destroy/package.json +0 -48
- package/debuggingApp/node_modules/ee-first/LICENSE +0 -22
- package/debuggingApp/node_modules/ee-first/README.md +0 -80
- package/debuggingApp/node_modules/ee-first/index.js +0 -95
- package/debuggingApp/node_modules/ee-first/package.json +0 -29
- package/debuggingApp/node_modules/encodeurl/HISTORY.md +0 -14
- package/debuggingApp/node_modules/encodeurl/LICENSE +0 -22
- package/debuggingApp/node_modules/encodeurl/README.md +0 -128
- package/debuggingApp/node_modules/encodeurl/index.js +0 -60
- package/debuggingApp/node_modules/encodeurl/package.json +0 -40
- package/debuggingApp/node_modules/escape-html/LICENSE +0 -24
- package/debuggingApp/node_modules/escape-html/Readme.md +0 -43
- package/debuggingApp/node_modules/escape-html/index.js +0 -78
- package/debuggingApp/node_modules/escape-html/package.json +0 -24
- package/debuggingApp/node_modules/etag/HISTORY.md +0 -83
- package/debuggingApp/node_modules/etag/LICENSE +0 -22
- package/debuggingApp/node_modules/etag/README.md +0 -159
- package/debuggingApp/node_modules/etag/index.js +0 -131
- package/debuggingApp/node_modules/etag/package.json +0 -47
- package/debuggingApp/node_modules/express/History.md +0 -3579
- package/debuggingApp/node_modules/express/LICENSE +0 -24
- package/debuggingApp/node_modules/express/Readme.md +0 -166
- package/debuggingApp/node_modules/express/index.js +0 -11
- package/debuggingApp/node_modules/express/lib/application.js +0 -661
- package/debuggingApp/node_modules/express/lib/express.js +0 -116
- package/debuggingApp/node_modules/express/lib/middleware/init.js +0 -43
- package/debuggingApp/node_modules/express/lib/middleware/query.js +0 -47
- package/debuggingApp/node_modules/express/lib/request.js +0 -525
- package/debuggingApp/node_modules/express/lib/response.js +0 -1169
- package/debuggingApp/node_modules/express/lib/router/index.js +0 -673
- package/debuggingApp/node_modules/express/lib/router/layer.js +0 -181
- package/debuggingApp/node_modules/express/lib/router/route.js +0 -225
- package/debuggingApp/node_modules/express/lib/utils.js +0 -304
- package/debuggingApp/node_modules/express/lib/view.js +0 -182
- package/debuggingApp/node_modules/express/package.json +0 -99
- package/debuggingApp/node_modules/finalhandler/HISTORY.md +0 -195
- package/debuggingApp/node_modules/finalhandler/LICENSE +0 -22
- package/debuggingApp/node_modules/finalhandler/README.md +0 -147
- package/debuggingApp/node_modules/finalhandler/SECURITY.md +0 -25
- package/debuggingApp/node_modules/finalhandler/index.js +0 -336
- package/debuggingApp/node_modules/finalhandler/package.json +0 -46
- package/debuggingApp/node_modules/forwarded/HISTORY.md +0 -21
- package/debuggingApp/node_modules/forwarded/LICENSE +0 -22
- package/debuggingApp/node_modules/forwarded/README.md +0 -57
- package/debuggingApp/node_modules/forwarded/index.js +0 -90
- package/debuggingApp/node_modules/forwarded/package.json +0 -45
- package/debuggingApp/node_modules/fresh/HISTORY.md +0 -70
- package/debuggingApp/node_modules/fresh/LICENSE +0 -23
- package/debuggingApp/node_modules/fresh/README.md +0 -119
- package/debuggingApp/node_modules/fresh/index.js +0 -137
- package/debuggingApp/node_modules/fresh/package.json +0 -46
- package/debuggingApp/node_modules/function-bind/.jscs.json +0 -176
- package/debuggingApp/node_modules/function-bind/.travis.yml +0 -168
- package/debuggingApp/node_modules/function-bind/LICENSE +0 -20
- package/debuggingApp/node_modules/function-bind/README.md +0 -48
- package/debuggingApp/node_modules/function-bind/implementation.js +0 -52
- package/debuggingApp/node_modules/function-bind/index.js +0 -5
- package/debuggingApp/node_modules/function-bind/package.json +0 -63
- package/debuggingApp/node_modules/function-bind/test/index.js +0 -252
- package/debuggingApp/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/debuggingApp/node_modules/get-intrinsic/.nycrc +0 -9
- package/debuggingApp/node_modules/get-intrinsic/CHANGELOG.md +0 -91
- package/debuggingApp/node_modules/get-intrinsic/LICENSE +0 -21
- package/debuggingApp/node_modules/get-intrinsic/README.md +0 -71
- package/debuggingApp/node_modules/get-intrinsic/index.js +0 -334
- package/debuggingApp/node_modules/get-intrinsic/package.json +0 -88
- package/debuggingApp/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/debuggingApp/node_modules/has/LICENSE-MIT +0 -22
- package/debuggingApp/node_modules/has/README.md +0 -18
- package/debuggingApp/node_modules/has/package.json +0 -48
- package/debuggingApp/node_modules/has/src/index.js +0 -5
- package/debuggingApp/node_modules/has/test/index.js +0 -10
- package/debuggingApp/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/debuggingApp/node_modules/has-symbols/.nycrc +0 -9
- package/debuggingApp/node_modules/has-symbols/CHANGELOG.md +0 -75
- package/debuggingApp/node_modules/has-symbols/LICENSE +0 -21
- package/debuggingApp/node_modules/has-symbols/README.md +0 -46
- package/debuggingApp/node_modules/has-symbols/index.js +0 -13
- package/debuggingApp/node_modules/has-symbols/package.json +0 -101
- package/debuggingApp/node_modules/has-symbols/shams.js +0 -42
- package/debuggingApp/node_modules/has-symbols/test/index.js +0 -22
- package/debuggingApp/node_modules/has-symbols/test/shams/core-js.js +0 -28
- package/debuggingApp/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -28
- package/debuggingApp/node_modules/has-symbols/test/tests.js +0 -56
- package/debuggingApp/node_modules/http-errors/HISTORY.md +0 -180
- package/debuggingApp/node_modules/http-errors/LICENSE +0 -23
- package/debuggingApp/node_modules/http-errors/README.md +0 -169
- package/debuggingApp/node_modules/http-errors/index.js +0 -289
- package/debuggingApp/node_modules/http-errors/package.json +0 -50
- package/debuggingApp/node_modules/i18next/CONTRIBUTING.md +0 -22
- package/debuggingApp/node_modules/i18next/LICENSE +0 -21
- package/debuggingApp/node_modules/i18next/README.md +0 -60
- package/debuggingApp/node_modules/i18next/dist/cjs/i18next.js +0 -2801
- package/debuggingApp/node_modules/i18next/dist/esm/i18next.bundled.js +0 -2954
- package/debuggingApp/node_modules/i18next/dist/esm/i18next.js +0 -2802
- package/debuggingApp/node_modules/i18next/dist/esm/package.json +0 -1
- package/debuggingApp/node_modules/i18next/dist/umd/i18next.js +0 -2922
- package/debuggingApp/node_modules/i18next/dist/umd/i18next.min.js +0 -1
- package/debuggingApp/node_modules/i18next/i18next.js +0 -2922
- package/debuggingApp/node_modules/i18next/i18next.min.js +0 -1
- package/debuggingApp/node_modules/i18next/index.d.ts +0 -1257
- package/debuggingApp/node_modules/i18next/index.js +0 -5
- package/debuggingApp/node_modules/i18next/package.json +0 -126
- package/debuggingApp/node_modules/i18next-express-middleware/LICENSE +0 -22
- package/debuggingApp/node_modules/i18next-express-middleware/README.md +0 -167
- package/debuggingApp/node_modules/i18next-express-middleware/lib/LanguageDetector.js +0 -138
- package/debuggingApp/node_modules/i18next-express-middleware/lib/index.js +0 -152
- package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/cookie.js +0 -47
- package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/header.js +0 -59
- package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/path.js +0 -27
- package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/querystring.js +0 -31
- package/debuggingApp/node_modules/i18next-express-middleware/lib/languageLookups/session.js +0 -27
- package/debuggingApp/node_modules/i18next-express-middleware/lib/utils.js +0 -70
- package/debuggingApp/node_modules/i18next-express-middleware/package.json +0 -43
- package/debuggingApp/node_modules/i18next-node-fs-backend/LICENSE +0 -22
- package/debuggingApp/node_modules/i18next-node-fs-backend/README.md +0 -72
- package/debuggingApp/node_modules/i18next-node-fs-backend/lib/index.js +0 -162
- package/debuggingApp/node_modules/i18next-node-fs-backend/lib/utils.js +0 -78
- package/debuggingApp/node_modules/i18next-node-fs-backend/package.json +0 -43
- package/debuggingApp/node_modules/iconv-lite/Changelog.md +0 -162
- package/debuggingApp/node_modules/iconv-lite/LICENSE +0 -21
- package/debuggingApp/node_modules/iconv-lite/README.md +0 -156
- package/debuggingApp/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -555
- package/debuggingApp/node_modules/iconv-lite/encodings/dbcs-data.js +0 -176
- package/debuggingApp/node_modules/iconv-lite/encodings/index.js +0 -22
- package/debuggingApp/node_modules/iconv-lite/encodings/internal.js +0 -188
- package/debuggingApp/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
- package/debuggingApp/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
- package/debuggingApp/node_modules/iconv-lite/encodings/sbcs-data.js +0 -174
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -55
- package/debuggingApp/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
- package/debuggingApp/node_modules/iconv-lite/encodings/utf16.js +0 -177
- package/debuggingApp/node_modules/iconv-lite/encodings/utf7.js +0 -290
- package/debuggingApp/node_modules/iconv-lite/lib/bom-handling.js +0 -52
- package/debuggingApp/node_modules/iconv-lite/lib/extend-node.js +0 -217
- package/debuggingApp/node_modules/iconv-lite/lib/index.d.ts +0 -24
- package/debuggingApp/node_modules/iconv-lite/lib/index.js +0 -153
- package/debuggingApp/node_modules/iconv-lite/lib/streams.js +0 -121
- package/debuggingApp/node_modules/iconv-lite/package.json +0 -46
- package/debuggingApp/node_modules/inherits/LICENSE +0 -16
- package/debuggingApp/node_modules/inherits/README.md +0 -42
- package/debuggingApp/node_modules/inherits/inherits.js +0 -9
- package/debuggingApp/node_modules/inherits/inherits_browser.js +0 -27
- package/debuggingApp/node_modules/inherits/package.json +0 -29
- package/debuggingApp/node_modules/ipaddr.js/LICENSE +0 -19
- package/debuggingApp/node_modules/ipaddr.js/README.md +0 -233
- package/debuggingApp/node_modules/ipaddr.js/ipaddr.min.js +0 -1
- package/debuggingApp/node_modules/ipaddr.js/lib/ipaddr.js +0 -673
- package/debuggingApp/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +0 -68
- package/debuggingApp/node_modules/ipaddr.js/package.json +0 -35
- package/debuggingApp/node_modules/json5/.travis.yml +0 -5
- package/debuggingApp/node_modules/json5/CHANGELOG.md +0 -144
- package/debuggingApp/node_modules/json5/README.md +0 -271
- package/debuggingApp/node_modules/json5/lib/cli.js +0 -41
- package/debuggingApp/node_modules/json5/lib/json5.js +0 -754
- package/debuggingApp/node_modules/json5/lib/require.js +0 -18
- package/debuggingApp/node_modules/json5/package.json +0 -30
- package/debuggingApp/node_modules/json5/package.json5 +0 -30
- package/debuggingApp/node_modules/json5/test/parse-cases/arrays/empty-array.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/arrays/leading-comma-array.js +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/arrays/lone-trailing-comma-array.js +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/arrays/no-comma-array.txt +0 -4
- package/debuggingApp/node_modules/json5/test/parse-cases/arrays/regular-array.json +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/arrays/trailing-comma-array.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-following-array-element.json5 +0 -6
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-following-top-level-value.json5 +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-in-string.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-preceding-top-level-value.json5 +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/block-comment-with-asterisks.json5 +0 -7
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-following-array-element.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-following-top-level-value.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-in-string.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/inline-comment-preceding-top-level-value.json5 +0 -2
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/top-level-block-comment.txt +0 -4
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/top-level-inline-comment.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/comments/unterminated-block-comment.txt +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/misc/empty.txt +0 -0
- package/debuggingApp/node_modules/json5/test/parse-cases/misc/npm-package.json +0 -106
- package/debuggingApp/node_modules/json5/test/parse-cases/misc/npm-package.json5 +0 -106
- package/debuggingApp/node_modules/json5/test/parse-cases/misc/readme-example.json5 +0 -25
- package/debuggingApp/node_modules/json5/test/parse-cases/misc/valid-whitespace.json5 +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/.gitattributes +0 -4
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/comment-cr.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/comment-crlf.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/comment-lf.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/escaped-cr.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/escaped-crlf.json5 +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/new-lines/escaped-lf.json5 +0 -5
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/binary-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-leading-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-leading-zero.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-trailing-decimal-point-with-integer-exponent.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-trailing-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float-with-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/float.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-empty.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-lowercase-letter.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-uppercase-x.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal-with-integer-exponent.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/hexadecimal.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/infinity.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-float-exponent.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-hexadecimal-exponent.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-float-exponent.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-hexadecimal-exponent.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-negative-zero-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-float-exponent.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-hexadecimal-exponent.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-positive-zero-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer-with-zero-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/integer.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/lone-decimal-point.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/nan.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-binary-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float-leading-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float-leading-zero.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float-trailing-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-float.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-hexadecimal.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-infinity.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-integer.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-noctal.js +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-octal-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-octal.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-binary-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-float-leading-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-float-trailing-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-float.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-hexadecimal.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-integer.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-octal-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/negative-zero-octal.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/noctal-with-leading-octal-digit.js +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/noctal.js +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/octal-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/octal.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-binary-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float-leading-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float-leading-zero.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float-trailing-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-float.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-hexadecimal.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-infinity.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-integer.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-noctal.js +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-octal-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-octal.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-binary-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-float-leading-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-float-trailing-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-float.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-hexadecimal.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-integer.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-octal-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/positive-zero-octal.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-binary-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-float-leading-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-float-trailing-decimal-point.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-float.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-hexadecimal.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-integer-with-integer-exponent.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-integer.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-octal-coffeescript.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/numbers/zero-octal.txt +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/duplicate-keys.json +0 -4
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/empty-object.json +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-number.txt +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/illegal-unquoted-key-symbol.txt +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/leading-comma-object.txt +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/lone-trailing-comma-object.txt +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/no-comma-object.txt +0 -4
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/reserved-unquoted-key.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/single-quoted-key.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/trailing-comma-object.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/objects/unquoted-keys.json5 +0 -8
- package/debuggingApp/node_modules/json5/test/parse-cases/strings/escaped-single-quoted-string.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/strings/multi-line-string.json5 +0 -2
- package/debuggingApp/node_modules/json5/test/parse-cases/strings/single-quoted-string.json5 +0 -1
- package/debuggingApp/node_modules/json5/test/parse-cases/strings/unescaped-multi-line-string.txt +0 -2
- package/debuggingApp/node_modules/json5/test/parse-cases/todo/unicode-escaped-unquoted-key.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse-cases/todo/unicode-unquoted-key.json5 +0 -3
- package/debuggingApp/node_modules/json5/test/parse.js +0 -89
- package/debuggingApp/node_modules/json5/test/readme.md +0 -23
- package/debuggingApp/node_modules/json5/test/require.js +0 -18
- package/debuggingApp/node_modules/json5/test/stringify.js +0 -498
- package/debuggingApp/node_modules/keygrip/HISTORY.md +0 -20
- package/debuggingApp/node_modules/keygrip/LICENSE +0 -21
- package/debuggingApp/node_modules/keygrip/README.md +0 -103
- package/debuggingApp/node_modules/keygrip/index.js +0 -71
- package/debuggingApp/node_modules/keygrip/package.json +0 -25
- package/debuggingApp/node_modules/media-typer/HISTORY.md +0 -22
- package/debuggingApp/node_modules/media-typer/LICENSE +0 -22
- package/debuggingApp/node_modules/media-typer/README.md +0 -81
- package/debuggingApp/node_modules/media-typer/index.js +0 -270
- package/debuggingApp/node_modules/media-typer/package.json +0 -26
- package/debuggingApp/node_modules/merge-descriptors/HISTORY.md +0 -21
- package/debuggingApp/node_modules/merge-descriptors/LICENSE +0 -23
- package/debuggingApp/node_modules/merge-descriptors/README.md +0 -48
- package/debuggingApp/node_modules/merge-descriptors/index.js +0 -60
- package/debuggingApp/node_modules/merge-descriptors/package.json +0 -32
- package/debuggingApp/node_modules/methods/HISTORY.md +0 -29
- package/debuggingApp/node_modules/methods/LICENSE +0 -24
- package/debuggingApp/node_modules/methods/README.md +0 -51
- package/debuggingApp/node_modules/methods/index.js +0 -69
- package/debuggingApp/node_modules/methods/package.json +0 -36
- package/debuggingApp/node_modules/mime/CHANGELOG.md +0 -164
- package/debuggingApp/node_modules/mime/LICENSE +0 -21
- package/debuggingApp/node_modules/mime/README.md +0 -90
- package/debuggingApp/node_modules/mime/cli.js +0 -8
- package/debuggingApp/node_modules/mime/mime.js +0 -108
- package/debuggingApp/node_modules/mime/package.json +0 -44
- package/debuggingApp/node_modules/mime/src/build.js +0 -53
- package/debuggingApp/node_modules/mime/src/test.js +0 -60
- package/debuggingApp/node_modules/mime/types.json +0 -1
- package/debuggingApp/node_modules/mime-db/HISTORY.md +0 -507
- package/debuggingApp/node_modules/mime-db/LICENSE +0 -23
- package/debuggingApp/node_modules/mime-db/README.md +0 -100
- package/debuggingApp/node_modules/mime-db/db.json +0 -8519
- package/debuggingApp/node_modules/mime-db/index.js +0 -12
- package/debuggingApp/node_modules/mime-db/package.json +0 -60
- package/debuggingApp/node_modules/mime-types/HISTORY.md +0 -397
- package/debuggingApp/node_modules/mime-types/LICENSE +0 -23
- package/debuggingApp/node_modules/mime-types/README.md +0 -113
- package/debuggingApp/node_modules/mime-types/index.js +0 -188
- package/debuggingApp/node_modules/mime-types/package.json +0 -44
- package/debuggingApp/node_modules/ms/index.js +0 -152
- package/debuggingApp/node_modules/ms/license.md +0 -21
- package/debuggingApp/node_modules/ms/package.json +0 -37
- package/debuggingApp/node_modules/ms/readme.md +0 -51
- package/debuggingApp/node_modules/negotiator/HISTORY.md +0 -108
- package/debuggingApp/node_modules/negotiator/LICENSE +0 -24
- package/debuggingApp/node_modules/negotiator/README.md +0 -203
- package/debuggingApp/node_modules/negotiator/index.js +0 -82
- package/debuggingApp/node_modules/negotiator/lib/charset.js +0 -169
- package/debuggingApp/node_modules/negotiator/lib/encoding.js +0 -184
- package/debuggingApp/node_modules/negotiator/lib/language.js +0 -179
- package/debuggingApp/node_modules/negotiator/lib/mediaType.js +0 -294
- package/debuggingApp/node_modules/negotiator/package.json +0 -42
- package/debuggingApp/node_modules/object-inspect/.github/FUNDING.yml +0 -12
- package/debuggingApp/node_modules/object-inspect/.nycrc +0 -13
- package/debuggingApp/node_modules/object-inspect/CHANGELOG.md +0 -360
- package/debuggingApp/node_modules/object-inspect/LICENSE +0 -21
- package/debuggingApp/node_modules/object-inspect/example/all.js +0 -23
- package/debuggingApp/node_modules/object-inspect/example/circular.js +0 -6
- package/debuggingApp/node_modules/object-inspect/example/fn.js +0 -5
- package/debuggingApp/node_modules/object-inspect/example/inspect.js +0 -10
- package/debuggingApp/node_modules/object-inspect/index.js +0 -512
- package/debuggingApp/node_modules/object-inspect/package-support.json +0 -20
- package/debuggingApp/node_modules/object-inspect/package.json +0 -94
- package/debuggingApp/node_modules/object-inspect/readme.markdown +0 -86
- package/debuggingApp/node_modules/object-inspect/test/bigint.js +0 -58
- package/debuggingApp/node_modules/object-inspect/test/browser/dom.js +0 -15
- package/debuggingApp/node_modules/object-inspect/test/circular.js +0 -16
- package/debuggingApp/node_modules/object-inspect/test/deep.js +0 -12
- package/debuggingApp/node_modules/object-inspect/test/element.js +0 -53
- package/debuggingApp/node_modules/object-inspect/test/err.js +0 -48
- package/debuggingApp/node_modules/object-inspect/test/fakes.js +0 -29
- package/debuggingApp/node_modules/object-inspect/test/fn.js +0 -76
- package/debuggingApp/node_modules/object-inspect/test/has.js +0 -15
- package/debuggingApp/node_modules/object-inspect/test/holes.js +0 -15
- package/debuggingApp/node_modules/object-inspect/test/indent-option.js +0 -271
- package/debuggingApp/node_modules/object-inspect/test/inspect.js +0 -139
- package/debuggingApp/node_modules/object-inspect/test/lowbyte.js +0 -12
- package/debuggingApp/node_modules/object-inspect/test/number.js +0 -58
- package/debuggingApp/node_modules/object-inspect/test/quoteStyle.js +0 -17
- package/debuggingApp/node_modules/object-inspect/test/toStringTag.js +0 -40
- package/debuggingApp/node_modules/object-inspect/test/undef.js +0 -12
- package/debuggingApp/node_modules/object-inspect/test/values.js +0 -211
- package/debuggingApp/node_modules/object-inspect/test-core-js.js +0 -26
- package/debuggingApp/node_modules/object-inspect/util.inspect.js +0 -1
- package/debuggingApp/node_modules/on-finished/HISTORY.md +0 -98
- package/debuggingApp/node_modules/on-finished/LICENSE +0 -23
- package/debuggingApp/node_modules/on-finished/README.md +0 -162
- package/debuggingApp/node_modules/on-finished/index.js +0 -234
- package/debuggingApp/node_modules/on-finished/package.json +0 -39
- package/debuggingApp/node_modules/parseurl/HISTORY.md +0 -58
- package/debuggingApp/node_modules/parseurl/LICENSE +0 -24
- package/debuggingApp/node_modules/parseurl/README.md +0 -133
- package/debuggingApp/node_modules/parseurl/index.js +0 -158
- package/debuggingApp/node_modules/parseurl/package.json +0 -40
- package/debuggingApp/node_modules/path-to-regexp/History.md +0 -36
- package/debuggingApp/node_modules/path-to-regexp/LICENSE +0 -21
- package/debuggingApp/node_modules/path-to-regexp/Readme.md +0 -35
- package/debuggingApp/node_modules/path-to-regexp/index.js +0 -129
- package/debuggingApp/node_modules/path-to-regexp/package.json +0 -30
- package/debuggingApp/node_modules/proxy-addr/HISTORY.md +0 -161
- package/debuggingApp/node_modules/proxy-addr/LICENSE +0 -22
- package/debuggingApp/node_modules/proxy-addr/README.md +0 -139
- package/debuggingApp/node_modules/proxy-addr/index.js +0 -327
- package/debuggingApp/node_modules/proxy-addr/package.json +0 -47
- package/debuggingApp/node_modules/qs/.github/FUNDING.yml +0 -12
- package/debuggingApp/node_modules/qs/.nycrc +0 -13
- package/debuggingApp/node_modules/qs/CHANGELOG.md +0 -388
- package/debuggingApp/node_modules/qs/LICENSE.md +0 -29
- package/debuggingApp/node_modules/qs/README.md +0 -623
- package/debuggingApp/node_modules/qs/dist/qs.js +0 -2044
- package/debuggingApp/node_modules/qs/lib/formats.js +0 -23
- package/debuggingApp/node_modules/qs/lib/index.js +0 -11
- package/debuggingApp/node_modules/qs/lib/parse.js +0 -263
- package/debuggingApp/node_modules/qs/lib/stringify.js +0 -317
- package/debuggingApp/node_modules/qs/lib/utils.js +0 -252
- package/debuggingApp/node_modules/qs/package.json +0 -73
- package/debuggingApp/node_modules/qs/test/parse.js +0 -841
- package/debuggingApp/node_modules/qs/test/stringify.js +0 -865
- package/debuggingApp/node_modules/qs/test/utils.js +0 -136
- package/debuggingApp/node_modules/range-parser/HISTORY.md +0 -56
- package/debuggingApp/node_modules/range-parser/LICENSE +0 -23
- package/debuggingApp/node_modules/range-parser/README.md +0 -84
- package/debuggingApp/node_modules/range-parser/index.js +0 -162
- package/debuggingApp/node_modules/range-parser/package.json +0 -44
- package/debuggingApp/node_modules/raw-body/HISTORY.md +0 -303
- package/debuggingApp/node_modules/raw-body/LICENSE +0 -22
- package/debuggingApp/node_modules/raw-body/README.md +0 -223
- package/debuggingApp/node_modules/raw-body/SECURITY.md +0 -24
- package/debuggingApp/node_modules/raw-body/index.d.ts +0 -87
- package/debuggingApp/node_modules/raw-body/index.js +0 -329
- package/debuggingApp/node_modules/raw-body/package.json +0 -49
- package/debuggingApp/node_modules/regenerator-runtime/LICENSE +0 -21
- package/debuggingApp/node_modules/regenerator-runtime/README.md +0 -31
- package/debuggingApp/node_modules/regenerator-runtime/package.json +0 -19
- package/debuggingApp/node_modules/regenerator-runtime/path.js +0 -11
- package/debuggingApp/node_modules/regenerator-runtime/runtime.js +0 -754
- package/debuggingApp/node_modules/safe-buffer/LICENSE +0 -21
- package/debuggingApp/node_modules/safe-buffer/README.md +0 -584
- package/debuggingApp/node_modules/safe-buffer/index.d.ts +0 -187
- package/debuggingApp/node_modules/safe-buffer/index.js +0 -65
- package/debuggingApp/node_modules/safe-buffer/package.json +0 -51
- package/debuggingApp/node_modules/safer-buffer/LICENSE +0 -21
- package/debuggingApp/node_modules/safer-buffer/Porting-Buffer.md +0 -268
- package/debuggingApp/node_modules/safer-buffer/Readme.md +0 -156
- package/debuggingApp/node_modules/safer-buffer/dangerous.js +0 -58
- package/debuggingApp/node_modules/safer-buffer/package.json +0 -34
- package/debuggingApp/node_modules/safer-buffer/safer.js +0 -77
- package/debuggingApp/node_modules/safer-buffer/tests.js +0 -406
- package/debuggingApp/node_modules/send/HISTORY.md +0 -521
- package/debuggingApp/node_modules/send/LICENSE +0 -23
- package/debuggingApp/node_modules/send/README.md +0 -327
- package/debuggingApp/node_modules/send/SECURITY.md +0 -24
- package/debuggingApp/node_modules/send/index.js +0 -1143
- package/debuggingApp/node_modules/send/node_modules/ms/index.js +0 -162
- package/debuggingApp/node_modules/send/node_modules/ms/license.md +0 -21
- package/debuggingApp/node_modules/send/node_modules/ms/package.json +0 -38
- package/debuggingApp/node_modules/send/node_modules/ms/readme.md +0 -59
- package/debuggingApp/node_modules/send/package.json +0 -62
- package/debuggingApp/node_modules/serve-static/HISTORY.md +0 -471
- package/debuggingApp/node_modules/serve-static/LICENSE +0 -25
- package/debuggingApp/node_modules/serve-static/README.md +0 -257
- package/debuggingApp/node_modules/serve-static/index.js +0 -210
- package/debuggingApp/node_modules/serve-static/package.json +0 -42
- package/debuggingApp/node_modules/setprototypeof/LICENSE +0 -13
- package/debuggingApp/node_modules/setprototypeof/README.md +0 -31
- package/debuggingApp/node_modules/setprototypeof/index.d.ts +0 -2
- package/debuggingApp/node_modules/setprototypeof/index.js +0 -17
- package/debuggingApp/node_modules/setprototypeof/package.json +0 -38
- package/debuggingApp/node_modules/setprototypeof/test/index.js +0 -24
- package/debuggingApp/node_modules/side-channel/.github/FUNDING.yml +0 -12
- package/debuggingApp/node_modules/side-channel/.nycrc +0 -13
- package/debuggingApp/node_modules/side-channel/CHANGELOG.md +0 -65
- package/debuggingApp/node_modules/side-channel/LICENSE +0 -21
- package/debuggingApp/node_modules/side-channel/README.md +0 -2
- package/debuggingApp/node_modules/side-channel/index.js +0 -124
- package/debuggingApp/node_modules/side-channel/package.json +0 -67
- package/debuggingApp/node_modules/side-channel/test/index.js +0 -78
- package/debuggingApp/node_modules/statuses/HISTORY.md +0 -82
- package/debuggingApp/node_modules/statuses/LICENSE +0 -23
- package/debuggingApp/node_modules/statuses/README.md +0 -136
- package/debuggingApp/node_modules/statuses/codes.json +0 -65
- package/debuggingApp/node_modules/statuses/index.js +0 -146
- package/debuggingApp/node_modules/statuses/package.json +0 -49
- package/debuggingApp/node_modules/toidentifier/HISTORY.md +0 -9
- package/debuggingApp/node_modules/toidentifier/LICENSE +0 -21
- package/debuggingApp/node_modules/toidentifier/README.md +0 -61
- package/debuggingApp/node_modules/toidentifier/index.js +0 -32
- package/debuggingApp/node_modules/toidentifier/package.json +0 -38
- package/debuggingApp/node_modules/type-is/HISTORY.md +0 -259
- package/debuggingApp/node_modules/type-is/LICENSE +0 -23
- package/debuggingApp/node_modules/type-is/README.md +0 -170
- package/debuggingApp/node_modules/type-is/index.js +0 -266
- package/debuggingApp/node_modules/type-is/package.json +0 -45
- package/debuggingApp/node_modules/unpipe/HISTORY.md +0 -4
- package/debuggingApp/node_modules/unpipe/LICENSE +0 -22
- package/debuggingApp/node_modules/unpipe/README.md +0 -43
- package/debuggingApp/node_modules/unpipe/index.js +0 -69
- package/debuggingApp/node_modules/unpipe/package.json +0 -27
- package/debuggingApp/node_modules/utils-merge/LICENSE +0 -20
- package/debuggingApp/node_modules/utils-merge/README.md +0 -34
- package/debuggingApp/node_modules/utils-merge/index.js +0 -23
- package/debuggingApp/node_modules/utils-merge/package.json +0 -40
- package/debuggingApp/node_modules/vary/HISTORY.md +0 -39
- package/debuggingApp/node_modules/vary/LICENSE +0 -22
- package/debuggingApp/node_modules/vary/README.md +0 -101
- package/debuggingApp/node_modules/vary/index.js +0 -149
- package/debuggingApp/node_modules/vary/package.json +0 -43
- package/debuggingApp/package-lock.json +0 -1162
- package/debuggingApp/package.json +0 -18
- package/debuggingApp/server.js +0 -42
- package/dist/cjs/locize.js +0 -464
- package/dist/esm/locize.js +0 -454
|
@@ -1,2802 +0,0 @@
|
|
|
1
|
-
import _typeof from '@babel/runtime/helpers/esm/typeof';
|
|
2
|
-
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
|
|
3
|
-
import _createClass from '@babel/runtime/helpers/esm/createClass';
|
|
4
|
-
import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
5
|
-
import _inherits from '@babel/runtime/helpers/esm/inherits';
|
|
6
|
-
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
7
|
-
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
8
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
9
|
-
import _toArray from '@babel/runtime/helpers/esm/toArray';
|
|
10
|
-
|
|
11
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
-
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
|
-
|
|
15
|
-
var consoleLogger = {
|
|
16
|
-
type: 'logger',
|
|
17
|
-
log: function log(args) {
|
|
18
|
-
this.output('log', args);
|
|
19
|
-
},
|
|
20
|
-
warn: function warn(args) {
|
|
21
|
-
this.output('warn', args);
|
|
22
|
-
},
|
|
23
|
-
error: function error(args) {
|
|
24
|
-
this.output('error', args);
|
|
25
|
-
},
|
|
26
|
-
output: function output(type, args) {
|
|
27
|
-
if (console && console[type]) console[type].apply(console, args);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var Logger = function () {
|
|
32
|
-
function Logger(concreteLogger) {
|
|
33
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
34
|
-
|
|
35
|
-
_classCallCheck(this, Logger);
|
|
36
|
-
|
|
37
|
-
this.init(concreteLogger, options);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
_createClass(Logger, [{
|
|
41
|
-
key: "init",
|
|
42
|
-
value: function init(concreteLogger) {
|
|
43
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
|
-
this.prefix = options.prefix || 'i18next:';
|
|
45
|
-
this.logger = concreteLogger || consoleLogger;
|
|
46
|
-
this.options = options;
|
|
47
|
-
this.debug = options.debug;
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "setDebug",
|
|
51
|
-
value: function setDebug(bool) {
|
|
52
|
-
this.debug = bool;
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
key: "log",
|
|
56
|
-
value: function log() {
|
|
57
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
58
|
-
args[_key] = arguments[_key];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return this.forward(args, 'log', '', true);
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "warn",
|
|
65
|
-
value: function warn() {
|
|
66
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
67
|
-
args[_key2] = arguments[_key2];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return this.forward(args, 'warn', '', true);
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "error",
|
|
74
|
-
value: function error() {
|
|
75
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
76
|
-
args[_key3] = arguments[_key3];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return this.forward(args, 'error', '');
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "deprecate",
|
|
83
|
-
value: function deprecate() {
|
|
84
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
85
|
-
args[_key4] = arguments[_key4];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "forward",
|
|
92
|
-
value: function forward(args, lvl, prefix, debugOnly) {
|
|
93
|
-
if (debugOnly && !this.debug) return null;
|
|
94
|
-
if (typeof args[0] === 'string') args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]);
|
|
95
|
-
return this.logger[lvl](args);
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "create",
|
|
99
|
-
value: function create(moduleName) {
|
|
100
|
-
return new Logger(this.logger, _objectSpread(_objectSpread({}, {
|
|
101
|
-
prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
|
|
102
|
-
}), this.options));
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
105
|
-
|
|
106
|
-
return Logger;
|
|
107
|
-
}();
|
|
108
|
-
|
|
109
|
-
var baseLogger = new Logger();
|
|
110
|
-
|
|
111
|
-
var EventEmitter = function () {
|
|
112
|
-
function EventEmitter() {
|
|
113
|
-
_classCallCheck(this, EventEmitter);
|
|
114
|
-
|
|
115
|
-
this.observers = {};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_createClass(EventEmitter, [{
|
|
119
|
-
key: "on",
|
|
120
|
-
value: function on(events, listener) {
|
|
121
|
-
var _this = this;
|
|
122
|
-
|
|
123
|
-
events.split(' ').forEach(function (event) {
|
|
124
|
-
_this.observers[event] = _this.observers[event] || [];
|
|
125
|
-
|
|
126
|
-
_this.observers[event].push(listener);
|
|
127
|
-
});
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "off",
|
|
132
|
-
value: function off(event, listener) {
|
|
133
|
-
if (!this.observers[event]) return;
|
|
134
|
-
|
|
135
|
-
if (!listener) {
|
|
136
|
-
delete this.observers[event];
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
this.observers[event] = this.observers[event].filter(function (l) {
|
|
141
|
-
return l !== listener;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}, {
|
|
145
|
-
key: "emit",
|
|
146
|
-
value: function emit(event) {
|
|
147
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
148
|
-
args[_key - 1] = arguments[_key];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (this.observers[event]) {
|
|
152
|
-
var cloned = [].concat(this.observers[event]);
|
|
153
|
-
cloned.forEach(function (observer) {
|
|
154
|
-
observer.apply(void 0, args);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (this.observers['*']) {
|
|
159
|
-
var _cloned = [].concat(this.observers['*']);
|
|
160
|
-
|
|
161
|
-
_cloned.forEach(function (observer) {
|
|
162
|
-
observer.apply(observer, [event].concat(args));
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}]);
|
|
167
|
-
|
|
168
|
-
return EventEmitter;
|
|
169
|
-
}();
|
|
170
|
-
|
|
171
|
-
function defer() {
|
|
172
|
-
var res;
|
|
173
|
-
var rej;
|
|
174
|
-
var promise = new Promise(function (resolve, reject) {
|
|
175
|
-
res = resolve;
|
|
176
|
-
rej = reject;
|
|
177
|
-
});
|
|
178
|
-
promise.resolve = res;
|
|
179
|
-
promise.reject = rej;
|
|
180
|
-
return promise;
|
|
181
|
-
}
|
|
182
|
-
function makeString(object) {
|
|
183
|
-
if (object == null) return '';
|
|
184
|
-
return '' + object;
|
|
185
|
-
}
|
|
186
|
-
function copy(a, s, t) {
|
|
187
|
-
a.forEach(function (m) {
|
|
188
|
-
if (s[m]) t[m] = s[m];
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function getLastOfPath(object, path, Empty) {
|
|
193
|
-
function cleanKey(key) {
|
|
194
|
-
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function canNotTraverseDeeper() {
|
|
198
|
-
return !object || typeof object === 'string';
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
202
|
-
|
|
203
|
-
while (stack.length > 1) {
|
|
204
|
-
if (canNotTraverseDeeper()) return {};
|
|
205
|
-
var key = cleanKey(stack.shift());
|
|
206
|
-
if (!object[key] && Empty) object[key] = new Empty();
|
|
207
|
-
|
|
208
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
209
|
-
object = object[key];
|
|
210
|
-
} else {
|
|
211
|
-
object = {};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (canNotTraverseDeeper()) return {};
|
|
216
|
-
return {
|
|
217
|
-
obj: object,
|
|
218
|
-
k: cleanKey(stack.shift())
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function setPath(object, path, newValue) {
|
|
223
|
-
var _getLastOfPath = getLastOfPath(object, path, Object),
|
|
224
|
-
obj = _getLastOfPath.obj,
|
|
225
|
-
k = _getLastOfPath.k;
|
|
226
|
-
|
|
227
|
-
obj[k] = newValue;
|
|
228
|
-
}
|
|
229
|
-
function pushPath(object, path, newValue, concat) {
|
|
230
|
-
var _getLastOfPath2 = getLastOfPath(object, path, Object),
|
|
231
|
-
obj = _getLastOfPath2.obj,
|
|
232
|
-
k = _getLastOfPath2.k;
|
|
233
|
-
|
|
234
|
-
obj[k] = obj[k] || [];
|
|
235
|
-
if (concat) obj[k] = obj[k].concat(newValue);
|
|
236
|
-
if (!concat) obj[k].push(newValue);
|
|
237
|
-
}
|
|
238
|
-
function getPath(object, path) {
|
|
239
|
-
var _getLastOfPath3 = getLastOfPath(object, path),
|
|
240
|
-
obj = _getLastOfPath3.obj,
|
|
241
|
-
k = _getLastOfPath3.k;
|
|
242
|
-
|
|
243
|
-
if (!obj) return undefined;
|
|
244
|
-
return obj[k];
|
|
245
|
-
}
|
|
246
|
-
function getPathWithDefaults(data, defaultData, key) {
|
|
247
|
-
var value = getPath(data, key);
|
|
248
|
-
|
|
249
|
-
if (value !== undefined) {
|
|
250
|
-
return value;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return getPath(defaultData, key);
|
|
254
|
-
}
|
|
255
|
-
function deepExtend(target, source, overwrite) {
|
|
256
|
-
for (var prop in source) {
|
|
257
|
-
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
258
|
-
if (prop in target) {
|
|
259
|
-
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
260
|
-
if (overwrite) target[prop] = source[prop];
|
|
261
|
-
} else {
|
|
262
|
-
deepExtend(target[prop], source[prop], overwrite);
|
|
263
|
-
}
|
|
264
|
-
} else {
|
|
265
|
-
target[prop] = source[prop];
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return target;
|
|
271
|
-
}
|
|
272
|
-
function regexEscape(str) {
|
|
273
|
-
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
274
|
-
}
|
|
275
|
-
var _entityMap = {
|
|
276
|
-
'&': '&',
|
|
277
|
-
'<': '<',
|
|
278
|
-
'>': '>',
|
|
279
|
-
'"': '"',
|
|
280
|
-
"'": ''',
|
|
281
|
-
'/': '/'
|
|
282
|
-
};
|
|
283
|
-
function escape(data) {
|
|
284
|
-
if (typeof data === 'string') {
|
|
285
|
-
return data.replace(/[&<>"'\/]/g, function (s) {
|
|
286
|
-
return _entityMap[s];
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return data;
|
|
291
|
-
}
|
|
292
|
-
var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
|
|
293
|
-
var chars = [' ', ',', '?', '!', ';'];
|
|
294
|
-
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
295
|
-
nsSeparator = nsSeparator || '';
|
|
296
|
-
keySeparator = keySeparator || '';
|
|
297
|
-
var possibleChars = chars.filter(function (c) {
|
|
298
|
-
return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
|
|
299
|
-
});
|
|
300
|
-
if (possibleChars.length === 0) return true;
|
|
301
|
-
var r = new RegExp("(".concat(possibleChars.map(function (c) {
|
|
302
|
-
return c === '?' ? '\\?' : c;
|
|
303
|
-
}).join('|'), ")"));
|
|
304
|
-
var matched = !r.test(key);
|
|
305
|
-
|
|
306
|
-
if (!matched) {
|
|
307
|
-
var ki = key.indexOf(keySeparator);
|
|
308
|
-
|
|
309
|
-
if (ki > 0 && !r.test(key.substring(0, ki))) {
|
|
310
|
-
matched = true;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return matched;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
318
|
-
|
|
319
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
320
|
-
|
|
321
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
322
|
-
|
|
323
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
324
|
-
|
|
325
|
-
function deepFind(obj, path) {
|
|
326
|
-
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
327
|
-
if (!obj) return undefined;
|
|
328
|
-
if (obj[path]) return obj[path];
|
|
329
|
-
var paths = path.split(keySeparator);
|
|
330
|
-
var current = obj;
|
|
331
|
-
|
|
332
|
-
for (var i = 0; i < paths.length; ++i) {
|
|
333
|
-
if (!current) return undefined;
|
|
334
|
-
|
|
335
|
-
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
336
|
-
return undefined;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (current[paths[i]] === undefined) {
|
|
340
|
-
var j = 2;
|
|
341
|
-
var p = paths.slice(i, i + j).join(keySeparator);
|
|
342
|
-
var mix = current[p];
|
|
343
|
-
|
|
344
|
-
while (mix === undefined && paths.length > i + j) {
|
|
345
|
-
j++;
|
|
346
|
-
p = paths.slice(i, i + j).join(keySeparator);
|
|
347
|
-
mix = current[p];
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (mix === undefined) return undefined;
|
|
351
|
-
if (mix === null) return null;
|
|
352
|
-
|
|
353
|
-
if (path.endsWith(p)) {
|
|
354
|
-
if (typeof mix === 'string') return mix;
|
|
355
|
-
if (p && typeof mix[p] === 'string') return mix[p];
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
var joinedPath = paths.slice(i + j).join(keySeparator);
|
|
359
|
-
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
360
|
-
return undefined;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
current = current[paths[i]];
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return current;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
var ResourceStore = function (_EventEmitter) {
|
|
370
|
-
_inherits(ResourceStore, _EventEmitter);
|
|
371
|
-
|
|
372
|
-
var _super = _createSuper(ResourceStore);
|
|
373
|
-
|
|
374
|
-
function ResourceStore(data) {
|
|
375
|
-
var _this;
|
|
376
|
-
|
|
377
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
378
|
-
ns: ['translation'],
|
|
379
|
-
defaultNS: 'translation'
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
_classCallCheck(this, ResourceStore);
|
|
383
|
-
|
|
384
|
-
_this = _super.call(this);
|
|
385
|
-
|
|
386
|
-
if (isIE10) {
|
|
387
|
-
EventEmitter.call(_assertThisInitialized(_this));
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
_this.data = data || {};
|
|
391
|
-
_this.options = options;
|
|
392
|
-
|
|
393
|
-
if (_this.options.keySeparator === undefined) {
|
|
394
|
-
_this.options.keySeparator = '.';
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
if (_this.options.ignoreJSONStructure === undefined) {
|
|
398
|
-
_this.options.ignoreJSONStructure = true;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return _this;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
_createClass(ResourceStore, [{
|
|
405
|
-
key: "addNamespaces",
|
|
406
|
-
value: function addNamespaces(ns) {
|
|
407
|
-
if (this.options.ns.indexOf(ns) < 0) {
|
|
408
|
-
this.options.ns.push(ns);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}, {
|
|
412
|
-
key: "removeNamespaces",
|
|
413
|
-
value: function removeNamespaces(ns) {
|
|
414
|
-
var index = this.options.ns.indexOf(ns);
|
|
415
|
-
|
|
416
|
-
if (index > -1) {
|
|
417
|
-
this.options.ns.splice(index, 1);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}, {
|
|
421
|
-
key: "getResource",
|
|
422
|
-
value: function getResource(lng, ns, key) {
|
|
423
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
424
|
-
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
425
|
-
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
426
|
-
var path = [lng, ns];
|
|
427
|
-
if (key && typeof key !== 'string') path = path.concat(key);
|
|
428
|
-
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
429
|
-
|
|
430
|
-
if (lng.indexOf('.') > -1) {
|
|
431
|
-
path = lng.split('.');
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
var result = getPath(this.data, path);
|
|
435
|
-
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
436
|
-
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
437
|
-
}
|
|
438
|
-
}, {
|
|
439
|
-
key: "addResource",
|
|
440
|
-
value: function addResource(lng, ns, key, value) {
|
|
441
|
-
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
442
|
-
silent: false
|
|
443
|
-
};
|
|
444
|
-
var keySeparator = this.options.keySeparator;
|
|
445
|
-
if (keySeparator === undefined) keySeparator = '.';
|
|
446
|
-
var path = [lng, ns];
|
|
447
|
-
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
448
|
-
|
|
449
|
-
if (lng.indexOf('.') > -1) {
|
|
450
|
-
path = lng.split('.');
|
|
451
|
-
value = ns;
|
|
452
|
-
ns = path[1];
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
this.addNamespaces(ns);
|
|
456
|
-
setPath(this.data, path, value);
|
|
457
|
-
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
458
|
-
}
|
|
459
|
-
}, {
|
|
460
|
-
key: "addResources",
|
|
461
|
-
value: function addResources(lng, ns, resources) {
|
|
462
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
463
|
-
silent: false
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
for (var m in resources) {
|
|
467
|
-
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
468
|
-
silent: true
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
473
|
-
}
|
|
474
|
-
}, {
|
|
475
|
-
key: "addResourceBundle",
|
|
476
|
-
value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
477
|
-
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
478
|
-
silent: false
|
|
479
|
-
};
|
|
480
|
-
var path = [lng, ns];
|
|
481
|
-
|
|
482
|
-
if (lng.indexOf('.') > -1) {
|
|
483
|
-
path = lng.split('.');
|
|
484
|
-
deep = resources;
|
|
485
|
-
resources = ns;
|
|
486
|
-
ns = path[1];
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
this.addNamespaces(ns);
|
|
490
|
-
var pack = getPath(this.data, path) || {};
|
|
491
|
-
|
|
492
|
-
if (deep) {
|
|
493
|
-
deepExtend(pack, resources, overwrite);
|
|
494
|
-
} else {
|
|
495
|
-
pack = _objectSpread$1(_objectSpread$1({}, pack), resources);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
setPath(this.data, path, pack);
|
|
499
|
-
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
500
|
-
}
|
|
501
|
-
}, {
|
|
502
|
-
key: "removeResourceBundle",
|
|
503
|
-
value: function removeResourceBundle(lng, ns) {
|
|
504
|
-
if (this.hasResourceBundle(lng, ns)) {
|
|
505
|
-
delete this.data[lng][ns];
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
this.removeNamespaces(ns);
|
|
509
|
-
this.emit('removed', lng, ns);
|
|
510
|
-
}
|
|
511
|
-
}, {
|
|
512
|
-
key: "hasResourceBundle",
|
|
513
|
-
value: function hasResourceBundle(lng, ns) {
|
|
514
|
-
return this.getResource(lng, ns) !== undefined;
|
|
515
|
-
}
|
|
516
|
-
}, {
|
|
517
|
-
key: "getResourceBundle",
|
|
518
|
-
value: function getResourceBundle(lng, ns) {
|
|
519
|
-
if (!ns) ns = this.options.defaultNS;
|
|
520
|
-
if (this.options.compatibilityAPI === 'v1') return _objectSpread$1(_objectSpread$1({}, {}), this.getResource(lng, ns));
|
|
521
|
-
return this.getResource(lng, ns);
|
|
522
|
-
}
|
|
523
|
-
}, {
|
|
524
|
-
key: "getDataByLanguage",
|
|
525
|
-
value: function getDataByLanguage(lng) {
|
|
526
|
-
return this.data[lng];
|
|
527
|
-
}
|
|
528
|
-
}, {
|
|
529
|
-
key: "hasLanguageSomeTranslations",
|
|
530
|
-
value: function hasLanguageSomeTranslations(lng) {
|
|
531
|
-
var data = this.getDataByLanguage(lng);
|
|
532
|
-
var n = data && Object.keys(data) || [];
|
|
533
|
-
return !!n.find(function (v) {
|
|
534
|
-
return data[v] && Object.keys(data[v]).length > 0;
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
}, {
|
|
538
|
-
key: "toJSON",
|
|
539
|
-
value: function toJSON() {
|
|
540
|
-
return this.data;
|
|
541
|
-
}
|
|
542
|
-
}]);
|
|
543
|
-
|
|
544
|
-
return ResourceStore;
|
|
545
|
-
}(EventEmitter);
|
|
546
|
-
|
|
547
|
-
var postProcessor = {
|
|
548
|
-
processors: {},
|
|
549
|
-
addPostProcessor: function addPostProcessor(module) {
|
|
550
|
-
this.processors[module.name] = module;
|
|
551
|
-
},
|
|
552
|
-
handle: function handle(processors, value, key, options, translator) {
|
|
553
|
-
var _this = this;
|
|
554
|
-
|
|
555
|
-
processors.forEach(function (processor) {
|
|
556
|
-
if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
|
|
557
|
-
});
|
|
558
|
-
return value;
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
563
|
-
|
|
564
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
565
|
-
|
|
566
|
-
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
567
|
-
|
|
568
|
-
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
569
|
-
var checkedLoadedFor = {};
|
|
570
|
-
|
|
571
|
-
var Translator = function (_EventEmitter) {
|
|
572
|
-
_inherits(Translator, _EventEmitter);
|
|
573
|
-
|
|
574
|
-
var _super = _createSuper$1(Translator);
|
|
575
|
-
|
|
576
|
-
function Translator(services) {
|
|
577
|
-
var _this;
|
|
578
|
-
|
|
579
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
580
|
-
|
|
581
|
-
_classCallCheck(this, Translator);
|
|
582
|
-
|
|
583
|
-
_this = _super.call(this);
|
|
584
|
-
|
|
585
|
-
if (isIE10) {
|
|
586
|
-
EventEmitter.call(_assertThisInitialized(_this));
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized(_this));
|
|
590
|
-
_this.options = options;
|
|
591
|
-
|
|
592
|
-
if (_this.options.keySeparator === undefined) {
|
|
593
|
-
_this.options.keySeparator = '.';
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
_this.logger = baseLogger.create('translator');
|
|
597
|
-
return _this;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
_createClass(Translator, [{
|
|
601
|
-
key: "changeLanguage",
|
|
602
|
-
value: function changeLanguage(lng) {
|
|
603
|
-
if (lng) this.language = lng;
|
|
604
|
-
}
|
|
605
|
-
}, {
|
|
606
|
-
key: "exists",
|
|
607
|
-
value: function exists(key) {
|
|
608
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
609
|
-
interpolation: {}
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
if (key === undefined || key === null) {
|
|
613
|
-
return false;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
var resolved = this.resolve(key, options);
|
|
617
|
-
return resolved && resolved.res !== undefined;
|
|
618
|
-
}
|
|
619
|
-
}, {
|
|
620
|
-
key: "extractFromKey",
|
|
621
|
-
value: function extractFromKey(key, options) {
|
|
622
|
-
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
623
|
-
if (nsSeparator === undefined) nsSeparator = ':';
|
|
624
|
-
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
625
|
-
var namespaces = options.ns || this.options.defaultNS || [];
|
|
626
|
-
var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
|
|
627
|
-
var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
|
|
628
|
-
|
|
629
|
-
if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
|
|
630
|
-
var m = key.match(this.interpolator.nestingRegexp);
|
|
631
|
-
|
|
632
|
-
if (m && m.length > 0) {
|
|
633
|
-
return {
|
|
634
|
-
key: key,
|
|
635
|
-
namespaces: namespaces
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
var parts = key.split(nsSeparator);
|
|
640
|
-
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
641
|
-
key = parts.join(keySeparator);
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
645
|
-
return {
|
|
646
|
-
key: key,
|
|
647
|
-
namespaces: namespaces
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
}, {
|
|
651
|
-
key: "translate",
|
|
652
|
-
value: function translate(keys, options, lastKey) {
|
|
653
|
-
var _this2 = this;
|
|
654
|
-
|
|
655
|
-
if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
656
|
-
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
if (!options) options = {};
|
|
660
|
-
if (keys === undefined || keys === null) return '';
|
|
661
|
-
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
662
|
-
var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
|
|
663
|
-
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
664
|
-
|
|
665
|
-
var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
|
|
666
|
-
key = _this$extractFromKey.key,
|
|
667
|
-
namespaces = _this$extractFromKey.namespaces;
|
|
668
|
-
|
|
669
|
-
var namespace = namespaces[namespaces.length - 1];
|
|
670
|
-
var lng = options.lng || this.language;
|
|
671
|
-
var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
672
|
-
|
|
673
|
-
if (lng && lng.toLowerCase() === 'cimode') {
|
|
674
|
-
if (appendNamespaceToCIMode) {
|
|
675
|
-
var nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
676
|
-
|
|
677
|
-
if (returnDetails) {
|
|
678
|
-
resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
|
|
679
|
-
return resolved;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
return "".concat(namespace).concat(nsSeparator).concat(key);
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
if (returnDetails) {
|
|
686
|
-
resolved.res = key;
|
|
687
|
-
return resolved;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
return key;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
var resolved = this.resolve(keys, options);
|
|
694
|
-
var res = resolved && resolved.res;
|
|
695
|
-
var resUsedKey = resolved && resolved.usedKey || key;
|
|
696
|
-
var resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
697
|
-
var resType = Object.prototype.toString.apply(res);
|
|
698
|
-
var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
699
|
-
var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
700
|
-
var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
701
|
-
var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
702
|
-
|
|
703
|
-
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
704
|
-
if (!options.returnObjects && !this.options.returnObjects) {
|
|
705
|
-
if (!this.options.returnedObjectHandler) {
|
|
706
|
-
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2(_objectSpread$2({}, options), {}, {
|
|
710
|
-
ns: namespaces
|
|
711
|
-
})) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
712
|
-
|
|
713
|
-
if (returnDetails) {
|
|
714
|
-
resolved.res = r;
|
|
715
|
-
return resolved;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
return r;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
if (keySeparator) {
|
|
722
|
-
var resTypeIsArray = resType === '[object Array]';
|
|
723
|
-
var copy = resTypeIsArray ? [] : {};
|
|
724
|
-
var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
725
|
-
|
|
726
|
-
for (var m in res) {
|
|
727
|
-
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
728
|
-
var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
729
|
-
copy[m] = this.translate(deepKey, _objectSpread$2(_objectSpread$2({}, options), {
|
|
730
|
-
joinArrays: false,
|
|
731
|
-
ns: namespaces
|
|
732
|
-
}));
|
|
733
|
-
if (copy[m] === deepKey) copy[m] = res[m];
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
res = copy;
|
|
738
|
-
}
|
|
739
|
-
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
740
|
-
res = res.join(joinArrays);
|
|
741
|
-
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
742
|
-
} else {
|
|
743
|
-
var usedDefault = false;
|
|
744
|
-
var usedKey = false;
|
|
745
|
-
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
746
|
-
var hasDefaultValue = Translator.hasDefaultValue(options);
|
|
747
|
-
var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
|
|
748
|
-
var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
|
|
749
|
-
|
|
750
|
-
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
751
|
-
usedDefault = true;
|
|
752
|
-
res = defaultValue;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
if (!this.isValidLookup(res)) {
|
|
756
|
-
usedKey = true;
|
|
757
|
-
res = key;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
761
|
-
var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
762
|
-
var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
763
|
-
|
|
764
|
-
if (usedKey || usedDefault || updateMissing) {
|
|
765
|
-
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
766
|
-
|
|
767
|
-
if (keySeparator) {
|
|
768
|
-
var fk = this.resolve(key, _objectSpread$2(_objectSpread$2({}, options), {}, {
|
|
769
|
-
keySeparator: false
|
|
770
|
-
}));
|
|
771
|
-
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.');
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
var lngs = [];
|
|
775
|
-
var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
776
|
-
|
|
777
|
-
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
778
|
-
for (var i = 0; i < fallbackLngs.length; i++) {
|
|
779
|
-
lngs.push(fallbackLngs[i]);
|
|
780
|
-
}
|
|
781
|
-
} else if (this.options.saveMissingTo === 'all') {
|
|
782
|
-
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
783
|
-
} else {
|
|
784
|
-
lngs.push(options.lng || this.language);
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
var send = function send(l, k, specificDefaultValue) {
|
|
788
|
-
var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
|
|
789
|
-
|
|
790
|
-
if (_this2.options.missingKeyHandler) {
|
|
791
|
-
_this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
792
|
-
} else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
|
|
793
|
-
_this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
_this2.emit('missingKey', l, namespace, k, res);
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
if (this.options.saveMissing) {
|
|
800
|
-
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
801
|
-
lngs.forEach(function (language) {
|
|
802
|
-
_this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
|
|
803
|
-
send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue);
|
|
804
|
-
});
|
|
805
|
-
});
|
|
806
|
-
} else {
|
|
807
|
-
send(lngs, key, defaultValue);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
813
|
-
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key);
|
|
814
|
-
|
|
815
|
-
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
|
|
816
|
-
if (this.options.compatibilityAPI !== 'v1') {
|
|
817
|
-
res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
|
|
818
|
-
} else {
|
|
819
|
-
res = this.options.parseMissingKeyHandler(res);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
if (returnDetails) {
|
|
825
|
-
resolved.res = res;
|
|
826
|
-
return resolved;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
return res;
|
|
830
|
-
}
|
|
831
|
-
}, {
|
|
832
|
-
key: "extendTranslation",
|
|
833
|
-
value: function extendTranslation(res, key, options, resolved, lastKey) {
|
|
834
|
-
var _this3 = this;
|
|
835
|
-
|
|
836
|
-
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
837
|
-
res = this.i18nFormat.parse(res, _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
838
|
-
resolved: resolved
|
|
839
|
-
});
|
|
840
|
-
} else if (!options.skipInterpolation) {
|
|
841
|
-
if (options.interpolation) this.interpolator.init(_objectSpread$2(_objectSpread$2({}, options), {
|
|
842
|
-
interpolation: _objectSpread$2(_objectSpread$2({}, this.options.interpolation), options.interpolation)
|
|
843
|
-
}));
|
|
844
|
-
var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
845
|
-
var nestBef;
|
|
846
|
-
|
|
847
|
-
if (skipOnVariables) {
|
|
848
|
-
var nb = res.match(this.interpolator.nestingRegexp);
|
|
849
|
-
nestBef = nb && nb.length;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
853
|
-
if (this.options.interpolation.defaultVariables) data = _objectSpread$2(_objectSpread$2({}, this.options.interpolation.defaultVariables), data);
|
|
854
|
-
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
855
|
-
|
|
856
|
-
if (skipOnVariables) {
|
|
857
|
-
var na = res.match(this.interpolator.nestingRegexp);
|
|
858
|
-
var nestAft = na && na.length;
|
|
859
|
-
if (nestBef < nestAft) options.nest = false;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
863
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
864
|
-
args[_key] = arguments[_key];
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
868
|
-
_this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
|
|
869
|
-
|
|
870
|
-
return null;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
return _this3.translate.apply(_this3, args.concat([key]));
|
|
874
|
-
}, options);
|
|
875
|
-
if (options.interpolation) this.interpolator.reset();
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
var postProcess = options.postProcess || this.options.postProcess;
|
|
879
|
-
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
880
|
-
|
|
881
|
-
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
882
|
-
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2({
|
|
883
|
-
i18nResolved: resolved
|
|
884
|
-
}, options) : options, this);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
return res;
|
|
888
|
-
}
|
|
889
|
-
}, {
|
|
890
|
-
key: "resolve",
|
|
891
|
-
value: function resolve(keys) {
|
|
892
|
-
var _this4 = this;
|
|
893
|
-
|
|
894
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
895
|
-
var found;
|
|
896
|
-
var usedKey;
|
|
897
|
-
var exactUsedKey;
|
|
898
|
-
var usedLng;
|
|
899
|
-
var usedNS;
|
|
900
|
-
if (typeof keys === 'string') keys = [keys];
|
|
901
|
-
keys.forEach(function (k) {
|
|
902
|
-
if (_this4.isValidLookup(found)) return;
|
|
903
|
-
|
|
904
|
-
var extracted = _this4.extractFromKey(k, options);
|
|
905
|
-
|
|
906
|
-
var key = extracted.key;
|
|
907
|
-
usedKey = key;
|
|
908
|
-
var namespaces = extracted.namespaces;
|
|
909
|
-
if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
|
|
910
|
-
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
911
|
-
|
|
912
|
-
var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
|
|
913
|
-
|
|
914
|
-
var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
915
|
-
var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
|
|
916
|
-
namespaces.forEach(function (ns) {
|
|
917
|
-
if (_this4.isValidLookup(found)) return;
|
|
918
|
-
usedNS = ns;
|
|
919
|
-
|
|
920
|
-
if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
|
|
921
|
-
checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
|
|
922
|
-
|
|
923
|
-
_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!!!');
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
codes.forEach(function (code) {
|
|
927
|
-
if (_this4.isValidLookup(found)) return;
|
|
928
|
-
usedLng = code;
|
|
929
|
-
var finalKeys = [key];
|
|
930
|
-
|
|
931
|
-
if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
|
|
932
|
-
_this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
933
|
-
} else {
|
|
934
|
-
var pluralSuffix;
|
|
935
|
-
if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
|
|
936
|
-
var zeroSuffix = '_zero';
|
|
937
|
-
|
|
938
|
-
if (needsPluralHandling) {
|
|
939
|
-
finalKeys.push(key + pluralSuffix);
|
|
940
|
-
|
|
941
|
-
if (needsZeroSuffixLookup) {
|
|
942
|
-
finalKeys.push(key + zeroSuffix);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
if (needsContextHandling) {
|
|
947
|
-
var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
|
|
948
|
-
finalKeys.push(contextKey);
|
|
949
|
-
|
|
950
|
-
if (needsPluralHandling) {
|
|
951
|
-
finalKeys.push(contextKey + pluralSuffix);
|
|
952
|
-
|
|
953
|
-
if (needsZeroSuffixLookup) {
|
|
954
|
-
finalKeys.push(contextKey + zeroSuffix);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
var possibleKey;
|
|
961
|
-
|
|
962
|
-
while (possibleKey = finalKeys.pop()) {
|
|
963
|
-
if (!_this4.isValidLookup(found)) {
|
|
964
|
-
exactUsedKey = possibleKey;
|
|
965
|
-
found = _this4.getResource(code, ns, possibleKey, options);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
});
|
|
969
|
-
});
|
|
970
|
-
});
|
|
971
|
-
return {
|
|
972
|
-
res: found,
|
|
973
|
-
usedKey: usedKey,
|
|
974
|
-
exactUsedKey: exactUsedKey,
|
|
975
|
-
usedLng: usedLng,
|
|
976
|
-
usedNS: usedNS
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
}, {
|
|
980
|
-
key: "isValidLookup",
|
|
981
|
-
value: function isValidLookup(res) {
|
|
982
|
-
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
983
|
-
}
|
|
984
|
-
}, {
|
|
985
|
-
key: "getResource",
|
|
986
|
-
value: function getResource(code, ns, key) {
|
|
987
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
988
|
-
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
989
|
-
return this.resourceStore.getResource(code, ns, key, options);
|
|
990
|
-
}
|
|
991
|
-
}], [{
|
|
992
|
-
key: "hasDefaultValue",
|
|
993
|
-
value: function hasDefaultValue(options) {
|
|
994
|
-
var prefix = 'defaultValue';
|
|
995
|
-
|
|
996
|
-
for (var option in options) {
|
|
997
|
-
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
998
|
-
return true;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
return false;
|
|
1003
|
-
}
|
|
1004
|
-
}]);
|
|
1005
|
-
|
|
1006
|
-
return Translator;
|
|
1007
|
-
}(EventEmitter);
|
|
1008
|
-
|
|
1009
|
-
function capitalize(string) {
|
|
1010
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
var LanguageUtil = function () {
|
|
1014
|
-
function LanguageUtil(options) {
|
|
1015
|
-
_classCallCheck(this, LanguageUtil);
|
|
1016
|
-
|
|
1017
|
-
this.options = options;
|
|
1018
|
-
this.supportedLngs = this.options.supportedLngs || false;
|
|
1019
|
-
this.logger = baseLogger.create('languageUtils');
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
_createClass(LanguageUtil, [{
|
|
1023
|
-
key: "getScriptPartFromCode",
|
|
1024
|
-
value: function getScriptPartFromCode(code) {
|
|
1025
|
-
if (!code || code.indexOf('-') < 0) return null;
|
|
1026
|
-
var p = code.split('-');
|
|
1027
|
-
if (p.length === 2) return null;
|
|
1028
|
-
p.pop();
|
|
1029
|
-
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
1030
|
-
return this.formatLanguageCode(p.join('-'));
|
|
1031
|
-
}
|
|
1032
|
-
}, {
|
|
1033
|
-
key: "getLanguagePartFromCode",
|
|
1034
|
-
value: function getLanguagePartFromCode(code) {
|
|
1035
|
-
if (!code || code.indexOf('-') < 0) return code;
|
|
1036
|
-
var p = code.split('-');
|
|
1037
|
-
return this.formatLanguageCode(p[0]);
|
|
1038
|
-
}
|
|
1039
|
-
}, {
|
|
1040
|
-
key: "formatLanguageCode",
|
|
1041
|
-
value: function formatLanguageCode(code) {
|
|
1042
|
-
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
1043
|
-
var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
1044
|
-
var p = code.split('-');
|
|
1045
|
-
|
|
1046
|
-
if (this.options.lowerCaseLng) {
|
|
1047
|
-
p = p.map(function (part) {
|
|
1048
|
-
return part.toLowerCase();
|
|
1049
|
-
});
|
|
1050
|
-
} else if (p.length === 2) {
|
|
1051
|
-
p[0] = p[0].toLowerCase();
|
|
1052
|
-
p[1] = p[1].toUpperCase();
|
|
1053
|
-
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
1054
|
-
} else if (p.length === 3) {
|
|
1055
|
-
p[0] = p[0].toLowerCase();
|
|
1056
|
-
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
1057
|
-
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
1058
|
-
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
1059
|
-
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
return p.join('-');
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
1066
|
-
}
|
|
1067
|
-
}, {
|
|
1068
|
-
key: "isSupportedCode",
|
|
1069
|
-
value: function isSupportedCode(code) {
|
|
1070
|
-
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
1071
|
-
code = this.getLanguagePartFromCode(code);
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
1075
|
-
}
|
|
1076
|
-
}, {
|
|
1077
|
-
key: "getBestMatchFromCodes",
|
|
1078
|
-
value: function getBestMatchFromCodes(codes) {
|
|
1079
|
-
var _this = this;
|
|
1080
|
-
|
|
1081
|
-
if (!codes) return null;
|
|
1082
|
-
var found;
|
|
1083
|
-
codes.forEach(function (code) {
|
|
1084
|
-
if (found) return;
|
|
1085
|
-
|
|
1086
|
-
var cleanedLng = _this.formatLanguageCode(code);
|
|
1087
|
-
|
|
1088
|
-
if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
if (!found && this.options.supportedLngs) {
|
|
1092
|
-
codes.forEach(function (code) {
|
|
1093
|
-
if (found) return;
|
|
1094
|
-
|
|
1095
|
-
var lngOnly = _this.getLanguagePartFromCode(code);
|
|
1096
|
-
|
|
1097
|
-
if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
1098
|
-
found = _this.options.supportedLngs.find(function (supportedLng) {
|
|
1099
|
-
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
1105
|
-
return found;
|
|
1106
|
-
}
|
|
1107
|
-
}, {
|
|
1108
|
-
key: "getFallbackCodes",
|
|
1109
|
-
value: function getFallbackCodes(fallbacks, code) {
|
|
1110
|
-
if (!fallbacks) return [];
|
|
1111
|
-
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
1112
|
-
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
1113
|
-
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
1114
|
-
if (!code) return fallbacks["default"] || [];
|
|
1115
|
-
var found = fallbacks[code];
|
|
1116
|
-
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
1117
|
-
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
1118
|
-
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
1119
|
-
if (!found) found = fallbacks["default"];
|
|
1120
|
-
return found || [];
|
|
1121
|
-
}
|
|
1122
|
-
}, {
|
|
1123
|
-
key: "toResolveHierarchy",
|
|
1124
|
-
value: function toResolveHierarchy(code, fallbackCode) {
|
|
1125
|
-
var _this2 = this;
|
|
1126
|
-
|
|
1127
|
-
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
1128
|
-
var codes = [];
|
|
1129
|
-
|
|
1130
|
-
var addCode = function addCode(c) {
|
|
1131
|
-
if (!c) return;
|
|
1132
|
-
|
|
1133
|
-
if (_this2.isSupportedCode(c)) {
|
|
1134
|
-
codes.push(c);
|
|
1135
|
-
} else {
|
|
1136
|
-
_this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
1141
|
-
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
1142
|
-
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
1143
|
-
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
1144
|
-
} else if (typeof code === 'string') {
|
|
1145
|
-
addCode(this.formatLanguageCode(code));
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
fallbackCodes.forEach(function (fc) {
|
|
1149
|
-
if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
|
|
1150
|
-
});
|
|
1151
|
-
return codes;
|
|
1152
|
-
}
|
|
1153
|
-
}]);
|
|
1154
|
-
|
|
1155
|
-
return LanguageUtil;
|
|
1156
|
-
}();
|
|
1157
|
-
|
|
1158
|
-
var sets = [{
|
|
1159
|
-
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
1160
|
-
nr: [1, 2],
|
|
1161
|
-
fc: 1
|
|
1162
|
-
}, {
|
|
1163
|
-
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'],
|
|
1164
|
-
nr: [1, 2],
|
|
1165
|
-
fc: 2
|
|
1166
|
-
}, {
|
|
1167
|
-
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
1168
|
-
nr: [1],
|
|
1169
|
-
fc: 3
|
|
1170
|
-
}, {
|
|
1171
|
-
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
1172
|
-
nr: [1, 2, 5],
|
|
1173
|
-
fc: 4
|
|
1174
|
-
}, {
|
|
1175
|
-
lngs: ['ar'],
|
|
1176
|
-
nr: [0, 1, 2, 3, 11, 100],
|
|
1177
|
-
fc: 5
|
|
1178
|
-
}, {
|
|
1179
|
-
lngs: ['cs', 'sk'],
|
|
1180
|
-
nr: [1, 2, 5],
|
|
1181
|
-
fc: 6
|
|
1182
|
-
}, {
|
|
1183
|
-
lngs: ['csb', 'pl'],
|
|
1184
|
-
nr: [1, 2, 5],
|
|
1185
|
-
fc: 7
|
|
1186
|
-
}, {
|
|
1187
|
-
lngs: ['cy'],
|
|
1188
|
-
nr: [1, 2, 3, 8],
|
|
1189
|
-
fc: 8
|
|
1190
|
-
}, {
|
|
1191
|
-
lngs: ['fr'],
|
|
1192
|
-
nr: [1, 2],
|
|
1193
|
-
fc: 9
|
|
1194
|
-
}, {
|
|
1195
|
-
lngs: ['ga'],
|
|
1196
|
-
nr: [1, 2, 3, 7, 11],
|
|
1197
|
-
fc: 10
|
|
1198
|
-
}, {
|
|
1199
|
-
lngs: ['gd'],
|
|
1200
|
-
nr: [1, 2, 3, 20],
|
|
1201
|
-
fc: 11
|
|
1202
|
-
}, {
|
|
1203
|
-
lngs: ['is'],
|
|
1204
|
-
nr: [1, 2],
|
|
1205
|
-
fc: 12
|
|
1206
|
-
}, {
|
|
1207
|
-
lngs: ['jv'],
|
|
1208
|
-
nr: [0, 1],
|
|
1209
|
-
fc: 13
|
|
1210
|
-
}, {
|
|
1211
|
-
lngs: ['kw'],
|
|
1212
|
-
nr: [1, 2, 3, 4],
|
|
1213
|
-
fc: 14
|
|
1214
|
-
}, {
|
|
1215
|
-
lngs: ['lt'],
|
|
1216
|
-
nr: [1, 2, 10],
|
|
1217
|
-
fc: 15
|
|
1218
|
-
}, {
|
|
1219
|
-
lngs: ['lv'],
|
|
1220
|
-
nr: [1, 2, 0],
|
|
1221
|
-
fc: 16
|
|
1222
|
-
}, {
|
|
1223
|
-
lngs: ['mk'],
|
|
1224
|
-
nr: [1, 2],
|
|
1225
|
-
fc: 17
|
|
1226
|
-
}, {
|
|
1227
|
-
lngs: ['mnk'],
|
|
1228
|
-
nr: [0, 1, 2],
|
|
1229
|
-
fc: 18
|
|
1230
|
-
}, {
|
|
1231
|
-
lngs: ['mt'],
|
|
1232
|
-
nr: [1, 2, 11, 20],
|
|
1233
|
-
fc: 19
|
|
1234
|
-
}, {
|
|
1235
|
-
lngs: ['or'],
|
|
1236
|
-
nr: [2, 1],
|
|
1237
|
-
fc: 2
|
|
1238
|
-
}, {
|
|
1239
|
-
lngs: ['ro'],
|
|
1240
|
-
nr: [1, 2, 20],
|
|
1241
|
-
fc: 20
|
|
1242
|
-
}, {
|
|
1243
|
-
lngs: ['sl'],
|
|
1244
|
-
nr: [5, 1, 2, 3],
|
|
1245
|
-
fc: 21
|
|
1246
|
-
}, {
|
|
1247
|
-
lngs: ['he', 'iw'],
|
|
1248
|
-
nr: [1, 2, 20, 21],
|
|
1249
|
-
fc: 22
|
|
1250
|
-
}];
|
|
1251
|
-
var _rulesPluralsTypes = {
|
|
1252
|
-
1: function _(n) {
|
|
1253
|
-
return Number(n > 1);
|
|
1254
|
-
},
|
|
1255
|
-
2: function _(n) {
|
|
1256
|
-
return Number(n != 1);
|
|
1257
|
-
},
|
|
1258
|
-
3: function _(n) {
|
|
1259
|
-
return 0;
|
|
1260
|
-
},
|
|
1261
|
-
4: function _(n) {
|
|
1262
|
-
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
1263
|
-
},
|
|
1264
|
-
5: function _(n) {
|
|
1265
|
-
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
1266
|
-
},
|
|
1267
|
-
6: function _(n) {
|
|
1268
|
-
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
1269
|
-
},
|
|
1270
|
-
7: function _(n) {
|
|
1271
|
-
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
1272
|
-
},
|
|
1273
|
-
8: function _(n) {
|
|
1274
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
1275
|
-
},
|
|
1276
|
-
9: function _(n) {
|
|
1277
|
-
return Number(n >= 2);
|
|
1278
|
-
},
|
|
1279
|
-
10: function _(n) {
|
|
1280
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
1281
|
-
},
|
|
1282
|
-
11: function _(n) {
|
|
1283
|
-
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
1284
|
-
},
|
|
1285
|
-
12: function _(n) {
|
|
1286
|
-
return Number(n % 10 != 1 || n % 100 == 11);
|
|
1287
|
-
},
|
|
1288
|
-
13: function _(n) {
|
|
1289
|
-
return Number(n !== 0);
|
|
1290
|
-
},
|
|
1291
|
-
14: function _(n) {
|
|
1292
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
1293
|
-
},
|
|
1294
|
-
15: function _(n) {
|
|
1295
|
-
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
1296
|
-
},
|
|
1297
|
-
16: function _(n) {
|
|
1298
|
-
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
1299
|
-
},
|
|
1300
|
-
17: function _(n) {
|
|
1301
|
-
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
1302
|
-
},
|
|
1303
|
-
18: function _(n) {
|
|
1304
|
-
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
1305
|
-
},
|
|
1306
|
-
19: function _(n) {
|
|
1307
|
-
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
1308
|
-
},
|
|
1309
|
-
20: function _(n) {
|
|
1310
|
-
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
1311
|
-
},
|
|
1312
|
-
21: function _(n) {
|
|
1313
|
-
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
1314
|
-
},
|
|
1315
|
-
22: function _(n) {
|
|
1316
|
-
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
1317
|
-
}
|
|
1318
|
-
};
|
|
1319
|
-
var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
|
|
1320
|
-
var suffixesOrder = {
|
|
1321
|
-
zero: 0,
|
|
1322
|
-
one: 1,
|
|
1323
|
-
two: 2,
|
|
1324
|
-
few: 3,
|
|
1325
|
-
many: 4,
|
|
1326
|
-
other: 5
|
|
1327
|
-
};
|
|
1328
|
-
|
|
1329
|
-
function createRules() {
|
|
1330
|
-
var rules = {};
|
|
1331
|
-
sets.forEach(function (set) {
|
|
1332
|
-
set.lngs.forEach(function (l) {
|
|
1333
|
-
rules[l] = {
|
|
1334
|
-
numbers: set.nr,
|
|
1335
|
-
plurals: _rulesPluralsTypes[set.fc]
|
|
1336
|
-
};
|
|
1337
|
-
});
|
|
1338
|
-
});
|
|
1339
|
-
return rules;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
var PluralResolver = function () {
|
|
1343
|
-
function PluralResolver(languageUtils) {
|
|
1344
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1345
|
-
|
|
1346
|
-
_classCallCheck(this, PluralResolver);
|
|
1347
|
-
|
|
1348
|
-
this.languageUtils = languageUtils;
|
|
1349
|
-
this.options = options;
|
|
1350
|
-
this.logger = baseLogger.create('pluralResolver');
|
|
1351
|
-
|
|
1352
|
-
if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
|
|
1353
|
-
this.options.compatibilityJSON = 'v3';
|
|
1354
|
-
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.');
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
this.rules = createRules();
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
_createClass(PluralResolver, [{
|
|
1361
|
-
key: "addRule",
|
|
1362
|
-
value: function addRule(lng, obj) {
|
|
1363
|
-
this.rules[lng] = obj;
|
|
1364
|
-
}
|
|
1365
|
-
}, {
|
|
1366
|
-
key: "getRule",
|
|
1367
|
-
value: function getRule(code) {
|
|
1368
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1369
|
-
|
|
1370
|
-
if (this.shouldUseIntlApi()) {
|
|
1371
|
-
try {
|
|
1372
|
-
return new Intl.PluralRules(code, {
|
|
1373
|
-
type: options.ordinal ? 'ordinal' : 'cardinal'
|
|
1374
|
-
});
|
|
1375
|
-
} catch (_unused) {
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
1381
|
-
}
|
|
1382
|
-
}, {
|
|
1383
|
-
key: "needsPlural",
|
|
1384
|
-
value: function needsPlural(code) {
|
|
1385
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1386
|
-
var rule = this.getRule(code, options);
|
|
1387
|
-
|
|
1388
|
-
if (this.shouldUseIntlApi()) {
|
|
1389
|
-
return rule && rule.resolvedOptions().pluralCategories.length > 1;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
return rule && rule.numbers.length > 1;
|
|
1393
|
-
}
|
|
1394
|
-
}, {
|
|
1395
|
-
key: "getPluralFormsOfKey",
|
|
1396
|
-
value: function getPluralFormsOfKey(code, key) {
|
|
1397
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1398
|
-
return this.getSuffixes(code, options).map(function (suffix) {
|
|
1399
|
-
return "".concat(key).concat(suffix);
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
}, {
|
|
1403
|
-
key: "getSuffixes",
|
|
1404
|
-
value: function getSuffixes(code) {
|
|
1405
|
-
var _this = this;
|
|
1406
|
-
|
|
1407
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1408
|
-
var rule = this.getRule(code, options);
|
|
1409
|
-
|
|
1410
|
-
if (!rule) {
|
|
1411
|
-
return [];
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
if (this.shouldUseIntlApi()) {
|
|
1415
|
-
return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
|
|
1416
|
-
return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
|
|
1417
|
-
}).map(function (pluralCategory) {
|
|
1418
|
-
return "".concat(_this.options.prepend).concat(pluralCategory);
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
return rule.numbers.map(function (number) {
|
|
1423
|
-
return _this.getSuffix(code, number, options);
|
|
1424
|
-
});
|
|
1425
|
-
}
|
|
1426
|
-
}, {
|
|
1427
|
-
key: "getSuffix",
|
|
1428
|
-
value: function getSuffix(code, count) {
|
|
1429
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1430
|
-
var rule = this.getRule(code, options);
|
|
1431
|
-
|
|
1432
|
-
if (rule) {
|
|
1433
|
-
if (this.shouldUseIntlApi()) {
|
|
1434
|
-
return "".concat(this.options.prepend).concat(rule.select(count));
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
return this.getSuffixRetroCompatible(rule, count);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
this.logger.warn("no plural rule found for: ".concat(code));
|
|
1441
|
-
return '';
|
|
1442
|
-
}
|
|
1443
|
-
}, {
|
|
1444
|
-
key: "getSuffixRetroCompatible",
|
|
1445
|
-
value: function getSuffixRetroCompatible(rule, count) {
|
|
1446
|
-
var _this2 = this;
|
|
1447
|
-
|
|
1448
|
-
var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
1449
|
-
var suffix = rule.numbers[idx];
|
|
1450
|
-
|
|
1451
|
-
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
1452
|
-
if (suffix === 2) {
|
|
1453
|
-
suffix = 'plural';
|
|
1454
|
-
} else if (suffix === 1) {
|
|
1455
|
-
suffix = '';
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
var returnSuffix = function returnSuffix() {
|
|
1460
|
-
return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
if (this.options.compatibilityJSON === 'v1') {
|
|
1464
|
-
if (suffix === 1) return '';
|
|
1465
|
-
if (typeof suffix === 'number') return "_plural_".concat(suffix.toString());
|
|
1466
|
-
return returnSuffix();
|
|
1467
|
-
} else if (this.options.compatibilityJSON === 'v2') {
|
|
1468
|
-
return returnSuffix();
|
|
1469
|
-
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
1470
|
-
return returnSuffix();
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
1474
|
-
}
|
|
1475
|
-
}, {
|
|
1476
|
-
key: "shouldUseIntlApi",
|
|
1477
|
-
value: function shouldUseIntlApi() {
|
|
1478
|
-
return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
|
|
1479
|
-
}
|
|
1480
|
-
}]);
|
|
1481
|
-
|
|
1482
|
-
return PluralResolver;
|
|
1483
|
-
}();
|
|
1484
|
-
|
|
1485
|
-
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1486
|
-
|
|
1487
|
-
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1488
|
-
|
|
1489
|
-
var Interpolator = function () {
|
|
1490
|
-
function Interpolator() {
|
|
1491
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1492
|
-
|
|
1493
|
-
_classCallCheck(this, Interpolator);
|
|
1494
|
-
|
|
1495
|
-
this.logger = baseLogger.create('interpolator');
|
|
1496
|
-
this.options = options;
|
|
1497
|
-
|
|
1498
|
-
this.format = options.interpolation && options.interpolation.format || function (value) {
|
|
1499
|
-
return value;
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
this.init(options);
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
_createClass(Interpolator, [{
|
|
1506
|
-
key: "init",
|
|
1507
|
-
value: function init() {
|
|
1508
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1509
|
-
if (!options.interpolation) options.interpolation = {
|
|
1510
|
-
escapeValue: true
|
|
1511
|
-
};
|
|
1512
|
-
var iOpts = options.interpolation;
|
|
1513
|
-
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
|
|
1514
|
-
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
1515
|
-
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
1516
|
-
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
1517
|
-
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
1518
|
-
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
1519
|
-
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
1520
|
-
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
1521
|
-
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
1522
|
-
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
1523
|
-
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
1524
|
-
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
1525
|
-
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
1526
|
-
this.resetRegExp();
|
|
1527
|
-
}
|
|
1528
|
-
}, {
|
|
1529
|
-
key: "reset",
|
|
1530
|
-
value: function reset() {
|
|
1531
|
-
if (this.options) this.init(this.options);
|
|
1532
|
-
}
|
|
1533
|
-
}, {
|
|
1534
|
-
key: "resetRegExp",
|
|
1535
|
-
value: function resetRegExp() {
|
|
1536
|
-
var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
1537
|
-
this.regexp = new RegExp(regexpStr, 'g');
|
|
1538
|
-
var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
1539
|
-
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
1540
|
-
var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
1541
|
-
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
1542
|
-
}
|
|
1543
|
-
}, {
|
|
1544
|
-
key: "interpolate",
|
|
1545
|
-
value: function interpolate(str, data, lng, options) {
|
|
1546
|
-
var _this = this;
|
|
1547
|
-
|
|
1548
|
-
var match;
|
|
1549
|
-
var value;
|
|
1550
|
-
var replaces;
|
|
1551
|
-
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
1552
|
-
|
|
1553
|
-
function regexSafe(val) {
|
|
1554
|
-
return val.replace(/\$/g, '$$$$');
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
var handleFormat = function handleFormat(key) {
|
|
1558
|
-
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
1559
|
-
var path = getPathWithDefaults(data, defaultData, key);
|
|
1560
|
-
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
1561
|
-
interpolationkey: key
|
|
1562
|
-
})) : path;
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
var p = key.split(_this.formatSeparator);
|
|
1566
|
-
var k = p.shift().trim();
|
|
1567
|
-
var f = p.join(_this.formatSeparator).trim();
|
|
1568
|
-
return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
|
|
1569
|
-
interpolationkey: k
|
|
1570
|
-
}));
|
|
1571
|
-
};
|
|
1572
|
-
|
|
1573
|
-
this.resetRegExp();
|
|
1574
|
-
var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
1575
|
-
var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
1576
|
-
var todos = [{
|
|
1577
|
-
regex: this.regexpUnescape,
|
|
1578
|
-
safeValue: function safeValue(val) {
|
|
1579
|
-
return regexSafe(val);
|
|
1580
|
-
}
|
|
1581
|
-
}, {
|
|
1582
|
-
regex: this.regexp,
|
|
1583
|
-
safeValue: function safeValue(val) {
|
|
1584
|
-
return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
|
|
1585
|
-
}
|
|
1586
|
-
}];
|
|
1587
|
-
todos.forEach(function (todo) {
|
|
1588
|
-
replaces = 0;
|
|
1589
|
-
|
|
1590
|
-
while (match = todo.regex.exec(str)) {
|
|
1591
|
-
var matchedVar = match[1].trim();
|
|
1592
|
-
value = handleFormat(matchedVar);
|
|
1593
|
-
|
|
1594
|
-
if (value === undefined) {
|
|
1595
|
-
if (typeof missingInterpolationHandler === 'function') {
|
|
1596
|
-
var temp = missingInterpolationHandler(str, match, options);
|
|
1597
|
-
value = typeof temp === 'string' ? temp : '';
|
|
1598
|
-
} else if (options && options.hasOwnProperty(matchedVar)) {
|
|
1599
|
-
value = '';
|
|
1600
|
-
} else if (skipOnVariables) {
|
|
1601
|
-
value = match[0];
|
|
1602
|
-
continue;
|
|
1603
|
-
} else {
|
|
1604
|
-
_this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
|
|
1605
|
-
|
|
1606
|
-
value = '';
|
|
1607
|
-
}
|
|
1608
|
-
} else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
|
|
1609
|
-
value = makeString(value);
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
var safeValue = todo.safeValue(value);
|
|
1613
|
-
str = str.replace(match[0], safeValue);
|
|
1614
|
-
|
|
1615
|
-
if (skipOnVariables) {
|
|
1616
|
-
todo.regex.lastIndex += value.length;
|
|
1617
|
-
todo.regex.lastIndex -= match[0].length;
|
|
1618
|
-
} else {
|
|
1619
|
-
todo.regex.lastIndex = 0;
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
replaces++;
|
|
1623
|
-
|
|
1624
|
-
if (replaces >= _this.maxReplaces) {
|
|
1625
|
-
break;
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
});
|
|
1629
|
-
return str;
|
|
1630
|
-
}
|
|
1631
|
-
}, {
|
|
1632
|
-
key: "nest",
|
|
1633
|
-
value: function nest(str, fc) {
|
|
1634
|
-
var _this2 = this;
|
|
1635
|
-
|
|
1636
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1637
|
-
var match;
|
|
1638
|
-
var value;
|
|
1639
|
-
|
|
1640
|
-
var clonedOptions = _objectSpread$3({}, options);
|
|
1641
|
-
|
|
1642
|
-
clonedOptions.applyPostProcessor = false;
|
|
1643
|
-
delete clonedOptions.defaultValue;
|
|
1644
|
-
|
|
1645
|
-
function handleHasOptions(key, inheritedOptions) {
|
|
1646
|
-
var sep = this.nestingOptionsSeparator;
|
|
1647
|
-
if (key.indexOf(sep) < 0) return key;
|
|
1648
|
-
var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
|
|
1649
|
-
var optionsString = "{".concat(c[1]);
|
|
1650
|
-
key = c[0];
|
|
1651
|
-
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
1652
|
-
optionsString = optionsString.replace(/'/g, '"');
|
|
1653
|
-
|
|
1654
|
-
try {
|
|
1655
|
-
clonedOptions = JSON.parse(optionsString);
|
|
1656
|
-
if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
|
|
1657
|
-
} catch (e) {
|
|
1658
|
-
this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
|
|
1659
|
-
return "".concat(key).concat(sep).concat(optionsString);
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
delete clonedOptions.defaultValue;
|
|
1663
|
-
return key;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
while (match = this.nestingRegexp.exec(str)) {
|
|
1667
|
-
var formatters = [];
|
|
1668
|
-
var doReduce = false;
|
|
1669
|
-
|
|
1670
|
-
if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
|
|
1671
|
-
var r = match[1].split(this.formatSeparator).map(function (elem) {
|
|
1672
|
-
return elem.trim();
|
|
1673
|
-
});
|
|
1674
|
-
match[1] = r.shift();
|
|
1675
|
-
formatters = r;
|
|
1676
|
-
doReduce = true;
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
1680
|
-
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
1681
|
-
if (typeof value !== 'string') value = makeString(value);
|
|
1682
|
-
|
|
1683
|
-
if (!value) {
|
|
1684
|
-
this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str));
|
|
1685
|
-
value = '';
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
if (doReduce) {
|
|
1689
|
-
value = formatters.reduce(function (v, f) {
|
|
1690
|
-
return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
1691
|
-
interpolationkey: match[1].trim()
|
|
1692
|
-
}));
|
|
1693
|
-
}, value.trim());
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
str = str.replace(match[0], value);
|
|
1697
|
-
this.regexp.lastIndex = 0;
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
return str;
|
|
1701
|
-
}
|
|
1702
|
-
}]);
|
|
1703
|
-
|
|
1704
|
-
return Interpolator;
|
|
1705
|
-
}();
|
|
1706
|
-
|
|
1707
|
-
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1708
|
-
|
|
1709
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1710
|
-
|
|
1711
|
-
function parseFormatStr(formatStr) {
|
|
1712
|
-
var formatName = formatStr.toLowerCase().trim();
|
|
1713
|
-
var formatOptions = {};
|
|
1714
|
-
|
|
1715
|
-
if (formatStr.indexOf('(') > -1) {
|
|
1716
|
-
var p = formatStr.split('(');
|
|
1717
|
-
formatName = p[0].toLowerCase().trim();
|
|
1718
|
-
var optStr = p[1].substring(0, p[1].length - 1);
|
|
1719
|
-
|
|
1720
|
-
if (formatName === 'currency' && optStr.indexOf(':') < 0) {
|
|
1721
|
-
if (!formatOptions.currency) formatOptions.currency = optStr.trim();
|
|
1722
|
-
} else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
|
|
1723
|
-
if (!formatOptions.range) formatOptions.range = optStr.trim();
|
|
1724
|
-
} else {
|
|
1725
|
-
var opts = optStr.split(';');
|
|
1726
|
-
opts.forEach(function (opt) {
|
|
1727
|
-
if (!opt) return;
|
|
1728
|
-
|
|
1729
|
-
var _opt$split = opt.split(':'),
|
|
1730
|
-
_opt$split2 = _toArray(_opt$split),
|
|
1731
|
-
key = _opt$split2[0],
|
|
1732
|
-
rest = _opt$split2.slice(1);
|
|
1733
|
-
|
|
1734
|
-
var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
|
|
1735
|
-
if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
|
|
1736
|
-
if (val === 'false') formatOptions[key.trim()] = false;
|
|
1737
|
-
if (val === 'true') formatOptions[key.trim()] = true;
|
|
1738
|
-
if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
return {
|
|
1744
|
-
formatName: formatName,
|
|
1745
|
-
formatOptions: formatOptions
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
var Formatter = function () {
|
|
1750
|
-
function Formatter() {
|
|
1751
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1752
|
-
|
|
1753
|
-
_classCallCheck(this, Formatter);
|
|
1754
|
-
|
|
1755
|
-
this.logger = baseLogger.create('formatter');
|
|
1756
|
-
this.options = options;
|
|
1757
|
-
this.formats = {
|
|
1758
|
-
number: function number(val, lng, options) {
|
|
1759
|
-
return new Intl.NumberFormat(lng, options).format(val);
|
|
1760
|
-
},
|
|
1761
|
-
currency: function currency(val, lng, options) {
|
|
1762
|
-
return new Intl.NumberFormat(lng, _objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
1763
|
-
style: 'currency'
|
|
1764
|
-
})).format(val);
|
|
1765
|
-
},
|
|
1766
|
-
datetime: function datetime(val, lng, options) {
|
|
1767
|
-
return new Intl.DateTimeFormat(lng, _objectSpread$4({}, options)).format(val);
|
|
1768
|
-
},
|
|
1769
|
-
relativetime: function relativetime(val, lng, options) {
|
|
1770
|
-
return new Intl.RelativeTimeFormat(lng, _objectSpread$4({}, options)).format(val, options.range || 'day');
|
|
1771
|
-
},
|
|
1772
|
-
list: function list(val, lng, options) {
|
|
1773
|
-
return new Intl.ListFormat(lng, _objectSpread$4({}, options)).format(val);
|
|
1774
|
-
}
|
|
1775
|
-
};
|
|
1776
|
-
this.init(options);
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
_createClass(Formatter, [{
|
|
1780
|
-
key: "init",
|
|
1781
|
-
value: function init(services) {
|
|
1782
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
1783
|
-
interpolation: {}
|
|
1784
|
-
};
|
|
1785
|
-
var iOpts = options.interpolation;
|
|
1786
|
-
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
1787
|
-
}
|
|
1788
|
-
}, {
|
|
1789
|
-
key: "add",
|
|
1790
|
-
value: function add(name, fc) {
|
|
1791
|
-
this.formats[name.toLowerCase().trim()] = fc;
|
|
1792
|
-
}
|
|
1793
|
-
}, {
|
|
1794
|
-
key: "format",
|
|
1795
|
-
value: function format(value, _format, lng, options) {
|
|
1796
|
-
var _this = this;
|
|
1797
|
-
|
|
1798
|
-
var formats = _format.split(this.formatSeparator);
|
|
1799
|
-
|
|
1800
|
-
var result = formats.reduce(function (mem, f) {
|
|
1801
|
-
var _parseFormatStr = parseFormatStr(f),
|
|
1802
|
-
formatName = _parseFormatStr.formatName,
|
|
1803
|
-
formatOptions = _parseFormatStr.formatOptions;
|
|
1804
|
-
|
|
1805
|
-
if (_this.formats[formatName]) {
|
|
1806
|
-
var formatted = mem;
|
|
1807
|
-
|
|
1808
|
-
try {
|
|
1809
|
-
var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
|
|
1810
|
-
var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
|
|
1811
|
-
formatted = _this.formats[formatName](mem, l, _objectSpread$4(_objectSpread$4(_objectSpread$4({}, formatOptions), options), valOptions));
|
|
1812
|
-
} catch (error) {
|
|
1813
|
-
_this.logger.warn(error);
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
return formatted;
|
|
1817
|
-
} else {
|
|
1818
|
-
_this.logger.warn("there was no format function for ".concat(formatName));
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
return mem;
|
|
1822
|
-
}, value);
|
|
1823
|
-
return result;
|
|
1824
|
-
}
|
|
1825
|
-
}]);
|
|
1826
|
-
|
|
1827
|
-
return Formatter;
|
|
1828
|
-
}();
|
|
1829
|
-
|
|
1830
|
-
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1831
|
-
|
|
1832
|
-
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1833
|
-
|
|
1834
|
-
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1835
|
-
|
|
1836
|
-
function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1837
|
-
|
|
1838
|
-
function removePending(q, name) {
|
|
1839
|
-
if (q.pending[name] !== undefined) {
|
|
1840
|
-
delete q.pending[name];
|
|
1841
|
-
q.pendingCount--;
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
var Connector = function (_EventEmitter) {
|
|
1846
|
-
_inherits(Connector, _EventEmitter);
|
|
1847
|
-
|
|
1848
|
-
var _super = _createSuper$2(Connector);
|
|
1849
|
-
|
|
1850
|
-
function Connector(backend, store, services) {
|
|
1851
|
-
var _this;
|
|
1852
|
-
|
|
1853
|
-
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1854
|
-
|
|
1855
|
-
_classCallCheck(this, Connector);
|
|
1856
|
-
|
|
1857
|
-
_this = _super.call(this);
|
|
1858
|
-
|
|
1859
|
-
if (isIE10) {
|
|
1860
|
-
EventEmitter.call(_assertThisInitialized(_this));
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
_this.backend = backend;
|
|
1864
|
-
_this.store = store;
|
|
1865
|
-
_this.services = services;
|
|
1866
|
-
_this.languageUtils = services.languageUtils;
|
|
1867
|
-
_this.options = options;
|
|
1868
|
-
_this.logger = baseLogger.create('backendConnector');
|
|
1869
|
-
_this.waitingReads = [];
|
|
1870
|
-
_this.maxParallelReads = options.maxParallelReads || 10;
|
|
1871
|
-
_this.readingCalls = 0;
|
|
1872
|
-
_this.state = {};
|
|
1873
|
-
_this.queue = [];
|
|
1874
|
-
|
|
1875
|
-
if (_this.backend && _this.backend.init) {
|
|
1876
|
-
_this.backend.init(services, options.backend, options);
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
return _this;
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
_createClass(Connector, [{
|
|
1883
|
-
key: "queueLoad",
|
|
1884
|
-
value: function queueLoad(languages, namespaces, options, callback) {
|
|
1885
|
-
var _this2 = this;
|
|
1886
|
-
|
|
1887
|
-
var toLoad = {};
|
|
1888
|
-
var pending = {};
|
|
1889
|
-
var toLoadLanguages = {};
|
|
1890
|
-
var toLoadNamespaces = {};
|
|
1891
|
-
languages.forEach(function (lng) {
|
|
1892
|
-
var hasAllNamespaces = true;
|
|
1893
|
-
namespaces.forEach(function (ns) {
|
|
1894
|
-
var name = "".concat(lng, "|").concat(ns);
|
|
1895
|
-
|
|
1896
|
-
if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
|
|
1897
|
-
_this2.state[name] = 2;
|
|
1898
|
-
} else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
|
|
1899
|
-
if (pending[name] === undefined) pending[name] = true;
|
|
1900
|
-
} else {
|
|
1901
|
-
_this2.state[name] = 1;
|
|
1902
|
-
hasAllNamespaces = false;
|
|
1903
|
-
if (pending[name] === undefined) pending[name] = true;
|
|
1904
|
-
if (toLoad[name] === undefined) toLoad[name] = true;
|
|
1905
|
-
if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
if (!hasAllNamespaces) toLoadLanguages[lng] = true;
|
|
1909
|
-
});
|
|
1910
|
-
|
|
1911
|
-
if (Object.keys(toLoad).length || Object.keys(pending).length) {
|
|
1912
|
-
this.queue.push({
|
|
1913
|
-
pending: pending,
|
|
1914
|
-
pendingCount: Object.keys(pending).length,
|
|
1915
|
-
loaded: {},
|
|
1916
|
-
errors: [],
|
|
1917
|
-
callback: callback
|
|
1918
|
-
});
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
return {
|
|
1922
|
-
toLoad: Object.keys(toLoad),
|
|
1923
|
-
pending: Object.keys(pending),
|
|
1924
|
-
toLoadLanguages: Object.keys(toLoadLanguages),
|
|
1925
|
-
toLoadNamespaces: Object.keys(toLoadNamespaces)
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
1928
|
-
}, {
|
|
1929
|
-
key: "loaded",
|
|
1930
|
-
value: function loaded(name, err, data) {
|
|
1931
|
-
var s = name.split('|');
|
|
1932
|
-
var lng = s[0];
|
|
1933
|
-
var ns = s[1];
|
|
1934
|
-
if (err) this.emit('failedLoading', lng, ns, err);
|
|
1935
|
-
|
|
1936
|
-
if (data) {
|
|
1937
|
-
this.store.addResourceBundle(lng, ns, data);
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
this.state[name] = err ? -1 : 2;
|
|
1941
|
-
var loaded = {};
|
|
1942
|
-
this.queue.forEach(function (q) {
|
|
1943
|
-
pushPath(q.loaded, [lng], ns);
|
|
1944
|
-
removePending(q, name);
|
|
1945
|
-
if (err) q.errors.push(err);
|
|
1946
|
-
|
|
1947
|
-
if (q.pendingCount === 0 && !q.done) {
|
|
1948
|
-
Object.keys(q.loaded).forEach(function (l) {
|
|
1949
|
-
if (!loaded[l]) loaded[l] = {};
|
|
1950
|
-
var loadedKeys = q.loaded[l];
|
|
1951
|
-
|
|
1952
|
-
if (loadedKeys.length) {
|
|
1953
|
-
loadedKeys.forEach(function (ns) {
|
|
1954
|
-
if (loaded[l][ns] === undefined) loaded[l][ns] = true;
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
|
-
});
|
|
1958
|
-
q.done = true;
|
|
1959
|
-
|
|
1960
|
-
if (q.errors.length) {
|
|
1961
|
-
q.callback(q.errors);
|
|
1962
|
-
} else {
|
|
1963
|
-
q.callback();
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
this.emit('loaded', loaded);
|
|
1968
|
-
this.queue = this.queue.filter(function (q) {
|
|
1969
|
-
return !q.done;
|
|
1970
|
-
});
|
|
1971
|
-
}
|
|
1972
|
-
}, {
|
|
1973
|
-
key: "read",
|
|
1974
|
-
value: function read(lng, ns, fcName) {
|
|
1975
|
-
var _this3 = this;
|
|
1976
|
-
|
|
1977
|
-
var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1978
|
-
var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 350;
|
|
1979
|
-
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
1980
|
-
if (!lng.length) return callback(null, {});
|
|
1981
|
-
|
|
1982
|
-
if (this.readingCalls >= this.maxParallelReads) {
|
|
1983
|
-
this.waitingReads.push({
|
|
1984
|
-
lng: lng,
|
|
1985
|
-
ns: ns,
|
|
1986
|
-
fcName: fcName,
|
|
1987
|
-
tried: tried,
|
|
1988
|
-
wait: wait,
|
|
1989
|
-
callback: callback
|
|
1990
|
-
});
|
|
1991
|
-
return;
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
this.readingCalls++;
|
|
1995
|
-
return this.backend[fcName](lng, ns, function (err, data) {
|
|
1996
|
-
if (err && data && tried < 5) {
|
|
1997
|
-
setTimeout(function () {
|
|
1998
|
-
_this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
1999
|
-
}, wait);
|
|
2000
|
-
return;
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
_this3.readingCalls--;
|
|
2004
|
-
|
|
2005
|
-
if (_this3.waitingReads.length > 0) {
|
|
2006
|
-
var next = _this3.waitingReads.shift();
|
|
2007
|
-
|
|
2008
|
-
_this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
callback(err, data);
|
|
2012
|
-
});
|
|
2013
|
-
}
|
|
2014
|
-
}, {
|
|
2015
|
-
key: "prepareLoading",
|
|
2016
|
-
value: function prepareLoading(languages, namespaces) {
|
|
2017
|
-
var _this4 = this;
|
|
2018
|
-
|
|
2019
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2020
|
-
var callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
2021
|
-
|
|
2022
|
-
if (!this.backend) {
|
|
2023
|
-
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
2024
|
-
return callback && callback();
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
2028
|
-
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
2029
|
-
var toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
2030
|
-
|
|
2031
|
-
if (!toLoad.toLoad.length) {
|
|
2032
|
-
if (!toLoad.pending.length) callback();
|
|
2033
|
-
return null;
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
toLoad.toLoad.forEach(function (name) {
|
|
2037
|
-
_this4.loadOne(name);
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
}, {
|
|
2041
|
-
key: "load",
|
|
2042
|
-
value: function load(languages, namespaces, callback) {
|
|
2043
|
-
this.prepareLoading(languages, namespaces, {}, callback);
|
|
2044
|
-
}
|
|
2045
|
-
}, {
|
|
2046
|
-
key: "reload",
|
|
2047
|
-
value: function reload(languages, namespaces, callback) {
|
|
2048
|
-
this.prepareLoading(languages, namespaces, {
|
|
2049
|
-
reload: true
|
|
2050
|
-
}, callback);
|
|
2051
|
-
}
|
|
2052
|
-
}, {
|
|
2053
|
-
key: "loadOne",
|
|
2054
|
-
value: function loadOne(name) {
|
|
2055
|
-
var _this5 = this;
|
|
2056
|
-
|
|
2057
|
-
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2058
|
-
var s = name.split('|');
|
|
2059
|
-
var lng = s[0];
|
|
2060
|
-
var ns = s[1];
|
|
2061
|
-
this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
|
|
2062
|
-
if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
|
|
2063
|
-
if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
|
|
2064
|
-
|
|
2065
|
-
_this5.loaded(name, err, data);
|
|
2066
|
-
});
|
|
2067
|
-
}
|
|
2068
|
-
}, {
|
|
2069
|
-
key: "saveMissing",
|
|
2070
|
-
value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
2071
|
-
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
2072
|
-
|
|
2073
|
-
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
2074
|
-
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!!!');
|
|
2075
|
-
return;
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
if (key === undefined || key === null || key === '') return;
|
|
2079
|
-
|
|
2080
|
-
if (this.backend && this.backend.create) {
|
|
2081
|
-
this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5(_objectSpread$5({}, options), {}, {
|
|
2082
|
-
isUpdate: isUpdate
|
|
2083
|
-
}));
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
if (!languages || !languages[0]) return;
|
|
2087
|
-
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
2088
|
-
}
|
|
2089
|
-
}]);
|
|
2090
|
-
|
|
2091
|
-
return Connector;
|
|
2092
|
-
}(EventEmitter);
|
|
2093
|
-
|
|
2094
|
-
function get() {
|
|
2095
|
-
return {
|
|
2096
|
-
debug: false,
|
|
2097
|
-
initImmediate: true,
|
|
2098
|
-
ns: ['translation'],
|
|
2099
|
-
defaultNS: ['translation'],
|
|
2100
|
-
fallbackLng: ['dev'],
|
|
2101
|
-
fallbackNS: false,
|
|
2102
|
-
supportedLngs: false,
|
|
2103
|
-
nonExplicitSupportedLngs: false,
|
|
2104
|
-
load: 'all',
|
|
2105
|
-
preload: false,
|
|
2106
|
-
simplifyPluralSuffix: true,
|
|
2107
|
-
keySeparator: '.',
|
|
2108
|
-
nsSeparator: ':',
|
|
2109
|
-
pluralSeparator: '_',
|
|
2110
|
-
contextSeparator: '_',
|
|
2111
|
-
partialBundledLanguages: false,
|
|
2112
|
-
saveMissing: false,
|
|
2113
|
-
updateMissing: false,
|
|
2114
|
-
saveMissingTo: 'fallback',
|
|
2115
|
-
saveMissingPlurals: true,
|
|
2116
|
-
missingKeyHandler: false,
|
|
2117
|
-
missingInterpolationHandler: false,
|
|
2118
|
-
postProcess: false,
|
|
2119
|
-
postProcessPassResolved: false,
|
|
2120
|
-
returnNull: true,
|
|
2121
|
-
returnEmptyString: true,
|
|
2122
|
-
returnObjects: false,
|
|
2123
|
-
joinArrays: false,
|
|
2124
|
-
returnedObjectHandler: false,
|
|
2125
|
-
parseMissingKeyHandler: false,
|
|
2126
|
-
appendNamespaceToMissingKey: false,
|
|
2127
|
-
appendNamespaceToCIMode: false,
|
|
2128
|
-
overloadTranslationOptionHandler: function handle(args) {
|
|
2129
|
-
var ret = {};
|
|
2130
|
-
if (_typeof(args[1]) === 'object') ret = args[1];
|
|
2131
|
-
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
2132
|
-
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
2133
|
-
|
|
2134
|
-
if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {
|
|
2135
|
-
var options = args[3] || args[2];
|
|
2136
|
-
Object.keys(options).forEach(function (key) {
|
|
2137
|
-
ret[key] = options[key];
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
return ret;
|
|
2142
|
-
},
|
|
2143
|
-
interpolation: {
|
|
2144
|
-
escapeValue: true,
|
|
2145
|
-
format: function format(value, _format, lng, options) {
|
|
2146
|
-
return value;
|
|
2147
|
-
},
|
|
2148
|
-
prefix: '{{',
|
|
2149
|
-
suffix: '}}',
|
|
2150
|
-
formatSeparator: ',',
|
|
2151
|
-
unescapePrefix: '-',
|
|
2152
|
-
nestingPrefix: '$t(',
|
|
2153
|
-
nestingSuffix: ')',
|
|
2154
|
-
nestingOptionsSeparator: ',',
|
|
2155
|
-
maxReplaces: 1000,
|
|
2156
|
-
skipOnVariables: true
|
|
2157
|
-
}
|
|
2158
|
-
};
|
|
2159
|
-
}
|
|
2160
|
-
function transformOptions(options) {
|
|
2161
|
-
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
2162
|
-
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
2163
|
-
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
2164
|
-
|
|
2165
|
-
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
2166
|
-
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
return options;
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2173
|
-
|
|
2174
|
-
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2175
|
-
|
|
2176
|
-
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2177
|
-
|
|
2178
|
-
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2179
|
-
|
|
2180
|
-
function noop() {}
|
|
2181
|
-
|
|
2182
|
-
function bindMemberFunctions(inst) {
|
|
2183
|
-
var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
2184
|
-
mems.forEach(function (mem) {
|
|
2185
|
-
if (typeof inst[mem] === 'function') {
|
|
2186
|
-
inst[mem] = inst[mem].bind(inst);
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
var I18n = function (_EventEmitter) {
|
|
2192
|
-
_inherits(I18n, _EventEmitter);
|
|
2193
|
-
|
|
2194
|
-
var _super = _createSuper$3(I18n);
|
|
2195
|
-
|
|
2196
|
-
function I18n() {
|
|
2197
|
-
var _this;
|
|
2198
|
-
|
|
2199
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2200
|
-
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2201
|
-
|
|
2202
|
-
_classCallCheck(this, I18n);
|
|
2203
|
-
|
|
2204
|
-
_this = _super.call(this);
|
|
2205
|
-
|
|
2206
|
-
if (isIE10) {
|
|
2207
|
-
EventEmitter.call(_assertThisInitialized(_this));
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
_this.options = transformOptions(options);
|
|
2211
|
-
_this.services = {};
|
|
2212
|
-
_this.logger = baseLogger;
|
|
2213
|
-
_this.modules = {
|
|
2214
|
-
external: []
|
|
2215
|
-
};
|
|
2216
|
-
bindMemberFunctions(_assertThisInitialized(_this));
|
|
2217
|
-
|
|
2218
|
-
if (callback && !_this.isInitialized && !options.isClone) {
|
|
2219
|
-
if (!_this.options.initImmediate) {
|
|
2220
|
-
_this.init(options, callback);
|
|
2221
|
-
|
|
2222
|
-
return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
setTimeout(function () {
|
|
2226
|
-
_this.init(options, callback);
|
|
2227
|
-
}, 0);
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2230
|
-
return _this;
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
_createClass(I18n, [{
|
|
2234
|
-
key: "init",
|
|
2235
|
-
value: function init() {
|
|
2236
|
-
var _this2 = this;
|
|
2237
|
-
|
|
2238
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2239
|
-
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2240
|
-
|
|
2241
|
-
if (typeof options === 'function') {
|
|
2242
|
-
callback = options;
|
|
2243
|
-
options = {};
|
|
2244
|
-
}
|
|
2245
|
-
|
|
2246
|
-
if (!options.defaultNS && options.ns) {
|
|
2247
|
-
if (typeof options.ns === 'string') {
|
|
2248
|
-
options.defaultNS = options.ns;
|
|
2249
|
-
} else if (options.ns.indexOf('translation') < 0) {
|
|
2250
|
-
options.defaultNS = options.ns[0];
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
var defOpts = get();
|
|
2255
|
-
this.options = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, defOpts), this.options), transformOptions(options));
|
|
2256
|
-
|
|
2257
|
-
if (this.options.compatibilityAPI !== 'v1') {
|
|
2258
|
-
this.options.interpolation = _objectSpread$6(_objectSpread$6({}, defOpts.interpolation), this.options.interpolation);
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
if (options.keySeparator !== undefined) {
|
|
2262
|
-
this.options.userDefinedKeySeparator = options.keySeparator;
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
if (options.nsSeparator !== undefined) {
|
|
2266
|
-
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
function createClassOnDemand(ClassOrObject) {
|
|
2270
|
-
if (!ClassOrObject) return null;
|
|
2271
|
-
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
2272
|
-
return ClassOrObject;
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
if (!this.options.isClone) {
|
|
2276
|
-
if (this.modules.logger) {
|
|
2277
|
-
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
2278
|
-
} else {
|
|
2279
|
-
baseLogger.init(null, this.options);
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
var formatter;
|
|
2283
|
-
|
|
2284
|
-
if (this.modules.formatter) {
|
|
2285
|
-
formatter = this.modules.formatter;
|
|
2286
|
-
} else if (typeof Intl !== 'undefined') {
|
|
2287
|
-
formatter = Formatter;
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
var lu = new LanguageUtil(this.options);
|
|
2291
|
-
this.store = new ResourceStore(this.options.resources, this.options);
|
|
2292
|
-
var s = this.services;
|
|
2293
|
-
s.logger = baseLogger;
|
|
2294
|
-
s.resourceStore = this.store;
|
|
2295
|
-
s.languageUtils = lu;
|
|
2296
|
-
s.pluralResolver = new PluralResolver(lu, {
|
|
2297
|
-
prepend: this.options.pluralSeparator,
|
|
2298
|
-
compatibilityJSON: this.options.compatibilityJSON,
|
|
2299
|
-
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
2300
|
-
});
|
|
2301
|
-
|
|
2302
|
-
if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
|
|
2303
|
-
s.formatter = createClassOnDemand(formatter);
|
|
2304
|
-
s.formatter.init(s, this.options);
|
|
2305
|
-
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
s.interpolator = new Interpolator(this.options);
|
|
2309
|
-
s.utils = {
|
|
2310
|
-
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
2311
|
-
};
|
|
2312
|
-
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
2313
|
-
s.backendConnector.on('*', function (event) {
|
|
2314
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2315
|
-
args[_key - 1] = arguments[_key];
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
_this2.emit.apply(_this2, [event].concat(args));
|
|
2319
|
-
});
|
|
2320
|
-
|
|
2321
|
-
if (this.modules.languageDetector) {
|
|
2322
|
-
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
2323
|
-
s.languageDetector.init(s, this.options.detection, this.options);
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
if (this.modules.i18nFormat) {
|
|
2327
|
-
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
2328
|
-
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
this.translator = new Translator(this.services, this.options);
|
|
2332
|
-
this.translator.on('*', function (event) {
|
|
2333
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
2334
|
-
args[_key2 - 1] = arguments[_key2];
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
_this2.emit.apply(_this2, [event].concat(args));
|
|
2338
|
-
});
|
|
2339
|
-
this.modules.external.forEach(function (m) {
|
|
2340
|
-
if (m.init) m.init(_this2);
|
|
2341
|
-
});
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
this.format = this.options.interpolation.format;
|
|
2345
|
-
if (!callback) callback = noop;
|
|
2346
|
-
|
|
2347
|
-
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2348
|
-
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2349
|
-
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
if (!this.services.languageDetector && !this.options.lng) {
|
|
2353
|
-
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
2354
|
-
}
|
|
2355
|
-
|
|
2356
|
-
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
2357
|
-
storeApi.forEach(function (fcName) {
|
|
2358
|
-
_this2[fcName] = function () {
|
|
2359
|
-
var _this2$store;
|
|
2360
|
-
|
|
2361
|
-
return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
|
|
2362
|
-
};
|
|
2363
|
-
});
|
|
2364
|
-
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
2365
|
-
storeApiChained.forEach(function (fcName) {
|
|
2366
|
-
_this2[fcName] = function () {
|
|
2367
|
-
var _this2$store2;
|
|
2368
|
-
|
|
2369
|
-
(_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
|
|
2370
|
-
|
|
2371
|
-
return _this2;
|
|
2372
|
-
};
|
|
2373
|
-
});
|
|
2374
|
-
var deferred = defer();
|
|
2375
|
-
|
|
2376
|
-
var load = function load() {
|
|
2377
|
-
var finish = function finish(err, t) {
|
|
2378
|
-
if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
2379
|
-
_this2.isInitialized = true;
|
|
2380
|
-
if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
|
|
2381
|
-
|
|
2382
|
-
_this2.emit('initialized', _this2.options);
|
|
2383
|
-
|
|
2384
|
-
deferred.resolve(t);
|
|
2385
|
-
callback(err, t);
|
|
2386
|
-
};
|
|
2387
|
-
|
|
2388
|
-
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
|
|
2389
|
-
|
|
2390
|
-
_this2.changeLanguage(_this2.options.lng, finish);
|
|
2391
|
-
};
|
|
2392
|
-
|
|
2393
|
-
if (this.options.resources || !this.options.initImmediate) {
|
|
2394
|
-
load();
|
|
2395
|
-
} else {
|
|
2396
|
-
setTimeout(load, 0);
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
return deferred;
|
|
2400
|
-
}
|
|
2401
|
-
}, {
|
|
2402
|
-
key: "loadResources",
|
|
2403
|
-
value: function loadResources(language) {
|
|
2404
|
-
var _this3 = this;
|
|
2405
|
-
|
|
2406
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
2407
|
-
var usedCallback = callback;
|
|
2408
|
-
var usedLng = typeof language === 'string' ? language : this.language;
|
|
2409
|
-
if (typeof language === 'function') usedCallback = language;
|
|
2410
|
-
|
|
2411
|
-
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
2412
|
-
if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
|
|
2413
|
-
var toLoad = [];
|
|
2414
|
-
|
|
2415
|
-
var append = function append(lng) {
|
|
2416
|
-
if (!lng) return;
|
|
2417
|
-
|
|
2418
|
-
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
2419
|
-
|
|
2420
|
-
lngs.forEach(function (l) {
|
|
2421
|
-
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
2422
|
-
});
|
|
2423
|
-
};
|
|
2424
|
-
|
|
2425
|
-
if (!usedLng) {
|
|
2426
|
-
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2427
|
-
fallbacks.forEach(function (l) {
|
|
2428
|
-
return append(l);
|
|
2429
|
-
});
|
|
2430
|
-
} else {
|
|
2431
|
-
append(usedLng);
|
|
2432
|
-
}
|
|
2433
|
-
|
|
2434
|
-
if (this.options.preload) {
|
|
2435
|
-
this.options.preload.forEach(function (l) {
|
|
2436
|
-
return append(l);
|
|
2437
|
-
});
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
|
-
this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
|
|
2441
|
-
if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
|
|
2442
|
-
usedCallback(e);
|
|
2443
|
-
});
|
|
2444
|
-
} else {
|
|
2445
|
-
usedCallback(null);
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
|
-
}, {
|
|
2449
|
-
key: "reloadResources",
|
|
2450
|
-
value: function reloadResources(lngs, ns, callback) {
|
|
2451
|
-
var deferred = defer();
|
|
2452
|
-
if (!lngs) lngs = this.languages;
|
|
2453
|
-
if (!ns) ns = this.options.ns;
|
|
2454
|
-
if (!callback) callback = noop;
|
|
2455
|
-
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
2456
|
-
deferred.resolve();
|
|
2457
|
-
callback(err);
|
|
2458
|
-
});
|
|
2459
|
-
return deferred;
|
|
2460
|
-
}
|
|
2461
|
-
}, {
|
|
2462
|
-
key: "use",
|
|
2463
|
-
value: function use(module) {
|
|
2464
|
-
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
2465
|
-
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
2466
|
-
|
|
2467
|
-
if (module.type === 'backend') {
|
|
2468
|
-
this.modules.backend = module;
|
|
2469
|
-
}
|
|
2470
|
-
|
|
2471
|
-
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
2472
|
-
this.modules.logger = module;
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
|
-
if (module.type === 'languageDetector') {
|
|
2476
|
-
this.modules.languageDetector = module;
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
|
-
if (module.type === 'i18nFormat') {
|
|
2480
|
-
this.modules.i18nFormat = module;
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
if (module.type === 'postProcessor') {
|
|
2484
|
-
postProcessor.addPostProcessor(module);
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
if (module.type === 'formatter') {
|
|
2488
|
-
this.modules.formatter = module;
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
|
-
if (module.type === '3rdParty') {
|
|
2492
|
-
this.modules.external.push(module);
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
|
-
return this;
|
|
2496
|
-
}
|
|
2497
|
-
}, {
|
|
2498
|
-
key: "setResolvedLanguage",
|
|
2499
|
-
value: function setResolvedLanguage(l) {
|
|
2500
|
-
if (!l || !this.languages) return;
|
|
2501
|
-
if (['cimode', 'dev'].indexOf(l) > -1) return;
|
|
2502
|
-
|
|
2503
|
-
for (var li = 0; li < this.languages.length; li++) {
|
|
2504
|
-
var lngInLngs = this.languages[li];
|
|
2505
|
-
if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
|
|
2506
|
-
|
|
2507
|
-
if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
|
|
2508
|
-
this.resolvedLanguage = lngInLngs;
|
|
2509
|
-
break;
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
}, {
|
|
2514
|
-
key: "changeLanguage",
|
|
2515
|
-
value: function changeLanguage(lng, callback) {
|
|
2516
|
-
var _this4 = this;
|
|
2517
|
-
|
|
2518
|
-
this.isLanguageChangingTo = lng;
|
|
2519
|
-
var deferred = defer();
|
|
2520
|
-
this.emit('languageChanging', lng);
|
|
2521
|
-
|
|
2522
|
-
var setLngProps = function setLngProps(l) {
|
|
2523
|
-
_this4.language = l;
|
|
2524
|
-
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
2525
|
-
_this4.resolvedLanguage = undefined;
|
|
2526
|
-
|
|
2527
|
-
_this4.setResolvedLanguage(l);
|
|
2528
|
-
};
|
|
2529
|
-
|
|
2530
|
-
var done = function done(err, l) {
|
|
2531
|
-
if (l) {
|
|
2532
|
-
setLngProps(l);
|
|
2533
|
-
|
|
2534
|
-
_this4.translator.changeLanguage(l);
|
|
2535
|
-
|
|
2536
|
-
_this4.isLanguageChangingTo = undefined;
|
|
2537
|
-
|
|
2538
|
-
_this4.emit('languageChanged', l);
|
|
2539
|
-
|
|
2540
|
-
_this4.logger.log('languageChanged', l);
|
|
2541
|
-
} else {
|
|
2542
|
-
_this4.isLanguageChangingTo = undefined;
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
deferred.resolve(function () {
|
|
2546
|
-
return _this4.t.apply(_this4, arguments);
|
|
2547
|
-
});
|
|
2548
|
-
if (callback) callback(err, function () {
|
|
2549
|
-
return _this4.t.apply(_this4, arguments);
|
|
2550
|
-
});
|
|
2551
|
-
};
|
|
2552
|
-
|
|
2553
|
-
var setLng = function setLng(lngs) {
|
|
2554
|
-
if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
|
|
2555
|
-
var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
2556
|
-
|
|
2557
|
-
if (l) {
|
|
2558
|
-
if (!_this4.language) {
|
|
2559
|
-
setLngProps(l);
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
if (!_this4.translator.language) _this4.translator.changeLanguage(l);
|
|
2563
|
-
if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
_this4.loadResources(l, function (err) {
|
|
2567
|
-
done(err, l);
|
|
2568
|
-
});
|
|
2569
|
-
};
|
|
2570
|
-
|
|
2571
|
-
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
2572
|
-
setLng(this.services.languageDetector.detect());
|
|
2573
|
-
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
2574
|
-
this.services.languageDetector.detect(setLng);
|
|
2575
|
-
} else {
|
|
2576
|
-
setLng(lng);
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
return deferred;
|
|
2580
|
-
}
|
|
2581
|
-
}, {
|
|
2582
|
-
key: "getFixedT",
|
|
2583
|
-
value: function getFixedT(lng, ns, keyPrefix) {
|
|
2584
|
-
var _this5 = this;
|
|
2585
|
-
|
|
2586
|
-
var fixedT = function fixedT(key, opts) {
|
|
2587
|
-
var options;
|
|
2588
|
-
|
|
2589
|
-
if (_typeof(opts) !== 'object') {
|
|
2590
|
-
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
2591
|
-
rest[_key3 - 2] = arguments[_key3];
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
2595
|
-
} else {
|
|
2596
|
-
options = _objectSpread$6({}, opts);
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
options.lng = options.lng || fixedT.lng;
|
|
2600
|
-
options.lngs = options.lngs || fixedT.lngs;
|
|
2601
|
-
options.ns = options.ns || fixedT.ns;
|
|
2602
|
-
var keySeparator = _this5.options.keySeparator || '.';
|
|
2603
|
-
var resultKey = keyPrefix ? "".concat(keyPrefix).concat(keySeparator).concat(key) : key;
|
|
2604
|
-
return _this5.t(resultKey, options);
|
|
2605
|
-
};
|
|
2606
|
-
|
|
2607
|
-
if (typeof lng === 'string') {
|
|
2608
|
-
fixedT.lng = lng;
|
|
2609
|
-
} else {
|
|
2610
|
-
fixedT.lngs = lng;
|
|
2611
|
-
}
|
|
2612
|
-
|
|
2613
|
-
fixedT.ns = ns;
|
|
2614
|
-
fixedT.keyPrefix = keyPrefix;
|
|
2615
|
-
return fixedT;
|
|
2616
|
-
}
|
|
2617
|
-
}, {
|
|
2618
|
-
key: "t",
|
|
2619
|
-
value: function t() {
|
|
2620
|
-
var _this$translator;
|
|
2621
|
-
|
|
2622
|
-
return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
|
|
2623
|
-
}
|
|
2624
|
-
}, {
|
|
2625
|
-
key: "exists",
|
|
2626
|
-
value: function exists() {
|
|
2627
|
-
var _this$translator2;
|
|
2628
|
-
|
|
2629
|
-
return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
|
|
2630
|
-
}
|
|
2631
|
-
}, {
|
|
2632
|
-
key: "setDefaultNamespace",
|
|
2633
|
-
value: function setDefaultNamespace(ns) {
|
|
2634
|
-
this.options.defaultNS = ns;
|
|
2635
|
-
}
|
|
2636
|
-
}, {
|
|
2637
|
-
key: "hasLoadedNamespace",
|
|
2638
|
-
value: function hasLoadedNamespace(ns) {
|
|
2639
|
-
var _this6 = this;
|
|
2640
|
-
|
|
2641
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2642
|
-
|
|
2643
|
-
if (!this.isInitialized) {
|
|
2644
|
-
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
2645
|
-
return false;
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
if (!this.languages || !this.languages.length) {
|
|
2649
|
-
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
2650
|
-
return false;
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
var lng = this.resolvedLanguage || this.languages[0];
|
|
2654
|
-
var fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
2655
|
-
var lastLng = this.languages[this.languages.length - 1];
|
|
2656
|
-
if (lng.toLowerCase() === 'cimode') return true;
|
|
2657
|
-
|
|
2658
|
-
var loadNotPending = function loadNotPending(l, n) {
|
|
2659
|
-
var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)];
|
|
2660
|
-
|
|
2661
|
-
return loadState === -1 || loadState === 2;
|
|
2662
|
-
};
|
|
2663
|
-
|
|
2664
|
-
if (options.precheck) {
|
|
2665
|
-
var preResult = options.precheck(this, loadNotPending);
|
|
2666
|
-
if (preResult !== undefined) return preResult;
|
|
2667
|
-
}
|
|
2668
|
-
|
|
2669
|
-
if (this.hasResourceBundle(lng, ns)) return true;
|
|
2670
|
-
if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
|
|
2671
|
-
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
2672
|
-
return false;
|
|
2673
|
-
}
|
|
2674
|
-
}, {
|
|
2675
|
-
key: "loadNamespaces",
|
|
2676
|
-
value: function loadNamespaces(ns, callback) {
|
|
2677
|
-
var _this7 = this;
|
|
2678
|
-
|
|
2679
|
-
var deferred = defer();
|
|
2680
|
-
|
|
2681
|
-
if (!this.options.ns) {
|
|
2682
|
-
callback && callback();
|
|
2683
|
-
return Promise.resolve();
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
|
-
if (typeof ns === 'string') ns = [ns];
|
|
2687
|
-
ns.forEach(function (n) {
|
|
2688
|
-
if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
|
|
2689
|
-
});
|
|
2690
|
-
this.loadResources(function (err) {
|
|
2691
|
-
deferred.resolve();
|
|
2692
|
-
if (callback) callback(err);
|
|
2693
|
-
});
|
|
2694
|
-
return deferred;
|
|
2695
|
-
}
|
|
2696
|
-
}, {
|
|
2697
|
-
key: "loadLanguages",
|
|
2698
|
-
value: function loadLanguages(lngs, callback) {
|
|
2699
|
-
var deferred = defer();
|
|
2700
|
-
if (typeof lngs === 'string') lngs = [lngs];
|
|
2701
|
-
var preloaded = this.options.preload || [];
|
|
2702
|
-
var newLngs = lngs.filter(function (lng) {
|
|
2703
|
-
return preloaded.indexOf(lng) < 0;
|
|
2704
|
-
});
|
|
2705
|
-
|
|
2706
|
-
if (!newLngs.length) {
|
|
2707
|
-
if (callback) callback();
|
|
2708
|
-
return Promise.resolve();
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
this.options.preload = preloaded.concat(newLngs);
|
|
2712
|
-
this.loadResources(function (err) {
|
|
2713
|
-
deferred.resolve();
|
|
2714
|
-
if (callback) callback(err);
|
|
2715
|
-
});
|
|
2716
|
-
return deferred;
|
|
2717
|
-
}
|
|
2718
|
-
}, {
|
|
2719
|
-
key: "dir",
|
|
2720
|
-
value: function dir(lng) {
|
|
2721
|
-
if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
|
|
2722
|
-
if (!lng) return 'rtl';
|
|
2723
|
-
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'];
|
|
2724
|
-
return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
|
|
2725
|
-
}
|
|
2726
|
-
}, {
|
|
2727
|
-
key: "cloneInstance",
|
|
2728
|
-
value: function cloneInstance() {
|
|
2729
|
-
var _this8 = this;
|
|
2730
|
-
|
|
2731
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2732
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
2733
|
-
|
|
2734
|
-
var mergedOptions = _objectSpread$6(_objectSpread$6(_objectSpread$6({}, this.options), options), {
|
|
2735
|
-
isClone: true
|
|
2736
|
-
});
|
|
2737
|
-
|
|
2738
|
-
var clone = new I18n(mergedOptions);
|
|
2739
|
-
var membersToCopy = ['store', 'services', 'language'];
|
|
2740
|
-
membersToCopy.forEach(function (m) {
|
|
2741
|
-
clone[m] = _this8[m];
|
|
2742
|
-
});
|
|
2743
|
-
clone.services = _objectSpread$6({}, this.services);
|
|
2744
|
-
clone.services.utils = {
|
|
2745
|
-
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
2746
|
-
};
|
|
2747
|
-
clone.translator = new Translator(clone.services, clone.options);
|
|
2748
|
-
clone.translator.on('*', function (event) {
|
|
2749
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
2750
|
-
args[_key4 - 1] = arguments[_key4];
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
clone.emit.apply(clone, [event].concat(args));
|
|
2754
|
-
});
|
|
2755
|
-
clone.init(mergedOptions, callback);
|
|
2756
|
-
clone.translator.options = clone.options;
|
|
2757
|
-
clone.translator.backendConnector.services.utils = {
|
|
2758
|
-
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
2759
|
-
};
|
|
2760
|
-
return clone;
|
|
2761
|
-
}
|
|
2762
|
-
}, {
|
|
2763
|
-
key: "toJSON",
|
|
2764
|
-
value: function toJSON() {
|
|
2765
|
-
return {
|
|
2766
|
-
options: this.options,
|
|
2767
|
-
store: this.store,
|
|
2768
|
-
language: this.language,
|
|
2769
|
-
languages: this.languages,
|
|
2770
|
-
resolvedLanguage: this.resolvedLanguage
|
|
2771
|
-
};
|
|
2772
|
-
}
|
|
2773
|
-
}]);
|
|
2774
|
-
|
|
2775
|
-
return I18n;
|
|
2776
|
-
}(EventEmitter);
|
|
2777
|
-
|
|
2778
|
-
_defineProperty(I18n, "createInstance", function () {
|
|
2779
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2780
|
-
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2781
|
-
return new I18n(options, callback);
|
|
2782
|
-
});
|
|
2783
|
-
|
|
2784
|
-
var instance = I18n.createInstance();
|
|
2785
|
-
instance.createInstance = I18n.createInstance;
|
|
2786
|
-
|
|
2787
|
-
var createInstance = instance.createInstance;
|
|
2788
|
-
var init = instance.init;
|
|
2789
|
-
var loadResources = instance.loadResources;
|
|
2790
|
-
var reloadResources = instance.reloadResources;
|
|
2791
|
-
var use = instance.use;
|
|
2792
|
-
var changeLanguage = instance.changeLanguage;
|
|
2793
|
-
var getFixedT = instance.getFixedT;
|
|
2794
|
-
var t = instance.t;
|
|
2795
|
-
var exists = instance.exists;
|
|
2796
|
-
var setDefaultNamespace = instance.setDefaultNamespace;
|
|
2797
|
-
var hasLoadedNamespace = instance.hasLoadedNamespace;
|
|
2798
|
-
var loadNamespaces = instance.loadNamespaces;
|
|
2799
|
-
var loadLanguages = instance.loadLanguages;
|
|
2800
|
-
|
|
2801
|
-
export default instance;
|
|
2802
|
-
export { changeLanguage, createInstance, exists, getFixedT, hasLoadedNamespace, init, loadLanguages, loadNamespaces, loadResources, reloadResources, setDefaultNamespace, t, use };
|