lingo.dev 0.116.2 → 0.116.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.cjs CHANGED
@@ -26,17 +26,17 @@ function getSettings(explicitApiKey) {
26
26
  _envVarsInfo();
27
27
  return {
28
28
  auth: {
29
- apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiKey]) || defaults2.auth.apiKey,
30
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _39 => _39.auth, 'optionalAccess', _40 => _40.apiUrl]) || defaults2.auth.apiUrl,
31
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _41 => _41.auth, 'optionalAccess', _42 => _42.webUrl]) || defaults2.auth.webUrl
29
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _38 => _38.auth, 'optionalAccess', _39 => _39.apiKey]) || defaults2.auth.apiKey,
30
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _40 => _40.auth, 'optionalAccess', _41 => _41.apiUrl]) || defaults2.auth.apiUrl,
31
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _42 => _42.auth, 'optionalAccess', _43 => _43.webUrl]) || defaults2.auth.webUrl
32
32
  },
33
33
  llm: {
34
- openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _43 => _43.llm, 'optionalAccess', _44 => _44.openaiApiKey]),
35
- anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _45 => _45.llm, 'optionalAccess', _46 => _46.anthropicApiKey]),
36
- groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _47 => _47.llm, 'optionalAccess', _48 => _48.groqApiKey]),
37
- googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _49 => _49.llm, 'optionalAccess', _50 => _50.googleApiKey]),
38
- openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _51 => _51.llm, 'optionalAccess', _52 => _52.openrouterApiKey]),
39
- mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _53 => _53.llm, 'optionalAccess', _54 => _54.mistralApiKey])
34
+ openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _44 => _44.llm, 'optionalAccess', _45 => _45.openaiApiKey]),
35
+ anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _46 => _46.llm, 'optionalAccess', _47 => _47.anthropicApiKey]),
36
+ groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _48 => _48.llm, 'optionalAccess', _49 => _49.groqApiKey]),
37
+ googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.googleApiKey]),
38
+ openrouterApiKey: env.OPENROUTER_API_KEY || _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.openrouterApiKey]),
39
+ mistralApiKey: env.MISTRAL_API_KEY || _optionalChain([systemFile, 'access', _54 => _54.llm, 'optionalAccess', _55 => _55.mistralApiKey])
40
40
  }
41
41
  };
42
42
  }
@@ -145,43 +145,43 @@ Please use LINGODOTDEV_API_KEY instead.
145
145
  function _envVarsInfo() {
146
146
  const env = _loadEnv();
147
147
  const systemFile = _loadSystemFile();
148
- if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _55 => _55.auth, 'optionalAccess', _56 => _56.apiKey])) {
148
+ if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _56 => _56.auth, 'optionalAccess', _57 => _57.apiKey])) {
149
149
  console.info(
150
150
  "\x1B[36m%s\x1B[0m",
151
151
  `\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
152
152
  );
153
153
  }
154
- if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _57 => _57.llm, 'optionalAccess', _58 => _58.openaiApiKey])) {
154
+ if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _58 => _58.llm, 'optionalAccess', _59 => _59.openaiApiKey])) {
155
155
  console.info(
156
156
  "\x1B[36m%s\x1B[0m",
157
157
  `\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
158
158
  );
159
159
  }
160
- if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _59 => _59.llm, 'optionalAccess', _60 => _60.anthropicApiKey])) {
160
+ if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _60 => _60.llm, 'optionalAccess', _61 => _61.anthropicApiKey])) {
161
161
  console.info(
162
162
  "\x1B[36m%s\x1B[0m",
163
163
  `\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
164
164
  );
165
165
  }
166
- if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _61 => _61.llm, 'optionalAccess', _62 => _62.groqApiKey])) {
166
+ if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _62 => _62.llm, 'optionalAccess', _63 => _63.groqApiKey])) {
167
167
  console.info(
168
168
  "\x1B[36m%s\x1B[0m",
169
169
  `\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
170
170
  );
171
171
  }
172
- if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _63 => _63.llm, 'optionalAccess', _64 => _64.googleApiKey])) {
172
+ if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _64 => _64.llm, 'optionalAccess', _65 => _65.googleApiKey])) {
173
173
  console.info(
174
174
  "\x1B[36m%s\x1B[0m",
175
175
  `\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
176
176
  );
177
177
  }
178
- if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _65 => _65.llm, 'optionalAccess', _66 => _66.openrouterApiKey])) {
178
+ if (env.OPENROUTER_API_KEY && _optionalChain([systemFile, 'access', _66 => _66.llm, 'optionalAccess', _67 => _67.openrouterApiKey])) {
179
179
  console.info(
180
180
  "\x1B[36m%s\x1B[0m",
181
181
  `\u2139\uFE0F Using OPENROUTER_API_KEY env var instead of key from user config`
182
182
  );
183
183
  }
184
- if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _67 => _67.llm, 'optionalAccess', _68 => _68.mistralApiKey])) {
184
+ if (env.MISTRAL_API_KEY && _optionalChain([systemFile, 'access', _68 => _68.llm, 'optionalAccess', _69 => _69.mistralApiKey])) {
185
185
  console.info(
186
186
  "\x1B[36m%s\x1B[0m",
187
187
  `\u2139\uFE0F Using MISTRAL_API_KEY env var instead of key from user config`
@@ -264,10 +264,10 @@ var LocalizationError = (_class5 = class extends Error {
264
264
  constructor(message, context) {
265
265
  super(message);_class5.prototype.__init5.call(this);;
266
266
  this.name = "LocalizationError";
267
- this.bucket = _optionalChain([context, 'optionalAccess', _69 => _69.bucket]);
268
- this.sourceLocale = _optionalChain([context, 'optionalAccess', _70 => _70.sourceLocale]);
269
- this.targetLocale = _optionalChain([context, 'optionalAccess', _71 => _71.targetLocale]);
270
- this.pathPattern = _optionalChain([context, 'optionalAccess', _72 => _72.pathPattern]);
267
+ this.bucket = _optionalChain([context, 'optionalAccess', _70 => _70.bucket]);
268
+ this.sourceLocale = _optionalChain([context, 'optionalAccess', _71 => _71.sourceLocale]);
269
+ this.targetLocale = _optionalChain([context, 'optionalAccess', _72 => _72.targetLocale]);
270
+ this.pathPattern = _optionalChain([context, 'optionalAccess', _73 => _73.pathPattern]);
271
271
  }
272
272
  }, _class5);
273
273
  var BucketProcessingError = (_class6 = class extends Error {
@@ -403,7 +403,7 @@ function createAuthenticator(params) {
403
403
  });
404
404
  if (res.ok) {
405
405
  const payload = await res.json();
406
- if (!_optionalChain([payload, 'optionalAccess', _73 => _73.email])) {
406
+ if (!_optionalChain([payload, 'optionalAccess', _74 => _74.email])) {
407
407
  return null;
408
408
  }
409
409
  return {
@@ -598,7 +598,7 @@ async function renderSummary(results) {
598
598
  if (succeededResults.length > 0) {
599
599
  console.log(_chalk2.default.hex(colors.green)("\n[Processed Files]"));
600
600
  for (const result of succeededResults) {
601
- const displayPath = _optionalChain([result, 'access', _74 => _74.pathPattern, 'optionalAccess', _75 => _75.replace, 'call', _76 => _76("[locale]", result.targetLocale)]) || "unknown";
601
+ const displayPath = _optionalChain([result, 'access', _75 => _75.pathPattern, 'optionalAccess', _76 => _76.replace, 'call', _77 => _77("[locale]", result.targetLocale)]) || "unknown";
602
602
  console.log(
603
603
  ` \u2713 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
604
604
  );
@@ -607,7 +607,7 @@ async function renderSummary(results) {
607
607
  if (skippedResults.length > 0) {
608
608
  console.log(_chalk2.default.hex(colors.blue)("\n[Cached Files]"));
609
609
  for (const result of skippedResults) {
610
- const displayPath = _optionalChain([result, 'access', _77 => _77.pathPattern, 'optionalAccess', _78 => _78.replace, 'call', _79 => _79("[locale]", result.targetLocale)]) || "unknown";
610
+ const displayPath = _optionalChain([result, 'access', _78 => _78.pathPattern, 'optionalAccess', _79 => _79.replace, 'call', _80 => _80("[locale]", result.targetLocale)]) || "unknown";
611
611
  console.log(
612
612
  ` \u26A1 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
613
613
  );
@@ -616,12 +616,12 @@ async function renderSummary(results) {
616
616
  if (failedResults.length > 0) {
617
617
  console.log(_chalk2.default.hex(colors.orange)("\n[Failed Files]"));
618
618
  for (const result of failedResults) {
619
- const displayPath = _optionalChain([result, 'access', _80 => _80.pathPattern, 'optionalAccess', _81 => _81.replace, 'call', _82 => _82("[locale]", result.targetLocale)]) || "unknown";
619
+ const displayPath = _optionalChain([result, 'access', _81 => _81.pathPattern, 'optionalAccess', _82 => _82.replace, 'call', _83 => _83("[locale]", result.targetLocale)]) || "unknown";
620
620
  console.log(
621
621
  ` \u274C ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
622
622
  );
623
623
  console.log(
624
- ` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _83 => _83.error, 'optionalAccess', _84 => _84.message]) || "Unknown error"))}`
624
+ ` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _84 => _84.error, 'optionalAccess', _85 => _85.message]) || "Unknown error"))}`
625
625
  );
626
626
  }
627
627
  }
@@ -1267,7 +1267,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
1267
1267
  });
1268
1268
  const auth2 = await newAuthenticator.whoami();
1269
1269
  if (auth2) {
1270
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _85 => _85.email])}`);
1270
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _86 => _86.email])}`);
1271
1271
  } else {
1272
1272
  _ora2.default.call(void 0, ).fail("Authentication failed.");
1273
1273
  }
