@prosopo/procaptcha-bundle 3.1.6 → 3.2.3

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 (174) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/dist/cjs/index.cjs +10 -1
  3. package/dist/cjs/util/configCreator.cjs +0 -1
  4. package/dist/index.js +10 -1
  5. package/dist/util/configCreator.js +0 -1
  6. package/package.json +16 -16
  7. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts +0 -5
  8. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.d.ts.map +0 -1
  9. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js +0 -5
  10. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/components.js.map +0 -1
  11. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts +0 -16
  12. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.d.ts.map +0 -1
  13. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js +0 -135
  14. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/index.js.map +0 -1
  15. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  16. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  17. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js +0 -36
  18. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/captchaType.test.js.map +0 -1
  19. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts +0 -2
  20. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  21. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js +0 -69
  22. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/config.test.js.map +0 -1
  23. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  24. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  25. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js +0 -136
  26. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/tests/util/renderLogic.test.js.map +0 -1
  27. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  28. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  29. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js +0 -15
  30. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentProvider.js.map +0 -1
  31. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  32. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  33. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js +0 -11
  34. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaComponentsList.js.map +0 -1
  35. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  36. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  37. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js +0 -2
  38. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaProps.js.map +0 -1
  39. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  40. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  41. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js +0 -49
  42. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaRenderer.js.map +0 -1
  43. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  44. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  45. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js +0 -8
  46. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/captchaType.js.map +0 -1
  47. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  48. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  49. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js +0 -14
  50. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/frictionlessCaptcha.js.map +0 -1
  51. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  52. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  53. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js +0 -9
  54. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/imageCaptcha.js.map +0 -1
  55. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  56. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  57. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js +0 -9
  58. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/captcha/components/powCaptcha.js.map +0 -1
  59. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts +0 -6
  60. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.d.ts.map +0 -1
  61. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js +0 -13
  62. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/config.js.map +0 -1
  63. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts +0 -5
  64. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.d.ts.map +0 -1
  65. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js +0 -24
  66. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/configCreator.js.map +0 -1
  67. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts +0 -3
  68. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.d.ts.map +0 -1
  69. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js +0 -17
  70. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/language.js.map +0 -1
  71. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts +0 -3
  72. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.d.ts.map +0 -1
  73. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js +0 -9
  74. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/timeout.js.map +0 -1
  75. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts +0 -18
  76. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  77. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js +0 -66
  78. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetFactory.js.map +0 -1
  79. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  80. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  81. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js +0 -19
  82. package/.rollup.cache/home/runner/work/captcha/captcha/packages/procaptcha-bundle/dist/bundle/util/widgetThemeResolver.js.map +0 -1
  83. package/dist/bundle/ProcaptchaWidget-CJ-4hVS1.js +0 -187
  84. package/dist/bundle/ProcaptchaWidget-Cw3s7cGX.js +0 -1014
  85. package/dist/bundle/Signer-DP9drQ55.js +0 -23
  86. package/dist/bundle/bnChunk-DRlDxTFg.js +0 -1137
  87. package/dist/bundle/browser-ponyfill-CvzSbL_o.js +0 -339
  88. package/dist/bundle/builder-ByZ5z580.js +0 -46
  89. package/dist/bundle/captchaComponentProvider-Cn75EmSH.js +0 -1002
  90. package/dist/bundle/captchaRenderer-s4QuLEen.js +0 -71
  91. package/dist/bundle/commonChunk-BjvuHlB1.js +0 -180
  92. package/dist/bundle/components.d.ts +0 -5
  93. package/dist/bundle/components.d.ts.map +0 -1
  94. package/dist/bundle/emotion-element-c39617d8.browser.esm-BNNnmykm.js +0 -916
  95. package/dist/bundle/fp.esm-DYWeNGcH.js +0 -1654
  96. package/dist/bundle/index-BuQg3Zno.js +0 -1884
  97. package/dist/bundle/index-DIdd2cUz.js +0 -5416
  98. package/dist/bundle/index-IgqrmVIs.js +0 -601
  99. package/dist/bundle/index.d.ts +0 -16
  100. package/dist/bundle/index.d.ts.map +0 -1
  101. package/dist/bundle/locales/ar/translation.json +0 -57
  102. package/dist/bundle/locales/az/translation.json +0 -57
  103. package/dist/bundle/locales/cs/translation.json +0 -57
  104. package/dist/bundle/locales/de/translation.json +0 -57
  105. package/dist/bundle/locales/el/translation.json +0 -57
  106. package/dist/bundle/locales/en/translation.json +0 -57
  107. package/dist/bundle/locales/es/translation.json +0 -57
  108. package/dist/bundle/locales/fi/translation.json +0 -57
  109. package/dist/bundle/locales/fr/translation.json +0 -57
  110. package/dist/bundle/locales/hi/translation.json +0 -57
  111. package/dist/bundle/locales/hu/translation.json +0 -57
  112. package/dist/bundle/locales/id/translation.json +0 -57
  113. package/dist/bundle/locales/it/translation.json +0 -57
  114. package/dist/bundle/locales/ja/translation.json +0 -57
  115. package/dist/bundle/locales/jv/translation.json +0 -57
  116. package/dist/bundle/locales/ko/translation.json +0 -57
  117. package/dist/bundle/locales/ml/translation.json +0 -57
  118. package/dist/bundle/locales/ms/translation.json +0 -57
  119. package/dist/bundle/locales/nl/translation.json +0 -57
  120. package/dist/bundle/locales/no/translation.json +0 -57
  121. package/dist/bundle/locales/pl/translation.json +0 -57
  122. package/dist/bundle/locales/pt/translation.json +0 -57
  123. package/dist/bundle/locales/pt-BR/translation.json +0 -57
  124. package/dist/bundle/locales/ro/translation.json +0 -57
  125. package/dist/bundle/locales/ru/translation.json +0 -57
  126. package/dist/bundle/locales/sr/translation.json +0 -57
  127. package/dist/bundle/locales/sv/translation.json +0 -57
  128. package/dist/bundle/locales/th/translation.json +0 -57
  129. package/dist/bundle/locales/tr/translation.json +0 -57
  130. package/dist/bundle/locales/uk/translation.json +0 -57
  131. package/dist/bundle/locales/vi/translation.json +0 -57
  132. package/dist/bundle/locales/zh-CN/translation.json +0 -57
  133. package/dist/bundle/nobleChunk-Bbltwf44.js +0 -2728
  134. package/dist/bundle/procaptcha.bundle.js +0 -8
  135. package/dist/bundle/tests/util/captchaType.test.d.ts +0 -2
  136. package/dist/bundle/tests/util/captchaType.test.d.ts.map +0 -1
  137. package/dist/bundle/tests/util/config.test.d.ts +0 -2
  138. package/dist/bundle/tests/util/config.test.d.ts.map +0 -1
  139. package/dist/bundle/tests/util/renderLogic.test.d.ts +0 -2
  140. package/dist/bundle/tests/util/renderLogic.test.d.ts.map +0 -1
  141. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts +0 -8
  142. package/dist/bundle/util/captcha/captchaComponentProvider.d.ts.map +0 -1
  143. package/dist/bundle/util/captcha/captchaComponentsList.d.ts +0 -6
  144. package/dist/bundle/util/captcha/captchaComponentsList.d.ts.map +0 -1
  145. package/dist/bundle/util/captcha/captchaProps.d.ts +0 -10
  146. package/dist/bundle/util/captcha/captchaProps.d.ts.map +0 -1
  147. package/dist/bundle/util/captcha/captchaRenderer.d.ts +0 -24
  148. package/dist/bundle/util/captcha/captchaRenderer.d.ts.map +0 -1
  149. package/dist/bundle/util/captcha/captchaType.d.ts +0 -3
  150. package/dist/bundle/util/captcha/captchaType.d.ts.map +0 -1
  151. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts +0 -4
  152. package/dist/bundle/util/captcha/components/frictionlessCaptcha.d.ts.map +0 -1
  153. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts +0 -4
  154. package/dist/bundle/util/captcha/components/imageCaptcha.d.ts.map +0 -1
  155. package/dist/bundle/util/captcha/components/powCaptcha.d.ts +0 -4
  156. package/dist/bundle/util/captcha/components/powCaptcha.d.ts.map +0 -1
  157. package/dist/bundle/util/config.d.ts +0 -6
  158. package/dist/bundle/util/config.d.ts.map +0 -1
  159. package/dist/bundle/util/configCreator.d.ts +0 -5
  160. package/dist/bundle/util/configCreator.d.ts.map +0 -1
  161. package/dist/bundle/util/language.d.ts +0 -3
  162. package/dist/bundle/util/language.d.ts.map +0 -1
  163. package/dist/bundle/util/timeout.d.ts +0 -3
  164. package/dist/bundle/util/timeout.d.ts.map +0 -1
  165. package/dist/bundle/util/widgetFactory.d.ts +0 -18
  166. package/dist/bundle/util/widgetFactory.d.ts.map +0 -1
  167. package/dist/bundle/util/widgetThemeResolver.d.ts +0 -9
  168. package/dist/bundle/util/widgetThemeResolver.d.ts.map +0 -1
  169. package/dist/bundle/utilChunk-DPr6oTOj.js +0 -317
  170. package/dist/bundle/utilCryptoChunk-D6ZLkbFV.js +0 -1236
  171. package/dist/bundle/web2Chunk-CNoojUDK.js +0 -3967
  172. package/dist/bundle/web3Chunk-BlYvY4Ea.js +0 -525
  173. package/dist/bundle/zodChunk-aEfPZzrp.js +0 -2882
  174. package/stats.html +0 -4842
