trello-cli-unofficial 0.7.3 → 0.7.5

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/main.js CHANGED
@@ -23178,6 +23178,2653 @@ var init_esm16 = __esm(() => {
23178
23178
  esm_default12 = inquirer;
23179
23179
  });
23180
23180
 
23181
+ // node_modules/i18next/dist/esm/i18next.js
23182
+ class RegExpCache {
23183
+ constructor(capacity) {
23184
+ this.capacity = capacity;
23185
+ this.regExpMap = new Map;
23186
+ this.regExpQueue = [];
23187
+ }
23188
+ getRegExp(pattern) {
23189
+ const regExpFromCache = this.regExpMap.get(pattern);
23190
+ if (regExpFromCache !== undefined) {
23191
+ return regExpFromCache;
23192
+ }
23193
+ const regExpNew = new RegExp(pattern);
23194
+ if (this.regExpQueue.length === this.capacity) {
23195
+ this.regExpMap.delete(this.regExpQueue.shift());
23196
+ }
23197
+ this.regExpMap.set(pattern, regExpNew);
23198
+ this.regExpQueue.push(pattern);
23199
+ return regExpNew;
23200
+ }
23201
+ }
23202
+
23203
+ class Logger {
23204
+ constructor(concreteLogger, options = {}) {
23205
+ this.init(concreteLogger, options);
23206
+ }
23207
+ init(concreteLogger, options = {}) {
23208
+ this.prefix = options.prefix || "i18next:";
23209
+ this.logger = concreteLogger || consoleLogger;
23210
+ this.options = options;
23211
+ this.debug = options.debug;
23212
+ }
23213
+ log(...args) {
23214
+ return this.forward(args, "log", "", true);
23215
+ }
23216
+ warn(...args) {
23217
+ return this.forward(args, "warn", "", true);
23218
+ }
23219
+ error(...args) {
23220
+ return this.forward(args, "error", "");
23221
+ }
23222
+ deprecate(...args) {
23223
+ return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
23224
+ }
23225
+ forward(args, lvl, prefix, debugOnly) {
23226
+ if (debugOnly && !this.debug)
23227
+ return null;
23228
+ if (isString(args[0]))
23229
+ args[0] = `${prefix}${this.prefix} ${args[0]}`;
23230
+ return this.logger[lvl](args);
23231
+ }
23232
+ create(moduleName) {
23233
+ return new Logger(this.logger, {
23234
+ ...{
23235
+ prefix: `${this.prefix}:${moduleName}:`
23236
+ },
23237
+ ...this.options
23238
+ });
23239
+ }
23240
+ clone(options) {
23241
+ options = options || this.options;
23242
+ options.prefix = options.prefix || this.prefix;
23243
+ return new Logger(this.logger, options);
23244
+ }
23245
+ }
23246
+
23247
+ class EventEmitter {
23248
+ constructor() {
23249
+ this.observers = {};
23250
+ }
23251
+ on(events, listener) {
23252
+ events.split(" ").forEach((event) => {
23253
+ if (!this.observers[event])
23254
+ this.observers[event] = new Map;
23255
+ const numListeners = this.observers[event].get(listener) || 0;
23256
+ this.observers[event].set(listener, numListeners + 1);
23257
+ });
23258
+ return this;
23259
+ }
23260
+ off(event, listener) {
23261
+ if (!this.observers[event])
23262
+ return;
23263
+ if (!listener) {
23264
+ delete this.observers[event];
23265
+ return;
23266
+ }
23267
+ this.observers[event].delete(listener);
23268
+ }
23269
+ emit(event, ...args) {
23270
+ if (this.observers[event]) {
23271
+ const cloned = Array.from(this.observers[event].entries());
23272
+ cloned.forEach(([observer, numTimesAdded]) => {
23273
+ for (let i = 0;i < numTimesAdded; i++) {
23274
+ observer(...args);
23275
+ }
23276
+ });
23277
+ }
23278
+ if (this.observers["*"]) {
23279
+ const cloned = Array.from(this.observers["*"].entries());
23280
+ cloned.forEach(([observer, numTimesAdded]) => {
23281
+ for (let i = 0;i < numTimesAdded; i++) {
23282
+ observer.apply(observer, [event, ...args]);
23283
+ }
23284
+ });
23285
+ }
23286
+ }
23287
+ }
23288
+ function createProxy() {
23289
+ const state = [];
23290
+ const handler = Object.create(null);
23291
+ let proxy;
23292
+ handler.get = (target, key) => {
23293
+ proxy?.revoke?.();
23294
+ if (key === PATH_KEY)
23295
+ return state;
23296
+ state.push(key);
23297
+ proxy = Proxy.revocable(target, handler);
23298
+ return proxy.proxy;
23299
+ };
23300
+ return Proxy.revocable(Object.create(null), handler).proxy;
23301
+ }
23302
+ function keysFromSelector(selector, opts) {
23303
+ const {
23304
+ [PATH_KEY]: path2
23305
+ } = selector(createProxy());
23306
+ return path2.join(opts?.keySeparator ?? ".");
23307
+ }
23308
+
23309
+ class LanguageUtil {
23310
+ constructor(options) {
23311
+ this.options = options;
23312
+ this.supportedLngs = this.options.supportedLngs || false;
23313
+ this.logger = baseLogger.create("languageUtils");
23314
+ }
23315
+ getScriptPartFromCode(code) {
23316
+ code = getCleanedCode(code);
23317
+ if (!code || code.indexOf("-") < 0)
23318
+ return null;
23319
+ const p = code.split("-");
23320
+ if (p.length === 2)
23321
+ return null;
23322
+ p.pop();
23323
+ if (p[p.length - 1].toLowerCase() === "x")
23324
+ return null;
23325
+ return this.formatLanguageCode(p.join("-"));
23326
+ }
23327
+ getLanguagePartFromCode(code) {
23328
+ code = getCleanedCode(code);
23329
+ if (!code || code.indexOf("-") < 0)
23330
+ return code;
23331
+ const p = code.split("-");
23332
+ return this.formatLanguageCode(p[0]);
23333
+ }
23334
+ formatLanguageCode(code) {
23335
+ if (isString(code) && code.indexOf("-") > -1) {
23336
+ let formattedCode;
23337
+ try {
23338
+ formattedCode = Intl.getCanonicalLocales(code)[0];
23339
+ } catch (e) {}
23340
+ if (formattedCode && this.options.lowerCaseLng) {
23341
+ formattedCode = formattedCode.toLowerCase();
23342
+ }
23343
+ if (formattedCode)
23344
+ return formattedCode;
23345
+ if (this.options.lowerCaseLng) {
23346
+ return code.toLowerCase();
23347
+ }
23348
+ return code;
23349
+ }
23350
+ return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
23351
+ }
23352
+ isSupportedCode(code) {
23353
+ if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
23354
+ code = this.getLanguagePartFromCode(code);
23355
+ }
23356
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
23357
+ }
23358
+ getBestMatchFromCodes(codes) {
23359
+ if (!codes)
23360
+ return null;
23361
+ let found;
23362
+ codes.forEach((code) => {
23363
+ if (found)
23364
+ return;
23365
+ const cleanedLng = this.formatLanguageCode(code);
23366
+ if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng))
23367
+ found = cleanedLng;
23368
+ });
23369
+ if (!found && this.options.supportedLngs) {
23370
+ codes.forEach((code) => {
23371
+ if (found)
23372
+ return;
23373
+ const lngScOnly = this.getScriptPartFromCode(code);
23374
+ if (this.isSupportedCode(lngScOnly))
23375
+ return found = lngScOnly;
23376
+ const lngOnly = this.getLanguagePartFromCode(code);
23377
+ if (this.isSupportedCode(lngOnly))
23378
+ return found = lngOnly;
23379
+ found = this.options.supportedLngs.find((supportedLng) => {
23380
+ if (supportedLng === lngOnly)
23381
+ return supportedLng;
23382
+ if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0)
23383
+ return;
23384
+ if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly)
23385
+ return supportedLng;
23386
+ if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1)
23387
+ return supportedLng;
23388
+ });
23389
+ });
23390
+ }
23391
+ if (!found)
23392
+ found = this.getFallbackCodes(this.options.fallbackLng)[0];
23393
+ return found;
23394
+ }
23395
+ getFallbackCodes(fallbacks, code) {
23396
+ if (!fallbacks)
23397
+ return [];
23398
+ if (typeof fallbacks === "function")
23399
+ fallbacks = fallbacks(code);
23400
+ if (isString(fallbacks))
23401
+ fallbacks = [fallbacks];
23402
+ if (Array.isArray(fallbacks))
23403
+ return fallbacks;
23404
+ if (!code)
23405
+ return fallbacks.default || [];
23406
+ let found = fallbacks[code];
23407
+ if (!found)
23408
+ found = fallbacks[this.getScriptPartFromCode(code)];
23409
+ if (!found)
23410
+ found = fallbacks[this.formatLanguageCode(code)];
23411
+ if (!found)
23412
+ found = fallbacks[this.getLanguagePartFromCode(code)];
23413
+ if (!found)
23414
+ found = fallbacks.default;
23415
+ return found || [];
23416
+ }
23417
+ toResolveHierarchy(code, fallbackCode) {
23418
+ const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
23419
+ const codes = [];
23420
+ const addCode = (c) => {
23421
+ if (!c)
23422
+ return;
23423
+ if (this.isSupportedCode(c)) {
23424
+ codes.push(c);
23425
+ } else {
23426
+ this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
23427
+ }
23428
+ };
23429
+ if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
23430
+ if (this.options.load !== "languageOnly")
23431
+ addCode(this.formatLanguageCode(code));
23432
+ if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly")
23433
+ addCode(this.getScriptPartFromCode(code));
23434
+ if (this.options.load !== "currentOnly")
23435
+ addCode(this.getLanguagePartFromCode(code));
23436
+ } else if (isString(code)) {
23437
+ addCode(this.formatLanguageCode(code));
23438
+ }
23439
+ fallbackCodes.forEach((fc) => {
23440
+ if (codes.indexOf(fc) < 0)
23441
+ addCode(this.formatLanguageCode(fc));
23442
+ });
23443
+ return codes;
23444
+ }
23445
+ }
23446
+
23447
+ class PluralResolver {
23448
+ constructor(languageUtils, options = {}) {
23449
+ this.languageUtils = languageUtils;
23450
+ this.options = options;
23451
+ this.logger = baseLogger.create("pluralResolver");
23452
+ this.pluralRulesCache = {};
23453
+ }
23454
+ addRule(lng, obj) {
23455
+ this.rules[lng] = obj;
23456
+ }
23457
+ clearCache() {
23458
+ this.pluralRulesCache = {};
23459
+ }
23460
+ getRule(code, options = {}) {
23461
+ const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
23462
+ const type = options.ordinal ? "ordinal" : "cardinal";
23463
+ const cacheKey = JSON.stringify({
23464
+ cleanedCode,
23465
+ type
23466
+ });
23467
+ if (cacheKey in this.pluralRulesCache) {
23468
+ return this.pluralRulesCache[cacheKey];
23469
+ }
23470
+ let rule;
23471
+ try {
23472
+ rule = new Intl.PluralRules(cleanedCode, {
23473
+ type
23474
+ });
23475
+ } catch (err) {
23476
+ if (!Intl) {
23477
+ this.logger.error("No Intl support, please use an Intl polyfill!");
23478
+ return dummyRule;
23479
+ }
23480
+ if (!code.match(/-|_/))
23481
+ return dummyRule;
23482
+ const lngPart = this.languageUtils.getLanguagePartFromCode(code);
23483
+ rule = this.getRule(lngPart, options);
23484
+ }
23485
+ this.pluralRulesCache[cacheKey] = rule;
23486
+ return rule;
23487
+ }
23488
+ needsPlural(code, options = {}) {
23489
+ let rule = this.getRule(code, options);
23490
+ if (!rule)
23491
+ rule = this.getRule("dev", options);
23492
+ return rule?.resolvedOptions().pluralCategories.length > 1;
23493
+ }
23494
+ getPluralFormsOfKey(code, key, options = {}) {
23495
+ return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
23496
+ }
23497
+ getSuffixes(code, options = {}) {
23498
+ let rule = this.getRule(code, options);
23499
+ if (!rule)
23500
+ rule = this.getRule("dev", options);
23501
+ if (!rule)
23502
+ return [];
23503
+ return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
23504
+ }
23505
+ getSuffix(code, count, options = {}) {
23506
+ const rule = this.getRule(code, options);
23507
+ if (rule) {
23508
+ return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
23509
+ }
23510
+ this.logger.warn(`no plural rule found for: ${code}`);
23511
+ return this.getSuffix("dev", count, options);
23512
+ }
23513
+ }
23514
+
23515
+ class Interpolator {
23516
+ constructor(options = {}) {
23517
+ this.logger = baseLogger.create("interpolator");
23518
+ this.options = options;
23519
+ this.format = options?.interpolation?.format || ((value) => value);
23520
+ this.init(options);
23521
+ }
23522
+ init(options = {}) {
23523
+ if (!options.interpolation)
23524
+ options.interpolation = {
23525
+ escapeValue: true
23526
+ };
23527
+ const {
23528
+ escape: escape$1,
23529
+ escapeValue,
23530
+ useRawValueToEscape,
23531
+ prefix,
23532
+ prefixEscaped,
23533
+ suffix,
23534
+ suffixEscaped,
23535
+ formatSeparator,
23536
+ unescapeSuffix,
23537
+ unescapePrefix,
23538
+ nestingPrefix,
23539
+ nestingPrefixEscaped,
23540
+ nestingSuffix,
23541
+ nestingSuffixEscaped,
23542
+ nestingOptionsSeparator,
23543
+ maxReplaces,
23544
+ alwaysFormat
23545
+ } = options.interpolation;
23546
+ this.escape = escape$1 !== undefined ? escape$1 : escape;
23547
+ this.escapeValue = escapeValue !== undefined ? escapeValue : true;
23548
+ this.useRawValueToEscape = useRawValueToEscape !== undefined ? useRawValueToEscape : false;
23549
+ this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || "{{";
23550
+ this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || "}}";
23551
+ this.formatSeparator = formatSeparator || ",";
23552
+ this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix || "-";
23553
+ this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix || "";
23554
+ this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape("$t(");
23555
+ this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(")");
23556
+ this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
23557
+ this.maxReplaces = maxReplaces || 1000;
23558
+ this.alwaysFormat = alwaysFormat !== undefined ? alwaysFormat : false;
23559
+ this.resetRegExp();
23560
+ }
23561
+ reset() {
23562
+ if (this.options)
23563
+ this.init(this.options);
23564
+ }
23565
+ resetRegExp() {
23566
+ const getOrResetRegExp = (existingRegExp, pattern) => {
23567
+ if (existingRegExp?.source === pattern) {
23568
+ existingRegExp.lastIndex = 0;
23569
+ return existingRegExp;
23570
+ }
23571
+ return new RegExp(pattern, "g");
23572
+ };
23573
+ this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
23574
+ this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
23575
+ this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
23576
+ }
23577
+ interpolate(str, data, lng, options) {
23578
+ let match;
23579
+ let value;
23580
+ let replaces;
23581
+ const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
23582
+ const handleFormat = (key) => {
23583
+ if (key.indexOf(this.formatSeparator) < 0) {
23584
+ const path2 = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
23585
+ return this.alwaysFormat ? this.format(path2, undefined, lng, {
23586
+ ...options,
23587
+ ...data,
23588
+ interpolationkey: key
23589
+ }) : path2;
23590
+ }
23591
+ const p = key.split(this.formatSeparator);
23592
+ const k = p.shift().trim();
23593
+ const f = p.join(this.formatSeparator).trim();
23594
+ return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
23595
+ ...options,
23596
+ ...data,
23597
+ interpolationkey: k
23598
+ });
23599
+ };
23600
+ this.resetRegExp();
23601
+ const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
23602
+ const skipOnVariables = options?.interpolation?.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
23603
+ const todos = [{
23604
+ regex: this.regexpUnescape,
23605
+ safeValue: (val) => regexSafe(val)
23606
+ }, {
23607
+ regex: this.regexp,
23608
+ safeValue: (val) => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
23609
+ }];
23610
+ todos.forEach((todo) => {
23611
+ replaces = 0;
23612
+ while (match = todo.regex.exec(str)) {
23613
+ const matchedVar = match[1].trim();
23614
+ value = handleFormat(matchedVar);
23615
+ if (value === undefined) {
23616
+ if (typeof missingInterpolationHandler === "function") {
23617
+ const temp = missingInterpolationHandler(str, match, options);
23618
+ value = isString(temp) ? temp : "";
23619
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
23620
+ value = "";
23621
+ } else if (skipOnVariables) {
23622
+ value = match[0];
23623
+ continue;
23624
+ } else {
23625
+ this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
23626
+ value = "";
23627
+ }
23628
+ } else if (!isString(value) && !this.useRawValueToEscape) {
23629
+ value = makeString(value);
23630
+ }
23631
+ const safeValue = todo.safeValue(value);
23632
+ str = str.replace(match[0], safeValue);
23633
+ if (skipOnVariables) {
23634
+ todo.regex.lastIndex += value.length;
23635
+ todo.regex.lastIndex -= match[0].length;
23636
+ } else {
23637
+ todo.regex.lastIndex = 0;
23638
+ }
23639
+ replaces++;
23640
+ if (replaces >= this.maxReplaces) {
23641
+ break;
23642
+ }
23643
+ }
23644
+ });
23645
+ return str;
23646
+ }
23647
+ nest(str, fc, options = {}) {
23648
+ let match;
23649
+ let value;
23650
+ let clonedOptions;
23651
+ const handleHasOptions = (key, inheritedOptions) => {
23652
+ const sep = this.nestingOptionsSeparator;
23653
+ if (key.indexOf(sep) < 0)
23654
+ return key;
23655
+ const c = key.split(new RegExp(`${sep}[ ]*{`));
23656
+ let optionsString = `{${c[1]}`;
23657
+ key = c[0];
23658
+ optionsString = this.interpolate(optionsString, clonedOptions);
23659
+ const matchedSingleQuotes = optionsString.match(/'/g);
23660
+ const matchedDoubleQuotes = optionsString.match(/"/g);
23661
+ if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
23662
+ optionsString = optionsString.replace(/'/g, '"');
23663
+ }
23664
+ try {
23665
+ clonedOptions = JSON.parse(optionsString);
23666
+ if (inheritedOptions)
23667
+ clonedOptions = {
23668
+ ...inheritedOptions,
23669
+ ...clonedOptions
23670
+ };
23671
+ } catch (e) {
23672
+ this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
23673
+ return `${key}${sep}${optionsString}`;
23674
+ }
23675
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1)
23676
+ delete clonedOptions.defaultValue;
23677
+ return key;
23678
+ };
23679
+ while (match = this.nestingRegexp.exec(str)) {
23680
+ let formatters = [];
23681
+ clonedOptions = {
23682
+ ...options
23683
+ };
23684
+ clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
23685
+ clonedOptions.applyPostProcessor = false;
23686
+ delete clonedOptions.defaultValue;
23687
+ const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf("}") + 1 : match[1].indexOf(this.formatSeparator);
23688
+ if (keyEndIndex !== -1) {
23689
+ formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
23690
+ match[1] = match[1].slice(0, keyEndIndex);
23691
+ }
23692
+ value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
23693
+ if (value && match[0] === str && !isString(value))
23694
+ return value;
23695
+ if (!isString(value))
23696
+ value = makeString(value);
23697
+ if (!value) {
23698
+ this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
23699
+ value = "";
23700
+ }
23701
+ if (formatters.length) {
23702
+ value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
23703
+ ...options,
23704
+ interpolationkey: match[1].trim()
23705
+ }), value.trim());
23706
+ }
23707
+ str = str.replace(match[0], value);
23708
+ this.regexp.lastIndex = 0;
23709
+ }
23710
+ return str;
23711
+ }
23712
+ }
23713
+
23714
+ class Formatter {
23715
+ constructor(options = {}) {
23716
+ this.logger = baseLogger.create("formatter");
23717
+ this.options = options;
23718
+ this.init(options);
23719
+ }
23720
+ init(services, options = {
23721
+ interpolation: {}
23722
+ }) {
23723
+ this.formatSeparator = options.interpolation.formatSeparator || ",";
23724
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
23725
+ this.formats = {
23726
+ number: cf((lng, opt) => {
23727
+ const formatter = new Intl.NumberFormat(lng, {
23728
+ ...opt
23729
+ });
23730
+ return (val) => formatter.format(val);
23731
+ }),
23732
+ currency: cf((lng, opt) => {
23733
+ const formatter = new Intl.NumberFormat(lng, {
23734
+ ...opt,
23735
+ style: "currency"
23736
+ });
23737
+ return (val) => formatter.format(val);
23738
+ }),
23739
+ datetime: cf((lng, opt) => {
23740
+ const formatter = new Intl.DateTimeFormat(lng, {
23741
+ ...opt
23742
+ });
23743
+ return (val) => formatter.format(val);
23744
+ }),
23745
+ relativetime: cf((lng, opt) => {
23746
+ const formatter = new Intl.RelativeTimeFormat(lng, {
23747
+ ...opt
23748
+ });
23749
+ return (val) => formatter.format(val, opt.range || "day");
23750
+ }),
23751
+ list: cf((lng, opt) => {
23752
+ const formatter = new Intl.ListFormat(lng, {
23753
+ ...opt
23754
+ });
23755
+ return (val) => formatter.format(val);
23756
+ })
23757
+ };
23758
+ }
23759
+ add(name, fc) {
23760
+ this.formats[name.toLowerCase().trim()] = fc;
23761
+ }
23762
+ addCached(name, fc) {
23763
+ this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
23764
+ }
23765
+ format(value, format, lng, options = {}) {
23766
+ const formats = format.split(this.formatSeparator);
23767
+ if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f) => f.indexOf(")") > -1)) {
23768
+ const lastIndex = formats.findIndex((f) => f.indexOf(")") > -1);
23769
+ formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
23770
+ }
23771
+ const result = formats.reduce((mem, f) => {
23772
+ const {
23773
+ formatName,
23774
+ formatOptions
23775
+ } = parseFormatStr(f);
23776
+ if (this.formats[formatName]) {
23777
+ let formatted = mem;
23778
+ try {
23779
+ const valOptions = options?.formatParams?.[options.interpolationkey] || {};
23780
+ const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
23781
+ formatted = this.formats[formatName](mem, l, {
23782
+ ...formatOptions,
23783
+ ...options,
23784
+ ...valOptions
23785
+ });
23786
+ } catch (error) {
23787
+ this.logger.warn(error);
23788
+ }
23789
+ return formatted;
23790
+ } else {
23791
+ this.logger.warn(`there was no format function for ${formatName}`);
23792
+ }
23793
+ return mem;
23794
+ }, value);
23795
+ return result;
23796
+ }
23797
+ }
23798
+ var isString = (obj) => typeof obj === "string", defer2 = () => {
23799
+ let res;
23800
+ let rej;
23801
+ const promise = new Promise((resolve, reject) => {
23802
+ res = resolve;
23803
+ rej = reject;
23804
+ });
23805
+ promise.resolve = res;
23806
+ promise.reject = rej;
23807
+ return promise;
23808
+ }, makeString = (object) => {
23809
+ if (object == null)
23810
+ return "";
23811
+ return "" + object;
23812
+ }, copy = (a, s, t) => {
23813
+ a.forEach((m) => {
23814
+ if (s[m])
23815
+ t[m] = s[m];
23816
+ });
23817
+ }, lastOfPathSeparatorRegExp, cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key, canNotTraverseDeeper = (object) => !object || isString(object), getLastOfPath = (object, path2, Empty) => {
23818
+ const stack = !isString(path2) ? path2 : path2.split(".");
23819
+ let stackIndex = 0;
23820
+ while (stackIndex < stack.length - 1) {
23821
+ if (canNotTraverseDeeper(object))
23822
+ return {};
23823
+ const key = cleanKey(stack[stackIndex]);
23824
+ if (!object[key] && Empty)
23825
+ object[key] = new Empty;
23826
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
23827
+ object = object[key];
23828
+ } else {
23829
+ object = {};
23830
+ }
23831
+ ++stackIndex;
23832
+ }
23833
+ if (canNotTraverseDeeper(object))
23834
+ return {};
23835
+ return {
23836
+ obj: object,
23837
+ k: cleanKey(stack[stackIndex])
23838
+ };
23839
+ }, setPath = (object, path2, newValue) => {
23840
+ const {
23841
+ obj,
23842
+ k
23843
+ } = getLastOfPath(object, path2, Object);
23844
+ if (obj !== undefined || path2.length === 1) {
23845
+ obj[k] = newValue;
23846
+ return;
23847
+ }
23848
+ let e = path2[path2.length - 1];
23849
+ let p = path2.slice(0, path2.length - 1);
23850
+ let last = getLastOfPath(object, p, Object);
23851
+ while (last.obj === undefined && p.length) {
23852
+ e = `${p[p.length - 1]}.${e}`;
23853
+ p = p.slice(0, p.length - 1);
23854
+ last = getLastOfPath(object, p, Object);
23855
+ if (last?.obj && typeof last.obj[`${last.k}.${e}`] !== "undefined") {
23856
+ last.obj = undefined;
23857
+ }
23858
+ }
23859
+ last.obj[`${last.k}.${e}`] = newValue;
23860
+ }, pushPath = (object, path2, newValue, concat) => {
23861
+ const {
23862
+ obj,
23863
+ k
23864
+ } = getLastOfPath(object, path2, Object);
23865
+ obj[k] = obj[k] || [];
23866
+ obj[k].push(newValue);
23867
+ }, getPath = (object, path2) => {
23868
+ const {
23869
+ obj,
23870
+ k
23871
+ } = getLastOfPath(object, path2);
23872
+ if (!obj)
23873
+ return;
23874
+ if (!Object.prototype.hasOwnProperty.call(obj, k))
23875
+ return;
23876
+ return obj[k];
23877
+ }, getPathWithDefaults = (data, defaultData, key) => {
23878
+ const value = getPath(data, key);
23879
+ if (value !== undefined) {
23880
+ return value;
23881
+ }
23882
+ return getPath(defaultData, key);
23883
+ }, deepExtend = (target, source, overwrite) => {
23884
+ for (const prop in source) {
23885
+ if (prop !== "__proto__" && prop !== "constructor") {
23886
+ if (prop in target) {
23887
+ if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
23888
+ if (overwrite)
23889
+ target[prop] = source[prop];
23890
+ } else {
23891
+ deepExtend(target[prop], source[prop], overwrite);
23892
+ }
23893
+ } else {
23894
+ target[prop] = source[prop];
23895
+ }
23896
+ }
23897
+ }
23898
+ return target;
23899
+ }, regexEscape = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), _entityMap, escape = (data) => {
23900
+ if (isString(data)) {
23901
+ return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
23902
+ }
23903
+ return data;
23904
+ }, chars, looksLikeObjectPathRegExpCache, looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
23905
+ nsSeparator = nsSeparator || "";
23906
+ keySeparator = keySeparator || "";
23907
+ const possibleChars = chars.filter((c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
23908
+ if (possibleChars.length === 0)
23909
+ return true;
23910
+ const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => c === "?" ? "\\?" : c).join("|")})`);
23911
+ let matched = !r.test(key);
23912
+ if (!matched) {
23913
+ const ki = key.indexOf(keySeparator);
23914
+ if (ki > 0 && !r.test(key.substring(0, ki))) {
23915
+ matched = true;
23916
+ }
23917
+ }
23918
+ return matched;
23919
+ }, deepFind = (obj, path2, keySeparator = ".") => {
23920
+ if (!obj)
23921
+ return;
23922
+ if (obj[path2]) {
23923
+ if (!Object.prototype.hasOwnProperty.call(obj, path2))
23924
+ return;
23925
+ return obj[path2];
23926
+ }
23927
+ const tokens = path2.split(keySeparator);
23928
+ let current = obj;
23929
+ for (let i = 0;i < tokens.length; ) {
23930
+ if (!current || typeof current !== "object") {
23931
+ return;
23932
+ }
23933
+ let next;
23934
+ let nextPath = "";
23935
+ for (let j = i;j < tokens.length; ++j) {
23936
+ if (j !== i) {
23937
+ nextPath += keySeparator;
23938
+ }
23939
+ nextPath += tokens[j];
23940
+ next = current[nextPath];
23941
+ if (next !== undefined) {
23942
+ if (["string", "number", "boolean"].indexOf(typeof next) > -1 && j < tokens.length - 1) {
23943
+ continue;
23944
+ }
23945
+ i += j - i + 1;
23946
+ break;
23947
+ }
23948
+ }
23949
+ current = next;
23950
+ }
23951
+ return current;
23952
+ }, getCleanedCode = (code) => code?.replace("_", "-"), consoleLogger, baseLogger, ResourceStore, postProcessor, PATH_KEY, checkedLoadedFor, shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number", Translator, suffixesOrder, dummyRule, deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
23953
+ let path2 = getPathWithDefaults(data, defaultData, key);
23954
+ if (!path2 && ignoreJSONStructure && isString(key)) {
23955
+ path2 = deepFind(data, key, keySeparator);
23956
+ if (path2 === undefined)
23957
+ path2 = deepFind(defaultData, key, keySeparator);
23958
+ }
23959
+ return path2;
23960
+ }, regexSafe = (val) => val.replace(/\$/g, "$$$$"), parseFormatStr = (formatStr) => {
23961
+ let formatName = formatStr.toLowerCase().trim();
23962
+ const formatOptions = {};
23963
+ if (formatStr.indexOf("(") > -1) {
23964
+ const p = formatStr.split("(");
23965
+ formatName = p[0].toLowerCase().trim();
23966
+ const optStr = p[1].substring(0, p[1].length - 1);
23967
+ if (formatName === "currency" && optStr.indexOf(":") < 0) {
23968
+ if (!formatOptions.currency)
23969
+ formatOptions.currency = optStr.trim();
23970
+ } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
23971
+ if (!formatOptions.range)
23972
+ formatOptions.range = optStr.trim();
23973
+ } else {
23974
+ const opts = optStr.split(";");
23975
+ opts.forEach((opt) => {
23976
+ if (opt) {
23977
+ const [key, ...rest] = opt.split(":");
23978
+ const val = rest.join(":").trim().replace(/^'+|'+$/g, "");
23979
+ const trimmedKey = key.trim();
23980
+ if (!formatOptions[trimmedKey])
23981
+ formatOptions[trimmedKey] = val;
23982
+ if (val === "false")
23983
+ formatOptions[trimmedKey] = false;
23984
+ if (val === "true")
23985
+ formatOptions[trimmedKey] = true;
23986
+ if (!isNaN(val))
23987
+ formatOptions[trimmedKey] = parseInt(val, 10);
23988
+ }
23989
+ });
23990
+ }
23991
+ }
23992
+ return {
23993
+ formatName,
23994
+ formatOptions
23995
+ };
23996
+ }, createCachedFormatter = (fn) => {
23997
+ const cache = {};
23998
+ return (v, l, o) => {
23999
+ let optForCache = o;
24000
+ if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
24001
+ optForCache = {
24002
+ ...optForCache,
24003
+ [o.interpolationkey]: undefined
24004
+ };
24005
+ }
24006
+ const key = l + JSON.stringify(optForCache);
24007
+ let frm = cache[key];
24008
+ if (!frm) {
24009
+ frm = fn(getCleanedCode(l), o);
24010
+ cache[key] = frm;
24011
+ }
24012
+ return frm(v);
24013
+ };
24014
+ }, createNonCachedFormatter = (fn) => (v, l, o) => fn(getCleanedCode(l), o)(v), removePending = (q, name) => {
24015
+ if (q.pending[name] !== undefined) {
24016
+ delete q.pending[name];
24017
+ q.pendingCount--;
24018
+ }
24019
+ }, Connector, get = () => ({
24020
+ debug: false,
24021
+ initAsync: true,
24022
+ ns: ["translation"],
24023
+ defaultNS: ["translation"],
24024
+ fallbackLng: ["dev"],
24025
+ fallbackNS: false,
24026
+ supportedLngs: false,
24027
+ nonExplicitSupportedLngs: false,
24028
+ load: "all",
24029
+ preload: false,
24030
+ simplifyPluralSuffix: true,
24031
+ keySeparator: ".",
24032
+ nsSeparator: ":",
24033
+ pluralSeparator: "_",
24034
+ contextSeparator: "_",
24035
+ partialBundledLanguages: false,
24036
+ saveMissing: false,
24037
+ updateMissing: false,
24038
+ saveMissingTo: "fallback",
24039
+ saveMissingPlurals: true,
24040
+ missingKeyHandler: false,
24041
+ missingInterpolationHandler: false,
24042
+ postProcess: false,
24043
+ postProcessPassResolved: false,
24044
+ returnNull: false,
24045
+ returnEmptyString: true,
24046
+ returnObjects: false,
24047
+ joinArrays: false,
24048
+ returnedObjectHandler: false,
24049
+ parseMissingKeyHandler: false,
24050
+ appendNamespaceToMissingKey: false,
24051
+ appendNamespaceToCIMode: false,
24052
+ overloadTranslationOptionHandler: (args) => {
24053
+ let ret = {};
24054
+ if (typeof args[1] === "object")
24055
+ ret = args[1];
24056
+ if (isString(args[1]))
24057
+ ret.defaultValue = args[1];
24058
+ if (isString(args[2]))
24059
+ ret.tDescription = args[2];
24060
+ if (typeof args[2] === "object" || typeof args[3] === "object") {
24061
+ const options = args[3] || args[2];
24062
+ Object.keys(options).forEach((key) => {
24063
+ ret[key] = options[key];
24064
+ });
24065
+ }
24066
+ return ret;
24067
+ },
24068
+ interpolation: {
24069
+ escapeValue: true,
24070
+ format: (value) => value,
24071
+ prefix: "{{",
24072
+ suffix: "}}",
24073
+ formatSeparator: ",",
24074
+ unescapePrefix: "-",
24075
+ nestingPrefix: "$t(",
24076
+ nestingSuffix: ")",
24077
+ nestingOptionsSeparator: ",",
24078
+ maxReplaces: 1000,
24079
+ skipOnVariables: true
24080
+ },
24081
+ cacheInBuiltFormats: true
24082
+ }), transformOptions = (options) => {
24083
+ if (isString(options.ns))
24084
+ options.ns = [options.ns];
24085
+ if (isString(options.fallbackLng))
24086
+ options.fallbackLng = [options.fallbackLng];
24087
+ if (isString(options.fallbackNS))
24088
+ options.fallbackNS = [options.fallbackNS];
24089
+ if (options.supportedLngs?.indexOf?.("cimode") < 0) {
24090
+ options.supportedLngs = options.supportedLngs.concat(["cimode"]);
24091
+ }
24092
+ if (typeof options.initImmediate === "boolean")
24093
+ options.initAsync = options.initImmediate;
24094
+ return options;
24095
+ }, noop = () => {}, bindMemberFunctions = (inst) => {
24096
+ const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
24097
+ mems.forEach((mem) => {
24098
+ if (typeof inst[mem] === "function") {
24099
+ inst[mem] = inst[mem].bind(inst);
24100
+ }
24101
+ });
24102
+ }, I18n, instance, createInstance, dir, init, loadResources, reloadResources, use, changeLanguage, getFixedT, t, exists, setDefaultNamespace, hasLoadedNamespace, loadNamespaces, loadLanguages;
24103
+ var init_i18next = __esm(() => {
24104
+ lastOfPathSeparatorRegExp = /###/g;
24105
+ _entityMap = {
24106
+ "&": "&amp;",
24107
+ "<": "&lt;",
24108
+ ">": "&gt;",
24109
+ '"': "&quot;",
24110
+ "'": "&#39;",
24111
+ "/": "&#x2F;"
24112
+ };
24113
+ chars = [" ", ",", "?", "!", ";"];
24114
+ looksLikeObjectPathRegExpCache = new RegExpCache(20);
24115
+ consoleLogger = {
24116
+ type: "logger",
24117
+ log(args) {
24118
+ this.output("log", args);
24119
+ },
24120
+ warn(args) {
24121
+ this.output("warn", args);
24122
+ },
24123
+ error(args) {
24124
+ this.output("error", args);
24125
+ },
24126
+ output(type, args) {
24127
+ console?.[type]?.apply?.(console, args);
24128
+ }
24129
+ };
24130
+ baseLogger = new Logger;
24131
+ ResourceStore = class ResourceStore extends EventEmitter {
24132
+ constructor(data, options = {
24133
+ ns: ["translation"],
24134
+ defaultNS: "translation"
24135
+ }) {
24136
+ super();
24137
+ this.data = data || {};
24138
+ this.options = options;
24139
+ if (this.options.keySeparator === undefined) {
24140
+ this.options.keySeparator = ".";
24141
+ }
24142
+ if (this.options.ignoreJSONStructure === undefined) {
24143
+ this.options.ignoreJSONStructure = true;
24144
+ }
24145
+ }
24146
+ addNamespaces(ns) {
24147
+ if (this.options.ns.indexOf(ns) < 0) {
24148
+ this.options.ns.push(ns);
24149
+ }
24150
+ }
24151
+ removeNamespaces(ns) {
24152
+ const index = this.options.ns.indexOf(ns);
24153
+ if (index > -1) {
24154
+ this.options.ns.splice(index, 1);
24155
+ }
24156
+ }
24157
+ getResource(lng, ns, key, options = {}) {
24158
+ const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
24159
+ const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
24160
+ let path2;
24161
+ if (lng.indexOf(".") > -1) {
24162
+ path2 = lng.split(".");
24163
+ } else {
24164
+ path2 = [lng, ns];
24165
+ if (key) {
24166
+ if (Array.isArray(key)) {
24167
+ path2.push(...key);
24168
+ } else if (isString(key) && keySeparator) {
24169
+ path2.push(...key.split(keySeparator));
24170
+ } else {
24171
+ path2.push(key);
24172
+ }
24173
+ }
24174
+ }
24175
+ const result = getPath(this.data, path2);
24176
+ if (!result && !ns && !key && lng.indexOf(".") > -1) {
24177
+ lng = path2[0];
24178
+ ns = path2[1];
24179
+ key = path2.slice(2).join(".");
24180
+ }
24181
+ if (result || !ignoreJSONStructure || !isString(key))
24182
+ return result;
24183
+ return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
24184
+ }
24185
+ addResource(lng, ns, key, value, options = {
24186
+ silent: false
24187
+ }) {
24188
+ const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
24189
+ let path2 = [lng, ns];
24190
+ if (key)
24191
+ path2 = path2.concat(keySeparator ? key.split(keySeparator) : key);
24192
+ if (lng.indexOf(".") > -1) {
24193
+ path2 = lng.split(".");
24194
+ value = ns;
24195
+ ns = path2[1];
24196
+ }
24197
+ this.addNamespaces(ns);
24198
+ setPath(this.data, path2, value);
24199
+ if (!options.silent)
24200
+ this.emit("added", lng, ns, key, value);
24201
+ }
24202
+ addResources(lng, ns, resources, options = {
24203
+ silent: false
24204
+ }) {
24205
+ for (const m in resources) {
24206
+ if (isString(resources[m]) || Array.isArray(resources[m]))
24207
+ this.addResource(lng, ns, m, resources[m], {
24208
+ silent: true
24209
+ });
24210
+ }
24211
+ if (!options.silent)
24212
+ this.emit("added", lng, ns, resources);
24213
+ }
24214
+ addResourceBundle(lng, ns, resources, deep, overwrite, options = {
24215
+ silent: false,
24216
+ skipCopy: false
24217
+ }) {
24218
+ let path2 = [lng, ns];
24219
+ if (lng.indexOf(".") > -1) {
24220
+ path2 = lng.split(".");
24221
+ deep = resources;
24222
+ resources = ns;
24223
+ ns = path2[1];
24224
+ }
24225
+ this.addNamespaces(ns);
24226
+ let pack = getPath(this.data, path2) || {};
24227
+ if (!options.skipCopy)
24228
+ resources = JSON.parse(JSON.stringify(resources));
24229
+ if (deep) {
24230
+ deepExtend(pack, resources, overwrite);
24231
+ } else {
24232
+ pack = {
24233
+ ...pack,
24234
+ ...resources
24235
+ };
24236
+ }
24237
+ setPath(this.data, path2, pack);
24238
+ if (!options.silent)
24239
+ this.emit("added", lng, ns, resources);
24240
+ }
24241
+ removeResourceBundle(lng, ns) {
24242
+ if (this.hasResourceBundle(lng, ns)) {
24243
+ delete this.data[lng][ns];
24244
+ }
24245
+ this.removeNamespaces(ns);
24246
+ this.emit("removed", lng, ns);
24247
+ }
24248
+ hasResourceBundle(lng, ns) {
24249
+ return this.getResource(lng, ns) !== undefined;
24250
+ }
24251
+ getResourceBundle(lng, ns) {
24252
+ if (!ns)
24253
+ ns = this.options.defaultNS;
24254
+ return this.getResource(lng, ns);
24255
+ }
24256
+ getDataByLanguage(lng) {
24257
+ return this.data[lng];
24258
+ }
24259
+ hasLanguageSomeTranslations(lng) {
24260
+ const data = this.getDataByLanguage(lng);
24261
+ const n = data && Object.keys(data) || [];
24262
+ return !!n.find((v) => data[v] && Object.keys(data[v]).length > 0);
24263
+ }
24264
+ toJSON() {
24265
+ return this.data;
24266
+ }
24267
+ };
24268
+ postProcessor = {
24269
+ processors: {},
24270
+ addPostProcessor(module) {
24271
+ this.processors[module.name] = module;
24272
+ },
24273
+ handle(processors, value, key, options, translator) {
24274
+ processors.forEach((processor) => {
24275
+ value = this.processors[processor]?.process(value, key, options, translator) ?? value;
24276
+ });
24277
+ return value;
24278
+ }
24279
+ };
24280
+ PATH_KEY = Symbol("i18next/PATH_KEY");
24281
+ checkedLoadedFor = {};
24282
+ Translator = class Translator extends EventEmitter {
24283
+ constructor(services, options = {}) {
24284
+ super();
24285
+ copy(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
24286
+ this.options = options;
24287
+ if (this.options.keySeparator === undefined) {
24288
+ this.options.keySeparator = ".";
24289
+ }
24290
+ this.logger = baseLogger.create("translator");
24291
+ }
24292
+ changeLanguage(lng) {
24293
+ if (lng)
24294
+ this.language = lng;
24295
+ }
24296
+ exists(key, o = {
24297
+ interpolation: {}
24298
+ }) {
24299
+ const opt = {
24300
+ ...o
24301
+ };
24302
+ if (key == null)
24303
+ return false;
24304
+ const resolved = this.resolve(key, opt);
24305
+ if (resolved?.res === undefined)
24306
+ return false;
24307
+ const isObject = shouldHandleAsObject(resolved.res);
24308
+ if (opt.returnObjects === false && isObject) {
24309
+ return false;
24310
+ }
24311
+ return true;
24312
+ }
24313
+ extractFromKey(key, opt) {
24314
+ let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
24315
+ if (nsSeparator === undefined)
24316
+ nsSeparator = ":";
24317
+ const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
24318
+ let namespaces = opt.ns || this.options.defaultNS || [];
24319
+ const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
24320
+ const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
24321
+ if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
24322
+ const m = key.match(this.interpolator.nestingRegexp);
24323
+ if (m && m.length > 0) {
24324
+ return {
24325
+ key,
24326
+ namespaces: isString(namespaces) ? [namespaces] : namespaces
24327
+ };
24328
+ }
24329
+ const parts = key.split(nsSeparator);
24330
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1)
24331
+ namespaces = parts.shift();
24332
+ key = parts.join(keySeparator);
24333
+ }
24334
+ return {
24335
+ key,
24336
+ namespaces: isString(namespaces) ? [namespaces] : namespaces
24337
+ };
24338
+ }
24339
+ translate(keys, o, lastKey) {
24340
+ let opt = typeof o === "object" ? {
24341
+ ...o
24342
+ } : o;
24343
+ if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
24344
+ opt = this.options.overloadTranslationOptionHandler(arguments);
24345
+ }
24346
+ if (typeof opt === "object")
24347
+ opt = {
24348
+ ...opt
24349
+ };
24350
+ if (!opt)
24351
+ opt = {};
24352
+ if (keys == null)
24353
+ return "";
24354
+ if (typeof keys === "function")
24355
+ keys = keysFromSelector(keys, {
24356
+ ...this.options,
24357
+ ...opt
24358
+ });
24359
+ if (!Array.isArray(keys))
24360
+ keys = [String(keys)];
24361
+ const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
24362
+ const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
24363
+ const {
24364
+ key,
24365
+ namespaces
24366
+ } = this.extractFromKey(keys[keys.length - 1], opt);
24367
+ const namespace = namespaces[namespaces.length - 1];
24368
+ let nsSeparator = opt.nsSeparator !== undefined ? opt.nsSeparator : this.options.nsSeparator;
24369
+ if (nsSeparator === undefined)
24370
+ nsSeparator = ":";
24371
+ const lng = opt.lng || this.language;
24372
+ const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
24373
+ if (lng?.toLowerCase() === "cimode") {
24374
+ if (appendNamespaceToCIMode) {
24375
+ if (returnDetails) {
24376
+ return {
24377
+ res: `${namespace}${nsSeparator}${key}`,
24378
+ usedKey: key,
24379
+ exactUsedKey: key,
24380
+ usedLng: lng,
24381
+ usedNS: namespace,
24382
+ usedParams: this.getUsedParamsDetails(opt)
24383
+ };
24384
+ }
24385
+ return `${namespace}${nsSeparator}${key}`;
24386
+ }
24387
+ if (returnDetails) {
24388
+ return {
24389
+ res: key,
24390
+ usedKey: key,
24391
+ exactUsedKey: key,
24392
+ usedLng: lng,
24393
+ usedNS: namespace,
24394
+ usedParams: this.getUsedParamsDetails(opt)
24395
+ };
24396
+ }
24397
+ return key;
24398
+ }
24399
+ const resolved = this.resolve(keys, opt);
24400
+ let res = resolved?.res;
24401
+ const resUsedKey = resolved?.usedKey || key;
24402
+ const resExactUsedKey = resolved?.exactUsedKey || key;
24403
+ const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
24404
+ const joinArrays = opt.joinArrays !== undefined ? opt.joinArrays : this.options.joinArrays;
24405
+ const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
24406
+ const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
24407
+ const hasDefaultValue = Translator.hasDefaultValue(opt);
24408
+ const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : "";
24409
+ const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
24410
+ ordinal: false
24411
+ }) : "";
24412
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
24413
+ const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
24414
+ let resForObjHndl = res;
24415
+ if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
24416
+ resForObjHndl = defaultValue;
24417
+ }
24418
+ const handleAsObject = shouldHandleAsObject(resForObjHndl);
24419
+ const resType = Object.prototype.toString.apply(resForObjHndl);
24420
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
24421
+ if (!opt.returnObjects && !this.options.returnObjects) {
24422
+ if (!this.options.returnedObjectHandler) {
24423
+ this.logger.warn("accessing an object - but returnObjects options is not enabled!");
24424
+ }
24425
+ const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
24426
+ ...opt,
24427
+ ns: namespaces
24428
+ }) : `key '${key} (${this.language})' returned an object instead of string.`;
24429
+ if (returnDetails) {
24430
+ resolved.res = r;
24431
+ resolved.usedParams = this.getUsedParamsDetails(opt);
24432
+ return resolved;
24433
+ }
24434
+ return r;
24435
+ }
24436
+ if (keySeparator) {
24437
+ const resTypeIsArray = Array.isArray(resForObjHndl);
24438
+ const copy2 = resTypeIsArray ? [] : {};
24439
+ const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
24440
+ for (const m in resForObjHndl) {
24441
+ if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
24442
+ const deepKey = `${newKeyToUse}${keySeparator}${m}`;
24443
+ if (hasDefaultValue && !res) {
24444
+ copy2[m] = this.translate(deepKey, {
24445
+ ...opt,
24446
+ defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : undefined,
24447
+ ...{
24448
+ joinArrays: false,
24449
+ ns: namespaces
24450
+ }
24451
+ });
24452
+ } else {
24453
+ copy2[m] = this.translate(deepKey, {
24454
+ ...opt,
24455
+ ...{
24456
+ joinArrays: false,
24457
+ ns: namespaces
24458
+ }
24459
+ });
24460
+ }
24461
+ if (copy2[m] === deepKey)
24462
+ copy2[m] = resForObjHndl[m];
24463
+ }
24464
+ }
24465
+ res = copy2;
24466
+ }
24467
+ } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
24468
+ res = res.join(joinArrays);
24469
+ if (res)
24470
+ res = this.extendTranslation(res, keys, opt, lastKey);
24471
+ } else {
24472
+ let usedDefault = false;
24473
+ let usedKey = false;
24474
+ if (!this.isValidLookup(res) && hasDefaultValue) {
24475
+ usedDefault = true;
24476
+ res = defaultValue;
24477
+ }
24478
+ if (!this.isValidLookup(res)) {
24479
+ usedKey = true;
24480
+ res = key;
24481
+ }
24482
+ const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
24483
+ const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
24484
+ const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
24485
+ if (usedKey || usedDefault || updateMissing) {
24486
+ this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue : res);
24487
+ if (keySeparator) {
24488
+ const fk = this.resolve(key, {
24489
+ ...opt,
24490
+ keySeparator: false
24491
+ });
24492
+ if (fk && fk.res)
24493
+ this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
24494
+ }
24495
+ let lngs = [];
24496
+ const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
24497
+ if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
24498
+ for (let i = 0;i < fallbackLngs.length; i++) {
24499
+ lngs.push(fallbackLngs[i]);
24500
+ }
24501
+ } else if (this.options.saveMissingTo === "all") {
24502
+ lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
24503
+ } else {
24504
+ lngs.push(opt.lng || this.language);
24505
+ }
24506
+ const send = (l, k, specificDefaultValue) => {
24507
+ const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
24508
+ if (this.options.missingKeyHandler) {
24509
+ this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
24510
+ } else if (this.backendConnector?.saveMissing) {
24511
+ this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
24512
+ }
24513
+ this.emit("missingKey", l, namespace, k, res);
24514
+ };
24515
+ if (this.options.saveMissing) {
24516
+ if (this.options.saveMissingPlurals && needsPluralHandling) {
24517
+ lngs.forEach((language) => {
24518
+ const suffixes = this.pluralResolver.getSuffixes(language, opt);
24519
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
24520
+ suffixes.push(`${this.options.pluralSeparator}zero`);
24521
+ }
24522
+ suffixes.forEach((suffix) => {
24523
+ send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
24524
+ });
24525
+ });
24526
+ } else {
24527
+ send(lngs, key, defaultValue);
24528
+ }
24529
+ }
24530
+ }
24531
+ res = this.extendTranslation(res, keys, opt, resolved, lastKey);
24532
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
24533
+ res = `${namespace}${nsSeparator}${key}`;
24534
+ }
24535
+ if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
24536
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : undefined, opt);
24537
+ }
24538
+ }
24539
+ if (returnDetails) {
24540
+ resolved.res = res;
24541
+ resolved.usedParams = this.getUsedParamsDetails(opt);
24542
+ return resolved;
24543
+ }
24544
+ return res;
24545
+ }
24546
+ extendTranslation(res, key, opt, resolved, lastKey) {
24547
+ if (this.i18nFormat?.parse) {
24548
+ res = this.i18nFormat.parse(res, {
24549
+ ...this.options.interpolation.defaultVariables,
24550
+ ...opt
24551
+ }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
24552
+ resolved
24553
+ });
24554
+ } else if (!opt.skipInterpolation) {
24555
+ if (opt.interpolation)
24556
+ this.interpolator.init({
24557
+ ...opt,
24558
+ ...{
24559
+ interpolation: {
24560
+ ...this.options.interpolation,
24561
+ ...opt.interpolation
24562
+ }
24563
+ }
24564
+ });
24565
+ const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== undefined ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
24566
+ let nestBef;
24567
+ if (skipOnVariables) {
24568
+ const nb = res.match(this.interpolator.nestingRegexp);
24569
+ nestBef = nb && nb.length;
24570
+ }
24571
+ let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
24572
+ if (this.options.interpolation.defaultVariables)
24573
+ data = {
24574
+ ...this.options.interpolation.defaultVariables,
24575
+ ...data
24576
+ };
24577
+ res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
24578
+ if (skipOnVariables) {
24579
+ const na = res.match(this.interpolator.nestingRegexp);
24580
+ const nestAft = na && na.length;
24581
+ if (nestBef < nestAft)
24582
+ opt.nest = false;
24583
+ }
24584
+ if (!opt.lng && resolved && resolved.res)
24585
+ opt.lng = this.language || resolved.usedLng;
24586
+ if (opt.nest !== false)
24587
+ res = this.interpolator.nest(res, (...args) => {
24588
+ if (lastKey?.[0] === args[0] && !opt.context) {
24589
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
24590
+ return null;
24591
+ }
24592
+ return this.translate(...args, key);
24593
+ }, opt);
24594
+ if (opt.interpolation)
24595
+ this.interpolator.reset();
24596
+ }
24597
+ const postProcess = opt.postProcess || this.options.postProcess;
24598
+ const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
24599
+ if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
24600
+ res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
24601
+ i18nResolved: {
24602
+ ...resolved,
24603
+ usedParams: this.getUsedParamsDetails(opt)
24604
+ },
24605
+ ...opt
24606
+ } : opt, this);
24607
+ }
24608
+ return res;
24609
+ }
24610
+ resolve(keys, opt = {}) {
24611
+ let found;
24612
+ let usedKey;
24613
+ let exactUsedKey;
24614
+ let usedLng;
24615
+ let usedNS;
24616
+ if (isString(keys))
24617
+ keys = [keys];
24618
+ keys.forEach((k) => {
24619
+ if (this.isValidLookup(found))
24620
+ return;
24621
+ const extracted = this.extractFromKey(k, opt);
24622
+ const key = extracted.key;
24623
+ usedKey = key;
24624
+ let namespaces = extracted.namespaces;
24625
+ if (this.options.fallbackNS)
24626
+ namespaces = namespaces.concat(this.options.fallbackNS);
24627
+ const needsPluralHandling = opt.count !== undefined && !isString(opt.count);
24628
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
24629
+ const needsContextHandling = opt.context !== undefined && (isString(opt.context) || typeof opt.context === "number") && opt.context !== "";
24630
+ const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
24631
+ namespaces.forEach((ns) => {
24632
+ if (this.isValidLookup(found))
24633
+ return;
24634
+ usedNS = ns;
24635
+ if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
24636
+ checkedLoadedFor[`${codes[0]}-${ns}`] = true;
24637
+ 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!!!");
24638
+ }
24639
+ codes.forEach((code) => {
24640
+ if (this.isValidLookup(found))
24641
+ return;
24642
+ usedLng = code;
24643
+ const finalKeys = [key];
24644
+ if (this.i18nFormat?.addLookupKeys) {
24645
+ this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
24646
+ } else {
24647
+ let pluralSuffix;
24648
+ if (needsPluralHandling)
24649
+ pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
24650
+ const zeroSuffix = `${this.options.pluralSeparator}zero`;
24651
+ const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
24652
+ if (needsPluralHandling) {
24653
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
24654
+ finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
24655
+ }
24656
+ finalKeys.push(key + pluralSuffix);
24657
+ if (needsZeroSuffixLookup) {
24658
+ finalKeys.push(key + zeroSuffix);
24659
+ }
24660
+ }
24661
+ if (needsContextHandling) {
24662
+ const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
24663
+ finalKeys.push(contextKey);
24664
+ if (needsPluralHandling) {
24665
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
24666
+ finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
24667
+ }
24668
+ finalKeys.push(contextKey + pluralSuffix);
24669
+ if (needsZeroSuffixLookup) {
24670
+ finalKeys.push(contextKey + zeroSuffix);
24671
+ }
24672
+ }
24673
+ }
24674
+ }
24675
+ let possibleKey;
24676
+ while (possibleKey = finalKeys.pop()) {
24677
+ if (!this.isValidLookup(found)) {
24678
+ exactUsedKey = possibleKey;
24679
+ found = this.getResource(code, ns, possibleKey, opt);
24680
+ }
24681
+ }
24682
+ });
24683
+ });
24684
+ });
24685
+ return {
24686
+ res: found,
24687
+ usedKey,
24688
+ exactUsedKey,
24689
+ usedLng,
24690
+ usedNS
24691
+ };
24692
+ }
24693
+ isValidLookup(res) {
24694
+ return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
24695
+ }
24696
+ getResource(code, ns, key, options = {}) {
24697
+ if (this.i18nFormat?.getResource)
24698
+ return this.i18nFormat.getResource(code, ns, key, options);
24699
+ return this.resourceStore.getResource(code, ns, key, options);
24700
+ }
24701
+ getUsedParamsDetails(options = {}) {
24702
+ const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
24703
+ const useOptionsReplaceForData = options.replace && !isString(options.replace);
24704
+ let data = useOptionsReplaceForData ? options.replace : options;
24705
+ if (useOptionsReplaceForData && typeof options.count !== "undefined") {
24706
+ data.count = options.count;
24707
+ }
24708
+ if (this.options.interpolation.defaultVariables) {
24709
+ data = {
24710
+ ...this.options.interpolation.defaultVariables,
24711
+ ...data
24712
+ };
24713
+ }
24714
+ if (!useOptionsReplaceForData) {
24715
+ data = {
24716
+ ...data
24717
+ };
24718
+ for (const key of optionsKeys) {
24719
+ delete data[key];
24720
+ }
24721
+ }
24722
+ return data;
24723
+ }
24724
+ static hasDefaultValue(options) {
24725
+ const prefix = "defaultValue";
24726
+ for (const option in options) {
24727
+ if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && options[option] !== undefined) {
24728
+ return true;
24729
+ }
24730
+ }
24731
+ return false;
24732
+ }
24733
+ };
24734
+ suffixesOrder = {
24735
+ zero: 0,
24736
+ one: 1,
24737
+ two: 2,
24738
+ few: 3,
24739
+ many: 4,
24740
+ other: 5
24741
+ };
24742
+ dummyRule = {
24743
+ select: (count) => count === 1 ? "one" : "other",
24744
+ resolvedOptions: () => ({
24745
+ pluralCategories: ["one", "other"]
24746
+ })
24747
+ };
24748
+ Connector = class Connector extends EventEmitter {
24749
+ constructor(backend, store, services, options = {}) {
24750
+ super();
24751
+ this.backend = backend;
24752
+ this.store = store;
24753
+ this.services = services;
24754
+ this.languageUtils = services.languageUtils;
24755
+ this.options = options;
24756
+ this.logger = baseLogger.create("backendConnector");
24757
+ this.waitingReads = [];
24758
+ this.maxParallelReads = options.maxParallelReads || 10;
24759
+ this.readingCalls = 0;
24760
+ this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
24761
+ this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
24762
+ this.state = {};
24763
+ this.queue = [];
24764
+ this.backend?.init?.(services, options.backend, options);
24765
+ }
24766
+ queueLoad(languages, namespaces, options, callback) {
24767
+ const toLoad = {};
24768
+ const pending = {};
24769
+ const toLoadLanguages = {};
24770
+ const toLoadNamespaces = {};
24771
+ languages.forEach((lng) => {
24772
+ let hasAllNamespaces = true;
24773
+ namespaces.forEach((ns) => {
24774
+ const name = `${lng}|${ns}`;
24775
+ if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
24776
+ this.state[name] = 2;
24777
+ } else if (this.state[name] < 0)
24778
+ ;
24779
+ else if (this.state[name] === 1) {
24780
+ if (pending[name] === undefined)
24781
+ pending[name] = true;
24782
+ } else {
24783
+ this.state[name] = 1;
24784
+ hasAllNamespaces = false;
24785
+ if (pending[name] === undefined)
24786
+ pending[name] = true;
24787
+ if (toLoad[name] === undefined)
24788
+ toLoad[name] = true;
24789
+ if (toLoadNamespaces[ns] === undefined)
24790
+ toLoadNamespaces[ns] = true;
24791
+ }
24792
+ });
24793
+ if (!hasAllNamespaces)
24794
+ toLoadLanguages[lng] = true;
24795
+ });
24796
+ if (Object.keys(toLoad).length || Object.keys(pending).length) {
24797
+ this.queue.push({
24798
+ pending,
24799
+ pendingCount: Object.keys(pending).length,
24800
+ loaded: {},
24801
+ errors: [],
24802
+ callback
24803
+ });
24804
+ }
24805
+ return {
24806
+ toLoad: Object.keys(toLoad),
24807
+ pending: Object.keys(pending),
24808
+ toLoadLanguages: Object.keys(toLoadLanguages),
24809
+ toLoadNamespaces: Object.keys(toLoadNamespaces)
24810
+ };
24811
+ }
24812
+ loaded(name, err, data) {
24813
+ const s = name.split("|");
24814
+ const lng = s[0];
24815
+ const ns = s[1];
24816
+ if (err)
24817
+ this.emit("failedLoading", lng, ns, err);
24818
+ if (!err && data) {
24819
+ this.store.addResourceBundle(lng, ns, data, undefined, undefined, {
24820
+ skipCopy: true
24821
+ });
24822
+ }
24823
+ this.state[name] = err ? -1 : 2;
24824
+ if (err && data)
24825
+ this.state[name] = 0;
24826
+ const loaded = {};
24827
+ this.queue.forEach((q) => {
24828
+ pushPath(q.loaded, [lng], ns);
24829
+ removePending(q, name);
24830
+ if (err)
24831
+ q.errors.push(err);
24832
+ if (q.pendingCount === 0 && !q.done) {
24833
+ Object.keys(q.loaded).forEach((l) => {
24834
+ if (!loaded[l])
24835
+ loaded[l] = {};
24836
+ const loadedKeys = q.loaded[l];
24837
+ if (loadedKeys.length) {
24838
+ loadedKeys.forEach((n) => {
24839
+ if (loaded[l][n] === undefined)
24840
+ loaded[l][n] = true;
24841
+ });
24842
+ }
24843
+ });
24844
+ q.done = true;
24845
+ if (q.errors.length) {
24846
+ q.callback(q.errors);
24847
+ } else {
24848
+ q.callback();
24849
+ }
24850
+ }
24851
+ });
24852
+ this.emit("loaded", loaded);
24853
+ this.queue = this.queue.filter((q) => !q.done);
24854
+ }
24855
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
24856
+ if (!lng.length)
24857
+ return callback(null, {});
24858
+ if (this.readingCalls >= this.maxParallelReads) {
24859
+ this.waitingReads.push({
24860
+ lng,
24861
+ ns,
24862
+ fcName,
24863
+ tried,
24864
+ wait,
24865
+ callback
24866
+ });
24867
+ return;
24868
+ }
24869
+ this.readingCalls++;
24870
+ const resolver = (err, data) => {
24871
+ this.readingCalls--;
24872
+ if (this.waitingReads.length > 0) {
24873
+ const next = this.waitingReads.shift();
24874
+ this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
24875
+ }
24876
+ if (err && data && tried < this.maxRetries) {
24877
+ setTimeout(() => {
24878
+ this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
24879
+ }, wait);
24880
+ return;
24881
+ }
24882
+ callback(err, data);
24883
+ };
24884
+ const fc = this.backend[fcName].bind(this.backend);
24885
+ if (fc.length === 2) {
24886
+ try {
24887
+ const r = fc(lng, ns);
24888
+ if (r && typeof r.then === "function") {
24889
+ r.then((data) => resolver(null, data)).catch(resolver);
24890
+ } else {
24891
+ resolver(null, r);
24892
+ }
24893
+ } catch (err) {
24894
+ resolver(err);
24895
+ }
24896
+ return;
24897
+ }
24898
+ return fc(lng, ns, resolver);
24899
+ }
24900
+ prepareLoading(languages, namespaces, options = {}, callback) {
24901
+ if (!this.backend) {
24902
+ this.logger.warn("No backend was added via i18next.use. Will not load resources.");
24903
+ return callback && callback();
24904
+ }
24905
+ if (isString(languages))
24906
+ languages = this.languageUtils.toResolveHierarchy(languages);
24907
+ if (isString(namespaces))
24908
+ namespaces = [namespaces];
24909
+ const toLoad = this.queueLoad(languages, namespaces, options, callback);
24910
+ if (!toLoad.toLoad.length) {
24911
+ if (!toLoad.pending.length)
24912
+ callback();
24913
+ return null;
24914
+ }
24915
+ toLoad.toLoad.forEach((name) => {
24916
+ this.loadOne(name);
24917
+ });
24918
+ }
24919
+ load(languages, namespaces, callback) {
24920
+ this.prepareLoading(languages, namespaces, {}, callback);
24921
+ }
24922
+ reload(languages, namespaces, callback) {
24923
+ this.prepareLoading(languages, namespaces, {
24924
+ reload: true
24925
+ }, callback);
24926
+ }
24927
+ loadOne(name, prefix = "") {
24928
+ const s = name.split("|");
24929
+ const lng = s[0];
24930
+ const ns = s[1];
24931
+ this.read(lng, ns, "read", undefined, undefined, (err, data) => {
24932
+ if (err)
24933
+ this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
24934
+ if (!err && data)
24935
+ this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
24936
+ this.loaded(name, err, data);
24937
+ });
24938
+ }
24939
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {}) {
24940
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
24941
+ 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!!!");
24942
+ return;
24943
+ }
24944
+ if (key === undefined || key === null || key === "")
24945
+ return;
24946
+ if (this.backend?.create) {
24947
+ const opts = {
24948
+ ...options,
24949
+ isUpdate
24950
+ };
24951
+ const fc = this.backend.create.bind(this.backend);
24952
+ if (fc.length < 6) {
24953
+ try {
24954
+ let r;
24955
+ if (fc.length === 5) {
24956
+ r = fc(languages, namespace, key, fallbackValue, opts);
24957
+ } else {
24958
+ r = fc(languages, namespace, key, fallbackValue);
24959
+ }
24960
+ if (r && typeof r.then === "function") {
24961
+ r.then((data) => clb(null, data)).catch(clb);
24962
+ } else {
24963
+ clb(null, r);
24964
+ }
24965
+ } catch (err) {
24966
+ clb(err);
24967
+ }
24968
+ } else {
24969
+ fc(languages, namespace, key, fallbackValue, clb, opts);
24970
+ }
24971
+ }
24972
+ if (!languages || !languages[0])
24973
+ return;
24974
+ this.store.addResource(languages[0], namespace, key, fallbackValue);
24975
+ }
24976
+ };
24977
+ I18n = class I18n extends EventEmitter {
24978
+ constructor(options = {}, callback) {
24979
+ super();
24980
+ this.options = transformOptions(options);
24981
+ this.services = {};
24982
+ this.logger = baseLogger;
24983
+ this.modules = {
24984
+ external: []
24985
+ };
24986
+ bindMemberFunctions(this);
24987
+ if (callback && !this.isInitialized && !options.isClone) {
24988
+ if (!this.options.initAsync) {
24989
+ this.init(options, callback);
24990
+ return this;
24991
+ }
24992
+ setTimeout(() => {
24993
+ this.init(options, callback);
24994
+ }, 0);
24995
+ }
24996
+ }
24997
+ init(options = {}, callback) {
24998
+ this.isInitializing = true;
24999
+ if (typeof options === "function") {
25000
+ callback = options;
25001
+ options = {};
25002
+ }
25003
+ if (options.defaultNS == null && options.ns) {
25004
+ if (isString(options.ns)) {
25005
+ options.defaultNS = options.ns;
25006
+ } else if (options.ns.indexOf("translation") < 0) {
25007
+ options.defaultNS = options.ns[0];
25008
+ }
25009
+ }
25010
+ const defOpts = get();
25011
+ this.options = {
25012
+ ...defOpts,
25013
+ ...this.options,
25014
+ ...transformOptions(options)
25015
+ };
25016
+ this.options.interpolation = {
25017
+ ...defOpts.interpolation,
25018
+ ...this.options.interpolation
25019
+ };
25020
+ if (options.keySeparator !== undefined) {
25021
+ this.options.userDefinedKeySeparator = options.keySeparator;
25022
+ }
25023
+ if (options.nsSeparator !== undefined) {
25024
+ this.options.userDefinedNsSeparator = options.nsSeparator;
25025
+ }
25026
+ const createClassOnDemand = (ClassOrObject) => {
25027
+ if (!ClassOrObject)
25028
+ return null;
25029
+ if (typeof ClassOrObject === "function")
25030
+ return new ClassOrObject;
25031
+ return ClassOrObject;
25032
+ };
25033
+ if (!this.options.isClone) {
25034
+ if (this.modules.logger) {
25035
+ baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
25036
+ } else {
25037
+ baseLogger.init(null, this.options);
25038
+ }
25039
+ let formatter;
25040
+ if (this.modules.formatter) {
25041
+ formatter = this.modules.formatter;
25042
+ } else {
25043
+ formatter = Formatter;
25044
+ }
25045
+ const lu = new LanguageUtil(this.options);
25046
+ this.store = new ResourceStore(this.options.resources, this.options);
25047
+ const s = this.services;
25048
+ s.logger = baseLogger;
25049
+ s.resourceStore = this.store;
25050
+ s.languageUtils = lu;
25051
+ s.pluralResolver = new PluralResolver(lu, {
25052
+ prepend: this.options.pluralSeparator,
25053
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
25054
+ });
25055
+ const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
25056
+ if (usingLegacyFormatFunction) {
25057
+ this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
25058
+ }
25059
+ if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
25060
+ s.formatter = createClassOnDemand(formatter);
25061
+ if (s.formatter.init)
25062
+ s.formatter.init(s, this.options);
25063
+ this.options.interpolation.format = s.formatter.format.bind(s.formatter);
25064
+ }
25065
+ s.interpolator = new Interpolator(this.options);
25066
+ s.utils = {
25067
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
25068
+ };
25069
+ s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
25070
+ s.backendConnector.on("*", (event, ...args) => {
25071
+ this.emit(event, ...args);
25072
+ });
25073
+ if (this.modules.languageDetector) {
25074
+ s.languageDetector = createClassOnDemand(this.modules.languageDetector);
25075
+ if (s.languageDetector.init)
25076
+ s.languageDetector.init(s, this.options.detection, this.options);
25077
+ }
25078
+ if (this.modules.i18nFormat) {
25079
+ s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
25080
+ if (s.i18nFormat.init)
25081
+ s.i18nFormat.init(this);
25082
+ }
25083
+ this.translator = new Translator(this.services, this.options);
25084
+ this.translator.on("*", (event, ...args) => {
25085
+ this.emit(event, ...args);
25086
+ });
25087
+ this.modules.external.forEach((m) => {
25088
+ if (m.init)
25089
+ m.init(this);
25090
+ });
25091
+ }
25092
+ this.format = this.options.interpolation.format;
25093
+ if (!callback)
25094
+ callback = noop;
25095
+ if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
25096
+ const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
25097
+ if (codes.length > 0 && codes[0] !== "dev")
25098
+ this.options.lng = codes[0];
25099
+ }
25100
+ if (!this.services.languageDetector && !this.options.lng) {
25101
+ this.logger.warn("init: no languageDetector is used and no lng is defined");
25102
+ }
25103
+ const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
25104
+ storeApi.forEach((fcName) => {
25105
+ this[fcName] = (...args) => this.store[fcName](...args);
25106
+ });
25107
+ const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
25108
+ storeApiChained.forEach((fcName) => {
25109
+ this[fcName] = (...args) => {
25110
+ this.store[fcName](...args);
25111
+ return this;
25112
+ };
25113
+ });
25114
+ const deferred = defer2();
25115
+ const load2 = () => {
25116
+ const finish = (err, t) => {
25117
+ this.isInitializing = false;
25118
+ if (this.isInitialized && !this.initializedStoreOnce)
25119
+ this.logger.warn("init: i18next is already initialized. You should call init just once!");
25120
+ this.isInitialized = true;
25121
+ if (!this.options.isClone)
25122
+ this.logger.log("initialized", this.options);
25123
+ this.emit("initialized", this.options);
25124
+ deferred.resolve(t);
25125
+ callback(err, t);
25126
+ };
25127
+ if (this.languages && !this.isInitialized)
25128
+ return finish(null, this.t.bind(this));
25129
+ this.changeLanguage(this.options.lng, finish);
25130
+ };
25131
+ if (this.options.resources || !this.options.initAsync) {
25132
+ load2();
25133
+ } else {
25134
+ setTimeout(load2, 0);
25135
+ }
25136
+ return deferred;
25137
+ }
25138
+ loadResources(language, callback = noop) {
25139
+ let usedCallback = callback;
25140
+ const usedLng = isString(language) ? language : this.language;
25141
+ if (typeof language === "function")
25142
+ usedCallback = language;
25143
+ if (!this.options.resources || this.options.partialBundledLanguages) {
25144
+ if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0))
25145
+ return usedCallback();
25146
+ const toLoad = [];
25147
+ const append = (lng) => {
25148
+ if (!lng)
25149
+ return;
25150
+ if (lng === "cimode")
25151
+ return;
25152
+ const lngs = this.services.languageUtils.toResolveHierarchy(lng);
25153
+ lngs.forEach((l) => {
25154
+ if (l === "cimode")
25155
+ return;
25156
+ if (toLoad.indexOf(l) < 0)
25157
+ toLoad.push(l);
25158
+ });
25159
+ };
25160
+ if (!usedLng) {
25161
+ const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
25162
+ fallbacks.forEach((l) => append(l));
25163
+ } else {
25164
+ append(usedLng);
25165
+ }
25166
+ this.options.preload?.forEach?.((l) => append(l));
25167
+ this.services.backendConnector.load(toLoad, this.options.ns, (e) => {
25168
+ if (!e && !this.resolvedLanguage && this.language)
25169
+ this.setResolvedLanguage(this.language);
25170
+ usedCallback(e);
25171
+ });
25172
+ } else {
25173
+ usedCallback(null);
25174
+ }
25175
+ }
25176
+ reloadResources(lngs, ns, callback) {
25177
+ const deferred = defer2();
25178
+ if (typeof lngs === "function") {
25179
+ callback = lngs;
25180
+ lngs = undefined;
25181
+ }
25182
+ if (typeof ns === "function") {
25183
+ callback = ns;
25184
+ ns = undefined;
25185
+ }
25186
+ if (!lngs)
25187
+ lngs = this.languages;
25188
+ if (!ns)
25189
+ ns = this.options.ns;
25190
+ if (!callback)
25191
+ callback = noop;
25192
+ this.services.backendConnector.reload(lngs, ns, (err) => {
25193
+ deferred.resolve();
25194
+ callback(err);
25195
+ });
25196
+ return deferred;
25197
+ }
25198
+ use(module) {
25199
+ if (!module)
25200
+ throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
25201
+ if (!module.type)
25202
+ throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
25203
+ if (module.type === "backend") {
25204
+ this.modules.backend = module;
25205
+ }
25206
+ if (module.type === "logger" || module.log && module.warn && module.error) {
25207
+ this.modules.logger = module;
25208
+ }
25209
+ if (module.type === "languageDetector") {
25210
+ this.modules.languageDetector = module;
25211
+ }
25212
+ if (module.type === "i18nFormat") {
25213
+ this.modules.i18nFormat = module;
25214
+ }
25215
+ if (module.type === "postProcessor") {
25216
+ postProcessor.addPostProcessor(module);
25217
+ }
25218
+ if (module.type === "formatter") {
25219
+ this.modules.formatter = module;
25220
+ }
25221
+ if (module.type === "3rdParty") {
25222
+ this.modules.external.push(module);
25223
+ }
25224
+ return this;
25225
+ }
25226
+ setResolvedLanguage(l) {
25227
+ if (!l || !this.languages)
25228
+ return;
25229
+ if (["cimode", "dev"].indexOf(l) > -1)
25230
+ return;
25231
+ for (let li = 0;li < this.languages.length; li++) {
25232
+ const lngInLngs = this.languages[li];
25233
+ if (["cimode", "dev"].indexOf(lngInLngs) > -1)
25234
+ continue;
25235
+ if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
25236
+ this.resolvedLanguage = lngInLngs;
25237
+ break;
25238
+ }
25239
+ }
25240
+ if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
25241
+ this.resolvedLanguage = l;
25242
+ this.languages.unshift(l);
25243
+ }
25244
+ }
25245
+ changeLanguage(lng, callback) {
25246
+ this.isLanguageChangingTo = lng;
25247
+ const deferred = defer2();
25248
+ this.emit("languageChanging", lng);
25249
+ const setLngProps = (l) => {
25250
+ this.language = l;
25251
+ this.languages = this.services.languageUtils.toResolveHierarchy(l);
25252
+ this.resolvedLanguage = undefined;
25253
+ this.setResolvedLanguage(l);
25254
+ };
25255
+ const done = (err, l) => {
25256
+ if (l) {
25257
+ if (this.isLanguageChangingTo === lng) {
25258
+ setLngProps(l);
25259
+ this.translator.changeLanguage(l);
25260
+ this.isLanguageChangingTo = undefined;
25261
+ this.emit("languageChanged", l);
25262
+ this.logger.log("languageChanged", l);
25263
+ }
25264
+ } else {
25265
+ this.isLanguageChangingTo = undefined;
25266
+ }
25267
+ deferred.resolve((...args) => this.t(...args));
25268
+ if (callback)
25269
+ callback(err, (...args) => this.t(...args));
25270
+ };
25271
+ const setLng = (lngs) => {
25272
+ if (!lng && !lngs && this.services.languageDetector)
25273
+ lngs = [];
25274
+ const fl = isString(lngs) ? lngs : lngs && lngs[0];
25275
+ const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
25276
+ if (l) {
25277
+ if (!this.language) {
25278
+ setLngProps(l);
25279
+ }
25280
+ if (!this.translator.language)
25281
+ this.translator.changeLanguage(l);
25282
+ this.services.languageDetector?.cacheUserLanguage?.(l);
25283
+ }
25284
+ this.loadResources(l, (err) => {
25285
+ done(err, l);
25286
+ });
25287
+ };
25288
+ if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
25289
+ setLng(this.services.languageDetector.detect());
25290
+ } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
25291
+ if (this.services.languageDetector.detect.length === 0) {
25292
+ this.services.languageDetector.detect().then(setLng);
25293
+ } else {
25294
+ this.services.languageDetector.detect(setLng);
25295
+ }
25296
+ } else {
25297
+ setLng(lng);
25298
+ }
25299
+ return deferred;
25300
+ }
25301
+ getFixedT(lng, ns, keyPrefix) {
25302
+ const fixedT = (key, opts, ...rest) => {
25303
+ let o;
25304
+ if (typeof opts !== "object") {
25305
+ o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
25306
+ } else {
25307
+ o = {
25308
+ ...opts
25309
+ };
25310
+ }
25311
+ o.lng = o.lng || fixedT.lng;
25312
+ o.lngs = o.lngs || fixedT.lngs;
25313
+ o.ns = o.ns || fixedT.ns;
25314
+ if (o.keyPrefix !== "")
25315
+ o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
25316
+ const keySeparator = this.options.keySeparator || ".";
25317
+ let resultKey;
25318
+ if (o.keyPrefix && Array.isArray(key)) {
25319
+ resultKey = key.map((k) => {
25320
+ if (typeof k === "function")
25321
+ k = keysFromSelector(k, {
25322
+ ...this.options,
25323
+ ...opts
25324
+ });
25325
+ return `${o.keyPrefix}${keySeparator}${k}`;
25326
+ });
25327
+ } else {
25328
+ if (typeof key === "function")
25329
+ key = keysFromSelector(key, {
25330
+ ...this.options,
25331
+ ...opts
25332
+ });
25333
+ resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
25334
+ }
25335
+ return this.t(resultKey, o);
25336
+ };
25337
+ if (isString(lng)) {
25338
+ fixedT.lng = lng;
25339
+ } else {
25340
+ fixedT.lngs = lng;
25341
+ }
25342
+ fixedT.ns = ns;
25343
+ fixedT.keyPrefix = keyPrefix;
25344
+ return fixedT;
25345
+ }
25346
+ t(...args) {
25347
+ return this.translator?.translate(...args);
25348
+ }
25349
+ exists(...args) {
25350
+ return this.translator?.exists(...args);
25351
+ }
25352
+ setDefaultNamespace(ns) {
25353
+ this.options.defaultNS = ns;
25354
+ }
25355
+ hasLoadedNamespace(ns, options = {}) {
25356
+ if (!this.isInitialized) {
25357
+ this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
25358
+ return false;
25359
+ }
25360
+ if (!this.languages || !this.languages.length) {
25361
+ this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
25362
+ return false;
25363
+ }
25364
+ const lng = options.lng || this.resolvedLanguage || this.languages[0];
25365
+ const fallbackLng = this.options ? this.options.fallbackLng : false;
25366
+ const lastLng = this.languages[this.languages.length - 1];
25367
+ if (lng.toLowerCase() === "cimode")
25368
+ return true;
25369
+ const loadNotPending = (l, n) => {
25370
+ const loadState = this.services.backendConnector.state[`${l}|${n}`];
25371
+ return loadState === -1 || loadState === 0 || loadState === 2;
25372
+ };
25373
+ if (options.precheck) {
25374
+ const preResult = options.precheck(this, loadNotPending);
25375
+ if (preResult !== undefined)
25376
+ return preResult;
25377
+ }
25378
+ if (this.hasResourceBundle(lng, ns))
25379
+ return true;
25380
+ if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages)
25381
+ return true;
25382
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
25383
+ return true;
25384
+ return false;
25385
+ }
25386
+ loadNamespaces(ns, callback) {
25387
+ const deferred = defer2();
25388
+ if (!this.options.ns) {
25389
+ if (callback)
25390
+ callback();
25391
+ return Promise.resolve();
25392
+ }
25393
+ if (isString(ns))
25394
+ ns = [ns];
25395
+ ns.forEach((n) => {
25396
+ if (this.options.ns.indexOf(n) < 0)
25397
+ this.options.ns.push(n);
25398
+ });
25399
+ this.loadResources((err) => {
25400
+ deferred.resolve();
25401
+ if (callback)
25402
+ callback(err);
25403
+ });
25404
+ return deferred;
25405
+ }
25406
+ loadLanguages(lngs, callback) {
25407
+ const deferred = defer2();
25408
+ if (isString(lngs))
25409
+ lngs = [lngs];
25410
+ const preloaded = this.options.preload || [];
25411
+ const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
25412
+ if (!newLngs.length) {
25413
+ if (callback)
25414
+ callback();
25415
+ return Promise.resolve();
25416
+ }
25417
+ this.options.preload = preloaded.concat(newLngs);
25418
+ this.loadResources((err) => {
25419
+ deferred.resolve();
25420
+ if (callback)
25421
+ callback(err);
25422
+ });
25423
+ return deferred;
25424
+ }
25425
+ dir(lng) {
25426
+ if (!lng)
25427
+ lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
25428
+ if (!lng)
25429
+ return "rtl";
25430
+ try {
25431
+ const l = new Intl.Locale(lng);
25432
+ if (l && l.getTextInfo) {
25433
+ const ti = l.getTextInfo();
25434
+ if (ti && ti.direction)
25435
+ return ti.direction;
25436
+ }
25437
+ } catch (e) {}
25438
+ 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"];
25439
+ const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
25440
+ if (lng.toLowerCase().indexOf("-latn") > 1)
25441
+ return "ltr";
25442
+ return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
25443
+ }
25444
+ static createInstance(options = {}, callback) {
25445
+ const instance = new I18n(options, callback);
25446
+ instance.createInstance = I18n.createInstance;
25447
+ return instance;
25448
+ }
25449
+ cloneInstance(options = {}, callback = noop) {
25450
+ const forkResourceStore = options.forkResourceStore;
25451
+ if (forkResourceStore)
25452
+ delete options.forkResourceStore;
25453
+ const mergedOptions = {
25454
+ ...this.options,
25455
+ ...options,
25456
+ ...{
25457
+ isClone: true
25458
+ }
25459
+ };
25460
+ const clone = new I18n(mergedOptions);
25461
+ if (options.debug !== undefined || options.prefix !== undefined) {
25462
+ clone.logger = clone.logger.clone(options);
25463
+ }
25464
+ const membersToCopy = ["store", "services", "language"];
25465
+ membersToCopy.forEach((m) => {
25466
+ clone[m] = this[m];
25467
+ });
25468
+ clone.services = {
25469
+ ...this.services
25470
+ };
25471
+ clone.services.utils = {
25472
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
25473
+ };
25474
+ if (forkResourceStore) {
25475
+ const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
25476
+ prev[l] = {
25477
+ ...this.store.data[l]
25478
+ };
25479
+ prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
25480
+ acc[n] = {
25481
+ ...prev[l][n]
25482
+ };
25483
+ return acc;
25484
+ }, prev[l]);
25485
+ return prev;
25486
+ }, {});
25487
+ clone.store = new ResourceStore(clonedData, mergedOptions);
25488
+ clone.services.resourceStore = clone.store;
25489
+ }
25490
+ clone.translator = new Translator(clone.services, mergedOptions);
25491
+ clone.translator.on("*", (event, ...args) => {
25492
+ clone.emit(event, ...args);
25493
+ });
25494
+ clone.init(mergedOptions, callback);
25495
+ clone.translator.options = mergedOptions;
25496
+ clone.translator.backendConnector.services.utils = {
25497
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
25498
+ };
25499
+ return clone;
25500
+ }
25501
+ toJSON() {
25502
+ return {
25503
+ options: this.options,
25504
+ store: this.store,
25505
+ language: this.language,
25506
+ languages: this.languages,
25507
+ resolvedLanguage: this.resolvedLanguage
25508
+ };
25509
+ }
25510
+ };
25511
+ instance = I18n.createInstance();
25512
+ createInstance = instance.createInstance;
25513
+ dir = instance.dir;
25514
+ init = instance.init;
25515
+ loadResources = instance.loadResources;
25516
+ reloadResources = instance.reloadResources;
25517
+ use = instance.use;
25518
+ changeLanguage = instance.changeLanguage;
25519
+ getFixedT = instance.getFixedT;
25520
+ t = instance.t;
25521
+ exists = instance.exists;
25522
+ setDefaultNamespace = instance.setDefaultNamespace;
25523
+ hasLoadedNamespace = instance.hasLoadedNamespace;
25524
+ loadNamespaces = instance.loadNamespaces;
25525
+ loadLanguages = instance.loadLanguages;
25526
+ });
25527
+
25528
+ // src/i18n/locales/en.json
25529
+ var en_default;
25530
+ var init_en = __esm(() => {
25531
+ en_default = {
25532
+ common: {
25533
+ yes: "Yes",
25534
+ no: "No",
25535
+ cancel: "Cancel",
25536
+ back: "Back",
25537
+ exit: "Exit",
25538
+ success: "✅ Success!",
25539
+ error: "❌ Error!",
25540
+ loading: "⏳ Loading..."
25541
+ },
25542
+ auth: {
25543
+ notAuthenticated: "🔐 You are not authenticated!",
25544
+ enterToken: "Please enter your Trello token:",
25545
+ tokenInvalid: "❌ Invalid token! Token must start with 'ATTA' and be at least 11 characters long.",
25546
+ tokenSaved: "✅ Token saved successfully!",
25547
+ authenticated: "✅ You are already authenticated!"
25548
+ },
25549
+ menu: {
25550
+ title: "� Main Menu - Trello CLI Unofficial",
25551
+ boards: "📋 View my boards",
25552
+ explore: "📝 Explore board",
25553
+ create: "➕ Create card",
25554
+ config: "⚙️ Settings",
25555
+ exit: "🚪 Exit",
25556
+ goodbye: "👋 Goodbye!",
25557
+ exploreInDevelopment: "� Explore board - Under development",
25558
+ configTitle: "⚙️ Settings",
25559
+ configToken: "🔑 Configure token",
25560
+ configView: "👀 View current configuration",
25561
+ configReset: "🔄 Reset configuration",
25562
+ configBack: "⬅️ Back",
25563
+ currentConfig: "� Current configuration:",
25564
+ tokenConfigured: "Token configured:",
25565
+ configFile: "Config file: ~/.trello-cli-unofficial/config.json",
25566
+ confirmReset: "Are you sure you want to reset all configuration?",
25567
+ configResetted: "✅ Configuration resetted!",
25568
+ selectBoard: "Select a board:",
25569
+ selectList: "Select a list:",
25570
+ selectCard: "Select a card:"
25571
+ },
25572
+ board: {
25573
+ loading: "⏳ Loading boards...",
25574
+ empty: "📋 No boards found.",
25575
+ notFound: '❌ Board "{{name}}" not found',
25576
+ lists: "📝 Lists of Board: {{name}}",
25577
+ yourBoards: "📋 Your Trello Boards:"
25578
+ },
25579
+ list: {
25580
+ loading: "⏳ Loading lists...",
25581
+ empty: "📝 No lists found in this board.",
25582
+ notFound: '❌ List "{{listName}}" not found in board "{{boardName}}"',
25583
+ cards: "🃏 Cards of List: {{name}}",
25584
+ boardLists: '📋 Lists from board "{{boardName}}":'
25585
+ },
25586
+ card: {
25587
+ loading: "⏳ Loading cards...",
25588
+ empty: "🃏 No cards found in this list.",
25589
+ notFound: '❌ Card with ID "{{cardId}}" not found',
25590
+ created: "✅ Card created successfully!",
25591
+ updated: "✅ Card updated successfully!",
25592
+ deleted: "✅ Card deleted successfully!",
25593
+ moved: "✅ Card moved successfully!",
25594
+ enterName: "Card name:",
25595
+ enterDescription: "Description (optional):",
25596
+ confirmDelete: 'Are you sure you want to delete "{{name}}"?',
25597
+ listCards: '📋 Cards from list "{{listName}}" in board "{{boardName}}":',
25598
+ emptyList: "📭 This list is empty.",
25599
+ selectBoard: "Select board:",
25600
+ selectList: "Select list:",
25601
+ selectCard: "Select a card:",
25602
+ whatToDo: "What would you like to do?",
25603
+ newName: "New name:",
25604
+ newDescription: "New description:",
25605
+ moveToWhichList: "Move to which list?",
25606
+ cardName: "📝 Name: {{name}}",
25607
+ cardUrl: "🔗 URL: {{url}}",
25608
+ cardId: "🆔 ID: {{id}}",
25609
+ movedTo: "➡️ To: {{listName}}",
25610
+ actions: {
25611
+ view: "👁️ View Details",
25612
+ create: "➕ Create Card",
25613
+ edit: "✏️ Edit Card",
25614
+ move: "🔄 Move Card",
25615
+ delete: "🗑️ Delete Card",
25616
+ back: "⬅️ Back"
25617
+ }
25618
+ },
25619
+ errors: {
25620
+ general: "❌ An error occurred: {{message}}",
25621
+ generic: "❌ Error:",
25622
+ network: "❌ Network error. Check your connection.",
25623
+ invalidInput: "❌ Invalid input: {{field}}",
25624
+ required: "❌ Required field: {{field}}"
25625
+ },
25626
+ commands: {
25627
+ boards: {
25628
+ description: "List all available boards",
25629
+ success: "📋 Boards loaded successfully!"
25630
+ },
25631
+ lists: {
25632
+ description: "List the lists of a specific board",
25633
+ boardRequired: "❌ Board name is required",
25634
+ success: "📝 Lists loaded successfully!"
25635
+ },
25636
+ cards: {
25637
+ description: "List the cards of a specific list",
25638
+ boardRequired: "❌ Board name is required",
25639
+ listRequired: "❌ List name is required",
25640
+ success: "🃏 Cards loaded successfully!"
25641
+ },
25642
+ createCard: {
25643
+ description: "Create a new card in a list",
25644
+ nameRequired: "❌ Card name is required",
25645
+ success: "✅ Card '{{name}}' created successfully!"
25646
+ },
25647
+ moveCard: {
25648
+ description: "Move a card to another list",
25649
+ cardIdRequired: "❌ Card ID is required",
25650
+ targetListRequired: "❌ Target list ID is required",
25651
+ success: "✅ Card moved successfully!"
25652
+ },
25653
+ deleteCard: {
25654
+ description: "Delete a card",
25655
+ cardIdRequired: "❌ Card ID is required",
25656
+ success: "✅ Card deleted successfully!"
25657
+ }
25658
+ }
25659
+ };
25660
+ });
25661
+
25662
+ // src/i18n/locales/pt-BR.json
25663
+ var pt_BR_default;
25664
+ var init_pt_BR = __esm(() => {
25665
+ pt_BR_default = {
25666
+ common: {
25667
+ yes: "Sim",
25668
+ no: "Não",
25669
+ cancel: "Cancelar",
25670
+ back: "Voltar",
25671
+ exit: "Sair",
25672
+ success: "✅ Sucesso!",
25673
+ error: "❌ Erro!",
25674
+ loading: "⏳ Carregando..."
25675
+ },
25676
+ auth: {
25677
+ notAuthenticated: "🔐 Você não está autenticado!",
25678
+ enterToken: "Por favor, insira seu token do Trello:",
25679
+ tokenInvalid: "❌ Token inválido! O token deve começar com 'ATTA' e ter pelo menos 11 caracteres.",
25680
+ tokenSaved: "✅ Token salvo com sucesso!",
25681
+ authenticated: "✅ Você já está autenticado!"
25682
+ },
25683
+ menu: {
25684
+ title: "� Menu Principal - Trello CLI Unofficial",
25685
+ boards: "📋 Ver meus quadros",
25686
+ explore: "📝 Explorar quadro",
25687
+ create: "➕ Criar cartão",
25688
+ config: "⚙️ Configurações",
25689
+ exit: "🚪 Sair",
25690
+ goodbye: "👋 Até logo!",
25691
+ exploreInDevelopment: "🚧 Explorar quadro - Em desenvolvimento",
25692
+ configTitle: "⚙️ Configurações",
25693
+ configToken: "� Configurar token",
25694
+ configView: "👀 Ver configuração atual",
25695
+ configReset: "🔄 Resetar configuração",
25696
+ configBack: "⬅️ Voltar",
25697
+ currentConfig: "� Configuração atual:",
25698
+ tokenConfigured: "Token configurado:",
25699
+ configFile: "Arquivo de config: ~/.trello-cli-unofficial/config.json",
25700
+ confirmReset: "Tem certeza que deseja resetar toda a configuração?",
25701
+ configResetted: "✅ Configuração resetada!",
25702
+ selectBoard: "Selecione um board:",
25703
+ selectList: "Selecione uma lista:",
25704
+ selectCard: "Selecione um card:"
25705
+ },
25706
+ board: {
25707
+ loading: "⏳ Carregando boards...",
25708
+ empty: "📋 Nenhum board encontrado.",
25709
+ notFound: '❌ Quadro "{{name}}" não encontrado',
25710
+ lists: "📝 Listas do Board: {{name}}",
25711
+ yourBoards: "📋 Seus Quadros do Trello:"
25712
+ },
25713
+ list: {
25714
+ loading: "⏳ Carregando listas...",
25715
+ empty: "📝 Nenhuma lista encontrada neste board.",
25716
+ notFound: '❌ Lista "{{listName}}" não encontrada no quadro "{{boardName}}"',
25717
+ cards: "🃏 Cards da Lista: {{name}}",
25718
+ boardLists: '📋 Listas do quadro "{{boardName}}":'
25719
+ },
25720
+ card: {
25721
+ loading: "⏳ Carregando cards...",
25722
+ empty: "🃏 Nenhum card encontrado nesta lista.",
25723
+ notFound: '❌ Cartão com ID "{{cardId}}" não encontrado',
25724
+ created: "✅ Cartão criado com sucesso!",
25725
+ updated: "✅ Cartão atualizado com sucesso!",
25726
+ deleted: "✅ Cartão deletado com sucesso!",
25727
+ moved: "✅ Cartão movido com sucesso!",
25728
+ enterName: "Nome do cartão:",
25729
+ enterDescription: "Descrição (opcional):",
25730
+ confirmDelete: 'Tem certeza que deseja deletar "{{name}}"?',
25731
+ listCards: '📋 Cartões da lista "{{listName}}" no quadro "{{boardName}}":',
25732
+ emptyList: "📭 Esta lista está vazia.",
25733
+ selectBoard: "Selecione o quadro:",
25734
+ selectList: "Selecione a lista:",
25735
+ selectCard: "Selecione um cartão:",
25736
+ whatToDo: "O que deseja fazer?",
25737
+ newName: "Novo nome:",
25738
+ newDescription: "Nova descrição:",
25739
+ moveToWhichList: "Mover para qual lista?",
25740
+ cardName: "📝 Nome: {{name}}",
25741
+ cardUrl: "🔗 URL: {{url}}",
25742
+ cardId: "🆔 ID: {{id}}",
25743
+ movedTo: "➡️ Para: {{listName}}",
25744
+ actions: {
25745
+ view: "👁️ Ver Detalhes",
25746
+ create: "➕ Criar Card",
25747
+ edit: "✏️ Editar Card",
25748
+ move: "🔄 Mover Card",
25749
+ delete: "🗑️ Deletar Card",
25750
+ back: "⬅️ Voltar"
25751
+ }
25752
+ },
25753
+ errors: {
25754
+ general: "❌ Ocorreu um erro: {{message}}",
25755
+ generic: "❌ Erro:",
25756
+ network: "❌ Erro de rede. Verifique sua conexão.",
25757
+ invalidInput: "❌ Entrada inválida: {{field}}",
25758
+ required: "❌ Campo obrigatório: {{field}}"
25759
+ },
25760
+ commands: {
25761
+ boards: {
25762
+ description: "Lista todos os boards disponíveis",
25763
+ success: "📋 Boards carregados com sucesso!"
25764
+ },
25765
+ lists: {
25766
+ description: "Lista as listas de um board específico",
25767
+ boardRequired: "❌ Nome do board é obrigatório",
25768
+ success: "📝 Listas carregadas com sucesso!"
25769
+ },
25770
+ cards: {
25771
+ description: "Lista os cards de uma lista específica",
25772
+ boardRequired: "❌ Nome do board é obrigatório",
25773
+ listRequired: "❌ Nome da lista é obrigatório",
25774
+ success: "🃏 Cards carregados com sucesso!"
25775
+ },
25776
+ createCard: {
25777
+ description: "Cria um novo card em uma lista",
25778
+ nameRequired: "❌ Nome do card é obrigatório",
25779
+ success: "✅ Card '{{name}}' criado com sucesso!"
25780
+ },
25781
+ moveCard: {
25782
+ description: "Move um card para outra lista",
25783
+ cardIdRequired: "❌ ID do card é obrigatório",
25784
+ targetListRequired: "❌ ID da lista de destino é obrigatório",
25785
+ success: "✅ Card movido com sucesso!"
25786
+ },
25787
+ deleteCard: {
25788
+ description: "Deleta um card",
25789
+ cardIdRequired: "❌ ID do card é obrigatório",
25790
+ success: "✅ Card deletado com sucesso!"
25791
+ }
25792
+ }
25793
+ };
25794
+ });
25795
+
25796
+ // src/i18n/index.ts
25797
+ function detectLanguage() {
25798
+ const lang = process.env.LANG || process.env.LANGUAGE || "en_US";
25799
+ if (lang.startsWith("pt")) {
25800
+ return "pt-BR";
25801
+ }
25802
+ return "en";
25803
+ }
25804
+ function t2(key, options) {
25805
+ return instance.t(key, options);
25806
+ }
25807
+ var init_i18n = __esm(() => {
25808
+ init_i18next();
25809
+ init_en();
25810
+ init_pt_BR();
25811
+ instance.init({
25812
+ lng: detectLanguage(),
25813
+ fallbackLng: "en",
25814
+ resources: {
25815
+ "pt-BR": {
25816
+ translation: pt_BR_default
25817
+ },
25818
+ en: {
25819
+ translation: en_default
25820
+ }
25821
+ },
25822
+ interpolation: {
25823
+ escapeValue: false
25824
+ }
25825
+ });
25826
+ });
25827
+
23181
25828
  // src/presentation/cli/AuthController.ts
23182
25829
  class AuthController {
23183
25830
  configRepository;
@@ -23189,7 +25836,7 @@ class AuthController {
23189
25836
  async ensureAuthenticated() {
23190
25837
  const result = await this.authenticateUseCase.execute();
23191
25838
  if (!result.success) {
23192
- console.log(result.message);
25839
+ console.log(t2("auth.notAuthenticated"));
23193
25840
  await this.setupToken();
23194
25841
  }
23195
25842
  }
@@ -23198,12 +25845,12 @@ class AuthController {
23198
25845
  {
23199
25846
  type: "input",
23200
25847
  name: "token",
23201
- message: "Digite seu token do Trello (ATTA...):",
23202
- validate: (input) => input.startsWith("ATTA") || "Token deve começar com ATTA"
25848
+ message: t2("auth.enterToken"),
25849
+ validate: (input) => input.startsWith("ATTA") || t2("auth.tokenInvalid")
23203
25850
  }
23204
25851
  ]);
23205
25852
  const result = await this.authenticateUseCase.execute(token);
23206
- console.log(result.message);
25853
+ console.log(result.success ? t2("auth.tokenSaved") : result.message);
23207
25854
  }
23208
25855
  async getConfig() {
23209
25856
  return await this.authenticateUseCase.getConfig();
@@ -23212,6 +25859,7 @@ class AuthController {
23212
25859
  var init_AuthController = __esm(() => {
23213
25860
  init_use_cases();
23214
25861
  init_esm16();
25862
+ init_i18n();
23215
25863
  });
23216
25864
 
23217
25865
  // src/presentation/cli/BoardController.ts
@@ -23226,7 +25874,7 @@ class BoardController {
23226
25874
  }
23227
25875
  async showBoards() {
23228
25876
  const boards = await this.getBoardsUseCase.execute();
23229
- console.log("\uD83D\uDCCB Seus Quadros do Trello:");
25877
+ console.log(t2("board.yourBoards"));
23230
25878
  boards.forEach((board, index) => {
23231
25879
  console.log(`${index + 1}. ${board.name}`);
23232
25880
  console.log(` \uD83D\uDD17 ${board.url}`);
@@ -23238,10 +25886,10 @@ class BoardController {
23238
25886
  const boards = await this.getBoardsUseCase.execute();
23239
25887
  const board = boards.find((b) => b.name === boardName);
23240
25888
  if (!board) {
23241
- throw new Error(`Quadro "${boardName}" não encontrado`);
25889
+ throw new Error(t2("board.notFound", { name: boardName }));
23242
25890
  }
23243
25891
  const lists = await this.getListsUseCase.execute(board.id);
23244
- console.log(`\uD83D\uDCCB Listas do quadro "${boardName}":`);
25892
+ console.log(t2("list.boardLists", { boardName }));
23245
25893
  lists.forEach((list, index) => {
23246
25894
  console.log(`${index + 1}. ${list.name}`);
23247
25895
  console.log(` \uD83C\uDD94 ${list.id}