@@ -1357,7 +1357,7 @@ function getBuckets(i18nConfig) {
1357
1357
  const includeItems = bucketEntry.include.map(
1358
1358
  (item) => resolveBucketItem(item)
1359
1359
  );
1360
- const excludeItems = _optionalChain([bucketEntry, 'access', _86 => _86.exclude, 'optionalAccess', _87 => _87.map, 'call', _88 => _88(
1360
+ const excludeItems = _optionalChain([bucketEntry, 'access', _87 => _87.exclude, 'optionalAccess', _88 => _88.map, 'call', _89 => _89(
1361
1361
  (item) => resolveBucketItem(item)
1362
1362
  )]);
1363
1363
  const config = {
@@ -1395,7 +1395,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
1395
1395
  delimiter: pattern.delimiter
1396
1396
  }))
1397
1397
  );
1398
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _89 => _89.flatMap, 'call', _90 => _90(
1398
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _90 => _90.flatMap, 'call', _91 => _91(
1399
1399
  (pattern) => expandPlaceholderedGlob(
1400
1400
  pattern.path,
1401
1401
  __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
@@ -1561,12 +1561,12 @@ function composeLoaders(...loaders) {
1561
1561
  return {
1562
1562
  init: async () => {
1563
1563
  for (const loader of loaders) {
1564
- await _optionalChain([loader, 'access', _91 => _91.init, 'optionalCall', _92 => _92()]);
1564
+ await _optionalChain([loader, 'access', _92 => _92.init, 'optionalCall', _93 => _93()]);
1565
1565
  }
1566
1566
  },
1567
1567
  setDefaultLocale(locale) {
1568
1568
  for (const loader of loaders) {
1569
- _optionalChain([loader, 'access', _93 => _93.setDefaultLocale, 'optionalCall', _94 => _94(locale)]);
1569
+ _optionalChain([loader, 'access', _94 => _94.setDefaultLocale, 'optionalCall', _95 => _95(locale)]);
1570
1570
  }
1571
1571
  return this;
1572
1572
  },
@@ -1587,7 +1587,7 @@ function composeLoaders(...loaders) {
1587
1587
  pullHints: async (originalInput) => {
1588
1588
  let result = originalInput;
1589
1589
  for (let i = 0; i < loaders.length; i++) {
1590
- const subResult = await _optionalChain([loaders, 'access', _95 => _95[i], 'access', _96 => _96.pullHints, 'optionalCall', _97 => _97(result)]);
1590
+ const subResult = await _optionalChain([loaders, 'access', _96 => _96[i], 'access', _97 => _97.pullHints, 'optionalCall', _98 => _98(result)]);
1591
1591
  if (subResult) {
1592
1592
  result = subResult;
1593
1593
  }
@@ -1609,7 +1609,7 @@ function createLoader(lDefinition) {
1609
1609
  if (state.initCtx) {
1610
1610
  return state.initCtx;
1611
1611
  }
1612
- state.initCtx = await _optionalChain([lDefinition, 'access', _98 => _98.init, 'optionalCall', _99 => _99()]);
1612
+ state.initCtx = await _optionalChain([lDefinition, 'access', _99 => _99.init, 'optionalCall', _100 => _100()]);
1613
1613
  return state.initCtx;
1614
1614
  },
1615
1615
  setDefaultLocale(locale) {
@@ -1620,7 +1620,7 @@ function createLoader(lDefinition) {
1620
1620
  return this;
1621
1621
  },
1622
1622
  async pullHints() {
1623
- return _optionalChain([lDefinition, 'access', _100 => _100.pullHints, 'optionalCall', _101 => _101(state.originalInput)]);
1623
+ return _optionalChain([lDefinition, 'access', _101 => _101.pullHints, 'optionalCall', _102 => _102(state.originalInput)]);
1624
1624
  },
1625
1625
  async pull(locale, input2) {
1626
1626
  if (!state.defaultLocale) {
@@ -1906,7 +1906,7 @@ function createDenormalizeLoader(options) {
1906
1906
  const preservedObjects = {};
1907
1907
  const nonPreservedInput = {};
1908
1908
  for (const [key, value] of Object.entries(inputDenormalized)) {
1909
- if (_optionalChain([options, 'optionalAccess', _102 => _102.shouldPreserveObject, 'optionalCall', _103 => _103(value)])) {
1909
+ if (_optionalChain([options, 'optionalAccess', _103 => _103.shouldPreserveObject, 'optionalCall', _104 => _104(value)])) {
1910
1910
  preservedObjects[key] = value;
1911
1911
  } else {
1912
1912
  nonPreservedInput[key] = value;
@@ -1939,7 +1939,7 @@ function createNormalizeLoader() {
1939
1939
  return normalized;
1940
1940
  },
1941
1941
  push: async (locale, data, originalInput) => {
1942
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _104 => _104.keysMap]), () => ( {}));
1942
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _105 => _105.keysMap]), () => ( {}));
1943
1943
  const input2 = mapDenormalizedKeys(data, keysMap);
1944
1944
  const denormalized = _flat.unflatten.call(void 0, input2, {
1945
1945
  delimiter: "/",
@@ -2040,7 +2040,7 @@ function createTextFileLoader(pathPattern) {
2040
2040
  const trimmedResult = result.trim();
2041
2041
  return trimmedResult;
2042
2042
  },
2043
- async push(locale, data, _36, originalLocale) {
2043
+ async push(locale, data, _37, originalLocale) {
2044
2044
  const draftPath = pathPattern.replaceAll("[locale]", locale);
2045
2045
  const finalPath = path14.default.resolve(draftPath);
2046
2046
  const dirPath = path14.default.dirname(finalPath);
@@ -2073,8 +2073,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
2073
2073
  if (!templateData) {
2074
2074
  templateData = await readFileForLocale(pathPattern, originalLocale);
2075
2075
  }
2076
- if (_optionalChain([templateData, 'optionalAccess', _105 => _105.match, 'call', _106 => _106(/[\r\n]$/)])) {
2077
- const ending = _optionalChain([templateData, 'optionalAccess', _107 => _107.includes, 'call', _108 => _108("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _109 => _109.includes, 'call', _110 => _110("\r")]) ? "\r" : "\n";
2076
+ if (_optionalChain([templateData, 'optionalAccess', _106 => _106.match, 'call', _107 => _107(/[\r\n]$/)])) {
2077
+ const ending = _optionalChain([templateData, 'optionalAccess', _108 => _108.includes, 'call', _109 => _109("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _110 => _110.includes, 'call', _111 => _111("\r")]) ? "\r" : "\n";
2078
2078
  return ending;
2079
2079
  }
2080
2080
  return "";
@@ -2268,7 +2268,7 @@ async function parseAndroidDocument(input2) {
2268
2268
  const resourceNodes = [];
2269
2269
  let metaIndex = 0;
2270
2270
  for (const child of resourcesNode.$$) {
2271
- const elementName = _optionalChain([child, 'optionalAccess', _111 => _111["#name"]]);
2271
+ const elementName = _optionalChain([child, 'optionalAccess', _112 => _112["#name"]]);
2272
2272
  if (!isResourceElementName(elementName)) {
2273
2273
  continue;
2274
2274
  }
@@ -2276,11 +2276,11 @@ async function parseAndroidDocument(input2) {
2276
2276
  if (!meta || meta.type !== elementName) {
2277
2277
  continue;
2278
2278
  }
2279
- const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _112 => _112.$, 'optionalAccess', _113 => _113.name]), () => ( meta.name));
2279
+ const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _113 => _113.$, 'optionalAccess', _114 => _114.name]), () => ( meta.name));
2280
2280
  if (!name) {
2281
2281
  continue;
2282
2282
  }
2283
- const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _114 => _114.$, 'optionalAccess', _115 => _115.translatable]), () => ( ""))).toLowerCase() !== "false";
2283
+ const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _115 => _115.$, 'optionalAccess', _116 => _116.translatable]), () => ( ""))).toLowerCase() !== "false";
2284
2284
  switch (meta.type) {
2285
2285
  case "string": {
2286
2286
  resourceNodes.push({
@@ -2293,7 +2293,7 @@ async function parseAndroidDocument(input2) {
2293
2293
  break;
2294
2294
  }
2295
2295
  case "string-array": {
2296
- const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _116 => _116.item]), () => ( []));
2296
+ const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _117 => _117.item]), () => ( []));
2297
2297
  const items = [];
2298
2298
  const templateItems = meta.items;
2299
2299
  for (let i = 0; i < Math.max(itemNodes.length, templateItems.length); i++) {
@@ -2317,7 +2317,7 @@ async function parseAndroidDocument(input2) {
2317
2317
  break;
2318
2318
  }
2319
2319
  case "plurals": {
2320
- const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _117 => _117.item]), () => ( []));
2320
+ const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _118 => _118.item]), () => ( []));
2321
2321
  const templateItems = meta.items;
2322
2322
  const items = [];
2323
2323
  for (const templateItem of templateItems) {
@@ -2326,7 +2326,7 @@ async function parseAndroidDocument(input2) {
2326
2326
  continue;
2327
2327
  }
2328
2328
  const nodeItem = itemNodes.find(
2329
- (item) => _optionalChain([item, 'optionalAccess', _118 => _118.$, 'optionalAccess', _119 => _119.quantity]) === quantity
2329
+ (item) => _optionalChain([item, 'optionalAccess', _119 => _119.$, 'optionalAccess', _120 => _120.quantity]) === quantity
2330
2330
  );
2331
2331
  if (!nodeItem) {
2332
2332
  continue;
@@ -2607,7 +2607,7 @@ function cloneResourceNode(resource) {
2607
2607
  const nodeClone = deepClone(resource.node);
2608
2608
  const itemNodes = _nullishCoalesce(nodeClone.item, () => ( []));
2609
2609
  const items = itemNodes.map((itemNode, index) => {
2610
- const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _120 => _120.items, 'access', _121 => _121[index], 'optionalAccess', _122 => _122.meta]), () => ( _optionalChain([resource, 'access', _123 => _123.items, 'access', _124 => _124[resource.items.length - 1], 'optionalAccess', _125 => _125.meta]))), () => ( makeTextMeta([])));
2610
+ const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _121 => _121.items, 'access', _122 => _122[index], 'optionalAccess', _123 => _123.meta]), () => ( _optionalChain([resource, 'access', _124 => _124.items, 'access', _125 => _125[resource.items.length - 1], 'optionalAccess', _126 => _126.meta]))), () => ( makeTextMeta([])));
2611
2611
  return {
2612
2612
  node: itemNode,
2613
2613
  meta: cloneTextMeta(templateMeta)
@@ -2627,7 +2627,7 @@ function cloneResourceNode(resource) {
2627
2627
  const items = [];
2628
2628
  for (const templateItem of resource.items) {
2629
2629
  const cloneNode = itemNodes.find(
2630
- (item) => _optionalChain([item, 'optionalAccess', _126 => _126.$, 'optionalAccess', _127 => _127.quantity]) === templateItem.quantity
2630
+ (item) => _optionalChain([item, 'optionalAccess', _127 => _127.$, 'optionalAccess', _128 => _128.quantity]) === templateItem.quantity
2631
2631
  );
2632
2632
  if (!cloneNode) {
2633
2633
  continue;
@@ -2883,8 +2883,8 @@ function cloneDocumentStructure(document) {
2883
2883
  resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
2884
2884
  );
2885
2885
  let filtered = resourcesClone.$$.filter((child) => {
2886
- const elementName = _optionalChain([child, 'optionalAccess', _128 => _128["#name"]]);
2887
- const name = _optionalChain([child, 'optionalAccess', _129 => _129.$, 'optionalAccess', _130 => _130.name]);
2886
+ const elementName = _optionalChain([child, 'optionalAccess', _129 => _129["#name"]]);
2887
+ const name = _optionalChain([child, 'optionalAccess', _130 => _130.$, 'optionalAccess', _131 => _131.name]);
2888
2888
  if (!isResourceElementName(elementName) || !name) {
2889
2889
  return true;
2890
2890
  }
@@ -2893,7 +2893,7 @@ function cloneDocumentStructure(document) {
2893
2893
  const cleaned = [];
2894
2894
  let lastWasWhitespace = false;
2895
2895
  for (const child of filtered) {
2896
- const isWhitespace = _optionalChain([child, 'optionalAccess', _131 => _131["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
2896
+ const isWhitespace = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
2897
2897
  if (isWhitespace) {
2898
2898
  if (!lastWasWhitespace) {
2899
2899
  cleaned.push(child);
@@ -2915,8 +2915,8 @@ function buildResourceLookup(resources) {
2915
2915
  const lookup = /* @__PURE__ */ new Map();
2916
2916
  const children = Array.isArray(resources.$$) ? resources.$$ : [];
2917
2917
  for (const child of children) {
2918
- const type = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]);
2919
- const name = _optionalChain([child, 'optionalAccess', _133 => _133.$, 'optionalAccess', _134 => _134.name]);
2918
+ const type = _optionalChain([child, 'optionalAccess', _133 => _133["#name"]]);
2919
+ const name = _optionalChain([child, 'optionalAccess', _134 => _134.$, 'optionalAccess', _135 => _135.name]);
2920
2920
  if (!type || !name || !isResourceElementName(type)) {
2921
2921
  continue;
2922
2922
  }
@@ -2945,7 +2945,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
2945
2945
  }
2946
2946
  case "string-array": {
2947
2947
  const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
2948
- (child) => _optionalChain([child, 'optionalAccess', _135 => _135["#name"]]) === "item"
2948
+ (child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
2949
2949
  );
2950
2950
  node.item = childItems;
2951
2951
  if (childItems.length < resource.items.length) {
@@ -2974,12 +2974,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
2974
2974
  }
2975
2975
  case "plurals": {
2976
2976
  const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
2977
- (child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
2977
+ (child) => _optionalChain([child, 'optionalAccess', _137 => _137["#name"]]) === "item"
2978
2978
  );
2979
2979
  node.item = childItems;
2980
2980
  const itemMap = /* @__PURE__ */ new Map();
2981
2981
  for (const item of childItems) {
2982
- if (_optionalChain([item, 'optionalAccess', _137 => _137.$, 'optionalAccess', _138 => _138.quantity])) {
2982
+ if (_optionalChain([item, 'optionalAccess', _138 => _138.$, 'optionalAccess', _139 => _139.quantity])) {
2983
2983
  itemMap.set(item.$.quantity, item);
2984
2984
  }
2985
2985
  }
@@ -3269,7 +3269,7 @@ var _sync3 = require('csv-stringify/sync');
3269
3269
 
3270
3270
  function detectKeyColumnName(csvString) {
3271
3271
  const row = _sync.parse.call(void 0, csvString)[0];
3272
- const firstColumn = _optionalChain([row, 'optionalAccess', _139 => _139[0], 'optionalAccess', _140 => _140.trim, 'call', _141 => _141()]);
3272
+ const firstColumn = _optionalChain([row, 'optionalAccess', _140 => _140[0], 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()]);
3273
3273
  return firstColumn || "KEY";
3274
3274
  }
3275
3275
  function createCsvLoader() {
@@ -3371,7 +3371,7 @@ function createHtmlLoader() {
3371
3371
  break;
3372
3372
  }
3373
3373
  const siblings = Array.from(parent.childNodes).filter(
3374
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _142 => _142.textContent, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()])
3374
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _143 => _143.textContent, 'optionalAccess', _144 => _144.trim, 'call', _145 => _145()])
3375
3375
  );
3376
3376
  const index = siblings.indexOf(current);
3377
3377
  if (index !== -1) {
@@ -3407,15 +3407,15 @@ function createHtmlLoader() {
3407
3407
  }
3408
3408
  });
3409
3409
  Array.from(element.childNodes).filter(
3410
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _145 => _145.textContent, 'optionalAccess', _146 => _146.trim, 'call', _147 => _147()])
3410
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _146 => _146.textContent, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()])
3411
3411
  ).forEach(processNode);
3412
3412
  }
3413
3413
  };
3414
3414
  Array.from(document.head.childNodes).filter(
3415
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _148 => _148.textContent, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()])
3415
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _149 => _149.textContent, 'optionalAccess', _150 => _150.trim, 'call', _151 => _151()])
3416
3416
  ).forEach(processNode);
3417
3417
  Array.from(document.body.childNodes).filter(
3418
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _151 => _151.textContent, 'optionalAccess', _152 => _152.trim, 'call', _153 => _153()])
3418
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _152 => _152.textContent, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])
3419
3419
  ).forEach(processNode);
3420
3420
  return result;
3421
3421
  },
@@ -3440,7 +3440,7 @@ function createHtmlLoader() {
3440
3440
  for (let i = 0; i < indices.length; i++) {
3441
3441
  const index = parseInt(indices[i]);
3442
3442
  const siblings = Array.from(parent.childNodes).filter(
3443
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _154 => _154.textContent, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])
3443
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _155 => _155.textContent, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()])
3444
3444
  );