@@ -1,3967 +0,0 @@
1
- var $t = (n) => {
2
- throw TypeError(n);
3
- };
4
- var Nt = (n, e, t) => e.has(n) || $t("Cannot " + t);
5
- var j = (n, e, t) => (Nt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), me = (n, e, t) => e.has(n) ? $t("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ye = (n, e, t, r) => (Nt(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
6
- import { g as Hr } from "./bnChunk-DRlDxTFg.js";
7
- import { j as Vr } from "./nobleChunk-Bbltwf44.js";
8
- import { z as C, n as ke, o as y, a as w, b as q, s as p, c as ce, d as Br, u as _e, e as jt, f as Dt, g as Je, r as On, l as Ut } from "./zodChunk-aEfPZzrp.js";
9
- import { j as Kr, s as qr, n as zr, a as Wr, b as Jr, c as Xr, d as Yr, e as Gr, f as Qr, g as Zr, k as ei, h as En, i as Tn, l as je, m as ti, o as ni, p as ri, q as ii, r as oi } from "./utilCryptoChunk-D6ZLkbFV.js";
10
- import { r as nt, b as ft, o as Cn, u as dt, a as Ft, t as si, i as ai, c as De, k as rt, s as Ln } from "./utilChunk-DPr6oTOj.js";
11
- function ui(n, e) {
12
- for (var t = 0; t < e.length; t++) {
13
- const r = e[t];
14
- if (typeof r != "string" && !Array.isArray(r)) {
15
- for (const i in r)
16
- if (i !== "default" && !(i in n)) {
17
- const o = Object.getOwnPropertyDescriptor(r, i);
18
- o && Object.defineProperty(n, i, o.get ? o : {
19
- enumerable: !0,
20
- get: () => r[i]
21
- });
22
- }
23
- }
24
- }
25
- return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
26
- }
27
- var h = /* @__PURE__ */ ((n) => (n.datasetId = "datasetId", n.user = "user", n.dapp = "dapp", n.provider = "provider", n.blockNumber = "blockNumber", n.requestHash = "requestHash", n.captchas = "captchas", n.commitmentId = "commitmentId", n.proof = "proof", n.dappSignature = "dappSignature", n.dappUserSignature = "dappUserSignature", n.providerUrl = "providerUrl", n.procaptchaResponse = "procaptcha-response", n.verifiedTimeout = "verifiedTimeout", n.maxVerifiedTime = "maxVerifiedTime", n.verified = "verified", n.status = "status", n.challenge = "challenge", n.difficulty = "difficulty", n.nonce = "nonce", n.timeouts = "timeouts", n.token = "token", n.secret = "secret", n.timestamp = "timestamp", n.signature = "signature", n.error = "error", n.siteKey = "siteKey", n.captchaType = "captchaType", n.sessionId = "sessionId", n.settings = "settings", n.domains = "domains", n.frictionlessThreshold = "frictionlessThreshold", n.powDifficulty = "powDifficulty", n.score = "score", n.tier = "tier", n.detectorKey = "detectorKey", n.ip = "ip", n.expirationInSeconds = "expirationInSeconds", n))(h || {}), St = /* @__PURE__ */ ((n) => (n.Free = "free", n.Professional = "professional", n.Enterprise = "enterprise", n))(St || {});
28
- C.nativeEnum(St);
29
- var Xe = /* @__PURE__ */ ((n) => (n.image = "image", n.pow = "pow", n.frictionless = "frictionless", n.invisible = "invisible", n))(Xe || {});
30
- C.nativeEnum(Xe);
31
- const li = ke(Xe), ci = Xe.frictionless, fi = [], di = 0.5, pi = 4, hi = 0.8;
32
- var Pn = /* @__PURE__ */ ((n) => (n.Allow = "allow", n.Reject = "reject", n.Flag = "flag", n))(Pn || {});
33
- const B = C.nativeEnum(Pn), gi = "allow", mi = "allow", yi = "allow", vi = 1e3, wi = 5e-3, bi = "reject", Si = "reject", xi = !1, Oi = y({
34
- actions: y({
35
- countryChangeAction: B.optional(),
36
- cityChangeAction: B.optional(),
37
- ispChangeAction: B.optional(),
38
- distanceExceedAction: B.optional(),
39
- abuseScoreExceedAction: B.optional()
40
- }).partial(),
41
- // all optional, so you can just override what you need
42
- distanceThresholdKm: w().positive().optional(),
43
- abuseScoreThreshold: w().positive().optional(),
44
- requireAllConditions: ce().optional()
45
- }), Ei = y({
46
- actions: y({
47
- countryChangeAction: B.optional().default(
48
- gi
49
- ),
50
- cityChangeAction: B.optional().default(
51
- mi
52
- ),
53
- ispChangeAction: B.optional().default(
54
- yi
55
- ),
56
- distanceExceedAction: B.optional().default(
57
- bi
58
- ),
59
- abuseScoreExceedAction: B.optional().default(
60
- Si
61
- )
62
- }),
63
- distanceThresholdKm: w().positive().optional().default(vi),
64
- abuseScoreThreshold: w().positive().optional().default(wi),
65
- requireAllConditions: C.boolean().optional().default(xi),
66
- // overrides are now lightweight, not recursive
67
- countryOverrides: C.record(p(), Oi).optional()
68
- }), Ti = y({
69
- captchaType: li.optional().default(ci),
70
- domains: q(p()).optional().default([...fi]),
71
- frictionlessThreshold: w().optional().default(di),
72
- powDifficulty: w().optional().default(pi),
73
- imageThreshold: w().optional().default(hi),
74
- ipValidationRules: Ei.optional()
75
- });
76
- let it;
77
- async function Ia(n) {
78
- return new Promise((e, t) => {
79
- try {
80
- Promise.resolve().then(() => ls).then(({ default: r }) => {
81
- it ? e(it) : it = r(e);
82
- });
83
- } catch (r) {
84
- t(r);
85
- }
86
- });
87
- }
88
- const kn = {
89
- arabic: "ar",
90
- azerbaijani: "az",
91
- czech: "cs",
92
- german: "de",
93
- greek: "el",
94
- english: "en",
95
- spanish: "es",
96
- finnish: "fi",
97
- french: "fr",
98
- hindi: "hi",
99
- hungarian: "hu",
100
- indonesian: "id",
101
- italian: "it",
102
- japanese: "ja",
103
- javanese: "jv",
104
- korean: "ko",
105
- malayalam: "ml",
106
- malay: "ms",
107
- dutch: "nl",
108
- norwegian: "no",
109
- polish: "pl",
110
- portugeseBrazil: "pt-BR",
111
- portuguese: "pt",
112
- romanian: "ro",
113
- russian: "ru",
114
- serbian: "sr",
115
- swedish: "sv",
116
- thai: "th",
117
- turkish: "tr",
118
- ukrainian: "uk",
119
- vietnamese: "vi",
120
- chinese: "zh-CN"
121
- }, In = C.enum(
122
- Object.values(kn)
123
- );
124
- var Rn = { exports: {} }, x = {};
125
- var Ie = Symbol.for("react.element"), Ci = Symbol.for("react.portal"), Li = Symbol.for("react.fragment"), Pi = Symbol.for("react.strict_mode"), ki = Symbol.for("react.profiler"), Ii = Symbol.for("react.provider"), Ri = Symbol.for("react.context"), Ai = Symbol.for("react.forward_ref"), $i = Symbol.for("react.suspense"), Ni = Symbol.for("react.memo"), ji = Symbol.for("react.lazy"), _t = Symbol.iterator;
126
- function Di(n) {
127
- return n === null || typeof n != "object" ? null : (n = _t && n[_t] || n["@@iterator"], typeof n == "function" ? n : null);
128
- }
129
- var An = { isMounted: function() {
130
- return !1;
131
- }, enqueueForceUpdate: function() {
132
- }, enqueueReplaceState: function() {
133
- }, enqueueSetState: function() {
134
- } }, $n = Object.assign, Nn = {};
135
- function pe(n, e, t) {
136
- this.props = n, this.context = e, this.refs = Nn, this.updater = t || An;
137
- }
138
- pe.prototype.isReactComponent = {};
139
- pe.prototype.setState = function(n, e) {
140
- if (typeof n != "object" && typeof n != "function" && n != null) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
141
- this.updater.enqueueSetState(this, n, e, "setState");
142
- };
143
- pe.prototype.forceUpdate = function(n) {
144
- this.updater.enqueueForceUpdate(this, n, "forceUpdate");
145
- };
146
- function jn() {
147
- }
148
- jn.prototype = pe.prototype;
149
- function xt(n, e, t) {
150
- this.props = n, this.context = e, this.refs = Nn, this.updater = t || An;
151
- }
152
- var Ot = xt.prototype = new jn();
153
- Ot.constructor = xt;
154
- $n(Ot, pe.prototype);
155
- Ot.isPureReactComponent = !0;
156
- var Mt = Array.isArray, Dn = Object.prototype.hasOwnProperty, Et = { current: null }, Un = { key: !0, ref: !0, __self: !0, __source: !0 };
157
- function Fn(n, e, t) {
158
- var r, i = {}, o = null, s = null;
159
- if (e != null) for (r in e.ref !== void 0 && (s = e.ref), e.key !== void 0 && (o = "" + e.key), e) Dn.call(e, r) && !Un.hasOwnProperty(r) && (i[r] = e[r]);
160
- var a = arguments.length - 2;
161
- if (a === 1) i.children = t;
162
- else if (1 < a) {
163
- for (var u = Array(a), c = 0; c < a; c++) u[c] = arguments[c + 2];
164
- i.children = u;
165
- }
166
- if (n && n.defaultProps) for (r in a = n.defaultProps, a) i[r] === void 0 && (i[r] = a[r]);
167
- return { $$typeof: Ie, type: n, key: o, ref: s, props: i, _owner: Et.current };
168
- }
169
- function Ui(n, e) {
170
- return { $$typeof: Ie, type: n.type, key: e, ref: n.ref, props: n.props, _owner: n._owner };
171
- }
172
- function Tt(n) {
173
- return typeof n == "object" && n !== null && n.$$typeof === Ie;
174
- }
175
- function Fi(n) {
176
- var e = { "=": "=0", ":": "=2" };
177
- return "$" + n.replace(/[=:]/g, function(t) {
178
- return e[t];
179
- });
180
- }
181
- var Ht = /\/+/g;
182
- function ot(n, e) {
183
- return typeof n == "object" && n !== null && n.key != null ? Fi("" + n.key) : e.toString(36);
184
- }
185
- function Ue(n, e, t, r, i) {
186
- var o = typeof n;
187
- (o === "undefined" || o === "boolean") && (n = null);
188
- var s = !1;
189
- if (n === null) s = !0;
190
- else switch (o) {
191
- case "string":
192
- case "number":
193
- s = !0;
194
- break;
195
- case "object":
196
- switch (n.$$typeof) {
197
- case Ie:
198
- case Ci:
199
- s = !0;
200
- }
201
- }
202
- if (s) return s = n, i = i(s), n = r === "" ? "." + ot(s, 0) : r, Mt(i) ? (t = "", n != null && (t = n.replace(Ht, "$&/") + "/"), Ue(i, e, t, "", function(c) {
203
- return c;
204
- })) : i != null && (Tt(i) && (i = Ui(i, t + (!i.key || s && s.key === i.key ? "" : ("" + i.key).replace(Ht, "$&/") + "/") + n)), e.push(i)), 1;
205
- if (s = 0, r = r === "" ? "." : r + ":", Mt(n)) for (var a = 0; a < n.length; a++) {
206
- o = n[a];
207
- var u = r + ot(o, a);
208
- s += Ue(o, e, t, u, i);
209
- }
210
- else if (u = Di(n), typeof u == "function") for (n = u.call(n), a = 0; !(o = n.next()).done; ) o = o.value, u = r + ot(o, a++), s += Ue(o, e, t, u, i);
211
- else if (o === "object") throw e = String(n), Error("Objects are not valid as a React child (found: " + (e === "[object Object]" ? "object with keys {" + Object.keys(n).join(", ") + "}" : e) + "). If you meant to render a collection of children, use an array instead.");
212
- return s;
213
- }
214
- function $e(n, e, t) {
215
- if (n == null) return n;
216
- var r = [], i = 0;
217
- return Ue(n, r, "", "", function(o) {
218
- return e.call(t, o, i++);
219
- }), r;
220
- }
221
- function _i(n) {
222
- if (n._status === -1) {
223
- var e = n._result;
224
- e = e(), e.then(function(t) {
225
- (n._status === 0 || n._status === -1) && (n._status = 1, n._result = t);
226
- }, function(t) {
227
- (n._status === 0 || n._status === -1) && (n._status = 2, n._result = t);
228
- }), n._status === -1 && (n._status = 0, n._result = e);
229
- }
230
- if (n._status === 1) return n._result.default;
231
- throw n._result;
232
- }
233
- var A = { current: null }, Fe = { transition: null }, Mi = { ReactCurrentDispatcher: A, ReactCurrentBatchConfig: Fe, ReactCurrentOwner: Et };
234
- function _n() {
235
- throw Error("act(...) is not supported in production builds of React.");
236
- }
237
- x.Children = { map: $e, forEach: function(n, e, t) {
238
- $e(n, function() {
239
- e.apply(this, arguments);
240
- }, t);
241
- }, count: function(n) {
242
- var e = 0;
243
- return $e(n, function() {
244
- e++;
245
- }), e;
246
- }, toArray: function(n) {
247
- return $e(n, function(e) {
248
- return e;
249
- }) || [];
250
- }, only: function(n) {
251
- if (!Tt(n)) throw Error("React.Children.only expected to receive a single React element child.");
252
- return n;
253
- } };
254
- x.Component = pe;
255
- x.Fragment = Li;
256
- x.Profiler = ki;
257
- x.PureComponent = xt;
258
- x.StrictMode = Pi;
259
- x.Suspense = $i;
260
- x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Mi;
261
- x.act = _n;
262
- x.cloneElement = function(n, e, t) {
263
- if (n == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + n + ".");
264
- var r = $n({}, n.props), i = n.key, o = n.ref, s = n._owner;
265
- if (e != null) {
266
- if (e.ref !== void 0 && (o = e.ref, s = Et.current), e.key !== void 0 && (i = "" + e.key), n.type && n.type.defaultProps) var a = n.type.defaultProps;
267
- for (u in e) Dn.call(e, u) && !Un.hasOwnProperty(u) && (r[u] = e[u] === void 0 && a !== void 0 ? a[u] : e[u]);
268
- }
269
- var u = arguments.length - 2;
270
- if (u === 1) r.children = t;
271
- else if (1 < u) {
272
- a = Array(u);
273
- for (var c = 0; c < u; c++) a[c] = arguments[c + 2];
274
- r.children = a;
275
- }
276
- return { $$typeof: Ie, type: n.type, key: i, ref: o, props: r, _owner: s };
277
- };
278
- x.createContext = function(n) {
279
- return n = { $$typeof: Ri, _currentValue: n, _currentValue2: n, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, n.Provider = { $$typeof: Ii, _context: n }, n.Consumer = n;
280
- };
281
- x.createElement = Fn;
282
- x.createFactory = function(n) {
283
- var e = Fn.bind(null, n);
284
- return e.type = n, e;
285
- };
286
- x.createRef = function() {
287
- return { current: null };
288
- };
289
- x.forwardRef = function(n) {
290
- return { $$typeof: Ai, render: n };
291
- };
292
- x.isValidElement = Tt;
293
- x.lazy = function(n) {
294
- return { $$typeof: ji, _payload: { _status: -1, _result: n }, _init: _i };
295
- };
296
- x.memo = function(n, e) {
297
- return { $$typeof: Ni, type: n, compare: e === void 0 ? null : e };
298
- };
299
- x.startTransition = function(n) {
300
- var e = Fe.transition;
301
- Fe.transition = {};
302
- try {
303
- n();
304
- } finally {
305
- Fe.transition = e;
306
- }
307
- };
308
- x.unstable_act = _n;
309
- x.useCallback = function(n, e) {
310
- return A.current.useCallback(n, e);
311
- };
312
- x.useContext = function(n) {
313
- return A.current.useContext(n);
314
- };
315
- x.useDebugValue = function() {
316
- };
317
- x.useDeferredValue = function(n) {
318
- return A.current.useDeferredValue(n);
319
- };
320
- x.useEffect = function(n, e) {
321
- return A.current.useEffect(n, e);
322
- };
323
- x.useId = function() {
324
- return A.current.useId();
325
- };
326
- x.useImperativeHandle = function(n, e, t) {
327
- return A.current.useImperativeHandle(n, e, t);
328
- };
329
- x.useInsertionEffect = function(n, e) {
330
- return A.current.useInsertionEffect(n, e);
331
- };
332
- x.useLayoutEffect = function(n, e) {
333
- return A.current.useLayoutEffect(n, e);
334
- };
335
- x.useMemo = function(n, e) {
336
- return A.current.useMemo(n, e);
337
- };
338
- x.useReducer = function(n, e, t) {
339
- return A.current.useReducer(n, e, t);
340
- };
341
- x.useRef = function(n) {
342
- return A.current.useRef(n);
343
- };
344
- x.useState = function(n) {
345
- return A.current.useState(n);
346
- };
347
- x.useSyncExternalStore = function(n, e, t) {
348
- return A.current.useSyncExternalStore(n, e, t);
349
- };
350
- x.useTransition = function() {
351
- return A.current.useTransition();
352
- };
353
- x.version = "18.3.1";
354
- Rn.exports = x;
355
- var F = Rn.exports;
356
- const Hi = /* @__PURE__ */ Hr(F), Ra = /* @__PURE__ */ ui({
357
- __proto__: null,
358
- default: Hi
359
- }, [F]), Vi = (n, e, t, r) => {
360
- var o, s, a, u;
361
- const i = [t, {
362
- code: e,
363
- ...r || {}
364
- }];
365
- if ((s = (o = n == null ? void 0 : n.services) == null ? void 0 : o.logger) != null && s.forward)
366
- return n.services.logger.forward(i, "warn", "react-i18next::", !0);
367
- ee(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), (u = (a = n == null ? void 0 : n.services) == null ? void 0 : a.logger) != null && u.warn ? n.services.logger.warn(...i) : console != null && console.warn && [...i];
368
- }, Vt = {}, pt = (n, e, t, r) => {
369
- ee(t) && Vt[t] || (ee(t) && (Vt[t] = /* @__PURE__ */ new Date()), Vi(n, e, t, r));
370
- }, Mn = (n, e) => () => {
371
- if (n.isInitialized)
372
- e();
373
- else {
374
- const t = () => {
375
- setTimeout(() => {
376
- n.off("initialized", t);
377
- }, 0), e();
378
- };
379
- n.on("initialized", t);
380
- }
381
- }, ht = (n, e, t) => {
382
- n.loadNamespaces(e, Mn(n, t));
383
- }, Bt = (n, e, t, r) => {
384
- if (ee(t) && (t = [t]), n.options.preload && n.options.preload.indexOf(e) > -1) return ht(n, t, r);
385
- t.forEach((i) => {
386
- n.options.ns.indexOf(i) < 0 && n.options.ns.push(i);
387
- }), n.loadLanguages(e, Mn(n, r));
388
- }, Bi = (n, e, t = {}) => !e.languages || !e.languages.length ? (pt(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
389
- languages: e.languages
390
- }), !0) : e.hasLoadedNamespace(n, {
391
- lng: t.lng,
392
- precheck: (r, i) => {
393
- var o;
394
- if (((o = t.bindI18n) == null ? void 0 : o.indexOf("languageChanging")) > -1 && r.services.backendConnector.backend && r.isLanguageChangingTo && !i(r.isLanguageChangingTo, n)) return !1;
395
- }
396
- }), ee = (n) => typeof n == "string", Ki = (n) => typeof n == "object" && n !== null, qi = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, zi = {
397
- "&amp;": "&",
398
- "&#38;": "&",
399
- "&lt;": "<",
400
- "&#60;": "<",
401
- "&gt;": ">",
402
- "&#62;": ">",
403
- "&apos;": "'",
404
- "&#39;": "'",
405
- "&quot;": '"',
406
- "&#34;": '"',
407
- "&nbsp;": " ",
408
- "&#160;": " ",
409
- "&copy;": "©",
410
- "&#169;": "©",
411
- "&reg;": "®",
412
- "&#174;": "®",
413
- "&hellip;": "…",
414
- "&#8230;": "…",
415
- "&#x2F;": "/",
416
- "&#47;": "/"
417
- }, Wi = (n) => zi[n], Ji = (n) => n.replace(qi, Wi);
418
- let gt = {
419
- bindI18n: "languageChanged",
420
- bindI18nStore: "",
421
- transEmptyNodeValue: "",
422
- transSupportBasicHtmlNodes: !0,
423
- transWrapTextNodes: "",
424
- transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
425
- useSuspense: !0,
426
- unescape: Ji
427
- };
428
- const Xi = (n = {}) => {
429
- gt = {
430
- ...gt,
431
- ...n
432
- };
433
- }, Yi = () => gt;
434
- let Hn;
435
- const Gi = (n) => {
436
- Hn = n;
437
- }, Qi = () => Hn, Zi = {
438
- type: "3rdParty",
439
- init(n) {
440
- Xi(n.options.react), Gi(n);
441
- }
442
- }, eo = F.createContext();
443
- class to {
444
- constructor() {
445
- this.usedNamespaces = {};
446
- }
447
- addUsedNamespaces(e) {
448
- e.forEach((t) => {
449
- this.usedNamespaces[t] || (this.usedNamespaces[t] = !0);
450
- });
451
- }
452
- getUsedNamespaces() {
453
- return Object.keys(this.usedNamespaces);
454
- }
455
- }
456
- const no = (n, e) => {
457
- const t = F.useRef();
458
- return F.useEffect(() => {
459
- t.current = n;
460
- }, [n, e]), t.current;
461
- }, Vn = (n, e, t, r) => n.getFixedT(e, t, r), ro = (n, e, t, r) => F.useCallback(Vn(n, e, t, r), [n, e, t, r]), io = (n, e = {}) => {
462
- var $, J, X, k;
463
- const {
464
- i18n: t
465
- } = e, {
466
- i18n: r,
467
- defaultNS: i
468
- } = F.useContext(eo) || {}, o = t || r || Qi();
469
- if (o && !o.reportNamespaces && (o.reportNamespaces = new to()), !o) {
470
- pt(o, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
471
- const O = (R, T) => ee(T) ? T : Ki(T) && ee(T.defaultValue) ? T.defaultValue : Array.isArray(R) ? R[R.length - 1] : R, I = [O, {}, !1];
472
- return I.t = O, I.i18n = {}, I.ready = !1, I;
473
- }
474
- ($ = o.options.react) != null && $.wait && pt(o, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
475
- const s = {
476
- ...Yi(),
477
- ...o.options.react,
478
- ...e
479
- }, {
480
- useSuspense: a,
481
- keyPrefix: u
482
- } = s;
483
- let c = n || i || ((J = o.options) == null ? void 0 : J.defaultNS);
484
- c = ee(c) ? [c] : c || ["translation"], (k = (X = o.reportNamespaces).addUsedNamespaces) == null || k.call(X, c);
485
- const l = (o.isInitialized || o.initializedStoreOnce) && c.every((O) => Bi(O, o, s)), f = ro(o, e.lng || null, s.nsMode === "fallback" ? c : c[0], u), d = () => f, g = () => Vn(o, e.lng || null, s.nsMode === "fallback" ? c : c[0], u), [m, v] = F.useState(d);
486
- let b = c.join();
487
- e.lng && (b = `${e.lng}${b}`);
488
- const P = no(b), E = F.useRef(!0);
489
- F.useEffect(() => {
490
- const {
491
- bindI18n: O,
492
- bindI18nStore: I
493
- } = s;
494
- E.current = !0, !l && !a && (e.lng ? Bt(o, e.lng, c, () => {
495
- E.current && v(g);
496
- }) : ht(o, c, () => {
497
- E.current && v(g);
498
- })), l && P && P !== b && E.current && v(g);
499
- const R = () => {
500
- E.current && v(g);
501
- };
502
- return O && (o == null || o.on(O, R)), I && (o == null || o.store.on(I, R)), () => {
503
- E.current = !1, o && (O == null || O.split(" ").forEach((T) => o.off(T, R))), I && o && I.split(" ").forEach((T) => o.store.off(T, R));
504
- };
505
- }, [o, b]), F.useEffect(() => {
506
- E.current && l && v(d);
507
- }, [o, u, l]);
508
- const L = [m, o, l];
509
- if (L.t = m, L.i18n = o, L.ready = l, l || !l && !a) return L;
510
- throw new Promise((O) => {
511
- e.lng ? Bt(o, e.lng, c, () => O()) : ht(o, c, () => O());
512
- });
513
- }, S = (n) => typeof n == "string", ve = () => {
514
- let n, e;
515
- const t = new Promise((r, i) => {
516
- n = r, e = i;
517
- });
518
- return t.resolve = n, t.reject = e, t;
519
- }, Kt = (n) => n == null ? "" : "" + n, oo = (n, e, t) => {
520
- n.forEach((r) => {
521
- e[r] && (t[r] = e[r]);
522
- });
523
- }, so = /###/g, qt = (n) => n && n.indexOf("###") > -1 ? n.replace(so, ".") : n, zt = (n) => !n || S(n), Oe = (n, e, t) => {
524
- const r = S(e) ? e.split(".") : e;
525
- let i = 0;
526
- for (; i < r.length - 1; ) {
527
- if (zt(n)) return {};
528
- const o = qt(r[i]);
529
- !n[o] && t && (n[o] = new t()), Object.prototype.hasOwnProperty.call(n, o) ? n = n[o] : n = {}, ++i;
530
- }
531
- return zt(n) ? {} : {
532
- obj: n,
533
- k: qt(r[i])
534
- };
535
- }, Wt = (n, e, t) => {
536
- const {
537
- obj: r,
538
- k: i
539
- } = Oe(n, e, Object);
540
- if (r !== void 0 || e.length === 1) {
541
- r[i] = t;
542
- return;
543
- }
544
- let o = e[e.length - 1], s = e.slice(0, e.length - 1), a = Oe(n, s, Object);
545
- for (; a.obj === void 0 && s.length; )
546
- o = `${s[s.length - 1]}.${o}`, s = s.slice(0, s.length - 1), a = Oe(n, s, Object), a != null && a.obj && typeof a.obj[`${a.k}.${o}`] < "u" && (a.obj = void 0);
547
- a.obj[`${a.k}.${o}`] = t;
548
- }, ao = (n, e, t, r) => {
549
- const {
550
- obj: i,
551
- k: o
552
- } = Oe(n, e, Object);
553
- i[o] = i[o] || [], i[o].push(t);
554
- }, Me = (n, e) => {
555
- const {
556
- obj: t,
557
- k: r
558
- } = Oe(n, e);
559
- if (t && Object.prototype.hasOwnProperty.call(t, r))
560
- return t[r];
561
- }, uo = (n, e, t) => {
562
- const r = Me(n, t);
563
- return r !== void 0 ? r : Me(e, t);
564
- }, Bn = (n, e, t) => {
565
- for (const r in e)
566
- r !== "__proto__" && r !== "constructor" && (r in n ? S(n[r]) || n[r] instanceof String || S(e[r]) || e[r] instanceof String ? t && (n[r] = e[r]) : Bn(n[r], e[r], t) : n[r] = e[r]);
567
- return n;
568
- }, re = (n) => n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
569
- var lo = {
570
- "&": "&amp;",
571
- "<": "&lt;",
572
- ">": "&gt;",
573
- '"': "&quot;",
574
- "'": "&#39;",
575
- "/": "&#x2F;"
576
- };
577
- const co = (n) => S(n) ? n.replace(/[&<>"'\/]/g, (e) => lo[e]) : n;
578
- class fo {
579
- constructor(e) {
580
- this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
581
- }
582
- getRegExp(e) {
583
- const t = this.regExpMap.get(e);
584
- if (t !== void 0)
585
- return t;
586
- const r = new RegExp(e);
587
- return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, r), this.regExpQueue.push(e), r;
588
- }
589
- }
590
- const po = [" ", ",", "?", "!", ";"], ho = new fo(20), go = (n, e, t) => {
591
- e = e || "", t = t || "";
592
- const r = po.filter((s) => e.indexOf(s) < 0 && t.indexOf(s) < 0);
593
- if (r.length === 0) return !0;
594
- const i = ho.getRegExp(`(${r.map((s) => s === "?" ? "\\?" : s).join("|")})`);
595
- let o = !i.test(n);
596
- if (!o) {
597
- const s = n.indexOf(t);
598
- s > 0 && !i.test(n.substring(0, s)) && (o = !0);
599
- }
600
- return o;
601
- }, mt = function(n, e) {
602
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
603
- if (!n) return;
604
- if (n[e])
605
- return Object.prototype.hasOwnProperty.call(n, e) ? n[e] : void 0;
606
- const r = e.split(t);
607
- let i = n;
608
- for (let o = 0; o < r.length; ) {
609
- if (!i || typeof i != "object")
610
- return;
611
- let s, a = "";
612
- for (let u = o; u < r.length; ++u)
613
- if (u !== o && (a += t), a += r[u], s = i[a], s !== void 0) {
614
- if (["string", "number", "boolean"].indexOf(typeof s) > -1 && u < r.length - 1)
615
- continue;
616
- o += u - o + 1;
617
- break;
618
- }
619
- i = s;
620
- }
621
- return i;
622
- }, He = (n) => n == null ? void 0 : n.replace("_", "-"), mo = {
623
- type: "logger",
624
- log(n) {
625
- this.output("log", n);
626
- },
627
- warn(n) {
628
- this.output("warn", n);
629
- },
630
- error(n) {
631
- this.output("error", n);
632
- },
633
- output(n, e) {
634
- var t, r;
635
- (r = (t = console == null ? void 0 : console[n]) == null ? void 0 : t.apply) == null || r.call(t, console, e);
636
- }
637
- };
638
- class Ve {
639
- constructor(e) {
640
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
641
- this.init(e, t);
642
- }
643
- init(e) {
644
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
645
- this.prefix = t.prefix || "i18next:", this.logger = e || mo, this.options = t, this.debug = t.debug;
646
- }
647
- log() {
648
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
649
- t[r] = arguments[r];
650
- return this.forward(t, "log", "", !0);
651
- }
652
- warn() {
653
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
654
- t[r] = arguments[r];
655
- return this.forward(t, "warn", "", !0);
656
- }
657
- error() {
658
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
659
- t[r] = arguments[r];
660
- return this.forward(t, "error", "");
661
- }
662
- deprecate() {
663
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
664
- t[r] = arguments[r];
665
- return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
666
- }
667
- forward(e, t, r, i) {
668
- return i && !this.debug ? null : (S(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[t](e));
669
- }
670
- create(e) {
671
- return new Ve(this.logger, {
672
- prefix: `${this.prefix}:${e}:`,
673
- ...this.options
674
- });
675
- }
676
- clone(e) {
677
- return e = e || this.options, e.prefix = e.prefix || this.prefix, new Ve(this.logger, e);
678
- }
679
- }
680
- var K = new Ve();
681
- class Ye {
682
- constructor() {
683
- this.observers = {};
684
- }
685
- on(e, t) {
686
- return e.split(" ").forEach((r) => {
687
- this.observers[r] || (this.observers[r] = /* @__PURE__ */ new Map());
688
- const i = this.observers[r].get(t) || 0;
689
- this.observers[r].set(t, i + 1);
690
- }), this;
691
- }
692
- off(e, t) {
693
- if (this.observers[e]) {
694
- if (!t) {
695
- delete this.observers[e];
696
- return;
697
- }
698
- this.observers[e].delete(t);
699
- }
700
- }
701
- emit(e) {
702
- for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
703
- r[i - 1] = arguments[i];
704
- this.observers[e] && Array.from(this.observers[e].entries()).forEach((s) => {
705
- let [a, u] = s;
706
- for (let c = 0; c < u; c++)
707
- a(...r);
708
- }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((s) => {
709
- let [a, u] = s;
710
- for (let c = 0; c < u; c++)
711
- a.apply(a, [e, ...r]);
712
- });
713
- }
714
- }
715
- class Jt extends Ye {
716
- constructor(e) {
717
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
718
- ns: ["translation"],
719
- defaultNS: "translation"
720
- };
721
- super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
722
- }
723
- addNamespaces(e) {
724
- this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
725
- }
726
- removeNamespaces(e) {
727
- const t = this.options.ns.indexOf(e);
728
- t > -1 && this.options.ns.splice(t, 1);
729
- }
730
- getResource(e, t, r) {
731
- var c, l;
732
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
733
- const o = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, s = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
734
- let a;
735
- e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], r && (Array.isArray(r) ? a.push(...r) : S(r) && o ? a.push(...r.split(o)) : a.push(r)));
736
- const u = Me(this.data, a);
737
- return !u && !t && !r && e.indexOf(".") > -1 && (e = a[0], t = a[1], r = a.slice(2).join(".")), u || !s || !S(r) ? u : mt((l = (c = this.data) == null ? void 0 : c[e]) == null ? void 0 : l[t], r, o);
738
- }
739
- addResource(e, t, r, i) {
740
- let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
741
- silent: !1
742
- };
743
- const s = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator;
744
- let a = [e, t];
745
- r && (a = a.concat(s ? r.split(s) : r)), e.indexOf(".") > -1 && (a = e.split("."), i = t, t = a[1]), this.addNamespaces(t), Wt(this.data, a, i), o.silent || this.emit("added", e, t, r, i);
746
- }
747
- addResources(e, t, r) {
748
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
749
- silent: !1
750
- };
751
- for (const o in r)
752
- (S(r[o]) || Array.isArray(r[o])) && this.addResource(e, t, o, r[o], {
753
- silent: !0
754
- });
755
- i.silent || this.emit("added", e, t, r);
756
- }
757
- addResourceBundle(e, t, r, i, o) {
758
- let s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
759
- silent: !1,
760
- skipCopy: !1
761
- }, a = [e, t];
762
- e.indexOf(".") > -1 && (a = e.split("."), i = r, r = t, t = a[1]), this.addNamespaces(t);
763
- let u = Me(this.data, a) || {};
764
- s.skipCopy || (r = JSON.parse(JSON.stringify(r))), i ? Bn(u, r, o) : u = {
765
- ...u,
766
- ...r
767
- }, Wt(this.data, a, u), s.silent || this.emit("added", e, t, r);
768
- }
769
- removeResourceBundle(e, t) {
770
- this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
771
- }
772
- hasResourceBundle(e, t) {
773
- return this.getResource(e, t) !== void 0;
774
- }
775
- getResourceBundle(e, t) {
776
- return t || (t = this.options.defaultNS), this.getResource(e, t);
777
- }
778
- getDataByLanguage(e) {
779
- return this.data[e];
780
- }
781
- hasLanguageSomeTranslations(e) {
782
- const t = this.getDataByLanguage(e);
783
- return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
784
- }
785
- toJSON() {
786
- return this.data;
787
- }
788
- }
789
- var Kn = {
790
- processors: {},
791
- addPostProcessor(n) {
792
- this.processors[n.name] = n;
793
- },
794
- handle(n, e, t, r, i) {
795
- return n.forEach((o) => {
796
- var s;
797
- e = ((s = this.processors[o]) == null ? void 0 : s.process(e, t, r, i)) ?? e;
798
- }), e;
799
- }
800
- };
801
- const Xt = {}, Yt = (n) => !S(n) && typeof n != "boolean" && typeof n != "number";
802
- class Be extends Ye {
803
- constructor(e) {
804
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
805
- super(), oo(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = K.create("translator");
806
- }
807
- changeLanguage(e) {
808
- e && (this.language = e);
809
- }
810
- exists(e) {
811
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
812
- interpolation: {}
813
- };
814
- if (e == null)
815
- return !1;
816
- const r = this.resolve(e, t);
817
- return (r == null ? void 0 : r.res) !== void 0;
818
- }
819
- extractFromKey(e, t) {
820
- let r = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
821
- r === void 0 && (r = ":");
822
- const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
823
- let o = t.ns || this.options.defaultNS || [];
824
- const s = r && e.indexOf(r) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !go(e, r, i);
825
- if (s && !a) {
826
- const u = e.match(this.interpolator.nestingRegexp);
827
- if (u && u.length > 0)
828
- return {
829
- key: e,
830
- namespaces: S(o) ? [o] : o
831
- };
832
- const c = e.split(r);
833
- (r !== i || r === i && this.options.ns.indexOf(c[0]) > -1) && (o = c.shift()), e = c.join(i);
834
- }
835
- return {
836
- key: e,
837
- namespaces: S(o) ? [o] : o
838
- };
839
- }
840
- translate(e, t, r) {
841
- if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
842
- ...t
843
- }), t || (t = {}), e == null) return "";
844
- Array.isArray(e) || (e = [String(e)]);
845
- const i = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, o = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
846
- key: s,
847
- namespaces: a
848
- } = this.extractFromKey(e[e.length - 1], t), u = a[a.length - 1], c = t.lng || this.language, l = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
849
- if ((c == null ? void 0 : c.toLowerCase()) === "cimode") {
850
- if (l) {
851
- const T = t.nsSeparator || this.options.nsSeparator;
852
- return i ? {
853
- res: `${u}${T}${s}`,
854
- usedKey: s,
855
- exactUsedKey: s,
856
- usedLng: c,
857
- usedNS: u,
858
- usedParams: this.getUsedParamsDetails(t)
859
- } : `${u}${T}${s}`;
860
- }
861
- return i ? {
862
- res: s,
863
- usedKey: s,
864
- exactUsedKey: s,
865
- usedLng: c,
866
- usedNS: u,
867
- usedParams: this.getUsedParamsDetails(t)
868
- } : s;
869
- }
870
- const f = this.resolve(e, t);
871
- let d = f == null ? void 0 : f.res;
872
- const g = (f == null ? void 0 : f.usedKey) || s, m = (f == null ? void 0 : f.exactUsedKey) || s, v = ["[object Number]", "[object Function]", "[object RegExp]"], b = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, P = !this.i18nFormat || this.i18nFormat.handleAsObject, E = t.count !== void 0 && !S(t.count), L = Be.hasDefaultValue(t), $ = E ? this.pluralResolver.getSuffix(c, t.count, t) : "", J = t.ordinal && E ? this.pluralResolver.getSuffix(c, t.count, {
873
- ordinal: !1
874
- }) : "", X = E && !t.ordinal && t.count === 0, k = X && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${$}`] || t[`defaultValue${J}`] || t.defaultValue;
875
- let O = d;
876
- P && !d && L && (O = k);
877
- const I = Yt(O), R = Object.prototype.toString.apply(O);
878
- if (P && O && I && v.indexOf(R) < 0 && !(S(b) && Array.isArray(O))) {
879
- if (!t.returnObjects && !this.options.returnObjects) {
880
- this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
881
- const T = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, O, {
882
- ...t,
883
- ns: a
884
- }) : `key '${s} (${this.language})' returned an object instead of string.`;
885
- return i ? (f.res = T, f.usedParams = this.getUsedParamsDetails(t), f) : T;
886
- }
887
- if (o) {
888
- const T = Array.isArray(O), U = T ? [] : {}, kt = T ? m : g;
889
- for (const _ in O)
890
- if (Object.prototype.hasOwnProperty.call(O, _)) {
891
- const z = `${kt}${o}${_}`;
892
- L && !d ? U[_] = this.translate(z, {
893
- ...t,
894
- defaultValue: Yt(k) ? k[_] : void 0,
895
- joinArrays: !1,
896
- ns: a
897
- }) : U[_] = this.translate(z, {
898
- ...t,
899
- joinArrays: !1,
900
- ns: a
901
- }), U[_] === z && (U[_] = O[_]);
902
- }
903
- d = U;
904
- }
905
- } else if (P && S(b) && Array.isArray(d))
906
- d = d.join(b), d && (d = this.extendTranslation(d, e, t, r));
907
- else {
908
- let T = !1, U = !1;
909
- !this.isValidLookup(d) && L && (T = !0, d = k), this.isValidLookup(d) || (U = !0, d = s);
910
- const _ = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && U ? void 0 : d, z = L && k !== d && this.options.updateMissing;
911
- if (U || T || z) {
912
- if (this.logger.log(z ? "updateKey" : "missingKey", c, u, s, z ? k : d), o) {
913
- const N = this.resolve(s, {
914
- ...t,
915
- keySeparator: !1
916
- });
917
- N && N.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.");
918
- }
919
- let he = [];
920
- const Ae = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
921
- if (this.options.saveMissingTo === "fallback" && Ae && Ae[0])
922
- for (let N = 0; N < Ae.length; N++)
923
- he.push(Ae[N]);
924
- else this.options.saveMissingTo === "all" ? he = this.languageUtils.toResolveHierarchy(t.lng || this.language) : he.push(t.lng || this.language);
925
- const It = (N, Q, ge) => {
926
- var At;
927
- const Rt = L && ge !== d ? ge : _;
928
- this.options.missingKeyHandler ? this.options.missingKeyHandler(N, u, Q, Rt, z, t) : (At = this.backendConnector) != null && At.saveMissing && this.backendConnector.saveMissing(N, u, Q, Rt, z, t), this.emit("missingKey", N, u, Q, d);
929
- };
930
- this.options.saveMissing && (this.options.saveMissingPlurals && E ? he.forEach((N) => {
931
- const Q = this.pluralResolver.getSuffixes(N, t);
932
- X && t[`defaultValue${this.options.pluralSeparator}zero`] && Q.indexOf(`${this.options.pluralSeparator}zero`) < 0 && Q.push(`${this.options.pluralSeparator}zero`), Q.forEach((ge) => {
933
- It([N], s + ge, t[`defaultValue${ge}`] || k);
934
- });
935
- }) : It(he, s, k));
936
- }
937
- d = this.extendTranslation(d, e, t, f, r), U && d === s && this.options.appendNamespaceToMissingKey && (d = `${u}:${s}`), (U || T) && this.options.parseMissingKeyHandler && (d = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}:${s}` : s, T ? d : void 0));
938
- }
939
- return i ? (f.res = d, f.usedParams = this.getUsedParamsDetails(t), f) : d;
940
- }
941
- extendTranslation(e, t, r, i, o) {
942
- var c, l;
943
- var s = this;
944
- if ((c = this.i18nFormat) != null && c.parse)
945
- e = this.i18nFormat.parse(e, {
946
- ...this.options.interpolation.defaultVariables,
947
- ...r
948
- }, r.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
949
- resolved: i
950
- });
951
- else if (!r.skipInterpolation) {
952
- r.interpolation && this.interpolator.init({
953
- ...r,
954
- interpolation: {
955
- ...this.options.interpolation,
956
- ...r.interpolation
957
- }
958
- });
959
- const f = S(e) && (((l = r == null ? void 0 : r.interpolation) == null ? void 0 : l.skipOnVariables) !== void 0 ? r.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
960
- let d;
961
- if (f) {
962
- const m = e.match(this.interpolator.nestingRegexp);
963
- d = m && m.length;
964
- }
965
- let g = r.replace && !S(r.replace) ? r.replace : r;
966
- if (this.options.interpolation.defaultVariables && (g = {
967
- ...this.options.interpolation.defaultVariables,
968
- ...g
969
- }), e = this.interpolator.interpolate(e, g, r.lng || this.language || i.usedLng, r), f) {
970
- const m = e.match(this.interpolator.nestingRegexp), v = m && m.length;
971
- d < v && (r.nest = !1);
972
- }
973
- !r.lng && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, function() {
974
- for (var m = arguments.length, v = new Array(m), b = 0; b < m; b++)
975
- v[b] = arguments[b];
976
- return (o == null ? void 0 : o[0]) === v[0] && !r.context ? (s.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${t[0]}`), null) : s.translate(...v, t);
977
- }, r)), r.interpolation && this.interpolator.reset();
978
- }
979
- const a = r.postProcess || this.options.postProcess, u = S(a) ? [a] : a;
980
- return e != null && (u != null && u.length) && r.applyPostProcessor !== !1 && (e = Kn.handle(u, e, t, this.options && this.options.postProcessPassResolved ? {
981
- i18nResolved: {
982
- ...i,
983
- usedParams: this.getUsedParamsDetails(r)
984
- },
985
- ...r
986
- } : r, this)), e;
987
- }
988
- resolve(e) {
989
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r, i, o, s, a;
990
- return S(e) && (e = [e]), e.forEach((u) => {
991
- if (this.isValidLookup(r)) return;
992
- const c = this.extractFromKey(u, t), l = c.key;
993
- i = l;
994
- let f = c.namespaces;
995
- this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
996
- const d = t.count !== void 0 && !S(t.count), g = d && !t.ordinal && t.count === 0, m = t.context !== void 0 && (S(t.context) || typeof t.context == "number") && t.context !== "", v = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
997
- f.forEach((b) => {
998
- var P, E;
999
- this.isValidLookup(r) || (a = b, !Xt[`${v[0]}-${b}`] && ((P = this.utils) != null && P.hasLoadedNamespace) && !((E = this.utils) != null && E.hasLoadedNamespace(a)) && (Xt[`${v[0]}-${b}`] = !0, this.logger.warn(`key "${i}" for languages "${v.join(", ")}" won't get resolved as namespace "${a}" 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!!!")), v.forEach((L) => {
1000
- var X;
1001
- if (this.isValidLookup(r)) return;
1002
- s = L;
1003
- const $ = [l];
1004
- if ((X = this.i18nFormat) != null && X.addLookupKeys)
1005
- this.i18nFormat.addLookupKeys($, l, L, b, t);
1006
- else {
1007
- let k;
1008
- d && (k = this.pluralResolver.getSuffix(L, t.count, t));
1009
- const O = `${this.options.pluralSeparator}zero`, I = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
1010
- if (d && ($.push(l + k), t.ordinal && k.indexOf(I) === 0 && $.push(l + k.replace(I, this.options.pluralSeparator)), g && $.push(l + O)), m) {
1011
- const R = `${l}${this.options.contextSeparator}${t.context}`;
1012
- $.push(R), d && ($.push(R + k), t.ordinal && k.indexOf(I) === 0 && $.push(R + k.replace(I, this.options.pluralSeparator)), g && $.push(R + O));
1013
- }
1014
- }
1015
- let J;
1016
- for (; J = $.pop(); )
1017
- this.isValidLookup(r) || (o = J, r = this.getResource(L, b, J, t));
1018
- }));
1019
- });
1020
- }), {
1021
- res: r,
1022
- usedKey: i,
1023
- exactUsedKey: o,
1024
- usedLng: s,
1025
- usedNS: a
1026
- };
1027
- }
1028
- isValidLookup(e) {
1029
- return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
1030
- }
1031
- getResource(e, t, r) {
1032
- var o;
1033
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1034
- return (o = this.i18nFormat) != null && o.getResource ? this.i18nFormat.getResource(e, t, r, i) : this.resourceStore.getResource(e, t, r, i);
1035
- }
1036
- getUsedParamsDetails() {
1037
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1038
- const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], r = e.replace && !S(e.replace);
1039
- let i = r ? e.replace : e;
1040
- if (r && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
1041
- ...this.options.interpolation.defaultVariables,
1042
- ...i
1043
- }), !r) {
1044
- i = {
1045
- ...i
1046
- };
1047
- for (const o of t)
1048
- delete i[o];
1049
- }
1050
- return i;
1051
- }
1052
- static hasDefaultValue(e) {
1053
- const t = "defaultValue";
1054
- for (const r in e)
1055
- if (Object.prototype.hasOwnProperty.call(e, r) && t === r.substring(0, t.length) && e[r] !== void 0)
1056
- return !0;
1057
- return !1;
1058
- }
1059
- }
1060
- class Gt {
1061
- constructor(e) {
1062
- this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = K.create("languageUtils");
1063
- }
1064
- getScriptPartFromCode(e) {
1065
- if (e = He(e), !e || e.indexOf("-") < 0) return null;
1066
- const t = e.split("-");
1067
- return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
1068
- }
1069
- getLanguagePartFromCode(e) {
1070
- if (e = He(e), !e || e.indexOf("-") < 0) return e;
1071
- const t = e.split("-");
1072
- return this.formatLanguageCode(t[0]);
1073
- }
1074
- formatLanguageCode(e) {
1075
- if (S(e) && e.indexOf("-") > -1) {
1076
- let t;
1077
- try {
1078
- t = Intl.getCanonicalLocales(e)[0];
1079
- } catch {
1080
- }
1081
- return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
1082
- }
1083
- return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
1084
- }
1085
- isSupportedCode(e) {
1086
- return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
1087
- }
1088
- getBestMatchFromCodes(e) {
1089
- if (!e) return null;
1090
- let t;
1091
- return e.forEach((r) => {
1092
- if (t) return;
1093
- const i = this.formatLanguageCode(r);
1094
- (!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
1095
- }), !t && this.options.supportedLngs && e.forEach((r) => {
1096
- if (t) return;
1097
- const i = this.getLanguagePartFromCode(r);
1098
- if (this.isSupportedCode(i)) return t = i;
1099
- t = this.options.supportedLngs.find((o) => {
1100
- if (o === i) return o;
1101
- if (!(o.indexOf("-") < 0 && i.indexOf("-") < 0) && (o.indexOf("-") > 0 && i.indexOf("-") < 0 && o.substring(0, o.indexOf("-")) === i || o.indexOf(i) === 0 && i.length > 1))
1102
- return o;
1103
- });
1104
- }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
1105
- }
1106
- getFallbackCodes(e, t) {
1107
- if (!e) return [];
1108
- if (typeof e == "function" && (e = e(t)), S(e) && (e = [e]), Array.isArray(e)) return e;
1109
- if (!t) return e.default || [];
1110
- let r = e[t];
1111
- return r || (r = e[this.getScriptPartFromCode(t)]), r || (r = e[this.formatLanguageCode(t)]), r || (r = e[this.getLanguagePartFromCode(t)]), r || (r = e.default), r || [];
1112
- }
1113
- toResolveHierarchy(e, t) {
1114
- const r = this.getFallbackCodes(t || this.options.fallbackLng || [], e), i = [], o = (s) => {
1115
- s && (this.isSupportedCode(s) ? i.push(s) : this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`));
1116
- };
1117
- return S(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && o(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && o(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && o(this.getLanguagePartFromCode(e))) : S(e) && o(this.formatLanguageCode(e)), r.forEach((s) => {
1118
- i.indexOf(s) < 0 && o(this.formatLanguageCode(s));
1119
- }), i;
1120
- }
1121
- }
1122
- const Qt = {
1123
- zero: 0,
1124
- one: 1,
1125
- two: 2,
1126
- few: 3,
1127
- many: 4,
1128
- other: 5
1129
- }, Zt = {
1130
- select: (n) => n === 1 ? "one" : "other",
1131
- resolvedOptions: () => ({
1132
- pluralCategories: ["one", "other"]
1133
- })
1134
- };
1135
- class yo {
1136
- constructor(e) {
1137
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1138
- this.languageUtils = e, this.options = t, this.logger = K.create("pluralResolver"), this.pluralRulesCache = {};
1139
- }
1140
- addRule(e, t) {
1141
- this.rules[e] = t;
1142
- }
1143
- clearCache() {
1144
- this.pluralRulesCache = {};
1145
- }
1146
- getRule(e) {
1147
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1148
- const r = He(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", o = JSON.stringify({
1149
- cleanedCode: r,
1150
- type: i
1151
- });
1152
- if (o in this.pluralRulesCache)
1153
- return this.pluralRulesCache[o];
1154
- let s;
1155
- try {
1156
- s = new Intl.PluralRules(r, {
1157
- type: i
1158
- });
1159
- } catch {
1160
- if (!Intl)
1161
- return this.logger.error("No Intl support, please use an Intl polyfill!"), Zt;
1162
- if (!e.match(/-|_/)) return Zt;
1163
- const u = this.languageUtils.getLanguagePartFromCode(e);
1164
- s = this.getRule(u, t);
1165
- }
1166
- return this.pluralRulesCache[o] = s, s;
1167
- }
1168
- needsPlural(e) {
1169
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = this.getRule(e, t);
1170
- return r || (r = this.getRule("dev", t)), (r == null ? void 0 : r.resolvedOptions().pluralCategories.length) > 1;
1171
- }
1172
- getPluralFormsOfKey(e, t) {
1173
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1174
- return this.getSuffixes(e, r).map((i) => `${t}${i}`);
1175
- }
1176
- getSuffixes(e) {
1177
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = this.getRule(e, t);
1178
- return r || (r = this.getRule("dev", t)), r ? r.resolvedOptions().pluralCategories.sort((i, o) => Qt[i] - Qt[o]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
1179
- }
1180
- getSuffix(e, t) {
1181
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1182
- const i = this.getRule(e, r);
1183
- return i ? `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, r));
1184
- }
1185
- }
1186
- const en = function(n, e, t) {
1187
- let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, o = uo(n, e, t);
1188
- return !o && i && S(t) && (o = mt(n, t, r), o === void 0 && (o = mt(e, t, r))), o;
1189
- }, st = (n) => n.replace(/\$/g, "$$$$");
1190
- class vo {
1191
- constructor() {
1192
- var t;
1193
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1194
- this.logger = K.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((r) => r), this.init(e);
1195
- }
1196
- init() {
1197
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1198
- e.interpolation || (e.interpolation = {
1199
- escapeValue: !0
1200
- });
1201
- const {
1202
- escape: t,
1203
- escapeValue: r,
1204
- useRawValueToEscape: i,
1205
- prefix: o,
1206
- prefixEscaped: s,
1207
- suffix: a,
1208
- suffixEscaped: u,
1209
- formatSeparator: c,
1210
- unescapeSuffix: l,
1211
- unescapePrefix: f,
1212
- nestingPrefix: d,
1213
- nestingPrefixEscaped: g,
1214
- nestingSuffix: m,
1215
- nestingSuffixEscaped: v,
1216
- nestingOptionsSeparator: b,
1217
- maxReplaces: P,
1218
- alwaysFormat: E
1219
- } = e.interpolation;
1220
- this.escape = t !== void 0 ? t : co, this.escapeValue = r !== void 0 ? r : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = o ? re(o) : s || "{{", this.suffix = a ? re(a) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? re(d) : g || re("$t("), this.nestingSuffix = m ? re(m) : v || re(")"), this.nestingOptionsSeparator = b || ",", this.maxReplaces = P || 1e3, this.alwaysFormat = E !== void 0 ? E : !1, this.resetRegExp();
1221
- }
1222
- reset() {
1223
- this.options && this.init(this.options);
1224
- }
1225
- resetRegExp() {
1226
- const e = (t, r) => (t == null ? void 0 : t.source) === r ? (t.lastIndex = 0, t) : new RegExp(r, "g");
1227
- this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
1228
- }
1229
- interpolate(e, t, r, i) {
1230
- var g;
1231
- let o, s, a;
1232
- const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (m) => {
1233
- if (m.indexOf(this.formatSeparator) < 0) {
1234
- const E = en(t, u, m, this.options.keySeparator, this.options.ignoreJSONStructure);
1235
- return this.alwaysFormat ? this.format(E, void 0, r, {
1236
- ...i,
1237
- ...t,
1238
- interpolationkey: m
1239
- }) : E;
1240
- }
1241
- const v = m.split(this.formatSeparator), b = v.shift().trim(), P = v.join(this.formatSeparator).trim();
1242
- return this.format(en(t, u, b, this.options.keySeparator, this.options.ignoreJSONStructure), P, r, {
1243
- ...i,
1244
- ...t,
1245
- interpolationkey: b
1246
- });
1247
- };
1248
- this.resetRegExp();
1249
- const l = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((g = i == null ? void 0 : i.interpolation) == null ? void 0 : g.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1250
- return [{
1251
- regex: this.regexpUnescape,
1252
- safeValue: (m) => st(m)
1253
- }, {
1254
- regex: this.regexp,
1255
- safeValue: (m) => this.escapeValue ? st(this.escape(m)) : st(m)
1256
- }].forEach((m) => {
1257
- for (a = 0; o = m.regex.exec(e); ) {
1258
- const v = o[1].trim();
1259
- if (s = c(v), s === void 0)
1260
- if (typeof l == "function") {
1261
- const P = l(e, o, i);
1262
- s = S(P) ? P : "";
1263
- } else if (i && Object.prototype.hasOwnProperty.call(i, v))
1264
- s = "";
1265
- else if (f) {
1266
- s = o[0];
1267
- continue;
1268
- } else
1269
- this.logger.warn(`missed to pass in variable ${v} for interpolating ${e}`), s = "";
1270
- else !S(s) && !this.useRawValueToEscape && (s = Kt(s));
1271
- const b = m.safeValue(s);
1272
- if (e = e.replace(o[0], b), f ? (m.regex.lastIndex += s.length, m.regex.lastIndex -= o[0].length) : m.regex.lastIndex = 0, a++, a >= this.maxReplaces)
1273
- break;
1274
- }
1275
- }), e;
1276
- }
1277
- nest(e, t) {
1278
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, o, s;
1279
- const a = (u, c) => {
1280
- const l = this.nestingOptionsSeparator;
1281
- if (u.indexOf(l) < 0) return u;
1282
- const f = u.split(new RegExp(`${l}[ ]*{`));
1283
- let d = `{${f[1]}`;
1284
- u = f[0], d = this.interpolate(d, s);
1285
- const g = d.match(/'/g), m = d.match(/"/g);
1286
- (((g == null ? void 0 : g.length) ?? 0) % 2 === 0 && !m || m.length % 2 !== 0) && (d = d.replace(/'/g, '"'));
1287
- try {
1288
- s = JSON.parse(d), c && (s = {
1289
- ...c,
1290
- ...s
1291
- });
1292
- } catch (v) {
1293
- return this.logger.warn(`failed parsing options string in nesting for key ${u}`, v), `${u}${l}${d}`;
1294
- }
1295
- return s.defaultValue && s.defaultValue.indexOf(this.prefix) > -1 && delete s.defaultValue, u;
1296
- };
1297
- for (; i = this.nestingRegexp.exec(e); ) {
1298
- let u = [];
1299
- s = {
1300
- ...r
1301
- }, s = s.replace && !S(s.replace) ? s.replace : s, s.applyPostProcessor = !1, delete s.defaultValue;
1302
- let c = !1;
1303
- if (i[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(i[1])) {
1304
- const l = i[1].split(this.formatSeparator).map((f) => f.trim());
1305
- i[1] = l.shift(), u = l, c = !0;
1306
- }
1307
- if (o = t(a.call(this, i[1].trim(), s), s), o && i[0] === e && !S(o)) return o;
1308
- S(o) || (o = Kt(o)), o || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), o = ""), c && (o = u.reduce((l, f) => this.format(l, f, r.lng, {
1309
- ...r,
1310
- interpolationkey: i[1].trim()
1311
- }), o.trim())), e = e.replace(i[0], o), this.regexp.lastIndex = 0;
1312
- }
1313
- return e;
1314
- }
1315
- }
1316
- const wo = (n) => {
1317
- let e = n.toLowerCase().trim();
1318
- const t = {};
1319
- if (n.indexOf("(") > -1) {
1320
- const r = n.split("(");
1321
- e = r[0].toLowerCase().trim();
1322
- const i = r[1].substring(0, r[1].length - 1);
1323
- e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((s) => {
1324
- if (s) {
1325
- const [a, ...u] = s.split(":"), c = u.join(":").trim().replace(/^'+|'+$/g, ""), l = a.trim();
1326
- t[l] || (t[l] = c), c === "false" && (t[l] = !1), c === "true" && (t[l] = !0), isNaN(c) || (t[l] = parseInt(c, 10));
1327
- }
1328
- });
1329
- }
1330
- return {
1331
- formatName: e,
1332
- formatOptions: t
1333
- };
1334
- }, ie = (n) => {
1335
- const e = {};
1336
- return (t, r, i) => {
1337
- let o = i;
1338
- i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (o = {
1339
- ...o,
1340
- [i.interpolationkey]: void 0
1341
- });
1342
- const s = r + JSON.stringify(o);
1343
- let a = e[s];
1344
- return a || (a = n(He(r), i), e[s] = a), a(t);
1345
- };
1346
- };
1347
- class bo {
1348
- constructor() {
1349
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1350
- this.logger = K.create("formatter"), this.options = e, this.formats = {
1351
- number: ie((t, r) => {
1352
- const i = new Intl.NumberFormat(t, {
1353
- ...r
1354
- });
1355
- return (o) => i.format(o);
1356
- }),
1357
- currency: ie((t, r) => {
1358
- const i = new Intl.NumberFormat(t, {
1359
- ...r,
1360
- style: "currency"
1361
- });
1362
- return (o) => i.format(o);
1363
- }),
1364
- datetime: ie((t, r) => {
1365
- const i = new Intl.DateTimeFormat(t, {
1366
- ...r
1367
- });
1368
- return (o) => i.format(o);
1369
- }),
1370
- relativetime: ie((t, r) => {
1371
- const i = new Intl.RelativeTimeFormat(t, {
1372
- ...r
1373
- });
1374
- return (o) => i.format(o, r.range || "day");
1375
- }),
1376
- list: ie((t, r) => {
1377
- const i = new Intl.ListFormat(t, {
1378
- ...r
1379
- });
1380
- return (o) => i.format(o);
1381
- })
1382
- }, this.init(e);
1383
- }
1384
- init(e) {
1385
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1386
- interpolation: {}
1387
- };
1388
- this.formatSeparator = t.interpolation.formatSeparator || ",";
1389
- }
1390
- add(e, t) {
1391
- this.formats[e.toLowerCase().trim()] = t;
1392
- }
1393
- addCached(e, t) {
1394
- this.formats[e.toLowerCase().trim()] = ie(t);
1395
- }
1396
- format(e, t, r) {
1397
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1398
- const o = t.split(this.formatSeparator);
1399
- if (o.length > 1 && o[0].indexOf("(") > 1 && o[0].indexOf(")") < 0 && o.find((a) => a.indexOf(")") > -1)) {
1400
- const a = o.findIndex((u) => u.indexOf(")") > -1);
1401
- o[0] = [o[0], ...o.splice(1, a)].join(this.formatSeparator);
1402
- }
1403
- return o.reduce((a, u) => {
1404
- var f;
1405
- const {
1406
- formatName: c,
1407
- formatOptions: l
1408
- } = wo(u);
1409
- if (this.formats[c]) {
1410
- let d = a;
1411
- try {
1412
- const g = ((f = i == null ? void 0 : i.formatParams) == null ? void 0 : f[i.interpolationkey]) || {}, m = g.locale || g.lng || i.locale || i.lng || r;
1413
- d = this.formats[c](a, m, {
1414
- ...l,
1415
- ...i,
1416
- ...g
1417
- });
1418
- } catch (g) {
1419
- this.logger.warn(g);
1420
- }
1421
- return d;
1422
- } else
1423
- this.logger.warn(`there was no format function for ${c}`);
1424
- return a;
1425
- }, e);
1426
- }
1427
- }
1428
- const So = (n, e) => {
1429
- n.pending[e] !== void 0 && (delete n.pending[e], n.pendingCount--);
1430
- };
1431
- class xo extends Ye {
1432
- constructor(e, t, r) {
1433
- var o, s;
1434
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1435
- super(), this.backend = e, this.store = t, this.services = r, this.languageUtils = r.languageUtils, this.options = i, this.logger = K.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], (s = (o = this.backend) == null ? void 0 : o.init) == null || s.call(o, r, i.backend, i);
1436
- }
1437
- queueLoad(e, t, r, i) {
1438
- const o = {}, s = {}, a = {}, u = {};
1439
- return e.forEach((c) => {
1440
- let l = !0;
1441
- t.forEach((f) => {
1442
- const d = `${c}|${f}`;
1443
- !r.reload && this.store.hasResourceBundle(c, f) ? this.state[d] = 2 : this.state[d] < 0 || (this.state[d] === 1 ? s[d] === void 0 && (s[d] = !0) : (this.state[d] = 1, l = !1, s[d] === void 0 && (s[d] = !0), o[d] === void 0 && (o[d] = !0), u[f] === void 0 && (u[f] = !0)));
1444
- }), l || (a[c] = !0);
1445
- }), (Object.keys(o).length || Object.keys(s).length) && this.queue.push({
1446
- pending: s,
1447
- pendingCount: Object.keys(s).length,
1448
- loaded: {},
1449
- errors: [],
1450
- callback: i
1451
- }), {
1452
- toLoad: Object.keys(o),
1453
- pending: Object.keys(s),
1454
- toLoadLanguages: Object.keys(a),
1455
- toLoadNamespaces: Object.keys(u)
1456
- };
1457
- }
1458
- loaded(e, t, r) {
1459
- const i = e.split("|"), o = i[0], s = i[1];
1460
- t && this.emit("failedLoading", o, s, t), !t && r && this.store.addResourceBundle(o, s, r, void 0, void 0, {
1461
- skipCopy: !0
1462
- }), this.state[e] = t ? -1 : 2, t && r && (this.state[e] = 0);
1463
- const a = {};
1464
- this.queue.forEach((u) => {
1465
- ao(u.loaded, [o], s), So(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((c) => {
1466
- a[c] || (a[c] = {});
1467
- const l = u.loaded[c];
1468
- l.length && l.forEach((f) => {
1469
- a[c][f] === void 0 && (a[c][f] = !0);
1470
- });
1471
- }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
1472
- }), this.emit("loaded", a), this.queue = this.queue.filter((u) => !u.done);
1473
- }
1474
- read(e, t, r) {
1475
- let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, s = arguments.length > 5 ? arguments[5] : void 0;
1476
- if (!e.length) return s(null, {});
1477
- if (this.readingCalls >= this.maxParallelReads) {
1478
- this.waitingReads.push({
1479
- lng: e,
1480
- ns: t,
1481
- fcName: r,
1482
- tried: i,
1483
- wait: o,
1484
- callback: s
1485
- });
1486
- return;
1487
- }
1488
- this.readingCalls++;
1489
- const a = (c, l) => {
1490
- if (this.readingCalls--, this.waitingReads.length > 0) {
1491
- const f = this.waitingReads.shift();
1492
- this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
1493
- }
1494
- if (c && l && i < this.maxRetries) {
1495
- setTimeout(() => {
1496
- this.read.call(this, e, t, r, i + 1, o * 2, s);
1497
- }, o);
1498
- return;
1499
- }
1500
- s(c, l);
1501
- }, u = this.backend[r].bind(this.backend);
1502
- if (u.length === 2) {
1503
- try {
1504
- const c = u(e, t);
1505
- c && typeof c.then == "function" ? c.then((l) => a(null, l)).catch(a) : a(null, c);
1506
- } catch (c) {
1507
- a(c);
1508
- }
1509
- return;
1510
- }
1511
- return u(e, t, a);
1512
- }
1513
- prepareLoading(e, t) {
1514
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 ? arguments[3] : void 0;
1515
- if (!this.backend)
1516
- return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
1517
- S(e) && (e = this.languageUtils.toResolveHierarchy(e)), S(t) && (t = [t]);
1518
- const o = this.queueLoad(e, t, r, i);
1519
- if (!o.toLoad.length)
1520
- return o.pending.length || i(), null;
1521
- o.toLoad.forEach((s) => {
1522
- this.loadOne(s);
1523
- });
1524
- }
1525
- load(e, t, r) {
1526
- this.prepareLoading(e, t, {}, r);
1527
- }
1528
- reload(e, t, r) {
1529
- this.prepareLoading(e, t, {
1530
- reload: !0
1531
- }, r);
1532
- }
1533
- loadOne(e) {
1534
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1535
- const r = e.split("|"), i = r[0], o = r[1];
1536
- this.read(i, o, "read", void 0, void 0, (s, a) => {
1537
- s && this.logger.warn(`${t}loading namespace ${o} for language ${i} failed`, s), !s && a && this.logger.log(`${t}loaded namespace ${o} for language ${i}`, a), this.loaded(e, s, a);
1538
- });
1539
- }
1540
- saveMissing(e, t, r, i, o) {
1541
- var u, c, l, f, d;
1542
- let s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1543
- };
1544
- if ((c = (u = this.services) == null ? void 0 : u.utils) != null && c.hasLoadedNamespace && !((f = (l = this.services) == null ? void 0 : l.utils) != null && f.hasLoadedNamespace(t))) {
1545
- this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1546
- return;
1547
- }
1548
- if (!(r == null || r === "")) {
1549
- if ((d = this.backend) != null && d.create) {
1550
- const g = {
1551
- ...s,
1552
- isUpdate: o
1553
- }, m = this.backend.create.bind(this.backend);
1554
- if (m.length < 6)
1555
- try {
1556
- let v;
1557
- m.length === 5 ? v = m(e, t, r, i, g) : v = m(e, t, r, i), v && typeof v.then == "function" ? v.then((b) => a(null, b)).catch(a) : a(null, v);
1558
- } catch (v) {
1559
- a(v);
1560
- }
1561
- else
1562
- m(e, t, r, i, a, g);
1563
- }
1564
- !e || !e[0] || this.store.addResource(e[0], t, r, i);
1565
- }
1566
- }
1567
- }
1568
- const tn = () => ({
1569
- debug: !1,
1570
- initAsync: !0,
1571
- ns: ["translation"],
1572
- defaultNS: ["translation"],
1573
- fallbackLng: ["dev"],
1574
- fallbackNS: !1,
1575
- supportedLngs: !1,
1576
- nonExplicitSupportedLngs: !1,
1577
- load: "all",
1578
- preload: !1,
1579
- simplifyPluralSuffix: !0,
1580
- keySeparator: ".",
1581
- nsSeparator: ":",
1582
- pluralSeparator: "_",
1583
- contextSeparator: "_",
1584
- partialBundledLanguages: !1,
1585
- saveMissing: !1,
1586
- updateMissing: !1,
1587
- saveMissingTo: "fallback",
1588
- saveMissingPlurals: !0,
1589
- missingKeyHandler: !1,
1590
- missingInterpolationHandler: !1,
1591
- postProcess: !1,
1592
- postProcessPassResolved: !1,
1593
- returnNull: !1,
1594
- returnEmptyString: !0,
1595
- returnObjects: !1,
1596
- joinArrays: !1,
1597
- returnedObjectHandler: !1,
1598
- parseMissingKeyHandler: !1,
1599
- appendNamespaceToMissingKey: !1,
1600
- appendNamespaceToCIMode: !1,
1601
- overloadTranslationOptionHandler: (n) => {
1602
- let e = {};
1603
- if (typeof n[1] == "object" && (e = n[1]), S(n[1]) && (e.defaultValue = n[1]), S(n[2]) && (e.tDescription = n[2]), typeof n[2] == "object" || typeof n[3] == "object") {
1604
- const t = n[3] || n[2];
1605
- Object.keys(t).forEach((r) => {
1606
- e[r] = t[r];
1607
- });
1608
- }
1609
- return e;
1610
- },
1611
- interpolation: {
1612
- escapeValue: !0,
1613
- format: (n) => n,
1614
- prefix: "{{",
1615
- suffix: "}}",
1616
- formatSeparator: ",",
1617
- unescapePrefix: "-",
1618
- nestingPrefix: "$t(",
1619
- nestingSuffix: ")",
1620
- nestingOptionsSeparator: ",",
1621
- maxReplaces: 1e3,
1622
- skipOnVariables: !0
1623
- }
1624
- }), nn = (n) => {
1625
- var e, t;
1626
- return S(n.ns) && (n.ns = [n.ns]), S(n.fallbackLng) && (n.fallbackLng = [n.fallbackLng]), S(n.fallbackNS) && (n.fallbackNS = [n.fallbackNS]), ((t = (e = n.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (n.supportedLngs = n.supportedLngs.concat(["cimode"])), typeof n.initImmediate == "boolean" && (n.initAsync = n.initImmediate), n;
1627
- }, Ne = () => {
1628
- }, Oo = (n) => {
1629
- Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((t) => {
1630
- typeof n[t] == "function" && (n[t] = n[t].bind(n));
1631
- });
1632
- };
1633
- class Ee extends Ye {
1634
- constructor() {
1635
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1636
- if (super(), this.options = nn(e), this.services = {}, this.logger = K, this.modules = {
1637
- external: []
1638
- }, Oo(this), t && !this.isInitialized && !e.isClone) {
1639
- if (!this.options.initAsync)
1640
- return this.init(e, t), this;
1641
- setTimeout(() => {
1642
- this.init(e, t);
1643
- }, 0);
1644
- }
1645
- }
1646
- init() {
1647
- var e = this;
1648
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0;
1649
- this.isInitializing = !0, typeof t == "function" && (r = t, t = {}), t.defaultNS == null && t.ns && (S(t.ns) ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
1650
- const i = tn();
1651
- this.options = {
1652
- ...i,
1653
- ...this.options,
1654
- ...nn(t)
1655
- }, this.options.interpolation = {
1656
- ...i.interpolation,
1657
- ...this.options.interpolation
1658
- }, t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1659
- const o = (l) => l ? typeof l == "function" ? new l() : l : null;
1660
- if (!this.options.isClone) {
1661
- this.modules.logger ? K.init(o(this.modules.logger), this.options) : K.init(null, this.options);
1662
- let l;
1663
- this.modules.formatter ? l = this.modules.formatter : l = bo;
1664
- const f = new Gt(this.options);
1665
- this.store = new Jt(this.options.resources, this.options);
1666
- const d = this.services;
1667
- d.logger = K, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new yo(f, {
1668
- prepend: this.options.pluralSeparator,
1669
- simplifyPluralSuffix: this.options.simplifyPluralSuffix
1670
- }), l && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (d.formatter = o(l), d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new vo(this.options), d.utils = {
1671
- hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1672
- }, d.backendConnector = new xo(o(this.modules.backend), d.resourceStore, d, this.options), d.backendConnector.on("*", function(g) {
1673
- for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), b = 1; b < m; b++)
1674
- v[b - 1] = arguments[b];
1675
- e.emit(g, ...v);
1676
- }), this.modules.languageDetector && (d.languageDetector = o(this.modules.languageDetector), d.languageDetector.init && d.languageDetector.init(d, this.options.detection, this.options)), this.modules.i18nFormat && (d.i18nFormat = o(this.modules.i18nFormat), d.i18nFormat.init && d.i18nFormat.init(this)), this.translator = new Be(this.services, this.options), this.translator.on("*", function(g) {
1677
- for (var m = arguments.length, v = new Array(m > 1 ? m - 1 : 0), b = 1; b < m; b++)
1678
- v[b - 1] = arguments[b];
1679
- e.emit(g, ...v);
1680
- }), this.modules.external.forEach((g) => {
1681
- g.init && g.init(this);
1682
- });
1683
- }
1684
- if (this.format = this.options.interpolation.format, r || (r = Ne), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1685
- const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1686
- l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
1687
- }
1688
- !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((l) => {
1689
- this[l] = function() {
1690
- return e.store[l](...arguments);
1691
- };
1692
- }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((l) => {
1693
- this[l] = function() {
1694
- return e.store[l](...arguments), e;
1695
- };
1696
- });
1697
- const u = ve(), c = () => {
1698
- const l = (f, d) => {
1699
- this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), u.resolve(d), r(f, d);
1700
- };
1701
- if (this.languages && !this.isInitialized) return l(null, this.t.bind(this));
1702
- this.changeLanguage(this.options.lng, l);
1703
- };
1704
- return this.options.resources || !this.options.initAsync ? c() : setTimeout(c, 0), u;
1705
- }
1706
- loadResources(e) {
1707
- var o, s;
1708
- let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Ne;
1709
- const i = S(e) ? e : this.language;
1710
- if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) {
1711
- if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r();
1712
- const a = [], u = (c) => {
1713
- if (!c || c === "cimode") return;
1714
- this.services.languageUtils.toResolveHierarchy(c).forEach((f) => {
1715
- f !== "cimode" && a.indexOf(f) < 0 && a.push(f);
1716
- });
1717
- };
1718
- i ? u(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => u(l)), (s = (o = this.options.preload) == null ? void 0 : o.forEach) == null || s.call(o, (c) => u(c)), this.services.backendConnector.load(a, this.options.ns, (c) => {
1719
- !c && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), r(c);
1720
- });
1721
- } else
1722
- r(null);
1723
- }
1724
- reloadResources(e, t, r) {
1725
- const i = ve();
1726
- return typeof e == "function" && (r = e, e = void 0), typeof t == "function" && (r = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), r || (r = Ne), this.services.backendConnector.reload(e, t, (o) => {
1727
- i.resolve(), r(o);
1728
- }), i;
1729
- }
1730
- use(e) {
1731
- if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1732
- if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1733
- return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && Kn.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1734
- }
1735
- setResolvedLanguage(e) {
1736
- if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1737
- for (let t = 0; t < this.languages.length; t++) {
1738
- const r = this.languages[t];
1739
- if (!(["cimode", "dev"].indexOf(r) > -1) && this.store.hasLanguageSomeTranslations(r)) {
1740
- this.resolvedLanguage = r;
1741
- break;
1742
- }
1743
- }
1744
- }
1745
- changeLanguage(e, t) {
1746
- var r = this;
1747
- this.isLanguageChangingTo = e;
1748
- const i = ve();
1749
- this.emit("languageChanging", e);
1750
- const o = (u) => {
1751
- this.language = u, this.languages = this.services.languageUtils.toResolveHierarchy(u), this.resolvedLanguage = void 0, this.setResolvedLanguage(u);
1752
- }, s = (u, c) => {
1753
- c ? (o(c), this.translator.changeLanguage(c), this.isLanguageChangingTo = void 0, this.emit("languageChanged", c), this.logger.log("languageChanged", c)) : this.isLanguageChangingTo = void 0, i.resolve(function() {
1754
- return r.t(...arguments);
1755
- }), t && t(u, function() {
1756
- return r.t(...arguments);
1757
- });
1758
- }, a = (u) => {
1759
- var l, f;
1760
- !e && !u && this.services.languageDetector && (u = []);
1761
- const c = S(u) ? u : this.services.languageUtils.getBestMatchFromCodes(u);
1762
- c && (this.language || o(c), this.translator.language || this.translator.changeLanguage(c), (f = (l = this.services.languageDetector) == null ? void 0 : l.cacheUserLanguage) == null || f.call(l, c)), this.loadResources(c, (d) => {
1763
- s(d, c);
1764
- });
1765
- };
1766
- return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), i;
1767
- }
1768
- getFixedT(e, t, r) {
1769
- var i = this;
1770
- const o = function(s, a) {
1771
- let u;
1772
- if (typeof a != "object") {
1773
- for (var c = arguments.length, l = new Array(c > 2 ? c - 2 : 0), f = 2; f < c; f++)
1774
- l[f - 2] = arguments[f];
1775
- u = i.options.overloadTranslationOptionHandler([s, a].concat(l));
1776
- } else
1777
- u = {
1778
- ...a
1779
- };
1780
- u.lng = u.lng || o.lng, u.lngs = u.lngs || o.lngs, u.ns = u.ns || o.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || r || o.keyPrefix);
1781
- const d = i.options.keySeparator || ".";
1782
- let g;
1783
- return u.keyPrefix && Array.isArray(s) ? g = s.map((m) => `${u.keyPrefix}${d}${m}`) : g = u.keyPrefix ? `${u.keyPrefix}${d}${s}` : s, i.t(g, u);
1784
- };
1785
- return S(e) ? o.lng = e : o.lngs = e, o.ns = t, o.keyPrefix = r, o;
1786
- }
1787
- t() {
1788
- var i;
1789
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
1790
- t[r] = arguments[r];
1791
- return (i = this.translator) == null ? void 0 : i.translate(...t);
1792
- }
1793
- exists() {
1794
- var i;
1795
- for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
1796
- t[r] = arguments[r];
1797
- return (i = this.translator) == null ? void 0 : i.exists(...t);
1798
- }
1799
- setDefaultNamespace(e) {
1800
- this.options.defaultNS = e;
1801
- }
1802
- hasLoadedNamespace(e) {
1803
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1804
- if (!this.isInitialized)
1805
- return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1806
- if (!this.languages || !this.languages.length)
1807
- return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1808
- const r = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, o = this.languages[this.languages.length - 1];
1809
- if (r.toLowerCase() === "cimode") return !0;
1810
- const s = (a, u) => {
1811
- const c = this.services.backendConnector.state[`${a}|${u}`];
1812
- return c === -1 || c === 0 || c === 2;
1813
- };
1814
- if (t.precheck) {
1815
- const a = t.precheck(this, s);
1816
- if (a !== void 0) return a;
1817
- }
1818
- return !!(this.hasResourceBundle(r, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || s(r, e) && (!i || s(o, e)));
1819
- }
1820
- loadNamespaces(e, t) {
1821
- const r = ve();
1822
- return this.options.ns ? (S(e) && (e = [e]), e.forEach((i) => {
1823
- this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
1824
- }), this.loadResources((i) => {
1825
- r.resolve(), t && t(i);
1826
- }), r) : (t && t(), Promise.resolve());
1827
- }
1828
- loadLanguages(e, t) {
1829
- const r = ve();
1830
- S(e) && (e = [e]);
1831
- const i = this.options.preload || [], o = e.filter((s) => i.indexOf(s) < 0 && this.services.languageUtils.isSupportedCode(s));
1832
- return o.length ? (this.options.preload = i.concat(o), this.loadResources((s) => {
1833
- r.resolve(), t && t(s);
1834
- }), r) : (t && t(), Promise.resolve());
1835
- }
1836
- dir(e) {
1837
- var i, o;
1838
- if (e || (e = this.resolvedLanguage || (((i = this.languages) == null ? void 0 : i.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1839
- const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], r = ((o = this.services) == null ? void 0 : o.languageUtils) || new Gt(tn());
1840
- return t.indexOf(r.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1841
- }
1842
- static createInstance() {
1843
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1844
- return new Ee(e, t);
1845
- }
1846
- cloneInstance() {
1847
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Ne;
1848
- const r = e.forkResourceStore;
1849
- r && delete e.forkResourceStore;
1850
- const i = {
1851
- ...this.options,
1852
- ...e,
1853
- isClone: !0
1854
- }, o = new Ee(i);
1855
- if ((e.debug !== void 0 || e.prefix !== void 0) && (o.logger = o.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
1856
- o[a] = this[a];
1857
- }), o.services = {
1858
- ...this.services
1859
- }, o.services.utils = {
1860
- hasLoadedNamespace: o.hasLoadedNamespace.bind(o)
1861
- }, r) {
1862
- const a = Object.keys(this.store.data).reduce((u, c) => (u[c] = {
1863
- ...this.store.data[c]
1864
- }, Object.keys(u[c]).reduce((l, f) => (l[f] = {
1865
- ...u[c][f]
1866
- }, l), {})), {});
1867
- o.store = new Jt(a, i), o.services.resourceStore = o.store;
1868
- }
1869
- return o.translator = new Be(o.services, i), o.translator.on("*", function(a) {
1870
- for (var u = arguments.length, c = new Array(u > 1 ? u - 1 : 0), l = 1; l < u; l++)
1871
- c[l - 1] = arguments[l];
1872
- o.emit(a, ...c);
1873
- }), o.init(i, t), o.translator.options = i, o.translator.backendConnector.services.utils = {
1874
- hasLoadedNamespace: o.hasLoadedNamespace.bind(o)
1875
- }, o;
1876
- }
1877
- toJSON() {
1878
- return {
1879
- options: this.options,
1880
- store: this.store,
1881
- language: this.language,
1882
- languages: this.languages,
1883
- resolvedLanguage: this.resolvedLanguage
1884
- };
1885
- }
1886
- }
1887
- const oe = Ee.createInstance();
1888
- oe.createInstance = Ee.createInstance;
1889
- const {
1890
- slice: Eo,
1891
- forEach: To
1892
- } = [];
1893
- function Co(n) {
1894
- return To.call(Eo.call(arguments, 1), (e) => {
1895
- if (e)
1896
- for (const t in e)
1897
- n[t] === void 0 && (n[t] = e[t]);
1898
- }), n;
1899
- }
1900
- const rn = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/, Lo = function(n, e) {
1901
- const r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
1902
- path: "/"
1903
- }, i = encodeURIComponent(e);
1904
- let o = `${n}=${i}`;
1905
- if (r.maxAge > 0) {
1906
- const s = r.maxAge - 0;
1907
- if (Number.isNaN(s)) throw new Error("maxAge should be a Number");
1908
- o += `; Max-Age=${Math.floor(s)}`;
1909
- }
1910
- if (r.domain) {
1911
- if (!rn.test(r.domain))
1912
- throw new TypeError("option domain is invalid");
1913
- o += `; Domain=${r.domain}`;
1914
- }
1915
- if (r.path) {
1916
- if (!rn.test(r.path))
1917
- throw new TypeError("option path is invalid");
1918
- o += `; Path=${r.path}`;
1919
- }
1920
- if (r.expires) {
1921
- if (typeof r.expires.toUTCString != "function")
1922
- throw new TypeError("option expires is invalid");
1923
- o += `; Expires=${r.expires.toUTCString()}`;
1924
- }
1925
- if (r.httpOnly && (o += "; HttpOnly"), r.secure && (o += "; Secure"), r.sameSite)
1926
- switch (typeof r.sameSite == "string" ? r.sameSite.toLowerCase() : r.sameSite) {
1927
- case !0:
1928
- o += "; SameSite=Strict";
1929
- break;
1930
- case "lax":
1931
- o += "; SameSite=Lax";
1932
- break;
1933
- case "strict":
1934
- o += "; SameSite=Strict";
1935
- break;
1936
- case "none":
1937
- o += "; SameSite=None";
1938
- break;
1939
- default:
1940
- throw new TypeError("option sameSite is invalid");
1941
- }
1942
- return o;
1943
- }, on = {
1944
- create(n, e, t, r) {
1945
- let i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
1946
- path: "/",
1947
- sameSite: "strict"
1948
- };
1949
- t && (i.expires = /* @__PURE__ */ new Date(), i.expires.setTime(i.expires.getTime() + t * 60 * 1e3)), r && (i.domain = r), document.cookie = Lo(n, encodeURIComponent(e), i);
1950
- },
1951
- read(n) {
1952
- const e = `${n}=`, t = document.cookie.split(";");
1953
- for (let r = 0; r < t.length; r++) {
1954
- let i = t[r];
1955
- for (; i.charAt(0) === " "; ) i = i.substring(1, i.length);
1956
- if (i.indexOf(e) === 0) return i.substring(e.length, i.length);
1957
- }
1958
- return null;
1959
- },
1960
- remove(n) {
1961
- this.create(n, "", -1);
1962
- }
1963
- };
1964
- var Po = {
1965
- name: "cookie",
1966
- // Deconstruct the options object and extract the lookupCookie property
1967
- lookup(n) {
1968
- let {
1969
- lookupCookie: e
1970
- } = n;
1971
- if (e && typeof document < "u")
1972
- return on.read(e) || void 0;
1973
- },
1974
- // Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
1975
- cacheUserLanguage(n, e) {
1976
- let {
1977
- lookupCookie: t,
1978
- cookieMinutes: r,
1979
- cookieDomain: i,
1980
- cookieOptions: o
1981
- } = e;
1982
- t && typeof document < "u" && on.create(t, n, r, i, o);
1983
- }
1984
- }, ko = {
1985
- name: "querystring",
1986
- // Deconstruct the options object and extract the lookupQuerystring property
1987
- lookup(n) {
1988
- var r;
1989
- let {
1990
- lookupQuerystring: e
1991
- } = n, t;
1992
- if (typeof window < "u") {
1993
- let {
1994
- search: i
1995
- } = window.location;
1996
- !window.location.search && ((r = window.location.hash) == null ? void 0 : r.indexOf("?")) > -1 && (i = window.location.hash.substring(window.location.hash.indexOf("?")));
1997
- const s = i.substring(1).split("&");
1998
- for (let a = 0; a < s.length; a++) {
1999
- const u = s[a].indexOf("=");
2000
- u > 0 && s[a].substring(0, u) === e && (t = s[a].substring(u + 1));
2001
- }
2002
- }
2003
- return t;
2004
- }
2005
- };
2006
- let we = null;
2007
- const sn = () => {
2008
- if (we !== null) return we;
2009
- try {
2010
- we = window !== "undefined" && window.localStorage !== null;
2011
- const n = "i18next.translate.boo";
2012
- window.localStorage.setItem(n, "foo"), window.localStorage.removeItem(n);
2013
- } catch {
2014
- we = !1;
2015
- }
2016
- return we;
2017
- };
2018
- var Io = {
2019
- name: "localStorage",
2020
- // Deconstruct the options object and extract the lookupLocalStorage property
2021
- lookup(n) {
2022
- let {
2023
- lookupLocalStorage: e
2024
- } = n;
2025
- if (e && sn())
2026
- return window.localStorage.getItem(e) || void 0;
2027
- },
2028
- // Deconstruct the options object and extract the lookupLocalStorage property
2029
- cacheUserLanguage(n, e) {
2030
- let {
2031
- lookupLocalStorage: t
2032
- } = e;
2033
- t && sn() && window.localStorage.setItem(t, n);
2034
- }
2035
- };
2036
- let be = null;
2037
- const an = () => {
2038
- if (be !== null) return be;
2039
- try {
2040
- be = window !== "undefined" && window.sessionStorage !== null;
2041
- const n = "i18next.translate.boo";
2042
- window.sessionStorage.setItem(n, "foo"), window.sessionStorage.removeItem(n);
2043
- } catch {
2044
- be = !1;
2045
- }
2046
- return be;
2047
- };
2048
- var Ro = {
2049
- name: "sessionStorage",
2050
- lookup(n) {
2051
- let {
2052
- lookupSessionStorage: e
2053
- } = n;
2054
- if (e && an())
2055
- return window.sessionStorage.getItem(e) || void 0;
2056
- },
2057
- cacheUserLanguage(n, e) {
2058
- let {
2059
- lookupSessionStorage: t
2060
- } = e;
2061
- t && an() && window.sessionStorage.setItem(t, n);
2062
- }
2063
- }, Ao = {
2064
- name: "navigator",
2065
- lookup(n) {
2066
- const e = [];
2067
- if (typeof navigator < "u") {
2068
- const {
2069
- languages: t,
2070
- userLanguage: r,
2071
- language: i
2072
- } = navigator;
2073
- if (t)
2074
- for (let o = 0; o < t.length; o++)
2075
- e.push(t[o]);
2076
- r && e.push(r), i && e.push(i);
2077
- }
2078
- return e.length > 0 ? e : void 0;
2079
- }
2080
- }, $o = {
2081
- name: "htmlTag",
2082
- // Deconstruct the options object and extract the htmlTag property
2083
- lookup(n) {
2084
- let {
2085
- htmlTag: e
2086
- } = n, t;
2087
- const r = e || (typeof document < "u" ? document.documentElement : null);
2088
- return r && typeof r.getAttribute == "function" && (t = r.getAttribute("lang")), t;
2089
- }
2090
- }, No = {
2091
- name: "path",
2092
- // Deconstruct the options object and extract the lookupFromPathIndex property
2093
- lookup(n) {
2094
- var i;
2095
- let {
2096
- lookupFromPathIndex: e
2097
- } = n;
2098
- if (typeof window > "u") return;
2099
- const t = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
2100
- return Array.isArray(t) ? (i = t[typeof e == "number" ? e : 0]) == null ? void 0 : i.replace("/", "") : void 0;
2101
- }
2102
- }, jo = {
2103
- name: "subdomain",
2104
- lookup(n) {
2105
- var i, o;
2106
- let {
2107
- lookupFromSubdomainIndex: e
2108
- } = n;
2109
- const t = typeof e == "number" ? e + 1 : 1, r = typeof window < "u" && ((o = (i = window.location) == null ? void 0 : i.hostname) == null ? void 0 : o.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));
2110
- if (r)
2111
- return r[t];
2112
- }
2113
- };
2114
- let qn = !1;
2115
- try {
2116
- qn = !0;
2117
- } catch {
2118
- }
2119
- const zn = ["querystring", "cookie", "localStorage", "sessionStorage", "navigator", "htmlTag"];
2120
- qn || zn.splice(1, 1);
2121
- const Do = () => ({
2122
- order: zn,
2123
- lookupQuerystring: "lng",
2124
- lookupCookie: "i18next",
2125
- lookupLocalStorage: "i18nextLng",
2126
- lookupSessionStorage: "i18nextLng",
2127
- // cache user language
2128
- caches: ["localStorage"],
2129
- excludeCacheFor: ["cimode"],
2130
- // cookieMinutes: 10,
2131
- // cookieDomain: 'myDomain'
2132
- convertDetectedLanguage: (n) => n
2133
- });
2134
- class Wn {
2135
- constructor(e) {
2136
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2137
- this.type = "languageDetector", this.detectors = {}, this.init(e, t);
2138
- }
2139
- init() {
2140
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2141
- languageUtils: {}
2142
- }, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2143
- this.services = e, this.options = Co(t, this.options || {}, Do()), typeof this.options.convertDetectedLanguage == "string" && this.options.convertDetectedLanguage.indexOf("15897") > -1 && (this.options.convertDetectedLanguage = (i) => i.replace("-", "_")), this.options.lookupFromUrlIndex && (this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex), this.i18nOptions = r, this.addDetector(Po), this.addDetector(ko), this.addDetector(Io), this.addDetector(Ro), this.addDetector(Ao), this.addDetector($o), this.addDetector(No), this.addDetector(jo);
2144
- }
2145
- addDetector(e) {
2146
- return this.detectors[e.name] = e, this;
2147
- }
2148
- detect() {
2149
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.order, t = [];
2150
- return e.forEach((r) => {
2151
- if (this.detectors[r]) {
2152
- let i = this.detectors[r].lookup(this.options);
2153
- i && typeof i == "string" && (i = [i]), i && (t = t.concat(i));
2154
- }
2155
- }), t = t.map((r) => this.options.convertDetectedLanguage(r)), this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes ? t : t.length > 0 ? t[0] : null;
2156
- }
2157
- cacheUserLanguage(e) {
2158
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.options.caches;
2159
- t && (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(e) > -1 || t.forEach((r) => {
2160
- this.detectors[r] && this.detectors[r].cacheUserLanguage(e, this.options);
2161
- }));
2162
- }
2163
- }
2164
- Wn.type = "languageDetector";
2165
- function Uo(n, e) {
2166
- if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function");
2167
- }
2168
- function Te(n) {
2169
- "@babel/helpers - typeof";
2170
- return Te = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2171
- return typeof e;
2172
- } : function(e) {
2173
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2174
- }, Te(n);
2175
- }
2176
- function Fo(n, e) {
2177
- if (Te(n) != "object" || !n) return n;
2178
- var t = n[Symbol.toPrimitive];
2179
- if (t !== void 0) {
2180
- var r = t.call(n, e);
2181
- if (Te(r) != "object") return r;
2182
- throw new TypeError("@@toPrimitive must return a primitive value.");
2183
- }
2184
- return String(n);
2185
- }
2186
- function _o(n) {
2187
- var e = Fo(n, "string");
2188
- return Te(e) == "symbol" ? e : e + "";
2189
- }
2190
- function Mo(n, e) {
2191
- for (var t = 0; t < e.length; t++) {
2192
- var r = e[t];
2193
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(n, _o(r.key), r);
2194
- }
2195
- }
2196
- function Ho(n, e, t) {
2197
- return e && Mo(n.prototype, e), Object.defineProperty(n, "prototype", {
2198
- writable: !1
2199
- }), n;
2200
- }
2201
- var Jn = [], Vo = Jn.forEach, Bo = Jn.slice;
2202
- function Ko(n) {
2203
- return Vo.call(Bo.call(arguments, 1), function(e) {
2204
- if (e)
2205
- for (var t in e)
2206
- n[t] === void 0 && (n[t] = e[t]);
2207
- }), n;
2208
- }
2209
- function qo(n) {
2210
- return n ? typeof n == "function" ? new n() : n : null;
2211
- }
2212
- function zo() {
2213
- return {
2214
- handleEmptyResourcesAsFailed: !0,
2215
- cacheHitMode: "none"
2216
- // reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000
2217
- // refreshExpirationTime: 60 * 60 * 1000
2218
- };
2219
- }
2220
- function un(n, e, t, r) {
2221
- var i = n.read.bind(n);
2222
- if (i.length === 2) {
2223
- try {
2224
- var o = i(e, t);
2225
- o && typeof o.then == "function" ? o.then(function(s) {
2226
- return r(null, s);
2227
- }).catch(r) : r(null, o);
2228
- } catch (s) {
2229
- r(s);
2230
- }
2231
- return;
2232
- }
2233
- i(e, t, r);
2234
- }
2235
- var Xn = /* @__PURE__ */ function() {
2236
- function n(e) {
2237
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2238
- Uo(this, n), this.backends = [], this.type = "backend", this.allOptions = r, this.init(e, t);
2239
- }
2240
- return Ho(n, [{
2241
- key: "init",
2242
- value: function(t) {
2243
- var r = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2244
- this.services = t, this.options = Ko(i, this.options || {}, zo()), this.allOptions = o, this.options.backends && this.options.backends.forEach(function(s, a) {
2245
- r.backends[a] = r.backends[a] || qo(s), r.backends[a].init(t, r.options.backendOptions && r.options.backendOptions[a] || {}, o);
2246
- }), this.services && this.options.reloadInterval && setInterval(function() {
2247
- return r.reload();
2248
- }, this.options.reloadInterval);
2249
- }
2250
- }, {
2251
- key: "read",
2252
- value: function(t, r, i) {
2253
- var o = this, s = this.backends.length, a = function c(l) {
2254
- if (l >= s) return i(new Error("non of the backend loaded data", !0));
2255
- var f = l === s - 1, d = o.options.handleEmptyResourcesAsFailed && !f ? 0 : -1, g = o.backends[l];
2256
- g.read ? un(g, t, r, function(m, v, b) {
2257
- if (!m && v && Object.keys(v).length > d) {
2258
- if (i(null, v, l), u(l - 1, v), g.save && o.options.cacheHitMode && ["refresh", "refreshAndUpdateStore"].indexOf(o.options.cacheHitMode) > -1) {
2259
- if (b && o.options.refreshExpirationTime && b + o.options.refreshExpirationTime > Date.now()) return;
2260
- var P = o.backends[l + 1];
2261
- P && P.read && un(P, t, r, function(E, L) {
2262
- E || L && (Object.keys(L).length <= d || (u(l, L), o.options.cacheHitMode === "refreshAndUpdateStore" && o.services && o.services.resourceStore && o.services.resourceStore.addResourceBundle(t, r, L)));
2263
- });
2264
- }
2265
- } else
2266
- c(l + 1);
2267
- }) : c(l + 1);
2268
- }, u = function c(l, f) {
2269
- if (!(l < 0)) {
2270
- var d = o.backends[l];
2271
- d.save && d.save(t, r, f), c(l - 1, f);
2272
- }
2273
- };
2274
- a(0);
2275
- }
2276
- }, {
2277
- key: "create",
2278
- value: function(t, r, i, o) {
2279
- var s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : function() {
2280
- }, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
2281
- this.backends.forEach(function(u) {
2282
- if (u.create) {
2283
- var c = u.create.bind(u);
2284
- if (c.length < 6) {
2285
- try {
2286
- var l;
2287
- c.length === 5 ? l = c(t, r, i, o, a) : l = c(t, r, i, o), l && typeof l.then == "function" ? l.then(function(f) {
2288
- return s(null, f);
2289
- }).catch(s) : s(null, l);
2290
- } catch (f) {
2291
- s(f);
2292
- }
2293
- return;
2294
- }
2295
- c(t, r, i, o, s, a);
2296
- }
2297
- });
2298
- }
2299
- }, {
2300
- key: "reload",
2301
- value: function() {
2302
- var t = this, r = this.services, i = r.backendConnector, o = r.languageUtils, s = r.logger, a = i.language;
2303
- if (!(a && a.toLowerCase() === "cimode")) {
2304
- var u = [], c = function(f) {
2305
- var d = o.toResolveHierarchy(f);
2306
- d.forEach(function(g) {
2307
- u.indexOf(g) < 0 && u.push(g);
2308
- });
2309
- };
2310
- c(a), this.allOptions.preload && this.allOptions.preload.forEach(function(l) {
2311
- return c(l);
2312
- }), u.forEach(function(l) {
2313
- t.allOptions.ns.forEach(function(f) {
2314
- i.read(l, f, "read", null, null, function(d, g) {
2315
- d && s.warn("loading namespace ".concat(f, " for language ").concat(l, " failed"), d), !d && g && s.log("loaded namespace ".concat(f, " for language ").concat(l), g), i.loaded("".concat(l, "|").concat(f), d, g);
2316
- });
2317
- });
2318
- });
2319
- }
2320
- }
2321
- }]), n;
2322
- }();
2323
- Xn.type = "backend";
2324
- function yt(n) {
2325
- "@babel/helpers - typeof";
2326
- return yt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2327
- return typeof e;
2328
- } : function(e) {
2329
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2330
- }, yt(n);
2331
- }
2332
- function Yn() {
2333
- return typeof XMLHttpRequest == "function" || (typeof XMLHttpRequest > "u" ? "undefined" : yt(XMLHttpRequest)) === "object";
2334
- }
2335
- function Wo(n) {
2336
- return !!n && typeof n.then == "function";
2337
- }
2338
- function Jo(n) {
2339
- return Wo(n) ? n : Promise.resolve(n);
2340
- }
2341
- function ln(n, e) {
2342
- var t = Object.keys(n);
2343
- if (Object.getOwnPropertySymbols) {
2344
- var r = Object.getOwnPropertySymbols(n);
2345
- e && (r = r.filter(function(i) {
2346
- return Object.getOwnPropertyDescriptor(n, i).enumerable;
2347
- })), t.push.apply(t, r);
2348
- }
2349
- return t;
2350
- }
2351
- function cn(n) {
2352
- for (var e = 1; e < arguments.length; e++) {
2353
- var t = arguments[e] != null ? arguments[e] : {};
2354
- e % 2 ? ln(Object(t), !0).forEach(function(r) {
2355
- Xo(n, r, t[r]);
2356
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : ln(Object(t)).forEach(function(r) {
2357
- Object.defineProperty(n, r, Object.getOwnPropertyDescriptor(t, r));
2358
- });
2359
- }
2360
- return n;
2361
- }
2362
- function Xo(n, e, t) {
2363
- return (e = Yo(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
2364
- }
2365
- function Yo(n) {
2366
- var e = Go(n, "string");
2367
- return te(e) == "symbol" ? e : e + "";
2368
- }
2369
- function Go(n, e) {
2370
- if (te(n) != "object" || !n) return n;
2371
- var t = n[Symbol.toPrimitive];
2372
- if (t !== void 0) {
2373
- var r = t.call(n, e);
2374
- if (te(r) != "object") return r;
2375
- throw new TypeError("@@toPrimitive must return a primitive value.");
2376
- }
2377
- return (e === "string" ? String : Number)(n);
2378
- }
2379
- function te(n) {
2380
- "@babel/helpers - typeof";
2381
- return te = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2382
- return typeof e;
2383
- } : function(e) {
2384
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2385
- }, te(n);
2386
- }
2387
- var Y = typeof fetch == "function" ? fetch : void 0;
2388
- typeof global < "u" && global.fetch ? Y = global.fetch : typeof window < "u" && window.fetch && (Y = window.fetch);
2389
- var Ce;
2390
- Yn() && (typeof global < "u" && global.XMLHttpRequest ? Ce = global.XMLHttpRequest : typeof window < "u" && window.XMLHttpRequest && (Ce = window.XMLHttpRequest));
2391
- var Ke;
2392
- typeof ActiveXObject == "function" && (typeof global < "u" && global.ActiveXObject ? Ke = global.ActiveXObject : typeof window < "u" && window.ActiveXObject && (Ke = window.ActiveXObject));
2393
- typeof Y != "function" && (Y = void 0);
2394
- if (!Y && !Ce && !Ke)
2395
- try {
2396
- import("./browser-ponyfill-CvzSbL_o.js").then((n) => n.b).then(function(n) {
2397
- Y = n.default;
2398
- }).catch(function() {
2399
- });
2400
- } catch {
2401
- }
2402
- var vt = function(e, t) {
2403
- if (t && te(t) === "object") {
2404
- var r = "";
2405
- for (var i in t)
2406
- r += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(t[i]);
2407
- if (!r) return e;
2408
- e = e + (e.indexOf("?") !== -1 ? "&" : "?") + r.slice(1);
2409
- }
2410
- return e;
2411
- }, fn = function(e, t, r, i) {
2412
- var o = function(u) {
2413
- if (!u.ok) return r(u.statusText || "Error", {
2414
- status: u.status
2415
- });
2416
- u.text().then(function(c) {
2417
- r(null, {
2418
- status: u.status,
2419
- data: c
2420
- });
2421
- }).catch(r);
2422
- };
2423
- if (i) {
2424
- var s = i(e, t);
2425
- if (s instanceof Promise) {
2426
- s.then(o).catch(r);
2427
- return;
2428
- }
2429
- }
2430
- typeof fetch == "function" ? fetch(e, t).then(o).catch(r) : Y(e, t).then(o).catch(r);
2431
- }, dn = !1, Qo = function(e, t, r, i) {
2432
- e.queryStringParams && (t = vt(t, e.queryStringParams));
2433
- var o = cn({}, typeof e.customHeaders == "function" ? e.customHeaders() : e.customHeaders);
2434
- typeof window > "u" && typeof global < "u" && typeof global.process < "u" && global.process.versions && global.process.versions.node && (o["User-Agent"] = "i18next-http-backend (node/".concat(global.process.version, "; ").concat(global.process.platform, " ").concat(global.process.arch, ")")), r && (o["Content-Type"] = "application/json");
2435
- var s = typeof e.requestOptions == "function" ? e.requestOptions(r) : e.requestOptions, a = cn({
2436
- method: r ? "POST" : "GET",
2437
- body: r ? e.stringify(r) : void 0,
2438
- headers: o
2439
- }, dn ? {} : s), u = typeof e.alternateFetch == "function" && e.alternateFetch.length >= 1 ? e.alternateFetch : void 0;
2440
- try {
2441
- fn(t, a, i, u);
2442
- } catch (c) {
2443
- if (!s || Object.keys(s).length === 0 || !c.message || c.message.indexOf("not implemented") < 0)
2444
- return i(c);
2445
- try {
2446
- Object.keys(s).forEach(function(l) {
2447
- delete a[l];
2448
- }), fn(t, a, i, u), dn = !0;
2449
- } catch (l) {
2450
- i(l);
2451
- }
2452
- }
2453
- }, Zo = function(e, t, r, i) {
2454
- r && te(r) === "object" && (r = vt("", r).slice(1)), e.queryStringParams && (t = vt(t, e.queryStringParams));
2455
- try {
2456
- var o = Ce ? new Ce() : new Ke("MSXML2.XMLHTTP.3.0");
2457
- o.open(r ? "POST" : "GET", t, 1), e.crossDomain || o.setRequestHeader("X-Requested-With", "XMLHttpRequest"), o.withCredentials = !!e.withCredentials, r && o.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), o.overrideMimeType && o.overrideMimeType("application/json");
2458
- var s = e.customHeaders;
2459
- if (s = typeof s == "function" ? s() : s, s)
2460
- for (var a in s)
2461
- o.setRequestHeader(a, s[a]);
2462
- o.onreadystatechange = function() {
2463
- o.readyState > 3 && i(o.status >= 400 ? o.statusText : null, {
2464
- status: o.status,
2465
- data: o.responseText
2466
- });
2467
- }, o.send(r);
2468
- } catch (u) {
2469
- }
2470
- }, es = function(e, t, r, i) {
2471
- if (typeof r == "function" && (i = r, r = void 0), i = i || function() {
2472
- }, Y && t.indexOf("file:") !== 0)
2473
- return Qo(e, t, r, i);
2474
- if (Yn() || typeof ActiveXObject == "function")
2475
- return Zo(e, t, r, i);
2476
- i(new Error("No fetch and no xhr implementation found!"));
2477
- };
2478
- function fe(n) {
2479
- "@babel/helpers - typeof";
2480
- return fe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
2481
- return typeof e;
2482
- } : function(e) {
2483
- return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2484
- }, fe(n);
2485
- }
2486
- function pn(n, e) {
2487
- var t = Object.keys(n);
2488
- if (Object.getOwnPropertySymbols) {
2489
- var r = Object.getOwnPropertySymbols(n);
2490
- e && (r = r.filter(function(i) {
2491
- return Object.getOwnPropertyDescriptor(n, i).enumerable;
2492
- })), t.push.apply(t, r);
2493
- }
2494
- return t;
2495
- }
2496
- function at(n) {
2497
- for (var e = 1; e < arguments.length; e++) {
2498
- var t = arguments[e] != null ? arguments[e] : {};
2499
- e % 2 ? pn(Object(t), !0).forEach(function(r) {
2500
- Gn(n, r, t[r]);
2501
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : pn(Object(t)).forEach(function(r) {
2502
- Object.defineProperty(n, r, Object.getOwnPropertyDescriptor(t, r));
2503
- });
2504
- }
2505
- return n;
2506
- }
2507
- function ts(n, e) {
2508
- if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function");
2509
- }
2510
- function ns(n, e) {
2511
- for (var t = 0; t < e.length; t++) {
2512
- var r = e[t];
2513
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(n, Qn(r.key), r);
2514
- }
2515
- }
2516
- function rs(n, e, t) {
2517
- return e && ns(n.prototype, e), Object.defineProperty(n, "prototype", { writable: !1 }), n;
2518
- }
2519
- function Gn(n, e, t) {
2520
- return (e = Qn(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
2521
- }
2522
- function Qn(n) {
2523
- var e = is(n, "string");
2524
- return fe(e) == "symbol" ? e : e + "";
2525
- }
2526
- function is(n, e) {
2527
- if (fe(n) != "object" || !n) return n;
2528
- var t = n[Symbol.toPrimitive];
2529
- if (t !== void 0) {
2530
- var r = t.call(n, e);
2531
- if (fe(r) != "object") return r;
2532
- throw new TypeError("@@toPrimitive must return a primitive value.");
2533
- }
2534
- return String(n);
2535
- }
2536
- var os = function() {
2537
- return {
2538
- loadPath: "/locales/{{lng}}/{{ns}}.json",
2539
- addPath: "/locales/add/{{lng}}/{{ns}}",
2540
- parse: function(t) {
2541
- return JSON.parse(t);
2542
- },
2543
- stringify: JSON.stringify,
2544
- parsePayload: function(t, r, i) {
2545
- return Gn({}, r, i || "");
2546
- },
2547
- parseLoadPayload: function(t, r) {
2548
- },
2549
- request: es,
2550
- reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
2551
- customHeaders: {},
2552
- queryStringParams: {},
2553
- crossDomain: !1,
2554
- withCredentials: !1,
2555
- overrideMimeType: !1,
2556
- requestOptions: {
2557
- mode: "cors",
2558
- credentials: "same-origin",
2559
- cache: "default"
2560
- }
2561
- };
2562
- }, Zn = function() {
2563
- function n(e) {
2564
- var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2565
- ts(this, n), this.services = e, this.options = t, this.allOptions = r, this.type = "backend", this.init(e, t, r);
2566
- }
2567
- return rs(n, [{
2568
- key: "init",
2569
- value: function(t) {
2570
- var r = this, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2571
- if (this.services = t, this.options = at(at(at({}, os()), this.options || {}), i), this.allOptions = o, this.services && this.options.reloadInterval) {
2572
- var s = setInterval(function() {
2573
- return r.reload();
2574
- }, this.options.reloadInterval);
2575
- fe(s) === "object" && typeof s.unref == "function" && s.unref();
2576
- }
2577
- }
2578
- }, {
2579
- key: "readMulti",
2580
- value: function(t, r, i) {
2581
- this._readAny(t, t, r, r, i);
2582
- }
2583
- }, {
2584
- key: "read",
2585
- value: function(t, r, i) {
2586
- this._readAny([t], t, [r], r, i);
2587
- }
2588
- }, {
2589
- key: "_readAny",
2590
- value: function(t, r, i, o, s) {
2591
- var a = this, u = this.options.loadPath;
2592
- typeof this.options.loadPath == "function" && (u = this.options.loadPath(t, i)), u = Jo(u), u.then(function(c) {
2593
- if (!c) return s(null, {});
2594
- var l = a.services.interpolator.interpolate(c, {
2595
- lng: t.join("+"),
2596
- ns: i.join("+")
2597
- });
2598
- a.loadUrl(l, s, r, o);
2599
- });
2600
- }
2601
- }, {
2602
- key: "loadUrl",
2603
- value: function(t, r, i, o) {
2604
- var s = this, a = typeof i == "string" ? [i] : i, u = typeof o == "string" ? [o] : o, c = this.options.parseLoadPayload(a, u);
2605
- this.options.request(this.options, t, c, function(l, f) {
2606
- if (f && (f.status >= 500 && f.status < 600 || !f.status)) return r("failed loading " + t + "; status code: " + f.status, !0);
2607
- if (f && f.status >= 400 && f.status < 500) return r("failed loading " + t + "; status code: " + f.status, !1);
2608
- if (!f && l && l.message) {
2609
- var d = l.message.toLowerCase(), g = ["failed", "fetch", "network", "load"].find(function(b) {
2610
- return d.indexOf(b) > -1;
2611
- });
2612
- if (g)
2613
- return r("failed loading " + t + ": " + l.message, !0);
2614
- }
2615
- if (l) return r(l, !1);
2616
- var m, v;
2617
- try {
2618
- typeof f.data == "string" ? m = s.options.parse(f.data, i, o) : m = f.data;
2619
- } catch {
2620
- v = "failed parsing " + t + " to json";
2621
- }
2622
- if (v) return r(v, !1);
2623
- r(null, m);
2624
- });
2625
- }
2626
- }, {
2627
- key: "create",
2628
- value: function(t, r, i, o, s) {
2629
- var a = this;
2630
- if (this.options.addPath) {
2631
- typeof t == "string" && (t = [t]);
2632
- var u = this.options.parsePayload(r, i, o), c = 0, l = [], f = [];
2633
- t.forEach(function(d) {
2634
- var g = a.options.addPath;
2635
- typeof a.options.addPath == "function" && (g = a.options.addPath(d, r));
2636
- var m = a.services.interpolator.interpolate(g, {
2637
- lng: d,
2638
- ns: r
2639
- });
2640
- a.options.request(a.options, m, u, function(v, b) {
2641
- c += 1, l.push(v), f.push(b), c === t.length && typeof s == "function" && s(l, f);
2642
- });
2643
- });
2644
- }
2645
- }
2646
- }, {
2647
- key: "reload",
2648
- value: function() {
2649
- var t = this, r = this.services, i = r.backendConnector, o = r.languageUtils, s = r.logger, a = i.language;
2650
- if (!(a && a.toLowerCase() === "cimode")) {
2651
- var u = [], c = function(f) {
2652
- var d = o.toResolveHierarchy(f);
2653
- d.forEach(function(g) {
2654
- u.indexOf(g) < 0 && u.push(g);
2655
- });
2656
- };
2657
- c(a), this.allOptions.preload && this.allOptions.preload.forEach(function(l) {
2658
- return c(l);
2659
- }), u.forEach(function(l) {
2660
- t.allOptions.ns.forEach(function(f) {
2661
- i.read(l, f, "read", null, null, function(d, g) {
2662
- d && s.warn("loading namespace ".concat(f, " for language ").concat(l, " failed"), d), !d && g && s.log("loaded namespace ".concat(f, " for language ").concat(l), g), i.loaded("".concat(l, "|").concat(f), d, g);
2663
- });
2664
- });
2665
- });
2666
- }
2667
- }
2668
- }]);
2669
- }();
2670
- Zn.type = "backend";
2671
- var ss = function(e) {
2672
- return {
2673
- type: "backend",
2674
- init: function(r, i, o) {
2675
- },
2676
- read: function(r, i, o) {
2677
- if (typeof e == "function") {
2678
- if (e.length < 3) {
2679
- try {
2680
- var s = e(r, i);
2681
- s && typeof s.then == "function" ? s.then(function(a) {
2682
- return o(null, a && a.default || a);
2683
- }).catch(o) : o(null, s);
2684
- } catch (a) {
2685
- o(a);
2686
- }
2687
- return;
2688
- }
2689
- e(r, i, o);
2690
- return;
2691
- }
2692
- o(null, e && e[r] && e[r][i]);
2693
- }
2694
- };
2695
- };
2696
- const as = {
2697
- debug: !1,
2698
- fallbackLng: In.enum.en,
2699
- namespace: "translation",
2700
- supportedLngs: Object.values(kn),
2701
- nonExplicitSupportedLngs: !1
2702
- }, us = {
2703
- react: {
2704
- useSuspense: !0
2705
- },
2706
- detection: {
2707
- order: ["navigator", "htmlTag", "path", "subdomain"],
2708
- caches: ["localStorage", "cookie"]
2709
- }
2710
- }, hn = (n, e) => {
2711
- const t = import.meta.url.split("/").pop();
2712
- return `${import.meta.url.replace(`/${t}`, "")}/locales/${n}/${e}.json`;
2713
- };
2714
- function wt(n) {
2715
- return oe.isInitialized || (oe.use(Xn).use(
2716
- new Wn(null, {
2717
- order: ["cookie", "localStorage", "navigator"],
2718
- lookupQuerystring: "lng",
2719
- lookupCookie: "i18next",
2720
- lookupLocalStorage: "i18nextLng",
2721
- caches: ["localStorage", "cookie"]
2722
- })
2723
- ).use(Zi).init({
2724
- ...as,
2725
- backend: {
2726
- backends: [
2727
- Zn,
2728
- // if a namespace can't be loaded via normal http-backend loadPath, then the inMemoryLocalBackend will try to return the correct resources
2729
- // with dynamic import, you have to use the "default" key of the module ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#importing_defaults )
2730
- ss(
2731
- (e, t) => import(hn(e, t))
2732
- )
2733
- ],
2734
- backendOptions: [
2735
- {
2736
- loadPath: hn("{{lng}}", "{{ns}}")
2737
- }
2738
- ]
2739
- },
2740
- ...us
2741
- }), oe.on("loaded", () => {
2742
- n == null || n(oe);
2743
- })), oe;
2744
- }
2745
- const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2746
- __proto__: null,
2747
- default: wt,
2748
- initializeI18n: wt
2749
- }, Symbol.toStringTag, { value: "Module" }));
2750
- function Aa(n) {
2751
- const e = wt();
2752
- return io("translation", { i18n: e, ...n });
2753
- }
2754
- const Ct = 60 * 1e3, Re = Ct, er = Re * 2, tr = Re * 3, Lt = Re * 15, Ge = Ct, Qe = Ge * 2, nr = Ge * 3, rr = Ct * 15;
2755
- var ir = /* @__PURE__ */ ((n) => (n.SelectAll = "SelectAll", n))(ir || {}), or = /* @__PURE__ */ ((n) => (n.Text = "text", n.Image = "image", n))(or || {});
2756
- w();
2757
- const cs = "___", fs = Br((n) => {
2758
- const e = n.split(cs);
2759
- try {
2760
- return e.length === 4;
2761
- } catch {
2762
- return !1;
2763
- }
2764
- }), ds = y({
2765
- captchaId: _e([p(), jt()]),
2766
- captchaContentId: _e([p(), jt()]),
2767
- salt: p().min(34),
2768
- solution: w().array().optional(),
2769
- unlabelled: w().array().optional(),
2770
- timeLimit: w().optional()
2771
- }), sr = y({
2772
- hash: p(),
2773
- data: p(),
2774
- type: ke(or)
2775
- }), ar = sr.extend({
2776
- hash: p()
2777
- }), ps = ar.extend({
2778
- label: p()
2779
- }), hs = ar.extend({
2780
- label: p().optional()
2781
- }), ur = ds.extend({
2782
- items: q(sr),
2783
- target: p()
2784
- }), gs = ur.extend({
2785
- solution: p().array().optional(),
2786
- unlabelled: p().array().optional()
2787
- }), ms = gs.extend({
2788
- solution: w().array().optional(),
2789
- unlabelled: w().array().optional()
2790
- }), ys = q(ur);
2791
- q(
2792
- ms
2793
- );
2794
- const lr = y({
2795
- captchaId: p(),
2796
- captchaContentId: p(),
2797
- solution: p().array(),
2798
- salt: p()
2799
- });
2800
- q(lr);
2801
- y({
2802
- items: q(hs)
2803
- });
2804
- y({
2805
- items: q(ps)
2806
- });
2807
- y({
2808
- captchas: ys,
2809
- format: ke(ir)
2810
- });
2811
- y({
2812
- labels: q(p())
2813
- });
2814
- const $a = (n) => new Promise((e) => setTimeout(e, n)), Na = (n, e) => {
2815
- let t = 0;
2816
- const r = "0".repeat(e);
2817
- for (; ; ) {
2818
- const i = new TextEncoder().encode(t + n);
2819
- if (vs(Vr(i)).startsWith(r))
2820
- return t;
2821
- t += 1;
2822
- }
2823
- }, vs = (n) => Array.from(n).map((e) => e.toString(16).padStart(2, "0")).join("");
2824
- function W(n, e, t) {
2825
- if (n.length === 0)
2826
- throw new Error("Array is empty");
2827
- if (!Number.isFinite(e))
2828
- throw new Error(`Index ${e} is not a finite number`);
2829
- if (e > 0 ? e = e % n.length : e = Math.ceil(Math.abs(e) / n.length) * n.length + e, e >= n.length)
2830
- throw new Error(`Index ${e} larger than array length ${n.length}`);
2831
- if (e < 0)
2832
- throw new Error(`Index ${e} smaller than 0`);
2833
- return n[e];
2834
- }
2835
- const ws = (n) => Array.isArray(n) && n !== null, bs = "dev", qe = new Array(256), cr = new Array(256 * 256);
2836
- for (let n = 0; n < 256; n++)
2837
- qe[n] = n.toString(16).padStart(2, "0");
2838
- for (let n = 0; n < 256; n++) {
2839
- const e = n << 8;
2840
- for (let t = 0; t < 256; t++)
2841
- cr[e | t] = qe[n] + qe[t];
2842
- }
2843
- function ut(n, e) {
2844
- const t = n.length % 2 | 0, r = n.length - t | 0;
2845
- for (let i = 0; i < r; i += 2)
2846
- e += cr[n[i] << 8 | n[i + 1]];
2847
- return t && (e += qe[n[r] | 0]), e;
2848
- }
2849
- function Ze(n, e = -1, t = !0) {
2850
- const r = t ? "0x" : "";
2851
- if (!(n != null && n.length))
2852
- return r;
2853
- if (e > 0) {
2854
- const i = Math.ceil(e / 8);
2855
- if (n.length > i)
2856
- return `${ut(n.subarray(0, i / 2), r)}…${ut(n.subarray(n.length - i / 2), "")}`;
2857
- }
2858
- return ut(n, r);
2859
- }
2860
- const ja = (n) => ws(n) ? Ze(new Uint8Array(n)) : n.toString(), Da = (n, e) => {
2861
- const t = n.replace(/^0x/, "").split("");
2862
- let r = 0, i = t.length - 1;
2863
- const o = e.length.toString(16).padStart(2, "0");
2864
- t[r++] = W(o, 0), t[r++] = W(o, 1);
2865
- const s = [], a = [];
2866
- let u = 0;
2867
- for (const c of e) {
2868
- const l = c.toString(16), f = l.length;
2869
- u += f;
2870
- const d = i - f + 1;
2871
- s.push(d), a.push(f);
2872
- for (let g = 0; g < f; g++)
2873
- t[d + g] = W(l, g);
2874
- i -= f;
2875
- }
2876
- if (u > n.length)
2877
- throw new Error(
2878
- `Hex data length ${u} exceeds length of hex string ${t.length}`
2879
- );
2880
- for (let c = 0; c < e.length; c++) {
2881
- const l = W(s, c).toString(16).padStart(2, "0");
2882
- u += l.length;
2883
- const f = W(a, c).toString(16).padStart(2, "0");
2884
- if (u += f.length, u > n.length)
2885
- throw new Error(
2886
- `Hex data length ${u} exceeds length of hex string ${t.length}`
2887
- );
2888
- t[r++] = W(l, 0), t[r++] = W(l, 1), t[r++] = W(f, 0), t[r++] = W(f, 1);
2889
- }
2890
- return `0x${t.join("")}`;
2891
- };
2892
- var Ss = Object.defineProperty, xs = (n, e, t) => e in n ? Ss(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, gn = (n, e, t) => (xs(n, typeof e != "symbol" ? e + "" : e, t), t), lt = {
2893
- 0: 0,
2894
- 1: 1,
2895
- 2: 2,
2896
- 3: 3,
2897
- 4: 4,
2898
- 5: 5,
2899
- 6: 6,
2900
- 7: 7,
2901
- 8: 8,
2902
- 9: 9,
2903
- a: 10,
2904
- b: 11,
2905
- c: 12,
2906
- d: 13,
2907
- e: 14,
2908
- f: 15,
2909
- A: 10,
2910
- B: 11,
2911
- C: 12,
2912
- D: 13,
2913
- E: 14,
2914
- F: 15
2915
- };
2916
- function Os(n) {
2917
- const e = n.length % 2, t = (n[1] === "x" ? 2 : 0) + e, r = (n.length - t) / 2 + e, i = new Uint8Array(r);
2918
- e && (i[0] = 0 | lt[n[2]]);
2919
- for (let o = 0; o < r; ) {
2920
- const s = t + o * 2, a = lt[n[s]], u = lt[n[s + 1]];
2921
- i[e + o++] = a << 4 | u;
2922
- }
2923
- return i;
2924
- }
2925
- var mn = class extends Uint8Array {
2926
- constructor(n) {
2927
- super(n), gn(this, "i", 0), gn(this, "v"), this.v = new DataView(n);
2928
- }
2929
- }, ne = (n) => (e) => n(e instanceof mn ? e : new mn(e instanceof Uint8Array ? e.buffer : typeof e == "string" ? Os(e).buffer : e)), et = (n) => {
2930
- const e = n.length;
2931
- let t = 0;
2932
- for (let i = 0; i < e; i++)
2933
- t += n[i].byteLength;
2934
- const r = new Uint8Array(t);
2935
- for (let i = 0, o = 0; i < e; i++) {
2936
- const s = n[i];
2937
- r.set(s, o), o += s.byteLength;
2938
- }
2939
- return r;
2940
- };
2941
- function yn(n, e) {
2942
- const t = Object.keys(n), r = t.length, i = {};
2943
- for (let o = 0; o < r; o++) {
2944
- const s = t[o];
2945
- i[s] = e(n[s], s);
2946
- }
2947
- return i;
2948
- }
2949
- var D = (n, e) => {
2950
- const t = [n, e];
2951
- return t.enc = n, t.dec = e, t;
2952
- }, fr = (n, e) => (t) => n(e(t)), dr = (n, e) => (t) => e(n(t)), Es = ([n, e], t, r) => D(fr(n, t), dr(e, r));
2953
- function Ts(n, e) {
2954
- return ne((t) => {
2955
- const r = t.v[e](t.i, !0);
2956
- return t.i += n, r;
2957
- });
2958
- }
2959
- function Cs(n, e) {
2960
- return (t) => {
2961
- const r = new Uint8Array(n);
2962
- return new DataView(r.buffer)[e](0, t, !0), r;
2963
- };
2964
- }
2965
- function G(n, e, t) {
2966
- return D(Cs(n, t), Ts(n, e));
2967
- }
2968
- var de = G(1, "getUint8", "setUint8"), ze = G(2, "getUint16", "setUint16"), Le = G(4, "getUint32", "setUint32"), pr = G(8, "getBigUint64", "setBigUint64");
2969
- G(1, "getInt8", "setInt8");
2970
- G(2, "getInt16", "setInt16");
2971
- G(4, "getInt32", "setInt32");
2972
- G(8, "getBigInt64", "setBigInt64");
2973
- var hr = (n) => {
2974
- const e = new Uint8Array(16), t = new DataView(e.buffer);
2975
- return t.setBigInt64(0, n, !0), t.setBigInt64(8, n >> 64n, !0), e;
2976
- }, gr = (n) => ne((e) => {
2977
- const { v: t, i: r } = e, i = t.getBigUint64(r, !0), o = t[n](r + 8, !0);
2978
- return e.i += 16, o << 64n | i;
2979
- });
2980
- D(hr, gr("getBigUint64"));
2981
- D(hr, gr("getBigInt64"));
2982
- var mr = (n) => {
2983
- const e = new Uint8Array(32), t = new DataView(e.buffer);
2984
- return t.setBigInt64(0, n, !0), t.setBigInt64(8, n >> 64n, !0), t.setBigInt64(16, n >> 128n, !0), t.setBigInt64(24, n >> 192n, !0), e;
2985
- }, yr = (n) => ne((e) => {
2986
- let t = e.v.getBigUint64(e.i, !0);
2987
- return e.i += 8, t |= e.v.getBigUint64(e.i, !0) << 64n, e.i += 8, t |= e.v.getBigUint64(e.i, !0) << 128n, e.i += 8, t |= e.v[n](e.i, !0) << 192n, e.i += 8, t;
2988
- });
2989
- D(mr, yr("getBigUint64"));
2990
- D(mr, yr("getBigInt64"));
2991
- var vr = Es(de, (n) => n ? 1 : 0, Boolean), Ls = [de[1], ze[1], Le[1]], Ps = ne((n) => {
2992
- const e = n[n.i], t = e & 3;
2993
- if (t < 3)
2994
- return Ls[t](n) >>> 2;
2995
- const r = (e >>> 2) + 4;
2996
- n.i++;
2997
- let i = 0n;
2998
- const o = r / 8 | 0;
2999
- let s = 0n;
3000
- for (let u = 0; u < o; u++)
3001
- i = pr[1](n) << s | i, s += 64n;
3002
- let a = r % 8;
3003
- return a > 3 && (i = BigInt(Le[1](n)) << s | i, s += 32n, a -= 4), a > 1 && (i = BigInt(ze[1](n)) << s | i, s += 16n, a -= 2), a && (i = BigInt(de[1](n)) << s | i), i;
3004
- }), ks = 1n << 56n, Is = 1 << 24, Rs = 256, As = 4294967295n, $s = 64, Ns = 16384, js = 1 << 30, Ds = (n) => {
3005
- if (n < 0)
3006
- throw new Error(`Wrong compact input (${n})`);
3007
- const e = Number(n) << 2;
3008
- if (n < $s)
3009
- return de[0](e);
3010
- if (n < Ns)
3011
- return ze[0](e | 1);
3012
- if (n < js)
3013
- return Le[0](e | 2);
3014
- let t = [new Uint8Array(1)], r = BigInt(n);
3015
- for (; r >= ks; )
3016
- t.push(pr[0](r)), r >>= 64n;
3017
- r >= Is && (t.push(Le[0](Number(r & As))), r >>= 32n);
3018
- let i = Number(r);
3019
- i >= Rs && (t.push(ze[0](i)), i >>= 16), i && t.push(de[0](i));
3020
- const o = et(t);
3021
- return o[0] = o.length - 5 << 2 | 3, o;
3022
- }, wr = D(Ds, Ps), Us = new TextEncoder(), Fs = (n) => {
3023
- const e = Us.encode(n);
3024
- return et([wr.enc(e.length), e]);
3025
- }, _s = new TextDecoder(), Ms = ne((n) => {
3026
- let e = wr.dec(n);
3027
- const t = new DataView(n.buffer, n.i, e);
3028
- return n.i += e, _s.decode(t);
3029
- }), M = D(Fs, Ms), Hs = () => {
3030
- }, Vs = new Uint8Array(0);
3031
- D(() => Vs, Hs);
3032
- var br = (n) => ne((e) => {
3033
- const t = de.dec(e);
3034
- if (t !== 0)
3035
- return n === vr[1] ? t === 1 : n(e);
3036
- }), Sr = (n) => (e) => {
3037
- const t = new Uint8Array(1);
3038
- return e === void 0 ? (t[0] = 0, t) : (t[0] = 1, n === vr[0] ? (t[0] = e ? 1 : 2, t) : et([t, n(e)]));
3039
- }, H = (n) => D(Sr(n[0]), br(n[1]));
3040
- H.enc = Sr;
3041
- H.dec = br;
3042
- var xr = (...n) => ne((e) => n.map((t) => t(e))), Or = (...n) => (e) => et(n.map((t, r) => t(e[r]))), tt = (...n) => D(Or(...n.map(([e]) => e)), xr(...n.map(([, e]) => e)));
3043
- tt.enc = Or;
3044
- tt.dec = xr;
3045
- var Er = (n) => {
3046
- const e = Object.keys(n);
3047
- return fr(tt.enc(...Object.values(n)), (t) => e.map((r) => t[r]));
3048
- }, Tr = (n) => {
3049
- const e = Object.keys(n);
3050
- return dr(tt.dec(...Object.values(n)), (t) => Object.fromEntries(t.map((r, i) => [e[i], r])));
3051
- }, ue = (n) => D(Er(yn(n, (e) => e[0])), Tr(yn(n, (e) => e[1])));
3052
- ue.enc = Er;
3053
- ue.dec = Tr;
3054
- const Bs = y({
3055
- [h.requestHash]: p()
3056
- });
3057
- y({
3058
- [h.challenge]: p()
3059
- });
3060
- const Ks = y({
3061
- [h.timestamp]: p()
3062
- }), vn = y({
3063
- [h.challenge]: p().optional(),
3064
- [h.requestHash]: p().optional(),
3065
- [h.timestamp]: p().optional()
3066
- });
3067
- y({
3068
- [h.commitmentId]: p().optional(),
3069
- [h.providerUrl]: p().optional(),
3070
- [h.dapp]: p(),
3071
- [h.user]: p(),
3072
- [h.challenge]: p().optional(),
3073
- [h.nonce]: w().optional(),
3074
- [h.timestamp]: p(),
3075
- [h.signature]: y({
3076
- [h.provider]: vn,
3077
- [h.user]: vn
3078
- })
3079
- });
3080
- const qs = ue({
3081
- [h.commitmentId]: H(M),
3082
- [h.providerUrl]: H(M),
3083
- [h.dapp]: M,
3084
- [h.user]: M,
3085
- [h.challenge]: H(M),
3086
- [h.nonce]: H(Le),
3087
- [h.timestamp]: M,
3088
- [h.signature]: ue({
3089
- [h.provider]: ue({
3090
- [h.challenge]: H(M),
3091
- [h.requestHash]: H(M)
3092
- }),
3093
- [h.user]: ue({
3094
- [h.timestamp]: H(M),
3095
- [h.requestHash]: H(M)
3096
- })
3097
- })
3098
- }), Cr = p().startsWith("0x"), Ua = (n) => {
3099
- var e, t, r, i;
3100
- return Ze(
3101
- qs.enc({
3102
- [h.commitmentId]: void 0,
3103
- [h.providerUrl]: void 0,
3104
- [h.challenge]: void 0,
3105
- [h.nonce]: void 0,
3106
- // override any optional fields by spreading the procaptchaOutput
3107
- ...n,
3108
- signature: {
3109
- provider: {
3110
- challenge: ((e = n.signature.provider) == null ? void 0 : e.challenge) || void 0,
3111
- requestHash: ((t = n.signature.provider) == null ? void 0 : t.requestHash) || void 0
3112
- },
3113
- user: {
3114
- timestamp: ((r = n.signature.user) == null ? void 0 : r.timestamp) || void 0,
3115
- requestHash: ((i = n.signature.user) == null ? void 0 : i.requestHash) || void 0
3116
- }
3117
- }
3118
- })
3119
- );
3120
- }, Lr = 2, Pr = 0;
3121
- var zs = /* @__PURE__ */ ((n) => (n.GetImageCaptchaChallenge = "/v1/prosopo/provider/client/captcha/image", n.GetPowCaptchaChallenge = "/v1/prosopo/provider/client/captcha/pow", n.GetFrictionlessCaptchaChallenge = "/v1/prosopo/provider/client/captcha/frictionless", n.SubmitImageCaptchaSolution = "/v1/prosopo/provider/client/solution", n.SubmitPowCaptchaSolution = "/v1/prosopo/provider/client/pow/solution", n.VerifyPowCaptchaSolution = "/v1/prosopo/provider/client/pow/verify", n.VerifyImageCaptchaSolutionDapp = "/v1/prosopo/provider/client/image/dapp/verify", n.GetProviderStatus = "/v1/prosopo/provider/client/status", n.SubmitUserEvents = "/v1/prosopo/provider/client/events", n))(zs || {}), Ws = /* @__PURE__ */ ((n) => (n.Healthz = "/healthz", n.GetProviderDetails = "/v1/prosopo/provider/public/details", n))(Ws || {});
3122
- y({
3123
- version: p(),
3124
- message: p(),
3125
- redis: y({
3126
- actor: p(),
3127
- isReady: ce(),
3128
- awaitingTimeSeconds: w()
3129
- }).array()
3130
- });
3131
- var Js = /* @__PURE__ */ ((n) => (n.SiteKeyRegister = "/v1/prosopo/provider/admin/sitekey/register", n.UpdateDetectorKey = "/v1/prosopo/provider/admin/detector/update", n.RemoveDetectorKey = "/v1/prosopo/provider/admin/detector/remove", n))(Js || {});
3132
- const kr = {
3133
- "/v1/prosopo/provider/client/captcha/image": { windowMs: 6e4, limit: 30 },
3134
- "/v1/prosopo/provider/client/captcha/pow": { windowMs: 6e4, limit: 60 },
3135
- "/v1/prosopo/provider/client/solution": { windowMs: 6e4, limit: 60 },
3136
- "/v1/prosopo/provider/client/captcha/frictionless": {
3137
- windowMs: 6e4,
3138
- limit: 60
3139
- },
3140
- "/v1/prosopo/provider/client/pow/solution": { windowMs: 6e4, limit: 60 },
3141
- "/v1/prosopo/provider/client/pow/verify": { windowMs: 6e4, limit: 60 },
3142
- "/v1/prosopo/provider/client/image/dapp/verify": {
3143
- windowMs: 6e4,
3144
- limit: 60
3145
- },
3146
- "/v1/prosopo/provider/client/status": { windowMs: 6e4, limit: 60 },
3147
- "/v1/prosopo/provider/public/details": { windowMs: 6e4, limit: 60 },
3148
- "/v1/prosopo/provider/client/events": { windowMs: 6e4, limit: 60 },
3149
- "/v1/prosopo/provider/admin/sitekey/register": { windowMs: 6e4, limit: 5 },
3150
- "/v1/prosopo/provider/admin/detector/update": { windowMs: 6e4, limit: 5 },
3151
- "/v1/prosopo/provider/admin/detector/remove": { windowMs: 6e4, limit: 5 }
3152
- }, Xs = (n) => y(
3153
- Object.entries(n).reduce(
3154
- (e, [t, r]) => {
3155
- const i = t;
3156
- return e[i] = y({
3157
- windowMs: Dt.number().optional().default(r.windowMs),
3158
- limit: Dt.number().optional().default(r.limit)
3159
- }), e;
3160
- },
3161
- {}
3162
- )
3163
- ), Ys = Xs(
3164
- kr
3165
- );
3166
- y({
3167
- [h.user]: p(),
3168
- [h.dapp]: p(),
3169
- [h.datasetId]: _e([p(), q(w())]),
3170
- [h.sessionId]: p().optional()
3171
- });
3172
- y({
3173
- [h.user]: p(),
3174
- [h.dapp]: p(),
3175
- [h.captchas]: q(lr),
3176
- [h.requestHash]: p(),
3177
- [h.timestamp]: p(),
3178
- [h.signature]: y({
3179
- [h.user]: Ks,
3180
- [h.provider]: Bs
3181
- })
3182
- });
3183
- y({
3184
- [h.token]: Cr,
3185
- [h.dappSignature]: p(),
3186
- [h.maxVerifiedTime]: w().optional().default(Lt),
3187
- [h.ip]: p().optional()
3188
- });
3189
- y({
3190
- [h.token]: Cr,
3191
- [h.dappSignature]: p(),
3192
- [h.verifiedTimeout]: w().optional().default(Qe),
3193
- [h.ip]: p().optional()
3194
- });
3195
- y({
3196
- [h.user]: p(),
3197
- [h.dapp]: p(),
3198
- [h.sessionId]: p().optional()
3199
- });
3200
- const Fa = y({
3201
- [h.challenge]: fs,
3202
- [h.difficulty]: w(),
3203
- [h.signature]: y({
3204
- [h.user]: y({
3205
- [h.timestamp]: p()
3206
- }),
3207
- [h.provider]: y({
3208
- [h.challenge]: p()
3209
- })
3210
- }),
3211
- [h.user]: p(),
3212
- [h.dapp]: p(),
3213
- [h.nonce]: w(),
3214
- [h.verifiedTimeout]: w().optional().default(Qe)
3215
- });
3216
- y({
3217
- [h.dapp]: p(),
3218
- [h.token]: p(),
3219
- [h.user]: p()
3220
- });
3221
- y({
3222
- [h.siteKey]: p()
3223
- });
3224
- y({
3225
- [h.siteKey]: p(),
3226
- [h.tier]: ke(St),
3227
- [h.settings]: Ti.optional()
3228
- });
3229
- const _a = y({
3230
- [h.detectorKey]: p()
3231
- }), Ma = y({
3232
- [h.detectorKey]: p(),
3233
- [h.expirationInSeconds]: w().positive().optional()
3234
- }), Ir = y({
3235
- solved: y({
3236
- count: w().positive()
3237
- }).optional().default({ count: Lr }),
3238
- unsolved: y({
3239
- count: w().nonnegative()
3240
- }).optional().default({ count: Pr })
3241
- });
3242
- var Rr = /* @__PURE__ */ ((n) => (n.ipAddress = "ipAddress", n.userAccount = "userAccount", n))(Rr || {});
3243
- const Gs = ke(Rr);
3244
- y({
3245
- global: ce(),
3246
- hardBlock: ce(),
3247
- type: Gs,
3248
- dappAccount: p().optional(),
3249
- captchaConfig: Ir.optional()
3250
- });
3251
- y({
3252
- [h.dapp]: p()
3253
- });
3254
- const Ar = 0.2, $r = 0.5, Nr = 0.2, Qs = y({
3255
- PENALTY_OLD_TIMESTAMP: w().positive().optional().default(Ar),
3256
- PENALTY_ACCESS_RULE: w().positive().optional().default($r),
3257
- PENALTY_UNVERIFIED_HOST: w().positive().optional().default(Nr)
3258
- }), wn = Je([
3259
- "trace",
3260
- "debug",
3261
- "info",
3262
- "warn",
3263
- "error",
3264
- "fatal",
3265
- "log"
3266
- ]);
3267
- Je([
3268
- "mongo",
3269
- "mongoMemory",
3270
- "provider",
3271
- "client",
3272
- "captcha"
3273
- ]);
3274
- const bt = Je([
3275
- "development",
3276
- "staging",
3277
- "production"
3278
- ]), Zs = On(
3279
- bt,
3280
- y({
3281
- type: p(),
3282
- endpoint: p(),
3283
- dbname: p().default("prosopo"),
3284
- authSource: p().default("admin")
3285
- })
3286
- ), ea = y({
3287
- logLevel: wn.optional().default(wn.enum.info),
3288
- defaultEnvironment: bt.default(
3289
- bt.Values.production
3290
- ),
3291
- // The account with which to query the contract.merge sign transactions
3292
- account: y({
3293
- address: p().optional(),
3294
- secret: p().optional(),
3295
- password: p().optional()
3296
- })
3297
- });
3298
- C.object({
3299
- encoded: C.string(),
3300
- encoding: C.object({
3301
- content: C.array(C.string()),
3302
- type: C.array(C.string()),
3303
- version: C.string()
3304
- }),
3305
- address: C.string(),
3306
- meta: C.object({
3307
- genesisHash: C.string(),
3308
- name: C.string(),
3309
- whenCreated: C.number()
3310
- })
3311
- });
3312
- const jr = ea.merge(
3313
- y({
3314
- database: Zs.optional(),
3315
- devOnlyWatchEvents: ce().optional()
3316
- })
3317
- ), ta = y({
3318
- baseURL: p().url(),
3319
- port: w().optional().default(9229)
3320
- }).default({
3321
- baseURL: "http://localhost",
3322
- port: 9229
3323
- });
3324
- y({
3325
- requiredNumberOfSolutions: w().positive().min(2),
3326
- solutionWinningPercentage: w().positive().max(100),
3327
- captchaBlockRecency: w().positive().min(2)
3328
- });
3329
- const Dr = jr.merge(
3330
- y({
3331
- userAccountAddress: p().optional(),
3332
- web2: ce().optional().default(!0),
3333
- solutionThreshold: w().positive().max(100).optional().default(80),
3334
- dappName: p().optional().default("ProsopoClientDapp"),
3335
- serverUrl: p().optional()
3336
- })
3337
- ), Ur = {
3338
- challengeTimeout: Re,
3339
- solutionTimeout: er,
3340
- verifiedTimeout: tr,
3341
- cachedTimeout: Lt
3342
- }, Fr = {
3343
- challengeTimeout: Qe,
3344
- solutionTimeout: Ge,
3345
- cachedTimeout: nr
3346
- }, _r = {
3347
- maxVerifiedTime: rr
3348
- }, Pt = {
3349
- image: Ur,
3350
- pow: Fr,
3351
- contract: _r
3352
- }, Mr = y({
3353
- image: y({
3354
- // Set this to a default value for the frontend
3355
- challengeTimeout: w().positive().optional().default(Re),
3356
- // Set this to a default value for the frontend
3357
- solutionTimeout: w().positive().optional().default(er),
3358
- verifiedTimeout: w().positive().optional().default(tr),
3359
- cachedTimeout: w().positive().optional().default(Lt)
3360
- }).default(Ur),
3361
- pow: y({
3362
- verifiedTimeout: w().positive().optional().default(Qe),
3363
- solutionTimeout: w().positive().optional().default(Ge),
3364
- cachedTimeout: w().positive().optional().default(nr)
3365
- }).default(Fr),
3366
- contract: y({
3367
- maxVerifiedTime: w().positive().optional().default(rr)
3368
- }).default(_r)
3369
- }).default(Pt);
3370
- Dr.merge(
3371
- y({
3372
- serverUrl: p().url().optional(),
3373
- timeouts: Mr.optional().default(Pt)
3374
- })
3375
- );
3376
- y({
3377
- area: y({
3378
- width: w().positive(),
3379
- height: w().positive()
3380
- }),
3381
- offsetParameter: w().positive(),
3382
- multiplier: w().positive(),
3383
- fontSizeFactor: w().positive(),
3384
- maxShadowBlur: w().positive(),
3385
- numberOfRounds: w().positive(),
3386
- seed: w().positive()
3387
- });
3388
- const na = _e([Ut("light"), Ut("dark")]);
3389
- var ra = /* @__PURE__ */ ((n) => (n.visible = "visible", n.invisible = "invisible", n))(ra || {});
3390
- const ia = Je([
3391
- "visible",
3392
- "invisible"
3393
- /* invisible */
3394
- ]).optional(), Ha = Dr.and(
3395
- y({
3396
- theme: na.optional().default("light"),
3397
- captchas: Mr.optional().default(Pt),
3398
- language: In.optional(),
3399
- mode: ia.optional().default(
3400
- "visible"
3401
- /* visible */
3402
- )
3403
- })
3404
- ), oa = C.object({
3405
- apiKey: C.string(),
3406
- baseUrl: C.string().url()
3407
- });
3408
- jr.merge(
3409
- y({
3410
- host: p(),
3411
- captchas: Ir.optional().default({
3412
- solved: { count: Lr },
3413
- unsolved: { count: Pr }
3414
- }),
3415
- penalties: Qs.optional().default({
3416
- PENALTY_OLD_TIMESTAMP: Ar,
3417
- PENALTY_ACCESS_RULE: $r,
3418
- PENALTY_UNVERIFIED_HOST: Nr
3419
- }),
3420
- scheduledTasks: y({
3421
- captchaScheduler: y({
3422
- schedule: p().optional()
3423
- }).optional(),
3424
- clientListScheduler: y({
3425
- schedule: p().optional()
3426
- }).optional()
3427
- }).optional(),
3428
- server: ta.optional(),
3429
- mongoEventsUri: p().optional(),
3430
- mongoCaptchaUri: p().optional(),
3431
- mongoClientUri: p().optional(),
3432
- ipApi: oa,
3433
- redisConnection: y({
3434
- url: p(),
3435
- password: p(),
3436
- indexName: p().optional()
3437
- }).default({
3438
- url: "redis://localhost:6379",
3439
- password: "root"
3440
- }),
3441
- rateLimits: Ys.default(kr),
3442
- proxyCount: w().optional().default(0),
3443
- lRules: On(p(), w()).optional(),
3444
- authAccount: y({
3445
- address: p().optional(),
3446
- secret: p().optional(),
3447
- password: p().optional()
3448
- })
3449
- })
3450
- );
3451
- const sa = async () => (await import("./fp.esm-DYWeNGcH.js")).default, aa = async () => (await (await (await sa()).load()).get()).visitorId, se = new Uint8Array([161, 35, 3, 33, 0]), We = new Uint8Array([
3452
- 48,
3453
- 83,
3454
- 2,
3455
- 1,
3456
- 1,
3457
- 48,
3458
- 5,
3459
- 6,
3460
- 3,
3461
- 43,
3462
- 101,
3463
- 112,
3464
- 4,
3465
- 34,
3466
- 4,
3467
- 32
3468
- ]), ua = 32, bn = 64, la = 32, Se = We.length;
3469
- function ca(n, e, t) {
3470
- const r = Array.isArray(t) || t === void 0 ? t : [t], i = Kr(e, n, r), o = i.subarray(0, We.length);
3471
- if (!nt(o, We))
3472
- throw new Error("Invalid encoding header found in body");
3473
- let s = i.subarray(Se, Se + bn), a = Se + bn, u = i.subarray(a, a + se.length);
3474
- if (!nt(u, se) && (a = Se + la, s = i.subarray(Se, a), u = i.subarray(a, a + se.length), !nt(u, se)))
3475
- throw new Error("Invalid encoding divider found in body");
3476
- const c = a + se.length;
3477
- return {
3478
- publicKey: i.subarray(c, c + ua),
3479
- secretKey: s
3480
- };
3481
- }
3482
- function fa({ publicKey: n, secretKey: e }, t) {
3483
- if (!e)
3484
- throw new Error("Expected a valid secretKey to be passed to encode");
3485
- const r = ft(We, e, se, n);
3486
- if (!t)
3487
- return r;
3488
- const { params: i, password: o, salt: s } = qr(t), { encrypted: a, nonce: u } = zr(r, o.subarray(0, 32));
3489
- return ft(Wr(s, i), u, a);
3490
- }
3491
- function da(n, { address: e, meta: t }, r, i) {
3492
- return Cn(
3493
- Jr(r, ["pkcs8", n], i),
3494
- {
3495
- address: e,
3496
- meta: t
3497
- }
3498
- );
3499
- }
3500
- const pa = new Uint8Array([]), ha = {
3501
- sr25519: Tn,
3502
- ed25519: () => {
3503
- throw new Error("Not Implemented");
3504
- },
3505
- ecdsa: () => {
3506
- throw new Error("Not Implemented");
3507
- },
3508
- ethereum: () => {
3509
- throw new Error("Not Implemented");
3510
- }
3511
- }, ga = {
3512
- ecdsa: new Uint8Array([2]),
3513
- ed25519: new Uint8Array([0]),
3514
- ethereum: new Uint8Array([2]),
3515
- sr25519: new Uint8Array([1])
3516
- }, ma = {
3517
- sr25519: Zr,
3518
- ed25519: () => {
3519
- throw new Error("Not Implemented");
3520
- },
3521
- ecdsa: () => {
3522
- throw new Error("Not Implemented");
3523
- },
3524
- ethereum: () => {
3525
- throw new Error("Not Implemented");
3526
- }
3527
- }, ct = {
3528
- sr25519: (n) => n,
3529
- ed25519: () => {
3530
- throw new Error("Not Implemented");
3531
- },
3532
- ecdsa: () => {
3533
- throw new Error("Not Implemented");
3534
- },
3535
- ethereum: () => {
3536
- throw new Error("Not Implemented");
3537
- }
3538
- };
3539
- function xe(n) {
3540
- return !n || si(n);
3541
- }
3542
- function ae({ toSS58: n, type: e }, { publicKey: t, secretKey: r }, i = {}, o = null, s) {
3543
- const a = (l, f) => {
3544
- const d = ca(l, f || o, s);
3545
- if (d.secretKey.length === 64)
3546
- t = d.publicKey, r = d.secretKey;
3547
- else {
3548
- const g = ha[e](d.secretKey);
3549
- t = g.publicKey, r = g.secretKey;
3550
- }
3551
- }, u = (l) => (xe(r) && o && a(l, o), o = fa({ publicKey: t, secretKey: r }, l), s = void 0, o), c = () => {
3552
- const l = ct[e](t);
3553
- return n(l);
3554
- };
3555
- return {
3556
- get address() {
3557
- return c();
3558
- },
3559
- get addressRaw() {
3560
- return ct[e](t);
3561
- },
3562
- get isLocked() {
3563
- return xe(r);
3564
- },
3565
- get meta() {
3566
- return i;
3567
- },
3568
- get publicKey() {
3569
- return t;
3570
- },
3571
- get type() {
3572
- return e;
3573
- },
3574
- // eslint-disable-next-line sort-keys
3575
- decodePkcs8: a,
3576
- derive: (l, f) => {
3577
- if (xe(r))
3578
- throw new Error("Cannot derive on a locked keypair");
3579
- const { path: d } = ei(l), g = En({ publicKey: t, secretKey: r }, d, e);
3580
- return ae({ toSS58: n, type: e }, g, f, null);
3581
- },
3582
- encodePkcs8: (l) => u(l),
3583
- lock: () => {
3584
- r = new Uint8Array([]);
3585
- },
3586
- setMeta: (l) => {
3587
- i = Cn({}, i, l);
3588
- },
3589
- sign: (l, f = {}) => {
3590
- if (xe(r))
3591
- throw new Error("Cannot sign with a locked key pair");
3592
- return ft(
3593
- f.withType ? ga[e] : pa,
3594
- ma[e](dt(l), { publicKey: t, secretKey: r })
3595
- );
3596
- },
3597
- toJson: (l) => {
3598
- const f = ["ecdsa", "ethereum"].includes(e) ? t.length === 20 ? Ft(t) : Ft(Qr(t)) : c();
3599
- return da(
3600
- e,
3601
- { address: f, meta: i },
3602
- u(l),
3603
- !!l
3604
- );
3605
- },
3606
- unlock: (l) => {
3607
- a(l);
3608
- },
3609
- verify: (l, f, d) => Gr(
3610
- l,
3611
- f,
3612
- ct[e](dt(d))
3613
- ).isValid,
3614
- vrfSign: (l, f, d) => {
3615
- if (xe(r))
3616
- throw new Error("Cannot sign with a locked key pair");
3617
- return Yr(l, { secretKey: r }, f, d);
3618
- },
3619
- vrfVerify: (l, f, d, g, m) => Xr(l, f, t, g, m)
3620
- };
3621
- }
3622
- var Z;
3623
- class ya {
3624
- constructor() {
3625
- me(this, Z, {});
3626
- }
3627
- add(e) {
3628
- return j(this, Z)[je(e.address).toString()] = e, e;
3629
- }
3630
- all() {
3631
- return Object.values(j(this, Z));
3632
- }
3633
- get(e) {
3634
- const t = j(this, Z)[je(e).toString()];
3635
- if (!t)
3636
- throw new Error(
3637
- `Unable to retrieve keypair '${ai(e) || De(e) ? Ze(dt(e)) : e}'`
3638
- );
3639
- return t;
3640
- }
3641
- remove(e) {
3642
- delete j(this, Z)[je(e).toString()];
3643
- }
3644
- }
3645
- Z = new WeakMap();
3646
- const va = "bottom drive obey lake curtain smoke basket hold race lonely fit walk", Sn = {
3647
- sr25519: (n) => Tn(n),
3648
- ed25519: () => {
3649
- throw new Error("Not Implemented");
3650
- },
3651
- ecdsa: () => {
3652
- throw new Error("Not Implemented");
3653
- },
3654
- ethereum: () => {
3655
- throw new Error("Not Implemented");
3656
- }
3657
- };
3658
- function wa({ publicKey: n }) {
3659
- return n;
3660
- }
3661
- var V, Pe, le;
3662
- class ba {
3663
- constructor(e = {}) {
3664
- me(this, V);
3665
- me(this, Pe);
3666
- me(this, le);
3667
- if (this.decodeAddress = je, this.encodeAddress = (t, r) => ti(t, r ?? j(this, le)), e.type = e.type || "sr25519", !["sr25519"].includes(e.type || "undefined"))
3668
- throw new Error(
3669
- `Expected a keyring type of either 'sr25519', found '${e.type || "unknown"}`
3670
- );
3671
- ye(this, V, new ya()), ye(this, le, e.ss58Format), ye(this, Pe, e.type);
3672
- }
3673
- /**
3674
- * @description retrieve the pairs (alias for getPairs)
3675
- */
3676
- get pairs() {
3677
- return this.getPairs();
3678
- }
3679
- /**
3680
- * @description retrieve the publicKeys (alias for getPublicKeys)
3681
- */
3682
- get publicKeys() {
3683
- return this.getPublicKeys();
3684
- }
3685
- /**
3686
- * @description Returns the type of the keyring, ed25519, sr25519 or ecdsa
3687
- */
3688
- get type() {
3689
- return j(this, Pe);
3690
- }
3691
- /**
3692
- * @name addPair
3693
- * @summary Stores an account, given a keyring pair, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3694
- */
3695
- addPair(e) {
3696
- return j(this, V).add(e);
3697
- }
3698
- /**
3699
- * @name addFromAddress
3700
- * @summary Stores an account, given an account address, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3701
- * @description Allows user to explicitly provide separate inputs including account address or public key, and optionally
3702
- * the associated account metadata, and the default encoded value as arguments (that may be obtained from the json file
3703
- * of an account backup), and then generates a keyring pair from them that it passes to
3704
- * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3705
- */
3706
- addFromAddress(e, t = {}, r = null, i = this.type, o, s) {
3707
- const a = this.decodeAddress(e, o);
3708
- return this.addPair(
3709
- ae(
3710
- { toSS58: this.encodeAddress, type: i },
3711
- { publicKey: a, secretKey: new Uint8Array() },
3712
- t,
3713
- r,
3714
- s
3715
- )
3716
- );
3717
- }
3718
- /**
3719
- * @name addFromJson
3720
- * @summary Stores an account, given JSON data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3721
- * @description Allows user to provide a json object argument that contains account information (that may be obtained from the json file
3722
- * of an account backup), and then generates a keyring pair from it that it passes to
3723
- * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3724
- */
3725
- addFromJson(e, t) {
3726
- return this.addPair(this.createFromJson(e, t));
3727
- }
3728
- /**
3729
- * @name addFromMnemonic
3730
- * @summary Stores an account, given a mnemonic, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3731
- * @description Allows user to provide a mnemonic (seed phrase that is provided when account is originally created)
3732
- * argument and a metadata argument that contains account information (that may be obtained from the json file
3733
- * of an account backup), and then generates a keyring pair from it that it passes to
3734
- * `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3735
- */
3736
- addFromMnemonic(e, t = {}, r = this.type) {
3737
- return this.addFromUri(e, t, r);
3738
- }
3739
- /**
3740
- * @name addFromPair
3741
- * @summary Stores an account created from an explicit publicKey/secreteKey combination
3742
- */
3743
- addFromPair(e, t = {}, r = this.type) {
3744
- return this.addPair(this.createFromPair(e, t, r));
3745
- }
3746
- /**
3747
- * @name addFromSeed
3748
- * @summary Stores an account, given seed data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
3749
- * @description Stores in a keyring pair dictionary the public key of the pair as a key and the pair as the associated value.
3750
- * Allows user to provide the account seed as an argument, and then generates a keyring pair from it that it passes to
3751
- * `addPair` to store in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
3752
- */
3753
- addFromSeed(e, t = {}, r = this.type) {
3754
- return this.addPair(
3755
- ae(
3756
- { toSS58: this.encodeAddress, type: r },
3757
- Sn[r](e),
3758
- t,
3759
- null
3760
- )
3761
- );
3762
- }
3763
- /**
3764
- * @name addFromUri
3765
- * @summary Creates an account via an suri
3766
- * @description Extracts the phrase, path and password from a SURI format for specifying secret keys `<secret>/<soft-key>//<hard-key>///<password>` (the `///password` may be omitted, and `/<soft-key>` and `//<hard-key>` maybe repeated and mixed). The secret can be a hex string, mnemonic phrase or a string (to be padded)
3767
- */
3768
- addFromUri(e, t = {}, r = this.type) {
3769
- return this.addPair(this.createFromUri(e, t, r));
3770
- }
3771
- /**
3772
- * @name createFromJson
3773
- * @description Creates a pair from a JSON keyfile
3774
- */
3775
- createFromJson({
3776
- address: e,
3777
- encoded: t,
3778
- encoding: { content: r, type: i, version: o },
3779
- meta: s
3780
- }, a) {
3781
- if (o === "3" && r[0] !== "pkcs8")
3782
- throw new Error(
3783
- `Unable to decode non-pkcs8 type, [${r.join(",")}] found}`
3784
- );
3785
- const u = o === "0" || !Array.isArray(r) ? this.type : r[1];
3786
- if (!u)
3787
- throw new Error("cryptoType is undefined");
3788
- const c = Array.isArray(i) ? i : [i];
3789
- if (!["sr25519"].includes(u))
3790
- throw new Error(`Unknown crypto type ${u}`);
3791
- const l = De(e) ? rt(e) : this.decodeAddress(e, a), f = De(t) ? rt(t) : ni(t);
3792
- return ae(
3793
- { toSS58: this.encodeAddress, type: u },
3794
- { publicKey: l, secretKey: new Uint8Array() },
3795
- s,
3796
- f,
3797
- c
3798
- );
3799
- }
3800
- /**
3801
- * @name createFromPair
3802
- * @summary Creates a pair from an explicit publicKey/secreteKey combination
3803
- */
3804
- createFromPair(e, t = {}, r = this.type) {
3805
- return ae({ toSS58: this.encodeAddress, type: r }, e, t, null);
3806
- }
3807
- /**
3808
- * @name createFromUri
3809
- * @summary Creates a Keypair from an suri
3810
- * @description This creates a pair from the suri, but does not add it to the keyring
3811
- */
3812
- createFromUri(e, t = {}, r = this.type) {
3813
- const i = e.startsWith("//") ? `${va}${e}` : e, { password: o, path: s, phrase: a } = ri(i);
3814
- let u;
3815
- if (De(a, 256))
3816
- u = rt(a);
3817
- else {
3818
- const f = a.split(" ");
3819
- if ([12, 15, 18, 21, 24].includes(f.length))
3820
- u = r === "ethereum" ? (() => {
3821
- throw new Error(
3822
- "Not implemented - Prosopo Keyring supports sr25519 only"
3823
- );
3824
- })() : ii(a, o);
3825
- else {
3826
- if (a.length > 32)
3827
- throw new Error(
3828
- "specified phrase is not a valid mnemonic and is invalid as a raw seed at > 32 bytes"
3829
- );
3830
- u = Ln(a.padEnd(32));
3831
- }
3832
- }
3833
- const l = En(Sn[r](u), s, r);
3834
- return ae(
3835
- { toSS58: this.encodeAddress, type: r },
3836
- l,
3837
- t,
3838
- null
3839
- );
3840
- }
3841
- /**
3842
- * @name getPair
3843
- * @summary Retrieves an account keyring pair from the Keyring Pair Dictionary, given an account address
3844
- * @description Returns a keyring pair value from the keyring pair dictionary by performing
3845
- * a key lookup using the provided account address or public key (after decoding it).
3846
- */
3847
- getPair(e) {
3848
- return j(this, V).get(e);
3849
- }
3850
- /**
3851
- * @name getPairs
3852
- * @summary Retrieves all account keyring pairs from the Keyring Pair Dictionary
3853
- * @description Returns an array list of all the keyring pair values that are stored in the keyring pair dictionary.
3854
- */
3855
- getPairs() {
3856
- return j(this, V).all();
3857
- }
3858
- /**
3859
- * @name getPublicKeys
3860
- * @summary Retrieves Public Keys of all Keyring Pairs stored in the Keyring Pair Dictionary
3861
- * @description Returns an array list of all the public keys associated with each of the keyring pair values that are stored in the keyring pair dictionary.
3862
- */
3863
- getPublicKeys() {
3864
- return j(this, V).all().map(wa);
3865
- }
3866
- /**
3867
- * @name removePair
3868
- * @description Deletes the provided input address or public key from the stored Keyring Pair Dictionary.
3869
- */
3870
- removePair(e) {
3871
- j(this, V).remove(e);
3872
- }
3873
- /**
3874
- * @name setSS58Format;
3875
- * @description Sets the ss58 format for the keyring
3876
- */
3877
- setSS58Format(e) {
3878
- ye(this, le, e);
3879
- }
3880
- /**
3881
- * @name toJson
3882
- * @summary Returns a JSON object associated with the input argument that contains metadata assocated with an account
3883
- * @description Returns a JSON object containing the metadata associated with an account
3884
- * when valid address or public key and when the account passphrase is provided if the account secret
3885
- * is not already unlocked and available in memory. Note that in [Polkadot-JS Apps](https://github.com/polkadot-js/apps) the user
3886
- * may backup their account to a JSON file that contains this information.
3887
- */
3888
- toJson(e, t) {
3889
- return j(this, V).get(e).toJson(t);
3890
- }
3891
- }
3892
- V = new WeakMap(), Pe = new WeakMap(), le = new WeakMap();
3893
- class Sa {
3894
- }
3895
- const xa = async () => (await import("./Signer-DP9drQ55.js")).default, Oa = async () => (await import("./utilCryptoChunk-D6ZLkbFV.js").then((n) => n.w)).entropyToMnemonic;
3896
- class xn extends Sa {
3897
- async getAccount(e) {
3898
- const t = await this.createAccount(e), r = await this.createExtension(t);
3899
- return {
3900
- account: t,
3901
- extension: r
3902
- };
3903
- }
3904
- async createExtension(e) {
3905
- const t = await xa(), r = new t(async () => {
3906
- });
3907
- return r.signRaw = async (i) => {
3908
- const o = e.keypair.sign(i.data);
3909
- return {
3910
- id: 1,
3911
- // the id of the request to sign. This should be incremented each time and adjust the signature, but we're hacking around this. Hence the signature will always be the same given the same payload.
3912
- signature: Ze(o)
3913
- };
3914
- }, {
3915
- accounts: {
3916
- get: async () => [e],
3917
- subscribe: () => () => {
3918
- }
3919
- },
3920
- name: "procaptcha-web2",
3921
- version: bs,
3922
- signer: r
3923
- };
3924
- }
3925
- async createAccount(e) {
3926
- const t = await aa(), r = oi(t, 128).slice(2), i = Ln(r), s = (await Oa())(i), a = "sr25519", c = new ba({
3927
- type: a
3928
- }).addFromMnemonic(s), l = c.address;
3929
- return {
3930
- address: l,
3931
- name: l,
3932
- keypair: c
3933
- };
3934
- }
3935
- }
3936
- const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3937
- __proto__: null,
3938
- ExtensionWeb2: xn,
3939
- default: xn
3940
- }, Symbol.toStringTag, { value: "Module" }));
3941
- export {
3942
- h as A,
3943
- Xe as C,
3944
- Sa as E,
3945
- In as L,
3946
- ra as M,
3947
- Ha as P,
3948
- Ma as R,
3949
- Fa as S,
3950
- _a as U,
3951
- W as a,
3952
- bt as b,
3953
- zs as c,
3954
- Ws as d,
3955
- Js as e,
3956
- Ra as f,
3957
- Da as g,
3958
- Ua as h,
3959
- ja as i,
3960
- Hi as j,
3961
- Na as k,
3962
- Ia as l,
3963
- Va as m,
3964
- F as r,
3965
- $a as s,
3966
- Aa as u
3967
- };