@wix/cli-app 1.1.57 → 1.1.59

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 (92) hide show
  1. package/build/{CreateVersionCommand-AIXBHCYB.js → CreateVersionCommand-6HJGN4WS.js} +16 -16
  2. package/build/{DevCommand-TOFPM7DZ.js → DevCommand-U7PV4HW6.js} +15 -15
  3. package/build/DevCommand-U7PV4HW6.js.map +1 -0
  4. package/build/{GenerateCommand-HB46FNMR.js → GenerateCommand-M3T6OD4B.js} +316 -194
  5. package/build/GenerateCommand-M3T6OD4B.js.map +1 -0
  6. package/build/{LogsCommand-Q2HRBR6G.js → LogsCommand-ECPZQ3LE.js} +4 -4
  7. package/build/PreviewCommand-ZQ3OUOKW.js +23 -0
  8. package/build/ReleaseCommand-KLZWNOVY.js +91 -0
  9. package/build/ReleaseCommand-KLZWNOVY.js.map +1 -0
  10. package/build/{ServeCommand-ZEXPLXTI.js → ServeCommand-I65XXTLM.js} +13 -13
  11. package/build/{build-3AJU7FWE.js → build-HZ5LVFAS.js} +10 -9
  12. package/build/build-HZ5LVFAS.js.map +1 -0
  13. package/build/{chunk-XQ2F7ZVH.js → chunk-4JDHJDA5.js} +3 -3
  14. package/build/{chunk-2BYVOUAH.js → chunk-ACN6EZGH.js} +3 -3
  15. package/build/{chunk-FOKCY5BR.js → chunk-AQKGIDJO.js} +1969 -342
  16. package/build/chunk-AQKGIDJO.js.map +1 -0
  17. package/build/{chunk-QG2TLAMS.js → chunk-BNROT2BN.js} +5 -5
  18. package/build/{chunk-MGPAOFO3.js → chunk-DXNFLVQP.js} +549 -538
  19. package/build/chunk-DXNFLVQP.js.map +1 -0
  20. package/build/{chunk-Y6SGP7TM.js → chunk-EZLVJJON.js} +3 -3
  21. package/build/{chunk-JZVNLHD3.js → chunk-FHMCCDCY.js} +3 -3
  22. package/build/{chunk-4JP2XRKG.js → chunk-FMM24YL4.js} +2044 -924
  23. package/build/chunk-FMM24YL4.js.map +1 -0
  24. package/build/{chunk-6A37LXDJ.js → chunk-IDWDZWLM.js} +2 -2
  25. package/build/{chunk-F2XRLYHS.js → chunk-OCC6MO6R.js} +5 -5
  26. package/build/{chunk-77XREOLU.js → chunk-PAWIUC26.js} +8 -8
  27. package/build/{chunk-IJVKSYIY.js → chunk-QVGYU6D4.js} +19 -8
  28. package/build/chunk-QVGYU6D4.js.map +1 -0
  29. package/build/{chunk-BMVZ7QCF.js → chunk-QW4WBWJK.js} +3 -3
  30. package/build/{chunk-2GIVAXZY.js → chunk-U72IPCQR.js} +3 -3
  31. package/build/{chunk-FTNALO4B.js → chunk-UQBZVJDQ.js} +6 -3
  32. package/build/chunk-UQBZVJDQ.js.map +1 -0
  33. package/build/{chunk-HL4K6RV3.js → chunk-W4HI7DI3.js} +2 -2
  34. package/build/{chunk-2CUJME55.js → chunk-ZJYRE4BT.js} +3 -3
  35. package/build/{chunk-N6O7J2WO.js → chunk-ZXHKA32C.js} +56 -12
  36. package/build/chunk-ZXHKA32C.js.map +1 -0
  37. package/build/cloudflare-runtime/entry.js +306 -252
  38. package/build/cloudflare-runtime/getRegisteredExtensions.js +21 -273
  39. package/build/index.js +444 -134
  40. package/build/index.js.map +1 -1
  41. package/build/platform-sdk/chunk-7EYXEF6M.js +2 -0
  42. package/build/platform-sdk/chunk-7EYXEF6M.js.map +1 -0
  43. package/build/platform-sdk/chunk-EVF6HSFE.js +2 -0
  44. package/build/platform-sdk/chunk-EVF6HSFE.js.map +1 -0
  45. package/build/platform-sdk/chunk-LO6MZPZE.js +2 -0
  46. package/build/platform-sdk/chunk-LO6MZPZE.js.map +1 -0
  47. package/build/platform-sdk/dashboard.js +1 -1
  48. package/build/platform-sdk/dashboard.js.map +1 -1
  49. package/build/platform-sdk/editor.js +6 -6
  50. package/build/platform-sdk/editor.js.map +1 -1
  51. package/build/platform-sdk/site.js +1 -1
  52. package/build/platform-sdk/site.js.map +1 -1
  53. package/build/platform-sdk/web-methods.js +2 -0
  54. package/build/platform-sdk/web-methods.js.map +1 -0
  55. package/build/{preview-C7XYH7BB.js → preview-FI6WYZUP.js} +13 -13
  56. package/build/preview-FI6WYZUP.js.map +1 -0
  57. package/build/{render-command-BMSK4YLL.js → render-command-UKYXN7C7.js} +6 -6
  58. package/package.json +13 -10
  59. package/schemas/site-plugin.json +1 -0
  60. package/templates/web-method/files/placeholder.ts.ejs +17 -0
  61. package/build/DevCommand-TOFPM7DZ.js.map +0 -1
  62. package/build/GenerateCommand-HB46FNMR.js.map +0 -1
  63. package/build/PreviewCommand-XBSTVGWT.js +0 -23
  64. package/build/build-3AJU7FWE.js.map +0 -1
  65. package/build/chunk-4JP2XRKG.js.map +0 -1
  66. package/build/chunk-FOKCY5BR.js.map +0 -1
  67. package/build/chunk-FTNALO4B.js.map +0 -1
  68. package/build/chunk-IJVKSYIY.js.map +0 -1
  69. package/build/chunk-MGPAOFO3.js.map +0 -1
  70. package/build/chunk-N6O7J2WO.js.map +0 -1
  71. package/build/platform-sdk/chunk-DGX4CFXG.js +0 -2
  72. package/build/platform-sdk/chunk-DGX4CFXG.js.map +0 -1
  73. package/build/platform-sdk/chunk-TN6HYRXL.js +0 -2
  74. package/build/platform-sdk/chunk-TN6HYRXL.js.map +0 -1
  75. package/build/preview-C7XYH7BB.js.map +0 -1
  76. /package/build/{CreateVersionCommand-AIXBHCYB.js.map → CreateVersionCommand-6HJGN4WS.js.map} +0 -0
  77. /package/build/{LogsCommand-Q2HRBR6G.js.map → LogsCommand-ECPZQ3LE.js.map} +0 -0
  78. /package/build/{PreviewCommand-XBSTVGWT.js.map → PreviewCommand-ZQ3OUOKW.js.map} +0 -0
  79. /package/build/{ServeCommand-ZEXPLXTI.js.map → ServeCommand-I65XXTLM.js.map} +0 -0
  80. /package/build/{chunk-XQ2F7ZVH.js.map → chunk-4JDHJDA5.js.map} +0 -0
  81. /package/build/{chunk-2BYVOUAH.js.map → chunk-ACN6EZGH.js.map} +0 -0
  82. /package/build/{chunk-QG2TLAMS.js.map → chunk-BNROT2BN.js.map} +0 -0
  83. /package/build/{chunk-Y6SGP7TM.js.map → chunk-EZLVJJON.js.map} +0 -0
  84. /package/build/{chunk-JZVNLHD3.js.map → chunk-FHMCCDCY.js.map} +0 -0
  85. /package/build/{chunk-6A37LXDJ.js.map → chunk-IDWDZWLM.js.map} +0 -0
  86. /package/build/{chunk-F2XRLYHS.js.map → chunk-OCC6MO6R.js.map} +0 -0
  87. /package/build/{chunk-77XREOLU.js.map → chunk-PAWIUC26.js.map} +0 -0
  88. /package/build/{chunk-BMVZ7QCF.js.map → chunk-QW4WBWJK.js.map} +0 -0
  89. /package/build/{chunk-2GIVAXZY.js.map → chunk-U72IPCQR.js.map} +0 -0
  90. /package/build/{chunk-HL4K6RV3.js.map → chunk-W4HI7DI3.js.map} +0 -0
  91. /package/build/{chunk-2CUJME55.js.map → chunk-ZJYRE4BT.js.map} +0 -0
  92. /package/build/{render-command-BMSK4YLL.js.map → render-command-UKYXN7C7.js.map} +0 -0
@@ -11518,7 +11518,7 @@ var init_tslib_es6 = __esm({
11518
11518
  });
11519
11519
 
11520
11520
  // package.json
11521
- var version = "1.1.57";
11521
+ var version = "1.1.59";
11522
11522
 
11523
11523
  // ../cli-error/src/cli-error.ts
11524
11524
  init_esm_shims();