3445
3445
  if (index >= siblings.length) {
3446
3446
  if (i === indices.length - 1) {
@@ -3491,7 +3491,7 @@ function createMarkdownLoader() {
3491
3491
  yaml: yamlEngine
3492
3492
  }
3493
3493
  });
3494
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]), () => ( ""))).filter(Boolean);
3494
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]), () => ( ""))).filter(Boolean);
3495
3495
  return {
3496
3496
  ...Object.fromEntries(
3497
3497
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -3510,7 +3510,7 @@ function createMarkdownLoader() {
3510
3510
  );
3511
3511
  let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
3512
3512
  ([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
3513
- ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()]), () => ( ""))).filter(Boolean).join("\n\n");
3513
+ ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]), () => ( ""))).filter(Boolean).join("\n\n");
3514
3514
  if (Object.keys(frontmatter).length > 0) {
3515
3515
  content = `
3516
3516
  ${content}`;
@@ -3535,7 +3535,7 @@ function createMarkdocLoader() {
3535
3535
  const result = {};
3536
3536
  const counters = {};
3537
3537
  traverseAndExtract(ast, "", result, counters);
3538
- if (_optionalChain([ast, 'access', _161 => _161.attributes, 'optionalAccess', _162 => _162.frontmatter])) {
3538
+ if (_optionalChain([ast, 'access', _162 => _162.attributes, 'optionalAccess', _163 => _163.frontmatter])) {
3539
3539
  const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
3540
3540
  Object.entries(frontmatter).forEach(([key, value]) => {
3541
3541
  if (typeof value === "string") {
@@ -3581,7 +3581,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
3581
3581
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3582
3582
  semanticType = nodeSemanticType;
3583
3583
  }
3584
- if (node.type === "text" && _optionalChain([node, 'access', _163 => _163.attributes, 'optionalAccess', _164 => _164.content])) {
3584
+ if (node.type === "text" && _optionalChain([node, 'access', _164 => _164.attributes, 'optionalAccess', _165 => _165.content])) {
3585
3585
  const content = node.attributes.content;
3586
3586
  if (typeof content === "string" && content.trim()) {
3587
3587
  if (semanticType) {
@@ -3608,7 +3608,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
3608
3608
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3609
3609
  semanticType = nodeSemanticType;
3610
3610
  }
3611
- if (node.type === "text" && _optionalChain([node, 'access', _165 => _165.attributes, 'optionalAccess', _166 => _166.content])) {
3611
+ if (node.type === "text" && _optionalChain([node, 'access', _166 => _166.attributes, 'optionalAccess', _167 => _167.content])) {
3612
3612
  const content = node.attributes.content;
3613
3613
  if (typeof content === "string" && content.trim()) {
3614
3614
  if (semanticType) {
@@ -3631,7 +3631,7 @@ function applyTranslations(node, path19, data, pathMap) {
3631
3631
  if (!node || typeof node !== "object") {
3632
3632
  return;
3633
3633
  }
3634
- if (node.type === "text" && _optionalChain([node, 'access', _167 => _167.attributes, 'optionalAccess', _168 => _168.content])) {
3634
+ if (node.type === "text" && _optionalChain([node, 'access', _168 => _168.attributes, 'optionalAccess', _169 => _169.content])) {
3635
3635
  const content = node.attributes.content;
3636
3636
  if (typeof content === "string") {
3637
3637
  const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
@@ -3670,7 +3670,7 @@ function createPropertiesLoader() {
3670
3670
  return result;
3671
3671
  },
3672
3672
  async push(locale, payload) {
3673
- const result = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
3673
+ const result = Object.entries(payload).filter(([_37, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
3674
3674
  return result;
3675
3675
  }
3676
3676
  });
@@ -3681,7 +3681,7 @@ function isSkippableLine(line) {
3681
3681
  function parsePropertyLine(line) {
3682
3682
  const [key, ...valueParts] = line.split("=");
3683
3683
  return {
3684
- key: _optionalChain([key, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]) || "",
3684
+ key: _optionalChain([key, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || "",
3685
3685
  value: valueParts.join("=").trim()
3686
3686
  };
3687
3687
  }
@@ -3973,7 +3973,7 @@ var Parser = class {
3973
3973
  }
3974
3974
  }
3975
3975
  expect(type) {
3976
- if (_optionalChain([this, 'access', _171 => _171.current, 'call', _172 => _172(), 'optionalAccess', _173 => _173.type]) === type) {
3976
+ if (_optionalChain([this, 'access', _172 => _172.current, 'call', _173 => _173(), 'optionalAccess', _174 => _174.type]) === type) {
3977
3977
  this.advance();
3978
3978
  return true;
3979
3979
  }
@@ -3992,7 +3992,7 @@ function createXcodeStringsLoader() {
3992
3992
  return result;
3993
3993
  },
3994
3994
  async push(locale, payload) {
3995
- const lines = Object.entries(payload).filter(([_36, value]) => value != null).map(([key, value]) => {
3995
+ const lines = Object.entries(payload).filter(([_37, value]) => value != null).map(([key, value]) => {
3996
3996
  const escapedValue = escapeString(value);
3997
3997
  return `"${key}" = "${escapedValue}";`;
3998
3998
  });
@@ -4050,7 +4050,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4050
4050
  if (rootTranslationEntity.shouldTranslate === false) {
4051
4051
  continue;
4052
4052
  }
4053
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _174 => _174.localizations, 'optionalAccess', _175 => _175[locale]]);
4053
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]]);
4054
4054
  if (langTranslationEntity) {
4055
4055
  if ("stringUnit" in langTranslationEntity) {
4056
4056
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -4064,7 +4064,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4064
4064
  resultData[translationKey] = {};
4065
4065
  const pluralForms = langTranslationEntity.variations.plural;
4066
4066
  for (const form in pluralForms) {
4067
- if (_optionalChain([pluralForms, 'access', _176 => _176[form], 'optionalAccess', _177 => _177.stringUnit, 'optionalAccess', _178 => _178.value])) {
4067
+ if (_optionalChain([pluralForms, 'access', _177 => _177[form], 'optionalAccess', _178 => _178.stringUnit, 'optionalAccess', _179 => _179.value])) {
4068
4068
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
4069
4069
  }
4070
4070
  }
@@ -4090,7 +4090,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4090
4090
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
4091
4091
  if (typeof value === "string") {
4092
4092
  langDataToMerge.strings[key] = {
4093
- extractionState: _optionalChain([originalInput, 'optionalAccess', _179 => _179.strings, 'optionalAccess', _180 => _180[key], 'optionalAccess', _181 => _181.extractionState]),
4093
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
4094
4094
  localizations: {
4095
4095
  [locale]: {
4096
4096
  stringUnit: {
@@ -4105,7 +4105,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4105
4105
  }
4106
4106
  } else if (Array.isArray(value)) {
4107
4107
  langDataToMerge.strings[key] = {
4108
- extractionState: _optionalChain([originalInput, 'optionalAccess', _182 => _182.strings, 'optionalAccess', _183 => _183[key], 'optionalAccess', _184 => _184.extractionState]),
4108
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _183 => _183.strings, 'optionalAccess', _184 => _184[key], 'optionalAccess', _185 => _185.extractionState]),
4109
4109
  localizations: {
4110
4110
  [locale]: {
4111
4111
  stringSet: {
@@ -4163,7 +4163,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4163
4163
  for (const [locale, localization] of Object.entries(
4164
4164
  entity.localizations
4165
4165
  )) {
4166
- if (_optionalChain([localization, 'access', _185 => _185.variations, 'optionalAccess', _186 => _186.plural])) {
4166
+ if (_optionalChain([localization, 'access', _186 => _186.variations, 'optionalAccess', _187 => _187.plural])) {
4167
4167
  const pluralForms = localization.variations.plural;
4168
4168
  for (const form in pluralForms) {
4169
4169
  const pluralKey = `${translationKey}/${form}`;
@@ -4183,225 +4183,28 @@ function _removeLocale(input2, locale) {
4183
4183
  const { strings } = input2;
4184
4184
  const newStrings = _lodash2.default.cloneDeep(strings);
4185
4185
  for (const [key, value] of Object.entries(newStrings)) {
4186
- if (_optionalChain([value, 'access', _187 => _187.localizations, 'optionalAccess', _188 => _188[locale]])) {
4186
+ if (_optionalChain([value, 'access', _188 => _188.localizations, 'optionalAccess', _189 => _189[locale]])) {
4187
4187
  delete value.localizations[locale];
4188
4188
  }
4189
4189
  }
4190
4190
  return { ...input2, strings: newStrings };
4191
4191
  }
4192
4192
 
4193
- // src/cli/loaders/xcode-xcstrings-icu.ts
4194
- var ICU_TYPE_MARKER = Symbol.for("@lingo.dev/icu-plural-object");
4195
- var CLDR_PLURAL_CATEGORIES = /* @__PURE__ */ new Set([
4196
- "zero",
4197
- "one",
4198
- "two",
4199
- "few",
4200
- "many",
4201
- "other"
4202
- ]);
4203
- function isICUPluralObject(value) {
4204
- if (!value || typeof value !== "object" || Array.isArray(value)) {
4205
- return false;
4206
- }
4207
- if (ICU_TYPE_MARKER in value) {
4208
- return true;
4209
- }
4210
- if (!("icu" in value) || typeof value.icu !== "string") {
4211
- return false;
4212
- }
4213
- const icuPluralPattern = /^\{[\w]+,\s*plural,\s*.+\}$/;
4214
- if (!icuPluralPattern.test(value.icu)) {
4215
- return false;
4216
- }
4217
- if (value._meta !== void 0) {
4218
- if (typeof value._meta !== "object" || !value._meta.variables || typeof value._meta.variables !== "object") {
4219
- return false;
4220
- }
4221
- for (const [varName, varMeta] of Object.entries(value._meta.variables)) {
4222
- if (!varMeta || typeof varMeta !== "object" || typeof varMeta.format !== "string" || varMeta.role !== "plural" && varMeta.role !== "other") {
4223
- return false;
4224
- }
4225
- }
4226
- }
4227
- return true;
4228
- }
4229
- function isPluralFormsObject(value) {
4230
- if (!value || typeof value !== "object" || Array.isArray(value)) {
4231
- return false;
4232
- }
4233
- const keys = Object.keys(value);
4234
- if (keys.length === 0) {
4235
- return false;
4236
- }
4237
- const allKeysAreCldr = keys.every((key) => CLDR_PLURAL_CATEGORIES.has(key));
4238
- if (!allKeysAreCldr) {
4239
- return false;
4240
- }
4241
- const allValuesAreStrings = keys.every(
4242
- (key) => typeof value[key] === "string"
4193
+ // src/cli/loaders/xcode-xcstrings-v2.ts
4194
+
4195
+ function buildIcuPluralString(forms) {
4196
+ const parts = Object.entries(forms).map(
4197
+ ([form, text]) => `${form} {${text}}`
4243
4198
  );
4244
- if (!allValuesAreStrings) {
4245
- return false;
4246
- }
4247
- if (!("other" in value)) {
4248
- return false;
4249
- }
4250
- return true;
4199
+ return `{count, plural, ${parts.join(" ")}}`;
4251
4200
  }
4252
- function getRequiredPluralCategories(locale) {
4253
- try {
4254
- const pluralRules = new Intl.PluralRules(locale);
4255
- const categories = pluralRules.resolvedOptions().pluralCategories;
4256
- if (!categories || categories.length === 0) {
4257
- throw new Error(`No plural categories found for locale: ${locale}`);
4258
- }
4259
- return categories;
4260
- } catch (error) {
4261
- console.warn(
4262
- `[xcode-xcstrings-icu] Failed to resolve plural categories for locale "${locale}". Using fallback ["one", "other"]. Error: ${error instanceof Error ? error.message : String(error)}`
4263
- );
4264
- return ["one", "other"];
4265
- }
4266
- }
4267
- var CLDR_CATEGORY_TO_NUMBER = {
4268
- zero: 0,
4269
- one: 1,
4270
- two: 2
4271
- };
4272
- var NUMBER_TO_CLDR_CATEGORY = {
4273
- 0: "zero",
4274
- 1: "one",
4275
- 2: "two"
4276
- };
4277
- function xcstringsToPluralWithMeta(pluralForms, sourceLocale = "en") {
4278
- if (!pluralForms || Object.keys(pluralForms).length === 0) {
4279
- throw new Error("pluralForms cannot be empty");
4280
- }
4281
- const requiredCategories = getRequiredPluralCategories(sourceLocale);
4282
- const variables = {};
4283
- const formatRegex = /(%(?:(\d+)\$)?(?:[+-])?(?:\d+)?(?:\.(\d+))?([lhqLzjt]*)([diuoxXfFeEgGaAcspn@]))/g;
4284
- let maxMatches = [];
4285
- let maxMatchText = "";
4286
- for (const [form, text] of Object.entries(pluralForms)) {
4287
- if (typeof text !== "string") {
4288
- console.warn(
4289
- `Warning: Plural form "${form}" has non-string value:`,
4290
- text
4291
- );
4292
- continue;
4293
- }
4294
- const matches = [...text.matchAll(formatRegex)];
4295
- if (matches.length > maxMatches.length) {
4296
- maxMatches = matches;
4297
- maxMatchText = text;
4298
- }
4299
- }
4300
- let lastNumericIndex = -1;
4301
- maxMatches.forEach((match2, idx) => {
4302
- const specifier = match2[5];
4303
- if (/[diuoxXfFeE]/.test(specifier)) {
4304
- lastNumericIndex = idx;
4305
- }
4306
- });
4307
- let nonPluralCounter = 0;
4308
- maxMatches.forEach((match2, idx) => {
4309
- const fullFormat = match2[1];
4310
- const position = match2[2];
4311
- const precision = match2[3];
4312
- const lengthMod = match2[4];
4313
- const specifier = match2[5];
4314
- const isPluralVar = idx === lastNumericIndex;
4315
- const varName = isPluralVar ? "count" : `var${nonPluralCounter++}`;
4316
- variables[varName] = {
4317
- format: fullFormat,
4318
- role: isPluralVar ? "plural" : "other"
4319
- };
4320
- });
4321
- const variableKeys = Object.keys(variables);
4322
- const icuForms = Object.entries(pluralForms).filter(([form, text]) => {
4323
- if (typeof text !== "string") {
4324
- return false;
4325
- }
4326
- return true;
4327
- }).map(([form, text]) => {
4328
- let processed = text;
4329
- let vIdx = 0;
4330
- processed = processed.replace(formatRegex, () => {
4331
- if (vIdx >= variableKeys.length) {
4332
- vIdx++;
4333
- return "#";
4334
- }
4335
- const varName = variableKeys[vIdx];
4336
- const varMeta = variables[varName];
4337
- vIdx++;
4338
- if (varMeta.role === "plural") {
4339
- return "#";
4340
- } else {
4341
- return `{${varName}}`;
4342
- }
4343
- });
4344
- const isRequired = requiredCategories.includes(form);
4345
- const formKey = !isRequired && form in CLDR_CATEGORY_TO_NUMBER ? `=${CLDR_CATEGORY_TO_NUMBER[form]}` : form;
4346
- return `${formKey} {${processed}}`;
4347
- }).join(" ");
4348
- const pluralVarName = Object.keys(variables).find((name) => variables[name].role === "plural") || "count";
4349
- const icu = `{${pluralVarName}, plural, ${icuForms}}`;
4350
- const result = {
4351
- icu,
4352
- _meta: Object.keys(variables).length > 0 ? { variables } : void 0,
4353
- [ICU_TYPE_MARKER]: true
4354
- // Add type marker for robust detection
4355
- };
4356
- return result;
4357
- }
4358
- function pluralWithMetaToXcstrings(data) {
4359
- if (!data.icu) {
4360
- throw new Error("ICU string is required");
4361
- }
4362
- const ast = parseICU(data.icu);
4363
- if (!ast || ast.length === 0) {
4364
- throw new Error("Invalid ICU format");
4365
- }
4366
- const pluralNode = ast.find((node) => node.type === "plural");
4367
- if (!pluralNode) {
4368
- throw new Error("No plural found in ICU format");
4201
+ function parseIcuPluralString(icuString) {
4202
+ const pluralMatch = icuString.match(/\{[\w]+,\s*plural,\s*(.+)\}$/);
4203
+ if (!pluralMatch) {
4204
+ throw new Error(`Invalid ICU plural format: ${icuString}`);
4369
4205
  }
4206
+ const formsText = pluralMatch[1];
4370
4207
  const forms = {};
4371
- for (const [form, option] of Object.entries(pluralNode.options)) {
4372
- let text = "";
4373
- const optionValue = option.value;
4374
- for (const element of optionValue) {
4375
- if (element.type === "literal") {
4376
- text += element.value;
4377
- } else if (element.type === "pound") {
4378
- const pluralVar = Object.entries(_optionalChain([data, 'access', _189 => _189._meta, 'optionalAccess', _190 => _190.variables]) || {}).find(
4379
- ([_36, meta]) => meta.role === "plural"
4380
- );
4381
- text += _optionalChain([pluralVar, 'optionalAccess', _191 => _191[1], 'access', _192 => _192.format]) || "%lld";
4382
- } else if (element.type === "argument") {
4383
- const varName = element.value;
4384
- const varMeta = _optionalChain([data, 'access', _193 => _193._meta, 'optionalAccess', _194 => _194.variables, 'optionalAccess', _195 => _195[varName]]);
4385
- text += _optionalChain([varMeta, 'optionalAccess', _196 => _196.format]) || "%@";
4386
- }
4387
- }
4388
- let xcstringsFormName = form;
4389
- if (form.startsWith("=")) {
4390
- const numValue = parseInt(form.substring(1), 10);
4391
- xcstringsFormName = NUMBER_TO_CLDR_CATEGORY[numValue] || form;
4392
- }
4393
- forms[xcstringsFormName] = text;
4394
- }
4395
- return forms;
4396
- }
4397
- function parseICU(icu) {
4398
- const match2 = icu.match(/\{(\w+),\s*plural,\s*(.+)\}$/);
4399
- if (!match2) {
4400
- throw new Error("Invalid ICU plural format");
4401
- }
4402
- const varName = match2[1];
4403
- const formsText = match2[2];
4404
- const options = {};
4405
4208
  let i = 0;
4406
4209
  while (i < formsText.length) {
4407
4210
  while (i < formsText.length && /\s/.test(formsText[i])) {
@@ -4447,119 +4250,198 @@ function parseICU(icu) {
4447
4250
  i++;
4448
4251
  }
4449
4252
  if (braceCount !== 0) {
4450
- const preview = formsText.substring(
4451
- Math.max(0, i - 50),
4452
- Math.min(formsText.length, i + 50)
4453
- );
4454
4253
  throw new Error(
4455
- `Unclosed brace for form '${formName}' in ICU MessageFormat.
4456
- Expected ${braceCount} more closing brace(s).
4457
- Context: ...${preview}...
4458
- Full ICU: {${varName}, plural, ${formsText}}`
4254
+ `Unclosed brace for form '${formName}' in ICU: ${icuString}`
4459
4255
  );
4460
4256
  }
4461
- const elements = parseFormText(formText);
4462
- options[formName] = {
4463
- value: elements
4464
- };
4257
+ forms[formName] = formText;
4465
4258
  }
4466
- return [
4467
- {
4468
- type: "plural",
4469
- value: varName,
4470
- options
4471
- }
4472
- ];
4259
+ return forms;
4473
4260
  }
4474
- function parseFormText(text) {
4475
- const elements = [];
4476
- let currentText = "";
4477
- let i = 0;
4478
- while (i < text.length) {
4479
- if (text[i] === "#") {
4480
- if (currentText) {
4481
- elements.push({ type: "literal", value: currentText });
4482
- currentText = "";
4483
- }
4484
- elements.push({ type: "pound" });
4485
- i++;
4486
- } else if (text[i] === "{") {
4487
- if (currentText) {
4488
- elements.push({ type: "literal", value: currentText });
4489
- currentText = "";
4490
- }
4491
- let braceCount = 1;
4492
- let j = i + 1;
4493
- while (j < text.length && braceCount > 0) {
4494
- if (text[j] === "{") {
4495
- braceCount++;
4496
- } else if (text[j] === "}") {
4497
- braceCount--;
4498
- }
4499
- j++;
4500
- }
4501
- if (braceCount !== 0) {
4502
- throw new Error("Unclosed variable reference");
4503
- }
4504
- const varName = text.slice(i + 1, j - 1);
4505
- elements.push({ type: "argument", value: varName });
4506
- i = j;
4507
- } else {
4508
- currentText += text[i];
4509
- i++;
4510
- }
4511
- }
4512
- if (currentText) {
4513
- elements.push({ type: "literal", value: currentText });
4514
- }
4515
- return elements;
4261
+ function isIcuPluralString(value) {
4262
+ return typeof value === "string" && /^\{[\w]+,\s*plural,\s*.+\}$/.test(value);
4516
4263
  }
4517
-
4518
- // src/cli/loaders/xcode-xcstrings-v2-loader.ts
4519
- function createXcodeXcstringsV2Loader(defaultLocale = "en") {
4264
+ function createXcodeXcstringsV2Loader(defaultLocale) {
4520
4265
  return createLoader({
4521
- async pull(locale, input2) {
4522
- const result = {};
4523
- for (const [key, value] of Object.entries(input2)) {
4524
- if (isPluralFormsObject(value)) {
4525
- try {
4526
- result[key] = xcstringsToPluralWithMeta(value, locale);
4527
- } catch (error) {
4528
- console.error(
4529
- `
4530
- [xcode-xcstrings-icu] Failed to convert plural forms for key "${key}":`,
4531
- `
4532
- Error: ${error instanceof Error ? error.message : String(error)}`,
4533
- `
4534
- Locale: ${locale}
4535
- `
4536
- );
4537
- result[key] = value;
4266
+ async pull(locale, input2, initCtx) {
4267
+ const resultData = {};
4268
+ const isSourceLanguage = locale === defaultLocale;
4269
+ for (const [translationKey, _translationEntity] of Object.entries(
4270
+ input2.strings
4271
+ )) {
4272
+ const rootTranslationEntity = _translationEntity;
4273
+ if (rootTranslationEntity.shouldTranslate === false) {
4274
+ continue;
4275
+ }
4276
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _190 => _190.localizations, 'optionalAccess', _191 => _191[locale]]);
4277
+ if (langTranslationEntity) {
4278
+ if (!resultData[translationKey]) {
4279
+ resultData[translationKey] = {};
4538
4280
  }
4539
- } else {
4540
- result[key] = value;
4281
+ if ("stringUnit" in langTranslationEntity) {
4282
+ resultData[translationKey].stringUnit = langTranslationEntity.stringUnit.value;
4283
+ if ("substitutions" in langTranslationEntity) {
4284
+ resultData[translationKey].substitutions = {};
4285
+ for (const [subName, subData] of Object.entries(
4286
+ langTranslationEntity.substitutions
4287
+ )) {
4288
+ const pluralForms = _optionalChain([subData, 'access', _192 => _192.variations, 'optionalAccess', _193 => _193.plural]);
4289
+ if (pluralForms) {
4290
+ const forms = {};
4291
+ for (const [form, formData] of Object.entries(pluralForms)) {
4292
+ forms[form] = formData.stringUnit.value;
4293
+ }
4294
+ const icuString = buildIcuPluralString(forms);
4295
+ resultData[translationKey].substitutions[subName] = {
4296
+ variations: {
4297
+ plural: icuString
4298
+ }
4299
+ };
4300
+ }
4301
+ }
4302
+ }
4303
+ } else if ("stringSet" in langTranslationEntity) {
4304
+ const values = langTranslationEntity.stringSet.values;
4305
+ if (Array.isArray(values) && values.length > 0) {
4306
+ resultData[translationKey].stringSet = values;
4307
+ }
4308
+ } else if ("variations" in langTranslationEntity) {
4309
+ if ("plural" in langTranslationEntity.variations) {
4310
+ const pluralForms = langTranslationEntity.variations.plural;
4311
+ const forms = {};
4312
+ for (const [form, formData] of Object.entries(pluralForms)) {
4313
+ if (_optionalChain([formData, 'optionalAccess', _194 => _194.stringUnit, 'optionalAccess', _195 => _195.value])) {
4314
+ forms[form] = formData.stringUnit.value;
4315
+ }
4316
+ }
4317
+ const icuString = buildIcuPluralString(forms);
4318
+ resultData[translationKey].variations = {
4319
+ plural: icuString
4320
+ };
4321
+ }
4322
+ }
4323
+ } else if (isSourceLanguage) {
4324
+ if (!resultData[translationKey]) {
4325
+ resultData[translationKey] = {};
4326
+ }
4327
+ resultData[translationKey].stringUnit = translationKey;
4541
4328
  }
4542
4329
  }
4543
- return result;
4330
+ return resultData;
4544
4331
  },
4545
- async push(locale, payload) {
4546
- const result = {};
4547
- for (const [key, value] of Object.entries(payload)) {
4548
- if (isICUPluralObject(value)) {
4549
- try {
4550
- const pluralForms = pluralWithMetaToXcstrings(value);
4551
- result[key] = pluralForms;
4552
- } catch (error) {
4553
- throw new Error(
4554
- `Failed to write plural translation for key "${key}" (locale: ${locale}).
4332
+ async push(locale, payload, originalInput) {
4333
+ const langDataToMerge = {};
4334
+ langDataToMerge.strings = {};
4335
+ const input2 = _lodash2.default.cloneDeep(originalInput) || {
4336
+ sourceLanguage: locale,
4337
+ strings: {}
4338
+ };
4339
+ for (const [baseKey, keyData] of Object.entries(payload)) {
4340
+ if (!keyData || typeof keyData !== "object") {
4341
+ continue;
4342
+ }
4343
+ const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[baseKey] && originalInput.strings[baseKey].shouldTranslate === false;
4344
+ const localizationData = {};
4345
+ if ("stringUnit" in keyData) {
4346
+ localizationData.stringUnit = {
4347
+ state: "translated",
4348
+ value: keyData.stringUnit
4349
+ };
4350
+ }
4351
+ if ("substitutions" in keyData && keyData.substitutions) {
4352
+ const subs = {};
4353
+ for (const [subName, subData] of Object.entries(
4354
+ keyData.substitutions
4355
+ )) {
4356
+ const pluralValue = _optionalChain([subData, 'optionalAccess', _196 => _196.variations, 'optionalAccess', _197 => _197.plural]);
4357
+ if (pluralValue && isIcuPluralString(pluralValue)) {
4358
+ try {
4359
+ const pluralForms = parseIcuPluralString(pluralValue);
4360
+ const pluralOut = {};
4361
+ for (const [form, text] of Object.entries(pluralForms)) {
4362
+ pluralOut[form] = {
4363
+ stringUnit: {
4364
+ state: "translated",
4365
+ value: text
4366
+ }
4367
+ };
4368
+ }
4369
+ const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _198 => _198.sourceLanguage]) || "en";
4370
+ const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _199 => _199.strings, 'optionalAccess', _200 => _200[baseKey], 'optionalAccess', _201 => _201.localizations, 'optionalAccess', _202 => _202[sourceLocale], 'optionalAccess', _203 => _203.substitutions, 'optionalAccess', _204 => _204[subName], 'optionalAccess', _205 => _205.formatSpecifier]) || subName;
4371
+ subs[subName] = {
4372
+ formatSpecifier: origFormatSpec,
4373
+ variations: {
4374
+ plural: pluralOut
4375
+ }
4376
+ };
4377
+ } catch (error) {
4378
+ throw new Error(
4379
+ `Failed to write substitution plural translation for key "${baseKey}/substitutions/${subName}" (locale: ${locale}).
4555
4380
  ${error instanceof Error ? error.message : String(error)}`
4556
- );
4381
+ );
4382
+ }
4383
+ }
4384
+ }
4385
+ if (Object.keys(subs).length > 0) {
4386
+ localizationData.substitutions = subs;
4387
+ }
4388
+ }
4389
+ if ("stringSet" in keyData && Array.isArray(keyData.stringSet)) {
4390
+ localizationData.stringSet = {
4391
+ state: "translated",
4392
+ values: keyData.stringSet
4393
+ };
4394
+ }
4395
+ if ("variations" in keyData && _optionalChain([keyData, 'access', _206 => _206.variations, 'optionalAccess', _207 => _207.plural])) {
4396
+ const pluralValue = keyData.variations.plural;
4397
+ if (isIcuPluralString(pluralValue)) {
4398
+ try {
4399
+ const pluralForms = parseIcuPluralString(pluralValue);
4400
+ const pluralOut = {};
4401
+ for (const [form, text] of Object.entries(pluralForms)) {
4402
+ pluralOut[form] = {
4403
+ stringUnit: {
4404
+ state: "translated",
4405
+ value: text
4406
+ }
4407
+ };
4408
+ }
4409
+ localizationData.variations = {
4410
+ plural: pluralOut
4411
+ };
4412
+ } catch (error) {
4413
+ throw new Error(
4414
+ `Failed to write plural translation for key "${baseKey}" (locale: ${locale}).
4415
+ ${error instanceof Error ? error.message : String(error)}`
4416
+ );
4417
+ }
4418
+ }
4419
+ }
4420
+ if (Object.keys(localizationData).length > 0) {
4421
+ langDataToMerge.strings[baseKey] = {
4422
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _208 => _208.strings, 'optionalAccess', _209 => _209[baseKey], 'optionalAccess', _210 => _210.extractionState]),
4423
+ localizations: {
4424
+ [locale]: localizationData
4425
+ }
4426
+ };
4427
+ if (hasDoNotTranslateFlag) {
4428
+ langDataToMerge.strings[baseKey].shouldTranslate = false;
4557
4429
  }
4558
- } else {
4559
- result[key] = value;
4560
4430
  }
4561
4431
  }
4562
- return result;
4432
+ return _lodash2.default.merge(input2, langDataToMerge);
4433
+ },
4434
+ async pullHints(input2) {
4435
+ const hints = {};
4436
+ for (const [translationKey, _translationEntity] of Object.entries(
4437
+ input2.strings || {}
4438
+ )) {
4439
+ const rootTranslationEntity = _translationEntity;
4440
+ if (rootTranslationEntity.comment && typeof rootTranslationEntity.comment === "string") {
4441
+ hints[translationKey] = { hint: rootTranslationEntity.comment };
4442
+ }
4443
+ }
4444
+ return hints;
4563
4445
  }
4564
4446
  });
4565
4447
  }
@@ -4574,12 +4456,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
4574
4456
  const unlocalizableKeys = _getUnlocalizableKeys(input2);
4575
4457
  const result = _lodash2.default.omitBy(
4576
4458
  input2,
4577
- (_36, key) => unlocalizableKeys.includes(key)
4459
+ (_37, key) => unlocalizableKeys.includes(key)
4578
4460
  );
4579
4461
  if (returnUnlocalizedKeys) {
4580
4462
  result.unlocalizable = _lodash2.default.omitBy(
4581
4463
  input2,
4582
- (_36, key) => !unlocalizableKeys.includes(key)
4464
+ (_37, key) => !unlocalizableKeys.includes(key)
4583
4465
  );
4584
4466
  }
4585
4467
  return result;
@@ -4589,7 +4471,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
4589
4471
  const result = _lodash2.default.merge(
4590
4472
  {},
4591
4473
  data,
4592
- _lodash2.default.omitBy(originalInput, (_36, key) => !unlocalizableKeys.includes(key))
4474
+ _lodash2.default.omitBy(originalInput, (_37, key) => !unlocalizableKeys.includes(key))
4593
4475
  );
4594
4476
  return result;
4595
4477
  }
@@ -4620,7 +4502,7 @@ function _getUnlocalizableKeys(input2) {
4620
4502
  }
4621
4503
  }
4622
4504
  return false;
4623
- }).map(([key, _36]) => key);
4505
+ }).map(([key, _37]) => key);
4624
4506
  }
4625
4507
 
4626
4508
  // src/cli/loaders/formatters/prettier.ts
@@ -4760,8 +4642,8 @@ async function formatDataWithBiome(data, filePath, options) {
4760
4642
  });
4761
4643
  return formatted.content;
4762
4644
  } catch (error) {
4763
- const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _197 => _197.stackTrace, 'optionalAccess', _198 => _198.toString, 'call', _199 => _199(), 'access', _200 => _200.split, 'call', _201 => _201("\n"), 'access', _202 => _202[0]]) : "";
4764
- if (_optionalChain([errorMessage, 'optionalAccess', _203 => _203.includes, 'call', _204 => _204("does not exist in the workspace")])) {
4645
+ const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _211 => _211.stackTrace, 'optionalAccess', _212 => _212.toString, 'call', _213 => _213(), 'access', _214 => _214.split, 'call', _215 => _215("\n"), 'access', _216 => _216[0]]) : "";
4646
+ if (_optionalChain([errorMessage, 'optionalAccess', _217 => _217.includes, 'call', _218 => _218("does not exist in the workspace")])) {
4765
4647
  } else {
4766
4648
  console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
4767
4649
  if (errorMessage) {
@@ -4808,7 +4690,7 @@ function createPoDataLoader(params) {
4808
4690
  Object.entries(entries).forEach(([msgid, entry]) => {
4809
4691
  if (msgid && entry.msgid) {
4810
4692
  const context = entry.msgctxt || "";
4811
- const fullEntry = _optionalChain([parsedPo, 'access', _205 => _205.translations, 'access', _206 => _206[context], 'optionalAccess', _207 => _207[msgid]]);
4693
+ const fullEntry = _optionalChain([parsedPo, 'access', _219 => _219.translations, 'access', _220 => _220[context], 'optionalAccess', _221 => _221[msgid]]);
4812
4694
  if (fullEntry) {
4813
4695
  result[msgid] = fullEntry;
4814
4696
  }
@@ -4818,8 +4700,8 @@ function createPoDataLoader(params) {
4818
4700
  return result;
4819
4701
  },
4820
4702
  async push(locale, data, originalInput, originalLocale, pullInput) {
4821
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _208 => _208.split, 'call', _209 => _209("\n\n"), 'access', _210 => _210.filter, 'call', _211 => _211(Boolean)]) || [];
4822
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _212 => _212.split, 'call', _213 => _213("\n\n"), 'access', _214 => _214.filter, 'call', _215 => _215(Boolean)]) || [];
4703
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _222 => _222.split, 'call', _223 => _223("\n\n"), 'access', _224 => _224.filter, 'call', _225 => _225(Boolean)]) || [];
4704
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _226 => _226.split, 'call', _227 => _227("\n\n"), 'access', _228 => _228.filter, 'call', _229 => _229(Boolean)]) || [];
4823
4705
  const result = originalSections.map((section) => {
4824
4706
  const sectionPo = _gettextparser2.default.po.parse(section);
4825
4707
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -4888,8 +4770,8 @@ function createPoContentLoader() {
4888
4770
  {
4889
4771
  ...entry,
4890
4772
  msgstr: [
4891
- _optionalChain([data, 'access', _216 => _216[entry.msgid], 'optionalAccess', _217 => _217.singular]),
4892
- _optionalChain([data, 'access', _218 => _218[entry.msgid], 'optionalAccess', _219 => _219.plural]) || null
4773
+ _optionalChain([data, 'access', _230 => _230[entry.msgid], 'optionalAccess', _231 => _231.singular]),
4774
+ _optionalChain([data, 'access', _232 => _232[entry.msgid], 'optionalAccess', _233 => _233.plural]) || null
4893
4775
  ].filter(Boolean)
4894
4776
  }
4895
4777
  ]).fromPairs().value();
@@ -5011,7 +4893,7 @@ function pullV1(xliffElement, locale, originalLocale) {
5011
4893
  let key = getTransUnitKey(unit);
5012
4894
  if (!key) return;
5013
4895
  if (seenKeys.has(key)) {
5014
- const id = _optionalChain([unit, 'access', _220 => _220.getAttribute, 'call', _221 => _221("id"), 'optionalAccess', _222 => _222.trim, 'call', _223 => _223()]);
4896
+ const id = _optionalChain([unit, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
5015
4897
  if (id) {
5016
4898
  key = `${key}#${id}`;
5017
4899
  } else {
@@ -5059,7 +4941,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5059
4941
  let key = getTransUnitKey(unit);
5060
4942
  if (!key) return;
5061
4943
  if (seenKeys.has(key)) {
5062
- const id = _optionalChain([unit, 'access', _224 => _224.getAttribute, 'call', _225 => _225("id"), 'optionalAccess', _226 => _226.trim, 'call', _227 => _227()]);
4944
+ const id = _optionalChain([unit, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5063
4945
  if (id) {
5064
4946
  key = `${key}#${id}`;
5065
4947
  } else {
@@ -5101,7 +4983,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5101
4983
  const translationKeys = new Set(Object.keys(translations));
5102
4984
  existingUnits.forEach((unit, key) => {
5103
4985
  if (!translationKeys.has(key)) {
5104
- _optionalChain([unit, 'access', _228 => _228.parentNode, 'optionalAccess', _229 => _229.removeChild, 'call', _230 => _230(unit)]);
4986
+ _optionalChain([unit, 'access', _242 => _242.parentNode, 'optionalAccess', _243 => _243.removeChild, 'call', _244 => _244(unit)]);
5105
4987
  }
5106
4988
  });
5107
4989
  return serializeWithDeclaration(
@@ -5144,18 +5026,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
5144
5026
  Array.from(container.children).forEach((child) => {
5145
5027
  const tagName = child.tagName;
5146
5028
  if (tagName === "unit") {
5147
- const unitId = _optionalChain([child, 'access', _231 => _231.getAttribute, 'call', _232 => _232("id"), 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]);
5029
+ const unitId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5148
5030
  if (!unitId) return;
5149
5031
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5150
5032
  const segment = child.querySelector("segment");
5151
- const source = _optionalChain([segment, 'optionalAccess', _235 => _235.querySelector, 'call', _236 => _236("source")]);
5033
+ const source = _optionalChain([segment, 'optionalAccess', _249 => _249.querySelector, 'call', _250 => _250("source")]);
5152
5034
  if (source) {
5153
5035
  result[key] = extractTextContent(source);
5154
5036
  } else {
5155
5037
  result[key] = unitId;
5156
5038
  }
5157
5039
  } else if (tagName === "group") {
5158
- const groupId = _optionalChain([child, 'access', _237 => _237.getAttribute, 'call', _238 => _238("id"), 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]);
5040
+ const groupId = _optionalChain([child, 'access', _251 => _251.getAttribute, 'call', _252 => _252("id"), 'optionalAccess', _253 => _253.trim, 'call', _254 => _254()]);
5159
5041
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5160
5042
  traverseUnitsV2(child, fileId, newPath, result);
5161
5043
  }
@@ -5191,12 +5073,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
5191
5073
  Array.from(container.children).forEach((child) => {
5192
5074
  const tagName = child.tagName;
5193
5075
  if (tagName === "unit") {
5194
- const unitId = _optionalChain([child, 'access', _241 => _241.getAttribute, 'call', _242 => _242("id"), 'optionalAccess', _243 => _243.trim, 'call', _244 => _244()]);
5076
+ const unitId = _optionalChain([child, 'access', _255 => _255.getAttribute, 'call', _256 => _256("id"), 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]);
5195
5077
  if (!unitId) return;
5196
5078
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5197
5079
  index.set(key, child);
5198
5080
  } else if (tagName === "group") {
5199
- const groupId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5081
+ const groupId = _optionalChain([child, 'access', _259 => _259.getAttribute, 'call', _260 => _260("id"), 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]);
5200
5082
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5201
5083
  indexUnitsV2(child, fileId, newPath, index);
5202
5084
  }
@@ -5217,9 +5099,9 @@ function updateUnitV2(unit, value) {
5217
5099
  setTextContent(source, value);
5218
5100
  }
5219
5101
  function getTransUnitKey(transUnit) {
5220
- const resname = _optionalChain([transUnit, 'access', _249 => _249.getAttribute, 'call', _250 => _250("resname"), 'optionalAccess', _251 => _251.trim, 'call', _252 => _252()]);
5102
+ const resname = _optionalChain([transUnit, 'access', _263 => _263.getAttribute, 'call', _264 => _264("resname"), 'optionalAccess', _265 => _265.trim, 'call', _266 => _266()]);
5221
5103
  if (resname) return resname;
5222
- const id = _optionalChain([transUnit, 'access', _253 => _253.getAttribute, 'call', _254 => _254("id"), 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]);
5104
+ const id = _optionalChain([transUnit, 'access', _267 => _267.getAttribute, 'call', _268 => _268("id"), 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]);
5223
5105
  if (id) return id;
5224
5106
  const sourceElement = transUnit.querySelector("source");
5225
5107
  if (sourceElement) {
@@ -5276,7 +5158,7 @@ function formatXml(xml) {
5276
5158
  if (cdataNode) {
5277
5159
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
5278
5160
  }
5279
- const textContent = _optionalChain([element, 'access', _257 => _257.textContent, 'optionalAccess', _258 => _258.trim, 'call', _259 => _259()]) || "";
5161
+ const textContent = _optionalChain([element, 'access', _271 => _271.textContent, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || "";
5280
5162
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
5281
5163
  if (hasOnlyText && textContent) {
5282
5164
  return `${indent2}${openTag}${textContent}</${tagName}>`;
@@ -5569,7 +5451,7 @@ function createDatoClient(params) {
5569
5451
  ids: !records.length ? void 0 : records.join(",")
5570
5452
  }
5571
5453
  }).catch(
5572
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _260 => _260.response, 'optionalAccess', _261 => _261.body, 'optionalAccess', _262 => _262.data, 'optionalAccess', _263 => _263[0]]) || error)
5454
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _274 => _274.response, 'optionalAccess', _275 => _275.body, 'optionalAccess', _276 => _276.data, 'optionalAccess', _277 => _277[0]]) || error)
5573
5455
  );
5574
5456
  },
5575
5457
  findRecordsForModel: async (modelId, records) => {
@@ -5580,10 +5462,10 @@ function createDatoClient(params) {
5580
5462
  filter: {
5581
5463
  type: modelId,
5582
5464
  only_valid: "true",
5583
- ids: !_optionalChain([records, 'optionalAccess', _264 => _264.length]) ? void 0 : records.join(",")
5465
+ ids: !_optionalChain([records, 'optionalAccess', _278 => _278.length]) ? void 0 : records.join(",")
5584
5466
  }
5585
5467
  }).catch(
5586
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _265 => _265.response, 'optionalAccess', _266 => _266.body, 'optionalAccess', _267 => _267.data, 'optionalAccess', _268 => _268[0]]) || error)
5468
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _279 => _279.response, 'optionalAccess', _280 => _280.body, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282[0]]) || error)
5587
5469
  );
5588
5470
  return result;
5589
5471
  } catch (_error) {
@@ -5599,10 +5481,10 @@ function createDatoClient(params) {
5599
5481
  updateRecord: async (id, payload) => {
5600
5482
  try {
5601
5483
  await dato.items.update(id, payload).catch(
5602
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _269 => _269.response, 'optionalAccess', _270 => _270.body, 'optionalAccess', _271 => _271.data, 'optionalAccess', _272 => _272[0]]) || error)
5484
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _283 => _283.response, 'optionalAccess', _284 => _284.body, 'optionalAccess', _285 => _285.data, 'optionalAccess', _286 => _286[0]]) || error)
5603
5485
  );
5604
5486
  } catch (_error) {
5605
- if (_optionalChain([_error, 'optionalAccess', _273 => _273.attributes, 'optionalAccess', _274 => _274.details, 'optionalAccess', _275 => _275.message])) {
5487
+ if (_optionalChain([_error, 'optionalAccess', _287 => _287.attributes, 'optionalAccess', _288 => _288.details, 'optionalAccess', _289 => _289.message])) {
5606
5488
  throw new Error(
5607
5489
  [
5608
5490
  `${_error.attributes.details.message}`,
@@ -5624,10 +5506,10 @@ function createDatoClient(params) {
5624
5506
  enableFieldLocalization: async (args) => {
5625
5507
  try {
5626
5508
  await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
5627
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _276 => _276.response, 'optionalAccess', _277 => _277.body, 'optionalAccess', _278 => _278.data, 'optionalAccess', _279 => _279[0]]) || error)
5509
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _290 => _290.response, 'optionalAccess', _291 => _291.body, 'optionalAccess', _292 => _292.data, 'optionalAccess', _293 => _293[0]]) || error)
5628
5510
  );
5629
5511
  } catch (_error) {
5630
- if (_optionalChain([_error, 'optionalAccess', _280 => _280.attributes, 'optionalAccess', _281 => _281.code]) === "NOT_FOUND") {
5512
+ if (_optionalChain([_error, 'optionalAccess', _294 => _294.attributes, 'optionalAccess', _295 => _295.code]) === "NOT_FOUND") {
5631
5513
  throw new Error(
5632
5514
  [
5633
5515
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -5635,7 +5517,7 @@ function createDatoClient(params) {
5635
5517
  ].join("\n\n")
5636
5518
  );
5637
5519
  }
5638
- if (_optionalChain([_error, 'optionalAccess', _282 => _282.attributes, 'optionalAccess', _283 => _283.details, 'optionalAccess', _284 => _284.message])) {
5520
+ if (_optionalChain([_error, 'optionalAccess', _296 => _296.attributes, 'optionalAccess', _297 => _297.details, 'optionalAccess', _298 => _298.message])) {
5639
5521
  throw new Error(
5640
5522
  [
5641
5523
  `${_error.attributes.details.message}`,
@@ -5713,7 +5595,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
5713
5595
  const records = await dato.findRecordsForModel(modelId);
5714
5596
  const recordChoices = createRecordChoices(
5715
5597
  records,
5716
- _optionalChain([config, 'access', _285 => _285.models, 'access', _286 => _286[modelId], 'optionalAccess', _287 => _287.records]) || [],
5598
+ _optionalChain([config, 'access', _299 => _299.models, 'access', _300 => _300[modelId], 'optionalAccess', _301 => _301.records]) || [],
5717
5599
  project
5718
5600
  );
5719
5601
  const selectedRecords = await promptRecordSelection(
@@ -5732,14 +5614,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
5732
5614
  },
5733
5615
  async pull(locale, input2, initCtx) {
5734
5616
  const result = {};
5735
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _288 => _288.models]) || {})) {
5736
- let records = _optionalChain([initCtx, 'optionalAccess', _289 => _289.models, 'access', _290 => _290[modelId], 'access', _291 => _291.records]) || [];
5617
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _302 => _302.models]) || {})) {
5618
+ let records = _optionalChain([initCtx, 'optionalAccess', _303 => _303.models, 'access', _304 => _304[modelId], 'access', _305 => _305.records]) || [];
5737
5619
  const recordIds = records.map((record) => record.id);
5738
5620
  records = await dato.findRecords(recordIds);
5739
5621
  console.log(`Fetched ${records.length} records for model ${modelId}`);
5740
5622
  if (records.length > 0) {
5741
5623
  result[modelId] = {
5742
- fields: _optionalChain([initCtx, 'optionalAccess', _292 => _292.models, 'optionalAccess', _293 => _293[modelId], 'optionalAccess', _294 => _294.fields]) || [],
5624
+ fields: _optionalChain([initCtx, 'optionalAccess', _306 => _306.models, 'optionalAccess', _307 => _307[modelId], 'optionalAccess', _308 => _308.fields]) || [],
5743
5625
  records
5744
5626
  };
5745
5627
  }
@@ -5802,7 +5684,7 @@ function createRecordChoices(records, selectedIds = [], project) {
5802
5684
  return records.map((record) => ({
5803
5685
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
5804
5686
  value: record.id,
5805
- checked: _optionalChain([selectedIds, 'optionalAccess', _295 => _295.includes, 'call', _296 => _296(record.id)])
5687
+ checked: _optionalChain([selectedIds, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(record.id)])
5806
5688
  }));
5807
5689
  }
5808
5690
  async function promptRecordSelection(modelName, choices) {
@@ -6121,7 +6003,7 @@ function createVttLoader() {
6121
6003
  if (!input2) {
6122
6004
  return "";
6123
6005
  }
6124
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _297 => _297.parse, 'call', _298 => _298(input2), 'optionalAccess', _299 => _299.cues]);
6006
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _311 => _311.parse, 'call', _312 => _312(input2), 'optionalAccess', _313 => _313.cues]);
6125
6007
  if (Object.keys(vtt).length === 0) {
6126
6008
  return {};
6127
6009
  } else {
@@ -6167,15 +6049,6 @@ function variableExtractLoader(params) {
6167
6049
  const inputValues = _lodash2.default.omitBy(input2, _lodash2.default.isEmpty);
6168
6050
  for (const [key, value] of Object.entries(inputValues)) {
6169
6051
  const originalValue = originalInput[key];
6170
- if (isICUPluralObject(originalValue)) {
6171
- const icuValue = isICUPluralObject(value) ? { icu: value.icu } : value;
6172
- result[key] = {
6173
- value: icuValue,
6174
- variables: []
6175
- // Metadata stored separately, not in variables
6176
- };
6177
- continue;
6178
- }
6179
6052
  const matches = originalValue.match(specifierPattern) || [];
6180
6053
  result[key] = result[key] || {
6181
6054
  value,
@@ -6184,7 +6057,7 @@ function variableExtractLoader(params) {
6184
6057
  for (let i = 0; i < matches.length; i++) {
6185
6058
  const match2 = matches[i];
6186
6059
  const currentValue = result[key].value;
6187
- const newValue = _optionalChain([currentValue, 'optionalAccess', _300 => _300.replace, 'call', _301 => _301(match2, `{variable:${i}}`)]);
6060
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _314 => _314.replace, 'call', _315 => _315(match2, `{variable:${i}}`)]);
6188
6061
  result[key].value = newValue;
6189
6062
  result[key].variables[i] = match2;
6190
6063
  }
@@ -6195,19 +6068,14 @@ function variableExtractLoader(params) {
6195
6068
  const result = {};
6196
6069
  for (const [key, valueObj] of Object.entries(data)) {
6197
6070
  result[key] = valueObj.value;
6198
- const resultValue = result[key];
6199
- if (isICUPluralObject(resultValue)) {
6200
- const originalValue = _optionalChain([originalInput, 'optionalAccess', _302 => _302[key]]);
6201
- if (isICUPluralObject(originalValue) && originalValue._meta) {
6202
- resultValue._meta = originalValue._meta;
6203
- resultValue[Symbol.for("@lingo.dev/icu-plural-object")] = true;
6204
- }
6205
- }
6206
6071
  for (let i = 0; i < valueObj.variables.length; i++) {
6207
6072
  const variable = valueObj.variables[i];
6208
6073
  const currentValue = result[key];
6209
6074
  if (typeof currentValue === "string") {
6210
- const newValue = _optionalChain([currentValue, 'optionalAccess', _303 => _303.replace, 'call', _304 => _304(`{variable:${i}}`, variable)]);
6075
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _316 => _316.replaceAll, 'call', _317 => _317(
6076
+ `{variable:${i}}`,
6077
+ variable
6078
+ )]);
6211
6079
  result[key] = newValue;
6212
6080
  }
6213
6081
  }
@@ -6408,7 +6276,7 @@ function createVueJsonLoader() {
6408
6276
  return createLoader({
6409
6277
  pull: async (locale, input2, ctx) => {
6410
6278
  const parsed = parseVueFile(input2);
6411
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _305 => _305.i18n, 'optionalAccess', _306 => _306[locale]]), () => ( {}));
6279
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _318 => _318.i18n, 'optionalAccess', _319 => _319[locale]]), () => ( {}));
6412
6280
  },
6413
6281
  push: async (locale, data, originalInput) => {
6414
6282
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -6593,7 +6461,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
6593
6461
  objectExpression.properties.forEach((prop) => {
6594
6462
  if (!t.isObjectProperty(prop)) return;
6595
6463
  const key = getPropertyKey(prop);
6596
- const incomingVal = _optionalChain([data, 'optionalAccess', _307 => _307[key]]);
6464
+ const incomingVal = _optionalChain([data, 'optionalAccess', _320 => _320[key]]);
6597
6465
  if (incomingVal === void 0) {
6598
6466
  return;
6599
6467
  }
@@ -6629,7 +6497,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
6629
6497
  let modified = false;
6630
6498
  arrayExpression.elements.forEach((element, index) => {
6631
6499
  if (!element) return;
6632
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _308 => _308[index]]);
6500
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _321 => _321[index]]);
6633
6501
  if (incomingVal === void 0) return;
6634
6502
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
6635
6503
  if (element.value !== incomingVal) {
@@ -7120,7 +6988,7 @@ var AST = class _AST {
7120
6988
  const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
7121
6989
  if (this.isStart() && !this.type)
7122
6990
  ret.unshift([]);
7123
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.type]) === "!")) {
6991
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!")) {
7124
6992
  ret.push({});
7125
6993
  }
7126
6994
  return ret;
@@ -7128,7 +6996,7 @@ var AST = class _AST {
7128
6996
  isStart() {
7129
6997
  if (this.#root === this)
7130
6998
  return true;
7131
- if (!_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.isStart, 'call', _313 => _313()]))
6999
+ if (!_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.isStart, 'call', _326 => _326()]))
7132
7000
  return false;
7133
7001
  if (this.#parentIndex === 0)
7134
7002
  return true;
@@ -7144,12 +7012,12 @@ var AST = class _AST {
7144
7012
  isEnd() {
7145
7013
  if (this.#root === this)
7146
7014
  return true;
7147
- if (_optionalChain([this, 'access', _314 => _314.#parent, 'optionalAccess', _315 => _315.type]) === "!")
7015
+ if (_optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")
7148
7016
  return true;
7149
- if (!_optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]))
7017
+ if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]))
7150
7018
  return false;
7151
7019
  if (!this.type)
7152
- return _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.isEnd, 'call', _321 => _321()]);
7020
+ return _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.isEnd, 'call', _334 => _334()]);
7153
7021
  const pl = this.#parent ? this.#parent.#parts.length : 0;
7154
7022
  return this.#parentIndex === pl - 1;
7155
7023
  }
@@ -7371,7 +7239,7 @@ var AST = class _AST {
7371
7239
  if (!this.type) {
7372
7240
  const noEmpty = this.isStart() && this.isEnd();
7373
7241
  const src = this.#parts.map((p) => {
7374
- const [re, _36, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
7242
+ const [re, _37, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
7375
7243
  this.#hasMagic = this.#hasMagic || hasMagic;
7376
7244
  this.#uflag = this.#uflag || uflag;
7377
7245
  return re;
@@ -7394,7 +7262,7 @@ var AST = class _AST {
7394
7262
  }
7395
7263
  }
7396
7264
  let end = "";
7397
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!") {
7265
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _335 => _335.#parent, 'optionalAccess', _336 => _336.type]) === "!") {
7398
7266
  end = "(?:$|\\/)";
7399
7267
  }
7400
7268
  const final2 = start2 + src + end;
@@ -7444,7 +7312,7 @@ var AST = class _AST {
7444
7312
  if (typeof p === "string") {
7445
7313
  throw new Error("string type in extglob ast??");
7446
7314
  }
7447
- const [re, _36, _hasMagic, uflag] = p.toRegExpSource(dot);
7315
+ const [re, _37, _hasMagic, uflag] = p.toRegExpSource(dot);
7448
7316
  this.#uflag = this.#uflag || uflag;
7449
7317
  return re;
7450
7318
  }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
@@ -7689,7 +7557,7 @@ var Minimatch = class {
7689
7557
  }
7690
7558
  return false;
7691
7559
  }
7692
- debug(..._36) {
7560
+ debug(..._37) {
7693
7561
  }
7694
7562
  make() {
7695
7563
  const pattern = this.pattern;
@@ -7711,7 +7579,7 @@ var Minimatch = class {
7711
7579
  const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
7712
7580
  this.globParts = this.preprocess(rawGlobParts);
7713
7581
  this.debug(this.pattern, this.globParts);
7714
- let set = this.globParts.map((s, _36, __) => {
7582
+ let set = this.globParts.map((s, _37, __) => {
7715
7583
  if (this.isWindows && this.windowsNoMagicRoot) {
7716
7584
  const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
7717
7585
  const isDrive = /^[a-z]:/i.test(s[0]);
@@ -8484,7 +8352,7 @@ function createMdxSectionsSplit2Loader() {
8484
8352
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
8485
8353
  const result = {
8486
8354
  frontmatter: data.frontmatter,
8487
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _324 => _324.codePlaceholders]) || {},
8355
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _337 => _337.codePlaceholders]) || {},
8488
8356
  content
8489
8357
  };
8490
8358
  return result;
@@ -8749,7 +8617,7 @@ function createTxtLoader() {
8749
8617
  const sortedEntries = Object.entries(payload).sort(
8750
8618
  ([a], [b]) => parseInt(a) - parseInt(b)
8751
8619
  );
8752
- return sortedEntries.map(([_36, value]) => value).join("\n");
8620
+ return sortedEntries.map(([_37, value]) => value).join("\n");
8753
8621
  }
8754
8622
  });
8755
8623
  }
@@ -9040,9 +8908,8 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
9040
8908
  createPlutilJsonTextLoader(),
9041
8909
  createLockedPatternsLoader(lockedPatterns),
9042
8910
  createJsonLoader(),
9043
- createXcodeXcstringsLoader(options.defaultLocale),
9044
8911
  createXcodeXcstringsV2Loader(options.defaultLocale),
9045
- createFlatLoader({ shouldPreserveObject: isICUPluralObject }),
8912
+ createFlatLoader(),
9046
8913
  createEnsureKeyOrderLoader(),
9047
8914
  createLockedKeysLoader(lockedKeys || []),
9048
8915
  createIgnoredKeysLoader(ignoredKeys || []),
@@ -9585,7 +9452,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9585
9452
  ]
9586
9453
  });
9587
9454
  const result = JSON.parse(response.text);
9588
- return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
9455
+ return _optionalChain([result, 'optionalAccess', _338 => _338.data]) || {};
9589
9456
  }
9590
9457
  }
9591
9458
  function extractPayloadChunks(payload) {
@@ -9668,7 +9535,7 @@ function getPureModelProvider(provider) {
9668
9535
 
9669
9536
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9670
9537
  `;
9671
- switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
9538
+ switch (_optionalChain([provider, 'optionalAccess', _339 => _339.id])) {
9672
9539
  case "openai": {
9673
9540
  if (!process.env.OPENAI_API_KEY) {
9674
9541
  throw new Error(
@@ -9726,7 +9593,7 @@ function getPureModelProvider(provider) {
9726
9593
  })(provider.model);
9727
9594
  }
9728
9595
  default: {
9729
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
9596
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _340 => _340.id])));
9730
9597
  }
9731
9598
  }
9732
9599
  }
@@ -9934,6 +9801,35 @@ function createDeltaProcessor(fileKey) {
9934
9801
  };
9935
9802
  }
9936
9803
 
9804
+ // src/cli/loaders/xcode-xcstrings-icu.ts
9805
+ var ICU_TYPE_MARKER = Symbol.for("@lingo.dev/icu-plural-object");
9806
+ function isICUPluralObject(value) {
9807
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
9808
+ return false;
9809
+ }
9810
+ if (ICU_TYPE_MARKER in value) {
9811
+ return true;
9812
+ }
9813
+ if (!("icu" in value) || typeof value.icu !== "string") {
9814
+ return false;
9815
+ }
9816
+ const icuPluralPattern = /^\{[\w]+,\s*plural,\s*.+\}$/;
9817
+ if (!icuPluralPattern.test(value.icu)) {
9818
+ return false;
9819
+ }
9820
+ if (value._meta !== void 0) {
9821
+ if (typeof value._meta !== "object" || !value._meta.variables || typeof value._meta.variables !== "object") {
9822
+ return false;
9823
+ }
9824
+ for (const [varName, varMeta] of Object.entries(value._meta.variables)) {
9825
+ if (!varMeta || typeof varMeta !== "object" || typeof varMeta.format !== "string" || varMeta.role !== "plural" && varMeta.role !== "other") {
9826
+ return false;
9827
+ }
9828
+ }
9829
+ }
9830
+ return true;
9831
+ }
9832
+
9937
9833
  // src/cli/cmd/i18n.ts
9938
9834
  var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description(
9939
9835
  "DEPRECATED: Run localization pipeline (prefer `run` command instead)"
@@ -10012,7 +9908,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10012
9908
  validateParams(i18nConfig, flags);
10013
9909
  ora.succeed("Localization configuration is valid");
10014
9910
  ora.start("Connecting to Lingo.dev Localization Engine...");
10015
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
9911
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _341 => _341.provider]);
10016
9912
  if (isByokMode) {
10017
9913
  authId = null;
10018
9914
  ora.succeed("Using external provider (BYOK mode)");
@@ -10026,16 +9922,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10026
9922
  flags
10027
9923
  });
10028
9924
  let buckets = getBuckets(i18nConfig);
10029
- if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
9925
+ if (_optionalChain([flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.length])) {
10030
9926
  buckets = buckets.filter(
10031
9927
  (bucket) => flags.bucket.includes(bucket.type)
10032
9928
  );
10033
9929
  }
10034
9930
  ora.succeed("Buckets retrieved");
10035
- if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
9931
+ if (_optionalChain([flags, 'access', _344 => _344.file, 'optionalAccess', _345 => _345.length])) {
10036
9932
  buckets = buckets.map((bucket) => {
10037
9933
  const paths = bucket.paths.filter(
10038
- (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
9934
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _346 => _346.pathPattern, 'optionalAccess', _347 => _347.includes, 'call', _348 => _348(file)]))
10039
9935
  );
10040
9936
  return { ...bucket, paths };
10041
9937
  }).filter((bucket) => bucket.paths.length > 0);
@@ -10056,7 +9952,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10056
9952
  });
10057
9953
  }
10058
9954
  }
10059
- const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
9955
+ const targetLocales = _optionalChain([flags, 'access', _349 => _349.locale, 'optionalAccess', _350 => _350.length]) ? flags.locale : i18nConfig.locale.targets;
10060
9956
  ora.start("Setting up localization cache...");
10061
9957
  const checkLockfileProcessor = createDeltaProcessor("");
10062
9958
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -10233,7 +10129,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10233
10129
  if (flags.key) {
10234
10130
  processableData = _lodash2.default.pickBy(
10235
10131
  processableData,
10236
- (_36, key) => key === flags.key
10132
+ (_37, key) => key === flags.key
10237
10133
  );
10238
10134
  }
10239
10135
  if (flags.verbose) {
@@ -10344,7 +10240,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10344
10240
  }
10345
10241
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
10346
10242
  const checksums = await deltaProcessor.createChecksums(sourceData);
10347
- if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
10243
+ if (!_optionalChain([flags, 'access', _351 => _351.locale, 'optionalAccess', _352 => _352.length])) {
10348
10244
  await deltaProcessor.saveChecksums(checksums);
10349
10245
  }
10350
10246
  }
@@ -10468,12 +10364,12 @@ function validateParams(i18nConfig, flags) {
10468
10364
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10469
10365
  docUrl: "bucketNotFound"
10470
10366
  });
10471
- } else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10367
+ } else if (_optionalChain([flags, 'access', _353 => _353.locale, 'optionalAccess', _354 => _354.some, 'call', _355 => _355((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10472
10368
  throw new ValidationError({
10473
10369
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10474
10370
  docUrl: "localeTargetNotFound"
10475
10371
  });
10476
- } else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
10372
+ } else if (_optionalChain([flags, 'access', _356 => _356.bucket, 'optionalAccess', _357 => _357.some, 'call', _358 => _358(
10477
10373
  (bucket) => !i18nConfig.buckets[bucket]
10478
10374
  )])) {
10479
10375
  throw new ValidationError({
@@ -10877,7 +10773,7 @@ var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
10877
10773
 
10878
10774
  var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description(
10879
10775
  "Start a Model Context Protocol (MCP) server for AI assistant integration"
10880
- ).helpOption("-h, --help", "Show help").action(async (_36, program) => {
10776
+ ).helpOption("-h, --help", "Show help").action(async (_37, program) => {
10881
10777
  const apiKey = program.args[0];
10882
10778
  const settings = getSettings(apiKey);
10883
10779
  if (!settings.auth.apiKey) {
@@ -11007,7 +10903,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
11007
10903
  const response = await engine.whoami();
11008
10904
  return {
11009
10905
  authenticated: !!response,
11010
- username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
10906
+ username: _optionalChain([response, 'optionalAccess', _359 => _359.email])
11011
10907
  };
11012
10908
  } catch (error) {
11013
10909
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -11123,7 +11019,7 @@ function createExplicitLocalizer(provider) {
11123
11019
  }
11124
11020
  function createAiSdkLocalizer(params) {
11125
11021
  const skipAuth = params.skipAuth === true;
11126
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
11022
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _360 => _360.apiKeyName]), () => ( ""))];
11127
11023
  if (!skipAuth && !apiKey || !params.apiKeyName) {
11128
11024
  throw new Error(
11129
11025
  _dedent2.default`
@@ -11257,8 +11153,8 @@ async function setup(input2) {
11257
11153
  throw new Error(
11258
11154
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
11259
11155
  );
11260
- } else if (_optionalChain([ctx, 'access', _348 => _348.flags, 'access', _349 => _349.bucket, 'optionalAccess', _350 => _350.some, 'call', _351 => _351(
11261
- (bucket) => !_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.buckets, 'access', _354 => _354[bucket]])
11156
+ } else if (_optionalChain([ctx, 'access', _361 => _361.flags, 'access', _362 => _362.bucket, 'optionalAccess', _363 => _363.some, 'call', _364 => _364(
11157
+ (bucket) => !_optionalChain([ctx, 'access', _365 => _365.config, 'optionalAccess', _366 => _366.buckets, 'access', _367 => _367[bucket]])
11262
11158
  )])) {
11263
11159
  throw new Error(
11264
11160
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -11271,7 +11167,7 @@ async function setup(input2) {
11271
11167
  title: "Selecting localization provider",
11272
11168
  task: async (ctx, task) => {
11273
11169
  ctx.localizer = createLocalizer(
11274
- _optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
11170
+ _optionalChain([ctx, 'access', _368 => _368.config, 'optionalAccess', _369 => _369.provider]),
11275
11171
  ctx.flags.apiKey
11276
11172
  );
11277
11173
  if (!ctx.localizer) {
@@ -11284,7 +11180,7 @@ async function setup(input2) {
11284
11180
  },
11285
11181
  {
11286
11182
  title: "Checking authentication",
11287
- enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
11183
+ enabled: (ctx) => _optionalChain([ctx, 'access', _370 => _370.localizer, 'optionalAccess', _371 => _371.id]) === "Lingo.dev",
11288
11184
  task: async (ctx, task) => {
11289
11185
  const authStatus = await ctx.localizer.checkAuth();
11290
11186
  if (!authStatus.authenticated) {
@@ -11297,7 +11193,7 @@ async function setup(input2) {
11297
11193
  },
11298
11194
  {
11299
11195
  title: "Validating configuration",
11300
- enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
11196
+ enabled: (ctx) => _optionalChain([ctx, 'access', _372 => _372.localizer, 'optionalAccess', _373 => _373.id]) !== "Lingo.dev",
11301
11197
  task: async (ctx, task) => {
11302
11198
  const validationStatus = await ctx.localizer.validateSettings();
11303
11199
  if (!validationStatus.valid) {
@@ -11515,7 +11411,7 @@ async function execute(input2) {
11515
11411
  const workerTasks = [];
11516
11412
  for (let i = 0; i < workersCount; i++) {
11517
11413
  const assignedTasks = ctx.tasks.filter(
11518
- (_36, idx) => idx % workersCount === i
11414
+ (_37, idx) => idx % workersCount === i
11519
11415
  );
11520
11416
  workerTasks.push(
11521
11417
  createWorkerTask({
@@ -11628,7 +11524,7 @@ function createWorkerTask(args) {
11628
11524
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11629
11525
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11630
11526
  ).filter(
11631
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
11527
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _374 => _374.onlyKeys, 'optionalAccess', _375 => _375.some, 'call', _376 => _376(
11632
11528
  (pattern) => minimatch(key, pattern)
11633
11529
  )])
11634
11530
  ).fromPairs().value();
@@ -11696,7 +11592,7 @@ function createWorkerTask(args) {
11696
11592
  finalRenamedTargetData
11697
11593
  );
11698
11594
  const checksums = await deltaProcessor.createChecksums(sourceData);
11699
- if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
11595
+ if (!_optionalChain([args, 'access', _377 => _377.ctx, 'access', _378 => _378.flags, 'access', _379 => _379.targetLocale, 'optionalAccess', _380 => _380.length])) {
11700
11596
  await deltaProcessor.saveChecksums(checksums);
11701
11597
  }
11702
11598
  });
@@ -11901,10 +11797,10 @@ var flagsSchema2 = _zod.z.object({
11901
11797
  async function frozen(input2) {
11902
11798
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
11903
11799
  let buckets = getBuckets(input2.config);
11904
- if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
11800
+ if (_optionalChain([input2, 'access', _381 => _381.flags, 'access', _382 => _382.bucket, 'optionalAccess', _383 => _383.length])) {
11905
11801
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
11906
11802
  }
11907
- if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
11803
+ if (_optionalChain([input2, 'access', _384 => _384.flags, 'access', _385 => _385.file, 'optionalAccess', _386 => _386.length])) {
11908
11804
  buckets = buckets.map((bucket) => {
11909
11805
  const paths = bucket.paths.filter(
11910
11806
  (p) => input2.flags.file.some(
@@ -12041,13 +11937,13 @@ async function frozen(input2) {
12041
11937
 
12042
11938
  // src/cli/cmd/run/_utils.ts
12043
11939
  async function determineAuthId(ctx) {
12044
- const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
11940
+ const isByokMode = !!_optionalChain([ctx, 'access', _387 => _387.config, 'optionalAccess', _388 => _388.provider]);
12045
11941
  if (isByokMode) {
12046
11942
  return null;
12047
11943
  } else {
12048
11944
  try {
12049
- const authStatus = await _optionalChain([ctx, 'access', _376 => _376.localizer, 'optionalAccess', _377 => _377.checkAuth, 'call', _378 => _378()]);
12050
- return _optionalChain([authStatus, 'optionalAccess', _379 => _379.username]) || null;
11945
+ const authStatus = await _optionalChain([ctx, 'access', _389 => _389.localizer, 'optionalAccess', _390 => _390.checkAuth, 'call', _391 => _391()]);
11946
+ return _optionalChain([authStatus, 'optionalAccess', _392 => _392.username]) || null;
12051
11947
  } catch (e3) {
12052
11948
  return null;
12053
11949
  }
@@ -12245,7 +12141,7 @@ var InBranchFlow = class extends IntegrationFlow {
12245
12141
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
12246
12142
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
12247
12143
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
12248
- _optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
12144
+ _optionalChain([this, 'access', _393 => _393.platformKit, 'optionalAccess', _394 => _394.gitConfig, 'call', _395 => _395()]);
12249
12145
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
12250
12146
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
12251
12147
  if (!processOwnCommits) {
@@ -12277,7 +12173,7 @@ var InBranchFlow = class extends IntegrationFlow {
12277
12173
  // src/cli/cmd/ci/flows/pull-request.ts
12278
12174
  var PullRequestFlow = class extends InBranchFlow {
12279
12175
  async preRun() {
12280
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
12176
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _396 => _396()]);
12281
12177
  if (!canContinue) {
12282
12178
  return false;
12283
12179
  }
@@ -12544,10 +12440,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12544
12440
  repo_slug: this.platformConfig.repositoryName,
12545
12441
  state: "OPEN"
12546
12442
  }).then(({ data: { values } }) => {
12547
- return _optionalChain([values, 'optionalAccess', _384 => _384.find, 'call', _385 => _385(
12548
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _386 => _386.branch, 'optionalAccess', _387 => _387.name]) === branch && _optionalChain([destination, 'optionalAccess', _388 => _388.branch, 'optionalAccess', _389 => _389.name]) === this.platformConfig.baseBranchName
12443
+ return _optionalChain([values, 'optionalAccess', _397 => _397.find, 'call', _398 => _398(
12444
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _399 => _399.branch, 'optionalAccess', _400 => _400.name]) === branch && _optionalChain([destination, 'optionalAccess', _401 => _401.branch, 'optionalAccess', _402 => _402.name]) === this.platformConfig.baseBranchName
12549
12445
  )]);
12550
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
12446
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.id]));
12551
12447
  }
12552
12448
  async closePullRequest({ pullRequestNumber }) {
12553
12449
  await this.bb.repositories.declinePullRequest({
@@ -12643,7 +12539,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12643
12539
  repo: this.platformConfig.repositoryName,
12644
12540
  base: this.platformConfig.baseBranchName,
12645
12541
  state: "open"
12646
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
12542
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.number]));
12647
12543
  }
12648
12544
  async closePullRequest({ pullRequestNumber }) {
12649
12545
  await this.octokit.rest.pulls.update({
@@ -12770,7 +12666,7 @@ var GitlabPlatformKit = class extends PlatformKit {
12770
12666
  sourceBranch: branch,
12771
12667
  state: "opened"
12772
12668
  });
12773
- return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
12669
+ return _optionalChain([mergeRequests, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.iid]);
12774
12670
  }
12775
12671
  async closePullRequest({
12776
12672
  pullRequestNumber
@@ -12882,7 +12778,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12882
12778
  }
12883
12779
  const env = {
12884
12780
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
12885
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
12781
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _407 => _407.pullRequest, 'optionalAccess', _408 => _408.toString, 'call', _409 => _409()]) || "false",
12886
12782
  ...options.commitMessage && {
12887
12783
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
12888
12784
  },
@@ -12908,7 +12804,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12908
12804
  const { isPullRequestMode } = platformKit.config;
12909
12805
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
12910
12806
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
12911
- const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
12807
+ const canRun = await _optionalChain([flow, 'access', _410 => _410.preRun, 'optionalCall', _411 => _411()]);
12912
12808
  if (canRun === false) {
12913
12809
  return;
12914
12810
  }
@@ -12918,7 +12814,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12918
12814
  if (!hasChanges) {
12919
12815
  return;
12920
12816
  }
12921
- await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
12817
+ await _optionalChain([flow, 'access', _412 => _412.postRun, 'optionalCall', _413 => _413()]);
12922
12818
  });
12923
12819
  function parseBooleanArg(val) {
12924
12820
  if (val === true) return true;
@@ -12955,8 +12851,8 @@ function exitGracefully(elapsedMs = 0) {
12955
12851
  }
12956
12852
  }
12957
12853
  function checkForPendingOperations() {
12958
- const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
12959
- const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
12854
+ const activeHandles = _optionalChain([process, 'access', _414 => _414._getActiveHandles, 'optionalCall', _415 => _415()]) || [];
12855
+ const activeRequests = _optionalChain([process, 'access', _416 => _416._getActiveRequests, 'optionalCall', _417 => _417()]) || [];
12960
12856
  const nonStandardHandles = activeHandles.filter((handle) => {
12961
12857
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
12962
12858
  return false;
@@ -13025,17 +12921,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13025
12921
  flags
13026
12922
  });
13027
12923
  let buckets = getBuckets(i18nConfig);
13028
- if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
12924
+ if (_optionalChain([flags, 'access', _418 => _418.bucket, 'optionalAccess', _419 => _419.length])) {
13029
12925
  buckets = buckets.filter(
13030
12926
  (bucket) => flags.bucket.includes(bucket.type)
13031
12927
  );
13032
12928
  }
13033
12929
  ora.succeed("Buckets retrieved");
13034
- if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
12930
+ if (_optionalChain([flags, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.length])) {
13035
12931
  buckets = buckets.map((bucket) => {
13036
12932
  const paths = bucket.paths.filter(
13037
12933
  (path19) => flags.file.find(
13038
- (file) => _optionalChain([path19, 'access', _409 => _409.pathPattern, 'optionalAccess', _410 => _410.includes, 'call', _411 => _411(file)]) || _optionalChain([path19, 'access', _412 => _412.pathPattern, 'optionalAccess', _413 => _413.match, 'call', _414 => _414(file)]) || minimatch(path19.pathPattern, file)
12934
+ (file) => _optionalChain([path19, 'access', _422 => _422.pathPattern, 'optionalAccess', _423 => _423.includes, 'call', _424 => _424(file)]) || _optionalChain([path19, 'access', _425 => _425.pathPattern, 'optionalAccess', _426 => _426.match, 'call', _427 => _427(file)]) || minimatch(path19.pathPattern, file)
13039
12935
  )
13040
12936
  );
13041
12937
  return { ...bucket, paths };
@@ -13055,7 +12951,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13055
12951
  });
13056
12952
  }
13057
12953
  }
13058
- const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
12954
+ const targetLocales = _optionalChain([flags, 'access', _428 => _428.locale, 'optionalAccess', _429 => _429.length]) ? flags.locale : i18nConfig.locale.targets;
13059
12955
  let totalSourceKeyCount = 0;
13060
12956
  let uniqueKeysToTranslate = 0;
13061
12957
  let totalExistingTranslations = 0;
@@ -13463,12 +13359,12 @@ function validateParams2(i18nConfig, flags) {
13463
13359
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13464
13360
  docUrl: "bucketNotFound"
13465
13361
  });
13466
- } else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13362
+ } else if (_optionalChain([flags, 'access', _430 => _430.locale, 'optionalAccess', _431 => _431.some, 'call', _432 => _432((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13467
13363
  throw new CLIError({
13468
13364
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13469
13365
  docUrl: "localeTargetNotFound"
13470
13366
  });
13471
- } else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
13367
+ } else if (_optionalChain([flags, 'access', _433 => _433.bucket, 'optionalAccess', _434 => _434.some, 'call', _435 => _435(
13472
13368
  (bucket) => !i18nConfig.buckets[bucket]
13473
13369
  )])) {
13474
13370
  throw new CLIError({
@@ -13560,7 +13456,7 @@ async function renderHero2() {
13560
13456
  // package.json
13561
13457
  var package_default = {
13562
13458
  name: "lingo.dev",
13563
- version: "0.116.2",
13459
+ version: "0.116.3",
13564
13460
  description: "Lingo.dev CLI",
13565
13461
  private: false,
13566
13462
  publishConfig: {
@@ -13852,7 +13748,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
13852
13748
  if (options.file && options.file.length) {
13853
13749
  buckets = buckets.map((bucket) => {
13854
13750
  const paths = bucket.paths.filter(
13855
- (bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
13751
+ (bucketPath) => _optionalChain([options, 'access', _436 => _436.file, 'optionalAccess', _437 => _437.some, 'call', _438 => _438((f) => bucketPath.pathPattern.includes(f))])
13856
13752
  );
13857
13753
  return { ...bucket, paths };
13858
13754
  }).filter((bucket) => bucket.paths.length > 0);