lingo.dev 0.105.1 → 0.105.2

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
@@ -2749,18 +2749,406 @@ function preserveCommentOrder(section, originalSection) {
2749
2749
  }
2750
2750
 
2751
2751
  // src/cli/loaders/xliff.ts
2752
- var _xliff = require('xliff'); var _xliff2 = _interopRequireDefault(_xliff);
2752
+
2753
2753
  function createXliffLoader() {
2754
2754
  return createLoader({
2755
- async pull(locale, input2) {
2756
- const js = await _xliff2.default.xliff2js(input2);
2757
- return js || {};
2755
+ async pull(locale, input2, _ctx, originalLocale) {
2756
+ const trimmedInput = (_nullishCoalesce(input2, () => ( ""))).trim();
2757
+ if (!trimmedInput) {
2758
+ return createEmptyResult(originalLocale, locale);
2759
+ }
2760
+ try {
2761
+ const dom = new (0, _jsdom.JSDOM)(trimmedInput, { contentType: "text/xml" });
2762
+ const document = dom.window.document;
2763
+ const parserError = document.querySelector("parsererror");
2764
+ if (parserError) {
2765
+ throw new Error(`XML parsing failed: ${parserError.textContent}`);
2766
+ }
2767
+ const xliffElement = document.documentElement;
2768
+ if (!xliffElement || xliffElement.tagName !== "xliff") {
2769
+ throw new Error("Invalid XLIFF: missing root <xliff> element");
2770
+ }
2771
+ const version = xliffElement.getAttribute("version") || "1.2";
2772
+ const isV2 = version === "2.0";
2773
+ if (isV2) {
2774
+ return pullV2(xliffElement, locale, originalLocale);
2775
+ } else {
2776
+ return pullV1(xliffElement, locale, originalLocale);
2777
+ }
2778
+ } catch (error) {
2779
+ throw new Error(`Failed to parse XLIFF file: ${error.message}`);
2780
+ }
2758
2781
  },
2759
- async push(locale, payload) {
2760
- const res = await _xliff2.default.js2xliff(payload);
2761
- return res.trim();
2782
+ async push(locale, translations, originalInput, originalLocale, pullInput) {
2783
+ if (!originalInput) {
2784
+ return pushNewFile(locale, translations, originalLocale);
2785
+ }
2786
+ try {
2787
+ const dom = new (0, _jsdom.JSDOM)(originalInput, { contentType: "text/xml" });
2788
+ const document = dom.window.document;
2789
+ const xliffElement = document.documentElement;
2790
+ const version = xliffElement.getAttribute("version") || "1.2";
2791
+ const isV2 = version === "2.0";
2792
+ if (isV2) {
2793
+ return pushV2(
2794
+ dom,
2795
+ xliffElement,
2796
+ locale,
2797
+ translations,
2798
+ originalLocale,
2799
+ originalInput
2800
+ );
2801
+ } else {
2802
+ return pushV1(
2803
+ dom,
2804
+ xliffElement,
2805
+ locale,
2806
+ translations,
2807
+ originalLocale,
2808
+ originalInput
2809
+ );
2810
+ }
2811
+ } catch (error) {
2812
+ throw new Error(`Failed to update XLIFF file: ${error.message}`);
2813
+ }
2814
+ }
2815
+ });
2816
+ }
2817
+ function pullV1(xliffElement, locale, originalLocale) {
2818
+ const result = {};
2819
+ const fileElement = xliffElement.querySelector("file");
2820
+ if (!fileElement) {
2821
+ return result;
2822
+ }
2823
+ const sourceLanguage = fileElement.getAttribute("source-language") || originalLocale;
2824
+ const isSourceLocale = sourceLanguage === locale;
2825
+ const bodyElement = fileElement.querySelector("body");
2826
+ if (!bodyElement) {
2827
+ return result;
2828
+ }
2829
+ const transUnits = bodyElement.querySelectorAll("trans-unit");
2830
+ const seenKeys = /* @__PURE__ */ new Set();
2831
+ transUnits.forEach((unit) => {
2832
+ let key = getTransUnitKey(unit);
2833
+ if (!key) return;
2834
+ if (seenKeys.has(key)) {
2835
+ const id = _optionalChain([unit, 'access', _136 => _136.getAttribute, 'call', _137 => _137("id"), 'optionalAccess', _138 => _138.trim, 'call', _139 => _139()]);
2836
+ if (id) {
2837
+ key = `${key}#${id}`;
2838
+ } else {
2839
+ let counter = 1;
2840
+ let newKey = `${key}__${counter}`;
2841
+ while (seenKeys.has(newKey)) {
2842
+ counter++;
2843
+ newKey = `${key}__${counter}`;
2844
+ }
2845
+ key = newKey;
2846
+ }
2847
+ }
2848
+ seenKeys.add(key);
2849
+ const elementName = isSourceLocale ? "source" : "target";
2850
+ const textElement = unit.querySelector(elementName);
2851
+ if (textElement) {
2852
+ result[key] = extractTextContent(textElement);
2853
+ } else if (isSourceLocale) {
2854
+ result[key] = key;
2855
+ } else {
2856
+ result[key] = "";
2762
2857
  }
2763
2858
  });
2859
+ return result;
2860
+ }
2861
+ function pushV1(dom, xliffElement, locale, translations, originalLocale, originalInput) {
2862
+ const document = dom.window.document;
2863
+ const fileElement = xliffElement.querySelector("file");
2864
+ if (!fileElement) {
2865
+ throw new Error("Invalid XLIFF 1.2: missing <file> element");
2866
+ }
2867
+ const sourceLanguage = fileElement.getAttribute("source-language") || originalLocale;
2868
+ const isSourceLocale = sourceLanguage === locale;
2869
+ if (!isSourceLocale) {
2870
+ fileElement.setAttribute("target-language", locale);
2871
+ }
2872
+ let bodyElement = fileElement.querySelector("body");
2873
+ if (!bodyElement) {
2874
+ bodyElement = document.createElement("body");
2875
+ fileElement.appendChild(bodyElement);
2876
+ }
2877
+ const existingUnits = /* @__PURE__ */ new Map();
2878
+ const seenKeys = /* @__PURE__ */ new Set();
2879
+ bodyElement.querySelectorAll("trans-unit").forEach((unit) => {
2880
+ let key = getTransUnitKey(unit);
2881
+ if (!key) return;
2882
+ if (seenKeys.has(key)) {
2883
+ const id = _optionalChain([unit, 'access', _140 => _140.getAttribute, 'call', _141 => _141("id"), 'optionalAccess', _142 => _142.trim, 'call', _143 => _143()]);
2884
+ if (id) {
2885
+ key = `${key}#${id}`;
2886
+ } else {
2887
+ let counter = 1;
2888
+ let newKey = `${key}__${counter}`;
2889
+ while (seenKeys.has(newKey)) {
2890
+ counter++;
2891
+ newKey = `${key}__${counter}`;
2892
+ }
2893
+ key = newKey;
2894
+ }
2895
+ }
2896
+ seenKeys.add(key);
2897
+ existingUnits.set(key, unit);
2898
+ });
2899
+ Object.entries(translations).forEach(([key, value]) => {
2900
+ let unit = existingUnits.get(key);
2901
+ if (!unit) {
2902
+ unit = document.createElement("trans-unit");
2903
+ unit.setAttribute("id", key);
2904
+ unit.setAttribute("resname", key);
2905
+ unit.setAttribute("restype", "string");
2906
+ unit.setAttribute("datatype", "plaintext");
2907
+ const sourceElement = document.createElement("source");
2908
+ setTextContent(sourceElement, isSourceLocale ? value : key);
2909
+ unit.appendChild(sourceElement);
2910
+ if (!isSourceLocale) {
2911
+ const targetElement = document.createElement("target");
2912
+ targetElement.setAttribute("state", value ? "translated" : "new");
2913
+ setTextContent(targetElement, value);
2914
+ unit.appendChild(targetElement);
2915
+ }
2916
+ bodyElement.appendChild(unit);
2917
+ existingUnits.set(key, unit);
2918
+ } else {
2919
+ updateTransUnitV1(unit, key, value, isSourceLocale);
2920
+ }
2921
+ });
2922
+ const translationKeys = new Set(Object.keys(translations));
2923
+ existingUnits.forEach((unit, key) => {
2924
+ if (!translationKeys.has(key)) {
2925
+ _optionalChain([unit, 'access', _144 => _144.parentNode, 'optionalAccess', _145 => _145.removeChild, 'call', _146 => _146(unit)]);
2926
+ }
2927
+ });
2928
+ return serializeWithDeclaration(
2929
+ dom,
2930
+ extractXmlDeclaration(originalInput || "")
2931
+ );
2932
+ }
2933
+ function updateTransUnitV1(unit, key, value, isSourceLocale) {
2934
+ const document = unit.ownerDocument;
2935
+ if (isSourceLocale) {
2936
+ let sourceElement = unit.querySelector("source");
2937
+ if (!sourceElement) {
2938
+ sourceElement = document.createElement("source");
2939
+ unit.appendChild(sourceElement);
2940
+ }
2941
+ setTextContent(sourceElement, value);
2942
+ } else {
2943
+ let targetElement = unit.querySelector("target");
2944
+ if (!targetElement) {
2945
+ targetElement = document.createElement("target");
2946
+ unit.appendChild(targetElement);
2947
+ }
2948
+ setTextContent(targetElement, value);
2949
+ targetElement.setAttribute("state", value.trim() ? "translated" : "new");
2950
+ }
2951
+ }
2952
+ function pullV2(xliffElement, locale, originalLocale) {
2953
+ const result = {};
2954
+ const srcLang = xliffElement.getAttribute("srcLang") || originalLocale;
2955
+ result.sourceLanguage = srcLang;
2956
+ const fileElements = xliffElement.querySelectorAll("file");
2957
+ fileElements.forEach((fileElement) => {
2958
+ const fileId = fileElement.getAttribute("id");
2959
+ if (!fileId) return;
2960
+ traverseUnitsV2(fileElement, fileId, "", result);
2961
+ });
2962
+ return result;
2963
+ }
2964
+ function traverseUnitsV2(container, fileId, currentPath, result) {
2965
+ Array.from(container.children).forEach((child) => {
2966
+ const tagName = child.tagName;
2967
+ if (tagName === "unit") {
2968
+ const unitId = _optionalChain([child, 'access', _147 => _147.getAttribute, 'call', _148 => _148("id"), 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()]);
2969
+ if (!unitId) return;
2970
+ const key = `resources/${fileId}/${currentPath}${unitId}/source`;
2971
+ const segment = child.querySelector("segment");
2972
+ const source = _optionalChain([segment, 'optionalAccess', _151 => _151.querySelector, 'call', _152 => _152("source")]);
2973
+ if (source) {
2974
+ result[key] = extractTextContent(source);
2975
+ } else {
2976
+ result[key] = unitId;
2977
+ }
2978
+ } else if (tagName === "group") {
2979
+ const groupId = _optionalChain([child, 'access', _153 => _153.getAttribute, 'call', _154 => _154("id"), 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()]);
2980
+ const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
2981
+ traverseUnitsV2(child, fileId, newPath, result);
2982
+ }
2983
+ });
2984
+ }
2985
+ function pushV2(dom, xliffElement, locale, translations, originalLocale, originalInput) {
2986
+ const document = dom.window.document;
2987
+ if (translations.sourceLanguage) {
2988
+ xliffElement.setAttribute("srcLang", translations.sourceLanguage);
2989
+ delete translations.sourceLanguage;
2990
+ }
2991
+ const existingUnits = /* @__PURE__ */ new Map();
2992
+ const fileElements = xliffElement.querySelectorAll("file");
2993
+ fileElements.forEach((fileElement) => {
2994
+ const fileId = fileElement.getAttribute("id");
2995
+ if (!fileId) return;
2996
+ indexUnitsV2(fileElement, fileId, "", existingUnits);
2997
+ });
2998
+ Object.entries(translations).forEach(([key, value]) => {
2999
+ const unit = existingUnits.get(key);
3000
+ if (unit) {
3001
+ updateUnitV2(unit, value);
3002
+ } else {
3003
+ console.warn(`Cannot create new unit for key: ${key} in XLIFF 2.0`);
3004
+ }
3005
+ });
3006
+ return serializeWithDeclaration(
3007
+ dom,
3008
+ extractXmlDeclaration(originalInput || "")
3009
+ );
3010
+ }
3011
+ function indexUnitsV2(container, fileId, currentPath, index) {
3012
+ Array.from(container.children).forEach((child) => {
3013
+ const tagName = child.tagName;
3014
+ if (tagName === "unit") {
3015
+ const unitId = _optionalChain([child, 'access', _157 => _157.getAttribute, 'call', _158 => _158("id"), 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()]);
3016
+ if (!unitId) return;
3017
+ const key = `resources/${fileId}/${currentPath}${unitId}/source`;
3018
+ index.set(key, child);
3019
+ } else if (tagName === "group") {
3020
+ const groupId = _optionalChain([child, 'access', _161 => _161.getAttribute, 'call', _162 => _162("id"), 'optionalAccess', _163 => _163.trim, 'call', _164 => _164()]);
3021
+ const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
3022
+ indexUnitsV2(child, fileId, newPath, index);
3023
+ }
3024
+ });
3025
+ }
3026
+ function updateUnitV2(unit, value) {
3027
+ const document = unit.ownerDocument;
3028
+ let segment = unit.querySelector("segment");
3029
+ if (!segment) {
3030
+ segment = document.createElement("segment");
3031
+ unit.appendChild(segment);
3032
+ }
3033
+ let source = segment.querySelector("source");
3034
+ if (!source) {
3035
+ source = document.createElement("source");
3036
+ segment.appendChild(source);
3037
+ }
3038
+ setTextContent(source, value);
3039
+ }
3040
+ function getTransUnitKey(transUnit) {
3041
+ const resname = _optionalChain([transUnit, 'access', _165 => _165.getAttribute, 'call', _166 => _166("resname"), 'optionalAccess', _167 => _167.trim, 'call', _168 => _168()]);
3042
+ if (resname) return resname;
3043
+ const id = _optionalChain([transUnit, 'access', _169 => _169.getAttribute, 'call', _170 => _170("id"), 'optionalAccess', _171 => _171.trim, 'call', _172 => _172()]);
3044
+ if (id) return id;
3045
+ const sourceElement = transUnit.querySelector("source");
3046
+ if (sourceElement) {
3047
+ const sourceText = extractTextContent(sourceElement).trim();
3048
+ if (sourceText) return sourceText;
3049
+ }
3050
+ return "";
3051
+ }
3052
+ function extractTextContent(element) {
3053
+ const cdataNode = Array.from(element.childNodes).find(
3054
+ (node) => node.nodeType === element.CDATA_SECTION_NODE
3055
+ );
3056
+ if (cdataNode) {
3057
+ return cdataNode.nodeValue || "";
3058
+ }
3059
+ return element.textContent || "";
3060
+ }
3061
+ function setTextContent(element, content) {
3062
+ const document = element.ownerDocument;
3063
+ while (element.firstChild) {
3064
+ element.removeChild(element.firstChild);
3065
+ }
3066
+ if (/[<>&"']/.test(content)) {
3067
+ const cdataSection = document.createCDATASection(content);
3068
+ element.appendChild(cdataSection);
3069
+ } else {
3070
+ element.textContent = content;
3071
+ }
3072
+ }
3073
+ function extractXmlDeclaration(xmlContent) {
3074
+ const match2 = xmlContent.match(/^<\?xml[^>]*\?>/);
3075
+ return match2 ? match2[0] : "";
3076
+ }
3077
+ function serializeWithDeclaration(dom, declaration) {
3078
+ let serialized = dom.serialize();
3079
+ serialized = formatXml(serialized);
3080
+ if (declaration) {
3081
+ serialized = `${declaration}
3082
+ ${serialized}`;
3083
+ }
3084
+ return serialized;
3085
+ }
3086
+ function formatXml(xml) {
3087
+ const dom = new (0, _jsdom.JSDOM)(xml, { contentType: "text/xml" });
3088
+ const doc = dom.window.document;
3089
+ function formatElement(element, depth = 0) {
3090
+ const indent2 = " ".repeat(depth);
3091
+ const tagName = element.tagName;
3092
+ const attributes = Array.from(element.attributes).map((attr) => `${attr.name}="${attr.value}"`).join(" ");
3093
+ const openTag = attributes ? `<${tagName} ${attributes}>` : `<${tagName}>`;
3094
+ const cdataNode = Array.from(element.childNodes).find(
3095
+ (node) => node.nodeType === element.CDATA_SECTION_NODE
3096
+ );
3097
+ if (cdataNode) {
3098
+ return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
3099
+ }
3100
+ const textContent = _optionalChain([element, 'access', _173 => _173.textContent, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]) || "";
3101
+ const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
3102
+ if (hasOnlyText && textContent) {
3103
+ return `${indent2}${openTag}${textContent}</${tagName}>`;
3104
+ }
3105
+ const children = Array.from(element.children);
3106
+ if (children.length === 0) {
3107
+ return `${indent2}${openTag}</${tagName}>`;
3108
+ }
3109
+ let result = `${indent2}${openTag}
3110
+ `;
3111
+ for (const child of children) {
3112
+ result += formatElement(child, depth + 1) + "\n";
3113
+ }
3114
+ result += `${indent2}</${tagName}>`;
3115
+ return result;
3116
+ }
3117
+ return formatElement(doc.documentElement);
3118
+ }
3119
+ function createEmptyResult(originalLocale, locale) {
3120
+ return {};
3121
+ }
3122
+ function pushNewFile(locale, translations, originalLocale) {
3123
+ const skeleton = `<?xml version="1.0" encoding="utf-8"?>
3124
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3125
+ <file original="" source-language="${originalLocale}" target-language="${locale}" datatype="plaintext">
3126
+ <header></header>
3127
+ <body></body>
3128
+ </file>
3129
+ </xliff>`;
3130
+ const dom = new (0, _jsdom.JSDOM)(skeleton, { contentType: "text/xml" });
3131
+ const document = dom.window.document;
3132
+ const bodyElement = document.querySelector("body");
3133
+ Object.entries(translations).forEach(([key, value]) => {
3134
+ const unit = document.createElement("trans-unit");
3135
+ unit.setAttribute("id", key);
3136
+ unit.setAttribute("resname", key);
3137
+ unit.setAttribute("restype", "string");
3138
+ unit.setAttribute("datatype", "plaintext");
3139
+ const sourceElement = document.createElement("source");
3140
+ setTextContent(sourceElement, key);
3141
+ unit.appendChild(sourceElement);
3142
+ const targetElement = document.createElement("target");
3143
+ targetElement.setAttribute("state", value ? "translated" : "new");
3144
+ setTextContent(targetElement, value);
3145
+ unit.appendChild(targetElement);
3146
+ bodyElement.appendChild(unit);
3147
+ });
3148
+ return serializeWithDeclaration(
3149
+ dom,
3150
+ '<?xml version="1.0" encoding="utf-8"?>'
3151
+ );
2764
3152
  }
2765
3153
 
2766
3154
  // src/cli/loaders/xml.ts
@@ -3002,7 +3390,7 @@ function createDatoClient(params) {
3002
3390
  ids: !records.length ? void 0 : records.join(",")
3003
3391
  }
3004
3392
  }).catch(
3005
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _136 => _136.response, 'optionalAccess', _137 => _137.body, 'optionalAccess', _138 => _138.data, 'optionalAccess', _139 => _139[0]]) || error)
3393
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _176 => _176.response, 'optionalAccess', _177 => _177.body, 'optionalAccess', _178 => _178.data, 'optionalAccess', _179 => _179[0]]) || error)
3006
3394
  );
