i18next-cli 1.67.4 → 1.67.6

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.
package/dist/cjs/cli.js CHANGED
@@ -37,7 +37,7 @@ const program = new commander.Command();
37
37
  program
38
38
  .name('i18next-cli')
39
39
  .description('A unified, high-performance i18next CLI.')
40
- .version('1.67.4'); // This string is replaced with the actual version at build time by rollup
40
+ .version('1.67.6'); // This string is replaced with the actual version at build time by rollup
41
41
  // new: global config override option
42
42
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
43
43
  program
@@ -241,14 +241,11 @@ async function processFile(file, plugins, astVisitors, pluginContext, config, lo
241
241
  throw new validation.ExtractorError('Failed to process file', file, err);
242
242
  }
243
243
  }
244
- // Normalize SWC span offsets so every span is file-relative (0-based).
245
- // SWC accumulates byte offsets across successive parse() calls and uses
246
- // 1-based positions, so Module.span.start points to the first token,
247
- // NOT to byte 0 of the source. We derive the true base by subtracting
248
- // the 0-based index of that first token in the source string.
249
- const firstTokenIdx = astUtils.findFirstTokenIndex(code);
250
- const spanBase = ast.span.start - firstTokenIdx;
251
- astUtils.normalizeASTSpans(ast, spanBase);
244
+ // Normalize SWC span offsets so every span is a file-relative (0-based)
245
+ // character index. SWC accumulates byte offsets across successive parse()
246
+ // calls and Module.span.start points to the first token, NOT to byte 0 of
247
+ // the source.
248
+ astUtils.normalizeSpansToCharIndices(ast, code);
252
249
  // "Wire up" the visitor's scope method to the context.
253
250
  // This avoids a circular dependency while giving plugins access to the scope.
254
251
  pluginContext.getVarFromScope = astVisitors.getVarFromScope.bind(astVisitors);
@@ -348,8 +345,7 @@ async function preScanFile(file, astVisitors, config, logger$1 = new logger.Cons
348
345
  throw new validation.ExtractorError('Failed to pre-scan file', file, err);
349
346
  }
350
347
  }
351
- const firstTokenIdx = astUtils.findFirstTokenIndex(code);
352
- astUtils.normalizeASTSpans(ast, ast.span.start - firstTokenIdx);
348
+ astUtils.normalizeSpansToCharIndices(ast, code);
353
349
  astVisitors.setCurrentFile(file, code);
354
350
  astVisitors.preScanForConstants(ast);
355
351
  }
@@ -135,6 +135,8 @@ async function processSourceFiles(config) {
135
135
  // Combine default ignore patterns with user-configured ones
136
136
  ignore: [...defaultIgnore, ...userIgnore],
137
137
  cwd: process.cwd(),
138
+ // A directory named e.g. `abc.tsx` matches the input globs
139
+ nodir: true,
138
140
  });
139
141
  }
140
142
 
@@ -168,6 +168,23 @@ function convertSpansToCharIndices(node, byteToChar) {
168
168
  }
169
169
  }
170
170
  }
171
+ /**
172
+ * Normalises every span in a freshly parsed SWC AST to a file-relative UTF-16
173
+ * character index — the unit JavaScript strings, MagicString and
174
+ * `lineColumnFromOffset` all use.
175
+ *
176
+ * Combines the two steps that must always happen together: subtracting SWC's
177
+ * accumulated base (which is expressed in UTF-8 *bytes*, hence the
178
+ * `Buffer.byteLength` of the leading trivia) and converting the remaining byte
179
+ * offsets to char indices.
180
+ */
181
+ function normalizeSpansToCharIndices(ast, code) {
182
+ const firstTokenByteIdx = Buffer.byteLength(code.slice(0, findFirstTokenIndex(code)), 'utf8');
183
+ normalizeASTSpans(ast, ast.span.start - firstTokenByteIdx);
184
+ const byteToChar = buildByteToCharMap(code);
185
+ if (byteToChar)
186
+ convertSpansToCharIndices(ast, byteToChar);
187
+ }
171
188
  // ─── Ignore-comment helpers ──────────────────────────────────────────────────
