@jackuait/blok 0.7.0-beta.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/dist/blok.mjs +3 -7
  2. package/dist/chunks/blok-Ufr5cPq-.mjs +12435 -0
  3. package/dist/chunks/constants-DT17zmu_.mjs +2934 -0
  4. package/dist/chunks/i18next-DymC16cN.mjs +1146 -0
  5. package/dist/chunks/i18next-loader-qjweOJ-t.mjs +35 -0
  6. package/dist/chunks/lightweight-i18n-vbtPx5C4.mjs +105 -0
  7. package/dist/chunks/messages-3bOAVT3X2.mjs +80 -0
  8. package/dist/chunks/messages-43N0Vfg42.mjs +80 -0
  9. package/dist/chunks/messages-B0cg-ThO2.mjs +80 -0
  10. package/dist/chunks/messages-B3StvafX.mjs +80 -0
  11. package/dist/chunks/messages-B7LU-b6n2.mjs +80 -0
  12. package/dist/chunks/messages-B87-89os.mjs +80 -0
  13. package/dist/chunks/messages-BFiMCfDX2.mjs +80 -0
  14. package/dist/chunks/messages-BLxyso1L.mjs +80 -0
  15. package/dist/chunks/messages-BQZtOYxr2.mjs +80 -0
  16. package/dist/chunks/messages-BRrtoRdw2.mjs +80 -0
  17. package/dist/chunks/messages-BU_YdaAf.mjs +80 -0
  18. package/dist/chunks/messages-BWbZYIs12.mjs +80 -0
  19. package/dist/chunks/messages-B_Qcy8kr2.mjs +80 -0
  20. package/dist/chunks/messages-B_uTiuQ-.mjs +80 -0
  21. package/dist/chunks/messages-BdWTM73p.mjs +80 -0
  22. package/dist/chunks/messages-BhZcNoIQ.mjs +80 -0
  23. package/dist/chunks/messages-Bn6LwI4B.mjs +80 -0
  24. package/dist/chunks/messages-BoTtYEct2.mjs +80 -0
  25. package/dist/chunks/messages-BrvAiuWT.mjs +80 -0
  26. package/dist/chunks/messages-Byp0YFMg.mjs +80 -0
  27. package/dist/chunks/messages-C0ZWDShx2.mjs +80 -0
  28. package/dist/chunks/messages-CA-jms9R.mjs +80 -0
  29. package/dist/chunks/messages-CFr0Ha6p2.mjs +80 -0
  30. package/dist/chunks/messages-CG2xl0IV.mjs +80 -0
  31. package/dist/chunks/messages-CIGX0FfW.mjs +80 -0
  32. package/dist/chunks/messages-CRMdL0jG.mjs +80 -0
  33. package/dist/chunks/messages-CRdl14uE.mjs +80 -0
  34. package/dist/chunks/messages-Cimsel4e.mjs +80 -0
  35. package/dist/chunks/messages-CjcSWeud.mjs +80 -0
  36. package/dist/chunks/messages-ClDJuy8K2.mjs +80 -0
  37. package/dist/chunks/messages-Cn1AC0Qk.mjs +80 -0
  38. package/dist/chunks/messages-CpnXbVOK2.mjs +80 -0
  39. package/dist/chunks/messages-CqsES1wk2.mjs +80 -0
  40. package/dist/chunks/messages-Csq7JatN.mjs +80 -0
  41. package/dist/chunks/messages-CtufKbaD.mjs +80 -0
  42. package/dist/chunks/messages-Cuk0QaLM.mjs +80 -0
  43. package/dist/chunks/messages-CvamFN6x.mjs +80 -0
  44. package/dist/chunks/messages-CwRhVVui.mjs +80 -0
  45. package/dist/chunks/messages-CzCezryo.mjs +80 -0
  46. package/dist/chunks/messages-D0v0Xa_i2.mjs +80 -0
  47. package/dist/chunks/messages-D3JVx_CH2.mjs +80 -0
  48. package/dist/chunks/messages-D4jR5Oc-.mjs +80 -0
  49. package/dist/chunks/messages-D7fI9Pj52.mjs +80 -0
  50. package/dist/chunks/messages-DGodJU2R.mjs +80 -0
  51. package/dist/chunks/messages-DLrmLkco2.mjs +80 -0
  52. package/dist/chunks/messages-DPe7kW6J.mjs +80 -0
  53. package/dist/chunks/messages-DRYKKPk8.mjs +80 -0
  54. package/dist/chunks/messages-DV5c_ZRQ.mjs +80 -0
  55. package/dist/chunks/messages-Dg6kSnxq.mjs +80 -0
  56. package/dist/chunks/messages-Dgfbmyf-.mjs +80 -0
  57. package/dist/chunks/messages-DihczS7L.mjs +80 -0
  58. package/dist/chunks/messages-DkSwQvmi2.mjs +80 -0
  59. package/dist/chunks/messages-Doxcj7Qy.mjs +80 -0
  60. package/dist/chunks/messages-DqGQvcXv2.mjs +80 -0
  61. package/dist/chunks/messages-Dr7yA3xM.mjs +80 -0
  62. package/dist/chunks/messages-DriB5lEF.mjs +80 -0
  63. package/dist/chunks/messages-FB_MePlt.mjs +80 -0
  64. package/dist/chunks/messages-JyZvGvrN.mjs +80 -0
  65. package/dist/chunks/messages-KdvbGwLH.mjs +80 -0
  66. package/dist/chunks/messages-M0HT-kBW.mjs +80 -0
  67. package/dist/chunks/messages-M8noQ6Kp2.mjs +80 -0
  68. package/dist/chunks/messages-elZUbCrN.mjs +80 -0
  69. package/dist/chunks/messages-iWMOMK822.mjs +80 -0
  70. package/dist/chunks/messages-kC92TJI72.mjs +80 -0
  71. package/dist/chunks/messages-tfyq1JIh2.mjs +80 -0
  72. package/dist/chunks/messages-v1HkA3kF2.mjs +80 -0
  73. package/dist/chunks/messages-yuqArCc6.mjs +80 -0
  74. package/dist/chunks/notifier-BqYxvxnV.mjs +96 -0
  75. package/dist/chunks/objectSpread2-CyPxu8-u.mjs +62 -0
  76. package/dist/chunks/tools-CJIETS-H.mjs +6004 -0
  77. package/dist/chunks/tw-DmW6-pCY.mjs +237 -0
  78. package/dist/cli.mjs +36 -49
  79. package/dist/full.mjs +26 -52
  80. package/dist/locales.mjs +181 -254
  81. package/dist/messages-2iHnlF0U.mjs +80 -0
  82. package/dist/messages-49ZJ_ISf.mjs +80 -0
  83. package/dist/messages-B8jjwMLK.mjs +80 -0
  84. package/dist/messages-BEDVb3ZX.mjs +80 -0
  85. package/dist/messages-BEEr6Vh82.mjs +80 -0
  86. package/dist/messages-BFT0F9pw.mjs +80 -0
  87. package/dist/messages-BHOI7R4K.mjs +80 -0
  88. package/dist/messages-BRPH_a6a.mjs +80 -0
  89. package/dist/messages-BSlQrYwp.mjs +80 -0
  90. package/dist/messages-BTNuOkhL.mjs +80 -0
  91. package/dist/messages-BX2KVzJp2.mjs +80 -0
  92. package/dist/messages-BaGwIHPb2.mjs +80 -0
  93. package/dist/messages-BdA_xvxj.mjs +80 -0
  94. package/dist/messages-BeJaje7e2.mjs +80 -0
  95. package/dist/messages-BfgHOkAy.mjs +80 -0
  96. package/dist/messages-BflWzIcP2.mjs +80 -0
  97. package/dist/messages-BigRnQS92.mjs +80 -0
  98. package/dist/messages-BjnJajTO2.mjs +80 -0
  99. package/dist/messages-BpA30dPf.mjs +80 -0
  100. package/dist/messages-BrPEPj382.mjs +80 -0
  101. package/dist/messages-Bt_9ptDu.mjs +80 -0
  102. package/dist/messages-C0cXOCHN2.mjs +80 -0
  103. package/dist/messages-C3tLCwJp2.mjs +80 -0
  104. package/dist/messages-C45IBZtA2.mjs +80 -0
  105. package/dist/messages-CA0hwajz.mjs +80 -0
  106. package/dist/messages-CCKZS2f4.mjs +80 -0
  107. package/dist/messages-CCm71gq3.mjs +80 -0
  108. package/dist/messages-CERs9LC9.mjs +80 -0
  109. package/dist/messages-CLQvtc_8.mjs +80 -0
  110. package/dist/messages-CPx1R-PH.mjs +80 -0
  111. package/dist/messages-CYFdbooL2.mjs +80 -0
  112. package/dist/messages-CYLYnOV82.mjs +80 -0
  113. package/dist/messages-CYZVFnaF.mjs +80 -0
  114. package/dist/messages-CaAdEXoh2.mjs +80 -0
  115. package/dist/messages-CicggErN2.mjs +80 -0
  116. package/dist/messages-CkAWTSc4.mjs +80 -0
  117. package/dist/messages-CkVfziK_2.mjs +80 -0
  118. package/dist/messages-CsM2iz1H2.mjs +80 -0
  119. package/dist/messages-D-12TeCM2.mjs +80 -0
  120. package/dist/messages-D0i5Vdyy2.mjs +80 -0
  121. package/dist/messages-D5KmRsUV2.mjs +80 -0
  122. package/dist/messages-DBwaWI0X.mjs +80 -0
  123. package/dist/messages-DDGzypb4.mjs +80 -0
  124. package/dist/messages-DQGzw4IC.mjs +80 -0
  125. package/dist/messages-DWZyaZNA.mjs +80 -0
  126. package/dist/messages-DYlxQEIv.mjs +80 -0
  127. package/dist/messages-DZo0x7Bd.mjs +80 -0
  128. package/dist/messages-Dc1yFFBM.mjs +80 -0
  129. package/dist/messages-DdUpYaJ1.mjs +80 -0
  130. package/dist/messages-DgstU8GH.mjs +80 -0
  131. package/dist/messages-DhdWq5oQ2.mjs +80 -0
  132. package/dist/messages-DmX52AQr.mjs +80 -0
  133. package/dist/messages-Dr-YJYIK2.mjs +80 -0
  134. package/dist/messages-DuubRyFf.mjs +80 -0
  135. package/dist/messages-DvTVsLOK2.mjs +80 -0
  136. package/dist/messages-DwPfgL_u.mjs +80 -0
  137. package/dist/messages-DxKIxLKw.mjs +80 -0
  138. package/dist/messages-DzhR8Klk.mjs +80 -0
  139. package/dist/messages-MBBSKGjJ2.mjs +80 -0
  140. package/dist/messages-RNusm48G2.mjs +80 -0
  141. package/dist/messages-XwPD18Kk.mjs +80 -0
  142. package/dist/messages-YfjdnhUF.mjs +80 -0
  143. package/dist/messages-aNMLsF8T2.mjs +80 -0
  144. package/dist/messages-cOqXp22e.mjs +80 -0
  145. package/dist/messages-g58itYPI.mjs +80 -0
  146. package/dist/messages-vfkwiKQo.mjs +80 -0
  147. package/dist/messages-vssmW7KO.mjs +80 -0
  148. package/dist/react.mjs +108 -0
  149. package/dist/tools.mjs +3 -7462
  150. package/dist/vendor.LICENSE.txt +86 -86
  151. package/package.json +56 -29
  152. package/src/blok.ts +52 -2
  153. package/src/components/block/api.ts +8 -0
  154. package/src/components/block/mutation-handler.ts +29 -4
  155. package/src/components/block/style-manager.ts +1 -1
  156. package/src/components/block-tunes/block-tune-width.ts +39 -0
  157. package/src/components/blocks.ts +56 -2
  158. package/src/components/core.ts +1 -0
  159. package/src/components/i18n/locales/am/messages.json +6 -1
  160. package/src/components/i18n/locales/ar/messages.json +6 -1
  161. package/src/components/i18n/locales/az/messages.json +6 -1
  162. package/src/components/i18n/locales/bg/messages.json +8 -3
  163. package/src/components/i18n/locales/bn/messages.json +6 -1
  164. package/src/components/i18n/locales/bs/messages.json +6 -1
  165. package/src/components/i18n/locales/cs/messages.json +6 -1
  166. package/src/components/i18n/locales/da/messages.json +6 -1
  167. package/src/components/i18n/locales/de/messages.json +8 -3
  168. package/src/components/i18n/locales/dv/messages.json +6 -1
  169. package/src/components/i18n/locales/el/messages.json +8 -3
  170. package/src/components/i18n/locales/en/messages.json +5 -0
  171. package/src/components/i18n/locales/es/messages.json +6 -1
  172. package/src/components/i18n/locales/et/messages.json +6 -1
  173. package/src/components/i18n/locales/fa/messages.json +8 -3
  174. package/src/components/i18n/locales/fi/messages.json +6 -1
  175. package/src/components/i18n/locales/fil/messages.json +21 -16
  176. package/src/components/i18n/locales/fr/messages.json +6 -1
  177. package/src/components/i18n/locales/gu/messages.json +6 -1
  178. package/src/components/i18n/locales/he/messages.json +6 -1
  179. package/src/components/i18n/locales/hi/messages.json +6 -1
  180. package/src/components/i18n/locales/hr/messages.json +6 -1
  181. package/src/components/i18n/locales/hu/messages.json +6 -1
  182. package/src/components/i18n/locales/hy/messages.json +8 -3
  183. package/src/components/i18n/locales/id/messages.json +12 -7
  184. package/src/components/i18n/locales/it/messages.json +6 -1
  185. package/src/components/i18n/locales/ja/messages.json +6 -1
  186. package/src/components/i18n/locales/ka/messages.json +6 -1
  187. package/src/components/i18n/locales/km/messages.json +6 -1
  188. package/src/components/i18n/locales/kn/messages.json +6 -1
  189. package/src/components/i18n/locales/ko/messages.json +6 -1
  190. package/src/components/i18n/locales/ku/messages.json +7 -2
  191. package/src/components/i18n/locales/lo/messages.json +7 -2
  192. package/src/components/i18n/locales/lt/messages.json +6 -1
  193. package/src/components/i18n/locales/lv/messages.json +6 -1
  194. package/src/components/i18n/locales/mk/messages.json +6 -1
  195. package/src/components/i18n/locales/ml/messages.json +6 -1
  196. package/src/components/i18n/locales/mn/messages.json +6 -1
  197. package/src/components/i18n/locales/mr/messages.json +6 -1
  198. package/src/components/i18n/locales/ms/messages.json +6 -1
  199. package/src/components/i18n/locales/my/messages.json +6 -1
  200. package/src/components/i18n/locales/ne/messages.json +9 -4
  201. package/src/components/i18n/locales/nl/messages.json +6 -1
  202. package/src/components/i18n/locales/no/messages.json +6 -1
  203. package/src/components/i18n/locales/pa/messages.json +6 -1
  204. package/src/components/i18n/locales/pl/messages.json +6 -1
  205. package/src/components/i18n/locales/ps/messages.json +8 -3
  206. package/src/components/i18n/locales/pt/messages.json +6 -1
  207. package/src/components/i18n/locales/ro/messages.json +6 -1
  208. package/src/components/i18n/locales/ru/messages.json +10 -5
  209. package/src/components/i18n/locales/sd/messages.json +6 -1
  210. package/src/components/i18n/locales/si/messages.json +6 -1
  211. package/src/components/i18n/locales/sk/messages.json +6 -1
  212. package/src/components/i18n/locales/sl/messages.json +6 -1
  213. package/src/components/i18n/locales/sq/messages.json +6 -1
  214. package/src/components/i18n/locales/sr/messages.json +6 -1
  215. package/src/components/i18n/locales/sv/messages.json +6 -1
  216. package/src/components/i18n/locales/sw/messages.json +6 -1
  217. package/src/components/i18n/locales/ta/messages.json +6 -1
  218. package/src/components/i18n/locales/te/messages.json +9 -4
  219. package/src/components/i18n/locales/th/messages.json +6 -1
  220. package/src/components/i18n/locales/tr/messages.json +6 -1
  221. package/src/components/i18n/locales/ug/messages.json +7 -2
  222. package/src/components/i18n/locales/uk/messages.json +6 -1
  223. package/src/components/i18n/locales/ur/messages.json +6 -1
  224. package/src/components/i18n/locales/vi/messages.json +6 -1
  225. package/src/components/i18n/locales/yi/messages.json +7 -2
  226. package/src/components/i18n/locales/zh/messages.json +6 -1
  227. package/src/components/icons/index.ts +16 -0
  228. package/src/components/inline-tools/inline-tool-link.ts +1 -1
  229. package/src/components/modules/api/blocks.ts +45 -2
  230. package/src/components/modules/api/index.ts +1 -0
  231. package/src/components/modules/api/width.ts +17 -0
  232. package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +99 -0
  233. package/src/components/modules/blockEvents/composers/markdownShortcuts.ts +109 -2
  234. package/src/components/modules/blockEvents/constants.ts +7 -0
  235. package/src/components/modules/blockManager/blockManager.ts +113 -9
  236. package/src/components/modules/blockManager/hierarchy.ts +61 -0
  237. package/src/components/modules/blockManager/operations.ts +161 -16
  238. package/src/components/modules/blockManager/yjs-sync.ts +112 -4
  239. package/src/components/modules/blockSelection.ts +36 -2
  240. package/src/components/modules/crossBlockSelection.ts +22 -2
  241. package/src/components/modules/drag/DragController.ts +178 -4
  242. package/src/components/modules/drag/operations/DragOperations.ts +48 -9
  243. package/src/components/modules/drag/preview/DragPreview.ts +21 -1
  244. package/src/components/modules/drag/state/DragStateMachine.ts +6 -1
  245. package/src/components/modules/drag/target/DropTargetDetector.ts +80 -4
  246. package/src/components/modules/drag/utils/ToggleSpringLoader.ts +71 -0
  247. package/src/components/modules/index.ts +7 -1
  248. package/src/components/modules/modificationsObserver.ts +19 -0
  249. package/src/components/modules/paste/constants.ts +2 -0
  250. package/src/components/modules/paste/handlers/base.ts +33 -1
  251. package/src/components/modules/paste/handlers/html-handler.ts +121 -54
  252. package/src/components/modules/paste/index.ts +5 -0
  253. package/src/components/modules/paste/types.ts +5 -0
  254. package/src/components/modules/rectangleSelection.ts +74 -81
  255. package/src/components/modules/toolbar/blockSettings.ts +25 -7
  256. package/src/components/modules/toolbar/index.ts +9 -7
  257. package/src/components/modules/toolbar/inline/index.ts +6 -1
  258. package/src/components/modules/toolbar/plus-button.ts +2 -6
  259. package/src/components/modules/toolbar/positioning.ts +10 -1
  260. package/src/components/modules/toolbar/settings-toggler.ts +1 -1
  261. package/src/components/modules/toolbar/styles.ts +3 -7
  262. package/src/components/modules/ui.ts +59 -5
  263. package/src/components/modules/uiControllers/handlers/click.ts +3 -2
  264. package/src/components/modules/widthManager.ts +69 -0
  265. package/src/components/modules/yjs/document-store.ts +11 -0
  266. package/src/components/modules/yjs/index.ts +11 -0
  267. package/src/components/shared/color-picker.ts +3 -3
  268. package/src/components/tools/block.ts +1 -11
  269. package/src/components/ui/toolbox.ts +52 -8
  270. package/src/components/utils/blocks.ts +37 -7
  271. package/src/components/utils/mutations.ts +2 -2
  272. package/src/components/utils/notifier/draw.ts +1 -1
  273. package/src/components/utils/placeholder.ts +5 -6
  274. package/src/components/utils/popover/components/popover-header/popover-header.const.ts +1 -1
  275. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +4 -4
  276. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +6 -6
  277. package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +2 -2
  278. package/src/components/utils/popover/components/search-input/search-input.const.ts +2 -2
  279. package/src/components/utils/popover/components/search-input/search-input.ts +7 -11
  280. package/src/components/utils/popover/components/search-input/search-input.types.ts +149 -10
  281. package/src/components/utils/popover/popover-abstract.ts +3 -2
  282. package/src/components/utils/popover/popover-desktop.ts +133 -11
  283. package/src/components/utils/popover/popover-inline.ts +1 -1
  284. package/src/components/utils/popover/popover.const.ts +3 -3
  285. package/src/components/utils/shortcut.ts +2 -0
  286. package/src/components/utils/tooltip.ts +11 -1
  287. package/src/react/BlokContent.tsx +46 -0
  288. package/src/react/holder-map.ts +17 -0
  289. package/src/react/index.ts +3 -0
  290. package/src/react/types.ts +16 -0
  291. package/src/react/useBlok.ts +173 -0
  292. package/src/stories/Placeholder.stories.ts +0 -59
  293. package/src/styles/main.css +663 -52
  294. package/src/tools/header/header-toggle-keyboard.ts +115 -0
  295. package/src/tools/header/index.ts +382 -187
  296. package/src/tools/list/block-operations.ts +1 -1
  297. package/src/tools/list/caret-manager.ts +9 -12
  298. package/src/tools/list/index.ts +2 -6
  299. package/src/tools/list/list-keyboard.ts +2 -2
  300. package/src/tools/paragraph/index.ts +1 -1
  301. package/src/tools/table/index.ts +75 -3
  302. package/src/tools/table/table-add-controls.ts +97 -8
  303. package/src/tools/table/table-cell-blocks.ts +17 -8
  304. package/src/tools/table/table-cell-clipboard.ts +1 -1
  305. package/src/tools/table/table-cell-selection.ts +27 -2
  306. package/src/tools/table/table-operations.ts +3 -2
  307. package/src/tools/toggle/block-operations.ts +4 -2
  308. package/src/tools/toggle/constants.ts +26 -2
  309. package/src/tools/toggle/dom-builder.ts +90 -25
  310. package/src/tools/toggle/index.ts +112 -9
  311. package/src/tools/toggle/toggle-keyboard.ts +5 -3
  312. package/src/tools/toggle/toggle-lifecycle.ts +79 -7
  313. package/src/tools/toggle/toggle-shortcuts.ts +214 -20
  314. package/src/tools/toggle/types.ts +2 -0
  315. package/src/types-internal/blok-modules.d.ts +4 -0
  316. package/types/api/block.d.ts +5 -0
  317. package/types/api/blocks.d.ts +29 -0
  318. package/types/api/index.d.ts +1 -0
  319. package/types/api/width.d.ts +19 -0
  320. package/types/configs/blok-config.d.ts +33 -0
  321. package/types/index.d.ts +4 -0
  322. package/types/react.d.ts +58 -0
  323. package/types/utils/popover/popover.d.ts +7 -0
  324. package/dist/chunks/blok-BlyYiZTm.mjs +0 -20098
  325. package/dist/chunks/constants-DEy4jBO5.mjs +0 -5123
  326. package/dist/chunks/i18next-B47TKgbU.mjs +0 -1303
  327. package/dist/chunks/i18next-loader-Cfbv-x6v.mjs +0 -43
  328. package/dist/chunks/index-Cu1w-sLZ.mjs +0 -130
  329. package/dist/chunks/messages-0Pxnqd4N.mjs +0 -75
  330. package/dist/chunks/messages-0ZXYUq7S.mjs +0 -75
  331. package/dist/chunks/messages-2OD2uUDS.mjs +0 -75
  332. package/dist/chunks/messages-7cEMfYzh.mjs +0 -75
  333. package/dist/chunks/messages-8mwfda1Q.mjs +0 -75
  334. package/dist/chunks/messages-B-FqWsBM.mjs +0 -75
  335. package/dist/chunks/messages-B1jzqWiQ.mjs +0 -75
  336. package/dist/chunks/messages-B5wk4Ezz.mjs +0 -75
  337. package/dist/chunks/messages-BAZ5Ld8x.mjs +0 -75
  338. package/dist/chunks/messages-BBhGp198.mjs +0 -75
  339. package/dist/chunks/messages-BC9IjIb7.mjs +0 -75
  340. package/dist/chunks/messages-BFEmpeV-.mjs +0 -75
  341. package/dist/chunks/messages-BGqzTZy0.mjs +0 -75
  342. package/dist/chunks/messages-BICs1abK.mjs +0 -75
  343. package/dist/chunks/messages-BJX6rOnd.mjs +0 -75
  344. package/dist/chunks/messages-BL2bXRhN.mjs +0 -75
  345. package/dist/chunks/messages-BMs5qdlH.mjs +0 -75
  346. package/dist/chunks/messages-BRsjUNwB.mjs +0 -75
  347. package/dist/chunks/messages-BSqV8OUR.mjs +0 -75
  348. package/dist/chunks/messages-BTqu3DfG.mjs +0 -75
  349. package/dist/chunks/messages-BXnDEsur.mjs +0 -75
  350. package/dist/chunks/messages-BYcre4-6.mjs +0 -75
  351. package/dist/chunks/messages-BZ9LRJf-.mjs +0 -75
  352. package/dist/chunks/messages-BgypBy7y.mjs +0 -75
  353. package/dist/chunks/messages-BsuGf70G.mjs +0 -75
  354. package/dist/chunks/messages-BwaoF4lQ.mjs +0 -75
  355. package/dist/chunks/messages-C1l8_7-y.mjs +0 -75
  356. package/dist/chunks/messages-C5NA_r9v.mjs +0 -75
  357. package/dist/chunks/messages-C6zgZ5pA.mjs +0 -75
  358. package/dist/chunks/messages-CAo5ghFI.mjs +0 -75
  359. package/dist/chunks/messages-CH9qlJ9I.mjs +0 -75
  360. package/dist/chunks/messages-CI0HqAeS.mjs +0 -75
  361. package/dist/chunks/messages-CJJtms9k.mjs +0 -75
  362. package/dist/chunks/messages-CM2hJqk6.mjs +0 -75
  363. package/dist/chunks/messages-CRMiDPIQ.mjs +0 -75
  364. package/dist/chunks/messages-CWsZuBj1.mjs +0 -75
  365. package/dist/chunks/messages-C_gLHo6A.mjs +0 -75
  366. package/dist/chunks/messages-Cbu-NUDn.mjs +0 -75
  367. package/dist/chunks/messages-Cjb_MCeh.mjs +0 -75
  368. package/dist/chunks/messages-ClXYO9Wn.mjs +0 -75
  369. package/dist/chunks/messages-CsH20vhP.mjs +0 -75
  370. package/dist/chunks/messages-CsjAGhzA.mjs +0 -75
  371. package/dist/chunks/messages-Cx7VKFOE.mjs +0 -75
  372. package/dist/chunks/messages-D3JeBwxo.mjs +0 -75
  373. package/dist/chunks/messages-D541fieJ.mjs +0 -75
  374. package/dist/chunks/messages-D7XPdglc.mjs +0 -75
  375. package/dist/chunks/messages-DBhylfvt.mjs +0 -75
  376. package/dist/chunks/messages-DCA120lW.mjs +0 -75
  377. package/dist/chunks/messages-DCf_xZMN.mjs +0 -75
  378. package/dist/chunks/messages-DDwXKCpe.mjs +0 -75
  379. package/dist/chunks/messages-DNKDlxcy.mjs +0 -75
  380. package/dist/chunks/messages-DPvEjrGK.mjs +0 -75
  381. package/dist/chunks/messages-DQ-AkNxA.mjs +0 -75
  382. package/dist/chunks/messages-DVuvkNap.mjs +0 -75
  383. package/dist/chunks/messages-DaglyqUT.mjs +0 -75
  384. package/dist/chunks/messages-Di0bAfwA.mjs +0 -75
  385. package/dist/chunks/messages-DuLct0Yr.mjs +0 -75
  386. package/dist/chunks/messages-DzEYYhZh.mjs +0 -75
  387. package/dist/chunks/messages-DznNGAB2.mjs +0 -75
  388. package/dist/chunks/messages-DzoIzyu8.mjs +0 -75
  389. package/dist/chunks/messages-QYOGmket.mjs +0 -75
  390. package/dist/chunks/messages-cEjGDAgI.mjs +0 -75
  391. package/dist/chunks/messages-ddhvrdpE.mjs +0 -75
  392. package/dist/chunks/messages-mwfNK5nZ.mjs +0 -75
  393. package/dist/chunks/messages-nG_vNDte.mjs +0 -75
  394. package/dist/chunks/messages-tDq3Owh7.mjs +0 -75
  395. package/dist/chunks/messages-x6VJVZKx.mjs +0 -75
  396. package/dist/messages-0Pxnqd4N.mjs +0 -75
  397. package/dist/messages-0ZXYUq7S.mjs +0 -75
  398. package/dist/messages-2OD2uUDS.mjs +0 -75
  399. package/dist/messages-7cEMfYzh.mjs +0 -75
  400. package/dist/messages-8mwfda1Q.mjs +0 -75
  401. package/dist/messages-B-FqWsBM.mjs +0 -75
  402. package/dist/messages-B1jzqWiQ.mjs +0 -75
  403. package/dist/messages-B5wk4Ezz.mjs +0 -75
  404. package/dist/messages-BAZ5Ld8x.mjs +0 -75
  405. package/dist/messages-BBhGp198.mjs +0 -75
  406. package/dist/messages-BC9IjIb7.mjs +0 -75
  407. package/dist/messages-BFEmpeV-.mjs +0 -75
  408. package/dist/messages-BGqzTZy0.mjs +0 -75
  409. package/dist/messages-BICs1abK.mjs +0 -75
  410. package/dist/messages-BJX6rOnd.mjs +0 -75
  411. package/dist/messages-BL2bXRhN.mjs +0 -75
  412. package/dist/messages-BMs5qdlH.mjs +0 -75
  413. package/dist/messages-BRsjUNwB.mjs +0 -75
  414. package/dist/messages-BSqV8OUR.mjs +0 -75
  415. package/dist/messages-BTqu3DfG.mjs +0 -75
  416. package/dist/messages-BXnDEsur.mjs +0 -75
  417. package/dist/messages-BYcre4-6.mjs +0 -75
  418. package/dist/messages-BZ9LRJf-.mjs +0 -75
  419. package/dist/messages-BgypBy7y.mjs +0 -75
  420. package/dist/messages-BsuGf70G.mjs +0 -75
  421. package/dist/messages-BwaoF4lQ.mjs +0 -75
  422. package/dist/messages-C1l8_7-y.mjs +0 -75
  423. package/dist/messages-C5NA_r9v.mjs +0 -75
  424. package/dist/messages-C6zgZ5pA.mjs +0 -75
  425. package/dist/messages-CAo5ghFI.mjs +0 -75
  426. package/dist/messages-CH9qlJ9I.mjs +0 -75
  427. package/dist/messages-CI0HqAeS.mjs +0 -75
  428. package/dist/messages-CJJtms9k.mjs +0 -75
  429. package/dist/messages-CM2hJqk6.mjs +0 -75
  430. package/dist/messages-CRMiDPIQ.mjs +0 -75
  431. package/dist/messages-CWsZuBj1.mjs +0 -75
  432. package/dist/messages-C_gLHo6A.mjs +0 -75
  433. package/dist/messages-Cbu-NUDn.mjs +0 -75
  434. package/dist/messages-Cjb_MCeh.mjs +0 -75
  435. package/dist/messages-ClXYO9Wn.mjs +0 -75
  436. package/dist/messages-CsH20vhP.mjs +0 -75
  437. package/dist/messages-CsjAGhzA.mjs +0 -75
  438. package/dist/messages-Cx7VKFOE.mjs +0 -75
  439. package/dist/messages-D3JeBwxo.mjs +0 -75
  440. package/dist/messages-D541fieJ.mjs +0 -75
  441. package/dist/messages-D7XPdglc.mjs +0 -75
  442. package/dist/messages-DBhylfvt.mjs +0 -75
  443. package/dist/messages-DCA120lW.mjs +0 -75
  444. package/dist/messages-DCf_xZMN.mjs +0 -75
  445. package/dist/messages-DDwXKCpe.mjs +0 -75
  446. package/dist/messages-DNKDlxcy.mjs +0 -75
  447. package/dist/messages-DPvEjrGK.mjs +0 -75
  448. package/dist/messages-DQ-AkNxA.mjs +0 -75
  449. package/dist/messages-DVuvkNap.mjs +0 -75
  450. package/dist/messages-DaglyqUT.mjs +0 -75
  451. package/dist/messages-Di0bAfwA.mjs +0 -75
  452. package/dist/messages-DuLct0Yr.mjs +0 -75
  453. package/dist/messages-DzEYYhZh.mjs +0 -75
  454. package/dist/messages-DznNGAB2.mjs +0 -75
  455. package/dist/messages-DzoIzyu8.mjs +0 -75
  456. package/dist/messages-QYOGmket.mjs +0 -75
  457. package/dist/messages-cEjGDAgI.mjs +0 -75
  458. package/dist/messages-ddhvrdpE.mjs +0 -75
  459. package/dist/messages-mwfNK5nZ.mjs +0 -75
  460. package/dist/messages-nG_vNDte.mjs +0 -75
  461. package/dist/messages-tDq3Owh7.mjs +0 -75
  462. package/dist/messages-x6VJVZKx.mjs +0 -75
