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