lingo.dev 0.117.4 → 0.117.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.cjs CHANGED
@@ -3414,8 +3414,8 @@ function serializeElement(node) {
3414
3414
  const attrString = Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttributeValue(String(value))}"`).join("");
3415
3415
  const children = Array.isArray(node.$$) ? node.$$ : [];
3416
3416
  if (children.length === 0) {
3417
- const textContent = _nullishCoalesce(node._, () => ( ""));
3418
- return `<${name}${attrString}>${textContent}</${name}>`;
3417
+ const textContent2 = _nullishCoalesce(node._, () => ( ""));
3418
+ return `<${name}${attrString}>${textContent2}</${name}>`;
3419
3419
  }
3420
3420
  const childContent = children.map(serializeElement).join("");
3421
3421
  return `<${name}${attrString}>${childContent}</${name}>`;
@@ -3504,135 +3504,335 @@ function createPullOutputCleaner() {
3504
3504
  }
3505
3505
 
3506
3506
  // src/cli/loaders/html.ts
3507
- var _jsdom = require('jsdom');
3508
- function normalizeTextContent(text, isStandalone) {
3509
- const trimmed = text.trim();
3510
- if (!trimmed) return "";
3511
- return trimmed;
3512
- }
3507
+ var _htmlparser2 = require('htmlparser2'); var htmlparser2 = _interopRequireWildcard(_htmlparser2);
3508
+ var _domhandler = require('domhandler');
3509
+ var _domutils = require('domutils'); var domutils = _interopRequireWildcard(_domutils);
3510
+ var _domserializer = require('dom-serializer'); var DomSerializer = _interopRequireWildcard(_domserializer);
3513
3511
  function createHtmlLoader() {
3512
+ const PHRASING_ELEMENTS = /* @__PURE__ */ new Set([
3513
+ // Text-level semantics
3514
+ "a",
3515
+ "abbr",
3516
+ "b",
3517
+ "bdi",
3518
+ "bdo",
3519
+ "br",
3520
+ "cite",
3521
+ "code",
3522
+ "data",
3523
+ "dfn",
3524
+ "em",
3525
+ "i",
3526
+ "kbd",
3527
+ "mark",
3528
+ "q",
3529
+ "ruby",
3530
+ "s",
3531
+ "samp",
3532
+ "small",
3533
+ "span",
3534
+ "strong",
3535
+ "sub",
3536
+ "sup",
3537
+ "time",
3538
+ "u",
3539
+ "var",
3540
+ "wbr",
3541
+ // Media
3542
+ "audio",
3543
+ "img",
3544
+ "video",
3545
+ "picture",
3546
+ // Interactive
3547
+ "button",
3548
+ "input",
3549
+ "label",
3550
+ "select",
3551
+ "textarea",
3552
+ // Embedded
3553
+ "canvas",
3554
+ "iframe",
3555
+ "object",
3556
+ "svg",
3557
+ "math",
3558
+ // Other
3559
+ "del",
3560
+ "ins",
3561
+ "map",
3562
+ "area"
3563
+ ]);
3564
+ const BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
3565
+ "div",
3566
+ "p",
3567
+ "h1",
3568
+ "h2",
3569
+ "h3",
3570
+ "h4",
3571
+ "h5",
3572
+ "h6",
3573
+ "ul",
3574
+ "ol",
3575
+ "li",
3576
+ "dl",
3577
+ "dt",
3578
+ "dd",
3579
+ "blockquote",
3580
+ "pre",
3581
+ "article",
3582
+ "aside",
3583
+ "nav",
3584
+ "section",
3585
+ "header",
3586
+ "footer",
3587
+ "main",
3588
+ "figure",
3589
+ "figcaption",
3590
+ "table",
3591
+ "thead",
3592
+ "tbody",
3593
+ "tfoot",
3594
+ "tr",
3595
+ "td",
3596
+ "th",
3597
+ "caption",
3598
+ "form",
3599
+ "fieldset",
3600
+ "legend",
3601
+ "details",
3602
+ "summary",
3603
+ "address",
3604
+ "hr",
3605
+ "search",
3606
+ "dialog",
3607
+ "noscript",
3608
+ "title"
3609
+ // <title> should be treated as a block element for translation
3610
+ ]);
3611
+ const UNLOCALIZABLE_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
3514
3612
  const LOCALIZABLE_ATTRIBUTES = {
3515
3613
  meta: ["content"],
3516
- img: ["alt"],
3517
- input: ["placeholder"],
3518
- a: ["title"]
3614
+ img: ["alt", "title"],
3615
+ input: ["placeholder", "title"],
3616
+ textarea: ["placeholder", "title"],
3617
+ a: ["title"],
3618
+ abbr: ["title"],
3619
+ button: ["title"],
3620
+ link: ["title"]
3519
3621
  };