3007
3395
  },
3008
3396
  findRecordsForModel: async (modelId, records) => {
@@ -3013,10 +3401,10 @@ function createDatoClient(params) {
3013
3401
  filter: {
3014
3402
  type: modelId,
3015
3403
  only_valid: "true",
3016
- ids: !_optionalChain([records, 'optionalAccess', _140 => _140.length]) ? void 0 : records.join(",")
3404
+ ids: !_optionalChain([records, 'optionalAccess', _180 => _180.length]) ? void 0 : records.join(",")
3017
3405
  }
3018
3406
  }).catch(
3019
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _141 => _141.response, 'optionalAccess', _142 => _142.body, 'optionalAccess', _143 => _143.data, 'optionalAccess', _144 => _144[0]]) || error)
3407
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _181 => _181.response, 'optionalAccess', _182 => _182.body, 'optionalAccess', _183 => _183.data, 'optionalAccess', _184 => _184[0]]) || error)
3020
3408
  );
3021
3409
  return result;
3022
3410
  } catch (_error) {
@@ -3032,10 +3420,10 @@ function createDatoClient(params) {
3032
3420
  updateRecord: async (id, payload) => {
3033
3421
  try {
3034
3422
  await dato.items.update(id, payload).catch(
3035
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _145 => _145.response, 'optionalAccess', _146 => _146.body, 'optionalAccess', _147 => _147.data, 'optionalAccess', _148 => _148[0]]) || error)
3423
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _185 => _185.response, 'optionalAccess', _186 => _186.body, 'optionalAccess', _187 => _187.data, 'optionalAccess', _188 => _188[0]]) || error)
3036
3424
  );
