hyperframes 0.4.13 → 0.4.15-alpha.1

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/cli.js CHANGED
@@ -54,7 +54,7 @@ var VERSION;
54
54
  var init_version = __esm({
55
55
  "src/version.ts"() {
56
56
  "use strict";
57
- VERSION = true ? "0.4.13" : "0.0.0-dev";
57
+ VERSION = true ? "0.4.15-alpha.1" : "0.0.0-dev";
58
58
  }
59
59
  });
60
60
 
@@ -4422,6 +4422,110 @@ var init_core = __esm({
4422
4422
  });
4423
4423
 
4424
4424
  // ../core/src/lint/rules/media.ts
4425
+ function escapeRegExp(value) {
4426
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4427
+ }
4428
+ function selectorTargetsManagedMedia(selector, mediaIds) {
4429
+ const normalized = selector.trim();
4430
+ if (!normalized) return false;
4431
+ if (/\b(video|audio)\b/i.test(normalized)) return true;
4432
+ for (const mediaId of mediaIds) {
4433
+ if (normalized.includes(`#${mediaId}`) || normalized.includes(`[id="${mediaId}"]`) || normalized.includes(`[id='${mediaId}']`)) {
4434
+ return true;
4435
+ }
4436
+ }
4437
+ return false;
4438
+ }
4439
+ function findImperativeMediaControlFindings(ctx) {
4440
+ const findings = [];
4441
+ const managedMediaIds = new Set(
4442
+ ctx.tags.filter((tag) => tag.name === "video" || tag.name === "audio").map((tag) => readAttr(tag.raw, "id")).filter((id) => Boolean(id))
4443
+ );
4444
+ if (managedMediaIds.size === 0 || ctx.scripts.length === 0) return findings;
4445
+ for (const script of ctx.scripts) {
4446
+ const mediaVars = /* @__PURE__ */ new Map();
4447
+ const assignmentPatterns = [
4448
+ /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:document|window\.document)\.getElementById\(\s*["']([^"']+)["']\s*\)/g,
4449
+ /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:document|window\.document)\.querySelector\(\s*["']([^"']+)["']\s*\)/g
4450
+ ];
4451
+ for (const pattern of assignmentPatterns) {
4452
+ let match;
4453
+ while ((match = pattern.exec(script.content)) !== null) {
4454
+ const variableName = match[1];
4455
+ const target = match[2];
4456
+ if (!variableName || !target) continue;
4457
+ if (managedMediaIds.has(target) || selectorTargetsManagedMedia(target, managedMediaIds)) {
4458
+ mediaVars.set(variableName, managedMediaIds.has(target) ? target : void 0);
4459
+ }
4460
+ }
4461
+ }
4462
+ const directIdPatterns = [
4463
+ {
4464
+ pattern: /\b(?:document|window\.document)\.getElementById\(\s*["']([^"']+)["']\s*\)\.play\s*\(/g,
4465
+ kind: "play()"
4466
+ },
4467
+ {
4468
+ pattern: /\b(?:document|window\.document)\.getElementById\(\s*["']([^"']+)["']\s*\)\.pause\s*\(/g,
4469
+ kind: "pause()"
4470
+ },
4471
+ {
4472
+ pattern: /\b(?:document|window\.document)\.getElementById\(\s*["']([^"']+)["']\s*\)\.currentTime\s*=/g,
4473
+ kind: "currentTime"
4474
+ },
4475
+ {
4476
+ pattern: /\b(?:document|window\.document)\.querySelector\(\s*["']([^"']+)["']\s*\)\.play\s*\(/g,
4477
+ kind: "play()"
4478
+ },
4479
+ {
4480
+ pattern: /\b(?:document|window\.document)\.querySelector\(\s*["']([^"']+)["']\s*\)\.pause\s*\(/g,
4481
+ kind: "pause()"
4482
+ },
4483
+ {
4484
+ pattern: /\b(?:document|window\.document)\.querySelector\(\s*["']([^"']+)["']\s*\)\.currentTime\s*=/g,
4485
+ kind: "currentTime"
4486
+ }
4487
+ ];
4488
+ for (const { pattern, kind } of directIdPatterns) {
4489
+ let match;
4490
+ while ((match = pattern.exec(script.content)) !== null) {
4491
+ const target = match[1];
4492
+ if (!target) continue;
4493
+ const elementId = managedMediaIds.has(target) ? target : selectorTargetsManagedMedia(target, managedMediaIds) ? void 0 : null;
4494
+ if (elementId === null) continue;
4495
+ findings.push({
4496
+ code: "imperative_media_control",
4497
+ severity: "error",
4498
+ message: `Inline <script> imperatively controls managed media via ${kind}. HyperFrames must own media play/pause/seek to keep preview, timeline, and renders deterministic.`,
4499
+ elementId: elementId || void 0,
4500
+ fixHint: "Remove imperative media play/pause/currentTime control. Express timing with data-start/data-duration and media offsets like data-media-start or data-playback-start instead.",
4501
+ snippet: truncateSnippet(match[0])
4502
+ });
4503
+ }
4504
+ }
4505
+ for (const [variableName, elementId] of mediaVars) {
4506
+ const escapedVar = escapeRegExp(variableName);
4507
+ const variablePatterns = [
4508
+ { pattern: new RegExp(`\\b${escapedVar}\\.play\\s*\\(`, "g"), kind: "play()" },
4509
+ { pattern: new RegExp(`\\b${escapedVar}\\.pause\\s*\\(`, "g"), kind: "pause()" },
4510
+ { pattern: new RegExp(`\\b${escapedVar}\\.currentTime\\s*=`, "g"), kind: "currentTime" }
4511
+ ];
4512
+ for (const { pattern, kind } of variablePatterns) {
4513
+ let match;
4514
+ while ((match = pattern.exec(script.content)) !== null) {
4515
+ findings.push({
4516
+ code: "imperative_media_control",
4517
+ severity: "error",
4518
+ message: `Inline <script> imperatively controls managed media via ${kind}. HyperFrames must own media play/pause/seek to keep preview, timeline, and renders deterministic.`,
4519
+ elementId,
4520
+ fixHint: "Remove imperative media play/pause/currentTime control. Express timing with data-start/data-duration and media offsets like data-media-start or data-playback-start instead.",
4521
+ snippet: truncateSnippet(match[0])
4522
+ });
4523
+ }
4524
+ }
4525
+ }
4526
+ }
4527
+ return findings;
4528
+ }
4425
4529
  var mediaRules;
4426
4530
  var init_media = __esm({
4427
4531
  "../core/src/lint/rules/media.ts"() {
@@ -4649,7 +4753,9 @@ var init_media = __esm({
4649
4753
  }
4650
4754
  }
4651
4755
  return findings;
4652
- }
4756
+ },
4757
+ // imperative_media_control
4758
+ findImperativeMediaControlFindings
4653
4759
  ];
4654
4760
  }
4655
4761
  });
@@ -9715,7 +9821,7 @@ import { get as httpsGet } from "https";
9715
9821
  import { pipeline } from "stream/promises";
