@incodetech/web 2.4.1-agentic → 2.4.1-agentic.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 (352) hide show
  1. package/THIRD_PARTY_NOTICES.txt +1 -4
  2. package/dist/{GeolocationPermissionDenied-CUt-uebQ.js → GeolocationPermissionDenied-Dag9fchQ.js} +23 -8
  3. package/dist/Password-4ht2vsqv.js +212 -0
  4. package/dist/RadioGroup-Cf6xDIm5.js +123 -0
  5. package/dist/RequiredLegend-DwaAzhid.js +16 -0
  6. package/dist/RequiredMarker-CGQR8lsb.js +16 -0
  7. package/dist/TextField-o3qwE7KD.js +166 -0
  8. package/dist/ae-signature/ae-signature.es.js +4 -4
  9. package/dist/{af-ZA-BWKMRc6V.js → af-ZA-CdJRBJEg.js} +107 -881
  10. package/dist/{ageVerification-CMIp0I--.js → ageVerification-u2zo-WUl.js} +10 -8
  11. package/dist/{am-DPyjIvQV.js → am-Df9uoE6e.js} +107 -881
  12. package/dist/antifraud/antifraud.es.js +5 -4
  13. package/dist/{applyStudioConfig-DxtP9221.js → applyStudioConfig-Deh55YNW.js} +2 -2
  14. package/dist/{ar-AE-CxCvbyoW.js → ar-AE-CAoWsgnA.js} +107 -881
  15. package/dist/{ar-EG-B1hHB55j.js → ar-EG-CXi0p-DV.js} +107 -881
  16. package/dist/{ar-10SoqF1i.js → ar-hyEIwsq9.js} +108 -882
  17. package/dist/assertClassBrand-CuHX5JcR.js +17 -0
  18. package/dist/authentication/authentication.es.js +7 -5
  19. package/dist/autoFocusTitle-CNeT8ydU.js +19 -0
  20. package/dist/{az-cmuBNn_5.js → az-CUehzrK3.js} +107 -881
  21. package/dist/{back-horizontal-hint-Dl2C4J4u.js → back-horizontal-hint-D5xvRtEe.js} +1 -1
  22. package/dist/{back-vertical-hint-CM4_HjWk.js → back-vertical-hint-DoKJSQhY.js} +1 -1
  23. package/dist/base.css +1 -1
  24. package/dist/{baseTutorial-BGU2Gcly.js → baseTutorial-xDkp34JC.js} +9 -7
  25. package/dist/{bn-CuGYlngZ.js → bn-DStUscj0.js} +107 -881
  26. package/dist/{bottomSheet-x20yd6eP.js → bottomSheet-COrgITc6.js} +3 -3
  27. package/dist/{bs-vwpJzaHm.js → bs-Lq1FPKJj.js} +107 -881
  28. package/dist/{ca-DXZs5vtr.js → ca-K83Ys4Fe.js} +107 -881
  29. package/dist/cameraOverlay-Bciqav_0.js +2 -0
  30. package/dist/{cameraOverlayHeader-BxutAKy-.js → cameraOverlayHeader-C7Pi5eIm.js} +9 -8
  31. package/dist/{cameraView-DVzaEGW8.js → cameraView-B7l40Opf.js} +3 -3
  32. package/dist/capture-D7HVD1ht.js +754 -0
  33. package/dist/capture-Do7z-u0d.js +3 -0
  34. package/dist/{tutorial-BKPHj5To.js → capture-I1enj-0M.js} +28 -68
  35. package/dist/capture-WaSNv1Wn.js +2 -0
  36. package/dist/captureButtonIcon-DVbAZ8TK.js +1 -0
  37. package/dist/captureFocusContext-CNtkY3Lk.js +718 -0
  38. package/dist/captureFooter-CucCxqz-.js +47 -0
  39. package/dist/{ceb-CmhS_VOs.js → ceb-NR8sWgTh.js} +107 -881
  40. package/dist/certificate-issuance/certificate-issuance.es.js +68 -41
  41. package/dist/certificate-issuance/styles.css +1 -1
  42. package/dist/certificate-issuance/styles.css.js +1 -1
  43. package/dist/{checkbox-BC26Qbxh.js → checkbox-C5k2pepr.js} +4 -4
  44. package/dist/chooser-CNm0MKQl.js +1517 -0
  45. package/dist/connectionError-Bs3TO2RP.js +100 -0
  46. package/dist/consent/consent.es.js +16 -12
  47. package/dist/{countryFlag-DXSVHiby.js → countryFlag-CZUyZ06G.js} +1 -1
  48. package/dist/{countrySelector-0PDDFsZF.js → countrySelector-CPgaMT7n.js} +4 -4
  49. package/dist/cross-document-data-match/cross-document-data-match.es.js +5 -4
  50. package/dist/{cs-CZ-Dg5O-Vom.js → cs-CZ-KpSXcWZT.js} +107 -881
  51. package/dist/{cs-CoJlE7De.js → cs-UYoUjOrG.js} +107 -881
  52. package/dist/curp-validation/curp-validation.es.js +97 -96
  53. package/dist/curp-validation/styles.css +1 -1
  54. package/dist/curp-validation/styles.css.js +1 -1
  55. package/dist/{customFields-COYGTuuK.js → customFields-BcubL9au.js} +33 -19
  56. package/dist/{customWatchlist-B0wY6Rwb.js → customWatchlist-D4RK0ow6.js} +11 -8
  57. package/dist/{da-DK-C_JAndM-.js → da-DK-Bds8n-Rj.js} +107 -881
  58. package/dist/dashboardTheme-DQaxmEq3.js +383 -0
  59. package/dist/dateInputComposed-BrpUtswb.js +1 -0
  60. package/dist/{dateInputComposed-QkmLGLHg.js → dateInputComposed-BzCDzTM3.js} +4 -5
  61. package/dist/{de-11hHLedu.js → de-CZlvE1Xz.js} +107 -881
  62. package/dist/denied-BeVKpBem.js +272 -0
  63. package/dist/devWarn-B4kGEiva.js +1056 -0
  64. package/dist/{deviceWallet-BeTpokSL.js → deviceWallet-7b1VpcGm.js} +4 -4
  65. package/dist/{digitalIdRedirect-BnljwZV3.js → digitalIdRedirect-CG9jzrQh.js} +4 -4
  66. package/dist/{digitalIdUpload-DNhqqMHT.js → digitalIdUpload-BUJcgYY5.js} +37 -15
  67. package/dist/document-capture/document-capture.es.js +1 -1
  68. package/dist/document-capture/styles.css +1 -1
  69. package/dist/document-capture/styles.css.js +1 -1
  70. package/dist/documentCapture-BdEStEoH.js +2 -0
  71. package/dist/{documentCapture-uAKPK1U-.js → documentCapture-JcxukEgT.js} +113 -59
  72. package/dist/dropdownComposed-C36c9ZOm.js +1 -0
  73. package/dist/{dropdownComposed-D_RQd0Z9.js → dropdownComposed-yNmLuHxU.js} +8 -6
  74. package/dist/dynamic-forms/dynamic-forms.es.js +62 -35
  75. package/dist/ekyb/ekyb.es.js +1 -1
  76. package/dist/{ekybModule-Bsqag_MS.js → ekybModule-Cp-7fs23.js} +109 -89
  77. package/dist/ekybModule-ccZRVb7E.js +2 -0
  78. package/dist/ekyc/ekyc.es.js +1 -1
  79. package/dist/ekyc-prefill/ekyc-prefill.es.js +2 -0
  80. package/dist/ekyc-prefill/styles.css +2 -0
  81. package/dist/ekyc-prefill/styles.css.js +1 -0
  82. package/dist/ekycModule-CcZTIgGK.js +2 -0
  83. package/dist/ekycModule-DKUZp3Ww.js +358 -0
  84. package/dist/ekycPrefillModule-Bou_Ig42.js +2 -0
  85. package/dist/ekycPrefillModule-DJoeviHP.js +233 -0
  86. package/dist/{el-CRGmVrep.js → el-C6tFl9i9.js} +107 -881
  87. package/dist/{el-GR-CjtJiRTo.js → el-GR-BLkQ_dbO.js} +107 -881
  88. package/dist/electronic-signature/electronic-signature.es.js +1 -1
  89. package/dist/{electronic-signature-Cm2BEiQu.js → electronic-signature-D-4uTJdE.js} +55 -36
  90. package/dist/email/email.es.js +21 -16
  91. package/dist/{emailInput-JmK2JIFS.js → emailInput-C5VHG66O.js} +23 -12
  92. package/dist/{en-DG-Cruu6Woh.js → en-DG-BEuiDKtl.js} +107 -881
  93. package/dist/{en-CSjoG3e4.js → en-DNBypQuu.js} +107 -881
  94. package/dist/{errorContent-zY4jb6uY.js → errorContent-BC8mDFld.js} +21 -20
  95. package/dist/{formField-C3MNhFKI.js → errorParams-W7NX72mI.js} +2 -33
  96. package/dist/es-419-BCIRYhZK.js +5 -0
  97. package/dist/{es-C_LAY-Yu.js → es-DjQEM4f9.js} +108 -882
  98. package/dist/{es-ES-D7O0P5Mg.js → es-ES-Q6nMptUM.js} +107 -881
  99. package/dist/{es-MX-DVzFaANh.js → es-MX-Df5g3bAX.js} +107 -881
  100. package/dist/{et-DdSwjU5d.js → et-BYRhgB8X.js} +108 -882
  101. package/dist/expiredId-BVa13c9u.js +67 -0
  102. package/dist/extensibility.es.js +368 -42
  103. package/dist/{fa-IR-CdK8XLkS.js → fa-IR-DP-FPc-r.js} +107 -881
  104. package/dist/face-match/face-match.es.js +1 -1
  105. package/dist/face-match/styles.css +1 -1
  106. package/dist/face-match/styles.css.js +1 -1
  107. package/dist/faceMatch-B2n0FPIm.js +2 -0
  108. package/dist/{faceMatch-B0IzR9_u.js → faceMatch-C5QmR3Vt.js} +44 -53
  109. package/dist/{fi-FI-CYlEPu44.js → fi-FI-rnIjEC7X.js} +107 -881
  110. package/dist/field-comparison/field-comparison.es.js +1 -1
  111. package/dist/fieldComparison-CDGiqzsu.js +126 -0
  112. package/dist/fieldComparison-D-LmR1LR.js +2 -0
  113. package/dist/{fieldLabelHint-gdoE5nLQ.js → fieldLabelHint-eF42wLDJ.js} +3 -3
  114. package/dist/{finalSuccessScreen-BM9oeJDH.js → finalSuccessScreen-vOR061dK.js} +31 -22
  115. package/dist/fiscal-qr/fiscal-qr.es.js +25 -22
  116. package/dist/flipAnimation-CGP9Fu9J.js +46 -0
  117. package/dist/flipCapturedCardEligibility-C8wQ0_No.js +210 -0
  118. package/dist/flow/flow.es.js +216 -191
  119. package/dist/flow/shell/styles.css +1 -1
  120. package/dist/flow/shell/styles.css.js +1 -1
  121. package/dist/flow/styles.css +1 -1
  122. package/dist/formField-DrSwXufE.js +49 -0
  123. package/dist/{fr-CA-DD_s9NuV.js → fr-CA-vPsubqTC.js} +107 -881
  124. package/dist/{fr-C4cP8ZNE.js → fr-P8YbBMxT.js} +107 -881
  125. package/dist/{front-horizontal-hint-Dol0Lpc6.js → front-horizontal-hint-CDHj9LQF.js} +1 -1
  126. package/dist/{front-vertical-hint-CAhAzw92.js → front-vertical-hint-B_pU27Iv.js} +1 -1
  127. package/dist/geolocation/geolocation.es.js +15 -10
  128. package/dist/government-validation/government-validation.es.js +7 -6
  129. package/dist/{he-D3fvMZAl.js → he-DfptjOXC.js} +107 -881
  130. package/dist/{hi-DLf6_opn.js → hi-C7tSzMcB.js} +107 -881
  131. package/dist/{hmn-DzoODzbN.js → hmn-jKsUYgaq.js} +107 -881
  132. package/dist/{homeScreen-D1Xd93In.js → homeScreen-C1b8yg4y.js} +21 -14
  133. package/dist/{incodeComponent-C1Bz5Qou.js → hooks-COiwxC3h.js} +39 -325
  134. package/dist/{hr-C-jP0DrB.js → hr-ehtrddz3.js} +107 -881
  135. package/dist/{ht-CVt9koJf.js → ht-CA5NNkri.js} +107 -881
  136. package/dist/{hu-9fSzIeAd.js → hu-DYgOdNXH.js} +107 -881
  137. package/dist/{icons-BdiCuWFP.js → icons-CLoob8B-.js} +129 -56
  138. package/dist/id/id.es.js +166 -197
  139. package/dist/id/styles.css +1 -1
  140. package/dist/id/styles.css.js +1 -1
  141. package/dist/{id-Dgi5uGHK.js → id-CMBxWcTV.js} +107 -881
  142. package/dist/{id-back-of-card-CHFxXTEq.js → id-back-of-card-BEAthtU0.js} +1 -1
  143. package/dist/{id-back-of-card-vertical-CUBdKGbw.js → id-back-of-card-vertical-Ce0d7tp5.js} +1 -1
  144. package/dist/{id-front-of-card-DplNJr13.js → id-front-of-card-DS0lS9jP.js} +1 -1
  145. package/dist/{id-front-of-card-vertical-D1duHEsV.js → id-front-of-card-vertical-BLWn85NX.js} +1 -1
  146. package/dist/id-selfie-flow/id-selfie-flow.es.js +13 -11
  147. package/dist/id-selfie-flow/styles.css +1 -1
  148. package/dist/id-verification/id-verification.es.js +6 -5
  149. package/dist/idFlipTransition-3z8Lqcab.js +154 -0
  150. package/dist/{idOcr-sknZwQNF.js → idOcr-qPEZSG5D.js} +64 -37
  151. package/dist/identity-reuse/identity-reuse.es.js +36 -24
  152. package/dist/incodeComponent-CxWTvgqz.js +235 -0
  153. package/dist/{incodeModule-DJToJb00.js → incodeModule-BQVPjhJE.js} +5 -5
  154. package/dist/index.es.js +3 -3
  155. package/dist/{inputComposed-BuE0iZlw.js → inputComposed-oWeKvdES.js} +4 -4
  156. package/dist/{it-CEFstYFG.js → it-DNcyH3GL.js} +107 -881
  157. package/dist/{ja-BNdVd9B6.js → ja-BkVsn7yw.js} +107 -881
  158. package/dist/{ja-JP-B5TPMV1q.js → ja-JP-BI4iShf-.js} +108 -882
  159. package/dist/{jv-CMxkkXUk.js → jv-Bpp0lYl-.js} +107 -881
  160. package/dist/{ka-C70bUmEK.js → ka-__y8BNrb.js} +107 -881
  161. package/dist/{kk-C_55EmWt.js → kk-C8RZv7Y9.js} +107 -881
  162. package/dist/{km-D4Ig0NhN.js → km-CdNpEVlv.js} +114 -888
  163. package/dist/{ko-DfUa3dzQ.js → ko-Db8jh_Pq.js} +107 -881
  164. package/dist/{ko-KP-BwBB8ahu.js → ko-KP-Cn4RuF_b.js} +107 -881
  165. package/dist/{ky-CnJichOm.js → ky-DljlRCIf.js} +107 -881
  166. package/dist/kyb-checks/kyb-checks.es.js +2 -0
  167. package/dist/kyb-checks/styles.css +2 -0
  168. package/dist/kyb-checks/styles.css.js +1 -0
  169. package/dist/kybChecksModule-B2nSWMuy.js +2 -0
  170. package/dist/kybChecksModule-DGXAS1Sc.js +345 -0
  171. package/dist/{lo-ww1DXVAP.js → lo-DXJI47k7.js} +107 -881
  172. package/dist/{lt-IJ8qpluI.js → lt-CUHwdgrq.js} +107 -881
  173. package/dist/{lv-DMfsmqyK.js → lv-BFrYWmGH.js} +107 -881
  174. package/dist/{mandatoryConsent-Bp8sQoiu.js → mandatoryConsent-Dc0PQou0.js} +20 -14
  175. package/dist/{manualCaptureButton-Cd-FY05-.js → manualCaptureButton-DIlebb4i.js} +8 -7
  176. package/dist/{manualCaptureButton-BXOTp2PS.js → manualCaptureButton-t0b_hCKH.js} +15 -12
  177. package/dist/{mk-ByafmFak.js → mk-BRpnPevj.js} +107 -881
  178. package/dist/{mn-DjO9p3xN.js → mn-tly7Lz7o.js} +107 -881
  179. package/dist/{ms-3Vf1QpHl.js → ms-DFpRACK3.js} +107 -881
  180. package/dist/{my-C5hpE5P1.js → my-G2jJl4tA.js} +107 -881
  181. package/dist/{nb-NO-DGCWCOul.js → nb-NO-CaDPgzxb.js} +107 -881
  182. package/dist/{ne-CpJxcVhV.js → ne-BaCq8Imv.js} +107 -881
  183. package/dist/{nl-R2RykJHB.js → nl-BK-jT4yQ.js} +107 -881
  184. package/dist/{optionAccessibleLabel-BQl8HooZ.js → optionAccessibleLabel-CDKKh7c3.js} +25 -10
  185. package/dist/otpInput-B4mH5be-.js +245 -0
  186. package/dist/{page-utEpSa9Z.js → page-5CklyQnq.js} +86 -44
  187. package/dist/{pageUiConfig-rOL18JSI.js → pageUiConfig-DZQHreIo.js} +67 -25
  188. package/dist/{passport-horizontal-hint-BfTXA2LB.js → passport-horizontal-hint-JdWoLKa5.js} +1 -1
  189. package/dist/{passport-vertical-hint-C7dzd2ks.js → passport-vertical-hint-BgtJXbvC.js} +1 -1
  190. package/dist/passwordRequirements-bbbHZACR.js +49 -0
  191. package/dist/{pdf-BnPw8ZaT.js → pdf-CLcY9ugT.js} +2 -17
  192. package/dist/pdfViewer-2NTW2bZn.js +2 -0
  193. package/dist/{pdfViewer-DNMZsDFD.js → pdfViewer-D4xu2J13.js} +11 -14
  194. package/dist/permissionInstructionList-Dmy2y4cX.js +43 -0
  195. package/dist/{permissions-CCEc9lKM.js → permissions-BPh2QNoI.js} +84 -53
  196. package/dist/phone/phone.es.js +16 -12
  197. package/dist/{phoneInputComposed-ByiK_6Hu.js → phoneInputComposed-Dzt9xdrF.js} +6 -6
  198. package/dist/{pl-B1LgnPj1.js → pl-CoWZGdbr.js} +107 -881
  199. package/dist/preloadableLazy-2hqV2Q8z.js +43 -0
  200. package/dist/{processing-Ci_Kl-Rh.js → processing-DStiN9XK.js} +2 -2
  201. package/dist/{progressBar-Caj-Vu1e.js → progressBar-CJqJXzAh.js} +2 -2
  202. package/dist/{pt-CPVeH0hD.js → pt-BDByRgpr.js} +107 -881
  203. package/dist/{pt-BR-DSJDHb-K.js → pt-BR-BRMyrqIN.js} +107 -881
  204. package/dist/{pt-PT-BWJTVPZY.js → pt-PT-CfwlYo6V.js} +107 -881
  205. package/dist/qe-signature/qe-signature.es.js +4 -4
  206. package/dist/redirect-to-mobile/redirect-to-mobile.es.js +34 -33
  207. package/dist/redirect-to-mobile/styles.css +1 -1
  208. package/dist/redirect-to-mobile/styles.css.js +1 -1
  209. package/dist/{registerIncodeElement-Dtw9dM3O.js → registerIncodeElement-B5W7SqS3.js} +1 -1
  210. package/dist/{resendTimer-ODOCcKyh.js → resendTimer-COMRdeDC.js} +2 -2
  211. package/dist/richText-BMvr5dhl.js +1761 -0
  212. package/dist/{ro-8gGEWeHO.js → ro-ju058j4P.js} +107 -881
  213. package/dist/{ru-C4EVku5S.js → ru-DYwhf4Hw.js} +107 -881
  214. package/dist/{ru-RU-Dr0NOGjg.js → ru-RU-BAvJW-vp.js} +107 -881
  215. package/dist/{sanitizeSvg-ilJ8VQmH.js → sanitizeSvg-BZoCoRr0.js} +1 -1
  216. package/dist/selfie/selfie.es.js +30 -14
  217. package/dist/selfie/styles.css +1 -1
  218. package/dist/selfie/styles.css.js +1 -1
  219. package/dist/signature/signature.es.js +18 -13
  220. package/dist/{sk-BSTzMa__.js → sk-Cl6F-Kaz.js} +108 -882
  221. package/dist/{sl-_HvO-HVX.js → sl-BxsNneWx.js} +107 -881
  222. package/dist/{smsTabContent-CWBrtP4u.js → smsTabContent-BLJM1Hbk.js} +40 -27
  223. package/dist/{so-pyCaqonl.js → so-D8izvKPD.js} +107 -881
  224. package/dist/spacer-NanHQwzu.js +1100 -0
  225. package/dist/spinner-bRH4yw9e.js +69 -0
  226. package/dist/{sr-Bpxtt0kk.js → sr-BtsYxFKz.js} +107 -881
  227. package/dist/{sr-Latn-BjueCJSI.js → sr-Latn-BTn5o62j.js} +112 -886
  228. package/dist/sr-YU-BNViLYA5.js +5 -0
  229. package/dist/step-up/step-up.es.js +483 -0
  230. package/dist/step-up/styles.css +2 -0
  231. package/dist/{sv-SE-sv5v6ZWe.js → sv-SE-f5R8i8ue.js} +107 -881
  232. package/dist/{sw-BseJSmdR.js → sw-BgHNoEGs.js} +107 -881
  233. package/dist/{th-TH-D0WNW-3l.js → th-TH-DmfU-a6A.js} +107 -881
  234. package/dist/{th-C2G8Ur12.js → th-aFkhFNxp.js} +107 -881
  235. package/dist/themes/dark.css +1 -1
  236. package/dist/themes/light.css +1 -1
  237. package/dist/{tl-CBOmxz5r.js → tl-CA42NVfv.js} +107 -881
  238. package/dist/{tl-PH-CwafDrED.js → tl-PH-DMCUe7pP.js} +107 -881
  239. package/dist/{tr-C4iH8UJx.js → tr-BVjID0jl.js} +108 -882
  240. package/dist/{transitionSpinner-DbrWrpRU.js → transitionSpinner-MclJtdHE.js} +5 -5
  241. package/dist/tutorial-fC2iei2v.js +28 -0
  242. package/dist/types/ae-signature.d.ts +7 -3
  243. package/dist/types/antifraud.d.ts +7 -3
  244. package/dist/types/authentication.d.ts +7 -3
  245. package/dist/types/certificate-issuance.d.ts +7 -3
  246. package/dist/types/consent.d.ts +7 -3
  247. package/dist/types/cross-document-data-match.d.ts +7 -3
  248. package/dist/types/curp-validation.d.ts +7 -3
  249. package/dist/types/document-capture.d.ts +7 -3
  250. package/dist/types/dynamic-forms.d.ts +7 -3
  251. package/dist/types/ekyb.d.ts +7 -3
  252. package/dist/types/ekyc-prefill.d.ts +213 -0
  253. package/dist/types/ekyc.d.ts +7 -3
  254. package/dist/types/electronic-signature.d.ts +7 -3
  255. package/dist/types/email.d.ts +7 -3
  256. package/dist/types/extensibility.d.ts +63 -17
  257. package/dist/types/face-match.d.ts +7 -3
  258. package/dist/types/field-comparison.d.ts +7 -3
  259. package/dist/types/fiscal-qr.d.ts +7 -3
  260. package/dist/types/flow.d.ts +16 -3
  261. package/dist/types/geolocation.d.ts +7 -3
  262. package/dist/types/government-validation.d.ts +7 -3
  263. package/dist/types/id-selfie-flow.d.ts +7 -3
  264. package/dist/types/id-verification.d.ts +7 -3
  265. package/dist/types/id.d.ts +7 -3
  266. package/dist/types/identity-reuse.d.ts +7 -3
  267. package/dist/types/index.d.ts +4 -0
  268. package/dist/types/kyb-checks.d.ts +213 -0
  269. package/dist/types/phone.d.ts +7 -3
  270. package/dist/types/qe-signature.d.ts +7 -3
  271. package/dist/types/selfie.d.ts +7 -3
  272. package/dist/types/signature.d.ts +7 -3
  273. package/dist/types/step-up.d.ts +85 -0
  274. package/dist/types/watchlist.d.ts +7 -3
  275. package/dist/types/workflow.d.ts +7 -3
  276. package/dist/{typography-BF9d8wEc.js → typography-Dncyo-3D.js} +3 -11
  277. package/dist/{uk-BGYlvKb_.js → uk-HjZTXCOA.js} +107 -881
  278. package/dist/{uk-UA-CbxzkCL_.js → uk-UA-ChpoWDcU.js} +108 -882
  279. package/dist/{ur-BQgtsAfv.js → ur-CZkQHBM4.js} +107 -881
  280. package/dist/{useCameraPreview-BmkAmzAs.js → useCameraPreview-DrteOjaq.js} +1 -1
  281. package/dist/useCaptureHelpButton-B5zEGcaB.js +43 -0
  282. package/dist/{useIsDarkTheme-COJZngNK.js → useIsDarkTheme-DAs5RhsW.js} +1 -1
  283. package/dist/{useModuleLoader-CceEKjsh.js → useModuleLoader-C2fbLotc.js} +8 -3
  284. package/dist/{uz-DqOg1Fdv.js → uz-BCp_m_Om.js} +107 -881
  285. package/dist/{vendor-preact-C0jX1Cbq.js → vendor-preact-HIccnts1.js} +19 -1
  286. package/dist/{verificationResult-m99Ragq6.js → verificationResult-sh4xut0K.js} +30 -27
  287. package/dist/{vi-COxdKkHn.js → vi-BvxcvDgc.js} +107 -881
  288. package/dist/video-selfie/styles.css +1 -1
  289. package/dist/video-selfie/styles.css.js +1 -1
  290. package/dist/video-selfie/video-selfie.es.js +64 -42
  291. package/dist/watchlist/watchlist.es.js +12 -8
  292. package/dist/{watchlistForBusiness-C2zxbavl.js → watchlistForBusiness-DnS1r-Ml.js} +38 -22
  293. package/dist/{withEndScreenTexts-BwNU-8-X.js → withEndScreenTexts-CHWofhk5.js} +212 -46
  294. package/dist/workflow/styles.css +1 -1
  295. package/dist/workflow/workflow.es.js +1 -530
  296. package/dist/workflow-DBS9eyu4.js +533 -0
  297. package/dist/{zh-CN-DfvYQGdE.js → zh-CN-DZRia1ir.js} +108 -882
  298. package/dist/{zh-CPQoDPxf.js → zh-DN_kUZaR.js} +107 -881
  299. package/dist/{zh-HANT-B4LzHH2y.js → zh-HANT-DisU_Tal.js} +107 -881
  300. package/dist/{zh-TW-DtvvhBYL.js → zh-TW-BJzCsdPP.js} +107 -881
  301. package/package.json +44 -12
  302. package/dist/autoFocusTitle-BxsSeMSB.js +0 -32
  303. package/dist/browser-ponyfill-CHlXHPpU.js +0 -441
  304. package/dist/cameraOverlay-Be1PFI8S.js +0 -2
  305. package/dist/check-icon-BWTjhSuA.js +0 -48
  306. package/dist/dashboardTheme-COBidrbH.js +0 -246
  307. package/dist/dateInputComposed-CONPVayx.js +0 -1
  308. package/dist/denied-Btt81vUD.js +0 -1871
  309. package/dist/devWarn-Cr7MglXv.js +0 -2628
  310. package/dist/documentCapture-DGCraCO3.js +0 -2
  311. package/dist/dropdownComposed-DyZXfcTf.js +0 -1
  312. package/dist/ekybModule-D-czIusz.js +0 -2
  313. package/dist/ekycModule-CkBRa6h2.js +0 -2
  314. package/dist/ekycModule-WlhVn8AO.js +0 -321
  315. package/dist/es-419-CTB15v-l.js +0 -3231
  316. package/dist/esm-BTUEHyry.js +0 -430
  317. package/dist/expiredId-DpbWqSzB.js +0 -80
  318. package/dist/faceMatch-CRbIcwK2.js +0 -2
  319. package/dist/fieldComparison-DKQNK0-r.js +0 -2
  320. package/dist/fieldComparison-OwGIeOM5.js +0 -109
  321. package/dist/flipAnimation-D-5tokFC.js +0 -3275
  322. package/dist/inputComposed-5mLbxAZJ.js +0 -1
  323. package/dist/numberedStep-CqgNwc_a.js +0 -13
  324. package/dist/otpInput-B_iLvmIn.js +0 -157
  325. package/dist/passwordInputComposed-NtiseM85.js +0 -74
  326. package/dist/pdfViewer-7FzYV8l3.js +0 -2
  327. package/dist/radioGroupComposed-CocqpoKe.js +0 -160
  328. package/dist/radioGroupComposed-DlQ-fNrF.js +0 -1
  329. package/dist/reload-icon-BR1POqkD.js +0 -70
  330. package/dist/richText-CRWB2afV.js +0 -1549
  331. package/dist/spacer-CwyNauIk.js +0 -733
  332. package/dist/spinner-DEZJxLSc.js +0 -88
  333. package/dist/sr-YU-xCb5qxap.js +0 -3235
  334. package/dist/useCaptureHelpButton-D40hYyD7.js +0 -88
  335. /package/dist/{aligndevicelottie-BHWuptBk.js → aligndevicelottie-DroBRtbt.js} +0 -0
  336. /package/dist/{back-tutorial-BYZr11eV.js → back-tutorial-ydxRtY-Y.js} +0 -0
  337. /package/dist/{backdevicelottie-JflQKxT_.js → backdevicelottie-hv8vbwYH.js} +0 -0
  338. /package/dist/{blurdevicelottie-CWuMQEHL.js → blurdevicelottie-Cgu4hKn7.js} +0 -0
  339. /package/dist/{countryDefinitions-6FOOLcB2.js → countryDefinitions-DlsV3Tf8.js} +0 -0
  340. /package/dist/{defineProperty-CUC2zCmh.js → defineProperty-CRYuXE79.js} +0 -0
  341. /package/dist/{flip-animation-BqTKEBcW.js → flip-animation-CJhh7l_J.js} +0 -0
  342. /package/dist/{frontdevicelottie-BWD-NCfG.js → frontdevicelottie-vyO3BJJe.js} +0 -0
  343. /package/dist/{glaredevicelottie-Cjy50jGc.js → glaredevicelottie-DrgkRjFh.js} +0 -0
  344. /package/dist/{id-laser-h-By7lMim8.js → id-laser-h-CUz29uFc.js} +0 -0
  345. /package/dist/{id-laser-v-BCPAN2x5.js → id-laser-v-Bnf10QJp.js} +0 -0
  346. /package/dist/{id-tutorial-B9cUQuf0.js → id-tutorial-DGwvKAMs.js} +0 -0
  347. /package/dist/{lottie_light-DywVSPMT.js → lottie_light-BXXuEKyZ.js} +0 -0
  348. /package/dist/{passport-tutorial-TSZzEGqb.js → passport-tutorial-DoqqyBXo.js} +0 -0
  349. /package/dist/{pdf.worker.min-D7ZNTVBZ.js → pdf.worker.min-Cm2oniEB.js} +0 -0
  350. /package/dist/{policyUrls-Bpacx_pp.js → policyUrls-Hvb4jPfF.js} +0 -0
  351. /package/dist/{purify.es-DZazHwBu.js → purify.es-DIIgrZ-E.js} +0 -0
  352. /package/dist/{selfieTutorial-CLJAEuXG.js → selfieTutorial-BTewRjM5.js} +0 -0
