@generaltranslation/react-core 2.0.0-odysseus.0 → 11.0.0-odysseus.10

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 (482) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  3. package/dist/components/branches/Branch.cjs +2 -0
  4. package/dist/components/branches/Branch.cjs.map +1 -0
  5. package/dist/components/branches/Branch.d.ts +30 -0
  6. package/dist/components/branches/Branch.d.ts.map +1 -0
  7. package/dist/components/branches/Branch.mjs +2 -0
  8. package/dist/components/branches/Branch.mjs.map +1 -0
  9. package/dist/components/branches/Plural.cjs +2 -0
  10. package/dist/components/branches/Plural.cjs.map +1 -0
  11. package/dist/components/branches/Plural.d.ts +19 -0
  12. package/dist/components/branches/Plural.d.ts.map +1 -0
  13. package/dist/components/branches/Plural.mjs +2 -0
  14. package/dist/components/branches/Plural.mjs.map +1 -0
  15. package/dist/components/branches/Plural.rsc.cjs +2 -0
  16. package/dist/components/branches/Plural.rsc.cjs.map +1 -0
  17. package/dist/components/branches/Plural.rsc.d.ts +15 -0
  18. package/dist/components/branches/Plural.rsc.d.ts.map +1 -0
  19. package/dist/components/branches/Plural.rsc.mjs +2 -0
  20. package/dist/components/branches/Plural.rsc.mjs.map +1 -0
  21. package/dist/components/branches/Plural.shared.cjs +2 -0
  22. package/dist/components/branches/Plural.shared.cjs.map +1 -0
  23. package/dist/components/branches/Plural.shared.d.ts +18 -0
  24. package/dist/components/branches/Plural.shared.d.ts.map +1 -0
  25. package/dist/components/branches/Plural.shared.mjs +2 -0
  26. package/dist/components/branches/Plural.shared.mjs.map +1 -0
  27. package/dist/components/derivation/Derive.cjs +2 -0
  28. package/dist/components/derivation/Derive.cjs.map +1 -0
  29. package/dist/components/derivation/Derive.d.ts +19 -0
  30. package/dist/components/derivation/Derive.d.ts.map +1 -0
  31. package/dist/components/derivation/Derive.mjs +2 -0
  32. package/dist/components/derivation/Derive.mjs.map +1 -0
  33. package/dist/components/helpers/InternalLocaleSelector.cjs +2 -0
  34. package/dist/components/helpers/InternalLocaleSelector.cjs.map +1 -0
  35. package/dist/components/helpers/InternalLocaleSelector.d.ts +38 -0
  36. package/dist/components/helpers/InternalLocaleSelector.d.ts.map +1 -0
  37. package/dist/components/helpers/InternalLocaleSelector.mjs +2 -0
  38. package/dist/components/helpers/InternalLocaleSelector.mjs.map +1 -0
  39. package/dist/components/helpers/InternalRegionSelector.cjs +2 -0
  40. package/dist/components/helpers/InternalRegionSelector.cjs.map +1 -0
  41. package/dist/components/helpers/InternalRegionSelector.d.ts +33 -0
  42. package/dist/components/helpers/InternalRegionSelector.d.ts.map +1 -0
  43. package/dist/components/helpers/InternalRegionSelector.mjs +2 -0
  44. package/dist/components/helpers/InternalRegionSelector.mjs.map +1 -0
  45. package/dist/components/translation/T.cjs +2 -0
  46. package/dist/components/translation/T.cjs.map +1 -0
  47. package/dist/components/translation/T.d.ts +18 -0
  48. package/dist/components/translation/T.d.ts.map +1 -0
  49. package/dist/components/translation/T.mjs +2 -0
  50. package/dist/components/translation/T.mjs.map +1 -0
  51. package/dist/components/translation/T.rsc.cjs +2 -0
  52. package/dist/components/translation/T.rsc.cjs.map +1 -0
  53. package/dist/components/translation/T.rsc.d.ts +17 -0
  54. package/dist/components/translation/T.rsc.d.ts.map +1 -0
  55. package/dist/components/translation/T.rsc.mjs +2 -0
  56. package/dist/components/translation/T.rsc.mjs.map +1 -0
  57. package/dist/components/translation/Tx.rsc.cjs +2 -0
  58. package/dist/components/translation/Tx.rsc.cjs.map +1 -0
  59. package/dist/components/translation/Tx.rsc.d.ts +17 -0
  60. package/dist/components/translation/Tx.rsc.d.ts.map +1 -0
  61. package/dist/components/translation/Tx.rsc.mjs +2 -0
  62. package/dist/components/translation/Tx.rsc.mjs.map +1 -0
  63. package/dist/components/variables/Currency.cjs +2 -0
  64. package/dist/components/variables/Currency.cjs.map +1 -0
  65. package/dist/components/variables/Currency.d.ts +18 -0
  66. package/dist/components/variables/Currency.d.ts.map +1 -0
  67. package/dist/components/variables/Currency.mjs +2 -0
  68. package/dist/components/variables/Currency.mjs.map +1 -0
  69. package/dist/components/variables/Currency.rsc.cjs +2 -0
  70. package/dist/components/variables/Currency.rsc.cjs.map +1 -0
  71. package/dist/components/variables/Currency.rsc.d.ts +14 -0
  72. package/dist/components/variables/Currency.rsc.d.ts.map +1 -0
  73. package/dist/components/variables/Currency.rsc.mjs +2 -0
  74. package/dist/components/variables/Currency.rsc.mjs.map +1 -0
  75. package/dist/components/variables/Currency.shared.cjs +2 -0
  76. package/dist/components/variables/Currency.shared.cjs.map +1 -0
  77. package/dist/components/variables/Currency.shared.d.ts +17 -0
  78. package/dist/components/variables/Currency.shared.d.ts.map +1 -0
  79. package/dist/components/variables/Currency.shared.mjs +2 -0
  80. package/dist/components/variables/Currency.shared.mjs.map +1 -0
  81. package/dist/components/variables/DateTime.cjs +2 -0
  82. package/dist/components/variables/DateTime.cjs.map +1 -0
  83. package/dist/components/variables/DateTime.d.ts +18 -0
  84. package/dist/components/variables/DateTime.d.ts.map +1 -0
  85. package/dist/components/variables/DateTime.mjs +2 -0
  86. package/dist/components/variables/DateTime.mjs.map +1 -0
  87. package/dist/components/variables/DateTime.rsc.cjs +2 -0
  88. package/dist/components/variables/DateTime.rsc.cjs.map +1 -0
  89. package/dist/components/variables/DateTime.rsc.d.ts +14 -0
  90. package/dist/components/variables/DateTime.rsc.d.ts.map +1 -0
  91. package/dist/components/variables/DateTime.rsc.mjs +2 -0
  92. package/dist/components/variables/DateTime.rsc.mjs.map +1 -0
  93. package/dist/components/variables/DateTime.shared.cjs +2 -0
  94. package/dist/components/variables/DateTime.shared.cjs.map +1 -0
  95. package/dist/components/variables/DateTime.shared.d.ts +16 -0
  96. package/dist/components/variables/DateTime.shared.d.ts.map +1 -0
  97. package/dist/components/variables/DateTime.shared.mjs +2 -0
  98. package/dist/components/variables/DateTime.shared.mjs.map +1 -0
  99. package/dist/components/variables/Num.cjs +2 -0
  100. package/dist/components/variables/Num.cjs.map +1 -0
  101. package/dist/components/variables/Num.d.ts +18 -0
  102. package/dist/components/variables/Num.d.ts.map +1 -0
  103. package/dist/components/variables/Num.mjs +2 -0
  104. package/dist/components/variables/Num.mjs.map +1 -0
  105. package/dist/components/variables/Num.rsc.cjs +2 -0
  106. package/dist/components/variables/Num.rsc.cjs.map +1 -0
  107. package/dist/components/variables/Num.rsc.d.ts +14 -0
  108. package/dist/components/variables/Num.rsc.d.ts.map +1 -0
  109. package/dist/components/variables/Num.rsc.mjs +2 -0
  110. package/dist/components/variables/Num.rsc.mjs.map +1 -0
  111. package/dist/components/variables/Num.shared.cjs +2 -0
  112. package/dist/components/variables/Num.shared.cjs.map +1 -0
  113. package/dist/components/variables/Num.shared.d.ts +16 -0
  114. package/dist/components/variables/Num.shared.d.ts.map +1 -0
  115. package/dist/components/variables/Num.shared.mjs +2 -0
  116. package/dist/components/variables/Num.shared.mjs.map +1 -0
  117. package/dist/components/variables/RelativeTime.cjs +2 -0
  118. package/dist/components/variables/RelativeTime.cjs.map +1 -0
  119. package/dist/components/variables/RelativeTime.d.ts +18 -0
  120. package/dist/components/variables/RelativeTime.d.ts.map +1 -0
  121. package/dist/components/variables/RelativeTime.mjs +2 -0
  122. package/dist/components/variables/RelativeTime.mjs.map +1 -0
  123. package/dist/components/variables/RelativeTime.rsc.cjs +2 -0
  124. package/dist/components/variables/RelativeTime.rsc.cjs.map +1 -0
  125. package/dist/components/variables/RelativeTime.rsc.d.ts +14 -0
  126. package/dist/components/variables/RelativeTime.rsc.d.ts.map +1 -0
  127. package/dist/components/variables/RelativeTime.rsc.mjs +2 -0
  128. package/dist/components/variables/RelativeTime.rsc.mjs.map +1 -0
  129. package/dist/components/variables/RelativeTime.shared.cjs +2 -0
  130. package/dist/components/variables/RelativeTime.shared.cjs.map +1 -0
  131. package/dist/components/variables/RelativeTime.shared.d.ts +20 -0
  132. package/dist/components/variables/RelativeTime.shared.d.ts.map +1 -0
  133. package/dist/components/variables/RelativeTime.shared.mjs +2 -0
  134. package/dist/components/variables/RelativeTime.shared.mjs.map +1 -0
  135. package/dist/components/variables/Var.cjs +2 -0
  136. package/dist/components/variables/Var.cjs.map +1 -0
  137. package/dist/components/variables/Var.d.ts +27 -0
  138. package/dist/components/variables/Var.d.ts.map +1 -0
  139. package/dist/components/variables/Var.mjs +2 -0
  140. package/dist/components/variables/Var.mjs.map +1 -0
  141. package/dist/components-rsc.cjs +1 -0
  142. package/dist/components-rsc.d.ts +32 -531
  143. package/dist/components-rsc.mjs +1 -0
  144. package/dist/components.cjs +1 -0
  145. package/dist/components.d.ts +14 -495
  146. package/dist/components.mjs +1 -0
  147. package/dist/condition-store/singleton-operations.cjs +2 -0
  148. package/dist/condition-store/singleton-operations.cjs.map +1 -0
  149. package/dist/condition-store/singleton-operations.d.ts +12 -0
  150. package/dist/condition-store/singleton-operations.d.ts.map +1 -0
  151. package/dist/condition-store/singleton-operations.mjs +2 -0
  152. package/dist/condition-store/singleton-operations.mjs.map +1 -0
  153. package/dist/context/InternalGTProvider.cjs +2 -0
  154. package/dist/context/InternalGTProvider.cjs.map +1 -0
  155. package/dist/context/InternalGTProvider.d.ts +39 -0
  156. package/dist/context/InternalGTProvider.d.ts.map +1 -0
  157. package/dist/context/InternalGTProvider.mjs +2 -0
  158. package/dist/context/InternalGTProvider.mjs.map +1 -0
  159. package/dist/context/context.cjs +2 -0
  160. package/dist/context/context.cjs.map +1 -0
  161. package/dist/context/context.mjs +2 -0
  162. package/dist/context/context.mjs.map +1 -0
  163. package/dist/cookies.cjs +1 -0
  164. package/dist/cookies.d.ts +2 -0
  165. package/dist/cookies.mjs +1 -0
  166. package/dist/functions/helpers/getTranslationsSnapshot.cjs +2 -0
  167. package/dist/functions/helpers/getTranslationsSnapshot.cjs.map +1 -0
  168. package/dist/functions/helpers/getTranslationsSnapshot.d.ts +14 -0
  169. package/dist/functions/helpers/getTranslationsSnapshot.d.ts.map +1 -0
  170. package/dist/functions/helpers/getTranslationsSnapshot.mjs +2 -0
  171. package/dist/functions/helpers/getTranslationsSnapshot.mjs.map +1 -0
  172. package/dist/functions/translation/t.cjs +2 -0
  173. package/dist/functions/translation/t.cjs.map +1 -0
  174. package/dist/functions/translation/t.d.ts +34 -0
  175. package/dist/functions/translation/t.d.ts.map +1 -0
  176. package/dist/functions/translation/t.mjs +2 -0
  177. package/dist/functions/translation/t.mjs.map +1 -0
  178. package/dist/hooks/condition-store.cjs +2 -0
  179. package/dist/hooks/condition-store.cjs.map +1 -0
  180. package/dist/hooks/condition-store.d.ts +23 -0
  181. package/dist/hooks/condition-store.d.ts.map +1 -0
  182. package/dist/hooks/condition-store.mjs +2 -0
  183. package/dist/hooks/condition-store.mjs.map +1 -0
  184. package/dist/hooks/external-store/useTrackedDictionaryObjResolver.cjs +2 -0
  185. package/dist/hooks/external-store/useTrackedDictionaryObjResolver.cjs.map +1 -0
  186. package/dist/hooks/external-store/useTrackedDictionaryObjResolver.mjs +2 -0
  187. package/dist/hooks/external-store/useTrackedDictionaryObjResolver.mjs.map +1 -0
  188. package/dist/hooks/external-store/useTrackedDictionaryResolver.cjs +2 -0
  189. package/dist/hooks/external-store/useTrackedDictionaryResolver.cjs.map +1 -0
  190. package/dist/hooks/external-store/useTrackedDictionaryResolver.mjs +2 -0
  191. package/dist/hooks/external-store/useTrackedDictionaryResolver.mjs.map +1 -0
  192. package/dist/hooks/external-store/useTrackedTranslationResolver.cjs +2 -0
  193. package/dist/hooks/external-store/useTrackedTranslationResolver.cjs.map +1 -0
  194. package/dist/hooks/external-store/useTrackedTranslationResolver.d.ts +10 -0
  195. package/dist/hooks/external-store/useTrackedTranslationResolver.d.ts.map +1 -0
  196. package/dist/hooks/external-store/useTrackedTranslationResolver.mjs +2 -0
  197. package/dist/hooks/external-store/useTrackedTranslationResolver.mjs.map +1 -0
  198. package/dist/hooks/external-store.cjs +2 -0
  199. package/dist/hooks/external-store.cjs.map +1 -0
  200. package/dist/hooks/external-store.mjs +2 -0
  201. package/dist/hooks/external-store.mjs.map +1 -0
  202. package/dist/hooks/i18n-config.cjs +2 -0
  203. package/dist/hooks/i18n-config.cjs.map +1 -0
  204. package/dist/hooks/i18n-config.d.ts +9 -0
  205. package/dist/hooks/i18n-config.d.ts.map +1 -0
  206. package/dist/hooks/i18n-config.mjs +2 -0
  207. package/dist/hooks/i18n-config.mjs.map +1 -0
  208. package/dist/hooks/useGT.cjs +2 -0
  209. package/dist/hooks/useGT.cjs.map +1 -0
  210. package/dist/hooks/useGT.d.ts +8 -0
  211. package/dist/hooks/useGT.d.ts.map +1 -0
  212. package/dist/hooks/useGT.mjs +2 -0
  213. package/dist/hooks/useGT.mjs.map +1 -0
  214. package/dist/hooks/useInternalLocaleSelector.cjs +2 -0
  215. package/dist/hooks/useInternalLocaleSelector.cjs.map +1 -0
  216. package/dist/hooks/useInternalLocaleSelector.d.ts +12 -0
  217. package/dist/hooks/useInternalLocaleSelector.d.ts.map +1 -0
  218. package/dist/hooks/useInternalLocaleSelector.mjs +2 -0
  219. package/dist/hooks/useInternalLocaleSelector.mjs.map +1 -0
  220. package/dist/hooks/useInternalRegionSelector.cjs +2 -0
  221. package/dist/hooks/useInternalRegionSelector.cjs.map +1 -0
  222. package/dist/hooks/useInternalRegionSelector.d.ts +42 -0
  223. package/dist/hooks/useInternalRegionSelector.d.ts.map +1 -0
  224. package/dist/hooks/useInternalRegionSelector.mjs +2 -0
  225. package/dist/hooks/useInternalRegionSelector.mjs.map +1 -0
  226. package/dist/hooks/useMessages.cjs +2 -0
  227. package/dist/hooks/useMessages.cjs.map +1 -0
  228. package/dist/hooks/useMessages.d.ts +8 -0
  229. package/dist/hooks/useMessages.d.ts.map +1 -0
  230. package/dist/hooks/useMessages.mjs +2 -0
  231. package/dist/hooks/useMessages.mjs.map +1 -0
  232. package/dist/hooks/useTranslations.cjs +2 -0
  233. package/dist/hooks/useTranslations.cjs.map +1 -0
  234. package/dist/hooks/useTranslations.d.ts +10 -0
  235. package/dist/hooks/useTranslations.d.ts.map +1 -0
  236. package/dist/hooks/useTranslations.mjs +2 -0
  237. package/dist/hooks/useTranslations.mjs.map +1 -0
  238. package/dist/hooks/utils/getFormatLocales.cjs +2 -0
  239. package/dist/hooks/utils/getFormatLocales.cjs.map +1 -0
  240. package/dist/hooks/utils/getFormatLocales.d.ts +13 -0
  241. package/dist/hooks/utils/getFormatLocales.d.ts.map +1 -0
  242. package/dist/hooks/utils/getFormatLocales.mjs +2 -0
  243. package/dist/hooks/utils/getFormatLocales.mjs.map +1 -0
  244. package/dist/hooks/utils/getShouldTranslate.cjs +2 -0
  245. package/dist/hooks/utils/getShouldTranslate.cjs.map +1 -0
  246. package/dist/hooks/utils/getShouldTranslate.d.ts +8 -0
  247. package/dist/hooks/utils/getShouldTranslate.d.ts.map +1 -0
  248. package/dist/hooks/utils/getShouldTranslate.mjs +2 -0
  249. package/dist/hooks/utils/getShouldTranslate.mjs.map +1 -0
  250. package/dist/hooks/utils/missing-translation.cjs +2 -0
  251. package/dist/hooks/utils/missing-translation.cjs.map +1 -0
  252. package/dist/hooks/utils/missing-translation.d.ts +10 -0
  253. package/dist/hooks/utils/missing-translation.d.ts.map +1 -0
  254. package/dist/hooks/utils/missing-translation.mjs +2 -0
  255. package/dist/hooks/utils/missing-translation.mjs.map +1 -0
  256. package/dist/hooks/utils.cjs +2 -0
  257. package/dist/hooks/utils.cjs.map +1 -0
  258. package/dist/hooks/utils.d.ts +14 -0
  259. package/dist/hooks/utils.d.ts.map +1 -0
  260. package/dist/hooks/utils.mjs +2 -0
  261. package/dist/hooks/utils.mjs.map +1 -0
  262. package/dist/hooks.cjs +1 -0
  263. package/dist/hooks.d.ts +9 -130
  264. package/dist/hooks.mjs +1 -0
  265. package/dist/i18n-cache/ReactI18nCache.cjs +2 -0
  266. package/dist/i18n-cache/ReactI18nCache.cjs.map +1 -0
  267. package/dist/i18n-cache/ReactI18nCache.d.ts +10 -0
  268. package/dist/i18n-cache/ReactI18nCache.d.ts.map +1 -0
  269. package/dist/i18n-cache/ReactI18nCache.mjs +2 -0
  270. package/dist/i18n-cache/ReactI18nCache.mjs.map +1 -0
  271. package/dist/i18n-cache/singleton-operations.cjs +2 -0
  272. package/dist/i18n-cache/singleton-operations.cjs.map +1 -0
  273. package/dist/i18n-cache/singleton-operations.d.ts +8 -0
  274. package/dist/i18n-cache/singleton-operations.d.ts.map +1 -0
  275. package/dist/i18n-cache/singleton-operations.mjs +2 -0
  276. package/dist/i18n-cache/singleton-operations.mjs.map +1 -0
  277. package/dist/i18n-store/I18nStore.cjs +2 -0
  278. package/dist/i18n-store/I18nStore.cjs.map +1 -0
  279. package/dist/i18n-store/I18nStore.d.ts +41 -0
  280. package/dist/i18n-store/I18nStore.d.ts.map +1 -0
  281. package/dist/i18n-store/I18nStore.mjs +2 -0
  282. package/dist/i18n-store/I18nStore.mjs.map +1 -0
  283. package/dist/i18n-store/singleton-operations.cjs +2 -0
  284. package/dist/i18n-store/singleton-operations.cjs.map +1 -0
  285. package/dist/i18n-store/singleton-operations.d.ts +9 -0
  286. package/dist/i18n-store/singleton-operations.d.ts.map +1 -0
  287. package/dist/i18n-store/singleton-operations.mjs +2 -0
  288. package/dist/i18n-store/singleton-operations.mjs.map +1 -0
  289. package/dist/i18n-store/storeTypes.d.ts +21 -0
  290. package/dist/i18n-store/storeTypes.d.ts.map +1 -0
  291. package/dist/i18n-store/useI18nStore.cjs +2 -0
  292. package/dist/i18n-store/useI18nStore.cjs.map +1 -0
  293. package/dist/i18n-store/useI18nStore.mjs +2 -0
  294. package/dist/i18n-store/useI18nStore.mjs.map +1 -0
  295. package/dist/i18n-store/utils/dictionaries.cjs +2 -0
  296. package/dist/i18n-store/utils/dictionaries.cjs.map +1 -0
  297. package/dist/i18n-store/utils/dictionaries.mjs +2 -0
  298. package/dist/i18n-store/utils/dictionaries.mjs.map +1 -0
  299. package/dist/i18n-store/utils/subscriptions.cjs +2 -0
  300. package/dist/i18n-store/utils/subscriptions.cjs.map +1 -0
  301. package/dist/i18n-store/utils/subscriptions.mjs +2 -0
  302. package/dist/i18n-store/utils/subscriptions.mjs.map +1 -0
  303. package/dist/i18n-store/utils/translations.cjs +2 -0
  304. package/dist/i18n-store/utils/translations.cjs.map +1 -0
  305. package/dist/i18n-store/utils/translations.mjs +2 -0
  306. package/dist/i18n-store/utils/translations.mjs.map +1 -0
  307. package/dist/pure.cjs +1 -0
  308. package/dist/pure.d.ts +30 -676
  309. package/dist/pure.mjs +1 -0
  310. package/dist/setup/i18nConfig.cjs +2 -0
  311. package/dist/setup/i18nConfig.cjs.map +1 -0
  312. package/dist/setup/i18nConfig.d.ts +21 -0
  313. package/dist/setup/i18nConfig.d.ts.map +1 -0
  314. package/dist/setup/i18nConfig.mjs +2 -0
  315. package/dist/setup/i18nConfig.mjs.map +1 -0
  316. package/dist/setup/initializeGTSRA.cjs +2 -0
  317. package/dist/setup/initializeGTSRA.cjs.map +1 -0
  318. package/dist/setup/initializeGTSRA.d.ts +11 -0
  319. package/dist/setup/initializeGTSRA.d.ts.map +1 -0
  320. package/dist/setup/initializeGTSRA.mjs +2 -0
  321. package/dist/setup/initializeGTSRA.mjs.map +1 -0
  322. package/dist/utils/cookies.cjs +2 -0
  323. package/dist/utils/cookies.cjs.map +1 -0
  324. package/dist/utils/cookies.d.ts +16 -0
  325. package/dist/utils/cookies.d.ts.map +1 -0
  326. package/dist/utils/cookies.mjs +2 -0
  327. package/dist/utils/cookies.mjs.map +1 -0
  328. package/dist/utils/dictionaries/flattenDictionary.cjs +2 -0
  329. package/dist/utils/dictionaries/flattenDictionary.cjs.map +1 -0
  330. package/dist/utils/dictionaries/flattenDictionary.d.ts +15 -0
  331. package/dist/utils/dictionaries/flattenDictionary.d.ts.map +1 -0
  332. package/dist/utils/dictionaries/flattenDictionary.mjs +2 -0
  333. package/dist/utils/dictionaries/flattenDictionary.mjs.map +1 -0
  334. package/dist/utils/dictionaries/getDictionaryEntry.cjs +2 -0
  335. package/dist/utils/dictionaries/getDictionaryEntry.cjs.map +1 -0
  336. package/dist/utils/dictionaries/getDictionaryEntry.d.ts +8 -0
  337. package/dist/utils/dictionaries/getDictionaryEntry.d.ts.map +1 -0
  338. package/dist/utils/dictionaries/getDictionaryEntry.mjs +2 -0
  339. package/dist/utils/dictionaries/getDictionaryEntry.mjs.map +1 -0
  340. package/dist/utils/dictionaries/getEntryAndMetadata.cjs +2 -0
  341. package/dist/utils/dictionaries/getEntryAndMetadata.cjs.map +1 -0
  342. package/dist/utils/dictionaries/getEntryAndMetadata.d.ts +10 -0
  343. package/dist/utils/dictionaries/getEntryAndMetadata.d.ts.map +1 -0
  344. package/dist/utils/dictionaries/getEntryAndMetadata.mjs +2 -0
  345. package/dist/utils/dictionaries/getEntryAndMetadata.mjs.map +1 -0
  346. package/dist/utils/dictionaries/indexDict.cjs +2 -0
  347. package/dist/utils/dictionaries/indexDict.cjs.map +1 -0
  348. package/dist/utils/dictionaries/indexDict.mjs +2 -0
  349. package/dist/utils/dictionaries/indexDict.mjs.map +1 -0
  350. package/dist/utils/dictionaries/isDictionaryEntry.cjs +2 -0
  351. package/dist/utils/dictionaries/isDictionaryEntry.cjs.map +1 -0
  352. package/dist/utils/dictionaries/isDictionaryEntry.d.ts +12 -0
  353. package/dist/utils/dictionaries/isDictionaryEntry.d.ts.map +1 -0
  354. package/dist/utils/dictionaries/isDictionaryEntry.mjs +2 -0
  355. package/dist/utils/dictionaries/isDictionaryEntry.mjs.map +1 -0
  356. package/dist/utils/dictionaries/mergeDictionaries.cjs +2 -0
  357. package/dist/utils/dictionaries/mergeDictionaries.cjs.map +1 -0
  358. package/dist/utils/dictionaries/mergeDictionaries.d.ts +7 -0
  359. package/dist/utils/dictionaries/mergeDictionaries.d.ts.map +1 -0
  360. package/dist/utils/dictionaries/mergeDictionaries.mjs +2 -0
  361. package/dist/utils/dictionaries/mergeDictionaries.mjs.map +1 -0
  362. package/dist/utils/internal/addGTIdentifier.cjs +2 -0
  363. package/dist/utils/internal/addGTIdentifier.cjs.map +1 -0
  364. package/dist/utils/internal/addGTIdentifier.d.ts +8 -0
  365. package/dist/utils/internal/addGTIdentifier.d.ts.map +1 -0
  366. package/dist/utils/internal/addGTIdentifier.mjs +2 -0
  367. package/dist/utils/internal/addGTIdentifier.mjs.map +1 -0
  368. package/dist/utils/internal/removeInjectedT.cjs +2 -0
  369. package/dist/utils/internal/removeInjectedT.cjs.map +1 -0
  370. package/dist/utils/internal/removeInjectedT.mjs +2 -0
  371. package/dist/utils/internal/removeInjectedT.mjs.map +1 -0
  372. package/dist/utils/internal/writeChildrenAsObjects.cjs +2 -0
  373. package/dist/utils/internal/writeChildrenAsObjects.cjs.map +1 -0
  374. package/dist/utils/internal/writeChildrenAsObjects.d.ts +14 -0
  375. package/dist/utils/internal/writeChildrenAsObjects.d.ts.map +1 -0
  376. package/dist/utils/internal/writeChildrenAsObjects.mjs +2 -0
  377. package/dist/utils/internal/writeChildrenAsObjects.mjs.map +1 -0
  378. package/dist/utils/plurals/getPluralBranch.cjs +2 -0
  379. package/dist/utils/plurals/getPluralBranch.cjs.map +1 -0
  380. package/dist/utils/plurals/getPluralBranch.d.ts +12 -0
  381. package/dist/utils/plurals/getPluralBranch.d.ts.map +1 -0
  382. package/dist/utils/plurals/getPluralBranch.mjs +2 -0
  383. package/dist/utils/plurals/getPluralBranch.mjs.map +1 -0
  384. package/dist/utils/rendering/createRenderPipeline.cjs +2 -0
  385. package/dist/utils/rendering/createRenderPipeline.cjs.map +1 -0
  386. package/dist/utils/rendering/createRenderPipeline.d.ts +18 -0
  387. package/dist/utils/rendering/createRenderPipeline.d.ts.map +1 -0
  388. package/dist/utils/rendering/createRenderPipeline.mjs +2 -0
  389. package/dist/utils/rendering/createRenderPipeline.mjs.map +1 -0
  390. package/dist/utils/rendering/createRenderVariable.cjs +2 -0
  391. package/dist/utils/rendering/createRenderVariable.cjs.map +1 -0
  392. package/dist/utils/rendering/createRenderVariable.d.ts +46 -0
  393. package/dist/utils/rendering/createRenderVariable.d.ts.map +1 -0
  394. package/dist/utils/rendering/createRenderVariable.mjs +2 -0
  395. package/dist/utils/rendering/createRenderVariable.mjs.map +1 -0
  396. package/dist/utils/rendering/getDefaultRenderSettings.cjs +2 -0
  397. package/dist/utils/rendering/getDefaultRenderSettings.cjs.map +1 -0
  398. package/dist/utils/rendering/getDefaultRenderSettings.d.ts +10 -0
  399. package/dist/utils/rendering/getDefaultRenderSettings.d.ts.map +1 -0
  400. package/dist/utils/rendering/getDefaultRenderSettings.mjs +2 -0
  401. package/dist/utils/rendering/getDefaultRenderSettings.mjs.map +1 -0
  402. package/dist/utils/rendering/getGTTag.cjs +2 -0
  403. package/dist/utils/rendering/getGTTag.cjs.map +1 -0
  404. package/dist/utils/rendering/getGTTag.mjs +2 -0
  405. package/dist/utils/rendering/getGTTag.mjs.map +1 -0
  406. package/dist/utils/rendering/renderDefaultChildren.shared.cjs +2 -0
  407. package/dist/utils/rendering/renderDefaultChildren.shared.cjs.map +1 -0
  408. package/dist/utils/rendering/renderDefaultChildren.shared.d.ts +12 -0
  409. package/dist/utils/rendering/renderDefaultChildren.shared.d.ts.map +1 -0
  410. package/dist/utils/rendering/renderDefaultChildren.shared.mjs +2 -0
  411. package/dist/utils/rendering/renderDefaultChildren.shared.mjs.map +1 -0
  412. package/dist/utils/rendering/renderPipeline.cjs +2 -0
  413. package/dist/utils/rendering/renderPipeline.cjs.map +1 -0
  414. package/dist/utils/rendering/renderPipeline.mjs +2 -0
  415. package/dist/utils/rendering/renderPipeline.mjs.map +1 -0
  416. package/dist/utils/rendering/renderPipeline.rsc.cjs +2 -0
  417. package/dist/utils/rendering/renderPipeline.rsc.cjs.map +1 -0
  418. package/dist/utils/rendering/renderPipeline.rsc.d.ts +11 -0
  419. package/dist/utils/rendering/renderPipeline.rsc.d.ts.map +1 -0
  420. package/dist/utils/rendering/renderPipeline.rsc.mjs +2 -0
  421. package/dist/utils/rendering/renderPipeline.rsc.mjs.map +1 -0
  422. package/dist/utils/rendering/renderPreparedT.shared.cjs +2 -0
  423. package/dist/utils/rendering/renderPreparedT.shared.cjs.map +1 -0
  424. package/dist/utils/rendering/renderPreparedT.shared.d.ts +16 -0
  425. package/dist/utils/rendering/renderPreparedT.shared.d.ts.map +1 -0
  426. package/dist/utils/rendering/renderPreparedT.shared.mjs +2 -0
  427. package/dist/utils/rendering/renderPreparedT.shared.mjs.map +1 -0
  428. package/dist/utils/rendering/renderTranslatedChildren.shared.cjs +2 -0
  429. package/dist/utils/rendering/renderTranslatedChildren.shared.cjs.map +1 -0
  430. package/dist/utils/rendering/renderTranslatedChildren.shared.d.ts +13 -0
  431. package/dist/utils/rendering/renderTranslatedChildren.shared.d.ts.map +1 -0
  432. package/dist/utils/rendering/renderTranslatedChildren.shared.mjs +2 -0
  433. package/dist/utils/rendering/renderTranslatedChildren.shared.mjs.map +1 -0
  434. package/dist/utils/translation/prepareT.shared.cjs +2 -0
  435. package/dist/utils/translation/prepareT.shared.cjs.map +1 -0
  436. package/dist/utils/translation/prepareT.shared.d.ts +40 -0
  437. package/dist/utils/translation/prepareT.shared.d.ts.map +1 -0
  438. package/dist/utils/translation/prepareT.shared.mjs +2 -0
  439. package/dist/utils/translation/prepareT.shared.mjs.map +1 -0
  440. package/dist/utils/translation/usePrepareT.cjs +2 -0
  441. package/dist/utils/translation/usePrepareT.cjs.map +1 -0
  442. package/dist/utils/translation/usePrepareT.mjs +2 -0
  443. package/dist/utils/translation/usePrepareT.mjs.map +1 -0
  444. package/dist/utils/types.d.ts +98 -0
  445. package/dist/utils/types.d.ts.map +1 -0
  446. package/dist/utils/utils.cjs +2 -0
  447. package/dist/utils/utils.cjs.map +1 -0
  448. package/dist/utils/utils.mjs +2 -0
  449. package/dist/utils/utils.mjs.map +1 -0
  450. package/dist/utils/variables/_getVariableProps.cjs +2 -0
  451. package/dist/utils/variables/_getVariableProps.cjs.map +1 -0
  452. package/dist/utils/variables/_getVariableProps.d.ts +13 -0
  453. package/dist/utils/variables/_getVariableProps.d.ts.map +1 -0
  454. package/dist/utils/variables/_getVariableProps.mjs +2 -0
  455. package/dist/utils/variables/_getVariableProps.mjs.map +1 -0
  456. package/dist/utils/variables/getVariableName.cjs +2 -0
  457. package/dist/utils/variables/getVariableName.cjs.map +1 -0
  458. package/dist/utils/variables/getVariableName.d.ts +12 -0
  459. package/dist/utils/variables/getVariableName.d.ts.map +1 -0
  460. package/dist/utils/variables/getVariableName.mjs +2 -0
  461. package/dist/utils/variables/getVariableName.mjs.map +1 -0
  462. package/package.json +24 -13
  463. package/dist/components-rsc.cjs.min.cjs +0 -2
  464. package/dist/components-rsc.cjs.min.cjs.map +0 -1
  465. package/dist/components-rsc.d.ts.map +0 -1
  466. package/dist/components-rsc.esm.min.mjs +0 -2
  467. package/dist/components-rsc.esm.min.mjs.map +0 -1
  468. package/dist/components.cjs.min.cjs +0 -2
  469. package/dist/components.cjs.min.cjs.map +0 -1
  470. package/dist/components.d.ts.map +0 -1
  471. package/dist/components.esm.min.mjs +0 -2
  472. package/dist/components.esm.min.mjs.map +0 -1
  473. package/dist/hooks.cjs.min.cjs +0 -2
  474. package/dist/hooks.cjs.min.cjs.map +0 -1
  475. package/dist/hooks.d.ts.map +0 -1
  476. package/dist/hooks.esm.min.mjs +0 -2
  477. package/dist/hooks.esm.min.mjs.map +0 -1
  478. package/dist/pure.cjs.min.cjs +0 -2
  479. package/dist/pure.cjs.min.cjs.map +0 -1
  480. package/dist/pure.d.ts.map +0 -1
  481. package/dist/pure.esm.min.mjs +0 -2
  482. package/dist/pure.esm.min.mjs.map +0 -1
