siluzan-tso-cli 1.1.69-beta.1 → 1.1.69-beta.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/dist/index.js CHANGED
@@ -7616,7 +7616,8 @@ var init_google_analysis = __esm({
7616
7616
  "// \u4E2D\u6587\u8BD1\u540D\uFF1A`countryOrRegionZh`\uFF08\u7531 `countryOrRegion` \u7ECF geo-en2zh.json \u7FFB\u8BD1\uFF0C\u76EE\u524D\u8986\u76D6 105 \u4E2A\u56FD\u5BB6/\u5730\u533A\uFF1B\u672A\u547D\u4E2D\u65F6\u8BE5\u5B57\u6BB5\u7F3A\u7701\uFF09\u3002"
7617
7617
  ],
7618
7618
  "geo-targeted": [
7619
- "// \u5F53\u524D\u4ECD\u5728\u6295\u653E\u7684\u5B9A\u4F4D\uFF08\u5DF2\u79FB\u9664\u56FD\u5BB6\u4E0D\u4F1A\u51FA\u73B0\uFF09\u3002\u4E2D\u6587\u8BD1\u540D\uFF1A`countryOrRegionZh`\uFF08\u7531 `countryOrRegion` \u7ECF geo-en2zh.json \u7FFB\u8BD1\uFF1B\u672A\u547D\u4E2D\u65F6\u8BE5\u5B57\u6BB5\u7F3A\u7701\uFF09\u3002",
7619
+ "// \u5F53\u524D\u4ECD\u5728\u6295\u653E\u7684\u5B9A\u4F4D\uFF08\u5DF2\u79FB\u9664\u56FD\u5BB6\u4E0D\u4F1A\u51FA\u73B0\uFF09\u3002\u6BCF\u884C\u6709\u6240\u5C5E\u7CFB\u5217\u7684 `channelTypeV2`\uFF08SEARCH / DISPLAY / PERFORMANCE_MAX \u7B49\uFF09\u3002\u6309\u6E20\u9053\u7B5B\u5B9A\u4F4D\u76F4\u63A5\u8BFB\u8FD9\u4E2A\u5B57\u6BB5\u3002",
7620
+ "// \u4E2D\u6587\u8BD1\u540D\uFF1A`countryOrRegionZh`\uFF08\u7531 `countryOrRegion` \u7ECF geo-en2zh.json \u7FFB\u8BD1\uFF1B\u672A\u547D\u4E2D\u65F6\u8BE5\u5B57\u6BB5\u7F3A\u7701\uFF09\u3002",
7620
7621
  "// `ctr` \u5DF2\u6298\u6210 0~1 \u5C0F\u6570\uFF1B`conversionRate` \u7F51\u5173\u672C\u8EAB\u5C31\u662F 0~1\uFF0C\u4E0D\u8981\u518D \xF7100\u3002"
7621
7622
  ],
7622
7623
  "geo-matched": [
@@ -7686,8 +7687,8 @@ var init_bid_modifier_display = __esm({
7686
7687
  });
7687
7688
 
7688
7689
  // src/commands/facebook-analysis/xlsx-style-engine.ts
7689
- import fs13 from "fs";
7690
- import path18 from "path";
7690
+ import fs14 from "fs";
7691
+ import path19 from "path";
7691
7692
  function resolveAccent(accent) {
7692
7693
  if (!accent) return PLATFORM_ACCENTS.default;
7693
7694
  const hex = accent.replace(/^#/, "");
@@ -8176,9 +8177,9 @@ var init_xlsx_style_engine = __esm({
8176
8177
  return zipStore(files);
8177
8178
  }
8178
8179
  writeFile(filePath) {
8179
- const abs = path18.resolve(filePath);
8180
- fs13.mkdirSync(path18.dirname(abs), { recursive: true });
8181
- fs13.writeFileSync(abs, this.toBuffer());
8180
+ const abs = path19.resolve(filePath);
8181
+ fs14.mkdirSync(path19.dirname(abs), { recursive: true });
8182
+ fs14.writeFileSync(abs, this.toBuffer());
8182
8183
  return abs;
8183
8184
  }
8184
8185
  };
@@ -9553,6 +9554,7 @@ function targetedLocationsToGeographic(raw) {
9553
9554
  countryOrRegion: typeof row.locationName === "string" ? row.locationName : "",
9554
9555
  campaignId: row.campaignId == null ? void 0 : String(row.campaignId),
9555
9556
  campaignName: typeof row.campaignName === "string" ? row.campaignName : "",
9557
+ ...typeof row.channelTypeV2 === "string" && row.channelTypeV2 ? { channelTypeV2: row.channelTypeV2 } : {},
9556
9558
  impressions: finiteNumber2(row.impressions),
9557
9559
  clicks: finiteNumber2(row.clicks),
9558
9560
  ctr: finiteNumber2(row.ctr) / 100,
@@ -105137,22 +105139,22 @@ var init_demand_gen_report_content = __esm({
105137
105139
  });
105138
105140
 
105139
105141
  // src/commands/google-analysis/demand-gen-render.ts
105140
- import fs31 from "fs";
105142
+ import fs32 from "fs";
105141
105143
  import fsPromises2 from "fs/promises";
105142
- import path36 from "path";
105144
+ import path37 from "path";
105143
105145
  import { fileURLToPath as fileURLToPath9 } from "url";
105144
105146
  function resolveSkillTemplatePath3(basename13) {
105145
- const dir = path36.dirname(fileURLToPath9(import.meta.url));
105147
+ const dir = path37.dirname(fileURLToPath9(import.meta.url));
105146
105148
  const candidates = [
105147
- path36.join(dir, "skill", "report-templates", basename13),
105148
- path36.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
105149
- path36.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", basename13),
105150
- path36.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
105149
+ path37.join(dir, "skill", "report-templates", basename13),
105150
+ path37.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
105151
+ path37.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", basename13),
105152
+ path37.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
105151
105153
  ];
105152
105154
  for (const candidate of candidates) {
105153
- if (fs31.existsSync(candidate)) return candidate;
105155
+ if (fs32.existsSync(candidate)) return candidate;
105154
105156
  }
105155
- return path36.join(dir, "skill", "report-templates", basename13);
105157
+ return path37.join(dir, "skill", "report-templates", basename13);
105156
105158
  }
105157
105159
  function demandGenReportTemplatePath() {
105158
105160
  return resolveSkillTemplatePath3(TEMPLATE_BASENAME);
@@ -105173,7 +105175,7 @@ function injectDemandGenReport(html, payload) {
105173
105175
  return html.replace(DEMAND_GEN_INJECT_MARKER, `window.__DEMAND_GEN_REPORT__ = ${json};`);
105174
105176
  }
105175
105177
  async function runDemandGenRender(opts) {
105176
- const dataPath = path36.resolve(opts.dataFile);
105178
+ const dataPath = path37.resolve(opts.dataFile);
105177
105179
  const data = asDemandGenReport(await readJsonFile2(dataPath));
105178
105180
  if (opts.lang?.trim()) data.meta.lang = opts.lang.trim();
105179
105181
  const check = validateDemandGenReport(data);
@@ -105188,10 +105190,10 @@ ${formatDemandGenReportErrors(check)}`);
105188
105190
  } catch {
105189
105191
  throw new Error(`\u672A\u627E\u5230\u62A5\u544A\u6A21\u677F\uFF1A${templatePath}\u3002\u8BF7\u5148\u6267\u884C npm run build`);
105190
105192
  }
105191
- const outPath = path36.resolve(
105192
- opts.out ?? path36.join(path36.dirname(dataPath), "demand-gen-analysis-report.html")
105193
+ const outPath = path37.resolve(
105194
+ opts.out ?? path37.join(path37.dirname(dataPath), "demand-gen-analysis-report.html")
105193
105195
  );
105194
- await fsPromises2.mkdir(path36.dirname(outPath), { recursive: true });
105196
+ await fsPromises2.mkdir(path37.dirname(outPath), { recursive: true });
105195
105197
  await fsPromises2.writeFile(outPath, injectDemandGenReport(html, data), "utf8");
105196
105198
  console.log(`
105197
105199
  \u2705 Demand Gen \u6295\u653E\u6570\u636E\u5206\u6790 HTML \u5DF2\u751F\u6210\uFF1A${outPath}
@@ -105209,8 +105211,8 @@ var init_demand_gen_render = __esm({
105209
105211
  });
105210
105212
 
105211
105213
  // src/commands/google-analysis/okki-pmax-search-terms.ts
105212
- import * as fs32 from "fs/promises";
105213
- import * as path37 from "path";
105214
+ import * as fs33 from "fs/promises";
105215
+ import * as path38 from "path";
105214
105216
  function asRecord20(value) {
105215
105217
  if (value && typeof value === "object" && !Array.isArray(value)) return value;
105216
105218
  return null;
@@ -105325,8 +105327,8 @@ async function mapPool(items3, limit, fn) {
105325
105327
  }
105326
105328
  async function readManifest(snapshotDir, accountId) {
105327
105329
  try {
105328
- const raw = await fs32.readFile(
105329
- path37.join(snapshotDir, googleAnalysisManifestFile(accountId)),
105330
+ const raw = await fs33.readFile(
105331
+ path38.join(snapshotDir, googleAnalysisManifestFile(accountId)),
105330
105332
  "utf8"
105331
105333
  );
105332
105334
  const parsed = JSON.parse(raw);
@@ -105345,7 +105347,7 @@ function dateRangeOf(manifest) {
105345
105347
  return { start: range.start, end: range.end };
105346
105348
  }
105347
105349
  async function writePmaxSearchTermsSnapshot(opts) {
105348
- const absDir = path37.resolve(opts.snapshotDir);
105350
+ const absDir = path38.resolve(opts.snapshotDir);
105349
105351
  const manifest = await readManifest(absDir, opts.accountId);
105350
105352
  const range = manifest ? dateRangeOf(manifest) : null;
105351
105353
  if (!manifest || !range) return null;
@@ -105354,7 +105356,7 @@ async function writePmaxSearchTermsSnapshot(opts) {
105354
105356
  const campaignArt = campaignArts.find((art) => art.file.includes(dateTag)) ?? campaignArts.at(-1);
105355
105357
  if (!campaignArt) return null;
105356
105358
  const campaignRaw = JSON.parse(
105357
- await fs32.readFile(path37.join(absDir, campaignArt.file), "utf8")
105359
+ await fs33.readFile(path38.join(absDir, campaignArt.file), "utf8")
105358
105360
  );
105359
105361
  const campaigns = selectPmaxCampaignsWithTraffic(
105360
105362
  Array.isArray(campaignRaw.items) ? campaignRaw.items : []
@@ -105403,9 +105405,9 @@ async function writePmaxSearchTermsSnapshot(opts) {
105403
105405
  items: items3,
105404
105406
  record: null
105405
105407
  };
105406
- await fs32.writeFile(path37.join(absDir, fileName), `${JSON.stringify(envelope, null, 2)}
105408
+ await fs33.writeFile(path38.join(absDir, fileName), `${JSON.stringify(envelope, null, 2)}
105407
105409
  `, "utf8");
105408
- const manifestPath = path37.join(absDir, googleAnalysisManifestFile(opts.accountId));
105410
+ const manifestPath = path38.join(absDir, googleAnalysisManifestFile(opts.accountId));
105409
105411
  await withAsyncLock(manifestPath, async () => {
105410
105412
  const existing = await readManifest(absDir, opts.accountId);
105411
105413
  const merged = mergeGoogleAnalysisManifest(existing, {
@@ -105419,7 +105421,7 @@ async function writePmaxSearchTermsSnapshot(opts) {
105419
105421
  endpointHint: "campaign/pmax/{campaignId}/reports/search"
105420
105422
  }
105421
105423
  });
105422
- await fs32.writeFile(manifestPath, `${JSON.stringify(merged, null, 2)}
105424
+ await fs33.writeFile(manifestPath, `${JSON.stringify(merged, null, 2)}
105423
105425
  `, "utf8");
105424
105426
  });
105425
105427
  return {
@@ -105571,8 +105573,8 @@ var init_okki_display = __esm({
105571
105573
  });
105572
105574
 
105573
105575
  // src/commands/google-analysis/merge-snapshot.ts
105574
- import * as fs33 from "fs/promises";
105575
- import * as path38 from "path";
105576
+ import * as fs34 from "fs/promises";
105577
+ import * as path39 from "path";
105576
105578
  function asRecord22(value) {
105577
105579
  if (value && typeof value === "object" && !Array.isArray(value)) {
105578
105580
  return value;
@@ -105590,7 +105592,7 @@ async function readManifest2(snapshotDir, accountId) {
105590
105592
  const candidates = [];
105591
105593
  if (accountId) candidates.push(googleAnalysisManifestFile(accountId));
105592
105594
  try {
105593
- const entries = await fs33.readdir(snapshotDir);
105595
+ const entries = await fs34.readdir(snapshotDir);
105594
105596
  const manifestNames = entries.filter((n) => n.startsWith("manifest") && n.endsWith(".json"));
105595
105597
  for (const name2 of manifestNames) {
105596
105598
  if (!candidates.includes(name2)) candidates.push(name2);
@@ -105599,7 +105601,7 @@ async function readManifest2(snapshotDir, accountId) {
105599
105601
  }
105600
105602
  for (const name2 of candidates) {
105601
105603
  try {
105602
- const raw = await fs33.readFile(path38.join(snapshotDir, name2), "utf8");
105604
+ const raw = await fs34.readFile(path39.join(snapshotDir, name2), "utf8");
105603
105605
  const parsed = JSON.parse(raw);
105604
105606
  if (Array.isArray(parsed.artifacts) && parsed.artifacts.length > 0) return parsed;
105605
105607
  } catch {
@@ -105609,7 +105611,7 @@ async function readManifest2(snapshotDir, accountId) {
105609
105611
  }
105610
105612
  async function loadSectionFile(snapshotDir, file) {
105611
105613
  try {
105612
- const raw = await fs33.readFile(path38.join(snapshotDir, file), "utf8");
105614
+ const raw = await fs34.readFile(path39.join(snapshotDir, file), "utf8");
105613
105615
  const parsed = JSON.parse(raw);
105614
105616
  if (parsed && typeof parsed === "object") return parsed;
105615
105617
  return null;
@@ -105678,7 +105680,7 @@ async function recoverMissingReportSections(sectionMap, absDir, accountId, prefe
105678
105680
  if (!accountId) return;
105679
105681
  let entries;
105680
105682
  try {
105681
- entries = await fs33.readdir(absDir);
105683
+ entries = await fs34.readdir(absDir);
105682
105684
  } catch {
105683
105685
  return;
105684
105686
  }
@@ -105750,7 +105752,7 @@ function sumCampaignRowsToPeriodKpis(rows) {
105750
105752
  };
105751
105753
  }
105752
105754
  async function mergeGoogleAnalysisSnapshotIntoReport(payload, snapshotDir) {
105753
- const absDir = path38.resolve(snapshotDir);
105755
+ const absDir = path39.resolve(snapshotDir);
105754
105756
  const metaAccountId = typeof asRecord22(payload.meta)?.accountId === "string" ? asRecord22(payload.meta)?.accountId : void 0;
105755
105757
  const manifest = await readManifest2(snapshotDir, metaAccountId);
105756
105758
  if (!manifest) {
@@ -106116,8 +106118,8 @@ var init_okki_report_content = __esm({
106116
106118
  });
106117
106119
 
106118
106120
  // src/commands/google-analysis/okki-merge-snapshot.ts
106119
- import * as fs34 from "fs/promises";
106120
- import * as path39 from "path";
106121
+ import * as fs35 from "fs/promises";
106122
+ import * as path40 from "path";
106121
106123
  function num6(value) {
106122
106124
  const n = Number(value);
106123
106125
  return Number.isFinite(n) ? n : void 0;
@@ -106143,7 +106145,7 @@ async function readManifest3(snapshotDir, accountId) {
106143
106145
  const candidates = [];
106144
106146
  if (accountId) candidates.push(googleAnalysisManifestFile(accountId));
106145
106147
  try {
106146
- const entries = await fs34.readdir(snapshotDir);
106148
+ const entries = await fs35.readdir(snapshotDir);
106147
106149
  for (const name2 of entries.filter((n) => n.startsWith("manifest") && n.endsWith(".json"))) {
106148
106150
  if (!candidates.includes(name2)) candidates.push(name2);
106149
106151
  }
@@ -106151,7 +106153,7 @@ async function readManifest3(snapshotDir, accountId) {
106151
106153
  }
106152
106154
  for (const name2 of candidates) {
106153
106155
  try {
106154
- const raw = await fs34.readFile(path39.join(snapshotDir, name2), "utf8");
106156
+ const raw = await fs35.readFile(path40.join(snapshotDir, name2), "utf8");
106155
106157
  const parsed = JSON.parse(raw);
106156
106158
  if (Array.isArray(parsed.artifacts) && parsed.artifacts.length > 0) return parsed;
106157
106159
  } catch {
@@ -106161,7 +106163,7 @@ async function readManifest3(snapshotDir, accountId) {
106161
106163
  }
106162
106164
  async function loadSectionFile2(snapshotDir, file) {
106163
106165
  try {
106164
- const raw = await fs34.readFile(path39.join(snapshotDir, file), "utf8");
106166
+ const raw = await fs35.readFile(path40.join(snapshotDir, file), "utf8");
106165
106167
  const parsed = JSON.parse(raw);
106166
106168
  if (parsed && typeof parsed === "object") return parsed;
106167
106169
  return null;
@@ -106170,7 +106172,7 @@ async function loadSectionFile2(snapshotDir, file) {
106170
106172
  }
106171
106173
  }
106172
106174
  async function mergeOkkiSnapshotIntoReport(payload, snapshotDir) {
106173
- const absDir = path39.resolve(snapshotDir);
106175
+ const absDir = path40.resolve(snapshotDir);
106174
106176
  const metaAccountId = typeof asRecord23(payload.meta)?.accountId === "string" ? asRecord23(payload.meta)?.accountId : void 0;
106175
106177
  const manifest = await readManifest3(absDir, metaAccountId);
106176
106178
  if (!manifest) {
@@ -106187,7 +106189,7 @@ async function mergeOkkiSnapshotIntoReport(payload, snapshotDir) {
106187
106189
  if (accountId) {
106188
106190
  let entries = [];
106189
106191
  try {
106190
- entries = await fs34.readdir(absDir);
106192
+ entries = await fs35.readdir(absDir);
106191
106193
  } catch {
106192
106194
  entries = [];
106193
106195
  }
@@ -106713,10 +106715,10 @@ var init_okki_render_excel = __esm({
106713
106715
  });
106714
106716
 
106715
106717
  // src/commands/google-analysis/okki-render-report.ts
106716
- import fs35 from "fs/promises";
106717
- import path40 from "path";
106718
+ import fs36 from "fs/promises";
106719
+ import path41 from "path";
106718
106720
  async function readJsonFile3(filePath) {
106719
- const text5 = await fs35.readFile(filePath, "utf8");
106721
+ const text5 = await fs36.readFile(filePath, "utf8");
106720
106722
  try {
106721
106723
  return JSON.parse(text5);
106722
106724
  } catch {
@@ -106730,7 +106732,7 @@ function asPayload(value) {
106730
106732
  throw new Error("\u62A5\u544A\u6570\u636E\u987B\u4E3A JSON \u5BF9\u8C61");
106731
106733
  }
106732
106734
  async function runGoogleAnalysisOkkiRender(opts) {
106733
- const dataPath = path40.resolve(opts.dataFile);
106735
+ const dataPath = path41.resolve(opts.dataFile);
106734
106736
  const snapshotDir = opts.snapshotDir?.trim();
106735
106737
  if (!snapshotDir) {
106736
106738
  console.error("\n\u274C okki-render \u5FC5\u987B\u4F20 --snapshot-dir\uFF08google-analysis --json-out \u76EE\u5F55\uFF09\n");
@@ -106738,7 +106740,7 @@ async function runGoogleAnalysisOkkiRender(opts) {
106738
106740
  }
106739
106741
  let data = asPayload(await readJsonFile3(dataPath));
106740
106742
  try {
106741
- data = await mergeOkkiSnapshotIntoReport(data, path40.resolve(snapshotDir));
106743
+ data = await mergeOkkiSnapshotIntoReport(data, path41.resolve(snapshotDir));
106742
106744
  } catch (err) {
106743
106745
  console.error(`
106744
106746
  \u274C ${err instanceof Error ? err.message : String(err)}
@@ -106758,10 +106760,10 @@ async function runGoogleAnalysisOkkiRender(opts) {
106758
106760
  );
106759
106761
  process.exit(1);
106760
106762
  }
106761
- const outPath = path40.resolve(
106762
- opts.out ?? path40.join(path40.dirname(dataPath), "okki-weekly-report.xlsx")
106763
+ const outPath = path41.resolve(
106764
+ opts.out ?? path41.join(path41.dirname(dataPath), "okki-weekly-report.xlsx")
106763
106765
  );
106764
- await fs35.mkdir(path40.dirname(outPath), { recursive: true });
106766
+ await fs36.mkdir(path41.dirname(outPath), { recursive: true });
106765
106767
  writeOkkiWeeklyExcel(outPath, data, lang);
106766
106768
  console.log(`
106767
106769
  \u2705 OKKI \u5468\u62A5\u5DF2\u751F\u6210\uFF1A${outPath}
@@ -106934,19 +106936,19 @@ var init_report_content = __esm({
106934
106936
  });
106935
106937
 
106936
106938
  // src/commands/google-analysis/render-report.ts
106937
- import fs36 from "fs";
106939
+ import fs37 from "fs";
106938
106940
  import fsPromises3 from "fs/promises";
106939
- import path41 from "path";
106941
+ import path42 from "path";
106940
106942
  import { fileURLToPath as fileURLToPath10 } from "url";
106941
106943
  function resolveSkillTemplatePath4(basename13) {
106942
- const dir = path41.dirname(fileURLToPath10(import.meta.url));
106944
+ const dir = path42.dirname(fileURLToPath10(import.meta.url));
106943
106945
  const candidates = [
106944
- path41.join(dir, "skill", "report-templates", basename13),
106945
- path41.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
106946
- path41.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
106946
+ path42.join(dir, "skill", "report-templates", basename13),
106947
+ path42.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
106948
+ path42.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
106947
106949
  ];
106948
106950
  for (const p of candidates) {
106949
- if (fs36.existsSync(p)) return p;
106951
+ if (fs37.existsSync(p)) return p;
106950
106952
  }
106951
106953
  return candidates[0];
106952
106954
  }
@@ -106976,10 +106978,10 @@ function injectReportData2(html, payload, lang) {
106976
106978
  return localized.replace(INJECT_MARKER, `window.__GOOGLE_PERIOD_REPORT__ = ${json};`);
106977
106979
  }
106978
106980
  async function runGoogleAnalysisRender(opts) {
106979
- const dataPath = path41.resolve(opts.dataFile);
106981
+ const dataPath = path42.resolve(opts.dataFile);
106980
106982
  let data = asRecord25(await readJsonFile4(dataPath));
106981
106983
  if (opts.snapshotDir?.trim()) {
106982
- data = await mergeGoogleAnalysisSnapshotIntoReport(data, path41.resolve(opts.snapshotDir));
106984
+ data = await mergeGoogleAnalysisSnapshotIntoReport(data, path42.resolve(opts.snapshotDir));
106983
106985
  }
106984
106986
  const lang = readReportLangOrExit({ flag: opts.lang, meta: data.meta });
106985
106987
  const contentCheck = validateGooglePeriodReportContent(data);
@@ -107006,10 +107008,10 @@ async function runGoogleAnalysisRender(opts) {
107006
107008
  `);
107007
107009
  process.exit(1);
107008
107010
  }
107009
- const outPath = path41.resolve(
107010
- opts.out ?? path41.join(path41.dirname(dataPath), "google-period-report.html")
107011
+ const outPath = path42.resolve(
107012
+ opts.out ?? path42.join(path42.dirname(dataPath), "google-period-report.html")
107011
107013
  );
107012
- const outDir = path41.dirname(outPath);
107014
+ const outDir = path42.dirname(outPath);
107013
107015
  await fsPromises3.mkdir(outDir, { recursive: true });
107014
107016
  await fsPromises3.writeFile(outPath, injectReportData2(html, data, lang), "utf8");
107015
107017
  const { stats } = contentCheck;
@@ -107041,8 +107043,8 @@ var init_render_report = __esm({
107041
107043
 
107042
107044
  // src/utils/batch-runner.ts
107043
107045
  import { performance as performance2 } from "perf_hooks";
107044
- import * as path42 from "path";
107045
- import * as fs37 from "fs/promises";
107046
+ import * as path43 from "path";
107047
+ import * as fs38 from "fs/promises";
107046
107048
  async function runPool(items3, concurrencyRef, worker, signal) {
107047
107049
  let cursor = 0;
107048
107050
  const launch = () => {
@@ -107181,7 +107183,7 @@ async function runBatch(opts) {
107181
107183
  }
107182
107184
  const inner = {
107183
107185
  ...emptyProgress(
107184
- opts.paths.runDir.split(path42.sep).pop() ?? "run",
107186
+ opts.paths.runDir.split(path43.sep).pop() ?? "run",
107185
107187
  allTasks.length,
107186
107188
  opts.accountConcurrency,
107187
107189
  opts.sectionConcurrency
@@ -107306,7 +107308,7 @@ async function runBatch(opts) {
107306
107308
  signal: aborterToken.signal
107307
107309
  });
107308
107310
  await writer({
107309
- snapshotDir: path42.join(opts.paths.resultsDir, sanitizeAccountSegment(task.accountId)),
107311
+ snapshotDir: path43.join(opts.paths.resultsDir, sanitizeAccountSegment(task.accountId)),
107310
107312
  section: task.section,
107311
107313
  accountId: task.accountId,
107312
107314
  dateRange: result.dateRange,
@@ -107403,7 +107405,7 @@ async function runBatch(opts) {
107403
107405
  };
107404
107406
  }
107405
107407
  async function writeTaskError(paths, errorsDir, task, err, cls) {
107406
- const file = path42.join(errorsDir, `${sanitizeSection(task.section)}.error.json`);
107408
+ const file = path43.join(errorsDir, `${sanitizeSection(task.section)}.error.json`);
107407
107409
  const payload = {
107408
107410
  schemaVersion: 1,
107409
107411
  taskId: task.id,
@@ -107449,10 +107451,10 @@ async function persistRunMetadata(input) {
107449
107451
  accountsTotal: input.accounts.length,
107450
107452
  invocation: input.invocation
107451
107453
  };
107452
- await fs37.mkdir(paths.runDir, { recursive: true });
107453
- await fs37.mkdir(paths.stateDir, { recursive: true });
107454
- await fs37.mkdir(paths.resultsDir, { recursive: true });
107455
- await fs37.mkdir(paths.errorsDir, { recursive: true });
107454
+ await fs38.mkdir(paths.runDir, { recursive: true });
107455
+ await fs38.mkdir(paths.stateDir, { recursive: true });
107456
+ await fs38.mkdir(paths.resultsDir, { recursive: true });
107457
+ await fs38.mkdir(paths.errorsDir, { recursive: true });
107456
107458
  await writeRunManifest(paths, manifest);
107457
107459
  await writeAccounts(paths, input.accounts);
107458
107460
  return paths;
@@ -107517,7 +107519,7 @@ __export(google_analysis_batch_exports, {
107517
107519
  parseAccountIds: () => parseAccountIds,
107518
107520
  registerGoogleAnalysisBatchCommands: () => registerGoogleAnalysisBatchCommands
107519
107521
  });
107520
- import * as path43 from "path";
107522
+ import * as path44 from "path";
107521
107523
  import { performance as performance3 } from "perf_hooks";
107522
107524
  function parseSections(input) {
107523
107525
  if (!input || !input.trim()) return DEFAULT_SECTIONS;
@@ -108136,7 +108138,7 @@ var init_google_analysis_batch = __esm({
108136
108138
  });
108137
108139
 
108138
108140
  // src/commands/google-analysis/register-cli.ts
108139
- import * as path44 from "path";
108141
+ import * as path45 from "path";
108140
108142
  import { performance as performance4 } from "perf_hooks";
108141
108143
  import { Command } from "commander";
108142
108144
  function normalizeAnalysisDateOpts(opts) {
@@ -108312,7 +108314,7 @@ async function runAllSections(opts) {
108312
108314
  }
108313
108315
  const succeeded = results.filter((r) => r.ok).length;
108314
108316
  const failed = results.length - succeeded;
108315
- const absoluteSnapshotDir = path44.resolve(opts.jsonOut);
108317
+ const absoluteSnapshotDir = path45.resolve(opts.jsonOut);
108316
108318
  const summary = {
108317
108319
  kind: "siluzan-tso-google-analysis-snapshot-batch",
108318
108320
  absoluteSnapshotDir,
@@ -108596,8 +108598,8 @@ var init_google_analysis3 = __esm({
108596
108598
  // src/index.ts
108597
108599
  init_dist();
108598
108600
  init_dist();
108599
- import * as fs48 from "fs";
108600
- import * as path59 from "path";
108601
+ import * as fs49 from "fs";
108602
+ import * as path60 from "path";
108601
108603
  import { fileURLToPath as fileURLToPath16 } from "url";
108602
108604
  import { Command as Command6 } from "commander";
108603
108605
 
@@ -109087,8 +109089,8 @@ function deriveWebUrl(apiBaseUrl) {
109087
109089
  }
109088
109090
  var TSO_UMI_ROUTE_PREFIX = "/v3umijs/tso";
109089
109091
  function buildTsoPageWebUrl(webUrl, tsoSubRoute, extraQuery) {
109090
- const path60 = tsoSubRoute.replace(/^\/+/, "");
109091
- const umiPath = `${TSO_UMI_ROUTE_PREFIX}/${path60}`;
109092
+ const path61 = tsoSubRoute.replace(/^\/+/, "");
109093
+ const umiPath = `${TSO_UMI_ROUTE_PREFIX}/${path61}`;
109092
109094
  const q = new URLSearchParams({ tso: umiPath });
109093
109095
  if (extraQuery) {
109094
109096
  for (const [key, value] of Object.entries(extraQuery)) {
@@ -109096,7 +109098,7 @@ function buildTsoPageWebUrl(webUrl, tsoSubRoute, extraQuery) {
109096
109098
  if (v) q.set(key, v);
109097
109099
  }
109098
109100
  }
109099
- return `${webUrl.replace(/\/+$/, "")}/v3/foreign_trade/tso/${path60}?${q.toString()}`;
109101
+ return `${webUrl.replace(/\/+$/, "")}/v3/foreign_trade/tso/${path61}?${q.toString()}`;
109100
109102
  }
109101
109103
  function cmdConfigShow() {
109102
109104
  const shared = readSharedConfig();
@@ -115778,7 +115780,12 @@ init_shared();
115778
115780
 
115779
115781
  // src/commands/ad/campaign.ts
115780
115782
  init_auth();
115783
+ import fs12 from "fs/promises";
115784
+ import path17 from "path";
115781
115785
  init_cli_json_snapshot();
115786
+ init_media_customer_id();
115787
+ init_resumable_scan();
115788
+ init_time_budget();
115782
115789
 
115783
115790
  // src/commands/ad/digest-campaign-reuse.ts
115784
115791
  import fs11 from "fs";
@@ -117339,7 +117346,7 @@ function cloneKeywordBlockShell(block) {
117339
117346
  delete shell["matchTypeV2"];
117340
117347
  return shell;
117341
117348
  }
117342
- function splitKeywordsForBatchJobBlockIfMixed(block, path60, warnings) {
117349
+ function splitKeywordsForBatchJobBlockIfMixed(block, path61, warnings) {
117343
117350
  const declaredUi = matchTypeV2ToUi(readBlockMatchTypeRaw(block));
117344
117351
  const entries = collectKeywordEntriesFromBlock(block);
117345
117352
  if (entries.length === 0) return [block];
@@ -117358,7 +117365,7 @@ function splitKeywordsForBatchJobBlockIfMixed(block, path60, warnings) {
117358
117365
  (ui) => matchTypeUiToV2(ui)
117359
117366
  );
117360
117367
  warnings.push(
117361
- `${path60} \u542B\u591A\u79CD\u5339\u914D\u7C7B\u578B\uFF0C\u5DF2\u81EA\u52A8\u62C6\u5206\u4E3A ${groups.size} \u4E2A KeywordsForBatchJob \u5757\uFF08${labels.join("\u3001")}\uFF09`
117368
+ `${path61} \u542B\u591A\u79CD\u5339\u914D\u7C7B\u578B\uFF0C\u5DF2\u81EA\u52A8\u62C6\u5206\u4E3A ${groups.size} \u4E2A KeywordsForBatchJob \u5757\uFF08${labels.join("\u3001")}\uFF09`
117362
117369
  );
117363
117370
  const shell = cloneKeywordBlockShell(block);
117364
117371
  const splitBlocks = [];
@@ -117378,16 +117385,16 @@ function splitKeywordsForBatchJobBlockIfMixed(block, path60, warnings) {
117378
117385
  }
117379
117386
  return splitBlocks;
117380
117387
  }
117381
- function validateKeywordCore(core, path60, errors, lengthViolations) {
117388
+ function validateKeywordCore(core, path61, errors, lengthViolations) {
117382
117389
  const trimmed = core.trim();
117383
117390
  if (!trimmed) {
117384
- errors.push(`${path60} \u5173\u952E\u8BCD\u8BCD\u5E72\u4E0D\u80FD\u4E3A\u7A7A`);
117391
+ errors.push(`${path61} \u5173\u952E\u8BCD\u8BCD\u5E72\u4E0D\u80FD\u4E3A\u7A7A`);
117385
117392
  return false;
117386
117393
  }
117387
117394
  if (trimmed.length > GOOGLE_KEYWORD_MAX_CORE_LENGTH) {
117388
117395
  if (lengthViolations) {
117389
117396
  pushLengthViolation(lengthViolations, {
117390
- path: path60,
117397
+ path: path61,
117391
117398
  field: "KeywordText",
117392
117399
  kind: "keyword_core",
117393
117400
  limit: GOOGLE_KEYWORD_MAX_CORE_LENGTH,
@@ -117397,13 +117404,13 @@ function validateKeywordCore(core, path60, errors, lengthViolations) {
117397
117404
  });
117398
117405
  }
117399
117406
  errors.push(
117400
- `${path60} \u5173\u952E\u8BCD\u8BCD\u5E72\u8D85\u8FC7 ${GOOGLE_KEYWORD_MAX_CORE_LENGTH} \u5B57\u7B26\uFF08\u5F53\u524D ${trimmed.length}\uFF09\uFF1A"${trimmed}"`
117407
+ `${path61} \u5173\u952E\u8BCD\u8BCD\u5E72\u8D85\u8FC7 ${GOOGLE_KEYWORD_MAX_CORE_LENGTH} \u5B57\u7B26\uFF08\u5F53\u524D ${trimmed.length}\uFF09\uFF1A"${trimmed}"`
117401
117408
  );
117402
117409
  return false;
117403
117410
  }
117404
117411
  if (!VALID_CORE_REGEX.test(trimmed)) {
117405
117412
  errors.push(
117406
- `${path60} \u542B Google \u4E0D\u5141\u8BB8\u7684\u5B57\u7B26\uFF08\u8BCD\u5E72\u4EC5\u5141\u8BB8\u5B57\u6BCD/\u6570\u5B57/\u7A7A\u683C/\u8FDE\u5B57\u7B26/\u53E5\u70B9\uFF09\uFF1A"${trimmed.slice(0, 40)}${trimmed.length > 40 ? "\u2026" : ""}"`
117413
+ `${path61} \u542B Google \u4E0D\u5141\u8BB8\u7684\u5B57\u7B26\uFF08\u8BCD\u5E72\u4EC5\u5141\u8BB8\u5B57\u6BCD/\u6570\u5B57/\u7A7A\u683C/\u8FDE\u5B57\u7B26/\u53E5\u70B9\uFF09\uFF1A"${trimmed.slice(0, 40)}${trimmed.length > 40 ? "\u2026" : ""}"`
117407
117414
  );
117408
117415
  return false;
117409
117416
  }
@@ -117460,10 +117467,10 @@ function canonicalizeKeywordBatchBlock(block, resolvedMatchV2, normalizedTexts,
117460
117467
  }
117461
117468
  }
117462
117469
  }
117463
- function pushKeywordAutoFixWarning(warnings, path60, fieldLabel, trimmedRaw, formatted, declaredUi, beforeUi, matchType, inferredMatchType) {
117470
+ function pushKeywordAutoFixWarning(warnings, path61, fieldLabel, trimmedRaw, formatted, declaredUi, beforeUi, matchType, inferredMatchType) {
117464
117471
  if (inferredMatchType) {
117465
117472
  warnings.push(
117466
- `${path60}.${fieldLabel} \u672A\u6307\u5B9A MatchTypeV2\uFF0C\u5DF2\u6309\u8BCD\u9762\u63A8\u65AD\u4E3A ${matchTypeUiToV2(matchType)}`
117473
+ `${path61}.${fieldLabel} \u672A\u6307\u5B9A MatchTypeV2\uFF0C\u5DF2\u6309\u8BCD\u9762\u63A8\u65AD\u4E3A ${matchTypeUiToV2(matchType)}`
117467
117474
  );
117468
117475
  return false;
117469
117476
  }
@@ -117472,16 +117479,16 @@ function pushKeywordAutoFixWarning(warnings, path60, fieldLabel, trimmedRaw, for
117472
117479
  }
117473
117480
  if (declaredUi && beforeUi !== declaredUi) {
117474
117481
  warnings.push(
117475
- `${path60}.${fieldLabel} MatchTypeV2=${matchTypeUiToV2(declaredUi)} \u4E0E\u8BCD\u9762\u4E0D\u4E00\u81F4\uFF0C\u5DF2\u81EA\u52A8\u4FEE\u590D\u4E3A\uFF1A${formatted}`
117482
+ `${path61}.${fieldLabel} MatchTypeV2=${matchTypeUiToV2(declaredUi)} \u4E0E\u8BCD\u9762\u4E0D\u4E00\u81F4\uFF0C\u5DF2\u81EA\u52A8\u4FEE\u590D\u4E3A\uFF1A${formatted}`
117476
117483
  );
117477
117484
  return false;
117478
117485
  }
117479
117486
  if (formatted !== trimmedRaw) {
117480
- warnings.push(`${path60}.${fieldLabel} \u5DF2\u81EA\u52A8\u4FEE\u590D\u8BCD\u9762\uFF1A${trimmedRaw} \u2192 ${formatted}`);
117487
+ warnings.push(`${path61}.${fieldLabel} \u5DF2\u81EA\u52A8\u4FEE\u590D\u8BCD\u9762\uFF1A${trimmedRaw} \u2192 ${formatted}`);
117481
117488
  }
117482
117489
  return false;
117483
117490
  }
117484
- function normalizeKeywordTextList(texts, matchTypeRaw, path60, fieldLabel, errors, warnings, lengthViolations) {
117491
+ function normalizeKeywordTextList(texts, matchTypeRaw, path61, fieldLabel, errors, warnings, lengthViolations) {
117485
117492
  const declaredUi = matchTypeV2ToUi(matchTypeRaw);
117486
117493
  const normalized = [];
117487
117494
  const seen = /* @__PURE__ */ new Set();
@@ -117490,7 +117497,7 @@ function normalizeKeywordTextList(texts, matchTypeRaw, path60, fieldLabel, error
117490
117497
  for (let k = 0; k < texts.length; k++) {
117491
117498
  const raw = texts[k];
117492
117499
  if (typeof raw !== "string" || !raw.trim()) {
117493
- errors.push(`${path60}.${fieldLabel}[${k}] \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
117500
+ errors.push(`${path61}.${fieldLabel}[${k}] \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
117494
117501
  continue;
117495
117502
  }
117496
117503
  const trimmedRaw = collapseDuplicateSpacesInKeywordText(raw.trim());
@@ -117501,7 +117508,7 @@ function normalizeKeywordTextList(texts, matchTypeRaw, path60, fieldLabel, error
117501
117508
  );
117502
117509
  if (pushKeywordAutoFixWarning(
117503
117510
  warnings,
117504
- path60,
117511
+ path61,
117505
117512
  fieldLabel,
117506
117513
  trimmedRaw,
117507
117514
  formatted,
@@ -117513,11 +117520,11 @@ function normalizeKeywordTextList(texts, matchTypeRaw, path60, fieldLabel, error
117513
117520
  bareWrapped++;
117514
117521
  }
117515
117522
  const core = unwrapKeywordDisplayTextForEdit(formatted);
117516
- if (!validateKeywordCore(core, `${path60}.${fieldLabel}[${k}]`, errors, lengthViolations))
117523
+ if (!validateKeywordCore(core, `${path61}.${fieldLabel}[${k}]`, errors, lengthViolations))
117517
117524
  continue;
117518
117525
  const dedupeKey = `${matchTypeUiToV2(matchType)}:${core.toLowerCase()}`;
117519
117526
  if (seen.has(dedupeKey)) {
117520
- warnings.push(`${path60}.${fieldLabel}[${k}] \u4E0E\u540C\u7EC4\u91CD\u590D\uFF0C\u5DF2\u8DF3\u8FC7\uFF1A${formatted}`);
117527
+ warnings.push(`${path61}.${fieldLabel}[${k}] \u4E0E\u540C\u7EC4\u91CD\u590D\uFF0C\u5DF2\u8DF3\u8FC7\uFF1A${formatted}`);
117521
117528
  continue;
117522
117529
  }
117523
117530
  seen.add(dedupeKey);
@@ -117526,17 +117533,17 @@ function normalizeKeywordTextList(texts, matchTypeRaw, path60, fieldLabel, error
117526
117533
  }
117527
117534
  if (bareWrapped > 0 && declaredUi) {
117528
117535
  warnings.push(
117529
- `${path60}.${fieldLabel}\uFF1A${bareWrapped} \u4E2A\u88F8\u8BCD\u5DF2\u6309 MatchTypeV2=${matchTypeUiToV2(declaredUi)} \u81EA\u52A8\u4FEE\u590D\uFF08\u8865\u5168${declaredUi === "Exact" ? " [ ]" : "\u5F15\u53F7"}\uFF0C\u9884\u671F\u884C\u4E3A\uFF09`
117536
+ `${path61}.${fieldLabel}\uFF1A${bareWrapped} \u4E2A\u88F8\u8BCD\u5DF2\u6309 MatchTypeV2=${matchTypeUiToV2(declaredUi)} \u81EA\u52A8\u4FEE\u590D\uFF08\u8865\u5168${declaredUi === "Exact" ? " [ ]" : "\u5F15\u53F7"}\uFF0C\u9884\u671F\u884C\u4E3A\uFF09`
117530
117537
  );
117531
117538
  }
117532
117539
  return { normalized, resolvedUi };
117533
117540
  }
117534
- function normalizeKeywordsForBatchJobBlock(block, path60, errors, warnings, lengthViolations) {
117541
+ function normalizeKeywordsForBatchJobBlock(block, path61, errors, warnings, lengthViolations) {
117535
117542
  const matchTypeRaw = readBlockMatchTypeRaw(block);
117536
117543
  const declaredUi = matchTypeV2ToUi(matchTypeRaw);
117537
117544
  if (matchTypeRaw !== void 0 && declaredUi === null) {
117538
117545
  errors.push(
117539
- `${path60}.MatchTypeV2 \u65E0\u6548\uFF08${String(matchTypeRaw)}\uFF09\uFF0C\u5408\u6CD5\u503C\uFF1ABROAD | PHRASE | EXACT`
117546
+ `${path61}.MatchTypeV2 \u65E0\u6548\uFF08${String(matchTypeRaw)}\uFF09\uFF0C\u5408\u6CD5\u503C\uFF1ABROAD | PHRASE | EXACT`
117540
117547
  );
117541
117548
  return;
117542
117549
  }
@@ -117551,7 +117558,7 @@ function normalizeKeywordsForBatchJobBlock(block, path60, errors, warnings, leng
117551
117558
  const result = normalizeKeywordTextList(
117552
117559
  texts,
117553
117560
  matchTypeRaw,
117554
- path60,
117561
+ path61,
117555
117562
  "KeywordText",
117556
117563
  errors,
117557
117564
  warnings,
@@ -117560,7 +117567,7 @@ function normalizeKeywordsForBatchJobBlock(block, path60, errors, warnings, leng
117560
117567
  normalizedTexts = result.normalized;
117561
117568
  if (result.resolvedUi) resolvedUi = result.resolvedUi;
117562
117569
  if (normalizedTexts.length === 0 && texts.length > 0) {
117563
- errors.push(`${path60}.KeywordText \u7ECF\u6821\u9A8C\u540E\u65E0\u6709\u6548\u5173\u952E\u8BCD\uFF0C\u8BF7\u4FEE\u6B63\u8BCD\u9762\u6216 MatchTypeV2`);
117570
+ errors.push(`${path61}.KeywordText \u7ECF\u6821\u9A8C\u540E\u65E0\u6709\u6548\u5173\u952E\u8BCD\uFF0C\u8BF7\u4FEE\u6B63\u8BCD\u9762\u6216 MatchTypeV2`);
117564
117571
  }
117565
117572
  }
117566
117573
  if (hasItems && items3) {
@@ -117568,12 +117575,12 @@ function normalizeKeywordsForBatchJobBlock(block, path60, errors, warnings, leng
117568
117575
  for (let k = 0; k < items3.length; k++) {
117569
117576
  const item = items3[k];
117570
117577
  if (!item || typeof item !== "object") {
117571
- errors.push(`${path60}.Items[${k}] \u5FC5\u987B\u662F\u5BF9\u8C61`);
117578
+ errors.push(`${path61}.Items[${k}] \u5FC5\u987B\u662F\u5BF9\u8C61`);
117572
117579
  continue;
117573
117580
  }
117574
117581
  const raw = readItemText(item);
117575
117582
  if (raw === null || !raw.trim()) {
117576
- errors.push(`${path60}.Items[${k}].Text \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
117583
+ errors.push(`${path61}.Items[${k}].Text \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
117577
117584
  continue;
117578
117585
  }
117579
117586
  const trimmedRaw = collapseDuplicateSpacesInKeywordText(raw.trim());
@@ -117584,7 +117591,7 @@ function normalizeKeywordsForBatchJobBlock(block, path60, errors, warnings, leng
117584
117591
  );
117585
117592
  if (pushKeywordAutoFixWarning(
117586
117593
  warnings,
117587
- path60,
117594
+ path61,
117588
117595
  `Items[${k}].Text`,
117589
117596
  trimmedRaw,
117590
117597
  formatted,
@@ -117593,14 +117600,14 @@ function normalizeKeywordsForBatchJobBlock(block, path60, errors, warnings, leng
117593
117600
  matchType,
117594
117601
  inferredMatchType
117595
117602
  )) {
117596
- warnings.push(`${path60}.Items[${k}].Text \u5DF2\u6309\u5757\u7EA7\u5339\u914D\u7C7B\u578B\u81EA\u52A8\u4FEE\u590D\u4E3A\uFF1A${formatted}`);
117603
+ warnings.push(`${path61}.Items[${k}].Text \u5DF2\u6309\u5757\u7EA7\u5339\u914D\u7C7B\u578B\u81EA\u52A8\u4FEE\u590D\u4E3A\uFF1A${formatted}`);
117597
117604
  }
117598
117605
  const core = unwrapKeywordDisplayTextForEdit(formatted);
117599
- if (!validateKeywordCore(core, `${path60}.Items[${k}].Text`, errors, lengthViolations))
117606
+ if (!validateKeywordCore(core, `${path61}.Items[${k}].Text`, errors, lengthViolations))
117600
117607
  continue;
117601
117608
  const dedupeKey = `${matchTypeUiToV2(matchType)}:${core.toLowerCase()}`;
117602
117609
  if (seen.has(dedupeKey)) {
117603
- warnings.push(`${path60}.Items[${k}].Text \u4E0E\u540C\u7EC4\u91CD\u590D\uFF0C\u5DF2\u8DF3\u8FC7\uFF1A${formatted}`);
117610
+ warnings.push(`${path61}.Items[${k}].Text \u4E0E\u540C\u7EC4\u91CD\u590D\uFF0C\u5DF2\u8DF3\u8FC7\uFF1A${formatted}`);
117604
117611
  continue;
117605
117612
  }
117606
117613
  seen.add(dedupeKey);
@@ -117746,16 +117753,16 @@ function warnIfNegativeKeywordsInPositiveKeywords(campaign, warnings) {
117746
117753
  const raw = texts[ki];
117747
117754
  if (typeof raw !== "string" || !raw.trim()) continue;
117748
117755
  const core = normalizeKeywordCoreForNegativeCheck(raw);
117749
- const path60 = `campaign.AdGroupsForBatchJob[${gi}].KeywordsForBatchJob[${bi}].KeywordText[${ki}]`;
117756
+ const path61 = `campaign.AdGroupsForBatchJob[${gi}].KeywordsForBatchJob[${bi}].KeywordText[${ki}]`;
117750
117757
  if (plannedNegCores.has(core)) {
117751
117758
  warnings.push(
117752
- `${path60} \u8BCD\u9762\u300C${raw}\u300D\u5DF2\u51FA\u73B0\u5728 campaign.NegativeKeywordsForBatchJob\uFF0C\u4E0D\u5E94\u91CD\u590D\u5199\u5165\u6B63\u5411 KeywordsForBatchJob\uFF1B\u5426\u8BCD\u53EA\u653E NegativeKeywordsForBatchJob`
117759
+ `${path61} \u8BCD\u9762\u300C${raw}\u300D\u5DF2\u51FA\u73B0\u5728 campaign.NegativeKeywordsForBatchJob\uFF0C\u4E0D\u5E94\u91CD\u590D\u5199\u5165\u6B63\u5411 KeywordsForBatchJob\uFF1B\u5426\u8BCD\u53EA\u653E NegativeKeywordsForBatchJob`
117753
117760
  );
117754
117761
  continue;
117755
117762
  }
117756
117763
  if (looksLikeStandaloneNegativeKeyword(core)) {
117757
117764
  warnings.push(
117758
- `${path60} \u8BCD\u9762\u300C${raw}\u300D\u7591\u4F3C\u5426\u5B9A\u5173\u952E\u8BCD\uFF08\u5E38\u89C1\u5426\u8BCD\u8BCD\u6839\uFF09\uFF0C\u5E94\u5199\u5165 campaign.NegativeKeywordsForBatchJob\uFF08MatchTypeV2: BROAD\uFF09\uFF0C\u52FF\u653E\u5165 KeywordsForBatchJob`
117765
+ `${path61} \u8BCD\u9762\u300C${raw}\u300D\u7591\u4F3C\u5426\u5B9A\u5173\u952E\u8BCD\uFF08\u5E38\u89C1\u5426\u8BCD\u8BCD\u6839\uFF09\uFF0C\u5E94\u5199\u5165 campaign.NegativeKeywordsForBatchJob\uFF08MatchTypeV2: BROAD\uFF09\uFF0C\u52FF\u653E\u5165 KeywordsForBatchJob`
117759
117766
  );
117760
117767
  }
117761
117768
  }
@@ -118664,6 +118671,8 @@ async function resolveCampaignCustomerName(cfg, config, verbose) {
118664
118671
 
118665
118672
  // src/commands/ad/campaign.ts
118666
118673
  var CAMPAIGN_READBACK_WAIT_MS = 1e3;
118674
+ var CAMPAIGN_LIST_TIMEOUT_MS = 6e4;
118675
+ var CAMPAIGN_LIST_CONCURRENCY = 8;
118667
118676
  function formatGoogleCampaignListStatus(row) {
118668
118677
  const raw = row.statusV2;
118669
118678
  if (raw == null || String(raw).trim() === "") return "-";
@@ -118723,7 +118732,141 @@ async function emitReusedDigestCampaignTypes(opts, hit) {
118723
118732
  }
118724
118733
  console.log(JSON.stringify(payload));
118725
118734
  }
118735
+ function parseCampaignAccountIds(raw) {
118736
+ const parts = (raw ?? "").split(/[,,]+/).map((part) => part.trim()).filter((part) => part !== "");
118737
+ if (parts.length === 0) {
118738
+ console.error("\n\u274C -a/--account \u4E0D\u80FD\u4E3A\u7A7A\u3002\u591A\u4E2A\u8D26\u6237\u7528\u9017\u53F7\u5206\u9694\uFF0C\u4E0D\u8981\u5199 shell \u5FAA\u73AF\u3002\n");
118739
+ process.exit(1);
118740
+ }
118741
+ const ids = [];
118742
+ const seen = /* @__PURE__ */ new Set();
118743
+ for (const part of parts) {
118744
+ const id = normalizeNumericMediaCustomerId(part);
118745
+ if (!id) {
118746
+ console.error(
118747
+ `
118748
+ \u274C account\uFF08customerId\uFF09\u65E0\u6548\uFF1A${part}
118749
+ \u591A\u4E2A\u8D26\u6237\u5199\u6210 -a id1,id2,id3\uFF0C\u6BCF\u4E2A ID \u662F\u7EAF\u6570\u5B57\u6216\u5E26\u8FDE\u5B57\u7B26\u7684 CID\u3002
118750
+ `
118751
+ );
118752
+ process.exit(1);
118753
+ }
118754
+ if (seen.has(id)) continue;
118755
+ seen.add(id);
118756
+ ids.push(id);
118757
+ }
118758
+ return ids;
118759
+ }
118760
+ function campaignListSnapshotFile(snapshotDir, accountId) {
118761
+ const section = normalizeCliSnapshotSection(`ad-campaigns-${accountId}`);
118762
+ const stem = applyIdSuffix(section, slugifyIdSuffix(accountId));
118763
+ return path17.join(path17.resolve(snapshotDir), `${stem}.json`);
118764
+ }
118765
+ async function fileExists(file) {
118766
+ try {
118767
+ await fs12.access(file);
118768
+ return true;
118769
+ } catch {
118770
+ return false;
118771
+ }
118772
+ }
118773
+ function campaignListPayload(data) {
118774
+ const rawItems = data.data ?? [];
118775
+ const items3 = rawItems.map((item) => ({
118776
+ ...item,
118777
+ budget: toDisplayMoney(item.budget),
118778
+ targetSpendBidCeilingYuan: toDisplayMoney(item["targetSpend_BidCeilingAmount"]),
118779
+ targetCpaAmountYuan: toDisplayMoney(item["targetCpa_BidingAmount"]),
118780
+ statusDisplay: formatGoogleCampaignListStatus(item)
118781
+ }));
118782
+ const n = items3.length;
118783
+ const payload = stripLegacyGoogleFieldsIfV2Present({
118784
+ ...wrapListJson({ page: 1, pageSize: Math.max(n, 1), total: n, items: items3 }),
118785
+ code: data.code ?? null,
118786
+ message: data.message ?? null
118787
+ });
118788
+ return { items: items3, payload };
118789
+ }
118790
+ async function fetchCampaignList(opts, account, config) {
118791
+ const googleApiUrl = requireGoogleApi(config);
118792
+ const url = campaignListUrl(googleApiUrl, account, opts.startDate, opts.endDate, opts.fresh);
118793
+ const data = await apiFetch2(
118794
+ url,
118795
+ config,
118796
+ {},
118797
+ opts.verbose,
118798
+ CAMPAIGN_LIST_TIMEOUT_MS
118799
+ );
118800
+ return campaignListPayload(data);
118801
+ }
118802
+ async function runAdCampaignListBatch(opts) {
118803
+ const jsonOut = opts.jsonOut?.trim() ?? "";
118804
+ if (!jsonOut || jsonOut.toLowerCase().endsWith(".json")) {
118805
+ console.error(
118806
+ "\n\u274C \u591A\u4E2A\u8D26\u6237\u5FC5\u987B --json-out <\u76EE\u5F55>\u3002\n \u4F8B\uFF1Asiluzan-tso ad campaigns -a id1,id2 --start <\u65E5\u671F> --end <\u65E5\u671F> --json-out ./camp\n \u4E0D\u8981\u5199\u6210\u5355\u4E2A .json\uFF0C\u4E5F\u4E0D\u8981 while/for \u9010\u6237\u8C03\u7528\u3002\n"
118807
+ );
118808
+ process.exit(1);
118809
+ }
118810
+ const config = loadConfig(opts.token);
118811
+ const budget = resolveTimeBudgetOrExit(void 0);
118812
+ const pending = [];
118813
+ for (const account of opts.accounts) {
118814
+ if (!opts.fresh && await fileExists(campaignListSnapshotFile(jsonOut, account))) continue;
118815
+ pending.push(account);
118816
+ }
118817
+ const failures = [];
118818
+ const scan = await runAccountsWithBudget({
118819
+ ids: pending,
118820
+ concurrency: CAMPAIGN_LIST_CONCURRENCY,
118821
+ budget,
118822
+ run: async (account) => {
118823
+ try {
118824
+ const { payload } = await fetchCampaignList(opts, account, config);
118825
+ await writeCliJsonSnapshot({
118826
+ snapshotDir: jsonOut,
118827
+ section: `ad-campaigns-${account}`,
118828
+ commandHint: account,
118829
+ payload,
118830
+ idSuffix: account
118831
+ });
118832
+ } catch (err) {
118833
+ const message = err instanceof Error ? err.message : String(err);
118834
+ failures.push({ account, error: message.replace(/\s+/g, " ").trim().slice(0, 300) });
118835
+ }
118836
+ }
118837
+ });
118838
+ const summary = {
118839
+ kind: "siluzan-tso-ad-campaigns-batch",
118840
+ ok: failures.length === 0 && scan.completed,
118841
+ state: scan.completed ? "succeeded" : "paused",
118842
+ accounts: opts.accounts.length,
118843
+ skippedExisting: opts.accounts.length - pending.length,
118844
+ fetched: scan.finished - failures.length,
118845
+ failed: failures.length,
118846
+ failures,
118847
+ snapshotDir: path17.resolve(jsonOut),
118848
+ filePattern: "ad-campaigns-<accountId>.json"
118849
+ };
118850
+ if (!scan.completed) {
118851
+ console.log(
118852
+ JSON.stringify({
118853
+ ...summary,
118854
+ resumeCommand: ["siluzan-tso", ...process.argv.slice(2)].join(" "),
118855
+ agentHint: "\u65F6\u95F4\u9884\u7B97\u5185\u6CA1\u62C9\u5B8C\u3002\u5DF2\u843D\u76D8\u7684\u8D26\u6237\u4F1A\u5728\u4E0B\u6B21\u8DF3\u8FC7\u3002\u539F\u6837\u518D\u6267\u884C resumeCommand\uFF0C\u4E0D\u8981\u6539\u6210 while/for \u9010\u6237\u8C03\u7528\u3002"
118856
+ })
118857
+ );
118858
+ process.exit(EXIT_SCAN_PAUSED);
118859
+ }
118860
+ console.log(JSON.stringify(summary));
118861
+ if (pending.length > 0 && failures.length === pending.length) process.exit(1);
118862
+ }
118726
118863
  async function runAdCampaigns(opts) {
118864
+ const accountIds = parseCampaignAccountIds(opts.account);
118865
+ if (accountIds.length > 1) {
118866
+ await runAdCampaignListBatch({ ...opts, account: accountIds.join(","), accounts: accountIds });
118867
+ return;
118868
+ }
118869
+ opts = { ...opts, account: accountIds[0] ?? "" };
118727
118870
  opts = withResolvedAdAccount(opts);
118728
118871
  if (!opts.live) {
118729
118872
  const hit = findDigestCampaignTypes(process.cwd(), opts.account);
@@ -118733,38 +118876,23 @@ async function runAdCampaigns(opts) {
118733
118876
  }
118734
118877
  }
118735
118878
  const config = loadConfig(opts.token);
118736
- const googleApiUrl = requireGoogleApi(config);
118737
- const url = campaignListUrl(googleApiUrl, opts.account, opts.startDate, opts.endDate, opts.fresh);
118738
- let data;
118879
+ let items3;
118880
+ let campaignListPayload2;
118739
118881
  try {
118740
- data = await apiFetch2(url, config, {}, opts.verbose);
118882
+ const loaded = await fetchCampaignList(opts, opts.account, config);
118883
+ items3 = loaded.items;
118884
+ campaignListPayload2 = loaded.payload;
118741
118885
  } catch (err) {
118742
118886
  console.error(`
118743
118887
  \u274C \u67E5\u8BE2\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}
118744
118888
  `);
118745
118889
  process.exit(1);
118746
118890
  }
118747
- const rawItems = data.data ?? [];
118748
- const items3 = rawItems.map((item) => {
118749
- return {
118750
- ...item,
118751
- budget: toDisplayMoney(item.budget),
118752
- targetSpendBidCeilingYuan: toDisplayMoney(item["targetSpend_BidCeilingAmount"]),
118753
- targetCpaAmountYuan: toDisplayMoney(item["targetCpa_BidingAmount"]),
118754
- statusDisplay: formatGoogleCampaignListStatus(item)
118755
- };
118756
- });
118757
- const n = items3.length;
118758
- const campaignListPayload = stripLegacyGoogleFieldsIfV2Present({
118759
- ...wrapListJson({ page: 1, pageSize: Math.max(n, 1), total: n, items: items3 }),
118760
- code: data.code ?? null,
118761
- message: data.message ?? null
118762
- });
118763
118891
  if (await emitCliJsonOrSnapshot(opts, {
118764
118892
  section: `ad-campaigns-${opts.account}`,
118765
118893
  commandLabel: "ad campaigns",
118766
118894
  commandHint: opts.account,
118767
- payload: campaignListPayload,
118895
+ payload: campaignListPayload2,
118768
118896
  idSuffix: opts.account
118769
118897
  })) {
118770
118898
  return;
@@ -119974,8 +120102,8 @@ function normalizePlacementUrl(raw) {
119974
120102
  if (parts.length > 2) {
119975
120103
  throw new Error("\u7248\u4F4D\u7F51\u5740\u6700\u591A\u4E24\u7EA7\u8DEF\u5F84\uFF0C\u4F8B\u5982 http://www.domain.com/news/2024");
119976
120104
  }
119977
- const path60 = parts.length > 0 ? `/${parts.join("/")}` : "";
119978
- return `${url.protocol}//${host}${path60}`;
120105
+ const path61 = parts.length > 0 ? `/${parts.join("/")}` : "";
120106
+ return `${url.protocol}//${host}${path61}`;
119979
120107
  }
119980
120108
  var GROUP_LABEL = {
119981
120109
  sensitive: "\u654F\u611F\u5185\u5BB9",
@@ -120721,7 +120849,7 @@ async function runAdPmaxBrandsDetach(opts) {
120721
120849
  \u2705 \u5DF2\u4ECE\u7CFB\u5217 ${campaignId} \u5378\u4E0B\u54C1\u724C\u5217\u8868 ${criterionId}
120722
120850
  `);
120723
120851
  }
120724
- async function listCampaignRows(opts, path60, label2) {
120852
+ async function listCampaignRows(opts, path61, label2) {
120725
120853
  let campaignId;
120726
120854
  try {
120727
120855
  campaignId = requireCampaignId(opts.campaignId, label2);
@@ -120729,7 +120857,7 @@ async function listCampaignRows(opts, path60, label2) {
120729
120857
  fail(err, "\u53C2\u6570");
120730
120858
  }
120731
120859
  const { config, base: base2, account } = accountBase(opts);
120732
- const url = `${base2}/campaignmanagement/accounts/${account}/${path60}?campaignId=${campaignId}`;
120860
+ const url = `${base2}/campaignmanagement/accounts/${account}/${path61}?campaignId=${campaignId}`;
120733
120861
  let items3;
120734
120862
  try {
120735
120863
  items3 = unwrapItems(await apiFetch2(url, config, {}, opts.verbose));
@@ -120838,17 +120966,17 @@ async function runAdPmaxUrlsAdd(opts) {
120838
120966
  async function runAdPmaxUrlsRemove(opts) {
120839
120967
  await removeCampaignCriterion(opts, "pmax-urls", "\u7F51\u5740\u6392\u9664");
120840
120968
  }
120841
- async function removeCampaignCriterion(opts, path60, label2) {
120969
+ async function removeCampaignCriterion(opts, path61, label2) {
120842
120970
  let campaignId;
120843
120971
  let criterionId;
120844
120972
  try {
120845
- campaignId = requireCampaignId(opts.campaignId, path60);
120973
+ campaignId = requireCampaignId(opts.campaignId, path61);
120846
120974
  criterionId = requireDigits(opts.criterionId, "--criterion-id");
120847
120975
  } catch (err) {
120848
120976
  fail(err, "\u53C2\u6570");
120849
120977
  }
120850
120978
  const { config, base: base2, account } = accountBase(opts);
120851
- const url = `${base2}/campaignmanagement/accounts/${account}/${path60}/${criterionId}?campaignId=${campaignId}`;
120979
+ const url = `${base2}/campaignmanagement/accounts/${account}/${path61}/${criterionId}?campaignId=${campaignId}`;
120852
120980
  try {
120853
120981
  await apiDeleteRaw(url, config, { verbose: opts.verbose });
120854
120982
  } catch (err) {
@@ -122614,8 +122742,8 @@ init_cli_table();
122614
122742
  init_auth();
122615
122743
  init_cli_json_snapshot();
122616
122744
  init_shared();
122617
- import fs12 from "fs";
122618
- import path17 from "path";
122745
+ import fs13 from "fs";
122746
+ import path18 from "path";
122619
122747
 
122620
122748
  // src/commands/ad/campaign-extension-remediate.ts
122621
122749
  function shellArg(value) {
@@ -122759,7 +122887,7 @@ function buildBatchOperationSlots(cfg) {
122759
122887
  const campaign = asRecord3(cfg.campaign) ?? {};
122760
122888
  const names = Array.isArray(cfg.locations) ? cfg.locations : [];
122761
122889
  const slots = [];
122762
- const push = (kind, path60, label2) => slots.push({ index: slots.length, kind, path: path60, label: label2 });
122890
+ const push = (kind, path61, label2) => slots.push({ index: slots.length, kind, path: path61, label: label2 });
122763
122891
  push("campaign_budget", "campaign.Budget", "\u7CFB\u5217\u9884\u7B97");
122764
122892
  push("campaign", "campaign.Name", `\u7CFB\u5217\u300C${pickText(campaign, "Name", "name") || "\u2014"}\u300D`);
122765
122893
  pickArray(campaign, "targetedLocations", "TargetedLocations").forEach((loc, i) => {
@@ -123242,13 +123370,13 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123242
123370
  for (let ki = 0; ki < texts.length; ki++) {
123243
123371
  const t = texts[ki];
123244
123372
  if (typeof t !== "string" || !t.trim()) continue;
123245
- const path60 = `${groupPath}.KeywordsForBatchJob[${bi}].KeywordText[${ki}]`;
123373
+ const path61 = `${groupPath}.KeywordsForBatchJob[${bi}].KeywordText[${ki}]`;
123246
123374
  const key = keywordKey(t, matchTypeV2);
123247
123375
  const plannedContent = `\u8BCD\u9762: ${t} | \u5339\u914D: ${matchTypeV2}`;
123248
123376
  if (groupAbsent) {
123249
123377
  pushItem(items3, {
123250
123378
  layer: "keyword",
123251
- path: path60,
123379
+ path: path61,
123252
123380
  adGroupName: groupName,
123253
123381
  plannedContent,
123254
123382
  status: "skipped",
@@ -123260,7 +123388,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123260
123388
  if (!liveKwKeys.has(key)) {
123261
123389
  pushItem(items3, {
123262
123390
  layer: "keyword",
123263
- path: path60,
123391
+ path: path61,
123264
123392
  adGroupName: groupName,
123265
123393
  plannedContent,
123266
123394
  status: "missing",
@@ -123270,7 +123398,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123270
123398
  } else {
123271
123399
  pushItem(items3, {
123272
123400
  layer: "keyword",
123273
- path: path60,
123401
+ path: path61,
123274
123402
  adGroupName: groupName,
123275
123403
  plannedContent,
123276
123404
  status: "ok",
@@ -123290,7 +123418,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123290
123418
  for (let ai = 0; ai < ads.length; ai++) {
123291
123419
  const ad = asRecord4(ads[ai]);
123292
123420
  if (!ad) continue;
123293
- const path60 = `${groupPath}.AdsForBatchJob[${ai}]`;
123421
+ const path61 = `${groupPath}.AdsForBatchJob[${ai}]`;
123294
123422
  const primary = pickString2(ad["headlinePart1"], ad["AdTitle"]);
123295
123423
  const finalUrl = pickString2(ad["Finalurl"], ad["DestinationUrl"], ad["finalUrl"]);
123296
123424
  const rsaAssets = listPlannedRsaAssets(ad, groupPath, ai, groupName);
@@ -123299,7 +123427,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123299
123427
  if (groupAbsent) {
123300
123428
  pushItem(items3, {
123301
123429
  layer: "ad",
123302
- path: path60,
123430
+ path: path61,
123303
123431
  adGroupName: groupName,
123304
123432
  adLabel,
123305
123433
  plannedContent: primary ? `RSA \u9996\u6807\u9898: ${primary}${finalUrl ? ` | \u843D\u5730\u9875: ${finalUrl}` : ""}` : `AdsForBatchJob[${ai}]\uFF08\u7F3A\u5C11 headlinePart1\uFF09`,
@@ -123328,7 +123456,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123328
123456
  if (!primary) {
123329
123457
  pushItem(items3, {
123330
123458
  layer: "ad",
123331
- path: path60,
123459
+ path: path61,
123332
123460
  adGroupName: groupName,
123333
123461
  adLabel,
123334
123462
  plannedContent: `AdsForBatchJob[${ai}]\uFF08\u7F3A\u5C11 headlinePart1\uFF0C\u65E0\u6CD5\u6BD4\u5BF9\u6574\u6761 RSA\uFF09`,
@@ -123356,7 +123484,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123356
123484
  const rsaFound = matchedLive != null && liveAdHasHeadline(matchedLive, primary);
123357
123485
  pushItem(items3, {
123358
123486
  layer: "ad",
123359
- path: path60,
123487
+ path: path61,
123360
123488
  adGroupName: groupName,
123361
123489
  adLabel,
123362
123490
  plannedContent: `RSA \u9996\u6807\u9898: ${primary}${finalUrl ? ` | \u843D\u5730\u9875: ${finalUrl}` : ""}`,
@@ -123424,11 +123552,11 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123424
123552
  for (let ei = 0; ei < extBlocks.length; ei++) {
123425
123553
  const ext = asRecord4(extBlocks[ei]);
123426
123554
  const plannedContent = formatExtensionPlanned(ext);
123427
- const path60 = `campaign.ExtensionsForBatchJob[${ei}]`;
123555
+ const path61 = `campaign.ExtensionsForBatchJob[${ei}]`;
123428
123556
  if (campaignMissing) {
123429
123557
  pushItem(items3, {
123430
123558
  layer: "extension",
123431
- path: path60,
123559
+ path: path61,
123432
123560
  plannedContent,
123433
123561
  status: "skipped",
123434
123562
  liveNote: "\u7CFB\u5217\u672A\u627E\u5230\uFF0C\u8DF3\u8FC7\u9644\u52A0\u4FE1\u606F\u6BD4\u5BF9",
@@ -123440,7 +123568,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123440
123568
  const remediateCommand = !found && ext && accountId && campaignId ? buildExtensionRemediateCommandLine({ accountId, campaignId, ext }) ?? void 0 : void 0;
123441
123569
  pushItem(items3, {
123442
123570
  layer: "extension",
123443
- path: path60,
123571
+ path: path61,
123444
123572
  plannedContent,
123445
123573
  status: found ? "ok" : "missing",
123446
123574
  liveNote: `\u7CFB\u5217\u7EA7\u9644\u52A0\u4FE1\u606F\u8D26\u6237\u5185 ${liveExt}/${plannedExt} \u6761`,
@@ -123467,11 +123595,11 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123467
123595
  if (!id) continue;
123468
123596
  const displayName = locationNames[li] || pickString2(loc["locationName"], loc["name"], loc["countryOrRegion"]) || "";
123469
123597
  const plannedContent = `locationId: ${id}${displayName ? ` | \u540D\u79F0: ${displayName}` : ""}`;
123470
- const path60 = `campaign.targetedLocations[${li}]`;
123598
+ const path61 = `campaign.targetedLocations[${li}]`;
123471
123599
  if (campaignMissing) {
123472
123600
  pushItem(items3, {
123473
123601
  layer: "location",
123474
- path: path60,
123602
+ path: path61,
123475
123603
  plannedContent,
123476
123604
  status: "skipped",
123477
123605
  liveNote: "\u7CFB\u5217\u672A\u627E\u5230\uFF0C\u8DF3\u8FC7\u5730\u57DF\u6BD4\u5BF9",
@@ -123483,7 +123611,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123483
123611
  const remediateCommand = !found && accountId && campaignId ? buildGeoRemediateCommandLine({ accountId, campaignId, locationId: id }) : void 0;
123484
123612
  pushItem(items3, {
123485
123613
  layer: "location",
123486
- path: path60,
123614
+ path: path61,
123487
123615
  plannedContent,
123488
123616
  status: found ? "ok" : "missing",
123489
123617
  liveNote: `\u7CFB\u5217\u5DF2\u5B9A\u5411 ${liveLocIds.size}/${plannedLocCount} \u4E2A\u5730\u57DF`,
@@ -123503,12 +123631,12 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123503
123631
  const loc = asRecord4(plannedExcl[li]);
123504
123632
  const id = loc ? pickString2(loc["id"], loc["Id"]) : "";
123505
123633
  if (!id) continue;
123506
- const path60 = `campaign.excludedLocations[${li}]`;
123634
+ const path61 = `campaign.excludedLocations[${li}]`;
123507
123635
  const plannedContent = `\u6392\u9664 locationId: ${id}`;
123508
123636
  if (campaignMissing) {
123509
123637
  pushItem(items3, {
123510
123638
  layer: "excluded_location",
123511
- path: path60,
123639
+ path: path61,
123512
123640
  plannedContent,
123513
123641
  status: "skipped",
123514
123642
  liveNote: "\u7CFB\u5217\u672A\u627E\u5230\uFF0C\u8DF3\u8FC7\u6392\u9664\u5730\u57DF\u6BD4\u5BF9",
@@ -123519,7 +123647,7 @@ function compareCampaignCreateToLive(cfg, campaignId, live, meta) {
123519
123647
  const found = liveExclIds.has(id);
123520
123648
  pushItem(items3, {
123521
123649
  layer: "excluded_location",
123522
- path: path60,
123650
+ path: path61,
123523
123651
  plannedContent,
123524
123652
  status: found ? "ok" : "missing",
123525
123653
  liveNote: `\u7CFB\u5217\u5DF2\u6392\u9664 ${liveExclIds.size}/${plannedExclCount} \u4E2A\u5730\u57DF`,
@@ -124065,23 +124193,23 @@ function buildCampaignCreateStatusMarkdown(result, lang = "zh") {
124065
124193
  return lines.join("\n");
124066
124194
  }
124067
124195
  function resolveBatchDiffMdOutPath(opts) {
124068
- if (opts.mdOut?.trim()) return path17.resolve(opts.mdOut.trim());
124196
+ if (opts.mdOut?.trim()) return path18.resolve(opts.mdOut.trim());
124069
124197
  const fileName = `campaign-create-status-${opts.campaignId || "unknown"}.md`;
124070
124198
  if (opts.jsonOut?.trim()) {
124071
124199
  const jsonOut = opts.jsonOut.trim();
124072
- const abs = path17.resolve(jsonOut);
124200
+ const abs = path18.resolve(jsonOut);
124073
124201
  const looksLikeFile = /\.json$/i.test(jsonOut);
124074
124202
  if (looksLikeFile) {
124075
- return path17.join(path17.dirname(abs), fileName);
124203
+ return path18.join(path18.dirname(abs), fileName);
124076
124204
  }
124077
- return path17.join(abs, fileName);
124205
+ return path18.join(abs, fileName);
124078
124206
  }
124079
- return path17.resolve(fileName);
124207
+ return path18.resolve(fileName);
124080
124208
  }
124081
124209
  function writeCampaignCreateStatusMarkdown(result, mdPath, lang = "zh") {
124082
124210
  const reportMarkdown = buildCampaignCreateStatusMarkdown(result, lang);
124083
- fs12.mkdirSync(path17.dirname(mdPath), { recursive: true });
124084
- fs12.writeFileSync(mdPath, reportMarkdown, "utf8");
124211
+ fs13.mkdirSync(path18.dirname(mdPath), { recursive: true });
124212
+ fs13.writeFileSync(mdPath, reportMarkdown, "utf8");
124085
124213
  return { reportMarkdown, reportMarkdownFile: mdPath };
124086
124214
  }
124087
124215
  var USER_DELIVERY_MARKDOWN_BEGIN = "\u2500\u2500 BEGIN_USER_DELIVERY_MARKDOWN \uFF08\u5FC5\u987B\u539F\u6837\u7C98\u8D34\u5230\u5BF9\u7528\u6237\u7684\u4E0B\u4E00\u6761\u6D88\u606F\uFF1B\u7981\u6B62\u6458\u8981\u4EE3\u66FF\uFF1B\u4EA4\u4ED8\u4F18\u5148\u4E8E\u8865\u5EFA\uFF09\u2500\u2500";
@@ -125199,8 +125327,8 @@ function pmaxChannelTypesUrl(googleApiUrl) {
125199
125327
  }
125200
125328
  function pmaxCampaignUrl(googleApiUrl, accountId, campaignId) {
125201
125329
  const base2 = googleApiUrl.replace(/\/$/, "");
125202
- const path60 = `${base2}/accounts/${accountId}/campaign/pmax`;
125203
- return campaignId ? `${path60}/${campaignId}` : path60;
125330
+ const path61 = `${base2}/accounts/${accountId}/campaign/pmax`;
125331
+ return campaignId ? `${path61}/${campaignId}` : path61;
125204
125332
  }
125205
125333
  function pmaxBrandAssetsUrl(googleApiUrl, accountId, campaignId) {
125206
125334
  return `${pmaxCampaignUrl(googleApiUrl, accountId, campaignId)}/brand-assets`;
@@ -125210,8 +125338,8 @@ function pmaxBrandGuidelinesEnableUrl(googleApiUrl, accountId, campaignId) {
125210
125338
  }
125211
125339
  function pmaxAssetGroupUrl(googleApiUrl, accountId, assetGroupId, suffix) {
125212
125340
  const base2 = googleApiUrl.replace(/\/$/, "");
125213
- const path60 = `${base2}/accounts/${accountId}/campaign/pmax/asset-group/${assetGroupId}`;
125214
- return suffix ? `${path60}/${suffix.replace(/^\//, "")}` : path60;
125341
+ const path61 = `${base2}/accounts/${accountId}/campaign/pmax/asset-group/${assetGroupId}`;
125342
+ return suffix ? `${path61}/${suffix.replace(/^\//, "")}` : path61;
125215
125343
  }
125216
125344
  function pmaxCampaignAssetGroupUrl(googleApiUrl, accountId, campaignId) {
125217
125345
  const base2 = googleApiUrl.replace(/\/$/, "");
@@ -128193,8 +128321,8 @@ async function runAdPmaxImageConvert(opts) {
128193
128321
  }
128194
128322
 
128195
128323
  // src/commands/ad/pmax-brand-mgmt.ts
128196
- function loadBrandConfig(path60, accountId, campaignId) {
128197
- const cfg = loadPmaxJsonFile(path60);
128324
+ function loadBrandConfig(path61, accountId, campaignId) {
128325
+ const cfg = loadPmaxJsonFile(path61);
128198
128326
  return {
128199
128327
  ...cfg,
128200
128328
  account: String(cfg["account"] ?? accountId).trim(),
@@ -128963,12 +129091,12 @@ function demandGenConversionsValidateUrl(googleApiUrl, accountId) {
128963
129091
  return `${demandGenCollectionUrl(googleApiUrl, accountId)}/conversions/validate`;
128964
129092
  }
128965
129093
  function demandGenAdGroupUrl(googleApiUrl, accountId, campaignId, adGroupId, suffix) {
128966
- const path60 = `${demandGenCampaignUrl(googleApiUrl, accountId, campaignId)}/ad-groups/${adGroupId}`;
128967
- return suffix ? `${path60}/${suffix.replace(/^\//, "")}` : path60;
129094
+ const path61 = `${demandGenCampaignUrl(googleApiUrl, accountId, campaignId)}/ad-groups/${adGroupId}`;
129095
+ return suffix ? `${path61}/${suffix.replace(/^\//, "")}` : path61;
128968
129096
  }
128969
129097
  function demandGenAdUrl(googleApiUrl, accountId, campaignId, adGroupId, adId, suffix) {
128970
- const path60 = `${demandGenAdGroupUrl(googleApiUrl, accountId, campaignId, adGroupId)}/ads/${adId}`;
128971
- return suffix ? `${path60}/${suffix.replace(/^\//, "")}` : path60;
129098
+ const path61 = `${demandGenAdGroupUrl(googleApiUrl, accountId, campaignId, adGroupId)}/ads/${adId}`;
129099
+ return suffix ? `${path61}/${suffix.replace(/^\//, "")}` : path61;
128972
129100
  }
128973
129101
  function demandGenChannelReportUrl(googleApiUrl, accountId, campaignId, startDate, endDate) {
128974
129102
  const params = new URLSearchParams({ startDate, endDate });
@@ -129072,7 +129200,7 @@ function explainCreateError(err) {
129072
129200
  if (failure) return demandGenResumeHint(failure);
129073
129201
  return err instanceof Error ? err.message : String(err);
129074
129202
  }
129075
- async function postCreate(opts, path60, commandLabel) {
129203
+ async function postCreate(opts, path61, commandLabel) {
129076
129204
  const accountId = requireAccountId(opts.account);
129077
129205
  const raw = loadBody(opts.configFile);
129078
129206
  await withGoogleApi(opts, async (config, googleApiUrl) => {
@@ -129084,7 +129212,7 @@ async function postCreate(opts, path60, commandLabel) {
129084
129212
  fail4(err instanceof Error ? err.message : String(err));
129085
129213
  }
129086
129214
  printIssues(demandGenCreateIssues(body));
129087
- const url = path60 ? `${demandGenCollectionUrl(googleApiUrl, accountId)}/${path60}` : demandGenCollectionUrl(googleApiUrl, accountId);
129215
+ const url = path61 ? `${demandGenCollectionUrl(googleApiUrl, accountId)}/${path61}` : demandGenCollectionUrl(googleApiUrl, accountId);
129088
129216
  let data;
129089
129217
  try {
129090
129218
  data = await pmaxApiFetch(
@@ -129097,7 +129225,7 @@ async function postCreate(opts, path60, commandLabel) {
129097
129225
  fail4(explainCreateError(err));
129098
129226
  }
129099
129227
  const payload = decorateDemandGenRead(data);
129100
- if (await emit({ ...opts, account: accountId }, `ad-demand-gen-${path60 || "create"}`, commandLabel, payload, accountId)) {
129228
+ if (await emit({ ...opts, account: accountId }, `ad-demand-gen-${path61 || "create"}`, commandLabel, payload, accountId)) {
129101
129229
  return;
129102
129230
  }
129103
129231
  console.log(`
@@ -129839,7 +129967,12 @@ function register21(program2) {
129839
129967
  });
129840
129968
  }
129841
129969
  );
129842
- adCmd.command("campaigns").alias("campaign-list").description("\u67E5\u8BE2\u5E7F\u544A\u7CFB\u5217\u5217\u8868\uFF08\u65E5\u671F\u9ED8\u8BA4\u8FD1 30 \u5929\uFF1B\u522B\u540D campaign-list\uFF09").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").option("--start <date>", "\u5F00\u59CB\u65E5\u671F YYYY-MM-DD\uFF08\u9ED8\u8BA4 30 \u5929\u524D\uFF09").option("--end <date>", "\u7ED3\u675F\u65E5\u671F YYYY-MM-DD\uFF08\u9ED8\u8BA4\u4ECA\u5929\uFF09").option(
129970
+ adCmd.command("campaigns").alias("campaign-list").description(
129971
+ "\u67E5\u8BE2\u5E7F\u544A\u7CFB\u5217\u5217\u8868\uFF08\u65E5\u671F\u9ED8\u8BA4\u8FD1 30 \u5929\uFF1B\u522B\u540D campaign-list\uFF09\u3002\u591A\u4E2A\u8D26\u6237\u7528\u9017\u53F7\u4E00\u6B21\u4F20\u5165\uFF0C\u8FDB\u7A0B\u5185\u5E76\u53D1\uFF1B\u7981\u6B62 while/for/xargs \u9010\u6237\u8C03\u7528\u3002"
129972
+ ).requiredOption(
129973
+ "-a, --account <ids>",
129974
+ "\u4E00\u4E2A mediaCustomerId\uFF0C\u6216\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694\uFF08id1,id2\uFF09\u3002\u591A\u4E2A\u65F6\u5FC5\u987B\u5E26 --json-out <\u76EE\u5F55>"
129975
+ ).option("--start <date>", "\u5F00\u59CB\u65E5\u671F YYYY-MM-DD\uFF08\u9ED8\u8BA4 30 \u5929\u524D\uFF09").option("--end <date>", "\u7ED3\u675F\u65E5\u671F YYYY-MM-DD\uFF08\u9ED8\u8BA4\u4ECA\u5929\uFF09").option(
129843
129976
  "--fresh",
129844
129977
  "\u8DF3\u8FC7\u7F51\u5173 60 \u79D2\u7F13\u5B58\uFF0C\u5F3A\u5236\u62C9\u53D6\u6700\u65B0\u6570\u636E\uFF08\u7F51\u5173 newest=true\uFF09\uFF1B\u521A\u521B\u5EFA/\u7F16\u8F91\u5B8C\u60F3\u7ACB\u523B\u770B\u5230\u7ED3\u679C\u65F6\u7528",
129845
129978
  false
@@ -131482,9 +131615,9 @@ function metaAdContext(token) {
131482
131615
  const config = loadConfig(token);
131483
131616
  return { config, facebookApiUrl: requireFacebookApi(config) };
131484
131617
  }
131485
- function adsUrl(facebookApiUrl, account, path60) {
131618
+ function adsUrl(facebookApiUrl, account, path61) {
131486
131619
  const base2 = metaAdsBaseUrl(facebookApiUrl, account);
131487
- const p = path60.startsWith("/") ? path60 : `/${path60}`;
131620
+ const p = path61.startsWith("/") ? path61 : `/${path61}`;
131488
131621
  return `${base2}${p}`;
131489
131622
  }
131490
131623
  async function metaAdGet(url, config, verbose, action) {
@@ -132691,9 +132824,9 @@ async function runMetaAdForms(opts) {
132691
132824
  if (opts.after) params.set("after", opts.after);
132692
132825
  if (opts.before) params.set("before", opts.before);
132693
132826
  const qs = params.toString();
132694
- const path60 = `/pages/${encodeURIComponent(opts.pageId)}/forms${qs ? `?${qs}` : ""}`;
132827
+ const path61 = `/pages/${encodeURIComponent(opts.pageId)}/forms${qs ? `?${qs}` : ""}`;
132695
132828
  const raw = await metaAdGet(
132696
- adsUrl(facebookApiUrl, digits, path60),
132829
+ adsUrl(facebookApiUrl, digits, path61),
132697
132830
  config,
132698
132831
  opts.verbose,
132699
132832
  "\u5217\u8868\u5355\u5931\u8D25"
@@ -132788,8 +132921,8 @@ async function runMetaAdFormCreate(opts) {
132788
132921
 
132789
132922
  // src/commands/meta-ad/plan-render.ts
132790
132923
  init_xlsx_style_engine();
132791
- import fs14 from "fs";
132792
- import path19 from "path";
132924
+ import fs15 from "fs";
132925
+ import path20 from "path";
132793
132926
  init_html();
132794
132927
  init_lang();
132795
132928
  var PENDING = "[\u5F85\u8865]";
@@ -133177,18 +133310,18 @@ function writeMetaLeadPlanExcel(outPath, cfg, lang = "zh") {
133177
133310
  return writeOpsExcel(outPath, cfg, lang);
133178
133311
  }
133179
133312
  function writeMetaLeadPlanMarkdown(outPath, cfg, lang = "zh") {
133180
- const abs = path19.resolve(outPath);
133181
- fs14.mkdirSync(path19.dirname(abs), { recursive: true });
133182
- fs14.writeFileSync(abs, renderMarkdown(cfg, lang), "utf8");
133313
+ const abs = path20.resolve(outPath);
133314
+ fs15.mkdirSync(path20.dirname(abs), { recursive: true });
133315
+ fs15.writeFileSync(abs, renderMarkdown(cfg, lang), "utf8");
133183
133316
  return abs;
133184
133317
  }
133185
133318
  async function runMetaAdPlanRender(opts) {
133186
133319
  const cfg = loadMetaLeadCreateConfig(opts.configFile);
133187
133320
  const lang = readReportLangOrExit({ flag: opts.lang });
133188
- const configDir = path19.dirname(path19.resolve(opts.configFile));
133189
- const xlsxOut = path19.resolve(opts.out || path19.join(configDir, "meta-lead-plan.xlsx"));
133190
- const mdOut = path19.resolve(
133191
- opts.mdOut || path19.join(path19.dirname(xlsxOut), `${path19.parse(xlsxOut).name}.md`)
133321
+ const configDir = path20.dirname(path20.resolve(opts.configFile));
133322
+ const xlsxOut = path20.resolve(opts.out || path20.join(configDir, "meta-lead-plan.xlsx"));
133323
+ const mdOut = path20.resolve(
133324
+ opts.mdOut || path20.join(path20.dirname(xlsxOut), `${path20.parse(xlsxOut).name}.md`)
133192
133325
  );
133193
133326
  const xlsxPath = writeMetaLeadPlanExcel(xlsxOut, cfg, lang);
133194
133327
  const mdPath = writeMetaLeadPlanMarkdown(mdOut, cfg, lang);
@@ -137428,8 +137561,8 @@ async function runOpenAccountYandex(opts) {
137428
137561
 
137429
137562
  // src/commands/open-account/bing.ts
137430
137563
  init_auth();
137431
- import * as fs15 from "fs";
137432
- import * as path20 from "path";
137564
+ import * as fs16 from "fs";
137565
+ import * as path21 from "path";
137433
137566
  init_cli_json_snapshot();
137434
137567
 
137435
137568
  // src/commands/open-account/bing-industry-dict.ts
@@ -137557,8 +137690,8 @@ async function fetchBingIndustryOptions(config, verbose) {
137557
137690
 
137558
137691
  // src/commands/open-account/bing.ts
137559
137692
  async function uploadAttachment(filePath, apiBaseUrl, config, verbose) {
137560
- const fileName = path20.basename(filePath);
137561
- const fileBuffer = fs15.readFileSync(filePath);
137693
+ const fileName = path21.basename(filePath);
137694
+ const fileBuffer = fs16.readFileSync(filePath);
137562
137695
  const mimeType = guessContentType2(fileName);
137563
137696
  const form = new FormData();
137564
137697
  form.append("file", new Blob([fileBuffer], { type: mimeType }), fileName);
@@ -137586,7 +137719,7 @@ async function uploadAttachment(filePath, apiBaseUrl, config, verbose) {
137586
137719
  return { id: data.id, fileName, storageProvider: data.storageProvider ?? "StorageAccount" };
137587
137720
  }
137588
137721
  function guessContentType2(fileName) {
137589
- const ext = path20.extname(fileName).toLowerCase();
137722
+ const ext = path21.extname(fileName).toLowerCase();
137590
137723
  const map = {
137591
137724
  ".jpg": "image/jpeg",
137592
137725
  ".jpeg": "image/jpeg",
@@ -137599,7 +137732,7 @@ function guessContentType2(fileName) {
137599
137732
  }
137600
137733
  async function runOpenAccountBing(opts) {
137601
137734
  const config = loadConfig(opts.token);
137602
- if (!fs15.existsSync(opts.licenseFile)) {
137735
+ if (!fs16.existsSync(opts.licenseFile)) {
137603
137736
  console.error(`
137604
137737
  \u274C \u8425\u4E1A\u6267\u7167\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${opts.licenseFile}
137605
137738
  `);
@@ -138101,13 +138234,13 @@ Google \u5F00\u6237\u884C\u4E1A\uFF08\u7B2C 1 \u9875\uFF0C\u672C\u9875 ${rows.le
138101
138234
 
138102
138235
  // src/commands/open-account/tiktok.ts
138103
138236
  init_auth();
138104
- import * as fs16 from "fs";
138105
- import * as path21 from "path";
138237
+ import * as fs17 from "fs";
138238
+ import * as path22 from "path";
138106
138239
  init_cli_json_snapshot();
138107
138240
  init_cli_table();
138108
138241
  async function uploadLicenseToTikTok(filePath, businessCentreType, config, verbose) {
138109
- const fileName = path21.basename(filePath);
138110
- const fileBuffer = fs16.readFileSync(filePath);
138242
+ const fileName = path22.basename(filePath);
138243
+ const fileBuffer = fs17.readFileSync(filePath);
138111
138244
  const base64Image = fileBuffer.toString("base64");
138112
138245
  const res = await apiFetch2(
138113
138246
  `${config.apiBaseUrl}/command/media-account/tiktok/Upload`,
@@ -138132,7 +138265,7 @@ async function uploadLicenseToTikTok(filePath, businessCentreType, config, verbo
138132
138265
  async function runOpenAccountTikTok(opts) {
138133
138266
  const config = loadConfig(opts.token);
138134
138267
  const bcType = opts.businessCentreType ?? "Shop";
138135
- if (!fs16.existsSync(opts.licenseFile)) {
138268
+ if (!fs17.existsSync(opts.licenseFile)) {
138136
138269
  console.error(`
138137
138270
  \u274C \u8425\u4E1A\u6267\u7167\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${opts.licenseFile}
138138
138271
  `);
@@ -139123,8 +139256,8 @@ function attachLandingPageMeta(lighthouse, resolved) {
139123
139256
  // src/commands/website-diagnosis/shared.ts
139124
139257
  init_dist();
139125
139258
  init_auth();
139126
- import fs17 from "fs/promises";
139127
- import path22 from "path";
139259
+ import fs18 from "fs/promises";
139260
+ import path23 from "path";
139128
139261
  var HTML_FETCH_TIMEOUT_MS = 2e4;
139129
139262
  var HTML_FETCH_MAX_BYTES = 5 * 1024 * 1024;
139130
139263
  var HTML_FETCH_MAX_REDIRECTS = 5;
@@ -139188,17 +139321,17 @@ async function fetchWebsiteHtml(websiteUrl, verbose) {
139188
139321
  }
139189
139322
  }
139190
139323
  async function readWebsiteHtmlFile(filePath) {
139191
- const abs = path22.resolve(filePath);
139324
+ const abs = path23.resolve(filePath);
139192
139325
  let size = 0;
139193
139326
  try {
139194
- const stat2 = await fs17.stat(abs);
139327
+ const stat2 = await fs18.stat(abs);
139195
139328
  if (!stat2.isFile()) throw new Error(`\u9996\u9875 HTML \u4E0D\u662F\u6587\u4EF6\uFF1A${abs}`);
139196
139329
  size = stat2.size;
139197
139330
  } catch (err) {
139198
139331
  if (err instanceof Error && err.message.startsWith("\u9996\u9875 HTML")) throw err;
139199
139332
  throw new Error(`\u627E\u4E0D\u5230\u9996\u9875 HTML\uFF1A${abs}`);
139200
139333
  }
139201
- const fh = await fs17.open(abs, "r");
139334
+ const fh = await fs18.open(abs, "r");
139202
139335
  try {
139203
139336
  const len = Math.min(size, HTML_FETCH_MAX_BYTES);
139204
139337
  const buf = Buffer.alloc(len);
@@ -139376,10 +139509,10 @@ async function runWebsiteDiagnosisCollect(opts) {
139376
139509
 
139377
139510
  // src/commands/website-diagnosis/prepare.ts
139378
139511
  init_cli_json_snapshot();
139379
- import fs18 from "fs";
139380
- import path23 from "path";
139512
+ import fs19 from "fs";
139513
+ import path24 from "path";
139381
139514
  function readJson(filePath) {
139382
- const text5 = fs18.readFileSync(filePath, "utf8");
139515
+ const text5 = fs19.readFileSync(filePath, "utf8");
139383
139516
  try {
139384
139517
  const v = JSON.parse(text5);
139385
139518
  if (!v || typeof v !== "object" || Array.isArray(v)) {
@@ -139409,8 +139542,8 @@ function signalsFromCollectPayload(collect) {
139409
139542
  });
139410
139543
  }
139411
139544
  async function runWebsiteDiagnosisPrepare(opts) {
139412
- const collectPath = path23.resolve(opts.collectFile);
139413
- if (!fs18.existsSync(collectPath)) {
139545
+ const collectPath = path24.resolve(opts.collectFile);
139546
+ if (!fs19.existsSync(collectPath)) {
139414
139547
  console.error(`
139415
139548
  \u274C \u627E\u4E0D\u5230 collect \u6587\u4EF6\uFF1A${collectPath}
139416
139549
  `);
@@ -139419,11 +139552,11 @@ async function runWebsiteDiagnosisPrepare(opts) {
139419
139552
  const collect = readJson(collectPath);
139420
139553
  const signals = signalsFromCollectPayload(collect);
139421
139554
  const scaffold = buildDiagnosisScaffold(signals);
139422
- const outPath = path23.resolve(
139423
- opts.out ?? path23.join(path23.dirname(collectPath), "diagnosis.scaffold.json")
139555
+ const outPath = path24.resolve(
139556
+ opts.out ?? path24.join(path24.dirname(collectPath), "diagnosis.scaffold.json")
139424
139557
  );
139425
- fs18.mkdirSync(path23.dirname(outPath), { recursive: true });
139426
- fs18.writeFileSync(outPath, JSON.stringify(scaffold, null, 2), "utf8");
139558
+ fs19.mkdirSync(path24.dirname(outPath), { recursive: true });
139559
+ fs19.writeFileSync(outPath, JSON.stringify(scaffold, null, 2), "utf8");
139427
139560
  const summary = {
139428
139561
  url: signals.url,
139429
139562
  out: outPath,
@@ -139462,9 +139595,9 @@ async function runWebsiteDiagnosisPrepare(opts) {
139462
139595
  // src/commands/website-diagnosis/render-report.ts
139463
139596
  init_lang();
139464
139597
  init_html();
139465
- import fs19 from "fs";
139598
+ import fs20 from "fs";
139466
139599
  import fsPromises from "fs/promises";
139467
- import path24 from "path";
139600
+ import path25 from "path";
139468
139601
  import { fileURLToPath as fileURLToPath4 } from "url";
139469
139602
 
139470
139603
  // src/commands/website-diagnosis/tracking-probe.ts
@@ -139710,14 +139843,14 @@ var TEMPLATE_BASENAMES = {
139710
139843
  runtime: "website-diagnosis-report.runtime.js"
139711
139844
  };
139712
139845
  function resolveSkillTemplatePath(basename13) {
139713
- const dir = path24.dirname(fileURLToPath4(import.meta.url));
139846
+ const dir = path25.dirname(fileURLToPath4(import.meta.url));
139714
139847
  const candidates = [
139715
- path24.join(dir, "skill", "report-templates", basename13),
139716
- path24.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
139717
- path24.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
139848
+ path25.join(dir, "skill", "report-templates", basename13),
139849
+ path25.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
139850
+ path25.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
139718
139851
  ];
139719
139852
  for (const p of candidates) {
139720
- if (fs19.existsSync(p)) return p;
139853
+ if (fs20.existsSync(p)) return p;
139721
139854
  }
139722
139855
  return candidates[0];
139723
139856
  }
@@ -139809,14 +139942,14 @@ function injectReportData(html, payload, lang) {
139809
139942
  return localized.replace(marker, `window.__WEBSITE_DIAGNOSIS__ = ${json};`);
139810
139943
  }
139811
139944
  async function runWebsiteDiagnosisRender(opts) {
139812
- const dataPath = path24.resolve(opts.dataFile);
139945
+ const dataPath = path25.resolve(opts.dataFile);
139813
139946
  const dataRaw = await readJsonFile(dataPath);
139814
139947
  let data = asRecord6(dataRaw);
139815
139948
  if (opts.collectFile) {
139816
- const collectRaw = await readJsonFile(path24.resolve(opts.collectFile));
139949
+ const collectRaw = await readJsonFile(path25.resolve(opts.collectFile));
139817
139950
  data = mergeCollectLighthouse(data, asRecord6(collectRaw));
139818
139951
  }
139819
- const trackingSource = opts.trackingFile ? await readJsonFile(path24.resolve(opts.trackingFile)) : data.tracking;
139952
+ const trackingSource = opts.trackingFile ? await readJsonFile(path25.resolve(opts.trackingFile)) : data.tracking;
139820
139953
  let tracking;
139821
139954
  try {
139822
139955
  tracking = readTrackingForReport(trackingSource);
@@ -139847,14 +139980,14 @@ async function runWebsiteDiagnosisRender(opts) {
139847
139980
  `);
139848
139981
  process.exit(1);
139849
139982
  }
139850
- const outPath = path24.resolve(
139851
- opts.out ?? path24.join(path24.dirname(dataPath), "website-diagnosis-report.html")
139983
+ const outPath = path25.resolve(
139984
+ opts.out ?? path25.join(path25.dirname(dataPath), "website-diagnosis-report.html")
139852
139985
  );
139853
- const outDir = path24.dirname(outPath);
139986
+ const outDir = path25.dirname(outPath);
139854
139987
  await fsPromises.mkdir(outDir, { recursive: true });
139855
139988
  await fsPromises.writeFile(outPath, injectReportData(html, data, lang), "utf8");
139856
139989
  const runtimeSrc = websiteDiagnosisRuntimePath();
139857
- const runtimeOut = path24.join(outDir, TEMPLATE_BASENAMES.runtime);
139990
+ const runtimeOut = path25.join(outDir, TEMPLATE_BASENAMES.runtime);
139858
139991
  let runtimeCopied = false;
139859
139992
  try {
139860
139993
  await fsPromises.copyFile(runtimeSrc, runtimeOut);
@@ -140065,8 +140198,8 @@ async function runMarketAnalysisCollect(opts) {
140065
140198
  }
140066
140199
 
140067
140200
  // src/commands/market-analysis/render-report.ts
140068
- import fs20 from "fs/promises";
140069
- import path25 from "path";
140201
+ import fs21 from "fs/promises";
140202
+ import path26 from "path";
140070
140203
 
140071
140204
  // src/commands/market-analysis/report-content.ts
140072
140205
  var SILUZAN_ECHARTS_CDN_URL = "https://staticpn.siluzan.com/assets/slz/homeCDN/echarts.min.js";
@@ -140522,10 +140655,10 @@ function resolveMarketAnalysisHtml(data) {
140522
140655
  throw new Error("JSON \u4E2D\u7F3A\u5C11 htmlContent \u6216 rawResponse \u5B57\u6BB5");
140523
140656
  }
140524
140657
  async function runMarketAnalysisRender(opts) {
140525
- const dataPath = path25.resolve(opts.dataFile);
140658
+ const dataPath = path26.resolve(opts.dataFile);
140526
140659
  let dataRaw;
140527
140660
  try {
140528
- dataRaw = JSON.parse(await fs20.readFile(dataPath, "utf8"));
140661
+ dataRaw = JSON.parse(await fs21.readFile(dataPath, "utf8"));
140529
140662
  } catch {
140530
140663
  console.error(`
140531
140664
  \u274C \u65E0\u6CD5\u89E3\u6790 JSON\uFF1A${dataPath}
@@ -140568,11 +140701,11 @@ async function runMarketAnalysisRender(opts) {
140568
140701
  );
140569
140702
  process.exit(1);
140570
140703
  }
140571
- const outPath = path25.resolve(
140572
- opts.out ?? path25.join(path25.dirname(dataPath), "market-analysis-report.html")
140704
+ const outPath = path26.resolve(
140705
+ opts.out ?? path26.join(path26.dirname(dataPath), "market-analysis-report.html")
140573
140706
  );
140574
- await fs20.mkdir(path25.dirname(outPath), { recursive: true });
140575
- await fs20.writeFile(outPath, html, "utf8");
140707
+ await fs21.mkdir(path26.dirname(outPath), { recursive: true });
140708
+ await fs21.writeFile(outPath, html, "utf8");
140576
140709
  const { stats } = contentCheck;
140577
140710
  console.log(`
140578
140711
  \u2705 \u5E02\u573A\u5206\u6790 HTML \u62A5\u544A\u5DF2\u751F\u6210\uFF1A${outPath}
@@ -140619,12 +140752,12 @@ function registerMarketAnalysisCommands(program2) {
140619
140752
 
140620
140753
  // src/commands/google-ads-diagnosis/run-collect.ts
140621
140754
  init_auth();
140622
- import fs25 from "fs/promises";
140623
- import path29 from "path";
140755
+ import fs26 from "fs/promises";
140756
+ import path30 from "path";
140624
140757
 
140625
140758
  // src/commands/google-ads-diagnosis/shared.ts
140626
- import fs21 from "fs";
140627
- import path26 from "path";
140759
+ import fs22 from "fs";
140760
+ import path27 from "path";
140628
140761
  import { fileURLToPath as fileURLToPath5 } from "url";
140629
140762
  var GOOGLE_ADS_DIAGNOSIS_TEMPLATE_BASENAME = "GoogleAdsDiagnosisReport.html";
140630
140763
  var GOOGLE_ADS_DIAGNOSIS_DATA_MARKER = "__REPORT_DATA__";
@@ -140681,15 +140814,15 @@ function buildGoogleAdsDiagnosisNarrativeChecks() {
140681
140814
  }
140682
140815
  var GOOGLE_ADS_DIAGNOSIS_NARRATIVE_CHECKS = buildGoogleAdsDiagnosisNarrativeChecks();
140683
140816
  function resolveSkillTemplatePath2(basename13) {
140684
- const dir = path26.dirname(fileURLToPath5(import.meta.url));
140817
+ const dir = path27.dirname(fileURLToPath5(import.meta.url));
140685
140818
  const candidates = [
140686
- path26.join(dir, "skill", "report-templates", basename13),
140687
- path26.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
140688
- path26.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13),
140689
- path26.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
140819
+ path27.join(dir, "skill", "report-templates", basename13),
140820
+ path27.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
140821
+ path27.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13),
140822
+ path27.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
140690
140823
  ];
140691
140824
  for (const p of candidates) {
140692
- if (fs21.existsSync(p)) return p;
140825
+ if (fs22.existsSync(p)) return p;
140693
140826
  }
140694
140827
  return candidates[0];
140695
140828
  }
@@ -140719,8 +140852,8 @@ function buildGoogleAdsDiagnosisCollectAgentHint(snapDir) {
140719
140852
  }
140720
140853
 
140721
140854
  // src/commands/google-ads-diagnosis/build-report-data.ts
140722
- import fs23 from "fs";
140723
- import path28 from "path";
140855
+ import fs24 from "fs";
140856
+ import path29 from "path";
140724
140857
 
140725
140858
  // src/commands/google-ads-diagnosis/agent-brief.ts
140726
140859
  function buildGoogleAdsDiagnosisAgentBrief(input) {
@@ -140789,8 +140922,8 @@ function buildGoogleAdsDiagnosisAgentBrief(input) {
140789
140922
 
140790
140923
  // src/commands/google-ads-diagnosis/snapshot-io.ts
140791
140924
  init_google_analysis_snapshot();
140792
- import fs22 from "fs";
140793
- import path27 from "path";
140925
+ import fs23 from "fs";
140926
+ import path28 from "path";
140794
140927
  function dateRangeManifest(start, end) {
140795
140928
  if (start && end) return { mode: "range", start, end };
140796
140929
  return null;
@@ -140801,17 +140934,17 @@ function findSectionSnapshotFile(snapDir, section, accountId, start, end) {
140801
140934
  accountId,
140802
140935
  dateRangeManifest(start, end)
140803
140936
  );
140804
- const exactPath = path27.join(snapDir, exactName);
140805
- if (fs22.existsSync(exactPath)) return exactPath;
140937
+ const exactPath = path28.join(snapDir, exactName);
140938
+ if (fs23.existsSync(exactPath)) return exactPath;
140806
140939
  if (start && end) return void 0;
140807
- const files = fs22.readdirSync(snapDir);
140808
- return files.filter((f) => f.startsWith(`${section}-${accountId}`) && f.endsWith(".json")).sort().map((f) => path27.join(snapDir, f)).at(-1);
140940
+ const files = fs23.readdirSync(snapDir);
140941
+ return files.filter((f) => f.startsWith(`${section}-${accountId}`) && f.endsWith(".json")).sort().map((f) => path28.join(snapDir, f)).at(-1);
140809
140942
  }
140810
140943
  function loadSectionSnapshot(snapDir, section, accountId, start, end) {
140811
140944
  const file = findSectionSnapshotFile(snapDir, section, accountId, start, end);
140812
- if (!file || !fs22.existsSync(file)) return null;
140945
+ if (!file || !fs23.existsSync(file)) return null;
140813
140946
  try {
140814
- return JSON.parse(fs22.readFileSync(file, "utf8"));
140947
+ return JSON.parse(fs23.readFileSync(file, "utf8"));
140815
140948
  } catch {
140816
140949
  return null;
140817
140950
  }
@@ -141257,10 +141390,10 @@ function toDailyConversionItem(row) {
141257
141390
  };
141258
141391
  }
141259
141392
  function loadCompanyNameFromSnap(snapDir) {
141260
- const file = path28.join(snapDir, "list-accounts-google.json");
141261
- if (!fs23.existsSync(file)) return void 0;
141393
+ const file = path29.join(snapDir, "list-accounts-google.json");
141394
+ if (!fs24.existsSync(file)) return void 0;
141262
141395
  try {
141263
- const parsed = JSON.parse(fs23.readFileSync(file, "utf8"));
141396
+ const parsed = JSON.parse(fs24.readFileSync(file, "utf8"));
141264
141397
  const item = parsed.items?.[0];
141265
141398
  return item?.ma?.mediaCustomerName?.trim() || item?.mag?.advertiserName?.trim() || void 0;
141266
141399
  } catch {
@@ -141917,7 +142050,7 @@ function invokeGoogleAnalysisCli(opts) {
141917
142050
  }
141918
142051
 
141919
142052
  // src/commands/google-ads-diagnosis/write-draft.ts
141920
- import fs24 from "fs/promises";
142053
+ import fs25 from "fs/promises";
141921
142054
  function asRecord11(value) {
141922
142055
  if (value && typeof value === "object" && !Array.isArray(value)) {
141923
142056
  return value;
@@ -141945,12 +142078,12 @@ function hasAgentNarrative(data) {
141945
142078
  }
141946
142079
  async function writeDiagnosisDraft(opts) {
141947
142080
  try {
141948
- const existing = JSON.parse(await fs24.readFile(opts.draftPath, "utf8"));
142081
+ const existing = JSON.parse(await fs25.readFile(opts.draftPath, "utf8"));
141949
142082
  const record2 = asRecord11(existing);
141950
142083
  if (record2 && hasAgentNarrative(record2)) return "skipped-existing-narrative";
141951
142084
  } catch {
141952
142085
  }
141953
- await fs24.writeFile(opts.draftPath, `${JSON.stringify(opts.reportData, null, 2)}
142086
+ await fs25.writeFile(opts.draftPath, `${JSON.stringify(opts.reportData, null, 2)}
141954
142087
  `, "utf8");
141955
142088
  return "written";
141956
142089
  }
@@ -141987,8 +142120,8 @@ async function runGoogleAdsDiagnosisCollect(opts) {
141987
142120
  console.error("\n\u274C collect \u987B\u540C\u65F6\u6307\u5B9A --start \u4E0E --end\u3002\n");
141988
142121
  process.exit(1);
141989
142122
  }
141990
- const snapDir = path29.resolve(opts.jsonOut);
141991
- await fs25.mkdir(snapDir, { recursive: true });
142123
+ const snapDir = path30.resolve(opts.jsonOut);
142124
+ await fs26.mkdir(snapDir, { recursive: true });
141992
142125
  let degraded = false;
141993
142126
  console.error(`
141994
142127
  \u{1F4E5} google-analysis \u62C9\u6570\uFF1A\u8D26\u6237 ${accountId}\uFF0C${opts.start} ~ ${opts.end}
@@ -142084,13 +142217,13 @@ async function runGoogleAdsDiagnosisCollect(opts) {
142084
142217
  agentBrief,
142085
142218
  agentHint: buildGoogleAdsDiagnosisCollectAgentHint(snapDir)
142086
142219
  };
142087
- const collectPath = path29.join(snapDir, GOOGLE_ADS_DIAGNOSIS_COLLECT_BASENAME);
142088
- await fs25.writeFile(collectPath, `${JSON.stringify(collectPayload, null, 2)}
142220
+ const collectPath = path30.join(snapDir, GOOGLE_ADS_DIAGNOSIS_COLLECT_BASENAME);
142221
+ await fs26.writeFile(collectPath, `${JSON.stringify(collectPayload, null, 2)}
142089
142222
  `, "utf8");
142090
- const draftPath = path29.join(snapDir, GOOGLE_ADS_DIAGNOSIS_REPORT_BASENAME);
142223
+ const draftPath = path30.join(snapDir, GOOGLE_ADS_DIAGNOSIS_REPORT_BASENAME);
142091
142224
  const draftOutcome = await writeDiagnosisDraft({ draftPath, reportData });
142092
- const digestPath = path29.join(snapDir, GOOGLE_ADS_DIAGNOSIS_DIGEST_BASENAME);
142093
- await fs25.writeFile(
142225
+ const digestPath = path30.join(snapDir, GOOGLE_ADS_DIAGNOSIS_DIGEST_BASENAME);
142226
+ await fs26.writeFile(
142094
142227
  digestPath,
142095
142228
  buildCollectDigest(reportData, {
142096
142229
  accountId,
@@ -142132,8 +142265,8 @@ async function runGoogleAdsDiagnosisCollect(opts) {
142132
142265
  }
142133
142266
 
142134
142267
  // src/commands/google-ads-diagnosis/render-report.ts
142135
- import fs26 from "fs/promises";
142136
- import path30 from "path";
142268
+ import fs27 from "fs/promises";
142269
+ import path31 from "path";
142137
142270
 
142138
142271
  // src/commands/google-ads-diagnosis/report-content.ts
142139
142272
  function asRecord12(value) {
@@ -142142,9 +142275,9 @@ function asRecord12(value) {
142142
142275
  }
142143
142276
  return null;
142144
142277
  }
142145
- function getNestedValue(root, path60) {
142278
+ function getNestedValue(root, path61) {
142146
142279
  let cur = root;
142147
- for (const key of path60) {
142280
+ for (const key of path61) {
142148
142281
  const rec = asRecord12(cur);
142149
142282
  if (!rec) return void 0;
142150
142283
  cur = rec[key];
@@ -142799,7 +142932,7 @@ function asRecord17(value) {
142799
142932
  }
142800
142933
  async function tryLoadCollectReportData(collectPath) {
142801
142934
  try {
142802
- const raw = JSON.parse(await fs26.readFile(collectPath, "utf8"));
142935
+ const raw = JSON.parse(await fs27.readFile(collectPath, "utf8"));
142803
142936
  const root = asRecord17(raw);
142804
142937
  const reportData = asRecord17(root?.reportData);
142805
142938
  return reportData ?? root;
@@ -142808,10 +142941,10 @@ async function tryLoadCollectReportData(collectPath) {
142808
142941
  }
142809
142942
  }
142810
142943
  async function runGoogleAdsDiagnosisRender(opts) {
142811
- const dataPath = path30.resolve(opts.dataFile);
142944
+ const dataPath = path31.resolve(opts.dataFile);
142812
142945
  let dataRaw;
142813
142946
  try {
142814
- dataRaw = JSON.parse(await fs26.readFile(dataPath, "utf8"));
142947
+ dataRaw = JSON.parse(await fs27.readFile(dataPath, "utf8"));
142815
142948
  } catch {
142816
142949
  console.error(`
142817
142950
  \u274C \u65E0\u6CD5\u89E3\u6790 JSON\uFF1A${dataPath}
@@ -142820,8 +142953,8 @@ async function runGoogleAdsDiagnosisRender(opts) {
142820
142953
  }
142821
142954
  let data = asRecord17(dataRaw);
142822
142955
  if (!opts.noMergeCollect) {
142823
- const collectPath = path30.resolve(
142824
- opts.collectFile ?? path30.join(path30.dirname(dataPath), GOOGLE_ADS_DIAGNOSIS_COLLECT_BASENAME)
142956
+ const collectPath = path31.resolve(
142957
+ opts.collectFile ?? path31.join(path31.dirname(dataPath), GOOGLE_ADS_DIAGNOSIS_COLLECT_BASENAME)
142825
142958
  );
142826
142959
  const collectReportData = await tryLoadCollectReportData(collectPath);
142827
142960
  if (collectReportData) {
@@ -142850,7 +142983,7 @@ async function runGoogleAdsDiagnosisRender(opts) {
142850
142983
  }
142851
142984
  }
142852
142985
  }
142853
- data = reconcileGoldAccountInReport(data, path30.dirname(dataPath));
142986
+ data = reconcileGoldAccountInReport(data, path31.dirname(dataPath));
142854
142987
  data = applyDataRenderedCopy(data);
142855
142988
  const overview = normalizeDiagnosisOverview(data);
142856
142989
  data = overview.data;
@@ -142906,7 +143039,7 @@ async function runGoogleAdsDiagnosisRender(opts) {
142906
143039
  const templatePath = googleAdsDiagnosisReportTemplatePath();
142907
143040
  let html;
142908
143041
  try {
142909
- html = await fs26.readFile(templatePath, "utf8");
143042
+ html = await fs27.readFile(templatePath, "utf8");
142910
143043
  } catch {
142911
143044
  console.error(`
142912
143045
  \u274C \u672A\u627E\u5230\u62A5\u544A\u6A21\u677F\uFF1A${templatePath}
@@ -142925,11 +143058,11 @@ async function runGoogleAdsDiagnosisRender(opts) {
142925
143058
  `);
142926
143059
  process.exit(1);
142927
143060
  }
142928
- const outPath = path30.resolve(
142929
- opts.out ?? path30.join(path30.dirname(dataPath), "google-ads-diagnosis-report.html")
143061
+ const outPath = path31.resolve(
143062
+ opts.out ?? path31.join(path31.dirname(dataPath), "google-ads-diagnosis-report.html")
142930
143063
  );
142931
- await fs26.mkdir(path30.dirname(outPath), { recursive: true });
142932
- await fs26.writeFile(outPath, rendered, "utf8");
143064
+ await fs27.mkdir(path31.dirname(outPath), { recursive: true });
143065
+ await fs27.writeFile(outPath, rendered, "utf8");
142933
143066
  console.log(`
142934
143067
  \u2705 Google \u5E7F\u544A\u8BCA\u65AD HTML \u62A5\u544A\u5DF2\u751F\u6210\uFF1A${outPath}
142935
143068
  `);
@@ -142997,8 +143130,8 @@ function registerGoogleAdsDiagnosisCommands(program2) {
142997
143130
 
142998
143131
  // src/commands/google-quarterly/run-collect.ts
142999
143132
  init_auth();
143000
- import fs29 from "fs/promises";
143001
- import path33 from "path";
143133
+ import fs30 from "fs/promises";
143134
+ import path34 from "path";
143002
143135
 
143003
143136
  // src/commands/google-quarterly/drill-country.ts
143004
143137
  init_geo_en2zh();
@@ -143517,31 +143650,31 @@ function buildSpendPlanDefaults(currentSpend) {
143517
143650
  }
143518
143651
 
143519
143652
  // src/commands/google-quarterly/region.ts
143520
- import fs27 from "fs";
143521
- import path31 from "path";
143653
+ import fs28 from "fs";
143654
+ import path32 from "path";
143522
143655
  import { fileURLToPath as fileURLToPath6 } from "url";
143523
143656
  var EAST_ASIA = /* @__PURE__ */ new Set(["\u4E2D\u56FD", "\u65E5\u672C", "\u97E9\u56FD", "\u671D\u9C9C", "\u8499\u53E4", "\u9999\u6E2F", "\u6FB3\u95E8", "\u53F0\u6E7E"]);
143524
143657
  var continentMap = null;
143525
143658
  function continentsPath() {
143526
- const dir = path31.dirname(fileURLToPath6(import.meta.url));
143659
+ const dir = path32.dirname(fileURLToPath6(import.meta.url));
143527
143660
  const candidates = [
143528
143661
  // dist/index.js → dist/skill/references/...
143529
- path31.join(dir, "skill", "references", "analytics", "geo-continents.json"),
143530
- path31.join(dir, "skill", "siluzan-ads", "references", "analytics", "geo-continents.json"),
143662
+ path32.join(dir, "skill", "references", "analytics", "geo-continents.json"),
143663
+ path32.join(dir, "skill", "siluzan-ads", "references", "analytics", "geo-continents.json"),
143531
143664
  // dist/index.js → tso-cli/assets/...
143532
- path31.join(dir, "..", "assets", "siluzan-ads", "references", "analytics", "geo-continents.json"),
143665
+ path32.join(dir, "..", "assets", "siluzan-ads", "references", "analytics", "geo-continents.json"),
143533
143666
  // src/commands/google-quarterly/region.ts → tso-cli/assets/...
143534
- path31.join(dir, "..", "..", "assets", "siluzan-ads", "references", "analytics", "geo-continents.json"),
143535
- path31.join(dir, "..", "..", "..", "assets", "siluzan-ads", "references", "analytics", "geo-continents.json")
143667
+ path32.join(dir, "..", "..", "assets", "siluzan-ads", "references", "analytics", "geo-continents.json"),
143668
+ path32.join(dir, "..", "..", "..", "assets", "siluzan-ads", "references", "analytics", "geo-continents.json")
143536
143669
  ];
143537
143670
  for (const p of candidates) {
143538
- if (fs27.existsSync(p)) return p;
143671
+ if (fs28.existsSync(p)) return p;
143539
143672
  }
143540
143673
  return candidates[0];
143541
143674
  }
143542
143675
  function loadContinentMap() {
143543
143676
  if (continentMap) return continentMap;
143544
- const raw = JSON.parse(fs27.readFileSync(continentsPath(), "utf8"));
143677
+ const raw = JSON.parse(fs28.readFileSync(continentsPath(), "utf8"));
143545
143678
  const map = {};
143546
143679
  for (const [k, v] of Object.entries(raw)) {
143547
143680
  if (k.startsWith("_")) continue;
@@ -143977,23 +144110,23 @@ function roundFacts(facts) {
143977
144110
  }
143978
144111
 
143979
144112
  // src/commands/google-quarterly/shared.ts
143980
- import fs28 from "fs";
143981
- import path32 from "path";
144113
+ import fs29 from "fs";
144114
+ import path33 from "path";
143982
144115
  import { fileURLToPath as fileURLToPath7 } from "url";
143983
144116
  var GOOGLE_QUARTERLY_COLLECT_BASENAME = "google-quarterly-collect.json";
143984
144117
  var GOOGLE_QUARTERLY_HTML_BASENAME = "google-quarterly-report.html";
143985
144118
  var GOOGLE_QUARTERLY_TEMPLATE_BASENAME = "google-quarterly-report.html";
143986
144119
  var GOOGLE_QUARTERLY_INJECT_MARKER = "window.__GOOGLE_QUARTERLY_REPORT__ = window.__GOOGLE_QUARTERLY_REPORT__ || null;";
143987
144120
  function googleQuarterlyTemplatePath() {
143988
- const dir = path32.dirname(fileURLToPath7(import.meta.url));
144121
+ const dir = path33.dirname(fileURLToPath7(import.meta.url));
143989
144122
  const candidates = [
143990
- path32.join(dir, "skill", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME),
143991
- path32.join(dir, "skill", "siluzan-ads", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME),
143992
- path32.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME),
143993
- path32.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME)
144123
+ path33.join(dir, "skill", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME),
144124
+ path33.join(dir, "skill", "siluzan-ads", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME),
144125
+ path33.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME),
144126
+ path33.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", GOOGLE_QUARTERLY_TEMPLATE_BASENAME)
143994
144127
  ];
143995
144128
  for (const p of candidates) {
143996
- if (fs28.existsSync(p)) return p;
144129
+ if (fs29.existsSync(p)) return p;
143997
144130
  }
143998
144131
  return candidates[2];
143999
144132
  }
@@ -144019,7 +144152,7 @@ function periodSnap(dir, account, start, end, extra = []) {
144019
144152
  }
144020
144153
  async function readInquiries(file) {
144021
144154
  if (!file?.trim()) return void 0;
144022
- const raw = await fs29.readFile(path33.resolve(file), "utf8");
144155
+ const raw = await fs30.readFile(path34.resolve(file), "utf8");
144023
144156
  return JSON.parse(raw);
144024
144157
  }
144025
144158
  async function runGoogleQuarterlyCollect(opts) {
@@ -144032,8 +144165,8 @@ async function runGoogleQuarterlyCollect(opts) {
144032
144165
  const previous = previousRange(current.start, current.end);
144033
144166
  const yoy = yearOverYearRange(current.start, current.end);
144034
144167
  const months = listMonths(current.start, current.end);
144035
- const snapDir = path33.resolve(opts.jsonOut);
144036
- await fs29.mkdir(snapDir, { recursive: true });
144168
+ const snapDir = path34.resolve(opts.jsonOut);
144169
+ await fs30.mkdir(snapDir, { recursive: true });
144037
144170
  let degraded = false;
144038
144171
  const run = (label2, start, end, sections) => {
144039
144172
  console.error(`
@@ -144161,8 +144294,8 @@ async function runGoogleQuarterlyCollect(opts) {
144161
144294
  planDefaults: facts.planDefaults
144162
144295
  }
144163
144296
  };
144164
- const outFile = path33.join(snapDir, GOOGLE_QUARTERLY_COLLECT_BASENAME);
144165
- await fs29.writeFile(outFile, JSON.stringify(payload, null, 2), "utf8");
144297
+ const outFile = path34.join(snapDir, GOOGLE_QUARTERLY_COLLECT_BASENAME);
144298
+ await fs30.writeFile(outFile, JSON.stringify(payload, null, 2), "utf8");
144166
144299
  console.log(
144167
144300
  JSON.stringify({
144168
144301
  kind: "siluzan-tso-google-quarterly-collect-summary",
@@ -144181,8 +144314,8 @@ async function runGoogleQuarterlyCollect(opts) {
144181
144314
  }
144182
144315
 
144183
144316
  // src/commands/google-quarterly/render-report.ts
144184
- import fs30 from "fs/promises";
144185
- import path35 from "path";
144317
+ import fs31 from "fs/promises";
144318
+ import path36 from "path";
144186
144319
 
144187
144320
  // src/commands/google-quarterly/report-content.ts
144188
144321
  function asRecord18(value) {
@@ -144225,9 +144358,9 @@ function mergeCollectFacts(agentData, collect) {
144225
144358
 
144226
144359
  // src/test-utils/report-echarts.ts
144227
144360
  import { readFileSync as readFileSync20 } from "fs";
144228
- import path34 from "path";
144361
+ import path35 from "path";
144229
144362
  import { fileURLToPath as fileURLToPath8 } from "url";
144230
- var TSO_CLI_ROOT = path34.join(path34.dirname(fileURLToPath8(import.meta.url)), "../..");
144363
+ var TSO_CLI_ROOT = path35.join(path35.dirname(fileURLToPath8(import.meta.url)), "../..");
144231
144364
 
144232
144365
  // src/commands/google-quarterly/render-report.ts
144233
144366
  init_lang();
@@ -144239,22 +144372,22 @@ function asRecord19(value) {
144239
144372
  throw new Error("\u62A5\u544A JSON \u987B\u4E3A\u5BF9\u8C61");
144240
144373
  }
144241
144374
  async function runGoogleQuarterlyRender(opts) {
144242
- const dataPath = path35.resolve(opts.dataFile);
144375
+ const dataPath = path36.resolve(opts.dataFile);
144243
144376
  let agentRaw;
144244
144377
  try {
144245
- agentRaw = JSON.parse(await fs30.readFile(dataPath, "utf8"));
144378
+ agentRaw = JSON.parse(await fs31.readFile(dataPath, "utf8"));
144246
144379
  } catch {
144247
144380
  console.error(`
144248
144381
  \u274C \u65E0\u6CD5\u89E3\u6790 JSON\uFF1A${dataPath}
144249
144382
  `);
144250
144383
  process.exit(1);
144251
144384
  }
144252
- const collectPath = path35.resolve(
144253
- opts.collectFile ?? path35.join(path35.dirname(dataPath), GOOGLE_QUARTERLY_COLLECT_BASENAME)
144385
+ const collectPath = path36.resolve(
144386
+ opts.collectFile ?? path36.join(path36.dirname(dataPath), GOOGLE_QUARTERLY_COLLECT_BASENAME)
144254
144387
  );
144255
144388
  let collectRaw;
144256
144389
  try {
144257
- collectRaw = JSON.parse(await fs30.readFile(collectPath, "utf8"));
144390
+ collectRaw = JSON.parse(await fs31.readFile(collectPath, "utf8"));
144258
144391
  } catch {
144259
144392
  console.error(`
144260
144393
  \u274C \u65E0\u6CD5\u8BFB\u53D6 collect\uFF1A${collectPath}
@@ -144272,15 +144405,15 @@ async function runGoogleQuarterlyRender(opts) {
144272
144405
  const templatePath = googleQuarterlyTemplatePath();
144273
144406
  let html;
144274
144407
  try {
144275
- html = await fs30.readFile(templatePath, "utf8");
144408
+ html = await fs31.readFile(templatePath, "utf8");
144276
144409
  } catch {
144277
144410
  console.error(`
144278
144411
  \u274C \u627E\u4E0D\u5230\u6A21\u677F\uFF1A${templatePath}
144279
144412
  `);
144280
144413
  process.exit(1);
144281
144414
  }
144282
- const outPath = path35.resolve(opts.out ?? path35.join(path35.dirname(dataPath), GOOGLE_QUARTERLY_HTML_BASENAME));
144283
- await fs30.mkdir(path35.dirname(outPath), { recursive: true });
144415
+ const outPath = path36.resolve(opts.out ?? path36.join(path36.dirname(dataPath), GOOGLE_QUARTERLY_HTML_BASENAME));
144416
+ await fs31.mkdir(path36.dirname(outPath), { recursive: true });
144284
144417
  const lang = readReportLangOrExit({ flag: opts.lang, meta: merged.meta });
144285
144418
  const periodChrome = reportPeriodChrome(
144286
144419
  readMetaRange(merged, "current"),
@@ -144296,7 +144429,7 @@ async function runGoogleQuarterlyRender(opts) {
144296
144429
  console.error("\n\u274C \u6A21\u677F\u5FC5\u987B\u4F7F\u7528 ECharts\uFF0C\u7981\u6B62 Chart.js\u3002\n");
144297
144430
  process.exit(1);
144298
144431
  }
144299
- await fs30.writeFile(outPath, outHtml, "utf8");
144432
+ await fs31.writeFile(outPath, outHtml, "utf8");
144300
144433
  console.log(`
144301
144434
  \u2705 ${periodChrome.reportTitle}\u5DF2\u751F\u6210\uFF1A${outPath}
144302
144435
  `);
@@ -144436,14 +144569,14 @@ var FACEBOOK_SECTION_ALIASES = {
144436
144569
  import { Command as Command2 } from "commander";
144437
144570
 
144438
144571
  // src/commands/facebook-analysis/render-report.ts
144439
- import fs39 from "fs";
144572
+ import fs40 from "fs";
144440
144573
  import fsPromises4 from "fs/promises";
144441
- import path46 from "path";
144574
+ import path47 from "path";
144442
144575
  import { fileURLToPath as fileURLToPath11 } from "url";
144443
144576
 
144444
144577
  // src/commands/facebook-analysis/merge-snapshot.ts
144445
- import * as fs38 from "fs/promises";
144446
- import * as path45 from "path";
144578
+ import * as fs39 from "fs/promises";
144579
+ import * as path46 from "path";
144447
144580
 
144448
144581
  // src/commands/facebook-analysis/report-metrics.ts
144449
144582
  function asRecord26(value) {
@@ -144595,7 +144728,7 @@ function hasResults(row) {
144595
144728
 
144596
144729
  // src/commands/facebook-analysis/merge-snapshot.ts
144597
144730
  async function readManifest4(snapshotDir) {
144598
- const entries = await fs38.readdir(snapshotDir);
144731
+ const entries = await fs39.readdir(snapshotDir);
144599
144732
  const manifestNames = entries.filter(
144600
144733
  (n) => n.startsWith("report-manifest") && n.endsWith(".json")
144601
144734
  );
@@ -144605,7 +144738,7 @@ async function readManifest4(snapshotDir) {
144605
144738
  ];
144606
144739
  for (const name2 of ordered) {
144607
144740
  try {
144608
- const raw = await fs38.readFile(path45.join(snapshotDir, name2), "utf8");
144741
+ const raw = await fs39.readFile(path46.join(snapshotDir, name2), "utf8");
144609
144742
  const parsed = JSON.parse(raw);
144610
144743
  if (parsed?.artifacts?.length) return parsed;
144611
144744
  } catch {
@@ -144615,7 +144748,7 @@ async function readManifest4(snapshotDir) {
144615
144748
  }
144616
144749
  async function loadSectionFile3(snapshotDir, file) {
144617
144750
  try {
144618
- const raw = await fs38.readFile(path45.join(snapshotDir, file), "utf8");
144751
+ const raw = await fs39.readFile(path46.join(snapshotDir, file), "utf8");
144619
144752
  return asRecord26(JSON.parse(raw));
144620
144753
  } catch {
144621
144754
  return null;
@@ -144659,7 +144792,7 @@ function mapAdSetRows(groups) {
144659
144792
  })).sort((a, b) => (b.spend ?? 0) - (a.spend ?? 0));
144660
144793
  }
144661
144794
  async function mergeFacebookSnapshotIntoReport(payload, snapshotDir) {
144662
- const absDir = path45.resolve(snapshotDir);
144795
+ const absDir = path46.resolve(snapshotDir);
144663
144796
  const manifest = await readManifest4(snapshotDir);
144664
144797
  if (!manifest) {
144665
144798
  throw new Error(
@@ -145281,14 +145414,14 @@ var TEMPLATE_BASENAMES2 = {
145281
145414
  };
145282
145415
  var INJECT_MARKER2 = "window.__META_PERIOD_REPORT__ = window.__META_PERIOD_REPORT__ || null;";
145283
145416
  function resolveSkillTemplatePath5(basename13) {
145284
- const dir = path46.dirname(fileURLToPath11(import.meta.url));
145417
+ const dir = path47.dirname(fileURLToPath11(import.meta.url));
145285
145418
  const candidates = [
145286
- path46.join(dir, "skill", "report-templates", basename13),
145287
- path46.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
145288
- path46.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
145419
+ path47.join(dir, "skill", "report-templates", basename13),
145420
+ path47.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
145421
+ path47.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
145289
145422
  ];
145290
145423
  for (const p of candidates) {
145291
- if (fs39.existsSync(p)) return p;
145424
+ if (fs40.existsSync(p)) return p;
145292
145425
  }
145293
145426
  return candidates[0];
145294
145427
  }
@@ -145334,7 +145467,7 @@ function injectReportData3(html, payload, lang) {
145334
145467
  }
145335
145468
  function defaultOutPath(dataPath, format, out) {
145336
145469
  if (out?.trim()) {
145337
- const resolved = path46.resolve(out);
145470
+ const resolved = path47.resolve(out);
145338
145471
  if (format === "xlsx" && !/\.xlsx$/i.test(resolved)) {
145339
145472
  return resolved.replace(/\.(html?)$/i, ".xlsx");
145340
145473
  }
@@ -145343,14 +145476,14 @@ function defaultOutPath(dataPath, format, out) {
145343
145476
  }
145344
145477
  return resolved;
145345
145478
  }
145346
- const dir = path46.dirname(dataPath);
145347
- return path46.join(dir, format === "xlsx" ? "meta-period-report.xlsx" : "meta-period-report.html");
145479
+ const dir = path47.dirname(dataPath);
145480
+ return path47.join(dir, format === "xlsx" ? "meta-period-report.xlsx" : "meta-period-report.html");
145348
145481
  }
145349
145482
  async function runFacebookAnalysisRender(opts) {
145350
- const dataPath = path46.resolve(opts.dataFile);
145483
+ const dataPath = path47.resolve(opts.dataFile);
145351
145484
  let data = asRecord29(await readJsonFile5(dataPath));
145352
145485
  if (opts.snapshotDir?.trim()) {
145353
- data = await mergeFacebookSnapshotIntoReport(data, path46.resolve(opts.snapshotDir));
145486
+ data = await mergeFacebookSnapshotIntoReport(data, path47.resolve(opts.snapshotDir));
145354
145487
  }
145355
145488
  localizeFacebookReportLabels(data);
145356
145489
  const lang = readReportLangOrExit({ flag: opts.lang, meta: data.meta });
@@ -145370,7 +145503,7 @@ async function runFacebookAnalysisRender(opts) {
145370
145503
  const written = [];
145371
145504
  for (const format of formats) {
145372
145505
  const outPath = defaultOutPath(dataPath, format, opts.out);
145373
- await fsPromises4.mkdir(path46.dirname(outPath), { recursive: true });
145506
+ await fsPromises4.mkdir(path47.dirname(outPath), { recursive: true });
145374
145507
  if (format === "xlsx") {
145375
145508
  writeMetaPeriodExcel(outPath, data, lang);
145376
145509
  } else {
@@ -145406,14 +145539,14 @@ async function runFacebookAnalysisRender(opts) {
145406
145539
  }
145407
145540
 
145408
145541
  // src/commands/facebook-analysis/diagnosis-render-report.ts
145409
- import fs41 from "fs";
145542
+ import fs42 from "fs";
145410
145543
  import fsPromises5 from "fs/promises";
145411
- import path48 from "path";
145544
+ import path49 from "path";
145412
145545
  import { fileURLToPath as fileURLToPath12 } from "url";
145413
145546
 
145414
145547
  // src/commands/facebook-analysis/diagnosis-merge-snapshot.ts
145415
- import * as fs40 from "fs/promises";
145416
- import * as path47 from "path";
145548
+ import * as fs41 from "fs/promises";
145549
+ import * as path48 from "path";
145417
145550
  function asRecord30(value) {
145418
145551
  if (value && typeof value === "object" && !Array.isArray(value)) {
145419
145552
  return value;
@@ -145449,7 +145582,7 @@ async function readManifest5(snapshotDir, accountId) {
145449
145582
  const candidates = [];
145450
145583
  if (accountId) candidates.push(reportManifestFile(accountId));
145451
145584
  try {
145452
- const entries = await fs40.readdir(snapshotDir);
145585
+ const entries = await fs41.readdir(snapshotDir);
145453
145586
  const manifestNames = entries.filter(
145454
145587
  (n) => n.startsWith("report-manifest") && n.endsWith(".json")
145455
145588
  );
@@ -145463,7 +145596,7 @@ async function readManifest5(snapshotDir, accountId) {
145463
145596
  }
145464
145597
  for (const name2 of candidates) {
145465
145598
  try {
145466
- const raw = await fs40.readFile(path47.join(snapshotDir, name2), "utf8");
145599
+ const raw = await fs41.readFile(path48.join(snapshotDir, name2), "utf8");
145467
145600
  const parsed = JSON.parse(raw);
145468
145601
  if (Array.isArray(parsed.artifacts) && parsed.artifacts.length > 0) return parsed;
145469
145602
  } catch {
@@ -145473,14 +145606,14 @@ async function readManifest5(snapshotDir, accountId) {
145473
145606
  }
145474
145607
  async function loadSectionFile4(snapshotDir, file) {
145475
145608
  try {
145476
- const raw = await fs40.readFile(path47.join(snapshotDir, file), "utf8");
145609
+ const raw = await fs41.readFile(path48.join(snapshotDir, file), "utf8");
145477
145610
  return asRecord30(JSON.parse(raw));
145478
145611
  } catch {
145479
145612
  return null;
145480
145613
  }
145481
145614
  }
145482
145615
  async function mergeMetaDiagnosisSnapshotIntoReport(payload, snapshotDir) {
145483
- const absDir = path47.resolve(snapshotDir);
145616
+ const absDir = path48.resolve(snapshotDir);
145484
145617
  const metaAccountId = typeof asRecord30(payload.meta)?.accountId === "string" ? asRecord30(payload.meta)?.accountId : void 0;
145485
145618
  const manifest = await readManifest5(snapshotDir, metaAccountId);
145486
145619
  if (!manifest) {
@@ -145761,14 +145894,14 @@ init_html();
145761
145894
  var TEMPLATE_BASENAME3 = "meta-account-diagnosis-report.html";
145762
145895
  var INJECT_MARKER3 = "window.__META_DIAGNOSIS_REPORT__ = window.__META_DIAGNOSIS_REPORT__ || null;";
145763
145896
  function resolveSkillTemplatePath6(basename13) {
145764
- const dir = path48.dirname(fileURLToPath12(import.meta.url));
145897
+ const dir = path49.dirname(fileURLToPath12(import.meta.url));
145765
145898
  const candidates = [
145766
- path48.join(dir, "skill", "report-templates", basename13),
145767
- path48.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
145768
- path48.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
145899
+ path49.join(dir, "skill", "report-templates", basename13),
145900
+ path49.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
145901
+ path49.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
145769
145902
  ];
145770
145903
  for (const p of candidates) {
145771
- if (fs41.existsSync(p)) return p;
145904
+ if (fs42.existsSync(p)) return p;
145772
145905
  }
145773
145906
  return candidates[0];
145774
145907
  }
@@ -145798,10 +145931,10 @@ function injectReportData4(html, payload, lang) {
145798
145931
  return localized.replace(INJECT_MARKER3, `window.__META_DIAGNOSIS_REPORT__ = ${json};`);
145799
145932
  }
145800
145933
  async function runFacebookAnalysisDiagnosisRender(opts) {
145801
- const dataPath = path48.resolve(opts.dataFile);
145934
+ const dataPath = path49.resolve(opts.dataFile);
145802
145935
  let data = asRecord32(await readJsonFile6(dataPath));
145803
145936
  if (opts.snapshotDir?.trim()) {
145804
- data = await mergeMetaDiagnosisSnapshotIntoReport(data, path48.resolve(opts.snapshotDir));
145937
+ data = await mergeMetaDiagnosisSnapshotIntoReport(data, path49.resolve(opts.snapshotDir));
145805
145938
  }
145806
145939
  const lang = readReportLangOrExit({ flag: opts.lang, meta: data.meta });
145807
145940
  const contentCheck = validateMetaDiagnosisReportContent(data);
@@ -145828,10 +145961,10 @@ async function runFacebookAnalysisDiagnosisRender(opts) {
145828
145961
  `);
145829
145962
  process.exit(1);
145830
145963
  }
145831
- const outPath = path48.resolve(
145832
- opts.out ?? path48.join(path48.dirname(dataPath), "meta-account-diagnosis-report.html")
145964
+ const outPath = path49.resolve(
145965
+ opts.out ?? path49.join(path49.dirname(dataPath), "meta-account-diagnosis-report.html")
145833
145966
  );
145834
- const outDir = path48.dirname(outPath);
145967
+ const outDir = path49.dirname(outPath);
145835
145968
  await fsPromises5.mkdir(outDir, { recursive: true });
145836
145969
  await fsPromises5.writeFile(outPath, injectReportData4(html, data, lang), "utf8");
145837
145970
  const { stats } = contentCheck;
@@ -145849,7 +145982,7 @@ async function runFacebookAnalysisDiagnosisRender(opts) {
145849
145982
 
145850
145983
  // src/commands/facebook-analysis/run-batch.ts
145851
145984
  init_auth();
145852
- import * as path49 from "path";
145985
+ import * as path50 from "path";
145853
145986
  import { performance as performance5 } from "perf_hooks";
145854
145987
  init_version();
145855
145988
 
@@ -145951,7 +146084,7 @@ async function runAllFacebookSections(opts) {
145951
146084
  const results = await runWithConcurrency2(tasks, concurrency);
145952
146085
  const succeeded = results.filter((r) => r.ok).length;
145953
146086
  const failed = results.length - succeeded;
145954
- const absoluteSnapshotDir = path49.resolve(opts.jsonOut);
146087
+ const absoluteSnapshotDir = path50.resolve(opts.jsonOut);
145955
146088
  const summary = {
145956
146089
  kind: "siluzan-tso-facebook-analysis-snapshot-batch",
145957
146090
  absoluteSnapshotDir,
@@ -146075,9 +146208,9 @@ function parseEffectiveStatusFilter(raw) {
146075
146208
  }
146076
146209
  return canonical.length ? canonical.join(",") : void 0;
146077
146210
  }
146078
- function facebookAdsUrl(facebookApiUrl, digits, path60) {
146211
+ function facebookAdsUrl(facebookApiUrl, digits, path61) {
146079
146212
  const base2 = facebookApiUrl.replace(/\/$/, "");
146080
- const p = path60.startsWith("/") ? path60 : `/${path60}`;
146213
+ const p = path61.startsWith("/") ? path61 : `/${path61}`;
146081
146214
  return `${base2}/api/fb/ads/${digits}${p}`;
146082
146215
  }
146083
146216
  function facebookInsightsUrl(facebookApiUrl, digits, level) {
@@ -146114,7 +146247,7 @@ async function fetchFacebookAccount(config, digits, verbose) {
146114
146247
  verbose
146115
146248
  );
146116
146249
  }
146117
- async function fetchFacebookPagedList(config, digits, path60, opts) {
146250
+ async function fetchFacebookPagedList(config, digits, path61, opts) {
146118
146251
  const base2 = requireFacebookApi(config);
146119
146252
  const items3 = [];
146120
146253
  let after;
@@ -146129,7 +146262,7 @@ async function fetchFacebookPagedList(config, digits, path60, opts) {
146129
146262
  adsetId: opts.adsetId
146130
146263
  });
146131
146264
  const raw = await apiFetch2(
146132
- `${facebookAdsUrl(base2, digits, path60)}?${query}`,
146265
+ `${facebookAdsUrl(base2, digits, path61)}?${query}`,
146133
146266
  config,
146134
146267
  {},
146135
146268
  opts.verbose
@@ -146264,7 +146397,7 @@ async function runFacebookEntityList(opts, kind) {
146264
146397
  }
146265
146398
  const pageSize = resolveFacebookPageSize(opts.pageSize);
146266
146399
  const config = loadConfig(opts.token);
146267
- const path60 = `/${kind}`;
146400
+ const path61 = `/${kind}`;
146268
146401
  const labels = {
146269
146402
  campaigns: {
146270
146403
  section: "facebook-campaign-entities",
@@ -146277,7 +146410,7 @@ async function runFacebookEntityList(opts, kind) {
146277
146410
  const meta = labels[kind];
146278
146411
  let result;
146279
146412
  try {
146280
- result = await fetchFacebookPagedList(config, manifestId, path60, {
146413
+ result = await fetchFacebookPagedList(config, manifestId, path61, {
146281
146414
  pageSize,
146282
146415
  verbose: !!opts.verbose,
146283
146416
  effectiveStatus,
@@ -147025,7 +147158,7 @@ function endpointHintForBingSection(def) {
147025
147158
 
147026
147159
  // src/commands/bing-analysis/run-batch.ts
147027
147160
  init_auth();
147028
- import * as path50 from "path";
147161
+ import * as path51 from "path";
147029
147162
  import { performance as performance6 } from "perf_hooks";
147030
147163
  init_version();
147031
147164
  async function runWithConcurrency3(tasks, concurrency) {
@@ -147100,7 +147233,7 @@ async function runAllBingSections(opts) {
147100
147233
  const results = await runWithConcurrency3(tasks, concurrency);
147101
147234
  const succeeded = results.filter((r) => r.ok).length;
147102
147235
  const failed = results.length - succeeded;
147103
- const absoluteSnapshotDir = path50.resolve(opts.jsonOut);
147236
+ const absoluteSnapshotDir = path51.resolve(opts.jsonOut);
147104
147237
  const summary = {
147105
147238
  kind: "siluzan-tso-bing-analysis-snapshot-batch",
147106
147239
  absoluteSnapshotDir,
@@ -147444,14 +147577,14 @@ Bing \u5B98\u65B9\u6708\u6D88\u8017\uFF08${id}\uFF09
147444
147577
  import { Command as Command3 } from "commander";
147445
147578
 
147446
147579
  // src/commands/bing-analysis/render-report.ts
147447
- import fs43 from "fs";
147580
+ import fs44 from "fs";
147448
147581
  import fsPromises6 from "fs/promises";
147449
- import path52 from "path";
147582
+ import path53 from "path";
147450
147583
  import { fileURLToPath as fileURLToPath13 } from "url";
147451
147584
 
147452
147585
  // src/commands/bing-analysis/merge-snapshot.ts
147453
- import * as fs42 from "fs/promises";
147454
- import * as path51 from "path";
147586
+ import * as fs43 from "fs/promises";
147587
+ import * as path52 from "path";
147455
147588
  function asRecord34(value) {
147456
147589
  if (value && typeof value === "object" && !Array.isArray(value)) {
147457
147590
  return value;
@@ -147473,7 +147606,7 @@ function asRows3(value) {
147473
147606
  }
147474
147607
  async function loadSectionPayload(snapshotDir, file) {
147475
147608
  try {
147476
- const raw = await fs42.readFile(path51.join(snapshotDir, file), "utf8");
147609
+ const raw = await fs43.readFile(path52.join(snapshotDir, file), "utf8");
147477
147610
  return JSON.parse(raw);
147478
147611
  } catch {
147479
147612
  return null;
@@ -147483,7 +147616,7 @@ async function readManifest6(snapshotDir, accountId) {
147483
147616
  const candidates = [];
147484
147617
  if (accountId) candidates.push(reportManifestFile(accountId));
147485
147618
  try {
147486
- const entries = await fs42.readdir(snapshotDir);
147619
+ const entries = await fs43.readdir(snapshotDir);
147487
147620
  const manifestNames = entries.filter(
147488
147621
  (n) => n.startsWith("report-manifest") && n.endsWith(".json")
147489
147622
  );
@@ -147494,7 +147627,7 @@ async function readManifest6(snapshotDir, accountId) {
147494
147627
  }
147495
147628
  for (const name2 of candidates) {
147496
147629
  try {
147497
- const raw = await fs42.readFile(path51.join(snapshotDir, name2), "utf8");
147630
+ const raw = await fs43.readFile(path52.join(snapshotDir, name2), "utf8");
147498
147631
  const parsed = JSON.parse(raw);
147499
147632
  if (Array.isArray(parsed.artifacts) && parsed.artifacts.length > 0) return parsed;
147500
147633
  } catch {
@@ -147661,7 +147794,7 @@ function mapSearchTermRows(payload) {
147661
147794
  );
147662
147795
  }
147663
147796
  async function mergeBingAnalysisSnapshotIntoReport(payload, snapshotDir) {
147664
- const absDir = path51.resolve(snapshotDir);
147797
+ const absDir = path52.resolve(snapshotDir);
147665
147798
  const metaAccountId = typeof asRecord34(payload.meta)?.accountId === "string" ? asRecord34(payload.meta)?.accountId : void 0;
147666
147799
  const manifest = await readManifest6(snapshotDir, metaAccountId);
147667
147800
  if (!manifest) {
@@ -147899,14 +148032,14 @@ init_html();
147899
148032
  var TEMPLATE_BASENAME4 = "bing-period-report.html";
147900
148033
  var INJECT_MARKER4 = "window.__BING_PERIOD_REPORT__ = window.__BING_PERIOD_REPORT__ || null;";
147901
148034
  function resolveSkillTemplatePath7(basename13) {
147902
- const dir = path52.dirname(fileURLToPath13(import.meta.url));
148035
+ const dir = path53.dirname(fileURLToPath13(import.meta.url));
147903
148036
  const candidates = [
147904
- path52.join(dir, "skill", "report-templates", basename13),
147905
- path52.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
147906
- path52.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
148037
+ path53.join(dir, "skill", "report-templates", basename13),
148038
+ path53.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
148039
+ path53.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
147907
148040
  ];
147908
148041
  for (const p of candidates) {
147909
- if (fs43.existsSync(p)) return p;
148042
+ if (fs44.existsSync(p)) return p;
147910
148043
  }
147911
148044
  return candidates[0];
147912
148045
  }
@@ -147936,10 +148069,10 @@ function injectReportData5(html, payload, lang) {
147936
148069
  return localized.replace(INJECT_MARKER4, `window.__BING_PERIOD_REPORT__ = ${json};`);
147937
148070
  }
147938
148071
  async function runBingAnalysisRender(opts) {
147939
- const dataPath = path52.resolve(opts.dataFile);
148072
+ const dataPath = path53.resolve(opts.dataFile);
147940
148073
  let data = asRecord36(await readJsonFile7(dataPath));
147941
148074
  if (opts.snapshotDir?.trim()) {
147942
- data = await mergeBingAnalysisSnapshotIntoReport(data, path52.resolve(opts.snapshotDir));
148075
+ data = await mergeBingAnalysisSnapshotIntoReport(data, path53.resolve(opts.snapshotDir));
147943
148076
  }
147944
148077
  const lang = readReportLangOrExit({ flag: opts.lang, meta: data.meta });
147945
148078
  const contentCheck = validateBingPeriodReportContent(data);
@@ -147966,10 +148099,10 @@ async function runBingAnalysisRender(opts) {
147966
148099
  `);
147967
148100
  process.exit(1);
147968
148101
  }
147969
- const outPath = path52.resolve(
147970
- opts.out ?? path52.join(path52.dirname(dataPath), "bing-period-report.html")
148102
+ const outPath = path53.resolve(
148103
+ opts.out ?? path53.join(path53.dirname(dataPath), "bing-period-report.html")
147971
148104
  );
147972
- const outDir = path52.dirname(outPath);
148105
+ const outDir = path53.dirname(outPath);
147973
148106
  await fsPromises6.mkdir(outDir, { recursive: true });
147974
148107
  await fsPromises6.writeFile(outPath, injectReportData5(html, data, lang), "utf8");
147975
148108
  const { stats } = contentCheck;
@@ -148418,7 +148551,7 @@ async function fetchTikTokInterestList(config, account, verbose) {
148418
148551
 
148419
148552
  // src/commands/tiktok-analysis/run-batch.ts
148420
148553
  init_auth();
148421
- import * as path53 from "path";
148554
+ import * as path54 from "path";
148422
148555
  import { performance as performance7 } from "perf_hooks";
148423
148556
  init_version();
148424
148557
  async function runWithConcurrency4(tasks, concurrency) {
@@ -148493,7 +148626,7 @@ async function runAllTikTokSections(opts) {
148493
148626
  const results = await runWithConcurrency4(tasks, concurrency);
148494
148627
  const succeeded = results.filter((r) => r.ok).length;
148495
148628
  const failed = results.length - succeeded;
148496
- const absoluteSnapshotDir = path53.resolve(opts.jsonOut);
148629
+ const absoluteSnapshotDir = path54.resolve(opts.jsonOut);
148497
148630
  const summary = {
148498
148631
  kind: "siluzan-tso-tiktok-analysis-snapshot-batch",
148499
148632
  absoluteSnapshotDir,
@@ -148516,14 +148649,14 @@ init_auth();
148516
148649
  import { Command as Command4 } from "commander";
148517
148650
 
148518
148651
  // src/commands/tiktok-analysis/render-report.ts
148519
- import fs45 from "fs";
148652
+ import fs46 from "fs";
148520
148653
  import fsPromises7 from "fs/promises";
148521
- import path55 from "path";
148654
+ import path56 from "path";
148522
148655
  import { fileURLToPath as fileURLToPath14 } from "url";
148523
148656
 
148524
148657
  // src/commands/tiktok-analysis/merge-snapshot.ts
148525
- import * as fs44 from "fs/promises";
148526
- import * as path54 from "path";
148658
+ import * as fs45 from "fs/promises";
148659
+ import * as path55 from "path";
148527
148660
  function asRecord37(value) {
148528
148661
  if (value && typeof value === "object" && !Array.isArray(value)) {
148529
148662
  return value;
@@ -148539,7 +148672,7 @@ function round29(value) {
148539
148672
  }
148540
148673
  async function loadSectionPayload2(snapshotDir, file) {
148541
148674
  try {
148542
- const raw = await fs44.readFile(path54.join(snapshotDir, file), "utf8");
148675
+ const raw = await fs45.readFile(path55.join(snapshotDir, file), "utf8");
148543
148676
  return JSON.parse(raw);
148544
148677
  } catch {
148545
148678
  return null;
@@ -148549,7 +148682,7 @@ async function readManifest7(snapshotDir, accountId) {
148549
148682
  const candidates = [];
148550
148683
  if (accountId) candidates.push(reportManifestFile(accountId));
148551
148684
  try {
148552
- const entries = await fs44.readdir(snapshotDir);
148685
+ const entries = await fs45.readdir(snapshotDir);
148553
148686
  const manifestNames = entries.filter(
148554
148687
  (n) => n.startsWith("report-manifest") && n.endsWith(".json")
148555
148688
  );
@@ -148560,7 +148693,7 @@ async function readManifest7(snapshotDir, accountId) {
148560
148693
  }
148561
148694
  for (const name2 of candidates) {
148562
148695
  try {
148563
- const raw = await fs44.readFile(path54.join(snapshotDir, name2), "utf8");
148696
+ const raw = await fs45.readFile(path55.join(snapshotDir, name2), "utf8");
148564
148697
  const parsed = JSON.parse(raw);
148565
148698
  if (Array.isArray(parsed.artifacts) && parsed.artifacts.length > 0) return parsed;
148566
148699
  } catch {
@@ -148701,7 +148834,7 @@ function mapAudienceMerged(payload) {
148701
148834
  };
148702
148835
  }
148703
148836
  async function mergeTikTokAnalysisSnapshotIntoReport(payload, snapshotDir) {
148704
- const absDir = path54.resolve(snapshotDir);
148837
+ const absDir = path55.resolve(snapshotDir);
148705
148838
  const metaAccountId = typeof asRecord37(payload.meta)?.accountId === "string" ? asRecord37(payload.meta)?.accountId : void 0;
148706
148839
  const manifest = await readManifest7(snapshotDir, metaAccountId);
148707
148840
  if (!manifest) {
@@ -148914,14 +149047,14 @@ init_html();
148914
149047
  var TEMPLATE_BASENAME5 = "tiktok-period-report.html";
148915
149048
  var INJECT_MARKER5 = "window.__TIKTOK_PERIOD_REPORT__ = window.__TIKTOK_PERIOD_REPORT__ || null;";
148916
149049
  function resolveSkillTemplatePath8(basename13) {
148917
- const dir = path55.dirname(fileURLToPath14(import.meta.url));
149050
+ const dir = path56.dirname(fileURLToPath14(import.meta.url));
148918
149051
  const candidates = [
148919
- path55.join(dir, "skill", "report-templates", basename13),
148920
- path55.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
148921
- path55.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
149052
+ path56.join(dir, "skill", "report-templates", basename13),
149053
+ path56.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
149054
+ path56.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
148922
149055
  ];
148923
149056
  for (const p of candidates) {
148924
- if (fs45.existsSync(p)) return p;
149057
+ if (fs46.existsSync(p)) return p;
148925
149058
  }
148926
149059
  return candidates[0];
148927
149060
  }
@@ -148951,10 +149084,10 @@ function injectReportData6(html, payload, lang) {
148951
149084
  return localized.replace(INJECT_MARKER5, `window.__TIKTOK_PERIOD_REPORT__ = ${json};`);
148952
149085
  }
148953
149086
  async function runTikTokAnalysisRender(opts) {
148954
- const dataPath = path55.resolve(opts.dataFile);
149087
+ const dataPath = path56.resolve(opts.dataFile);
148955
149088
  let data = asRecord39(await readJsonFile8(dataPath));
148956
149089
  if (opts.snapshotDir?.trim()) {
148957
- data = await mergeTikTokAnalysisSnapshotIntoReport(data, path55.resolve(opts.snapshotDir));
149090
+ data = await mergeTikTokAnalysisSnapshotIntoReport(data, path56.resolve(opts.snapshotDir));
148958
149091
  }
148959
149092
  const lang = readReportLangOrExit({ flag: opts.lang, meta: data.meta });
148960
149093
  const contentCheck = validateTikTokPeriodReportContent(data);
@@ -148981,10 +149114,10 @@ async function runTikTokAnalysisRender(opts) {
148981
149114
  `);
148982
149115
  process.exit(1);
148983
149116
  }
148984
- const outPath = path55.resolve(
148985
- opts.out ?? path55.join(path55.dirname(dataPath), "tiktok-period-report.html")
149117
+ const outPath = path56.resolve(
149118
+ opts.out ?? path56.join(path56.dirname(dataPath), "tiktok-period-report.html")
148986
149119
  );
148987
- const outDir = path55.dirname(outPath);
149120
+ const outDir = path56.dirname(outPath);
148988
149121
  await fsPromises7.mkdir(outDir, { recursive: true });
148989
149122
  await fsPromises7.writeFile(outPath, injectReportData6(html, data, lang), "utf8");
148990
149123
  const { stats } = contentCheck;
@@ -149766,10 +149899,10 @@ function assertTikTokWriteOk(raw, label2) {
149766
149899
  const message = raw.message ?? "\u672A\u77E5\u9519\u8BEF";
149767
149900
  throw new Error(`${label2} \u4E1A\u52A1\u5931\u8D25 code=${String(code)}\uFF1A${message}`);
149768
149901
  }
149769
- async function putTikTok(path60, body, opts, section, commandLabel) {
149902
+ async function putTikTok(path61, body, opts, section, commandLabel) {
149770
149903
  const advertiserId = assertTikTokAccountId(opts.account);
149771
149904
  const config = loadConfig(opts.token);
149772
- const url = `${requireTikTokApiUrl(config)}/${path60}`;
149905
+ const url = `${requireTikTokApiUrl(config)}/${path61}`;
149773
149906
  const payload = await apiFetch2(
149774
149907
  url,
149775
149908
  config,
@@ -150094,7 +150227,7 @@ var YANDEX_SECTION_ALIASES = {
150094
150227
 
150095
150228
  // src/commands/yandex-analysis/run-batch.ts
150096
150229
  init_auth();
150097
- import * as path57 from "path";
150230
+ import * as path58 from "path";
150098
150231
  import { performance as performance8 } from "perf_hooks";
150099
150232
  init_version();
150100
150233
 
@@ -150234,8 +150367,8 @@ function endpointHintForYandexSection(def) {
150234
150367
  }
150235
150368
 
150236
150369
  // src/commands/yandex-analysis/merge-snapshot.ts
150237
- import * as fs46 from "fs/promises";
150238
- import * as path56 from "path";
150370
+ import * as fs47 from "fs/promises";
150371
+ import * as path57 from "path";
150239
150372
  function asRecord40(value) {
150240
150373
  if (value && typeof value === "object" && !Array.isArray(value)) {
150241
150374
  return value;
@@ -150285,7 +150418,7 @@ function pickMetrics2(row, extras = []) {
150285
150418
  }
150286
150419
  async function loadSectionPayload3(snapshotDir, file) {
150287
150420
  try {
150288
- const raw = await fs46.readFile(path56.join(snapshotDir, file), "utf8");
150421
+ const raw = await fs47.readFile(path57.join(snapshotDir, file), "utf8");
150289
150422
  return JSON.parse(raw);
150290
150423
  } catch {
150291
150424
  return null;
@@ -150295,7 +150428,7 @@ async function readManifest8(snapshotDir, accountId) {
150295
150428
  const candidates = [];
150296
150429
  if (accountId) candidates.push(reportManifestFile(accountId));
150297
150430
  try {
150298
- const entries = await fs46.readdir(snapshotDir);
150431
+ const entries = await fs47.readdir(snapshotDir);
150299
150432
  for (const name2 of entries.filter(
150300
150433
  (n) => n.startsWith("report-manifest") && n.endsWith(".json")
150301
150434
  )) {
@@ -150305,7 +150438,7 @@ async function readManifest8(snapshotDir, accountId) {
150305
150438
  }
150306
150439
  for (const name2 of candidates) {
150307
150440
  try {
150308
- const raw = await fs46.readFile(path56.join(snapshotDir, name2), "utf8");
150441
+ const raw = await fs47.readFile(path57.join(snapshotDir, name2), "utf8");
150309
150442
  const parsed = JSON.parse(raw);
150310
150443
  if (Array.isArray(parsed.artifacts) && parsed.artifacts.length > 0) return parsed;
150311
150444
  } catch {
@@ -150464,7 +150597,7 @@ function mapDeviceRows2(payload) {
150464
150597
  return asItems(payload).map((r) => pickMetrics2(r, ["device", "network"]));
150465
150598
  }
150466
150599
  async function mergeYandexAnalysisSnapshotIntoReport(payload, snapshotDir) {
150467
- const absDir = path56.resolve(snapshotDir);
150600
+ const absDir = path57.resolve(snapshotDir);
150468
150601
  const metaAccountId = typeof asRecord40(payload.meta)?.accountId === "string" ? asRecord40(payload.meta)?.accountId : void 0;
150469
150602
  const manifest = await readManifest8(snapshotDir, metaAccountId);
150470
150603
  if (!manifest) {
@@ -150650,7 +150783,7 @@ async function runAllYandexSections(opts) {
150650
150783
  const results = await runWithConcurrency5(tasks, concurrency);
150651
150784
  const succeeded = results.filter((r) => r.ok).length;
150652
150785
  const failed = results.length - succeeded;
150653
- const absoluteSnapshotDir = path57.resolve(opts.jsonOut);
150786
+ const absoluteSnapshotDir = path58.resolve(opts.jsonOut);
150654
150787
  const summary = {
150655
150788
  kind: "siluzan-tso-yandex-analysis-snapshot-batch",
150656
150789
  absoluteSnapshotDir,
@@ -150668,9 +150801,9 @@ async function runAllYandexSections(opts) {
150668
150801
  }
150669
150802
 
150670
150803
  // src/commands/yandex-analysis/render-report.ts
150671
- import fs47 from "fs";
150804
+ import fs48 from "fs";
150672
150805
  import fsPromises8 from "fs/promises";
150673
- import path58 from "path";
150806
+ import path59 from "path";
150674
150807
  import { fileURLToPath as fileURLToPath15 } from "url";
150675
150808
 
150676
150809
  // src/commands/yandex-analysis/report-content.ts
@@ -150877,14 +151010,14 @@ init_html();
150877
151010
  var TEMPLATE_BASENAME6 = "yandex-period-report.html";
150878
151011
  var INJECT_MARKER6 = "window.__YANDEX_PERIOD_REPORT__ = window.__YANDEX_PERIOD_REPORT__ || null;";
150879
151012
  function resolveSkillTemplatePath9(basename13) {
150880
- const dir = path58.dirname(fileURLToPath15(import.meta.url));
151013
+ const dir = path59.dirname(fileURLToPath15(import.meta.url));
150881
151014
  const candidates = [
150882
- path58.join(dir, "skill", "report-templates", basename13),
150883
- path58.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
150884
- path58.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
151015
+ path59.join(dir, "skill", "report-templates", basename13),
151016
+ path59.join(dir, "skill", "siluzan-ads", "report-templates", basename13),
151017
+ path59.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename13)
150885
151018
  ];
150886
151019
  for (const p of candidates) {
150887
- if (fs47.existsSync(p)) return p;
151020
+ if (fs48.existsSync(p)) return p;
150888
151021
  }
150889
151022
  return candidates[0];
150890
151023
  }
@@ -150927,10 +151060,10 @@ function injectReportData7(html, payload, lang) {
150927
151060
  return localized.replace(INJECT_MARKER6, `window.__YANDEX_PERIOD_REPORT__ = ${json};`);
150928
151061
  }
150929
151062
  async function runYandexAnalysisRender(opts) {
150930
- const dataPath = path58.resolve(opts.dataFile);
151063
+ const dataPath = path59.resolve(opts.dataFile);
150931
151064
  let data = asRecord42(await readJsonFile9(dataPath));
150932
151065
  if (opts.snapshotDir?.trim()) {
150933
- data = await mergeYandexAnalysisSnapshotIntoReport(data, path58.resolve(opts.snapshotDir));
151066
+ data = await mergeYandexAnalysisSnapshotIntoReport(data, path59.resolve(opts.snapshotDir));
150934
151067
  }
150935
151068
  data = refreshWeeklyFromDaily(data);
150936
151069
  const lang = readReportLangOrExit({ flag: opts.lang, meta: data.meta });
@@ -150956,10 +151089,10 @@ async function runYandexAnalysisRender(opts) {
150956
151089
  `);
150957
151090
  process.exit(1);
150958
151091
  }
150959
- const outPath = path58.resolve(
150960
- opts.out ?? path58.join(path58.dirname(dataPath), "yandex-period-report.html")
151092
+ const outPath = path59.resolve(
151093
+ opts.out ?? path59.join(path59.dirname(dataPath), "yandex-period-report.html")
150961
151094
  );
150962
- const outDir = path58.dirname(outPath);
151095
+ const outDir = path59.dirname(outPath);
150963
151096
  await fsPromises8.mkdir(outDir, { recursive: true });
150964
151097
  await fsPromises8.writeFile(outPath, injectReportData7(html, data, lang), "utf8");
150965
151098
  const { stats } = contentCheck;
@@ -151060,13 +151193,13 @@ function optionalId(raw) {
151060
151193
  function insightsLevelToPath(level) {
151061
151194
  return level;
151062
151195
  }
151063
- function assertYandexAnalysisQuery(path60, query) {
151064
- const caps = YANDEX_PATH_CAPS[path60];
151196
+ function assertYandexAnalysisQuery(path61, query) {
151197
+ const caps = YANDEX_PATH_CAPS[path61];
151065
151198
  if (query.timeIncrement != null && !caps.timeIncrement) {
151066
- throw new Error(`--time-increment \u4E0D\u80FD\u7528\u4E8E /${path60}\uFF08\u4EC5 campaigns / adgroups / ads\uFF09\u3002`);
151199
+ throw new Error(`--time-increment \u4E0D\u80FD\u7528\u4E8E /${path61}\uFF08\u4EC5 campaigns / adgroups / ads\uFF09\u3002`);
151067
151200
  }
151068
151201
  if (query.network != null && !caps.network) {
151069
- throw new Error(`--network \u4E0D\u80FD\u7528\u4E8E /${path60}\uFF08\u4EC5 campaigns / geo / devices\uFF09\u3002`);
151202
+ throw new Error(`--network \u4E0D\u80FD\u7528\u4E8E /${path61}\uFF08\u4EC5 campaigns / geo / devices\uFF09\u3002`);
151070
151203
  }
151071
151204
  if (query.status != null && !caps.status) {
151072
151205
  throw new Error(`--status \u4EC5\u7528\u4E8E /ads\uFF08\u62D2\u5BA1/\u5BA1\u6838\u6001\u8D70\u7ED3\u6784\u67E5\u8BE2\uFF0C\u884C\u5185 spend \u4E3A 0\uFF09\u3002`);
@@ -151083,12 +151216,12 @@ function assertYandexAnalysisQuery(path60, query) {
151083
151216
  );
151084
151217
  }
151085
151218
  if (query.limit != null && !caps.limit) {
151086
- throw new Error(`--limit \u4E0D\u80FD\u7528\u4E8E /${path60}\uFF08overview / daily / devices \u65E0\u6B64\u53C2\u6570\uFF09\u3002`);
151219
+ throw new Error(`--limit \u4E0D\u80FD\u7528\u4E8E /${path61}\uFF08overview / daily / devices \u65E0\u6B64\u53C2\u6570\uFF09\u3002`);
151087
151220
  }
151088
151221
  }
151089
- function buildYandexAnalysisSearchParams(path60, query) {
151090
- assertYandexAnalysisQuery(path60, query);
151091
- const caps = YANDEX_PATH_CAPS[path60];
151222
+ function buildYandexAnalysisSearchParams(path61, query) {
151223
+ assertYandexAnalysisQuery(path61, query);
151224
+ const caps = YANDEX_PATH_CAPS[path61];
151092
151225
  const params = new URLSearchParams({
151093
151226
  account: query.account,
151094
151227
  start: query.start,
@@ -151114,10 +151247,10 @@ function buildYandexAnalysisSearchParams(path60, query) {
151114
151247
  }
151115
151248
  return params;
151116
151249
  }
151117
- async function fetchYandexAnalysisPath(config, path60, query, verbose) {
151250
+ async function fetchYandexAnalysisPath(config, path61, query, verbose) {
151118
151251
  const yandexApiUrl = requireYandexApi(config);
151119
- const params = buildYandexAnalysisSearchParams(path60, query);
151120
- const url = analysisUrl(yandexApiUrl, path60, params.toString());
151252
+ const params = buildYandexAnalysisSearchParams(path61, query);
151253
+ const url = analysisUrl(yandexApiUrl, path61, params.toString());
151121
151254
  return apiFetch2(url, config, {}, verbose);
151122
151255
  }
151123
151256
  function unwrapYandexItems(raw) {
@@ -151181,13 +151314,13 @@ ${args.title}
151181
151314
  console.log(` ${args.footnote}
151182
151315
  `);
151183
151316
  }
151184
- async function fetchPath(opts, path60, extra) {
151317
+ async function fetchPath(opts, path61, extra) {
151185
151318
  const accountId = assertYandexAccountId(opts.account);
151186
151319
  const { startDate, endDate } = resolveRange(opts.start, opts.end);
151187
151320
  const config = loadConfig(opts.token);
151188
151321
  const raw = await fetchYandexAnalysisPath(
151189
151322
  config,
151190
- path60,
151323
+ path61,
151191
151324
  {
151192
151325
  account: accountId,
151193
151326
  start: startDate,
@@ -151457,14 +151590,14 @@ function requireYandexEntityId(raw, label2) {
151457
151590
  }
151458
151591
  return id;
151459
151592
  }
151460
- function yandexAdsUrl(base2, path60, account) {
151593
+ function yandexAdsUrl(base2, path61, account) {
151461
151594
  const q = new URLSearchParams({ account });
151462
- return `${base2.replace(/\/$/, "")}/yandex-ads/${path60}?${q}`;
151595
+ return `${base2.replace(/\/$/, "")}/yandex-ads/${path61}?${q}`;
151463
151596
  }
151464
- async function postYandex(path60, body, opts, section, commandLabel) {
151597
+ async function postYandex(path61, body, opts, section, commandLabel) {
151465
151598
  const account = assertYandexAccountId(opts.account);
151466
151599
  const config = loadConfig(opts.token);
151467
- const url = yandexAdsUrl(requireYandexApi(config), path60, account);
151600
+ const url = yandexAdsUrl(requireYandexApi(config), path61, account);
151468
151601
  const payload = await apiFetch2(
151469
151602
  url,
151470
151603
  config,
@@ -151637,36 +151770,36 @@ function registerYandexAnalysisCommands(program2) {
151637
151770
  }
151638
151771
 
151639
151772
  // src/commands/ad-gap/catalog.ts
151640
- var bing = (path60, needsBody = true) => ({
151773
+ var bing = (path61, needsBody = true) => ({
151641
151774
  service: "tso",
151642
151775
  method: "POST",
151643
- path: `/reporting/media-account/BingV2/{account}/library/${path60}`,
151776
+ path: `/reporting/media-account/BingV2/{account}/library/${path61}`,
151644
151777
  needsBody
151645
151778
  });
151646
- var yandex = (path60, extra) => ({
151779
+ var yandex = (path61, extra) => ({
151647
151780
  service: "yandex",
151648
151781
  method: "POST",
151649
- path: `/yandex-ads/library/${path60}`,
151782
+ path: `/yandex-ads/library/${path61}`,
151650
151783
  needsBody: true,
151651
151784
  ...extra
151652
151785
  });
151653
- var facebook = (path60, extra) => ({
151786
+ var facebook = (path61, extra) => ({
151654
151787
  service: "facebook",
151655
151788
  method: "POST",
151656
- path: `/api/fb/ads/{account}/${path60}`,
151789
+ path: `/api/fb/ads/{account}/${path61}`,
151657
151790
  needsBody: true,
151658
151791
  ...extra
151659
151792
  });
151660
- var tiktok = (path60) => ({
151793
+ var tiktok = (path61) => ({
151661
151794
  service: "tiktok",
151662
151795
  method: "POST",
151663
- path: `/tiktokgap/${path60}`,
151796
+ path: `/tiktokgap/${path61}`,
151664
151797
  needsBody: true
151665
151798
  });
151666
- var google = (method, path60, extra) => ({
151799
+ var google = (method, path61, extra) => ({
151667
151800
  service: "google",
151668
151801
  method,
151669
- path: path60,
151802
+ path: path61,
151670
151803
  needsBody: method !== "GET" && method !== "DELETE",
151671
151804
  ...extra
151672
151805
  });
@@ -151796,14 +151929,14 @@ function resolveGapPath(actionName, target) {
151796
151929
  const parent = action.needsParent ? requireToken(target.parent, "parent") : target.parent?.trim() ?? "";
151797
151930
  const id = action.needsId ? requireToken(target.id, "id") : target.id?.trim() ?? "";
151798
151931
  const label2 = action.needsLabel ? requireToken(target.label, "label") : target.label?.trim() ?? "";
151799
- let path60 = action.path.replaceAll("{account}", encodeURIComponent(account)).replaceAll("{parent}", encodeURIComponent(parent)).replaceAll("{id}", encodeURIComponent(id)).replaceAll("{label}", encodeURIComponent(label2));
151800
- if (path60.includes("{")) {
151932
+ let path61 = action.path.replaceAll("{account}", encodeURIComponent(account)).replaceAll("{parent}", encodeURIComponent(parent)).replaceAll("{id}", encodeURIComponent(id)).replaceAll("{label}", encodeURIComponent(label2));
151933
+ if (path61.includes("{")) {
151801
151934
  throw new Error(`action ${actionName} \u8FD8\u7F3A\u8DEF\u5F84\u53C2\u6570`);
151802
151935
  }
151803
151936
  if (action.service === "yandex") {
151804
- path60 += `${path60.includes("?") ? "&" : "?"}account=${encodeURIComponent(account)}`;
151937
+ path61 += `${path61.includes("?") ? "&" : "?"}account=${encodeURIComponent(account)}`;
151805
151938
  }
151806
- return { action, path: path60 };
151939
+ return { action, path: path61 };
151807
151940
  }
151808
151941
  function requireToken(value, label2) {
151809
151942
  const text5 = (value ?? "").trim();
@@ -152133,9 +152266,9 @@ function interceptAgentCompatArgv(argv) {
152133
152266
  installProcessHandlers();
152134
152267
  function getVersion() {
152135
152268
  try {
152136
- const __dirname3 = path59.dirname(fileURLToPath16(import.meta.url));
152137
- const pkgPath = path59.join(__dirname3, "..", "package.json");
152138
- const pkg = JSON.parse(fs48.readFileSync(pkgPath, "utf8"));
152269
+ const __dirname3 = path60.dirname(fileURLToPath16(import.meta.url));
152270
+ const pkgPath = path60.join(__dirname3, "..", "package.json");
152271
+ const pkg = JSON.parse(fs49.readFileSync(pkgPath, "utf8"));
152139
152272
  return pkg.version ?? "0.0.0";
152140
152273
  } catch {
152141
152274
  return "0.0.0";