@@ -23252,17 +25900,17 @@ class BoardController {
23252
25900
  const boards = await this.getBoardsUseCase.execute();
23253
25901
  const board = boards.find((b) => b.name === boardName);
23254
25902
  if (!board) {
23255
- throw new Error(`Quadro "${boardName}" não encontrado`);
25903
+ throw new Error(t2("board.notFound", { name: boardName }));
23256
25904
  }
23257
25905
  const lists = await this.getListsUseCase.execute(board.id);
23258
25906
  const list = lists.find((l) => l.name === listName);
23259
25907
  if (!list) {
23260
- throw new Error(`Lista "${listName}" não encontrada no quadro "${boardName}"`);
25908
+ throw new Error(t2("list.notFound", { listName, boardName }));
23261
25909
  }
23262
25910
  const cards = await this.getCardsUseCase.execute(list.id);
23263
- console.log(`\uD83D\uDCCB Cartões da lista "${listName}" no quadro "${boardName}":`);
25911
+ console.log(t2("card.listCards", { listName, boardName }));
23264
25912
  if (cards.length === 0) {
23265
- console.log("\uD83D\uDCED Esta lista está vazia.");
25913
+ console.log(t2("card.emptyList"));
23266
25914
  return;
23267
25915
  }
23268
25916
  cards.forEach((card, index) => {
@@ -23283,6 +25931,7 @@ class BoardController {
23283
25931
  }
23284
25932
  var init_BoardController = __esm(() => {
23285
25933
  init_use_cases();
25934
+ init_i18n();
23286
25935
  });
23287
25936
 
23288
25937
  // src/shared/types.ts
@@ -23331,8 +25980,11 @@ class CardController {
23331
25980
  {
23332
25981
  type: "list",
23333
25982
  name: "selectedBoard",
23334
- message: "Selecione o quadro:",
23335
- choices: boards.map((board) => ({ name: board.name, value: board.id }))
25983
+ message: t2("card.selectBoard"),
25984
+ choices: boards.map((board) => ({
25985
+ name: board.name,
25986
+ value: board.id
25987
+ }))
23336
25988
  }
23337
25989
  ]);
23338
25990
  const lists = await this.boardController.getLists(selectedBoard);
@@ -23340,21 +25992,24 @@ class CardController {
23340
25992
  {
23341
25993
  type: "list",
23342
25994
  name: "selectedList",
23343
- message: "Selecione a lista:",
23344
- choices: lists.map((list) => ({ name: list.name, value: list.id }))
25995
+ message: t2("card.selectList"),
25996
+ choices: lists.map((list) => ({
25997
+ name: list.name,
25998
+ value: list.id
25999
+ }))
23345
26000
  }
23346
26001
  ]);
23347
26002
  const { cardName, cardDesc } = await esm_default12.prompt([
23348
26003
  {
23349
26004
  type: "input",
23350
26005
  name: "cardName",
23351
- message: "Nome do cartão:",
26006
+ message: t2("card.enterName"),
23352
26007
  validate: (input) => input.length > 0 || "Nome é obrigatório"
23353
26008
  },
23354
26009
  {
23355
26010
  type: "input",
23356
26011
  name: "cardDesc",
23357
- message: "Descrição (opcional):"
26012
+ message: t2("card.enterDescription")
23358
26013
  }
23359
26014
  ]);
23360
26015
  const newCard = await this.createCardUseCase.execute({
@@ -23362,22 +26017,22 @@ class CardController {
23362
26017
  desc: cardDesc,
23363
26018
  listId: selectedList
23364
26019
  });
23365
- console.log("✅ Cartão criado com sucesso!");
23366
- console.log(`\uD83D\uDCDD Nome: ${newCard.name}`);
23367
- console.log(`\uD83D\uDD17 URL: ${newCard.url}`);
26020
+ console.log(t2("card.created"));
26021
+ console.log(t2("card.cardName", { name: newCard.name }));
26022
+ console.log(t2("card.cardUrl", { url: newCard.url }));
23368
26023
  }
23369
26024
  async exploreCards(boardId, lists) {
23370
26025
  const { selectedList } = await esm_default12.prompt([
23371
26026
  {
23372
26027
  type: "list",
23373
26028
  name: "selectedList",
23374
- message: "Selecione uma lista:",
26029
+ message: t2("card.selectList"),
23375
26030
  choices: lists.map((list) => ({ name: list.name, value: list.id }))
23376
26031
  }
23377
26032
  ]);
23378
26033
  const cards = await this.boardController.getCards(selectedList);
23379
26034
  if (cards.length === 0) {
23380
- console.log("\uD83D\uDCED Esta lista está vazia.");
26035
+ console.log(t2("card.emptyList"));
23381
26036
  return;
23382
26037
  }
23383
26038
  console.log(`\uD83C\uDCCF Cartões em "${lists.find((l) => l.id === selectedList)?.name}":`);
@@ -23394,11 +26049,11 @@ class CardController {
23394
26049
  {
23395
26050
  type: "list",
23396
26051
  name: "nextAction",
23397
- message: "O que deseja fazer?",
26052
+ message: t2("card.whatToDo"),
23398
26053
  choices: [
23399
- { name: "⬅️ Voltar ao menu", value: CARD_ACTIONS.BACK },
23400
- { name: "\uD83D\uDCDD Editar cartão", value: CARD_ACTIONS.EDIT },
23401
- { name: "\uD83D\uDDD1️ Deletar cartão", value: CARD_ACTIONS.DELETE },
26054
+ { name: t2("card.actions.back"), value: CARD_ACTIONS.BACK },
26055
+ { name: t2("card.actions.edit"), value: CARD_ACTIONS.EDIT },
26056
+ { name: t2("card.actions.delete"), value: CARD_ACTIONS.DELETE },
23402
26057
  { name: "\uD83D\uDCE6 Mover cartão", value: CARD_ACTIONS.MOVE }
23403
26058
  ]
23404
26059
  }
@@ -23408,8 +26063,11 @@ class CardController {
23408
26063
  {
23409
26064
  type: "list",
23410
26065
  name: "selectedCard",
23411
- message: "Selecione um cartão:",
23412
- choices: cards.map((card) => ({ name: card.name, value: card.id }))
26066
+ message: t2("card.selectCard"),
26067
+ choices: cards.map((card) => ({
26068
+ name: card.name,
26069
+ value: card.id
26070
+ }))
23413
26071
  }
23414
26072
  ]);
23415
26073
  const selectedCardEntity = cards.find((c) => c.id === selectedCard);
@@ -23431,13 +26089,13 @@ class CardController {
23431
26089
  {
23432
26090
  type: "input",
23433
26091
  name: "newName",
23434
- message: "Novo nome:",
26092
+ message: t2("card.newName"),
23435
26093
  default: card.name
23436
26094
  },
23437
26095
  {
23438
26096
  type: "input",
23439
26097
  name: "newDesc",
23440
- message: "Nova descrição:",
26098
+ message: t2("card.newDescription"),
23441
26099
  default: card.desc || ""
23442
26100
  }
23443
26101
  ]);
@@ -23445,14 +26103,14 @@ class CardController {
23445
26103
  name: newName,
23446
26104
  desc: newDesc
23447
26105
  });
