lingo.dev 0.117.4 → 0.117.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.cjs CHANGED
@@ -2732,16 +2732,9 @@ function appendResourceNode(document, resourceNode) {
2732
2732
  function setTextualNodeContent(node, value, useCdata) {
2733
2733
  const escapedValue = useCdata ? escapeApostrophesOnly(value) : escapeAndroidString(value);
2734
2734
  node._ = escapedValue;
2735
- node.$$ = _nullishCoalesce(node.$$, () => ( []));
2736
- let textNode = node.$$.find(
2737
- (child) => child["#name"] === "__text__" || child["#name"] === "__cdata"
2738
- );
2739
- if (!textNode) {
2740
- textNode = {};
2741
- node.$$.push(textNode);
2742
- }
2743
- textNode["#name"] = useCdata ? "__cdata" : "__text__";
2744
- textNode._ = escapedValue;
2735
+ node.$$ = [
2736
+ { "#name": useCdata ? "__cdata" : "__text__", _: escapedValue }
2737
+ ];
2745
2738
  }
2746
2739
  function buildResourceNameMap(document) {
2747
2740
  const map = /* @__PURE__ */ new Map();
@@ -3414,8 +3407,8 @@ function serializeElement(node) {
3414
3407
  const attrString = Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttributeValue(String(value))}"`).join("");
3415
3408
  const children = Array.isArray(node.$$) ? node.$$ : [];
3416
3409
  if (children.length === 0) {
3417
- const textContent = _nullishCoalesce(node._, () => ( ""));
3418
- return `<${name}${attrString}>${textContent}</${name}>`;
3410
+ const textContent2 = _nullishCoalesce(node._, () => ( ""));
3411
+ return `<${name}${attrString}>${textContent2}</${name}>`;
3419
3412
  }
3420
3413
  const childContent = children.map(serializeElement).join("");
3421
3414
  return `<${name}${attrString}>${childContent}</${name}>`;
@@ -3504,135 +3497,335 @@ function createPullOutputCleaner() {
3504
3497
  }
3505
3498
 
3506
3499
  // 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
- }
3500
+ var _htmlparser2 = require('htmlparser2'); var htmlparser2 = _interopRequireWildcard(_htmlparser2);
3501
+ var _domhandler = require('domhandler');
3502
+ var _domutils = require('domutils'); var domutils = _interopRequireWildcard(_domutils);
3503
+ var _domserializer = require('dom-serializer'); var DomSerializer = _interopRequireWildcard(_domserializer);
3513
3504
  function createHtmlLoader() {
3505
+ const PHRASING_ELEMENTS = /* @__PURE__ */ new Set([
3506
+ // Text-level semantics
3507
+ "a",
3508
+ "abbr",
3509
+ "b",
3510
+ "bdi",
3511
+ "bdo",
3512
+ "br",
3513
+ "cite",
3514
+ "code",
3515
+ "data",
3516
+ "dfn",
3517
+ "em",
3518
+ "i",
3519
+ "kbd",
3520
+ "mark",
3521
+ "q",
3522
+ "ruby",
3523
+ "s",
3524
+ "samp",
3525
+ "small",
3526
+ "span",
3527
+ "strong",
3528
+ "sub",
3529
+ "sup",
3530
+ "time",
3531
+ "u",
3532
+ "var",
3533
+ "wbr",
3534
+ // Media
3535
+ "audio",
3536
+ "img",
3537
+ "video",
3538
+ "picture",
3539
+ // Interactive
3540
+ "button",
3541
+ "input",
3542
+ "label",
3543
+ "select",
3544
+ "textarea",
3545
+ // Embedded
3546
+ "canvas",
3547
+ "iframe",
3548
+ "object",
3549
+ "svg",
3550
+ "math",
3551
+ // Other
3552
+ "del",
3553
+ "ins",
3554
+ "map",
3555
+ "area"
3556
+ ]);
3557
+ const BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
3558
+ "div",
3559
+ "p",
3560
+ "h1",
3561
+ "h2",
3562
+ "h3",
3563
+ "h4",
3564
+ "h5",
3565
+ "h6",
3566
+ "ul",
3567
+ "ol",
3568
+ "li",
3569
+ "dl",
3570
+ "dt",
3571
+ "dd",
3572
+ "blockquote",
3573
+ "pre",
3574
+ "article",
3575
+ "aside",
3576
+ "nav",
3577
+ "section",
3578
+ "header",
3579
+ "footer",
3580
+ "main",
3581
+ "figure",
3582
+ "figcaption",
3583
+ "table",
3584
+ "thead",
3585
+ "tbody",
3586
+ "tfoot",
3587
+ "tr",
3588
+ "td",
3589
+ "th",
3590
+ "caption",
3591
+ "form",
3592
+ "fieldset",
3593
+ "legend",
3594
+ "details",
3595
+ "summary",
3596
+ "address",
3597
+ "hr",
3598
+ "search",
3599
+ "dialog",
3600
+ "noscript",
3601
+ "title"
3602
+ // <title> should be treated as a block element for translation
3603
+ ]);
3604
+ const UNLOCALIZABLE_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
3514
3605
  const LOCALIZABLE_ATTRIBUTES = {
3515
3606
  meta: ["content"],
3516
- img: ["alt"],
3517
- input: ["placeholder"],
3518
- a: ["title"]
3607
+ img: ["alt", "title"],
3608
+ input: ["placeholder", "title"],
3609
+ textarea: ["placeholder", "title"],
3610
+ a: ["title"],
3611
+ abbr: ["title"],
3612
+ button: ["title"],
3613
+ link: ["title"]
3519
3614
  };