@@ -1,2628 +0,0 @@
1
- import { S as k, _ as y, f as d, h as q, r as C, u as T, v as u, y as K } from "./vendor-preact-C0jX1Cbq.js";
2
- //#region ../../node_modules/.pnpm/i18next@25.7.1_typescript@5.9.3/node_modules/i18next/dist/esm/i18next.js
3
- var isString = (obj) => typeof obj === "string";
4
- var defer = () => {
5
- let res;
6
- let rej;
7
- const promise = new Promise((resolve, reject) => {
8
- res = resolve;
9
- rej = reject;
10
- });
11
- promise.resolve = res;
12
- promise.reject = rej;
13
- return promise;
14
- };
15
- var makeString = (object) => {
16
- if (object == null) return "";
17
- return "" + object;
18
- };
19
- var copy = (a, s, t) => {
20
- a.forEach((m) => {
21
- if (s[m]) t[m] = s[m];
22
- });
23
- };
24
- var lastOfPathSeparatorRegExp = /###/g;
25
- var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
26
- var canNotTraverseDeeper = (object) => !object || isString(object);
27
- var getLastOfPath = (object, path, Empty) => {
28
- const stack = !isString(path) ? path : path.split(".");
29
- let stackIndex = 0;
30
- while (stackIndex < stack.length - 1) {
31
- if (canNotTraverseDeeper(object)) return {};
32
- const key = cleanKey(stack[stackIndex]);
33
- if (!object[key] && Empty) object[key] = new Empty();
34
- if (Object.prototype.hasOwnProperty.call(object, key)) object = object[key];
35
- else object = {};
36
- ++stackIndex;
37
- }
38
- if (canNotTraverseDeeper(object)) return {};
39
- return {
40
- obj: object,
41
- k: cleanKey(stack[stackIndex])
42
- };
43
- };
44
- var setPath = (object, path, newValue) => {
45
- const { obj, k } = getLastOfPath(object, path, Object);
46
- if (obj !== void 0 || path.length === 1) {
47
- obj[k] = newValue;
48
- return;
49
- }
50
- let e = path[path.length - 1];
51
- let p = path.slice(0, path.length - 1);
52
- let last = getLastOfPath(object, p, Object);
53
- while (last.obj === void 0 && p.length) {
54
- e = `${p[p.length - 1]}.${e}`;
55
- p = p.slice(0, p.length - 1);
56
- last = getLastOfPath(object, p, Object);
57
- if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== "undefined") last.obj = void 0;
58
- }
59
- last.obj[`${last.k}.${e}`] = newValue;
60
- };
61
- var pushPath = (object, path, newValue, concat) => {
62
- const { obj, k } = getLastOfPath(object, path, Object);
63
- obj[k] = obj[k] || [];
64
- obj[k].push(newValue);
65
- };
66
- var getPath = (object, path) => {
67
- const { obj, k } = getLastOfPath(object, path);
68
- if (!obj) return void 0;
69
- if (!Object.prototype.hasOwnProperty.call(obj, k)) return void 0;
70
- return obj[k];
71
- };
72
- var getPathWithDefaults = (data, defaultData, key) => {
73
- const value = getPath(data, key);
74
- if (value !== void 0) return value;
75
- return getPath(defaultData, key);
76
- };
77
- var deepExtend = (target, source, overwrite) => {
78
- for (const prop in source) if (prop !== "__proto__" && prop !== "constructor") if (prop in target) if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
79
- if (overwrite) target[prop] = source[prop];
80
- } else deepExtend(target[prop], source[prop], overwrite);
81
- else target[prop] = source[prop];
82
- return target;
83
- };
84
- var regexEscape = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
85
- var _entityMap = {
86
- "&": "&amp;",
87
- "<": "&lt;",
88
- ">": "&gt;",
89
- "\"": "&quot;",
90
- "'": "&#39;",
91
- "/": "&#x2F;"
92
- };
93
- var escape = (data) => {
94
- if (isString(data)) return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
95
- return data;
96
- };
97
- var RegExpCache = class {
98
- constructor(capacity) {
99
- this.capacity = capacity;
100
- this.regExpMap = /* @__PURE__ */ new Map();
101
- this.regExpQueue = [];
102
- }
103
- getRegExp(pattern) {
104
- const regExpFromCache = this.regExpMap.get(pattern);
105
- if (regExpFromCache !== void 0) return regExpFromCache;
106
- const regExpNew = new RegExp(pattern);
107
- if (this.regExpQueue.length === this.capacity) this.regExpMap.delete(this.regExpQueue.shift());
108
- this.regExpMap.set(pattern, regExpNew);
109
- this.regExpQueue.push(pattern);
110
- return regExpNew;
111
- }
112
- };
113
- var chars = [
114
- " ",
115
- ",",
116
- "?",
117
- "!",
118
- ";"
119
- ];
120
- var looksLikeObjectPathRegExpCache = new RegExpCache(20);
121
- var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
122
- nsSeparator = nsSeparator || "";
123
- keySeparator = keySeparator || "";
124
- const possibleChars = chars.filter((c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
125
- if (possibleChars.length === 0) return true;
126
- const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => c === "?" ? "\\?" : c).join("|")})`);
127
- let matched = !r.test(key);
128
- if (!matched) {
129
- const ki = key.indexOf(keySeparator);
130
- if (ki > 0 && !r.test(key.substring(0, ki))) matched = true;
131
- }
132
- return matched;
133
- };
134
- var deepFind = (obj, path, keySeparator = ".") => {
135
- if (!obj) return void 0;
136
- if (obj[path]) {
137
- if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
138
- return obj[path];
139
- }
140
- const tokens = path.split(keySeparator);
141
- let current = obj;
142
- for (let i = 0; i < tokens.length;) {
143
- if (!current || typeof current !== "object") return;
144
- let next;
145
- let nextPath = "";
146
- for (let j = i; j < tokens.length; ++j) {
147
- if (j !== i) nextPath += keySeparator;
148
- nextPath += tokens[j];
149
- next = current[nextPath];
150
- if (next !== void 0) {
151
- if ([
152
- "string",
153
- "number",
154
- "boolean"
155
- ].indexOf(typeof next) > -1 && j < tokens.length - 1) continue;
156
- i += j - i + 1;
157
- break;
158
- }
159
- }
160
- current = next;
161
- }
162
- return current;
163
- };
164
- var getCleanedCode = (code) => code?.replace("_", "-");
165
- var consoleLogger = {
166
- type: "logger",
167
- log(args) {
168
- this.output("log", args);
169
- },
170
- warn(args) {
171
- this.output("warn", args);
172
- },
173
- error(args) {
174
- this.output("error", args);
175
- },
176
- output(type, args) {
177
- console?.[type]?.apply?.(console, args);
178
- }
179
- };
180
- var baseLogger = new class Logger {
181
- constructor(concreteLogger, options = {}) {
182
- this.init(concreteLogger, options);
183
- }
184
- init(concreteLogger, options = {}) {
185
- this.prefix = options.prefix || "i18next:";
186
- this.logger = concreteLogger || consoleLogger;
187
- this.options = options;
188
- this.debug = options.debug;
189
- }
190
- log(...args) {
191
- return this.forward(args, "log", "", true);
192
- }
193
- warn(...args) {
194
- return this.forward(args, "warn", "", true);
195
- }
196
- error(...args) {
197
- return this.forward(args, "error", "");
198
- }
199
- deprecate(...args) {
200
- return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
201
- }
202
- forward(args, lvl, prefix, debugOnly) {
203
- if (debugOnly && !this.debug) return null;
204
- if (isString(args[0])) args[0] = `${prefix}${this.prefix} ${args[0]}`;
205
- return this.logger[lvl](args);
206
- }
207
- create(moduleName) {
208
- return new Logger(this.logger, {
209
- prefix: `${this.prefix}:${moduleName}:`,
210
- ...this.options
211
- });
212
- }
213
- clone(options) {
214
- options = options || this.options;
215
- options.prefix = options.prefix || this.prefix;
216
- return new Logger(this.logger, options);
217
- }
218
- }();
219
- var EventEmitter = class {
220
- constructor() {
221
- this.observers = {};
222
- }
223
- on(events, listener) {
224
- events.split(" ").forEach((event) => {
225
- if (!this.observers[event]) this.observers[event] = /* @__PURE__ */ new Map();
226
- const numListeners = this.observers[event].get(listener) || 0;
227
- this.observers[event].set(listener, numListeners + 1);
228
- });
229
- return this;
230
- }
231
- off(event, listener) {
232
- if (!this.observers[event]) return;
233
- if (!listener) {
234
- delete this.observers[event];
235
- return;
236
- }
237
- this.observers[event].delete(listener);
238
- }
239
- emit(event, ...args) {
240
- if (this.observers[event]) Array.from(this.observers[event].entries()).forEach(([observer, numTimesAdded]) => {
241
- for (let i = 0; i < numTimesAdded; i++) observer(...args);
242
- });
243
- if (this.observers["*"]) Array.from(this.observers["*"].entries()).forEach(([observer, numTimesAdded]) => {
244
- for (let i = 0; i < numTimesAdded; i++) observer.apply(observer, [event, ...args]);
245
- });
246
- }
247
- };
248
- var ResourceStore = class extends EventEmitter {
249
- constructor(data, options = {
250
- ns: ["translation"],
251
- defaultNS: "translation"
252
- }) {
253
- super();
254
- this.data = data || {};
255
- this.options = options;
256
- if (this.options.keySeparator === void 0) this.options.keySeparator = ".";
257
- if (this.options.ignoreJSONStructure === void 0) this.options.ignoreJSONStructure = true;
258
- }
259
- addNamespaces(ns) {
260
- if (this.options.ns.indexOf(ns) < 0) this.options.ns.push(ns);
261
- }
262
- removeNamespaces(ns) {
263
- const index = this.options.ns.indexOf(ns);
264
- if (index > -1) this.options.ns.splice(index, 1);
265
- }
266
- getResource(lng, ns, key, options = {}) {
267
- const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
268
- const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
269
- let path;
270
- if (lng.indexOf(".") > -1) path = lng.split(".");
271
- else {
272
- path = [lng, ns];
273
- if (key) if (Array.isArray(key)) path.push(...key);
274
- else if (isString(key) && keySeparator) path.push(...key.split(keySeparator));
275
- else path.push(key);
276
- }
277
- const result = getPath(this.data, path);
278
- if (!result && !ns && !key && lng.indexOf(".") > -1) {
279
- lng = path[0];
280
- ns = path[1];
281
- key = path.slice(2).join(".");
282
- }
283
- if (result || !ignoreJSONStructure || !isString(key)) return result;
284
- return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
285
- }
286
- addResource(lng, ns, key, value, options = { silent: false }) {
287
- const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
288
- let path = [lng, ns];
289
- if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
290
- if (lng.indexOf(".") > -1) {
291
- path = lng.split(".");
292
- value = ns;
293
- ns = path[1];
294
- }
295
- this.addNamespaces(ns);
296
- setPath(this.data, path, value);
297
- if (!options.silent) this.emit("added", lng, ns, key, value);
298
- }
299
- addResources(lng, ns, resources, options = { silent: false }) {
300
- for (const m in resources) if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], { silent: true });
301
- if (!options.silent) this.emit("added", lng, ns, resources);
302
- }
303
- addResourceBundle(lng, ns, resources, deep, overwrite, options = {
304
- silent: false,
305
- skipCopy: false
306
- }) {
307
- let path = [lng, ns];
308
- if (lng.indexOf(".") > -1) {
309
- path = lng.split(".");
310
- deep = resources;
311
- resources = ns;
312
- ns = path[1];
313
- }
314
- this.addNamespaces(ns);
315
- let pack = getPath(this.data, path) || {};
316
- if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
317
- if (deep) deepExtend(pack, resources, overwrite);
318
- else pack = {
319
- ...pack,
320
- ...resources
321
- };
322
- setPath(this.data, path, pack);
323
- if (!options.silent) this.emit("added", lng, ns, resources);
324
- }
325
- removeResourceBundle(lng, ns) {
326
- if (this.hasResourceBundle(lng, ns)) delete this.data[lng][ns];
327
- this.removeNamespaces(ns);
328
- this.emit("removed", lng, ns);
329
- }
330
- hasResourceBundle(lng, ns) {
331
- return this.getResource(lng, ns) !== void 0;
332
- }
333
- getResourceBundle(lng, ns) {
334
- if (!ns) ns = this.options.defaultNS;
335
- return this.getResource(lng, ns);
336
- }
337
- getDataByLanguage(lng) {
338
- return this.data[lng];
339
- }
340
- hasLanguageSomeTranslations(lng) {
341
- const data = this.getDataByLanguage(lng);
342
- return !!(data && Object.keys(data) || []).find((v) => data[v] && Object.keys(data[v]).length > 0);
343
- }
344
- toJSON() {
345
- return this.data;
346
- }
347
- };
348
- var postProcessor = {
349
- processors: {},
350
- addPostProcessor(module) {
351
- this.processors[module.name] = module;
352
- },
353
- handle(processors, value, key, options, translator) {
354
- processors.forEach((processor) => {
355
- value = this.processors[processor]?.process(value, key, options, translator) ?? value;
356
- });
357
- return value;
358
- }
359
- };
360
- var PATH_KEY = Symbol("i18next/PATH_KEY");
361
- function createProxy() {
362
- const state = [];
363
- const handler = Object.create(null);
364
- let proxy;
365
- handler.get = (target, key) => {
366
- proxy?.revoke?.();
367
- if (key === PATH_KEY) return state;
368
- state.push(key);
369
- proxy = Proxy.revocable(target, handler);
370
- return proxy.proxy;
371
- };
372
- return Proxy.revocable(Object.create(null), handler).proxy;
373
- }
374
- function keysFromSelector(selector, opts) {
375
- const { [PATH_KEY]: path } = selector(createProxy());
376
- return path.join(opts?.keySeparator ?? ".");
377
- }
378
- var checkedLoadedFor = {};
379
- var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
380
- var Translator = class Translator extends EventEmitter {
381
- constructor(services, options = {}) {
382
- super();
383
- copy([
384
- "resourceStore",
385
- "languageUtils",
386
- "pluralResolver",
387
- "interpolator",
388
- "backendConnector",
389
- "i18nFormat",
390
- "utils"
391
- ], services, this);
392
- this.options = options;
393
- if (this.options.keySeparator === void 0) this.options.keySeparator = ".";
394
- this.logger = baseLogger.create("translator");
395
- }
396
- changeLanguage(lng) {
397
- if (lng) this.language = lng;
398
- }
399
- exists(key, o = { interpolation: {} }) {
400
- const opt = { ...o };
401
- if (key == null) return false;
402
- const resolved = this.resolve(key, opt);
403
- if (resolved?.res === void 0) return false;
404
- const isObject = shouldHandleAsObject(resolved.res);
405
- if (opt.returnObjects === false && isObject) return false;
406
- return true;
407
- }
408
- extractFromKey(key, opt) {
409
- let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
410
- if (nsSeparator === void 0) nsSeparator = ":";
411
- const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
412
- let namespaces = opt.ns || this.options.defaultNS || [];
413
- const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
414
- const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
415
- if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
416
- const m = key.match(this.interpolator.nestingRegexp);
417
- if (m && m.length > 0) return {
418
- key,
419
- namespaces: isString(namespaces) ? [namespaces] : namespaces
420
- };
421
- const parts = key.split(nsSeparator);
422
- if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
423
- key = parts.join(keySeparator);
424
- }
425
- return {
426
- key,
427
- namespaces: isString(namespaces) ? [namespaces] : namespaces
428
- };
429
- }
430
- translate(keys, o, lastKey) {
431
- let opt = typeof o === "object" ? { ...o } : o;
432
- if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) opt = this.options.overloadTranslationOptionHandler(arguments);
433
- if (typeof opt === "object") opt = { ...opt };
434
- if (!opt) opt = {};
435
- if (keys == null) return "";
436
- if (typeof keys === "function") keys = keysFromSelector(keys, {
437
- ...this.options,
438
- ...opt
439
- });
440
- if (!Array.isArray(keys)) keys = [String(keys)];
441
- const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
442
- const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
443
- const { key, namespaces } = this.extractFromKey(keys[keys.length - 1], opt);
444
- const namespace = namespaces[namespaces.length - 1];
445
- let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
446
- if (nsSeparator === void 0) nsSeparator = ":";
447
- const lng = opt.lng || this.language;
448
- const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
449
- if (lng?.toLowerCase() === "cimode") {
450
- if (appendNamespaceToCIMode) {
451
- if (returnDetails) return {
452
- res: `${namespace}${nsSeparator}${key}`,
453
- usedKey: key,
454
- exactUsedKey: key,
455
- usedLng: lng,
456
- usedNS: namespace,
457
- usedParams: this.getUsedParamsDetails(opt)
458
- };
459
- return `${namespace}${nsSeparator}${key}`;
460
- }
461
- if (returnDetails) return {
462
- res: key,
463
- usedKey: key,
464
- exactUsedKey: key,
465
- usedLng: lng,
466
- usedNS: namespace,
467
- usedParams: this.getUsedParamsDetails(opt)
468
- };
469
- return key;
470
- }
471
- const resolved = this.resolve(keys, opt);
472
- let res = resolved?.res;
473
- const resUsedKey = resolved?.usedKey || key;
474
- const resExactUsedKey = resolved?.exactUsedKey || key;
475
- const noObject = [
476
- "[object Number]",
477
- "[object Function]",
478
- "[object RegExp]"
479
- ];
480
- const joinArrays = opt.joinArrays !== void 0 ? opt.joinArrays : this.options.joinArrays;
481
- const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
482
- const needsPluralHandling = opt.count !== void 0 && !isString(opt.count);
483
- const hasDefaultValue = Translator.hasDefaultValue(opt);
484
- const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : "";
485
- const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, { ordinal: false }) : "";
486
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
487
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
488
- let resForObjHndl = res;
489
- if (handleAsObjectInI18nFormat && !res && hasDefaultValue) resForObjHndl = defaultValue;
490
- const handleAsObject = shouldHandleAsObject(resForObjHndl);
491
- const resType = Object.prototype.toString.apply(resForObjHndl);
492
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
493
- if (!opt.returnObjects && !this.options.returnObjects) {
494
- if (!this.options.returnedObjectHandler) this.logger.warn("accessing an object - but returnObjects options is not enabled!");
495
- const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
496
- ...opt,
497
- ns: namespaces
498
- }) : `key '${key} (${this.language})' returned an object instead of string.`;
499
- if (returnDetails) {
500
- resolved.res = r;
501
- resolved.usedParams = this.getUsedParamsDetails(opt);
502
- return resolved;
503
- }
504
- return r;
505
- }
506
- if (keySeparator) {
507
- const resTypeIsArray = Array.isArray(resForObjHndl);
508
- const copy = resTypeIsArray ? [] : {};
509
- const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
510
- for (const m in resForObjHndl) if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
511
- const deepKey = `${newKeyToUse}${keySeparator}${m}`;
512
- if (hasDefaultValue && !res) copy[m] = this.translate(deepKey, {
513
- ...opt,
514
- defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : void 0,
515
- joinArrays: false,
516
- ns: namespaces
517
- });
518
- else copy[m] = this.translate(deepKey, {
519
- ...opt,
520
- joinArrays: false,
521
- ns: namespaces
522
- });
523
- if (copy[m] === deepKey) copy[m] = resForObjHndl[m];
524
- }
525
- res = copy;
526
- }
527
- } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
528
- res = res.join(joinArrays);
529
- if (res) res = this.extendTranslation(res, keys, opt, lastKey);
530
- } else {
531
- let usedDefault = false;
532
- let usedKey = false;
533
- if (!this.isValidLookup(res) && hasDefaultValue) {
534
- usedDefault = true;
535
- res = defaultValue;
536
- }
537
- if (!this.isValidLookup(res)) {
538
- usedKey = true;
539
- res = key;
540
- }
541
- const resForMissing = (opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && usedKey ? void 0 : res;
542
- const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
543
- if (usedKey || usedDefault || updateMissing) {
544
- this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue : res);
545
- if (keySeparator) {
546
- const fk = this.resolve(key, {
547
- ...opt,
548
- keySeparator: false
549
- });
550
- if (fk && fk.res) this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
551
- }
552
- let lngs = [];
553
- const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
554
- if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) for (let i = 0; i < fallbackLngs.length; i++) lngs.push(fallbackLngs[i]);
555
- else if (this.options.saveMissingTo === "all") lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
556
- else lngs.push(opt.lng || this.language);
557
- const send = (l, k, specificDefaultValue) => {
558
- const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
559
- if (this.options.missingKeyHandler) this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
560
- else if (this.backendConnector?.saveMissing) this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
561
- this.emit("missingKey", l, namespace, k, res);
562
- };
563
- if (this.options.saveMissing) if (this.options.saveMissingPlurals && needsPluralHandling) lngs.forEach((language) => {
564
- const suffixes = this.pluralResolver.getSuffixes(language, opt);
565
- if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) suffixes.push(`${this.options.pluralSeparator}zero`);
566
- suffixes.forEach((suffix) => {
567
- send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
568
- });
569
- });
570
- else send(lngs, key, defaultValue);
571
- }
572
- res = this.extendTranslation(res, keys, opt, resolved, lastKey);
573
- if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}${nsSeparator}${key}`;
574
- if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : void 0, opt);
575
- }
576
- if (returnDetails) {
577
- resolved.res = res;
578
- resolved.usedParams = this.getUsedParamsDetails(opt);
579
- return resolved;
580
- }
581
- return res;
582
- }
583
- extendTranslation(res, key, opt, resolved, lastKey) {
584
- if (this.i18nFormat?.parse) res = this.i18nFormat.parse(res, {
585
- ...this.options.interpolation.defaultVariables,
586
- ...opt
587
- }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, { resolved });
588
- else if (!opt.skipInterpolation) {
589
- if (opt.interpolation) this.interpolator.init({
590
- ...opt,
591
- interpolation: {
592
- ...this.options.interpolation,
593
- ...opt.interpolation
594
- }
595
- });
596
- const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
597
- let nestBef;
598
- if (skipOnVariables) {
599
- const nb = res.match(this.interpolator.nestingRegexp);
600
- nestBef = nb && nb.length;
601
- }
602
- let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
603
- if (this.options.interpolation.defaultVariables) data = {
604
- ...this.options.interpolation.defaultVariables,
605
- ...data
606
- };
607
- res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
608
- if (skipOnVariables) {
609
- const na = res.match(this.interpolator.nestingRegexp);
610
- const nestAft = na && na.length;
611
- if (nestBef < nestAft) opt.nest = false;
612
- }
613
- if (!opt.lng && resolved && resolved.res) opt.lng = this.language || resolved.usedLng;
614
- if (opt.nest !== false) res = this.interpolator.nest(res, (...args) => {
615
- if (lastKey?.[0] === args[0] && !opt.context) {
616
- this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
617
- return null;
618
- }
619
- return this.translate(...args, key);
620
- }, opt);
621
- if (opt.interpolation) this.interpolator.reset();
622
- }
623
- const postProcess = opt.postProcess || this.options.postProcess;
624
- const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
625
- if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
626
- i18nResolved: {
627
- ...resolved,
628
- usedParams: this.getUsedParamsDetails(opt)
629
- },
630
- ...opt
631
- } : opt, this);
632
- return res;
633
- }
634
- resolve(keys, opt = {}) {
635
- let found;
636
- let usedKey;
637
- let exactUsedKey;
638
- let usedLng;
639
- let usedNS;
640
- if (isString(keys)) keys = [keys];
641
- keys.forEach((k) => {
642
- if (this.isValidLookup(found)) return;
643
- const extracted = this.extractFromKey(k, opt);
644
- const key = extracted.key;
645
- usedKey = key;
646
- let namespaces = extracted.namespaces;
647
- if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
648
- const needsPluralHandling = opt.count !== void 0 && !isString(opt.count);
649
- const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
650
- const needsContextHandling = opt.context !== void 0 && (isString(opt.context) || typeof opt.context === "number") && opt.context !== "";
651
- const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
652
- namespaces.forEach((ns) => {
653
- if (this.isValidLookup(found)) return;
654
- usedNS = ns;
655
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
656
- checkedLoadedFor[`${codes[0]}-${ns}`] = true;
657
- this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
658
- }
659
- codes.forEach((code) => {
660
- if (this.isValidLookup(found)) return;
661
- usedLng = code;
662
- const finalKeys = [key];
663
- if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
664
- else {
665
- let pluralSuffix;
666
- if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
667
- const zeroSuffix = `${this.options.pluralSeparator}zero`;
668
- const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
669
- if (needsPluralHandling) {
670
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
671
- finalKeys.push(key + pluralSuffix);
672
- if (needsZeroSuffixLookup) finalKeys.push(key + zeroSuffix);
673
- }
674
- if (needsContextHandling) {
675
- const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
676
- finalKeys.push(contextKey);
677
- if (needsPluralHandling) {
678
- if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
679
- finalKeys.push(contextKey + pluralSuffix);
680
- if (needsZeroSuffixLookup) finalKeys.push(contextKey + zeroSuffix);
681
- }
682
- }
683
- }
684
- let possibleKey;
685
- while (possibleKey = finalKeys.pop()) if (!this.isValidLookup(found)) {
686
- exactUsedKey = possibleKey;
687
- found = this.getResource(code, ns, possibleKey, opt);
688
- }
689
- });
690
- });
691
- });
692
- return {
693
- res: found,
694
- usedKey,
695
- exactUsedKey,
696
- usedLng,
697
- usedNS
698
- };
699
- }
700
- isValidLookup(res) {
701
- return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
702
- }
703
- getResource(code, ns, key, options = {}) {
704
- if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
705
- return this.resourceStore.getResource(code, ns, key, options);
706
- }
707
- getUsedParamsDetails(options = {}) {
708
- const optionsKeys = [
709
- "defaultValue",
710
- "ordinal",
711
- "context",
712
- "replace",
713
- "lng",
714
- "lngs",
715
- "fallbackLng",
716
- "ns",
717
- "keySeparator",
718
- "nsSeparator",
719
- "returnObjects",
720
- "returnDetails",
721
- "joinArrays",
722
- "postProcess",
723
- "interpolation"
724
- ];
725
- const useOptionsReplaceForData = options.replace && !isString(options.replace);
726
- let data = useOptionsReplaceForData ? options.replace : options;
727
- if (useOptionsReplaceForData && typeof options.count !== "undefined") data.count = options.count;
728
- if (this.options.interpolation.defaultVariables) data = {
729
- ...this.options.interpolation.defaultVariables,
730
- ...data
731
- };
732
- if (!useOptionsReplaceForData) {
733
- data = { ...data };
734
- for (const key of optionsKeys) delete data[key];
735
- }
736
- return data;
737
- }
738
- static hasDefaultValue(options) {
739
- const prefix = "defaultValue";
740
- for (const option in options) if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, 12) && void 0 !== options[option]) return true;
741
- return false;
742
- }
743
- };
744
- var LanguageUtil = class {
745
- constructor(options) {
746
- this.options = options;
747
- this.supportedLngs = this.options.supportedLngs || false;
748
- this.logger = baseLogger.create("languageUtils");
749
- }
750
- getScriptPartFromCode(code) {
751
- code = getCleanedCode(code);
752
- if (!code || code.indexOf("-") < 0) return null;
753
- const p = code.split("-");
754
- if (p.length === 2) return null;
755
- p.pop();
756
- if (p[p.length - 1].toLowerCase() === "x") return null;
757
- return this.formatLanguageCode(p.join("-"));
758
- }
759
- getLanguagePartFromCode(code) {
760
- code = getCleanedCode(code);
761
- if (!code || code.indexOf("-") < 0) return code;
762
- const p = code.split("-");
763
- return this.formatLanguageCode(p[0]);
764
- }
765
- formatLanguageCode(code) {
766
- if (isString(code) && code.indexOf("-") > -1) {
767
- let formattedCode;
768
- try {
769
- formattedCode = Intl.getCanonicalLocales(code)[0];
770
- } catch (e) {}
771
- if (formattedCode && this.options.lowerCaseLng) formattedCode = formattedCode.toLowerCase();
772
- if (formattedCode) return formattedCode;
773
- if (this.options.lowerCaseLng) return code.toLowerCase();
774
- return code;
775
- }
776
- return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
777
- }
778
- isSupportedCode(code) {
779
- if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) code = this.getLanguagePartFromCode(code);
780
- return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
781
- }
782
- getBestMatchFromCodes(codes) {
783
- if (!codes) return null;
784
- let found;
785
- codes.forEach((code) => {
786
- if (found) return;
787
- const cleanedLng = this.formatLanguageCode(code);
788
- if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;
789
- });
790
- if (!found && this.options.supportedLngs) codes.forEach((code) => {
791
- if (found) return;
792
- const lngScOnly = this.getScriptPartFromCode(code);
793
- if (this.isSupportedCode(lngScOnly)) return found = lngScOnly;
794
- const lngOnly = this.getLanguagePartFromCode(code);
795
- if (this.isSupportedCode(lngOnly)) return found = lngOnly;
796
- found = this.options.supportedLngs.find((supportedLng) => {
797
- if (supportedLng === lngOnly) return supportedLng;
798
- if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0) return;
799
- if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly) return supportedLng;
800
- if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1) return supportedLng;
801
- });
802
- });
803
- if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
804
- return found;
805
- }
806
- getFallbackCodes(fallbacks, code) {
807
- if (!fallbacks) return [];
808
- if (typeof fallbacks === "function") fallbacks = fallbacks(code);
809
- if (isString(fallbacks)) fallbacks = [fallbacks];
810
- if (Array.isArray(fallbacks)) return fallbacks;
811
- if (!code) return fallbacks.default || [];
812
- let found = fallbacks[code];
813
- if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
814
- if (!found) found = fallbacks[this.formatLanguageCode(code)];
815
- if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
816
- if (!found) found = fallbacks.default;
817
- return found || [];
818
- }
819
- toResolveHierarchy(code, fallbackCode) {
820
- const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
821
- const codes = [];
822
- const addCode = (c) => {
823
- if (!c) return;
824
- if (this.isSupportedCode(c)) codes.push(c);
825
- else this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
826
- };
827
- if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
828
- if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
829
- if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
830
- if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
831
- } else if (isString(code)) addCode(this.formatLanguageCode(code));
832
- fallbackCodes.forEach((fc) => {
833
- if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));
834
- });
835
- return codes;
836
- }
837
- };
838
- var suffixesOrder = {
839
- zero: 0,
840
- one: 1,
841
- two: 2,
842
- few: 3,
843
- many: 4,
844
- other: 5
845
- };
846
- var dummyRule = {
847
- select: (count) => count === 1 ? "one" : "other",
848
- resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
849
- };
850
- var PluralResolver = class {
851
- constructor(languageUtils, options = {}) {
852
- this.languageUtils = languageUtils;
853
- this.options = options;
854
- this.logger = baseLogger.create("pluralResolver");
855
- this.pluralRulesCache = {};
856
- }
857
- addRule(lng, obj) {
858
- this.rules[lng] = obj;
859
- }
860
- clearCache() {
861
- this.pluralRulesCache = {};
862
- }
863
- getRule(code, options = {}) {
864
- const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
865
- const type = options.ordinal ? "ordinal" : "cardinal";
866
- const cacheKey = JSON.stringify({
867
- cleanedCode,
868
- type
869
- });
870
- if (cacheKey in this.pluralRulesCache) return this.pluralRulesCache[cacheKey];
871
- let rule;
872
- try {
873
- rule = new Intl.PluralRules(cleanedCode, { type });
874
- } catch (err) {
875
- if (!Intl) {
876
- this.logger.error("No Intl support, please use an Intl polyfill!");
877
- return dummyRule;
878
- }
879
- if (!code.match(/-|_/)) return dummyRule;
880
- const lngPart = this.languageUtils.getLanguagePartFromCode(code);
881
- rule = this.getRule(lngPart, options);
882
- }
883
- this.pluralRulesCache[cacheKey] = rule;
884
- return rule;
885
- }
886
- needsPlural(code, options = {}) {
887
- let rule = this.getRule(code, options);
888
- if (!rule) rule = this.getRule("dev", options);
889
- return rule?.resolvedOptions().pluralCategories.length > 1;
890
- }
891
- getPluralFormsOfKey(code, key, options = {}) {
892
- return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
893
- }
894
- getSuffixes(code, options = {}) {
895
- let rule = this.getRule(code, options);
896
- if (!rule) rule = this.getRule("dev", options);
897
- if (!rule) return [];
898
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
899
- }
900
- getSuffix(code, count, options = {}) {
901
- const rule = this.getRule(code, options);
902
- if (rule) return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
903
- this.logger.warn(`no plural rule found for: ${code}`);
904
- return this.getSuffix("dev", count, options);
905
- }
906
- };
907
- var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
908
- let path = getPathWithDefaults(data, defaultData, key);
909
- if (!path && ignoreJSONStructure && isString(key)) {
910
- path = deepFind(data, key, keySeparator);
911
- if (path === void 0) path = deepFind(defaultData, key, keySeparator);
912
- }
913
- return path;
914
- };
915
- var regexSafe = (val) => val.replace(/\$/g, "$$$$");
916
- var Interpolator = class {
917
- constructor(options = {}) {
918
- this.logger = baseLogger.create("interpolator");
919
- this.options = options;
920
- this.format = options?.interpolation?.format || ((value) => value);
921
- this.init(options);
922
- }
923
- init(options = {}) {
924
- if (!options.interpolation) options.interpolation = { escapeValue: true };
925
- const { escape: escape$1, escapeValue, useRawValueToEscape, prefix, prefixEscaped, suffix, suffixEscaped, formatSeparator, unescapeSuffix, unescapePrefix, nestingPrefix, nestingPrefixEscaped, nestingSuffix, nestingSuffixEscaped, nestingOptionsSeparator, maxReplaces, alwaysFormat } = options.interpolation;
926
- this.escape = escape$1 !== void 0 ? escape$1 : escape;
927
- this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
928
- this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
929
- this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || "{{";
930
- this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || "}}";
931
- this.formatSeparator = formatSeparator || ",";
932
- this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix || "-";
933
- this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix || "";
934
- this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape("$t(");
935
- this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(")");
936
- this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
937
- this.maxReplaces = maxReplaces || 1e3;
938
- this.alwaysFormat = alwaysFormat !== void 0 ? alwaysFormat : false;
939
- this.resetRegExp();
940
- }
941
- reset() {
942
- if (this.options) this.init(this.options);
943
- }
944
- resetRegExp() {
945
- const getOrResetRegExp = (existingRegExp, pattern) => {
946
- if (existingRegExp?.source === pattern) {
947
- existingRegExp.lastIndex = 0;
948
- return existingRegExp;
949
- }
950
- return new RegExp(pattern, "g");
951
- };
952
- this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
953
- this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
954
- this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
955
- }
956
- interpolate(str, data, lng, options) {
957
- let match;
958
- let value;
959
- let replaces;
960
- const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
961
- const handleFormat = (key) => {
962
- if (key.indexOf(this.formatSeparator) < 0) {
963
- const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
964
- return this.alwaysFormat ? this.format(path, void 0, lng, {
965
- ...options,
966
- ...data,
967
- interpolationkey: key
968
- }) : path;
969
- }
970
- const p = key.split(this.formatSeparator);
971
- const k = p.shift().trim();
972
- const f = p.join(this.formatSeparator).trim();
973
- return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
974
- ...options,
975
- ...data,
976
- interpolationkey: k
977
- });
978
- };
979
- this.resetRegExp();
980
- const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
981
- const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
982
- [{
983
- regex: this.regexpUnescape,
984
- safeValue: (val) => regexSafe(val)
985
- }, {
986
- regex: this.regexp,
987
- safeValue: (val) => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
988
- }].forEach((todo) => {
989
- replaces = 0;
990
- while (match = todo.regex.exec(str)) {
991
- const matchedVar = match[1].trim();
992
- value = handleFormat(matchedVar);
993
- if (value === void 0) if (typeof missingInterpolationHandler === "function") {
994
- const temp = missingInterpolationHandler(str, match, options);
995
- value = isString(temp) ? temp : "";
996
- } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) value = "";
997
- else if (skipOnVariables) {
998
- value = match[0];
999
- continue;
1000
- } else {
1001
- this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
1002
- value = "";
1003
- }
1004
- else if (!isString(value) && !this.useRawValueToEscape) value = makeString(value);
1005
- const safeValue = todo.safeValue(value);
1006
- str = str.replace(match[0], safeValue);
1007
- if (skipOnVariables) {
1008
- todo.regex.lastIndex += value.length;
1009
- todo.regex.lastIndex -= match[0].length;
1010
- } else todo.regex.lastIndex = 0;
1011
- replaces++;
1012
- if (replaces >= this.maxReplaces) break;
1013
- }
1014
- });
1015
- return str;
1016
- }
1017
- nest(str, fc, options = {}) {
1018
- let match;
1019
- let value;
1020
- let clonedOptions;
1021
- const handleHasOptions = (key, inheritedOptions) => {
1022
- const sep = this.nestingOptionsSeparator;
1023
- if (key.indexOf(sep) < 0) return key;
1024
- const c = key.split(new RegExp(`${sep}[ ]*{`));
1025
- let optionsString = `{${c[1]}`;
1026
- key = c[0];
1027
- optionsString = this.interpolate(optionsString, clonedOptions);
1028
- const matchedSingleQuotes = optionsString.match(/'/g);
1029
- const matchedDoubleQuotes = optionsString.match(/"/g);
1030
- if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) optionsString = optionsString.replace(/'/g, "\"");
1031
- try {
1032
- clonedOptions = JSON.parse(optionsString);
1033
- if (inheritedOptions) clonedOptions = {
1034
- ...inheritedOptions,
1035
- ...clonedOptions
1036
- };
1037
- } catch (e) {
1038
- this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
1039
- return `${key}${sep}${optionsString}`;
1040
- }
1041
- if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
1042
- return key;
1043
- };
1044
- while (match = this.nestingRegexp.exec(str)) {
1045
- let formatters = [];
1046
- clonedOptions = { ...options };
1047
- clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1048
- clonedOptions.applyPostProcessor = false;
1049
- delete clonedOptions.defaultValue;
1050
- const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf("}") + 1 : match[1].indexOf(this.formatSeparator);
1051
- if (keyEndIndex !== -1) {
1052
- formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
1053
- match[1] = match[1].slice(0, keyEndIndex);
1054
- }
1055
- value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1056
- if (value && match[0] === str && !isString(value)) return value;
1057
- if (!isString(value)) value = makeString(value);
1058
- if (!value) {
1059
- this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
1060
- value = "";
1061
- }
1062
- if (formatters.length) value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
1063
- ...options,
1064
- interpolationkey: match[1].trim()
1065
- }), value.trim());
1066
- str = str.replace(match[0], value);
1067
- this.regexp.lastIndex = 0;
1068
- }
1069
- return str;
1070
- }
1071
- };
1072
- var parseFormatStr = (formatStr) => {
1073
- let formatName = formatStr.toLowerCase().trim();
1074
- const formatOptions = {};
1075
- if (formatStr.indexOf("(") > -1) {
1076
- const p = formatStr.split("(");
1077
- formatName = p[0].toLowerCase().trim();
1078
- const optStr = p[1].substring(0, p[1].length - 1);
1079
- if (formatName === "currency" && optStr.indexOf(":") < 0) {
1080
- if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1081
- } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
1082
- if (!formatOptions.range) formatOptions.range = optStr.trim();
1083
- } else optStr.split(";").forEach((opt) => {
1084
- if (opt) {
1085
- const [key, ...rest] = opt.split(":");
1086
- const val = rest.join(":").trim().replace(/^'+|'+$/g, "");
1087
- const trimmedKey = key.trim();
1088
- if (!formatOptions[trimmedKey]) formatOptions[trimmedKey] = val;
1089
- if (val === "false") formatOptions[trimmedKey] = false;
1090
- if (val === "true") formatOptions[trimmedKey] = true;
1091
- if (!isNaN(val)) formatOptions[trimmedKey] = parseInt(val, 10);
1092
- }
1093
- });
1094
- }
1095
- return {
1096
- formatName,
1097
- formatOptions
1098
- };
1099
- };
1100
- var createCachedFormatter = (fn) => {
1101
- const cache = {};
1102
- return (v, l, o) => {
1103
- let optForCache = o;
1104
- if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) optForCache = {
1105
- ...optForCache,
1106
- [o.interpolationkey]: void 0
1107
- };
1108
- const key = l + JSON.stringify(optForCache);
1109
- let frm = cache[key];
1110
- if (!frm) {
1111
- frm = fn(getCleanedCode(l), o);
1112
- cache[key] = frm;
1113
- }
1114
- return frm(v);
1115
- };
1116
- };
1117
- var createNonCachedFormatter = (fn) => (v, l, o) => fn(getCleanedCode(l), o)(v);
1118
- var Formatter = class {
1119
- constructor(options = {}) {
1120
- this.logger = baseLogger.create("formatter");
1121
- this.options = options;
1122
- this.init(options);
1123
- }
1124
- init(services, options = { interpolation: {} }) {
1125
- this.formatSeparator = options.interpolation.formatSeparator || ",";
1126
- const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1127
- this.formats = {
1128
- number: cf((lng, opt) => {
1129
- const formatter = new Intl.NumberFormat(lng, { ...opt });
1130
- return (val) => formatter.format(val);
1131
- }),
1132
- currency: cf((lng, opt) => {
1133
- const formatter = new Intl.NumberFormat(lng, {
1134
- ...opt,
1135
- style: "currency"
1136
- });
1137
- return (val) => formatter.format(val);
1138
- }),
1139
- datetime: cf((lng, opt) => {
1140
- const formatter = new Intl.DateTimeFormat(lng, { ...opt });
1141
- return (val) => formatter.format(val);
1142
- }),
1143
- relativetime: cf((lng, opt) => {
1144
- const formatter = new Intl.RelativeTimeFormat(lng, { ...opt });
1145
- return (val) => formatter.format(val, opt.range || "day");
1146
- }),
1147
- list: cf((lng, opt) => {
1148
- const formatter = new Intl.ListFormat(lng, { ...opt });
1149
- return (val) => formatter.format(val);
1150
- })
1151
- };
1152
- }
1153
- add(name, fc) {
1154
- this.formats[name.toLowerCase().trim()] = fc;
1155
- }
1156
- addCached(name, fc) {
1157
- this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1158
- }
1159
- format(value, format, lng, options = {}) {
1160
- const formats = format.split(this.formatSeparator);
1161
- if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f) => f.indexOf(")") > -1)) {
1162
- const lastIndex = formats.findIndex((f) => f.indexOf(")") > -1);
1163
- formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
1164
- }
1165
- return formats.reduce((mem, f) => {
1166
- const { formatName, formatOptions } = parseFormatStr(f);
1167
- if (this.formats[formatName]) {
1168
- let formatted = mem;
1169
- try {
1170
- const valOptions = options?.formatParams?.[options.interpolationkey] || {};
1171
- const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1172
- formatted = this.formats[formatName](mem, l, {
1173
- ...formatOptions,
1174
- ...options,
1175
- ...valOptions
1176
- });
1177
- } catch (error) {
1178
- this.logger.warn(error);
1179
- }
1180
- return formatted;
1181
- } else this.logger.warn(`there was no format function for ${formatName}`);
1182
- return mem;
1183
- }, value);
1184
- }
1185
- };
1186
- var removePending = (q, name) => {
1187
- if (q.pending[name] !== void 0) {
1188
- delete q.pending[name];
1189
- q.pendingCount--;
1190
- }
1191
- };
1192
- var Connector = class extends EventEmitter {
1193
- constructor(backend, store, services, options = {}) {
1194
- super();
1195
- this.backend = backend;
1196
- this.store = store;
1197
- this.services = services;
1198
- this.languageUtils = services.languageUtils;
1199
- this.options = options;
1200
- this.logger = baseLogger.create("backendConnector");
1201
- this.waitingReads = [];
1202
- this.maxParallelReads = options.maxParallelReads || 10;
1203
- this.readingCalls = 0;
1204
- this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1205
- this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1206
- this.state = {};
1207
- this.queue = [];
1208
- this.backend?.init?.(services, options.backend, options);
1209
- }
1210
- queueLoad(languages, namespaces, options, callback) {
1211
- const toLoad = {};
1212
- const pending = {};
1213
- const toLoadLanguages = {};
1214
- const toLoadNamespaces = {};
1215
- languages.forEach((lng) => {
1216
- let hasAllNamespaces = true;
1217
- namespaces.forEach((ns) => {
1218
- const name = `${lng}|${ns}`;
1219
- if (!options.reload && this.store.hasResourceBundle(lng, ns)) this.state[name] = 2;
1220
- else if (this.state[name] < 0);
1221
- else if (this.state[name] === 1) {
1222
- if (pending[name] === void 0) pending[name] = true;
1223
- } else {
1224
- this.state[name] = 1;
1225
- hasAllNamespaces = false;
1226
- if (pending[name] === void 0) pending[name] = true;
1227
- if (toLoad[name] === void 0) toLoad[name] = true;
1228
- if (toLoadNamespaces[ns] === void 0) toLoadNamespaces[ns] = true;
1229
- }
1230
- });
1231
- if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1232
- });
1233
- if (Object.keys(toLoad).length || Object.keys(pending).length) this.queue.push({
1234
- pending,
1235
- pendingCount: Object.keys(pending).length,
1236
- loaded: {},
1237
- errors: [],
1238
- callback
1239
- });
1240
- return {
1241
- toLoad: Object.keys(toLoad),
1242
- pending: Object.keys(pending),
1243
- toLoadLanguages: Object.keys(toLoadLanguages),
1244
- toLoadNamespaces: Object.keys(toLoadNamespaces)
1245
- };
1246
- }
1247
- loaded(name, err, data) {
1248
- const s = name.split("|");
1249
- const lng = s[0];
1250
- const ns = s[1];
1251
- if (err) this.emit("failedLoading", lng, ns, err);
1252
- if (!err && data) this.store.addResourceBundle(lng, ns, data, void 0, void 0, { skipCopy: true });
1253
- this.state[name] = err ? -1 : 2;
1254
- if (err && data) this.state[name] = 0;
1255
- const loaded = {};
1256
- this.queue.forEach((q) => {
1257
- pushPath(q.loaded, [lng], ns);
1258
- removePending(q, name);
1259
- if (err) q.errors.push(err);
1260
- if (q.pendingCount === 0 && !q.done) {
1261
- Object.keys(q.loaded).forEach((l) => {
1262
- if (!loaded[l]) loaded[l] = {};
1263
- const loadedKeys = q.loaded[l];
1264
- if (loadedKeys.length) loadedKeys.forEach((n) => {
1265
- if (loaded[l][n] === void 0) loaded[l][n] = true;
1266
- });
1267
- });
1268
- q.done = true;
1269
- if (q.errors.length) q.callback(q.errors);
1270
- else q.callback();
1271
- }
1272
- });
1273
- this.emit("loaded", loaded);
1274
- this.queue = this.queue.filter((q) => !q.done);
1275
- }
1276
- read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1277
- if (!lng.length) return callback(null, {});
1278
- if (this.readingCalls >= this.maxParallelReads) {
1279
- this.waitingReads.push({
1280
- lng,
1281
- ns,
1282
- fcName,
1283
- tried,
1284
- wait,
1285
- callback
1286
- });
1287
- return;
1288
- }
1289
- this.readingCalls++;
1290
- const resolver = (err, data) => {
1291
- this.readingCalls--;
1292
- if (this.waitingReads.length > 0) {
1293
- const next = this.waitingReads.shift();
1294
- this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
1295
- }
1296
- if (err && data && tried < this.maxRetries) {
1297
- setTimeout(() => {
1298
- this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
1299
- }, wait);
1300
- return;
1301
- }
1302
- callback(err, data);
1303
- };
1304
- const fc = this.backend[fcName].bind(this.backend);
1305
- if (fc.length === 2) {
1306
- try {
1307
- const r = fc(lng, ns);
1308
- if (r && typeof r.then === "function") r.then((data) => resolver(null, data)).catch(resolver);
1309
- else resolver(null, r);
1310
- } catch (err) {
1311
- resolver(err);
1312
- }
1313
- return;
1314
- }
1315
- return fc(lng, ns, resolver);
1316
- }
1317
- prepareLoading(languages, namespaces, options = {}, callback) {
1318
- if (!this.backend) {
1319
- this.logger.warn("No backend was added via i18next.use. Will not load resources.");
1320
- return callback && callback();
1321
- }
1322
- if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
1323
- if (isString(namespaces)) namespaces = [namespaces];
1324
- const toLoad = this.queueLoad(languages, namespaces, options, callback);
1325
- if (!toLoad.toLoad.length) {
1326
- if (!toLoad.pending.length) callback();
1327
- return null;
1328
- }
1329
- toLoad.toLoad.forEach((name) => {
1330
- this.loadOne(name);
1331
- });
1332
- }
1333
- load(languages, namespaces, callback) {
1334
- this.prepareLoading(languages, namespaces, {}, callback);
1335
- }
1336
- reload(languages, namespaces, callback) {
1337
- this.prepareLoading(languages, namespaces, { reload: true }, callback);
1338
- }
1339
- loadOne(name, prefix = "") {
1340
- const s = name.split("|");
1341
- const lng = s[0];
1342
- const ns = s[1];
1343
- this.read(lng, ns, "read", void 0, void 0, (err, data) => {
1344
- if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
1345
- if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
1346
- this.loaded(name, err, data);
1347
- });
1348
- }
1349
- saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
1350
- if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
1351
- this.logger.warn(`did not save key "${key}" as the namespace "${namespace}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1352
- return;
1353
- }
1354
- if (key === void 0 || key === null || key === "") return;
1355
- if (this.backend?.create) {
1356
- const opts = {
1357
- ...options,
1358
- isUpdate
1359
- };
1360
- const fc = this.backend.create.bind(this.backend);
1361
- if (fc.length < 6) try {
1362
- let r;
1363
- if (fc.length === 5) r = fc(languages, namespace, key, fallbackValue, opts);
1364
- else r = fc(languages, namespace, key, fallbackValue);
1365
- if (r && typeof r.then === "function") r.then((data) => clb(null, data)).catch(clb);
1366
- else clb(null, r);
1367
- } catch (err) {
1368
- clb(err);
1369
- }
1370
- else fc(languages, namespace, key, fallbackValue, clb, opts);
1371
- }
1372
- if (!languages || !languages[0]) return;
1373
- this.store.addResource(languages[0], namespace, key, fallbackValue);
1374
- }
1375
- };
1376
- var get = () => ({
1377
- debug: false,
1378
- initAsync: true,
1379
- ns: ["translation"],
1380
- defaultNS: ["translation"],
1381
- fallbackLng: ["dev"],
1382
- fallbackNS: false,
1383
- supportedLngs: false,
1384
- nonExplicitSupportedLngs: false,
1385
- load: "all",
1386
- preload: false,
1387
- simplifyPluralSuffix: true,
1388
- keySeparator: ".",
1389
- nsSeparator: ":",
1390
- pluralSeparator: "_",
1391
- contextSeparator: "_",
1392
- partialBundledLanguages: false,
1393
- saveMissing: false,
1394
- updateMissing: false,
1395
- saveMissingTo: "fallback",
1396
- saveMissingPlurals: true,
1397
- missingKeyHandler: false,
1398
- missingInterpolationHandler: false,
1399
- postProcess: false,
1400
- postProcessPassResolved: false,
1401
- returnNull: false,
1402
- returnEmptyString: true,
1403
- returnObjects: false,
1404
- joinArrays: false,
1405
- returnedObjectHandler: false,
1406
- parseMissingKeyHandler: false,
1407
- appendNamespaceToMissingKey: false,
1408
- appendNamespaceToCIMode: false,
1409
- overloadTranslationOptionHandler: (args) => {
1410
- let ret = {};
1411
- if (typeof args[1] === "object") ret = args[1];
1412
- if (isString(args[1])) ret.defaultValue = args[1];
1413
- if (isString(args[2])) ret.tDescription = args[2];
1414
- if (typeof args[2] === "object" || typeof args[3] === "object") {
1415
- const options = args[3] || args[2];
1416
- Object.keys(options).forEach((key) => {
1417
- ret[key] = options[key];
1418
- });
1419
- }
1420
- return ret;
1421
- },
1422
- interpolation: {
1423
- escapeValue: true,
1424
- format: (value) => value,
1425
- prefix: "{{",
1426
- suffix: "}}",
1427
- formatSeparator: ",",
1428
- unescapePrefix: "-",
1429
- nestingPrefix: "$t(",
1430
- nestingSuffix: ")",
1431
- nestingOptionsSeparator: ",",
1432
- maxReplaces: 1e3,
1433
- skipOnVariables: true
1434
- },
1435
- cacheInBuiltFormats: true
1436
- });
1437
- var transformOptions = (options) => {
1438
- if (isString(options.ns)) options.ns = [options.ns];
1439
- if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
1440
- if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
1441
- if (options.supportedLngs?.indexOf?.("cimode") < 0) options.supportedLngs = options.supportedLngs.concat(["cimode"]);
1442
- if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
1443
- return options;
1444
- };
1445
- var noop = () => {};
1446
- var bindMemberFunctions = (inst) => {
1447
- Object.getOwnPropertyNames(Object.getPrototypeOf(inst)).forEach((mem) => {
1448
- if (typeof inst[mem] === "function") inst[mem] = inst[mem].bind(inst);
1449
- });
1450
- };
1451
- var instance = class I18n extends EventEmitter {
1452
- constructor(options = {}, callback) {
1453
- super();
1454
- this.options = transformOptions(options);
1455
- this.services = {};
1456
- this.logger = baseLogger;
1457
- this.modules = { external: [] };
1458
- bindMemberFunctions(this);
1459
- if (callback && !this.isInitialized && !options.isClone) {
1460
- if (!this.options.initAsync) {
1461
- this.init(options, callback);
1462
- return this;
1463
- }
1464
- setTimeout(() => {
1465
- this.init(options, callback);
1466
- }, 0);
1467
- }
1468
- }
1469
- init(options = {}, callback) {
1470
- this.isInitializing = true;
1471
- if (typeof options === "function") {
1472
- callback = options;
1473
- options = {};
1474
- }
1475
- if (options.defaultNS == null && options.ns) {
1476
- if (isString(options.ns)) options.defaultNS = options.ns;
1477
- else if (options.ns.indexOf("translation") < 0) options.defaultNS = options.ns[0];
1478
- }
1479
- const defOpts = get();
1480
- this.options = {
1481
- ...defOpts,
1482
- ...this.options,
1483
- ...transformOptions(options)
1484
- };
1485
- this.options.interpolation = {
1486
- ...defOpts.interpolation,
1487
- ...this.options.interpolation
1488
- };
1489
- if (options.keySeparator !== void 0) this.options.userDefinedKeySeparator = options.keySeparator;
1490
- if (options.nsSeparator !== void 0) this.options.userDefinedNsSeparator = options.nsSeparator;
1491
- const createClassOnDemand = (ClassOrObject) => {
1492
- if (!ClassOrObject) return null;
1493
- if (typeof ClassOrObject === "function") return new ClassOrObject();
1494
- return ClassOrObject;
1495
- };
1496
- if (!this.options.isClone) {
1497
- if (this.modules.logger) baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
1498
- else baseLogger.init(null, this.options);
1499
- let formatter;
1500
- if (this.modules.formatter) formatter = this.modules.formatter;
1501
- else formatter = Formatter;
1502
- const lu = new LanguageUtil(this.options);
1503
- this.store = new ResourceStore(this.options.resources, this.options);
1504
- const s = this.services;
1505
- s.logger = baseLogger;
1506
- s.resourceStore = this.store;
1507
- s.languageUtils = lu;
1508
- s.pluralResolver = new PluralResolver(lu, {
1509
- prepend: this.options.pluralSeparator,
1510
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1511
- });
1512
- if (this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format) this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1513
- if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1514
- s.formatter = createClassOnDemand(formatter);
1515
- if (s.formatter.init) s.formatter.init(s, this.options);
1516
- this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1517
- }
1518
- s.interpolator = new Interpolator(this.options);
1519
- s.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) };
1520
- s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1521
- s.backendConnector.on("*", (event, ...args) => {
1522
- this.emit(event, ...args);
1523
- });
1524
- if (this.modules.languageDetector) {
1525
- s.languageDetector = createClassOnDemand(this.modules.languageDetector);
1526
- if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
1527
- }
1528
- if (this.modules.i18nFormat) {
1529
- s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
1530
- if (s.i18nFormat.init) s.i18nFormat.init(this);
1531
- }
1532
- this.translator = new Translator(this.services, this.options);
1533
- this.translator.on("*", (event, ...args) => {
1534
- this.emit(event, ...args);
1535
- });
1536
- this.modules.external.forEach((m) => {
1537
- if (m.init) m.init(this);
1538
- });
1539
- }
1540
- this.format = this.options.interpolation.format;
1541
- if (!callback) callback = noop;
1542
- if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1543
- const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1544
- if (codes.length > 0 && codes[0] !== "dev") this.options.lng = codes[0];
1545
- }
1546
- if (!this.services.languageDetector && !this.options.lng) this.logger.warn("init: no languageDetector is used and no lng is defined");
1547
- [
1548
- "getResource",
1549
- "hasResourceBundle",
1550
- "getResourceBundle",
1551
- "getDataByLanguage"
1552
- ].forEach((fcName) => {
1553
- this[fcName] = (...args) => this.store[fcName](...args);
1554
- });
1555
- [
1556
- "addResource",
1557
- "addResources",
1558
- "addResourceBundle",
1559
- "removeResourceBundle"
1560
- ].forEach((fcName) => {
1561
- this[fcName] = (...args) => {
1562
- this.store[fcName](...args);
1563
- return this;
1564
- };
1565
- });
1566
- const deferred = defer();
1567
- const load = () => {
1568
- const finish = (err, t) => {
1569
- this.isInitializing = false;
1570
- if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
1571
- this.isInitialized = true;
1572
- if (!this.options.isClone) this.logger.log("initialized", this.options);
1573
- this.emit("initialized", this.options);
1574
- deferred.resolve(t);
1575
- callback(err, t);
1576
- };
1577
- if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
1578
- this.changeLanguage(this.options.lng, finish);
1579
- };
1580
- if (this.options.resources || !this.options.initAsync) load();
1581
- else setTimeout(load, 0);
1582
- return deferred;
1583
- }
1584
- loadResources(language, callback = noop) {
1585
- let usedCallback = callback;
1586
- const usedLng = isString(language) ? language : this.language;
1587
- if (typeof language === "function") usedCallback = language;
1588
- if (!this.options.resources || this.options.partialBundledLanguages) {
1589
- if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
1590
- const toLoad = [];
1591
- const append = (lng) => {
1592
- if (!lng) return;
1593
- if (lng === "cimode") return;
1594
- this.services.languageUtils.toResolveHierarchy(lng).forEach((l) => {
1595
- if (l === "cimode") return;
1596
- if (toLoad.indexOf(l) < 0) toLoad.push(l);
1597
- });
1598
- };
1599
- if (!usedLng) this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => append(l));
1600
- else append(usedLng);
1601
- this.options.preload?.forEach?.((l) => append(l));
1602
- this.services.backendConnector.load(toLoad, this.options.ns, (e) => {
1603
- if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
1604
- usedCallback(e);
1605
- });
1606
- } else usedCallback(null);
1607
- }
1608
- reloadResources(lngs, ns, callback) {
1609
- const deferred = defer();
1610
- if (typeof lngs === "function") {
1611
- callback = lngs;
1612
- lngs = void 0;
1613
- }
1614
- if (typeof ns === "function") {
1615
- callback = ns;
1616
- ns = void 0;
1617
- }
1618
- if (!lngs) lngs = this.languages;
1619
- if (!ns) ns = this.options.ns;
1620
- if (!callback) callback = noop;
1621
- this.services.backendConnector.reload(lngs, ns, (err) => {
1622
- deferred.resolve();
1623
- callback(err);
1624
- });
1625
- return deferred;
1626
- }
1627
- use(module) {
1628
- if (!module) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1629
- if (!module.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1630
- if (module.type === "backend") this.modules.backend = module;
1631
- if (module.type === "logger" || module.log && module.warn && module.error) this.modules.logger = module;
1632
- if (module.type === "languageDetector") this.modules.languageDetector = module;
1633
- if (module.type === "i18nFormat") this.modules.i18nFormat = module;
1634
- if (module.type === "postProcessor") postProcessor.addPostProcessor(module);
1635
- if (module.type === "formatter") this.modules.formatter = module;
1636
- if (module.type === "3rdParty") this.modules.external.push(module);
1637
- return this;
1638
- }
1639
- setResolvedLanguage(l) {
1640
- if (!l || !this.languages) return;
1641
- if (["cimode", "dev"].indexOf(l) > -1) return;
1642
- for (let li = 0; li < this.languages.length; li++) {
1643
- const lngInLngs = this.languages[li];
1644
- if (["cimode", "dev"].indexOf(lngInLngs) > -1) continue;
1645
- if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
1646
- this.resolvedLanguage = lngInLngs;
1647
- break;
1648
- }
1649
- }
1650
- if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
1651
- this.resolvedLanguage = l;
1652
- this.languages.unshift(l);
1653
- }
1654
- }
1655
- changeLanguage(lng, callback) {
1656
- this.isLanguageChangingTo = lng;
1657
- const deferred = defer();
1658
- this.emit("languageChanging", lng);
1659
- const setLngProps = (l) => {
1660
- this.language = l;
1661
- this.languages = this.services.languageUtils.toResolveHierarchy(l);
1662
- this.resolvedLanguage = void 0;
1663
- this.setResolvedLanguage(l);
1664
- };
1665
- const done = (err, l) => {
1666
- if (l) {
1667
- if (this.isLanguageChangingTo === lng) {
1668
- setLngProps(l);
1669
- this.translator.changeLanguage(l);
1670
- this.isLanguageChangingTo = void 0;
1671
- this.emit("languageChanged", l);
1672
- this.logger.log("languageChanged", l);
1673
- }
1674
- } else this.isLanguageChangingTo = void 0;
1675
- deferred.resolve((...args) => this.t(...args));
1676
- if (callback) callback(err, (...args) => this.t(...args));
1677
- };
1678
- const setLng = (lngs) => {
1679
- if (!lng && !lngs && this.services.languageDetector) lngs = [];
1680
- const fl = isString(lngs) ? lngs : lngs && lngs[0];
1681
- const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
1682
- if (l) {
1683
- if (!this.language) setLngProps(l);
1684
- if (!this.translator.language) this.translator.changeLanguage(l);
1685
- this.services.languageDetector?.cacheUserLanguage?.(l);
1686
- }
1687
- this.loadResources(l, (err) => {
1688
- done(err, l);
1689
- });
1690
- };
1691
- if (!lng && this.services.languageDetector && !this.services.languageDetector.async) setLng(this.services.languageDetector.detect());
1692
- else if (!lng && this.services.languageDetector && this.services.languageDetector.async) if (this.services.languageDetector.detect.length === 0) this.services.languageDetector.detect().then(setLng);
1693
- else this.services.languageDetector.detect(setLng);
1694
- else setLng(lng);
1695
- return deferred;
1696
- }
1697
- getFixedT(lng, ns, keyPrefix) {
1698
- const fixedT = (key, opts, ...rest) => {
1699
- let o;
1700
- if (typeof opts !== "object") o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
1701
- else o = { ...opts };
1702
- o.lng = o.lng || fixedT.lng;
1703
- o.lngs = o.lngs || fixedT.lngs;
1704
- o.ns = o.ns || fixedT.ns;
1705
- if (o.keyPrefix !== "") o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
1706
- const keySeparator = this.options.keySeparator || ".";
1707
- let resultKey;
1708
- if (o.keyPrefix && Array.isArray(key)) resultKey = key.map((k) => {
1709
- if (typeof k === "function") k = keysFromSelector(k, {
1710
- ...this.options,
1711
- ...opts
1712
- });
1713
- return `${o.keyPrefix}${keySeparator}${k}`;
1714
- });
1715
- else {
1716
- if (typeof key === "function") key = keysFromSelector(key, {
1717
- ...this.options,
1718
- ...opts
1719
- });
1720
- resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
1721
- }
1722
- return this.t(resultKey, o);
1723
- };
1724
- if (isString(lng)) fixedT.lng = lng;
1725
- else fixedT.lngs = lng;
1726
- fixedT.ns = ns;
1727
- fixedT.keyPrefix = keyPrefix;
1728
- return fixedT;
1729
- }
1730
- t(...args) {
1731
- return this.translator?.translate(...args);
1732
- }
1733
- exists(...args) {
1734
- return this.translator?.exists(...args);
1735
- }
1736
- setDefaultNamespace(ns) {
1737
- this.options.defaultNS = ns;
1738
- }
1739
- hasLoadedNamespace(ns, options = {}) {
1740
- if (!this.isInitialized) {
1741
- this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
1742
- return false;
1743
- }
1744
- if (!this.languages || !this.languages.length) {
1745
- this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
1746
- return false;
1747
- }
1748
- const lng = options.lng || this.resolvedLanguage || this.languages[0];
1749
- const fallbackLng = this.options ? this.options.fallbackLng : false;
1750
- const lastLng = this.languages[this.languages.length - 1];
1751
- if (lng.toLowerCase() === "cimode") return true;
1752
- const loadNotPending = (l, n) => {
1753
- const loadState = this.services.backendConnector.state[`${l}|${n}`];
1754
- return loadState === -1 || loadState === 0 || loadState === 2;
1755
- };
1756
- if (options.precheck) {
1757
- const preResult = options.precheck(this, loadNotPending);
1758
- if (preResult !== void 0) return preResult;
1759
- }
1760
- if (this.hasResourceBundle(lng, ns)) return true;
1761
- if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
1762
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
1763
- return false;
1764
- }
1765
- loadNamespaces(ns, callback) {
1766
- const deferred = defer();
1767
- if (!this.options.ns) {
1768
- if (callback) callback();
1769
- return Promise.resolve();
1770
- }
1771
- if (isString(ns)) ns = [ns];
1772
- ns.forEach((n) => {
1773
- if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
1774
- });
1775
- this.loadResources((err) => {
1776
- deferred.resolve();
1777
- if (callback) callback(err);
1778
- });
1779
- return deferred;
1780
- }
1781
- loadLanguages(lngs, callback) {
1782
- const deferred = defer();
1783
- if (isString(lngs)) lngs = [lngs];
1784
- const preloaded = this.options.preload || [];
1785
- const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
1786
- if (!newLngs.length) {
1787
- if (callback) callback();
1788
- return Promise.resolve();
1789
- }
1790
- this.options.preload = preloaded.concat(newLngs);
1791
- this.loadResources((err) => {
1792
- deferred.resolve();
1793
- if (callback) callback(err);
1794
- });
1795
- return deferred;
1796
- }
1797
- dir(lng) {
1798
- if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
1799
- if (!lng) return "rtl";
1800
- try {
1801
- const l = new Intl.Locale(lng);
1802
- if (l && l.getTextInfo) {
1803
- const ti = l.getTextInfo();
1804
- if (ti && ti.direction) return ti.direction;
1805
- }
1806
- } catch (e) {}
1807
- const rtlLngs = [
1808
- "ar",
1809
- "shu",
1810
- "sqr",
1811
- "ssh",
1812
- "xaa",
1813
- "yhd",
1814
- "yud",
1815
- "aao",
1816
- "abh",
1817
- "abv",
1818
- "acm",
1819
- "acq",
1820
- "acw",
1821
- "acx",
1822
- "acy",
1823
- "adf",
1824
- "ads",
1825
- "aeb",
1826
- "aec",
1827
- "afb",
1828
- "ajp",
1829
- "apc",
1830
- "apd",
1831
- "arb",
1832
- "arq",
1833
- "ars",
1834
- "ary",
1835
- "arz",
1836
- "auz",
1837
- "avl",
1838
- "ayh",
1839
- "ayl",
1840
- "ayn",
1841
- "ayp",
1842
- "bbz",
1843
- "pga",
1844
- "he",
1845
- "iw",
1846
- "ps",
1847
- "pbt",
1848
- "pbu",
1849
- "pst",
1850
- "prp",
1851
- "prd",
1852
- "ug",
1853
- "ur",
1854
- "ydd",
1855
- "yds",
1856
- "yih",
1857
- "ji",
1858
- "yi",
1859
- "hbo",
1860
- "men",
1861
- "xmn",
1862
- "fa",
1863
- "jpr",
1864
- "peo",
1865
- "pes",
1866
- "prs",
1867
- "dv",
1868
- "sam",
1869
- "ckb"
1870
- ];
1871
- const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
1872
- if (lng.toLowerCase().indexOf("-latn") > 1) return "ltr";
1873
- return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1874
- }
1875
- static createInstance(options = {}, callback) {
1876
- const instance = new I18n(options, callback);
1877
- instance.createInstance = I18n.createInstance;
1878
- return instance;
1879
- }
1880
- cloneInstance(options = {}, callback = noop) {
1881
- const forkResourceStore = options.forkResourceStore;
1882
- if (forkResourceStore) delete options.forkResourceStore;
1883
- const mergedOptions = {
1884
- ...this.options,
1885
- ...options,
1886
- isClone: true
1887
- };
1888
- const clone = new I18n(mergedOptions);
1889
- if (options.debug !== void 0 || options.prefix !== void 0) clone.logger = clone.logger.clone(options);
1890
- [
1891
- "store",
1892
- "services",
1893
- "language"
1894
- ].forEach((m) => {
1895
- clone[m] = this[m];
1896
- });
1897
- clone.services = { ...this.services };
1898
- clone.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) };
1899
- if (forkResourceStore) {
1900
- clone.store = new ResourceStore(Object.keys(this.store.data).reduce((prev, l) => {
1901
- prev[l] = { ...this.store.data[l] };
1902
- prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
1903
- acc[n] = { ...prev[l][n] };
1904
- return acc;
1905
- }, prev[l]);
1906
- return prev;
1907
- }, {}), mergedOptions);
1908
- clone.services.resourceStore = clone.store;
1909
- }
1910
- if (options.interpolation) clone.services.interpolator = new Interpolator(mergedOptions);
1911
- clone.translator = new Translator(clone.services, mergedOptions);
1912
- clone.translator.on("*", (event, ...args) => {
1913
- clone.emit(event, ...args);
1914
- });
1915
- clone.init(mergedOptions, callback);
1916
- clone.translator.options = mergedOptions;
1917
- clone.translator.backendConnector.services.utils = { hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone) };
1918
- return clone;
1919
- }
1920
- toJSON() {
1921
- return {
1922
- options: this.options,
1923
- store: this.store,
1924
- language: this.language,
1925
- languages: this.languages,
1926
- resolvedLanguage: this.resolvedLanguage
1927
- };
1928
- }
1929
- }.createInstance();
1930
- instance.createInstance;
1931
- instance.dir;
1932
- instance.init;
1933
- instance.loadResources;
1934
- instance.reloadResources;
1935
- instance.use;
1936
- instance.changeLanguage;
1937
- instance.getFixedT;
1938
- instance.t;
1939
- instance.exists;
1940
- instance.setDefaultNamespace;
1941
- instance.hasLoadedNamespace;
1942
- instance.loadNamespaces;
1943
- instance.loadLanguages;
1944
- //#endregion
1945
- //#region src/i18n/bundledTranslationLoaders.ts
1946
- var bundledTranslationLoaders = {
1947
- "en": () => import("./en-CSjoG3e4.js"),
1948
- "en-DG": () => import("./en-DG-Cruu6Woh.js"),
1949
- "es": () => import("./es-C_LAY-Yu.js"),
1950
- "es-ES": () => import("./es-ES-D7O0P5Mg.js"),
1951
- "sr": () => import("./sr-Bpxtt0kk.js"),
1952
- "sr-Latn": () => import("./sr-Latn-BjueCJSI.js"),
1953
- "fr": () => import("./fr-C4cP8ZNE.js"),
1954
- "pt-BR": () => import("./pt-BR-DSJDHb-K.js"),
1955
- "pt": () => import("./pt-CPVeH0hD.js"),
1956
- "bn": () => import("./bn-CuGYlngZ.js"),
1957
- "zh": () => import("./zh-CPQoDPxf.js"),
1958
- "hi": () => import("./hi-DLf6_opn.js"),
1959
- "id": () => import("./id-Dgi5uGHK.js"),
1960
- "ms": () => import("./ms-3Vf1QpHl.js"),
1961
- "tr": () => import("./tr-C4iH8UJx.js"),
1962
- "vi": () => import("./vi-COxdKkHn.js"),
1963
- "ht": () => import("./ht-CVt9koJf.js"),
1964
- "it": () => import("./it-CEFstYFG.js"),
1965
- "de": () => import("./de-11hHLedu.js"),
1966
- "nl": () => import("./nl-R2RykJHB.js"),
1967
- "tl-PH": () => import("./tl-PH-CwafDrED.js"),
1968
- "pl": () => import("./pl-B1LgnPj1.js"),
1969
- "hu": () => import("./hu-9fSzIeAd.js"),
1970
- "ro": () => import("./ro-8gGEWeHO.js"),
1971
- "hmn": () => import("./hmn-DzoODzbN.js"),
1972
- "so": () => import("./so-pyCaqonl.js"),
1973
- "ca": () => import("./ca-DXZs5vtr.js"),
1974
- "af-ZA": () => import("./af-ZA-BWKMRc6V.js"),
1975
- "ar": () => import("./ar-10SoqF1i.js"),
1976
- "ar-EG": () => import("./ar-EG-B1hHB55j.js"),
1977
- "ar-AE": () => import("./ar-AE-CxCvbyoW.js"),
1978
- "zh-CN": () => import("./zh-CN-DfvYQGdE.js"),
1979
- "zh-TW": () => import("./zh-TW-DtvvhBYL.js"),
1980
- "zh-HANT": () => import("./zh-HANT-B4LzHH2y.js"),
1981
- "cs-CZ": () => import("./cs-CZ-Dg5O-Vom.js"),
1982
- "da-DK": () => import("./da-DK-C_JAndM-.js"),
1983
- "fi-FI": () => import("./fi-FI-CYlEPu44.js"),
1984
- "fr-CA": () => import("./fr-CA-DD_s9NuV.js"),
1985
- "el-GR": () => import("./el-GR-CjtJiRTo.js"),
1986
- "he": () => import("./he-D3fvMZAl.js"),
1987
- "ja": () => import("./ja-BNdVd9B6.js"),
1988
- "ja-JP": () => import("./ja-JP-B5TPMV1q.js"),
1989
- "ko-KP": () => import("./ko-KP-BwBB8ahu.js"),
1990
- "nb-NO": () => import("./nb-NO-DGCWCOul.js"),
1991
- "fa-IR": () => import("./fa-IR-CdK8XLkS.js"),
1992
- "pt-PT": () => import("./pt-PT-BWJTVPZY.js"),
1993
- "ru-RU": () => import("./ru-RU-Dr0NOGjg.js"),
1994
- "sr-YU": () => import("./sr-YU-xCb5qxap.js"),
1995
- "es-419": () => import("./es-419-CTB15v-l.js"),
1996
- "es-MX": () => import("./es-MX-DVzFaANh.js"),
1997
- "sv-SE": () => import("./sv-SE-sv5v6ZWe.js"),
1998
- "th-TH": () => import("./th-TH-D0WNW-3l.js"),
1999
- "uk-UA": () => import("./uk-UA-CbxzkCL_.js"),
2000
- "am": () => import("./am-DPyjIvQV.js"),
2001
- "az": () => import("./az-cmuBNn_5.js"),
2002
- "bs": () => import("./bs-vwpJzaHm.js"),
2003
- "my": () => import("./my-C5hpE5P1.js"),
2004
- "ceb": () => import("./ceb-CmhS_VOs.js"),
2005
- "cs": () => import("./cs-CoJlE7De.js"),
2006
- "et": () => import("./et-DdSwjU5d.js"),
2007
- "ka": () => import("./ka-C70bUmEK.js"),
2008
- "el": () => import("./el-CRGmVrep.js"),
2009
- "jv": () => import("./jv-CMxkkXUk.js"),
2010
- "kk": () => import("./kk-C_55EmWt.js"),
2011
- "km": () => import("./km-D4Ig0NhN.js"),
2012
- "ko": () => import("./ko-DfUa3dzQ.js"),
2013
- "ky": () => import("./ky-CnJichOm.js"),
2014
- "lo": () => import("./lo-ww1DXVAP.js"),
2015
- "lv": () => import("./lv-DMfsmqyK.js"),
2016
- "lt": () => import("./lt-IJ8qpluI.js"),
2017
- "mk": () => import("./mk-ByafmFak.js"),
2018
- "mn": () => import("./mn-DjO9p3xN.js"),
2019
- "ne": () => import("./ne-CpJxcVhV.js"),
2020
- "ru": () => import("./ru-C4EVku5S.js"),
2021
- "sk": () => import("./sk-BSTzMa__.js"),
2022
- "sl": () => import("./sl-_HvO-HVX.js"),
2023
- "sw": () => import("./sw-BseJSmdR.js"),
2024
- "tl": () => import("./tl-CBOmxz5r.js"),
2025
- "th": () => import("./th-C2G8Ur12.js"),
2026
- "uk": () => import("./uk-BGYlvKb_.js"),
2027
- "ur": () => import("./ur-BQgtsAfv.js"),
2028
- "uz": () => import("./uz-DqOg1Fdv.js"),
2029
- "hr": () => import("./hr-C-jP0DrB.js")
2030
- };
2031
- //#endregion
2032
- //#region src/i18n/bundledTranslationsBackend.ts
2033
- function asError(error) {
2034
- return error instanceof Error ? error : /* @__PURE__ */ new Error("Could not load bundled translations");
2035
- }
2036
- var bundledTranslationsBackend = {
2037
- type: "backend",
2038
- init() {},
2039
- read(language, _namespace, callback) {
2040
- const load = bundledTranslationLoaders[language];
2041
- if (!load) {
2042
- callback(/* @__PURE__ */ new Error(`Unsupported bundled language: ${language}`), false);
2043
- return;
2044
- }
2045
- load().then(({ default: translations }) => callback(null, translations), (error) => callback(asError(error), false));
2046
- }
2047
- };
2048
- var supportedLanguages = [
2049
- "en",
2050
- "en-DG",
2051
- "es",
2052
- "es-ES",
2053
- "sr",
2054
- "sr-Latn",
2055
- "fr",
2056
- "pt-BR",
2057
- "pt",
2058
- "bn",
2059
- "zh",
2060
- "hi",
2061
- "id",
2062
- "ms",
2063
- "tr",
2064
- "vi",
2065
- "ht",
2066
- "it",
2067
- "de",
2068
- "nl",
2069
- "tl-PH",
2070
- "pl",
2071
- "hu",
2072
- "ro",
2073
- "hmn",
2074
- "so",
2075
- "ca",
2076
- "af-ZA",
2077
- "ar",
2078
- "ar-EG",
2079
- "ar-AE",
2080
- "zh-CN",
2081
- "zh-TW",
2082
- "zh-HANT",
2083
- "cs-CZ",
2084
- "da-DK",
2085
- "fi-FI",
2086
- "fr-CA",
2087
- "el-GR",
2088
- "he",
2089
- "ja",
2090
- "ja-JP",
2091
- "ko-KP",
2092
- "nb-NO",
2093
- "fa-IR",
2094
- "pt-PT",
2095
- "ru-RU",
2096
- "sr-YU",
2097
- "es-419",
2098
- "es-MX",
2099
- "sv-SE",
2100
- "th-TH",
2101
- "uk-UA",
2102
- "am",
2103
- "az",
2104
- "bs",
2105
- "my",
2106
- "ceb",
2107
- "cs",
2108
- "et",
2109
- "ka",
2110
- "el",
2111
- "jv",
2112
- "kk",
2113
- "km",
2114
- "ko",
2115
- "ky",
2116
- "lo",
2117
- "lv",
2118
- "lt",
2119
- "mk",
2120
- "mn",
2121
- "ne",
2122
- "ru",
2123
- "sk",
2124
- "sl",
2125
- "sw",
2126
- "tl",
2127
- "th",
2128
- "uk",
2129
- "ur",
2130
- "uz",
2131
- "hr"
2132
- ];
2133
- var languageMetadata = {
2134
- en: { emoji: "🇺🇸" },
2135
- "en-DG": { emoji: "🇬🇧" },
2136
- es: { emoji: "🇪🇸" },
2137
- "es-ES": { emoji: "🇪🇸" },
2138
- sr: { emoji: "🇷🇸" },
2139
- "sr-Latn": { emoji: "🇷🇸" },
2140
- fr: { emoji: "🇫🇷" },
2141
- "pt-BR": { emoji: "🇧🇷" },
2142
- pt: { emoji: "🇵🇹" },
2143
- bn: { emoji: "🇧🇩" },
2144
- zh: { emoji: "🇨🇳" },
2145
- hi: { emoji: "🇮🇳" },
2146
- id: { emoji: "🇮🇩" },
2147
- ms: { emoji: "🇲🇾" },
2148
- tr: { emoji: "🇹🇷" },
2149
- vi: { emoji: "🇻🇳" },
2150
- ht: { emoji: "🇭🇹" },
2151
- it: { emoji: "🇮🇹" },
2152
- de: { emoji: "🇩🇪" },
2153
- nl: { emoji: "🇳🇱" },
2154
- "tl-PH": { emoji: "🇵🇭" },
2155
- pl: { emoji: "🇵🇱" },
2156
- hu: { emoji: "🇭🇺" },
2157
- ro: { emoji: "🇷🇴" },
2158
- hmn: { emoji: "🌐" },
2159
- so: { emoji: "🇸🇴" },
2160
- ca: { emoji: "🇪🇸" },
2161
- "af-ZA": { emoji: "🇿🇦" },
2162
- ar: { emoji: "🇸🇦" },
2163
- "ar-EG": { emoji: "🇪🇬" },
2164
- "ar-AE": { emoji: "🇦🇪" },
2165
- "zh-CN": { emoji: "🇨🇳" },
2166
- "zh-TW": { emoji: "🇹🇼" },
2167
- "zh-HANT": { emoji: "🇹🇼" },
2168
- "cs-CZ": { emoji: "🇨🇿" },
2169
- "da-DK": { emoji: "🇩🇰" },
2170
- "fi-FI": { emoji: "🇫🇮" },
2171
- "fr-CA": { emoji: "🇨🇦" },
2172
- "el-GR": { emoji: "🇬🇷" },
2173
- he: { emoji: "🇮🇱" },
2174
- ja: { emoji: "🇯🇵" },
2175
- "ja-JP": { emoji: "🇯🇵" },
2176
- "ko-KP": { emoji: "🇰🇵" },
2177
- "nb-NO": { emoji: "🇳🇴" },
2178
- "fa-IR": { emoji: "🇮🇷" },
2179
- "pt-PT": { emoji: "🇵🇹" },
2180
- "ru-RU": { emoji: "🇷🇺" },
2181
- "sr-YU": { emoji: "🇷🇸" },
2182
- "es-419": { emoji: "🌎" },
2183
- "es-MX": { emoji: "🇲🇽" },
2184
- "sv-SE": { emoji: "🇸🇪" },
2185
- "th-TH": { emoji: "🇹🇭" },
2186
- "uk-UA": { emoji: "🇺🇦" },
2187
- am: { emoji: "🇪🇹" },
2188
- az: { emoji: "🇦🇿" },
2189
- bs: { emoji: "🇧🇦" },
2190
- my: { emoji: "🇲🇲" },
2191
- ceb: { emoji: "🇵🇭" },
2192
- cs: { emoji: "🇨🇿" },
2193
- et: { emoji: "🇪🇪" },
2194
- ka: { emoji: "🇬🇪" },
2195
- el: { emoji: "🇬🇷" },
2196
- jv: { emoji: "🇮🇩" },
2197
- kk: { emoji: "🇰🇿" },
2198
- km: { emoji: "🇰🇭" },
2199
- ko: { emoji: "🇰🇷" },
2200
- ky: { emoji: "🇰🇬" },
2201
- lo: { emoji: "🇱🇦" },
2202
- lv: { emoji: "🇱🇻" },
2203
- lt: { emoji: "🇱🇹" },
2204
- mk: { emoji: "🇲🇰" },
2205
- mn: { emoji: "🇲🇳" },
2206
- ne: { emoji: "🇳🇵" },
2207
- ru: { emoji: "🇷🇺" },
2208
- sk: { emoji: "🇸🇰" },
2209
- sl: { emoji: "🇸🇮" },
2210
- sw: { emoji: "🇹🇿" },
2211
- tl: { emoji: "🇵🇭" },
2212
- th: { emoji: "🇹🇭" },
2213
- uk: { emoji: "🇺🇦" },
2214
- ur: { emoji: "🇵🇰" },
2215
- uz: { emoji: "🇺🇿" },
2216
- hr: { emoji: "🇭🇷" }
2217
- };
2218
- function getLanguageEmoji(language) {
2219
- const directMatch = languageMetadata[language];
2220
- if (directMatch) return directMatch.emoji;
2221
- return languageMetadata[language.split("-")[0] || language]?.emoji ?? "🌐";
2222
- }
2223
- //#endregion
2224
- //#region src/i18n/lazyHttpBackend.ts
2225
- var _LazyHttpBackend;
2226
- /**
2227
- * Loads i18next-http-backend on the first read, so sessions that use the
2228
- * bundled catalogs do not download it. i18next creates one instance of this
2229
- * class for each i18n instance.
2230
- */
2231
- var LazyHttpBackend = class {
2232
- constructor() {
2233
- this.type = "backend";
2234
- }
2235
- init(services, backendOptions, i18nextOptions) {
2236
- this.initArgs = [
2237
- services,
2238
- backendOptions,
2239
- i18nextOptions
2240
- ];
2241
- }
2242
- read(language, namespace, callback) {
2243
- this.backend ??= import("./esm-BTUEHyry.js").then(({ default: RealHttpBackend }) => {
2244
- const backend = new RealHttpBackend();
2245
- backend.init(...this.initArgs);
2246
- return backend;
2247
- });
2248
- this.backend.then((backend) => {
2249
- try {
2250
- backend.read(language, namespace, callback);
2251
- } catch (error) {
2252
- callback(error, false);
2253
- }
2254
- }, (error) => {
2255
- this.backend = void 0;
2256
- callback(error, false);
2257
- });
2258
- }
2259
- };
2260
- _LazyHttpBackend = LazyHttpBackend;
2261
- _LazyHttpBackend.type = "backend";
2262
- //#endregion
2263
- //#region src/i18n/setup.ts
2264
- var LANGUAGE_STORAGE_KEY = "incode:i18n:language";
2265
- var camelToStartCase = (text) => {
2266
- const result = text.replace(/([A-Z])/g, " $1");
2267
- return result.charAt(0).toUpperCase() + result.slice(1);
2268
- };
2269
- var keyToStartCase = (key, defaultValue) => {
2270
- if (defaultValue) return defaultValue;
2271
- const splitKey = key.split(".");
2272
- const missingKey = splitKey[splitKey.length - 1];
2273
- return camelToStartCase(missingKey || "missing key");
2274
- };
2275
- function readNavigatorLanguage() {
2276
- if (typeof navigator === "undefined") return "en";
2277
- const languageFromBrowser = navigator.language;
2278
- if (!languageFromBrowser) return null;
2279
- if (supportedLanguages.includes(languageFromBrowser)) return languageFromBrowser;
2280
- return languageFromBrowser.split("-")[0];
2281
- }
2282
- function readHtmlLanguage() {
2283
- if (typeof document === "undefined") return null;
2284
- return document.documentElement?.getAttribute("lang") ?? null;
2285
- }
2286
- function createLanguageDetector(skipInitialLanguageCache) {
2287
- let skipNextCache = skipInitialLanguageCache;
2288
- return {
2289
- type: "languageDetector",
2290
- detect: () => [
2291
- readQueryLanguage(),
2292
- readStoredLanguage(),
2293
- readStorageLanguage(() => sessionStorage),
2294
- readNavigatorLanguage(),
2295
- readHtmlLanguage()
2296
- ].filter((language) => !!language),
2297
- cacheUserLanguage(language) {
2298
- if (skipNextCache) {
2299
- skipNextCache = false;
2300
- return;
2301
- }
2302
- if (language === "cimode") return;
2303
- try {
2304
- localStorage.setItem(LANGUAGE_STORAGE_KEY, language);
2305
- } catch {}
2306
- }
2307
- };
2308
- }
2309
- function applyOverrides(i18nInstance, translations) {
2310
- for (const [langCode, value] of Object.entries(translations)) if (value) i18nInstance.addResourceBundle(langCode, "default", value, true, true);
2311
- }
2312
- function readStorageLanguage(getStorage) {
2313
- try {
2314
- return getStorage().getItem(LANGUAGE_STORAGE_KEY);
2315
- } catch {
2316
- return null;
2317
- }
2318
- }
2319
- function readStoredLanguage() {
2320
- return readStorageLanguage(() => localStorage);
2321
- }
2322
- function readQueryLanguage() {
2323
- if (typeof window === "undefined") return null;
2324
- return new URLSearchParams(window.location.search).get("lang") || null;
2325
- }
2326
- /**
2327
- * TODO(form-definitions): temporary. Lists in the console, once each, the keys
2328
- * the SDK asks for that i18nexus doesn't have yet (such as the new eKYC labels
2329
- * and error messages), so they're easy to create. Remove once they exist.
2330
- */
2331
- function createMissingKeyReporter(i18nInstance) {
2332
- return (key) => {};
2333
- }
2334
- function createI18n(options = {}) {
2335
- const { lang, loadPath, skipRemoteLoad, translations } = options;
2336
- const i18nInstance = instance.createInstance();
2337
- const reportMissingKey = createMissingKeyReporter(i18nInstance);
2338
- const queryLang = readQueryLanguage();
2339
- const languageDetector = createLanguageDetector(queryLang !== null);
2340
- const storedLang = readStoredLanguage();
2341
- const resolvedLoadPath = loadPath ?? void 0;
2342
- const remoteLoadEnabled = skipRemoteLoad !== true && resolvedLoadPath !== void 0;
2343
- if (remoteLoadEnabled) i18nInstance.use(LazyHttpBackend);
2344
- else i18nInstance.use(bundledTranslationsBackend);
2345
- i18nInstance.use(languageDetector).init({
2346
- lng: queryLang ?? storedLang ?? lang,
2347
- fallbackLng: "en",
2348
- load: remoteLoadEnabled ? "all" : "currentOnly",
2349
- supportedLngs: supportedLanguages,
2350
- ns: ["default"],
2351
- defaultNS: "default",
2352
- partialBundledLanguages: true,
2353
- keySeparator: ".",
2354
- interpolation: { escapeValue: false },
2355
- backend: remoteLoadEnabled ? { loadPath: resolvedLoadPath } : void 0,
2356
- initImmediate: false,
2357
- parseMissingKeyHandler: (key, defaultValue) => {
2358
- reportMissingKey(key);
2359
- return keyToStartCase(key, defaultValue);
2360
- }
2361
- });
2362
- if (translations) {
2363
- applyOverrides(i18nInstance, translations);
2364
- i18nInstance.on("loaded", () => {
2365
- applyOverrides(i18nInstance, translations);
2366
- });
2367
- }
2368
- return i18nInstance;
2369
- }
2370
- //#endregion
2371
- //#region src/i18n/instance.ts
2372
- var TRANSLATION_EVENTS = [
2373
- "languageChanged",
2374
- "initialized",
2375
- "loaded"
2376
- ];
2377
- var i18nInstance = null;
2378
- var version = 0;
2379
- var listeners$1 = /* @__PURE__ */ new Set();
2380
- function notify() {
2381
- version += 1;
2382
- for (const listener of listeners$1) listener();
2383
- }
2384
- function bindTranslationEvents(instance) {
2385
- for (const event of TRANSLATION_EVENTS) instance.on(event, notify);
2386
- }
2387
- function unbindTranslationEvents(instance) {
2388
- for (const event of TRANSLATION_EVENTS) instance.off(event, notify);
2389
- }
2390
- function setI18nInstance(instance) {
2391
- if (i18nInstance === instance) return;
2392
- if (i18nInstance) unbindTranslationEvents(i18nInstance);
2393
- i18nInstance = instance;
2394
- bindTranslationEvents(instance);
2395
- notify();
2396
- }
2397
- function hasI18nInstance() {
2398
- return i18nInstance !== null;
2399
- }
2400
- function getI18nInstance() {
2401
- if (!i18nInstance) {
2402
- i18nInstance = createI18n();
2403
- bindTranslationEvents(i18nInstance);
2404
- }
2405
- return i18nInstance;
2406
- }
2407
- function getI18nVersion() {
2408
- return version;
2409
- }
2410
- function subscribeToI18n(listener) {
2411
- listeners$1.add(listener);
2412
- return () => {
2413
- listeners$1.delete(listener);
2414
- };
2415
- }
2416
- //#endregion
2417
- //#region src/shared/icons/arrowIcon.tsx
2418
- var ArrowIcon = ({ class: className }) => /* @__PURE__ */ u("svg", {
2419
- width: "13",
2420
- height: "14",
2421
- viewBox: "0 0 13 14",
2422
- fill: "none",
2423
- xmlns: "http://www.w3.org/2000/svg",
2424
- "aria-hidden": "true",
2425
- class: className,
2426
- children: /* @__PURE__ */ u("path", {
2427
- d: "M0 8.08V5.92h9.198l-4.5-4.05L6.228.34 12.6 6.28v1.422L6.228 13.66l-1.53-1.53 4.5-4.05z",
2428
- fill: "currentColor"
2429
- })
2430
- });
2431
- //#endregion
2432
- //#region src/i18n/useTranslation.ts
2433
- function useTranslation() {
2434
- const i18nInstance = getI18nInstance();
2435
- const [, forceUpdate] = d(0);
2436
- const [ready, setReady] = d(i18nInstance.isInitialized);
2437
- y(() => {
2438
- const handleLanguageChanged = () => {
2439
- forceUpdate((n) => n + 1);
2440
- };
2441
- const handleInitialized = () => {
2442
- setReady(true);
2443
- forceUpdate((n) => n + 1);
2444
- };
2445
- i18nInstance.on("languageChanged", handleLanguageChanged);
2446
- i18nInstance.on("initialized", handleInitialized);
2447
- i18nInstance.on("loaded", handleLanguageChanged);
2448
- return () => {
2449
- i18nInstance.off("languageChanged", handleLanguageChanged);
2450
- i18nInstance.off("initialized", handleInitialized);
2451
- i18nInstance.off("loaded", handleLanguageChanged);
2452
- };
2453
- }, [i18nInstance]);
2454
- return {
2455
- t: T(() => i18nInstance.t.bind(i18nInstance), [i18nInstance]),
2456
- ready,
2457
- i18n: i18nInstance
2458
- };
2459
- }
2460
- //#endregion
2461
- //#region src/i18n/Trans.tsx
2462
- var Trans = ({ i18nKey, boldClass = "IncodeTransBold", arrowClass = "IncodeTransArrow", components, defaultValue }) => {
2463
- const { t } = useTranslation();
2464
- const text = defaultValue ? t(i18nKey, { defaultValue }) : t(i18nKey);
2465
- const builtInPattern = "<strong>|<\\/strong>|<br\\s*\\/?>|<arrow\\s*\\/>";
2466
- const componentPattern = components ? Object.keys(components).map((name) => `<${name}>|<\\/${name}>`).join("|") : "";
2467
- const fullPattern = componentPattern ? `${builtInPattern}|${componentPattern}` : builtInPattern;
2468
- const parts = text.split(new RegExp(`(${fullPattern})`, "g"));
2469
- let isBold = false;
2470
- let activeComponent = null;
2471
- return /* @__PURE__ */ u(k, { children: parts.map((part, index) => {
2472
- if (part === "<strong>") {
2473
- isBold = true;
2474
- return null;
2475
- }
2476
- if (part === "</strong>") {
2477
- isBold = false;
2478
- return null;
2479
- }
2480
- if (/^<br\s*\/?>$/.test(part)) return /* @__PURE__ */ u("br", {}, index);
2481
- if (/^<arrow\s*\/>$/.test(part)) return /* @__PURE__ */ u(ArrowIcon, { class: arrowClass }, index);
2482
- if (components) {
2483
- const openMatch = part.match(/^<(\w+)>$/);
2484
- if (openMatch && components[openMatch[1]]) {
2485
- activeComponent = openMatch[1];
2486
- return null;
2487
- }
2488
- const closeMatch = part.match(/^<\/(\w+)>$/);
2489
- if (closeMatch && components[closeMatch[1]]) {
2490
- activeComponent = null;
2491
- return null;
2492
- }
2493
- }
2494
- if (!part) return null;
2495
- if (activeComponent && components) return K(components[activeComponent], { key: index }, part);
2496
- return isBold ? /* @__PURE__ */ u("span", {
2497
- class: boldClass,
2498
- children: part
2499
- }, index) : /* @__PURE__ */ u(k, { children: part }, index);
2500
- }) });
2501
- };
2502
- //#endregion
2503
- //#region src/i18n/fallbackTranslations.ts
2504
- /**
2505
- * Last-resort English copy for keys a screen may read before the translation
2506
- * bundle loads (see `useTranslationWithFallback`). One fallback per key,
2507
- * defined once.
2508
- */
2509
- var I18N_LOCAL = {
2510
- "common.close": "Close",
2511
- "unsupportedBrowser.title": "Unsupported browser",
2512
- "unsupportedBrowser.betterExperience": "For a better experience, open this link in",
2513
- "unsupportedBrowser.or": "or",
2514
- "unsupportedBrowser.copyLink": "Copy link",
2515
- "unsupportedBrowser.continueAnyways": "Continue anyway",
2516
- "unsupportedBrowser.linkCopied": "Link copied",
2517
- "connectionError.title": "No internet connection",
2518
- "connectionError.subtitle": "Wait for the internet to return to continue the process or connect to an available network.",
2519
- "connectionError.refresh": "Refresh"
2520
- };
2521
- //#endregion
2522
- //#region src/i18n/useTranslationWithFallback.ts
2523
- /**
2524
- * `useTranslation()`, but a bare `t(key)` picks up its `I18N_LOCAL` fallback
2525
- * automatically. Any explicit second argument is forwarded untouched. Use
2526
- * this only on screens that can render before the bundle loads — see
2527
- * `BrowserNotSupported`.
2528
- */
2529
- function useTranslationWithFallback() {
2530
- const { t, ready, i18n } = useTranslation();
2531
- C(subscribeToI18n, getI18nVersion);
2532
- return {
2533
- t: q((key, defaultValueOrOptions, options) => {
2534
- if (typeof defaultValueOrOptions === "string") return options === void 0 ? t(key, defaultValueOrOptions) : t(key, defaultValueOrOptions, options);
2535
- if (defaultValueOrOptions !== void 0) return t(key, defaultValueOrOptions);
2536
- if (typeof key !== "string") return t(key);
2537
- const fallback = I18N_LOCAL[key];
2538
- return fallback ? t(key, { defaultValue: fallback }) : t(key);
2539
- }, [t]),
2540
- ready,
2541
- i18n
2542
- };
2543
- }
2544
- //#endregion
2545
- //#region src/shared/uiConfig/uiConfig.ts
2546
- /** Tier 1: set by the host via `setup({ uiConfig })` / `setUiConfig`. Wins. */
2547
- var hostUiConfig = {};
2548
- /** Tier 2: derived from the tenant's dashboard theme. Fills the gaps. */
2549
- var themeUiConfig = {};
2550
- /**
2551
- * Cached composition of the two tiers. `useSyncExternalStore` requires
2552
- * `getSnapshot` to return a referentially stable value — composing on every
2553
- * call would hand Preact a new object each time and loop forever — so the
2554
- * merge happens once per write instead.
2555
- */
2556
- var snapshot = {};
2557
- var listeners = /* @__PURE__ */ new Set();
2558
- function withoutUndefined(value) {
2559
- const defined = {};
2560
- for (const key of Object.keys(value)) if (value[key] !== void 0) defined[key] = value[key];
2561
- return defined;
2562
- }
2563
- /**
2564
- * Host fields win over theme fields; a host field left `undefined` counts as
2565
- * "not specified" and lets the theme through, rather than blanking it.
2566
- */
2567
- function publish() {
2568
- snapshot = {
2569
- ...themeUiConfig,
2570
- ...withoutUndefined(hostUiConfig)
2571
- };
2572
- for (const listener of listeners) listener();
2573
- }
2574
- function subscribe(listener) {
2575
- listeners.add(listener);
2576
- return () => {
2577
- listeners.delete(listener);
2578
- };
2579
- }
2580
- function getSnapshot() {
2581
- return snapshot;
2582
- }
2583
- /**
2584
- * Sets global UI configuration defaults for `@incodetech/web`.
2585
- *
2586
- * Replaces (does not merge with) the previous host-supplied config, so omitting
2587
- * a field clears it. The dashboard theme is held separately and is unaffected.
2588
- */
2589
- function setUiConfig(next) {
2590
- hostUiConfig = next;
2591
- publish();
2592
- }
2593
- /**
2594
- * Merges fields into the host config, leaving unlisted fields as they are.
2595
- *
2596
- * Unlike {@link setUiConfig}, which replaces, this applies one source of
2597
- * config without disturbing what the host set elsewhere — so applying a
2598
- * Studio export cannot drop a host's `assets` or `spinner`. `undefined`
2599
- * values are skipped, so an unset field never clears a good one.
2600
- */
2601
- function patchUiConfig(partial) {
2602
- hostUiConfig = {
2603
- ...hostUiConfig,
2604
- ...withoutUndefined(partial)
2605
- };
2606
- publish();
2607
- }
2608
- /**
2609
- * Internal: publishes the branding fields derived from the tenant's dashboard
2610
- * theme. Not exported from the package — hosts use {@link setUiConfig}.
2611
- */
2612
- function setThemeUiConfig(next) {
2613
- themeUiConfig = next;
2614
- publish();
2615
- }
2616
- function useUiConfig() {
2617
- return C(subscribe, getSnapshot);
2618
- }
2619
- //#endregion
2620
- //#region src/shared/devWarn/devWarn.ts
2621
- /**
2622
- * Emits a namespaced `console.warn` in development only. Override load
2623
- * failures and bad catalog keys are non-fatal (we always fall back to a
2624
- * built-in default), so they must never surface in production consoles.
2625
- */
2626
- function devWarn(message, error) {}
2627
- //#endregion
2628
- export { useUiConfig as a, useTranslation as c, setI18nInstance as d, createI18n as f, supportedLanguages as h, setUiConfig as i, getI18nInstance as l, getLanguageEmoji as m, patchUiConfig as n, useTranslationWithFallback as o, readStoredLanguage as p, setThemeUiConfig as r, Trans as s, devWarn as t, hasI18nInstance as u };