23448
- console.log("✅ Cartão atualizado com sucesso!");
26106
+ console.log(t2("card.updated"));
23449
26107
  }
23450
26108
  async deleteCardInteractive(cardId, card) {
23451
26109
  const { confirm } = await esm_default12.prompt([
23452
26110
  {
23453
26111
  type: "confirm",
23454
26112
  name: "confirm",
23455
- message: `Tem certeza que deseja deletar "${card.name}"?`,
26113
+ message: t2("card.confirmDelete", { name: card.name }),
23456
26114
  default: false
23457
26115
  }
23458
26116
  ]);
@@ -23465,7 +26123,7 @@ class CardController {
23465
26123
  {
23466
26124
  type: "list",
23467
26125
  name: "targetList",
23468
- message: "Mover para qual lista?",
26126
+ message: t2("card.moveToWhichList"),
23469
26127
  choices: lists.map((list) => ({ name: list.name, value: list.id }))
23470
26128
  }
23471
26129
  ]);
@@ -23478,22 +26136,22 @@ class CardController {
23478
26136
  const boards = await this.boardController.getBoards();
23479
26137
  const board = boards.find((b) => b.name === boardName);
23480
26138
  if (!board) {
23481
- throw new Error(`Quadro "${boardName}" não encontrado`);
26139
+ throw new Error(t2("board.notFound", { name: boardName }));
23482
26140
  }
23483
26141
  const lists = await this.boardController.getLists(board.id);
23484
26142
  const list = lists.find((l) => l.name === listName);
23485
26143
  if (!list) {
23486
- throw new Error(`Lista "${listName}" não encontrada no quadro "${boardName}"`);
26144
+ throw new Error(t2("list.notFound", { listName, boardName }));
23487
26145
  }
23488
26146
  const newCard = await this.createCardUseCase.execute({
23489
26147
  name: cardName,
23490
26148
  desc: description || "",
23491
26149
  listId: list.id
23492
26150
  });
23493
- console.log("✅ Cartão criado com sucesso!");
23494
- console.log(`\uD83D\uDCDD Nome: ${newCard.name}`);
23495
- console.log(`\uD83D\uDD17 URL: ${newCard.url}`);
23496
- console.log(`\uD83C\uDD94 ID: ${newCard.id}`);
26151
+ console.log(t2("card.created"));
26152
+ console.log(t2("card.cardName", { name: newCard.name }));
26153
+ console.log(t2("card.cardUrl", { url: newCard.url }));
26154
+ console.log(t2("card.cardId", { id: newCard.id }));
23497
26155
  }