172
189
  /**
173
190
  * Matches the shared ignore directive used by both the instrumenter and the
@@ -365,3 +382,4 @@ exports.getObjectProperty = getObjectProperty;
365
382
  exports.isSimpleTemplateLiteral = isSimpleTemplateLiteral;
366
383
  exports.lineColumnFromOffset = lineColumnFromOffset;
367
384
  exports.normalizeASTSpans = normalizeASTSpans;
385
+ exports.normalizeSpansToCharIndices = normalizeSpansToCharIndices;
@@ -258,18 +258,11 @@ async function scanFileForCandidates(content, file, config) {
258
258
  throw err;
259
259
  }
260
260
  }
261
- // Normalize spans
262
- const firstTokenIdx = astUtils.findFirstTokenIndex(content);
263
- const spanBase = ast.span.start - firstTokenIdx;
264
- astUtils.normalizeASTSpans(ast, spanBase);
265
- // Convert byte offsets → char indices for files with multi-byte characters.
266
- // SWC reports spans as UTF-8 byte offsets, but JavaScript strings and
267
- // MagicString use UTF-16 code-unit indices. Without this conversion,
268
- // every emoji / accented char / CJK char shifts all subsequent offsets.
269
- const byteToChar = astUtils.buildByteToCharMap(content);
270
- if (byteToChar) {
271
- astUtils.convertSpansToCharIndices(ast, byteToChar);
272
- }
261
+ // Normalize spans to file-relative char indices. SWC reports spans as UTF-8
262
+ // byte offsets, but JavaScript strings and MagicString use UTF-16 code-unit
263
+ // indices without the conversion every emoji / accented char / CJK char
264
+ // shifts all subsequent offsets.
265
+ astUtils.normalizeSpansToCharIndices(ast, content);
273
266
  // Detect React function component boundaries
274
267
  detectComponentBoundaries(ast, content, components);
275
268
  // Visit AST to find string literals
@@ -1351,7 +1344,9 @@ async function getSourceFilesForInstrumentation(config) {
1351
1344
  : config.extract.ignore ? [config.extract.ignore] : [];
1352
1345
  return await glob.glob(config.extract.input, {
1353
1346
  ignore: [...defaultIgnore, ...userIgnore],
1354
- cwd: process.cwd()
1347
+ cwd: process.cwd(),
1348
+ // A directory named e.g. `abc.tsx` matches the input globs
1349
+ nodir: true
1355
1350
  });
1356
1351
  }
1357
1352
  /**
@@ -524,7 +524,9 @@ class Linter extends node_events.EventEmitter {
524
524
  ? config.lint.ignore
525
525
  : config.lint?.ignore ? [config.lint.ignore] : [];
526
526
  const sourceFiles = await glob.glob(config.extract.input, {
527
- ignore: [...defaultIgnore, ...extractIgnore, ...lintIgnore]
527
+ ignore: [...defaultIgnore, ...extractIgnore, ...lintIgnore],
528
+ // A directory named e.g. `abc.tsx` matches the input globs; reading it throws EISDIR
529
+ nodir: true
528
530
  });
529
531
  this.emit('progress', { message: `Analyzing ${sourceFiles.length} source files...` });
530
532
  // Load translation values once so the interpolation linter can resolve lookup keys
@@ -601,11 +603,7 @@ class Linter extends node_events.EventEmitter {
601
603
  // (findHardcodedStrings/lintInterpolationParams locate issues via text
602
604
  // search and don't read spans, so this only affects ignore handling.)
603
605
  try {
604
- const spanBase = ast.span.start - astUtils.findFirstTokenIndex(code);
605
- astUtils.normalizeASTSpans(ast, spanBase);
606
- const byteToChar = astUtils.buildByteToCharMap(code);
607
- if (byteToChar)
608
- astUtils.convertSpansToCharIndices(ast, byteToChar);
606
+ astUtils.normalizeSpansToCharIndices(ast, code);
609
607
  }
610
608
  catch {
611
609
  // If span normalisation fails for any reason, fall back to text-based
package/dist/esm/cli.js CHANGED
@@ -31,7 +31,7 @@ const program = new Command();
31
31
  program
32
32
  .name('i18next-cli')
33
33
  .description('A unified, high-performance i18next CLI.')
34
- .version('1.67.4'); // This string is replaced with the actual version at build time by rollup
34
+ .version('1.67.6'); // This string is replaced with the actual version at build time by rollup
35
35
  // new: global config override option
36
36
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
37
37
  program
@@ -8,7 +8,7 @@ import { getTranslations } from './translation-manager.js';
8
8
  import { validateExtractorConfig, ExtractorError } from '../../utils/validation.js';
9
9
  import { ConflictError } from '../plugin-manager.js';
10
10
  import { extractKeysFromComments } from '../parsers/comment-parser.js';
11
- import { findFirstTokenIndex, normalizeASTSpans } from '../parsers/ast-utils.js';
11
+ import { normalizeSpansToCharIndices } from '../parsers/ast-utils.js';
12
12
  import { ConsoleLogger } from '../../utils/logger.js';
13
13
  import { inferFormatFromPath, loadRawJson5Content, serializeTranslationFile } from '../../utils/file-utils.js';
14
14
  import { shouldShowFunnel, recordFunnelShown } from '../../utils/funnel-msg-tracker.js';
@@ -239,14 +239,11 @@ async function processFile(file, plugins, astVisitors, pluginContext, config, lo
239
239
  throw new ExtractorError('Failed to process file', file, err);
240
240
  }
241
241
  }
242
- // Normalize SWC span offsets so every span is file-relative (0-based).
243
- // SWC accumulates byte offsets across successive parse() calls and uses
244
- // 1-based positions, so Module.span.start points to the first token,
245
- // NOT to byte 0 of the source. We derive the true base by subtracting
246
- // the 0-based index of that first token in the source string.
247
- const firstTokenIdx = findFirstTokenIndex(code);
248
- const spanBase = ast.span.start - firstTokenIdx;
249
- normalizeASTSpans(ast, spanBase);
242
+ // Normalize SWC span offsets so every span is a file-relative (0-based)
243
+ // character index. SWC accumulates byte offsets across successive parse()
244
+ // calls and Module.span.start points to the first token, NOT to byte 0 of
245
+ // the source.
246
+ normalizeSpansToCharIndices(ast, code);
250
247
  // "Wire up" the visitor's scope method to the context.
251
248
  // This avoids a circular dependency while giving plugins access to the scope.
252
249
  pluginContext.getVarFromScope = astVisitors.getVarFromScope.bind(astVisitors);
@@ -346,8 +343,7 @@ async function preScanFile(file, astVisitors, config, logger = new ConsoleLogger
346
343
  throw new ExtractorError('Failed to pre-scan file', file, err);
347
344
  }
348
345
  }
349
- const firstTokenIdx = findFirstTokenIndex(code);
350
- normalizeASTSpans(ast, ast.span.start - firstTokenIdx);
346
+ normalizeSpansToCharIndices(ast, code);
351
347
  astVisitors.setCurrentFile(file, code);
352
348
  astVisitors.preScanForConstants(ast);
353
349
  }
@@ -133,6 +133,8 @@ async function processSourceFiles(config) {
133
133
  // Combine default ignore patterns with user-configured ones
134
134
  ignore: [...defaultIgnore, ...userIgnore],
135
135
  cwd: process.cwd(),
136
+ // A directory named e.g. `abc.tsx` matches the input globs
137
+ nodir: true,
136
138
  });
137
139
  }
138
140
 
@@ -166,6 +166,23 @@ function convertSpansToCharIndices(node, byteToChar) {
166
166
  }
167
167
  }
168
168
  }
169
+ /**
170
+ * Normalises every span in a freshly parsed SWC AST to a file-relative UTF-16
171
+ * character index — the unit JavaScript strings, MagicString and
172
+ * `lineColumnFromOffset` all use.
173
+ *
174
+ * Combines the two steps that must always happen together: subtracting SWC's
175
+ * accumulated base (which is expressed in UTF-8 *bytes*, hence the
176
+ * `Buffer.byteLength` of the leading trivia) and converting the remaining byte
177
+ * offsets to char indices.
178
+ */
179
+ function normalizeSpansToCharIndices(ast, code) {
180
+ const firstTokenByteIdx = Buffer.byteLength(code.slice(0, findFirstTokenIndex(code)), 'utf8');
181
+ normalizeASTSpans(ast, ast.span.start - firstTokenByteIdx);
182
+ const byteToChar = buildByteToCharMap(code);
183
+ if (byteToChar)
184
+ convertSpansToCharIndices(ast, byteToChar);
185
+ }
169
186
  // ─── Ignore-comment helpers ──────────────────────────────────────────────────