3037
3425
  } catch (_error) {
3038
- if (_optionalChain([_error, 'optionalAccess', _149 => _149.attributes, 'optionalAccess', _150 => _150.details, 'optionalAccess', _151 => _151.message])) {
3426
+ if (_optionalChain([_error, 'optionalAccess', _189 => _189.attributes, 'optionalAccess', _190 => _190.details, 'optionalAccess', _191 => _191.message])) {
3039
3427
  throw new Error(
3040
3428
  [
3041
3429
  `${_error.attributes.details.message}`,
@@ -3057,10 +3445,10 @@ function createDatoClient(params) {
3057
3445
  enableFieldLocalization: async (args) => {
3058
3446
  try {
3059
3447
  await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
3060
- (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _152 => _152.response, 'optionalAccess', _153 => _153.body, 'optionalAccess', _154 => _154.data, 'optionalAccess', _155 => _155[0]]) || error)
3448
+ (error) => Promise.reject(_optionalChain([error, 'optionalAccess', _192 => _192.response, 'optionalAccess', _193 => _193.body, 'optionalAccess', _194 => _194.data, 'optionalAccess', _195 => _195[0]]) || error)
3061
3449
  );
3062
3450
  } catch (_error) {
3063
- if (_optionalChain([_error, 'optionalAccess', _156 => _156.attributes, 'optionalAccess', _157 => _157.code]) === "NOT_FOUND") {
3451
+ if (_optionalChain([_error, 'optionalAccess', _196 => _196.attributes, 'optionalAccess', _197 => _197.code]) === "NOT_FOUND") {
3064
3452
  throw new Error(
3065
3453
  [
3066
3454
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -3068,7 +3456,7 @@ function createDatoClient(params) {
3068
3456
  ].join("\n\n")
3069
3457
  );
3070
3458
  }
3071
- if (_optionalChain([_error, 'optionalAccess', _158 => _158.attributes, 'optionalAccess', _159 => _159.details, 'optionalAccess', _160 => _160.message])) {
3459
+ if (_optionalChain([_error, 'optionalAccess', _198 => _198.attributes, 'optionalAccess', _199 => _199.details, 'optionalAccess', _200 => _200.message])) {
3072
3460
  throw new Error(
3073
3461
  [
3074
3462
  `${_error.attributes.details.message}`,
@@ -3146,7 +3534,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
3146
3534
  const records = await dato.findRecordsForModel(modelId);
3147
3535
  const recordChoices = createRecordChoices(
3148
3536
  records,
3149
- _optionalChain([config, 'access', _161 => _161.models, 'access', _162 => _162[modelId], 'optionalAccess', _163 => _163.records]) || [],
3537
+ _optionalChain([config, 'access', _201 => _201.models, 'access', _202 => _202[modelId], 'optionalAccess', _203 => _203.records]) || [],
3150
3538
  project
3151
3539
  );
3152
3540
  const selectedRecords = await promptRecordSelection(
@@ -3165,14 +3553,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
3165
3553
  },
3166
3554
  async pull(locale, input2, initCtx) {
3167
3555
  const result = {};
3168
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _164 => _164.models]) || {})) {
3169
- let records = _optionalChain([initCtx, 'optionalAccess', _165 => _165.models, 'access', _166 => _166[modelId], 'access', _167 => _167.records]) || [];
3556
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _204 => _204.models]) || {})) {
3557
+ let records = _optionalChain([initCtx, 'optionalAccess', _205 => _205.models, 'access', _206 => _206[modelId], 'access', _207 => _207.records]) || [];
3170
3558
  const recordIds = records.map((record) => record.id);
3171
3559
  records = await dato.findRecords(recordIds);
3172
3560
  console.log(`Fetched ${records.length} records for model ${modelId}`);
3173
3561
  if (records.length > 0) {
3174
3562
  result[modelId] = {
3175
- fields: _optionalChain([initCtx, 'optionalAccess', _168 => _168.models, 'optionalAccess', _169 => _169[modelId], 'optionalAccess', _170 => _170.fields]) || [],
3563
+ fields: _optionalChain([initCtx, 'optionalAccess', _208 => _208.models, 'optionalAccess', _209 => _209[modelId], 'optionalAccess', _210 => _210.fields]) || [],
3176
3564
  records
3177
3565
  };
3178
3566
  }
@@ -3235,7 +3623,7 @@ function createRecordChoices(records, selectedIds = [], project) {
3235
3623
  return records.map((record) => ({
3236
3624
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
3237
3625
  value: record.id,
3238
- checked: _optionalChain([selectedIds, 'optionalAccess', _171 => _171.includes, 'call', _172 => _172(record.id)])
3626
+ checked: _optionalChain([selectedIds, 'optionalAccess', _211 => _211.includes, 'call', _212 => _212(record.id)])
3239
3627
  }));
3240
3628
  }
3241
3629
  async function promptRecordSelection(modelName, choices) {
@@ -3554,7 +3942,7 @@ function createVttLoader() {
3554
3942
  if (!input2) {
3555
3943
  return "";
3556
3944
  }
3557
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _173 => _173.parse, 'call', _174 => _174(input2), 'optionalAccess', _175 => _175.cues]);
3945
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _213 => _213.parse, 'call', _214 => _214(input2), 'optionalAccess', _215 => _215.cues]);
3558
3946
  if (Object.keys(vtt).length === 0) {
3559
3947
  return {};
3560
3948
  } else {
@@ -3608,7 +3996,7 @@ function variableExtractLoader(params) {
3608
3996
  for (let i = 0; i < matches.length; i++) {
3609
3997
  const match2 = matches[i];
3610
3998
  const currentValue = result[key].value;
3611
- const newValue = _optionalChain([currentValue, 'optionalAccess', _176 => _176.replace, 'call', _177 => _177(match2, `{variable:${i}}`)]);
3999
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _216 => _216.replace, 'call', _217 => _217(match2, `{variable:${i}}`)]);
3612
4000
  result[key].value = newValue;
3613
4001
  result[key].variables[i] = match2;
3614
4002
  }
@@ -3622,7 +4010,7 @@ function variableExtractLoader(params) {
3622
4010
  for (let i = 0; i < valueObj.variables.length; i++) {
3623
4011
  const variable = valueObj.variables[i];
3624
4012
  const currentValue = result[key];
3625
- const newValue = _optionalChain([currentValue, 'optionalAccess', _178 => _178.replace, 'call', _179 => _179(`{variable:${i}}`, variable)]);
4013
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _218 => _218.replace, 'call', _219 => _219(`{variable:${i}}`, variable)]);
3626
4014
  result[key] = newValue;
3627
4015
  }
3628
4016
  }
@@ -3822,7 +4210,7 @@ function createVueJsonLoader() {
3822
4210
  return createLoader({
3823
4211
  pull: async (locale, input2, ctx) => {
3824
4212
  const parsed = parseVueFile(input2);
3825
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _180 => _180.i18n, 'optionalAccess', _181 => _181[locale]]), () => ( {}));
4213
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _220 => _220.i18n, 'optionalAccess', _221 => _221[locale]]), () => ( {}));
3826
4214
  },