23498
26156
  async moveCard(cardId, targetListName) {
23499
26157
  const boards = await this.boardController.getBoards();
@@ -23506,12 +26164,15 @@ class CardController {
23506
26164
  if (card) {
23507
26165
  const targetList = lists.find((l) => l.name === targetListName);
23508
26166
  if (!targetList) {
23509
- throw new Error(`Lista "${targetListName}" não encontrada no quadro "${board.name}"`);
26167
+ throw new Error(t2("list.notFound", {
26168
+ listName: targetListName,
26169
+ boardName: board.name
26170
+ }));
23510
26171
  }
23511
26172
  await this.moveCardUseCase.execute(cardId, targetList.id);
23512
- console.log("✅ Cartão movido com sucesso!");
23513
- console.log(`\uD83D\uDCDD Cartão: ${card.name}`);
23514
- console.log(`➡️ Para: ${targetList.name}`);
26173
+ console.log(t2("card.moved"));
26174
+ console.log(t2("card.cardName", { name: card.name }));
26175
+ console.log(t2("card.movedTo", { listName: targetList.name }));
23515
26176
  return;
23516
26177
  }
23517
26178
  } catch {
@@ -23519,7 +26180,7 @@ class CardController {
23519
26180
  }
23520
26181
  }
23521
26182
  }