170
187
  /**
171
188
  * Matches the shared ignore directive used by both the instrumenter and the
@@ -353,4 +370,4 @@ function getObjectPropValue(object, propName, identifierResolver) {
353
370
  return undefined;
354
371
  }
355
372
 
356
- export { buildByteToCharMap, collectIgnoredLineRanges, convertSpansToCharIndices, findFirstTokenIndex, getObjectPropValue, getObjectPropValueExpression, getObjectProperty, isSimpleTemplateLiteral, lineColumnFromOffset, normalizeASTSpans };
373
+ export { buildByteToCharMap, collectIgnoredLineRanges, convertSpansToCharIndices, findFirstTokenIndex, getObjectPropValue, getObjectPropValueExpression, getObjectProperty, isSimpleTemplateLiteral, lineColumnFromOffset, normalizeASTSpans, normalizeSpansToCharIndices };
@@ -10,7 +10,7 @@ import { createKeyRegistry, generateKeyFromContent } from './key-generator.js';
10
10
  import { createSpinnerLike } from '../../utils/wrap-ora.js';
11
11
  import { ConsoleLogger } from '../../utils/logger.js';
12
12
  import { ignoredAttributeSet } from '../../utils/jsx-attributes.js';
13
- import { findFirstTokenIndex, normalizeASTSpans, buildByteToCharMap, convertSpansToCharIndices, collectIgnoredLineRanges } from '../../extractor/parsers/ast-utils.js';
13
+ import { normalizeSpansToCharIndices, collectIgnoredLineRanges } from '../../extractor/parsers/ast-utils.js';
14
14
  import { getOutputPath } from '../../utils/file-utils.js';
15
15
 
16
16
  /**
@@ -252,18 +252,11 @@ async function scanFileForCandidates(content, file, config) {
252
252
  throw err;
253
253
  }
254
254
  }
255
- // Normalize spans
256
- const firstTokenIdx = findFirstTokenIndex(content);
257
- const spanBase = ast.span.start - firstTokenIdx;
258
- normalizeASTSpans(ast, spanBase);
259
- // Convert byte offsets → char indices for files with multi-byte characters.
260
- // SWC reports spans as UTF-8 byte offsets, but JavaScript strings and
261
- // MagicString use UTF-16 code-unit indices. Without this conversion,
262
- // every emoji / accented char / CJK char shifts all subsequent offsets.
263
- const byteToChar = buildByteToCharMap(content);
264
- if (byteToChar) {
265
- convertSpansToCharIndices(ast, byteToChar);
266
- }
255
+ // Normalize spans to file-relative char indices. SWC reports spans as UTF-8
256
+ // byte offsets, but JavaScript strings and MagicString use UTF-16 code-unit
257
+ // indices without the conversion every emoji / accented char / CJK char
258
+ // shifts all subsequent offsets.
259
+ normalizeSpansToCharIndices(ast, content);
267
260
  // Detect React function component boundaries
268
261
  detectComponentBoundaries(ast, content, components);
269
262
  // Visit AST to find string literals
@@ -1345,7 +1338,9 @@ async function getSourceFilesForInstrumentation(config) {
1345
1338
  : config.extract.ignore ? [config.extract.ignore] : [];
1346
1339
  return await glob(config.extract.input, {
1347
1340
  ignore: [...defaultIgnore, ...userIgnore],
1348
- cwd: process.cwd()
1341
+ cwd: process.cwd(),
1342
+ // A directory named e.g. `abc.tsx` matches the input globs
1343
+ nodir: true
1349
1344
  });
1350
1345
  }
1351
1346
  /**
@@ -7,7 +7,7 @@ import { styleText } from 'node:util';
7
7
  import { ConsoleLogger } from './utils/logger.js';
8
8
  import { createSpinnerLike } from './utils/wrap-ora.js';
9
9
  import { acceptedTags, translatableAttributes, ignoredTags, ignoredAttributeLowerSet } from './utils/jsx-attributes.js';
10
- import { findFirstTokenIndex, normalizeASTSpans, buildByteToCharMap, convertSpansToCharIndices, collectIgnoredLineRanges, lineColumnFromOffset } from './extractor/parsers/ast-utils.js';
10
+ import { normalizeSpansToCharIndices, collectIgnoredLineRanges, lineColumnFromOffset } from './extractor/parsers/ast-utils.js';
11
11
  import { matchesFunctionPattern } from './extractor/utils/function-matcher.js';
12
12
 
13
13
  /**
@@ -522,7 +522,9 @@ class Linter extends EventEmitter {
522
522
  ? config.lint.ignore
523
523
  : config.lint?.ignore ? [config.lint.ignore] : [];
524
524
  const sourceFiles = await glob(config.extract.input, {
525
- ignore: [...defaultIgnore, ...extractIgnore, ...lintIgnore]
525
+ ignore: [...defaultIgnore, ...extractIgnore, ...lintIgnore],
526
+ // A directory named e.g. `abc.tsx` matches the input globs; reading it throws EISDIR
527
+ nodir: true
526
528
  });
527
529
  this.emit('progress', { message: `Analyzing ${sourceFiles.length} source files...` });
528
530
  // Load translation values once so the interpolation linter can resolve lookup keys
@@ -599,11 +601,7 @@ class Linter extends EventEmitter {
599
601
  // (findHardcodedStrings/lintInterpolationParams locate issues via text
600
602
  // search and don't read spans, so this only affects ignore handling.)
601
603
  try {
602
- const spanBase = ast.span.start - findFirstTokenIndex(code);
603
- normalizeASTSpans(ast, spanBase);
604
- const byteToChar = buildByteToCharMap(code);
605
- if (byteToChar)
606
- convertSpansToCharIndices(ast, byteToChar);
604
+ normalizeSpansToCharIndices(ast, code);
607
605
  }
608
606
  catch {
609
607
  // If span normalisation fails for any reason, fall back to text-based
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.67.4",
3
+ "version": "1.67.6",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/extractor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAO5G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAK/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAA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,CAAA;CAAO,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAO1K"}
@@ -54,6 +54,17 @@ export declare function buildByteToCharMap(content: string): number[] | null;
54
54
  * pre-built lookup table.
55
55
  */