9716
9822
  function downloadFile(url, dest) {
9717
9823
  const tmp = `${dest}.tmp`;
9718
- return new Promise((resolve35, reject) => {
9824
+ return new Promise((resolve36, reject) => {
9719
9825
  const follow = (u) => {
9720
9826
  httpsGet(u, (res) => {
9721
9827
  if (res.statusCode === 301 || res.statusCode === 302) {
@@ -9732,7 +9838,7 @@ function downloadFile(url, dest) {
9732
9838
  const file = createWriteStream(tmp);
9733
9839
  pipeline(res, file).then(() => {
9734
9840
  renameSync(tmp, dest);
9735
- resolve35();
9841
+ resolve36();
9736
9842
  }).catch((err) => {
9737
9843
  try {
9738
9844
  unlinkSync(tmp);
@@ -10450,7 +10556,7 @@ function hasNpx() {
10450
10556
  }
10451
10557
  }
10452
10558
  function runSkillsAdd(repo) {
10453
- return new Promise((resolve35, reject) => {
10559
+ return new Promise((resolve36, reject) => {
10454
10560
  const child = spawn("npx", ["skills", "add", repo, "--all"], {
10455
10561
  stdio: "inherit",
10456
10562
  timeout: 12e4,
@@ -10464,7 +10570,7 @@ function runSkillsAdd(repo) {
10464
10570
  env: { ...process.env, GIT_CLONE_PROTECTION_ACTIVE: "0" }
10465
10571
  });
10466
10572
  child.on("close", (code, signal) => {
10467
- if (code === 0) resolve35();
10573
+ if (code === 0) resolve36();
10468
10574
  else if (signal === "SIGINT" || code === 130) process.exit(0);
10469
10575
  else reject(new Error(`npx skills add exited with code ${code}`));
10470
10576
  });
@@ -14744,10 +14850,10 @@ function compareDocumentPosition(nodeA, nodeB) {
14744
14850
  function uniqueSort(nodes) {
14745
14851
  nodes = nodes.filter((node, i2, arr) => !arr.includes(node, i2 + 1));
14746
14852
  nodes.sort((a, b) => {
14747
- const relative5 = compareDocumentPosition(a, b);
14748
- if (relative5 & DocumentPosition.PRECEDING) {
14853
+ const relative6 = compareDocumentPosition(a, b);
14854
+ if (relative6 & DocumentPosition.PRECEDING) {
14749
14855
  return -1;
14750
- } else if (relative5 & DocumentPosition.FOLLOWING) {
14856
+ } else if (relative6 & DocumentPosition.FOLLOWING) {
14751
14857
  return 1;
14752
14858
  }
14753
14859
  return 0;
@@ -15209,8 +15315,8 @@ var init_custom_element_registry = __esm({
15209
15315
  } : (element) => element.localName === localName;
15210
15316
  registry.set(localName, { Class, check });
15211
15317
  if (waiting.has(localName)) {
15212
- for (const resolve35 of waiting.get(localName))
15213
- resolve35(Class);
15318
+ for (const resolve36 of waiting.get(localName))
15319
+ resolve36(Class);
15214
15320
  waiting.delete(localName);
15215
15321
  }
15216
15322
  ownerDocument.querySelectorAll(
@@ -15250,13 +15356,13 @@ var init_custom_element_registry = __esm({
15250
15356
  */
15251
15357
  whenDefined(localName) {
15252
15358
  const { registry, waiting } = this;
15253
- return new Promise((resolve35) => {
15359
+ return new Promise((resolve36) => {
15254
15360
  if (registry.has(localName))
15255
- resolve35(registry.get(localName).Class);
15361
+ resolve36(registry.get(localName).Class);
15256
15362
  else {
15257
15363
  if (!waiting.has(localName))
15258
15364
  waiting.set(localName, []);
15259
- waiting.get(localName).push(resolve35);
15365
+ waiting.get(localName).push(resolve36);
15260
15366
  }
15261
15367
  });
15262
15368
  }
@@ -25291,7 +25397,7 @@ async function pollPageExpression(page, expression, timeoutMs, intervalMs = 100)
25291
25397
  while (Date.now() < deadline) {
25292
25398
  const ready = Boolean(await page.evaluate(expression));
25293
25399
  if (ready) return true;
25294
- await new Promise((resolve35) => setTimeout(resolve35, intervalMs));
25400
+ await new Promise((resolve36) => setTimeout(resolve36, intervalMs));
25295
25401
  }
25296
25402
  return Boolean(await page.evaluate(expression));
25297
25403
  }
@@ -25574,7 +25680,7 @@ var init_frameCapture = __esm({
25574
25680
  // ../engine/src/utils/gpuEncoder.ts
25575
25681
  import { spawn as spawn2 } from "child_process";
25576
25682
  async function detectGpuEncoder() {
25577
- return new Promise((resolve35) => {
25683
+ return new Promise((resolve36) => {
25578
25684
  const ffmpeg = spawn2("ffmpeg", ["-encoders"], {
25579
25685
  stdio: ["pipe", "pipe", "pipe"]
25580
25686
  });
@@ -25583,13 +25689,13 @@ async function detectGpuEncoder() {
25583
25689
  stdout2 += data.toString();
25584
25690
  });
25585
25691
  ffmpeg.on("close", () => {
25586
- if (stdout2.includes("h264_nvenc")) resolve35("nvenc");
25587
- else if (stdout2.includes("h264_videotoolbox")) resolve35("videotoolbox");
25588
- else if (stdout2.includes("h264_vaapi")) resolve35("vaapi");
25589
- else if (stdout2.includes("h264_qsv")) resolve35("qsv");
25590
- else resolve35(null);
25692
+ if (stdout2.includes("h264_nvenc")) resolve36("nvenc");
25693
+ else if (stdout2.includes("h264_videotoolbox")) resolve36("videotoolbox");
25694
+ else if (stdout2.includes("h264_vaapi")) resolve36("vaapi");
25695
+ else if (stdout2.includes("h264_qsv")) resolve36("qsv");
25696
+ else resolve36(null);
25591
25697
  });
25592
- ffmpeg.on("error", () => resolve35(null));
25698
+ ffmpeg.on("error", () => resolve36(null));
25593
25699
  });
25594
25700
  }
25595
25701
  async function getCachedGpuEncoder() {
@@ -25628,7 +25734,7 @@ async function runFfmpeg(args, opts) {
25628
25734
  const signal = opts?.signal;
25629
25735
  const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
25630
25736
  const onStderr = opts?.onStderr;
25631
- return new Promise((resolve35) => {
25737
+ return new Promise((resolve36) => {
25632
25738
  const ffmpeg = spawn3("ffmpeg", args);
25633
25739
  let stderr = "";
25634
25740
  const onAbort = () => {
@@ -25654,7 +25760,7 @@ async function runFfmpeg(args, opts) {
25654
25760
  ffmpeg.on("close", (code) => {
25655
25761
  clearTimeout(timer);
25656
25762
  if (signal) signal.removeEventListener("abort", onAbort);
25657
- resolve35({
25763
+ resolve36({
25658
25764
  success: !signal?.aborted && code === 0,
25659
25765
  exitCode: code,
25660
25766
  stderr,
@@ -25664,7 +25770,7 @@ async function runFfmpeg(args, opts) {
25664
25770
  ffmpeg.on("error", (err) => {
25665
25771
  clearTimeout(timer);
25666
25772
  if (signal) signal.removeEventListener("abort", onAbort);
25667
- resolve35({
25773
+ resolve36({
25668
25774
  success: false,
25669
25775
  exitCode: null,
25670
25776
  stderr: err.message,
@@ -25835,7 +25941,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25835
25941
  const inputPath = join19(framesDir, framePattern);
25836
25942
  const inputArgs = ["-framerate", String(options.fps), "-i", inputPath];
25837
25943
  const args = buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder);
25838
- return new Promise((resolve35) => {
25944
+ return new Promise((resolve36) => {
25839
25945
  const ffmpeg = spawn4("ffmpeg", args);
25840
25946
  let stderr = "";
25841
25947
  const onAbort = () => {
@@ -25860,7 +25966,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25860
25966
  if (signal) signal.removeEventListener("abort", onAbort);
25861
25967
  const durationMs = Date.now() - startTime;
25862
25968
  if (signal?.aborted) {
25863
- resolve35({
25969
+ resolve36({
25864
25970
  success: false,
25865
25971
  outputPath,
25866
25972
  durationMs,
@@ -25871,7 +25977,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25871
25977
  return;
25872
25978
  }
25873
25979
  if (code !== 0) {
25874
- resolve35({
25980
+ resolve36({
25875
25981
  success: false,
25876
25982
  outputPath,
25877
25983
  durationMs,
@@ -25882,12 +25988,12 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
25882
25988
  return;
25883
25989
  }
25884
25990
  const fileSize = existsSync15(outputPath) ? statSync4(outputPath).size : 0;
25885
- resolve35({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
25991
+ resolve36({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
25886
25992
  });
25887
25993
  ffmpeg.on("error", (err) => {
25888
25994
  clearTimeout(timer);
25889
25995
  if (signal) signal.removeEventListener("abort", onAbort);
25890
- resolve35({
25996
+ resolve36({
25891
25997
  success: false,
25892
25998
  outputPath,
25893
25999
  durationMs: Date.now() - startTime,
@@ -25945,18 +26051,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
25945
26051
  let gpuEncoder = null;
25946
26052
  if (options.useGpu) gpuEncoder = await getCachedGpuEncoder();
25947
26053
  const args = buildEncoderArgs(options, inputArgs, chunkPath, gpuEncoder);
25948
- const chunkResult = await new Promise((resolve35) => {
26054
+ const chunkResult = await new Promise((resolve36) => {
25949
26055
  const ffmpeg = spawn4("ffmpeg", args);
25950
26056
  let stderr = "";
25951
26057
  ffmpeg.stderr.on("data", (d) => {
25952
26058
  stderr += d.toString();
25953
26059
  });
25954
26060
  ffmpeg.on("close", (code) => {
25955
- if (code === 0) resolve35({ success: true });
25956
- else resolve35({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
26061
+ if (code === 0) resolve36({ success: true });
26062
+ else resolve36({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
25957
26063
  });
25958
26064
  ffmpeg.on("error", (err) => {
25959
- resolve35({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
26065
+ resolve36({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
25960
26066
  });
25961
26067
  });
25962
26068
  if (!chunkResult.success) {
@@ -25986,18 +26092,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
25986
26092
  "-y",
25987
26093
  outputPath
25988
26094
  ];
25989
- const concatResult = await new Promise((resolve35) => {
26095
+ const concatResult = await new Promise((resolve36) => {
25990
26096
  const ffmpeg = spawn4("ffmpeg", concatArgs);
25991
26097
  let stderr = "";
25992
26098
  ffmpeg.stderr.on("data", (d) => {
25993
26099
  stderr += d.toString();
25994
26100
  });
25995
26101
  ffmpeg.on("close", (code) => {
25996
- if (code === 0) resolve35({ success: true });
25997
- else resolve35({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
26102
+ if (code === 0) resolve36({ success: true });
26103
+ else resolve36({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
25998
26104
  });
25999
26105
  ffmpeg.on("error", (err) => {
26000
- resolve35({ success: false, error: `Chunk concat error: ${err.message}` });
26106
+ resolve36({ success: false, error: `Chunk concat error: ${err.message}` });
26001
26107
  });
26002
26108
  });
26003
26109
  if (!concatResult.success) {
@@ -26141,37 +26247,37 @@ import { dirname as dirname6 } from "path";
26141
26247
  function createFrameReorderBuffer(startFrame, endFrame) {
26142
26248
  let cursor = startFrame;
26143
26249
  const pending = /* @__PURE__ */ new Map();
26144
- const enqueueAt = (frame, resolve35) => {
26250
+ const enqueueAt = (frame, resolve36) => {
26145
26251
  const list = pending.get(frame);
26146
26252
  if (list === void 0) {
26147
- pending.set(frame, [resolve35]);
26253
+ pending.set(frame, [resolve36]);
26148
26254
  } else {
26149
- list.push(resolve35);
26255
+ list.push(resolve36);
26150
26256
  }
26151
26257
  };
26152
26258
  const flushAt = (frame) => {
26153
26259
  const list = pending.get(frame);
26154
26260
  if (list === void 0) return;
26155
26261
  pending.delete(frame);
26156
- for (const resolve35 of list) resolve35();
26262
+ for (const resolve36 of list) resolve36();
26157
26263
  };
26158
- const waitForFrame = (frame) => new Promise((resolve35) => {
26264
+ const waitForFrame = (frame) => new Promise((resolve36) => {
26159
26265
  if (frame === cursor) {
26160
- resolve35();
26266
+ resolve36();
26161
26267
  return;
26162
26268
  }
26163
- enqueueAt(frame, resolve35);
26269
+ enqueueAt(frame, resolve36);
26164
26270
  });
26165
26271
  const advanceTo = (frame) => {
26166
26272
  cursor = frame;
26167
26273
  flushAt(frame);
26168
26274
  };
26169
- const waitForAllDone = () => new Promise((resolve35) => {
26275
+ const waitForAllDone = () => new Promise((resolve36) => {
26170
26276
  if (cursor >= endFrame) {
26171
- resolve35();
26277
+ resolve36();
26172
26278
  return;
26173
26279
  }
26174
- enqueueAt(endFrame, resolve35);
26280
+ enqueueAt(endFrame, resolve36);
26175
26281
  });
26176
26282
  return { waitForFrame, advanceTo, waitForAllDone };
26177
26283
  }
@@ -26333,7 +26439,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
26333
26439
  let stderr = "";
26334
26440
  let exitCode = null;
26335
26441
  let exitPromiseResolve = null;
26336
- const exitPromise = new Promise((resolve35) => exitPromiseResolve = resolve35);
26442
+ const exitPromise = new Promise((resolve36) => exitPromiseResolve = resolve36);
26337
26443
  ffmpeg.stderr?.on("data", (data) => {
26338
26444
  stderr += data.toString();
26339
26445
  });
@@ -26379,8 +26485,8 @@ Process error: ${err.message}`;
26379
26485
  if (signal) signal.removeEventListener("abort", onAbort);
26380
26486
  const stdin = ffmpeg.stdin;
26381
26487
  if (stdin && !stdin.destroyed) {
26382
- await new Promise((resolve35) => {
26383
- stdin.end(() => resolve35());
26488
+ await new Promise((resolve36) => {
26489
+ stdin.end(() => resolve36());
26384
26490
  });
26385
26491
  }
26386
26492
  await exitPromise;
@@ -26422,7 +26528,7 @@ import { spawn as spawn6 } from "child_process";
26422
26528
  import { readFileSync as readFileSync14 } from "fs";
26423
26529
  import { extname as extname4 } from "path";
26424
26530
  function runFfprobe(args) {
26425
- return new Promise((resolve35, reject) => {
26531
+ return new Promise((resolve36, reject) => {
26426
26532
  const proc = spawn6("ffprobe", args);
26427
26533
  let stdout2 = "";
26428
26534
  let stderr = "";
@@ -26436,7 +26542,7 @@ function runFfprobe(args) {
26436
26542
  if (code !== 0) {
26437
26543
  reject(new Error(`[FFmpeg] ffprobe exited with code ${code}: ${stderr}`));
26438
26544
  } else {
26439
- resolve35(stdout2);
26545
+ resolve36(stdout2);
26440
26546
  }
26441
26547
  });
26442
26548
  proc.on("error", (err) => {
@@ -26850,7 +26956,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
26850
26956
  args.push("-q:v", format === "jpg" ? String(Math.ceil((100 - quality) / 3)) : "0");
26851
26957
  if (format === "png") args.push("-compression_level", "6");
26852
26958
  args.push("-y", outputPattern);
26853
- return new Promise((resolve35, reject) => {
26959
+ return new Promise((resolve36, reject) => {
26854
26960
  const ffmpeg = spawn7("ffmpeg", args);
26855
26961
  let stderr = "";
26856
26962
  const onAbort = () => {
@@ -26885,7 +26991,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
26885
26991
  files.forEach((file, index) => {
26886
26992
  framePaths.set(index, join21(videoOutputDir, file));
26887
26993
  });
26888
- resolve35({
26994
+ resolve36({
26889
26995
  videoId,
26890
26996
  srcPath: videoPath,
26891
26997
  outputDir: videoOutputDir,
@@ -28131,11 +28237,11 @@ function createFileServer(options) {
28131
28237
  headers: { "Content-Type": contentType }
28132
28238
  });
28133
28239
  });
28134
- return new Promise((resolve35) => {
28240
+ return new Promise((resolve36) => {
28135
28241
  const server = serve({ fetch: app.fetch, port }, (info) => {
28136
28242
  const actualPort = info.port;
28137
28243
  const url = `http://localhost:${actualPort}`;
28138
- resolve35({
28244
+ resolve36({
28139
28245
  url,
28140
28246
  port: actualPort,
28141
28247
  close: () => server.close()
@@ -29622,7 +29728,6 @@ __export(src_exports2, {
29622
29728
  getEncoderPreset: () => getEncoderPreset,
29623
29729
  getFrameAtTime: () => getFrameAtTime,
29624
29730
  getHdrEncoderColorParams: () => getHdrEncoderColorParams,
29625
- getSrgbToHdrLut: () => getSrgbToHdrLut,
29626
29731
  getSystemResources: () => getSystemResources,
29627
29732
  groupIntoLayers: () => groupIntoLayers,
29628
29733
  hdrToLinear: () => hdrToLinear,
@@ -30510,10 +30615,10 @@ function createFileServer2(options) {
30510
30615
  headers: { "Content-Type": contentType }
30511
30616
  });
30512
30617
  });
30513
- return new Promise((resolve35) => {
30618
+ return new Promise((resolve36) => {
30514
30619
  const connections = /* @__PURE__ */ new Set();
30515
30620
  const server = serve2({ fetch: app.fetch, port }, (info) => {
30516
- resolve35({
30621
+ resolve36({
30517
30622
  url: `http://localhost:${info.port}`,
30518
30623
  port: info.port,
30519
30624
  close: () => {
@@ -33095,8 +33200,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
33095
33200
  )
33096
33201
  });
33097
33202
  }
33098
- for (let layerIdx = 0; layerIdx < layers.length; layerIdx++) {
33099
- const layer = layers[layerIdx];
33203
+ for (const [layerIdx, layer] of layers.entries()) {
33100
33204
  if (layer.type === "hdr") {
33101
33205
  const before2 = shouldLog ? countNonZeroRgb482(canvas) : 0;
33102
33206
  const isHdrImage = nativeHdrImageIds.has(layer.element.id);
@@ -33915,10 +34019,10 @@ var init_semaphore = __esm({
33915
34019
  this.active++;
33916
34020
  return () => this.release();
33917
34021
  }
33918
- return new Promise((resolve35) => {
34022
+ return new Promise((resolve36) => {
33919
34023
  this.queue.push(() => {
33920
34024
  this.active++;
33921
- resolve35(() => this.release());
34025
+ resolve36(() => this.release());
33922
34026
  });
33923
34027
  });
33924
34028
  }
@@ -34675,7 +34779,7 @@ function createStudioServer(options) {
34675
34779
  });
34676
34780
  app.get("/api/runtime.js", (c2) => {
34677
34781
  const serve4 = async () => {
34678
- const runtimeSource = existsSync31(runtimePath) ? readFileSync23(runtimePath, "utf-8") : await loadRuntimeSourceFallback();
34782
+ const runtimeSource = await loadRuntimeSourceFallback() ?? (existsSync31(runtimePath) ? readFileSync23(runtimePath, "utf-8") : null);
34679
34783
  if (!runtimeSource) return c2.text("runtime not available", 404);
34680
34784
  return c2.body(runtimeSource, 200, {
34681
34785
  "Content-Type": "text/javascript",
@@ -34826,8 +34930,8 @@ async function runDevMode(dir, projectName) {
34826
34930
  }
34827
34931
  });
34828
34932
  }
34829
- return new Promise((resolve35) => {
34830
- child.on("close", () => resolve35());
34933
+ return new Promise((resolve36) => {
34934
+ child.on("close", () => resolve36());
34831
34935
  });
34832
34936
  }
34833
34937
  function hasLocalStudio(dir) {
@@ -34897,8 +35001,8 @@ async function runLocalStudioMode(dir, projectName) {
34897
35001
  }
34898
35002
  });
34899
35003
  }
34900
- return new Promise((resolve35) => {
34901
- child.on("close", () => resolve35());
35004
+ return new Promise((resolve36) => {
35005
+ child.on("close", () => resolve36());
34902
35006
  });
34903
35007
  }
34904
35008
  async function runEmbeddedMode(dir, startPort, projectName, forceNew = false) {
@@ -36308,6 +36412,184 @@ var init_play = __esm({
36308
36412
  }
36309
36413
  });
36310
36414
 
36415
+ // src/utils/publishProject.ts
36416
+ import { basename as basename6, join as join37, relative as relative4 } from "path";
36417
+ import { readdirSync as readdirSync13, readFileSync as readFileSync26, statSync as statSync12 } from "fs";
36418
+ import AdmZip from "adm-zip";
36419
+ function shouldIgnoreSegment(segment) {
36420
+ return segment.startsWith(".") || IGNORED_DIRS.has(segment) || IGNORED_FILES.has(segment);
36421
+ }
36422
+ function collectProjectFiles(rootDir, currentDir, paths) {
36423
+ for (const entry of readdirSync13(currentDir, { withFileTypes: true })) {
36424
+ if (shouldIgnoreSegment(entry.name)) continue;
36425
+ const absolutePath = join37(currentDir, entry.name);
36426
+ const relativePath = relative4(rootDir, absolutePath).replaceAll("\\", "/");
36427
+ if (!relativePath) continue;
36428
+ if (entry.isDirectory()) {
36429
+ collectProjectFiles(rootDir, absolutePath, paths);
36430
+ continue;
36431
+ }
36432
+ if (!statSync12(absolutePath).isFile()) continue;
36433
+ paths.push(relativePath);
36434
+ }
36435
+ }
36436
+ function createPublishArchive(projectDir) {
36437
+ const filePaths = [];
36438
+ collectProjectFiles(projectDir, projectDir, filePaths);
36439
+ if (!filePaths.includes("index.html")) {
36440
+ throw new Error("Project must include an index.html file at the root before publish.");
36441
+ }
36442
+ const archive = new AdmZip();
36443
+ for (const filePath of filePaths) {
36444
+ archive.addFile(filePath, readFileSync26(join37(projectDir, filePath)));
36445
+ }
36446
+ return {
36447
+ buffer: archive.toBuffer(),
36448
+ fileCount: filePaths.length
36449
+ };
36450
+ }
36451
+ function getPublishApiBaseUrl() {
36452
+ return (process.env["HYPERFRAMES_PUBLISHED_PROJECTS_API_URL"] || process.env["HEYGEN_API_URL"] || "https://api2.heygen.com").replace(/\/$/, "");
36453
+ }
36454
+ async function publishProjectArchive(projectDir) {
36455
+ const title = basename6(projectDir);
36456
+ const archive = createPublishArchive(projectDir);
36457
+ const archiveBytes = new Uint8Array(archive.buffer.byteLength);
36458
+ archiveBytes.set(archive.buffer);
36459
+ const body = new FormData();
36460
+ body.set("title", title);
36461
+ body.set("file", new File([archiveBytes], `${title}.zip`, { type: "application/zip" }));
36462
+ const headers = {
36463
+ heygen_route: "canary"
36464
+ };
36465
+ const response = await fetch(`${getPublishApiBaseUrl()}/v1/hyperframes/projects/publish`, {
36466
+ method: "POST",
36467
+ body,
36468
+ headers,
36469
+ signal: AbortSignal.timeout(3e4)
36470
+ });
36471
+ const payload = await response.json().catch(() => null);
36472
+ const message = typeof payload?.message === "string" ? payload.message : "Failed to publish project";
36473
+ if (!response.ok || !payload?.data) {
36474
+ throw new Error(message);
36475
+ }
36476
+ return {
36477
+ projectId: String(payload.data.project_id),
36478
+ title: String(payload.data.title),
36479
+ fileCount: Number(payload.data.file_count),
36480
+ url: String(payload.data.url),
36481
+ claimToken: String(payload.data.claim_token)
36482
+ };
36483
+ }
36484
+ var IGNORED_DIRS, IGNORED_FILES;
36485
+ var init_publishProject = __esm({
36486
+ "src/utils/publishProject.ts"() {
36487
+ "use strict";
36488
+ IGNORED_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", "dist", ".next", "coverage"]);
36489
+ IGNORED_FILES = /* @__PURE__ */ new Set([".DS_Store", "Thumbs.db"]);
36490
+ }
36491
+ });
36492
+
36493
+ // src/commands/publish.ts
36494
+ var publish_exports = {};
36495
+ __export(publish_exports, {
36496
+ default: () => publish_default,
36497
+ examples: () => examples6
36498
+ });
36499
+ import { basename as basename7, resolve as resolve25 } from "path";
36500
+ import { existsSync as existsSync37 } from "fs";
36501
+ import { join as join38 } from "path";
36502
+ var examples6, publish_default;
36503
+ var init_publish = __esm({
36504
+ "src/commands/publish.ts"() {
36505
+ "use strict";
36506
+ init_dist();
36507
+ init_dist3();
36508
+ init_colors();
36509
+ init_lintProject();
36510
+ init_lintFormat();
36511
+ init_publishProject();
36512
+ examples6 = [
36513
+ ["Publish the current project with a public URL", "hyperframes publish"],
36514
+ ["Publish a specific directory", "hyperframes publish ./my-video"],
36515
+ ["Skip the consent prompt (scripts)", "hyperframes publish --yes"]
36516
+ ];
36517
+ publish_default = defineCommand({
36518
+ meta: {
36519
+ name: "publish",
36520
+ description: "Upload the project and return a stable public URL"
36521
+ },
36522
+ args: {
36523
+ dir: { type: "positional", description: "Project directory", required: false },
36524
+ yes: {
36525
+ type: "boolean",
36526
+ alias: "y",
36527
+ description: "Skip the publish confirmation prompt",
36528
+ default: false
36529
+ }
36530
+ },
36531
+ async run({ args }) {
36532
+ const rawArg = args.dir;
36533
+ const dir = resolve25(rawArg ?? ".");
36534
+ const isImplicitCwd = !rawArg || rawArg === "." || rawArg === "./";
36535
+ const projectName = isImplicitCwd ? basename7(process.env["PWD"] ?? dir) : basename7(dir);
36536
+ const indexPath = join38(dir, "index.html");
36537
+ if (existsSync37(indexPath)) {
36538
+ const lintResult = lintProject({ dir, name: projectName, indexPath });
36539
+ if (lintResult.totalErrors > 0 || lintResult.totalWarnings > 0) {
36540
+ console.log();
36541
+ for (const line of formatLintFindings(lintResult)) console.log(line);
36542
+ console.log();
36543
+ }
36544
+ }
36545
+ if (args.yes !== true) {
36546
+ console.log();
36547
+ console.log(
36548
+ ` ${c.bold("hyperframes publish uploads this project and creates a stable public URL.")}`
36549
+ );
36550
+ console.log(
36551
+ ` ${c.dim("Anyone with the URL can open the published project and claim it after authenticating.")}`
36552
+ );
36553
+ console.log();
36554
+ const approved = await Rt({ message: "Publish this project?" });
36555
+ if (Ct(approved) || approved !== true) {
36556
+ console.log();
36557
+ console.log(` ${c.dim("Aborted.")}`);
36558
+ console.log();
36559
+ return;
36560
+ }
36561
+ }
36562
+ Wt2(c.bold("hyperframes publish"));
36563
+ const publishSpinner = be();
36564
+ publishSpinner.start("Uploading project...");
36565
+ try {
36566
+ const published = await publishProjectArchive(dir);
36567
+ const claimUrl = new URL(published.url);
36568
+ claimUrl.searchParams.set("claim_token", published.claimToken);
36569
+ publishSpinner.stop(c.success("Project published"));
36570
+ console.log();
36571
+ console.log(` ${c.dim("Project")} ${c.accent(published.title)}`);
36572
+ console.log(` ${c.dim("Files")} ${String(published.fileCount)}`);
36573
+ console.log(` ${c.dim("Public")} ${c.accent(claimUrl.toString())}`);
36574
+ console.log();
36575
+ console.log(
36576
+ ` ${c.dim("Open the URL on hyperframes.dev to claim the project and continue editing.")}`
36577
+ );
36578
+ console.log();
36579
+ return;
36580
+ } catch (err) {
36581
+ publishSpinner.stop(c.error("Publish failed"));
36582
+ console.error();
36583
+ console.error(` ${err.message}`);
36584
+ console.error();
36585
+ process.exitCode = 1;
36586
+ return;
36587
+ }
36588
+ }
36589
+ });
36590
+ }
36591
+ });
36592
+
36311
36593
  // src/utils/producer.ts
36312
36594
  async function loadProducer() {
36313
36595
  return await Promise.resolve().then(() => (init_src3(), src_exports3));
@@ -36421,11 +36703,11 @@ var init_ffmpeg = __esm({
36421
36703
  var render_exports = {};
36422
36704
  __export(render_exports, {
36423
36705
  default: () => render_default,
36424
- examples: () => examples6
36706
+ examples: () => examples7
36425
36707
  });
36426
- import { mkdirSync as mkdirSync21, readFileSync as readFileSync26, statSync as statSync12, writeFileSync as writeFileSync14, rmSync as rmSync8 } from "fs";
36708
+ import { mkdirSync as mkdirSync21, readFileSync as readFileSync27, statSync as statSync13, writeFileSync as writeFileSync14, rmSync as rmSync8 } from "fs";
36427
36709
  import { cpus as cpus3, freemem as freemem3, tmpdir as tmpdir3 } from "os";
36428
- import { resolve as resolve25, dirname as dirname15, join as join37, basename as basename6 } from "path";
36710
+ import { resolve as resolve26, dirname as dirname15, join as join39, basename as basename8 } from "path";
36429
36711
  import { execFileSync as execFileSync5, spawn as spawn10 } from "child_process";
36430
36712
  function defaultWorkerCount() {
36431
36713
  return Math.max(1, Math.min(Math.floor(CPU_CORE_COUNT * 3 / 4), 8));
@@ -36434,11 +36716,11 @@ function dockerImageTag(version) {
36434
36716
  return `${DOCKER_IMAGE_PREFIX}:${version}`;
36435
36717
  }
36436
36718
  function resolveDockerfilePath() {
36437
- const builtPath = resolve25(__dirname, "docker", "Dockerfile.render");
36438
- const devPath = resolve25(__dirname, "..", "src", "docker", "Dockerfile.render");
36719
+ const builtPath = resolve26(__dirname, "docker", "Dockerfile.render");
36720
+ const devPath = resolve26(__dirname, "..", "src", "docker", "Dockerfile.render");
36439
36721
  for (const p of [builtPath, devPath]) {
36440
36722
  try {
36441
- statSync12(p);
36723
+ statSync13(p);
36442
36724
  return p;
36443
36725
  } catch {
36444
36726
  continue;
@@ -36462,9 +36744,9 @@ function ensureDockerImage(version, quiet) {
36462
36744
  }
36463
36745
  if (!quiet) console.log(c.dim(` Building Docker image: ${tag}...`));
36464
36746
  const dockerfilePath = resolveDockerfilePath();
36465
- const tmpDir = join37(tmpdir3(), `hyperframes-docker-${Date.now()}`);
36747
+ const tmpDir = join39(tmpdir3(), `hyperframes-docker-${Date.now()}`);
36466
36748
  mkdirSync21(tmpDir, { recursive: true });
36467
- writeFileSync14(join37(tmpDir, "Dockerfile"), readFileSync26(dockerfilePath));
36749
+ writeFileSync14(join39(tmpDir, "Dockerfile"), readFileSync27(dockerfilePath));
36468
36750
  try {
36469
36751
  execFileSync5(
36470
36752
  "docker",
@@ -36509,11 +36791,11 @@ async function renderDocker(projectDir, outputPath, options) {
36509
36791
  process.exit(1);
36510
36792
  }
36511
36793
  const outputDir = dirname15(outputPath);
36512
- const outputFilename = basename6(outputPath);
36794
+ const outputFilename = basename8(outputPath);
36513
36795
  const dockerArgs = buildDockerRunArgs({
36514
36796
  imageTag,
36515
- projectDir: resolve25(projectDir),
36516
- outputDir: resolve25(outputDir),
36797
+ projectDir: resolve26(projectDir),
36798
+ outputDir: resolve26(outputDir),
36517
36799
  outputFilename,
36518
36800
  options: {
36519
36801
  fps: options.fps,
@@ -36632,7 +36914,7 @@ function printRenderComplete(outputPath, elapsedMs, quiet) {
36632
36914
  if (quiet) return;
36633
36915
  let fileSize = "unknown";
36634
36916
  try {
36635
- fileSize = formatBytes(statSync12(outputPath).size);
36917
+ fileSize = formatBytes(statSync13(outputPath).size);
36636
36918
  } catch {
36637
36919
  }
36638
36920
  const duration = formatDuration(elapsedMs);
@@ -36640,7 +36922,7 @@ function printRenderComplete(outputPath, elapsedMs, quiet) {
36640
36922
  console.log(c.success("\u25C7") + " " + c.accent(outputPath));
36641
36923
  console.log(" " + c.bold(fileSize) + c.dim(" \xB7 " + duration + " \xB7 completed"));
36642
36924
  }
36643
- var examples6, VALID_FPS, VALID_QUALITY, VALID_FORMAT, FORMAT_EXT, CPU_CORE_COUNT, render_default, DOCKER_IMAGE_PREFIX;
36925
+ var examples7, VALID_FPS, VALID_QUALITY, VALID_FORMAT, FORMAT_EXT, CPU_CORE_COUNT, render_default, DOCKER_IMAGE_PREFIX;
36644
36926
  var init_render2 = __esm({
36645
36927
  "src/commands/render.ts"() {
36646
36928
  "use strict";
@@ -36657,7 +36939,7 @@ var init_render2 = __esm({
36657
36939
  init_version();
36658
36940
  init_env();
36659
36941
  init_dockerRunArgs();
36660
- examples6 = [
36942
+ examples7 = [
36661
36943
  ["Render to MP4", "hyperframes render --output output.mp4"],
36662
36944
  ["Render transparent overlay (ProRes)", "hyperframes render --format mov --output overlay.mov"],
36663
36945
  ["Render transparent WebM overlay", "hyperframes render --format webm --output overlay.webm"],
@@ -36788,12 +37070,12 @@ var init_render2 = __esm({
36788
37070
  }
36789
37071
  process.env.PRODUCER_MAX_CONCURRENT_RENDERS = String(parsed);
36790
37072
  }
36791
- const rendersDir = resolve25("renders");
37073
+ const rendersDir = resolve26("renders");
36792
37074
  const ext = FORMAT_EXT[format] ?? ".mp4";
36793
37075
  const now = /* @__PURE__ */ new Date();
36794
37076
  const datePart = now.toISOString().slice(0, 10);
36795
37077
  const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
36796
- const outputPath = args.output ? resolve25(args.output) : join37(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
37078
+ const outputPath = args.output ? resolve26(args.output) : join39(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
36797
37079
  mkdirSync21(dirname15(outputPath), { recursive: true });
36798
37080
  const useDocker = args.docker ?? false;
36799
37081
  const useGpu = args.gpu ?? false;
@@ -37022,9 +37304,9 @@ var init_updateCheck = __esm({
37022
37304
  var lint_exports2 = {};
37023
37305
  __export(lint_exports2, {
37024
37306
  default: () => lint_default,
37025
- examples: () => examples7
37307
+ examples: () => examples8
37026
37308
  });
37027
- var examples7, lint_default;
37309
+ var examples8, lint_default;
37028
37310
  var init_lint3 = __esm({
37029
37311
  "src/commands/lint.ts"() {
37030
37312
  "use strict";
@@ -37034,7 +37316,7 @@ var init_lint3 = __esm({
37034
37316
  init_lintProject();
37035
37317
  init_project();
37036
37318
  init_updateCheck();
37037
- examples7 = [
37319
+ examples8 = [
37038
37320
  ["Lint the current project", "hyperframes lint"],
37039
37321
  ["Lint a specific directory", "hyperframes lint ./my-video"],
37040
37322
  ["Output findings as JSON", "hyperframes lint --json"],
@@ -37139,23 +37421,23 @@ var init_dom = __esm({
37139
37421
  var info_exports = {};
37140
37422
  __export(info_exports, {
37141
37423
  default: () => info_default,
37142
- examples: () => examples8
37424
+ examples: () => examples9
37143
37425
  });
37144
- import { readFileSync as readFileSync27, readdirSync as readdirSync13, statSync as statSync13 } from "fs";
37145
- import { join as join38 } from "path";
37426
+ import { readFileSync as readFileSync28, readdirSync as readdirSync14, statSync as statSync14 } from "fs";
37427
+ import { join as join40 } from "path";
37146
37428
  function totalSize(dir) {
37147
37429
  let total = 0;
37148
- for (const entry of readdirSync13(dir, { withFileTypes: true })) {
37149
- const path2 = join38(dir, entry.name);
37430
+ for (const entry of readdirSync14(dir, { withFileTypes: true })) {
37431
+ const path2 = join40(dir, entry.name);
37150
37432
  if (entry.isDirectory()) {
37151
37433
  total += totalSize(path2);
37152
37434
  } else {
37153
- total += statSync13(path2).size;
37435
+ total += statSync14(path2).size;
37154
37436
  }
37155
37437
  }
37156
37438
  return total;
37157
37439
  }
37158
- var examples8, info_default;
37440
+ var examples9, info_default;
37159
37441
  var init_info = __esm({
37160
37442
  "src/commands/info.ts"() {
37161
37443
  "use strict";
@@ -37166,7 +37448,7 @@ var init_info = __esm({
37166
37448
  init_dom();
37167
37449
  init_project();
37168
37450
  init_updateCheck();
37169
- examples8 = [
37451
+ examples9 = [
37170
37452
  ["Show project metadata", "hyperframes info"],
37171
37453
  ["Output as JSON", "hyperframes info --json"]
37172
37454
  ];
@@ -37178,7 +37460,7 @@ var init_info = __esm({
37178
37460
  },
37179
37461
  async run({ args }) {
37180
37462
  const project = resolveProject(args.dir);
37181
- const html = readFileSync27(project.indexPath, "utf-8");
37463
+ const html = readFileSync28(project.indexPath, "utf-8");
37182
37464
  ensureDOMParser();
37183
37465
  const parsed = parseHtml(html);
37184
37466
  const tracks = new Set(parsed.elements.map((el) => el.zIndex));
@@ -37232,10 +37514,10 @@ var init_info = __esm({
37232
37514
  var compositions_exports = {};
37233
37515
  __export(compositions_exports, {
37234
37516
  default: () => compositions_default,
37235
- examples: () => examples9
37517
+ examples: () => examples10
37236
37518
  });
37237
- import { existsSync as existsSync37, readFileSync as readFileSync28 } from "fs";
37238
- import { resolve as resolve26, dirname as dirname16 } from "path";
37519
+ import { existsSync as existsSync38, readFileSync as readFileSync29 } from "fs";
37520
+ import { resolve as resolve27, dirname as dirname16 } from "path";
37239
37521
  function parseCompositions(html, baseDir) {
37240
37522
  const parser = new DOMParser();
37241
37523
  const doc = parser.parseFromString(html, "text/html");
@@ -37247,9 +37529,9 @@ function parseCompositions(html, baseDir) {
37247
37529
  const height = parseInt(div.getAttribute("data-height") ?? "1080", 10);
37248
37530
  const compositionSrc = div.getAttribute("data-composition-src");
37249
37531
  if (compositionSrc) {
37250
- const subPath = resolve26(baseDir, compositionSrc);
37251
- if (existsSync37(subPath)) {
37252
- const subHtml = readFileSync28(subPath, "utf-8");
37532
+ const subPath = resolve27(baseDir, compositionSrc);
37533
+ if (existsSync38(subPath)) {
37534
+ const subHtml = readFileSync29(subPath, "utf-8");
37253
37535
  const subInfo = parseSubComposition(subHtml, id, width, height);
37254
37536
  compositions.push({ ...subInfo, source: compositionSrc });
37255
37537
  return;
@@ -37322,7 +37604,7 @@ function parseSubComposition(html, fallbackId, fallbackWidth, fallbackHeight) {
37322
37604
  }
37323
37605
  return { id, duration, width, height, elementCount };
37324
37606
  }
37325
- var examples9, compositions_default;
37607
+ var examples10, compositions_default;
37326
37608
  var init_compositions = __esm({
37327
37609
  "src/commands/compositions.ts"() {
37328
37610
  "use strict";
@@ -37331,7 +37613,7 @@ var init_compositions = __esm({
37331
37613
  init_dom();
37332
37614
  init_project();
37333
37615
  init_updateCheck();
37334
- examples9 = [
37616
+ examples10 = [
37335
37617
  ["List compositions in the current project", "hyperframes compositions"],
37336
37618
  ["Output as JSON", "hyperframes compositions --json"]
37337
37619
  ];
@@ -37343,7 +37625,7 @@ var init_compositions = __esm({
37343
37625
  },
37344
37626
  async run({ args }) {
37345
37627
  const project = resolveProject(args.dir);
37346
- const html = readFileSync28(project.indexPath, "utf-8");
37628
+ const html = readFileSync29(project.indexPath, "utf-8");
37347
37629
  ensureDOMParser();
37348
37630
  const compositions = parseCompositions(html, dirname16(project.indexPath));
37349
37631
  if (compositions.length === 0) {
@@ -37379,11 +37661,11 @@ var init_compositions = __esm({
37379
37661
  var benchmark_exports = {};
37380
37662
  __export(benchmark_exports, {
37381
37663
  default: () => benchmark_default,
37382
- examples: () => examples10
37664
+ examples: () => examples11
37383
37665
  });
37384
- import { existsSync as existsSync38, statSync as statSync14 } from "fs";
37385
- import { resolve as resolve27, join as join39 } from "path";
37386
- var examples10, DEFAULT_CONFIGS, benchmark_default;
37666
+ import { existsSync as existsSync39, statSync as statSync15 } from "fs";
37667
+ import { resolve as resolve28, join as join41 } from "path";
37668
+ var examples11, DEFAULT_CONFIGS, benchmark_default;
37387
37669
  var init_benchmark = __esm({
37388
37670
  "src/commands/benchmark.ts"() {
37389
37671
  "use strict";
@@ -37394,7 +37676,7 @@ var init_benchmark = __esm({
37394
37676
  init_format();
37395
37677
  init_dist3();
37396
37678
  init_updateCheck();
37397
- examples10 = [
37679
+ examples11 = [
37398
37680
  ["Run benchmarks with default settings (3 runs)", "hyperframes benchmark"],
37399
37681
  ["Run 5 iterations per config", "hyperframes benchmark --runs 5"],
37400
37682
  ["Output results as JSON", "hyperframes benchmark --json"]
@@ -37424,7 +37706,7 @@ var init_benchmark = __esm({
37424
37706
  process.exit(1);
37425
37707
  }
37426
37708
  const jsonOutput = args.json ?? false;
37427
- const benchDir = resolve27("renders", ".benchmark");
37709
+ const benchDir = resolve28("renders", ".benchmark");
37428
37710
  let producer = null;
37429
37711
  try {
37430
37712
  producer = await loadProducer();
@@ -37457,7 +37739,7 @@ var init_benchmark = __esm({
37457
37739
  s2?.start(`Benchmarking ${config.label}...`);
37458
37740
  for (let i2 = 0; i2 < runsPerConfig; i2++) {
37459
37741
  s2?.message(`${config.label} \u2014 run ${i2 + 1}/${runsPerConfig}`);
37460
- const outputPath = join39(
37742
+ const outputPath = join41(
37461
37743
  benchDir,
37462
37744
  `${config.label.replace(/[^a-zA-Z0-9]/g, "_")}_run${i2}.mp4`
37463
37745
  );
@@ -37471,8 +37753,8 @@ var init_benchmark = __esm({
37471
37753
  await producer.executeRenderJob(job, project.dir, outputPath);
37472
37754
  const elapsedMs = Date.now() - startTime;
37473
37755
  let fileSize = null;
37474
- if (existsSync38(outputPath)) {
37475
- const stat3 = statSync14(outputPath);
37756
+ if (existsSync39(outputPath)) {
37757
+ const stat3 = statSync15(outputPath);
37476
37758
  fileSize = stat3.size;
37477
37759
  }
37478
37760
  runs.push({ elapsedMs, fileSize });
@@ -37554,7 +37836,7 @@ var init_benchmark = __esm({
37554
37836
  var browser_exports = {};
37555
37837
  __export(browser_exports, {
37556
37838
  default: () => browser_default,
37557
- examples: () => examples11
37839
+ examples: () => examples12
37558
37840
  });
37559
37841
  async function runEnsure() {
37560
37842
  Wt2(c.bold("hyperframes browser ensure"));
@@ -37617,7 +37899,7 @@ function runClear() {
37617
37899
  Gt(c.dim("No cached browser to remove."));
37618
37900
  }
37619
37901
  }
37620
- var examples11, browser_default;
37902
+ var examples12, browser_default;
37621
37903
  var init_browser = __esm({
37622
37904
  "src/commands/browser.ts"() {
37623
37905
  "use strict";
@@ -37627,7 +37909,7 @@ var init_browser = __esm({
37627
37909
  init_format();
37628
37910
  init_manager2();
37629
37911
  init_events();
37630
- examples11 = [
37912
+ examples12 = [
37631
37913
  ["Find or download Chrome for rendering", "hyperframes browser ensure"],
37632
37914
  ["Print the Chrome executable path", "hyperframes browser path"],
37633
37915
  ["Remove cached Chrome download", "hyperframes browser clear"]
@@ -37685,10 +37967,10 @@ Run ${c.accent("hyperframes browser --help")} for usage.`
37685
37967
  var transcribe_exports2 = {};
37686
37968
  __export(transcribe_exports2, {
37687
37969
  default: () => transcribe_default,
37688
- examples: () => examples12
37970
+ examples: () => examples13
37689
37971
  });
37690
- import { existsSync as existsSync39, writeFileSync as writeFileSync15 } from "fs";
37691
- import { resolve as resolve28, join as join40, extname as extname8 } from "path";
37972
+ import { existsSync as existsSync40, writeFileSync as writeFileSync15 } from "fs";
37973
+ import { resolve as resolve29, join as join42, extname as extname8 } from "path";
37692
37974
  async function importTranscript(inputPath, dir, json) {
37693
37975
  const { loadTranscript: loadTranscript2, patchCaptionHtml: patchCaptionHtml2 } = await Promise.resolve().then(() => (init_normalize(), normalize_exports));
37694
37976
  const { words, format } = loadTranscript2(inputPath);
@@ -37696,7 +37978,7 @@ async function importTranscript(inputPath, dir, json) {
37696
37978
  console.error(c.error("No words found in transcript."));
37697
37979
  process.exit(1);
37698
37980
  }
37699
- const outPath = join40(dir, "transcript.json");
37981
+ const outPath = join42(dir, "transcript.json");
37700
37982
  writeFileSync15(outPath, JSON.stringify(words, null, 2));
37701
37983
  patchCaptionHtml2(dir, words);
37702
37984
  if (json) {
@@ -37763,7 +38045,7 @@ async function transcribeAudio(inputPath, dir, opts) {
37763
38045
  process.exit(1);
37764
38046
  }
37765
38047
  }
37766
- var examples12, transcribe_default;
38048
+ var examples13, transcribe_default;
37767
38049
  var init_transcribe2 = __esm({
37768
38050
  "src/commands/transcribe.ts"() {
37769
38051
  "use strict";
@@ -37771,7 +38053,7 @@ var init_transcribe2 = __esm({
37771
38053
  init_dist3();
37772
38054
  init_colors();
37773
38055
  init_manager();
37774
- examples12 = [
38056
+ examples13 = [
37775
38057
  ["Transcribe an audio file", "hyperframes transcribe audio.mp3"],
37776
38058
  ["Transcribe a video file", "hyperframes transcribe video.mp4"],
37777
38059
  ["Use a larger model for better accuracy", "hyperframes transcribe audio.mp3 --model medium.en"],
@@ -37812,12 +38094,12 @@ var init_transcribe2 = __esm({
37812
38094
  }
37813
38095
  },
37814
38096
  async run({ args }) {
37815
- const inputPath = resolve28(args.input);
37816
- if (!existsSync39(inputPath)) {
38097
+ const inputPath = resolve29(args.input);
38098
+ if (!existsSync40(inputPath)) {
37817
38099
  console.error(c.error(`File not found: ${args.input}`));
37818
38100
  process.exit(1);
37819
38101
  }
37820
- const dir = resolve28(args.dir ?? ".");
38102
+ const dir = resolve29(args.dir ?? ".");
37821
38103
  const ext = extname8(inputPath).toLowerCase();
37822
38104
  const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
37823
38105
  if (isImport) {
@@ -37834,9 +38116,9 @@ var init_transcribe2 = __esm({
37834
38116
  });
37835
38117
 
37836
38118
  // src/tts/manager.ts
37837
- import { existsSync as existsSync40, mkdirSync as mkdirSync22 } from "fs";
38119
+ import { existsSync as existsSync41, mkdirSync as mkdirSync22 } from "fs";
37838
38120
  import { homedir as homedir8 } from "os";
37839
- import { join as join41 } from "path";
38121
+ import { join as join43 } from "path";
37840
38122
  function inferLangFromVoiceId(voiceId) {
37841
38123
  const first = voiceId.charAt(0).toLowerCase();
37842
38124
  return VOICE_PREFIX_LANG[first] ?? "en-us";
@@ -37845,8 +38127,8 @@ function isSupportedLang(value) {
37845
38127
  return SUPPORTED_LANGS.includes(value);
37846
38128
  }
37847
38129
  async function ensureModel2(model = DEFAULT_MODEL2, options) {
37848
- const modelPath = join41(MODELS_DIR2, `${model}.onnx`);
37849
- if (existsSync40(modelPath)) return modelPath;
38130
+ const modelPath = join43(MODELS_DIR2, `${model}.onnx`);
38131
+ if (existsSync41(modelPath)) return modelPath;
37850
38132
  const url = MODEL_URLS[model];
37851
38133
  if (!url) {
37852
38134
  throw new Error(
@@ -37856,18 +38138,18 @@ async function ensureModel2(model = DEFAULT_MODEL2, options) {
37856
38138
  mkdirSync22(MODELS_DIR2, { recursive: true });
37857
38139
  options?.onProgress?.(`Downloading TTS model ${model} (~311 MB)...`);
37858
38140
  await downloadFile(url, modelPath);
37859
- if (!existsSync40(modelPath)) {
38141
+ if (!existsSync41(modelPath)) {
37860
38142
  throw new Error(`Model download failed: ${model}`);
37861
38143
  }
37862
38144
  return modelPath;
37863
38145
  }
37864
38146
  async function ensureVoices(options) {
37865
- const voicesPath = join41(VOICES_DIR, "voices-v1.0.bin");
37866
- if (existsSync40(voicesPath)) return voicesPath;
38147
+ const voicesPath = join43(VOICES_DIR, "voices-v1.0.bin");
38148
+ if (existsSync41(voicesPath)) return voicesPath;
37867
38149
  mkdirSync22(VOICES_DIR, { recursive: true });
37868
38150
  options?.onProgress?.("Downloading voice data (~27 MB)...");
37869
38151
  await downloadFile(VOICES_URL, voicesPath);
37870
- if (!existsSync40(voicesPath)) {
38152
+ if (!existsSync41(voicesPath)) {
37871
38153
  throw new Error("Voice data download failed");
37872
38154
  }
37873
38155
  return voicesPath;
@@ -37877,9 +38159,9 @@ var init_manager3 = __esm({
37877
38159
  "src/tts/manager.ts"() {
37878
38160
  "use strict";
37879
38161
  init_download();
37880
- CACHE_DIR3 = join41(homedir8(), ".cache", "hyperframes", "tts");
37881
- MODELS_DIR2 = join41(CACHE_DIR3, "models");
37882
- VOICES_DIR = join41(CACHE_DIR3, "voices");
38162
+ CACHE_DIR3 = join43(homedir8(), ".cache", "hyperframes", "tts");
38163
+ MODELS_DIR2 = join43(CACHE_DIR3, "models");
38164
+ VOICES_DIR = join43(CACHE_DIR3, "voices");
37883
38165
  DEFAULT_MODEL2 = "kokoro-v1.0";
37884
38166
  MODEL_URLS = {
37885
38167
  "kokoro-v1.0": "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx"
@@ -37940,8 +38222,8 @@ __export(synthesize_exports, {
37940
38222
  synthesize: () => synthesize
37941
38223
  });
37942
38224
  import { execFileSync as execFileSync6 } from "child_process";
37943
- import { existsSync as existsSync41, writeFileSync as writeFileSync16, mkdirSync as mkdirSync23, readdirSync as readdirSync14, unlinkSync as unlinkSync6 } from "fs";
37944
- import { join as join42, dirname as dirname17, basename as basename7 } from "path";
38225
+ import { existsSync as existsSync42, writeFileSync as writeFileSync16, mkdirSync as mkdirSync23, readdirSync as readdirSync15, unlinkSync as unlinkSync6 } from "fs";
38226
+ import { join as join44, dirname as dirname17, basename as basename9 } from "path";
37945
38227
  import { homedir as homedir9 } from "os";
37946
38228
  function findPython() {
37947
38229
  for (const name of ["python3", "python"]) {
@@ -37977,15 +38259,15 @@ function hasPythonPackage(python, pkg) {
37977
38259
  }
37978
38260
  }
37979
38261
  function ensureSynthScript() {
37980
- if (!existsSync41(SCRIPT_PATH)) {
38262
+ if (!existsSync42(SCRIPT_PATH)) {
37981
38263
  mkdirSync23(SCRIPT_DIR, { recursive: true });
37982
38264
  writeFileSync16(SCRIPT_PATH, SYNTH_SCRIPT);
37983
- const currentName = basename7(SCRIPT_PATH);
38265
+ const currentName = basename9(SCRIPT_PATH);
37984
38266
  try {
37985
- for (const entry of readdirSync14(SCRIPT_DIR)) {
38267
+ for (const entry of readdirSync15(SCRIPT_DIR)) {
37986
38268
  if (entry !== currentName && /^synth(-v\d+)?\.py$/.test(entry)) {
37987
38269
  try {
37988
- unlinkSync6(join42(SCRIPT_DIR, entry));
38270
+ unlinkSync6(join44(SCRIPT_DIR, entry));
37989
38271
  } catch {
37990
38272
  }
37991
38273
  }
@@ -38031,7 +38313,7 @@ async function synthesize(text, outputPath, options) {
38031
38313
  stdio: ["pipe", "pipe", "pipe"]
38032
38314
  }
38033
38315
  );
38034
- if (!existsSync41(outputPath)) {
38316
+ if (!existsSync42(outputPath)) {
38035
38317
  throw new Error("Synthesis completed but no output file was created");
38036
38318
  }
38037
38319
  const lines = stdout2.trim().split("\n");
@@ -38044,7 +38326,7 @@ async function synthesize(text, outputPath, options) {
38044
38326
  langApplied: result.langApplied
38045
38327
  };
38046
38328
  } catch (err) {
38047
- if (err instanceof SyntaxError && existsSync41(outputPath)) {
38329
+ if (err instanceof SyntaxError && existsSync42(outputPath)) {
38048
38330
  throw new Error(
38049
38331
  "Speech was generated but metadata could not be read. Check the output file manually."
38050
38332
  );
@@ -38095,8 +38377,8 @@ print(json.dumps({
38095
38377
  "langApplied": bool(lang and supports_lang),
38096
38378
  }))
38097
38379
  `;
38098
- SCRIPT_DIR = join42(homedir9(), ".cache", "hyperframes", "tts");
38099
- SCRIPT_PATH = join42(SCRIPT_DIR, "synth-v2.py");
38380
+ SCRIPT_DIR = join44(homedir9(), ".cache", "hyperframes", "tts");
38381
+ SCRIPT_PATH = join44(SCRIPT_DIR, "synth-v2.py");
38100
38382
  }
38101
38383
  });
38102
38384
 
@@ -38104,10 +38386,10 @@ print(json.dumps({
38104
38386
  var tts_exports = {};
38105
38387
  __export(tts_exports, {
38106
38388
  default: () => tts_default,
38107
- examples: () => examples13
38389
+ examples: () => examples14
38108
38390
  });
38109
- import { existsSync as existsSync42, readFileSync as readFileSync29 } from "fs";
38110
- import { resolve as resolve29, extname as extname9 } from "path";
38391
+ import { existsSync as existsSync43, readFileSync as readFileSync30 } from "fs";
38392
+ import { resolve as resolve30, extname as extname9 } from "path";
38111
38393
  function listVoices(json) {
38112
38394
  const rows = BUNDLED_VOICES.map((v) => ({ ...v, defaultLang: inferLangFromVoiceId(v.id) }));
38113
38395
  if (json) {
@@ -38137,7 +38419,7 @@ ${c.bold("Available voices")} (Kokoro-82M)
38137
38419
  `
38138
38420
  );
38139
38421
  }
38140
- var examples13, voiceList, langList, tts_default;
38422
+ var examples14, voiceList, langList, tts_default;
38141
38423
  var init_tts = __esm({
38142
38424
  "src/commands/tts.ts"() {
38143
38425
  "use strict";
@@ -38146,7 +38428,7 @@ var init_tts = __esm({
38146
38428
  init_colors();
38147
38429
  init_format();
38148
38430
  init_manager3();
38149
- examples13 = [
38431
+ examples14 = [
38150
38432
  ["Generate speech from text", 'hyperframes tts "Welcome to HyperFrames"'],
38151
38433
  ["Choose a voice", 'hyperframes tts "Hello world" --voice am_adam'],
38152
38434
  ["Save to a specific file", 'hyperframes tts "Intro" --voice bf_emma --output narration.wav'],
@@ -38215,9 +38497,9 @@ var init_tts = __esm({
38215
38497
  process.exit(1);
38216
38498
  }
38217
38499
  let text;
38218
- const maybeFile = resolve29(args.input);
38219
- if (existsSync42(maybeFile) && extname9(maybeFile).toLowerCase() === ".txt") {
38220
- text = readFileSync29(maybeFile, "utf-8").trim();
38500
+ const maybeFile = resolve30(args.input);
38501
+ if (existsSync43(maybeFile) && extname9(maybeFile).toLowerCase() === ".txt") {
38502
+ text = readFileSync30(maybeFile, "utf-8").trim();
38221
38503
  if (!text) {
38222
38504
  console.error(c.error("File is empty."));
38223
38505
  process.exit(1);
@@ -38229,7 +38511,7 @@ var init_tts = __esm({
38229
38511
  console.error(c.error("No text provided."));
38230
38512
  process.exit(1);
38231
38513
  }
38232
- const output = resolve29(args.output ?? "speech.wav");
38514
+ const output = resolve30(args.output ?? "speech.wav");
38233
38515
  const voice = args.voice ?? DEFAULT_VOICE;
38234
38516
  const speed = args.speed ? parseFloat(args.speed) : 1;
38235
38517
  if (isNaN(speed) || speed <= 0 || speed > 3) {
@@ -38307,17 +38589,17 @@ var init_tts = __esm({
38307
38589
  var docs_exports = {};
38308
38590
  __export(docs_exports, {
38309
38591
  default: () => docs_default,
38310
- examples: () => examples14
38592
+ examples: () => examples15
38311
38593
  });
38312
- import { readFileSync as readFileSync30, existsSync as existsSync43 } from "fs";
38313
- import { resolve as resolve30, dirname as dirname18, join as join43 } from "path";
38594
+ import { readFileSync as readFileSync31, existsSync as existsSync44 } from "fs";
38595
+ import { resolve as resolve31, dirname as dirname18, join as join45 } from "path";
38314
38596
  import { fileURLToPath as fileURLToPath6 } from "url";
38315
38597
  function docsDir() {
38316
38598
  const thisFile = fileURLToPath6(import.meta.url);
38317
38599
  const dir = dirname18(thisFile);
38318
- const devPath = resolve30(dir, "..", "docs");
38319
- const builtPath = resolve30(dir, "docs");
38320
- return existsSync43(devPath) ? devPath : builtPath;
38600
+ const devPath = resolve31(dir, "..", "docs");
38601
+ const builtPath = resolve31(dir, "docs");
38602
+ return existsSync44(devPath) ? devPath : builtPath;
38321
38603
  }
38322
38604
  function formatInlineCode(line) {
38323
38605
  return line.replace(/`([^`]+)`/g, (_match, code) => c.accent(code));
@@ -38344,13 +38626,13 @@ function renderMarkdown(content) {
38344
38626
  console.log(formatInlineCode(line));
38345
38627
  }
38346
38628
  }
38347
- var examples14, TOPICS, TOPIC_NAMES, docs_default;
38629
+ var examples15, TOPICS, TOPIC_NAMES, docs_default;
38348
38630
  var init_docs = __esm({
38349
38631
  "src/commands/docs.ts"() {
38350
38632
  "use strict";
38351
38633
  init_dist();
38352
38634
  init_colors();
38353
- examples14 = [
38635
+ examples15 = [
38354
38636
  ["List all available topics", "hyperframes docs"],
38355
38637
  ["Read about data attributes", "hyperframes docs data-attributes"],
38356
38638
  ["Read about rendering", "hyperframes docs rendering"],
@@ -38414,12 +38696,12 @@ var init_docs = __esm({
38414
38696
  }
38415
38697
  process.exit(1);
38416
38698
  }
38417
- const filePath = join43(docsDir(), entry.file);
38418
- if (!existsSync43(filePath)) {
38699
+ const filePath = join45(docsDir(), entry.file);
38700
+ if (!existsSync44(filePath)) {
38419
38701
  console.error(c.error(`Doc file not found: ${filePath}`));
38420
38702
  process.exit(1);
38421
38703
  }
38422
- const content = readFileSync30(filePath, "utf-8");
38704
+ const content = readFileSync31(filePath, "utf-8");
38423
38705
  console.log();
38424
38706
  renderMarkdown(content);
38425
38707
  }
@@ -38431,7 +38713,7 @@ var init_docs = __esm({
38431
38713
  var doctor_exports = {};
38432
38714
  __export(doctor_exports, {
38433
38715
  default: () => doctor_default,
38434
- examples: () => examples15
38716
+ examples: () => examples16
38435
38717
  });
38436
38718
  import { execSync as execSync3 } from "child_process";
38437
38719
  import { freemem as freemem4, platform as platform4 } from "os";
@@ -38573,7 +38855,7 @@ function checkEnvironment() {
38573
38855
  }
38574
38856
  return { ok: true, detail: parts.join(" \xB7 ") };
38575
38857
  }
38576
- var examples15, doctor_default;
38858
+ var examples16, doctor_default;
38577
38859
  var init_doctor = __esm({
38578
38860
  "src/commands/doctor.ts"() {
38579
38861
  "use strict";
@@ -38584,7 +38866,7 @@ var init_doctor = __esm({
38584
38866
  init_version();
38585
38867
  init_updateCheck();
38586
38868
  init_system();
38587
- examples15 = [["Check system dependencies", "hyperframes doctor"]];
38869
+ examples16 = [["Check system dependencies", "hyperframes doctor"]];
38588
38870
  doctor_default = defineCommand({
38589
38871
  meta: { name: "doctor", description: "Check system dependencies and environment" },
38590
38872
  args: {},
@@ -38639,10 +38921,10 @@ var init_doctor = __esm({
38639
38921
  var upgrade_exports = {};
38640
38922
  __export(upgrade_exports, {
38641
38923
  default: () => upgrade_default,
38642
- examples: () => examples16
38924
+ examples: () => examples17
38643
38925
  });
38644
38926
  import { execSync as execSync4 } from "child_process";
38645
- var examples16, upgrade_default;
38927
+ var examples17, upgrade_default;
38646
38928
  var init_upgrade = __esm({
38647
38929
  "src/commands/upgrade.ts"() {
38648
38930
  "use strict";
@@ -38651,7 +38933,7 @@ var init_upgrade = __esm({
38651
38933
  init_colors();
38652
38934
  init_version();
38653
38935
  init_updateCheck();
38654
- examples16 = [
38936
+ examples17 = [
38655
38937
  ["Check for updates interactively", "hyperframes upgrade"],
38656
38938
  ["Check for updates without prompting", "hyperframes upgrade --check"],
38657
38939
  ["Upgrade non-interactively", "hyperframes upgrade --yes"]
@@ -38729,7 +39011,7 @@ var init_upgrade = __esm({
38729
39011
  var telemetry_exports = {};
38730
39012
  __export(telemetry_exports, {
38731
39013
  default: () => telemetry_default,
38732
- examples: () => examples17
39014
+ examples: () => examples18
38733
39015
  });
38734
39016
  function runEnable() {
38735
39017
  const config = readConfig();
@@ -38759,14 +39041,14 @@ function runStatus() {
38759
39041
  console.log(` ${c.dim("Env var:")} ${c.accent("HYPERFRAMES_NO_TELEMETRY=1")}`);
38760
39042
  console.log();
38761
39043
  }
38762
- var examples17, telemetry_default;
39044
+ var examples18, telemetry_default;
38763
39045
  var init_telemetry = __esm({
38764
39046
  "src/commands/telemetry.ts"() {
38765
39047
  "use strict";
38766
39048
  init_dist();
38767
39049
  init_colors();
38768
39050
  init_config();
38769
- examples17 = [
39051
+ examples18 = [
38770
39052
  ["Check current telemetry status", "hyperframes telemetry status"],
38771
39053
  ["Disable telemetry", "hyperframes telemetry disable"],
38772
39054
  ["Enable telemetry", "hyperframes telemetry enable"]
@@ -38845,8 +39127,8 @@ var validate_exports = {};
38845
39127
  __export(validate_exports, {
38846
39128
  default: () => validate_default
38847
39129
  });
38848
- import { existsSync as existsSync44, readFileSync as readFileSync31 } from "fs";
38849
- import { resolve as resolve31, join as join44, dirname as dirname19 } from "path";
39130
+ import { existsSync as existsSync45, readFileSync as readFileSync32 } from "fs";
39131
+ import { resolve as resolve32, join as join46, dirname as dirname19 } from "path";
38850
39132
  import { fileURLToPath as fileURLToPath7 } from "url";
38851
39133
  async function getCompositionDuration2(page) {
38852
39134
  return page.evaluate(() => {
@@ -38892,7 +39174,7 @@ async function validateInBrowser(projectDir, opts) {
38892
39174
  const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
38893
39175
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
38894
39176
  let html = await bundleToSingleHtml2(projectDir);
38895
- const runtimePath = resolve31(
39177
+ const runtimePath = resolve32(
38896
39178
  __dirname2,
38897
39179
  "..",
38898
39180
  "..",
@@ -38901,8 +39183,8 @@ async function validateInBrowser(projectDir, opts) {
38901
39183
  "dist",
38902
39184
  "hyperframe.runtime.iife.js"
38903
39185
  );
38904
- if (existsSync44(runtimePath)) {
38905
- const runtimeSource = readFileSync31(runtimePath, "utf-8");
39186
+ if (existsSync45(runtimePath)) {
39187
+ const runtimeSource = readFileSync32(runtimePath, "utf-8");
38906
39188
  html = html.replace(
38907
39189
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
38908
39190
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
@@ -38917,10 +39199,10 @@ async function validateInBrowser(projectDir, opts) {
38917
39199
  res.end(html);
38918
39200
  return;
38919
39201
  }
38920
- const filePath = join44(projectDir, decodeURIComponent(url));
38921
- if (existsSync44(filePath)) {
39202
+ const filePath = join46(projectDir, decodeURIComponent(url));
39203
+ if (existsSync45(filePath)) {
38922
39204
  res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
38923
- res.end(readFileSync31(filePath));
39205
+ res.end(readFileSync32(filePath));
38924
39206
  return;
38925
39207
  }
38926
39208
  res.writeHead(404);
@@ -39108,16 +39390,16 @@ Examples:
39108
39390
  var snapshot_exports = {};
39109
39391
  __export(snapshot_exports, {
39110
39392
  default: () => snapshot_default,
39111
- examples: () => examples18
39393
+ examples: () => examples19
39112
39394
  });
39113
39395
  import { spawn as spawn11 } from "child_process";
39114
- import { existsSync as existsSync45, mkdtempSync as mkdtempSync2, readFileSync as readFileSync32, mkdirSync as mkdirSync24, rmSync as rmSync9 } from "fs";
39396
+ import { existsSync as existsSync46, mkdtempSync as mkdtempSync2, readFileSync as readFileSync33, mkdirSync as mkdirSync24, rmSync as rmSync9 } from "fs";
39115
39397
  import { tmpdir as tmpdir4 } from "os";
39116
- import { resolve as resolve32, join as join45, dirname as dirname20, relative as relative4, isAbsolute as isAbsolute4 } from "path";
39398
+ import { resolve as resolve33, join as join47, dirname as dirname20, relative as relative5, isAbsolute as isAbsolute4 } from "path";
39117
39399
  import { fileURLToPath as fileURLToPath8 } from "url";
39118
39400
  async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
39119
- const tmp = mkdtempSync2(join45(tmpdir4(), "hf-snapshot-frame-"));
39120
- const outPath = join45(tmp, "frame.png");
39401
+ const tmp = mkdtempSync2(join47(tmpdir4(), "hf-snapshot-frame-"));
39402
+ const outPath = join47(tmp, "frame.png");
39121
39403
  try {
39122
39404
  const result = await new Promise(
39123
39405
  (resolvePromise) => {
@@ -39155,8 +39437,8 @@ async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
39155
39437
  });
39156
39438
  }
39157
39439
  );
39158
- if (result.code !== 0 || result.timedOut || !existsSync45(outPath)) return null;
39159
- return readFileSync32(outPath);
39440
+ if (result.code !== 0 || result.timedOut || !existsSync46(outPath)) return null;
39441
+ return readFileSync33(outPath);
39160
39442
  } finally {
39161
39443
  try {
39162
39444
  rmSync9(tmp, { recursive: true, force: true });
@@ -39169,7 +39451,7 @@ async function captureSnapshots(projectDir, opts) {
39169
39451
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
39170
39452
  const numFrames = opts.frames ?? 5;
39171
39453
  let html = await bundleToSingleHtml2(projectDir);
39172
- const runtimePath = resolve32(
39454
+ const runtimePath = resolve33(
39173
39455
  __dirname3,
39174
39456
  "..",
39175
39457
  "..",
@@ -39178,8 +39460,8 @@ async function captureSnapshots(projectDir, opts) {
39178
39460
  "dist",
39179
39461
  "hyperframe.runtime.iife.js"
39180
39462
  );
39181
- if (existsSync45(runtimePath)) {
39182
- const runtimeSource = readFileSync32(runtimePath, "utf-8");
39463
+ if (existsSync46(runtimePath)) {
39464
+ const runtimeSource = readFileSync33(runtimePath, "utf-8");
39183
39465
  html = html.replace(
39184
39466
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
39185
39467
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
@@ -39194,16 +39476,16 @@ async function captureSnapshots(projectDir, opts) {
39194
39476
  res.end(html);
39195
39477
  return;
39196
39478
  }
39197
- const filePath = resolve32(projectDir, decodeURIComponent(url).replace(/^\//, ""));
39198
- const rel = relative4(projectDir, filePath);
39479
+ const filePath = resolve33(projectDir, decodeURIComponent(url).replace(/^\//, ""));
39480
+ const rel = relative5(projectDir, filePath);
39199
39481
  if (rel.startsWith("..") || isAbsolute4(rel)) {
39200
39482
  res.writeHead(403);
39201
39483
  res.end();
39202
39484
  return;
39203
39485
  }
39204
- if (existsSync45(filePath)) {
39486
+ if (existsSync46(filePath)) {
39205
39487
  res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
39206
- res.end(readFileSync32(filePath));
39488
+ res.end(readFileSync33(filePath));
39207
39489
  return;
39208
39490
  }
39209
39491
  res.writeHead(404);
@@ -39276,7 +39558,7 @@ async function captureSnapshots(projectDir, opts) {
39276
39558
  return [];
39277
39559
  }
39278
39560
  const positions = opts.at?.length ? opts.at : numFrames === 1 ? [duration / 2] : Array.from({ length: numFrames }, (_2, i2) => i2 / (numFrames - 1) * duration);
39279
- const snapshotDir = join45(projectDir, "snapshots");
39561
+ const snapshotDir = join47(projectDir, "snapshots");
39280
39562
  mkdirSync24(snapshotDir, { recursive: true });
39281
39563
  let injectVideoFramesBatch2 = null;
39282
39564
  let syncVideoFrameVisibility2 = null;
@@ -39335,9 +39617,9 @@ async function captureSnapshots(projectDir, opts) {
39335
39617
  try {
39336
39618
  const url = new URL(v.src);
39337
39619
  const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
39338
- const candidate = resolve32(projectDir, decodedPath);
39339
- const rel = relative4(projectDir, candidate);
39340
- if (!rel.startsWith("..") && !isAbsolute4(rel) && existsSync45(candidate)) {
39620
+ const candidate = resolve33(projectDir, decodedPath);
39621
+ const rel = relative5(projectDir, candidate);
39622
+ if (!rel.startsWith("..") && !isAbsolute4(rel) && existsSync46(candidate)) {
39341
39623
  filePath = candidate;
39342
39624
  }
39343
39625
  } catch {
@@ -39363,7 +39645,7 @@ async function captureSnapshots(projectDir, opts) {
39363
39645
  }
39364
39646
  const timeLabel = opts.at?.length ? `${time.toFixed(1)}s` : `${Math.round(time / duration * 100)}pct`;
39365
39647
  const filename = `frame-${String(i2).padStart(2, "0")}-at-${timeLabel}.png`;
39366
- const framePath = join45(snapshotDir, filename);
39648
+ const framePath = join47(snapshotDir, filename);
39367
39649
  await page.screenshot({ path: framePath, type: "png" });
39368
39650
  savedPaths.push(`snapshots/${filename}`);
39369
39651
  }
@@ -39375,7 +39657,7 @@ async function captureSnapshots(projectDir, opts) {
39375
39657
  }
39376
39658
  return savedPaths;
39377
39659
  }
39378
- var __filename2, __dirname3, FFMPEG_EXTRACT_TIMEOUT_MS, examples18, snapshot_default;
39660
+ var __filename2, __dirname3, FFMPEG_EXTRACT_TIMEOUT_MS, examples19, snapshot_default;
39379
39661
  var init_snapshot = __esm({
39380
39662
  "src/commands/snapshot.ts"() {
39381
39663
  "use strict";
@@ -39385,7 +39667,7 @@ var init_snapshot = __esm({
39385
39667
  __filename2 = fileURLToPath8(import.meta.url);
39386
39668
  __dirname3 = dirname20(__filename2);
39387
39669
  FFMPEG_EXTRACT_TIMEOUT_MS = 3e4;
39388
- examples18 = [
39670
+ examples19 = [
39389
39671
  ["Capture 5 key frames from a composition", "snapshot captures/stripe"],
39390
39672
  ["Capture 10 evenly-spaced frames", "snapshot captures/stripe --frames 10"]
39391
39673
  ];
@@ -39449,13 +39731,13 @@ ${c.error("\u2717")} Snapshot failed: ${msg}`);
39449
39731
 
39450
39732
  // src/capture/assetDownloader.ts
39451
39733
  import { writeFileSync as writeFileSync17, mkdirSync as mkdirSync25 } from "fs";
39452
- import { join as join46, extname as extname10 } from "path";
39734
+ import { join as join48, extname as extname10 } from "path";
39453
39735
  async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks) {
39454
- const assetsDir = join46(outputDir, "assets");
39736
+ const assetsDir = join48(outputDir, "assets");
39455
39737
  mkdirSync25(assetsDir, { recursive: true });
39456
39738
  const assets = [];
39457
39739
  const downloadedUrls = /* @__PURE__ */ new Set();
39458
- mkdirSync25(join46(outputDir, "assets", "svgs"), { recursive: true });
39740
+ mkdirSync25(join48(outputDir, "assets", "svgs"), { recursive: true });
39459
39741
  for (let i2 = 0; i2 < tokens.svgs.length && i2 < 30; i2++) {
39460
39742
  const svg = tokens.svgs[i2];
39461
39743
  if (!svg.outerHTML || svg.outerHTML.length < 50) continue;
@@ -39463,7 +39745,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39463
39745
  const name = label2 ? slugify(label2) + ".svg" : svg.isLogo ? `logo-${i2}.svg` : `icon-${i2}.svg`;
39464
39746
  const localPath = `assets/svgs/${name}`;
39465
39747
  try {
39466
- writeFileSync17(join46(outputDir, localPath), svg.outerHTML, "utf-8");
39748
+ writeFileSync17(join48(outputDir, localPath), svg.outerHTML, "utf-8");
39467
39749
  assets.push({ url: "", localPath, type: "svg" });
39468
39750
  } catch {
39469
39751
  }
@@ -39476,7 +39758,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39476
39758
  const localPath = `assets/${name}`;
39477
39759
  const buffer = await fetchBuffer(icon.href);
39478
39760
  if (buffer) {
39479
- writeFileSync17(join46(outputDir, localPath), buffer);
39761
+ writeFileSync17(join48(outputDir, localPath), buffer);
39480
39762
  assets.push({ url: icon.href, localPath, type: "favicon" });
39481
39763
  break;
39482
39764
  }
@@ -39533,7 +39815,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39533
39815
  const slug = isMeaningful ? slugify(rawName) : `${prefix}-${imgIdx}`;
39534
39816
  const name = `${slug}${ext}`;
39535
39817
  const localPath = `assets/${name}`;
39536
- writeFileSync17(join46(outputDir, localPath), buffer);
39818
+ writeFileSync17(join48(outputDir, localPath), buffer);
39537
39819
  assets.push({ url, localPath, type: "image" });
39538
39820
  imgIdx++;
39539
39821
  } catch {
@@ -39546,7 +39828,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
39546
39828
  const localPath = `assets/og-image${ext}`;
39547
39829
  const buffer = await fetchBuffer(tokens.ogImage);
39548
39830
  if (buffer && buffer.length > 5e3) {
39549
- writeFileSync17(join46(outputDir, localPath), buffer);
39831
+ writeFileSync17(join48(outputDir, localPath), buffer);
39550
39832
  assets.push({ url: tokens.ogImage, localPath, type: "image" });
39551
39833
  }
39552
39834
  } catch {
@@ -39569,7 +39851,7 @@ function normalizeUrl(u) {
39569
39851
  }
39570
39852
  }
39571
39853
  async function downloadAndRewriteFonts(css, outputDir) {
39572
- const assetsDir = join46(outputDir, "assets", "fonts");
39854
+ const assetsDir = join48(outputDir, "assets", "fonts");
39573
39855
  mkdirSync25(assetsDir, { recursive: true });
39574
39856
  const fontUrlRegex = /url\(['"]?(https?:\/\/[^'")\s]+\.(?:woff2?|ttf|otf)[^'")\s]*?)['"]?\)/g;
39575
39857
  const fontUrls = /* @__PURE__ */ new Set();
@@ -39605,7 +39887,7 @@ async function downloadAndRewriteFonts(css, outputDir) {
39605
39887
  try {
39606
39888
  const urlObj = new URL(fontUrl);
39607
39889
  const filename = urlObj.pathname.split("/").pop() || `font-${count}.woff2`;
39608
- const localPath = join46(assetsDir, filename);
39890
+ const localPath = join48(assetsDir, filename);
39609
39891
  const relativePath = `assets/fonts/${filename}`;
39610
39892
  const buffer = await fetchBuffer(fontUrl);
39611
39893
  if (buffer) {
@@ -40402,8 +40684,8 @@ var init_animationCataloger = __esm({
40402
40684
  });
40403
40685
 
40404
40686
  // src/capture/mediaCapture.ts
40405
- import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync18, readdirSync as readdirSync15, readFileSync as readFileSync33, statSync as statSync15 } from "fs";
40406
- import { join as join47 } from "path";
40687
+ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync18, readdirSync as readdirSync16, readFileSync as readFileSync34, statSync as statSync16 } from "fs";
40688
+ import { join as join49 } from "path";
40407
40689
  async function saveLottieAnimations(discoveredLotties, lottieDir) {
40408
40690
  let savedCount = 0;
40409
40691
  const savedHashes = /* @__PURE__ */ new Set();
@@ -40423,8 +40705,8 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40423
40705
  const buf = Buffer.from(await res.arrayBuffer());
40424
40706
  if (lottieItem.url.endsWith(".lottie")) {
40425
40707
  try {
40426
- const AdmZip = (await import("adm-zip")).default;
40427
- const zip = new AdmZip(buf);
40708
+ const AdmZip2 = (await import("adm-zip")).default;
40709
+ const zip = new AdmZip2(buf);
40428
40710
  const entries2 = zip.getEntries();
40429
40711
  const animEntry = entries2.find(
40430
40712
  (e2) => (e2.entryName.startsWith("a/") || e2.entryName.startsWith("animations/")) && e2.entryName.endsWith(".json")
@@ -40436,7 +40718,7 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40436
40718
  const hash2 = buf.toString("base64").slice(0, 100);
40437
40719
  if (savedHashes.has(hash2)) continue;
40438
40720
  savedHashes.add(hash2);
40439
- writeFileSync18(join47(lottieDir, `animation-${savedCount}.lottie`), buf);
40721
+ writeFileSync18(join49(lottieDir, `animation-${savedCount}.lottie`), buf);
40440
40722
  savedCount++;
40441
40723
  continue;
40442
40724
  }
@@ -40454,7 +40736,7 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40454
40736
  } catch {
40455
40737
  continue;
40456
40738
  }
40457
- writeFileSync18(join47(lottieDir, `animation-${savedCount}.json`), jsonData, "utf-8");
40739
+ writeFileSync18(join49(lottieDir, `animation-${savedCount}.json`), jsonData, "utf-8");
40458
40740
  savedCount++;
40459
40741
  }
40460
40742
  } catch {
@@ -40464,22 +40746,22 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
40464
40746
  }
40465
40747
  async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
40466
40748
  const manifest = [];
40467
- const previewDir = join47(lottieDir, "previews");
40749
+ const previewDir = join49(lottieDir, "previews");
40468
40750
  mkdirSync26(previewDir, { recursive: true });
40469
- for (const file of readdirSync15(lottieDir)) {
40751
+ for (const file of readdirSync16(lottieDir)) {
40470
40752
  if (!file.endsWith(".json")) continue;
40471
40753
  try {
40472
- const raw = JSON.parse(readFileSync33(join47(lottieDir, file), "utf-8"));
40754
+ const raw = JSON.parse(readFileSync34(join49(lottieDir, file), "utf-8"));
40473
40755
  const fr = raw.fr || 30;
40474
40756
  const dur = ((raw.op || 0) - (raw.ip || 0)) / fr;
40475
40757
  const previewName = file.replace(".json", "-preview.png");
40476
- const fileSize = statSync15(join47(lottieDir, file)).size;
40758
+ const fileSize = statSync16(join49(lottieDir, file)).size;
40477
40759
  if (fileSize > 2e6) continue;
40478
40760
  let previewPage;
40479
40761
  try {
40480
40762
  previewPage = await chromeBrowser.newPage();
40481
40763
  await previewPage.setViewport({ width: 400, height: 400 });
40482
- const animData = JSON.parse(readFileSync33(join47(lottieDir, file), "utf-8"));
40764
+ const animData = JSON.parse(readFileSync34(join49(lottieDir, file), "utf-8"));
40483
40765
  const midFrame = Math.floor(((raw.op || 0) - (raw.ip || 0)) * 0.3);
40484
40766
  await previewPage.setContent(
40485
40767
  `<!DOCTYPE html>
@@ -40509,7 +40791,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
40509
40791
  await previewPage.waitForFunction(() => window.__READY === true, { timeout: 5e3 }).catch(() => {
40510
40792
  });
40511
40793
  await previewPage.screenshot({
40512
- path: join47(previewDir, previewName),
40794
+ path: join49(previewDir, previewName),
40513
40795
  type: "png",
40514
40796
  omitBackground: true
40515
40797
  });
@@ -40533,7 +40815,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
40533
40815
  }
40534
40816
  if (manifest.length > 0) {
40535
40817
  writeFileSync18(
40536
- join47(outputDir, "extracted", "lottie-manifest.json"),
40818
+ join49(outputDir, "extracted", "lottie-manifest.json"),
40537
40819
  JSON.stringify(manifest, null, 2),
40538
40820
  "utf-8"
40539
40821
  );
@@ -40595,15 +40877,15 @@ async function captureVideoManifest(page, outputDir, progress) {
40595
40877
  return true;
40596
40878
  });
40597
40879
  if (uniqueVideos.length > 0) {
40598
- const videoManifestDir = join47(outputDir, "assets", "videos");
40880
+ const videoManifestDir = join49(outputDir, "assets", "videos");
40599
40881
  mkdirSync26(videoManifestDir, { recursive: true });
40600
- const previewDir = join47(videoManifestDir, "previews");
40882
+ const previewDir = join49(videoManifestDir, "previews");
40601
40883
  mkdirSync26(previewDir, { recursive: true });
40602
40884
  const videoManifest = [];
40603
40885
  for (let vi = 0; vi < uniqueVideos.length && vi < 20; vi++) {
40604
40886
  const v = uniqueVideos[vi];
40605
40887
  const previewName = `video-${vi}-preview.png`;
40606
- const previewPath = join47(previewDir, previewName);
40888
+ const previewPath = join49(previewDir, previewName);
40607
40889
  try {
40608
40890
  await page.evaluate(`window.scrollTo(0, ${Math.max(0, v.top - 100)})`);
40609
40891
  await new Promise((r2) => setTimeout(r2, 300));
@@ -40642,7 +40924,7 @@ async function captureVideoManifest(page, outputDir, progress) {
40642
40924
  }
40643
40925
  if (videoManifest.length > 0) {
40644
40926
  writeFileSync18(
40645
- join47(outputDir, "extracted", "video-manifest.json"),
40927
+ join49(outputDir, "extracted", "video-manifest.json"),
40646
40928
  JSON.stringify(videoManifest, null, 2),
40647
40929
  "utf-8"
40648
40930
  );
@@ -40924,7 +41206,7 @@ var require_p_retry = __commonJS({
40924
41206
  return error;
40925
41207
  };
40926
41208
  var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
40927
- var pRetry2 = (input, options) => new Promise((resolve35, reject) => {
41209
+ var pRetry2 = (input, options) => new Promise((resolve36, reject) => {
40928
41210
  options = {
40929
41211
  onFailedAttempt: () => {
40930
41212
  },
@@ -40934,7 +41216,7 @@ var require_p_retry = __commonJS({
40934
41216
  const operation = retry.operation(options);
40935
41217
  operation.attempt(async (attemptNumber) => {
40936
41218
  try {
40937
- resolve35(await input(attemptNumber));
41219
+ resolve36(await input(attemptNumber));
40938
41220
  } catch (error) {
40939
41221
  if (!(error instanceof Error)) {
40940
41222
  reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
@@ -41470,8 +41752,8 @@ var require_retry3 = __commonJS({
41470
41752
  }
41471
41753
  const delay = getNextRetryDelay(config);
41472
41754
  err.config.retryConfig.currentRetryAttempt += 1;
41473
- const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve35) => {
41474
- setTimeout(resolve35, delay);
41755
+ const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve36) => {
41756
+ setTimeout(resolve36, delay);
41475
41757
  });
41476
41758
  if (config.onRetryAttempt) {
41477
41759
  await config.onRetryAttempt(err);
@@ -42379,8 +42661,8 @@ var require_helpers = __commonJS({
42379
42661
  function req(url, opts = {}) {
42380
42662
  const href = typeof url === "string" ? url : url.href;
42381
42663
  const req2 = (href.startsWith("https:") ? https2 : http4).request(url, opts);
42382
- const promise = new Promise((resolve35, reject) => {
42383
- req2.once("response", resolve35).once("error", reject).end();
42664
+ const promise = new Promise((resolve36, reject) => {
42665
+ req2.once("response", resolve36).once("error", reject).end();
42384
42666
  });
42385
42667
  req2.then = promise.then.bind(promise);
42386
42668
  return req2;
@@ -42557,7 +42839,7 @@ var require_parse_proxy_response = __commonJS({
42557
42839
  var debug_1 = __importDefault(require_src2());
42558
42840
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
42559
42841
  function parseProxyResponse(socket) {
42560
- return new Promise((resolve35, reject) => {
42842
+ return new Promise((resolve36, reject) => {
42561
42843
  let buffersLength = 0;
42562
42844
  const buffers = [];
42563
42845
  function read() {
@@ -42623,7 +42905,7 @@ var require_parse_proxy_response = __commonJS({
42623
42905
  }
42624
42906
  debug("got proxy server response: %o %o", firstLine, headers);
42625
42907
  cleanup();
42626
- resolve35({
42908
+ resolve36({
42627
42909
  connect: {
42628
42910
  statusCode,
42629
42911
  statusText,
@@ -42867,7 +43149,7 @@ var require_ponyfill_es2018 = __commonJS({
42867
43149
  return new originalPromise(executor);
42868
43150
  }
42869
43151
  function promiseResolvedWith(value) {
42870
- return newPromise((resolve35) => resolve35(value));
43152
+ return newPromise((resolve36) => resolve36(value));
42871
43153
  }
42872
43154
  function promiseRejectedWith(reason) {
42873
43155
  return originalPromiseReject(reason);
@@ -43037,8 +43319,8 @@ var require_ponyfill_es2018 = __commonJS({
43037
43319
  return new TypeError("Cannot " + name + " a stream using a released reader");
43038
43320
  }
43039
43321
  function defaultReaderClosedPromiseInitialize(reader) {
43040
- reader._closedPromise = newPromise((resolve35, reject) => {
43041
- reader._closedPromise_resolve = resolve35;
43322
+ reader._closedPromise = newPromise((resolve36, reject) => {
43323
+ reader._closedPromise_resolve = resolve36;
43042
43324
  reader._closedPromise_reject = reject;
43043
43325
  });
43044
43326
  }
@@ -43212,8 +43494,8 @@ var require_ponyfill_es2018 = __commonJS({
43212
43494
  }
43213
43495
  let resolvePromise;
43214
43496
  let rejectPromise;
43215
- const promise = newPromise((resolve35, reject) => {
43216
- resolvePromise = resolve35;
43497
+ const promise = newPromise((resolve36, reject) => {
43498
+ resolvePromise = resolve36;
43217
43499
  rejectPromise = reject;
43218
43500
  });
43219
43501
  const readRequest = {
@@ -43318,8 +43600,8 @@ var require_ponyfill_es2018 = __commonJS({
43318
43600
  const reader = this._reader;
43319
43601
  let resolvePromise;
43320
43602
  let rejectPromise;
43321
- const promise = newPromise((resolve35, reject) => {
43322
- resolvePromise = resolve35;
43603
+ const promise = newPromise((resolve36, reject) => {
43604
+ resolvePromise = resolve36;
43323
43605
  rejectPromise = reject;
43324
43606
  });
43325
43607
  const readRequest = {
@@ -44338,8 +44620,8 @@ var require_ponyfill_es2018 = __commonJS({
44338
44620
  }
44339
44621
  let resolvePromise;
44340
44622
  let rejectPromise;
44341
- const promise = newPromise((resolve35, reject) => {
44342
- resolvePromise = resolve35;
44623
+ const promise = newPromise((resolve36, reject) => {
44624
+ resolvePromise = resolve36;
44343
44625
  rejectPromise = reject;
44344
44626
  });
44345
44627
  const readIntoRequest = {
@@ -44651,10 +44933,10 @@ var require_ponyfill_es2018 = __commonJS({
44651
44933
  wasAlreadyErroring = true;
44652
44934
  reason = void 0;
44653
44935
  }
44654
- const promise = newPromise((resolve35, reject) => {
44936
+ const promise = newPromise((resolve36, reject) => {
44655
44937
  stream._pendingAbortRequest = {
44656
44938
  _promise: void 0,
44657
- _resolve: resolve35,
44939
+ _resolve: resolve36,
44658
44940
  _reject: reject,
44659
44941
  _reason: reason,
44660
44942
  _wasAlreadyErroring: wasAlreadyErroring
@@ -44671,9 +44953,9 @@ var require_ponyfill_es2018 = __commonJS({
44671
44953
  if (state === "closed" || state === "errored") {
44672
44954
  return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
44673
44955
  }
44674
- const promise = newPromise((resolve35, reject) => {
44956
+ const promise = newPromise((resolve36, reject) => {
44675
44957
  const closeRequest = {
44676
- _resolve: resolve35,
44958
+ _resolve: resolve36,
44677
44959
  _reject: reject
44678
44960
  };
44679
44961
  stream._closeRequest = closeRequest;
@@ -44686,9 +44968,9 @@ var require_ponyfill_es2018 = __commonJS({
44686
44968
  return promise;
44687
44969
  }
44688
44970
  function WritableStreamAddWriteRequest(stream) {
44689
- const promise = newPromise((resolve35, reject) => {
44971
+ const promise = newPromise((resolve36, reject) => {
44690
44972
  const writeRequest = {
44691
- _resolve: resolve35,
44973
+ _resolve: resolve36,
44692
44974
  _reject: reject
44693
44975
  };
44694
44976
  stream._writeRequests.push(writeRequest);
@@ -45304,8 +45586,8 @@ var require_ponyfill_es2018 = __commonJS({
45304
45586
  return new TypeError("Cannot " + name + " a stream using a released writer");
45305
45587
  }
45306
45588
  function defaultWriterClosedPromiseInitialize(writer) {
45307
- writer._closedPromise = newPromise((resolve35, reject) => {
45308
- writer._closedPromise_resolve = resolve35;
45589
+ writer._closedPromise = newPromise((resolve36, reject) => {
45590
+ writer._closedPromise_resolve = resolve36;
45309
45591
  writer._closedPromise_reject = reject;
45310
45592
  writer._closedPromiseState = "pending";
45311
45593
  });
@@ -45341,8 +45623,8 @@ var require_ponyfill_es2018 = __commonJS({
45341
45623
  writer._closedPromiseState = "resolved";
45342
45624
  }
45343
45625
  function defaultWriterReadyPromiseInitialize(writer) {
45344
- writer._readyPromise = newPromise((resolve35, reject) => {
45345
- writer._readyPromise_resolve = resolve35;
45626
+ writer._readyPromise = newPromise((resolve36, reject) => {
45627
+ writer._readyPromise_resolve = resolve36;
45346
45628
  writer._readyPromise_reject = reject;
45347
45629
  });
45348
45630
  writer._readyPromiseState = "pending";
@@ -45429,7 +45711,7 @@ var require_ponyfill_es2018 = __commonJS({
45429
45711
  source._disturbed = true;
45430
45712
  let shuttingDown = false;
45431
45713
  let currentWrite = promiseResolvedWith(void 0);
45432
- return newPromise((resolve35, reject) => {
45714
+ return newPromise((resolve36, reject) => {
45433
45715
  let abortAlgorithm;
45434
45716
  if (signal !== void 0) {
45435
45717
  abortAlgorithm = () => {
@@ -45574,7 +45856,7 @@ var require_ponyfill_es2018 = __commonJS({
45574
45856
  if (isError) {
45575
45857
  reject(error);
45576
45858
  } else {
45577
- resolve35(void 0);
45859
+ resolve36(void 0);
45578
45860
  }
45579
45861
  return null;
45580
45862
  }
@@ -45855,8 +46137,8 @@ var require_ponyfill_es2018 = __commonJS({
45855
46137
  let branch1;
45856
46138
  let branch2;
45857
46139
  let resolveCancelPromise;
45858
- const cancelPromise = newPromise((resolve35) => {
45859
- resolveCancelPromise = resolve35;
46140
+ const cancelPromise = newPromise((resolve36) => {
46141
+ resolveCancelPromise = resolve36;
45860
46142
  });
45861
46143
  function pullAlgorithm() {
45862
46144
  if (reading) {
@@ -45947,8 +46229,8 @@ var require_ponyfill_es2018 = __commonJS({
45947
46229
  let branch1;
45948
46230
  let branch2;
45949
46231
  let resolveCancelPromise;
45950
- const cancelPromise = newPromise((resolve35) => {
45951
- resolveCancelPromise = resolve35;
46232
+ const cancelPromise = newPromise((resolve36) => {
46233
+ resolveCancelPromise = resolve36;
45952
46234
  });
45953
46235
  function forwardReaderError(thisReader) {
45954
46236
  uponRejection(thisReader._closedPromise, (r2) => {
@@ -46728,8 +47010,8 @@ var require_ponyfill_es2018 = __commonJS({
46728
47010
  const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
46729
47011
  const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
46730
47012
  let startPromise_resolve;
46731
- const startPromise = newPromise((resolve35) => {
46732
- startPromise_resolve = resolve35;
47013
+ const startPromise = newPromise((resolve36) => {
47014
+ startPromise_resolve = resolve36;
46733
47015
  });
46734
47016
  InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
46735
47017
  SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
@@ -46822,8 +47104,8 @@ var require_ponyfill_es2018 = __commonJS({
46822
47104
  if (stream._backpressureChangePromise !== void 0) {
46823
47105
  stream._backpressureChangePromise_resolve();
46824
47106
  }
46825
- stream._backpressureChangePromise = newPromise((resolve35) => {
46826
- stream._backpressureChangePromise_resolve = resolve35;
47107
+ stream._backpressureChangePromise = newPromise((resolve36) => {
47108
+ stream._backpressureChangePromise_resolve = resolve36;
46827
47109
  });
46828
47110
  stream._backpressure = backpressure;
46829
47111
  }
@@ -46991,8 +47273,8 @@ var require_ponyfill_es2018 = __commonJS({
46991
47273
  return controller._finishPromise;
46992
47274
  }
46993
47275
  const readable = stream._readable;
46994
- controller._finishPromise = newPromise((resolve35, reject) => {
46995
- controller._finishPromise_resolve = resolve35;
47276
+ controller._finishPromise = newPromise((resolve36, reject) => {
47277
+ controller._finishPromise_resolve = resolve36;
46996
47278
  controller._finishPromise_reject = reject;
46997
47279
  });
46998
47280
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -47018,8 +47300,8 @@ var require_ponyfill_es2018 = __commonJS({
47018
47300
  return controller._finishPromise;
47019
47301
  }
47020
47302
  const readable = stream._readable;
47021
- controller._finishPromise = newPromise((resolve35, reject) => {
47022
- controller._finishPromise_resolve = resolve35;
47303
+ controller._finishPromise = newPromise((resolve36, reject) => {
47304
+ controller._finishPromise_resolve = resolve36;
47023
47305
  controller._finishPromise_reject = reject;
47024
47306
  });
47025
47307
  const flushPromise = controller._flushAlgorithm();
@@ -47049,8 +47331,8 @@ var require_ponyfill_es2018 = __commonJS({
47049
47331
  return controller._finishPromise;
47050
47332
  }
47051
47333
  const writable = stream._writable;
47052
- controller._finishPromise = newPromise((resolve35, reject) => {
47053
- controller._finishPromise_resolve = resolve35;
47334
+ controller._finishPromise = newPromise((resolve36, reject) => {
47335
+ controller._finishPromise_resolve = resolve36;
47054
47336
  controller._finishPromise_reject = reject;
47055
47337
  });
47056
47338
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -47596,8 +47878,8 @@ var require_node_domexception = __commonJS({
47596
47878
  });
47597
47879
 
47598
47880
  // ../../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js
47599
- import { statSync as statSync16, createReadStream as createReadStream2, promises as fs2 } from "fs";
47600
- import { basename as basename8 } from "path";
47881
+ import { statSync as statSync17, createReadStream as createReadStream2, promises as fs2 } from "fs";
47882
+ import { basename as basename10 } from "path";
47601
47883
  var import_node_domexception, stat, blobFromSync, blobFrom, fileFrom, fileFromSync, fromBlob, fromFile, BlobDataItem;
47602
47884
  var init_from = __esm({
47603
47885
  "../../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js"() {
@@ -47606,10 +47888,10 @@ var init_from = __esm({
47606
47888
  init_file();
47607
47889
  init_fetch_blob();
47608
47890
  ({ stat } = fs2);
47609
- blobFromSync = (path2, type) => fromBlob(statSync16(path2), path2, type);
47891
+ blobFromSync = (path2, type) => fromBlob(statSync17(path2), path2, type);
47610
47892
  blobFrom = (path2, type) => stat(path2).then((stat3) => fromBlob(stat3, path2, type));
47611
47893
  fileFrom = (path2, type) => stat(path2).then((stat3) => fromFile(stat3, path2, type));
47612
- fileFromSync = (path2, type) => fromFile(statSync16(path2), path2, type);
47894
+ fileFromSync = (path2, type) => fromFile(statSync17(path2), path2, type);
47613
47895
  fromBlob = (stat3, path2, type = "") => new fetch_blob_default([new BlobDataItem({
47614
47896
  path: path2,
47615
47897
  size: stat3.size,
@@ -47621,7 +47903,7 @@ var init_from = __esm({
47621
47903
  size: stat3.size,
47622
47904
  lastModified: stat3.mtimeMs,
47623
47905
  start: 0
47624
- })], basename8(path2), { type, lastModified: stat3.mtimeMs });
47906
+ })], basename10(path2), { type, lastModified: stat3.mtimeMs });
47625
47907
  BlobDataItem = class _BlobDataItem {
47626
47908
  #path;
47627
47909
  #start;
@@ -49019,7 +49301,7 @@ import zlib from "zlib";
49019
49301
  import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "stream";
49020
49302
  import { Buffer as Buffer3 } from "buffer";
49021
49303
  async function fetch3(url, options_) {
49022
- return new Promise((resolve35, reject) => {
49304
+ return new Promise((resolve36, reject) => {
49023
49305
  const request = new Request2(url, options_);
49024
49306
  const { parsedURL, options } = getNodeRequestOptions(request);
49025
49307
  if (!supportedSchemas.has(parsedURL.protocol)) {
@@ -49028,7 +49310,7 @@ async function fetch3(url, options_) {
49028
49310
  if (parsedURL.protocol === "data:") {
49029
49311
  const data = dist_default(request.url);
49030
49312
  const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
49031
- resolve35(response2);
49313
+ resolve36(response2);
49032
49314
  return;
49033
49315
  }
49034
49316
  const send = (parsedURL.protocol === "https:" ? https : http3).request;
@@ -49150,7 +49432,7 @@ async function fetch3(url, options_) {
49150
49432
  if (responseReferrerPolicy) {
49151
49433
  requestOptions.referrerPolicy = responseReferrerPolicy;
49152
49434
  }
49153
- resolve35(fetch3(new Request2(locationURL, requestOptions)));
49435
+ resolve36(fetch3(new Request2(locationURL, requestOptions)));
49154
49436
  finalize();
49155
49437
  return;
49156
49438
  }
@@ -49183,7 +49465,7 @@ async function fetch3(url, options_) {
49183
49465
  const codings = headers.get("Content-Encoding");
49184
49466
  if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
49185
49467
  response = new Response2(body, responseOptions);
49186
- resolve35(response);
49468
+ resolve36(response);
49187
49469
  return;
49188
49470
  }
49189
49471
  const zlibOptions = {
@@ -49197,7 +49479,7 @@ async function fetch3(url, options_) {
49197
49479
  }
49198
49480
  });
49199
49481
  response = new Response2(body, responseOptions);
49200
- resolve35(response);
49482
+ resolve36(response);
49201
49483
  return;
49202
49484
  }
49203
49485
  if (codings === "deflate" || codings === "x-deflate") {
@@ -49221,12 +49503,12 @@ async function fetch3(url, options_) {
49221
49503
  });
49222
49504
  }
49223
49505
  response = new Response2(body, responseOptions);
49224
- resolve35(response);
49506
+ resolve36(response);
49225
49507
  });
49226
49508
  raw.once("end", () => {
49227
49509
  if (!response) {
49228
49510
  response = new Response2(body, responseOptions);
49229
- resolve35(response);
49511
+ resolve36(response);
49230
49512
  }
49231
49513
  });
49232
49514
  return;
@@ -49238,11 +49520,11 @@ async function fetch3(url, options_) {
49238
49520
  }
49239
49521
  });
49240
49522
  response = new Response2(body, responseOptions);
49241
- resolve35(response);
49523
+ resolve36(response);
49242
49524
  return;
49243
49525
  }
49244
49526
  response = new Response2(body, responseOptions);
49245
- resolve35(response);
49527
+ resolve36(response);
49246
49528
  });
49247
49529
  writeToStream(request_, request).catch(reject);
49248
49530
  });
@@ -55324,7 +55606,7 @@ var require_jwtaccess = __commonJS({
55324
55606
  }
55325
55607
  }
55326
55608
  fromStreamAsync(inputStream) {
55327
- return new Promise((resolve35, reject) => {
55609
+ return new Promise((resolve36, reject) => {
55328
55610
  if (!inputStream) {
55329
55611
  reject(new Error("Must pass in a stream containing the service account auth settings."));
55330
55612
  }
@@ -55333,7 +55615,7 @@ var require_jwtaccess = __commonJS({
55333
55615
  try {
55334
55616
  const data = JSON.parse(s2);
55335
55617
  this.fromJSON(data);
55336
- resolve35();
55618
+ resolve36();
55337
55619
  } catch (err) {
55338
55620
  reject(err);
55339
55621
  }
@@ -55572,7 +55854,7 @@ var require_jwtclient = __commonJS({
55572
55854
  }
55573
55855
  }
55574
55856
  fromStreamAsync(inputStream) {
55575
- return new Promise((resolve35, reject) => {
55857
+ return new Promise((resolve36, reject) => {
55576
55858
  if (!inputStream) {
55577
55859
  throw new Error("Must pass in a stream containing the service account auth settings.");
55578
55860
  }
@@ -55581,7 +55863,7 @@ var require_jwtclient = __commonJS({
55581
55863
  try {
55582
55864
  const data = JSON.parse(s2);
55583
55865
  this.fromJSON(data);
55584
- resolve35();
55866
+ resolve36();
55585
55867
  } catch (e2) {
55586
55868
  reject(e2);
55587
55869
  }
@@ -55714,7 +55996,7 @@ var require_refreshclient = __commonJS({
55714
55996
  }
55715
55997
  }
55716
55998
  async fromStreamAsync(inputStream) {
55717
- return new Promise((resolve35, reject) => {
55999
+ return new Promise((resolve36, reject) => {
55718
56000
  if (!inputStream) {
55719
56001
  return reject(new Error("Must pass in a stream containing the user refresh token."));
55720
56002
  }
@@ -55723,7 +56005,7 @@ var require_refreshclient = __commonJS({
55723
56005
  try {
55724
56006
  const data = JSON.parse(s2);
55725
56007
  this.fromJSON(data);
55726
- return resolve35();
56008
+ return resolve36();
55727
56009
  } catch (err) {
55728
56010
  return reject(err);
55729
56011
  }
@@ -57556,7 +57838,7 @@ var require_pluggable_auth_handler = __commonJS({
57556
57838
  * @return A promise that resolves with the executable response.
57557
57839
  */
57558
57840
  retrieveResponseFromExecutable(envMap) {
57559
- return new Promise((resolve35, reject) => {
57841
+ return new Promise((resolve36, reject) => {
57560
57842
  const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
57561
57843
  env: { ...process.env, ...Object.fromEntries(envMap) }
57562
57844
  });
@@ -57578,7 +57860,7 @@ var require_pluggable_auth_handler = __commonJS({
57578
57860
  try {
57579
57861
  const responseJson = JSON.parse(output);
57580
57862
  const response = new executable_response_1.ExecutableResponse(responseJson);
57581
- return resolve35(response);
57863
+ return resolve36(response);
57582
57864
  } catch (error) {
57583
57865
  if (error instanceof executable_response_1.ExecutableResponseError) {
57584
57866
  return reject(error);
@@ -58481,7 +58763,7 @@ var require_googleauth = __commonJS({
58481
58763
  }
58482
58764
  }
58483
58765
  fromStreamAsync(inputStream, options) {
58484
- return new Promise((resolve35, reject) => {
58766
+ return new Promise((resolve36, reject) => {
58485
58767
  if (!inputStream) {
58486
58768
  throw new Error("Must pass in a stream containing the Google auth settings.");
58487
58769
  }
@@ -58491,7 +58773,7 @@ var require_googleauth = __commonJS({
58491
58773
  try {
58492
58774
  const data = JSON.parse(chunks.join(""));
58493
58775
  const r2 = this._cacheClientFromJSON(data, options);
58494
- return resolve35(r2);
58776
+ return resolve36(r2);
58495
58777
  } catch (err) {
58496
58778
  if (!this.keyFilename)
58497
58779
  throw err;
@@ -58501,7 +58783,7 @@ var require_googleauth = __commonJS({
58501
58783
  });
58502
58784
  this.cachedCredential = client;
58503
58785
  this.setGapicJWTValues(client);
58504
- return resolve35(client);
58786
+ return resolve36(client);
58505
58787
  }
58506
58788
  } catch (err) {
58507
58789
  return reject(err);
@@ -58537,17 +58819,17 @@ var require_googleauth = __commonJS({
58537
58819
  * Run the Google Cloud SDK command that prints the default project ID
58538
58820
  */
58539
58821
  async getDefaultServiceProjectId() {
58540
- return new Promise((resolve35) => {
58822
+ return new Promise((resolve36) => {
58541
58823
  (0, child_process_1.exec)("gcloud config config-helper --format json", (err, stdout2) => {
58542
58824
  if (!err && stdout2) {
58543
58825
  try {
58544
58826
  const projectId = JSON.parse(stdout2).configuration.properties.core.project;
58545
- resolve35(projectId);
58827
+ resolve36(projectId);
58546
58828
  return;
58547
58829
  } catch (e2) {
58548
58830
  }
58549
58831
  }
58550
- resolve35(null);
58832
+ resolve36(null);
58551
58833
  });
58552
58834
  });
58553
58835
  }
@@ -66319,14 +66601,14 @@ function __asyncValues(o) {
66319
66601
  }, i2);
66320
66602
  function verb(n) {
66321
66603
  i2[n] = o[n] && function(v) {
66322
- return new Promise(function(resolve35, reject) {
66323
- v = o[n](v), settle(resolve35, reject, v.done, v.value);
66604
+ return new Promise(function(resolve36, reject) {
66605
+ v = o[n](v), settle(resolve36, reject, v.done, v.value);
66324
66606
  });
66325
66607
  };
66326
66608
  }
66327
- function settle(resolve35, reject, d, v) {
66609
+ function settle(resolve36, reject, d, v) {
66328
66610
  Promise.resolve(v).then(function(v2) {
66329
- resolve35({ value: v2, done: d });
66611
+ resolve36({ value: v2, done: d });
66330
66612
  }, reject);
66331
66613
  }
66332
66614
  }
@@ -76829,8 +77111,8 @@ var init_node4 = __esm({
76829
77111
  const url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateMusic?key=${apiKey}`;
76830
77112
  let onopenResolve = () => {
76831
77113
  };
76832
- const onopenPromise = new Promise((resolve35) => {
76833
- onopenResolve = resolve35;
77114
+ const onopenPromise = new Promise((resolve36) => {
77115
+ onopenResolve = resolve36;
76834
77116
  });
76835
77117
  const callbacks = params.callbacks;
76836
77118
  const onopenAwaitedCallback = function() {
@@ -77036,8 +77318,8 @@ var init_node4 = __esm({
77036
77318
  }
77037
77319
  let onopenResolve = () => {
77038
77320
  };
77039
- const onopenPromise = new Promise((resolve35) => {
77040
- onopenResolve = resolve35;
77321
+ const onopenPromise = new Promise((resolve36) => {
77322
+ onopenResolve = resolve36;
77041
77323
  });
77042
77324
  const callbacks = params.callbacks;
77043
77325
  const onopenAwaitedCallback = function() {
@@ -79346,7 +79628,7 @@ var init_node4 = __esm({
79346
79628
  return void 0;
79347
79629
  }
79348
79630
  };
79349
- sleep$1 = (ms) => new Promise((resolve35) => setTimeout(resolve35, ms));
79631
+ sleep$1 = (ms) => new Promise((resolve36) => setTimeout(resolve36, ms));
79350
79632
  FallbackEncoder = ({ headers, body }) => {
79351
79633
  return {
79352
79634
  bodyHeaders: {
@@ -79855,8 +80137,8 @@ ${underline2}`);
79855
80137
  };
79856
80138
  APIPromise = class _APIPromise extends Promise {
79857
80139
  constructor(client, responsePromise, parseResponse = defaultParseResponse) {
79858
- super((resolve35) => {
79859
- resolve35(null);
80140
+ super((resolve36) => {
80141
+ resolve36(null);
79860
80142
  });
79861
80143
  this.responsePromise = responsePromise;
79862
80144
  this.parseResponse = parseResponse;
@@ -81097,8 +81379,8 @@ ${underline2}`);
81097
81379
  });
81098
81380
 
81099
81381
  // src/capture/contentExtractor.ts
81100
- import { readdirSync as readdirSync16, statSync as statSync17, readFileSync as readFileSync34 } from "fs";
81101
- import { join as join48 } from "path";
81382
+ import { readdirSync as readdirSync17, statSync as statSync18, readFileSync as readFileSync35 } from "fs";
81383
+ import { join as join50 } from "path";
81102
81384
  async function detectLibraries(page, capturedShaders) {
81103
81385
  let detectedLibraries = [];
81104
81386
  try {
@@ -81218,7 +81500,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
81218
81500
  try {
81219
81501
  const { GoogleGenAI: GoogleGenAI2 } = await Promise.resolve().then(() => (init_node4(), node_exports));
81220
81502
  const ai = new GoogleGenAI2({ apiKey: geminiKey });
81221
- const imageFiles = readdirSync16(join48(outputDir, "assets")).filter(
81503
+ const imageFiles = readdirSync17(join50(outputDir, "assets")).filter(
81222
81504
  (f3) => /\.(png|jpg|jpeg|webp|gif)$/i.test(f3)
81223
81505
  );
81224
81506
  const model = process.env.HYPERFRAMES_GEMINI_MODEL || "gemini-3.1-flash-lite-preview";
@@ -81227,10 +81509,10 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
81227
81509
  const batch = imageFiles.slice(i2, i2 + BATCH_SIZE);
81228
81510
  const results = await Promise.allSettled(
81229
81511
  batch.map(async (file) => {
81230
- const filePath = join48(outputDir, "assets", file);
81231
- const stat3 = statSync17(filePath);
81512
+ const filePath = join50(outputDir, "assets", file);
81513
+ const stat3 = statSync18(filePath);
81232
81514
  if (stat3.size > 4e6) return { file, caption: "" };
81233
- const buffer = readFileSync34(filePath);
81515
+ const buffer = readFileSync35(filePath);
81234
81516
  const base64 = buffer.toString("base64");
81235
81517
  const ext = file.split(".").pop()?.toLowerCase() || "png";
81236
81518
  const mimeType = ext === "jpg" ? "image/jpeg" : `image/${ext}`;
@@ -81276,12 +81558,12 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
81276
81558
  const uncaptionedLines = [];
81277
81559
  const svgLines = [];
81278
81560
  const fontLines = [];
81279
- const assetsPath = join48(outputDir, "assets");
81561
+ const assetsPath = join50(outputDir, "assets");
81280
81562
  try {
81281
- for (const file of readdirSync16(assetsPath)) {
81563
+ for (const file of readdirSync17(assetsPath)) {
81282
81564
  if (file === "svgs" || file === "fonts" || file === "lottie" || file === "videos") continue;
81283
- const filePath = join48(assetsPath, file);
81284
- const stat3 = statSync17(filePath);
81565
+ const filePath = join50(assetsPath, file);
81566
+ const stat3 = statSync18(filePath);
81285
81567
  if (!stat3.isFile()) continue;
81286
81568
  const sizeKb = Math.round(stat3.size / 1024);
81287
81569
  const catalogMatch = catalogedAssets.find(
@@ -81309,8 +81591,8 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
81309
81591
  } catch {
81310
81592
  }
81311
81593
  try {
81312
- const svgsPath = join48(assetsPath, "svgs");
81313
- for (const file of readdirSync16(svgsPath)) {
81594
+ const svgsPath = join50(assetsPath, "svgs");
81595
+ for (const file of readdirSync17(svgsPath)) {
81314
81596
  if (!file.endsWith(".svg")) continue;
81315
81597
  const svgMatch = tokens.svgs.find(
81316
81598
  (s2) => s2.label && file.includes(
@@ -81324,8 +81606,8 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
81324
81606
  } catch {
81325
81607
  }
81326
81608
  try {
81327
- const fontsPath = join48(assetsPath, "fonts");
81328
- for (const file of readdirSync16(fontsPath)) {
81609
+ const fontsPath = join50(assetsPath, "fonts");
81610
+ for (const file of readdirSync17(fontsPath)) {
81329
81611
  fontLines.push(`fonts/${file} \u2014 font file`);
81330
81612
  }
81331
81613
  } catch {
@@ -81344,12 +81626,12 @@ __export(agentPromptGenerator_exports, {
81344
81626
  generateAgentPrompt: () => generateAgentPrompt
81345
81627
  });
81346
81628
  import { writeFileSync as writeFileSync19 } from "fs";
81347
- import { join as join49 } from "path";
81629
+ import { join as join51 } from "path";
81348
81630
  function generateAgentPrompt(outputDir, url, tokens, _animations, hasScreenshot, hasLottie, hasShaders, _catalogedAssets, detectedLibraries) {
81349
81631
  const prompt = buildPrompt(url, tokens, hasScreenshot, hasLottie, hasShaders, detectedLibraries);
81350
- writeFileSync19(join49(outputDir, "AGENTS.md"), prompt, "utf-8");
81351
- writeFileSync19(join49(outputDir, "CLAUDE.md"), prompt, "utf-8");
81352
- writeFileSync19(join49(outputDir, ".cursorrules"), prompt, "utf-8");
81632
+ writeFileSync19(join51(outputDir, "AGENTS.md"), prompt, "utf-8");
81633
+ writeFileSync19(join51(outputDir, "CLAUDE.md"), prompt, "utf-8");
81634
+ writeFileSync19(join51(outputDir, ".cursorrules"), prompt, "utf-8");
81353
81635
  }
81354
81636
  function buildPrompt(url, tokens, hasScreenshot, hasLottie, hasShaders, detectedLibraries) {
81355
81637
  const title = tokens.title || new URL(url).hostname.replace(/^www\./, "");
@@ -81416,15 +81698,15 @@ var init_agentPromptGenerator = __esm({
81416
81698
  });
81417
81699
 
81418
81700
  // src/capture/scaffolding.ts
81419
- import { existsSync as existsSync46, writeFileSync as writeFileSync20, readFileSync as readFileSync35 } from "fs";
81420
- import { join as join50, resolve as resolve33 } from "path";
81701
+ import { existsSync as existsSync47, writeFileSync as writeFileSync20, readFileSync as readFileSync36 } from "fs";
81702
+ import { join as join52, resolve as resolve34 } from "path";
81421
81703
  function loadEnvFile(startDir) {
81422
81704
  try {
81423
- let dir = resolve33(startDir);
81705
+ let dir = resolve34(startDir);
81424
81706
  for (let i2 = 0; i2 < 5; i2++) {
81425
- const envPath = resolve33(dir, ".env");
81707
+ const envPath = resolve34(dir, ".env");
81426
81708
  try {
81427
- const envContent = readFileSync35(envPath, "utf-8");
81709
+ const envContent = readFileSync36(envPath, "utf-8");
81428
81710
  for (const line of envContent.split("\n")) {
81429
81711
  const trimmed = line.trim();
81430
81712
  if (!trimmed || trimmed.startsWith("#")) continue;
@@ -81436,15 +81718,15 @@ function loadEnvFile(startDir) {
81436
81718
  }
81437
81719
  break;
81438
81720
  } catch {
81439
- dir = resolve33(dir, "..");
81721
+ dir = resolve34(dir, "..");
81440
81722
  }
81441
81723
  }
81442
81724
  } catch {
81443
81725
  }
81444
81726
  }
81445
81727
  async function generateProjectScaffold(outputDir, url, tokens, animationCatalog, hasScreenshots, hasLotties, hasShaders, catalogedAssets, progress, warnings, detectedLibraries) {
81446
- const metaPath = join50(outputDir, "meta.json");
81447
- if (!existsSync46(metaPath)) {
81728
+ const metaPath = join52(outputDir, "meta.json");
81729
+ if (!existsSync47(metaPath)) {
81448
81730
  const hostname = new URL(url).hostname.replace(/^www\./, "");
81449
81731
  writeFileSync20(
81450
81732
  metaPath,
@@ -81482,9 +81764,9 @@ __export(screenshotCapture_exports, {
81482
81764
  captureScrollScreenshots: () => captureScrollScreenshots
81483
81765
  });
81484
81766
  import { writeFileSync as writeFileSync21, mkdirSync as mkdirSync27 } from "fs";
81485
- import { join as join51 } from "path";
81767
+ import { join as join53 } from "path";
81486
81768
  async function captureScrollScreenshots(page, outputDir) {
81487
- const screenshotsDir = join51(outputDir, "screenshots");
81769
+ const screenshotsDir = join53(outputDir, "screenshots");
81488
81770
  mkdirSync27(screenshotsDir, { recursive: true });
81489
81771
  const MAX_SCREENSHOTS = 20;
81490
81772
  const filePaths = [];
@@ -81518,7 +81800,7 @@ async function captureScrollScreenshots(page, outputDir) {
81518
81800
  finalPositions[i2] / Math.max(1, scrollHeight - viewportHeight) * 100
81519
81801
  );
81520
81802
  const filename = `scroll-${String(Math.min(pct, 100)).padStart(3, "0")}.png`;
81521
- const filePath = join51(screenshotsDir, filename);
81803
+ const filePath = join53(screenshotsDir, filename);
81522
81804
  const buffer = await page.screenshot({ type: "png" });
81523
81805
  writeFileSync21(filePath, buffer);
81524
81806
  filePaths.push(`screenshots/${filename}`);
@@ -81831,8 +82113,8 @@ var capture_exports = {};
81831
82113
  __export(capture_exports, {
81832
82114
  captureWebsite: () => captureWebsite
81833
82115
  });
81834
- import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync22, existsSync as existsSync47 } from "fs";
81835
- import { join as join52 } from "path";
82116
+ import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync22, existsSync as existsSync48 } from "fs";
82117
+ import { join as join54 } from "path";
81836
82118
  async function captureWebsite(opts, onProgress) {
81837
82119
  const {
81838
82120
  url,
@@ -81849,9 +82131,9 @@ async function captureWebsite(opts, onProgress) {
81849
82131
  onProgress?.(stage, detail);
81850
82132
  };
81851
82133
  loadEnvFile(outputDir);
81852
- mkdirSync28(join52(outputDir, "extracted"), { recursive: true });
81853
- mkdirSync28(join52(outputDir, "screenshots"), { recursive: true });
81854
- mkdirSync28(join52(outputDir, "assets"), { recursive: true });
82134
+ mkdirSync28(join54(outputDir, "extracted"), { recursive: true });
82135
+ mkdirSync28(join54(outputDir, "screenshots"), { recursive: true });
82136
+ mkdirSync28(join54(outputDir, "assets"), { recursive: true });
81855
82137
  progress("browser", "Launching headless Chrome...");
81856
82138
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
81857
82139
  const browser = await ensureBrowser2();
@@ -82007,7 +82289,7 @@ async function captureWebsite(opts, onProgress) {
82007
82289
  } catch {
82008
82290
  }
82009
82291
  if (discoveredLotties.length > 0) {
82010
- const lottieDir = join52(outputDir, "assets", "lottie");
82292
+ const lottieDir = join54(outputDir, "assets", "lottie");
82011
82293
  mkdirSync28(lottieDir, { recursive: true });
82012
82294
  const savedCount = await saveLottieAnimations(discoveredLotties, lottieDir);
82013
82295
  if (savedCount > 0) {
@@ -82027,7 +82309,7 @@ async function captureWebsite(opts, onProgress) {
82027
82309
  });
82028
82310
  capturedShaders = unique;
82029
82311
  writeFileSync22(
82030
- join52(outputDir, "extracted", "shaders.json"),
82312
+ join54(outputDir, "extracted", "shaders.json"),
82031
82313
  JSON.stringify(unique, null, 2),
82032
82314
  "utf-8"
82033
82315
  );
@@ -82038,7 +82320,7 @@ async function captureWebsite(opts, onProgress) {
82038
82320
  progress("tokens", "Extracting design tokens...");
82039
82321
  const tokens = await extractTokens(page1);
82040
82322
  writeFileSync22(
82041
- join52(outputDir, "extracted", "tokens.json"),
82323
+ join54(outputDir, "extracted", "tokens.json"),
82042
82324
  JSON.stringify(tokens, null, 2),
82043
82325
  "utf-8"
82044
82326
  );
@@ -82112,7 +82394,7 @@ async function captureWebsite(opts, onProgress) {
82112
82394
  representativeAnimations: representativeAnims
82113
82395
  };
82114
82396
  writeFileSync22(
82115
- join52(outputDir, "extracted", "animations.json"),
82397
+ join54(outputDir, "extracted", "animations.json"),
82116
82398
  JSON.stringify(leanCatalog, null, 2),
82117
82399
  "utf-8"
82118
82400
  );
@@ -82123,18 +82405,18 @@ async function captureWebsite(opts, onProgress) {
82123
82405
  assets = await downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks);
82124
82406
  }
82125
82407
  if (visibleTextContent) {
82126
- writeFileSync22(join52(outputDir, "extracted", "visible-text.txt"), visibleTextContent, "utf-8");
82408
+ writeFileSync22(join54(outputDir, "extracted", "visible-text.txt"), visibleTextContent, "utf-8");
82127
82409
  }
82128
82410
  if (catalogedAssets.length > 0) {
82129
82411
  writeFileSync22(
82130
- join52(outputDir, "extracted", "assets-catalog.json"),
82412
+ join54(outputDir, "extracted", "assets-catalog.json"),
82131
82413
  JSON.stringify(catalogedAssets, null, 2),
82132
82414
  "utf-8"
82133
82415
  );
82134
82416
  }
82135
82417
  if (detectedLibraries.length > 0) {
82136
82418
  writeFileSync22(
82137
- join52(outputDir, "extracted", "detected-libraries.json"),
82419
+ join54(outputDir, "extracted", "detected-libraries.json"),
82138
82420
  JSON.stringify(detectedLibraries, null, 2),
82139
82421
  "utf-8"
82140
82422
  );
@@ -82145,7 +82427,7 @@ async function captureWebsite(opts, onProgress) {
82145
82427
  const lines = generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCaptions);
82146
82428
  if (lines.length > 0) {
82147
82429
  writeFileSync22(
82148
- join52(outputDir, "extracted", "asset-descriptions.md"),
82430
+ join54(outputDir, "extracted", "asset-descriptions.md"),
82149
82431
  "# Asset Descriptions\n\nOne line per file. Read this instead of opening every image individually.\n\n" + lines.map((l) => "- " + l).join("\n") + "\n",
82150
82432
  "utf-8"
82151
82433
  );
@@ -82161,7 +82443,7 @@ async function captureWebsite(opts, onProgress) {
82161
82443
  animationCatalog,
82162
82444
  screenshots.length > 0,
82163
82445
  discoveredLotties.length > 0,
82164
- existsSync47(join52(outputDir, "extracted", "shaders.json")),
82446
+ existsSync48(join54(outputDir, "extracted", "shaders.json")),
82165
82447
  catalogedAssets,
82166
82448
  progress,
82167
82449
  warnings,
@@ -82201,15 +82483,15 @@ var init_capture = __esm({
82201
82483
  var capture_exports2 = {};
82202
82484
  __export(capture_exports2, {
82203
82485
  default: () => capture_default,
82204
- examples: () => examples19
82486
+ examples: () => examples20
82205
82487
  });
82206
- import { resolve as resolve34 } from "path";
82207
- var examples19, capture_default;
82488
+ import { resolve as resolve35 } from "path";
82489
+ var examples20, capture_default;
82208
82490
  var init_capture2 = __esm({
82209
82491
  "src/commands/capture.ts"() {
82210
82492
  "use strict";
82211
82493
  init_dist();
82212
- examples19 = [
82494
+ examples20 = [
82213
82495
  ["Capture a website", "hyperframes capture https://stripe.com"],
82214
82496
  ["Capture to a specific directory", "hyperframes capture https://linear.app -o linear-video"],
82215
82497
  ["JSON output for AI agents", "hyperframes capture https://example.com --json"]
@@ -82262,7 +82544,7 @@ var init_capture2 = __esm({
82262
82544
  const hostname = new URL(url).hostname.replace(/^www\./, "");
82263
82545
  outputName = `captures/${hostname.replace(/\./g, "-")}`;
82264
82546
  }
82265
- const outputDir = resolve34(outputName);
82547
+ const outputDir = resolve35(outputName);
82266
82548
  const isJson = args.json;
82267
82549
  if (!isJson) {
82268
82550
  const { c: c2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
@@ -82510,7 +82792,7 @@ __export(autoUpdate_exports, {
82510
82792
  import { spawn as spawn12 } from "child_process";
82511
82793
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync29, openSync } from "fs";
82512
82794
  import { homedir as homedir10 } from "os";
82513
- import { join as join53 } from "path";
82795
+ import { join as join55 } from "path";
82514
82796
  import { compareVersions as compareVersions2 } from "compare-versions";
82515
82797
  function isAutoInstallDisabled() {
82516
82798
  if (isDevMode()) return true;
@@ -82533,7 +82815,7 @@ function log(line) {
82533
82815
  }
82534
82816
  function launchDetachedInstall(installCommand, version) {
82535
82817
  mkdirSync29(CONFIG_DIR2, { recursive: true, mode: 448 });
82536
- const configFile = join53(CONFIG_DIR2, "config.json");
82818
+ const configFile = join55(CONFIG_DIR2, "config.json");
82537
82819
  const nodeScript = `
82538
82820
  const { exec } = require("node:child_process");
82539
82821
  const { readFileSync, renameSync, writeFileSync } = require("node:fs");
@@ -82652,8 +82934,8 @@ var init_autoUpdate = __esm({
82652
82934
  init_config();
82653
82935
  init_env();
82654
82936
  init_installerDetection();
82655
- CONFIG_DIR2 = join53(homedir10(), ".hyperframes");
82656
- LOG_FILE = join53(CONFIG_DIR2, "auto-update.log");
82937
+ CONFIG_DIR2 = join55(homedir10(), ".hyperframes");
82938
+ LOG_FILE = join55(CONFIG_DIR2, "auto-update.log");
82657
82939
  PENDING_TIMEOUT_MS = 10 * 60 * 1e3;
82658
82940
  }
82659
82941
  });
@@ -82706,10 +82988,10 @@ function renderRootHelp() {
82706
82988
  lines.push(`Run ${c.cyan("hyperframes <command> --help")} for more information about a command.`);
82707
82989
  return lines.join("\n");
82708
82990
  }
82709
- function formatExamples(examples20) {
82991
+ function formatExamples(examples21) {
82710
82992
  const lines = [];
82711
82993
  lines.push(c.bold("Examples:"));
82712
- for (const [comment, command2] of examples20) {
82994
+ for (const [comment, command2] of examples21) {
82713
82995
  lines.push(` ${c.gray(`# ${comment}`)}`);
82714
82996
  lines.push(` ${command2}`);
82715
82997
  lines.push("");
@@ -82726,9 +83008,9 @@ async function showUsage2(cmd, parent) {
82726
83008
  console.log(usage + "\n");
82727
83009
  const name = meta?.name;
82728
83010
  if (name) {
82729
- const examples20 = STATIC_EXAMPLES[name] ?? await loadExamples(name);
82730
- if (examples20) {
82731
- console.log(formatExamples(examples20) + "\n");
83011
+ const examples21 = STATIC_EXAMPLES[name] ?? await loadExamples(name);
83012
+ if (examples21) {
83013
+ console.log(formatExamples(examples21) + "\n");
82732
83014
  }
82733
83015
  }
82734
83016
  }
@@ -82749,6 +83031,7 @@ var init_help = __esm({
82749
83031
  ["capture", "Capture a website for video production"],
82750
83032
  ["catalog", "Browse and install blocks and components"],
82751
83033
  ["preview", "Start the studio for previewing compositions"],
83034
+ ["publish", "Upload a project and get a stable public URL"],
82752
83035
  ["render", "Render a composition to MP4 or WebM"]
82753
83036
  ]
82754
83037
  },
@@ -82793,6 +83076,7 @@ var init_help = __esm({
82793
83076
  ROOT_EXAMPLES = [
82794
83077
  ["Create a new project", "hyperframes init my-video"],
82795
83078
  ["Start the live preview studio", "hyperframes preview"],
83079
+ ["Publish to hyperframes.dev", "hyperframes publish"],
82796
83080
  ["Render to MP4", "hyperframes render -o out.mp4"],
82797
83081
  ["Transparent WebM overlay", "hyperframes render --format webm -o out.webm"],
82798
83082
  ["Validate your composition", "hyperframes lint"],
@@ -82818,6 +83102,7 @@ var subCommands = {
82818
83102
  catalog: () => Promise.resolve().then(() => (init_catalog(), catalog_exports)).then((m2) => m2.default),
82819
83103
  play: () => Promise.resolve().then(() => (init_play(), play_exports)).then((m2) => m2.default),
82820
83104
  preview: () => Promise.resolve().then(() => (init_preview2(), preview_exports)).then((m2) => m2.default),
83105
+ publish: () => Promise.resolve().then(() => (init_publish(), publish_exports)).then((m2) => m2.default),
82821
83106
  render: () => Promise.resolve().then(() => (init_render2(), render_exports)).then((m2) => m2.default),
82822
83107
  lint: () => Promise.resolve().then(() => (init_lint3(), lint_exports2)).then((m2) => m2.default),
82823
83108
  info: () => Promise.resolve().then(() => (init_info(), info_exports)).then((m2) => m2.default),