23522
- throw new Error(`Cartão com ID "${cardId}" não encontrado`);
26183
+ throw new Error(t2("card.notFound", { cardId }));
23523
26184
  }
23524
26185
  async deleteCard(cardId, card) {
23525
26186
  if (!card) {
@@ -23542,18 +26203,19 @@ class CardController {
23542
26203
  }
23543
26204
  }
23544
26205
  if (!card) {
23545
- throw new Error(`Cartão com ID "${cardId}" não encontrado`);
26206
+ throw new Error(t2("card.notFound", { cardId }));
23546
26207
  }
23547
26208
  }
23548
26209
  await this.deleteCardUseCase.execute(cardId);
23549
- console.log("✅ Cartão deletado com sucesso!");
23550
- console.log(`\uD83D\uDCDD Nome: ${card.name}`);
26210
+ console.log(t2("card.deleted"));
26211
+ console.log(t2("card.cardName", { name: card.name }));
23551
26212
  }
23552
26213
  }
23553
26214
  var init_CardController = __esm(() => {
23554
26215
  init_use_cases();
23555
26216
  init_types();
23556
26217
  init_esm16();
26218
+ init_i18n();
23557
26219
  });
23558
26220
 
23559
26221
  // src/domain/entities/Board.ts
@@ -24072,13 +26734,13 @@ var require_clone = __commonJS((exports, module) => {
24072
26734
  if (obj === null || typeof obj !== "object")
24073
26735
  return obj;
24074
26736
  if (obj instanceof Object)
24075
- var copy = { __proto__: getPrototypeOf(obj) };
26737
+ var copy2 = { __proto__: getPrototypeOf(obj) };
24076
26738
  else
24077
- var copy = Object.create(null);
26739
+ var copy2 = Object.create(null);
24078
26740
  Object.getOwnPropertyNames(obj).forEach(function(key) {
24079
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
26741
+ Object.defineProperty(copy2, key, Object.getOwnPropertyDescriptor(obj, key));
24080
26742
  });
24081
- return copy;
26743
+ return copy2;
24082
26744
  }
24083
26745
  });