3520
- const UNLOCALIZABLE_TAGS = ["script", "style"];
3521
3622
  return createLoader({
3522
3623
  async pull(locale, input2) {
3523
3624
  const result = {};
3524
- const dom = new (0, _jsdom.JSDOM)(input2);
3525
- const document = dom.window.document;
3526
- const getPath = (node, attribute) => {
3527
- const indices = [];
3528
- let current = node;
3529
- let rootParent = "";
3530
- while (current) {
3531
- const parent = current.parentElement;
3532
- if (!parent) break;
3533
- if (parent === document.documentElement) {
3534
- rootParent = current.nodeName.toLowerCase();
3535
- break;
3625
+ const handler = new (0, _domhandler.DomHandler)();
3626
+ const parser = new htmlparser2.Parser(handler, {
3627
+ lowerCaseTags: false,
3628
+ lowerCaseAttributeNames: false
3629
+ });
3630
+ parser.write(input2);
3631
+ parser.end();
3632
+ const dom = handler.dom;
3633
+ function isInsideUnlocalizableTag(element) {
3634
+ let current = element.parent;
3635
+ while (current && current.type === "tag") {
3636
+ if (UNLOCALIZABLE_TAGS.has(current.name.toLowerCase())) {
3637
+ return true;
3536
3638
  }
3537
- const siblings = Array.from(parent.childNodes).filter(
3538
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _143 => _143.textContent, 'optionalAccess', _144 => _144.trim, 'call', _145 => _145()])
3539
- );
3540
- const index = siblings.indexOf(current);
3541
- if (index !== -1) {
3542
- indices.unshift(index);
3639
+ current = current.parent;
3640
+ }
3641
+ return false;
3642
+ }
3643
+ function hasTranslatableContent(element) {
3644
+ const text = domutils.textContent(element);
3645
+ return text.trim().length > 0;
3646
+ }
3647
+ function isLeafBlock(element) {
3648
+ const childElements = element.children.filter(
3649
+ (child) => child.type === "tag"
3650
+ );
3651
+ for (const child of childElements) {
3652
+ if (BLOCK_ELEMENTS.has(child.name.toLowerCase())) {
3653
+ return false;
3543
3654
  }
3544
- current = parent;
3545
3655
  }
3546
- const basePath = rootParent ? `${rootParent}/${indices.join("/")}` : indices.join("/");
3547
- return attribute ? `${basePath}#${attribute}` : basePath;
3548
- };
3549
- const processNode = (node) => {
3550
- let parent = node.parentElement;
3551
- while (parent) {
3552
- if (UNLOCALIZABLE_TAGS.includes(parent.tagName.toLowerCase())) {
3553
- return;
3656
+ return hasTranslatableContent(element);
3657
+ }
3658
+ function getInnerHTML(element) {
3659
+ return element.children.map((child) => DomSerializer.default(child, { encodeEntities: false })).join("");
3660
+ }
3661
+ function extractAttributes(element, path19) {
3662
+ const tagName = element.name.toLowerCase();
3663
+ const attrs = LOCALIZABLE_ATTRIBUTES[tagName];
3664
+ if (!attrs) return;
3665
+ for (const attr of attrs) {
3666
+ const value = _optionalChain([element, 'access', _143 => _143.attribs, 'optionalAccess', _144 => _144[attr]]);
3667
+ if (value && value.trim()) {
3668
+ result[`${path19}#${attr}`] = value.trim();
3554
3669
  }
3555
- parent = parent.parentElement;
3556
3670
  }
3557
- if (node.nodeType === 3) {
3558
- const text = node.textContent || "";
3559
- const normalizedText = normalizeTextContent(text, true);
3560
- if (normalizedText) {
3561
- result[getPath(node)] = normalizedText;
3671
+ }
3672
+ function extractFromElement(element, pathParts) {
3673
+ const path19 = pathParts.join("/");
3674
+ if (isInsideUnlocalizableTag(element)) {
3675
+ return;
3676
+ }
3677
+ extractAttributes(element, path19);
3678
+ const tagName = element.name.toLowerCase();
3679
+ if (BLOCK_ELEMENTS.has(tagName) && isLeafBlock(element)) {
3680
+ const content = getInnerHTML(element).trim();
3681
+ if (content) {
3682
+ result[path19] = content;
3562
3683
  }
3563
- } else if (node.nodeType === 1) {
3564
- const element = node;
3565
- const tagName = element.tagName.toLowerCase();
3566
- const attributes = LOCALIZABLE_ATTRIBUTES[tagName] || [];
3567
- attributes.forEach((attr) => {
3568
- const value = element.getAttribute(attr);
3569
- if (value) {
3570
- result[getPath(element, attr)] = value;
3571
- }
3572
- });
3573
- Array.from(element.childNodes).filter(
3574
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _146 => _146.textContent, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()])
3575
- ).forEach(processNode);
3684
+ return;
3576
3685
  }
3577
- };
3578
- Array.from(document.head.childNodes).filter(
3579
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _149 => _149.textContent, 'optionalAccess', _150 => _150.trim, 'call', _151 => _151()])
3580
- ).forEach(processNode);
3581
- Array.from(document.body.childNodes).filter(
3582
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _152 => _152.textContent, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])
3583
- ).forEach(processNode);
3686
+ if (PHRASING_ELEMENTS.has(tagName) && hasTranslatableContent(element)) {
3687
+ const content = getInnerHTML(element).trim();
3688
+ if (content) {
3689
+ result[path19] = content;
3690
+ }
3691
+ return;
3692
+ }
3693
+ let childIndex = 0;
3694
+ const childElements = element.children.filter(
3695
+ (child) => child.type === "tag"
3696
+ );
3697
+ for (const child of childElements) {
3698
+ extractFromElement(child, [...pathParts, childIndex++]);
3699
+ }
3700
+ }
3701
+ const html = domutils.findOne(
3702
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
3703
+ dom,
3704
+ true
3705
+ );
3706
+ if (html) {
3707
+ const head = domutils.findOne(
3708
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
3709
+ html.children,
3710
+ true
3711
+ );
3712
+ const body = domutils.findOne(
3713
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
3714
+ html.children,
3715
+ true
3716
+ );
3717
+ if (head) {
3718
+ let headIndex = 0;
3719
+ const headChildren = head.children.filter(
3720
+ (child) => child.type === "tag"
3721
+ );
3722
+ for (const child of headChildren) {
3723
+ extractFromElement(child, ["head", headIndex++]);
3724
+ }
3725
+ }
3726
+ if (body) {
3727
+ let bodyIndex = 0;
3728
+ const bodyChildren = body.children.filter(
3729
+ (child) => child.type === "tag"
3730
+ );
3731
+ for (const child of bodyChildren) {
3732
+ extractFromElement(child, ["body", bodyIndex++]);
3733
+ }
3734
+ }
3735
+ } else {
3736
+ let rootIndex = 0;
3737
+ const rootElements = dom.filter(
3738
+ (child) => child.type === "tag"
3739
+ );
3740
+ for (const child of rootElements) {
3741
+ extractFromElement(child, [rootIndex++]);
3742
+ }
3743
+ }
3584
3744
  return result;
3585
3745
  },
3586
3746
  async push(locale, data, originalInput) {
3587
- const dom = new (0, _jsdom.JSDOM)(
3747
+ const handler = new (0, _domhandler.DomHandler)();
3748
+ const parser = new htmlparser2.Parser(handler, {
3749
+ lowerCaseTags: false,
3750
+ lowerCaseAttributeNames: false
3751
+ });
3752
+ parser.write(
3588
3753
  _nullishCoalesce(originalInput, () => ( "<!DOCTYPE html><html><head></head><body></body></html>"))
3589
3754
  );
3590
- const document = dom.window.document;
3591
- const htmlElement = document.documentElement;
3592
- htmlElement.setAttribute("lang", locale);
3593
- const paths = Object.keys(data).sort((a, b) => {
3594
- const aDepth = a.split("/").length;
3595
- const bDepth = b.split("/").length;
3596
- return aDepth - bDepth;
3597
- });
3598
- paths.forEach((path19) => {
3599
- const value = data[path19];
3600
- const [nodePath, attribute] = path19.split("#");
3601
- const [rootTag, ...indices] = nodePath.split("/");
3602
- let parent = rootTag === "head" ? document.head : document.body;
3603
- let current = parent;
3604
- for (let i = 0; i < indices.length; i++) {
3605
- const index = parseInt(indices[i]);
3606
- const siblings = Array.from(parent.childNodes).filter(
3607
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _155 => _155.textContent, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()])
3755
+ parser.end();
3756
+ const dom = handler.dom;
3757
+ const html = domutils.findOne(
3758
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
3759
+ dom,
3760
+ true
3761
+ );
3762
+ if (html) {
3763
+ html.attribs = html.attribs || {};
3764
+ html.attribs.lang = locale;
3765
+ }
3766
+ function traverseByIndices(element, indices) {
3767
+ let current = element;
3768
+ for (const indexStr of indices) {
3769
+ if (!current) return null;
3770
+ const index = parseInt(indexStr, 10);
3771
+ const children = current.children.filter(
3772
+ (child) => child.type === "tag"
3608
3773
  );
3609
- if (index >= siblings.length) {
3610
- if (i === indices.length - 1) {
3611
- const textNode = document.createTextNode("");
3612
- parent.appendChild(textNode);
3613
- current = textNode;
3614
- } else {
3615
- const element = document.createElement("div");
3616
- parent.appendChild(element);
3617
- current = element;
3618
- parent = element;
3619
- }
3620
- } else {
3621
- current = siblings[index];
3622
- if (current.nodeType === 1) {
3623
- parent = current;
3624
- }
3774
+ if (index >= children.length) {
3775
+ return null;
3625
3776
  }
3777
+ current = children[index];
3778
+ }
3779
+ return current;
3780
+ }
3781
+ function resolvePathToElement(path19) {
3782
+ const parts = path19.split("/");
3783
+ const [rootTag, ...indices] = parts;
3784
+ let current = null;
3785
+ if (html) {
3786
+ if (rootTag === "head") {
3787
+ current = domutils.findOne(
3788
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
3789
+ html.children,
3790
+ true
3791
+ );
3792
+ } else if (rootTag === "body") {
3793
+ current = domutils.findOne(
3794
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
3795
+ html.children,
3796
+ true
3797
+ );
3798
+ }
3799
+ if (!current) return null;
3800
+ return traverseByIndices(current, indices);
3801
+ } else {
3802
+ const rootElements = dom.filter(
3803
+ (child) => child.type === "tag"
3804
+ );
3805
+ const rootIndex = parseInt(rootTag, 10);
3806
+ if (rootIndex >= rootElements.length) {
3807
+ return null;
3808
+ }
3809
+ current = rootElements[rootIndex];
3810
+ return traverseByIndices(current, indices);
3626
3811
  }
3627
- if (current) {
3628
- if (attribute) {
3629
- current.setAttribute(attribute, value);
3812
+ }
3813
+ for (const [path19, value] of Object.entries(data)) {
3814
+ const [nodePath, attribute] = path19.split("#");
3815
+ const element = resolvePathToElement(nodePath);
3816
+ if (!element) {
3817
+ console.warn(`Path not found in original HTML: ${nodePath}`);
3818
+ continue;
3819
+ }
3820
+ if (attribute) {
3821
+ element.attribs = element.attribs || {};
3822
+ element.attribs[attribute] = value;
3823
+ } else {
3824
+ if (value) {
3825
+ const valueHandler = new (0, _domhandler.DomHandler)();
3826
+ const valueParser = new htmlparser2.Parser(valueHandler);
3827
+ valueParser.write(value);
3828
+ valueParser.end();
3829
+ element.children = valueHandler.dom;
3630
3830
  } else {
3631
- current.textContent = value;
3831
+ element.children = [];
3632
3832
  }
3633
3833
  }
3634
- });
3635
- return dom.serialize();
3834
+ }
3835
+ return DomSerializer.default(dom, { encodeEntities: false });
3636
3836
  }
3637
3837
  });
3638
3838
  }
@@ -3655,7 +3855,7 @@ function createMarkdownLoader() {
3655
3855
  yaml: yamlEngine
3656
3856
  }
3657
3857
  });