@@ -11608,6 +11608,7 @@ var CliSystemErrorCode = (0, import_variant.variant)({
11608
11608
  TypeErrorInvalidUrl: {},
11609
11609
  FailedToGenerateSelfsignedCertificate: {},
11610
11610
  FailedToResolveViteOrigin: {},
11611
+ AppReleaseConfigViolations: (0, import_variant.fields)(),
11611
11612
  FailedToCreateAppRelease: {},
11612
11613
  FailedToUpdateAppRelease: {},
11613
11614
  FailedToCreateComponents: {},
@@ -11722,7 +11723,12 @@ var CliUserErrorCode = (0, import_variant.variant)({
11722
11723
  FailedToGetSiteFsManagerCode: {},
11723
11724
  FailedToGetSiteFsManagerDocument: {},
11724
11725
  FailedToApplySiteFsManagerFsUpdates: {},
11725
- FailedToApplySiteFsManagerExternalUpdates: {}
11726
+ FailedToApplySiteFsManagerExternalUpdates: {},
11727
+ CannotReleaseApplicationInReview: {},
11728
+ FailedToCreateIntellisenseAdapter: {},
11729
+ FailedToInitIntellisenseAdapterTypes: {},
11730
+ FailedToUpdateIntellisenseAdapterTypes: {},
11731
+ WebMethodOutsideOfProjectDirectory: (0, import_variant.fields)()
11726
11732
  });
11727
11733
  var CliErrorCode = (0, import_variant.variant)({
11728
11734
  ...CliSystemErrorCode,
@@ -16739,6 +16745,9 @@ var quotelessJson = (obj) => {
16739
16745
  return json.replace(/"([^"]+)":/g, "$1:");
16740
16746
  };
16741
16747
  var ZodError = class _ZodError extends Error {
16748
+ get errors() {
16749
+ return this.issues;
16750
+ }
16742
16751
  constructor(issues) {
16743
16752
  super();
16744
16753
  this.issues = [];
@@ -16757,9 +16766,6 @@ var ZodError = class _ZodError extends Error {
16757
16766
  this.name = "ZodError";
16758
16767
  this.issues = issues;
16759
16768
  }
16760
- get errors() {
16761
- return this.issues;
16762
- }
16763
16769
  format(_mapper) {
16764
16770
  const mapper = _mapper || function(issue) {
16765
16771
  return issue.message;
@@ -16970,8 +16976,11 @@ function addIssueToContext(ctx, issueData) {
16970
16976
  path: ctx.path,
16971
16977
  errorMaps: [
16972
16978
  ctx.common.contextualErrorMap,
16979
+ // contextual error map is first priority
16973
16980
  ctx.schemaErrorMap,
16981
+ // then schema-bound map if available
16974
16982
  overrideMap,
16983
+ // then global override map
16975
16984
  overrideMap === errorMap ? void 0 : errorMap
16976
16985
  // then global default map
16977
16986
  ].filter((x) => !!x)
@@ -17122,34 +17131,6 @@ function processCreateParams(params) {
17122
17131
  return { errorMap: customMap, description };
17123
17132
  }
17124
17133
  var ZodType = class {
17125
- constructor(def) {
17126
- this.spa = this.safeParseAsync;
17127
- this._def = def;
17128
- this.parse = this.parse.bind(this);
17129
- this.safeParse = this.safeParse.bind(this);
17130
- this.parseAsync = this.parseAsync.bind(this);
17131
- this.safeParseAsync = this.safeParseAsync.bind(this);
17132
- this.spa = this.spa.bind(this);
17133
- this.refine = this.refine.bind(this);
17134
- this.refinement = this.refinement.bind(this);
17135
- this.superRefine = this.superRefine.bind(this);
17136
- this.optional = this.optional.bind(this);
17137
- this.nullable = this.nullable.bind(this);
17138
- this.nullish = this.nullish.bind(this);
17139
- this.array = this.array.bind(this);
17140
- this.promise = this.promise.bind(this);
17141
- this.or = this.or.bind(this);
17142
- this.and = this.and.bind(this);
17143
- this.transform = this.transform.bind(this);
17144
- this.brand = this.brand.bind(this);
17145
- this.default = this.default.bind(this);
17146
- this.catch = this.catch.bind(this);
17147
- this.describe = this.describe.bind(this);
17148
- this.pipe = this.pipe.bind(this);
17149
- this.readonly = this.readonly.bind(this);
17150
- this.isNullable = this.isNullable.bind(this);
17151
- this.isOptional = this.isOptional.bind(this);
17152
- }
17153
17134
  get description() {
17154
17135
  return this._def.description;
17155
17136
  }
@@ -17213,6 +17194,43 @@ var ZodType = class {
17213
17194
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
17214
17195
  return handleResult(ctx, result);
17215
17196
  }
17197
+ "~validate"(data) {
17198
+ var _a2, _b;
17199
+ const ctx = {
17200
+ common: {
17201
+ issues: [],
17202
+ async: !!this["~standard"].async
17203
+ },
17204
+ path: [],
17205
+ schemaErrorMap: this._def.errorMap,
17206
+ parent: null,
17207
+ data,
17208
+ parsedType: getParsedType(data)
17209
+ };
17210
+ if (!this["~standard"].async) {
17211
+ try {
17212
+ const result = this._parseSync({ data, path: [], parent: ctx });
17213
+ return isValid(result) ? {
17214
+ value: result.value
17215
+ } : {
17216
+ issues: ctx.common.issues
17217
+ };
17218
+ } catch (err) {
17219
+ if ((_b = (_a2 = err === null || err === void 0 ? void 0 : err.message) === null || _a2 === void 0 ? void 0 : _a2.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
17220
+ this["~standard"].async = true;
17221
+ }
17222
+ ctx.common = {
17223
+ issues: [],
17224
+ async: true
17225
+ };
17226
+ }
17227
+ }
17228
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
17229
+ value: result.value
17230
+ } : {
17231
+ issues: ctx.common.issues
17232
+ });
17233
+ }
17216
17234
  async parseAsync(data, params) {
17217
17235
  const result = await this.safeParseAsync(data, params);
17218
17236
  if (result.success)
@@ -17290,6 +17308,39 @@ var ZodType = class {
17290
17308
  superRefine(refinement) {
17291
17309
  return this._refinement(refinement);
17292
17310
  }
17311
+ constructor(def) {
17312
+ this.spa = this.safeParseAsync;
17313
+ this._def = def;
17314
+ this.parse = this.parse.bind(this);
17315
+ this.safeParse = this.safeParse.bind(this);
17316
+ this.parseAsync = this.parseAsync.bind(this);
17317
+ this.safeParseAsync = this.safeParseAsync.bind(this);
17318
+ this.spa = this.spa.bind(this);
17319
+ this.refine = this.refine.bind(this);
17320
+ this.refinement = this.refinement.bind(this);
17321
+ this.superRefine = this.superRefine.bind(this);
17322
+ this.optional = this.optional.bind(this);
17323
+ this.nullable = this.nullable.bind(this);
17324
+ this.nullish = this.nullish.bind(this);
17325
+ this.array = this.array.bind(this);
17326
+ this.promise = this.promise.bind(this);
17327
+ this.or = this.or.bind(this);
17328
+ this.and = this.and.bind(this);
17329
+ this.transform = this.transform.bind(this);
17330
+ this.brand = this.brand.bind(this);
17331
+ this.default = this.default.bind(this);
17332
+ this.catch = this.catch.bind(this);
17333
+ this.describe = this.describe.bind(this);
17334
+ this.pipe = this.pipe.bind(this);
17335
+ this.readonly = this.readonly.bind(this);
17336
+ this.isNullable = this.isNullable.bind(this);
17337
+ this.isOptional = this.isOptional.bind(this);
17338
+ this["~standard"] = {
17339
+ version: 1,
17340
+ vendor: "zod",
17341
+ validate: (data) => this["~validate"](data)
17342
+ };
17343
+ }
17293
17344
  optional() {
17294
17345
  return ZodOptional.create(this, this._def);
17295
17346
  }
@@ -17300,7 +17351,7 @@ var ZodType = class {
17300
17351
  return this.nullable().optional();
17301
17352
  }
17302
17353
  array() {
17303
- return ZodArray.create(this, this._def);
17354
+ return ZodArray.create(this);
17304
17355
  }
17305
17356
  promise() {
17306
17357
  return ZodPromise.create(this, this._def);
@@ -17366,16 +17417,20 @@ var ZodType = class {
17366
17417
  };
17367
17418
  var cuidRegex = /^c[^\s-]{8,}$/i;
17368
17419
  var cuid2Regex = /^[0-9a-z]+$/;
17369
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
17420
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
17370
17421
  var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
17371
17422
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
17423
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
17372
17424
  var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
17373
17425
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
17374
17426
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
17375
17427
  var emojiRegex3;
17376
17428
  var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
17377
- var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
17429
+ var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
17430
+ var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
17431
+ var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
17378
17432
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
17433
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
17379
17434
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
17380
17435
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
17381
17436
  function timeRegexSource(args) {
@@ -17408,6 +17463,33 @@ function isValidIP(ip, version2) {
17408
17463
  }
17409
17464
  return false;
17410
17465
  }
17466
+ function isValidJWT(jwt, alg) {
17467
+ if (!jwtRegex.test(jwt))
17468
+ return false;
17469
+ try {
17470
+ const [header] = jwt.split(".");
17471
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
17472
+ const decoded = JSON.parse(atob(base64));
17473
+ if (typeof decoded !== "object" || decoded === null)
17474
+ return false;
17475
+ if (!decoded.typ || !decoded.alg)
17476
+ return false;
17477
+ if (alg && decoded.alg !== alg)
17478
+ return false;
17479
+ return true;
17480
+ } catch (_a2) {
17481
+ return false;
17482
+ }
17483
+ }
17484
+ function isValidCidr(ip, version2) {
17485
+ if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
17486
+ return true;
17487
+ }
17488
+ if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
17489
+ return true;
17490
+ }
17491
+ return false;
17492
+ }
17411
17493
  var ZodString = class _ZodString extends ZodType {
17412
17494
  _parse(input) {
17413
17495
  if (this._def.coerce) {
@@ -17664,6 +17746,26 @@ var ZodString = class _ZodString extends ZodType {
17664
17746
  });
17665
17747
  status.dirty();
17666
17748
  }
17749
+ } else if (check.kind === "jwt") {
17750
+ if (!isValidJWT(input.data, check.alg)) {
17751
+ ctx = this._getOrReturnCtx(input, ctx);
17752
+ addIssueToContext(ctx, {
17753
+ validation: "jwt",
17754
+ code: ZodIssueCode.invalid_string,
17755
+ message: check.message
17756
+ });
17757
+ status.dirty();
17758
+ }
17759
+ } else if (check.kind === "cidr") {
17760
+ if (!isValidCidr(input.data, check.version)) {
17761
+ ctx = this._getOrReturnCtx(input, ctx);
17762
+ addIssueToContext(ctx, {
17763
+ validation: "cidr",
17764
+ code: ZodIssueCode.invalid_string,
17765
+ message: check.message
17766
+ });
17767
+ status.dirty();
17768
+ }
17667
17769
  } else if (check.kind === "base64") {
17668
17770
  if (!base64Regex.test(input.data)) {
17669
17771
  ctx = this._getOrReturnCtx(input, ctx);
@@ -17674,6 +17776,16 @@ var ZodString = class _ZodString extends ZodType {
17674
17776
  });
17675
17777
  status.dirty();
17676
17778
  }
17779
+ } else if (check.kind === "base64url") {
17780
+ if (!base64urlRegex.test(input.data)) {
17781
+ ctx = this._getOrReturnCtx(input, ctx);
17782
+ addIssueToContext(ctx, {
17783
+ validation: "base64url",
17784
+ code: ZodIssueCode.invalid_string,
17785
+ message: check.message
17786
+ });
17787
+ status.dirty();
17788
+ }
17677
17789
  } else {
17678
17790
  util.assertNever(check);
17679
17791
  }
@@ -17720,9 +17832,21 @@ var ZodString = class _ZodString extends ZodType {
17720
17832
  base64(message) {
17721
17833
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
17722
17834
  }
17835
+ base64url(message) {
17836
+ return this._addCheck({
17837
+ kind: "base64url",
17838
+ ...errorUtil.errToObj(message)
17839
+ });
17840
+ }
17841
+ jwt(options) {
17842
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
17843
+ }
17723
17844
  ip(options) {
17724
17845
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
17725
17846
  }
17847
+ cidr(options) {
17848
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
17849
+ }
17726
17850
  datetime(options) {
17727
17851
  var _a2, _b;
17728
17852
  if (typeof options === "string") {
@@ -17813,8 +17937,7 @@ var ZodString = class _ZodString extends ZodType {
17813
17937
  });
17814
17938
  }
17815
17939
  /**
17816
- * @deprecated Use z.string().min(1) instead.
17817
- * @see {@link ZodString.min}
17940
+ * Equivalent to `.min(1)`
17818
17941
  */
17819
17942
  nonempty(message) {
17820
17943
  return this.min(1, errorUtil.errToObj(message));
@@ -17876,9 +17999,15 @@ var ZodString = class _ZodString extends ZodType {
17876
17999
  get isIP() {
17877
18000
  return !!this._def.checks.find((ch) => ch.kind === "ip");
17878
18001
  }
18002
+ get isCIDR() {
18003
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
18004
+ }
17879
18005
  get isBase64() {
17880
18006
  return !!this._def.checks.find((ch) => ch.kind === "base64");
17881
18007
  }
18008
+ get isBase64url() {
18009
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
18010
+ }
17882
18011
  get minLength() {
17883
18012
  let min = null;
17884
18013
  for (const ch of this._def.checks) {
@@ -18156,17 +18285,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
18156
18285
  }
18157
18286
  _parse(input) {
18158
18287
  if (this._def.coerce) {
18159
- input.data = BigInt(input.data);
18288
+ try {
18289
+ input.data = BigInt(input.data);
18290
+ } catch (_a2) {
18291
+ return this._getInvalidInput(input);
18292
+ }
18160
18293
  }
18161
18294
  const parsedType = this._getType(input);
18162
18295
  if (parsedType !== ZodParsedType.bigint) {
18163
- const ctx2 = this._getOrReturnCtx(input);
18164
- addIssueToContext(ctx2, {
18165
- code: ZodIssueCode.invalid_type,
18166
- expected: ZodParsedType.bigint,
18167
- received: ctx2.parsedType
18168
- });
18169
- return INVALID;
18296
+ return this._getInvalidInput(input);
18170
18297
  }
18171
18298
  let ctx = void 0;
18172
18299
  const status = new ParseStatus();
@@ -18213,6 +18340,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
18213
18340
  }
18214
18341
  return { status: status.value, value: input.data };
18215
18342
  }
18343
+ _getInvalidInput(input) {
18344
+ const ctx = this._getOrReturnCtx(input);
18345
+ addIssueToContext(ctx, {
18346
+ code: ZodIssueCode.invalid_type,
18347
+ expected: ZodParsedType.bigint,
18348
+ received: ctx.parsedType
18349
+ });
18350
+ return INVALID;
18351
+ }
18216
18352
  gte(value2, message) {
18217
18353
  return this.setLimit("min", value2, true, errorUtil.toString(message));
18218
18354
  }
@@ -22147,20 +22283,18 @@ terminalLink.stderr = (text, url, options = {}) => terminalLink(text, url, { tar
22147
22283
  terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
22148
22284
 
22149
22285
  // ../cli-ui-kit/src/components/Link.tsx
22150
- var Link = ({
22151
- skin,
22152
- children,
22153
- url,
22154
- transform = (v) => v
22155
- }) => {
22286
+ var Link = ({ skin, children, url }) => {
22156
22287
  if (children) {
22157
- return /* @__PURE__ */ import_react55.default.createElement(
22158
- Transform,
22159
- {
22160
- transform: (children2) => transform(terminalLink(children2, url, { fallback: true }))
22161
- },
22162
- /* @__PURE__ */ import_react55.default.createElement(Text2, { skin }, children)
22163
- );
22288
+ if (terminalLink.isSupported) {
22289
+ return /* @__PURE__ */ import_react55.default.createElement(
22290
+ Transform,
22291
+ {
22292
+ transform: (childrenAsString) => terminalLink(childrenAsString, url, { fallback: false })
22293
+ },
22294
+ /* @__PURE__ */ import_react55.default.createElement(Text2, { skin }, children)
22295
+ );
22296
+ }
22297
+ return /* @__PURE__ */ import_react55.default.createElement(Text2, null, /* @__PURE__ */ import_react55.default.createElement(Text2, { skin }, children), " (", url, ")");
22164
22298
  }
22165
22299
  return /* @__PURE__ */ import_react55.default.createElement(Text2, { skin: "info" }, url);
22166
22300
  };
@@ -22209,13 +22343,30 @@ var ErrorDetails = ({
22209
22343
  hint
22210
22344
  }) => /* @__PURE__ */ import_react58.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react58.default.createElement(Alert, { type: "error" }, message), explanation && /* @__PURE__ */ import_react58.default.createElement(Alert, { type: "warning" }, explanation), hint && /* @__PURE__ */ import_react58.default.createElement(Box_default, { paddingTop: 1 }, /* @__PURE__ */ import_react58.default.createElement(Alert, { type: "insight" }, hint)));
22211
22345
 
22346
+ // ../cli-ui-kit/src/components/Notification.tsx
22347
+ init_esm_shims();
22348
+ var import_react59 = __toESM(require_react(), 1);
22349
+ var Notification = ({ children }) => {
22350
+ return /* @__PURE__ */ import_react59.default.createElement(Box_default, null, /* @__PURE__ */ import_react59.default.createElement(
22351
+ Box_default,
22352
+ {
22353
+ padding: 1,
22354
+ alignItems: "center",
22355
+ flexDirection: "column",
22356
+ borderColor: "yellowBright",
22357
+ borderStyle: "round"
22358
+ },
22359
+ children
22360
+ ));
22361
+ };
22362
+
22212
22363
  // ../cli-ui-kit/src/hooks/use-async.ts
22213
22364
  init_esm_shims();
22214
22365
  var import_variant14 = __toESM(require_lib(), 1);
22215
22366
 
22216
22367
  // ../../node_modules/react-async-hook/dist/react-async-hook.esm.js
22217
22368
  init_esm_shims();
22218
- var import_react59 = __toESM(require_react());
22369
+ var import_react60 = __toESM(require_react());
22219
22370
  function _extends() {
22220
22371
  _extends = Object.assign || function(target) {
22221
22372
  for (var i2 = 1; i2 < arguments.length; i2++) {
@@ -22232,13 +22383,13 @@ function _extends() {
22232
22383
  }
22233
22384
  var _iteratorSymbol = typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
22234
22385
  var _asyncIteratorSymbol = typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
22235
- var useIsomorphicLayoutEffect = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? import_react59.useLayoutEffect : import_react59.useEffect;
22386
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? import_react60.useLayoutEffect : import_react60.useEffect;
22236
22387
  var useGetter = function useGetter2(t3) {
22237
- var ref = (0, import_react59.useRef)(t3);
22388
+ var ref = (0, import_react60.useRef)(t3);
22238
22389
  useIsomorphicLayoutEffect(function() {
22239
22390
  ref.current = t3;
22240
22391
  });
22241
- return (0, import_react59.useCallback)(function() {
22392
+ return (0, import_react60.useCallback)(function() {
22242
22393
  return ref.current;
22243
22394
  }, [ref]);
22244
22395
  };
@@ -22291,22 +22442,22 @@ var normalizeOptions = function normalizeOptions2(options) {
22291
22442
  return _extends({}, DefaultOptions, {}, options);
22292
22443
  };
22293
22444
  var useAsyncState = function useAsyncState2(options) {
22294
- var _useState = (0, import_react59.useState)(function() {
22445
+ var _useState = (0, import_react60.useState)(function() {
22295
22446
  return options.initialState(options);
22296
22447
  }), value2 = _useState[0], setValue = _useState[1];
22297
- var reset = (0, import_react59.useCallback)(function() {
22448
+ var reset = (0, import_react60.useCallback)(function() {
22298
22449
  return setValue(options.initialState(options));
22299
22450
  }, [setValue, options]);
22300
- var setLoading = (0, import_react59.useCallback)(function() {
22451
+ var setLoading = (0, import_react60.useCallback)(function() {
22301
22452
  return setValue(options.setLoading(value2));
22302
22453
  }, [value2, setValue]);
22303
- var setResult = (0, import_react59.useCallback)(function(result) {
22454
+ var setResult = (0, import_react60.useCallback)(function(result) {
22304
22455
  return setValue(options.setResult(result, value2));
22305
22456
  }, [value2, setValue]);
22306
- var setError = (0, import_react59.useCallback)(function(error) {
22457
+ var setError = (0, import_react60.useCallback)(function(error) {
22307
22458
  return setValue(options.setError(error, value2));
22308
22459
  }, [value2, setValue]);
22309
- var merge = (0, import_react59.useCallback)(function(state) {
22460
+ var merge = (0, import_react60.useCallback)(function(state) {
22310
22461
  return setValue(_extends({}, value2, {}, state));
22311
22462
  }, [value2, setValue]);
22312
22463
  return {
@@ -22320,8 +22471,8 @@ var useAsyncState = function useAsyncState2(options) {
22320
22471
  };
22321
22472
  };
22322
22473
  var useIsMounted = function useIsMounted2() {
22323
- var ref = (0, import_react59.useRef)(false);
22324
- (0, import_react59.useEffect)(function() {
22474
+ var ref = (0, import_react60.useRef)(false);
22475
+ (0, import_react60.useEffect)(function() {
22325
22476
  ref.current = true;
22326
22477
  return function() {
22327
22478
  ref.current = false;
@@ -22332,7 +22483,7 @@ var useIsMounted = function useIsMounted2() {
22332
22483
  };
22333
22484
  };
22334
22485
  var useCurrentPromise = function useCurrentPromise2() {
22335
- var ref = (0, import_react59.useRef)(null);
22486
+ var ref = (0, import_react60.useRef)(null);
22336
22487
  return {
22337
22488
  set: function set(promise) {
22338
22489
  return ref.current = promise;
@@ -22348,7 +22499,7 @@ var useCurrentPromise = function useCurrentPromise2() {
22348
22499
  var useAsyncInternal = function useAsyncInternal2(asyncFunction, params, options) {
22349
22500
  !params && (params = []);
22350
22501
  var normalizedOptions = normalizeOptions(options);
22351
- var _useState2 = (0, import_react59.useState)(null), currentParams = _useState2[0], setCurrentParams = _useState2[1];
22502
+ var _useState2 = (0, import_react60.useState)(null), currentParams = _useState2[0], setCurrentParams = _useState2[1];
22352
22503
  var AsyncState = useAsyncState(normalizedOptions);
22353
22504
  var isMounted = useIsMounted();
22354
22505
  var CurrentPromise = useCurrentPromise();
@@ -22391,11 +22542,11 @@ var useAsyncInternal = function useAsyncInternal2(asyncFunction, params, options
22391
22542
  return promise;
22392
22543
  };
22393
22544
  var getLatestExecuteAsyncOperation = useGetter(executeAsyncOperation);
22394
- var executeAsyncOperationMemo = (0, import_react59.useCallback)(function() {
22545
+ var executeAsyncOperationMemo = (0, import_react60.useCallback)(function() {
22395
22546
  return getLatestExecuteAsyncOperation().apply(void 0, arguments);
22396
22547
  }, [getLatestExecuteAsyncOperation]);
22397
22548
  var isMounting = !isMounted();
22398
- (0, import_react59.useEffect)(function() {
22549
+ (0, import_react60.useEffect)(function() {
22399
22550
  var execute = function execute2() {
22400
22551
  return getLatestExecuteAsyncOperation().apply(void 0, params);
22401
22552
  };
@@ -22428,7 +22579,7 @@ var useAsyncCallback = function useAsyncCallback2(asyncFunction, options) {
22428
22579
  };
22429
22580
 
22430
22581
  // ../cli-ui-kit/src/hooks/use-async.ts
22431
- var import_react60 = __toESM(require_react(), 1);
22582
+ var import_react61 = __toESM(require_react(), 1);
22432
22583
  var AsyncStatus = (0, import_variant14.variant)(
22433
22584
  (0, import_variant14.onTerms)(({ T: _T }) => ({
22434
22585
  Error: (error) => ({ error }),
@@ -22446,7 +22597,7 @@ var AsyncCallbackStatus = (0, import_variant14.variant)(
22446
22597
  );
22447
22598
  var useAsync2 = (fn, args, options) => {
22448
22599
  const exit = useExit();
22449
- const abortController = (0, import_react60.useMemo)(() => new AbortController(), []);
22600
+ const abortController = (0, import_react61.useMemo)(() => new AbortController(), []);
22450
22601
  const { result, error, status, merge } = useAsync(
22451
22602
  fn.bind(null, { signal: abortController.signal }),
22452
22603
  args,
@@ -22455,7 +22606,7 @@ var useAsync2 = (fn, args, options) => {
22455
22606
  ...options ?? {}
22456
22607
  }
22457
22608
  );
22458
- (0, import_react60.useEffect)(() => {
22609
+ (0, import_react61.useEffect)(() => {
22459
22610
  return () => {
22460
22611
  abortController.abort();
22461
22612
  };
@@ -22475,7 +22626,7 @@ var useAsync2 = (fn, args, options) => {
22475
22626
  };
22476
22627
  var useAsyncCallback3 = (fn, options) => {
22477
22628
  const exit = useExit();
22478
- const abortController = (0, import_react60.useMemo)(() => new AbortController(), []);
22629
+ const abortController = (0, import_react61.useMemo)(() => new AbortController(), []);
22479
22630
  const { result, error, status, merge, execute } = useAsyncCallback(
22480
22631
  fn.bind(null, { signal: abortController.signal }),
22481
22632
  {
@@ -22483,7 +22634,7 @@ var useAsyncCallback3 = (fn, options) => {
22483
22634
  ...options ?? {}
22484
22635
  }
22485
22636
  );
22486
- (0, import_react60.useEffect)(() => {
22637
+ (0, import_react61.useEffect)(() => {
22487
22638
  return () => {
22488
22639
  abortController.abort();
22489
22640
  };
@@ -22513,18 +22664,18 @@ var useAsyncCallback3 = (fn, options) => {
22513
22664
 
22514
22665
  // ../cli-i18n/src/I18nProvider.tsx
22515
22666
  init_esm_shims();
22516
- var import_react69 = __toESM(require_react(), 1);
22667
+ var import_react70 = __toESM(require_react(), 1);
22517
22668
 
22518
22669
  // ../../node_modules/react-i18next/dist/es/index.js
22519
22670
  init_esm_shims();
22520
22671
 
22521
22672
  // ../../node_modules/react-i18next/dist/es/Trans.js
22522
22673
  init_esm_shims();
22523
- var import_react63 = __toESM(require_react(), 1);
22674
+ var import_react64 = __toESM(require_react(), 1);
22524
22675
 
22525
22676
  // ../../node_modules/react-i18next/dist/es/TransWithoutContext.js
22526
22677
  init_esm_shims();
22527
- var import_react61 = __toESM(require_react(), 1);
22678
+ var import_react62 = __toESM(require_react(), 1);
22528
22679
 
22529
22680
  // ../../node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
22530
22681
  init_esm_shims();
@@ -22591,24 +22742,27 @@ var html_parse_stringify_module_default = c;
22591
22742
 
22592
22743
  // ../../node_modules/react-i18next/dist/es/utils.js
22593
22744
  init_esm_shims();
22594
- function warn() {
22595
- if (console && console.warn) {
22596
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22597
- args[_key] = arguments[_key];
22598
- }
22599
- if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
22745
+ var warn = (i18n, code, msg, rest) => {
22746
+ const args = [msg, {
22747
+ code,
22748
+ ...rest || {}
22749
+ }];
22750
+ if (i18n?.services?.logger?.forward) {
22751
+ return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
22752
+ }
22753
+ if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
22754
+ if (i18n?.services?.logger?.warn) {
22755
+ i18n.services.logger.warn(...args);
22756
+ } else if (console?.warn) {
22600
22757
  console.warn(...args);
22601
22758
  }
22602
- }
22759
+ };
22603
22760
  var alreadyWarned = {};
22604
- function warnOnce() {
22605
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
22606
- args[_key2] = arguments[_key2];
22607
- }
22608
- if (isString(args[0]) && alreadyWarned[args[0]]) return;
22609
- if (isString(args[0])) alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
22610
- warn(...args);
22611
- }
22761
+ var warnOnce = (i18n, code, msg, rest) => {
22762
+ if (isString(msg) && alreadyWarned[msg]) return;
22763
+ if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
22764
+ warn(i18n, code, msg, rest);
22765
+ };
22612
22766
  var loadedClb = (i18n, cb) => () => {
22613
22767
  if (i18n.isInitialized) {
22614
22768
  cb();
@@ -22627,41 +22781,23 @@ var loadNamespaces = (i18n, ns, cb) => {
22627
22781
  };
22628
22782
  var loadLanguages = (i18n, lng, ns, cb) => {
22629
22783
  if (isString(ns)) ns = [ns];
22784
+ if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
22630
22785
  ns.forEach((n2) => {
22631
22786
  if (i18n.options.ns.indexOf(n2) < 0) i18n.options.ns.push(n2);
22632
22787
  });
22633
22788
  i18n.loadLanguages(lng, loadedClb(i18n, cb));
22634
22789
  };
22635
- var oldI18nextHasLoadedNamespace = function(ns, i18n) {
22636
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
22637
- const lng = i18n.languages[0];
22638
- const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
22639
- const lastLng = i18n.languages[i18n.languages.length - 1];
22640
- if (lng.toLowerCase() === "cimode") return true;
22641
- const loadNotPending = (l, n2) => {
22642
- const loadState = i18n.services.backendConnector.state[`${l}|${n2}`];
22643
- return loadState === -1 || loadState === 2;
22644
- };
22645
- if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
22646
- if (i18n.hasResourceBundle(lng, ns)) return true;
22647
- if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
22648
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
22649
- return false;
22650
- };
22651
- var hasLoadedNamespace = function(ns, i18n) {
22652
- let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
22790
+ var hasLoadedNamespace = (ns, i18n, options = {}) => {
22653
22791
  if (!i18n.languages || !i18n.languages.length) {
22654
- warnOnce("i18n.languages were undefined or empty", i18n.languages);
22792
+ warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
22793
+ languages: i18n.languages
22794
+ });
22655
22795
  return true;
22656
22796
  }
22657
- const isNewerI18next = i18n.options.ignoreJSONStructure !== void 0;
22658
- if (!isNewerI18next) {
22659
- return oldI18nextHasLoadedNamespace(ns, i18n, options);
22660
- }
22661
22797
  return i18n.hasLoadedNamespace(ns, {
22662
22798
  lng: options.lng,
22663
22799
  precheck: (i18nInstance2, loadNotPending) => {
22664
- if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
22800
+ if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
22665
22801
  }
22666
22802
  });
22667
22803
  };
@@ -22710,8 +22846,7 @@ var defaultOptions = {
22710
22846
  useSuspense: true,
22711
22847
  unescape
22712
22848
  };
22713
- var setDefaults = function() {
22714
- let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
22849
+ var setDefaults = (options = {}) => {
22715
22850
  defaultOptions = {
22716
22851
  ...defaultOptions,
22717
22852
  ...options
@@ -22730,16 +22865,16 @@ var getI18n = () => i18nInstance;
22730
22865
  // ../../node_modules/react-i18next/dist/es/TransWithoutContext.js
22731
22866
  var hasChildren = (node, checkLength) => {
22732
22867
  if (!node) return false;
22733
- const base = node.props ? node.props.children : node.children;
22868
+ const base = node.props?.children ?? node.children;
22734
22869
  if (checkLength) return base.length > 0;
22735
22870
  return !!base;
22736
22871
  };
22737
22872
  var getChildren = (node) => {
22738
22873
  if (!node) return [];
22739
- const children = node.props ? node.props.children : node.children;
22740
- return node.props && node.props.i18nIsDynamicList ? getAsArray(children) : children;
22874
+ const children = node.props?.children ?? node.children;
22875
+ return node.props?.i18nIsDynamicList ? getAsArray(children) : children;
22741
22876
  };
22742
- var hasValidReactChildren = (children) => Array.isArray(children) && children.every(import_react61.isValidElement);
22877
+ var hasValidReactChildren = (children) => Array.isArray(children) && children.every(import_react62.isValidElement);
22743
22878
  var getAsArray = (data) => Array.isArray(data) ? data : [data];
22744
22879
  var mergeProps = (source, target) => {
22745
22880
  const newTarget = {
@@ -22748,15 +22883,17 @@ var mergeProps = (source, target) => {
22748
22883
  newTarget.props = Object.assign(source.props, target.props);
22749
22884
  return newTarget;
22750
22885
  };
22751
- var nodesToString = (children, i18nOptions) => {
22886
+ var nodesToString = (children, i18nOptions, i18n, i18nKey) => {
22752
22887
  if (!children) return "";
22753
22888
  let stringNode = "";
22754
22889
  const childrenArray = getAsArray(children);
22755
- const keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
22890
+ const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : [];
22756
22891
  childrenArray.forEach((child, childIndex) => {
22757
22892
  if (isString(child)) {
22758
22893
  stringNode += `${child}`;
22759
- } else if ((0, import_react61.isValidElement)(child)) {
22894
+ return;
22895
+ }
22896
+ if ((0, import_react62.isValidElement)(child)) {
22760
22897
  const {
22761
22898
  props,
22762
22899
  type
@@ -22766,17 +22903,27 @@ var nodesToString = (children, i18nOptions) => {
22766
22903
  const childChildren = props.children;
22767
22904
  if (!childChildren && shouldKeepChild && !childPropsCount) {
22768
22905
  stringNode += `<${type}/>`;
22769
- } else if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) {
22906
+ return;
22907
+ }
22908
+ if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) {
22770
22909
  stringNode += `<${childIndex}></${childIndex}>`;
22771
- } else if (shouldKeepChild && childPropsCount === 1 && isString(childChildren)) {
22910
+ return;
22911
+ }
22912
+ if (shouldKeepChild && childPropsCount === 1 && isString(childChildren)) {
22772
22913
  stringNode += `<${type}>${childChildren}</${type}>`;
22773
- } else {
22774
- const content = nodesToString(childChildren, i18nOptions);
22775
- stringNode += `<${childIndex}>${content}</${childIndex}>`;
22914
+ return;
22776
22915
  }
22777
- } else if (child === null) {
22778
- warn(`Trans: the passed in value is invalid - seems you passed in a null child.`);
22779
- } else if (isObject(child)) {
22916
+ const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey);
22917
+ stringNode += `<${childIndex}>${content}</${childIndex}>`;
22918
+ return;
22919
+ }
22920
+ if (child === null) {
22921
+ warn(i18n, "TRANS_NULL_VALUE", `Passed in a null value as child`, {
22922
+ i18nKey
22923
+ });
22924
+ return;
22925
+ }
22926
+ if (isObject(child)) {
22780
22927
  const {
22781
22928
  format,
22782
22929
  ...clone
@@ -22785,12 +22932,18 @@ var nodesToString = (children, i18nOptions) => {
22785
22932
  if (keys.length === 1) {
22786
22933
  const value2 = format ? `${keys[0]}, ${format}` : keys[0];
22787
22934
  stringNode += `{{${value2}}}`;
22788
- } else {
22789
- warn(`react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.`, child);
22935
+ return;
22790
22936
  }
22791
- } else {
22792
- warn(`Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.`, child);
22937
+ warn(i18n, "TRANS_INVALID_OBJ", `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, {
22938
+ i18nKey,
22939
+ child
22940
+ });
22941
+ return;
22793
22942
  }
22943
+ warn(i18n, "TRANS_INVALID_VAR", `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, {
22944
+ i18nKey,
22945
+ child
22946
+ });
22794
22947
  });
22795
22948
  return stringNode;
22796
22949
  };
@@ -22805,7 +22958,7 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22805
22958
  childrenArray.forEach((child) => {
22806
22959
  if (isString(child)) return;
22807
22960
  if (hasChildren(child)) getData(getChildren(child));
22808
- else if (isObject(child) && !(0, import_react61.isValidElement)(child)) Object.assign(data, child);
22961
+ else if (isObject(child) && !(0, import_react62.isValidElement)(child)) Object.assign(data, child);
22809
22962
  });
22810
22963
  };
22811
22964
  getData(children);
@@ -22817,21 +22970,21 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22817
22970
  const renderInner = (child, node, rootReactNode) => {
22818
22971
  const childs = getChildren(child);
22819
22972
  const mappedChildren = mapAST(childs, node.children, rootReactNode);
22820
- return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props && child.props.i18nIsDynamicList ? childs : mappedChildren;
22973
+ return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren;
22821
22974
  };
22822
22975
  const pushTranslatedJSX = (child, inner, mem, i2, isVoid) => {
22823
22976
  if (child.dummy) {
22824
22977
  child.children = inner;
22825
- mem.push((0, import_react61.cloneElement)(child, {
22978
+ mem.push((0, import_react62.cloneElement)(child, {
22826
22979
  key: i2
22827
22980
  }, isVoid ? void 0 : inner));
22828
22981
  } else {
22829
- mem.push(...import_react61.Children.map([child], (c2) => {
22982
+ mem.push(...import_react62.Children.map([child], (c2) => {
22830
22983
  const props = {
22831
22984
  ...c2.props
22832
22985
  };
22833
22986
  delete props.i18nIsDynamicList;
22834
- return (0, import_react61.createElement)(c2.type, {
22987
+ return (0, import_react62.createElement)(c2.type, {
22835
22988
  ...props,
22836
22989
  key: i2,
22837
22990
  ref: c2.ref
@@ -22843,7 +22996,7 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22843
22996
  const reactNodes = getAsArray(reactNode);
22844
22997
  const astNodes = getAsArray(astNode);
22845
22998
  return astNodes.reduce((mem, node, i2) => {
22846
- const translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
22999
+ const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
22847
23000
  if (node.type === "tag") {
22848
23001
  let tmp = reactNodes[parseInt(node.name, 10)];
22849
23002
  if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name];
@@ -22851,7 +23004,7 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22851
23004
  const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
22852
23005
  props: node.attrs
22853
23006
  }, tmp) : tmp;
22854
- const isElement = (0, import_react61.isValidElement)(child);
23007
+ const isElement = (0, import_react62.isValidElement)(child);
22855
23008
  const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
22856
23009
  const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && isObject(child) && child.dummy && !isElement;
22857
23010
  const isKnownComponent = isObject(children) && Object.hasOwnProperty.call(children, node.name);
@@ -22870,12 +23023,12 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22870
23023
  pushTranslatedJSX(child, inner, mem, i2, node.voidElement);
22871
23024
  } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
22872
23025
  if (node.voidElement) {
22873
- mem.push((0, import_react61.createElement)(node.name, {
23026
+ mem.push((0, import_react62.createElement)(node.name, {
22874
23027
  key: `${node.name}-${i2}`
22875
23028
  }));
22876
23029
  } else {
22877
23030
  const inner = mapAST(reactNodes, node.children, rootReactNode);
22878
- mem.push((0, import_react61.createElement)(node.name, {
23031
+ mem.push((0, import_react62.createElement)(node.name, {
22879
23032
  key: `${node.name}-${i2}`
22880
23033
  }, inner));
22881
23034
  }
@@ -22895,7 +23048,7 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22895
23048
  const wrapTextNodes = i18nOptions.transWrapTextNodes;
22896
23049
  const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
22897
23050
  if (wrapTextNodes) {
22898
- mem.push((0, import_react61.createElement)(wrapTextNodes, {
23051
+ mem.push((0, import_react62.createElement)(wrapTextNodes, {
22899
23052
  key: `${node.name}-${i2}`
22900
23053
  }, content));
22901
23054
  } else {
@@ -22911,42 +23064,79 @@ var renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, sho
22911
23064
  }], ast, getAsArray(children || []));
22912
23065
  return getChildren(result[0]);
22913
23066
  };
22914
- function Trans(_ref) {
22915
- let {
22916
- children,
22917
- count,
22918
- parent,
22919
- i18nKey,
22920
- context,
22921
- tOptions = {},
22922
- values,
22923
- defaults: defaults2,
22924
- components,
22925
- ns,
22926
- i18n: i18nFromProps,
22927
- t: tFromProps,
22928
- shouldUnescape,
22929
- ...additionalProps
22930
- } = _ref;
23067
+ var fixComponentProps = (component, index, translation) => {
23068
+ const componentKey = component.key || index;
23069
+ const comp = (0, import_react62.cloneElement)(component, {
23070
+ key: componentKey
23071
+ });
23072
+ if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) {
23073
+ return comp;
23074
+ }
23075
+ function Componentized() {
23076
+ return (0, import_react62.createElement)(import_react62.Fragment, null, comp);
23077
+ }
23078
+ return (0, import_react62.createElement)(Componentized);
23079
+ };
23080
+ var generateArrayComponents = (components, translation) => components.map((c2, index) => fixComponentProps(c2, index, translation));
23081
+ var generateObjectComponents = (components, translation) => {
23082
+ const componentMap = {};
23083
+ Object.keys(components).forEach((c2) => {
23084
+ Object.assign(componentMap, {
23085
+ [c2]: fixComponentProps(components[c2], c2, translation)
23086
+ });
23087
+ });
23088
+ return componentMap;
23089
+ };
23090
+ var generateComponents = (components, translation, i18n, i18nKey) => {
23091
+ if (!components) return null;
23092
+ if (Array.isArray(components)) {
23093
+ return generateArrayComponents(components, translation);
23094
+ }
23095
+ if (isObject(components)) {
23096
+ return generateObjectComponents(components, translation);
23097
+ }
23098
+ warnOnce(i18n, "TRANS_INVALID_COMPONENTS", `<Trans /> "components" prop expects an object or array`, {
23099
+ i18nKey
23100
+ });
23101
+ return null;
23102
+ };
23103
+ function Trans({
23104
+ children,
23105
+ count,
23106
+ parent,
23107
+ i18nKey,
23108
+ context,
23109
+ tOptions = {},
23110
+ values,
23111
+ defaults: defaults2,
23112
+ components,
23113
+ ns,
23114
+ i18n: i18nFromProps,
23115
+ t: tFromProps,
23116
+ shouldUnescape,
23117
+ ...additionalProps
23118
+ }) {
22931
23119
  const i18n = i18nFromProps || getI18n();
22932
23120
  if (!i18n) {
22933
- warnOnce("You will need to pass in an i18next instance by using i18nextReactModule");
23121
+ warnOnce(i18n, "NO_I18NEXT_INSTANCE", `Trans: You need to pass in an i18next instance using i18nextReactModule`, {
23122
+ i18nKey
23123
+ });
22934
23124
  return children;
22935
23125
  }
22936
23126
  const t3 = tFromProps || i18n.t.bind(i18n) || ((k) => k);
22937
23127
  const reactI18nextOptions = {
22938
23128
  ...getDefaults(),
22939
- ...i18n.options && i18n.options.react
23129
+ ...i18n.options?.react
22940
23130
  };
22941
- let namespaces = ns || t3.ns || i18n.options && i18n.options.defaultNS;
23131
+ let namespaces = ns || t3.ns || i18n.options?.defaultNS;
22942
23132
  namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
22943
- const nodeAsString = nodesToString(children, reactI18nextOptions);
23133
+ const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey);
22944
23134
  const defaultValue = defaults2 || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey;
22945
23135
  const {
22946
23136
  hashTransKey
22947
23137
  } = reactI18nextOptions;
22948
23138
  const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue);
22949
- if (i18n.options && i18n.options.interpolation && i18n.options.interpolation.defaultVariables) {
23139
+ if (i18n.options?.interpolation?.defaultVariables) {
22950
23140
  values = values && Object.keys(values).length > 0 ? {
22951
23141
  ...values,
22952
23142
  ...i18n.options.interpolation.defaultVariables
@@ -22954,7 +23144,7 @@ function Trans(_ref) {
22954
23144
  ...i18n.options.interpolation.defaultVariables
22955
23145
  };
22956
23146
  }
22957
- const interpolationOverride = values || count !== void 0 || !children ? tOptions.interpolation : {
23147
+ const interpolationOverride = values || count !== void 0 && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : {
22958
23148
  interpolation: {
22959
23149
  ...tOptions.interpolation,
22960
23150
  prefix: "#$?",
@@ -22971,24 +23161,15 @@ function Trans(_ref) {
22971
23161
  ns: namespaces
22972
23162
  };
22973
23163
  const translation = key ? t3(key, combinedTOpts) : defaultValue;
22974
- if (components) {
22975
- Object.keys(components).forEach((c2) => {
22976
- const comp = components[c2];
22977
- if (typeof comp.type === "function" || !comp.props || !comp.props.children || translation.indexOf(`${c2}/>`) < 0 && translation.indexOf(`${c2} />`) < 0) return;
22978
- function Componentized() {
22979
- return (0, import_react61.createElement)(import_react61.Fragment, null, comp);
22980
- }
22981
- components[c2] = (0, import_react61.createElement)(Componentized);
22982
- });
22983
- }
22984
- const content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
22985
- const useAsParent = parent !== void 0 ? parent : reactI18nextOptions.defaultTransParent;
22986
- return useAsParent ? (0, import_react61.createElement)(useAsParent, additionalProps, content) : content;
23164
+ const generatedComponents = generateComponents(components, translation, i18n, i18nKey);
23165
+ const content = renderNodes(generatedComponents || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
23166
+ const useAsParent = parent ?? reactI18nextOptions.defaultTransParent;
23167
+ return useAsParent ? (0, import_react62.createElement)(useAsParent, additionalProps, content) : content;
22987
23168
  }
22988
23169
 
22989
23170
  // ../../node_modules/react-i18next/dist/es/context.js
22990
23171
  init_esm_shims();
22991
- var import_react62 = __toESM(require_react(), 1);
23172
+ var import_react63 = __toESM(require_react(), 1);
22992
23173
 
22993
23174
  // ../../node_modules/react-i18next/dist/es/initReactI18next.js
22994
23175
  init_esm_shims();
@@ -23001,7 +23182,7 @@ var initReactI18next = {
23001
23182
  };
23002
23183
 
23003
23184
  // ../../node_modules/react-i18next/dist/es/context.js
23004
- var I18nContext = (0, import_react62.createContext)();
23185
+ var I18nContext = (0, import_react63.createContext)();
23005
23186
  var ReportNamespaces = class {
23006
23187
  constructor() {
23007
23188
  this.usedNamespaces = {};
@@ -23011,33 +23192,34 @@ var ReportNamespaces = class {
23011
23192
  if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
23012
23193
  });
23013
23194
  }
23014
- getUsedNamespaces = () => Object.keys(this.usedNamespaces);
23195
+ getUsedNamespaces() {
23196
+ return Object.keys(this.usedNamespaces);
23197
+ }
23015
23198
  };
23016
23199
 
23017
23200
  // ../../node_modules/react-i18next/dist/es/Trans.js
23018
- function Trans2(_ref) {
23019
- let {
23020
- children,
23021
- count,
23022
- parent,
23023
- i18nKey,
23024
- context,
23025
- tOptions = {},
23026
- values,
23027
- defaults: defaults2,
23028
- components,
23029
- ns,
23030
- i18n: i18nFromProps,
23031
- t: tFromProps,
23032
- shouldUnescape,
23033
- ...additionalProps
23034
- } = _ref;
23201
+ function Trans2({
23202
+ children,
23203
+ count,
23204
+ parent,
23205
+ i18nKey,
23206
+ context,
23207
+ tOptions = {},
23208
+ values,
23209
+ defaults: defaults2,
23210
+ components,
23211
+ ns,
23212
+ i18n: i18nFromProps,
23213
+ t: tFromProps,
23214
+ shouldUnescape,
23215
+ ...additionalProps
23216
+ }) {
23035
23217
  const {
23036
23218
  i18n: i18nFromContext,
23037
23219
  defaultNS: defaultNSFromContext
23038
- } = (0, import_react63.useContext)(I18nContext) || {};
23220
+ } = (0, import_react64.useContext)(I18nContext) || {};
23039
23221
  const i18n = i18nFromProps || i18nFromContext || getI18n();
23040
- const t3 = tFromProps || i18n && i18n.t.bind(i18n);
23222
+ const t3 = tFromProps || i18n?.t.bind(i18n);
23041
23223
  return Trans({
23042
23224
  children,
23043
23225
  count,
@@ -23048,7 +23230,7 @@ function Trans2(_ref) {
23048
23230
  values,
23049
23231
  defaults: defaults2,
23050
23232
  components,
23051
- ns: ns || t3 && t3.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
23233
+ ns: ns || t3?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
23052
23234
  i18n,
23053
23235
  t: tFromProps,
23054
23236
  shouldUnescape,
@@ -23058,29 +23240,28 @@ function Trans2(_ref) {
23058
23240
 
23059
23241
  // ../../node_modules/react-i18next/dist/es/useTranslation.js
23060
23242
  init_esm_shims();
23061
- var import_react64 = __toESM(require_react(), 1);
23243
+ var import_react65 = __toESM(require_react(), 1);
23062
23244
  var usePrevious = (value2, ignore) => {
23063
- const ref = (0, import_react64.useRef)();
23064
- (0, import_react64.useEffect)(() => {
23245
+ const ref = (0, import_react65.useRef)();
23246
+ (0, import_react65.useEffect)(() => {
23065
23247
  ref.current = ignore ? ref.current : value2;
23066
23248
  }, [value2, ignore]);
23067
23249
  return ref.current;
23068
23250
  };
23069
23251
  var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
23070
- var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react64.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
23071
- var useTranslation = function(ns) {
23072
- let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
23252
+ var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react65.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
23253
+ var useTranslation = (ns, props = {}) => {
23073
23254
  const {
23074
23255
  i18n: i18nFromProps
23075
23256
  } = props;
23076
23257
  const {
23077
23258
  i18n: i18nFromContext,
23078
23259
  defaultNS: defaultNSFromContext
23079
- } = (0, import_react64.useContext)(I18nContext) || {};
23260
+ } = (0, import_react65.useContext)(I18nContext) || {};
23080
23261
  const i18n = i18nFromProps || i18nFromContext || getI18n();
23081
23262
  if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
23082
23263
  if (!i18n) {
23083
- warnOnce("You will need to pass in an i18next instance by using initReactI18next");
23264
+ warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
23084
23265
  const notReadyT = (k, optsOrDefaultValue) => {
23085
23266
  if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
23086
23267
  if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
@@ -23092,7 +23273,7 @@ var useTranslation = function(ns) {
23092
23273
  retNotReady.ready = false;
23093
23274
  return retNotReady;
23094
23275
  }
23095
- if (i18n.options.react && i18n.options.react.wait !== void 0) warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
23276
+ if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
23096
23277
  const i18nOptions = {
23097
23278
  ...getDefaults(),
23098
23279
  ...i18n.options.react,
@@ -23102,19 +23283,19 @@ var useTranslation = function(ns) {
23102
23283
  useSuspense,
23103
23284
  keyPrefix
23104
23285
  } = i18nOptions;
23105
- let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
23286
+ let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
23106
23287
  namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
23107
- if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
23288
+ i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
23108
23289
  const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n2) => hasLoadedNamespace(n2, i18n, i18nOptions));
23109
23290
  const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
23110
23291
  const getT = () => memoGetT;
23111
23292
  const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
23112
- const [t3, setT] = (0, import_react64.useState)(getT);
23293
+ const [t3, setT] = (0, import_react65.useState)(getT);
23113
23294
  let joinedNS = namespaces.join();
23114
23295
  if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
23115
23296
  const previousJoinedNS = usePrevious(joinedNS);
23116
- const isMounted = (0, import_react64.useRef)(true);
23117
- (0, import_react64.useEffect)(() => {
23297
+ const isMounted = (0, import_react65.useRef)(true);
23298
+ (0, import_react65.useEffect)(() => {
23118
23299
  const {
23119
23300
  bindI18n,
23120
23301
  bindI18nStore
@@ -23137,15 +23318,15 @@ var useTranslation = function(ns) {
23137
23318
  const boundReset = () => {
23138
23319
  if (isMounted.current) setT(getNewT);
23139
23320
  };
23140
- if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
23141
- if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
23321
+ if (bindI18n) i18n?.on(bindI18n, boundReset);
23322
+ if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
23142
23323
  return () => {
23143
23324
  isMounted.current = false;
23144
- if (bindI18n && i18n) bindI18n.split(" ").forEach((e2) => i18n.off(e2, boundReset));
23325
+ if (i18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
23145
23326
  if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
23146
23327
  };
23147
23328
  }, [i18n, joinedNS]);
23148
- (0, import_react64.useEffect)(() => {
23329
+ (0, import_react65.useEffect)(() => {
23149
23330
  if (isMounted.current && ready) {
23150
23331
  setT(getT);
23151
23332
  }
@@ -23167,36 +23348,35 @@ var useTranslation = function(ns) {
23167
23348
 
23168
23349
  // ../../node_modules/react-i18next/dist/es/withTranslation.js
23169
23350
  init_esm_shims();
23170
- var import_react65 = __toESM(require_react(), 1);
23351
+ var import_react66 = __toESM(require_react(), 1);
23171
23352
 
23172
23353
  // ../../node_modules/react-i18next/dist/es/Translation.js
23173
23354
  init_esm_shims();
23174
23355
 
23175
23356
  // ../../node_modules/react-i18next/dist/es/I18nextProvider.js
23176
23357
  init_esm_shims();
23177
- var import_react66 = __toESM(require_react(), 1);
23178
- function I18nextProvider(_ref) {
23179
- let {
23180
- i18n,
23181
- defaultNS,
23182
- children
23183
- } = _ref;
23184
- const value2 = (0, import_react66.useMemo)(() => ({
23358
+ var import_react67 = __toESM(require_react(), 1);
23359
+ function I18nextProvider({
23360
+ i18n,
23361
+ defaultNS,
23362
+ children
23363
+ }) {
23364
+ const value2 = (0, import_react67.useMemo)(() => ({
23185
23365
  i18n,
23186
23366
  defaultNS
23187
23367
  }), [i18n, defaultNS]);
23188
- return (0, import_react66.createElement)(I18nContext.Provider, {
23368
+ return (0, import_react67.createElement)(I18nContext.Provider, {
23189
23369
  value: value2
23190
23370
  }, children);
23191
23371
  }
23192
23372
 
23193
23373
  // ../../node_modules/react-i18next/dist/es/withSSR.js
23194
23374
  init_esm_shims();
23195
- var import_react68 = __toESM(require_react(), 1);
23375
+ var import_react69 = __toESM(require_react(), 1);
23196
23376
 
23197
23377
  // ../../node_modules/react-i18next/dist/es/useSSR.js
23198
23378
  init_esm_shims();
23199
- var import_react67 = __toESM(require_react(), 1);
23379
+ var import_react68 = __toESM(require_react(), 1);
23200
23380
 
23201
23381
  // ../cli-i18n/src/create-i18n.ts
23202
23382
  init_esm_shims();
@@ -26783,7 +26963,7 @@ var setPath2 = (object, path, newValue) => {
26783
26963
  e2 = `${p[p.length - 1]}.${e2}`;
26784
26964
  p = p.slice(0, p.length - 1);
26785
26965
  last = getLastOfPath2(object, p, Object);
26786
- if (last && last.obj && typeof last.obj[`${last.k}.${e2}`] !== "undefined") {
26966
+ if (last?.obj && typeof last.obj[`${last.k}.${e2}`] !== "undefined") {
26787
26967
  last.obj = void 0;
26788
26968
  }
26789
26969
  }
@@ -26803,6 +26983,7 @@ var getPath2 = (object, path) => {
26803
26983
  k
26804
26984
  } = getLastOfPath2(object, path);
26805
26985
  if (!obj) return void 0;
26986
+ if (!Object.prototype.hasOwnProperty.call(obj, k)) return void 0;
26806
26987
  return obj[k];
26807
26988
  };
26808
26989
  var getPathWithDefaults = (data, defaultData, key) => {
@@ -26883,7 +27064,10 @@ var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
26883
27064
  var deepFind = function(obj, path) {
26884
27065
  let keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
26885
27066
  if (!obj) return void 0;
26886
- if (obj[path]) return obj[path];
27067
+ if (obj[path]) {
27068
+ if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
27069
+ return obj[path];
27070
+ }
26887
27071
  const tokens = path.split(keySeparator);
26888
27072
  let current = obj;
26889
27073
  for (let i2 = 0; i2 < tokens.length; ) {
@@ -26910,7 +27094,7 @@ var deepFind = function(obj, path) {
26910
27094
  }
26911
27095
  return current;
26912
27096
  };
26913
- var getCleanedCode = (code) => code && code.replace("_", "-");
27097
+ var getCleanedCode = (code) => code?.replace("_", "-");
26914
27098
  var consoleLogger = {
26915
27099
  type: "logger",
26916
27100
  log(args) {
@@ -26923,7 +27107,7 @@ var consoleLogger = {
26923
27107
  this.output("error", args);
26924
27108
  },
26925
27109
  output(type, args) {
26926
- if (console && console[type]) console[type].apply(console, args);
27110
+ console?.[type]?.apply?.(console, args);
26927
27111
  }
26928
27112
  };
26929
27113
  var Logger = class _Logger {
@@ -27079,7 +27263,7 @@ var ResourceStore = class extends EventEmitter2 {
27079
27263
  key = path.slice(2).join(".");
27080
27264
  }
27081
27265
  if (result || !ignoreJSONStructure || !isString2(key)) return result;
27082
- return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
27266
+ return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
27083
27267
  }
27084
27268
  addResource(lng, ns, key, value2) {
27085
27269
  let options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
@@ -27146,10 +27330,6 @@ var ResourceStore = class extends EventEmitter2 {
27146
27330
  }
27147
27331
  getResourceBundle(lng, ns) {
27148
27332
  if (!ns) ns = this.options.defaultNS;
27149
- if (this.options.compatibilityAPI === "v1") return {
27150
- ...{},
27151
- ...this.getResource(lng, ns)
27152
- };
27153
27333
  return this.getResource(lng, ns);
27154
27334
  }
27155
27335
  getDataByLanguage(lng) {
@@ -27171,7 +27351,7 @@ var postProcessor = {
27171
27351
  },
27172
27352
  handle(processors, value2, key, options, translator) {
27173
27353
  processors.forEach((processor) => {
27174
- if (this.processors[processor]) value2 = this.processors[processor].process(value2, key, options, translator);
27354
+ value2 = this.processors[processor]?.process(value2, key, options, translator) ?? value2;
27175
27355
  });
27176
27356
  return value2;
27177
27357
  }
@@ -27195,11 +27375,11 @@ var Translator = class _Translator extends EventEmitter2 {
27195
27375
  let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
27196
27376
  interpolation: {}
27197
27377
  };
27198
- if (key === void 0 || key === null) {
27378
+ if (key == null) {
27199
27379
  return false;
27200
27380
  }
27201
27381
  const resolved = this.resolve(key, options);
27202
- return resolved && resolved.res !== void 0;
27382
+ return resolved?.res !== void 0;
27203
27383
  }
27204
27384
  extractFromKey(key, options) {
27205
27385
  let nsSeparator = options.nsSeparator !== void 0 ? options.nsSeparator : this.options.nsSeparator;
@@ -27233,7 +27413,7 @@ var Translator = class _Translator extends EventEmitter2 {
27233
27413
  ...options
27234
27414
  };
27235
27415
  if (!options) options = {};
27236
- if (keys === void 0 || keys === null) return "";
27416
+ if (keys == null) return "";
27237
27417
  if (!Array.isArray(keys)) keys = [String(keys)];
27238
27418
  const returnDetails = options.returnDetails !== void 0 ? options.returnDetails : this.options.returnDetails;
27239
27419
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
@@ -27244,7 +27424,7 @@ var Translator = class _Translator extends EventEmitter2 {
27244
27424
  const namespace = namespaces[namespaces.length - 1];
27245
27425
  const lng = options.lng || this.language;
27246
27426
  const appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
27247
- if (lng && lng.toLowerCase() === "cimode") {
27427
+ if (lng?.toLowerCase() === "cimode") {
27248
27428
  if (appendNamespaceToCIMode) {
27249
27429
  const nsSeparator = options.nsSeparator || this.options.nsSeparator;
27250
27430
  if (returnDetails) {
@@ -27272,9 +27452,9 @@ var Translator = class _Translator extends EventEmitter2 {
27272
27452
  return key;
27273
27453
  }
27274
27454
  const resolved = this.resolve(keys, options);
27275
- let res = resolved && resolved.res;
27276
- const resUsedKey = resolved && resolved.usedKey || key;
27277
- const resExactUsedKey = resolved && resolved.exactUsedKey || key;
27455
+ let res = resolved?.res;
27456
+ const resUsedKey = resolved?.usedKey || key;
27457
+ const resExactUsedKey = resolved?.exactUsedKey || key;
27278
27458
  const resType = Object.prototype.toString.apply(res);
27279
27459
  const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
27280
27460
  const joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays;
@@ -27327,7 +27507,7 @@ var Translator = class _Translator extends EventEmitter2 {
27327
27507
  const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {
27328
27508
  ordinal: false
27329
27509
  }) : "";
27330
- const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && this.pluralResolver.shouldUseIntlApi();
27510
+ const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0;
27331
27511
  const defaultValue = needsZeroSuffixLookup && options[`defaultValue${this.options.pluralSeparator}zero`] || options[`defaultValue${defaultValueSuffix}`] || options[`defaultValue${defaultValueSuffixOrdinalFallback}`] || options.defaultValue;
27332
27512
  if (!this.isValidLookup(res) && hasDefaultValue) {
27333
27513
  usedDefault = true;
@@ -27364,7 +27544,7 @@ var Translator = class _Translator extends EventEmitter2 {
27364
27544
  const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
27365
27545
  if (this.options.missingKeyHandler) {
27366
27546
  this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
27367
- } else if (this.backendConnector && this.backendConnector.saveMissing) {
27547
+ } else if (this.backendConnector?.saveMissing) {
27368
27548
  this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
27369
27549
  }
27370
27550
  this.emit("missingKey", l, namespace, k, res);
@@ -27388,11 +27568,7 @@ var Translator = class _Translator extends EventEmitter2 {
27388
27568
  res = this.extendTranslation(res, keys, options, resolved, lastKey);
27389
27569
  if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;
27390
27570
  if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
27391
- if (this.options.compatibilityAPI !== "v1") {
27392
- res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : void 0);
27393
- } else {
27394
- res = this.options.parseMissingKeyHandler(res);
27395
- }
27571
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : void 0);
27396
27572
  }
27397
27573
  }
27398
27574
  if (returnDetails) {
@@ -27404,7 +27580,7 @@ var Translator = class _Translator extends EventEmitter2 {
27404
27580
  }
27405
27581
  extendTranslation(res, key, options, resolved, lastKey) {
27406
27582
  var _this = this;
27407
- if (this.i18nFormat && this.i18nFormat.parse) {
27583
+ if (this.i18nFormat?.parse) {
27408
27584
  res = this.i18nFormat.parse(res, {
27409
27585
  ...this.options.interpolation.defaultVariables,
27410
27586
  ...options
@@ -27421,7 +27597,7 @@ var Translator = class _Translator extends EventEmitter2 {
27421
27597
  }
27422
27598
  }
27423
27599
  });
27424
- const skipOnVariables = isString2(res) && (options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
27600
+ const skipOnVariables = isString2(res) && (options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
27425
27601
  let nestBef;
27426
27602
  if (skipOnVariables) {
27427
27603
  const nb = res.match(this.interpolator.nestingRegexp);
@@ -27438,12 +27614,12 @@ var Translator = class _Translator extends EventEmitter2 {
27438
27614
  const nestAft = na && na.length;
27439
27615
  if (nestBef < nestAft) options.nest = false;
27440
27616
  }
27441
- if (!options.lng && this.options.compatibilityAPI !== "v1" && resolved && resolved.res) options.lng = this.language || resolved.usedLng;
27617
+ if (!options.lng && resolved && resolved.res) options.lng = this.language || resolved.usedLng;
27442
27618
  if (options.nest !== false) res = this.interpolator.nest(res, function() {
27443
27619
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27444
27620
  args[_key] = arguments[_key];
27445
27621
  }
27446
- if (lastKey && lastKey[0] === args[0] && !options.context) {
27622
+ if (lastKey?.[0] === args[0] && !options.context) {
27447
27623
  _this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
27448
27624
  return null;
27449
27625
  }
@@ -27453,7 +27629,7 @@ var Translator = class _Translator extends EventEmitter2 {
27453
27629
  }
27454
27630
  const postProcess = options.postProcess || this.options.postProcess;
27455
27631
  const postProcessorNames = isString2(postProcess) ? [postProcess] : postProcess;
27456
- if (res !== void 0 && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
27632
+ if (res != null && postProcessorNames?.length && options.applyPostProcessor !== false) {
27457
27633
  res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
27458
27634
  i18nResolved: {
27459
27635
  ...resolved,
@@ -27480,13 +27656,13 @@ var Translator = class _Translator extends EventEmitter2 {
27480
27656
  let namespaces = extracted.namespaces;
27481
27657
  if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
27482
27658
  const needsPluralHandling = options.count !== void 0 && !isString2(options.count);
27483
- const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && this.pluralResolver.shouldUseIntlApi();
27659
+ const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0;
27484
27660
  const needsContextHandling = options.context !== void 0 && (isString2(options.context) || typeof options.context === "number") && options.context !== "";
27485
27661
  const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);
27486
27662
  namespaces.forEach((ns) => {
27487
27663
  if (this.isValidLookup(found)) return;
27488
27664
  usedNS = ns;
27489
- if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(usedNS)) {
27665
+ if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
27490
27666
  checkedLoadedFor[`${codes[0]}-${ns}`] = true;
27491
27667
  this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
27492
27668
  }
@@ -27494,7 +27670,7 @@ var Translator = class _Translator extends EventEmitter2 {
27494
27670
  if (this.isValidLookup(found)) return;
27495
27671
  usedLng = code;
27496
27672
  const finalKeys = [key];
27497
- if (this.i18nFormat && this.i18nFormat.addLookupKeys) {
27673
+ if (this.i18nFormat?.addLookupKeys) {
27498
27674
  this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
27499
27675
  } else {
27500
27676
  let pluralSuffix;
@@ -27547,7 +27723,7 @@ var Translator = class _Translator extends EventEmitter2 {
27547
27723
  }
27548
27724
  getResource(code, ns, key) {
27549
27725
  let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
27550
- if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
27726
+ if (this.i18nFormat?.getResource) return this.i18nFormat.getResource(code, ns, key, options);
27551
27727
  return this.resourceStore.getResource(code, ns, key, options);
27552
27728
  }
27553
27729
  getUsedParamsDetails() {
@@ -27584,7 +27760,6 @@ var Translator = class _Translator extends EventEmitter2 {
27584
27760
  return false;
27585
27761
  }
27586
27762
  };
27587
- var capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
27588
27763
  var LanguageUtil = class {
27589
27764
  constructor(options) {
27590
27765
  this.options = options;
@@ -27608,32 +27783,19 @@ var LanguageUtil = class {
27608
27783
  }
27609
27784
  formatLanguageCode(code) {
27610
27785
  if (isString2(code) && code.indexOf("-") > -1) {
27611
- if (typeof Intl !== "undefined" && typeof Intl.getCanonicalLocales !== "undefined") {
27612
- try {
27613
- let formattedCode = Intl.getCanonicalLocales(code)[0];
27614
- if (formattedCode && this.options.lowerCaseLng) {
27615
- formattedCode = formattedCode.toLowerCase();
27616
- }
27617
- if (formattedCode) return formattedCode;
27618
- } catch (e2) {
27619
- }
27786
+ let formattedCode;
27787
+ try {
27788
+ formattedCode = Intl.getCanonicalLocales(code)[0];
27789
+ } catch (e2) {
27620
27790
  }
27621
- const specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
27622
- let p = code.split("-");
27791
+ if (formattedCode && this.options.lowerCaseLng) {
27792
+ formattedCode = formattedCode.toLowerCase();
27793
+ }
27794
+ if (formattedCode) return formattedCode;
27623
27795
  if (this.options.lowerCaseLng) {
27624
- p = p.map((part) => part.toLowerCase());
27625
- } else if (p.length === 2) {
27626
- p[0] = p[0].toLowerCase();
27627
- p[1] = p[1].toUpperCase();
27628
- if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
27629
- } else if (p.length === 3) {
27630
- p[0] = p[0].toLowerCase();
27631
- if (p[1].length === 2) p[1] = p[1].toUpperCase();
27632
- if (p[0] !== "sgn" && p[2].length === 2) p[2] = p[2].toUpperCase();
27633
- if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
27634
- if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
27635
- }
27636
- return p.join("-");
27796
+ return code.toLowerCase();
27797
+ }
27798
+ return code;
27637
27799
  }
27638
27800
  return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
27639
27801
  }
@@ -27704,125 +27866,6 @@ var LanguageUtil = class {
27704
27866
  return codes;
27705
27867
  }
27706
27868
  };
27707
- var sets = [{
27708
- lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
27709
- nr: [1, 2],
27710
- fc: 1
27711
- }, {
27712
- lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
27713
- nr: [1, 2],
27714
- fc: 2
27715
- }, {
27716
- lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
27717
- nr: [1],
27718
- fc: 3
27719
- }, {
27720
- lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
27721
- nr: [1, 2, 5],
27722
- fc: 4
27723
- }, {
27724
- lngs: ["ar"],
27725
- nr: [0, 1, 2, 3, 11, 100],
27726
- fc: 5
27727
- }, {
27728
- lngs: ["cs", "sk"],
27729
- nr: [1, 2, 5],
27730
- fc: 6
27731
- }, {
27732
- lngs: ["csb", "pl"],
27733
- nr: [1, 2, 5],
27734
- fc: 7
27735
- }, {
27736
- lngs: ["cy"],
27737
- nr: [1, 2, 3, 8],
27738
- fc: 8
27739
- }, {
27740
- lngs: ["fr"],
27741
- nr: [1, 2],
27742
- fc: 9
27743
- }, {
27744
- lngs: ["ga"],
27745
- nr: [1, 2, 3, 7, 11],
27746
- fc: 10
27747
- }, {
27748
- lngs: ["gd"],
27749
- nr: [1, 2, 3, 20],
27750
- fc: 11
27751
- }, {
27752
- lngs: ["is"],
27753
- nr: [1, 2],
27754
- fc: 12
27755
- }, {
27756
- lngs: ["jv"],
27757
- nr: [0, 1],
27758
- fc: 13
27759
- }, {
27760
- lngs: ["kw"],
27761
- nr: [1, 2, 3, 4],
27762
- fc: 14
27763
- }, {
27764
- lngs: ["lt"],
27765
- nr: [1, 2, 10],
27766
- fc: 15
27767
- }, {
27768
- lngs: ["lv"],
27769
- nr: [1, 2, 0],
27770
- fc: 16
27771
- }, {
27772
- lngs: ["mk"],
27773
- nr: [1, 2],
27774
- fc: 17
27775
- }, {
27776
- lngs: ["mnk"],
27777
- nr: [0, 1, 2],
27778
- fc: 18
27779
- }, {
27780
- lngs: ["mt"],
27781
- nr: [1, 2, 11, 20],
27782
- fc: 19
27783
- }, {
27784
- lngs: ["or"],
27785
- nr: [2, 1],
27786
- fc: 2
27787
- }, {
27788
- lngs: ["ro"],
27789
- nr: [1, 2, 20],
27790
- fc: 20
27791
- }, {
27792
- lngs: ["sl"],
27793
- nr: [5, 1, 2, 3],
27794
- fc: 21
27795
- }, {
27796
- lngs: ["he", "iw"],
27797
- nr: [1, 2, 20, 21],
27798
- fc: 22
27799
- }];
27800
- var _rulesPluralsTypes = {
27801
- 1: (n2) => Number(n2 > 1),
27802
- 2: (n2) => Number(n2 != 1),
27803
- 3: (n2) => 0,
27804
- 4: (n2) => Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2),
27805
- 5: (n2) => Number(n2 == 0 ? 0 : n2 == 1 ? 1 : n2 == 2 ? 2 : n2 % 100 >= 3 && n2 % 100 <= 10 ? 3 : n2 % 100 >= 11 ? 4 : 5),
27806
- 6: (n2) => Number(n2 == 1 ? 0 : n2 >= 2 && n2 <= 4 ? 1 : 2),
27807
- 7: (n2) => Number(n2 == 1 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2),
27808
- 8: (n2) => Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 != 8 && n2 != 11 ? 2 : 3),
27809
- 9: (n2) => Number(n2 >= 2),
27810
- 10: (n2) => Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 < 7 ? 2 : n2 < 11 ? 3 : 4),
27811
- 11: (n2) => Number(n2 == 1 || n2 == 11 ? 0 : n2 == 2 || n2 == 12 ? 1 : n2 > 2 && n2 < 20 ? 2 : 3),
27812
- 12: (n2) => Number(n2 % 10 != 1 || n2 % 100 == 11),
27813
- 13: (n2) => Number(n2 !== 0),
27814
- 14: (n2) => Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 == 3 ? 2 : 3),
27815
- 15: (n2) => Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2),
27816
- 16: (n2) => Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 !== 0 ? 1 : 2),
27817
- 17: (n2) => Number(n2 == 1 || n2 % 10 == 1 && n2 % 100 != 11 ? 0 : 1),
27818
- 18: (n2) => Number(n2 == 0 ? 0 : n2 == 1 ? 1 : 2),
27819
- 19: (n2) => Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 1 && n2 % 100 < 11 ? 1 : n2 % 100 > 10 && n2 % 100 < 20 ? 2 : 3),
27820
- 20: (n2) => Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 0 && n2 % 100 < 20 ? 1 : 2),
27821
- 21: (n2) => Number(n2 % 100 == 1 ? 1 : n2 % 100 == 2 ? 2 : n2 % 100 == 3 || n2 % 100 == 4 ? 3 : 0),
27822
- 22: (n2) => Number(n2 == 1 ? 0 : n2 == 2 ? 1 : (n2 < 0 || n2 > 10) && n2 % 10 == 0 ? 2 : 3)
27823
- };
27824
- var nonIntlVersions = ["v1", "v2", "v3"];
27825
- var intlVersions = ["v4"];
27826
27869
  var suffixesOrder = {
27827
27870
  zero: 0,
27828
27871
  one: 1,
@@ -27831,17 +27874,11 @@ var suffixesOrder = {
27831
27874
  many: 4,
27832
27875
  other: 5
27833
27876
  };
27834
- var createRules = () => {
27835
- const rules = {};
27836
- sets.forEach((set) => {
27837
- set.lngs.forEach((l) => {
27838
- rules[l] = {
27839
- numbers: set.nr,
27840
- plurals: _rulesPluralsTypes[set.fc]
27841
- };
27842
- });
27843
- });
27844
- return rules;
27877
+ var dummyRule = {
27878
+ select: (count) => count === 1 ? "one" : "other",
27879
+ resolvedOptions: () => ({
27880
+ pluralCategories: ["one", "other"]
27881
+ })
27845
27882
  };
27846
27883
  var PluralResolver = class {
27847
27884
  constructor(languageUtils) {
@@ -27849,11 +27886,6 @@ var PluralResolver = class {
27849
27886
  this.languageUtils = languageUtils;
27850
27887
  this.options = options;
27851
27888
  this.logger = baseLogger.create("pluralResolver");
27852
- if ((!this.options.compatibilityJSON || intlVersions.includes(this.options.compatibilityJSON)) && (typeof Intl === "undefined" || !Intl.PluralRules)) {
27853
- this.options.compatibilityJSON = "v3";
27854
- this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.");
27855
- }
27856
- this.rules = createRules();
27857
27889
  this.pluralRulesCache = {};
27858
27890
  }
27859
27891
  addRule(lng, obj) {
@@ -27864,38 +27896,37 @@ var PluralResolver = class {
27864
27896
  }
27865
27897
  getRule(code) {
27866
27898
  let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
27867
- if (this.shouldUseIntlApi()) {
27868
- const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
27869
- const type = options.ordinal ? "ordinal" : "cardinal";
27870
- const cacheKey = JSON.stringify({
27871
- cleanedCode,
27899
+ const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
27900
+ const type = options.ordinal ? "ordinal" : "cardinal";
27901
+ const cacheKey = JSON.stringify({
27902
+ cleanedCode,
27903
+ type
27904
+ });
27905
+ if (cacheKey in this.pluralRulesCache) {
27906
+ return this.pluralRulesCache[cacheKey];
27907
+ }
27908
+ let rule;
27909
+ try {
27910
+ rule = new Intl.PluralRules(cleanedCode, {
27872
27911
  type
27873
27912
  });
27874
- if (cacheKey in this.pluralRulesCache) {
27875
- return this.pluralRulesCache[cacheKey];
27913
+ } catch (err) {
27914
+ if (!Intl) {
27915
+ this.logger.error("No Intl support, please use an Intl polyfill!");
27916
+ return dummyRule;
27876
27917
  }
27877
- let rule;
27878
- try {
27879
- rule = new Intl.PluralRules(cleanedCode, {
27880
- type
27881
- });
27882
- } catch (err) {
27883
- if (!code.match(/-|_/)) return;
27884
- const lngPart = this.languageUtils.getLanguagePartFromCode(code);
27885
- rule = this.getRule(lngPart, options);
27886
- }
27887
- this.pluralRulesCache[cacheKey] = rule;
27888
- return rule;
27918
+ if (!code.match(/-|_/)) return dummyRule;
27919
+ const lngPart = this.languageUtils.getLanguagePartFromCode(code);
27920
+ rule = this.getRule(lngPart, options);
27889
27921
  }
27890
- return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
27922
+ this.pluralRulesCache[cacheKey] = rule;
27923
+ return rule;
27891
27924
  }
27892
27925
  needsPlural(code) {
27893
27926
  let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
27894
- const rule = this.getRule(code, options);
27895
- if (this.shouldUseIntlApi()) {
27896
- return rule && rule.resolvedOptions().pluralCategories.length > 1;
27897
- }
27898
- return rule && rule.numbers.length > 1;
27927
+ let rule = this.getRule(code, options);
27928
+ if (!rule) rule = this.getRule("dev", options);
27929
+ return rule?.resolvedOptions().pluralCategories.length > 1;
27899
27930
  }
27900
27931
  getPluralFormsOfKey(code, key) {
27901
27932
  let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
@@ -27903,51 +27934,19 @@ var PluralResolver = class {
27903
27934
  }
27904
27935
  getSuffixes(code) {
27905
27936
  let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
27906
- const rule = this.getRule(code, options);
27907
- if (!rule) {
27908
- return [];
27909
- }
27910
- if (this.shouldUseIntlApi()) {
27911
- return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
27912
- }
27913
- return rule.numbers.map((number) => this.getSuffix(code, number, options));
27937
+ let rule = this.getRule(code, options);
27938
+ if (!rule) rule = this.getRule("dev", options);
27939
+ if (!rule) return [];
27940
+ return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
27914
27941
  }
27915
27942
  getSuffix(code, count) {
27916
27943
  let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
27917
27944
  const rule = this.getRule(code, options);
27918
27945
  if (rule) {
27919
- if (this.shouldUseIntlApi()) {
27920
- return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
27921
- }
27922
- return this.getSuffixRetroCompatible(rule, count);
27946
+ return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
27923
27947
  }
27924
27948
  this.logger.warn(`no plural rule found for: ${code}`);
27925
- return "";
27926
- }
27927
- getSuffixRetroCompatible(rule, count) {
27928
- const idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
27929
- let suffix = rule.numbers[idx];
27930
- if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
27931
- if (suffix === 2) {
27932
- suffix = "plural";
27933
- } else if (suffix === 1) {
27934
- suffix = "";
27935
- }
27936
- }
27937
- const returnSuffix = () => this.options.prepend && suffix.toString() ? this.options.prepend + suffix.toString() : suffix.toString();
27938
- if (this.options.compatibilityJSON === "v1") {
27939
- if (suffix === 1) return "";
27940
- if (typeof suffix === "number") return `_plural_${suffix.toString()}`;
27941
- return returnSuffix();
27942
- } else if (this.options.compatibilityJSON === "v2") {
27943
- return returnSuffix();
27944
- } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
27945
- return returnSuffix();
27946
- }
27947
- return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
27948
- }
27949
- shouldUseIntlApi() {
27950
- return !nonIntlVersions.includes(this.options.compatibilityJSON);
27949
+ return this.getSuffix("dev", count, options);
27951
27950
  }
27952
27951
  };
27953
27952
  var deepFindWithDefaults = function(data, defaultData, key) {
@@ -27966,7 +27965,7 @@ var Interpolator = class {
27966
27965
  let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
27967
27966
  this.logger = baseLogger.create("interpolator");
27968
27967
  this.options = options;
27969
- this.format = options.interpolation && options.interpolation.format || ((value2) => value2);
27968
+ this.format = options?.interpolation?.format || ((value2) => value2);
27970
27969
  this.init(options);
27971
27970
  }
27972
27971
  init() {
@@ -28013,7 +28012,7 @@ var Interpolator = class {
28013
28012
  }
28014
28013
  resetRegExp() {
28015
28014
  const getOrResetRegExp = (existingRegExp, pattern) => {
28016
- if (existingRegExp && existingRegExp.source === pattern) {
28015
+ if (existingRegExp?.source === pattern) {
28017
28016
  existingRegExp.lastIndex = 0;
28018
28017
  return existingRegExp;
28019
28018
  }
@@ -28047,8 +28046,8 @@ var Interpolator = class {
28047
28046
  });
28048
28047
  };
28049
28048
  this.resetRegExp();
28050
- const missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
28051
- const skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
28049
+ const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
28050
+ const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
28052
28051
  const todos = [{
28053
28052
  regex: this.regexpUnescape,
28054
28053
  safeValue: (val) => regexSafe(val)
@@ -28107,7 +28106,7 @@ var Interpolator = class {
28107
28106
  optionsString = this.interpolate(optionsString, clonedOptions);
28108
28107
  const matchedSingleQuotes = optionsString.match(/'/g);
28109
28108
  const matchedDoubleQuotes = optionsString.match(/"/g);
28110
- if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
28109
+ if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
28111
28110
  optionsString = optionsString.replace(/'/g, '"');
28112
28111
  }
28113
28112
  try {
@@ -28274,7 +28273,7 @@ var Formatter = class {
28274
28273
  if (this.formats[formatName]) {
28275
28274
  let formatted = mem;
28276
28275
  try {
28277
- const valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
28276
+ const valOptions = options?.formatParams?.[options.interpolationkey] || {};
28278
28277
  const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
28279
28278
  formatted = this.formats[formatName](mem, l, {
28280
28279
  ...formatOptions,
@@ -28316,9 +28315,7 @@ var Connector = class extends EventEmitter2 {
28316
28315
  this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
28317
28316
  this.state = {};
28318
28317
  this.queue = [];
28319
- if (this.backend && this.backend.init) {
28320
- this.backend.init(services, options.backend, options);
28321
- }
28318
+ this.backend?.init?.(services, options.backend, options);
28322
28319
  }
28323
28320
  queueLoad(languages, namespaces, options, callback) {
28324
28321
  const toLoad = {};
@@ -28486,12 +28483,12 @@ var Connector = class extends EventEmitter2 {
28486
28483
  let options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
28487
28484
  let clb = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
28488
28485
  };
28489
- if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
28486
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
28490
28487
  this.logger.warn(`did not save key "${key}" as the namespace "${namespace}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
28491
28488
  return;
28492
28489
  }
28493
28490
  if (key === void 0 || key === null || key === "") return;
28494
- if (this.backend && this.backend.create) {
28491
+ if (this.backend?.create) {
28495
28492
  const opts = {
28496
28493
  ...options,
28497
28494
  isUpdate
@@ -28523,7 +28520,7 @@ var Connector = class extends EventEmitter2 {
28523
28520
  };
28524
28521
  var get = () => ({
28525
28522
  debug: false,
28526
- initImmediate: true,
28523
+ initAsync: true,
28527
28524
  ns: ["translation"],
28528
28525
  defaultNS: ["translation"],
28529
28526
  fallbackLng: ["dev"],
@@ -28585,9 +28582,10 @@ var transformOptions = (options) => {
28585
28582
  if (isString2(options.ns)) options.ns = [options.ns];
28586
28583
  if (isString2(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
28587
28584
  if (isString2(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
28588
- if (options.supportedLngs && options.supportedLngs.indexOf("cimode") < 0) {
28585
+ if (options.supportedLngs?.indexOf?.("cimode") < 0) {
28589
28586
  options.supportedLngs = options.supportedLngs.concat(["cimode"]);
28590
28587
  }
28588
+ if (typeof options.initImmediate === "boolean") options.initAsync = options.initImmediate;
28591
28589
  return options;
28592
28590
  };
28593
28591
  var noop4 = () => {
@@ -28613,7 +28611,7 @@ var I18n = class _I18n extends EventEmitter2 {
28613
28611
  };
28614
28612
  bindMemberFunctions(this);
28615
28613
  if (callback && !this.isInitialized && !options.isClone) {
28616
- if (!this.options.initImmediate) {
28614
+ if (!this.options.initAsync) {
28617
28615
  this.init(options, callback);
28618
28616
  return this;
28619
28617
  }
@@ -28631,7 +28629,7 @@ var I18n = class _I18n extends EventEmitter2 {
28631
28629
  callback = options;
28632
28630
  options = {};
28633
28631
  }
28634
- if (!options.defaultNS && options.defaultNS !== false && options.ns) {
28632
+ if (options.defaultNS == null && options.ns) {
28635
28633
  if (isString2(options.ns)) {
28636
28634
  options.defaultNS = options.ns;
28637
28635
  } else if (options.ns.indexOf("translation") < 0) {
@@ -28644,12 +28642,10 @@ var I18n = class _I18n extends EventEmitter2 {
28644
28642
  ...this.options,
28645
28643
  ...transformOptions(options)
28646
28644
  };
28647
- if (this.options.compatibilityAPI !== "v1") {
28648
- this.options.interpolation = {
28649
- ...defOpts.interpolation,
28650
- ...this.options.interpolation
28651
- };
28652
- }
28645
+ this.options.interpolation = {
28646
+ ...defOpts.interpolation,
28647
+ ...this.options.interpolation
28648
+ };
28653
28649
  if (options.keySeparator !== void 0) {
28654
28650
  this.options.userDefinedKeySeparator = options.keySeparator;
28655
28651
  }
@@ -28670,7 +28666,7 @@ var I18n = class _I18n extends EventEmitter2 {
28670
28666
  let formatter;
28671
28667
  if (this.modules.formatter) {
28672
28668
  formatter = this.modules.formatter;
28673
- } else if (typeof Intl !== "undefined") {
28669
+ } else {
28674
28670
  formatter = Formatter;
28675
28671
  }
28676
28672
  const lu = new LanguageUtil(this.options);
@@ -28681,7 +28677,6 @@ var I18n = class _I18n extends EventEmitter2 {
28681
28677
  s2.languageUtils = lu;
28682
28678
  s2.pluralResolver = new PluralResolver(lu, {
28683
28679
  prepend: this.options.pluralSeparator,
28684
- compatibilityJSON: this.options.compatibilityJSON,
28685
28680
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
28686
28681
  });
28687
28682
  if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
@@ -28752,10 +28747,10 @@ var I18n = class _I18n extends EventEmitter2 {
28752
28747
  deferred.resolve(t3);
28753
28748
  callback(err, t3);
28754
28749
  };
28755
- if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
28750
+ if (this.languages && !this.isInitialized) return finish(null, this.t.bind(this));
28756
28751
  this.changeLanguage(this.options.lng, finish);
28757
28752
  };
28758
- if (this.options.resources || !this.options.initImmediate) {
28753
+ if (this.options.resources || !this.options.initAsync) {
28759
28754
  load();
28760
28755
  } else {
28761
28756
  setTimeout(load, 0);
@@ -28768,7 +28763,7 @@ var I18n = class _I18n extends EventEmitter2 {
28768
28763
  const usedLng = isString2(language) ? language : this.language;
28769
28764
  if (typeof language === "function") usedCallback = language;
28770
28765
  if (!this.options.resources || this.options.partialBundledLanguages) {
28771
- if (usedLng && usedLng.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
28766
+ if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
28772
28767
  const toLoad = [];
28773
28768
  const append = (lng) => {
28774
28769
  if (!lng) return;
@@ -28785,9 +28780,7 @@ var I18n = class _I18n extends EventEmitter2 {
28785
28780
  } else {
28786
28781
  append(usedLng);
28787
28782
  }
28788
- if (this.options.preload) {
28789
- this.options.preload.forEach((l) => append(l));
28790
- }
28783
+ this.options.preload?.forEach?.((l) => append(l));
28791
28784
  this.services.backendConnector.load(toLoad, this.options.ns, (e2) => {
28792
28785
  if (!e2 && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
28793
28786
  usedCallback(e2);
@@ -28889,7 +28882,7 @@ var I18n = class _I18n extends EventEmitter2 {
28889
28882
  setLngProps(l);
28890
28883
  }
28891
28884
  if (!this.translator.language) this.translator.changeLanguage(l);
28892
- if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);
28885
+ this.services.languageDetector?.cacheUserLanguage?.(l);
28893
28886
  }
28894
28887
  this.loadResources(l, (err) => {
28895
28888
  done(err, l);
@@ -28945,10 +28938,16 @@ var I18n = class _I18n extends EventEmitter2 {
28945
28938
  return fixedT;
28946
28939
  }
28947
28940
  t() {
28948
- return this.translator && this.translator.translate(...arguments);
28941
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
28942
+ args[_key4] = arguments[_key4];
28943
+ }
28944
+ return this.translator?.translate(...args);
28949
28945
  }
28950
28946
  exists() {
28951
- return this.translator && this.translator.exists(...arguments);
28947
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
28948
+ args[_key5] = arguments[_key5];
28949
+ }
28950
+ return this.translator?.exists(...args);
28952
28951
  }
28953
28952
  setDefaultNamespace(ns) {
28954
28953
  this.options.defaultNS = ns;
@@ -29013,10 +29012,10 @@ var I18n = class _I18n extends EventEmitter2 {
29013
29012
  return deferred;
29014
29013
  }
29015
29014
  dir(lng) {
29016
- if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
29015
+ if (!lng) lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
29017
29016
  if (!lng) return "rtl";
29018
29017
  const rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"];
29019
- const languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get());
29018
+ const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
29020
29019
  return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
29021
29020
  }
29022
29021
  static createInstance() {
@@ -29051,13 +29050,24 @@ var I18n = class _I18n extends EventEmitter2 {
29051
29050
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
29052
29051
  };
29053
29052
  if (forkResourceStore) {
29054
- clone.store = new ResourceStore(this.store.data, mergedOptions);
29053
+ const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
29054
+ prev[l] = {
29055
+ ...this.store.data[l]
29056
+ };
29057
+ return Object.keys(prev[l]).reduce((acc, n2) => {
29058
+ acc[n2] = {
29059
+ ...prev[l][n2]
29060
+ };
29061
+ return acc;
29062
+ }, {});
29063
+ }, {});
29064
+ clone.store = new ResourceStore(clonedData, mergedOptions);
29055
29065
  clone.services.resourceStore = clone.store;
29056
29066
  }
29057
29067
  clone.translator = new Translator(clone.services, mergedOptions);
29058
29068
  clone.translator.on("*", function(event) {
29059
- for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
29060
- args[_key4 - 1] = arguments[_key4];
29069
+ for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
29070
+ args[_key6 - 1] = arguments[_key6];
29061
29071
  }
29062
29072
  clone.emit(event, ...args);
29063
29073
  });
@@ -29120,8 +29130,8 @@ var I18nProvider = ({
29120
29130
  messages,
29121
29131
  i18n: initialI18n
29122
29132
  }) => {
29123
- const [i18n] = (0, import_react69.useState)(() => initialI18n ?? createI18n(messages));
29124
- return /* @__PURE__ */ import_react69.default.createElement(I18nextProvider, { i18n }, children);
29133
+ const [i18n] = (0, import_react70.useState)(() => initialI18n ?? createI18n(messages));
29134
+ return /* @__PURE__ */ import_react70.default.createElement(I18nextProvider, { i18n }, children);
29125
29135
  };
29126
29136
 
29127
29137
  // ../cli-i18n/src/index.ts
@@ -29171,6 +29181,7 @@ export {
29171
29181
  Link,
29172
29182
  Spinner2 as Spinner,
29173
29183
  ErrorDetails,
29184
+ Notification,
29174
29185
  useExit,
29175
29186
  AsyncCallbackStatus,
29176
29187
  useAsync2 as useAsync,
@@ -29228,4 +29239,4 @@ react-reconciler/cjs/react-reconciler-constants.production.min.js:
29228
29239
  * LICENSE file in the root directory of this source tree.
29229
29240
  *)
29230
29241
  */
29231
- //# sourceMappingURL=chunk-MGPAOFO3.js.map
29242
+ //# sourceMappingURL=chunk-DXNFLVQP.js.map