24084
26746
 
@@ -24098,7 +26760,7 @@ var require_graceful_fs = __commonJS((exports, module) => {
24098
26760
  gracefulQueue = "___graceful-fs.queue";
24099
26761
  previousSymbol = "___graceful-fs.previous";
24100
26762
  }
24101
- function noop() {}
26763
+ function noop2() {}
24102
26764
  function publishQueue(context, queue2) {
24103
26765
  Object.defineProperty(context, gracefulQueue, {
24104
26766
  get: function() {
@@ -24106,7 +26768,7 @@ var require_graceful_fs = __commonJS((exports, module) => {
24106
26768
  }
24107
26769
  });
24108
26770
  }
24109
- var debug = noop;
26771
+ var debug = noop2;
24110
26772
  if (util.debuglog)
24111
26773
  debug = util.debuglog("gfs4");
24112
26774
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
@@ -24578,16 +27240,16 @@ var require_make_dir = __commonJS((exports, module) => {
24578
27240
  return options;
24579
27241
  return { ...defaults, ...options }.mode;
24580
27242
  };
24581
- exports.makeDir = async (dir, options) => {
24582
- checkPath(dir);
24583
- return fs.mkdir(dir, {
27243
+ exports.makeDir = async (dir2, options) => {
27244
+ checkPath(dir2);
27245
+ return fs.mkdir(dir2, {
24584
27246
  mode: getMode(options),
24585
27247
  recursive: true
24586
27248
  });
24587
27249
  };
24588
- exports.makeDirSync = (dir, options) => {
24589
- checkPath(dir);
24590
- return fs.mkdirSync(dir, {
27250
+ exports.makeDirSync = (dir2, options) => {
27251
+ checkPath(dir2);
27252
+ return fs.mkdirSync(dir2, {
24591
27253
  mode: getMode(options),
24592
27254
  recursive: true
24593
27255
  });
@@ -24811,7 +27473,7 @@ var require_copy = __commonJS((exports, module) => {
24811
27473
  var { utimesMillis } = require_utimes();
24812
27474
  var stat = require_stat();
24813
27475
  var { asyncIteratorConcurrentProcess } = require_async2();
24814
- async function copy(src, dest, opts = {}) {
27476
+ async function copy2(src, dest, opts = {}) {
24815
27477
  if (typeof opts === "function") {
24816
27478
  opts = { filter: opts };
24817
27479
  }
@@ -24927,7 +27589,7 @@ var require_copy = __commonJS((exports, module) => {
24927
27589
  await fs.unlink(dest);
24928
27590
  return fs.symlink(resolvedSrc, dest);
24929
27591
  }
24930
- module.exports = copy;
27592
+ module.exports = copy2;
24931
27593
  });
24932
27594
 
24933
27595
  // node_modules/fs-extra/lib/copy/copy-sync.js
@@ -25021,14 +27683,14 @@ var require_copy_sync = __commonJS((exports, module) => {
25021
27683
  return setDestMode(dest, srcMode);
25022
27684
  }
25023
27685
  function copyDir(src, dest, opts) {
25024
- const dir = fs.opendirSync(src);
27686
+ const dir2 = fs.opendirSync(src);
25025
27687
  try {
25026
27688
  let dirent;
25027
- while ((dirent = dir.readSync()) !== null) {
27689
+ while ((dirent = dir2.readSync()) !== null) {
25028
27690
  copyDirItem(dirent.name, src, dest, opts);
25029
27691
  }
25030
27692
  } finally {
25031
- dir.closeSync();
27693
+ dir2.closeSync();
25032
27694
  }
25033
27695
  }
25034
27696
  function copyDirItem(item, src, dest, opts) {
@@ -25106,24 +27768,24 @@ var require_empty2 = __commonJS((exports, module) => {
25106
27768
  var path2 = __require("path");
25107
27769
  var mkdir = require_mkdirs();
25108
27770
  var remove = require_remove();
25109
- var emptyDir = u(async function emptyDir(dir) {
27771
+ var emptyDir = u(async function emptyDir(dir2) {
25110
27772
  let items;
25111
27773
  try {
25112
- items = await fs.readdir(dir);
27774
+ items = await fs.readdir(dir2);
25113
27775
  } catch {
25114
- return mkdir.mkdirs(dir);
27776
+ return mkdir.mkdirs(dir2);
25115
27777
  }
25116
- return Promise.all(items.map((item) => remove.remove(path2.join(dir, item))));
27778
+ return Promise.all(items.map((item) => remove.remove(path2.join(dir2, item))));
25117
27779
  });
25118
- function emptyDirSync(dir) {
27780
+ function emptyDirSync(dir2) {
25119
27781
  let items;
25120
27782
  try {
25121
- items = fs.readdirSync(dir);
27783
+ items = fs.readdirSync(dir2);
25122
27784
  } catch {
25123
- return mkdir.mkdirsSync(dir);
27785
+ return mkdir.mkdirsSync(dir2);
25124
27786
  }
25125
27787
  items.forEach((item) => {
25126
- item = path2.join(dir, item);
27788
+ item = path2.join(dir2, item);
25127
27789
  remove.removeSync(item);
25128
27790
  });
25129
27791
  }
@@ -25148,13 +27810,13 @@ var require_file = __commonJS((exports, module) => {
25148
27810
  } catch {}
25149
27811
  if (stats && stats.isFile())
25150
27812
  return;
25151
- const dir = path2.dirname(file);
27813
+ const dir2 = path2.dirname(file);
25152
27814
  let dirStats = null;
25153
27815
  try {
25154
- dirStats = await fs.stat(dir);
27816
+ dirStats = await fs.stat(dir2);
25155
27817
  } catch (err) {
25156
27818
  if (err.code === "ENOENT") {
25157
- await mkdir.mkdirs(dir);
27819
+ await mkdir.mkdirs(dir2);
25158
27820
  await fs.writeFile(file, "");
25159
27821
  return;
25160
27822
  } else {
@@ -25164,7 +27826,7 @@ var require_file = __commonJS((exports, module) => {
25164
27826
  if (dirStats.isDirectory()) {
25165
27827
  await fs.writeFile(file, "");
25166
27828
  } else {
25167
- await fs.readdir(dir);
27829
+ await fs.readdir(dir2);
25168
27830
  }
25169
27831
  }
25170
27832
  function createFileSync(file) {
@@ -25174,14 +27836,14 @@ var require_file = __commonJS((exports, module) => {
25174
27836
  } catch {}
25175
27837
  if (stats && stats.isFile())
25176
27838
  return;
25177
- const dir = path2.dirname(file);
27839
+ const dir2 = path2.dirname(file);
25178
27840
  try {
25179
- if (!fs.statSync(dir).isDirectory()) {
25180
- fs.readdirSync(dir);
27841
+ if (!fs.statSync(dir2).isDirectory()) {
27842
+ fs.readdirSync(dir2);
25181
27843
  }
25182
27844
  } catch (err) {
25183
27845
  if (err && err.code === "ENOENT")
25184
- mkdir.mkdirsSync(dir);
27846
+ mkdir.mkdirsSync(dir2);
25185
27847
  else
25186
27848
  throw err;
25187
27849
  }
@@ -25215,10 +27877,10 @@ var require_link = __commonJS((exports, module) => {
25215
27877
  }
25216
27878
  if (dstStat && areIdentical(srcStat, dstStat))
25217
27879
  return;
25218
- const dir = path2.dirname(dstpath);
25219
- const dirExists = await pathExists(dir);
27880
+ const dir2 = path2.dirname(dstpath);
27881
+ const dirExists = await pathExists(dir2);
25220
27882
  if (!dirExists) {
25221
- await mkdir.mkdirs(dir);
27883
+ await mkdir.mkdirs(dir2);
25222
27884
  }
25223
27885
  await fs.link(srcpath, dstpath);
25224
27886
  }
@@ -25235,11 +27897,11 @@ var require_link = __commonJS((exports, module) => {
25235
27897
  err.message = err.message.replace("lstat", "ensureLink");
25236
27898
  throw err;
25237
27899
  }
25238
- const dir = path2.dirname(dstpath);
25239
- const dirExists = fs.existsSync(dir);
27900
+ const dir2 = path2.dirname(dstpath);
27901
+ const dirExists = fs.existsSync(dir2);
25240
27902
  if (dirExists)
25241
27903
  return fs.linkSync(srcpath, dstpath);
25242
- mkdir.mkdirsSync(dir);
27904
+ mkdir.mkdirsSync(dir2);
25243
27905
  return fs.linkSync(srcpath, dstpath);
25244
27906
  }
25245
27907
  module.exports = {
@@ -25269,8 +27931,8 @@ var require_symlink_paths = __commonJS((exports, module) => {
25269
27931
  }
25270
27932
  const dstdir = path2.dirname(dstpath);
25271
27933
  const relativeToDst = path2.join(dstdir, srcpath);
25272
- const exists = await pathExists(relativeToDst);
25273
- if (exists) {
27934
+ const exists2 = await pathExists(relativeToDst);
27935
+ if (exists2) {
25274
27936
  return {
25275
27937
  toCwd: relativeToDst,
25276
27938
  toDst: srcpath
@@ -25289,8 +27951,8 @@ var require_symlink_paths = __commonJS((exports, module) => {
25289
27951
  }
25290
27952
  function symlinkPathsSync(srcpath, dstpath) {
25291
27953
  if (path2.isAbsolute(srcpath)) {
25292
- const exists2 = fs.existsSync(srcpath);
25293
- if (!exists2)
27954
+ const exists3 = fs.existsSync(srcpath);
27955
+ if (!exists3)
25294
27956
  throw new Error("absolute srcpath does not exist");
25295
27957
  return {
25296
27958
  toCwd: srcpath,
@@ -25299,8 +27961,8 @@ var require_symlink_paths = __commonJS((exports, module) => {
25299
27961
  }
25300
27962
  const dstdir = path2.dirname(dstpath);
25301
27963
  const relativeToDst = path2.join(dstdir, srcpath);
25302
- const exists = fs.existsSync(relativeToDst);
25303
- if (exists) {
27964
+ const exists2 = fs.existsSync(relativeToDst);
27965
+ if (exists2) {
25304
27966
  return {
25305
27967
  toCwd: relativeToDst,
25306
27968
  toDst: srcpath
@@ -25378,9 +28040,9 @@ var require_symlink = __commonJS((exports, module) => {
25378
28040
  const relative = await symlinkPaths(srcpath, dstpath);
25379
28041
  srcpath = relative.toDst;
25380
28042
  const toType = await symlinkType(relative.toCwd, type);
25381
- const dir = path2.dirname(dstpath);
25382
- if (!await pathExists(dir)) {
25383
- await mkdirs(dir);
28043
+ const dir2 = path2.dirname(dstpath);
28044
+ if (!await pathExists(dir2)) {
28045
+ await mkdirs(dir2);
25384
28046
  }
25385
28047
  return fs.symlink(srcpath, dstpath, toType);
25386
28048
  }
@@ -25398,11 +28060,11 @@ var require_symlink = __commonJS((exports, module) => {
25398
28060
  const relative = symlinkPathsSync(srcpath, dstpath);
25399
28061
  srcpath = relative.toDst;
25400
28062
  type = symlinkTypeSync(relative.toCwd, type);
25401
- const dir = path2.dirname(dstpath);
25402
- const exists = fs.existsSync(dir);
25403
- if (exists)
28063
+ const dir2 = path2.dirname(dstpath);
28064
+ const exists2 = fs.existsSync(dir2);
28065
+ if (exists2)
25404
28066
  return fs.symlinkSync(srcpath, dstpath, type);
25405
- mkdirsSync(dir);
28067
+ mkdirsSync(dir2);
25406
28068
  return fs.symlinkSync(srcpath, dstpath, type);
25407
28069
  }
25408
28070
  module.exports = {
@@ -25537,16 +28199,16 @@ var require_output_file = __commonJS((exports, module) => {
25537
28199
  var mkdir = require_mkdirs();
25538
28200
  var pathExists = require_path_exists().pathExists;
25539
28201
  async function outputFile(file, data, encoding = "utf-8") {
25540
- const dir = path2.dirname(file);
25541
- if (!await pathExists(dir)) {
25542
- await mkdir.mkdirs(dir);
28202
+ const dir2 = path2.dirname(file);
28203
+ if (!await pathExists(dir2)) {
28204
+ await mkdir.mkdirs(dir2);
25543
28205
  }
25544
28206
  return fs.writeFile(file, data, encoding);
25545
28207
  }
25546
28208
  function outputFileSync(file, ...args) {
25547
- const dir = path2.dirname(file);
25548
- if (!fs.existsSync(dir)) {
25549
- mkdir.mkdirsSync(dir);
28209
+ const dir2 = path2.dirname(file);
28210
+ if (!fs.existsSync(dir2)) {
28211
+ mkdir.mkdirsSync(dir2);
25550
28212
  }
25551
28213
  fs.writeFileSync(file, ...args);
25552
28214
  }
@@ -25597,7 +28259,7 @@ var require_json = __commonJS((exports, module) => {
25597
28259
  var require_move = __commonJS((exports, module) => {
25598
28260
  var fs = require_fs();
25599
28261
  var path2 = __require("path");
25600
- var { copy } = require_copy2();
28262
+ var { copy: copy2 } = require_copy2();
25601
28263
  var { remove } = require_remove();
25602
28264
  var { mkdirp } = require_mkdirs();
25603
28265
  var { pathExists } = require_path_exists();
@@ -25636,7 +28298,7 @@ var require_move = __commonJS((exports, module) => {
25636
28298
  errorOnExist: true,
25637
28299
  preserveTimestamps: true
25638
28300
  };
25639
- await copy(src, dest, opts);
28301
+ await copy2(src, dest, opts);
25640
28302
  return remove(src);
25641
28303
  }
25642
28304
  module.exports = move;
@@ -26562,7 +29224,7 @@ var require_suggestSimilar = __commonJS((exports) => {
26562
29224
 
26563
29225
  // node_modules/commander/lib/command.js
26564
29226
  var require_command = __commonJS((exports) => {
26565
- var EventEmitter = __require("node:events").EventEmitter;
29227
+ var EventEmitter2 = __require("node:events").EventEmitter;
26566
29228
  var childProcess = __require("node:child_process");
26567
29229
  var path3 = __require("node:path");
26568
29230
  var fs2 = __require("node:fs");
@@ -26573,7 +29235,7 @@ var require_command = __commonJS((exports) => {
26573
29235
  var { Option, DualOptions } = require_option();
26574
29236
  var { suggestSimilar } = require_suggestSimilar();
26575
29237
 
26576
- class Command extends EventEmitter {
29238
+ class Command extends EventEmitter2 {
26577
29239
  constructor(name) {
26578
29240
  super();
26579
29241
  this.commands = [];
@@ -28101,12 +30763,12 @@ class ConfigController {
28101
30763
  {
28102
30764
  type: "list",
28103
30765
  name: "configAction",
28104
- message: "⚙️ Configurações",
30766
+ message: t2("menu.configTitle"),
28105
30767
  choices: [
28106
- { name: "\uD83D\uDD11 Configurar token", value: CONFIG_ACTIONS.TOKEN },
28107
- { name: "\uD83D\uDC40 Ver configuração atual", value: CONFIG_ACTIONS.VIEW },
28108
- { name: "\uD83D\uDD04 Resetar configuração", value: CONFIG_ACTIONS.RESET },
28109
- { name: "⬅️ Voltar", value: CONFIG_ACTIONS.BACK }
30768
+ { name: t2("menu.configToken"), value: CONFIG_ACTIONS.TOKEN },
30769
+ { name: t2("menu.configView"), value: CONFIG_ACTIONS.VIEW },
30770
+ { name: t2("menu.configReset"), value: CONFIG_ACTIONS.RESET },
30771
+ { name: t2("menu.configBack"), value: CONFIG_ACTIONS.BACK }
28110
30772
  ]
28111
30773
  }
28112
30774
  ]);
@@ -28116,22 +30778,23 @@ class ConfigController {
28116
30778
  break;
28117
30779
  case CONFIG_ACTIONS.VIEW:
28118
30780
  const config = await this.authController.getConfig();
28119
- console.log("\uD83D\uDCCB Configuração atual:");
30781
+ console.log(t2("menu.currentConfig"));
28120
30782
  console.log(`API Key: ${config.apiKey}`);
28121
- console.log(`Token configurado: ${config.hasValidToken() ? "✅ Sim" : "❌ Não"}`);
28122
- console.log(`Arquivo de config: ~/.trello-cli-unofficial/config.json`);
30783
+ const tokenStatus = config.hasValidToken() ? `✅ ${t2("common.yes")}` : `❌ ${t2("common.no")}`;
30784
+ console.log(`${t2("menu.tokenConfigured")} ${tokenStatus}`);
30785
+ console.log(t2("menu.configFile"));
28123
30786
  break;
28124
30787
  case CONFIG_ACTIONS.RESET:
28125
30788
  const { confirm } = await esm_default12.prompt([
28126
30789
  {
28127
30790
  type: "confirm",
28128
30791
  name: "confirm",
28129
- message: "Tem certeza que deseja resetar toda a configuração?",
30792
+ message: t2("menu.confirmReset"),
28130
30793
  default: false
28131
30794
  }
28132
30795
  ]);
28133
30796
  if (confirm) {
28134
- console.log("✅ Configuração resetada!");
30797
+ console.log(t2("menu.configResetted"));
28135
30798
  }
28136
30799
  break;
28137
30800
  case CONFIG_ACTIONS.BACK:
@@ -28143,6 +30806,7 @@ class ConfigController {
28143
30806
  var init_ConfigController = __esm(() => {
28144
30807
  init_types();
28145
30808
  init_esm16();
30809
+ init_i18n();
28146
30810
  });
28147
30811
 
28148
30812
  // src/presentation/cli/MainMenuController.ts
@@ -28161,13 +30825,13 @@ class MainMenuController {
28161
30825
  {
28162
30826
  type: "list",
28163
30827
  name: "action",
28164
- message: "\uD83C\uDFE0 Menu Principal - Trello CLI Unofficial",
30828
+ message: t2("menu.title"),
28165
30829
  choices: [
28166
- { name: "\uD83D\uDCCB Ver meus quadros", value: MENU_ACTIONS.BOARDS },
28167
- { name: "\uD83D\uDCDD Explorar quadro", value: MENU_ACTIONS.EXPLORE },
28168
- { name: "➕ Criar cartão", value: MENU_ACTIONS.CREATE },
28169
- { name: "⚙️ Configurações", value: MENU_ACTIONS.CONFIG },
28170
- { name: "\uD83D\uDEAA Sair", value: MENU_ACTIONS.EXIT }
30830
+ { name: t2("menu.boards"), value: MENU_ACTIONS.BOARDS },
30831
+ { name: t2("menu.explore"), value: MENU_ACTIONS.EXPLORE },
30832
+ { name: t2("menu.create"), value: MENU_ACTIONS.CREATE },
30833
+ { name: t2("menu.config"), value: MENU_ACTIONS.CONFIG },
30834
+ { name: t2("menu.exit"), value: MENU_ACTIONS.EXIT }
28171
30835
  ]
28172
30836
  }
28173
30837
  ]);
@@ -28186,11 +30850,11 @@ class MainMenuController {
28186
30850
  await this.configController.showConfigMenu();
28187
30851
  break;
28188
30852
  case MENU_ACTIONS.EXIT:
28189
- console.log("\uD83D\uDC4B Até logo!");
30853
+ console.log(t2("menu.goodbye"));
28190
30854
  return;
28191
30855
  }
28192
30856
  } catch (error) {
28193
- console.error("❌ Erro:", error.message);
30857
+ console.error(t2("errors.generic"), error.message);
28194
30858
  }
28195
30859
  console.log(`
28196
30860
  ${"=".repeat(50)}
@@ -28198,12 +30862,13 @@ ${"=".repeat(50)}
28198
30862
  }
28199
30863
  }
28200
30864
  async exploreBoard() {
28201
- console.log("\uD83D\uDEA7 Explorar quadro - Em desenvolvimento");
30865
+ console.log(t2("menu.exploreInDevelopment"));
28202
30866
  }
28203
30867
  }
28204
30868
  var init_MainMenuController = __esm(() => {
28205
30869
  init_types();
28206
30870
  init_esm16();
30871
+ init_i18n();
28207
30872
  });
28208
30873
 
28209
30874
  // src/presentation/cli/index.ts