3658
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]), () => ( ""))).filter(Boolean);
3858
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""))).filter(Boolean);
3659
3859
  return {
3660
3860
  ...Object.fromEntries(
3661
3861
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -3674,7 +3874,7 @@ function createMarkdownLoader() {
3674
3874
  );
3675
3875
  let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
3676
3876
  ([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
3677
- ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]), () => ( ""))).filter(Boolean).join("\n\n");
3877
+ ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()]), () => ( ""))).filter(Boolean).join("\n\n");
3678
3878
  if (Object.keys(frontmatter).length > 0) {
3679
3879
  content = `
3680
3880
  ${content}`;
@@ -3699,7 +3899,7 @@ function createMarkdocLoader() {
3699
3899
  const result = {};
3700
3900
  const counters = {};
3701
3901
  traverseAndExtract(ast, "", result, counters);
3702
- if (_optionalChain([ast, 'access', _162 => _162.attributes, 'optionalAccess', _163 => _163.frontmatter])) {
3902
+ if (_optionalChain([ast, 'access', _149 => _149.attributes, 'optionalAccess', _150 => _150.frontmatter])) {
3703
3903
  const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
3704
3904
  Object.entries(frontmatter).forEach(([key, value]) => {
3705
3905
  if (typeof value === "string") {
@@ -3745,7 +3945,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
3745
3945
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3746
3946
  semanticType = nodeSemanticType;
3747
3947
  }
3748
- if (node.type === "text" && _optionalChain([node, 'access', _164 => _164.attributes, 'optionalAccess', _165 => _165.content])) {
3948
+ if (node.type === "text" && _optionalChain([node, 'access', _151 => _151.attributes, 'optionalAccess', _152 => _152.content])) {
3749
3949
  const content = node.attributes.content;
3750
3950
  if (typeof content === "string" && content.trim()) {
3751
3951
  if (semanticType) {
@@ -3772,7 +3972,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
3772
3972
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3773
3973
  semanticType = nodeSemanticType;
3774
3974
  }
3775
- if (node.type === "text" && _optionalChain([node, 'access', _166 => _166.attributes, 'optionalAccess', _167 => _167.content])) {
3975
+ if (node.type === "text" && _optionalChain([node, 'access', _153 => _153.attributes, 'optionalAccess', _154 => _154.content])) {
3776
3976
  const content = node.attributes.content;
3777
3977
  if (typeof content === "string" && content.trim()) {
3778
3978
  if (semanticType) {
@@ -3795,7 +3995,7 @@ function applyTranslations(node, path19, data, pathMap) {
3795
3995
  if (!node || typeof node !== "object") {
3796
3996
  return;
3797
3997
  }
3798
- if (node.type === "text" && _optionalChain([node, 'access', _168 => _168.attributes, 'optionalAccess', _169 => _169.content])) {
3998
+ if (node.type === "text" && _optionalChain([node, 'access', _155 => _155.attributes, 'optionalAccess', _156 => _156.content])) {
3799
3999
  const content = node.attributes.content;
3800
4000
  if (typeof content === "string") {
3801
4001
  const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
@@ -3845,7 +4045,7 @@ function isSkippableLine(line) {
3845
4045
  function parsePropertyLine(line) {
3846
4046
  const [key, ...valueParts] = line.split("=");
3847
4047
  return {
3848
- key: _optionalChain([key, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || "",
4048
+ key: _optionalChain([key, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]) || "",
3849
4049
  value: valueParts.join("=").trim()
3850
4050
  };
3851
4051
  }
@@ -4078,7 +4278,7 @@ function escapeString(str) {
4078
4278
  }
4079
4279
 
4080
4280
  // src/cli/loaders/xcode-strings/parser.ts
4081
- var Parser = class {
4281
+ var Parser2 = class {
4082
4282
 
4083
4283
 
4084
4284
  constructor(tokens) {
@@ -4137,7 +4337,7 @@ var Parser = class {
4137
4337
  }
4138
4338
  }
4139
4339
  expect(type) {
4140
- if (_optionalChain([this, 'access', _172 => _172.current, 'call', _173 => _173(), 'optionalAccess', _174 => _174.type]) === type) {
4340
+ if (_optionalChain([this, 'access', _159 => _159.current, 'call', _160 => _160(), 'optionalAccess', _161 => _161.type]) === type) {
4141
4341
  this.advance();
4142
4342
  return true;
4143
4343
  }
@@ -4151,7 +4351,7 @@ function createXcodeStringsLoader() {
4151
4351
  async pull(locale, input2) {
4152
4352
  const tokenizer = new Tokenizer(input2);
4153
4353
  const tokens = tokenizer.tokenize();
4154
- const parser = new Parser(tokens);
4354
+ const parser = new Parser2(tokens);
4155
4355
  const result = parser.parse();
4156
4356
  return result;
4157
4357
  },
@@ -4214,7 +4414,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4214
4414
  if (rootTranslationEntity.shouldTranslate === false) {
4215
4415
  continue;
4216
4416
  }
4217
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]]);
4417
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _162 => _162.localizations, 'optionalAccess', _163 => _163[locale]]);
4218
4418
  if (langTranslationEntity) {
4219
4419
  if ("stringUnit" in langTranslationEntity) {
4220
4420
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -4228,7 +4428,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4228
4428
  resultData[translationKey] = {};
4229
4429
  const pluralForms = langTranslationEntity.variations.plural;
4230
4430
  for (const form in pluralForms) {
4231
- if (_optionalChain([pluralForms, 'access', _177 => _177[form], 'optionalAccess', _178 => _178.stringUnit, 'optionalAccess', _179 => _179.value])) {
4431
+ if (_optionalChain([pluralForms, 'access', _164 => _164[form], 'optionalAccess', _165 => _165.stringUnit, 'optionalAccess', _166 => _166.value])) {
4232
4432
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
4233
4433
  }
4234
4434
  }
@@ -4254,7 +4454,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4254
4454
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
4255
4455
  if (typeof value === "string") {
4256
4456
  langDataToMerge.strings[key] = {
4257
- extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
4457
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _167 => _167.strings, 'optionalAccess', _168 => _168[key], 'optionalAccess', _169 => _169.extractionState]),
4258
4458
  localizations: {
4259
4459
  [locale]: {
4260
4460
  stringUnit: {
@@ -4269,7 +4469,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4269
4469
  }
4270
4470
  } else if (Array.isArray(value)) {
4271
4471
  langDataToMerge.strings[key] = {
4272
- extractionState: _optionalChain([originalInput, 'optionalAccess', _183 => _183.strings, 'optionalAccess', _184 => _184[key], 'optionalAccess', _185 => _185.extractionState]),
4472
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _170 => _170.strings, 'optionalAccess', _171 => _171[key], 'optionalAccess', _172 => _172.extractionState]),
4273
4473
  localizations: {
4274
4474
  [locale]: {
4275
4475
  stringSet: {
@@ -4327,7 +4527,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4327
4527
  for (const [locale, localization] of Object.entries(
4328
4528
  entity.localizations
4329
4529
  )) {
4330
- if (_optionalChain([localization, 'access', _186 => _186.variations, 'optionalAccess', _187 => _187.plural])) {
4530
+ if (_optionalChain([localization, 'access', _173 => _173.variations, 'optionalAccess', _174 => _174.plural])) {
4331
4531
  const pluralForms = localization.variations.plural;
4332
4532
  for (const form in pluralForms) {
4333
4533
  const pluralKey = `${translationKey}/${form}`;
@@ -4347,7 +4547,7 @@ function _removeLocale(input2, locale) {
4347
4547
  const { strings } = input2;
4348
4548
  const newStrings = _lodash2.default.cloneDeep(strings);
4349
4549
  for (const [key, value] of Object.entries(newStrings)) {
4350
- if (_optionalChain([value, 'access', _188 => _188.localizations, 'optionalAccess', _189 => _189[locale]])) {
4550
+ if (_optionalChain([value, 'access', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]])) {
4351
4551
  delete value.localizations[locale];
4352
4552
  }
4353
4553
  }
@@ -4478,7 +4678,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4478
4678
  if (rootTranslationEntity.shouldTranslate === false) {
4479
4679
  continue;
4480
4680
  }
4481
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _190 => _190.localizations, 'optionalAccess', _191 => _191[locale]]);
4681
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _177 => _177.localizations, 'optionalAccess', _178 => _178[locale]]);
4482
4682
  if (langTranslationEntity) {
4483
4683
  if (!resultData[translationKey]) {
4484
4684
  resultData[translationKey] = {};
@@ -4490,7 +4690,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4490
4690
  for (const [subName, subData] of Object.entries(
4491
4691
  langTranslationEntity.substitutions
4492
4692
  )) {
4493
- const pluralForms = _optionalChain([subData, 'access', _192 => _192.variations, 'optionalAccess', _193 => _193.plural]);
4693
+ const pluralForms = _optionalChain([subData, 'access', _179 => _179.variations, 'optionalAccess', _180 => _180.plural]);
4494
4694
  if (pluralForms) {
4495
4695
  const forms = {};
4496
4696
  for (const [form, formData] of Object.entries(pluralForms)) {
@@ -4515,7 +4715,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4515
4715
  const pluralForms = langTranslationEntity.variations.plural;
4516
4716
  const forms = {};
4517
4717
  for (const [form, formData] of Object.entries(pluralForms)) {
4518
- if (_optionalChain([formData, 'optionalAccess', _194 => _194.stringUnit, 'optionalAccess', _195 => _195.value])) {
4718
+ if (_optionalChain([formData, 'optionalAccess', _181 => _181.stringUnit, 'optionalAccess', _182 => _182.value])) {
4519
4719
  forms[form] = formData.stringUnit.value;
4520
4720
  }
4521
4721
  }
@@ -4558,7 +4758,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4558
4758
  for (const [subName, subData] of Object.entries(
4559
4759
  keyData.substitutions
4560
4760
  )) {
4561
- const pluralValue = _optionalChain([subData, 'optionalAccess', _196 => _196.variations, 'optionalAccess', _197 => _197.plural]);
4761
+ const pluralValue = _optionalChain([subData, 'optionalAccess', _183 => _183.variations, 'optionalAccess', _184 => _184.plural]);
4562
4762
  if (pluralValue && isIcuPluralString(pluralValue)) {
4563
4763
  try {
4564
4764
  const pluralForms = parseIcuPluralString(pluralValue, locale);
@@ -4571,8 +4771,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4571
4771
  }
4572
4772
  };
4573
4773
  }
4574
- const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _198 => _198.sourceLanguage]) || "en";
4575
- 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;
4774
+ const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _185 => _185.sourceLanguage]) || "en";
4775
+ const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _186 => _186.strings, 'optionalAccess', _187 => _187[baseKey], 'optionalAccess', _188 => _188.localizations, 'optionalAccess', _189 => _189[sourceLocale], 'optionalAccess', _190 => _190.substitutions, 'optionalAccess', _191 => _191[subName], 'optionalAccess', _192 => _192.formatSpecifier]) || subName;
4576
4776
  subs[subName] = {
4577
4777
  formatSpecifier: origFormatSpec,
4578
4778
  variations: {
@@ -4597,7 +4797,7 @@ ${error instanceof Error ? error.message : String(error)}`
4597
4797
  values: keyData.stringSet
4598
4798
  };
4599
4799
  }
4600
- if ("variations" in keyData && _optionalChain([keyData, 'access', _206 => _206.variations, 'optionalAccess', _207 => _207.plural])) {
4800
+ if ("variations" in keyData && _optionalChain([keyData, 'access', _193 => _193.variations, 'optionalAccess', _194 => _194.plural])) {
4601
4801
  const pluralValue = keyData.variations.plural;
4602
4802
  if (isIcuPluralString(pluralValue)) {
4603
4803
  try {
@@ -4624,7 +4824,7 @@ ${error instanceof Error ? error.message : String(error)}`
4624
4824
  }
4625
4825
  if (Object.keys(localizationData).length > 0) {
4626
4826
  langDataToMerge.strings[baseKey] = {
4627
- extractionState: _optionalChain([originalInput, 'optionalAccess', _208 => _208.strings, 'optionalAccess', _209 => _209[baseKey], 'optionalAccess', _210 => _210.extractionState]),
4827
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _195 => _195.strings, 'optionalAccess', _196 => _196[baseKey], 'optionalAccess', _197 => _197.extractionState]),
4628
4828
  localizations: {
4629
4829
  [locale]: localizationData
4630
4830
  }
@@ -4847,8 +5047,8 @@ async function formatDataWithBiome(data, filePath, options) {
4847
5047
  });
4848
5048
  return formatted.content;
4849
5049
  } catch (error) {
4850
- 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]]) : "";
4851
- if (_optionalChain([errorMessage, 'optionalAccess', _217 => _217.includes, 'call', _218 => _218("does not exist in the workspace")])) {
5050
+ const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _198 => _198.stackTrace, 'optionalAccess', _199 => _199.toString, 'call', _200 => _200(), 'access', _201 => _201.split, 'call', _202 => _202("\n"), 'access', _203 => _203[0]]) : "";
5051
+ if (_optionalChain([errorMessage, 'optionalAccess', _204 => _204.includes, 'call', _205 => _205("does not exist in the workspace")])) {
4852
5052
  } else {
4853
5053
  console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
4854
5054
  if (errorMessage) {
@@ -4895,7 +5095,7 @@ function createPoDataLoader(params) {
4895
5095
  Object.entries(entries).forEach(([msgid, entry]) => {
4896
5096
  if (msgid && entry.msgid) {
4897
5097
  const context = entry.msgctxt || "";
4898
- const fullEntry = _optionalChain([parsedPo, 'access', _219 => _219.translations, 'access', _220 => _220[context], 'optionalAccess', _221 => _221[msgid]]);
5098
+ const fullEntry = _optionalChain([parsedPo, 'access', _206 => _206.translations, 'access', _207 => _207[context], 'optionalAccess', _208 => _208[msgid]]);
4899
5099
  if (fullEntry) {
4900
5100
  result[msgid] = fullEntry;
4901
5101
  }
@@ -4905,8 +5105,8 @@ function createPoDataLoader(params) {
4905
5105
  return result;
4906
5106
  },
4907
5107
  async push(locale, data, originalInput, originalLocale, pullInput) {
4908
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _222 => _222.split, 'call', _223 => _223("\n\n"), 'access', _224 => _224.filter, 'call', _225 => _225(Boolean)]) || [];
4909
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _226 => _226.split, 'call', _227 => _227("\n\n"), 'access', _228 => _228.filter, 'call', _229 => _229(Boolean)]) || [];
5108
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _209 => _209.split, 'call', _210 => _210("\n\n"), 'access', _211 => _211.filter, 'call', _212 => _212(Boolean)]) || [];
5109
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _213 => _213.split, 'call', _214 => _214("\n\n"), 'access', _215 => _215.filter, 'call', _216 => _216(Boolean)]) || [];
4910
5110
  const result = originalSections.map((section) => {
4911
5111
  const sectionPo = _gettextparser2.default.po.parse(section);
4912
5112
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -4975,8 +5175,8 @@ function createPoContentLoader() {
4975
5175
  {
4976
5176
  ...entry,
4977
5177
  msgstr: [
4978
- _optionalChain([data, 'access', _230 => _230[entry.msgid], 'optionalAccess', _231 => _231.singular]),
4979
- _optionalChain([data, 'access', _232 => _232[entry.msgid], 'optionalAccess', _233 => _233.plural]) || null
5178
+ _optionalChain([data, 'access', _217 => _217[entry.msgid], 'optionalAccess', _218 => _218.singular]),
5179
+ _optionalChain([data, 'access', _219 => _219[entry.msgid], 'optionalAccess', _220 => _220.plural]) || null
4980
5180
  ].filter(Boolean)
4981
5181
  }
4982
5182
  ]).fromPairs().value();
@@ -5015,7 +5215,7 @@ function preserveCommentOrder(section, originalSection) {
5015
5215
  }
5016
5216
 
5017
5217
  // src/cli/loaders/xliff.ts
5018
-
5218
+ var _jsdom = require('jsdom');
5019
5219
  function createXliffLoader() {
5020
5220
  return createLoader({
5021
5221
  async pull(locale, input2, _ctx, originalLocale) {
@@ -5098,7 +5298,7 @@ function pullV1(xliffElement, locale, originalLocale) {
5098
5298
  let key = getTransUnitKey(unit);
5099
5299
  if (!key) return;
5100
5300
  if (seenKeys.has(key)) {
5101
- const id = _optionalChain([unit, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
5301
+ const id = _optionalChain([unit, 'access', _221 => _221.getAttribute, 'call', _222 => _222("id"), 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]);
5102
5302
  if (id) {
5103
5303
  key = `${key}#${id}`;
5104
5304
  } else {
@@ -5146,7 +5346,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5146
5346
  let key = getTransUnitKey(unit);
5147
5347
  if (!key) return;
5148
5348
  if (seenKeys.has(key)) {
5149
- const id = _optionalChain([unit, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5349
+ const id = _optionalChain([unit, 'access', _225 => _225.getAttribute, 'call', _226 => _226("id"), 'optionalAccess', _227 => _227.trim, 'call', _228 => _228()]);
5150
5350
  if (id) {
5151
5351
  key = `${key}#${id}`;
5152
5352
  } else {
@@ -5188,7 +5388,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5188
5388
  const translationKeys = new Set(Object.keys(translations));
5189
5389
  existingUnits.forEach((unit, key) => {
5190
5390
  if (!translationKeys.has(key)) {
5191
- _optionalChain([unit, 'access', _242 => _242.parentNode, 'optionalAccess', _243 => _243.removeChild, 'call', _244 => _244(unit)]);
5391
+ _optionalChain([unit, 'access', _229 => _229.parentNode, 'optionalAccess', _230 => _230.removeChild, 'call', _231 => _231(unit)]);
5192
5392
  }
5193
5393
  });
5194
5394
  return serializeWithDeclaration(
@@ -5231,18 +5431,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
5231
5431
  Array.from(container.children).forEach((child) => {
5232
5432
  const tagName = child.tagName;
5233
5433
  if (tagName === "unit") {
5234
- const unitId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5434
+ const unitId = _optionalChain([child, 'access', _232 => _232.getAttribute, 'call', _233 => _233("id"), 'optionalAccess', _234 => _234.trim, 'call', _235 => _235()]);
5235
5435
  if (!unitId) return;
5236
5436
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5237
5437
  const segment = child.querySelector("segment");
5238
- const source = _optionalChain([segment, 'optionalAccess', _249 => _249.querySelector, 'call', _250 => _250("source")]);
5438
+ const source = _optionalChain([segment, 'optionalAccess', _236 => _236.querySelector, 'call', _237 => _237("source")]);
5239
5439
  if (source) {
5240
5440
  result[key] = extractTextContent(source);
5241
5441
  } else {
5242
5442
  result[key] = unitId;
5243
5443
  }
5244
5444
  } else if (tagName === "group") {
5245
- const groupId = _optionalChain([child, 'access', _251 => _251.getAttribute, 'call', _252 => _252("id"), 'optionalAccess', _253 => _253.trim, 'call', _254 => _254()]);
5445
+ const groupId = _optionalChain([child, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5246
5446
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5247
5447
  traverseUnitsV2(child, fileId, newPath, result);
5248
5448
  }
@@ -5278,12 +5478,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
5278
5478
  Array.from(container.children).forEach((child) => {
5279
5479
  const tagName = child.tagName;
5280
5480
  if (tagName === "unit") {
5281
- const unitId = _optionalChain([child, 'access', _255 => _255.getAttribute, 'call', _256 => _256("id"), 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]);
5481
+ const unitId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
5282
5482
  if (!unitId) return;
5283
5483
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5284
5484
  index.set(key, child);
5285
5485
  } else if (tagName === "group") {
5286
- const groupId = _optionalChain([child, 'access', _259 => _259.getAttribute, 'call', _260 => _260("id"), 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]);
5486
+ const groupId = _optionalChain([child, 'access', _246 => _246.getAttribute, 'call', _247 => _247("id"), 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]);
5287
5487
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5288
5488
  indexUnitsV2(child, fileId, newPath, index);
5289
5489
  }
@@ -5304,9 +5504,9 @@ function updateUnitV2(unit, value) {
5304
5504
  setTextContent(source, value);
5305
5505
  }
5306
5506
  function getTransUnitKey(transUnit) {
5307
- const resname = _optionalChain([transUnit, 'access', _263 => _263.getAttribute, 'call', _264 => _264("resname"), 'optionalAccess', _265 => _265.trim, 'call', _266 => _266()]);
5507
+ const resname = _optionalChain([transUnit, 'access', _250 => _250.getAttribute, 'call', _251 => _251("resname"), 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]);
5308
5508
  if (resname) return resname;
5309
- const id = _optionalChain([transUnit, 'access', _267 => _267.getAttribute, 'call', _268 => _268("id"), 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]);
5509
+ const id = _optionalChain([transUnit, 'access', _254 => _254.getAttribute, 'call', _255 => _255("id"), 'optionalAccess', _256 => _256.trim, 'call', _257 => _257()]);
5310
5510
  if (id) return id;
5311
5511
  const sourceElement = transUnit.querySelector("source");
5312
5512
  if (sourceElement) {
@@ -5363,10 +5563,10 @@ function formatXml(xml) {
5363
5563
  if (cdataNode) {
5364
5564
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
5365
5565
  }
5366
- const textContent = _optionalChain([element, 'access', _271 => _271.textContent, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || "";
5566
+ const textContent2 = _optionalChain([element, 'access', _258 => _258.textContent, 'optionalAccess', _259 => _259.trim, 'call', _260 => _260()]) || "";
5367
5567
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
5368
- if (hasOnlyText && textContent) {
5369
- return `${indent2}${openTag}${textContent}</${tagName}>`;
5568
+ if (hasOnlyText && textContent2) {
5569
+ return `${indent2}${openTag}${textContent2}</${tagName}>`;
5370
5570
  }
5371
5571
  const children = Array.from(element.children);
5372
5572
  if (children.length === 0) {
@@ -5656,7 +5856,7 @@ function createDatoClient(params) {
5656
5856
  ids: !records.length ? void 0 : records.join(",")
5657
5857
  }
5658
5858
  }).catch(
5659
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _274 => _274.response, 'optionalAccess', _275 => _275.body, 'optionalAccess', _276 => _276.data, 'optionalAccess', _277 => _277[0]]) || error)
5859
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _261 => _261.response, 'optionalAccess', _262 => _262.body, 'optionalAccess', _263 => _263.data, 'optionalAccess', _264 => _264[0]]) || error)
5660
5860
  );
5661
5861
  },
5662
5862
  findRecordsForModel: async (modelId, records) => {
@@ -5667,10 +5867,10 @@ function createDatoClient(params) {
5667
5867
  filter: {
5668
5868
  type: modelId,
5669
5869
  only_valid: "true",
5670
- ids: !_optionalChain([records, 'optionalAccess', _278 => _278.length]) ? void 0 : records.join(",")
5870
+ ids: !_optionalChain([records, 'optionalAccess', _265 => _265.length]) ? void 0 : records.join(",")
5671
5871
  }
5672
5872
  }).catch(
5673
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _279 => _279.response, 'optionalAccess', _280 => _280.body, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282[0]]) || error)
5873
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _266 => _266.response, 'optionalAccess', _267 => _267.body, 'optionalAccess', _268 => _268.data, 'optionalAccess', _269 => _269[0]]) || error)
5674
5874
  );
5675
5875
  return result;
5676
5876
  } catch (_error) {
@@ -5686,10 +5886,10 @@ function createDatoClient(params) {
5686
5886
  updateRecord: async (id, payload) => {
5687
5887
  try {
5688
5888
  await dato.items.update(id, payload).catch(
5689
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _283 => _283.response, 'optionalAccess', _284 => _284.body, 'optionalAccess', _285 => _285.data, 'optionalAccess', _286 => _286[0]]) || error)
5889
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _270 => _270.response, 'optionalAccess', _271 => _271.body, 'optionalAccess', _272 => _272.data, 'optionalAccess', _273 => _273[0]]) || error)
5690
5890
  );
5691
5891
  } catch (_error) {
5692
- if (_optionalChain([_error, 'optionalAccess', _287 => _287.attributes, 'optionalAccess', _288 => _288.details, 'optionalAccess', _289 => _289.message])) {
5892
+ if (_optionalChain([_error, 'optionalAccess', _274 => _274.attributes, 'optionalAccess', _275 => _275.details, 'optionalAccess', _276 => _276.message])) {
5693
5893
  throw new Error(
5694
5894
  [
5695
5895
  `${_error.attributes.details.message}`,
@@ -5711,10 +5911,10 @@ function createDatoClient(params) {
5711
5911
  enableFieldLocalization: async (args) => {
5712
5912
  try {
5713
5913
  await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
5714
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _290 => _290.response, 'optionalAccess', _291 => _291.body, 'optionalAccess', _292 => _292.data, 'optionalAccess', _293 => _293[0]]) || error)
5914
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _277 => _277.response, 'optionalAccess', _278 => _278.body, 'optionalAccess', _279 => _279.data, 'optionalAccess', _280 => _280[0]]) || error)
5715
5915
  );
5716
5916
  } catch (_error) {
5717
- if (_optionalChain([_error, 'optionalAccess', _294 => _294.attributes, 'optionalAccess', _295 => _295.code]) === "NOT_FOUND") {
5917
+ if (_optionalChain([_error, 'optionalAccess', _281 => _281.attributes, 'optionalAccess', _282 => _282.code]) === "NOT_FOUND") {
5718
5918
  throw new Error(
5719
5919
  [
5720
5920
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -5722,7 +5922,7 @@ function createDatoClient(params) {
5722
5922
  ].join("\n\n")
5723
5923
  );
5724
5924
  }
5725
- if (_optionalChain([_error, 'optionalAccess', _296 => _296.attributes, 'optionalAccess', _297 => _297.details, 'optionalAccess', _298 => _298.message])) {
5925
+ if (_optionalChain([_error, 'optionalAccess', _283 => _283.attributes, 'optionalAccess', _284 => _284.details, 'optionalAccess', _285 => _285.message])) {
5726
5926
  throw new Error(
5727
5927
  [
5728
5928
  `${_error.attributes.details.message}`,
@@ -5800,7 +6000,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
5800
6000
  const records = await dato.findRecordsForModel(modelId);
5801
6001
  const recordChoices = createRecordChoices(
5802
6002
  records,
5803
- _optionalChain([config, 'access', _299 => _299.models, 'access', _300 => _300[modelId], 'optionalAccess', _301 => _301.records]) || [],
6003
+ _optionalChain([config, 'access', _286 => _286.models, 'access', _287 => _287[modelId], 'optionalAccess', _288 => _288.records]) || [],
5804
6004
  project
5805
6005
  );
5806
6006
  const selectedRecords = await promptRecordSelection(
@@ -5819,14 +6019,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
5819
6019
  },
5820
6020
  async pull(locale, input2, initCtx) {
5821
6021
  const result = {};
5822
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _302 => _302.models]) || {})) {
5823
- let records = _optionalChain([initCtx, 'optionalAccess', _303 => _303.models, 'access', _304 => _304[modelId], 'access', _305 => _305.records]) || [];
6022
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _289 => _289.models]) || {})) {
6023
+ let records = _optionalChain([initCtx, 'optionalAccess', _290 => _290.models, 'access', _291 => _291[modelId], 'access', _292 => _292.records]) || [];
5824
6024
  const recordIds = records.map((record) => record.id);
5825
6025
  records = await dato.findRecords(recordIds);
5826
6026
  console.log(`Fetched ${records.length} records for model ${modelId}`);
5827
6027
  if (records.length > 0) {
5828
6028
  result[modelId] = {
5829
- fields: _optionalChain([initCtx, 'optionalAccess', _306 => _306.models, 'optionalAccess', _307 => _307[modelId], 'optionalAccess', _308 => _308.fields]) || [],
6029
+ fields: _optionalChain([initCtx, 'optionalAccess', _293 => _293.models, 'optionalAccess', _294 => _294[modelId], 'optionalAccess', _295 => _295.fields]) || [],
5830
6030
  records
5831
6031
  };
5832
6032
  }
@@ -5889,7 +6089,7 @@ function createRecordChoices(records, selectedIds = [], project) {
5889
6089
  return records.map((record) => ({
5890
6090
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
5891
6091
  value: record.id,
5892
- checked: _optionalChain([selectedIds, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(record.id)])
6092
+ checked: _optionalChain([selectedIds, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(record.id)])
5893
6093
  }));
5894
6094
  }
5895
6095
  async function promptRecordSelection(modelName, choices) {
@@ -6208,7 +6408,7 @@ function createVttLoader() {
6208
6408
  if (!input2) {
6209
6409
  return "";
6210
6410
  }
6211
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _311 => _311.parse, 'call', _312 => _312(input2), 'optionalAccess', _313 => _313.cues]);
6411
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _298 => _298.parse, 'call', _299 => _299(input2), 'optionalAccess', _300 => _300.cues]);
6212
6412
  if (Object.keys(vtt).length === 0) {
6213
6413
  return {};
6214
6414
  } else {
@@ -6262,7 +6462,7 @@ function variableExtractLoader(params) {
6262
6462
  for (let i = 0; i < matches.length; i++) {
6263
6463
  const match2 = matches[i];
6264
6464
  const currentValue = result[key].value;
6265
- const newValue = _optionalChain([currentValue, 'optionalAccess', _314 => _314.replace, 'call', _315 => _315(match2, `{variable:${i}}`)]);
6465
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _301 => _301.replace, 'call', _302 => _302(match2, `{variable:${i}}`)]);
6266
6466
  result[key].value = newValue;
6267
6467
  result[key].variables[i] = match2;
6268
6468
  }
@@ -6277,7 +6477,7 @@ function variableExtractLoader(params) {
6277
6477
  const variable = valueObj.variables[i];
6278
6478
  const currentValue = result[key];
6279
6479
  if (typeof currentValue === "string") {
6280
- const newValue = _optionalChain([currentValue, 'optionalAccess', _316 => _316.replaceAll, 'call', _317 => _317(
6480
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _303 => _303.replaceAll, 'call', _304 => _304(
6281
6481
  `{variable:${i}}`,
6282
6482
  variable
6283
6483
  )]);
@@ -6481,7 +6681,7 @@ function createVueJsonLoader() {
6481
6681
  return createLoader({
6482
6682
  pull: async (locale, input2, ctx) => {
6483
6683
  const parsed = parseVueFile(input2);
6484
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _318 => _318.i18n, 'optionalAccess', _319 => _319[locale]]), () => ( {}));
6684
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _305 => _305.i18n, 'optionalAccess', _306 => _306[locale]]), () => ( {}));
6485
6685
  },
6486
6686
  push: async (locale, data, originalInput) => {
6487
6687
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -6666,7 +6866,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
6666
6866
  objectExpression.properties.forEach((prop) => {
6667
6867
  if (!t.isObjectProperty(prop)) return;
6668
6868
  const key = getPropertyKey(prop);
6669
- const incomingVal = _optionalChain([data, 'optionalAccess', _320 => _320[key]]);
6869
+ const incomingVal = _optionalChain([data, 'optionalAccess', _307 => _307[key]]);
6670
6870
  if (incomingVal === void 0) {
6671
6871
  return;
6672
6872
  }
@@ -6702,7 +6902,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
6702
6902
  let modified = false;
6703
6903
  arrayExpression.elements.forEach((element, index) => {
6704
6904
  if (!element) return;
6705
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _321 => _321[index]]);
6905
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _308 => _308[index]]);
6706
6906
  if (incomingVal === void 0) return;
6707
6907
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
6708
6908
  if (element.value !== incomingVal) {
@@ -7196,7 +7396,7 @@ var AST = class _AST {
7196
7396
  const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
7197
7397
  if (this.isStart() && !this.type)
7198
7398
  ret.unshift([]);
7199
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!")) {
7399
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.type]) === "!")) {
7200
7400
  ret.push({});
7201
7401
  }
7202
7402
  return ret;
@@ -7204,7 +7404,7 @@ var AST = class _AST {
7204
7404
  isStart() {
7205
7405
  if (this.#root === this)
7206
7406
  return true;
7207
- if (!_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.isStart, 'call', _326 => _326()]))
7407
+ if (!_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.isStart, 'call', _313 => _313()]))
7208
7408
  return false;
7209
7409
  if (this.#parentIndex === 0)
7210
7410
  return true;
@@ -7220,12 +7420,12 @@ var AST = class _AST {
7220
7420
  isEnd() {
7221
7421
  if (this.#root === this)
7222
7422
  return true;
7223
- if (_optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")
7423
+ if (_optionalChain([this, 'access', _314 => _314.#parent, 'optionalAccess', _315 => _315.type]) === "!")
7224
7424
  return true;
7225
- if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]))
7425
+ if (!_optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]))
7226
7426
  return false;
7227
7427
  if (!this.type)
7228
- return _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.isEnd, 'call', _334 => _334()]);
7428
+ return _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.isEnd, 'call', _321 => _321()]);
7229
7429
  const pl = this.#parent ? this.#parent.#parts.length : 0;
7230
7430
  return this.#parentIndex === pl - 1;
7231
7431
  }
@@ -7470,7 +7670,7 @@ var AST = class _AST {
7470
7670
  }
7471
7671
  }
7472
7672
  let end = "";
7473
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _335 => _335.#parent, 'optionalAccess', _336 => _336.type]) === "!") {
7673
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!") {
7474
7674
  end = "(?:$|\\/)";
7475
7675
  }
7476
7676
  const final2 = start2 + src + end;
@@ -8571,7 +8771,7 @@ function createMdxSectionsSplit2Loader() {
8571
8771
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
8572
8772
  const result = {
8573
8773
  frontmatter: data.frontmatter,
8574
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _337 => _337.codePlaceholders]) || {},
8774
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _324 => _324.codePlaceholders]) || {},
8575
8775
  content
8576
8776
  };
8577
8777
  return result;
@@ -8686,14 +8886,14 @@ function parseEjsForTranslation(input2) {
8686
8886
  if (part.type === "ejs") {
8687
8887
  template += part.content;
8688
8888
  } else {
8689
- const textContent = part.content;
8889
+ const textContent2 = part.content;
8690
8890
  const htmlTagRegex = /<[^>]+>/g;
8691
8891
  const textParts = [];
8692
8892
  let lastTextIndex = 0;
8693
8893
  let htmlMatch;
8694
- while ((htmlMatch = htmlTagRegex.exec(textContent)) !== null) {
8894
+ while ((htmlMatch = htmlTagRegex.exec(textContent2)) !== null) {
8695
8895
  if (htmlMatch.index > lastTextIndex) {
8696
- const textBefore = textContent.slice(lastTextIndex, htmlMatch.index);
8896
+ const textBefore = textContent2.slice(lastTextIndex, htmlMatch.index);
8697
8897
  if (textBefore.trim()) {
8698
8898
  textParts.push({ type: "text", content: textBefore });
8699
8899
  } else {
@@ -8703,8 +8903,8 @@ function parseEjsForTranslation(input2) {
8703
8903
  textParts.push({ type: "html", content: htmlMatch[0] });
8704
8904
  lastTextIndex = htmlMatch.index + htmlMatch[0].length;
8705
8905
  }
8706
- if (lastTextIndex < textContent.length) {
8707
- const remainingText = textContent.slice(lastTextIndex);
8906
+ if (lastTextIndex < textContent2.length) {
8907
+ const remainingText = textContent2.slice(lastTextIndex);
8708
8908
  if (remainingText.trim()) {
8709
8909
  textParts.push({ type: "text", content: remainingText });
8710
8910
  } else {
@@ -8712,11 +8912,11 @@ function parseEjsForTranslation(input2) {
8712
8912
  }
8713
8913
  }
8714
8914
  if (textParts.length === 0) {
8715
- const trimmedContent = textContent.trim();
8915
+ const trimmedContent = textContent2.trim();
8716
8916
  if (trimmedContent) {
8717
- textParts.push({ type: "text", content: textContent });
8917
+ textParts.push({ type: "text", content: textContent2 });
8718
8918
  } else {
8719
- textParts.push({ type: "html", content: textContent });
8919
+ textParts.push({ type: "html", content: textContent2 });
8720
8920
  }
8721
8921
  }
8722
8922
  for (const textPart of textParts) {
@@ -9671,7 +9871,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9671
9871
  ]
9672
9872
  });
9673
9873
  const result = JSON.parse(response.text);
9674
- return _optionalChain([result, 'optionalAccess', _338 => _338.data]) || {};
9874
+ return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
9675
9875
  }
9676
9876
  }
9677
9877
  function extractPayloadChunks(payload) {
@@ -9754,7 +9954,7 @@ function getPureModelProvider(provider) {
9754
9954
 
9755
9955
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9756
9956
  `;
9757
- switch (_optionalChain([provider, 'optionalAccess', _339 => _339.id])) {
9957
+ switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
9758
9958
  case "openai": {
9759
9959
  if (!process.env.OPENAI_API_KEY) {
9760
9960
  throw new Error(
@@ -9812,7 +10012,7 @@ function getPureModelProvider(provider) {
9812
10012
  })(provider.model);
9813
10013
  }
9814
10014
  default: {
9815
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _340 => _340.id])));
10015
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
9816
10016
  }
9817
10017
  }
9818
10018
  }
@@ -10098,7 +10298,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10098
10298
  validateParams(i18nConfig, flags);
10099
10299
  ora.succeed("Localization configuration is valid");
10100
10300
  ora.start("Connecting to Lingo.dev Localization Engine...");
10101
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _341 => _341.provider]);
10301
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
10102
10302
  if (isByokMode) {
10103
10303
  authId = null;
10104
10304
  ora.succeed("Using external provider (BYOK mode)");
@@ -10112,16 +10312,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10112
10312
  flags
10113
10313
  });
10114
10314
  let buckets = getBuckets(i18nConfig);
10115
- if (_optionalChain([flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.length])) {
10315
+ if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
10116
10316
  buckets = buckets.filter(
10117
10317
  (bucket) => flags.bucket.includes(bucket.type)
10118
10318
  );
10119
10319
  }
10120
10320
  ora.succeed("Buckets retrieved");
10121
- if (_optionalChain([flags, 'access', _344 => _344.file, 'optionalAccess', _345 => _345.length])) {
10321
+ if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
10122
10322
  buckets = buckets.map((bucket) => {
10123
10323
  const paths = bucket.paths.filter(
10124
- (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _346 => _346.pathPattern, 'optionalAccess', _347 => _347.includes, 'call', _348 => _348(file)]))
10324
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
10125
10325
  );
10126
10326
  return { ...bucket, paths };
10127
10327
  }).filter((bucket) => bucket.paths.length > 0);
@@ -10142,7 +10342,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10142
10342
  });
10143
10343
  }
10144
10344
  }
10145
- const targetLocales = _optionalChain([flags, 'access', _349 => _349.locale, 'optionalAccess', _350 => _350.length]) ? flags.locale : i18nConfig.locale.targets;
10345
+ const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
10146
10346
  ora.start("Setting up localization cache...");
10147
10347
  const checkLockfileProcessor = createDeltaProcessor("");
10148
10348
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -10427,7 +10627,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10427
10627
  }
10428
10628
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
10429
10629
  const checksums = await deltaProcessor.createChecksums(sourceData);
10430
- if (!_optionalChain([flags, 'access', _351 => _351.locale, 'optionalAccess', _352 => _352.length])) {
10630
+ if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
10431
10631
  await deltaProcessor.saveChecksums(checksums);
10432
10632
  }
10433
10633
  }
@@ -10551,12 +10751,12 @@ function validateParams(i18nConfig, flags) {
10551
10751
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10552
10752
  docUrl: "bucketNotFound"
10553
10753
  });
10554
- } else if (_optionalChain([flags, 'access', _353 => _353.locale, 'optionalAccess', _354 => _354.some, 'call', _355 => _355((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10754
+ } else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10555
10755
  throw new ValidationError({
10556
10756
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10557
10757
  docUrl: "localeTargetNotFound"
10558
10758
  });
10559
- } else if (_optionalChain([flags, 'access', _356 => _356.bucket, 'optionalAccess', _357 => _357.some, 'call', _358 => _358(
10759
+ } else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
10560
10760
  (bucket) => !i18nConfig.buckets[bucket]
10561
10761
  )])) {
10562
10762
  throw new ValidationError({
@@ -11090,7 +11290,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
11090
11290
  const response = await engine.whoami();
11091
11291
  return {
11092
11292
  authenticated: !!response,
11093
- username: _optionalChain([response, 'optionalAccess', _359 => _359.email])
11293
+ username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
11094
11294
  };
11095
11295
  } catch (error) {
11096
11296
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -11206,7 +11406,7 @@ function createExplicitLocalizer(provider) {
11206
11406
  }
11207
11407
  function createAiSdkLocalizer(params) {
11208
11408
  const skipAuth = params.skipAuth === true;
11209
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _360 => _360.apiKeyName]), () => ( ""))];
11409
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
11210
11410
  if (!skipAuth && !apiKey || !params.apiKeyName) {
11211
11411
  throw new Error(
11212
11412
  _dedent2.default`
@@ -11340,8 +11540,8 @@ async function setup(input2) {
11340
11540
  throw new Error(
11341
11541
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
11342
11542
  );
11343
- } else if (_optionalChain([ctx, 'access', _361 => _361.flags, 'access', _362 => _362.bucket, 'optionalAccess', _363 => _363.some, 'call', _364 => _364(
11344
- (bucket) => !_optionalChain([ctx, 'access', _365 => _365.config, 'optionalAccess', _366 => _366.buckets, 'access', _367 => _367[bucket]])
11543
+ } else if (_optionalChain([ctx, 'access', _348 => _348.flags, 'access', _349 => _349.bucket, 'optionalAccess', _350 => _350.some, 'call', _351 => _351(
11544
+ (bucket) => !_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.buckets, 'access', _354 => _354[bucket]])
11345
11545
  )])) {
11346
11546
  throw new Error(
11347
11547
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -11354,7 +11554,7 @@ async function setup(input2) {
11354
11554
  title: "Selecting localization provider",
11355
11555
  task: async (ctx, task) => {
11356
11556
  ctx.localizer = createLocalizer(
11357
- _optionalChain([ctx, 'access', _368 => _368.config, 'optionalAccess', _369 => _369.provider]),
11557
+ _optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
11358
11558
  ctx.flags.apiKey
11359
11559
  );
11360
11560
  if (!ctx.localizer) {
@@ -11367,7 +11567,7 @@ async function setup(input2) {
11367
11567
  },
11368
11568
  {
11369
11569
  title: "Checking authentication",
11370
- enabled: (ctx) => _optionalChain([ctx, 'access', _370 => _370.localizer, 'optionalAccess', _371 => _371.id]) === "Lingo.dev",
11570
+ enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
11371
11571
  task: async (ctx, task) => {
11372
11572
  const authStatus = await ctx.localizer.checkAuth();
11373
11573
  if (!authStatus.authenticated) {
@@ -11380,7 +11580,7 @@ async function setup(input2) {
11380
11580
  },
11381
11581
  {
11382
11582
  title: "Validating configuration",
11383
- enabled: (ctx) => _optionalChain([ctx, 'access', _372 => _372.localizer, 'optionalAccess', _373 => _373.id]) !== "Lingo.dev",
11583
+ enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
11384
11584
  task: async (ctx, task) => {
11385
11585
  const validationStatus = await ctx.localizer.validateSettings();
11386
11586
  if (!validationStatus.valid) {
@@ -11711,7 +11911,7 @@ function createWorkerTask(args) {
11711
11911
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11712
11912
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11713
11913
  ).filter(
11714
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _374 => _374.onlyKeys, 'optionalAccess', _375 => _375.some, 'call', _376 => _376(
11914
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
11715
11915
  (pattern) => minimatch(key, pattern)
11716
11916
  )])
11717
11917
  ).fromPairs().value();
@@ -11779,7 +11979,7 @@ function createWorkerTask(args) {
11779
11979
  finalRenamedTargetData
11780
11980
  );
11781
11981
  const checksums = await deltaProcessor.createChecksums(sourceData);
11782
- if (!_optionalChain([args, 'access', _377 => _377.ctx, 'access', _378 => _378.flags, 'access', _379 => _379.targetLocale, 'optionalAccess', _380 => _380.length])) {
11982
+ if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
11783
11983
  await deltaProcessor.saveChecksums(checksums);
11784
11984
  }
11785
11985
  });
@@ -11984,10 +12184,10 @@ var flagsSchema2 = _zod.z.object({
11984
12184
  async function frozen(input2) {
11985
12185
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
11986
12186
  let buckets = getBuckets(input2.config);
11987
- if (_optionalChain([input2, 'access', _381 => _381.flags, 'access', _382 => _382.bucket, 'optionalAccess', _383 => _383.length])) {
12187
+ if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
11988
12188
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
11989
12189
  }
11990
- if (_optionalChain([input2, 'access', _384 => _384.flags, 'access', _385 => _385.file, 'optionalAccess', _386 => _386.length])) {
12190
+ if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
11991
12191
  buckets = buckets.map((bucket) => {
11992
12192
  const paths = bucket.paths.filter(
11993
12193
  (p) => input2.flags.file.some(
@@ -12124,13 +12324,13 @@ async function frozen(input2) {
12124
12324
 
12125
12325
  // src/cli/cmd/run/_utils.ts
12126
12326
  async function determineAuthId(ctx) {
12127
- const isByokMode = !!_optionalChain([ctx, 'access', _387 => _387.config, 'optionalAccess', _388 => _388.provider]);
12327
+ const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
12128
12328
  if (isByokMode) {
12129
12329
  return null;
12130
12330
  } else {
12131
12331
  try {
12132
- const authStatus = await _optionalChain([ctx, 'access', _389 => _389.localizer, 'optionalAccess', _390 => _390.checkAuth, 'call', _391 => _391()]);
12133
- return _optionalChain([authStatus, 'optionalAccess', _392 => _392.username]) || null;
12332
+ const authStatus = await _optionalChain([ctx, 'access', _376 => _376.localizer, 'optionalAccess', _377 => _377.checkAuth, 'call', _378 => _378()]);
12333
+ return _optionalChain([authStatus, 'optionalAccess', _379 => _379.username]) || null;
12134
12334
  } catch (e3) {
12135
12335
  return null;
12136
12336
  }
@@ -12328,7 +12528,7 @@ var InBranchFlow = class extends IntegrationFlow {
12328
12528
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
12329
12529
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
12330
12530
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
12331
- _optionalChain([this, 'access', _393 => _393.platformKit, 'optionalAccess', _394 => _394.gitConfig, 'call', _395 => _395()]);
12531
+ _optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
12332
12532
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
12333
12533
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
12334
12534
  if (!processOwnCommits) {
@@ -12360,7 +12560,7 @@ var InBranchFlow = class extends IntegrationFlow {
12360
12560
  // src/cli/cmd/ci/flows/pull-request.ts
12361
12561
  var PullRequestFlow = class extends InBranchFlow {
12362
12562
  async preRun() {
12363
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _396 => _396()]);
12563
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
12364
12564
  if (!canContinue) {
12365
12565
  return false;
12366
12566
  }
@@ -12627,10 +12827,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12627
12827
  repo_slug: this.platformConfig.repositoryName,
12628
12828
  state: "OPEN"
12629
12829
  }).then(({ data: { values } }) => {
12630
- return _optionalChain([values, 'optionalAccess', _397 => _397.find, 'call', _398 => _398(
12631
- ({ 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
12830
+ return _optionalChain([values, 'optionalAccess', _384 => _384.find, 'call', _385 => _385(
12831
+ ({ 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
12632
12832
  )]);
12633
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.id]));
12833
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
12634
12834
  }
12635
12835
  async closePullRequest({ pullRequestNumber }) {
12636
12836
  await this.bb.repositories.declinePullRequest({
@@ -12726,7 +12926,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12726
12926
  repo: this.platformConfig.repositoryName,
12727
12927
  base: this.platformConfig.baseBranchName,
12728
12928
  state: "open"
12729
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.number]));
12929
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
12730
12930
  }
12731
12931
  async closePullRequest({ pullRequestNumber }) {
12732
12932
  await this.octokit.rest.pulls.update({
@@ -12853,7 +13053,7 @@ var GitlabPlatformKit = class extends PlatformKit {
12853
13053
  sourceBranch: branch,
12854
13054
  state: "opened"
12855
13055
  });
12856
- return _optionalChain([mergeRequests, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.iid]);
13056
+ return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
12857
13057
  }
12858
13058
  async closePullRequest({
12859
13059
  pullRequestNumber
@@ -12965,7 +13165,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12965
13165
  }
12966
13166
  const env = {
12967
13167
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
12968
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _407 => _407.pullRequest, 'optionalAccess', _408 => _408.toString, 'call', _409 => _409()]) || "false",
13168
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
12969
13169
  ...options.commitMessage && {
12970
13170
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
12971
13171
  },
@@ -12991,7 +13191,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12991
13191
  const { isPullRequestMode } = platformKit.config;
12992
13192
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
12993
13193
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
12994
- const canRun = await _optionalChain([flow, 'access', _410 => _410.preRun, 'optionalCall', _411 => _411()]);
13194
+ const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
12995
13195
  if (canRun === false) {
12996
13196
  return;
12997
13197
  }
@@ -13001,7 +13201,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
13001
13201
  if (!hasChanges) {
13002
13202
  return;
13003
13203
  }
13004
- await _optionalChain([flow, 'access', _412 => _412.postRun, 'optionalCall', _413 => _413()]);
13204
+ await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
13005
13205
  });
13006
13206
  function parseBooleanArg(val) {
13007
13207
  if (val === true) return true;
@@ -13038,8 +13238,8 @@ function exitGracefully(elapsedMs = 0) {
13038
13238
  }
13039
13239
  }
13040
13240
  function checkForPendingOperations() {
13041
- const activeHandles = _optionalChain([process, 'access', _414 => _414._getActiveHandles, 'optionalCall', _415 => _415()]) || [];
13042
- const activeRequests = _optionalChain([process, 'access', _416 => _416._getActiveRequests, 'optionalCall', _417 => _417()]) || [];
13241
+ const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
13242
+ const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
13043
13243
  const nonStandardHandles = activeHandles.filter((handle) => {
13044
13244
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
13045
13245
  return false;
@@ -13108,17 +13308,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13108
13308
  flags
13109
13309
  });
13110
13310
  let buckets = getBuckets(i18nConfig);
13111
- if (_optionalChain([flags, 'access', _418 => _418.bucket, 'optionalAccess', _419 => _419.length])) {
13311
+ if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
13112
13312
  buckets = buckets.filter(
13113
13313
  (bucket) => flags.bucket.includes(bucket.type)
13114
13314
  );
13115
13315
  }
13116
13316
  ora.succeed("Buckets retrieved");
13117
- if (_optionalChain([flags, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.length])) {
13317
+ if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
13118
13318
  buckets = buckets.map((bucket) => {
13119
13319
  const paths = bucket.paths.filter(
13120
13320
  (path19) => flags.file.find(
13121
- (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)
13321
+ (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)
13122
13322
  )
13123
13323
  );
13124
13324
  return { ...bucket, paths };
@@ -13138,7 +13338,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13138
13338
  });
13139
13339
  }
13140
13340
  }
13141
- const targetLocales = _optionalChain([flags, 'access', _428 => _428.locale, 'optionalAccess', _429 => _429.length]) ? flags.locale : i18nConfig.locale.targets;
13341
+ const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
13142
13342
  let totalSourceKeyCount = 0;
13143
13343
  let uniqueKeysToTranslate = 0;
13144
13344
  let totalExistingTranslations = 0;
@@ -13546,12 +13746,12 @@ function validateParams2(i18nConfig, flags) {
13546
13746
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13547
13747
  docUrl: "bucketNotFound"
13548
13748
  });
13549
- } else if (_optionalChain([flags, 'access', _430 => _430.locale, 'optionalAccess', _431 => _431.some, 'call', _432 => _432((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13749
+ } else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13550
13750
  throw new CLIError({
13551
13751
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13552
13752
  docUrl: "localeTargetNotFound"
13553
13753
  });
13554
- } else if (_optionalChain([flags, 'access', _433 => _433.bucket, 'optionalAccess', _434 => _434.some, 'call', _435 => _435(
13754
+ } else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
13555
13755
  (bucket) => !i18nConfig.buckets[bucket]
13556
13756
  )])) {
13557
13757
  throw new CLIError({
@@ -13643,7 +13843,7 @@ async function renderHero2() {
13643
13843
  // package.json
13644
13844
  var package_default = {
13645
13845
  name: "lingo.dev",
13646
- version: "0.117.4",
13846
+ version: "0.117.5",
13647
13847
  description: "Lingo.dev CLI",
13648
13848
  private: false,
13649
13849
  publishConfig: {
@@ -13801,6 +14001,9 @@ var package_default = {
13801
14001
  "date-fns": "4.1.0",
13802
14002
  dedent: "1.7.0",
13803
14003
  diff: "7.0.0",
14004
+ "dom-serializer": "2.0.0",
14005
+ domhandler: "5.0.3",
14006
+ domutils: "3.2.2",
13804
14007
  dotenv: "16.4.7",
13805
14008
  ejs: "3.1.10",
13806
14009
  express: "5.1.0",
@@ -13811,6 +14014,7 @@ var package_default = {
13811
14014
  glob: "11.1.0",
13812
14015
  "gradient-string": "3.0.0",
13813
14016
  "gray-matter": "4.0.3",
14017
+ htmlparser2: "10.0.0",
13814
14018
  ini: "5.0.0",
13815
14019
  ink: "4.2.0",
13816
14020
  "ink-progress-bar": "3.0.0",
@@ -13935,7 +14139,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
13935
14139
  if (options.file && options.file.length) {
13936
14140
  buckets = buckets.map((bucket) => {
13937
14141
  const paths = bucket.paths.filter(
13938
- (bucketPath) => _optionalChain([options, 'access', _436 => _436.file, 'optionalAccess', _437 => _437.some, 'call', _438 => _438((f) => bucketPath.pathPattern.includes(f))])
14142
+ (bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
13939
14143
  );
13940
14144
  return { ...bucket, paths };
13941
14145
  }).filter((bucket) => bucket.paths.length > 0);