3827
4215
  push: async (locale, data, originalInput) => {
3828
4216
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -4007,7 +4395,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
4007
4395
  objectExpression.properties.forEach((prop) => {
4008
4396
  if (!t.isObjectProperty(prop)) return;
4009
4397
  const key = getPropertyKey(prop);
4010
- const incomingVal = _optionalChain([data, 'optionalAccess', _182 => _182[key]]);
4398
+ const incomingVal = _optionalChain([data, 'optionalAccess', _222 => _222[key]]);
4011
4399
  if (incomingVal === void 0) {
4012
4400
  return;
4013
4401
  }
@@ -4043,7 +4431,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
4043
4431
  let modified = false;
4044
4432
  arrayExpression.elements.forEach((element, index) => {
4045
4433
  if (!element) return;
4046
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _183 => _183[index]]);
4434
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _223 => _223[index]]);
4047
4435
  if (incomingVal === void 0) return;
4048
4436
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
4049
4437
  if (element.value !== incomingVal) {
@@ -4325,7 +4713,7 @@ function createMdxSectionsSplit2Loader() {
4325
4713
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
4326
4714
  const result = {
4327
4715
  frontmatter: data.frontmatter,
4328
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _184 => _184.codePlaceholders]) || {},
4716
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _224 => _224.codePlaceholders]) || {},
4329
4717
  content