3520
- const UNLOCALIZABLE_TAGS = ["script", "style"];
3521
3615
  return createLoader({
3522
3616
  async pull(locale, input2) {
3523
3617
  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;
3618
+ const handler = new (0, _domhandler.DomHandler)();
3619
+ const parser = new htmlparser2.Parser(handler, {
3620
+ lowerCaseTags: false,
3621
+ lowerCaseAttributeNames: false
3622
+ });
3623
+ parser.write(input2);
3624
+ parser.end();
3625
+ const dom = handler.dom;
3626
+ function isInsideUnlocalizableTag(element) {
3627
+ let current = element.parent;
3628
+ while (current && current.type === "tag") {
3629
+ if (UNLOCALIZABLE_TAGS.has(current.name.toLowerCase())) {
3630
+ return true;
3536
3631
  }
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);
3632
+ current = current.parent;
3633
+ }
3634
+ return false;
3635
+ }
3636
+ function hasTranslatableContent(element) {
3637
+ const text = domutils.textContent(element);
3638
+ return text.trim().length > 0;
3639
+ }
3640
+ function isLeafBlock(element) {
3641
+ const childElements = element.children.filter(
3642
+ (child) => child.type === "tag"
3643
+ );
3644
+ for (const child of childElements) {
3645
+ if (BLOCK_ELEMENTS.has(child.name.toLowerCase())) {
3646
+ return false;
3543
3647
  }
3544
- current = parent;
3545
3648
  }
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;
3649
+ return hasTranslatableContent(element);
3650
+ }
3651
+ function getInnerHTML(element) {
3652
+ return element.children.map((child) => DomSerializer.default(child, { encodeEntities: false })).join("");
3653
+ }
3654
+ function extractAttributes(element, path19) {
3655
+ const tagName = element.name.toLowerCase();
3656
+ const attrs = LOCALIZABLE_ATTRIBUTES[tagName];
3657
+ if (!attrs) return;
3658
+ for (const attr of attrs) {
3659
+ const value = _optionalChain([element, 'access', _143 => _143.attribs, 'optionalAccess', _144 => _144[attr]]);
3660
+ if (value && value.trim()) {
3661
+ result[`${path19}#${attr}`] = value.trim();
3554
3662
  }
3555
- parent = parent.parentElement;
3556
3663
  }
3557
- if (node.nodeType === 3) {
3558
- const text = node.textContent || "";
3559
- const normalizedText = normalizeTextContent(text, true);
3560
- if (normalizedText) {
3561
- result[getPath(node)] = normalizedText;
3664
+ }
3665
+ function extractFromElement(element, pathParts) {
3666
+ const path19 = pathParts.join("/");
3667
+ if (isInsideUnlocalizableTag(element)) {
3668
+ return;
3669
+ }
3670
+ extractAttributes(element, path19);
3671
+ const tagName = element.name.toLowerCase();
3672
+ if (BLOCK_ELEMENTS.has(tagName) && isLeafBlock(element)) {
3673
+ const content = getInnerHTML(element).trim();
3674
+ if (content) {
3675
+ result[path19] = content;
3562
3676
  }
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);
3677
+ return;
3576
3678
  }
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);
3679
+ if (PHRASING_ELEMENTS.has(tagName) && hasTranslatableContent(element)) {
3680
+ const content = getInnerHTML(element).trim();
3681
+ if (content) {
3682
+ result[path19] = content;
3683
+ }
3684
+ return;
3685
+ }
3686
+ let childIndex = 0;
3687
+ const childElements = element.children.filter(
3688
+ (child) => child.type === "tag"
3689
+ );
3690
+ for (const child of childElements) {
3691
+ extractFromElement(child, [...pathParts, childIndex++]);
3692
+ }
3693
+ }
3694
+ const html = domutils.findOne(
3695
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
3696
+ dom,
3697
+ true
3698
+ );
3699
+ if (html) {
3700
+ const head = domutils.findOne(
3701
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
3702
+ html.children,
3703
+ true
3704
+ );
3705
+ const body = domutils.findOne(
3706
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
3707
+ html.children,
3708
+ true
3709
+ );
3710
+ if (head) {
3711
+ let headIndex = 0;
3712
+ const headChildren = head.children.filter(
3713
+ (child) => child.type === "tag"
3714
+ );
3715
+ for (const child of headChildren) {
3716
+ extractFromElement(child, ["head", headIndex++]);
3717
+ }
3718
+ }
3719
+ if (body) {
3720
+ let bodyIndex = 0;
3721
+ const bodyChildren = body.children.filter(
3722
+ (child) => child.type === "tag"
3723
+ );
3724
+ for (const child of bodyChildren) {
3725
+ extractFromElement(child, ["body", bodyIndex++]);
3726
+ }
3727
+ }
3728
+ } else {
3729
+ let rootIndex = 0;
3730
+ const rootElements = dom.filter(
3731
+ (child) => child.type === "tag"
3732
+ );
3733
+ for (const child of rootElements) {
3734
+ extractFromElement(child, [rootIndex++]);
3735
+ }
3736
+ }
3584
3737
  return result;
3585
3738
  },
3586
3739
  async push(locale, data, originalInput) {
3587
- const dom = new (0, _jsdom.JSDOM)(
3740
+ const handler = new (0, _domhandler.DomHandler)();
3741
+ const parser = new htmlparser2.Parser(handler, {
3742
+ lowerCaseTags: false,
3743
+ lowerCaseAttributeNames: false
3744
+ });
3745
+ parser.write(
3588
3746
  _nullishCoalesce(originalInput, () => ( "<!DOCTYPE html><html><head></head><body></body></html>"))
3589
3747
  );
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()])
3748
+ parser.end();
3749
+ const dom = handler.dom;
3750
+ const html = domutils.findOne(
3751
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
3752
+ dom,
3753
+ true
3754
+ );
3755
+ if (html) {
3756
+ html.attribs = html.attribs || {};
3757
+ html.attribs.lang = locale;
3758
+ }
3759
+ function traverseByIndices(element, indices) {
3760
+ let current = element;
3761
+ for (const indexStr of indices) {
3762
+ if (!current) return null;
3763
+ const index = parseInt(indexStr, 10);
3764
+ const children = current.children.filter(
3765
+ (child) => child.type === "tag"
3608
3766
  );
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
- }
3767
+ if (index >= children.length) {
3768
+ return null;
3625
3769
  }
3770
+ current = children[index];
3771
+ }
3772
+ return current;
3773
+ }
3774
+ function resolvePathToElement(path19) {
3775
+ const parts = path19.split("/");
3776
+ const [rootTag, ...indices] = parts;
3777
+ let current = null;
3778
+ if (html) {
3779
+ if (rootTag === "head") {
3780
+ current = domutils.findOne(
3781
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
3782
+ html.children,
3783
+ true
3784
+ );
3785
+ } else if (rootTag === "body") {
3786
+ current = domutils.findOne(
3787
+ (elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
3788
+ html.children,
3789
+ true
3790
+ );
3791
+ }
3792
+ if (!current) return null;
3793
+ return traverseByIndices(current, indices);
3794
+ } else {
3795
+ const rootElements = dom.filter(
3796
+ (child) => child.type === "tag"
3797
+ );
3798
+ const rootIndex = parseInt(rootTag, 10);
3799
+ if (rootIndex >= rootElements.length) {
3800
+ return null;
3801
+ }
3802
+ current = rootElements[rootIndex];
3803
+ return traverseByIndices(current, indices);
3626
3804
  }
3627
- if (current) {
3628
- if (attribute) {
3629
- current.setAttribute(attribute, value);
3805
+ }
3806
+ for (const [path19, value] of Object.entries(data)) {
3807
+ const [nodePath, attribute] = path19.split("#");
3808
+ const element = resolvePathToElement(nodePath);
3809
+ if (!element) {
3810
+ console.warn(`Path not found in original HTML: ${nodePath}`);
3811
+ continue;
3812
+ }
3813
+ if (attribute) {
3814
+ element.attribs = element.attribs || {};
3815
+ element.attribs[attribute] = value;
3816
+ } else {
3817
+ if (value) {
3818
+ const valueHandler = new (0, _domhandler.DomHandler)();
3819
+ const valueParser = new htmlparser2.Parser(valueHandler);
3820
+ valueParser.write(value);
3821
+ valueParser.end();
3822
+ element.children = valueHandler.dom;
3630
3823
  } else {
3631
- current.textContent = value;
3824
+ element.children = [];
3632
3825
  }
3633
3826
  }
3634
- });
3635
- return dom.serialize();
3827
+ }
3828
+ return DomSerializer.default(dom, { encodeEntities: false });
3636
3829
  }
3637
3830
  });
3638
3831
  }
@@ -3655,7 +3848,7 @@ function createMarkdownLoader() {
3655
3848
  yaml: yamlEngine
3656
3849
  }
3657
3850
  });