@@ -1,1303 +0,0 @@
1
- var Re = Object.defineProperty, $e = Object.defineProperties;
2
- var Ne = Object.getOwnPropertyDescriptors;
3
- var ae = Object.getOwnPropertySymbols;
4
- var ke = Object.prototype.hasOwnProperty, Fe = Object.prototype.propertyIsEnumerable;
5
- var oe = (a, e, t) => e in a ? Re(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, d = (a, e) => {
6
- for (var t in e || (e = {}))
7
- ke.call(e, t) && oe(a, t, e[t]);
8
- if (ae)
9
- for (var t of ae(e))
10
- Fe.call(e, t) && oe(a, t, e[t]);
11
- return a;
12
- }, b = (a, e) => $e(a, Ne(e));
13
- const m = (a) => typeof a == "string", U = () => {
14
- let a, e;
15
- const t = new Promise((s, i) => {
16
- a = s, e = i;
17
- });
18
- return t.resolve = a, t.reject = e, t;
19
- }, le = (a) => a == null ? "" : "" + a, je = (a, e, t) => {
20
- a.forEach((s) => {
21
- e[s] && (t[s] = e[s]);
22
- });
23
- }, Ee = /###/g, ue = (a) => a && a.indexOf("###") > -1 ? a.replace(Ee, ".") : a, fe = (a) => !a || m(a), H = (a, e, t) => {
24
- const s = m(e) ? e.split(".") : e;
25
- let i = 0;
26
- for (; i < s.length - 1; ) {
27
- if (fe(a)) return {};
28
- const n = ue(s[i]);
29
- !a[n] && t && (a[n] = new t()), Object.prototype.hasOwnProperty.call(a, n) ? a = a[n] : a = {}, ++i;
30
- }
31
- return fe(a) ? {} : {
32
- obj: a,
33
- k: ue(s[i])
34
- };
35
- }, he = (a, e, t) => {
36
- const {
37
- obj: s,
38
- k: i
39
- } = H(a, e, Object);
40
- if (s !== void 0 || e.length === 1) {
41
- s[i] = t;
42
- return;
43
- }
44
- let n = e[e.length - 1], r = e.slice(0, e.length - 1), o = H(a, r, Object);
45
- for (; o.obj === void 0 && r.length; )
46
- n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), o = H(a, r, Object), o != null && o.obj && typeof o.obj[`${o.k}.${n}`] != "undefined" && (o.obj = void 0);
47
- o.obj[`${o.k}.${n}`] = t;
48
- }, Te = (a, e, t, s) => {
49
- const {
50
- obj: i,
51
- k: n
52
- } = H(a, e, Object);
53
- i[n] = i[n] || [], i[n].push(t);
54
- }, W = (a, e) => {
55
- const {
56
- obj: t,
57
- k: s
58
- } = H(a, e);
59
- if (t && Object.prototype.hasOwnProperty.call(t, s))
60
- return t[s];
61
- }, Ie = (a, e, t) => {
62
- const s = W(a, t);
63
- return s !== void 0 ? s : W(e, t);
64
- }, be = (a, e, t) => {
65
- for (const s in e)
66
- s !== "__proto__" && s !== "constructor" && (s in a ? m(a[s]) || a[s] instanceof String || m(e[s]) || e[s] instanceof String ? t && (a[s] = e[s]) : be(a[s], e[s], t) : a[s] = e[s]);
67
- return a;
68
- }, V = (a) => a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
69
- var Ve = {
70
- "&": "&amp;",
71
- "<": "&lt;",
72
- ">": "&gt;",
73
- '"': "&quot;",
74
- "'": "&#39;",
75
- "/": "&#x2F;"
76
- };
77
- const De = (a) => m(a) ? a.replace(/[&<>"'\/]/g, (e) => Ve[e]) : a;
78
- class Ke {
79
- constructor(e) {
80
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
81
- }
82
- getRegExp(e) {
83
- const t = this.regExpMap.get(e);
84
- if (t !== void 0)
85
- return t;
86
- const s = new RegExp(e);
87
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
88
- }
89
- }
90
- const Ae = [" ", ",", "?", "!", ";"], Ue = new Ke(20), He = (a, e, t) => {
91
- e = e || "", t = t || "";
92
- const s = Ae.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
93
- if (s.length === 0) return !0;
94
- const i = Ue.getRegExp(`(${s.map((r) => r === "?" ? "\\?" : r).join("|")})`);
95
- let n = !i.test(a);
96
- if (!n) {
97
- const r = a.indexOf(t);
98
- r > 0 && !i.test(a.substring(0, r)) && (n = !0);
99
- }
100
- return n;
101
- }, ee = (a, e, t = ".") => {
102
- if (!a) return;
103
- if (a[e])
104
- return Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0;
105
- const s = e.split(t);
106
- let i = a;
107
- for (let n = 0; n < s.length; ) {
108
- if (!i || typeof i != "object")
109
- return;
110
- let r, o = "";
111
- for (let u = n; u < s.length; ++u)
112
- if (u !== n && (o += t), o += s[u], r = i[o], r !== void 0) {
113
- if (["string", "number", "boolean"].indexOf(typeof r) > -1 && u < s.length - 1)
114
- continue;
115
- n += u - n + 1;
116
- break;
117
- }
118
- i = r;
119
- }
120
- return i;
121
- }, z = (a) => a == null ? void 0 : a.replace("_", "-"), Me = {
122
- type: "logger",
123
- log(a) {
124
- this.output("log", a);
125
- },
126
- warn(a) {
127
- this.output("warn", a);
128
- },
129
- error(a) {
130
- this.output("error", a);
131
- },
132
- output(a, e) {
133
- var t, s;
134
- (s = (t = console == null ? void 0 : console[a]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
135
- }
136
- };
137
- class Y {
138
- constructor(e, t = {}) {
139
- this.init(e, t);
140
- }
141
- init(e, t = {}) {
142
- this.prefix = t.prefix || "i18next:", this.logger = e || Me, this.options = t, this.debug = t.debug;
143
- }
144
- log(...e) {
145
- return this.forward(e, "log", "", !0);
146
- }
147
- warn(...e) {
148
- return this.forward(e, "warn", "", !0);
149
- }
150
- error(...e) {
151
- return this.forward(e, "error", "");
152
- }
153
- deprecate(...e) {
154
- return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
155
- }
156
- forward(e, t, s, i) {
157
- return i && !this.debug ? null : (m(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
158
- }
159
- create(e) {
160
- return new Y(this.logger, d({
161
- prefix: `${this.prefix}:${e}:`
162
- }, this.options));
163
- }
164
- clone(e) {
165
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new Y(this.logger, e);
166
- }
167
- }
168
- var k = new Y();
169
- class Q {
170
- constructor() {
171
- this.observers = {};
172
- }
173
- on(e, t) {
174
- return e.split(" ").forEach((s) => {
175
- this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
176
- const i = this.observers[s].get(t) || 0;
177
- this.observers[s].set(t, i + 1);
178
- }), this;
179
- }
180
- off(e, t) {
181
- if (this.observers[e]) {
182
- if (!t) {
183
- delete this.observers[e];
184
- return;
185
- }
186
- this.observers[e].delete(t);
187
- }
188
- }
189
- emit(e, ...t) {
190
- this.observers[e] && Array.from(this.observers[e].entries()).forEach(([i, n]) => {
191
- for (let r = 0; r < n; r++)
192
- i(...t);
193
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([i, n]) => {
194
- for (let r = 0; r < n; r++)
195
- i.apply(i, [e, ...t]);
196
- });
197
- }
198
- }
199
- class ce extends Q {
200
- constructor(e, t = {
201
- ns: ["translation"],
202
- defaultNS: "translation"
203
- }) {
204
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
205
- }
206
- addNamespaces(e) {
207
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
208
- }
209
- removeNamespaces(e) {
210
- const t = this.options.ns.indexOf(e);
211
- t > -1 && this.options.ns.splice(t, 1);
212
- }
213
- getResource(e, t, s, i = {}) {
214
- var l, h;
215
- const n = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, r = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
216
- let o;
217
- e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : m(s) && n ? o.push(...s.split(n)) : o.push(s)));
218
- const u = W(this.data, o);
219
- return !u && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), u || !r || !m(s) ? u : ee((h = (l = this.data) == null ? void 0 : l[e]) == null ? void 0 : h[t], s, n);
220
- }
221
- addResource(e, t, s, i, n = {
222
- silent: !1
223
- }) {
224
- const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
225
- let o = [e, t];
226
- s && (o = o.concat(r ? s.split(r) : s)), e.indexOf(".") > -1 && (o = e.split("."), i = t, t = o[1]), this.addNamespaces(t), he(this.data, o, i), n.silent || this.emit("added", e, t, s, i);
227
- }
228
- addResources(e, t, s, i = {
229
- silent: !1
230
- }) {
231
- for (const n in s)
232
- (m(s[n]) || Array.isArray(s[n])) && this.addResource(e, t, n, s[n], {
233
- silent: !0
234
- });
235
- i.silent || this.emit("added", e, t, s);
236
- }
237
- addResourceBundle(e, t, s, i, n, r = {
238
- silent: !1,
239
- skipCopy: !1
240
- }) {
241
- let o = [e, t];
242
- e.indexOf(".") > -1 && (o = e.split("."), i = s, s = t, t = o[1]), this.addNamespaces(t);
243
- let u = W(this.data, o) || {};
244
- r.skipCopy || (s = JSON.parse(JSON.stringify(s))), i ? be(u, s, n) : u = d(d({}, u), s), he(this.data, o, u), r.silent || this.emit("added", e, t, s);
245
- }
246
- removeResourceBundle(e, t) {
247
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
248
- }
249
- hasResourceBundle(e, t) {
250
- return this.getResource(e, t) !== void 0;
251
- }
252
- getResourceBundle(e, t) {
253
- return t || (t = this.options.defaultNS), this.getResource(e, t);
254
- }
255
- getDataByLanguage(e) {
256
- return this.data[e];
257
- }
258
- hasLanguageSomeTranslations(e) {
259
- const t = this.getDataByLanguage(e);
260
- return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
261
- }
262
- toJSON() {
263
- return this.data;
264
- }
265
- }
266
- var Le = {
267
- processors: {},
268
- addPostProcessor(a) {
269
- this.processors[a.name] = a;
270
- },
271
- handle(a, e, t, s, i) {
272
- return a.forEach((n) => {
273
- var r, o;
274
- e = (o = (r = this.processors[n]) == null ? void 0 : r.process(e, t, s, i)) != null ? o : e;
275
- }), e;
276
- }
277
- };
278
- const we = /* @__PURE__ */ Symbol("i18next/PATH_KEY");
279
- function ze() {
280
- const a = [], e = /* @__PURE__ */ Object.create(null);
281
- let t;
282
- return e.get = (s, i) => {
283
- var n;
284
- return (n = t == null ? void 0 : t.revoke) == null || n.call(t), i === we ? a : (a.push(i), t = Proxy.revocable(s, e), t.proxy);
285
- }, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
286
- }
287
- function te(a, e) {
288
- var s;
289
- const {
290
- [we]: t
291
- } = a(ze());
292
- return t.join((s = e == null ? void 0 : e.keySeparator) != null ? s : ".");
293
- }
294
- const de = {}, Z = (a) => !m(a) && typeof a != "boolean" && typeof a != "number";
295
- class G extends Q {
296
- constructor(e, t = {}) {
297
- super(), je(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = k.create("translator");
298
- }
299
- changeLanguage(e) {
300
- e && (this.language = e);
301
- }
302
- exists(e, t = {
303
- interpolation: {}
304
- }) {
305
- const s = d({}, t);
306
- if (e == null) return !1;
307
- const i = this.resolve(e, s);
308
- if ((i == null ? void 0 : i.res) === void 0) return !1;
309
- const n = Z(i.res);
310
- return !(s.returnObjects === !1 && n);
311
- }
312
- extractFromKey(e, t) {
313
- let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
314
- s === void 0 && (s = ":");
315
- const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
316
- let n = t.ns || this.options.defaultNS || [];
317
- const r = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !He(e, s, i);
318
- if (r && !o) {
319
- const u = e.match(this.interpolator.nestingRegexp);
320
- if (u && u.length > 0)
321
- return {
322
- key: e,
323
- namespaces: m(n) ? [n] : n
324
- };
325
- const l = e.split(s);
326
- (s !== i || s === i && this.options.ns.indexOf(l[0]) > -1) && (n = l.shift()), e = l.join(i);
327
- }
328
- return {
329
- key: e,
330
- namespaces: m(n) ? [n] : n
331
- };
332
- }
333
- translate(e, t, s) {
334
- let i = typeof t == "object" ? d({}, t) : t;
335
- if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = d({}, i)), i || (i = {}), e == null) return "";
336
- typeof e == "function" && (e = te(e, d(d({}, this.options), i))), Array.isArray(e) || (e = [String(e)]);
337
- const n = i.returnDetails !== void 0 ? i.returnDetails : this.options.returnDetails, r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, {
338
- key: o,
339
- namespaces: u
340
- } = this.extractFromKey(e[e.length - 1], i), l = u[u.length - 1];
341
- let h = i.nsSeparator !== void 0 ? i.nsSeparator : this.options.nsSeparator;
342
- h === void 0 && (h = ":");
343
- const f = i.lng || this.language, g = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
344
- if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
345
- return g ? n ? {
346
- res: `${l}${h}${o}`,
347
- usedKey: o,
348
- exactUsedKey: o,
349
- usedLng: f,
350
- usedNS: l,
351
- usedParams: this.getUsedParamsDetails(i)
352
- } : `${l}${h}${o}` : n ? {
353
- res: o,
354
- usedKey: o,
355
- exactUsedKey: o,
356
- usedLng: f,
357
- usedNS: l,
358
- usedParams: this.getUsedParamsDetails(i)
359
- } : o;
360
- const p = this.resolve(e, i);
361
- let c = p == null ? void 0 : p.res;
362
- const x = (p == null ? void 0 : p.usedKey) || o, y = (p == null ? void 0 : p.exactUsedKey) || o, S = ["[object Number]", "[object Function]", "[object RegExp]"], P = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, T = !this.i18nFormat || this.i18nFormat.handleAsObject, L = i.count !== void 0 && !m(i.count), F = G.hasDefaultValue(i), B = L ? this.pluralResolver.getSuffix(f, i.count, i) : "", j = i.ordinal && L ? this.pluralResolver.getSuffix(f, i.count, {
363
- ordinal: !1
364
- }) : "", D = L && !i.ordinal && i.count === 0, C = D && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${B}`] || i[`defaultValue${j}`] || i.defaultValue;
365
- let O = c;
366
- T && !c && F && (O = C);
367
- const ve = Z(O), Pe = Object.prototype.toString.apply(O);
368
- if (T && O && ve && S.indexOf(Pe) < 0 && !(m(P) && Array.isArray(O))) {
369
- if (!i.returnObjects && !this.options.returnObjects) {
370
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
371
- const $ = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(x, O, b(d({}, i), {
372
- ns: u
373
- })) : `key '${o} (${this.language})' returned an object instead of string.`;
374
- return n ? (p.res = $, p.usedParams = this.getUsedParamsDetails(i), p) : $;
375
- }
376
- if (r) {
377
- const $ = Array.isArray(O), R = $ ? [] : {}, ie = $ ? y : x;
378
- for (const N in O)
379
- if (Object.prototype.hasOwnProperty.call(O, N)) {
380
- const E = `${ie}${r}${N}`;
381
- F && !c ? R[N] = this.translate(E, b(d({}, i), {
382
- defaultValue: Z(C) ? C[N] : void 0,
383
- joinArrays: !1,
384
- ns: u
385
- })) : R[N] = this.translate(E, b(d({}, i), {
386
- joinArrays: !1,
387
- ns: u
388
- })), R[N] === E && (R[N] = O[N]);
389
- }
390
- c = R;
391
- }
392
- } else if (T && m(P) && Array.isArray(c))
393
- c = c.join(P), c && (c = this.extendTranslation(c, e, i, s));
394
- else {
395
- let $ = !1, R = !1;
396
- !this.isValidLookup(c) && F && ($ = !0, c = C), this.isValidLookup(c) || (R = !0, c = o);
397
- const N = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && R ? void 0 : c, E = F && C !== c && this.options.updateMissing;
398
- if (R || $ || E) {
399
- if (this.logger.log(E ? "updateKey" : "missingKey", f, l, o, E ? C : c), r) {
400
- const v = this.resolve(o, b(d({}, i), {
401
- keySeparator: !1
402
- }));
403
- v && v.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.");
404
- }
405
- let K = [];
406
- const J = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
407
- if (this.options.saveMissingTo === "fallback" && J && J[0])
408
- for (let v = 0; v < J.length; v++)
409
- K.push(J[v]);
410
- else this.options.saveMissingTo === "all" ? K = this.languageUtils.toResolveHierarchy(i.lng || this.language) : K.push(i.lng || this.language);
411
- const se = (v, I, A) => {
412
- var re;
413
- const ne = F && A !== c ? A : N;
414
- this.options.missingKeyHandler ? this.options.missingKeyHandler(v, l, I, ne, E, i) : (re = this.backendConnector) != null && re.saveMissing && this.backendConnector.saveMissing(v, l, I, ne, E, i), this.emit("missingKey", v, l, I, c);
415
- };
416
- this.options.saveMissing && (this.options.saveMissingPlurals && L ? K.forEach((v) => {
417
- const I = this.pluralResolver.getSuffixes(v, i);
418
- D && i[`defaultValue${this.options.pluralSeparator}zero`] && I.indexOf(`${this.options.pluralSeparator}zero`) < 0 && I.push(`${this.options.pluralSeparator}zero`), I.forEach((A) => {
419
- se([v], o + A, i[`defaultValue${A}`] || C);
420
- });
421
- }) : se(K, o, C));
422
- }
423
- c = this.extendTranslation(c, e, i, p, s), R && c === o && this.options.appendNamespaceToMissingKey && (c = `${l}${h}${o}`), (R || $) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${h}${o}` : o, $ ? c : void 0, i));
424
- }
425
- return n ? (p.res = c, p.usedParams = this.getUsedParamsDetails(i), p) : c;
426
- }
427
- extendTranslation(e, t, s, i, n) {
428
- var u, l;
429
- if ((u = this.i18nFormat) != null && u.parse)
430
- e = this.i18nFormat.parse(e, d(d({}, this.options.interpolation.defaultVariables), s), s.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
431
- resolved: i
432
- });
433
- else if (!s.skipInterpolation) {
434
- s.interpolation && this.interpolator.init(b(d({}, s), {
435
- interpolation: d(d({}, this.options.interpolation), s.interpolation)
436
- }));
437
- const h = m(e) && (((l = s == null ? void 0 : s.interpolation) == null ? void 0 : l.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
438
- let f;
439
- if (h) {
440
- const p = e.match(this.interpolator.nestingRegexp);
441
- f = p && p.length;
442
- }
443
- let g = s.replace && !m(s.replace) ? s.replace : s;
444
- if (this.options.interpolation.defaultVariables && (g = d(d({}, this.options.interpolation.defaultVariables), g)), e = this.interpolator.interpolate(e, g, s.lng || this.language || i.usedLng, s), h) {
445
- const p = e.match(this.interpolator.nestingRegexp), c = p && p.length;
446
- f < c && (s.nest = !1);
447
- }
448
- !s.lng && i && i.res && (s.lng = this.language || i.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, (...p) => (n == null ? void 0 : n[0]) === p[0] && !s.context ? (this.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${t[0]}`), null) : this.translate(...p, t), s)), s.interpolation && this.interpolator.reset();
449
- }
450
- const r = s.postProcess || this.options.postProcess, o = m(r) ? [r] : r;
451
- return e != null && (o != null && o.length) && s.applyPostProcessor !== !1 && (e = Le.handle(o, e, t, this.options && this.options.postProcessPassResolved ? d({
452
- i18nResolved: b(d({}, i), {
453
- usedParams: this.getUsedParamsDetails(s)
454
- })
455
- }, s) : s, this)), e;
456
- }
457
- resolve(e, t = {}) {
458
- let s, i, n, r, o;
459
- return m(e) && (e = [e]), e.forEach((u) => {
460
- if (this.isValidLookup(s)) return;
461
- const l = this.extractFromKey(u, t), h = l.key;
462
- i = h;
463
- let f = l.namespaces;
464
- this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
465
- const g = t.count !== void 0 && !m(t.count), p = g && !t.ordinal && t.count === 0, c = t.context !== void 0 && (m(t.context) || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
466
- f.forEach((y) => {
467
- var S, P;
468
- this.isValidLookup(s) || (o = y, !de[`${x[0]}-${y}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((P = this.utils) != null && P.hasLoadedNamespace(o)) && (de[`${x[0]}-${y}`] = !0, this.logger.warn(`key "${i}" for languages "${x.join(", ")}" won't get resolved as namespace "${o}" 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!!!")), x.forEach((T) => {
469
- var B;
470
- if (this.isValidLookup(s)) return;
471
- r = T;
472
- const L = [h];
473
- if ((B = this.i18nFormat) != null && B.addLookupKeys)
474
- this.i18nFormat.addLookupKeys(L, h, T, y, t);
475
- else {
476
- let j;
477
- g && (j = this.pluralResolver.getSuffix(T, t.count, t));
478
- const D = `${this.options.pluralSeparator}zero`, C = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
479
- if (g && (t.ordinal && j.indexOf(C) === 0 && L.push(h + j.replace(C, this.options.pluralSeparator)), L.push(h + j), p && L.push(h + D)), c) {
480
- const O = `${h}${this.options.contextSeparator || "_"}${t.context}`;
481
- L.push(O), g && (t.ordinal && j.indexOf(C) === 0 && L.push(O + j.replace(C, this.options.pluralSeparator)), L.push(O + j), p && L.push(O + D));
482
- }
483
- }
484
- let F;
485
- for (; F = L.pop(); )
486
- this.isValidLookup(s) || (n = F, s = this.getResource(T, y, F, t));
487
- }));
488
- });
489
- }), {
490
- res: s,
491
- usedKey: i,
492
- exactUsedKey: n,
493
- usedLng: r,
494
- usedNS: o
495
- };
496
- }
497
- isValidLookup(e) {
498
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
499
- }
500
- getResource(e, t, s, i = {}) {
501
- var n;
502
- return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, s, i) : this.resourceStore.getResource(e, t, s, i);
503
- }
504
- getUsedParamsDetails(e = {}) {
505
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !m(e.replace);
506
- let i = s ? e.replace : e;
507
- if (s && typeof e.count != "undefined" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = d(d({}, this.options.interpolation.defaultVariables), i)), !s) {
508
- i = d({}, i);
509
- for (const n of t)
510
- delete i[n];
511
- }
512
- return i;
513
- }
514
- static hasDefaultValue(e) {
515
- const t = "defaultValue";
516
- for (const s in e)
517
- if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
518
- return !0;
519
- return !1;
520
- }
521
- }
522
- class pe {
523
- constructor(e) {
524
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = k.create("languageUtils");
525
- }
526
- getScriptPartFromCode(e) {
527
- if (e = z(e), !e || e.indexOf("-") < 0) return null;
528
- const t = e.split("-");
529
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
530
- }
531
- getLanguagePartFromCode(e) {
532
- if (e = z(e), !e || e.indexOf("-") < 0) return e;
533
- const t = e.split("-");
534
- return this.formatLanguageCode(t[0]);
535
- }
536
- formatLanguageCode(e) {
537
- if (m(e) && e.indexOf("-") > -1) {
538
- let t;
539
- try {
540
- t = Intl.getCanonicalLocales(e)[0];
541
- } catch (s) {
542
- }
543
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
544
- }
545
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
546
- }
547
- isSupportedCode(e) {
548
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
549
- }
550
- getBestMatchFromCodes(e) {
551
- if (!e) return null;
552
- let t;
553
- return e.forEach((s) => {
554
- if (t) return;
555
- const i = this.formatLanguageCode(s);
556
- (!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
557
- }), !t && this.options.supportedLngs && e.forEach((s) => {
558
- if (t) return;
559
- const i = this.getScriptPartFromCode(s);
560
- if (this.isSupportedCode(i)) return t = i;
561
- const n = this.getLanguagePartFromCode(s);
562
- if (this.isSupportedCode(n)) return t = n;
563
- t = this.options.supportedLngs.find((r) => {
564
- if (r === n) return r;
565
- if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && (r.indexOf("-") > 0 && n.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === n || r.indexOf(n) === 0 && n.length > 1))
566
- return r;
567
- });
568
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
569
- }
570
- getFallbackCodes(e, t) {
571
- if (!e) return [];
572
- if (typeof e == "function" && (e = e(t)), m(e) && (e = [e]), Array.isArray(e)) return e;
573
- if (!t) return e.default || [];
574
- let s = e[t];
575
- return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
576
- }
577
- toResolveHierarchy(e, t) {
578
- const s = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), i = [], n = (r) => {
579
- r && (this.isSupportedCode(r) ? i.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
580
- };
581
- return m(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : m(e) && n(this.formatLanguageCode(e)), s.forEach((r) => {
582
- i.indexOf(r) < 0 && n(this.formatLanguageCode(r));
583
- }), i;
584
- }
585
- }
586
- const ge = {
587
- zero: 0,
588
- one: 1,
589
- two: 2,
590
- few: 3,
591
- many: 4,
592
- other: 5
593
- }, me = {
594
- select: (a) => a === 1 ? "one" : "other",
595
- resolvedOptions: () => ({
596
- pluralCategories: ["one", "other"]
597
- })
598
- };
599
- class Be {
600
- constructor(e, t = {}) {
601
- this.languageUtils = e, this.options = t, this.logger = k.create("pluralResolver"), this.pluralRulesCache = {};
602
- }
603
- clearCache() {
604
- this.pluralRulesCache = {};
605
- }
606
- getRule(e, t = {}) {
607
- const s = z(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
608
- cleanedCode: s,
609
- type: i
610
- });
611
- if (n in this.pluralRulesCache)
612
- return this.pluralRulesCache[n];
613
- let r;
614
- try {
615
- r = new Intl.PluralRules(s, {
616
- type: i
617
- });
618
- } catch (o) {
619
- if (typeof Intl == "undefined")
620
- return this.logger.error("No Intl support, please use an Intl polyfill!"), me;
621
- if (!e.match(/-|_/)) return me;
622
- const u = this.languageUtils.getLanguagePartFromCode(e);
623
- r = this.getRule(u, t);
624
- }
625
- return this.pluralRulesCache[n] = r, r;
626
- }
627
- needsPlural(e, t = {}) {
628
- let s = this.getRule(e, t);
629
- return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
630
- }
631
- getPluralFormsOfKey(e, t, s = {}) {
632
- return this.getSuffixes(e, s).map((i) => `${t}${i}`);
633
- }
634
- getSuffixes(e, t = {}) {
635
- let s = this.getRule(e, t);
636
- return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((i, n) => ge[i] - ge[n]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
637
- }
638
- getSuffix(e, t, s = {}) {
639
- const i = this.getRule(e, s);
640
- return i ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
641
- }
642
- }
643
- const xe = (a, e, t, s = ".", i = !0) => {
644
- let n = Ie(a, e, t);
645
- return !n && i && m(t) && (n = ee(a, t, s), n === void 0 && (n = ee(e, t, s))), n;
646
- }, X = (a) => a.replace(/\$/g, "$$$$");
647
- class ye {
648
- constructor(e = {}) {
649
- var t;
650
- this.logger = k.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
651
- }
652
- init(e = {}) {
653
- e.interpolation || (e.interpolation = {
654
- escapeValue: !0
655
- });
656
- const {
657
- escape: t,
658
- escapeValue: s,
659
- useRawValueToEscape: i,
660
- prefix: n,
661
- prefixEscaped: r,
662
- suffix: o,
663
- suffixEscaped: u,
664
- formatSeparator: l,
665
- unescapeSuffix: h,
666
- unescapePrefix: f,
667
- nestingPrefix: g,
668
- nestingPrefixEscaped: p,
669
- nestingSuffix: c,
670
- nestingSuffixEscaped: x,
671
- nestingOptionsSeparator: y,
672
- maxReplaces: S,
673
- alwaysFormat: P
674
- } = e.interpolation;
675
- this.escape = t !== void 0 ? t : De, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = n ? V(n) : r || "{{", this.suffix = o ? V(o) : u || "}}", this.formatSeparator = l || ",", this.unescapePrefix = h ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = g ? V(g) : p || V("$t("), this.nestingSuffix = c ? V(c) : x || V(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = S || 1e3, this.alwaysFormat = P !== void 0 ? P : !1, this.resetRegExp();
676
- }
677
- reset() {
678
- this.options && this.init(this.options);
679
- }
680
- resetRegExp() {
681
- const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
682
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
683
- }
684
- interpolate(e, t, s, i) {
685
- var p;
686
- let n, r, o;
687
- const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, l = (c) => {
688
- if (c.indexOf(this.formatSeparator) < 0) {
689
- const P = xe(t, u, c, this.options.keySeparator, this.options.ignoreJSONStructure);
690
- return this.alwaysFormat ? this.format(P, void 0, s, b(d(d({}, i), t), {
691
- interpolationkey: c
692
- })) : P;
693
- }
694
- const x = c.split(this.formatSeparator), y = x.shift().trim(), S = x.join(this.formatSeparator).trim();
695
- return this.format(xe(t, u, y, this.options.keySeparator, this.options.ignoreJSONStructure), S, s, b(d(d({}, i), t), {
696
- interpolationkey: y
697
- }));
698
- };
699
- this.resetRegExp();
700
- const h = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((p = i == null ? void 0 : i.interpolation) == null ? void 0 : p.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
701
- return [{
702
- regex: this.regexpUnescape,
703
- safeValue: (c) => X(c)
704
- }, {
705
- regex: this.regexp,
706
- safeValue: (c) => this.escapeValue ? X(this.escape(c)) : X(c)
707
- }].forEach((c) => {
708
- for (o = 0; n = c.regex.exec(e); ) {
709
- const x = n[1].trim();
710
- if (r = l(x), r === void 0)
711
- if (typeof h == "function") {
712
- const S = h(e, n, i);
713
- r = m(S) ? S : "";
714
- } else if (i && Object.prototype.hasOwnProperty.call(i, x))
715
- r = "";
716
- else if (f) {
717
- r = n[0];
718
- continue;
719
- } else
720
- this.logger.warn(`missed to pass in variable ${x} for interpolating ${e}`), r = "";
721
- else !m(r) && !this.useRawValueToEscape && (r = le(r));
722
- const y = c.safeValue(r);
723
- if (e = e.replace(n[0], y), f ? (c.regex.lastIndex += r.length, c.regex.lastIndex -= n[0].length) : c.regex.lastIndex = 0, o++, o >= this.maxReplaces)
724
- break;
725
- }
726
- }), e;
727
- }
728
- nest(e, t, s = {}) {
729
- let i, n, r;
730
- const o = (u, l) => {
731
- var x, y;
732
- const h = this.nestingOptionsSeparator;
733
- if (u.indexOf(h) < 0) return u;
734
- const f = u.split(new RegExp(`${V(h)}[ ]*{`));
735
- let g = `{${f[1]}`;
736
- u = f[0], g = this.interpolate(g, r);
737
- const p = g.match(/'/g), c = g.match(/"/g);
738
- (((x = p == null ? void 0 : p.length) != null ? x : 0) % 2 === 0 && !c || ((y = c == null ? void 0 : c.length) != null ? y : 0) % 2 !== 0) && (g = g.replace(/'/g, '"'));
739
- try {
740
- r = JSON.parse(g), l && (r = d(d({}, l), r));
741
- } catch (S) {
742
- return this.logger.warn(`failed parsing options string in nesting for key ${u}`, S), `${u}${h}${g}`;
743
- }
744
- return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, u;
745
- };
746
- for (; i = this.nestingRegexp.exec(e); ) {
747
- let u = [];
748
- r = d({}, s), r = r.replace && !m(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
749
- const l = /{.*}/.test(i[1]) ? i[1].lastIndexOf("}") + 1 : i[1].indexOf(this.formatSeparator);
750
- if (l !== -1 && (u = i[1].slice(l).split(this.formatSeparator).map((h) => h.trim()).filter(Boolean), i[1] = i[1].slice(0, l)), n = t(o.call(this, i[1].trim(), r), r), n && i[0] === e && !m(n)) return n;
751
- m(n) || (n = le(n)), n || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), n = ""), u.length && (n = u.reduce((h, f) => this.format(h, f, s.lng, b(d({}, s), {
752
- interpolationkey: i[1].trim()
753
- })), n.trim())), e = e.replace(i[0], n), this.regexp.lastIndex = 0;
754
- }
755
- return e;
756
- }
757
- }
758
- const Je = (a) => {
759
- let e = a.toLowerCase().trim();
760
- const t = {};
761
- if (a.indexOf("(") > -1) {
762
- const s = a.split("(");
763
- e = s[0].toLowerCase().trim();
764
- const i = s[1].substring(0, s[1].length - 1);
765
- e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((r) => {
766
- if (r) {
767
- const [o, ...u] = r.split(":"), l = u.join(":").trim().replace(/^'+|'+$/g, ""), h = o.trim();
768
- t[h] || (t[h] = l), l === "false" && (t[h] = !1), l === "true" && (t[h] = !0), isNaN(l) || (t[h] = parseInt(l, 10));
769
- }
770
- });
771
- }
772
- return {
773
- formatName: e,
774
- formatOptions: t
775
- };
776
- }, Se = (a) => {
777
- const e = {};
778
- return (t, s, i) => {
779
- let n = i;
780
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (n = b(d({}, n), {
781
- [i.interpolationkey]: void 0
782
- }));
783
- const r = s + JSON.stringify(n);
784
- let o = e[r];
785
- return o || (o = a(z(s), i), e[r] = o), o(t);
786
- };
787
- }, _e = (a) => (e, t, s) => a(z(t), s)(e);
788
- class We {
789
- constructor(e = {}) {
790
- this.logger = k.create("formatter"), this.options = e, this.init(e);
791
- }
792
- init(e, t = {
793
- interpolation: {}
794
- }) {
795
- this.formatSeparator = t.interpolation.formatSeparator || ",";
796
- const s = t.cacheInBuiltFormats ? Se : _e;
797
- this.formats = {
798
- number: s((i, n) => {
799
- const r = new Intl.NumberFormat(i, d({}, n));
800
- return (o) => r.format(o);
801
- }),
802
- currency: s((i, n) => {
803
- const r = new Intl.NumberFormat(i, b(d({}, n), {
804
- style: "currency"
805
- }));
806
- return (o) => r.format(o);
807
- }),
808
- datetime: s((i, n) => {
809
- const r = new Intl.DateTimeFormat(i, d({}, n));
810
- return (o) => r.format(o);
811
- }),
812
- relativetime: s((i, n) => {
813
- const r = new Intl.RelativeTimeFormat(i, d({}, n));
814
- return (o) => r.format(o, n.range || "day");
815
- }),
816
- list: s((i, n) => {
817
- const r = new Intl.ListFormat(i, d({}, n));
818
- return (o) => r.format(o);
819
- })
820
- };
821
- }
822
- add(e, t) {
823
- this.formats[e.toLowerCase().trim()] = t;
824
- }
825
- addCached(e, t) {
826
- this.formats[e.toLowerCase().trim()] = Se(t);
827
- }
828
- format(e, t, s, i = {}) {
829
- const n = t.split(this.formatSeparator);
830
- if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((o) => o.indexOf(")") > -1)) {
831
- const o = n.findIndex((u) => u.indexOf(")") > -1);
832
- n[0] = [n[0], ...n.splice(1, o)].join(this.formatSeparator);
833
- }
834
- return n.reduce((o, u) => {
835
- var f;
836
- const {
837
- formatName: l,
838
- formatOptions: h
839
- } = Je(u);
840
- if (this.formats[l]) {
841
- let g = o;
842
- try {
843
- const p = ((f = i == null ? void 0 : i.formatParams) == null ? void 0 : f[i.interpolationkey]) || {}, c = p.locale || p.lng || i.locale || i.lng || s;
844
- g = this.formats[l](o, c, d(d(d({}, h), i), p));
845
- } catch (p) {
846
- this.logger.warn(p);
847
- }
848
- return g;
849
- } else
850
- this.logger.warn(`there was no format function for ${l}`);
851
- return o;
852
- }, e);
853
- }
854
- }
855
- const Ye = (a, e) => {
856
- a.pending[e] !== void 0 && (delete a.pending[e], a.pendingCount--);
857
- };
858
- class Ge extends Q {
859
- constructor(e, t, s, i = {}) {
860
- var n, r;
861
- super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = i, this.logger = k.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], (r = (n = this.backend) == null ? void 0 : n.init) == null || r.call(n, s, i.backend, i);
862
- }
863
- queueLoad(e, t, s, i) {
864
- const n = {}, r = {}, o = {}, u = {};
865
- return e.forEach((l) => {
866
- let h = !0;
867
- t.forEach((f) => {
868
- const g = `${l}|${f}`;
869
- !s.reload && this.store.hasResourceBundle(l, f) ? this.state[g] = 2 : this.state[g] < 0 || (this.state[g] === 1 ? r[g] === void 0 && (r[g] = !0) : (this.state[g] = 1, h = !1, r[g] === void 0 && (r[g] = !0), n[g] === void 0 && (n[g] = !0), u[f] === void 0 && (u[f] = !0)));
870
- }), h || (o[l] = !0);
871
- }), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
872
- pending: r,
873
- pendingCount: Object.keys(r).length,
874
- loaded: {},
875
- errors: [],
876
- callback: i
877
- }), {
878
- toLoad: Object.keys(n),
879
- pending: Object.keys(r),
880
- toLoadLanguages: Object.keys(o),
881
- toLoadNamespaces: Object.keys(u)
882
- };
883
- }
884
- loaded(e, t, s) {
885
- const i = e.split("|"), n = i[0], r = i[1];
886
- t && this.emit("failedLoading", n, r, t), !t && s && this.store.addResourceBundle(n, r, s, void 0, void 0, {
887
- skipCopy: !0
888
- }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
889
- const o = {};
890
- this.queue.forEach((u) => {
891
- Te(u.loaded, [n], r), Ye(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((l) => {
892
- o[l] || (o[l] = {});
893
- const h = u.loaded[l];
894
- h.length && h.forEach((f) => {
895
- o[l][f] === void 0 && (o[l][f] = !0);
896
- });
897
- }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
898
- }), this.emit("loaded", o), this.queue = this.queue.filter((u) => !u.done);
899
- }
900
- read(e, t, s, i = 0, n = this.retryTimeout, r) {
901
- if (!e.length) return r(null, {});
902
- if (this.readingCalls >= this.maxParallelReads) {
903
- this.waitingReads.push({
904
- lng: e,
905
- ns: t,
906
- fcName: s,
907
- tried: i,
908
- wait: n,
909
- callback: r
910
- });
911
- return;
912
- }
913
- this.readingCalls++;
914
- const o = (l, h) => {
915
- if (this.readingCalls--, this.waitingReads.length > 0) {
916
- const f = this.waitingReads.shift();
917
- this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
918
- }
919
- if (l && h && i < this.maxRetries) {
920
- setTimeout(() => {
921
- this.read.call(this, e, t, s, i + 1, n * 2, r);
922
- }, n);
923
- return;
924
- }
925
- r(l, h);
926
- }, u = this.backend[s].bind(this.backend);
927
- if (u.length === 2) {
928
- try {
929
- const l = u(e, t);
930
- l && typeof l.then == "function" ? l.then((h) => o(null, h)).catch(o) : o(null, l);
931
- } catch (l) {
932
- o(l);
933
- }
934
- return;
935
- }
936
- return u(e, t, o);
937
- }
938
- prepareLoading(e, t, s = {}, i) {
939
- if (!this.backend)
940
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
941
- m(e) && (e = this.languageUtils.toResolveHierarchy(e)), m(t) && (t = [t]);
942
- const n = this.queueLoad(e, t, s, i);
943
- if (!n.toLoad.length)
944
- return n.pending.length || i(), null;
945
- n.toLoad.forEach((r) => {
946
- this.loadOne(r);
947
- });
948
- }
949
- load(e, t, s) {
950
- this.prepareLoading(e, t, {}, s);
951
- }
952
- reload(e, t, s) {
953
- this.prepareLoading(e, t, {
954
- reload: !0
955
- }, s);
956
- }
957
- loadOne(e, t = "") {
958
- const s = e.split("|"), i = s[0], n = s[1];
959
- this.read(i, n, "read", void 0, void 0, (r, o) => {
960
- r && this.logger.warn(`${t}loading namespace ${n} for language ${i} failed`, r), !r && o && this.logger.log(`${t}loaded namespace ${n} for language ${i}`, o), this.loaded(e, r, o);
961
- });
962
- }
963
- saveMissing(e, t, s, i, n, r = {}, o = () => {
964
- }) {
965
- var u, l, h, f, g;
966
- if ((l = (u = this.services) == null ? void 0 : u.utils) != null && l.hasLoadedNamespace && !((f = (h = this.services) == null ? void 0 : h.utils) != null && f.hasLoadedNamespace(t))) {
967
- this.logger.warn(`did not save key "${s}" as the namespace "${t}" 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!!!");
968
- return;
969
- }
970
- if (!(s == null || s === "")) {
971
- if ((g = this.backend) != null && g.create) {
972
- const p = b(d({}, r), {
973
- isUpdate: n
974
- }), c = this.backend.create.bind(this.backend);
975
- if (c.length < 6)
976
- try {
977
- let x;
978
- c.length === 5 ? x = c(e, t, s, i, p) : x = c(e, t, s, i), x && typeof x.then == "function" ? x.then((y) => o(null, y)).catch(o) : o(null, x);
979
- } catch (x) {
980
- o(x);
981
- }
982
- else
983
- c(e, t, s, i, o, p);
984
- }
985
- !e || !e[0] || this.store.addResource(e[0], t, s, i);
986
- }
987
- }
988
- }
989
- const q = () => ({
990
- debug: !1,
991
- initAsync: !0,
992
- ns: ["translation"],
993
- defaultNS: ["translation"],
994
- fallbackLng: ["dev"],
995
- fallbackNS: !1,
996
- supportedLngs: !1,
997
- nonExplicitSupportedLngs: !1,
998
- load: "all",
999
- preload: !1,
1000
- simplifyPluralSuffix: !0,
1001
- keySeparator: ".",
1002
- nsSeparator: ":",
1003
- pluralSeparator: "_",
1004
- contextSeparator: "_",
1005
- partialBundledLanguages: !1,
1006
- saveMissing: !1,
1007
- updateMissing: !1,
1008
- saveMissingTo: "fallback",
1009
- saveMissingPlurals: !0,
1010
- missingKeyHandler: !1,
1011
- missingInterpolationHandler: !1,
1012
- postProcess: !1,
1013
- postProcessPassResolved: !1,
1014
- returnNull: !1,
1015
- returnEmptyString: !0,
1016
- returnObjects: !1,
1017
- joinArrays: !1,
1018
- returnedObjectHandler: !1,
1019
- parseMissingKeyHandler: !1,
1020
- appendNamespaceToMissingKey: !1,
1021
- appendNamespaceToCIMode: !1,
1022
- overloadTranslationOptionHandler: (a) => {
1023
- let e = {};
1024
- if (typeof a[1] == "object" && (e = a[1]), m(a[1]) && (e.defaultValue = a[1]), m(a[2]) && (e.tDescription = a[2]), typeof a[2] == "object" || typeof a[3] == "object") {
1025
- const t = a[3] || a[2];
1026
- Object.keys(t).forEach((s) => {
1027
- e[s] = t[s];
1028
- });
1029
- }
1030
- return e;
1031
- },
1032
- interpolation: {
1033
- escapeValue: !0,
1034
- format: (a) => a,
1035
- prefix: "{{",
1036
- suffix: "}}",
1037
- formatSeparator: ",",
1038
- unescapePrefix: "-",
1039
- nestingPrefix: "$t(",
1040
- nestingSuffix: ")",
1041
- nestingOptionsSeparator: ",",
1042
- maxReplaces: 1e3,
1043
- skipOnVariables: !0
1044
- },
1045
- cacheInBuiltFormats: !0
1046
- }), Oe = (a) => {
1047
- var e, t;
1048
- return m(a.ns) && (a.ns = [a.ns]), m(a.fallbackLng) && (a.fallbackLng = [a.fallbackLng]), m(a.fallbackNS) && (a.fallbackNS = [a.fallbackNS]), ((t = (e = a.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (a.supportedLngs = a.supportedLngs.concat(["cimode"])), typeof a.initImmediate == "boolean" && (a.initAsync = a.initImmediate), a;
1049
- }, _ = () => {
1050
- }, Qe = (a) => {
1051
- Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach((t) => {
1052
- typeof a[t] == "function" && (a[t] = a[t].bind(a));
1053
- });
1054
- }, Ce = "__i18next_supportNoticeShown", Ze = () => typeof globalThis != "undefined" && !!globalThis[Ce], Xe = () => {
1055
- typeof globalThis != "undefined" && (globalThis[Ce] = !0);
1056
- }, qe = (a) => {
1057
- var e, t, s, i, n, r, o, u, l, h, f, g, p;
1058
- return !!(((s = (t = (e = a == null ? void 0 : a.modules) == null ? void 0 : e.backend) == null ? void 0 : t.name) == null ? void 0 : s.indexOf("Locize")) > 0 || ((o = (r = (n = (i = a == null ? void 0 : a.modules) == null ? void 0 : i.backend) == null ? void 0 : n.constructor) == null ? void 0 : r.name) == null ? void 0 : o.indexOf("Locize")) > 0 || (l = (u = a == null ? void 0 : a.options) == null ? void 0 : u.backend) != null && l.backends && a.options.backend.backends.some((c) => {
1059
- var x, y, S;
1060
- return ((x = c == null ? void 0 : c.name) == null ? void 0 : x.indexOf("Locize")) > 0 || ((S = (y = c == null ? void 0 : c.constructor) == null ? void 0 : y.name) == null ? void 0 : S.indexOf("Locize")) > 0;
1061
- }) || (f = (h = a == null ? void 0 : a.options) == null ? void 0 : h.backend) != null && f.projectId || (p = (g = a == null ? void 0 : a.options) == null ? void 0 : g.backend) != null && p.backendOptions && a.options.backend.backendOptions.some((c) => c == null ? void 0 : c.projectId));
1062
- };
1063
- class M extends Q {
1064
- constructor(e = {}, t) {
1065
- if (super(), this.options = Oe(e), this.services = {}, this.logger = k, this.modules = {
1066
- external: []
1067
- }, Qe(this), t && !this.isInitialized && !e.isClone) {
1068
- if (!this.options.initAsync)
1069
- return this.init(e, t), this;
1070
- setTimeout(() => {
1071
- this.init(e, t);
1072
- }, 0);
1073
- }
1074
- }
1075
- init(e = {}, t) {
1076
- this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (m(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1077
- const s = q();
1078
- this.options = d(d(d({}, s), this.options), Oe(e)), this.options.interpolation = d(d({}, s.interpolation), this.options.interpolation), e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = s.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !qe(this) && !Ze() && (typeof console != "undefined" && typeof console.info != "undefined" && console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), Xe());
1079
- const i = (l) => l ? typeof l == "function" ? new l() : l : null;
1080
- if (!this.options.isClone) {
1081
- this.modules.logger ? k.init(i(this.modules.logger), this.options) : k.init(null, this.options);
1082
- let l;
1083
- this.modules.formatter ? l = this.modules.formatter : l = We;
1084
- const h = new pe(this.options);
1085
- this.store = new ce(this.options.resources, this.options);
1086
- const f = this.services;
1087
- f.logger = k, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Be(h, {
1088
- prepend: this.options.pluralSeparator,
1089
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1090
- }), this.options.interpolation.format && this.options.interpolation.format !== s.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), l && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (f.formatter = i(l), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new ye(this.options), f.utils = {
1091
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1092
- }, f.backendConnector = new Ge(i(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (p, ...c) => {
1093
- this.emit(p, ...c);
1094
- }), this.modules.languageDetector && (f.languageDetector = i(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = i(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new G(this.services, this.options), this.translator.on("*", (p, ...c) => {
1095
- this.emit(p, ...c);
1096
- }), this.modules.external.forEach((p) => {
1097
- p.init && p.init(this);
1098
- });
1099
- }
1100
- if (this.format = this.options.interpolation.format, t || (t = _), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1101
- const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1102
- l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
1103
- }
1104
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((l) => {
1105
- this[l] = (...h) => this.store[l](...h);
1106
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((l) => {
1107
- this[l] = (...h) => (this.store[l](...h), this);
1108
- });
1109
- const o = U(), u = () => {
1110
- const l = (h, f) => {
1111
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(f), t(h, f);
1112
- };
1113
- if (this.languages && !this.isInitialized) return l(null, this.t.bind(this));
1114
- this.changeLanguage(this.options.lng, l);
1115
- };
1116
- return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), o;
1117
- }
1118
- loadResources(e, t = _) {
1119
- var n, r;
1120
- let s = t;
1121
- const i = m(e) ? e : this.language;
1122
- if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1123
- if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1124
- const o = [], u = (l) => {
1125
- if (!l || l === "cimode") return;
1126
- this.services.languageUtils.toResolveHierarchy(l).forEach((f) => {
1127
- f !== "cimode" && o.indexOf(f) < 0 && o.push(f);
1128
- });
1129
- };
1130
- i ? u(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((h) => u(h)), (r = (n = this.options.preload) == null ? void 0 : n.forEach) == null || r.call(n, (l) => u(l)), this.services.backendConnector.load(o, this.options.ns, (l) => {
1131
- !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(l);
1132
- });
1133
- } else
1134
- s(null);
1135
- }
1136
- reloadResources(e, t, s) {
1137
- const i = U();
1138
- return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = _), this.services.backendConnector.reload(e, t, (n) => {
1139
- i.resolve(), s(n);
1140
- }), i;
1141
- }
1142
- use(e) {
1143
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1144
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1145
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && Le.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1146
- }
1147
- setResolvedLanguage(e) {
1148
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1149
- for (let t = 0; t < this.languages.length; t++) {
1150
- const s = this.languages[t];
1151
- if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1152
- this.resolvedLanguage = s;
1153
- break;
1154
- }
1155
- }
1156
- !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1157
- }
1158
- }
1159
- changeLanguage(e, t) {
1160
- this.isLanguageChangingTo = e;
1161
- const s = U();
1162
- this.emit("languageChanging", e);
1163
- const i = (o) => {
1164
- this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
1165
- }, n = (o, u) => {
1166
- u ? this.isLanguageChangingTo === e && (i(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, s.resolve((...l) => this.t(...l)), t && t(o, (...l) => this.t(...l));
1167
- }, r = (o) => {
1168
- var h, f;
1169
- !e && !o && this.services.languageDetector && (o = []);
1170
- const u = m(o) ? o : o && o[0], l = this.store.hasLanguageSomeTranslations(u) ? u : this.services.languageUtils.getBestMatchFromCodes(m(o) ? [o] : o);
1171
- l && (this.language || i(l), this.translator.language || this.translator.changeLanguage(l), (f = (h = this.services.languageDetector) == null ? void 0 : h.cacheUserLanguage) == null || f.call(h, l)), this.loadResources(l, (g) => {
1172
- n(g, l);
1173
- });
1174
- };
1175
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e), s;
1176
- }
1177
- getFixedT(e, t, s) {
1178
- const i = (n, r, ...o) => {
1179
- let u;
1180
- typeof r != "object" ? u = this.options.overloadTranslationOptionHandler([n, r].concat(o)) : u = d({}, r), u.lng = u.lng || i.lng, u.lngs = u.lngs || i.lngs, u.ns = u.ns || i.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || s || i.keyPrefix);
1181
- const l = this.options.keySeparator || ".";
1182
- let h;
1183
- return u.keyPrefix && Array.isArray(n) ? h = n.map((f) => (typeof f == "function" && (f = te(f, d(d({}, this.options), r))), `${u.keyPrefix}${l}${f}`)) : (typeof n == "function" && (n = te(n, d(d({}, this.options), r))), h = u.keyPrefix ? `${u.keyPrefix}${l}${n}` : n), this.t(h, u);
1184
- };
1185
- return m(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = s, i;
1186
- }
1187
- t(...e) {
1188
- var t;
1189
- return (t = this.translator) == null ? void 0 : t.translate(...e);
1190
- }
1191
- exists(...e) {
1192
- var t;
1193
- return (t = this.translator) == null ? void 0 : t.exists(...e);
1194
- }
1195
- setDefaultNamespace(e) {
1196
- this.options.defaultNS = e;
1197
- }
1198
- hasLoadedNamespace(e, t = {}) {
1199
- if (!this.isInitialized)
1200
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1201
- if (!this.languages || !this.languages.length)
1202
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1203
- const s = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
1204
- if (s.toLowerCase() === "cimode") return !0;
1205
- const r = (o, u) => {
1206
- const l = this.services.backendConnector.state[`${o}|${u}`];
1207
- return l === -1 || l === 0 || l === 2;
1208
- };
1209
- if (t.precheck) {
1210
- const o = t.precheck(this, r);
1211
- if (o !== void 0) return o;
1212
- }
1213
- return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(s, e) && (!i || r(n, e)));
1214
- }
1215
- loadNamespaces(e, t) {
1216
- const s = U();
1217
- return this.options.ns ? (m(e) && (e = [e]), e.forEach((i) => {
1218
- this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
1219
- }), this.loadResources((i) => {
1220
- s.resolve(), t && t(i);
1221
- }), s) : (t && t(), Promise.resolve());
1222
- }
1223
- loadLanguages(e, t) {
1224
- const s = U();
1225
- m(e) && (e = [e]);
1226
- const i = this.options.preload || [], n = e.filter((r) => i.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
1227
- return n.length ? (this.options.preload = i.concat(n), this.loadResources((r) => {
1228
- s.resolve(), t && t(r);
1229
- }), s) : (t && t(), Promise.resolve());
1230
- }
1231
- dir(e) {
1232
- var i, n;
1233
- if (e || (e = this.resolvedLanguage || (((i = this.languages) == null ? void 0 : i.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1234
- try {
1235
- const r = new Intl.Locale(e);
1236
- if (r && r.getTextInfo) {
1237
- const o = r.getTextInfo();
1238
- if (o && o.direction) return o.direction;
1239
- }
1240
- } catch (r) {
1241
- }
1242
- const t = ["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"], s = ((n = this.services) == null ? void 0 : n.languageUtils) || new pe(q());
1243
- return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1244
- }
1245
- static createInstance(e = {}, t) {
1246
- const s = new M(e, t);
1247
- return s.createInstance = M.createInstance, s;
1248
- }
1249
- cloneInstance(e = {}, t = _) {
1250
- const s = e.forkResourceStore;
1251
- s && delete e.forkResourceStore;
1252
- const i = b(d(d({}, this.options), e), {
1253
- isClone: !0
1254
- }), n = new M(i);
1255
- if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
1256
- n[o] = this[o];
1257
- }), n.services = d({}, this.services), n.services.utils = {
1258
- hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
1259
- }, s) {
1260
- const o = Object.keys(this.store.data).reduce((u, l) => (u[l] = d({}, this.store.data[l]), u[l] = Object.keys(u[l]).reduce((h, f) => (h[f] = d({}, u[l][f]), h), u[l]), u), {});
1261
- n.store = new ce(o, i), n.services.resourceStore = n.store;
1262
- }
1263
- if (e.interpolation) {
1264
- const o = q(), u = d(d(d({}, o.interpolation), this.options.interpolation), e.interpolation), l = b(d({}, i), {
1265
- interpolation: u
1266
- });
1267
- n.services.interpolator = new ye(l);
1268
- }
1269
- return n.translator = new G(n.services, i), n.translator.on("*", (o, ...u) => {
1270
- n.emit(o, ...u);
1271
- }), n.init(i, t), n.translator.options = i, n.translator.backendConnector.services.utils = {
1272
- hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
1273
- }, n;
1274
- }
1275
- toJSON() {
1276
- return {
1277
- options: this.options,
1278
- store: this.store,
1279
- language: this.language,
1280
- languages: this.languages,
1281
- resolvedLanguage: this.resolvedLanguage
1282
- };
1283
- }
1284
- }
1285
- const w = M.createInstance();
1286
- w.createInstance;
1287
- w.dir;
1288
- w.init;
1289
- w.loadResources;
1290
- w.reloadResources;
1291
- w.use;
1292
- w.changeLanguage;
1293
- w.getFixedT;
1294
- w.t;
1295
- w.exists;
1296
- w.setDefaultNamespace;
1297
- w.hasLoadedNamespace;
1298
- w.loadNamespaces;
1299
- w.loadLanguages;
1300
- export {
1301
- w as default,
1302
- te as keyFromSelector
1303
- };