4330
4718
  };
4331
4719
  return result;
@@ -4921,7 +5309,7 @@ function createBasicTranslator(model, systemPrompt) {
4921
5309
  ]
4922
5310
  });
4923
5311
  const result = JSON.parse(response.text);
4924
- return _optionalChain([result, 'optionalAccess', _185 => _185.data]) || {};
5312
+ return _optionalChain([result, 'optionalAccess', _225 => _225.data]) || {};
4925
5313
  }
4926
5314
  }
4927
5315
  function extractPayloadChunks(payload) {
@@ -5003,7 +5391,7 @@ function getPureModelProvider(provider) {
5003
5391
 
5004
5392
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
5005
5393
  `;
5006
- switch (_optionalChain([provider, 'optionalAccess', _186 => _186.id])) {
5394
+ switch (_optionalChain([provider, 'optionalAccess', _226 => _226.id])) {
5007
5395
  case "openai": {
5008
5396
  if (!process.env.OPENAI_API_KEY) {
5009
5397
  throw new Error(
@@ -5061,7 +5449,7 @@ function getPureModelProvider(provider) {
5061
5449
  })(provider.model);
5062
5450
  }
5063
5451
  default: {
5064
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _187 => _187.id])));
5452
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _227 => _227.id])));
5065
5453
  }
5066
5454
  }
5067
5455
  }
@@ -5301,7 +5689,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
5301
5689
  validateParams(i18nConfig, flags);
5302
5690
  ora.succeed("Localization configuration is valid");
5303
5691
  ora.start("Connecting to Lingo.dev Localization Engine...");
5304
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _188 => _188.provider]);
5692
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _228 => _228.provider]);
5305
5693
  if (isByokMode) {
5306
5694
  authId = null;
5307
5695
  ora.succeed("Using external provider (BYOK mode)");
@@ -5315,16 +5703,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
5315
5703
  flags
5316
5704
  });
5317
5705
  let buckets = getBuckets(i18nConfig);
5318
- if (_optionalChain([flags, 'access', _189 => _189.bucket, 'optionalAccess', _190 => _190.length])) {
5706
+ if (_optionalChain([flags, 'access', _229 => _229.bucket, 'optionalAccess', _230 => _230.length])) {
5319
5707
  buckets = buckets.filter(
5320
5708
  (bucket) => flags.bucket.includes(bucket.type)
5321
5709
  );
5322
5710
  }
5323
5711
  ora.succeed("Buckets retrieved");
5324
- if (_optionalChain([flags, 'access', _191 => _191.file, 'optionalAccess', _192 => _192.length])) {
5712
+ if (_optionalChain([flags, 'access', _231 => _231.file, 'optionalAccess', _232 => _232.length])) {
5325
5713
  buckets = buckets.map((bucket) => {
5326
5714
  const paths = bucket.paths.filter(
5327
- (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _193 => _193.pathPattern, 'optionalAccess', _194 => _194.includes, 'call', _195 => _195(file)]))
5715
+ (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _233 => _233.pathPattern, 'optionalAccess', _234 => _234.includes, 'call', _235 => _235(file)]))
5328
5716
  );
5329
5717
  return { ...bucket, paths };
5330
5718
  }).filter((bucket) => bucket.paths.length > 0);
@@ -5343,7 +5731,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
5343
5731
  });
5344
5732
  }
5345
5733
  }
5346
- const targetLocales = _optionalChain([flags, 'access', _196 => _196.locale, 'optionalAccess', _197 => _197.length]) ? flags.locale : i18nConfig.locale.targets;
5734
+ const targetLocales = _optionalChain([flags, 'access', _236 => _236.locale, 'optionalAccess', _237 => _237.length]) ? flags.locale : i18nConfig.locale.targets;
5347
5735
  ora.start("Setting up localization cache...");
5348
5736
  const checkLockfileProcessor = createDeltaProcessor("");
5349
5737
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -5602,7 +5990,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
5602
5990
  }
5603
5991
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
5604
5992
  const checksums = await deltaProcessor.createChecksums(sourceData);
5605
- if (!_optionalChain([flags, 'access', _198 => _198.locale, 'optionalAccess', _199 => _199.length])) {
5993
+ if (!_optionalChain([flags, 'access', _238 => _238.locale, 'optionalAccess', _239 => _239.length])) {
5606
5994
  await deltaProcessor.saveChecksums(checksums);
5607
5995
  }
5608
5996
  }
@@ -5686,12 +6074,12 @@ function validateParams(i18nConfig, flags) {
5686
6074
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
5687
6075
  docUrl: "bucketNotFound"
5688
6076
  });
5689
- } else if (_optionalChain([flags, 'access', _200 => _200.locale, 'optionalAccess', _201 => _201.some, 'call', _202 => _202((locale) => !i18nConfig.locale.targets.includes(locale))])) {
6077
+ } else if (_optionalChain([flags, 'access', _240 => _240.locale, 'optionalAccess', _241 => _241.some, 'call', _242 => _242((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5690
6078
  throw new CLIError({
5691
6079
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
5692
6080
  docUrl: "localeTargetNotFound"
5693
6081
  });
5694
- } else if (_optionalChain([flags, 'access', _203 => _203.bucket, 'optionalAccess', _204 => _204.some, 'call', _205 => _205(
6082
+ } else if (_optionalChain([flags, 'access', _243 => _243.bucket, 'optionalAccess', _244 => _244.some, 'call', _245 => _245(
5695
6083
  (bucket) => !i18nConfig.buckets[bucket]
5696
6084
  )])) {
5697
6085
  throw new CLIError({
@@ -6195,7 +6583,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
6195
6583
  const response = await engine.whoami();
6196
6584
  return {
6197
6585
  authenticated: !!response,
6198
- username: _optionalChain([response, 'optionalAccess', _206 => _206.email])
6586
+ username: _optionalChain([response, 'optionalAccess', _246 => _246.email])
6199
6587
  };
6200
6588
  } catch (e2) {
6201
6589
  return { authenticated: false };
@@ -6302,7 +6690,7 @@ function createExplicitLocalizer(provider) {
6302
6690
  }
6303
6691
  function createAiSdkLocalizer(params) {
6304
6692
  const skipAuth = params.skipAuth === true;
6305
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _207 => _207.apiKeyName]), () => ( ""))];
6693
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _247 => _247.apiKeyName]), () => ( ""))];
6306
6694
  if (!skipAuth && !apiKey || !params.apiKeyName) {
6307
6695
  throw new Error(
6308
6696
  _dedent2.default`
@@ -6427,8 +6815,8 @@ async function setup(input2) {
6427
6815
  throw new Error(
6428
6816
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
6429
6817
  );
6430
- } else if (_optionalChain([ctx, 'access', _208 => _208.flags, 'access', _209 => _209.bucket, 'optionalAccess', _210 => _210.some, 'call', _211 => _211(
6431
- (bucket) => !_optionalChain([ctx, 'access', _212 => _212.config, 'optionalAccess', _213 => _213.buckets, 'access', _214 => _214[bucket]])
6818
+ } else if (_optionalChain([ctx, 'access', _248 => _248.flags, 'access', _249 => _249.bucket, 'optionalAccess', _250 => _250.some, 'call', _251 => _251(
6819
+ (bucket) => !_optionalChain([ctx, 'access', _252 => _252.config, 'optionalAccess', _253 => _253.buckets, 'access', _254 => _254[bucket]])
6432
6820
  )])) {
6433
6821
  throw new Error(
6434
6822
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -6441,7 +6829,7 @@ async function setup(input2) {
6441
6829
  title: "Selecting localization provider",
6442
6830
  task: async (ctx, task) => {
6443
6831
  ctx.localizer = createLocalizer(
6444
- _optionalChain([ctx, 'access', _215 => _215.config, 'optionalAccess', _216 => _216.provider]),
6832
+ _optionalChain([ctx, 'access', _255 => _255.config, 'optionalAccess', _256 => _256.provider]),
6445
6833
  ctx.flags.apiKey
6446
6834
  );
6447
6835
  if (!ctx.localizer) {
@@ -6940,7 +7328,7 @@ var AST = class _AST {
6940
7328
  const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
6941
7329
  if (this.isStart() && !this.type)
6942
7330
  ret.unshift([]);
6943
- if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _217 => _217.#parent, 'optionalAccess', _218 => _218.type]) === "!")) {
7331
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _257 => _257.#parent, 'optionalAccess', _258 => _258.type]) === "!")) {
6944
7332
  ret.push({});
6945
7333
  }
6946
7334
  return ret;
@@ -6948,7 +7336,7 @@ var AST = class _AST {
6948
7336
  isStart() {
6949
7337
  if (this.#root === this)
6950
7338
  return true;
6951
- if (!_optionalChain([this, 'access', _219 => _219.#parent, 'optionalAccess', _220 => _220.isStart, 'call', _221 => _221()]))
7339
+ if (!_optionalChain([this, 'access', _259 => _259.#parent, 'optionalAccess', _260 => _260.isStart, 'call', _261 => _261()]))
6952
7340
  return false;
6953
7341
  if (this.#parentIndex === 0)
6954
7342
  return true;
@@ -6964,12 +7352,12 @@ var AST = class _AST {
6964
7352
  isEnd() {
6965
7353
  if (this.#root === this)
6966
7354
  return true;
6967
- if (_optionalChain([this, 'access', _222 => _222.#parent, 'optionalAccess', _223 => _223.type]) === "!")
7355
+ if (_optionalChain([this, 'access', _262 => _262.#parent, 'optionalAccess', _263 => _263.type]) === "!")
6968
7356
  return true;
6969
- if (!_optionalChain([this, 'access', _224 => _224.#parent, 'optionalAccess', _225 => _225.isEnd, 'call', _226 => _226()]))
7357
+ if (!_optionalChain([this, 'access', _264 => _264.#parent, 'optionalAccess', _265 => _265.isEnd, 'call', _266 => _266()]))
6970
7358
  return false;
6971
7359
  if (!this.type)
6972
- return _optionalChain([this, 'access', _227 => _227.#parent, 'optionalAccess', _228 => _228.isEnd, 'call', _229 => _229()]);
7360
+ return _optionalChain([this, 'access', _267 => _267.#parent, 'optionalAccess', _268 => _268.isEnd, 'call', _269 => _269()]);
6973
7361
  const pl = this.#parent ? this.#parent.#parts.length : 0;
6974
7362
  return this.#parentIndex === pl - 1;
6975
7363
  }
@@ -7214,7 +7602,7 @@ var AST = class _AST {
7214
7602
  }
7215
7603
  }
7216
7604
  let end = "";
7217
- if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _230 => _230.#parent, 'optionalAccess', _231 => _231.type]) === "!") {
7605
+ if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _270 => _270.#parent, 'optionalAccess', _271 => _271.type]) === "!") {
7218
7606
  end = "(?:$|\\/)";
7219
7607
  }
7220
7608
  const final2 = start2 + src + end;
@@ -8299,7 +8687,7 @@ function createWorkerTask(args) {
8299
8687
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
8300
8688
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
8301
8689
  ).filter(
8302
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _232 => _232.onlyKeys, 'optionalAccess', _233 => _233.some, 'call', _234 => _234(
8690
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _272 => _272.onlyKeys, 'optionalAccess', _273 => _273.some, 'call', _274 => _274(
8303
8691
  (pattern) => minimatch(key, pattern)
8304
8692
  )])
8305
8693
  ).fromPairs().value();
@@ -8360,7 +8748,7 @@ function createWorkerTask(args) {
8360
8748
  finalRenamedTargetData
8361
8749
  );
8362
8750
  const checksums2 = await deltaProcessor.createChecksums(sourceData);
8363
- if (!_optionalChain([args, 'access', _235 => _235.ctx, 'access', _236 => _236.flags, 'access', _237 => _237.targetLocale, 'optionalAccess', _238 => _238.length])) {
8751
+ if (!_optionalChain([args, 'access', _275 => _275.ctx, 'access', _276 => _276.flags, 'access', _277 => _277.targetLocale, 'optionalAccess', _278 => _278.length])) {
8364
8752
  await deltaProcessor.saveChecksums(checksums2);
8365
8753
  }
8366
8754
  });
@@ -8550,13 +8938,13 @@ var flagsSchema2 = _zod.z.object({
8550
8938
 
8551
8939
  // src/cli/cmd/run/_utils.ts
8552
8940
  async function determineAuthId(ctx) {
8553
- const isByokMode = !!_optionalChain([ctx, 'access', _239 => _239.config, 'optionalAccess', _240 => _240.provider]);
8941
+ const isByokMode = !!_optionalChain([ctx, 'access', _279 => _279.config, 'optionalAccess', _280 => _280.provider]);
8554
8942
  if (isByokMode) {
8555
8943
  return null;
8556
8944
  } else {
8557
8945
  try {
8558
- const authStatus = await _optionalChain([ctx, 'access', _241 => _241.localizer, 'optionalAccess', _242 => _242.checkAuth, 'call', _243 => _243()]);
8559
- return _optionalChain([authStatus, 'optionalAccess', _244 => _244.username]) || null;
8946
+ const authStatus = await _optionalChain([ctx, 'access', _281 => _281.localizer, 'optionalAccess', _282 => _282.checkAuth, 'call', _283 => _283()]);
8947
+ return _optionalChain([authStatus, 'optionalAccess', _284 => _284.username]) || null;
8560
8948
  } catch (e3) {
8561
8949
  return null;
8562
8950
  }
@@ -8716,7 +9104,7 @@ var InBranchFlow = class extends IntegrationFlow {
8716
9104
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
8717
9105
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
8718
9106
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
8719
- _optionalChain([this, 'access', _245 => _245.platformKit, 'optionalAccess', _246 => _246.gitConfig, 'call', _247 => _247()]);
9107
+ _optionalChain([this, 'access', _285 => _285.platformKit, 'optionalAccess', _286 => _286.gitConfig, 'call', _287 => _287()]);
8720
9108
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
8721
9109
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
8722
9110
  if (!processOwnCommits) {
@@ -8748,7 +9136,7 @@ var InBranchFlow = class extends IntegrationFlow {
8748
9136
  // src/cli/cmd/ci/flows/pull-request.ts
8749
9137
  var PullRequestFlow = class extends InBranchFlow {
8750
9138
  async preRun() {
8751
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _248 => _248()]);
9139
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _288 => _288()]);
8752
9140
  if (!canContinue) {
8753
9141
  return false;
8754
9142
  }
@@ -9011,10 +9399,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
9011
9399
  repo_slug: this.platformConfig.repositoryName,
9012
9400
  state: "OPEN"
9013
9401
  }).then(({ data: { values } }) => {
9014
- return _optionalChain([values, 'optionalAccess', _249 => _249.find, 'call', _250 => _250(
9015
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _251 => _251.branch, 'optionalAccess', _252 => _252.name]) === branch && _optionalChain([destination, 'optionalAccess', _253 => _253.branch, 'optionalAccess', _254 => _254.name]) === this.platformConfig.baseBranchName
9402
+ return _optionalChain([values, 'optionalAccess', _289 => _289.find, 'call', _290 => _290(
9403
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _291 => _291.branch, 'optionalAccess', _292 => _292.name]) === branch && _optionalChain([destination, 'optionalAccess', _293 => _293.branch, 'optionalAccess', _294 => _294.name]) === this.platformConfig.baseBranchName
9016
9404
  )]);
9017
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _255 => _255.id]));
9405
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _295 => _295.id]));
9018
9406
  }
9019
9407
  async closePullRequest({ pullRequestNumber }) {
9020
9408
  await this.bb.repositories.declinePullRequest({
@@ -9110,7 +9498,7 @@ var GitHubPlatformKit = class extends PlatformKit {
9110
9498
  repo: this.platformConfig.repositoryName,
9111
9499
  base: this.platformConfig.baseBranchName,
9112
9500
  state: "open"
9113
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _256 => _256.number]));
9501
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _296 => _296.number]));
9114
9502
  }
9115
9503
  async closePullRequest({ pullRequestNumber }) {
9116
9504
  await this.octokit.rest.pulls.update({
@@ -9237,7 +9625,7 @@ var GitlabPlatformKit = class extends PlatformKit {
9237
9625
  sourceBranch: branch,
9238
9626
  state: "opened"
9239
9627
  });
9240
- return _optionalChain([mergeRequests, 'access', _257 => _257[0], 'optionalAccess', _258 => _258.iid]);
9628
+ return _optionalChain([mergeRequests, 'access', _297 => _297[0], 'optionalAccess', _298 => _298.iid]);
9241
9629
  }
9242
9630
  async closePullRequest({
9243
9631
  pullRequestNumber
@@ -9327,7 +9715,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
9327
9715
  }
9328
9716
  const env = {
9329
9717
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
9330
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _259 => _259.pullRequest, 'optionalAccess', _260 => _260.toString, 'call', _261 => _261()]) || "false",
9718
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _299 => _299.pullRequest, 'optionalAccess', _300 => _300.toString, 'call', _301 => _301()]) || "false",
9331
9719
  ...options.commitMessage && {
9332
9720
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
9333
9721
  },
@@ -9347,7 +9735,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
9347
9735
  const { isPullRequestMode } = platformKit.config;
9348
9736
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
9349
9737
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
9350
- const canRun = await _optionalChain([flow, 'access', _262 => _262.preRun, 'optionalCall', _263 => _263()]);
9738
+ const canRun = await _optionalChain([flow, 'access', _302 => _302.preRun, 'optionalCall', _303 => _303()]);
9351
9739
  if (canRun === false) {
9352
9740
  return;
9353
9741
  }
@@ -9357,7 +9745,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
9357
9745
  if (!hasChanges) {
9358
9746
  return;
9359
9747
  }
9360
- await _optionalChain([flow, 'access', _264 => _264.postRun, 'optionalCall', _265 => _265()]);
9748
+ await _optionalChain([flow, 'access', _304 => _304.postRun, 'optionalCall', _305 => _305()]);
9361
9749
  });
9362
9750
  function parseBooleanArg(val) {
9363
9751
  if (val === true) return true;
@@ -9426,17 +9814,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
9426
9814
  flags
9427
9815
  });
9428
9816
  let buckets = getBuckets(i18nConfig);
9429
- if (_optionalChain([flags, 'access', _266 => _266.bucket, 'optionalAccess', _267 => _267.length])) {
9817
+ if (_optionalChain([flags, 'access', _306 => _306.bucket, 'optionalAccess', _307 => _307.length])) {
9430
9818
  buckets = buckets.filter(
9431
9819
  (bucket) => flags.bucket.includes(bucket.type)
9432
9820
  );
9433
9821
  }
9434
9822
  ora.succeed("Buckets retrieved");
9435
- if (_optionalChain([flags, 'access', _268 => _268.file, 'optionalAccess', _269 => _269.length])) {
9823
+ if (_optionalChain([flags, 'access', _308 => _308.file, 'optionalAccess', _309 => _309.length])) {
9436
9824
  buckets = buckets.map((bucket) => {
9437
9825
  const paths = bucket.paths.filter(
9438
9826
  (path17) => flags.file.find(
9439
- (file) => _optionalChain([path17, 'access', _270 => _270.pathPattern, 'optionalAccess', _271 => _271.includes, 'call', _272 => _272(file)]) || _optionalChain([path17, 'access', _273 => _273.pathPattern, 'optionalAccess', _274 => _274.match, 'call', _275 => _275(file)]) || minimatch(path17.pathPattern, file)
9827
+ (file) => _optionalChain([path17, 'access', _310 => _310.pathPattern, 'optionalAccess', _311 => _311.includes, 'call', _312 => _312(file)]) || _optionalChain([path17, 'access', _313 => _313.pathPattern, 'optionalAccess', _314 => _314.match, 'call', _315 => _315(file)]) || minimatch(path17.pathPattern, file)
9440
9828
  )
9441
9829
  );
9442
9830
  return { ...bucket, paths };
@@ -9456,7 +9844,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
9456
9844
  });
9457
9845
  }
9458
9846
  }
9459
- const targetLocales = _optionalChain([flags, 'access', _276 => _276.locale, 'optionalAccess', _277 => _277.length]) ? flags.locale : i18nConfig.locale.targets;
9847
+ const targetLocales = _optionalChain([flags, 'access', _316 => _316.locale, 'optionalAccess', _317 => _317.length]) ? flags.locale : i18nConfig.locale.targets;
9460
9848
  let totalSourceKeyCount = 0;
9461
9849
  let uniqueKeysToTranslate = 0;
9462
9850
  let totalExistingTranslations = 0;
@@ -9860,12 +10248,12 @@ function validateParams2(i18nConfig, flags) {
9860
10248
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
9861
10249
  docUrl: "bucketNotFound"
9862
10250
  });
9863
- } else if (_optionalChain([flags, 'access', _278 => _278.locale, 'optionalAccess', _279 => _279.some, 'call', _280 => _280((locale) => !i18nConfig.locale.targets.includes(locale))])) {
10251
+ } else if (_optionalChain([flags, 'access', _318 => _318.locale, 'optionalAccess', _319 => _319.some, 'call', _320 => _320((locale) => !i18nConfig.locale.targets.includes(locale))])) {
9864
10252
  throw new CLIError({
9865
10253
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
9866
10254
  docUrl: "localeTargetNotFound"
9867
10255
  });
9868
- } else if (_optionalChain([flags, 'access', _281 => _281.bucket, 'optionalAccess', _282 => _282.some, 'call', _283 => _283(
10256
+ } else if (_optionalChain([flags, 'access', _321 => _321.bucket, 'optionalAccess', _322 => _322.some, 'call', _323 => _323(
9869
10257
  (bucket) => !i18nConfig.buckets[bucket]
9870
10258
  )])) {
9871
10259
  throw new CLIError({
@@ -9954,7 +10342,7 @@ async function renderHero2() {
9954
10342
  // package.json
9955
10343
  var package_default = {
9956
10344
  name: "lingo.dev",
9957
- version: "0.105.1",
10345
+ version: "0.105.2",
9958
10346
  description: "Lingo.dev CLI",
9959
10347
  private: false,
9960
10348
  publishConfig: {
@@ -10229,7 +10617,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
10229
10617
  if (options.file && options.file.length) {
10230
10618
  buckets = buckets.map((bucket) => {
10231
10619
  const paths = bucket.paths.filter(
10232
- (bucketPath) => _optionalChain([options, 'access', _284 => _284.file, 'optionalAccess', _285 => _285.some, 'call', _286 => _286((f) => bucketPath.pathPattern.includes(f))])
10620
+ (bucketPath) => _optionalChain([options, 'access', _324 => _324.file, 'optionalAccess', _325 => _325.some, 'call', _326 => _326((f) => bucketPath.pathPattern.includes(f))])
10233
10621
  );
10234
10622
  return { ...bucket, paths };
10235
10623
  }).filter((bucket) => bucket.paths.length > 0);