56
56
  export declare function convertSpansToCharIndices(node: any, byteToChar: number[]): void;
57
+ /**
58
+ * Normalises every span in a freshly parsed SWC AST to a file-relative UTF-16
59
+ * character index — the unit JavaScript strings, MagicString and
60
+ * `lineColumnFromOffset` all use.
61
+ *
62
+ * Combines the two steps that must always happen together: subtracting SWC's
63
+ * accumulated base (which is expressed in UTF-8 *bytes*, hence the
64
+ * `Buffer.byteLength` of the leading trivia) and converting the remaining byte
65
+ * offsets to char indices.
66
+ */
67
+ export declare function normalizeSpansToCharIndices(ast: any, code: string): void;
57
68
  /**
58
69
  * Scans `code` for ignore-directive comments and returns a Set of 1-based line
59
70
  * numbers whose issues/strings should be suppressed.
@@ -1 +1 @@
1
- {"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE1F;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CA0BhE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAQhH;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CA0BpE;AAED;;;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OAAO,GAAG,MAAM,GAAG,SAAS,CAkB9J"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrumenter.d.ts","sourceRoot":"","sources":["../../../src/instrumenter/core/instrumenter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAA6B,sBAAsB,EAAiE,MAAM,gBAAgB,CAAA;AAU1N;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,mBAAmB,EAC5B,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC,sBAAsB,CAAC,CAoNjC;AAivCD;;GAEG;AACH,wBAAsB,mBAAmB,IAAK,OAAO,CAAC,OAAO,CAAC,CAU7D;AAID,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAA;AA6B/E;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,IAAK,OAAO,CAAC,kBAAkB,CAAC,CA8B7E;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAK,OAAO,CAAC,OAAO,CAAC,CAOlE;AAwBD;;;;;;GAMG;AACH,wBAAsB,wBAAwB,IAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxE;AAmYD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,eAAe,EAAE,EAC7B,MAAM,EAAE,oBAAoB,EAC5B,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC,IAAI,CAAC,CAoDf"}
1
+ {"version":3,"file":"instrumenter.d.ts","sourceRoot":"","sources":["../../../src/instrumenter/core/instrumenter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAA6B,sBAAsB,EAAiE,MAAM,gBAAgB,CAAA;AAU1N;;;;;;;;GAQG;AAC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