@@ -1,2 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`gt-i18n/internal`),t=require(`react`),n=require(`gt-i18n`),r=require(`generaltranslation`);function i(e){let t=e.trim();return t?/[.!?)]$/.test(t)?t:`${t}.`:``}function a(e){let t=e.trim(),n=t.length;for(;n>0;){let e=t[n-1];if(e!==`.`&&e!==`!`&&e!==`?`)break;--n}return t.slice(0,n)}function o(e){return e.replace(/^[A-Z][a-z]/,e=>e.toLowerCase())}function s(e){if(!e)return``;let t=Array.isArray(e)?e.join(`, `):e;return t.trim()?i(`Details: ${t}`):``}function c(e){if(e!=null)return String(e)}function l({source:e,severity:t,whatHappened:n,reassurance:r,why:c,fix:l,wayOut:u,details:d,docsUrl:f}){let p=e?t?`${e} ${t}:`:`${e}:`:t?`${t}:`:``,m=c?`${a(n)} because ${o(a(c))}`:n,h=!!l&&!!u&&/^[a-z]/.test(a(u)),g=[m,r,h?`${a(l)}, or ${o(a(u))}`:l,h?void 0:u,s(d)].filter(e=>!!e).map(i);f&&g.push(`Learn more: ${f}`);let _=g.join(` `);return p?`${p} ${_}`:_}var u=class extends e.I18nConfig{renderStrategy;constructor(e={},t=`server-render`){super(e),f(t),this.renderStrategy=t}getRenderStrategy(){return this.renderStrategy}};function d(){let t=(0,e.getI18nConfig)();if(p(t))return t;throw Error(l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read ReactI18nConfig after base I18nConfig setup.`,why:`the internal I18nConfig singleton was initialized without react-core render strategy support`,fix:`Initialize GT through gt-react or @generaltranslation/react-core/pure.`}))}function f(e){if(!(e===`SPA`||e===`server-render`))throw Error(l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Invalid React render strategy.`,why:`the render strategy must be "SPA" or "server-render", but received "${String(e)}"`,fix:`Initialize GT through gt-react or pass a valid render strategy.`}))}function p(e){return e instanceof u}const{getConditionStore:m,setConditionStore:h,isConditionStoreInitialized:g}=(0,e.createConditionStoreSingleton)(l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read GT runtime context before it has been initialized`,why:`The internal ConditionStore is unavailable`}));function _(){try{return m()}catch(t){let n=(0,e.getRuntimeEnvironment)(),r=d().getRenderStrategy(),i=l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot access ConditionStore before it is initialized.`,details:c(t),fix:r===`SPA`?`Initialize GT before reading GT runtime context.`:`Add a <GTProvider> at the root of your component tree.`,wayOut:n===`development`?void 0:r===`SPA`?`Request-specific values will fall back to the default configuration.`:`Request-specific values will fall back to the default configuration. This may cause hydration mismatches.`});if(n===`development`)throw Error(i);return console.error(i),{getLocale:()=>`en`,getRegion:()=>void 0,getEnableI18n:()=>!0,setLocale:()=>{},setRegion:()=>{},setEnableI18n:()=>{}}}}function v(){let e=globalThis;return e.__generaltranslation??={},e.__generaltranslation.reactCore??={},e.__generaltranslation.reactCore}function ee(){let e=v();return e.gtContext??=(0,t.createContext)(void 0),e.gtContext}function y(){let e=(0,t.useContext)(ee());if(e||d().getRenderStrategy()===`SPA`)return e;throw Error(b())}function b(){return l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`GT runtime context could not be read`,why:`GTContext was accessed outside of a <GTProvider>`,fix:`Add a <GTProvider> at the root of your component tree.`})}function x(){return y()?.conditionStore??_()}function S(){return x().getLocale()}function C(){return x().getRegion()}function w(){return x().getEnableI18n()}function T(){return(0,t.useMemo)(()=>(0,e.getI18nConfig)().getCustomMapping(),[])}function E(){return(0,t.useMemo)(()=>(0,e.getI18nConfig)().getDefaultLocale(),[])}function D(){return(0,t.useMemo)(()=>(0,e.getI18nConfig)().getLocales(),[])}const O=[];function k({locale:t,enableI18n:n,localesProp:r=O}){let i=(0,e.getI18nConfig)().getDefaultLocale();return n&&(0,e.getI18nConfig)().requiresTranslation(t)?[...r,t,i]:[i]}const A=[];function j(e=A){let n=S(),r=w();return(0,t.useMemo)(()=>k({locale:n,enableI18n:r,localesProp:e}),[n,r,e])}function M(){let t=w(),n=S();return t&&(0,e.getI18nConfig)().requiresTranslation(n)}function N(){return(0,t.useMemo)(()=>(0,e.getI18nConfig)().getGTClass(),[])}function P(n){return(0,t.useMemo)(()=>(0,e.getI18nConfig)().getGTClass().getLocaleProperties(n),[n])}function F(n){return(0,t.useMemo)(()=>(0,e.getI18nConfig)().getGTClass().getLocaleDirection(n),[n])}function I(){throw Error(l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`useVersionId() is not implemented in this entry point`,fix:`Use getVersionId() or import useVersionId() from a supported runtime entry point.`}))}function L(){let e=globalThis;return e.__generaltranslation??={},e.__generaltranslation.reactCore??={},e.__generaltranslation.reactCore}function R(){let e=L().i18nStore;if(!e)throw z();return e}function z(){let e=l({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot access I18nStore before it is initialized.`,fix:d().getRenderStrategy()===`SPA`?`Initialize GT before reading GT runtime context.`:`Add a <GTProvider> at the root of your component tree.`});return Error(e)}function B(){return y()?.i18nStore||R()}function V(){return y()?.translationsSnapshot||{}}function H(){return y()?.dictionariesSnapshot||{}}function U(){let n=y()?.onMissingTranslation,r=K();return(0,t.useCallback)(t=>{n?n(t):r((0,e.getTranslateListenerKey)(t),{type:`translation`,lookup:t})},[n,r])}function W(){let n=y()?.onMissingDictionaryEntry,r=K();return(0,t.useCallback)(t=>{n?n(t):r((0,e.getDictionaryListenerKey)(t),{type:`dictionaryEntry`,lookup:t})},[n,r])}function G(){let n=y()?.onMissingDictionaryObj,r=K();return(0,t.useCallback)(t=>{n?n(t):r((0,e.getDictionaryListenerKey)(t),{type:`dictionaryObject`,lookup:t})},[n,r])}function K(){let n=(0,e.getI18nConfig)().isDevHotReloadEnabled(),r=M(),i=B(),a=new Map;return(0,t.useEffect)(()=>{!n||!r||a.size===0||a.forEach(({type:e,lookup:t})=>{switch(e){case`translation`:i.translate(t);break;case`dictionaryEntry`:i.translateDictionaryEntry(t);break;case`dictionaryObject`:i.translateDictionaryObject(t);break}})},[n,r,i,a]),(e,t)=>{a.set(e,t)}}function q(n=[]){let r=V(),i=B(),a=(0,e.getI18nConfig)().isDevHotReloadEnabled(),o=U(),s=(0,t.useRef)(null);return s.current??=new Set,Y(n,s),J(s),(0,t.useCallback)(t=>{let n=(0,e.getTranslateListenerKey)(t);a&&s.current.add(n);let c=i.getTranslateSnapshot(t,r);return c==null&&a&&o(t),c},[i,r,o,a])}function J(n){let r=(0,t.useRef)(0),i=B(),a=(0,t.useCallback)(t=>i.subscribeToTranslationEvents(i=>{let a=(0,e.getTranslateListenerKey)(i);n.current.has(a)&&(r.current++,t())}),[i]),o=(0,t.useCallback)(()=>r.current,[]);(0,t.useSyncExternalStore)(a,o,o)}function Y(n,r){let i=B(),a=S(),o=(0,e.getI18nConfig)().isDevHotReloadEnabled(),s=M(),c=V(),l=(0,t.useMemo)(()=>n?.length>0&&s&&o,[n,s,o]),u=(0,t.useMemo)(()=>l?n.map(({message:t,...n})=>{let r=n.$locale??a,i={locale:r,message:t,options:(0,e.createLookupOptions)(r,n,`ICU`)};return[i,(0,e.getTranslateListenerKey)(i)]}):[],[a,l,n]);l&&u.forEach(([,e])=>{r.current.add(e)}),(0,t.useEffect)(()=>{l&&u.filter(([e])=>i.getTranslateSnapshot(e,c)==null).forEach(([e])=>i.translate(e))},[l,i,u,c])}function X(n){let r=S(),i=E(),a=M(),o=q(n);return(0,t.useCallback)((t,n={})=>{if(!a)return(0,e.interpolateMessage)({options:n,source:t,sourceLocale:i});let s=(0,e.createLookupOptions)(n.$locale??r,n,`ICU`);return(0,e.interpolateMessage)({source:t,target:o({locale:s.$locale,message:t,options:s}),options:s,sourceLocale:i})},[i,r,a,o])}function Z(r){let i=X(r);return(0,t.useCallback)((t,r={})=>{if(t==null)return t;let a=(0,n.decodeOptions)(t)??{};return(0,e.isEncodedTranslationOptions)(a)?i(a.$_source,a):i(t,r)},[i])}function Q(){let n=H(),r=B(),i=(0,e.getI18nConfig)().isDevHotReloadEnabled(),a=W(),o=(0,t.useRef)(null);return o.current??=new Set,te(o),(0,t.useCallback)(t=>{let s=(0,e.getDictionaryListenerKey)(t);i&&o.current.add(s);let c=r.getDictionaryEntrySnapshot(t,n);return c==null&&i&&a(t),c},[r,n,i,a])}function te(n){let r=(0,t.useRef)(0),i=B(),a=(0,t.useCallback)(t=>i.subscribeToDictionaryEntryEvents(i=>{let a=(0,e.getDictionaryListenerKey)(i);n.current.has(a)&&(r.current++,t())}),[i]),o=(0,t.useCallback)(()=>r.current,[]);(0,t.useSyncExternalStore)(a,o,o)}function ne(){let n=H(),r=B(),i=(0,e.getI18nConfig)().isDevHotReloadEnabled(),a=G(),o=(0,t.useRef)(null);return o.current??=new Set,re(o),(0,t.useCallback)(t=>{let s=(0,e.getDictionaryListenerKey)(t);i&&o.current.add(s);let c=r.getDictionaryObjectSnapshot(t,n);return c==null&&i&&a(t),c},[r,n,i,a])}function re(n){let r=(0,t.useRef)(0),i=B(),a=(0,t.useCallback)(t=>i.subscribeToDictionaryObjectEvents(i=>{let a=(0,e.getDictionaryListenerKey)(i);n.current.has(a)&&(r.current++,t())}),[i]),o=(0,t.useCallback)(()=>r.current,[]);(0,t.useSyncExternalStore)(a,o,o)}function ie(n){let r=S(),i=E(),a=M(),o=X(),s=Q(),c=ae(n),l=(0,t.useCallback)((t,c={})=>{let l=$(n,t),u=s({locale:i,id:l});if(u===void 0)throw Error(`Dictionary entry ${l} cannot be found`);let d=(0,e.resolveDictionaryLookupOptions)(u.options);if(!a)return o(u.entry,{...d,...(0,e.extractVariables)(c),$locale:i});let f=s({locale:r,id:l});return f?.entry==null?o(u.entry,{...d,...(0,e.extractVariables)(c),$locale:r}):(0,e.renderDictionaryEntry)({sourceLocale:i,targetLocale:r,sourceEntry:u,target:f.entry,dictionaryOptions:d,options:c})},[i,o,n,r,s,a]);return(0,t.useMemo)(()=>Object.assign(l,{obj:c}),[l,c])}function ae(n){let r=S(),i=E(),a=M(),o=X(),s=ne();return(0,t.useCallback)(t=>{let c=$(n,t),l=s({locale:i,id:c});if(l===void 0)throw Error(`Dictionary entry ${c} cannot be found`);let u;return a&&(u=s({locale:r,id:c})),(0,e.renderDictionaryObject)({sourceObject:l,targetObject:u,translate:(e,t)=>o(e.entry,{...t,$locale:a?r:i})})},[i,n,r,s,a,o])}function $(e,t){return e?`${e}.${t}`:t}function oe(e){let n=D(),i=T(),a=S(),o=(0,t.useMemo)(()=>{if(!n||n.length===0)return[];let e=new Intl.Collator;return[...n].sort((t,n)=>e.compare((0,r.getLocaleProperties)(t,a,i).nativeNameWithRegionCode,(0,r.getLocaleProperties)(n,a,i).nativeNameWithRegionCode))},[n,a,i]),s=(0,t.useCallback)(e=>(0,r.getLocaleProperties)(e,e,i),[a,i]);return{locale:a,locales:e||o,getLocaleProperties:s}}function se({regions:n,customMapping:i,prioritizeCurrentLocaleRegion:a=!0,sortRegionsAlphabetically:o=!0}={}){let s=D(),c=T(),l=S(),u=C(),{regionCode:d}=(0,r.getLocaleProperties)(l,l,c),[f,p]=(0,t.useMemo)(()=>{let t=(0,e.getI18nConfig)().getGTClass(l),u=new Map(s.map(e=>{let t=(0,r.getLocaleProperties)(e,l,c);return[t.regionCode,t]})),f=n?[...n]:Array.from(u?.keys()||[d]),p=new Map(f.map(e=>[e,{locale:u?.get(e)?.code||l,...t.getRegionProperties(e),...typeof i?.[e]==`string`?{name:i?.[e]}:i?.[e]}]));if(o&&f.sort((e,t)=>new Intl.Collator().compare(p.get(e).name,p.get(t).name)),a){let e=f.indexOf(d);e>0&&(f.splice(e,1),f.unshift(d))}return[f,p]},[n,i,l,d,s,c,a,o]);return{region:u,regions:f,regionData:p,locale:l,localeRegion:d}}exports.useConditionStore=x,exports.useCustomMapping=T,exports.useDefaultLocale=E,exports.useEnableI18n=w,exports.useFormatLocales=j,exports.useGT=X,exports.useGTClass=N,exports.useInternalLocaleSelector=oe,exports.useInternalRegionSelector=se,exports.useLocale=S,exports.useLocaleDirection=F,exports.useLocaleProperties=P,exports.useLocales=D,exports.useMessages=Z,exports.useRegion=C,exports.useShouldTranslate=M,exports.useTranslations=ie,exports.useVersionId=I;
2
- //# sourceMappingURL=hooks.cjs.min.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.cjs.min.cjs","names":["I18nConfig","getI18nConfig","getI18nConfig","getReactCoreGlobals","getI18nConfig","EMPTY_LOCALES_PROP","getI18nConfig","useSubscribeToLookups","useSubscribeToLookups"],"sources":["../../core/dist/base64-r7YWJYWt.mjs","../src/setup/i18nConfig.ts","../src/condition-store/singleton-operations.ts","../src/context/context.ts","../src/hooks/condition-store.ts","../src/hooks/i18n-config.ts","../src/hooks/utils/getFormatLocales.ts","../src/hooks/utils.ts","../src/i18n-store/singleton-operations.ts","../src/i18n-store/useI18nStore.ts","../src/hooks/utils/missing-translation.ts","../src/hooks/external-store/useTrackedTranslationResolver.ts","../src/hooks/useGT.ts","../src/hooks/useMessages.ts","../src/hooks/external-store/useTrackedDictionaryResolver.ts","../src/hooks/external-store/useTrackedDictionaryObjResolver.ts","../src/hooks/useTranslations.ts","../src/hooks/useInternalLocaleSelector.ts","../src/hooks/useInternalRegionSelector.ts"],"sourcesContent":["//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction lowercaseFirstWord(text) {\n\treturn text.replace(/^[A-Z][a-z]/, (match) => match.toLowerCase());\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${lowercaseFirstWord(stripSentence(why))}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${lowercaseFirstWord(stripSentence(wayOut))}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api2.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://runtime2.gtx.dev\";\n//#endregion\n//#region src/utils/isSupportedFileFormatTransform.ts\nconst SUPPORTED_TRANSFORMATIONS = {\n\tGTJSON: [\"GTJSON\"],\n\tJSON: [\"JSON\"],\n\tPO: [\"PO\"],\n\tPOT: [\"POT\", \"PO\"],\n\tYAML: [\"YAML\"],\n\tMDX: [\"MDX\"],\n\tMD: [\"MD\"],\n\tTS: [\"TS\"],\n\tJS: [\"JS\"],\n\tHTML: [\"HTML\"],\n\tTXT: [\"TXT\"],\n\tTWILIO_CONTENT_JSON: [\"TWILIO_CONTENT_JSON\"]\n};\n/**\n* This function checks if a file format transformation is supported during translation\n* @param from - The source file format.\n* @param to - The target file format.\n* @returns True if the transformation is supported, false otherwise\n*/\nfunction isSupportedFileFormatTransform(from, to) {\n\treturn SUPPORTED_TRANSFORMATIONS[from]?.includes(to) ?? false;\n}\n//#endregion\n//#region src/translate/utils/validateFileFormatTransform.ts\n/**\n* Returns a user-facing validation error when a requested file format transform\n* is missing source format context or is not currently supported.\n*/\nfunction getFileFormatTransformError(file) {\n\tif (!file.transformFormat) return void 0;\n\tconst fileLabel = file.fileName ?? file.fileId ?? \"unknown file\";\n\tif (!file.fileFormat) return `fileFormat is required when transformFormat is provided for ${fileLabel}`;\n\tif (!isSupportedFileFormatTransform(file.fileFormat, file.transformFormat)) return `Unsupported file format transform: ${file.fileFormat} -> ${file.transformFormat}`;\n}\n/**\n* Validates file format transforms before sending upload/enqueue requests.\n*/\nfunction validateFileFormatTransforms(files) {\n\tfor (const file of files) {\n\t\tconst error = getFileFormatTransformError(file);\n\t\tif (error) throw new Error(error);\n\t}\n}\n//#endregion\n//#region src/utils/base64.ts\nfunction encode(data) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(data, \"utf8\").toString(\"base64\");\n\tconst bytes = new TextEncoder().encode(data);\n\tlet binary = \"\";\n\tfor (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);\n\treturn btoa(binary);\n}\nfunction decode(base64) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(base64, \"base64\").toString(\"utf8\");\n\tconst binary = atob(base64);\n\tconst bytes = new Uint8Array(binary.length);\n\tfor (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n\treturn new TextDecoder().decode(bytes);\n}\n//#endregion\nexport { defaultBaseUrl as a, createDiagnosticMessage as c, libraryDefaultLocale as d, isSupportedFileFormatTransform as i, formatDiagnosticErrorDetails as l, encode as n, defaultCacheUrl as o, validateFileFormatTransforms as r, defaultRuntimeApiUrl as s, decode as t, defaultTimeout as u };\n\n//# sourceMappingURL=base64-r7YWJYWt.mjs.map","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport {\n getI18nConfig as getBaseI18nConfig,\n I18nConfig,\n setI18nConfig as setBaseI18nConfig,\n} from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\n/**\n * Helps us distinguish behavior for SPA vs server-rendered apps.\n * - server-rendered apps must use context\n * - SPA apps can synchronously access the locale\n */\nexport type RenderStrategy = 'SPA' | 'server-render';\n\nconst defaultRenderStrategy: RenderStrategy = 'server-render';\n\nexport class ReactI18nConfig extends I18nConfig {\n private renderStrategy: RenderStrategy;\n\n constructor(\n params: I18nConfigParams = {},\n renderStrategy: RenderStrategy = defaultRenderStrategy\n ) {\n super(params);\n validateRenderStrategy(renderStrategy);\n this.renderStrategy = renderStrategy;\n }\n\n getRenderStrategy(): RenderStrategy {\n return this.renderStrategy;\n }\n}\n\nexport function getI18nConfig(): ReactI18nConfig {\n const i18nConfig = getBaseI18nConfig();\n if (isReactI18nConfig(i18nConfig)) {\n return i18nConfig;\n }\n throw new Error(\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot read ReactI18nConfig after base I18nConfig setup.',\n why: 'the internal I18nConfig singleton was initialized without react-core render strategy support',\n fix: 'Initialize GT through gt-react or @generaltranslation/react-core/pure.',\n })\n );\n}\n\nexport function setI18nConfig(nextI18nConfig: ReactI18nConfig): void {\n setBaseI18nConfig(nextI18nConfig);\n}\n\nexport function initializeI18nConfig(\n params: I18nConfigParams = {},\n renderStrategy: RenderStrategy = defaultRenderStrategy\n): ReactI18nConfig {\n const nextI18nConfig = new ReactI18nConfig(params, renderStrategy);\n setI18nConfig(nextI18nConfig);\n return nextI18nConfig;\n}\n\nfunction validateRenderStrategy(\n renderStrategy: RenderStrategy\n): asserts renderStrategy is RenderStrategy {\n if (renderStrategy === 'SPA' || renderStrategy === 'server-render') return;\n throw new Error(\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Invalid React render strategy.',\n why: `the render strategy must be \"SPA\" or \"server-render\", but received \"${String(renderStrategy)}\"`,\n fix: 'Initialize GT through gt-react or pass a valid render strategy.',\n })\n );\n}\n\nfunction isReactI18nConfig(\n i18nConfig: I18nConfig\n): i18nConfig is ReactI18nConfig {\n return i18nConfig instanceof ReactI18nConfig;\n}\n","import {\n createDiagnosticMessage,\n formatDiagnosticErrorDetails,\n libraryDefaultLocale,\n} from 'generaltranslation/internal';\nimport {\n createConditionStoreSingleton,\n getRuntimeEnvironment,\n} from 'gt-i18n/internal';\nimport type { ReadonlyConditionStoreInterface } from 'gt-i18n/internal/types';\nimport { getI18nConfig } from '../setup/i18nConfig';\n\nconst conditionStoreNotInitializedError = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot read GT runtime context before it has been initialized',\n why: 'The internal ConditionStore is unavailable',\n});\n\nconst { getConditionStore, setConditionStore, isConditionStoreInitialized } =\n createConditionStoreSingleton<ReadonlyConditionStoreInterface>(\n conditionStoreNotInitializedError\n );\n\n/**\n * Opinionated decision: add a safety wrapper around the condition store to be more forgiving in production\n * TODO: perhaps this is how condition store should always be accessed\n */\nfunction getReadonlyConditionStoreWithFallback(): ReadonlyConditionStoreInterface {\n try {\n return getConditionStore();\n } catch (error) {\n // Error handling\n const runtimeEnvironment = getRuntimeEnvironment();\n const renderStrategy = getI18nConfig().getRenderStrategy();\n const errorMessage = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot access ConditionStore before it is initialized.',\n details: formatDiagnosticErrorDetails(error),\n fix:\n renderStrategy === 'SPA'\n ? 'Initialize GT before reading GT runtime context.'\n : 'Add a <GTProvider> at the root of your component tree.',\n wayOut:\n runtimeEnvironment === 'development'\n ? undefined\n : renderStrategy === 'SPA'\n ? 'Request-specific values will fall back to the default configuration.'\n : 'Request-specific values will fall back to the default configuration. This may cause hydration mismatches.',\n });\n\n if (runtimeEnvironment === 'development') {\n throw new Error(errorMessage);\n } else {\n console.error(errorMessage);\n }\n\n // Fallback to default configuration (important: do not set globally)\n return {\n getLocale: () => libraryDefaultLocale,\n getRegion: () => undefined,\n getEnableI18n: () => true,\n setLocale: () => {},\n setRegion: () => {},\n setEnableI18n: () => {},\n };\n }\n}\n\nexport {\n getConditionStore as getReadonlyConditionStore,\n getReadonlyConditionStoreWithFallback,\n setConditionStore as setReadonlyConditionStore,\n isConditionStoreInitialized as isReadonlyConditionStoreInitialized,\n};\n","import {\n Dictionary,\n Hash,\n Locale,\n ReadonlyConditionStoreInterface,\n} from 'gt-i18n/internal/types';\nimport { Translation } from 'gt-i18n/types';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { createContext, useContext, type Context } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\nimport type {\n OnMissingTranslation,\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n} from '../hooks/utils/missing-translation';\n\nexport type GTContextType = {\n /**\n * Source of truth for translations, streamed from server\n * In SPA mode, these won't be accessible and translations\n * can be accessed via useSyncExternalStore() directly\n */\n translationsSnapshot: Record<Locale, Record<Hash, Translation>>;\n dictionariesSnapshot: Record<Locale, Dictionary>;\n /**\n * I18nStore allows us to sync state updates in ConditionStore and I18nCache\n * with renders\n */\n i18nStore: I18nStore;\n /**\n * ConditionStore should always remain separate from i18nStore as\n * it manages how we perform lookups\n */\n conditionStore: ReadonlyConditionStoreInterface;\n /**\n * Custom override behavior on missing translations\n * Used for server triggering tx hmr b/c no access to useEffect\n */\n onMissingTranslation?: OnMissingTranslation;\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\ntype ReactCoreGlobals = {\n gtContext?: Context<GTContextType | undefined>;\n [key: string]: unknown;\n};\n\ntype GeneralTranslationGlobal = {\n reactCore?: ReactCoreGlobals;\n [key: string]: unknown;\n};\n\ntype GlobalWithGeneralTranslation = {\n __generaltranslation?: GeneralTranslationGlobal;\n};\n\nfunction getReactCoreGlobals(): ReactCoreGlobals {\n const globalObj = globalThis as unknown as GlobalWithGeneralTranslation;\n globalObj.__generaltranslation ??= {};\n // TODO: Consider checking package versions and using a compatibility matrix before sharing global singletons.\n globalObj.__generaltranslation.reactCore ??= {};\n return globalObj.__generaltranslation.reactCore;\n}\n\nexport function getGTContext(): Context<GTContextType | undefined> {\n const reactCoreGlobals = getReactCoreGlobals();\n reactCoreGlobals.gtContext ??= createContext<GTContextType | undefined>(\n undefined\n );\n return reactCoreGlobals.gtContext;\n}\n\nexport function useGTContext(): GTContextType | undefined {\n const context = useContext(getGTContext());\n if (context || getI18nConfig().getRenderStrategy() === 'SPA') {\n return context;\n }\n /**\n * TODO: in a separate PR, we should figure out how to make this more of a forgiving system\n */\n throw new Error(createMissingGTProviderError());\n}\n\nfunction createMissingGTProviderError(): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'GT runtime context could not be read',\n why: 'GTContext was accessed outside of a <GTProvider>',\n fix: 'Add a <GTProvider> at the root of your component tree.',\n });\n}\n","import { ReadonlyConditionStoreInterface } from 'gt-i18n/internal/types';\nimport { getReadonlyConditionStoreWithFallback } from '../condition-store/singleton-operations';\nimport { useGTContext } from '../context/context';\n\n/**\n * NOTE: useSetLocale() and useSetEnableI18n() are not implemented in @generaltranslation/react-core\n * Some server environments are read only, so we cannot implement these hooks.\n */\n\nexport function useConditionStore(): ReadonlyConditionStoreInterface {\n const context = useGTContext();\n return context?.conditionStore ?? getReadonlyConditionStoreWithFallback();\n}\n\n/**\n * Returns the current locale.\n */\nexport function useLocale(): string {\n return useConditionStore().getLocale();\n}\n\n/**\n * Returns the current region, or undefined if no region is set.\n */\nexport function useRegion(): string | undefined {\n return useConditionStore().getRegion();\n}\n\n/**\n * Returns the current enableI18n flag.\n */\nexport function useEnableI18n(): boolean {\n return useConditionStore().getEnableI18n();\n}\n","import { useMemo } from 'react';\nimport { getI18nConfig } from 'gt-i18n/internal';\nimport type { CustomMapping } from 'generaltranslation/types';\n\nexport function useCustomMapping(): CustomMapping {\n return useMemo(() => getI18nConfig().getCustomMapping(), []);\n}\n\nexport function useDefaultLocale(): string {\n return useMemo(() => getI18nConfig().getDefaultLocale(), []);\n}\n\nexport function useLocales(): readonly string[] {\n return useMemo(() => getI18nConfig().getLocales(), []);\n}\n","import { getI18nConfig } from 'gt-i18n/internal';\n\n// Pure helper shared by hook-based and RSC code paths. This module must stay\n// free of hook/context imports so it can be reached from the components-rsc\n// entrypoint.\n\nconst EMPTY_LOCALES_PROP: string[] = [];\n\nexport function getFormatLocales({\n locale,\n enableI18n,\n localesProp = EMPTY_LOCALES_PROP,\n}: {\n locale: string;\n enableI18n: boolean;\n localesProp?: string[];\n}): string[] {\n const defaultLocale = getI18nConfig().getDefaultLocale();\n const shouldTranslate =\n enableI18n && getI18nConfig().requiresTranslation(locale);\n return shouldTranslate\n ? [...localesProp, locale, defaultLocale]\n : [defaultLocale];\n}\n","import type { LocaleProperties } from '@generaltranslation/format/types';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { useMemo } from 'react';\nimport { useEnableI18n, useLocale } from './condition-store';\nimport { getFormatLocales } from './utils/getFormatLocales';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\nconst EMPTY_LOCALES_PROP: string[] = [];\n\nexport { getFormatLocales };\n\nexport function useFormatLocales(\n localesProp: string[] = EMPTY_LOCALES_PROP\n): string[] {\n const locale = useLocale();\n const enableI18n = useEnableI18n();\n return useMemo(\n () =>\n getFormatLocales({\n locale,\n enableI18n,\n localesProp,\n }),\n [locale, enableI18n, localesProp]\n );\n}\n\nexport function useShouldTranslate(): boolean {\n const enableI18n = useEnableI18n();\n const locale = useLocale();\n return enableI18n && getI18nConfig().requiresTranslation(locale);\n}\n\nexport function useGTClass() {\n return useMemo(() => getI18nConfig().getGTClass(), []);\n}\n\nexport function useLocaleProperties(locale: string): LocaleProperties {\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleProperties(locale),\n [locale]\n );\n}\n\nexport function useLocaleDirection(locale: string) {\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleDirection(locale),\n [locale]\n );\n}\n\nexport function useVersionId() {\n throw new Error(\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'useVersionId() is not implemented in this entry point',\n fix: 'Use getVersionId() or import useVersionId() from a supported runtime entry point.',\n })\n );\n}\n","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { I18nStore } from './I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\n\n// ===== I18n Store ===== //\n\ntype ReactCoreGlobals = {\n i18nStore?: I18nStore;\n [key: string]: unknown;\n};\n\ntype GeneralTranslationGlobal = {\n reactCore?: ReactCoreGlobals;\n [key: string]: unknown;\n};\n\ntype GlobalWithGeneralTranslation = {\n __generaltranslation?: GeneralTranslationGlobal;\n};\n\nfunction getReactCoreGlobals(): ReactCoreGlobals {\n const globalObj = globalThis as unknown as GlobalWithGeneralTranslation;\n globalObj.__generaltranslation ??= {};\n // TODO: Consider checking package versions and using a compatibility matrix before sharing global singletons.\n globalObj.__generaltranslation.reactCore ??= {};\n return globalObj.__generaltranslation.reactCore;\n}\n\nexport function getI18nStore(): I18nStore {\n const i18nStore = getReactCoreGlobals().i18nStore;\n if (!i18nStore) {\n throw createI18nStoreNotInitializedError();\n }\n return i18nStore;\n}\n\nexport function setI18nStore(nextStore: I18nStore): void {\n const reactCoreGlobals = getReactCoreGlobals();\n if (reactCoreGlobals.i18nStore && reactCoreGlobals.i18nStore !== nextStore) {\n console.warn(createI18nStoreOverwriteWarning());\n }\n reactCoreGlobals.i18nStore = nextStore;\n}\n\nexport function isI18nStoreInitialized(): boolean {\n return getReactCoreGlobals().i18nStore !== undefined;\n}\n\nfunction createI18nStoreNotInitializedError(): Error {\n const renderStrategy = getI18nConfig().getRenderStrategy();\n const errorMessage = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot access I18nStore before it is initialized.',\n fix:\n renderStrategy === 'SPA'\n ? 'Initialize GT before reading GT runtime context.'\n : 'Add a <GTProvider> at the root of your component tree.',\n });\n\n return new Error(errorMessage);\n}\n\nfunction createI18nStoreOverwriteWarning(): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Warning',\n whatHappened: 'Overwriting global i18nStore singleton instance',\n });\n}\n","import { Dictionary, Hash, Locale } from 'gt-i18n/internal/types';\nimport { useGTContext } from '../context/context';\nimport { I18nStore } from './I18nStore';\nimport { getI18nStore } from './singleton-operations';\nimport { Translation } from 'gt-i18n/types';\n\nexport function useI18nStore(): I18nStore {\n const context = useGTContext();\n return context?.i18nStore || getI18nStore();\n}\n\nexport function useTranslationsSnapshot(): Record<\n Locale,\n Record<Hash, Translation>\n> {\n const context = useGTContext();\n return context?.translationsSnapshot || {};\n}\n\nexport function useDictionariesSnapshot(): Record<Locale, Dictionary> {\n const context = useGTContext();\n return context?.dictionariesSnapshot || {};\n}\n","import {\n getDictionaryListenerKey,\n getI18nConfig,\n getTranslateListenerKey,\n} from 'gt-i18n/internal';\nimport { useShouldTranslate } from '../utils';\nimport { useI18nStore } from '../../i18n-store/useI18nStore';\nimport { DictionaryLookup, TranslateLookup } from '../../i18n-store/storeTypes';\nimport { useCallback, useEffect } from 'react';\nimport { Translation } from 'gt-i18n/types';\nimport { useGTContext } from '../../context/context';\n\nexport type OnMissingTranslation = <T extends Translation>(\n lookup: TranslateLookup<T>\n) => void;\nexport type OnMissingDictionaryEntry = (lookup: DictionaryLookup) => void;\n// TODO: rename to OnMissingDictionaryObject\nexport type OnMissingDictionaryObj = (lookup: DictionaryLookup) => void;\n\ntype PendingLookup =\n | {\n type: 'translation';\n lookup: TranslateLookup;\n }\n | {\n type: 'dictionaryEntry' | 'dictionaryObject';\n lookup: DictionaryLookup;\n };\n\n/**\n * Why have custom handleMissing functions?\n *\n * Some runtimes (like server) cannot make useEffect calls, so\n * we need to give them access to a callback where they can embed\n * their own translation calls\n *\n * While this is technnically not pure behavior, this is acceptable\n * in development hot reload\n */\n\n// TODO: reduce code duplication with the three below functions\nexport function useHandleMissingTranslation(): OnMissingTranslation {\n const customHandleMissing = useGTContext()?.onMissingTranslation;\n const pureHandleMissing = useDevHotReloadQueue();\n\n return useCallback(\n (lookup: TranslateLookup) => {\n if (customHandleMissing) {\n customHandleMissing(lookup);\n } else {\n pureHandleMissing(getTranslateListenerKey(lookup), {\n type: 'translation',\n lookup,\n });\n }\n },\n [customHandleMissing, pureHandleMissing]\n );\n}\n\nexport function useHandleMissingDictionaryEntry(): OnMissingDictionaryEntry {\n const customHandleMissing = useGTContext()?.onMissingDictionaryEntry;\n const pureHandleMissing = useDevHotReloadQueue();\n\n return useCallback(\n (lookup: DictionaryLookup) => {\n if (customHandleMissing) {\n customHandleMissing(lookup);\n } else {\n pureHandleMissing(getDictionaryListenerKey(lookup), {\n type: 'dictionaryEntry',\n lookup,\n });\n }\n },\n [customHandleMissing, pureHandleMissing]\n );\n}\n\nexport function useHandleMissingDictionaryObject(): OnMissingDictionaryObj {\n const customHandleMissing = useGTContext()?.onMissingDictionaryObj;\n const pureHandleMissing = useDevHotReloadQueue();\n return useCallback(\n (lookup: DictionaryLookup) => {\n if (customHandleMissing) {\n customHandleMissing(lookup);\n } else {\n pureHandleMissing(getDictionaryListenerKey(lookup), {\n type: 'dictionaryObject',\n lookup,\n });\n }\n },\n [customHandleMissing, pureHandleMissing]\n );\n}\n\n/**\n * HMR translation needs to be deferred to post-commit phase\n */\nfunction useDevHotReloadQueue() {\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const shouldTranslate = useShouldTranslate();\n const i18nStore = useI18nStore();\n\n // No memoization bc we want to flush after every render\n // TODO: perhaps should find a way to memoize and flush in a better way than this as it nullifies any useCallback\n const pendingLookups = new Map<string, PendingLookup>();\n\n // Pure react: effects run after render\n useEffect(() => {\n if (!devHotReloadEnabled || !shouldTranslate || pendingLookups.size === 0) {\n return;\n }\n\n pendingLookups.forEach(({ type, lookup }) => {\n switch (type) {\n case 'translation':\n i18nStore.translate(lookup);\n break;\n case 'dictionaryEntry':\n i18nStore.translateDictionaryEntry(lookup);\n break;\n case 'dictionaryObject':\n i18nStore.translateDictionaryObject(lookup);\n break;\n }\n });\n }, [devHotReloadEnabled, shouldTranslate, i18nStore, pendingLookups]);\n\n // No need for useCallback b/c we want access to the pendingLookups map\n return (key: string, pendingLookup: PendingLookup) => {\n pendingLookups.set(key, pendingLookup);\n };\n}\n","import {\n type RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from 'react';\nimport {\n createLookupOptions,\n getI18nConfig,\n getTranslateListenerKey,\n} from 'gt-i18n/internal';\nimport type { Translation } from 'gt-i18n/types';\nimport type {\n StoreListener,\n TranslateLookup,\n TranslateSnapshot,\n} from '../../i18n-store/storeTypes';\nimport type { InlineTranslationOptionsFields } from 'gt-i18n/internal/types';\nimport type { StringFormat } from '@generaltranslation/format';\nimport { useLocale } from '../condition-store';\nimport { useShouldTranslate } from '../utils';\nimport {\n useI18nStore,\n useTranslationsSnapshot,\n} from '../../i18n-store/useI18nStore';\nimport { useHandleMissingTranslation } from '../utils/missing-translation';\n\n/**\n * Returns the translation, but also triggers a translation if it is not found\n * when dev hot reload is enabled.\n */\nexport type TrackedTranslationResolver = <T extends Translation>(\n lookup: TranslateLookup<T>\n) => TranslateSnapshot<T>;\n\nexport type Message = InlineTranslationOptionsFields & {\n message: string;\n};\n\n/**\n * NOTE:\n * gt() may be called during render, so tracking intentionally only mutates\n * hook-local refs. This widens the event filter used by our existing\n * useSyncExternalStore subscription, but does not update React state or mutate\n * the translation cache during render.\n *\n * A render that is later aborted may leave behind an extra tracked key. That is\n * acceptable for dev hot reload because the worst case is an unnecessary\n * invalidation for this hook instance, not incorrect rendered output.\n */\n\nexport function useTrackedTranslationResolver(\n messages: Message[] = []\n): TrackedTranslationResolver {\n const translationsSnapshot = useTranslationsSnapshot();\n const i18nStore = useI18nStore();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const onMissingTranslation = useHandleMissingTranslation();\n\n /**\n * Track lookups per hook instance without updating React state during render.\n */\n const trackedKeysRef = useRef<Set<string> | null>(null);\n if (trackedKeysRef.current == null) {\n trackedKeysRef.current = new Set();\n }\n\n // (optimization) Pre-subscribe to compiler-injected lookups\n usePreloadCompilerLookups(messages, trackedKeysRef);\n\n // (tx hot reload) Subscribe to translation updates\n useSubscribeToLookups(trackedKeysRef);\n\n /**\n * Remember that we can make no assumptions about when this cb gets invoked\n * - Resolves translation from lookup\n * - enqueues dev hot reload (if needed)\n */\n return useCallback(\n <T extends Translation>(\n lookup: TranslateLookup<T>\n ): TranslateSnapshot<T> => {\n // Track the lookup for dev hot reload\n const lookupKey = getTranslateListenerKey(lookup);\n if (devHotReloadEnabled) {\n trackedKeysRef.current!.add(lookupKey);\n }\n\n // Resolve the translation from the store\n const translation = i18nStore.getTranslateSnapshot(\n lookup,\n translationsSnapshot\n );\n\n // Trigger a hot reload if the translation is not found\n if (translation == null && devHotReloadEnabled) {\n onMissingTranslation(lookup);\n }\n return translation;\n },\n [i18nStore, translationsSnapshot, onMissingTranslation, devHotReloadEnabled]\n );\n}\n\n/**\n * Subscribe to translation updates, but only trigger re-renders\n * if the lookup is in the tracked keys. Remember that we can make\n * no assumptions about when this list gets updated. Technically,\n * not pure, but this is an acceptable trade since this is\n * really just for translation hot reload.\n *\n * TODO: (separate PR) we can probably do better filtering for adding to the set since this is primarily dev only\n * TODO: reduce code duplication with the other two useSubscribeToLookups functions\n */\nfunction useSubscribeToLookups(trackedKeysRef: RefObject<Set<string> | null>) {\n // invalidation counter for triggering updates\n const versionRef = useRef(0);\n const i18nStore = useI18nStore();\n const subscribe = useCallback(\n (listener: StoreListener) => {\n return i18nStore.subscribeToTranslationEvents((lookup) => {\n const key = getTranslateListenerKey(lookup);\n if (!trackedKeysRef.current!.has(key)) return;\n versionRef.current++;\n listener();\n });\n },\n [i18nStore]\n );\n const getSnapshot = useCallback(() => {\n return versionRef.current;\n }, []);\n\n useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\n/**\n * Pre-subscribe to compiler-injected lookups\n * trigger translations for them\n *\n * This ref mutation is safe because this is translation hot reload only\n * and effects are deterministic\n */\nfunction usePreloadCompilerLookups(\n messages: Message[],\n trackedKeysRef: RefObject<Set<string> | null>\n) {\n const i18nStore = useI18nStore();\n const locale = useLocale();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const shouldTranslate = useShouldTranslate();\n const translationsSnapshot = useTranslationsSnapshot();\n const txHotReloadEnabled = useMemo(() => {\n return messages?.length > 0 && shouldTranslate && devHotReloadEnabled;\n }, [messages, shouldTranslate, devHotReloadEnabled]);\n\n // Precompute as much as we can\n const lookups: [TranslateLookup<string>, string][] = useMemo(() => {\n if (!txHotReloadEnabled) return [];\n return messages.map(({ message, ...options }) => {\n const targetLocale = options.$locale ?? locale;\n const lookupOptions = createLookupOptions<StringFormat>(\n targetLocale,\n options,\n 'ICU'\n );\n const lookup = {\n locale: targetLocale,\n message,\n options: lookupOptions,\n };\n return [lookup, getTranslateListenerKey(lookup)];\n });\n }, [locale, txHotReloadEnabled, messages]);\n\n // Pre-subscribe to the lookups\n if (txHotReloadEnabled) {\n lookups.forEach(([, lookupKey]) => {\n trackedKeysRef.current!.add(lookupKey);\n });\n }\n\n /**\n * Delegate non-pure operations to post commit\n *\n * (Optimization) Trigger a hot reload if the translation is not found\n * for compiler-injected lookups\n *\n * TODO: for use() + suspense strategy, use a Promise.all()\n * TODO: server side translation invocation\n */\n useEffect(() => {\n if (!txHotReloadEnabled) return;\n\n lookups\n .filter(\n ([lookup]) =>\n i18nStore.getTranslateSnapshot(lookup, translationsSnapshot) == null\n )\n .forEach(([lookup]) => i18nStore.translate(lookup));\n }, [txHotReloadEnabled, i18nStore, lookups, translationsSnapshot]);\n}\n","import { useCallback } from 'react';\nimport { createLookupOptions, interpolateMessage } from 'gt-i18n/internal';\nimport { useLocale } from './condition-store';\nimport { useShouldTranslate } from './utils';\nimport type { GTFunctionType, InlineTranslationOptions } from 'gt-i18n/types';\nimport type { StringFormat } from '@generaltranslation/format/types';\nimport { useDefaultLocale } from './i18n-config';\nimport {\n type Message,\n useTrackedTranslationResolver,\n} from './external-store/useTrackedTranslationResolver';\n\n// ===== Hook ===== //\n\nexport function useGT(_messages?: Message[]): GTFunctionType {\n const locale = useLocale();\n const defaultLocale = useDefaultLocale();\n const shouldTranslate = useShouldTranslate();\n const resolveTranslation = useTrackedTranslationResolver(_messages);\n\n /**\n * gt() string translation callback\n */\n return useCallback(\n (message: string, options: InlineTranslationOptions = {}) => {\n if (!shouldTranslate) {\n return interpolateMessage({\n options,\n source: message,\n sourceLocale: defaultLocale,\n });\n }\n\n const lookupOptions = createLookupOptions<StringFormat>(\n options.$locale ?? locale,\n options,\n 'ICU'\n );\n const translation = resolveTranslation({\n locale: lookupOptions.$locale,\n message,\n options: lookupOptions,\n });\n\n return interpolateMessage({\n source: message,\n target: translation,\n options: lookupOptions,\n sourceLocale: defaultLocale,\n });\n },\n [defaultLocale, locale, shouldTranslate, resolveTranslation]\n );\n}\n","import { useCallback } from 'react';\nimport { decodeOptions } from 'gt-i18n';\nimport { useGT } from './useGT';\nimport type { InlineResolveOptions, MFunctionType } from 'gt-i18n/types';\nimport { isEncodedTranslationOptions } from 'gt-i18n/internal';\nimport { Message } from './external-store/useTrackedTranslationResolver';\n\n// ===== Hook ===== //\n\nexport function useMessages(_messages?: Message[]): MFunctionType {\n const gt = useGT(_messages);\n\n return useCallback(\n <T extends string | null | undefined>(\n encodedMsg: T,\n options: InlineResolveOptions = {}\n ): T extends string ? string : T => {\n if (encodedMsg == null) {\n return encodedMsg as T extends string ? string : T;\n }\n\n const decodedOptions = decodeOptions(encodedMsg) ?? {};\n if (isEncodedTranslationOptions(decodedOptions)) {\n return gt(decodedOptions.$_source, decodedOptions) as T extends string\n ? string\n : T;\n }\n\n return gt(encodedMsg, options) as T extends string ? string : T;\n },\n [gt]\n );\n}\n","import { useCallback, useRef } from 'react';\nimport {\n useDictionariesSnapshot,\n useI18nStore,\n} from '../../i18n-store/useI18nStore';\nimport type {\n DictionaryEntrySnapshot,\n DictionaryLookup,\n StoreListener,\n} from '../../i18n-store/storeTypes';\nimport { getDictionaryListenerKey, getI18nConfig } from 'gt-i18n/internal';\nimport { useSyncExternalStore } from 'react';\nimport type { RefObject } from 'react';\nimport { useHandleMissingDictionaryEntry } from '../utils/missing-translation';\n\nexport type TrackedDictionaryEntryResolver = (\n lookup: DictionaryLookup\n) => DictionaryEntrySnapshot;\n\n// TODO: rename to useTrackedDictionaryEntryResolver\nexport function useTrackedDictionaryResolver(): TrackedDictionaryEntryResolver {\n const dictionariesSnapshot = useDictionariesSnapshot();\n const i18nStore = useI18nStore();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const onMissingDictionaryEntry = useHandleMissingDictionaryEntry();\n\n const trackedKeysRef = useRef<Set<string> | null>(null);\n if (trackedKeysRef.current == null) {\n trackedKeysRef.current = new Set();\n }\n\n // subscribe to dictionary entry updates\n useSubscribeToLookups(trackedKeysRef);\n\n // Resolution callback\n return useCallback(\n (lookup: DictionaryLookup) => {\n // Track the lookup for dev hot reload\n const lookupKey = getDictionaryListenerKey(lookup);\n if (devHotReloadEnabled) {\n trackedKeysRef.current!.add(lookupKey);\n }\n\n // Resolve the dictionary entry from the store\n const dictionaryEntry = i18nStore.getDictionaryEntrySnapshot(\n lookup,\n dictionariesSnapshot\n );\n\n // Hot reload\n if (dictionaryEntry == null && devHotReloadEnabled) {\n onMissingDictionaryEntry(lookup);\n }\n\n return dictionaryEntry;\n },\n [\n i18nStore,\n dictionariesSnapshot,\n devHotReloadEnabled,\n onMissingDictionaryEntry,\n ]\n );\n}\n\nfunction useSubscribeToLookups(trackedKeysRef: RefObject<Set<string> | null>) {\n // invalidation counter for triggering updates\n const versionRef = useRef(0);\n const i18nStore = useI18nStore();\n const subscribe = useCallback(\n (listener: StoreListener) => {\n return i18nStore.subscribeToDictionaryEntryEvents((lookup) => {\n const key = getDictionaryListenerKey(lookup);\n if (!trackedKeysRef.current!.has(key)) return;\n versionRef.current++;\n listener();\n });\n },\n [i18nStore]\n );\n const getSnapshot = useCallback(() => {\n return versionRef.current;\n }, []);\n\n useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n","import { getDictionaryListenerKey, getI18nConfig } from 'gt-i18n/internal';\nimport type {\n DictionaryLookup,\n DictionaryObjectSnapshot,\n StoreListener,\n} from '../../i18n-store/storeTypes';\nimport {\n useDictionariesSnapshot,\n useI18nStore,\n} from '../../i18n-store/useI18nStore';\nimport {\n type RefObject,\n useCallback,\n useRef,\n useSyncExternalStore,\n} from 'react';\nimport { useHandleMissingDictionaryObject } from '../utils/missing-translation';\n\nexport type TrackedDictionaryObjResolver = (\n lookup: DictionaryLookup\n) => DictionaryObjectSnapshot;\n\n// TODO: rename to useTrackedDictionaryObjectResolver\nexport function useTrackedDictionaryObjResolver(): TrackedDictionaryObjResolver {\n const dictionariesSnapshot = useDictionariesSnapshot();\n const i18nStore = useI18nStore();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const onMissingDictionaryObj = useHandleMissingDictionaryObject();\n\n const trackedKeysRef = useRef<Set<string> | null>(null);\n if (trackedKeysRef.current == null) {\n trackedKeysRef.current = new Set();\n }\n\n // subscribe to dictionary entry updates\n useSubscribeToLookups(trackedKeysRef);\n\n // Resolution callback\n return useCallback(\n (lookup: DictionaryLookup) => {\n // Track the lookup for dev hot reload\n const lookupKey = getDictionaryListenerKey(lookup);\n if (devHotReloadEnabled) {\n trackedKeysRef.current!.add(lookupKey);\n }\n\n // Resolve the dictionary entry from the store\n const dictionaryObject = i18nStore.getDictionaryObjectSnapshot(\n lookup,\n dictionariesSnapshot\n );\n\n // Hot reload\n if (dictionaryObject == null && devHotReloadEnabled) {\n onMissingDictionaryObj(lookup);\n }\n\n return dictionaryObject;\n },\n [\n i18nStore,\n dictionariesSnapshot,\n devHotReloadEnabled,\n onMissingDictionaryObj,\n ]\n );\n}\n\nfunction useSubscribeToLookups(trackedKeysRef: RefObject<Set<string> | null>) {\n // invalidation counter for triggering updates\n const versionRef = useRef(0);\n const i18nStore = useI18nStore();\n const subscribe = useCallback(\n (listener: StoreListener) => {\n return i18nStore.subscribeToDictionaryObjectEvents((lookup) => {\n const key = getDictionaryListenerKey(lookup);\n if (!trackedKeysRef.current!.has(key)) return;\n versionRef.current++;\n listener();\n });\n },\n [i18nStore]\n );\n const getSnapshot = useCallback(() => {\n return versionRef.current;\n }, []);\n\n useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n","import { useCallback, useMemo } from 'react';\nimport {\n extractVariables,\n renderDictionaryEntry,\n renderDictionaryObject,\n resolveDictionaryLookupOptions,\n} from 'gt-i18n/internal';\nimport { useLocale } from './condition-store';\nimport { useGT } from './useGT';\nimport type {\n DictionaryObjectTranslation,\n DictionaryTranslationOptions,\n} from 'gt-i18n/types';\nimport { useDefaultLocale } from './i18n-config';\nimport { useShouldTranslate } from './utils';\nimport { useTrackedDictionaryResolver } from './external-store/useTrackedDictionaryResolver';\nimport { useTrackedDictionaryObjResolver } from './external-store/useTrackedDictionaryObjResolver';\n\n// ===== Hook ===== //\n\nexport function useTranslations(rootId?: string): UseTranslationsFunction {\n const locale = useLocale();\n const defaultLocale = useDefaultLocale();\n const shouldTranslate = useShouldTranslate();\n const gt = useGT();\n const resolveDictionaryEntry = useTrackedDictionaryResolver();\n const translateObject = useTranslationsObj(rootId);\n\n const translateEntry = useCallback(\n (suffix: string, options: DictionaryTranslationOptions = {}) => {\n const id = getId(rootId, suffix);\n\n const sourceEntry = resolveDictionaryEntry({\n locale: defaultLocale,\n id,\n });\n if (sourceEntry === undefined) {\n throw new Error(`Dictionary entry ${id} cannot be found`);\n }\n const sourceOptions = resolveDictionaryLookupOptions(sourceEntry.options);\n if (!shouldTranslate) {\n return gt(sourceEntry.entry, {\n ...sourceOptions,\n ...extractVariables(options),\n $locale: defaultLocale,\n });\n }\n\n const targetEntry = resolveDictionaryEntry({ locale, id });\n if (targetEntry?.entry != null) {\n return renderDictionaryEntry({\n sourceLocale: defaultLocale,\n targetLocale: locale,\n sourceEntry,\n target: targetEntry.entry,\n dictionaryOptions: sourceOptions,\n options,\n });\n }\n\n return gt(sourceEntry.entry, {\n ...sourceOptions,\n ...extractVariables(options),\n $locale: locale,\n });\n },\n [defaultLocale, gt, rootId, locale, resolveDictionaryEntry, shouldTranslate]\n );\n\n return useMemo(\n () => Object.assign(translateEntry, { obj: translateObject }),\n [translateEntry, translateObject]\n );\n}\n\nfunction useTranslationsObj(rootId?: string): UseTranslationsObjFunction {\n const locale = useLocale();\n const defaultLocale = useDefaultLocale();\n const shouldTranslate = useShouldTranslate();\n const gt = useGT();\n const resolveDictionaryObject = useTrackedDictionaryObjResolver();\n\n return useCallback(\n (suffix: string) => {\n const entryId = getId(rootId, suffix);\n const sourceObject = resolveDictionaryObject({\n locale: defaultLocale,\n id: entryId,\n });\n if (sourceObject === undefined) {\n throw new Error(`Dictionary entry ${entryId} cannot be found`);\n }\n\n let targetObject = undefined;\n if (shouldTranslate) {\n const targetLookup = { locale, id: entryId };\n targetObject = resolveDictionaryObject(targetLookup);\n }\n\n return renderDictionaryObject({\n sourceObject,\n targetObject,\n translate: (sourceEntry, dictionaryOptions) =>\n gt(sourceEntry.entry, {\n ...dictionaryOptions,\n $locale: shouldTranslate ? locale : defaultLocale,\n }),\n });\n },\n [\n defaultLocale,\n rootId,\n locale,\n resolveDictionaryObject,\n shouldTranslate,\n gt,\n ]\n );\n}\n\n// ===== Lookup Helpers ===== //\n\nfunction getId(prefix: string | undefined, suffix: string): string {\n return prefix ? `${prefix}.${suffix}` : suffix;\n}\n\n// ===== Types ===== //\n\nexport type UseTranslationsFunction = ((\n id: string,\n options?: DictionaryTranslationOptions\n) => string) & {\n obj: (id: string) => DictionaryObjectTranslation;\n};\n\ntype UseTranslationsObjFunction = (id: string) => DictionaryObjectTranslation;\n","import { useCallback, useMemo } from 'react';\nimport { useCustomMapping, useLocales } from './i18n-config';\nimport { useLocale } from './condition-store';\nimport { getLocaleProperties } from 'generaltranslation';\n\nexport function useInternalLocaleSelector(locales?: string[]) {\n // Retrieve the locale, locales, and setLocale function\n const contextLocales = useLocales();\n const customMapping = useCustomMapping();\n const locale = useLocale();\n\n // sort\n const sortedLocales = useMemo(() => {\n if (!contextLocales || contextLocales.length === 0) {\n return [];\n }\n const collator = new Intl.Collator();\n return [...contextLocales].sort((a, b) =>\n collator.compare(\n getLocaleProperties(a, locale, customMapping).nativeNameWithRegionCode,\n getLocaleProperties(b, locale, customMapping).nativeNameWithRegionCode\n )\n );\n }, [contextLocales, locale, customMapping]);\n\n // create getLocaleProperties callback\n const getLocalePropertiesCallback = useCallback(\n (locale: string) => {\n return getLocaleProperties(locale, locale, customMapping);\n },\n [locale, customMapping]\n );\n\n return {\n locale,\n locales: locales ? locales : sortedLocales,\n getLocaleProperties: getLocalePropertiesCallback,\n };\n}\n","import { useMemo } from 'react';\nimport { useCustomMapping, useLocales } from './i18n-config';\nimport { useLocale, useRegion } from './condition-store';\nimport { getLocaleProperties } from 'generaltranslation';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\nexport type RegionData = {\n code: string;\n name: string;\n emoji: string;\n locale: string;\n};\n\nexport type InternalRegionSelectorOptions = {\n regions?: string[];\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n};\n\n/**\n * Internal logic for region selection in applications supporting multiple regions.\n *\n * Returns the current region, an ordered list of available regions (inferred\n * from the supported locales when not provided), and a map of region codes to\n * their display data (name, emoji, associated locale).\n */\nexport function useInternalRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion = true,\n sortRegionsAlphabetically = true,\n}: InternalRegionSelectorOptions = {}) {\n // Retrieve the locale, locales, and region\n const contextLocales = useLocales();\n const localeCustomMapping = useCustomMapping();\n const locale = useLocale();\n const region = useRegion();\n const { regionCode: localeRegion } = getLocaleProperties(\n locale,\n locale,\n localeCustomMapping\n );\n\n const [\n regions, // ordered list of ISO 3166 region codes\n regionData, // map of ISO 3166 region codes to region display data, potentially not ordered\n ] = useMemo<[string[], Map<string, RegionData>]>(() => {\n const gt = getI18nConfig().getGTClass(locale);\n const regionToLocaleMap = new Map(\n contextLocales.map((l) => {\n const lp = getLocaleProperties(l, locale, localeCustomMapping); // has to be directly called so sourceLocale can be in the user's current locale\n return [lp.regionCode, lp];\n })\n );\n\n const regions = _regions\n ? [..._regions]\n : Array.from(regionToLocaleMap?.keys() || [localeRegion]);\n\n const regionData = new Map<string, RegionData>(\n regions.map((r: string) => {\n return [\n r,\n {\n locale: regionToLocaleMap?.get(r)?.code || locale,\n ...gt.getRegionProperties(r),\n ...(typeof customMapping?.[r] === 'string'\n ? { name: customMapping?.[r] }\n : customMapping?.[r]),\n },\n ];\n })\n );\n\n if (sortRegionsAlphabetically) {\n regions.sort((a, b) =>\n new Intl.Collator().compare(\n regionData.get(a)!.name,\n regionData.get(b)!.name\n )\n );\n }\n\n if (prioritizeCurrentLocaleRegion) {\n const localeRegionIndex = regions.indexOf(localeRegion);\n if (localeRegionIndex > 0) {\n // 0 because no action is needed if it's already at the start\n regions.splice(localeRegionIndex, 1);\n regions.unshift(localeRegion);\n }\n }\n\n return [regions, regionData];\n }, [\n _regions,\n customMapping,\n locale,\n localeRegion,\n contextLocales,\n localeCustomMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n ]);\n\n return {\n region,\n regions,\n regionData,\n locale,\n localeRegion,\n };\n}\n"],"mappings":"6KAKA,SAAS,EAAe,EAAM,CAC7B,IAAM,EAAU,EAAK,MAAM,CAE3B,OADK,EACE,UAAU,KAAK,EAAQ,CAAG,EAAU,GAAG,EAAQ,GADjC,GAGtB,SAAS,EAAc,EAAM,CAC5B,IAAM,EAAU,EAAK,MAAM,CACvB,EAAM,EAAQ,OAClB,KAAO,EAAM,GAAG,CACf,IAAM,EAAO,EAAQ,EAAM,GAC3B,GAAI,IAAS,KAAO,IAAS,KAAO,IAAS,IAAK,MAClD,IAED,OAAO,EAAQ,MAAM,EAAG,EAAI,CAE7B,SAAS,EAAmB,EAAM,CACjC,OAAO,EAAK,QAAQ,cAAgB,GAAU,EAAM,aAAa,CAAC,CAEnE,SAAS,EAAc,EAAS,CAC/B,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Q,QAAQ,EAAa,EAIjC,MAAO,CAAC,EAAS,EAAW,EAC3B,CACD,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAAC,CAEF,MAAO,CACL,SACA,UACA,aACA,SACA,eACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.d.ts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/hooks/condition-store.ts","../../format/dist/types-COaQnqVZ.d.cts","../src/hooks/i18n-config.ts","../src/hooks/external-store/useTrackedTranslationResolver.ts","../src/hooks/useGT.ts","../src/hooks/useMessages.ts","../src/hooks/useTranslations.ts","../src/hooks/utils.ts","../src/hooks/useInternalLocaleSelector.ts","../src/hooks/useInternalRegionSelector.ts"],"mappings":";;;;;;;;;iBASgB,iBAAA,CAAA,GAAqB,+BAAA;;;;iBAQrB,SAAA,CAAA;AAAhB;;;AAAA,iBAOgB,SAAA,CAAA;;AAAhB;;iBAOgB,aAAA,CAAA;;;;KC9BXA,aAAAA,GAAgBG,MAAAA,kBAAwBD,OAAAA,CAAQD,gBAAAA;AAAAA;AAAAA,KAGhDA,gBAAAA;EACHG,IAAAA;EACAC,IAAAA;EACAC,UAAAA;EACAC,YAAA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 @@
1
- import{I18nConfig as e,createConditionStoreSingleton as t,createLookupOptions as n,extractVariables as r,getDictionaryListenerKey as i,getI18nConfig as a,getRuntimeEnvironment as o,getTranslateListenerKey as s,interpolateMessage as c,isEncodedTranslationOptions as l,renderDictionaryEntry as u,renderDictionaryObject as d,resolveDictionaryLookupOptions as f}from"gt-i18n/internal";import{createContext as p,useCallback as m,useContext as ee,useEffect as h,useMemo as g,useRef as _,useSyncExternalStore as v}from"react";import{decodeOptions as te}from"gt-i18n";import{getLocaleProperties as y}from"generaltranslation";function b(e){let t=e.trim();return t?/[.!?)]$/.test(t)?t:`${t}.`:``}function x(e){let t=e.trim(),n=t.length;for(;n>0;){let e=t[n-1];if(e!==`.`&&e!==`!`&&e!==`?`)break;--n}return t.slice(0,n)}function S(e){return e.replace(/^[A-Z][a-z]/,e=>e.toLowerCase())}function C(e){if(!e)return``;let t=Array.isArray(e)?e.join(`, `):e;return t.trim()?b(`Details: ${t}`):``}function ne(e){if(e!=null)return String(e)}function w({source:e,severity:t,whatHappened:n,reassurance:r,why:i,fix:a,wayOut:o,details:s,docsUrl:c}){let l=e?t?`${e} ${t}:`:`${e}:`:t?`${t}:`:``,u=i?`${x(n)} because ${S(x(i))}`:n,d=!!a&&!!o&&/^[a-z]/.test(x(o)),f=[u,r,d?`${x(a)}, or ${S(x(o))}`:a,d?void 0:o,C(s)].filter(e=>!!e).map(b);c&&f.push(`Learn more: ${c}`);let p=f.join(` `);return l?`${l} ${p}`:p}var T=class extends e{renderStrategy;constructor(e={},t=`server-render`){super(e),re(t),this.renderStrategy=t}getRenderStrategy(){return this.renderStrategy}};function E(){let e=a();if(D(e))return e;throw Error(w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read ReactI18nConfig after base I18nConfig setup.`,why:`the internal I18nConfig singleton was initialized without react-core render strategy support`,fix:`Initialize GT through gt-react or @generaltranslation/react-core/pure.`}))}function re(e){if(!(e===`SPA`||e===`server-render`))throw Error(w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Invalid React render strategy.`,why:`the render strategy must be "SPA" or "server-render", but received "${String(e)}"`,fix:`Initialize GT through gt-react or pass a valid render strategy.`}))}function D(e){return e instanceof T}const{getConditionStore:O,setConditionStore:ie,isConditionStoreInitialized:ae}=t(w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read GT runtime context before it has been initialized`,why:`The internal ConditionStore is unavailable`}));function k(){try{return O()}catch(e){let t=o(),n=E().getRenderStrategy(),r=w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot access ConditionStore before it is initialized.`,details:ne(e),fix:n===`SPA`?`Initialize GT before reading GT runtime context.`:`Add a <GTProvider> at the root of your component tree.`,wayOut:t===`development`?void 0:n===`SPA`?`Request-specific values will fall back to the default configuration.`:`Request-specific values will fall back to the default configuration. This may cause hydration mismatches.`});if(t===`development`)throw Error(r);return console.error(r),{getLocale:()=>`en`,getRegion:()=>void 0,getEnableI18n:()=>!0,setLocale:()=>{},setRegion:()=>{},setEnableI18n:()=>{}}}}function oe(){let e=globalThis;return e.__generaltranslation??={},e.__generaltranslation.reactCore??={},e.__generaltranslation.reactCore}function se(){let e=oe();return e.gtContext??=p(void 0),e.gtContext}function A(){let e=ee(se());if(e||E().getRenderStrategy()===`SPA`)return e;throw Error(ce())}function ce(){return w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`GT runtime context could not be read`,why:`GTContext was accessed outside of a <GTProvider>`,fix:`Add a <GTProvider> at the root of your component tree.`})}function j(){return A()?.conditionStore??k()}function M(){return j().getLocale()}function N(){return j().getRegion()}function P(){return j().getEnableI18n()}function F(){return g(()=>a().getCustomMapping(),[])}function I(){return g(()=>a().getDefaultLocale(),[])}function L(){return g(()=>a().getLocales(),[])}const R=[];function z({locale:e,enableI18n:t,localesProp:n=R}){let r=a().getDefaultLocale();return t&&a().requiresTranslation(e)?[...n,e,r]:[r]}const B=[];function V(e=B){let t=M(),n=P();return g(()=>z({locale:t,enableI18n:n,localesProp:e}),[t,n,e])}function H(){let e=P(),t=M();return e&&a().requiresTranslation(t)}function U(){return g(()=>a().getGTClass(),[])}function W(e){return g(()=>a().getGTClass().getLocaleProperties(e),[e])}function G(e){return g(()=>a().getGTClass().getLocaleDirection(e),[e])}function K(){throw Error(w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`useVersionId() is not implemented in this entry point`,fix:`Use getVersionId() or import useVersionId() from a supported runtime entry point.`}))}function q(){let e=globalThis;return e.__generaltranslation??={},e.__generaltranslation.reactCore??={},e.__generaltranslation.reactCore}function le(){let e=q().i18nStore;if(!e)throw ue();return e}function ue(){let e=w({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot access I18nStore before it is initialized.`,fix:E().getRenderStrategy()===`SPA`?`Initialize GT before reading GT runtime context.`:`Add a <GTProvider> at the root of your component tree.`});return Error(e)}function J(){return A()?.i18nStore||le()}function Y(){return A()?.translationsSnapshot||{}}function X(){return A()?.dictionariesSnapshot||{}}function de(){let e=A()?.onMissingTranslation,t=Z();return m(n=>{e?e(n):t(s(n),{type:`translation`,lookup:n})},[e,t])}function fe(){let e=A()?.onMissingDictionaryEntry,t=Z();return m(n=>{e?e(n):t(i(n),{type:`dictionaryEntry`,lookup:n})},[e,t])}function pe(){let e=A()?.onMissingDictionaryObj,t=Z();return m(n=>{e?e(n):t(i(n),{type:`dictionaryObject`,lookup:n})},[e,t])}function Z(){let e=a().isDevHotReloadEnabled(),t=H(),n=J(),r=new Map;return h(()=>{!e||!t||r.size===0||r.forEach(({type:e,lookup:t})=>{switch(e){case`translation`:n.translate(t);break;case`dictionaryEntry`:n.translateDictionaryEntry(t);break;case`dictionaryObject`:n.translateDictionaryObject(t);break}})},[e,t,n,r]),(e,t)=>{r.set(e,t)}}function me(e=[]){let t=Y(),n=J(),r=a().isDevHotReloadEnabled(),i=de(),o=_(null);return o.current??=new Set,ge(e,o),he(o),m(e=>{let a=s(e);r&&o.current.add(a);let c=n.getTranslateSnapshot(e,t);return c==null&&r&&i(e),c},[n,t,i,r])}function he(e){let t=_(0),n=J(),r=m(r=>n.subscribeToTranslationEvents(n=>{let i=s(n);e.current.has(i)&&(t.current++,r())}),[n]),i=m(()=>t.current,[]);v(r,i,i)}function ge(e,t){let r=J(),i=M(),o=a().isDevHotReloadEnabled(),c=H(),l=Y(),u=g(()=>e?.length>0&&c&&o,[e,c,o]),d=g(()=>u?e.map(({message:e,...t})=>{let r=t.$locale??i,a={locale:r,message:e,options:n(r,t,`ICU`)};return[a,s(a)]}):[],[i,u,e]);u&&d.forEach(([,e])=>{t.current.add(e)}),h(()=>{u&&d.filter(([e])=>r.getTranslateSnapshot(e,l)==null).forEach(([e])=>r.translate(e))},[u,r,d,l])}function Q(e){let t=M(),r=I(),i=H(),a=me(e);return m((e,o={})=>{if(!i)return c({options:o,source:e,sourceLocale:r});let s=n(o.$locale??t,o,`ICU`);return c({source:e,target:a({locale:s.$locale,message:e,options:s}),options:s,sourceLocale:r})},[r,t,i,a])}function _e(e){let t=Q(e);return m((e,n={})=>{if(e==null)return e;let r=te(e)??{};return l(r)?t(r.$_source,r):t(e,n)},[t])}function ve(){let e=X(),t=J(),n=a().isDevHotReloadEnabled(),r=fe(),o=_(null);return o.current??=new Set,ye(o),m(a=>{let s=i(a);n&&o.current.add(s);let c=t.getDictionaryEntrySnapshot(a,e);return c==null&&n&&r(a),c},[t,e,n,r])}function ye(e){let t=_(0),n=J(),r=m(r=>n.subscribeToDictionaryEntryEvents(n=>{let a=i(n);e.current.has(a)&&(t.current++,r())}),[n]),a=m(()=>t.current,[]);v(r,a,a)}function be(){let e=X(),t=J(),n=a().isDevHotReloadEnabled(),r=pe(),o=_(null);return o.current??=new Set,xe(o),m(a=>{let s=i(a);n&&o.current.add(s);let c=t.getDictionaryObjectSnapshot(a,e);return c==null&&n&&r(a),c},[t,e,n,r])}function xe(e){let t=_(0),n=J(),r=m(r=>n.subscribeToDictionaryObjectEvents(n=>{let a=i(n);e.current.has(a)&&(t.current++,r())}),[n]),a=m(()=>t.current,[]);v(r,a,a)}function Se(e){let t=M(),n=I(),i=H(),a=Q(),o=ve(),s=Ce(e),c=m((s,c={})=>{let l=$(e,s),d=o({locale:n,id:l});if(d===void 0)throw Error(`Dictionary entry ${l} cannot be found`);let p=f(d.options);if(!i)return a(d.entry,{...p,...r(c),$locale:n});let m=o({locale:t,id:l});return m?.entry==null?a(d.entry,{...p,...r(c),$locale:t}):u({sourceLocale:n,targetLocale:t,sourceEntry:d,target:m.entry,dictionaryOptions:p,options:c})},[n,a,e,t,o,i]);return g(()=>Object.assign(c,{obj:s}),[c,s])}function Ce(e){let t=M(),n=I(),r=H(),i=Q(),a=be();return m(o=>{let s=$(e,o),c=a({locale:n,id:s});if(c===void 0)throw Error(`Dictionary entry ${s} cannot be found`);let l;return r&&(l=a({locale:t,id:s})),d({sourceObject:c,targetObject:l,translate:(e,a)=>i(e.entry,{...a,$locale:r?t:n})})},[n,e,t,a,r,i])}function $(e,t){return e?`${e}.${t}`:t}function we(e){let t=L(),n=F(),r=M(),i=g(()=>{if(!t||t.length===0)return[];let e=new Intl.Collator;return[...t].sort((t,i)=>e.compare(y(t,r,n).nativeNameWithRegionCode,y(i,r,n).nativeNameWithRegionCode))},[t,r,n]),a=m(e=>y(e,e,n),[r,n]);return{locale:r,locales:e||i,getLocaleProperties:a}}function Te({regions:e,customMapping:t,prioritizeCurrentLocaleRegion:n=!0,sortRegionsAlphabetically:r=!0}={}){let i=L(),o=F(),s=M(),c=N(),{regionCode:l}=y(s,s,o),[u,d]=g(()=>{let c=a().getGTClass(s),u=new Map(i.map(e=>{let t=y(e,s,o);return[t.regionCode,t]})),d=e?[...e]:Array.from(u?.keys()||[l]),f=new Map(d.map(e=>[e,{locale:u?.get(e)?.code||s,...c.getRegionProperties(e),...typeof t?.[e]==`string`?{name:t?.[e]}:t?.[e]}]));if(r&&d.sort((e,t)=>new Intl.Collator().compare(f.get(e).name,f.get(t).name)),n){let e=d.indexOf(l);e>0&&(d.splice(e,1),d.unshift(l))}return[d,f]},[e,t,s,l,i,o,n,r]);return{region:c,regions:u,regionData:d,locale:s,localeRegion:l}}export{j as useConditionStore,F as useCustomMapping,I as useDefaultLocale,P as useEnableI18n,V as useFormatLocales,Q as useGT,U as useGTClass,we as useInternalLocaleSelector,Te as useInternalRegionSelector,M as useLocale,G as useLocaleDirection,W as useLocaleProperties,L as useLocales,_e as useMessages,N as useRegion,H as useShouldTranslate,Se as useTranslations,K as useVersionId};
2
- //# sourceMappingURL=hooks.esm.min.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.esm.min.mjs","names":["getI18nConfig","getBaseI18nConfig","getI18nConfig","getReactCoreGlobals","getI18nConfig","EMPTY_LOCALES_PROP","getI18nConfig","useSubscribeToLookups","useSubscribeToLookups"],"sources":["../../core/dist/base64-r7YWJYWt.mjs","../src/setup/i18nConfig.ts","../src/condition-store/singleton-operations.ts","../src/context/context.ts","../src/hooks/condition-store.ts","../src/hooks/i18n-config.ts","../src/hooks/utils/getFormatLocales.ts","../src/hooks/utils.ts","../src/i18n-store/singleton-operations.ts","../src/i18n-store/useI18nStore.ts","../src/hooks/utils/missing-translation.ts","../src/hooks/external-store/useTrackedTranslationResolver.ts","../src/hooks/useGT.ts","../src/hooks/useMessages.ts","../src/hooks/external-store/useTrackedDictionaryResolver.ts","../src/hooks/external-store/useTrackedDictionaryObjResolver.ts","../src/hooks/useTranslations.ts","../src/hooks/useInternalLocaleSelector.ts","../src/hooks/useInternalRegionSelector.ts"],"sourcesContent":["//#region src/settings/settings.ts\nconst libraryDefaultLocale = \"en\";\nconst defaultTimeout = 6e4;\n//#endregion\n//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction lowercaseFirstWord(text) {\n\treturn text.replace(/^[A-Z][a-z]/, (match) => match.toLowerCase());\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${lowercaseFirstWord(stripSentence(why))}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${lowercaseFirstWord(stripSentence(wayOut))}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\n//#region src/settings/settingsUrls.ts\nconst defaultCacheUrl = \"https://cdn.gtx.dev\";\nconst defaultBaseUrl = \"https://api2.gtx.dev\";\nconst defaultRuntimeApiUrl = \"https://runtime2.gtx.dev\";\n//#endregion\n//#region src/utils/isSupportedFileFormatTransform.ts\nconst SUPPORTED_TRANSFORMATIONS = {\n\tGTJSON: [\"GTJSON\"],\n\tJSON: [\"JSON\"],\n\tPO: [\"PO\"],\n\tPOT: [\"POT\", \"PO\"],\n\tYAML: [\"YAML\"],\n\tMDX: [\"MDX\"],\n\tMD: [\"MD\"],\n\tTS: [\"TS\"],\n\tJS: [\"JS\"],\n\tHTML: [\"HTML\"],\n\tTXT: [\"TXT\"],\n\tTWILIO_CONTENT_JSON: [\"TWILIO_CONTENT_JSON\"]\n};\n/**\n* This function checks if a file format transformation is supported during translation\n* @param from - The source file format.\n* @param to - The target file format.\n* @returns True if the transformation is supported, false otherwise\n*/\nfunction isSupportedFileFormatTransform(from, to) {\n\treturn SUPPORTED_TRANSFORMATIONS[from]?.includes(to) ?? false;\n}\n//#endregion\n//#region src/translate/utils/validateFileFormatTransform.ts\n/**\n* Returns a user-facing validation error when a requested file format transform\n* is missing source format context or is not currently supported.\n*/\nfunction getFileFormatTransformError(file) {\n\tif (!file.transformFormat) return void 0;\n\tconst fileLabel = file.fileName ?? file.fileId ?? \"unknown file\";\n\tif (!file.fileFormat) return `fileFormat is required when transformFormat is provided for ${fileLabel}`;\n\tif (!isSupportedFileFormatTransform(file.fileFormat, file.transformFormat)) return `Unsupported file format transform: ${file.fileFormat} -> ${file.transformFormat}`;\n}\n/**\n* Validates file format transforms before sending upload/enqueue requests.\n*/\nfunction validateFileFormatTransforms(files) {\n\tfor (const file of files) {\n\t\tconst error = getFileFormatTransformError(file);\n\t\tif (error) throw new Error(error);\n\t}\n}\n//#endregion\n//#region src/utils/base64.ts\nfunction encode(data) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(data, \"utf8\").toString(\"base64\");\n\tconst bytes = new TextEncoder().encode(data);\n\tlet binary = \"\";\n\tfor (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);\n\treturn btoa(binary);\n}\nfunction decode(base64) {\n\tif (typeof Buffer !== \"undefined\") return Buffer.from(base64, \"base64\").toString(\"utf8\");\n\tconst binary = atob(base64);\n\tconst bytes = new Uint8Array(binary.length);\n\tfor (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n\treturn new TextDecoder().decode(bytes);\n}\n//#endregion\nexport { defaultBaseUrl as a, createDiagnosticMessage as c, libraryDefaultLocale as d, isSupportedFileFormatTransform as i, formatDiagnosticErrorDetails as l, encode as n, defaultCacheUrl as o, validateFileFormatTransforms as r, defaultRuntimeApiUrl as s, decode as t, defaultTimeout as u };\n\n//# sourceMappingURL=base64-r7YWJYWt.mjs.map","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport {\n getI18nConfig as getBaseI18nConfig,\n I18nConfig,\n setI18nConfig as setBaseI18nConfig,\n} from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\n/**\n * Helps us distinguish behavior for SPA vs server-rendered apps.\n * - server-rendered apps must use context\n * - SPA apps can synchronously access the locale\n */\nexport type RenderStrategy = 'SPA' | 'server-render';\n\nconst defaultRenderStrategy: RenderStrategy = 'server-render';\n\nexport class ReactI18nConfig extends I18nConfig {\n private renderStrategy: RenderStrategy;\n\n constructor(\n params: I18nConfigParams = {},\n renderStrategy: RenderStrategy = defaultRenderStrategy\n ) {\n super(params);\n validateRenderStrategy(renderStrategy);\n this.renderStrategy = renderStrategy;\n }\n\n getRenderStrategy(): RenderStrategy {\n return this.renderStrategy;\n }\n}\n\nexport function getI18nConfig(): ReactI18nConfig {\n const i18nConfig = getBaseI18nConfig();\n if (isReactI18nConfig(i18nConfig)) {\n return i18nConfig;\n }\n throw new Error(\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot read ReactI18nConfig after base I18nConfig setup.',\n why: 'the internal I18nConfig singleton was initialized without react-core render strategy support',\n fix: 'Initialize GT through gt-react or @generaltranslation/react-core/pure.',\n })\n );\n}\n\nexport function setI18nConfig(nextI18nConfig: ReactI18nConfig): void {\n setBaseI18nConfig(nextI18nConfig);\n}\n\nexport function initializeI18nConfig(\n params: I18nConfigParams = {},\n renderStrategy: RenderStrategy = defaultRenderStrategy\n): ReactI18nConfig {\n const nextI18nConfig = new ReactI18nConfig(params, renderStrategy);\n setI18nConfig(nextI18nConfig);\n return nextI18nConfig;\n}\n\nfunction validateRenderStrategy(\n renderStrategy: RenderStrategy\n): asserts renderStrategy is RenderStrategy {\n if (renderStrategy === 'SPA' || renderStrategy === 'server-render') return;\n throw new Error(\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Invalid React render strategy.',\n why: `the render strategy must be \"SPA\" or \"server-render\", but received \"${String(renderStrategy)}\"`,\n fix: 'Initialize GT through gt-react or pass a valid render strategy.',\n })\n );\n}\n\nfunction isReactI18nConfig(\n i18nConfig: I18nConfig\n): i18nConfig is ReactI18nConfig {\n return i18nConfig instanceof ReactI18nConfig;\n}\n","import {\n createDiagnosticMessage,\n formatDiagnosticErrorDetails,\n libraryDefaultLocale,\n} from 'generaltranslation/internal';\nimport {\n createConditionStoreSingleton,\n getRuntimeEnvironment,\n} from 'gt-i18n/internal';\nimport type { ReadonlyConditionStoreInterface } from 'gt-i18n/internal/types';\nimport { getI18nConfig } from '../setup/i18nConfig';\n\nconst conditionStoreNotInitializedError = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot read GT runtime context before it has been initialized',\n why: 'The internal ConditionStore is unavailable',\n});\n\nconst { getConditionStore, setConditionStore, isConditionStoreInitialized } =\n createConditionStoreSingleton<ReadonlyConditionStoreInterface>(\n conditionStoreNotInitializedError\n );\n\n/**\n * Opinionated decision: add a safety wrapper around the condition store to be more forgiving in production\n * TODO: perhaps this is how condition store should always be accessed\n */\nfunction getReadonlyConditionStoreWithFallback(): ReadonlyConditionStoreInterface {\n try {\n return getConditionStore();\n } catch (error) {\n // Error handling\n const runtimeEnvironment = getRuntimeEnvironment();\n const renderStrategy = getI18nConfig().getRenderStrategy();\n const errorMessage = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot access ConditionStore before it is initialized.',\n details: formatDiagnosticErrorDetails(error),\n fix:\n renderStrategy === 'SPA'\n ? 'Initialize GT before reading GT runtime context.'\n : 'Add a <GTProvider> at the root of your component tree.',\n wayOut:\n runtimeEnvironment === 'development'\n ? undefined\n : renderStrategy === 'SPA'\n ? 'Request-specific values will fall back to the default configuration.'\n : 'Request-specific values will fall back to the default configuration. This may cause hydration mismatches.',\n });\n\n if (runtimeEnvironment === 'development') {\n throw new Error(errorMessage);\n } else {\n console.error(errorMessage);\n }\n\n // Fallback to default configuration (important: do not set globally)\n return {\n getLocale: () => libraryDefaultLocale,\n getRegion: () => undefined,\n getEnableI18n: () => true,\n setLocale: () => {},\n setRegion: () => {},\n setEnableI18n: () => {},\n };\n }\n}\n\nexport {\n getConditionStore as getReadonlyConditionStore,\n getReadonlyConditionStoreWithFallback,\n setConditionStore as setReadonlyConditionStore,\n isConditionStoreInitialized as isReadonlyConditionStoreInitialized,\n};\n","import {\n Dictionary,\n Hash,\n Locale,\n ReadonlyConditionStoreInterface,\n} from 'gt-i18n/internal/types';\nimport { Translation } from 'gt-i18n/types';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { createContext, useContext, type Context } from 'react';\nimport { I18nStore } from '../i18n-store/I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\nimport type {\n OnMissingTranslation,\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n} from '../hooks/utils/missing-translation';\n\nexport type GTContextType = {\n /**\n * Source of truth for translations, streamed from server\n * In SPA mode, these won't be accessible and translations\n * can be accessed via useSyncExternalStore() directly\n */\n translationsSnapshot: Record<Locale, Record<Hash, Translation>>;\n dictionariesSnapshot: Record<Locale, Dictionary>;\n /**\n * I18nStore allows us to sync state updates in ConditionStore and I18nCache\n * with renders\n */\n i18nStore: I18nStore;\n /**\n * ConditionStore should always remain separate from i18nStore as\n * it manages how we perform lookups\n */\n conditionStore: ReadonlyConditionStoreInterface;\n /**\n * Custom override behavior on missing translations\n * Used for server triggering tx hmr b/c no access to useEffect\n */\n onMissingTranslation?: OnMissingTranslation;\n onMissingDictionaryEntry?: OnMissingDictionaryEntry;\n onMissingDictionaryObj?: OnMissingDictionaryObj;\n};\n\ntype ReactCoreGlobals = {\n gtContext?: Context<GTContextType | undefined>;\n [key: string]: unknown;\n};\n\ntype GeneralTranslationGlobal = {\n reactCore?: ReactCoreGlobals;\n [key: string]: unknown;\n};\n\ntype GlobalWithGeneralTranslation = {\n __generaltranslation?: GeneralTranslationGlobal;\n};\n\nfunction getReactCoreGlobals(): ReactCoreGlobals {\n const globalObj = globalThis as unknown as GlobalWithGeneralTranslation;\n globalObj.__generaltranslation ??= {};\n // TODO: Consider checking package versions and using a compatibility matrix before sharing global singletons.\n globalObj.__generaltranslation.reactCore ??= {};\n return globalObj.__generaltranslation.reactCore;\n}\n\nexport function getGTContext(): Context<GTContextType | undefined> {\n const reactCoreGlobals = getReactCoreGlobals();\n reactCoreGlobals.gtContext ??= createContext<GTContextType | undefined>(\n undefined\n );\n return reactCoreGlobals.gtContext;\n}\n\nexport function useGTContext(): GTContextType | undefined {\n const context = useContext(getGTContext());\n if (context || getI18nConfig().getRenderStrategy() === 'SPA') {\n return context;\n }\n /**\n * TODO: in a separate PR, we should figure out how to make this more of a forgiving system\n */\n throw new Error(createMissingGTProviderError());\n}\n\nfunction createMissingGTProviderError(): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'GT runtime context could not be read',\n why: 'GTContext was accessed outside of a <GTProvider>',\n fix: 'Add a <GTProvider> at the root of your component tree.',\n });\n}\n","import { ReadonlyConditionStoreInterface } from 'gt-i18n/internal/types';\nimport { getReadonlyConditionStoreWithFallback } from '../condition-store/singleton-operations';\nimport { useGTContext } from '../context/context';\n\n/**\n * NOTE: useSetLocale() and useSetEnableI18n() are not implemented in @generaltranslation/react-core\n * Some server environments are read only, so we cannot implement these hooks.\n */\n\nexport function useConditionStore(): ReadonlyConditionStoreInterface {\n const context = useGTContext();\n return context?.conditionStore ?? getReadonlyConditionStoreWithFallback();\n}\n\n/**\n * Returns the current locale.\n */\nexport function useLocale(): string {\n return useConditionStore().getLocale();\n}\n\n/**\n * Returns the current region, or undefined if no region is set.\n */\nexport function useRegion(): string | undefined {\n return useConditionStore().getRegion();\n}\n\n/**\n * Returns the current enableI18n flag.\n */\nexport function useEnableI18n(): boolean {\n return useConditionStore().getEnableI18n();\n}\n","import { useMemo } from 'react';\nimport { getI18nConfig } from 'gt-i18n/internal';\nimport type { CustomMapping } from 'generaltranslation/types';\n\nexport function useCustomMapping(): CustomMapping {\n return useMemo(() => getI18nConfig().getCustomMapping(), []);\n}\n\nexport function useDefaultLocale(): string {\n return useMemo(() => getI18nConfig().getDefaultLocale(), []);\n}\n\nexport function useLocales(): readonly string[] {\n return useMemo(() => getI18nConfig().getLocales(), []);\n}\n","import { getI18nConfig } from 'gt-i18n/internal';\n\n// Pure helper shared by hook-based and RSC code paths. This module must stay\n// free of hook/context imports so it can be reached from the components-rsc\n// entrypoint.\n\nconst EMPTY_LOCALES_PROP: string[] = [];\n\nexport function getFormatLocales({\n locale,\n enableI18n,\n localesProp = EMPTY_LOCALES_PROP,\n}: {\n locale: string;\n enableI18n: boolean;\n localesProp?: string[];\n}): string[] {\n const defaultLocale = getI18nConfig().getDefaultLocale();\n const shouldTranslate =\n enableI18n && getI18nConfig().requiresTranslation(locale);\n return shouldTranslate\n ? [...localesProp, locale, defaultLocale]\n : [defaultLocale];\n}\n","import type { LocaleProperties } from '@generaltranslation/format/types';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { useMemo } from 'react';\nimport { useEnableI18n, useLocale } from './condition-store';\nimport { getFormatLocales } from './utils/getFormatLocales';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\nconst EMPTY_LOCALES_PROP: string[] = [];\n\nexport { getFormatLocales };\n\nexport function useFormatLocales(\n localesProp: string[] = EMPTY_LOCALES_PROP\n): string[] {\n const locale = useLocale();\n const enableI18n = useEnableI18n();\n return useMemo(\n () =>\n getFormatLocales({\n locale,\n enableI18n,\n localesProp,\n }),\n [locale, enableI18n, localesProp]\n );\n}\n\nexport function useShouldTranslate(): boolean {\n const enableI18n = useEnableI18n();\n const locale = useLocale();\n return enableI18n && getI18nConfig().requiresTranslation(locale);\n}\n\nexport function useGTClass() {\n return useMemo(() => getI18nConfig().getGTClass(), []);\n}\n\nexport function useLocaleProperties(locale: string): LocaleProperties {\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleProperties(locale),\n [locale]\n );\n}\n\nexport function useLocaleDirection(locale: string) {\n return useMemo(\n () => getI18nConfig().getGTClass().getLocaleDirection(locale),\n [locale]\n );\n}\n\nexport function useVersionId() {\n throw new Error(\n createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'useVersionId() is not implemented in this entry point',\n fix: 'Use getVersionId() or import useVersionId() from a supported runtime entry point.',\n })\n );\n}\n","import { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { I18nStore } from './I18nStore';\nimport { getI18nConfig } from '../setup/i18nConfig';\n\n// ===== I18n Store ===== //\n\ntype ReactCoreGlobals = {\n i18nStore?: I18nStore;\n [key: string]: unknown;\n};\n\ntype GeneralTranslationGlobal = {\n reactCore?: ReactCoreGlobals;\n [key: string]: unknown;\n};\n\ntype GlobalWithGeneralTranslation = {\n __generaltranslation?: GeneralTranslationGlobal;\n};\n\nfunction getReactCoreGlobals(): ReactCoreGlobals {\n const globalObj = globalThis as unknown as GlobalWithGeneralTranslation;\n globalObj.__generaltranslation ??= {};\n // TODO: Consider checking package versions and using a compatibility matrix before sharing global singletons.\n globalObj.__generaltranslation.reactCore ??= {};\n return globalObj.__generaltranslation.reactCore;\n}\n\nexport function getI18nStore(): I18nStore {\n const i18nStore = getReactCoreGlobals().i18nStore;\n if (!i18nStore) {\n throw createI18nStoreNotInitializedError();\n }\n return i18nStore;\n}\n\nexport function setI18nStore(nextStore: I18nStore): void {\n const reactCoreGlobals = getReactCoreGlobals();\n if (reactCoreGlobals.i18nStore && reactCoreGlobals.i18nStore !== nextStore) {\n console.warn(createI18nStoreOverwriteWarning());\n }\n reactCoreGlobals.i18nStore = nextStore;\n}\n\nexport function isI18nStoreInitialized(): boolean {\n return getReactCoreGlobals().i18nStore !== undefined;\n}\n\nfunction createI18nStoreNotInitializedError(): Error {\n const renderStrategy = getI18nConfig().getRenderStrategy();\n const errorMessage = createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Error',\n whatHappened: 'Cannot access I18nStore before it is initialized.',\n fix:\n renderStrategy === 'SPA'\n ? 'Initialize GT before reading GT runtime context.'\n : 'Add a <GTProvider> at the root of your component tree.',\n });\n\n return new Error(errorMessage);\n}\n\nfunction createI18nStoreOverwriteWarning(): string {\n return createDiagnosticMessage({\n source: '@generaltranslation/react-core',\n severity: 'Warning',\n whatHappened: 'Overwriting global i18nStore singleton instance',\n });\n}\n","import { Dictionary, Hash, Locale } from 'gt-i18n/internal/types';\nimport { useGTContext } from '../context/context';\nimport { I18nStore } from './I18nStore';\nimport { getI18nStore } from './singleton-operations';\nimport { Translation } from 'gt-i18n/types';\n\nexport function useI18nStore(): I18nStore {\n const context = useGTContext();\n return context?.i18nStore || getI18nStore();\n}\n\nexport function useTranslationsSnapshot(): Record<\n Locale,\n Record<Hash, Translation>\n> {\n const context = useGTContext();\n return context?.translationsSnapshot || {};\n}\n\nexport function useDictionariesSnapshot(): Record<Locale, Dictionary> {\n const context = useGTContext();\n return context?.dictionariesSnapshot || {};\n}\n","import {\n getDictionaryListenerKey,\n getI18nConfig,\n getTranslateListenerKey,\n} from 'gt-i18n/internal';\nimport { useShouldTranslate } from '../utils';\nimport { useI18nStore } from '../../i18n-store/useI18nStore';\nimport { DictionaryLookup, TranslateLookup } from '../../i18n-store/storeTypes';\nimport { useCallback, useEffect } from 'react';\nimport { Translation } from 'gt-i18n/types';\nimport { useGTContext } from '../../context/context';\n\nexport type OnMissingTranslation = <T extends Translation>(\n lookup: TranslateLookup<T>\n) => void;\nexport type OnMissingDictionaryEntry = (lookup: DictionaryLookup) => void;\n// TODO: rename to OnMissingDictionaryObject\nexport type OnMissingDictionaryObj = (lookup: DictionaryLookup) => void;\n\ntype PendingLookup =\n | {\n type: 'translation';\n lookup: TranslateLookup;\n }\n | {\n type: 'dictionaryEntry' | 'dictionaryObject';\n lookup: DictionaryLookup;\n };\n\n/**\n * Why have custom handleMissing functions?\n *\n * Some runtimes (like server) cannot make useEffect calls, so\n * we need to give them access to a callback where they can embed\n * their own translation calls\n *\n * While this is technnically not pure behavior, this is acceptable\n * in development hot reload\n */\n\n// TODO: reduce code duplication with the three below functions\nexport function useHandleMissingTranslation(): OnMissingTranslation {\n const customHandleMissing = useGTContext()?.onMissingTranslation;\n const pureHandleMissing = useDevHotReloadQueue();\n\n return useCallback(\n (lookup: TranslateLookup) => {\n if (customHandleMissing) {\n customHandleMissing(lookup);\n } else {\n pureHandleMissing(getTranslateListenerKey(lookup), {\n type: 'translation',\n lookup,\n });\n }\n },\n [customHandleMissing, pureHandleMissing]\n );\n}\n\nexport function useHandleMissingDictionaryEntry(): OnMissingDictionaryEntry {\n const customHandleMissing = useGTContext()?.onMissingDictionaryEntry;\n const pureHandleMissing = useDevHotReloadQueue();\n\n return useCallback(\n (lookup: DictionaryLookup) => {\n if (customHandleMissing) {\n customHandleMissing(lookup);\n } else {\n pureHandleMissing(getDictionaryListenerKey(lookup), {\n type: 'dictionaryEntry',\n lookup,\n });\n }\n },\n [customHandleMissing, pureHandleMissing]\n );\n}\n\nexport function useHandleMissingDictionaryObject(): OnMissingDictionaryObj {\n const customHandleMissing = useGTContext()?.onMissingDictionaryObj;\n const pureHandleMissing = useDevHotReloadQueue();\n return useCallback(\n (lookup: DictionaryLookup) => {\n if (customHandleMissing) {\n customHandleMissing(lookup);\n } else {\n pureHandleMissing(getDictionaryListenerKey(lookup), {\n type: 'dictionaryObject',\n lookup,\n });\n }\n },\n [customHandleMissing, pureHandleMissing]\n );\n}\n\n/**\n * HMR translation needs to be deferred to post-commit phase\n */\nfunction useDevHotReloadQueue() {\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const shouldTranslate = useShouldTranslate();\n const i18nStore = useI18nStore();\n\n // No memoization bc we want to flush after every render\n // TODO: perhaps should find a way to memoize and flush in a better way than this as it nullifies any useCallback\n const pendingLookups = new Map<string, PendingLookup>();\n\n // Pure react: effects run after render\n useEffect(() => {\n if (!devHotReloadEnabled || !shouldTranslate || pendingLookups.size === 0) {\n return;\n }\n\n pendingLookups.forEach(({ type, lookup }) => {\n switch (type) {\n case 'translation':\n i18nStore.translate(lookup);\n break;\n case 'dictionaryEntry':\n i18nStore.translateDictionaryEntry(lookup);\n break;\n case 'dictionaryObject':\n i18nStore.translateDictionaryObject(lookup);\n break;\n }\n });\n }, [devHotReloadEnabled, shouldTranslate, i18nStore, pendingLookups]);\n\n // No need for useCallback b/c we want access to the pendingLookups map\n return (key: string, pendingLookup: PendingLookup) => {\n pendingLookups.set(key, pendingLookup);\n };\n}\n","import {\n type RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from 'react';\nimport {\n createLookupOptions,\n getI18nConfig,\n getTranslateListenerKey,\n} from 'gt-i18n/internal';\nimport type { Translation } from 'gt-i18n/types';\nimport type {\n StoreListener,\n TranslateLookup,\n TranslateSnapshot,\n} from '../../i18n-store/storeTypes';\nimport type { InlineTranslationOptionsFields } from 'gt-i18n/internal/types';\nimport type { StringFormat } from '@generaltranslation/format';\nimport { useLocale } from '../condition-store';\nimport { useShouldTranslate } from '../utils';\nimport {\n useI18nStore,\n useTranslationsSnapshot,\n} from '../../i18n-store/useI18nStore';\nimport { useHandleMissingTranslation } from '../utils/missing-translation';\n\n/**\n * Returns the translation, but also triggers a translation if it is not found\n * when dev hot reload is enabled.\n */\nexport type TrackedTranslationResolver = <T extends Translation>(\n lookup: TranslateLookup<T>\n) => TranslateSnapshot<T>;\n\nexport type Message = InlineTranslationOptionsFields & {\n message: string;\n};\n\n/**\n * NOTE:\n * gt() may be called during render, so tracking intentionally only mutates\n * hook-local refs. This widens the event filter used by our existing\n * useSyncExternalStore subscription, but does not update React state or mutate\n * the translation cache during render.\n *\n * A render that is later aborted may leave behind an extra tracked key. That is\n * acceptable for dev hot reload because the worst case is an unnecessary\n * invalidation for this hook instance, not incorrect rendered output.\n */\n\nexport function useTrackedTranslationResolver(\n messages: Message[] = []\n): TrackedTranslationResolver {\n const translationsSnapshot = useTranslationsSnapshot();\n const i18nStore = useI18nStore();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const onMissingTranslation = useHandleMissingTranslation();\n\n /**\n * Track lookups per hook instance without updating React state during render.\n */\n const trackedKeysRef = useRef<Set<string> | null>(null);\n if (trackedKeysRef.current == null) {\n trackedKeysRef.current = new Set();\n }\n\n // (optimization) Pre-subscribe to compiler-injected lookups\n usePreloadCompilerLookups(messages, trackedKeysRef);\n\n // (tx hot reload) Subscribe to translation updates\n useSubscribeToLookups(trackedKeysRef);\n\n /**\n * Remember that we can make no assumptions about when this cb gets invoked\n * - Resolves translation from lookup\n * - enqueues dev hot reload (if needed)\n */\n return useCallback(\n <T extends Translation>(\n lookup: TranslateLookup<T>\n ): TranslateSnapshot<T> => {\n // Track the lookup for dev hot reload\n const lookupKey = getTranslateListenerKey(lookup);\n if (devHotReloadEnabled) {\n trackedKeysRef.current!.add(lookupKey);\n }\n\n // Resolve the translation from the store\n const translation = i18nStore.getTranslateSnapshot(\n lookup,\n translationsSnapshot\n );\n\n // Trigger a hot reload if the translation is not found\n if (translation == null && devHotReloadEnabled) {\n onMissingTranslation(lookup);\n }\n return translation;\n },\n [i18nStore, translationsSnapshot, onMissingTranslation, devHotReloadEnabled]\n );\n}\n\n/**\n * Subscribe to translation updates, but only trigger re-renders\n * if the lookup is in the tracked keys. Remember that we can make\n * no assumptions about when this list gets updated. Technically,\n * not pure, but this is an acceptable trade since this is\n * really just for translation hot reload.\n *\n * TODO: (separate PR) we can probably do better filtering for adding to the set since this is primarily dev only\n * TODO: reduce code duplication with the other two useSubscribeToLookups functions\n */\nfunction useSubscribeToLookups(trackedKeysRef: RefObject<Set<string> | null>) {\n // invalidation counter for triggering updates\n const versionRef = useRef(0);\n const i18nStore = useI18nStore();\n const subscribe = useCallback(\n (listener: StoreListener) => {\n return i18nStore.subscribeToTranslationEvents((lookup) => {\n const key = getTranslateListenerKey(lookup);\n if (!trackedKeysRef.current!.has(key)) return;\n versionRef.current++;\n listener();\n });\n },\n [i18nStore]\n );\n const getSnapshot = useCallback(() => {\n return versionRef.current;\n }, []);\n\n useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n\n/**\n * Pre-subscribe to compiler-injected lookups\n * trigger translations for them\n *\n * This ref mutation is safe because this is translation hot reload only\n * and effects are deterministic\n */\nfunction usePreloadCompilerLookups(\n messages: Message[],\n trackedKeysRef: RefObject<Set<string> | null>\n) {\n const i18nStore = useI18nStore();\n const locale = useLocale();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const shouldTranslate = useShouldTranslate();\n const translationsSnapshot = useTranslationsSnapshot();\n const txHotReloadEnabled = useMemo(() => {\n return messages?.length > 0 && shouldTranslate && devHotReloadEnabled;\n }, [messages, shouldTranslate, devHotReloadEnabled]);\n\n // Precompute as much as we can\n const lookups: [TranslateLookup<string>, string][] = useMemo(() => {\n if (!txHotReloadEnabled) return [];\n return messages.map(({ message, ...options }) => {\n const targetLocale = options.$locale ?? locale;\n const lookupOptions = createLookupOptions<StringFormat>(\n targetLocale,\n options,\n 'ICU'\n );\n const lookup = {\n locale: targetLocale,\n message,\n options: lookupOptions,\n };\n return [lookup, getTranslateListenerKey(lookup)];\n });\n }, [locale, txHotReloadEnabled, messages]);\n\n // Pre-subscribe to the lookups\n if (txHotReloadEnabled) {\n lookups.forEach(([, lookupKey]) => {\n trackedKeysRef.current!.add(lookupKey);\n });\n }\n\n /**\n * Delegate non-pure operations to post commit\n *\n * (Optimization) Trigger a hot reload if the translation is not found\n * for compiler-injected lookups\n *\n * TODO: for use() + suspense strategy, use a Promise.all()\n * TODO: server side translation invocation\n */\n useEffect(() => {\n if (!txHotReloadEnabled) return;\n\n lookups\n .filter(\n ([lookup]) =>\n i18nStore.getTranslateSnapshot(lookup, translationsSnapshot) == null\n )\n .forEach(([lookup]) => i18nStore.translate(lookup));\n }, [txHotReloadEnabled, i18nStore, lookups, translationsSnapshot]);\n}\n","import { useCallback } from 'react';\nimport { createLookupOptions, interpolateMessage } from 'gt-i18n/internal';\nimport { useLocale } from './condition-store';\nimport { useShouldTranslate } from './utils';\nimport type { GTFunctionType, InlineTranslationOptions } from 'gt-i18n/types';\nimport type { StringFormat } from '@generaltranslation/format/types';\nimport { useDefaultLocale } from './i18n-config';\nimport {\n type Message,\n useTrackedTranslationResolver,\n} from './external-store/useTrackedTranslationResolver';\n\n// ===== Hook ===== //\n\nexport function useGT(_messages?: Message[]): GTFunctionType {\n const locale = useLocale();\n const defaultLocale = useDefaultLocale();\n const shouldTranslate = useShouldTranslate();\n const resolveTranslation = useTrackedTranslationResolver(_messages);\n\n /**\n * gt() string translation callback\n */\n return useCallback(\n (message: string, options: InlineTranslationOptions = {}) => {\n if (!shouldTranslate) {\n return interpolateMessage({\n options,\n source: message,\n sourceLocale: defaultLocale,\n });\n }\n\n const lookupOptions = createLookupOptions<StringFormat>(\n options.$locale ?? locale,\n options,\n 'ICU'\n );\n const translation = resolveTranslation({\n locale: lookupOptions.$locale,\n message,\n options: lookupOptions,\n });\n\n return interpolateMessage({\n source: message,\n target: translation,\n options: lookupOptions,\n sourceLocale: defaultLocale,\n });\n },\n [defaultLocale, locale, shouldTranslate, resolveTranslation]\n );\n}\n","import { useCallback } from 'react';\nimport { decodeOptions } from 'gt-i18n';\nimport { useGT } from './useGT';\nimport type { InlineResolveOptions, MFunctionType } from 'gt-i18n/types';\nimport { isEncodedTranslationOptions } from 'gt-i18n/internal';\nimport { Message } from './external-store/useTrackedTranslationResolver';\n\n// ===== Hook ===== //\n\nexport function useMessages(_messages?: Message[]): MFunctionType {\n const gt = useGT(_messages);\n\n return useCallback(\n <T extends string | null | undefined>(\n encodedMsg: T,\n options: InlineResolveOptions = {}\n ): T extends string ? string : T => {\n if (encodedMsg == null) {\n return encodedMsg as T extends string ? string : T;\n }\n\n const decodedOptions = decodeOptions(encodedMsg) ?? {};\n if (isEncodedTranslationOptions(decodedOptions)) {\n return gt(decodedOptions.$_source, decodedOptions) as T extends string\n ? string\n : T;\n }\n\n return gt(encodedMsg, options) as T extends string ? string : T;\n },\n [gt]\n );\n}\n","import { useCallback, useRef } from 'react';\nimport {\n useDictionariesSnapshot,\n useI18nStore,\n} from '../../i18n-store/useI18nStore';\nimport type {\n DictionaryEntrySnapshot,\n DictionaryLookup,\n StoreListener,\n} from '../../i18n-store/storeTypes';\nimport { getDictionaryListenerKey, getI18nConfig } from 'gt-i18n/internal';\nimport { useSyncExternalStore } from 'react';\nimport type { RefObject } from 'react';\nimport { useHandleMissingDictionaryEntry } from '../utils/missing-translation';\n\nexport type TrackedDictionaryEntryResolver = (\n lookup: DictionaryLookup\n) => DictionaryEntrySnapshot;\n\n// TODO: rename to useTrackedDictionaryEntryResolver\nexport function useTrackedDictionaryResolver(): TrackedDictionaryEntryResolver {\n const dictionariesSnapshot = useDictionariesSnapshot();\n const i18nStore = useI18nStore();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const onMissingDictionaryEntry = useHandleMissingDictionaryEntry();\n\n const trackedKeysRef = useRef<Set<string> | null>(null);\n if (trackedKeysRef.current == null) {\n trackedKeysRef.current = new Set();\n }\n\n // subscribe to dictionary entry updates\n useSubscribeToLookups(trackedKeysRef);\n\n // Resolution callback\n return useCallback(\n (lookup: DictionaryLookup) => {\n // Track the lookup for dev hot reload\n const lookupKey = getDictionaryListenerKey(lookup);\n if (devHotReloadEnabled) {\n trackedKeysRef.current!.add(lookupKey);\n }\n\n // Resolve the dictionary entry from the store\n const dictionaryEntry = i18nStore.getDictionaryEntrySnapshot(\n lookup,\n dictionariesSnapshot\n );\n\n // Hot reload\n if (dictionaryEntry == null && devHotReloadEnabled) {\n onMissingDictionaryEntry(lookup);\n }\n\n return dictionaryEntry;\n },\n [\n i18nStore,\n dictionariesSnapshot,\n devHotReloadEnabled,\n onMissingDictionaryEntry,\n ]\n );\n}\n\nfunction useSubscribeToLookups(trackedKeysRef: RefObject<Set<string> | null>) {\n // invalidation counter for triggering updates\n const versionRef = useRef(0);\n const i18nStore = useI18nStore();\n const subscribe = useCallback(\n (listener: StoreListener) => {\n return i18nStore.subscribeToDictionaryEntryEvents((lookup) => {\n const key = getDictionaryListenerKey(lookup);\n if (!trackedKeysRef.current!.has(key)) return;\n versionRef.current++;\n listener();\n });\n },\n [i18nStore]\n );\n const getSnapshot = useCallback(() => {\n return versionRef.current;\n }, []);\n\n useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n","import { getDictionaryListenerKey, getI18nConfig } from 'gt-i18n/internal';\nimport type {\n DictionaryLookup,\n DictionaryObjectSnapshot,\n StoreListener,\n} from '../../i18n-store/storeTypes';\nimport {\n useDictionariesSnapshot,\n useI18nStore,\n} from '../../i18n-store/useI18nStore';\nimport {\n type RefObject,\n useCallback,\n useRef,\n useSyncExternalStore,\n} from 'react';\nimport { useHandleMissingDictionaryObject } from '../utils/missing-translation';\n\nexport type TrackedDictionaryObjResolver = (\n lookup: DictionaryLookup\n) => DictionaryObjectSnapshot;\n\n// TODO: rename to useTrackedDictionaryObjectResolver\nexport function useTrackedDictionaryObjResolver(): TrackedDictionaryObjResolver {\n const dictionariesSnapshot = useDictionariesSnapshot();\n const i18nStore = useI18nStore();\n const devHotReloadEnabled = getI18nConfig().isDevHotReloadEnabled();\n const onMissingDictionaryObj = useHandleMissingDictionaryObject();\n\n const trackedKeysRef = useRef<Set<string> | null>(null);\n if (trackedKeysRef.current == null) {\n trackedKeysRef.current = new Set();\n }\n\n // subscribe to dictionary entry updates\n useSubscribeToLookups(trackedKeysRef);\n\n // Resolution callback\n return useCallback(\n (lookup: DictionaryLookup) => {\n // Track the lookup for dev hot reload\n const lookupKey = getDictionaryListenerKey(lookup);\n if (devHotReloadEnabled) {\n trackedKeysRef.current!.add(lookupKey);\n }\n\n // Resolve the dictionary entry from the store\n const dictionaryObject = i18nStore.getDictionaryObjectSnapshot(\n lookup,\n dictionariesSnapshot\n );\n\n // Hot reload\n if (dictionaryObject == null && devHotReloadEnabled) {\n onMissingDictionaryObj(lookup);\n }\n\n return dictionaryObject;\n },\n [\n i18nStore,\n dictionariesSnapshot,\n devHotReloadEnabled,\n onMissingDictionaryObj,\n ]\n );\n}\n\nfunction useSubscribeToLookups(trackedKeysRef: RefObject<Set<string> | null>) {\n // invalidation counter for triggering updates\n const versionRef = useRef(0);\n const i18nStore = useI18nStore();\n const subscribe = useCallback(\n (listener: StoreListener) => {\n return i18nStore.subscribeToDictionaryObjectEvents((lookup) => {\n const key = getDictionaryListenerKey(lookup);\n if (!trackedKeysRef.current!.has(key)) return;\n versionRef.current++;\n listener();\n });\n },\n [i18nStore]\n );\n const getSnapshot = useCallback(() => {\n return versionRef.current;\n }, []);\n\n useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n}\n","import { useCallback, useMemo } from 'react';\nimport {\n extractVariables,\n renderDictionaryEntry,\n renderDictionaryObject,\n resolveDictionaryLookupOptions,\n} from 'gt-i18n/internal';\nimport { useLocale } from './condition-store';\nimport { useGT } from './useGT';\nimport type {\n DictionaryObjectTranslation,\n DictionaryTranslationOptions,\n} from 'gt-i18n/types';\nimport { useDefaultLocale } from './i18n-config';\nimport { useShouldTranslate } from './utils';\nimport { useTrackedDictionaryResolver } from './external-store/useTrackedDictionaryResolver';\nimport { useTrackedDictionaryObjResolver } from './external-store/useTrackedDictionaryObjResolver';\n\n// ===== Hook ===== //\n\nexport function useTranslations(rootId?: string): UseTranslationsFunction {\n const locale = useLocale();\n const defaultLocale = useDefaultLocale();\n const shouldTranslate = useShouldTranslate();\n const gt = useGT();\n const resolveDictionaryEntry = useTrackedDictionaryResolver();\n const translateObject = useTranslationsObj(rootId);\n\n const translateEntry = useCallback(\n (suffix: string, options: DictionaryTranslationOptions = {}) => {\n const id = getId(rootId, suffix);\n\n const sourceEntry = resolveDictionaryEntry({\n locale: defaultLocale,\n id,\n });\n if (sourceEntry === undefined) {\n throw new Error(`Dictionary entry ${id} cannot be found`);\n }\n const sourceOptions = resolveDictionaryLookupOptions(sourceEntry.options);\n if (!shouldTranslate) {\n return gt(sourceEntry.entry, {\n ...sourceOptions,\n ...extractVariables(options),\n $locale: defaultLocale,\n });\n }\n\n const targetEntry = resolveDictionaryEntry({ locale, id });\n if (targetEntry?.entry != null) {\n return renderDictionaryEntry({\n sourceLocale: defaultLocale,\n targetLocale: locale,\n sourceEntry,\n target: targetEntry.entry,\n dictionaryOptions: sourceOptions,\n options,\n });\n }\n\n return gt(sourceEntry.entry, {\n ...sourceOptions,\n ...extractVariables(options),\n $locale: locale,\n });\n },\n [defaultLocale, gt, rootId, locale, resolveDictionaryEntry, shouldTranslate]\n );\n\n return useMemo(\n () => Object.assign(translateEntry, { obj: translateObject }),\n [translateEntry, translateObject]\n );\n}\n\nfunction useTranslationsObj(rootId?: string): UseTranslationsObjFunction {\n const locale = useLocale();\n const defaultLocale = useDefaultLocale();\n const shouldTranslate = useShouldTranslate();\n const gt = useGT();\n const resolveDictionaryObject = useTrackedDictionaryObjResolver();\n\n return useCallback(\n (suffix: string) => {\n const entryId = getId(rootId, suffix);\n const sourceObject = resolveDictionaryObject({\n locale: defaultLocale,\n id: entryId,\n });\n if (sourceObject === undefined) {\n throw new Error(`Dictionary entry ${entryId} cannot be found`);\n }\n\n let targetObject = undefined;\n if (shouldTranslate) {\n const targetLookup = { locale, id: entryId };\n targetObject = resolveDictionaryObject(targetLookup);\n }\n\n return renderDictionaryObject({\n sourceObject,\n targetObject,\n translate: (sourceEntry, dictionaryOptions) =>\n gt(sourceEntry.entry, {\n ...dictionaryOptions,\n $locale: shouldTranslate ? locale : defaultLocale,\n }),\n });\n },\n [\n defaultLocale,\n rootId,\n locale,\n resolveDictionaryObject,\n shouldTranslate,\n gt,\n ]\n );\n}\n\n// ===== Lookup Helpers ===== //\n\nfunction getId(prefix: string | undefined, suffix: string): string {\n return prefix ? `${prefix}.${suffix}` : suffix;\n}\n\n// ===== Types ===== //\n\nexport type UseTranslationsFunction = ((\n id: string,\n options?: DictionaryTranslationOptions\n) => string) & {\n obj: (id: string) => DictionaryObjectTranslation;\n};\n\ntype UseTranslationsObjFunction = (id: string) => DictionaryObjectTranslation;\n","import { useCallback, useMemo } from 'react';\nimport { useCustomMapping, useLocales } from './i18n-config';\nimport { useLocale } from './condition-store';\nimport { getLocaleProperties } from 'generaltranslation';\n\nexport function useInternalLocaleSelector(locales?: string[]) {\n // Retrieve the locale, locales, and setLocale function\n const contextLocales = useLocales();\n const customMapping = useCustomMapping();\n const locale = useLocale();\n\n // sort\n const sortedLocales = useMemo(() => {\n if (!contextLocales || contextLocales.length === 0) {\n return [];\n }\n const collator = new Intl.Collator();\n return [...contextLocales].sort((a, b) =>\n collator.compare(\n getLocaleProperties(a, locale, customMapping).nativeNameWithRegionCode,\n getLocaleProperties(b, locale, customMapping).nativeNameWithRegionCode\n )\n );\n }, [contextLocales, locale, customMapping]);\n\n // create getLocaleProperties callback\n const getLocalePropertiesCallback = useCallback(\n (locale: string) => {\n return getLocaleProperties(locale, locale, customMapping);\n },\n [locale, customMapping]\n );\n\n return {\n locale,\n locales: locales ? locales : sortedLocales,\n getLocaleProperties: getLocalePropertiesCallback,\n };\n}\n","import { useMemo } from 'react';\nimport { useCustomMapping, useLocales } from './i18n-config';\nimport { useLocale, useRegion } from './condition-store';\nimport { getLocaleProperties } from 'generaltranslation';\nimport { getI18nConfig } from 'gt-i18n/internal';\n\nexport type RegionData = {\n code: string;\n name: string;\n emoji: string;\n locale: string;\n};\n\nexport type InternalRegionSelectorOptions = {\n regions?: string[];\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n};\n\n/**\n * Internal logic for region selection in applications supporting multiple regions.\n *\n * Returns the current region, an ordered list of available regions (inferred\n * from the supported locales when not provided), and a map of region codes to\n * their display data (name, emoji, associated locale).\n */\nexport function useInternalRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion = true,\n sortRegionsAlphabetically = true,\n}: InternalRegionSelectorOptions = {}) {\n // Retrieve the locale, locales, and region\n const contextLocales = useLocales();\n const localeCustomMapping = useCustomMapping();\n const locale = useLocale();\n const region = useRegion();\n const { regionCode: localeRegion } = getLocaleProperties(\n locale,\n locale,\n localeCustomMapping\n );\n\n const [\n regions, // ordered list of ISO 3166 region codes\n regionData, // map of ISO 3166 region codes to region display data, potentially not ordered\n ] = useMemo<[string[], Map<string, RegionData>]>(() => {\n const gt = getI18nConfig().getGTClass(locale);\n const regionToLocaleMap = new Map(\n contextLocales.map((l) => {\n const lp = getLocaleProperties(l, locale, localeCustomMapping); // has to be directly called so sourceLocale can be in the user's current locale\n return [lp.regionCode, lp];\n })\n );\n\n const regions = _regions\n ? [..._regions]\n : Array.from(regionToLocaleMap?.keys() || [localeRegion]);\n\n const regionData = new Map<string, RegionData>(\n regions.map((r: string) => {\n return [\n r,\n {\n locale: regionToLocaleMap?.get(r)?.code || locale,\n ...gt.getRegionProperties(r),\n ...(typeof customMapping?.[r] === 'string'\n ? { name: customMapping?.[r] }\n : customMapping?.[r]),\n },\n ];\n })\n );\n\n if (sortRegionsAlphabetically) {\n regions.sort((a, b) =>\n new Intl.Collator().compare(\n regionData.get(a)!.name,\n regionData.get(b)!.name\n )\n );\n }\n\n if (prioritizeCurrentLocaleRegion) {\n const localeRegionIndex = regions.indexOf(localeRegion);\n if (localeRegionIndex > 0) {\n // 0 because no action is needed if it's already at the start\n regions.splice(localeRegionIndex, 1);\n regions.unshift(localeRegion);\n }\n }\n\n return [regions, regionData];\n }, [\n _regions,\n customMapping,\n locale,\n localeRegion,\n contextLocales,\n localeCustomMapping,\n prioritizeCurrentLoc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,CACvC,EAAoB,IAAI,IAC5B,EAAe,IAAK,GAAM,CACxB,IAAM,EAAK,EAAoB,EAAG,EAAQ,EAAoB,CAC9D,MAAO,CAAC,EAAG,WAAY,EAAG,EAC1B,CACH,CAEK,EAAU,EACZ,CAAC,GAAG,EAAS,CACb,MAAM,KAAK,GAAmB,MAAM,EAAI,CAAC,EAAa,CAAC,CAErD,EAAa,IAAI,IACrB,EAAQ,IAAK,GACJ,CACL,EACA,CACE,OAAQ,GAAmB,IAAI,EAAE,EAAE,MAAQ,EAC3C,GAAG,EAAG,oBAAoB,EAAE,CAC5B,GAAI,OAAO,IAAgB,IAAO,SAC9B,CAAE,KAAM,IAAgB,GAAI,CAC5B,IAAgB,GACrB,CACF,CACD,CACH,CAWD,GATI,GACF,EAAQ,MAAM,EAAG,IACf,IAAI,KAAK,UAAU,CAAC,QAClB,EAAW,IAAI,EAAE,CAAE,KACnB,EAAW,IAAI,EAAE,CAAE,KACpB,CACF,CAGC,EAA+B,CACjC,IAAM,EAAoB,EAAQ,QAAQ,EAAa,CACnD,EAAoB,IAEtB,EAAQ,OAAO,EAAmB,EAAE,CACpC,EAAQ,QAAQ,EAAa,EAIjC,MAAO,CAAC,EAAS,EAAW,EAC3B,CACD,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAAC,CAEF,MAAO,CACL,SACA,UACA,aACA,SACA,eACD"}
@@ -1,2 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);let f=require(`gt-i18n`),p=require(`react`);p=u(p);let m=require(`gt-i18n/internal`),h=require(`react/jsx-runtime`);function g(e){let t=e.trim();return t?/[.!?)]$/.test(t)?t:`${t}.`:``}function _(e){let t=e.trim(),n=t.length;for(;n>0;){let e=t[n-1];if(e!==`.`&&e!==`!`&&e!==`?`)break;--n}return t.slice(0,n)}function v(e){return e.replace(/^[A-Z][a-z]/,e=>e.toLowerCase())}function ee(e){if(!e)return``;let t=Array.isArray(e)?e.join(`, `):e;return t.trim()?g(`Details: ${t}`):``}function y(e){if(e!=null)return String(e)}function b({source:e,severity:t,whatHappened:n,reassurance:r,why:i,fix:a,wayOut:o,details:s,docsUrl:c}){let l=e?t?`${e} ${t}:`:`${e}:`:t?`${t}:`:``,u=i?`${_(n)} because ${v(_(i))}`:n,d=!!a&&!!o&&/^[a-z]/.test(_(o)),f=[u,r,d?`${_(a)}, or ${v(_(o))}`:a,d?void 0:o,ee(s)].filter(e=>!!e).map(g);c&&f.push(`Learn more: ${c}`);let p=f.join(` `);return l?`${l} ${p}`:p}function x(e){if(e===void 0)return;if(e===null)return`null`;if(typeof e==`number`)return isFinite(e)?``+e:`null`;if(typeof e!=`object`)return JSON.stringify(e);if(Array.isArray(e)){let t=`[`;for(let n=0;n<e.length;n++)n&&(t+=`,`),t+=x(e[n])||`null`;return t+`]`}let t=Object.keys(e).sort(),n=``;for(let r of t){let t=x(e[r]);t&&(n&&(n+=`,`),n+=JSON.stringify(r)+`:`+t)}return`{`+n+`}`}function te(e){return x(e)??``}function S(e){let t=e;if(t&&typeof t==`object`&&typeof t.k==`string`){let e=Object.keys(t);if(e.length===1||e.length===2&&(typeof t.i==`number`||typeof t.v==`string`)||e.length===3&&typeof t.v==`string`&&typeof t.i==`number`)return!0}return!1}function C(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function w(e,t,n=``){let r=C(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`,l=o+`expected Uint8Array`+s+`, got `+c;throw r?RangeError(l):TypeError(l)}return e}function T(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function E(e,t){w(e,void 0,`digestInto() output`);let n=t.outputLen;if(e.length<n)throw RangeError(`"digestInto() output" expected to be of length >=`+n)}function D(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function O(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function k(e,t){return e<<32-t|e>>>t}new Uint8Array(new Uint32Array([287454020]).buffer)[0];const ne=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,re=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ie(e){if(w(e),ne)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=re[e[n]];return t}function ae(e){if(typeof e!=`string`)throw TypeError(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function oe(e,t={}){let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}const se=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function ce(e,t,n){return e&t^~e&n}function le(e,t,n){return e&t^e&n^t&n}var ue=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=O(this.buffer)}update(e){T(this),w(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=O(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){T(this),E(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,D(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;n.setBigUint64(r-8,BigInt(this.length*8),i),this.process(n,0);let o=O(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen must be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const A=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),j=BigInt(2**32-1),de=BigInt(32);function fe(e,t=!1){return t?{h:Number(e&j),l:Number(e>>de&j)}:{h:Number(e>>de&j)|0,l:Number(e&j)|0}}function pe(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=fe(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const me=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),M=new Uint32Array(64);var he=class extends ue{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)M[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=M[e-15],n=M[e-2],r=k(t,7)^k(t,18)^t>>>3;M[e]=(k(n,17)^k(n,19)^n>>>10)+M[e-7]+r+M[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=k(o,6)^k(o,11)^k(o,25),u=l+t+ce(o,s,c)+me[e]+M[e]|0,d=(k(n,2)^k(n,13)^k(n,22))+le(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){D(M)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),D(this.buffer)}},ge=class extends he{A=A[0]|0;B=A[1]|0;C=A[2]|0;D=A[3]|0;E=A[4]|0;F=A[5]|0;G=A[6]|0;H=A[7]|0;constructor(){super(32)}};const _e=pe(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));_e[0],_e[1];const ve=oe(()=>new ge,se(1)),ye=e=>`generaltranslation Formatting Error: Invalid cutoff style: ${e}.`,be=`DEFAULT_TERMINATOR_KEY`,xe={ellipsis:{fr:{terminator:`…`,separator:` `},zh:{terminator:`……`,separator:void 0},ja:{terminator:`……`,separator:void 0},[be]:{terminator:`…`,separator:void 0}},none:{[be]:{terminator:void 0,separator:void 0}}};var Se=class e{static resolveLocale(e){try{let t=e?Array.isArray(e)?e.map(String):[String(e)]:[`en`],[n]=Intl.getCanonicalLocales(t);return n??`en`}catch{return`en`}}constructor(t,n={}){this.locale=e.resolveLocale(t);let r=n.style??`ellipsis`;if(!xe[r])throw Error(ye(r));let i=n.maxChars===void 0?void 0:xe[r][new Intl.Locale(this.locale).language]||xe[r].DEFAULT_TERMINATOR_KEY,a=n.terminator??i?.terminator,o=a==null?void 0:n.separator??i?.separator;this.additionLength=(a?.length??0)+(o?.length??0),n.maxChars!==void 0&&Math.abs(n.maxChars)<this.additionLength&&(a=void 0,o=void 0),this.options={maxChars:n.maxChars,style:n.maxChars===void 0?void 0:r,terminator:a,separator:o}}format(e){return this.formatToParts(e).join(``)}formatToParts(e){let{maxChars:t,terminator:n,separator:r}=this.options,i=t===void 0||Math.abs(t)>=e.length?t:t>=0?Math.max(0,t-this.additionLength):Math.min(0,t+this.additionLength),a=i!==void 0&&i>-1?e.slice(0,i):e.slice(i);return t==null||i==null||i===0||n==null||e.length<=Math.abs(t)?[a]:i>0?r==null?[a,n]:[a,r,n]:r==null?[n,a]:[n,r,a]}resolvedOptions(){return this.options}};const Ce={Collator:Intl.Collator,DateTimeFormat:Intl.DateTimeFormat,DisplayNames:Intl.DisplayNames,ListFormat:Intl.ListFormat,Locale:Intl.Locale,NumberFormat:Intl.NumberFormat,PluralRules:Intl.PluralRules,RelativeTimeFormat:Intl.RelativeTimeFormat,Segmenter:Intl.Segmenter,CutoffFormat:Se},we=new class{constructor(){this.cache={}}generateKey(e,t={}){return`${e?Array.isArray(e)?e.map(e=>String(e)).join(`,`):String(e):`undefined`}:${t?JSON.stringify(t,Object.keys(t).sort()):`{}`}`}get(e,...t){let[n=`en`,r={}]=t,i=this.generateKey(n,r),a=this.cache[e];a===void 0&&(a={},this.cache[e]=a);let o=a[i];return o===void 0&&(o=new Ce[e](...t),a[i]=o),o}};function Te(e){return we.get(`PluralRules`,e)}var N=c({__addDisposableResource:()=>Ze,__assign:()=>L,__asyncDelegator:()=>Ue,__asyncGenerator:()=>He,__asyncValues:()=>We,__await:()=>F,__awaiter:()=>Fe,__classPrivateFieldGet:()=>Je,__classPrivateFieldIn:()=>Xe,__classPrivateFieldSet:()=>Ye,__createBinding:()=>R,__decorate:()=>Oe,__disposeResources:()=>Qe,__esDecorate:()=>Ae,__exportStar:()=>Le,__extends:()=>Ee,__generator:()=>Ie,__importDefault:()=>qe,__importStar:()=>Ke,__makeTemplateObject:()=>Ge,__metadata:()=>Pe,__param:()=>ke,__propKey:()=>Me,__read:()=>Re,__rest:()=>De,__rewriteRelativeImportExtension:()=>$e,__runInitializers:()=>je,__setFunctionName:()=>Ne,__spread:()=>ze,__spreadArray:()=>Ve,__spreadArrays:()=>Be,__values:()=>P,default:()=>nt});function Ee(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);I(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function De(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Oe(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function ke(e,t){return function(n,r){t(n,r,e)}}function Ae(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function je(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function Me(e){return typeof e==`symbol`?e:`${e}`}function Ne(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function Pe(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Fe(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Ie(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Le(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&R(t,e,n)}function P(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Re(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function ze(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Re(arguments[t]));return e}function Be(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function Ve(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function F(e){return this instanceof F?(this.v=e,this):new F(e)}function He(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof F?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Ue(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:F(e[r](t)),done:!1}:i?i(t):t}:i}}function We(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof P==`function`?P(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Ge(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function Ke(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=z(e),r=0;r<n.length;r++)n[r]!==`default`&&R(t,e,n[r]);return et(t,e),t}function qe(e){return e&&e.__esModule?e:{default:e}}function Je(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function Ye(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function Xe(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function Ze(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function Qe(e){function t(t){e.error=e.hasError?new tt(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function $e(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var I,L,R,et,z,tt,nt,B=o((()=>{I=function(e,t){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},I(e,t)},L=function(){return L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},L.apply(this,arguments)},R=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),et=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},z=function(e){return z=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},z(e)},tt=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},nt={__extends:Ee,__assign:L,__rest:De,__decorate:Oe,__param:ke,__esDecorate:Ae,__runInitializers:je,__propKey:Me,__setFunctionName:Ne,__metadata:Pe,__awaiter:Fe,__generator:Ie,__createBinding:R,__exportStar:Le,__values:P,__read:Re,__spread:ze,__spreadArrays:Be,__spreadArray:Ve,__await:F,__asyncGenerator:He,__asyncDelegator:Ue,__asyncValues:We,__makeTemplateObject:Ge,__importStar:Ke,__importDefault:qe,__classPrivateFieldGet:Je,__classPrivateFieldSet:Ye,__classPrivateFieldIn:Xe,__addDisposableResource:Ze,__disposeResources:Qe,__rewriteRelativeImportExtension:$e}})),rt=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ErrorKind=void 0;var t;(function(e){e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]=`EXPECT_ARGUMENT_CLOSING_BRACE`,e[e.EMPTY_ARGUMENT=2]=`EMPTY_ARGUMENT`,e[e.MALFORMED_ARGUMENT=3]=`MALFORMED_ARGUMENT`,e[e.EXPECT_ARGUMENT_TYPE=4]=`EXPECT_ARGUMENT_TYPE`,e[e.INVALID_ARGUMENT_TYPE=5]=`INVALID_ARGUMENT_TYPE`,e[e.EXPECT_ARGUMENT_STYLE=6]=`EXPECT_ARGUMENT_STYLE`,e[e.INVALID_NUMBER_SKELETON=7]=`INVALID_NUMBER_SKELETON`,e[e.INVALID_DATE_TIME_SKELETON=8]=`INVALID_DATE_TIME_SKELETON`,e[e.EXPECT_NUMBER_SKELETON=9]=`EXPECT_NUMBER_SKELETON`,e[e.EXPECT_DATE_TIME_SKELETON=10]=`EXPECT_DATE_TIME_SKELETON`,e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]=`UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`,e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]=`EXPECT_SELECT_ARGUMENT_OPTIONS`,e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]=`EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]=`INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]=`EXPECT_SELECT_ARGUMENT_SELECTOR`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]=`EXPECT_PLURAL_ARGUMENT_SELECTOR`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]=`EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]=`EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`,e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]=`INVALID_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]=`DUPLICATE_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]=`DUPLICATE_SELECT_ARGUMENT_SELECTOR`,e[e.MISSING_OTHER_CLAUSE=22]=`MISSING_OTHER_CLAUSE`,e[e.INVALID_TAG=23]=`INVALID_TAG`,e[e.INVALID_TAG_NAME=25]=`INVALID_TAG_NAME`,e[e.UNMATCHED_CLOSING_TAG=26]=`UNMATCHED_CLOSING_TAG`,e[e.UNCLOSED_TAG=27]=`UNCLOSED_TAG`})(t||(e.ErrorKind=t={}))})),V=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SKELETON_TYPE=e.TYPE=void 0,e.isLiteralElement=r,e.isArgumentElement=i,e.isNumberElement=a,e.isDateElement=o,e.isTimeElement=s,e.isSelectElement=c,e.isPluralElement=l,e.isPoundElement=u,e.isTagElement=d,e.isNumberSkeleton=f,e.isDateTimeSkeleton=p,e.createLiteralElement=m,e.createNumberElement=h;var t;(function(e){e[e.literal=0]=`literal`,e[e.argument=1]=`argument`,e[e.number=2]=`number`,e[e.date=3]=`date`,e[e.time=4]=`time`,e[e.select=5]=`select`,e[e.plural=6]=`plural`,e[e.pound=7]=`pound`,e[e.tag=8]=`tag`})(t||(e.TYPE=t={}));var n;(function(e){e[e.number=0]=`number`,e[e.dateTime=1]=`dateTime`})(n||(e.SKELETON_TYPE=n={}));function r(e){return e.type===t.literal}function i(e){return e.type===t.argument}function a(e){return e.type===t.number}function o(e){return e.type===t.date}function s(e){return e.type===t.time}function c(e){return e.type===t.select}function l(e){return e.type===t.plural}function u(e){return e.type===t.pound}function d(e){return e.type===t.tag}function f(e){return!!(e&&typeof e==`object`&&e.type===n.number)}function p(e){return!!(e&&typeof e==`object`&&e.type===n.dateTime)}function m(e){return{type:t.literal,value:e}}function h(e,n){return{type:t.number,value:e,style:n}}})),it=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WHITE_SPACE_REGEX=e.SPACE_SEPARATOR_REGEX=void 0,e.SPACE_SEPARATOR_REGEX=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,e.WHITE_SPACE_REGEX=/[\t-\r \x85\u200E\u200F\u2028\u2029]/})),at=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseDateTimeSkeleton=n;var t=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function n(e){var n={};return e.replace(t,function(e){var t=e.length;switch(e[0]){case`G`:n.era=t===4?`long`:t===5?`narrow`:`short`;break;case`y`:n.year=t===2?`2-digit`:`numeric`;break;case`Y`:case`u`:case`U`:case`r`:throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case`q`:case`Q`:throw RangeError("`q/Q` (quarter) patterns are not supported");case`M`:case`L`:n.month=[`numeric`,`2-digit`,`short`,`long`,`narrow`][t-1];break;case`w`:case`W`:throw RangeError("`w/W` (week) patterns are not supported");case`d`:n.day=[`numeric`,`2-digit`][t-1];break;case`D`:case`F`:case`g`:throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case`E`:n.weekday=t===4?`long`:t===5?`narrow`:`short`;break;case`e`:if(t<4)throw RangeError("`e..eee` (weekday) patterns are not supported");n.weekday=[`short`,`long`,`narrow`,`short`][t-4];break;case`c`:if(t<4)throw RangeError("`c..ccc` (weekday) patterns are not supported");n.weekday=[`short`,`long`,`narrow`,`short`][t-4];break;case`a`:n.hour12=!0;break;case`b`:case`B`:throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");case`h`:n.hourCycle=`h12`,n.hour=[`numeric`,`2-digit`][t-1];break;case`H`:n.hourCycle=`h23`,n.hour=[`numeric`,`2-digit`][t-1];break;case`K`:n.hourCycle=`h11`,n.hour=[`numeric`,`2-digit`][t-1];break;case`k`:n.hourCycle=`h24`,n.hour=[`numeric`,`2-digit`][t-1];break;case`j`:case`J`:case`C`:throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case`m`:n.minute=[`numeric`,`2-digit`][t-1];break;case`s`:n.second=[`numeric`,`2-digit`][t-1];break;case`S`:case`A`:throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");case`z`:n.timeZoneName=t<4?`short`:`long`;break;case`Z`:case`O`:case`v`:case`V`:case`X`:case`x`:throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return``}),n}})),ot=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WHITE_SPACE_REGEX=void 0,e.WHITE_SPACE_REGEX=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i})),st=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.parseNumberSkeletonFromString=r,e.parseNumberSkeleton=m;var t=(B(),d(N)),n=ot();function r(e){if(e.length===0)throw Error(`Number skeleton cannot be empty`);for(var t=e.split(n.WHITE_SPACE_REGEX).filter(function(e){return e.length>0}),r=[],i=0,a=t;i<a.length;i++){var o=a[i].split(`/`);if(o.length===0)throw Error(`Invalid number skeleton`);for(var s=o[0],c=o.slice(1),l=0,u=c;l<u.length;l++)if(u[l].length===0)throw Error(`Invalid number skeleton`);r.push({stem:s,options:c})}return r}function i(e){return e.replace(/^(.*?)-/,``)}var a=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,o=/^(@+)?(\+|#+)?[rs]?$/g,s=/(\*)(0+)|(#+)(0+)|(0+)/g,c=/^(0+)$/;function l(e){var t={};return e[e.length-1]===`r`?t.roundingPriority=`morePrecision`:e[e.length-1]===`s`&&(t.roundingPriority=`lessPrecision`),e.replace(o,function(e,n,r){return typeof r==`string`?r===`+`?t.minimumSignificantDigits=n.length:n[0]===`#`?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+(typeof r==`string`?r.length:0)):(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length),``}),t}function u(e){switch(e){case`sign-auto`:return{signDisplay:`auto`};case`sign-accounting`:case`()`:return{currencySign:`accounting`};case`sign-always`:case`+!`:return{signDisplay:`always`};case`sign-accounting-always`:case`()!`:return{signDisplay:`always`,currencySign:`accounting`};case`sign-except-zero`:case`+?`:return{signDisplay:`exceptZero`};case`sign-accounting-except-zero`:case`()?`:return{signDisplay:`exceptZero`,currencySign:`accounting`};case`sign-never`:case`+_`:return{signDisplay:`never`}}}function f(e){var t;if(e[0]===`E`&&e[1]===`E`?(t={notation:`engineering`},e=e.slice(2)):e[0]===`E`&&(t={notation:`scientific`},e=e.slice(1)),t){var n=e.slice(0,2);if(n===`+!`?(t.signDisplay=`always`,e=e.slice(2)):n===`+?`&&(t.signDisplay=`exceptZero`,e=e.slice(2)),!c.test(e))throw Error(`Malformed concise eng/scientific notation`);t.minimumIntegerDigits=e.length}return t}function p(e){return u(e)||{}}function m(e){for(var n={},r=0,d=e;r<d.length;r++){var m=d[r];switch(m.stem){case`percent`:case`%`:n.style=`percent`;continue;case`%x100`:n.style=`percent`,n.scale=100;continue;case`currency`:n.style=`currency`,n.currency=m.options[0];continue;case`group-off`:case`,_`:n.useGrouping=!1;continue;case`precision-integer`:case`.`:n.maximumFractionDigits=0;continue;case`measure-unit`:case`unit`:n.style=`unit`,n.unit=i(m.options[0]);continue;case`compact-short`:case`K`:n.notation=`compact`,n.compactDisplay=`short`;continue;case`compact-long`:case`KK`:n.notation=`compact`,n.compactDisplay=`long`;continue;case`scientific`:n=t.__assign(t.__assign(t.__assign({},n),{notation:`scientific`}),m.options.reduce(function(e,n){return t.__assign(t.__assign({},e),p(n))},{}));continue;case`engineering`:n=t.__assign(t.__assign(t.__assign({},n),{notation:`engineering`}),m.options.reduce(function(e,n){return t.__assign(t.__assign({},e),p(n))},{}));continue;case`notation-simple`:n.notation=`standard`;continue;case`unit-width-narrow`:n.currencyDisplay=`narrowSymbol`,n.unitDisplay=`narrow`;continue;case`unit-width-short`:n.currencyDisplay=`code`,n.unitDisplay=`short`;continue;case`unit-width-full-name`:n.currencyDisplay=`name`,n.unitDisplay=`long`;continue;case`unit-width-iso-code`:n.currencyDisplay=`symbol`;continue;case`scale`:n.scale=parseFloat(m.options[0]);continue;case`rounding-mode-floor`:n.roundingMode=`floor`;continue;case`rounding-mode-ceiling`:n.roundingMode=`ceil`;continue;case`rounding-mode-down`:n.roundingMode=`trunc`;continue;case`rounding-mode-up`:n.roundingMode=`expand`;continue;case`rounding-mode-half-even`:n.roundingMode=`halfEven`;continue;case`rounding-mode-half-down`:n.roundingMode=`halfTrunc`;continue;case`rounding-mode-half-up`:n.roundingMode=`halfExpand`;continue;case`integer-width`:if(m.options.length>1)throw RangeError(`integer-width stems only accept a single optional option`);m.options[0].replace(s,function(e,t,r,i,a,o){if(t)n.minimumIntegerDigits=r.length;else if(i&&a)throw Error(`We currently do not support maximum integer digits`);else if(o)throw Error(`We currently do not support exact integer digits`);return``});continue}if(c.test(m.stem)){n.minimumIntegerDigits=m.stem.length;continue}if(a.test(m.stem)){if(m.options.length>1)throw RangeError(`Fraction-precision stems only accept a single optional option`);m.stem.replace(a,function(e,t,r,i,a,o){return r===`*`?n.minimumFractionDigits=t.length:i&&i[0]===`#`?n.maximumFractionDigits=i.length:a&&o?(n.minimumFractionDigits=a.length,n.maximumFractionDigits=a.length+o.length):(n.minimumFractionDigits=t.length,n.maximumFractionDigits=t.length),``});var h=m.options[0];h===`w`?n=t.__assign(t.__assign({},n),{trailingZeroDisplay:`stripIfInteger`}):h&&(n=t.__assign(t.__assign({},n),l(h)));continue}if(o.test(m.stem)){n=t.__assign(t.__assign({},n),l(m.stem));continue}var g=u(m.stem);g&&(n=t.__assign(t.__assign({},n),g));var _=f(m.stem);_&&(n=t.__assign(t.__assign({},n),_))}return n}})),ct=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=(B(),d(N));t.__exportStar(at(),e),t.__exportStar(st(),e)})),lt=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.timeData=void 0,e.timeData={"001":[`H`,`h`],419:[`h`,`H`,`hB`,`hb`],AC:[`H`,`h`,`hb`,`hB`],AD:[`H`,`hB`],AE:[`h`,`hB`,`hb`,`H`],AF:[`H`,`hb`,`hB`,`h`],AG:[`h`,`hb`,`H`,`hB`],AI:[`H`,`h`,`hb`,`hB`],AL:[`h`,`H`,`hB`],AM:[`H`,`hB`],AO:[`H`,`hB`],AR:[`h`,`H`,`hB`,`hb`],AS:[`h`,`H`],AT:[`H`,`hB`],AU:[`h`,`hb`,`H`,`hB`],AW:[`H`,`hB`],AX:[`H`],AZ:[`H`,`hB`,`h`],BA:[`H`,`hB`,`h`],BB:[`h`,`hb`,`H`,`hB`],BD:[`h`,`hB`,`H`],BE:[`H`,`hB`],BF:[`H`,`hB`],BG:[`H`,`hB`,`h`],BH:[`h`,`hB`,`hb`,`H`],BI:[`H`,`h`],BJ:[`H`,`hB`],BL:[`H`,`hB`],BM:[`h`,`hb`,`H`,`hB`],BN:[`hb`,`hB`,`h`,`H`],BO:[`h`,`H`,`hB`,`hb`],BQ:[`H`],BR:[`H`,`hB`],BS:[`h`,`hb`,`H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R":[`H`,`h`,`hB`,`hb`],"es-ES":[`H`,`h`,`hB`,`hb`],"es-GQ":[`H`,`h`,`hB`,`hb`],"fr-CA":[`H`,`h`,`hB`],"gl-ES":[`H`,`h`,`hB`],"gu-IN":[`hB`,`hb`,`h`,`H`],"hi-IN":[`hB`,`h`,`H`],"it-CH":[`H`,`h`,`hB`],"it-IT":[`H`,`h`,`hB`],"kn-IN":[`hB`,`h`,`H`],"ml-IN":[`hB`,`h`,`H`],"mr-IN":[`hB`,`hb`,`h`,`H`],"pa-IN":[`hB`,`hb`,`h`,`H`],"ta-IN":[`hB`,`h`,`hb`,`H`],"te-IN":[`hB`,`h`,`H`],"zu-ZA":[`H`,`hB`,`hb`,`h`]}})),ut=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getBestPattern=n;var t=lt();function n(e,t){for(var n=``,i=0;i<e.length;i++){var a=e.charAt(i);if(a===`j`){for(var o=0;i+1<e.length&&e.charAt(i+1)===a;)o++,i++;var s=1+(o&1),c=o<2?1:3+(o>>1),l=`a`,u=r(t);for((u==`H`||u==`k`)&&(c=0);c-- >0;)n+=l;for(;s-- >0;)n=u+n}else a===`J`?n+=`H`:n+=a}return n}function r(e){var n=e.hourCycle;if(n===void 0&&e.hourCycles&&e.hourCycles.length&&(n=e.hourCycles[0]),n)switch(n){case`h24`:return`k`;case`h23`:return`H`;case`h12`:return`h`;case`h11`:return`K`;default:throw Error(`Invalid hourCycle`)}var r=e.language,i;return r!==`root`&&(i=e.maximize().region),(t.timeData[i||``]||t.timeData[r||``]||t.timeData[`${r}-001`]||t.timeData[`001`])[0]}})),dt=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Parser=void 0;var t=(B(),d(N)),n=rt(),r=V(),i=it(),a=ct(),o=ut(),s=RegExp(`^${i.SPACE_SEPARATOR_REGEX.source}*`),c=RegExp(`${i.SPACE_SEPARATOR_REGEX.source}*\$`);function l(e,t){return{start:e,end:t}}var u=!!String.prototype.startsWith&&`_a`.startsWith(`a`,1),f=!!String.fromCodePoint,p=!!Object.fromEntries,m=!!String.prototype.codePointAt,h=!!String.prototype.trimStart,g=!!String.prototype.trimEnd,_=Number.isSafeInteger?Number.isSafeInteger:function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},v=!0;try{v=C(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`,`yu`).exec(`a`)?.[0]===`a`}catch{v=!1}var ee=u?function(e,t,n){return e.startsWith(t,n)}:function(e,t,n){return e.slice(n,n+t.length)===t},y=f?String.fromCodePoint:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=``,r=e.length,i=0,a;r>i;){if(a=e[i++],a>1114111)throw RangeError(a+` is not a valid code point`);n+=a<65536?String.fromCharCode(a):String.fromCharCode(((a-=65536)>>10)+55296,a%1024+56320)}return n},b=p?Object.fromEntries:function(e){for(var t={},n=0,r=e;n<r.length;n++){var i=r[n],a=i[0];t[a]=i[1]}return t},x=m?function(e,t){return e.codePointAt(t)}:function(e,t){var n=e.length;if(!(t<0||t>=n)){var r=e.charCodeAt(t),i;return r<55296||r>56319||t+1===n||(i=e.charCodeAt(t+1))<56320||i>57343?r:(r-55296<<10)+(i-56320)+65536}},te=h?function(e){return e.trimStart()}:function(e){return e.replace(s,``)},S=g?function(e){return e.trimEnd()}:function(e){return e.replace(c,``)};function C(e,t){return new RegExp(e,t)}var w;if(v){var T=C(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`,`yu`);w=function(e,t){return T.lastIndex=t,T.exec(e)[1]??``}}else w=function(e,t){for(var n=[];;){var r=x(e,t);if(r===void 0||k(r)||ne(r))break;n.push(r),t+=r>=65536?2:1}return y.apply(void 0,n)};e.Parser=function(){function e(e,t){t===void 0&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error(`parser can only be used once`);return this.parseMessage(0,``,!1)},e.prototype.parseMessage=function(e,t,i){for(var a=[];!this.isEOF();){var o=this.char();if(o===123){var s=this.parseArgument(e,i);if(s.err)return s;a.push(s.val)}else if(o===125&&e>0)break;else if(o===35&&(t===`plural`||t===`selectordinal`)){var c=this.clonePosition();this.bump(),a.push({type:r.TYPE.pound,location:l(c,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(i)break;return this.error(n.ErrorKind.UNMATCHED_CLOSING_TAG,l(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&E(this.peek()||0)){var s=this.parseTag(e,t);if(s.err)return s;a.push(s.val)}else{var s=this.parseLiteral(e,t);if(s.err)return s;a.push(s.val)}}return{val:a,err:null}},e.prototype.parseTag=function(e,t){var i=this.clonePosition();this.bump();var a=this.parseTagName();if(this.bumpSpace(),this.bumpIf(`/>`))return{val:{type:r.TYPE.literal,value:`<${a}/>`,location:l(i,this.clonePosition())},err:null};if(this.bumpIf(`>`)){var o=this.parseMessage(e+1,t,!0);if(o.err)return o;var s=o.val,c=this.clonePosition();if(this.bumpIf(`</`)){if(this.isEOF()||!E(this.char()))return this.error(n.ErrorKind.INVALID_TAG,l(c,this.clonePosition()));var u=this.clonePosition();return a===this.parseTagName()?(this.bumpSpace(),this.bumpIf(`>`)?{val:{type:r.TYPE.tag,value:a,children:s,location:l(i,this.clonePosition())},err:null}:this.error(n.ErrorKind.INVALID_TAG,l(c,this.clonePosition()))):this.error(n.ErrorKind.UNMATCHED_CLOSING_TAG,l(u,this.clonePosition()))}else return this.error(n.ErrorKind.UNCLOSED_TAG,l(i,this.clonePosition()))}else return this.error(n.ErrorKind.INVALID_TAG,l(i,this.clonePosition()))},e.prototype.parseTagName=function(){var e=this.offset();for(this.bump();!this.isEOF()&&O(this.char());)this.bump();return this.message.slice(e,this.offset())},e.prototype.parseLiteral=function(e,t){for(var n=this.clonePosition(),i=``;;){var a=this.tryParseQuote(t);if(a){i+=a;continue}var o=this.tryParseUnquoted(e,t);if(o){i+=o;continue}var s=this.tryParseLeftAngleBracket();if(s){i+=s;continue}break}var c=l(n,this.clonePosition());return{val:{type:r.TYPE.literal,value:i,location:c},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!D(this.peek()||0))?(this.bump(),`<`):null},e.prototype.tryParseQuote=function(e){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),`'`;case 123:case 60:case 62:case 125:break;case 35:if(e===`plural`||e===`selectordinal`)break;return null;default:return null}this.bump();var t=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(n===39)if(this.peek()===39)t.push(39),this.bump();else{this.bump();break}else t.push(n);this.bump()}return y.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var n=this.char();return n===60||n===123||n===35&&(t===`plural`||t===`selectordinal`)||n===125&&e>0?null:(this.bump(),y(n))},e.prototype.parseArgument=function(e,t){var i=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(n.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,l(i,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(n.ErrorKind.EMPTY_ARGUMENT,l(i,this.clonePosition()));var a=this.parseIdentifierIfPossible().value;if(!a)return this.error(n.ErrorKind.MALFORMED_ARGUMENT,l(i,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(n.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,l(i,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:r.TYPE.argument,value:a,location:l(i,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(n.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,l(i,this.clonePosition())):this.parseArgumentOptions(e,t,a,i);default:return this.error(n.ErrorKind.MALFORMED_ARGUMENT,l(i,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),n=w(this.message,t),r=t+n.length;return this.bumpTo(r),{value:n,location:l(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,i,s,c){var u=this.clonePosition(),d=this.parseIdentifierIfPossible().value,f=this.clonePosition();switch(d){case``:return this.error(n.ErrorKind.EXPECT_ARGUMENT_TYPE,l(u,f));case`number`:case`date`:case`time`:this.bumpSpace();var p=null;if(this.bumpIf(`,`)){this.bumpSpace();var m=this.clonePosition(),h=this.parseSimpleArgStyleIfPossible();if(h.err)return h;var g=S(h.val);if(g.length===0)return this.error(n.ErrorKind.EXPECT_ARGUMENT_STYLE,l(this.clonePosition(),this.clonePosition()));p={style:g,styleLocation:l(m,this.clonePosition())}}var _=this.tryParseArgumentClose(c);if(_.err)return _;var v=l(c,this.clonePosition());if(p&&ee(p?.style,`::`,0)){var y=te(p.style.slice(2));if(d===`number`){var h=this.parseNumberSkeletonFromString(y,p.styleLocation);return h.err?h:{val:{type:r.TYPE.number,value:s,location:v,style:h.val},err:null}}else{if(y.length===0)return this.error(n.ErrorKind.EXPECT_DATE_TIME_SKELETON,v);var x=y;this.locale&&(x=(0,o.getBestPattern)(y,this.locale));var g={type:r.SKELETON_TYPE.dateTime,pattern:x,location:p.styleLocation,parsedOptions:this.shouldParseSkeletons?(0,a.parseDateTimeSkeleton)(x):{}};return{val:{type:d===`date`?r.TYPE.date:r.TYPE.time,value:s,location:v,style:g},err:null}}}return{val:{type:d===`number`?r.TYPE.number:d===`date`?r.TYPE.date:r.TYPE.time,value:s,location:v,style:p?.style??null},err:null};case`plural`:case`selectordinal`:case`select`:var C=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(`,`))return this.error(n.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS,l(C,t.__assign({},C)));this.bumpSpace();var w=this.parseIdentifierIfPossible(),T=0;if(d!==`select`&&w.value===`offset`){if(!this.bumpIf(`:`))return this.error(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,l(this.clonePosition(),this.clonePosition()));this.bumpSpace();var h=this.tryParseDecimalInteger(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,n.ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(h.err)return h;this.bumpSpace(),w=this.parseIdentifierIfPossible(),T=h.val}var E=this.tryParsePluralOrSelectOptions(e,d,i,w);if(E.err)return E;var _=this.tryParseArgumentClose(c);if(_.err)return _;var D=l(c,this.clonePosition());return d===`select`?{val:{type:r.TYPE.select,value:s,options:b(E.val),location:D},err:null}:{val:{type:r.TYPE.plural,value:s,options:b(E.val),offset:T,pluralType:d===`plural`?`cardinal`:`ordinal`,location:D},err:null};default:return this.error(n.ErrorKind.INVALID_ARGUMENT_TYPE,l(u,f))}},e.prototype.tryParseArgumentClose=function(e){return this.isEOF()||this.char()!==125?this.error(n.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE,l(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();)switch(this.char()){case 39:this.bump();var r=this.clonePosition();if(!this.bumpUntil(`'`))return this.error(n.ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,l(r,this.clonePosition()));this.bump();break;case 123:e+=1,this.bump();break;case 125:if(e>0)--e;else return{val:this.message.slice(t.offset,this.offset()),err:null};break;default:this.bump();break}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var i=[];try{i=(0,a.parseNumberSkeletonFromString)(e)}catch{return this.error(n.ErrorKind.INVALID_NUMBER_SKELETON,t)}return{val:{type:r.SKELETON_TYPE.number,tokens:i,location:t,parsedOptions:this.shouldParseSkeletons?(0,a.parseNumberSkeleton)(i):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,i){for(var a,o=!1,s=[],c=new Set,u=i.value,d=i.location;;){if(u.length===0){var f=this.clonePosition();if(t!==`select`&&this.bumpIf(`=`)){var p=this.tryParseDecimalInteger(n.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR,n.ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);if(p.err)return p;d=l(f,this.clonePosition()),u=this.message.slice(f.offset,this.offset())}else break}if(c.has(u))return this.error(t===`select`?n.ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR:n.ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,d);u===`other`&&(o=!0),this.bumpSpace();var m=this.clonePosition();if(!this.bumpIf(`{`))return this.error(t===`select`?n.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:n.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,l(this.clonePosition(),this.clonePosition()));var h=this.parseMessage(e+1,t,r);if(h.err)return h;var g=this.tryParseArgumentClose(m);if(g.err)return g;s.push([u,{value:h.val,location:l(m,this.clonePosition())}]),c.add(u),this.bumpSpace(),a=this.parseIdentifierIfPossible(),u=a.value,d=a.location}return s.length===0?this.error(t===`select`?n.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR:n.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR,l(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(n.ErrorKind.MISSING_OTHER_CLAUSE,l(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var n=1,r=this.clonePosition();this.bumpIf(`+`)||this.bumpIf(`-`)&&(n=-1);for(var i=!1,a=0;!this.isEOF();){var o=this.char();if(o>=48&&o<=57)i=!0,a=a*10+(o-48),this.bump();else break}var s=l(r,this.clonePosition());return i?(a*=n,_(a)?{val:a,err:null}:this.error(t,s)):this.error(e,s)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var e=this.position.offset;if(e>=this.message.length)throw Error(`out of bound`);var t=x(this.message,e);if(t===void 0)throw Error(`Offset ${e} is at invalid UTF-16 code unit boundary`);return t},e.prototype.error=function(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}},e.prototype.bump=function(){if(!this.isEOF()){var e=this.char();e===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}},e.prototype.bumpIf=function(e){if(ee(this.message,e,this.offset())){for(var t=0;t<e.length;t++)this.bump();return!0}return!1},e.prototype.bumpUntil=function(e){var t=this.offset(),n=this.message.indexOf(e,t);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error(`targetOffset ${e} must be greater than or equal to the current offset ${this.offset()}`);for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error(`targetOffset ${e} is at invalid UTF-16 code unit boundary`);if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&k(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this.offset();return this.message.charCodeAt(t+(e>=65536?2:1))??null},e}();function E(e){return e>=97&&e<=122||e>=65&&e<=90}function D(e){return E(e)||e===47}function O(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function k(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function ne(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}})),ft=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hoistSelectors=s,e.isStructurallySame=l;var t=(B(),d(N)),n=V();function r(e){return Array.isArray(e)?t.__spreadArray([],e.map(r),!0):typeof e==`object`&&e?Object.keys(e).reduce(function(t,n){return t[n]=r(e[n]),t},{}):e}function i(e,n,i){var a=r(n),o=a.options;return a.options=Object.keys(o).reduce(function(n,r){return n[r]={value:s(t.__spreadArray(t.__spreadArray(t.__spreadArray([],e.slice(0,i),!0),o[r].value,!0),e.slice(i+1),!0))},n},{}),a}function a(e){return(0,n.isPluralElement)(e)||(0,n.isSelectElement)(e)}function o(e){return!!e.find(function(e){return a(e)?!0:(0,n.isTagElement)(e)?o(e.children):!1})}function s(e){for(var t=0;t<e.length;t++){var r=e[t];if(a(r))return[i(e,r,t)];if((0,n.isTagElement)(r)&&o([r]))throw Error(`Cannot hoist plural/select within a tag element. Please put the tag element inside each plural/select option`)}return e}function c(e,t){t===void 0&&(t=new Map),e.forEach(function(e){if((0,n.isArgumentElement)(e)||(0,n.isDateElement)(e)||(0,n.isTimeElement)(e)||(0,n.isNumberElement)(e)){if(e.value in t&&t.get(e.value)!==e.type)throw Error(`Variable ${e.value} has conflicting types`);t.set(e.value,e.type)}((0,n.isPluralElement)(e)||(0,n.isSelectElement)(e))&&(t.set(e.value,e.type),Object.keys(e.options).forEach(function(n){c(e.options[n].value,t)})),(0,n.isTagElement)(e)&&(t.set(e.value,e.type),c(e.children,t))})}function l(e,t){var r=new Map,i=new Map;return c(e,r),c(t,i),r.size===i.size?Array.from(r.entries()).reduce(function(e,t){var r=t[0],a=t[1];if(!e.success)return e;var o=i.get(r);return o==null?{success:!1,error:Error(`Missing variable ${r} in message`)}:o===a?e:{success:!1,error:Error(`Variable ${r} has conflicting types: ${n.TYPE[a]} vs ${n.TYPE[o]}`)}},{success:!0}):{success:!1,error:Error(`Different number of variables: [${Array.from(r.keys()).join(`, `)}] vs [${Array.from(i.keys()).join(`, `)}]`)}}})),pt=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isStructurallySame=e._Parser=void 0,e.parse=o;var t=(B(),d(N)),n=rt(),r=dt(),i=V();function a(e){e.forEach(function(e){if(delete e.location,(0,i.isSelectElement)(e)||(0,i.isPluralElement)(e))for(var t in e.options)delete e.options[t].location,a(e.options[t].value);else (0,i.isNumberElement)(e)&&(0,i.isNumberSkeleton)(e.style)||((0,i.isDateElement)(e)||(0,i.isTimeElement)(e))&&(0,i.isDateTimeSkeleton)(e.style)?delete e.style.location:(0,i.isTagElement)(e)&&a(e.children)})}function o(e,i){i===void 0&&(i={}),i=t.__assign({shouldParseSkeletons:!0,requiresOtherClause:!0},i);var o=new r.Parser(e,i).parse();if(o.err){var s=SyntaxError(n.ErrorKind[o.err.kind]);throw s.location=o.err.location,s.originalMessage=o.err.message,s}return i?.captureLocation||a(o.val),o.val}t.__exportStar(V(),e),e._Parser=r.Parser;var s=ft();Object.defineProperty(e,`isStructurallySame`,{enumerable:!0,get:function(){return s.isStructurallySame}})})),mt=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),B(),d(N),V()})),H=pt(),ht=V();mt();const gt=[`singular`,`plural`,`dual`,`zero`,`one`,`two`,`few`,`many`,`other`];function _t(e){return gt.includes(e)}function vt(e,t=gt,n=[`en`]){let r=Te(n).select(e),i=Math.abs(e);if(i===0&&t.includes(`zero`))return`zero`;if(i===1){if(t.includes(`singular`))return`singular`;if(t.includes(`one`))return`one`}if(r===`one`&&t.includes(`singular`))return`singular`;if(i===2){if(t.includes(`dual`))return`dual`;if(t.includes(`two`))return`two`}return r===`two`&&t.includes(`dual`)?`dual`:t.includes(r)?r:r===`two`&&t.includes(`dual`)?`dual`:r===`two`&&t.includes(`plural`)?`plural`:r===`two`&&t.includes(`other`)?`other`:r===`few`&&t.includes(`plural`)?`plural`:r===`few`&&t.includes(`other`)?`other`:r===`many`&&t.includes(`plural`)?`plural`:r===`many`&&t.includes(`other`)?`other`:r===`other`&&t.includes(`plural`)?`plural`:``}const yt={variable:`v`,number:`n`,datetime:`d`,currency:`c`,"relative-time":`rt`};function bt(e){return yt[e]}function xt({icuString:e,shouldVisit:t,visitor:n,options:{recurseIntoVisited:r=!0,...i}}){let a=(0,H.parse)(e,i);return o(a),a;function o(e){e.map(s)}function s(e){let i=!1;t(e)&&(n(e),i=!0),(!i||r)&&(e.type===H.TYPE.select||e.type===H.TYPE.plural?Object.values(e.options).map(e=>e.value).map(o):e.type===H.TYPE.tag&&o(e.children))}}const St=`_gt_`;RegExp(`^${St}\\d+$`);const Ct=RegExp(`^${St}$`);function wt(e){return e.type===ht.TYPE.select&&Ct.test(e.value)&&!!e.options.other&&(e.options.other.value.length===0||e.options.other.value.length>0&&e.options.other.value[0]?.type===ht.TYPE.literal)}function Tt(e){if(!e.includes(`_gt_`))return e;let t=[];function n(e){t.push({start:e.location?.start.offset??0,end:e.location?.end.offset??0,otherStart:e.options.other.location?.start.offset??0,otherEnd:e.options.other.location?.end.offset??0})}xt({icuString:e,shouldVisit:wt,visitor:n,options:{recurseIntoVisited:!1,captureLocation:!0}});let r=[],i=0;for(let n=0;n<t.length;n++){let{start:a,end:o,otherStart:s,otherEnd:c}=t[n];r.push(e.slice(i,a)),r.push(e.slice(a,a+4+1)),r.push(String(n+1)),r.push(e.slice(a+4+1,s)),r.push(`{}`),r.push(e.slice(c,o)),i=o}return r.push(e.slice(i,e.length)),r.join(``)}RegExp(`${St}\\d+`);function U(e,t,n){let r=``,i=null;return typeof e==`number`&&!i&&n&&(r=vt(e,Object.keys(n).filter(_t),t)),r&&!i&&(i=n[r]),i}function Et(e,t=0){let n=t,r=e=>{let{type:t,props:r}=e;n+=1;let i={id:n,injectionType:`manual`},a;try{a=typeof t==`function`?t._gtt:void 0}catch{}if(a){let e=a.split(`-`);if((e[1]===`automatic`||e[2]===`automatic`)&&(i.injectionType=`automatic`),e[0]===`translate`&&(e[0]=`fragment`),e[0]===`variable`&&(i.variableType=e?.[1]||`variable`),e[0]===`plural`){let e=Object.entries(r).reduce((e,[t,r])=>(_t(t)&&(e[t]=Et(r,n)),e),{});Object.keys(e).length&&(i.branches=e)}if(e[0]===`branch`){let{children:e,branch:t,...a}=r,o=Object.fromEntries(Object.entries(a).filter(([e])=>!e.startsWith(`data-`))),s=Object.entries(o).reduce((e,[t,r])=>(e[t]=Et(r,n),e),{});Object.keys(s).length&&(i.branches=s)}i.transformation=e[0]}return i};function i(e){let{props:t}=e,n=r(e),i={...t,"data-_gt":n};return t.children&&!n.variableType&&(i.children=o(t.children)),e.type===p.default.Fragment&&(i[`data-_gt`].transformation=`fragment`),p.default.cloneElement(e,i)}function a(e){return(0,p.isValidElement)(e)?i(e):e}function o(e){return Array.isArray(e)?p.default.Children.map(e,a):a(e)}return o(e)}const Dt={variable:`value`,number:`n`,datetime:`date`,currency:`cost`,"relative-time":`time`};function Ot(e={},t){return typeof e.name==`string`?e.name:`_gt_${Dt[t]||`value`}_${e[`data-_gt`]?.id}`}function kt(e){return p.default.isValidElement(e)}const At={pl:`placeholder`,ti:`title`,alt:`alt`,arl:`aria-label`,arb:`aria-labelledby`,ard:`aria-describedby`},jt=e=>{if(!e)return``;let{type:t,props:n}=e;if(t&&typeof t==`function`){if(`displayName`in t&&typeof t.displayName==`string`&&t.displayName)return t.displayName;if(`name`in t&&typeof t.name==`string`&&t.name)return t.name}return t&&typeof t==`string`?t:n.href?`a`:n[`data-_gt`]?.id?`C${n[`data-_gt`].id}`:`function`},Mt=(e,t,n)=>{let r=Object.entries(At).reduce((e,[n,r])=>{let i=t[r];return typeof i==`string`&&(e[n]=i),e},{});if(e===`plural`&&n){let e={};Object.entries(n).forEach(([t,n])=>{e[t]=W(n)}),r={...r,b:e,t:`p`}}if(e===`branch`&&n){let e={};Object.entries(n).forEach(([t,n])=>{e[t]=W(n)}),r={...r,b:e,t:`b`}}return Object.keys(r).length?r:void 0},Nt=e=>{let{props:t}=e,n={t:jt(e)};if(t[`data-_gt`]){let e=t[`data-_gt`],r=e.transformation;if(r===`variable`){let n=e.variableType||`variable`,r=Ot(t,n),i=bt(n);return{i:e.id,k:r,v:i}}n.i=e.id,n.d=Mt(r,t,e.branches);let i=Object.entries(At).reduce((e,[n,r])=>{let i=t[r];return typeof i==`string`&&(e[n]=i),e},{});if(r===`plural`&&e.branches){let t={};Object.entries(e.branches).forEach(([e,n])=>{t[e]=W(n)}),i={...i,b:t,t:`p`}}if(r===`branch`&&e.branches){let t={};Object.entries(e.branches).forEach(([e,n])=>{t[e]=W(n)}),i={...i,b:t,t:`b`}}n.d=Object.keys(i).length?i:void 0}return t.children&&(n.c=W(t.children)),n},Pt=e=>kt(e)?Nt(e):typeof e==`number`?e.toString():e;function W(e){return Array.isArray(e)?e.map(Pt):Pt(e)}function G(e,t){if(e==null)throw Error(`Cannot index into an undefined dictionary`);return e[t]}function K(e,t,n){e[t]=n}const Ft=e=>`Duplicate key found in dictionary: "${e}"`;function It(e,t=``){let n={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let i=t?`${t}.${r}`:r;if(typeof G(e,r)==`object`&&G(e,r)!==null&&!Array.isArray(G(e,r))){let t=It(G(e,r),i);for(let e in t){if(Object.prototype.hasOwnProperty.call(n,e))throw Error(Ft(e));n[e]=t[e]}}else{if(Object.prototype.hasOwnProperty.call(n,i))throw Error(Ft(i));n[i]=G(e,r)}}return n}function Lt(e){return typeof e==`object`&&!!e&&`data-_gt`in e&&typeof e[`data-_gt`]==`object`&&!!e[`data-_gt`]&&`transformation`in e[`data-_gt`]&&e[`data-_gt`]?.transformation===`variable`}function q(e){let t=e[`data-_gt`]?.variableType||`variable`;return{variableName:Ot(e,t),variableType:bt(t),injectionType:e[`data-_gt`]?.injectionType||`manual`,variableValue:(()=>{if(e.value!==void 0)return e.value;if(e.date!==void 0)return e.date;if(e[`data-_gt-unformatted-value`]!==void 0)return e[`data-_gt-unformatted-value`];if(e.children!==void 0)return e.children})(),variableOptions:(()=>{let t={...e.currency!==void 0&&{currency:e.currency},...e.unit!==void 0&&{unit:e.unit},...e.baseDate!==void 0&&{baseDate:e.baseDate},...e.options!==void 0&&e.options};return Object.keys(t).length?t:typeof e[`data-_gt-variable-options`]==`string`?JSON.parse(e[`data-_gt-variable-options`]):e[`data-_gt-variable-options`]||void 0})()}}const Rt=[];function zt({locale:e,enableI18n:t,localesProp:n=Rt}){let r=(0,m.getI18nConfig)().getDefaultLocale();return t&&(0,m.getI18nConfig)().requiresTranslation(e)?[...n,e,r]:[r]}function J(){return(0,m.getI18nCache)()}function Bt(e){(0,m.setI18nCache)(e)}async function Vt(e){let t=await J().loadTranslations(e);return{[e]:t}}const Ht=`server-render`;var Ut=class extends m.I18nConfig{renderStrategy;constructor(e={},t=Ht){super(e),Kt(t),this.renderStrategy=t}getRenderStrategy(){return this.renderStrategy}};function Y(){let e=(0,m.getI18nConfig)();if(qt(e))return e;throw Error(b({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read ReactI18nConfig after base I18nConfig setup.`,why:`the internal I18nConfig singleton was initialized without react-core render strategy support`,fix:`Initialize GT through gt-react or @generaltranslation/react-core/pure.`}))}function Wt(e){(0,m.setI18nConfig)(e)}function Gt(e={},t=Ht){let n=new Ut(e,t);return Wt(n),n}function Kt(e){if(!(e===`SPA`||e===`server-render`))throw Error(b({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Invalid React render strategy.`,why:`the render strategy must be "SPA" or "server-render", but received "${String(e)}"`,fix:`Initialize GT through gt-react or pass a valid render strategy.`}))}function qt(e){return e instanceof Ut}const{getConditionStore:Jt,setConditionStore:Yt,isConditionStoreInitialized:Xt}=(0,m.createConditionStoreSingleton)(b({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot read GT runtime context before it has been initialized`,why:`The internal ConditionStore is unavailable`}));function Zt(){try{return Jt()}catch(e){let t=(0,m.getRuntimeEnvironment)(),n=Y().getRenderStrategy(),r=b({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot access ConditionStore before it is initialized.`,details:y(e),fix:n===`SPA`?`Initialize GT before reading GT runtime context.`:`Add a <GTProvider> at the root of your component tree.`,wayOut:t===`development`?void 0:n===`SPA`?`Request-specific values will fall back to the default configuration.`:`Request-specific values will fall back to the default configuration. This may cause hydration mismatches.`});if(t===`development`)throw Error(r);return console.error(r),{getLocale:()=>`en`,getRegion:()=>void 0,getEnableI18n:()=>!0,setLocale:()=>{},setRegion:()=>{},setEnableI18n:()=>{}}}}function Qt(){let e=Zt(),t=(0,m.getI18nConfig)(),n=e.getEnableI18n(),r=e.getLocale();return n&&t.requiresTranslation(r)}const $t=(e,...t)=>{if(an(e),typeof e==`string`){let n=t.at(0);return en(n?.$locale??on(),e,n)}return tn(e,t)};function en(e,t,n={}){let r=J(),i=Y().getDefaultLocale();if(!Qt())return(0,m.interpolateMessage)({options:n,source:t,sourceLocale:i});let a=(0,m.createLookupOptions)(e,n,`ICU`);return(0,m.interpolateMessage)({source:t,target:r.lookupTranslation(a.$locale,t,a),options:a,sourceLocale:i})}function tn(e,t){let n=on(),r=rn(e,t),i=J().lookupTranslation(n,r,{$format:`STRING`});if(i)return i;let{message:a,variables:o}=nn(e,t);return en(n,a,o)}function nn(e,t){let n=[],r={},i=0;for(let a=0;a<e.length;a++)if(n.push(e[a]),a<t.length){let e=i.toString();n.push(`{${e}}`),r[e]=t[a],i++}return{message:n.join(``),variables:r}}function rn(e,t){return e.map((e,n)=>e+(t[n]??``)).join(``)}function an(e){let t=Y().getRenderStrategy()===`server-render`,n=!Xt();if(!t||!n)return;let r=typeof e==`string`?e:e.join(``),i=b({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Using the t() function at the module level is forbidden in server-rendered applications.`,fix:`Either move the t() invocation into a request-time scope or register the string with the msg() function and translate with an m() function. Ensure that you have added the <GTProvider> at the root of your component tree.`,wayOut:(0,m.getRuntimeEnvironment)()===`development`?void 0:`Falling back to defaultLocale value.`,details:`Message: "${r}"`});if((0,m.getRuntimeEnvironment)()===`development`)throw Error(i);console.error(i)}function on(){return Zt().getLocale()}function sn({Currency:e,GtInternalCurrency:t,DateTime:n,GtInternalDateTime:r,Num:i,GtInternalNum:a,RelativeTime:o,GtInternalRelativeTime:s,Var:c,GtInternalVar:l}){return function({variableType:u,variableValue:d,variableOptions:f,locales:p,enableI18n:m,injectionType:g}){let _={_locale:p[0]??`en`,_enableI18n:m};if(u===`n`){let e=g===`automatic`?i:a,t=f;return(0,h.jsx)(e,{..._,options:t,children:d})}if(u===`d`){let e=g===`automatic`?n:r,t=f;return(0,h.jsx)(e,{..._,options:t,children:d})}if(u===`c`){let n=g===`automatic`?e:t,r=f;return(0,h.jsx)(n,{..._,options:r,children:d})}if(u===`rt`){let e=g===`automatic`?o:s,t=f;if(typeof d==`number`&&t?.unit)return(0,h.jsx)(e,{..._,value:d,unit:t.unit,baseDate:t?.baseDate,options:t});let n=d instanceof Date?d:typeof d==`string`||typeof d==`number`?new Date(d):void 0;return(0,h.jsx)(e,{..._,date:n&&!isNaN(n.getTime())?n:void 0,baseDate:t?.baseDate,options:t})}let v=d;return(0,h.jsx)(g===`automatic`?l:c,{..._,children:v})}}function cn(e){return e&&e.props&&e.props[`data-_gt`]?e.props[`data-_gt`]:null}function ln({renderVariable:e}){return function({children:t,defaultLocale:n=`en`,enableI18n:r}){let i=t=>{let i=cn(t);if(Lt(t.props)){let{variableType:i,variableValue:a,variableOptions:o,injectionType:s}=q(t.props);return e({variableType:i,variableValue:a,variableOptions:o,locales:[n],enableI18n:r,injectionType:s})}if(i?.transformation===`plural`){let e=i.branches||{};if(typeof t.props.n!=`number`)return t.props.children==null?null:o(t.props.children);let r=U(t.props.n,[n],e);return o(r===null?t.props.children:r)}if(i?.transformation===`branch`){let{children:e,branch:n}=t.props,r=i.branches||{},a=n==null||n===``?void 0:n.toString();return o(a&&r[a]!==void 0?r[a]:e)}return i?.transformation===`fragment`?p.default.createElement(p.default.Fragment,{key:t.props.key,children:o(t.props.children)}):t.props.children?p.default.cloneElement(t,{...t.props,"data-_gt":void 0,children:o(t.props.children)}):p.default.cloneElement(t,{...t.props,"data-_gt":void 0})},a=e=>p.default.isValidElement(e)?i(e):e,o=e=>Array.isArray(e)?p.default.Children.map(e,a):a(e);return o(t)}}function un({renderVariable:e}){let t=ln({renderVariable:e});function n({sourceElement:e,targetElement:n,locales:i=[`en`],enableI18n:a}){let{props:o}=e,s=o[`data-_gt`],c=s?.transformation,l=n.d,u={};if(l&&Object.entries(At).forEach(([e,t])=>{l[e]&&(u[t]=l[e])}),c===`plural`){let o=e.props.n;if(typeof o!=`number`)return t({children:e,defaultLocale:i[0],enableI18n:a});let c=U(o,i,s.branches||{}),l=c===null?e.props.children:c,u=U(o,i,n.d?.b||{});return r({source:l,target:u===null?n.c:u,locales:i,enableI18n:a})}if(c===`branch`){let{branch:e,children:t}=o,c=e==null||e===``?void 0:e.toString(),l=s.branches||{},u=n.d?.b||{};return r({source:c&&l[c]!==void 0?l[c]:t,target:c&&u[c]!==void 0?u[c]:n.c,locales:i,enableI18n:a})}return c===`fragment`&&n.c?p.default.createElement(p.default.Fragment,{key:e.props.key,children:r({source:o.children,target:n.c,locales:i,enableI18n:a})}):o?.children&&n?.c?p.default.cloneElement(e,{...o,...u,"data-_gt":void 0,children:r({source:o.children,target:n.c,locales:i,enableI18n:a})}):t({children:e,defaultLocale:i[0],enableI18n:a})}function r({source:r,target:i,locales:a=[`en`],enableI18n:o}){if(i==null&&r)return t({children:r,defaultLocale:a[0],enableI18n:o});if(typeof i==`string`)return i;if(Array.isArray(i)&&!Array.isArray(r)&&r&&(r=[r]),Array.isArray(r)&&Array.isArray(i)){let t={},s={},c={},l=r.filter(e=>{if(p.default.isValidElement(e))if(Lt(e.props)){let{variableName:n,variableValue:r,variableOptions:i,injectionType:a}=q(e.props);t[n]=r,s[n]=i,c[n]=a}else return!0;return!1}),u=e=>l.find(t=>{let n=cn(t);return n?.id===void 0?!1:n.id===e.i})||l.shift();return i.map((r,i)=>{if(typeof r==`string`)return(0,h.jsx)(p.default.Fragment,{children:r},`string_${i}`);if(S(r))return(0,h.jsx)(p.default.Fragment,{children:e({variableType:r.v||`v`,variableValue:t[r.k],variableOptions:s[r.k],locales:a,enableI18n:o,injectionType:c[r.k]||`manual`})},`var_${i}`);let l=u(r);return l?(0,h.jsx)(p.default.Fragment,{children:n({sourceElement:l,targetElement:r,locales:a,enableI18n:o})},`element_${i}`):null})}if(i&&typeof i==`object`&&!Array.isArray(i)){let t=S(i)?`variable`:`element`;if(p.default.isValidElement(r)){if(t===`element`)return n({sourceElement:r,targetElement:i,locales:a,enableI18n:o});if(Lt(r.props)){let{variableValue:t,variableOptions:n,variableType:i,injectionType:s}=q(r.props);return e({variableType:i,variableValue:t,variableOptions:n,locales:a,enableI18n:o,injectionType:s})}}}return t({children:r,defaultLocale:a[0],enableI18n:o})}return r}function dn({renderVariable:e}){let t=ln({renderVariable:e}),n=un({renderVariable:e});function r({taggedSourceChildren:e,targetJsxChildren:t,locale:n,defaultLocale:r,enableI18n:o,shouldTranslate:s}){return!s||t==null?i({taggedSourceChildren:e,defaultLocale:r,enableI18n:o}):a({taggedSourceChildren:e,targetJsxChildren:t,locales:[n,r],enableI18n:o})}function i({taggedSourceChildren:e,defaultLocale:n,enableI18n:r}){return t({children:e,defaultLocale:n,enableI18n:r})}function a({taggedSourceChildren:e,targetJsxChildren:t,locales:r,enableI18n:i}){return n({source:e,target:t,locales:r,enableI18n:i})}return r}function fn(e){let t=sn(e);return{renderVariable:t,renderDefaultChildren:ln({renderVariable:t}),renderTranslatedChildren:un({renderVariable:t}),renderPreparedT:dn({renderVariable:t})}}function pn(e){if(typeof e==`string`)return!0;if(Array.isArray(e)){if(typeof e?.[0]!=`string`)return!1;let t=e?.[1];if(t===void 0||t&&typeof t==`object`)return!0}return!1}function X(e,t){let n=e,r=t.split(`.`);for(let e of r){if(typeof n!=`object`&&!Array.isArray(n))return;n=G(n,e)}return n}function Z(e){if(Array.isArray(e)){if(e.length===1)return{entry:e[0]};if(e.length===2)return{entry:e[0],metadata:e[1]}}return{entry:e}}function mn(e){let t=e;if(t&&typeof t==`object`&&typeof t.k==`string`){let e=Object.keys(t);if(e.length===1||e.length===2&&(typeof t.i==`number`||typeof t.v==`string`)||e.length===3&&typeof t.v==`string`&&typeof t.i==`number`)return!0}return!1}function hn(){return``}function Q(e){return e===void 0?!1:typeof e==`string`?!0:Array.isArray(e)?!(e.length!==1&&e.length!==2||typeof e[0]!=`string`||e.length===2&&(typeof e[1]!=`object`||e[1]===null||!(`$context`in e[1])&&!(`$maxChars`in e[1])&&!(`$_hash`in e[1]))):!1}const gn=e=>typeof e==`string`||Array.isArray(e),_n=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function $(e,t){if(Array.isArray(e))return e.map((e,n)=>Q(e)?t[n]:$(e,t[n]));let n={...Object.fromEntries(Object.entries(e).filter(([,e])=>gn(e))),...Object.fromEntries(Object.entries(t).filter(([,e])=>gn(e)))},r=Object.entries(e).filter(([,e])=>_n(e)).map(([e])=>e),i=Object.entries(t).filter(([,e])=>_n(e)).map(([e])=>e),a=new Set([...r,...i]);for(let r of a)n[r]=$(G(e,r)||{},G(t,r)||{});return n}const vn=(e=`production`)=>({method:`default`,timeout:e===`development`?8e3:12e3}),yn=typeof p.use==`function`;function bn({dictionary:e,id:t}){if(t===``)return e;let n=e,r=t.split(`.`);for(let e of r)n=G(n,e);return n}function xn({dictionary:e,id:t,sourceDictionary:n}){if(t===``)return e;let r=e,i=n,a=t.split(`.`);for(let e of a)G(r,e)===void 0&&(Array.isArray(G(i,e))?K(r,e,[]):K(r,e,{})),r=G(r,e);return r}const Sn=[`constructor`,`prototype`,`__proto__`];function Cn(e){return!!Sn.includes(e)}function wn(e,t,n,r){if(Q(t))return e;let i=n.split(`.`);i.forEach(e=>{if(Cn(e))throw Error(`Invalid key: ${e}`)}),t||={};for(let e of i.slice(0,-1))G(t,e)??K(t,e,Array.isArray(G(r,e))?[]:{}),t=G(t,e),r=G(r,e);let a=i[i.length-1];K(t,a,e)}function Tn(e){let t={};return Array.isArray(e)&&(t=[]),Object.entries(e).forEach(([e,n])=>{if(Q(n)){let{entry:r}=Z(n);K(t,e,r)}else K(t,e,Tn(n))}),t}function En(e){return ie(ve(ae(e))).slice(0,16)}function Dn({source:e,context:t,id:n,maxChars:r,dataFormat:i},a=En){let o;return o=i===`JSX`?kn(e):e,a(te({source:o,...n&&{id:n},...t&&{context:t},...r!=null&&{maxChars:Math.abs(r)},...i&&{dataFormat:i}}))}const On=e=>{if(e&&typeof e==`object`){let t={};if(`c`in e&&e.c&&(t.c=kn(e.c)),`d`in e){let n=e?.d;n?.b&&(t.b=Object.fromEntries(Object.entries(n.b).map(([e,t])=>[e,kn(t)]))),n?.t&&(t.t=n.t)}return S(e)?{k:e.k,...e.v&&{v:e.v}}:t}return e};function kn(e){return Array.isArray(e)?e.map(On):On(e)}function An(e,t=``){let n=!1;return Object.entries(e).forEach(([r,i])=>{let a=t?`${t}.${r}`:r;if(Q(i)){let{entry:t,metadata:o}=Z(i);o?.$_hash||(o||={},o.$_hash=Dn({source:Tt(t),...o?.$context&&{context:o.$context},...o?.$maxChars!=null&&{maxChars:Math.abs(o.$maxChars)},id:a,dataFormat:`ICU`}),K(e,r,[t,o]),n=!0)}else{let{updateDictionary:e}=An(i,a);n||=e}}),{dictionary:e,updateDictionary:n}}function jn(e,t,n,r,i=``){let a=!1,o=i?i.split(`.`):[];return r.forEach(({metadata:r})=>{let{$_hash:i,$id:s}=r,c=o.length>0?s.split(`.`).slice(o.length).join(`.`):s,l=X(t,c),u;Q(l)&&(u=Z(l).entry);let d=n[i]||u;d&&(wn(d,t,c,e),a=!0)}),{dictionary:t,updateDictionary:a}}function Mn(e,t,n,r=``){let i=r?r.split(`.`):[];return n.forEach(({source:n,metadata:r})=>{let{$id:a}=r,o=i.length>0?a.split(`.`).slice(i.length).join(`.`):a,s=X(t,o),c;Q(s)&&(c=Z(s).entry),wn(c||n,t,o,e)}),t}const Nn=e=>`Dictionary subtree "${e}" could not be found`,Pn=()=>`A dictionary entry cannot be injected as a subtree`,Fn=()=>`A dictionary entry cannot be merged into another dictionary entry`;function In(e,t,n){let r=bn({dictionary:e,id:n});if(!r)throw Error(Nn(n));if(Q(r))throw Error(Pn());return Ln(e,$(r,t),n)}function Ln(e,t,n){let r=X(e,n);if(!r)throw Error(Nn(n));if(Q(r))throw Error(Fn());let i=n.split(`.`),a=i.slice(0,-1),o=i[i.length-1],s=e;return a.forEach(e=>{s=G(s,e)}),K(s,o,t),e}function Rn(e,t,n=``){let r=[];return Object.entries(e).forEach(([e,i])=>{let a=n?`${n}.${e}`:e;if(Q(i)){let{entry:n,metadata:o}=Z(i);G(t,e)||r.push({source:n,metadata:{$id:a,$context:o?.$context,$maxChars:o?.$maxChars,$_hash:o?.$_hash||``}})}else r.push(...Rn(i,G(t,e)||(Array.isArray(i)?[]:{}),a))}),r}var zn=class extends m.I18nCache{};function Bn(e){(0,m.setupGTServicesEnabled)(e),Gt(e,`server-render`),Bt(new zn(e))}function Vn(e,t){return e.add(t),()=>{e.delete(t)}}function Hn(e,t){let n=t.options.$_hash??(0,m.hashMessage)(t.message,t.options);return e?.[t.locale]?.[n]}function Un(e,t){return(0,m.getDictionaryEntry)(Gn(e,t))}function Wn(e,t){return Gn(e,t)}function Gn(e,{locale:t,id:n}){let r=e?.[t];if(!r)return;if(!n)return r;let i=r;for(let e of n.split(`.`)){if(!Kn(e)||!(0,m.isDictionaryValue)(i)||!Object.prototype.hasOwnProperty.call(i,e))return;i=i[e]}return i}function Kn(e){return e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}var qn=class{translateListeners=new Set;dictionaryEntryListeners=new Set;dictionaryObjectListeners=new Set;constructor(){}updateTranslations=e=>{J().updateTranslations(e)};updateDictionaries=e=>{J().updateDictionaries(e)};translate=async e=>J().lookupTranslationWithFallback(e.locale,e.message,e.options).then(t=>{this.emitTranslateEvent(e)});translateDictionaryEntry=e=>{J().lookupDictionaryWithFallback(e.locale,e.id).then(t=>{this.emitDictionaryEvent(e)})};translateDictionaryObject=e=>{J().lookupDictionaryObjWithFallback(e.locale,e.id).then(t=>{this.emitDictionaryEvent(e)})};subscribeToTranslate=(e,t)=>{let n=(0,m.getTranslateListenerKey)(e);return Vn(this.translateListeners,e=>{(0,m.getTranslateListenerKey)(e)===n&&t()})};subscribeToTranslationEvents=e=>Vn(this.translateListeners,e);subscribeToDictionaryEntryEvents=e=>Vn(this.dictionaryEntryListeners,e);subscribeToDictionaryObjectEvents=e=>Vn(this.dictionaryObjectListeners,e);getTranslateSnapshot=(e,t={})=>Hn(t,e)??J().lookupTranslation(e.locale,e.message,e.options);getDictionaryEntrySnapshot=(e,t={})=>Un(t,e)??J().lookupDictionary(e.locale,e.id);getDictionaryObjectSnapshot=(e,t={})=>Wn(t,e)??J().lookupDictionaryObj(e.locale,e.id);emitTranslateEvent(e){this.translateListeners.forEach(t=>t(e))}emitDictionaryEvent(e){this.dictionaryEntryListeners.forEach(t=>t(e)),this.dictionaryObjectListeners.forEach(t=>{t(e)})}};function Jn(){let e=globalThis;return e.__generaltranslation??={},e.__generaltranslation.reactCore??={},e.__generaltranslation.reactCore}function Yn(){let e=Jn().i18nStore;if(!e)throw Qn();return e}function Xn(e){let t=Jn();t.i18nStore&&t.i18nStore!==e&&console.warn($n()),t.i18nStore=e}function Zn(){return Jn().i18nStore!==void 0}function Qn(){let e=b({source:`@generaltranslation/react-core`,severity:`Error`,whatHappened:`Cannot access I18nStore before it is initialized.`,fix:Y().getRenderStrategy()===`SPA`?`Initialize GT before reading GT runtime context.`:`Add a <GTProvider> at the root of your component tree.`});return Error(e)}function $n(){return b({source:`@generaltranslation/react-core`,severity:`Warning`,whatHappened:`Overwriting global i18nStore singleton instance`})}function er(e){(0,m.setupGTServicesEnabled)(e),Gt(e,`SPA`),Bt(new m.I18nCache(e)),Yt(new m.WritableConditionStore(e)),Xn(new qn)}exports.I18nStore=qn,exports.ReactI18nCache=zn,exports.ReactI18nConfig=Ut,Object.defineProperty(exports,`ReadonlyConditionStore`,{enumerable:!0,get:function(){return m.ReadonlyConditionStore}}),Object.defineProperty(exports,`WritableConditionStore`,{enumerable:!0,get:function(){return m.WritableConditionStore}}),exports.addGTIdentifier=Et,exports.collectUntranslatedEntries=Rn,exports.createRenderPipeline=fn,Object.defineProperty(exports,`declareVar`,{enumerable:!0,get:function(){return f.declareVar}}),Object.defineProperty(exports,`decodeMsg`,{enumerable:!0,get:function(){return f.decodeMsg}}),Object.defineProperty(exports,`decodeOptions`,{enumerable:!0,get:function(){return f.decodeOptions}}),Object.defineProperty(exports,`decodeVars`,{enumerable:!0,get:function(){return f.decodeVars}}),exports.defaultEnableI18nCookieName=`generaltranslation.enable-i18n`,exports.defaultLocaleCookieName=`generaltranslation.locale`,exports.defaultRegionCookieName=`generaltranslation.region`,Object.defineProperty(exports,`derive`,{enumerable:!0,get:function(){return f.derive}}),exports.flattenDictionary=It,Object.defineProperty(exports,`getDefaultLocale`,{enumerable:!0,get:function(){return f.getDefaultLocale}}),exports.getDefaultRenderSettings=vn,exports.getDictionaryEntry=X,exports.getEntryAndMetadata=Z,exports.getFormatLocales=zt,Object.defineProperty(exports,`getGTClass`,{enumerable:!0,get:function(){return f.getGTClass}}),exports.getI18nConfig=Y,exports.getI18nStore=Yn,Object.defineProperty(exports,`getLocaleProperties`,{enumerable:!0,get:function(){return f.getLocaleProperties}}),Object.defineProperty(exports,`getLocales`,{enumerable:!0,get:function(){return f.getLocales}}),exports.getPluralBranch=U,exports.getReactI18nCache=J,exports.getReadonlyConditionStoreWithFallback=Zt,exports.getSubtree=bn,exports.getSubtreeWithCreation=xn,exports.getTranslationsSnapshot=Vt,exports.getVariableName=Ot,exports.getVariableProps=q,Object.defineProperty(exports,`getVersionId`,{enumerable:!0,get:function(){return f.getVersionId}}),Object.defineProperty(exports,`gtFallback`,{enumerable:!0,get:function(){return f.gtFallback}}),exports.initializeGT=Bn,exports.internalInitializeGTSRA=Bn,exports.initializeI18nConfig=Gt,exports.injectAndMerge=In,exports.injectEntry=wn,exports.injectFallbacks=Mn,exports.injectHashes=An,exports.injectTranslations=jn,exports.internalInitializeGTSPA=er,exports.isDictionaryEntry=Q,exports.isI18nStoreInitialized=Zn,exports.isValidDictionaryEntry=pn,exports.isVariableObject=mn,Object.defineProperty(exports,`mFallback`,{enumerable:!0,get:function(){return f.mFallback}}),exports.mergeDictionaries=$,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return f.msg}}),exports.reactHasUse=yn,exports.renderSkeleton=hn,exports.setI18nConfig=Wt,exports.setI18nStore=Xn,exports.setReactI18nCache=Bt,exports.setReadonlyConditionStore=Yt,exports.stripMetadataFromEntries=Tn,exports.t=$t,exports.writeChildrenAsObjects=W;
2
- //# sourceMappingURL=pure.cjs.min.cjs.map