3658
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]), () => ( ""))).filter(Boolean);
3851
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""))).filter(Boolean);
3659
3852
  return {
3660
3853
  ...Object.fromEntries(
3661
3854
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -3674,7 +3867,7 @@ function createMarkdownLoader() {
3674
3867
  );
3675
3868
  let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
3676
3869
  ([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");
3870
+ ).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()]), () => ( ""))).filter(Boolean).join("\n\n");
3678
3871
  if (Object.keys(frontmatter).length > 0) {
3679
3872
  content = `
3680
3873
  ${content}`;
@@ -3699,7 +3892,7 @@ function createMarkdocLoader() {
3699
3892
  const result = {};
3700
3893
  const counters = {};
3701
3894
  traverseAndExtract(ast, "", result, counters);
3702
- if (_optionalChain([ast, 'access', _162 => _162.attributes, 'optionalAccess', _163 => _163.frontmatter])) {
3895
+ if (_optionalChain([ast, 'access', _149 => _149.attributes, 'optionalAccess', _150 => _150.frontmatter])) {
3703
3896
  const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
3704
3897
  Object.entries(frontmatter).forEach(([key, value]) => {
3705
3898
  if (typeof value === "string") {
@@ -3745,7 +3938,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
3745
3938
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3746
3939
  semanticType = nodeSemanticType;
3747
3940
  }
3748
- if (node.type === "text" && _optionalChain([node, 'access', _164 => _164.attributes, 'optionalAccess', _165 => _165.content])) {
3941
+ if (node.type === "text" && _optionalChain([node, 'access', _151 => _151.attributes, 'optionalAccess', _152 => _152.content])) {
3749
3942
  const content = node.attributes.content;
3750
3943
  if (typeof content === "string" && content.trim()) {
3751
3944
  if (semanticType) {
@@ -3772,7 +3965,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
3772
3965
  if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
3773
3966
  semanticType = nodeSemanticType;
3774
3967
  }
3775
- if (node.type === "text" && _optionalChain([node, 'access', _166 => _166.attributes, 'optionalAccess', _167 => _167.content])) {
3968
+ if (node.type === "text" && _optionalChain([node, 'access', _153 => _153.attributes, 'optionalAccess', _154 => _154.content])) {
3776
3969
  const content = node.attributes.content;
3777
3970
  if (typeof content === "string" && content.trim()) {
3778
3971
  if (semanticType) {
@@ -3795,7 +3988,7 @@ function applyTranslations(node, path19, data, pathMap) {
3795
3988
  if (!node || typeof node !== "object") {
3796
3989
  return;
3797
3990
  }
3798
- if (node.type === "text" && _optionalChain([node, 'access', _168 => _168.attributes, 'optionalAccess', _169 => _169.content])) {
3991
+ if (node.type === "text" && _optionalChain([node, 'access', _155 => _155.attributes, 'optionalAccess', _156 => _156.content])) {
3799
3992
  const content = node.attributes.content;
3800
3993
  if (typeof content === "string") {
3801
3994
  const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
@@ -3845,7 +4038,7 @@ function isSkippableLine(line) {
3845
4038
  function parsePropertyLine(line) {
3846
4039
  const [key, ...valueParts] = line.split("=");
3847
4040
  return {
3848
- key: _optionalChain([key, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || "",
4041
+ key: _optionalChain([key, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]) || "",
3849
4042
  value: valueParts.join("=").trim()
3850
4043
  };
3851
4044
  }
@@ -4078,7 +4271,7 @@ function escapeString(str) {
4078
4271
  }
4079
4272
 
4080
4273
  // src/cli/loaders/xcode-strings/parser.ts
4081
- var Parser = class {
4274
+ var Parser2 = class {
4082
4275
 
4083
4276
 
4084
4277
  constructor(tokens) {
@@ -4137,7 +4330,7 @@ var Parser = class {
4137
4330
  }
4138
4331
  }
4139
4332
  expect(type) {
4140
- if (_optionalChain([this, 'access', _172 => _172.current, 'call', _173 => _173(), 'optionalAccess', _174 => _174.type]) === type) {
4333
+ if (_optionalChain([this, 'access', _159 => _159.current, 'call', _160 => _160(), 'optionalAccess', _161 => _161.type]) === type) {
4141
4334
  this.advance();
4142
4335
  return true;
4143
4336
  }
@@ -4151,7 +4344,7 @@ function createXcodeStringsLoader() {
4151
4344
  async pull(locale, input2) {
4152
4345
  const tokenizer = new Tokenizer(input2);
4153
4346
  const tokens = tokenizer.tokenize();
4154
- const parser = new Parser(tokens);
4347
+ const parser = new Parser2(tokens);
4155
4348
  const result = parser.parse();
4156
4349
  return result;
4157
4350
  },
@@ -4214,7 +4407,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4214
4407
  if (rootTranslationEntity.shouldTranslate === false) {
4215
4408
  continue;
4216
4409
  }
4217
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]]);
4410
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _162 => _162.localizations, 'optionalAccess', _163 => _163[locale]]);
4218
4411
  if (langTranslationEntity) {
4219
4412
  if ("stringUnit" in langTranslationEntity) {
4220
4413
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -4228,7 +4421,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4228
4421
  resultData[translationKey] = {};
4229
4422
  const pluralForms = langTranslationEntity.variations.plural;
4230
4423
  for (const form in pluralForms) {
4231
- if (_optionalChain([pluralForms, 'access', _177 => _177[form], 'optionalAccess', _178 => _178.stringUnit, 'optionalAccess', _179 => _179.value])) {
4424
+ if (_optionalChain([pluralForms, 'access', _164 => _164[form], 'optionalAccess', _165 => _165.stringUnit, 'optionalAccess', _166 => _166.value])) {
4232
4425
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
4233
4426
  }
4234
4427
  }
@@ -4254,7 +4447,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4254
4447
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
4255
4448
  if (typeof value === "string") {
4256
4449
  langDataToMerge.strings[key] = {
4257
- extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
4450
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _167 => _167.strings, 'optionalAccess', _168 => _168[key], 'optionalAccess', _169 => _169.extractionState]),
4258
4451
  localizations: {
4259
4452
  [locale]: {
4260
4453
  stringUnit: {
@@ -4269,7 +4462,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4269
4462
  }
4270
4463
  } else if (Array.isArray(value)) {
4271
4464
  langDataToMerge.strings[key] = {
4272
- extractionState: _optionalChain([originalInput, 'optionalAccess', _183 => _183.strings, 'optionalAccess', _184 => _184[key], 'optionalAccess', _185 => _185.extractionState]),
4465
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _170 => _170.strings, 'optionalAccess', _171 => _171[key], 'optionalAccess', _172 => _172.extractionState]),
4273
4466
  localizations: {
4274
4467
  [locale]: {
4275
4468
  stringSet: {
@@ -4327,7 +4520,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
4327
4520
  for (const [locale, localization] of Object.entries(
4328
4521
  entity.localizations
4329
4522
  )) {
4330
- if (_optionalChain([localization, 'access', _186 => _186.variations, 'optionalAccess', _187 => _187.plural])) {
4523
+ if (_optionalChain([localization, 'access', _173 => _173.variations, 'optionalAccess', _174 => _174.plural])) {
4331
4524
  const pluralForms = localization.variations.plural;
4332
4525
  for (const form in pluralForms) {
4333
4526
  const pluralKey = `${translationKey}/${form}`;
@@ -4347,7 +4540,7 @@ function _removeLocale(input2, locale) {
4347
4540
  const { strings } = input2;
4348
4541
  const newStrings = _lodash2.default.cloneDeep(strings);
4349
4542
  for (const [key, value] of Object.entries(newStrings)) {
4350
- if (_optionalChain([value, 'access', _188 => _188.localizations, 'optionalAccess', _189 => _189[locale]])) {
4543
+ if (_optionalChain([value, 'access', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]])) {
4351
4544
  delete value.localizations[locale];
4352
4545
  }
4353
4546
  }
@@ -4478,7 +4671,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4478
4671
  if (rootTranslationEntity.shouldTranslate === false) {
4479
4672
  continue;
4480
4673
  }
4481
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _190 => _190.localizations, 'optionalAccess', _191 => _191[locale]]);
4674
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _177 => _177.localizations, 'optionalAccess', _178 => _178[locale]]);
4482
4675
  if (langTranslationEntity) {
4483
4676
  if (!resultData[translationKey]) {
4484
4677
  resultData[translationKey] = {};
@@ -4490,7 +4683,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4490
4683
  for (const [subName, subData] of Object.entries(
4491
4684
  langTranslationEntity.substitutions
4492
4685
  )) {
4493
- const pluralForms = _optionalChain([subData, 'access', _192 => _192.variations, 'optionalAccess', _193 => _193.plural]);
4686
+ const pluralForms = _optionalChain([subData, 'access', _179 => _179.variations, 'optionalAccess', _180 => _180.plural]);
4494
4687
  if (pluralForms) {
4495
4688
  const forms = {};
4496
4689
  for (const [form, formData] of Object.entries(pluralForms)) {
@@ -4515,7 +4708,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4515
4708
  const pluralForms = langTranslationEntity.variations.plural;
4516
4709
  const forms = {};
4517
4710
  for (const [form, formData] of Object.entries(pluralForms)) {
4518
- if (_optionalChain([formData, 'optionalAccess', _194 => _194.stringUnit, 'optionalAccess', _195 => _195.value])) {
4711
+ if (_optionalChain([formData, 'optionalAccess', _181 => _181.stringUnit, 'optionalAccess', _182 => _182.value])) {
4519
4712
  forms[form] = formData.stringUnit.value;
4520
4713
  }
4521
4714
  }
@@ -4558,7 +4751,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4558
4751
  for (const [subName, subData] of Object.entries(
4559
4752
  keyData.substitutions
4560
4753
  )) {
4561
- const pluralValue = _optionalChain([subData, 'optionalAccess', _196 => _196.variations, 'optionalAccess', _197 => _197.plural]);
4754
+ const pluralValue = _optionalChain([subData, 'optionalAccess', _183 => _183.variations, 'optionalAccess', _184 => _184.plural]);
4562
4755
  if (pluralValue && isIcuPluralString(pluralValue)) {
4563
4756
  try {
4564
4757
  const pluralForms = parseIcuPluralString(pluralValue, locale);
@@ -4571,8 +4764,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
4571
4764
  }
4572
4765
  };
4573
4766
  }
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;
4767
+ const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _185 => _185.sourceLanguage]) || "en";
4768
+ 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
4769
  subs[subName] = {
4577
4770
  formatSpecifier: origFormatSpec,
4578
4771
  variations: {
@@ -4597,7 +4790,7 @@ ${error instanceof Error ? error.message : String(error)}`
4597
4790
  values: keyData.stringSet
4598
4791
  };
4599
4792
  }
4600
- if ("variations" in keyData && _optionalChain([keyData, 'access', _206 => _206.variations, 'optionalAccess', _207 => _207.plural])) {
4793
+ if ("variations" in keyData && _optionalChain([keyData, 'access', _193 => _193.variations, 'optionalAccess', _194 => _194.plural])) {
4601
4794
  const pluralValue = keyData.variations.plural;
4602
4795
  if (isIcuPluralString(pluralValue)) {
4603
4796
  try {
@@ -4624,7 +4817,7 @@ ${error instanceof Error ? error.message : String(error)}`
4624
4817
  }
4625
4818
  if (Object.keys(localizationData).length > 0) {
4626
4819
  langDataToMerge.strings[baseKey] = {
4627
- extractionState: _optionalChain([originalInput, 'optionalAccess', _208 => _208.strings, 'optionalAccess', _209 => _209[baseKey], 'optionalAccess', _210 => _210.extractionState]),
4820
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _195 => _195.strings, 'optionalAccess', _196 => _196[baseKey], 'optionalAccess', _197 => _197.extractionState]),
4628
4821
  localizations: {
4629
4822
  [locale]: localizationData
4630
4823
  }
@@ -4847,8 +5040,8 @@ async function formatDataWithBiome(data, filePath, options) {
4847
5040
  });
4848
5041
  return formatted.content;
4849
5042
  } 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")])) {
5043
+ 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]]) : "";
5044
+ if (_optionalChain([errorMessage, 'optionalAccess', _204 => _204.includes, 'call', _205 => _205("does not exist in the workspace")])) {
4852
5045
  } else {
4853
5046
  console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
4854
5047
  if (errorMessage) {
@@ -4895,7 +5088,7 @@ function createPoDataLoader(params) {
4895
5088
  Object.entries(entries).forEach(([msgid, entry]) => {
4896
5089
  if (msgid && entry.msgid) {
4897
5090
  const context = entry.msgctxt || "";
4898
- const fullEntry = _optionalChain([parsedPo, 'access', _219 => _219.translations, 'access', _220 => _220[context], 'optionalAccess', _221 => _221[msgid]]);
5091
+ const fullEntry = _optionalChain([parsedPo, 'access', _206 => _206.translations, 'access', _207 => _207[context], 'optionalAccess', _208 => _208[msgid]]);
4899
5092
  if (fullEntry) {
4900
5093
  result[msgid] = fullEntry;
4901
5094
  }
@@ -4905,8 +5098,8 @@ function createPoDataLoader(params) {
4905
5098
  return result;
4906
5099
  },
4907
5100
  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)]) || [];
5101
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _209 => _209.split, 'call', _210 => _210("\n\n"), 'access', _211 => _211.filter, 'call', _212 => _212(Boolean)]) || [];
5102
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _213 => _213.split, 'call', _214 => _214("\n\n"), 'access', _215 => _215.filter, 'call', _216 => _216(Boolean)]) || [];
4910
5103
  const result = originalSections.map((section) => {
4911
5104
  const sectionPo = _gettextparser2.default.po.parse(section);
4912
5105
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -4975,8 +5168,8 @@ function createPoContentLoader() {
4975
5168
  {
4976
5169
  ...entry,
4977
5170
  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
5171
+ _optionalChain([data, 'access', _217 => _217[entry.msgid], 'optionalAccess', _218 => _218.singular]),
5172
+ _optionalChain([data, 'access', _219 => _219[entry.msgid], 'optionalAccess', _220 => _220.plural]) || null
4980
5173
  ].filter(Boolean)
4981
5174
  }
4982
5175
  ]).fromPairs().value();
@@ -5015,7 +5208,7 @@ function preserveCommentOrder(section, originalSection) {
5015
5208
  }
5016
5209
 
5017
5210
  // src/cli/loaders/xliff.ts
5018
-
5211
+ var _jsdom = require('jsdom');
5019
5212
  function createXliffLoader() {
5020
5213
  return createLoader({
5021
5214
  async pull(locale, input2, _ctx, originalLocale) {
@@ -5098,7 +5291,7 @@ function pullV1(xliffElement, locale, originalLocale) {
5098
5291
  let key = getTransUnitKey(unit);
5099
5292
  if (!key) return;
5100
5293
  if (seenKeys.has(key)) {
5101
- const id = _optionalChain([unit, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
5294
+ const id = _optionalChain([unit, 'access', _221 => _221.getAttribute, 'call', _222 => _222("id"), 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]);
5102
5295
  if (id) {
5103
5296
  key = `${key}#${id}`;
5104
5297
  } else {
@@ -5146,7 +5339,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5146
5339
  let key = getTransUnitKey(unit);
5147
5340
  if (!key) return;
5148
5341
  if (seenKeys.has(key)) {
5149
- const id = _optionalChain([unit, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5342
+ const id = _optionalChain([unit, 'access', _225 => _225.getAttribute, 'call', _226 => _226("id"), 'optionalAccess', _227 => _227.trim, 'call', _228 => _228()]);
5150
5343
  if (id) {
5151
5344
  key = `${key}#${id}`;
5152
5345
  } else {
@@ -5188,7 +5381,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
5188
5381
  const translationKeys = new Set(Object.keys(translations));
5189
5382
  existingUnits.forEach((unit, key) => {
5190
5383
  if (!translationKeys.has(key)) {
5191
- _optionalChain([unit, 'access', _242 => _242.parentNode, 'optionalAccess', _243 => _243.removeChild, 'call', _244 => _244(unit)]);
5384
+ _optionalChain([unit, 'access', _229 => _229.parentNode, 'optionalAccess', _230 => _230.removeChild, 'call', _231 => _231(unit)]);
5192
5385
  }
5193
5386
  });
5194
5387
  return serializeWithDeclaration(
@@ -5231,18 +5424,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
5231
5424
  Array.from(container.children).forEach((child) => {
5232
5425
  const tagName = child.tagName;
5233
5426
  if (tagName === "unit") {
5234
- const unitId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
5427
+ const unitId = _optionalChain([child, 'access', _232 => _232.getAttribute, 'call', _233 => _233("id"), 'optionalAccess', _234 => _234.trim, 'call', _235 => _235()]);
5235
5428
  if (!unitId) return;
5236
5429
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5237
5430
  const segment = child.querySelector("segment");
5238
- const source = _optionalChain([segment, 'optionalAccess', _249 => _249.querySelector, 'call', _250 => _250("source")]);
5431
+ const source = _optionalChain([segment, 'optionalAccess', _236 => _236.querySelector, 'call', _237 => _237("source")]);
5239
5432
  if (source) {
5240
5433
  result[key] = extractTextContent(source);
5241
5434
  } else {
5242
5435
  result[key] = unitId;
5243
5436
  }
5244
5437
  } else if (tagName === "group") {
5245
- const groupId = _optionalChain([child, 'access', _251 => _251.getAttribute, 'call', _252 => _252("id"), 'optionalAccess', _253 => _253.trim, 'call', _254 => _254()]);
5438
+ const groupId = _optionalChain([child, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
5246
5439
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5247
5440
  traverseUnitsV2(child, fileId, newPath, result);
5248
5441
  }
@@ -5278,12 +5471,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
5278
5471
  Array.from(container.children).forEach((child) => {
5279
5472
  const tagName = child.tagName;
5280
5473
  if (tagName === "unit") {
5281
- const unitId = _optionalChain([child, 'access', _255 => _255.getAttribute, 'call', _256 => _256("id"), 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]);
5474
+ const unitId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
5282
5475
  if (!unitId) return;
5283
5476
  const key = `resources/${fileId}/${currentPath}${unitId}/source`;
5284
5477
  index.set(key, child);
5285
5478
  } else if (tagName === "group") {
5286
- const groupId = _optionalChain([child, 'access', _259 => _259.getAttribute, 'call', _260 => _260("id"), 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]);
5479
+ const groupId = _optionalChain([child, 'access', _246 => _246.getAttribute, 'call', _247 => _247("id"), 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]);
5287
5480
  const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
5288
5481
  indexUnitsV2(child, fileId, newPath, index);
5289
5482
  }
@@ -5304,9 +5497,9 @@ function updateUnitV2(unit, value) {
5304
5497
  setTextContent(source, value);
5305
5498
  }
5306
5499
  function getTransUnitKey(transUnit) {
5307
- const resname = _optionalChain([transUnit, 'access', _263 => _263.getAttribute, 'call', _264 => _264("resname"), 'optionalAccess', _265 => _265.trim, 'call', _266 => _266()]);
5500
+ const resname = _optionalChain([transUnit, 'access', _250 => _250.getAttribute, 'call', _251 => _251("resname"), 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]);
5308
5501
  if (resname) return resname;
5309
- const id = _optionalChain([transUnit, 'access', _267 => _267.getAttribute, 'call', _268 => _268("id"), 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]);
5502
+ const id = _optionalChain([transUnit, 'access', _254 => _254.getAttribute, 'call', _255 => _255("id"), 'optionalAccess', _256 => _256.trim, 'call', _257 => _257()]);
5310
5503
  if (id) return id;
5311
5504
  const sourceElement = transUnit.querySelector("source");
5312
5505
  if (sourceElement) {
@@ -5363,10 +5556,10 @@ function formatXml(xml) {
5363
5556
  if (cdataNode) {
5364
5557
  return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
5365
5558
  }
5366
- const textContent = _optionalChain([element, 'access', _271 => _271.textContent, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || "";
5559
+ const textContent2 = _optionalChain([element, 'access', _258 => _258.textContent, 'optionalAccess', _259 => _259.trim, 'call', _260 => _260()]) || "";
5367
5560
  const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
5368
- if (hasOnlyText && textContent) {
5369
- return `${indent2}${openTag}${textContent}</${tagName}>`;
5561
+ if (hasOnlyText && textContent2) {
5562
+ return `${indent2}${openTag}${textContent2}</${tagName}>`;
5370
5563
  }
5371
5564
  const children = Array.from(element.children);
5372
5565
  if (children.length === 0) {
@@ -5656,7 +5849,7 @@ function createDatoClient(params) {
5656
5849
  ids: !records.length ? void 0 : records.join(",")
5657
5850
  }
5658
5851
  }).catch(
5659
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _274 => _274.response, 'optionalAccess', _275 => _275.body, 'optionalAccess', _276 => _276.data, 'optionalAccess', _277 => _277[0]]) || error)
5852
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _261 => _261.response, 'optionalAccess', _262 => _262.body, 'optionalAccess', _263 => _263.data, 'optionalAccess', _264 => _264[0]]) || error)
5660
5853
  );
5661
5854
  },
5662
5855
  findRecordsForModel: async (modelId, records) => {
@@ -5667,10 +5860,10 @@ function createDatoClient(params) {
5667
5860
  filter: {
5668
5861
  type: modelId,
5669
5862
  only_valid: "true",
5670
- ids: !_optionalChain([records, 'optionalAccess', _278 => _278.length]) ? void 0 : records.join(",")
5863
+ ids: !_optionalChain([records, 'optionalAccess', _265 => _265.length]) ? void 0 : records.join(",")
5671
5864
  }
5672
5865
  }).catch(
5673
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _279 => _279.response, 'optionalAccess', _280 => _280.body, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282[0]]) || error)
5866
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _266 => _266.response, 'optionalAccess', _267 => _267.body, 'optionalAccess', _268 => _268.data, 'optionalAccess', _269 => _269[0]]) || error)
5674
5867
  );
5675
5868
  return result;
5676
5869
  } catch (_error) {
@@ -5686,10 +5879,10 @@ function createDatoClient(params) {
5686
5879
  updateRecord: async (id, payload) => {
5687
5880
  try {
5688
5881
  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)
5882
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _270 => _270.response, 'optionalAccess', _271 => _271.body, 'optionalAccess', _272 => _272.data, 'optionalAccess', _273 => _273[0]]) || error)
5690
5883
  );
5691
5884
  } catch (_error) {
5692
- if (_optionalChain([_error, 'optionalAccess', _287 => _287.attributes, 'optionalAccess', _288 => _288.details, 'optionalAccess', _289 => _289.message])) {
5885
+ if (_optionalChain([_error, 'optionalAccess', _274 => _274.attributes, 'optionalAccess', _275 => _275.details, 'optionalAccess', _276 => _276.message])) {
5693
5886
  throw new Error(
5694
5887
  [
5695
5888
  `${_error.attributes.details.message}`,
@@ -5711,10 +5904,10 @@ function createDatoClient(params) {
5711
5904
  enableFieldLocalization: async (args) => {
5712
5905
  try {
5713
5906
  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)
5907
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _277 => _277.response, 'optionalAccess', _278 => _278.body, 'optionalAccess', _279 => _279.data, 'optionalAccess', _280 => _280[0]]) || error)
5715
5908
  );
5716
5909
  } catch (_error) {
5717
- if (_optionalChain([_error, 'optionalAccess', _294 => _294.attributes, 'optionalAccess', _295 => _295.code]) === "NOT_FOUND") {
5910
+ if (_optionalChain([_error, 'optionalAccess', _281 => _281.attributes, 'optionalAccess', _282 => _282.code]) === "NOT_FOUND") {
5718
5911
  throw new Error(
5719
5912
  [
5720
5913
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -5722,7 +5915,7 @@ function createDatoClient(params) {
5722
5915
  ].join("\n\n")
5723
5916
  );
5724
5917
  }
5725
- if (_optionalChain([_error, 'optionalAccess', _296 => _296.attributes, 'optionalAccess', _297 => _297.details, 'optionalAccess', _298 => _298.message])) {
5918
+ if (_optionalChain([_error, 'optionalAccess', _283 => _283.attributes, 'optionalAccess', _284 => _284.details, 'optionalAccess', _285 => _285.message])) {
5726
5919
  throw new Error(
5727
5920
  [
5728
5921
  `${_error.attributes.details.message}`,
@@ -5800,7 +5993,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
5800
5993
  const records = await dato.findRecordsForModel(modelId);
5801
5994
  const recordChoices = createRecordChoices(
5802
5995
  records,
5803
- _optionalChain([config, 'access', _299 => _299.models, 'access', _300 => _300[modelId], 'optionalAccess', _301 => _301.records]) || [],
5996
+ _optionalChain([config, 'access', _286 => _286.models, 'access', _287 => _287[modelId], 'optionalAccess', _288 => _288.records]) || [],
5804
5997
  project
5805
5998
  );
5806
5999
  const selectedRecords = await promptRecordSelection(
@@ -5819,14 +6012,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
5819
6012
  },
5820
6013
  async pull(locale, input2, initCtx) {
5821
6014
  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]) || [];
6015
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _289 => _289.models]) || {})) {
6016
+ let records = _optionalChain([initCtx, 'optionalAccess', _290 => _290.models, 'access', _291 => _291[modelId], 'access', _292 => _292.records]) || [];
5824
6017
  const recordIds = records.map((record) => record.id);
5825
6018
  records = await dato.findRecords(recordIds);
5826
6019
  console.log(`Fetched ${records.length} records for model ${modelId}`);
5827
6020
  if (records.length > 0) {
5828
6021
  result[modelId] = {
5829
- fields: _optionalChain([initCtx, 'optionalAccess', _306 => _306.models, 'optionalAccess', _307 => _307[modelId], 'optionalAccess', _308 => _308.fields]) || [],
6022
+ fields: _optionalChain([initCtx, 'optionalAccess', _293 => _293.models, 'optionalAccess', _294 => _294[modelId], 'optionalAccess', _295 => _295.fields]) || [],
5830
6023
  records
5831
6024
  };
5832
6025
  }
@@ -5889,7 +6082,7 @@ function createRecordChoices(records, selectedIds = [], project) {
5889
6082
  return records.map((record) => ({
5890
6083
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
5891
6084
  value: record.id,
5892
- checked: _optionalChain([selectedIds, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(record.id)])
6085
+ checked: _optionalChain([selectedIds, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(record.id)])
5893
6086
  }));
5894
6087
  }
5895
6088
  async function promptRecordSelection(modelName, choices) {
@@ -6208,7 +6401,7 @@ function createVttLoader() {
6208
6401
  if (!input2) {
6209
6402
  return "";
6210
6403
  }
6211
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _311 => _311.parse, 'call', _312 => _312(input2), 'optionalAccess', _313 => _313.cues]);
6404
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _298 => _298.parse, 'call', _299 => _299(input2), 'optionalAccess', _300 => _300.cues]);
6212
6405
  if (Object.keys(vtt).length === 0) {
6213
6406
  return {};
6214
6407
  } else {
@@ -6262,7 +6455,7 @@ function variableExtractLoader(params) {
6262
6455
  for (let i = 0; i < matches.length; i++) {
6263
6456
  const match2 = matches[i];
6264
6457
  const currentValue = result[key].value;
6265
- const newValue = _optionalChain([currentValue, 'optionalAccess', _314 => _314.replace, 'call', _315 => _315(match2, `{variable:${i}}`)]);
6458
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _301 => _301.replace, 'call', _302 => _302(match2, `{variable:${i}}`)]);
6266
6459
  result[key].value = newValue;
6267
6460
  result[key].variables[i] = match2;
6268
6461
  }
@@ -6277,7 +6470,7 @@ function variableExtractLoader(params) {
6277
6470
  const variable = valueObj.variables[i];
6278
6471
  const currentValue = result[key];
6279
6472
  if (typeof currentValue === "string") {
6280
- const newValue = _optionalChain([currentValue, 'optionalAccess', _316 => _316.replaceAll, 'call', _317 => _317(
6473
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _303 => _303.replaceAll, 'call', _304 => _304(
6281
6474
  `{variable:${i}}`,
6282
6475
  variable
6283
6476
  )]);
@@ -6481,7 +6674,7 @@ function createVueJsonLoader() {
6481
6674
  return createLoader({
6482
6675
  pull: async (locale, input2, ctx) => {
6483
6676
  const parsed = parseVueFile(input2);
6484
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _318 => _318.i18n, 'optionalAccess', _319 => _319[locale]]), () => ( {}));
6677
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _305 => _305.i18n, 'optionalAccess', _306 => _306[locale]]), () => ( {}));
6485
6678
  },
6486
6679
  push: async (locale, data, originalInput) => {
6487
6680
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -6666,7 +6859,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
6666
6859
  objectExpression.properties.forEach((prop) => {
6667
6860
  if (!t.isObjectProperty(prop)) return;
6668
6861
  const key = getPropertyKey(prop);
6669
- const incomingVal = _optionalChain([data, 'optionalAccess', _320 => _320[key]]);
6862
+ const incomingVal = _optionalChain([data, 'optionalAccess', _307 => _307[key]]);
6670
6863
  if (incomingVal === void 0) {
6671
6864
  return;
6672
6865
  }
@@ -6702,7 +6895,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
6702
6895
  let modified = false;
6703
6896
  arrayExpression.elements.forEach((element, index) => {
6704
6897
  if (!element) return;
6705
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _321 => _321[index]]);
6898
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _308 => _308[index]]);
6706
6899
  if (incomingVal === void 0) return;
6707
6900
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
6708
6901
  if (element.value !== incomingVal) {
@@ -7196,7 +7389,7 @@ var AST = class _AST {
7196
7389
  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
7390
  if (this.isStart() && !this.type)
7198
7391
  ret.unshift([]);
7199
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!")) {
7392
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.type]) === "!")) {
7200
7393
  ret.push({});
7201
7394
  }
7202
7395
  return ret;
@@ -7204,7 +7397,7 @@ var AST = class _AST {
7204
7397
  isStart() {
7205
7398
  if (this.#root === this)
7206
7399
  return true;
7207
- if (!_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.isStart, 'call', _326 => _326()]))
7400
+ if (!_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.isStart, 'call', _313 => _313()]))
7208
7401
  return false;
7209
7402
  if (this.#parentIndex === 0)
7210
7403
  return true;
@@ -7220,12 +7413,12 @@ var AST = class _AST {
7220
7413
  isEnd() {
7221
7414
  if (this.#root === this)
7222
7415
  return true;
7223
- if (_optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")
7416
+ if (_optionalChain([this, 'access', _314 => _314.#parent, 'optionalAccess', _315 => _315.type]) === "!")
7224
7417
  return true;
7225
- if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]))
7418
+ if (!_optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]))
7226
7419
  return false;
7227
7420
  if (!this.type)
7228
- return _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.isEnd, 'call', _334 => _334()]);
7421
+ return _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.isEnd, 'call', _321 => _321()]);
7229
7422
  const pl = this.#parent ? this.#parent.#parts.length : 0;
7230
7423
  return this.#parentIndex === pl - 1;
7231
7424
  }
@@ -7470,7 +7663,7 @@ var AST = class _AST {
7470
7663
  }
7471
7664
  }
7472
7665
  let end = "";
7473
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _335 => _335.#parent, 'optionalAccess', _336 => _336.type]) === "!") {
7666
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!") {
7474
7667
  end = "(?:$|\\/)";
7475
7668
  }
7476
7669
  const final2 = start2 + src + end;
@@ -8571,7 +8764,7 @@ function createMdxSectionsSplit2Loader() {
8571
8764
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
8572
8765
  const result = {
8573
8766
  frontmatter: data.frontmatter,
8574
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _337 => _337.codePlaceholders]) || {},
8767
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _324 => _324.codePlaceholders]) || {},
8575
8768
  content
8576
8769
  };
8577
8770
  return result;
@@ -8686,14 +8879,14 @@ function parseEjsForTranslation(input2) {
8686
8879
  if (part.type === "ejs") {
8687
8880
  template += part.content;
8688
8881
  } else {
8689
- const textContent = part.content;
8882
+ const textContent2 = part.content;
8690
8883
  const htmlTagRegex = /<[^>]+>/g;
8691
8884
  const textParts = [];
8692
8885
  let lastTextIndex = 0;
8693
8886
  let htmlMatch;
8694
- while ((htmlMatch = htmlTagRegex.exec(textContent)) !== null) {
8887
+ while ((htmlMatch = htmlTagRegex.exec(textContent2)) !== null) {
8695
8888
  if (htmlMatch.index > lastTextIndex) {
8696
- const textBefore = textContent.slice(lastTextIndex, htmlMatch.index);
8889
+ const textBefore = textContent2.slice(lastTextIndex, htmlMatch.index);
8697
8890
  if (textBefore.trim()) {
8698
8891
  textParts.push({ type: "text", content: textBefore });
8699
8892
  } else {
@@ -8703,8 +8896,8 @@ function parseEjsForTranslation(input2) {
8703
8896
  textParts.push({ type: "html", content: htmlMatch[0] });
8704
8897
  lastTextIndex = htmlMatch.index + htmlMatch[0].length;
8705
8898
  }
8706
- if (lastTextIndex < textContent.length) {
8707
- const remainingText = textContent.slice(lastTextIndex);
8899
+ if (lastTextIndex < textContent2.length) {
8900
+ const remainingText = textContent2.slice(lastTextIndex);
8708
8901
  if (remainingText.trim()) {
8709
8902
  textParts.push({ type: "text", content: remainingText });
8710
8903
  } else {
@@ -8712,11 +8905,11 @@ function parseEjsForTranslation(input2) {
8712
8905
  }
8713
8906
  }
8714
8907
  if (textParts.length === 0) {
8715
- const trimmedContent = textContent.trim();
8908
+ const trimmedContent = textContent2.trim();
8716
8909
  if (trimmedContent) {
8717
- textParts.push({ type: "text", content: textContent });
8910
+ textParts.push({ type: "text", content: textContent2 });
8718
8911
  } else {
8719
- textParts.push({ type: "html", content: textContent });
8912
+ textParts.push({ type: "html", content: textContent2 });
8720
8913
  }
8721
8914
  }
8722
8915
  for (const textPart of textParts) {
@@ -9671,7 +9864,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
9671
9864
  ]
9672
9865
  });
9673
9866
  const result = JSON.parse(response.text);
9674
- return _optionalChain([result, 'optionalAccess', _338 => _338.data]) || {};
9867
+ return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
9675
9868
  }
9676
9869
  }
9677
9870
  function extractPayloadChunks(payload) {
@@ -9754,7 +9947,7 @@ function getPureModelProvider(provider) {
9754
9947
 
9755
9948
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
9756
9949
  `;
9757
- switch (_optionalChain([provider, 'optionalAccess', _339 => _339.id])) {
9950
+ switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
9758
9951
  case "openai": {
9759
9952
  if (!process.env.OPENAI_API_KEY) {
9760
9953
  throw new Error(
@@ -9812,7 +10005,7 @@ function getPureModelProvider(provider) {
9812
10005
  })(provider.model);
9813
10006
  }
9814
10007
  default: {
9815
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _340 => _340.id])));
10008
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
9816
10009
  }
9817
10010
  }
9818
10011
  }
@@ -10098,7 +10291,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10098
10291
  validateParams(i18nConfig, flags);
10099
10292
  ora.succeed("Localization configuration is valid");
10100
10293
  ora.start("Connecting to Lingo.dev Localization Engine...");
10101
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _341 => _341.provider]);
10294
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
10102
10295
  if (isByokMode) {
10103
10296
  authId = null;
10104
10297
  ora.succeed("Using external provider (BYOK mode)");
@@ -10112,16 +10305,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10112
10305
  flags
10113
10306
  });
10114
10307
  let buckets = getBuckets(i18nConfig);
10115
- if (_optionalChain([flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.length])) {
10308
+ if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
10116
10309
  buckets = buckets.filter(
10117
10310
  (bucket) => flags.bucket.includes(bucket.type)
10118
10311
  );
10119
10312
  }
10120
10313
  ora.succeed("Buckets retrieved");
10121
- if (_optionalChain([flags, 'access', _344 => _344.file, 'optionalAccess', _345 => _345.length])) {
10314
+ if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
10122
10315
  buckets = buckets.map((bucket) => {
10123
10316
  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)]))
10317
+ (path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
10125
10318
  );
10126
10319
  return { ...bucket, paths };
10127
10320
  }).filter((bucket) => bucket.paths.length > 0);
@@ -10142,7 +10335,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10142
10335
  });
10143
10336
  }
10144
10337
  }
10145
- const targetLocales = _optionalChain([flags, 'access', _349 => _349.locale, 'optionalAccess', _350 => _350.length]) ? flags.locale : i18nConfig.locale.targets;
10338
+ const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
10146
10339
  ora.start("Setting up localization cache...");
10147
10340
  const checkLockfileProcessor = createDeltaProcessor("");
10148
10341
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -10427,7 +10620,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
10427
10620
  }
10428
10621
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
10429
10622
  const checksums = await deltaProcessor.createChecksums(sourceData);
10430
- if (!_optionalChain([flags, 'access', _351 => _351.locale, 'optionalAccess', _352 => _352.length])) {
10623
+ if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
10431
10624
  await deltaProcessor.saveChecksums(checksums);
10432
10625
  }
10433
10626
  }
@@ -10551,12 +10744,12 @@ function validateParams(i18nConfig, flags) {
10551
10744
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
10552
10745
  docUrl: "bucketNotFound"
10553
10746
  });
10554
- } else if (_optionalChain([flags, 'access', _353 => _353.locale, 'optionalAccess', _354 => _354.some, 'call', _355 => _355((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10747
+ } else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10555
10748
  throw new ValidationError({
10556
10749
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
10557
10750
  docUrl: "localeTargetNotFound"
10558
10751
  });
10559
- } else if (_optionalChain([flags, 'access', _356 => _356.bucket, 'optionalAccess', _357 => _357.some, 'call', _358 => _358(
10752
+ } else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
10560
10753
  (bucket) => !i18nConfig.buckets[bucket]
10561
10754
  )])) {
10562
10755
  throw new ValidationError({
@@ -11090,7 +11283,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
11090
11283
  const response = await engine.whoami();
11091
11284
  return {
11092
11285
  authenticated: !!response,
11093
- username: _optionalChain([response, 'optionalAccess', _359 => _359.email])
11286
+ username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
11094
11287
  };
11095
11288
  } catch (error) {
11096
11289
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -11206,7 +11399,7 @@ function createExplicitLocalizer(provider) {
11206
11399
  }
11207
11400
  function createAiSdkLocalizer(params) {
11208
11401
  const skipAuth = params.skipAuth === true;
11209
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _360 => _360.apiKeyName]), () => ( ""))];
11402
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
11210
11403
  if (!skipAuth && !apiKey || !params.apiKeyName) {
11211
11404
  throw new Error(
11212
11405
  _dedent2.default`
@@ -11340,8 +11533,8 @@ async function setup(input2) {
11340
11533
  throw new Error(
11341
11534
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
11342
11535
  );
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]])
11536
+ } else if (_optionalChain([ctx, 'access', _348 => _348.flags, 'access', _349 => _349.bucket, 'optionalAccess', _350 => _350.some, 'call', _351 => _351(
11537
+ (bucket) => !_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.buckets, 'access', _354 => _354[bucket]])
11345
11538
  )])) {
11346
11539
  throw new Error(
11347
11540
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -11354,7 +11547,7 @@ async function setup(input2) {
11354
11547
  title: "Selecting localization provider",
11355
11548
  task: async (ctx, task) => {
11356
11549
  ctx.localizer = createLocalizer(
11357
- _optionalChain([ctx, 'access', _368 => _368.config, 'optionalAccess', _369 => _369.provider]),
11550
+ _optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
11358
11551
  ctx.flags.apiKey
11359
11552
  );
11360
11553
  if (!ctx.localizer) {
@@ -11367,7 +11560,7 @@ async function setup(input2) {
11367
11560
  },
11368
11561
  {
11369
11562
  title: "Checking authentication",
11370
- enabled: (ctx) => _optionalChain([ctx, 'access', _370 => _370.localizer, 'optionalAccess', _371 => _371.id]) === "Lingo.dev",
11563
+ enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
11371
11564
  task: async (ctx, task) => {
11372
11565
  const authStatus = await ctx.localizer.checkAuth();
11373
11566
  if (!authStatus.authenticated) {
@@ -11380,7 +11573,7 @@ async function setup(input2) {
11380
11573
  },
11381
11574
  {
11382
11575
  title: "Validating configuration",
11383
- enabled: (ctx) => _optionalChain([ctx, 'access', _372 => _372.localizer, 'optionalAccess', _373 => _373.id]) !== "Lingo.dev",
11576
+ enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
11384
11577
  task: async (ctx, task) => {
11385
11578
  const validationStatus = await ctx.localizer.validateSettings();
11386
11579
  if (!validationStatus.valid) {
@@ -11711,7 +11904,7 @@ function createWorkerTask(args) {
11711
11904
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
11712
11905
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
11713
11906
  ).filter(
11714
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _374 => _374.onlyKeys, 'optionalAccess', _375 => _375.some, 'call', _376 => _376(
11907
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
11715
11908
  (pattern) => minimatch(key, pattern)
11716
11909
  )])
11717
11910
  ).fromPairs().value();
@@ -11779,7 +11972,7 @@ function createWorkerTask(args) {
11779
11972
  finalRenamedTargetData
11780
11973
  );
11781
11974
  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])) {
11975
+ if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
11783
11976
  await deltaProcessor.saveChecksums(checksums);
11784
11977
  }
11785
11978
  });
@@ -11984,10 +12177,10 @@ var flagsSchema2 = _zod.z.object({
11984
12177
  async function frozen(input2) {
11985
12178
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
11986
12179
  let buckets = getBuckets(input2.config);
11987
- if (_optionalChain([input2, 'access', _381 => _381.flags, 'access', _382 => _382.bucket, 'optionalAccess', _383 => _383.length])) {
12180
+ if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
11988
12181
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
11989
12182
  }
11990
- if (_optionalChain([input2, 'access', _384 => _384.flags, 'access', _385 => _385.file, 'optionalAccess', _386 => _386.length])) {
12183
+ if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
11991
12184
  buckets = buckets.map((bucket) => {
11992
12185
  const paths = bucket.paths.filter(
11993
12186
  (p) => input2.flags.file.some(
@@ -12124,13 +12317,13 @@ async function frozen(input2) {
12124
12317
 
12125
12318
  // src/cli/cmd/run/_utils.ts
12126
12319
  async function determineAuthId(ctx) {
12127
- const isByokMode = !!_optionalChain([ctx, 'access', _387 => _387.config, 'optionalAccess', _388 => _388.provider]);
12320
+ const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
12128
12321
  if (isByokMode) {
12129
12322
  return null;
12130
12323
  } else {
12131
12324
  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;
12325
+ const authStatus = await _optionalChain([ctx, 'access', _376 => _376.localizer, 'optionalAccess', _377 => _377.checkAuth, 'call', _378 => _378()]);
12326
+ return _optionalChain([authStatus, 'optionalAccess', _379 => _379.username]) || null;
12134
12327
  } catch (e3) {
12135
12328
  return null;
12136
12329
  }
@@ -12328,7 +12521,7 @@ var InBranchFlow = class extends IntegrationFlow {
12328
12521
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
12329
12522
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
12330
12523
  _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()]);
12524
+ _optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
12332
12525
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
12333
12526
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
12334
12527
  if (!processOwnCommits) {
@@ -12360,7 +12553,7 @@ var InBranchFlow = class extends IntegrationFlow {
12360
12553
  // src/cli/cmd/ci/flows/pull-request.ts
12361
12554
  var PullRequestFlow = class extends InBranchFlow {
12362
12555
  async preRun() {
12363
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _396 => _396()]);
12556
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
12364
12557
  if (!canContinue) {
12365
12558
  return false;
12366
12559
  }
@@ -12627,10 +12820,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
12627
12820
  repo_slug: this.platformConfig.repositoryName,
12628
12821
  state: "OPEN"
12629
12822
  }).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
12823
+ return _optionalChain([values, 'optionalAccess', _384 => _384.find, 'call', _385 => _385(
12824
+ ({ 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
12825
  )]);
12633
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.id]));
12826
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
12634
12827
  }
12635
12828
  async closePullRequest({ pullRequestNumber }) {
12636
12829
  await this.bb.repositories.declinePullRequest({
@@ -12726,7 +12919,7 @@ var GitHubPlatformKit = class extends PlatformKit {
12726
12919
  repo: this.platformConfig.repositoryName,
12727
12920
  base: this.platformConfig.baseBranchName,
12728
12921
  state: "open"
12729
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.number]));
12922
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
12730
12923
  }
12731
12924
  async closePullRequest({ pullRequestNumber }) {
12732
12925
  await this.octokit.rest.pulls.update({
@@ -12853,7 +13046,7 @@ var GitlabPlatformKit = class extends PlatformKit {
12853
13046
  sourceBranch: branch,
12854
13047
  state: "opened"
12855
13048
  });
12856
- return _optionalChain([mergeRequests, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.iid]);
13049
+ return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
12857
13050
  }
12858
13051
  async closePullRequest({
12859
13052
  pullRequestNumber
@@ -12965,7 +13158,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12965
13158
  }
12966
13159
  const env = {
12967
13160
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
12968
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _407 => _407.pullRequest, 'optionalAccess', _408 => _408.toString, 'call', _409 => _409()]) || "false",
13161
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
12969
13162
  ...options.commitMessage && {
12970
13163
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
12971
13164
  },
@@ -12991,7 +13184,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
12991
13184
  const { isPullRequestMode } = platformKit.config;
12992
13185
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
12993
13186
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
12994
- const canRun = await _optionalChain([flow, 'access', _410 => _410.preRun, 'optionalCall', _411 => _411()]);
13187
+ const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
12995
13188
  if (canRun === false) {
12996
13189
  return;
12997
13190
  }
@@ -13001,7 +13194,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
13001
13194
  if (!hasChanges) {
13002
13195
  return;
13003
13196
  }
13004
- await _optionalChain([flow, 'access', _412 => _412.postRun, 'optionalCall', _413 => _413()]);
13197
+ await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
13005
13198
  });
13006
13199
  function parseBooleanArg(val) {
13007
13200
  if (val === true) return true;
@@ -13038,8 +13231,8 @@ function exitGracefully(elapsedMs = 0) {
13038
13231
  }
13039
13232
  }
13040
13233
  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()]) || [];
13234
+ const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
13235
+ const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
13043
13236
  const nonStandardHandles = activeHandles.filter((handle) => {
13044
13237
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
13045
13238
  return false;
@@ -13108,17 +13301,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13108
13301
  flags
13109
13302
  });
13110
13303
  let buckets = getBuckets(i18nConfig);
13111
- if (_optionalChain([flags, 'access', _418 => _418.bucket, 'optionalAccess', _419 => _419.length])) {
13304
+ if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
13112
13305
  buckets = buckets.filter(
13113
13306
  (bucket) => flags.bucket.includes(bucket.type)
13114
13307
  );
13115
13308
  }
13116
13309
  ora.succeed("Buckets retrieved");
13117
- if (_optionalChain([flags, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.length])) {
13310
+ if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
13118
13311
  buckets = buckets.map((bucket) => {
13119
13312
  const paths = bucket.paths.filter(
13120
13313
  (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)
13314
+ (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
13315
  )
13123
13316
  );
13124
13317
  return { ...bucket, paths };
@@ -13138,7 +13331,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
13138
13331
  });
13139
13332
  }
13140
13333
  }
13141
- const targetLocales = _optionalChain([flags, 'access', _428 => _428.locale, 'optionalAccess', _429 => _429.length]) ? flags.locale : i18nConfig.locale.targets;
13334
+ const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
13142
13335
  let totalSourceKeyCount = 0;
13143
13336
  let uniqueKeysToTranslate = 0;
13144
13337
  let totalExistingTranslations = 0;
@@ -13546,12 +13739,12 @@ function validateParams2(i18nConfig, flags) {
13546
13739
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
13547
13740
  docUrl: "bucketNotFound"
13548
13741
  });
13549
- } else if (_optionalChain([flags, 'access', _430 => _430.locale, 'optionalAccess', _431 => _431.some, 'call', _432 => _432((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13742
+ } else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
13550
13743
  throw new CLIError({
13551
13744
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
13552
13745
  docUrl: "localeTargetNotFound"
13553
13746
  });
13554
- } else if (_optionalChain([flags, 'access', _433 => _433.bucket, 'optionalAccess', _434 => _434.some, 'call', _435 => _435(
13747
+ } else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
13555
13748
  (bucket) => !i18nConfig.buckets[bucket]
13556
13749
  )])) {
13557
13750
  throw new CLIError({
@@ -13643,7 +13836,7 @@ async function renderHero2() {
13643
13836
  // package.json
13644
13837
  var package_default = {
13645
13838
  name: "lingo.dev",
13646
- version: "0.117.4",
13839
+ version: "0.117.6",
13647
13840
  description: "Lingo.dev CLI",
13648
13841
  private: false,
13649
13842
  publishConfig: {
@@ -13801,6 +13994,9 @@ var package_default = {
13801
13994
  "date-fns": "4.1.0",
13802
13995
  dedent: "1.7.0",
13803
13996
  diff: "7.0.0",
13997
+ "dom-serializer": "2.0.0",
13998
+ domhandler: "5.0.3",
13999
+ domutils: "3.2.2",
13804
14000
  dotenv: "16.4.7",
13805
14001
  ejs: "3.1.10",
13806
14002
  express: "5.1.0",
@@ -13811,6 +14007,7 @@ var package_default = {
13811
14007
  glob: "11.1.0",
13812
14008
  "gradient-string": "3.0.0",
13813
14009
  "gray-matter": "4.0.3",
14010
+ htmlparser2: "10.0.0",
13814
14011
  ini: "5.0.0",
13815
14012
  ink: "4.2.0",
13816
14013
  "ink-progress-bar": "3.0.0",
@@ -13935,7 +14132,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
13935
14132
  if (options.file && options.file.length) {
13936
14133
  buckets = buckets.map((bucket) => {
13937
14134
  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))])
14135
+ (bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
13939
14136
  );
13940
14137
  return { ...bucket, paths };
13941
14138
  }).filter((bucket) => bucket.paths.length > 0);