hyperframes 0.6.70 → 0.6.72

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
@@ -50,7 +50,7 @@ var VERSION;
50
50
  var init_version = __esm({
51
51
  "src/version.ts"() {
52
52
  "use strict";
53
- VERSION = true ? "0.6.70" : "0.0.0-dev";
53
+ VERSION = true ? "0.6.72" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -61106,7 +61106,17 @@ import { existsSync as existsSync18, readdirSync as readdirSync8, rmSync as rmSy
61106
61106
  import { basename as basename2 } from "path";
61107
61107
  import { homedir as homedir5 } from "os";
61108
61108
  import { join as join22 } from "path";
61109
- import { Browser, detectBrowserPlatform, getInstalledBrowsers, install } from "@puppeteer/browsers";
61109
+ async function loadPuppeteerBrowsers() {
61110
+ try {
61111
+ return await import("@puppeteer/browsers");
61112
+ } catch (err) {
61113
+ const cause = err instanceof Error ? err.message : String(err);
61114
+ throw new Error(
61115
+ `Failed to load @puppeteer/browsers: ${cause}
61116
+ Fix: run \`npm install\` or \`bun install\` to restore missing packages, then retry.`
61117
+ );
61118
+ }
61119
+ }
61110
61120
  function whichBinary2(name) {
61111
61121
  try {
61112
61122
  const cmd = process.platform === "win32" ? `where ${name}` : `which ${name}`;
@@ -61134,6 +61144,7 @@ async function findFromCache() {
61134
61144
  return fromPuppeteer;
61135
61145
  }
61136
61146
  if (existsSync18(CACHE_DIR2)) {
61147
+ const { Browser, getInstalledBrowsers } = await loadPuppeteerBrowsers();
61137
61148
  const installed = await getInstalledBrowsers({ cacheDir: CACHE_DIR2 });
61138
61149
  const match = installed.find((b2) => b2.browser === Browser.CHROMEHEADLESSSHELL);
61139
61150
  if (match) {
@@ -61286,6 +61297,7 @@ Then re-run your command. The HYPERFRAMES_BROWSER_PATH env var persists for the
61286
61297
  async function ensureBrowser(options) {
61287
61298
  const existing = await findBrowser();
61288
61299
  if (existing) return existing;
61300
+ const { Browser, detectBrowserPlatform, install } = await loadPuppeteerBrowsers();
61289
61301
  const platform9 = detectBrowserPlatform();
61290
61302
  if (!platform9) {
61291
61303
  throw new Error(`Unsupported platform: ${process.platform} ${process.arch}`);
@@ -61310,7 +61322,7 @@ function clearBrowser() {
61310
61322
  return true;
61311
61323
  }
61312
61324
  function isLinuxArm() {
61313
- return detectBrowserPlatform() === "linux_arm";
61325
+ return process.platform === "linux" && process.arch === "arm64";
61314
61326
  }
61315
61327
  var CHROME_VERSION, CACHE_DIR2, PUPPETEER_CACHE_DIR, SYSTEM_CHROME_PATHS, _warnedSystemFallback;
61316
61328
  var init_manager2 = __esm({
@@ -62367,6 +62379,62 @@ async function pollPageExpression(page, expression, timeoutMs, intervalMs = 100)
62367
62379
  }
62368
62380
  return Boolean(await page.evaluate(expression));
62369
62381
  }
62382
+ function buildZeroDurationDiagnostic(diag) {
62383
+ const hints = [];
62384
+ if (!diag.hasPlayer) {
62385
+ hints.push("window.__player was never set \u2014 the HyperFrames runtime did not initialize.");
62386
+ }
62387
+ if (!diag.hasTimeline) {
62388
+ hints.push(
62389
+ "No GSAP timeline registered (window.__timelines is empty). If using CSS/WAAPI/Lottie/Three.js animations, add data-duration to the root element."
62390
+ );
62391
+ }
62392
+ if (diag.declaredDuration <= 0 && !diag.hasTimeline) {
62393
+ hints.push(
62394
+ 'Fix: add data-duration="<seconds>" to your root <div data-composition-id="..."> element.'
62395
+ );
62396
+ }
62397
+ if (diag.hasSeek && diag.duration === 0 && diag.renderReady) {
62398
+ hints.push("The runtime finished initializing but reported zero duration \u2014 this is permanent.");
62399
+ }
62400
+ return `[FrameCapture] Composition has zero duration.
62401
+ Runtime ready: ${diag.renderReady}, __player: ${diag.hasPlayer}, __hf.seek: ${diag.hasSeek}, GSAP timeline: ${diag.hasTimeline}, data-duration: ${diag.declaredDuration > 0 ? diag.declaredDuration + "s" : "not set"}
62402
+ ` + (hints.length > 0 ? hints.map((h3) => ` \u2192 ${h3}`).join("\n") : "");
62403
+ }
62404
+ async function evaluateHfDiagnostic(page) {
62405
+ return await page.evaluate(HF_READY_DIAGNOSTIC_EXPR);
62406
+ }
62407
+ async function pollHfReady(page, timeoutMs, intervalMs = 100) {
62408
+ const readyExpr = `!!(window.__hf && typeof window.__hf.seek === "function" && window.__hf.duration > 0)`;
62409
+ const FAST_FAIL_AFTER_MS = 1e4;
62410
+ const DIAGNOSTIC_INTERVAL_MS = 1e3;
62411
+ const deadline = Date.now() + timeoutMs;
62412
+ let lastDiagnosticAt = 0;
62413
+ while (Date.now() < deadline) {
62414
+ const ready = Boolean(await page.evaluate(readyExpr));
62415
+ if (ready) return;
62416
+ const elapsed = timeoutMs - (deadline - Date.now());
62417
+ if (elapsed >= FAST_FAIL_AFTER_MS) {
62418
+ const now = Date.now();
62419
+ if (now - lastDiagnosticAt >= DIAGNOSTIC_INTERVAL_MS) {
62420
+ lastDiagnosticAt = now;
62421
+ const diag2 = await evaluateHfDiagnostic(page);
62422
+ if (diag2.renderReady && diag2.hasSeek && !diag2.hasTimeline && diag2.declaredDuration <= 0) {
62423
+ throw new Error(buildZeroDurationDiagnostic(diag2));
62424
+ }
62425
+ }
62426
+ }
62427
+ await new Promise((resolve48) => setTimeout(resolve48, intervalMs));
62428
+ }
62429
+ const diag = await evaluateHfDiagnostic(page);
62430
+ if (diag.hasSeek && diag.duration === 0) {
62431
+ throw new Error(buildZeroDurationDiagnostic(diag));
62432
+ }
62433
+ throw new Error(
62434
+ `[FrameCapture] window.__hf not ready after ${timeoutMs}ms. Page must expose window.__hf = { duration, seek }.
62435
+ State: __hf=${diag.hasHf}, seek=${diag.hasSeek}, player=${diag.hasPlayer}, renderReady=${diag.renderReady}, duration=${diag.duration}`
62436
+ );
62437
+ }
62370
62438
  async function pollSubCompositionTimelines(page, timeoutMs, intervalMs = 150) {
62371
62439
  const expression = `(function() {
62372
62440
  var hosts = document.querySelectorAll("[data-composition-id]");
@@ -62426,6 +62494,42 @@ async function pollVideosReady(page, skipIds, timeoutMs, intervalMs = 100) {
62426
62494
  }
62427
62495
  return check();
62428
62496
  }
62497
+ async function pollImagesReady(page, timeoutMs, intervalMs = 100) {
62498
+ const check = async () => {
62499
+ return Boolean(
62500
+ await page.evaluate(() => {
62501
+ const imgs = Array.from(document.querySelectorAll("img"));
62502
+ return imgs.length === 0 || imgs.every((img) => {
62503
+ const ie2 = img;
62504
+ const src = ie2.getAttribute("src") || "";
62505
+ if (!src || src.startsWith("data:")) return true;
62506
+ if (ie2.complete && ie2.naturalWidth === 0) return true;
62507
+ if (ie2.complete && ie2.naturalWidth > 0) return true;
62508
+ return false;
62509
+ });
62510
+ })
62511
+ );
62512
+ };
62513
+ const deadline = Date.now() + timeoutMs;
62514
+ while (Date.now() < deadline) {
62515
+ if (await check()) return true;
62516
+ await new Promise((resolve48) => setTimeout(resolve48, intervalMs));
62517
+ }
62518
+ return check();
62519
+ }
62520
+ async function decodeAllImages(page) {
62521
+ await page.evaluate(async () => {
62522
+ const imgs = Array.from(document.querySelectorAll("img"));
62523
+ await Promise.all(
62524
+ imgs.map((img) => {
62525
+ const ie2 = img;
62526
+ if (typeof ie2.decode !== "function") return Promise.resolve();
62527
+ if (!ie2.complete || ie2.naturalWidth === 0) return Promise.resolve();
62528
+ return ie2.decode().catch(() => void 0);
62529
+ })
62530
+ );
62531
+ });
62532
+ }
62429
62533
  async function applyVideoMetadataHints(page, hints) {
62430
62534
  if (!hints || hints.length === 0) return;
62431
62535
  await page.evaluate(
@@ -62497,16 +62601,7 @@ async function initializeSession(session) {
62497
62601
  if (session.captureMode === "screenshot") {
62498
62602
  await page.goto(url, { waitUntil: "domcontentloaded", timeout: 6e4 });
62499
62603
  const pageReadyTimeout2 = session.config?.playerReadyTimeout ?? DEFAULT_CONFIG2.playerReadyTimeout;
62500
- const pageReady2 = await pollPageExpression(
62501
- page,
62502
- `!!(window.__hf && typeof window.__hf.seek === "function" && window.__hf.duration > 0)`,
62503
- pageReadyTimeout2
62504
- );
62505
- if (!pageReady2) {
62506
- throw new Error(
62507
- `[FrameCapture] window.__hf not ready after ${pageReadyTimeout2}ms. Page must expose window.__hf = { duration, seek }.`
62508
- );
62509
- }
62604
+ await pollHfReady(page, pageReadyTimeout2);
62510
62605
  await pollSubCompositionTimelines(page, pageReadyTimeout2);
62511
62606
  await applyVideoMetadataHints(page, session.options.videoMetadataHints);
62512
62607
  const videosReady = await pollVideosReady(
@@ -62523,6 +62618,21 @@ async function initializeSession(session) {
62523
62618
  `[FrameCapture] Some video elements did not decode within ${pageReadyTimeout2}ms: ${failedVideos}. Continuing render \u2014 affected videos will appear as blank/black frames.`
62524
62619
  );
62525
62620
  }
62621
+ const imagesReady = await pollImagesReady(page, pageReadyTimeout2);
62622
+ if (!imagesReady) {
62623
+ const failedImages = await page.evaluate(() => {
62624
+ return Array.from(document.querySelectorAll("img")).filter((img) => {
62625
+ const ie2 = img;
62626
+ const src = ie2.getAttribute("src") || "";
62627
+ if (!src || src.startsWith("data:")) return false;
62628
+ return !(ie2.complete && ie2.naturalWidth > 0);
62629
+ }).map((img) => img.src || img.getAttribute("src") || "(no src)").join(", ");
62630
+ });
62631
+ console.warn(
62632
+ `[FrameCapture] Some image elements did not load within ${pageReadyTimeout2}ms: ${failedImages}. Continuing render \u2014 affected images may appear blank/missing in early frames.`
62633
+ );
62634
+ }
62635
+ await decodeAllImages(page);
62526
62636
  await page.evaluate(`document.fonts?.ready`);
62527
62637
  await waitForOptionalTailwindReady(page, pageReadyTimeout2);
62528
62638
  if (session.options.format === "png") {
@@ -62569,22 +62679,11 @@ async function initializeSession(session) {
62569
62679
  });
62570
62680
  await page.goto(url, { waitUntil: "domcontentloaded", timeout: 6e4 });
62571
62681
  const pageReadyTimeout = session.config?.playerReadyTimeout ?? DEFAULT_CONFIG2.playerReadyTimeout;
62572
- const pollDeadline = Date.now() + pageReadyTimeout;
62573
- while (Date.now() < pollDeadline) {
62574
- const ready = await page.evaluate(
62575
- `!!(window.__hf && typeof window.__hf.seek === "function" && window.__hf.duration > 0)`
62576
- );
62577
- if (ready) break;
62578
- await new Promise((r2) => setTimeout(r2, 100));
62579
- }
62580
- const pageReady = await page.evaluate(
62581
- `!!(window.__hf && typeof window.__hf.seek === "function" && window.__hf.duration > 0)`
62582
- );
62583
- if (!pageReady) {
62682
+ try {
62683
+ await pollHfReady(page, pageReadyTimeout);
62684
+ } catch (err) {
62584
62685
  warmupState.running = false;
62585
- throw new Error(
62586
- `[FrameCapture] window.__hf not ready after ${pageReadyTimeout}ms. Page must expose window.__hf = { duration, seek }.`
62587
- );
62686
+ throw err;
62588
62687
  }
62589
62688
  await pollSubCompositionTimelines(page, pageReadyTimeout);
62590
62689
  await applyVideoMetadataHints(page, session.options.videoMetadataHints);
@@ -62602,6 +62701,21 @@ async function initializeSession(session) {
62602
62701
  `[FrameCapture] Some video elements did not decode within ${pageReadyTimeout}ms: ${failedVideos}. Continuing render \u2014 affected videos will appear as blank/black frames.`
62603
62702
  );
62604
62703
  }
62704
+ const bfImagesReady = await pollImagesReady(page, pageReadyTimeout);
62705
+ if (!bfImagesReady) {
62706
+ const failedImages = await page.evaluate(() => {
62707
+ return Array.from(document.querySelectorAll("img")).filter((img) => {
62708
+ const ie2 = img;
62709
+ const src = ie2.getAttribute("src") || "";
62710
+ if (!src || src.startsWith("data:")) return false;
62711
+ return !(ie2.complete && ie2.naturalWidth > 0);
62712
+ }).map((img) => img.src || img.getAttribute("src") || "(no src)").join(", ");
62713
+ });
62714
+ console.warn(
62715
+ `[FrameCapture] Some image elements did not load within ${pageReadyTimeout}ms: ${failedImages}. Continuing render \u2014 affected images may appear blank/missing in early frames.`
62716
+ );
62717
+ }
62718
+ await decodeAllImages(page);
62605
62719
  await page.evaluate(`document.fonts?.ready`);
62606
62720
  await waitForOptionalTailwindReady(page, pageReadyTimeout);
62607
62721
  warmupState.running = false;
@@ -62813,7 +62927,7 @@ function getCapturePerfSummary(session) {
62813
62927
  avgScreenshotMs: Math.round(session.capturePerf.screenshotMs / frames)
62814
62928
  };
62815
62929
  }
62816
- var BROWSER_CONSOLE_BUFFER_SIZE, CAPTURE_SESSION_CLOSE_TIMEOUT_MS, LOCKED_WARMUP_TICKS, realSleep;
62930
+ var BROWSER_CONSOLE_BUFFER_SIZE, CAPTURE_SESSION_CLOSE_TIMEOUT_MS, LOCKED_WARMUP_TICKS, realSleep, HF_READY_DIAGNOSTIC_EXPR;
62817
62931
  var init_frameCapture = __esm({
62818
62932
  "../engine/src/services/frameCapture.ts"() {
62819
62933
  "use strict";
@@ -62825,6 +62939,25 @@ var init_frameCapture = __esm({
62825
62939
  CAPTURE_SESSION_CLOSE_TIMEOUT_MS = 5e3;
62826
62940
  LOCKED_WARMUP_TICKS = 60;
62827
62941
  realSleep = (ms) => new Promise((resolve48) => setTimeout(resolve48, ms));
62942
+ HF_READY_DIAGNOSTIC_EXPR = `(function() {
62943
+ var hf = window.__hf;
62944
+ var player = window.__player;
62945
+ var renderReady = !!window.__renderReady;
62946
+ var hasSeek = !!(hf && typeof hf.seek === "function");
62947
+ var duration = hf ? hf.duration : -1;
62948
+ var hasTimeline = !!(window.__timelines && Object.keys(window.__timelines).length > 0);
62949
+ var root = document.querySelector("[data-composition-id]");
62950
+ var declaredDuration = root ? Number(root.getAttribute("data-duration")) : -1;
62951
+ return {
62952
+ renderReady: renderReady,
62953
+ hasHf: !!hf,
62954
+ hasSeek: hasSeek,
62955
+ hasPlayer: !!player,
62956
+ duration: duration,
62957
+ hasTimeline: hasTimeline,
62958
+ declaredDuration: declaredDuration,
62959
+ };
62960
+ })()`;
62828
62961
  }
62829
62962
  });
62830
62963
 
@@ -72113,6 +72246,21 @@ async function localizeRemoteMediaSources(html, downloadDir) {
72113
72246
  "Localized remote media source(s)"
72114
72247
  );
72115
72248
  }
72249
+ async function localizeRemoteImageSources(html, downloadDir) {
72250
+ const urlSet = /* @__PURE__ */ new Set();
72251
+ const re2 = new RegExp(REMOTE_IMG_TAG_RE.source, REMOTE_IMG_TAG_RE.flags);
72252
+ let m2;
72253
+ while ((m2 = re2.exec(html)) !== null) {
72254
+ if (m2[1]) urlSet.add(m2[1]);
72255
+ }
72256
+ return downloadAndRewriteUrls(
72257
+ urlSet,
72258
+ html,
72259
+ join39(downloadDir, REMOTE_MEDIA_SUBDIR),
72260
+ "Remote image download failed for",
72261
+ "Localized remote image source(s)"
72262
+ );
72263
+ }
72116
72264
  async function localizeRemoteFontFaces(html, downloadDir) {
72117
72265
  const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
72118
72266
  const fontFaceRe = /@font-face\s*\{([^}]*)\}/gi;
@@ -72202,8 +72350,12 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
72202
72350
  for (const [relPath, absPath] of remoteMediaAssets) {
72203
72351
  externalAssets.set(relPath, absPath);
72204
72352
  }
72353
+ const { html: htmlWithLocalImages, remoteMediaAssets: remoteImageAssets } = await localizeRemoteImageSources(htmlWithLocalMedia, downloadDir);
72354
+ for (const [relPath, absPath] of remoteImageAssets) {
72355
+ externalAssets.set(relPath, absPath);
72356
+ }
72205
72357
  const { html, remoteMediaAssets: remoteFontAssets } = await localizeRemoteFontFaces(
72206
- htmlWithLocalMedia,
72358
+ htmlWithLocalImages,
72207
72359
  downloadDir
72208
72360
  );
72209
72361
  for (const [relPath, absPath] of remoteFontAssets) {
@@ -72489,7 +72641,7 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
72489
72641
  hasShaderTransitions: compiled.hasShaderTransitions
72490
72642
  };
72491
72643
  }
72492
- var INLINE_SCRIPT_PATTERN, COMPILER_MOUNT_BLOCK_START, COMPILER_MOUNT_BLOCK_END, SHADER_TRANSITION_USAGE_PATTERN, REMOTE_MEDIA_SUBDIR, REMOTE_MEDIA_TAG_RE, REMOTE_FONTFACE_URL_RE, GSAP_CDN_BASE;
72644
+ var INLINE_SCRIPT_PATTERN, COMPILER_MOUNT_BLOCK_START, COMPILER_MOUNT_BLOCK_END, SHADER_TRANSITION_USAGE_PATTERN, REMOTE_MEDIA_SUBDIR, REMOTE_MEDIA_TAG_RE, REMOTE_IMG_TAG_RE, REMOTE_FONTFACE_URL_RE, GSAP_CDN_BASE;
72493
72645
  var init_htmlCompiler2 = __esm({
72494
72646
  "../producer/src/services/htmlCompiler.ts"() {
72495
72647
  "use strict";
@@ -72508,6 +72660,7 @@ var init_htmlCompiler2 = __esm({
72508
72660
  SHADER_TRANSITION_USAGE_PATTERN = /\b(?:(?:window|globalThis)\s*\.\s*)?HyperShader\s*\.\s*init\s*\(|\b__hf\s*\.\s*transitions\s*=/;
72509
72661
  REMOTE_MEDIA_SUBDIR = "_remote_media";
72510
72662
  REMOTE_MEDIA_TAG_RE = /<(?:video|audio)\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
72663
+ REMOTE_IMG_TAG_RE = /<img\b[^>]*?(?<![\w-])src\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
72511
72664
  REMOTE_FONTFACE_URL_RE = /url\(["']?(https?:\/\/[^"')]+)["']?\)/gi;
72512
72665
  GSAP_CDN_BASE = "https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/";
72513
72666
  }
@@ -81831,13 +81984,19 @@ var init_feedback = __esm({
81831
81984
  });
81832
81985
 
81833
81986
  // src/utils/dockerRunArgs.ts
81987
+ function resolveDockerPlatform(arch2 = process.arch, env = process.env) {
81988
+ const override = env.HYPERFRAMES_DOCKER_PLATFORM;
81989
+ if (override && override.trim() !== "") return override.trim();
81990
+ return arch2 === "arm64" ? "linux/arm64" : "linux/amd64";
81991
+ }
81834
81992
  function buildDockerRunArgs(input2) {
81835
81993
  const { imageTag, projectDir, outputDir, outputFilename, options } = input2;
81994
+ const platform9 = input2.platform ?? resolveDockerPlatform();
81836
81995
  return [
81837
81996
  "run",
81838
81997
  "--rm",
81839
81998
  "--platform",
81840
- "linux/amd64",
81999
+ platform9,
81841
82000
  "--shm-size=2g",
81842
82001
  // GPU encoding requires host GPU passthrough.
81843
82002
  ...options.gpu ? ["--gpus", "all"] : [],
@@ -81959,26 +82118,33 @@ function dockerImageExists(tag) {
81959
82118
  return false;
81960
82119
  }
81961
82120
  }
81962
- function ensureDockerImage(version, quiet) {
81963
- const tag = dockerImageTag(version);
82121
+ function dockerImageTagForPlatform(version, platform9) {
82122
+ const archSuffix = platform9 === "linux/arm64" ? "-arm64" : "";
82123
+ return `${dockerImageTag(version)}${archSuffix}`;
82124
+ }
82125
+ function ensureDockerImage(version, platform9, quiet) {
82126
+ const tag = dockerImageTagForPlatform(version, platform9);
81964
82127
  if (dockerImageExists(tag)) {
81965
82128
  if (!quiet) console.log(c2.dim(` Docker image: ${tag} (cached)`));
81966
82129
  return tag;
81967
82130
  }
81968
- if (!quiet) console.log(c2.dim(` Building Docker image: ${tag}...`));
82131
+ if (!quiet) console.log(c2.dim(` Building Docker image: ${tag} (${platform9})...`));
81969
82132
  const dockerfilePath = resolveDockerfilePath();
81970
82133
  const tmpDir = join63(tmpdir5(), `hyperframes-docker-${Date.now()}`);
81971
82134
  mkdirSync32(tmpDir, { recursive: true });
81972
82135
  writeFileSync27(join63(tmpDir, "Dockerfile"), readFileSync40(dockerfilePath));
82136
+ const targetArch = platform9 === "linux/arm64" ? "arm64" : "amd64";
81973
82137
  try {
81974
82138
  execFileSync6(
81975
82139
  "docker",
81976
82140
  [
81977
82141
  "build",
81978
82142
  "--platform",
81979
- "linux/amd64",
82143
+ platform9,
81980
82144
  "--build-arg",
81981
82145
  `HYPERFRAMES_VERSION=${version}`,
82146
+ "--build-arg",
82147
+ `TARGETARCH=${targetArch}`,
81982
82148
  "-t",
81983
82149
  tag,
81984
82150
  tmpDir
@@ -81994,15 +82160,35 @@ function ensureDockerImage(version, quiet) {
81994
82160
  if (!quiet) console.log(c2.dim(` Docker image: ${tag} (built)`));
81995
82161
  return tag;
81996
82162
  }
82163
+ function resolveDockerHostPlatform(options) {
82164
+ const platform9 = resolveDockerPlatform();
82165
+ if (options.gpu && platform9 === "linux/arm64") {
82166
+ errorBox(
82167
+ "--gpu is not supported with --docker on arm64 hosts",
82168
+ "Docker Desktop/colima on Apple Silicon doesn't expose --gpus host passthrough to linux/arm64 containers.",
82169
+ "Drop --gpu, or run a native (non-Docker) render on this host, or set HYPERFRAMES_DOCKER_PLATFORM=linux/amd64 if you need GPU encoding (slow under qemu but works)."
82170
+ );
82171
+ process.exit(1);
82172
+ }
82173
+ if (!options.quiet && platform9 === "linux/arm64") {
82174
+ console.log(
82175
+ c2.dim(
82176
+ " Host is arm64 \u2014 using linux/arm64 image with system chromium (output won't be byte-identical to amd64 renders; set HYPERFRAMES_DOCKER_PLATFORM=linux/amd64 to force parity)."
82177
+ )
82178
+ );
82179
+ }
82180
+ return platform9;
82181
+ }
81997
82182
  async function renderDocker(projectDir, outputPath, options) {
81998
82183
  const startTime = Date.now();
81999
82184
  const dockerVersion = isDevMode() ? "latest" : VERSION;
82000
82185
  if (!options.quiet && isDevMode()) {
82001
82186
  console.log(c2.dim(" Dev mode: using hyperframes@latest in Docker image"));
82002
82187
  }
82188
+ const platform9 = resolveDockerHostPlatform(options);
82003
82189
  let imageTag;
82004
82190
  try {
82005
- imageTag = ensureDockerImage(dockerVersion, options.quiet);
82191
+ imageTag = ensureDockerImage(dockerVersion, platform9, options.quiet);
82006
82192
  } catch (error) {
82007
82193
  const message = error instanceof Error ? error.message : String(error);
82008
82194
  const isDockerMissing = /connect|not found|ENOENT/i.test(message);
@@ -82020,6 +82206,7 @@ async function renderDocker(projectDir, outputPath, options) {
82020
82206
  projectDir: resolve35(projectDir),
82021
82207
  outputDir: resolve35(outputDir),
82022
82208
  outputFilename,
82209
+ platform: platform9,
82023
82210
  options: {
82024
82211
  fps: options.fps,
82025
82212
  quality: options.quality,
@@ -87393,786 +87580,6 @@ var require_interceptor = __commonJS({
87393
87580
  }
87394
87581
  });
87395
87582
 
87396
- // ../../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
87397
- var require_ms = __commonJS({
87398
- "../../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
87399
- "use strict";
87400
- var s2 = 1e3;
87401
- var m2 = s2 * 60;
87402
- var h3 = m2 * 60;
87403
- var d2 = h3 * 24;
87404
- var w3 = d2 * 7;
87405
- var y = d2 * 365.25;
87406
- module.exports = function(val, options) {
87407
- options = options || {};
87408
- var type = typeof val;
87409
- if (type === "string" && val.length > 0) {
87410
- return parse6(val);
87411
- } else if (type === "number" && isFinite(val)) {
87412
- return options.long ? fmtLong(val) : fmtShort(val);
87413
- }
87414
- throw new Error(
87415
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
87416
- );
87417
- };
87418
- function parse6(str) {
87419
- str = String(str);
87420
- if (str.length > 100) {
87421
- return;
87422
- }
87423
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
87424
- str
87425
- );
87426
- if (!match) {
87427
- return;
87428
- }
87429
- var n = parseFloat(match[1]);
87430
- var type = (match[2] || "ms").toLowerCase();
87431
- switch (type) {
87432
- case "years":
87433
- case "year":
87434
- case "yrs":
87435
- case "yr":
87436
- case "y":
87437
- return n * y;
87438
- case "weeks":
87439
- case "week":
87440
- case "w":
87441
- return n * w3;
87442
- case "days":
87443
- case "day":
87444
- case "d":
87445
- return n * d2;
87446
- case "hours":
87447
- case "hour":
87448
- case "hrs":
87449
- case "hr":
87450
- case "h":
87451
- return n * h3;
87452
- case "minutes":
87453
- case "minute":
87454
- case "mins":
87455
- case "min":
87456
- case "m":
87457
- return n * m2;
87458
- case "seconds":
87459
- case "second":
87460
- case "secs":
87461
- case "sec":
87462
- case "s":
87463
- return n * s2;
87464
- case "milliseconds":
87465
- case "millisecond":
87466
- case "msecs":
87467
- case "msec":
87468
- case "ms":
87469
- return n;
87470
- default:
87471
- return void 0;
87472
- }
87473
- }
87474
- function fmtShort(ms) {
87475
- var msAbs = Math.abs(ms);
87476
- if (msAbs >= d2) {
87477
- return Math.round(ms / d2) + "d";
87478
- }
87479
- if (msAbs >= h3) {
87480
- return Math.round(ms / h3) + "h";
87481
- }
87482
- if (msAbs >= m2) {
87483
- return Math.round(ms / m2) + "m";
87484
- }
87485
- if (msAbs >= s2) {
87486
- return Math.round(ms / s2) + "s";
87487
- }
87488
- return ms + "ms";
87489
- }
87490
- function fmtLong(ms) {
87491
- var msAbs = Math.abs(ms);
87492
- if (msAbs >= d2) {
87493
- return plural(ms, msAbs, d2, "day");
87494
- }
87495
- if (msAbs >= h3) {
87496
- return plural(ms, msAbs, h3, "hour");
87497
- }
87498
- if (msAbs >= m2) {
87499
- return plural(ms, msAbs, m2, "minute");
87500
- }
87501
- if (msAbs >= s2) {
87502
- return plural(ms, msAbs, s2, "second");
87503
- }
87504
- return ms + " ms";
87505
- }
87506
- function plural(ms, msAbs, n, name) {
87507
- var isPlural = msAbs >= n * 1.5;
87508
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
87509
- }
87510
- }
87511
- });
87512
-
87513
- // ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js
87514
- var require_common2 = __commonJS({
87515
- "../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js"(exports, module) {
87516
- "use strict";
87517
- function setup(env) {
87518
- createDebug.debug = createDebug;
87519
- createDebug.default = createDebug;
87520
- createDebug.coerce = coerce;
87521
- createDebug.disable = disable;
87522
- createDebug.enable = enable;
87523
- createDebug.enabled = enabled;
87524
- createDebug.humanize = require_ms();
87525
- createDebug.destroy = destroy;
87526
- Object.keys(env).forEach((key2) => {
87527
- createDebug[key2] = env[key2];
87528
- });
87529
- createDebug.names = [];
87530
- createDebug.skips = [];
87531
- createDebug.formatters = {};
87532
- function selectColor(namespace) {
87533
- let hash2 = 0;
87534
- for (let i2 = 0; i2 < namespace.length; i2++) {
87535
- hash2 = (hash2 << 5) - hash2 + namespace.charCodeAt(i2);
87536
- hash2 |= 0;
87537
- }
87538
- return createDebug.colors[Math.abs(hash2) % createDebug.colors.length];
87539
- }
87540
- createDebug.selectColor = selectColor;
87541
- function createDebug(namespace) {
87542
- let prevTime;
87543
- let enableOverride = null;
87544
- let namespacesCache;
87545
- let enabledCache;
87546
- function debug(...args) {
87547
- if (!debug.enabled) {
87548
- return;
87549
- }
87550
- const self2 = debug;
87551
- const curr = Number(/* @__PURE__ */ new Date());
87552
- const ms = curr - (prevTime || curr);
87553
- self2.diff = ms;
87554
- self2.prev = prevTime;
87555
- self2.curr = curr;
87556
- prevTime = curr;
87557
- args[0] = createDebug.coerce(args[0]);
87558
- if (typeof args[0] !== "string") {
87559
- args.unshift("%O");
87560
- }
87561
- let index = 0;
87562
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
87563
- if (match === "%%") {
87564
- return "%";
87565
- }
87566
- index++;
87567
- const formatter = createDebug.formatters[format];
87568
- if (typeof formatter === "function") {
87569
- const val = args[index];
87570
- match = formatter.call(self2, val);
87571
- args.splice(index, 1);
87572
- index--;
87573
- }
87574
- return match;
87575
- });
87576
- createDebug.formatArgs.call(self2, args);
87577
- const logFn = self2.log || createDebug.log;
87578
- logFn.apply(self2, args);
87579
- }
87580
- debug.namespace = namespace;
87581
- debug.useColors = createDebug.useColors();
87582
- debug.color = createDebug.selectColor(namespace);
87583
- debug.extend = extend;
87584
- debug.destroy = createDebug.destroy;
87585
- Object.defineProperty(debug, "enabled", {
87586
- enumerable: true,
87587
- configurable: false,
87588
- get: () => {
87589
- if (enableOverride !== null) {
87590
- return enableOverride;
87591
- }
87592
- if (namespacesCache !== createDebug.namespaces) {
87593
- namespacesCache = createDebug.namespaces;
87594
- enabledCache = createDebug.enabled(namespace);
87595
- }
87596
- return enabledCache;
87597
- },
87598
- set: (v2) => {
87599
- enableOverride = v2;
87600
- }
87601
- });
87602
- if (typeof createDebug.init === "function") {
87603
- createDebug.init(debug);
87604
- }
87605
- return debug;
87606
- }
87607
- function extend(namespace, delimiter) {
87608
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
87609
- newDebug.log = this.log;
87610
- return newDebug;
87611
- }
87612
- function enable(namespaces) {
87613
- createDebug.save(namespaces);
87614
- createDebug.namespaces = namespaces;
87615
- createDebug.names = [];
87616
- createDebug.skips = [];
87617
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
87618
- for (const ns of split) {
87619
- if (ns[0] === "-") {
87620
- createDebug.skips.push(ns.slice(1));
87621
- } else {
87622
- createDebug.names.push(ns);
87623
- }
87624
- }
87625
- }
87626
- function matchesTemplate(search, template) {
87627
- let searchIndex = 0;
87628
- let templateIndex = 0;
87629
- let starIndex = -1;
87630
- let matchIndex = 0;
87631
- while (searchIndex < search.length) {
87632
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
87633
- if (template[templateIndex] === "*") {
87634
- starIndex = templateIndex;
87635
- matchIndex = searchIndex;
87636
- templateIndex++;
87637
- } else {
87638
- searchIndex++;
87639
- templateIndex++;
87640
- }
87641
- } else if (starIndex !== -1) {
87642
- templateIndex = starIndex + 1;
87643
- matchIndex++;
87644
- searchIndex = matchIndex;
87645
- } else {
87646
- return false;
87647
- }
87648
- }
87649
- while (templateIndex < template.length && template[templateIndex] === "*") {
87650
- templateIndex++;
87651
- }
87652
- return templateIndex === template.length;
87653
- }
87654
- function disable() {
87655
- const namespaces = [
87656
- ...createDebug.names,
87657
- ...createDebug.skips.map((namespace) => "-" + namespace)
87658
- ].join(",");
87659
- createDebug.enable("");
87660
- return namespaces;
87661
- }
87662
- function enabled(name) {
87663
- for (const skip of createDebug.skips) {
87664
- if (matchesTemplate(name, skip)) {
87665
- return false;
87666
- }
87667
- }
87668
- for (const ns of createDebug.names) {
87669
- if (matchesTemplate(name, ns)) {
87670
- return true;
87671
- }
87672
- }
87673
- return false;
87674
- }
87675
- function coerce(val) {
87676
- if (val instanceof Error) {
87677
- return val.stack || val.message;
87678
- }
87679
- return val;
87680
- }
87681
- function destroy() {
87682
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
87683
- }
87684
- createDebug.enable(createDebug.load());
87685
- return createDebug;
87686
- }
87687
- module.exports = setup;
87688
- }
87689
- });
87690
-
87691
- // ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/browser.js
87692
- var require_browser = __commonJS({
87693
- "../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/browser.js"(exports, module) {
87694
- "use strict";
87695
- exports.formatArgs = formatArgs;
87696
- exports.save = save;
87697
- exports.load = load;
87698
- exports.useColors = useColors;
87699
- exports.storage = localstorage();
87700
- exports.destroy = /* @__PURE__ */ (() => {
87701
- let warned = false;
87702
- return () => {
87703
- if (!warned) {
87704
- warned = true;
87705
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
87706
- }
87707
- };
87708
- })();
87709
- exports.colors = [
87710
- "#0000CC",
87711
- "#0000FF",
87712
- "#0033CC",
87713
- "#0033FF",
87714
- "#0066CC",
87715
- "#0066FF",
87716
- "#0099CC",
87717
- "#0099FF",
87718
- "#00CC00",
87719
- "#00CC33",
87720
- "#00CC66",
87721
- "#00CC99",
87722
- "#00CCCC",
87723
- "#00CCFF",
87724
- "#3300CC",
87725
- "#3300FF",
87726
- "#3333CC",
87727
- "#3333FF",
87728
- "#3366CC",
87729
- "#3366FF",
87730
- "#3399CC",
87731
- "#3399FF",
87732
- "#33CC00",
87733
- "#33CC33",
87734
- "#33CC66",
87735
- "#33CC99",
87736
- "#33CCCC",
87737
- "#33CCFF",
87738
- "#6600CC",
87739
- "#6600FF",
87740
- "#6633CC",
87741
- "#6633FF",
87742
- "#66CC00",
87743
- "#66CC33",
87744
- "#9900CC",
87745
- "#9900FF",
87746
- "#9933CC",
87747
- "#9933FF",
87748
- "#99CC00",
87749
- "#99CC33",
87750
- "#CC0000",
87751
- "#CC0033",
87752
- "#CC0066",
87753
- "#CC0099",
87754
- "#CC00CC",
87755
- "#CC00FF",
87756
- "#CC3300",
87757
- "#CC3333",
87758
- "#CC3366",
87759
- "#CC3399",
87760
- "#CC33CC",
87761
- "#CC33FF",
87762
- "#CC6600",
87763
- "#CC6633",
87764
- "#CC9900",
87765
- "#CC9933",
87766
- "#CCCC00",
87767
- "#CCCC33",
87768
- "#FF0000",
87769
- "#FF0033",
87770
- "#FF0066",
87771
- "#FF0099",
87772
- "#FF00CC",
87773
- "#FF00FF",
87774
- "#FF3300",
87775
- "#FF3333",
87776
- "#FF3366",
87777
- "#FF3399",
87778
- "#FF33CC",
87779
- "#FF33FF",
87780
- "#FF6600",
87781
- "#FF6633",
87782
- "#FF9900",
87783
- "#FF9933",
87784
- "#FFCC00",
87785
- "#FFCC33"
87786
- ];
87787
- function useColors() {
87788
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
87789
- return true;
87790
- }
87791
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
87792
- return false;
87793
- }
87794
- let m2;
87795
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
87796
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
87797
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
87798
- typeof navigator !== "undefined" && navigator.userAgent && (m2 = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m2[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
87799
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
87800
- }
87801
- function formatArgs(args) {
87802
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
87803
- if (!this.useColors) {
87804
- return;
87805
- }
87806
- const c3 = "color: " + this.color;
87807
- args.splice(1, 0, c3, "color: inherit");
87808
- let index = 0;
87809
- let lastC = 0;
87810
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
87811
- if (match === "%%") {
87812
- return;
87813
- }
87814
- index++;
87815
- if (match === "%c") {
87816
- lastC = index;
87817
- }
87818
- });
87819
- args.splice(lastC, 0, c3);
87820
- }
87821
- exports.log = console.debug || console.log || (() => {
87822
- });
87823
- function save(namespaces) {
87824
- try {
87825
- if (namespaces) {
87826
- exports.storage.setItem("debug", namespaces);
87827
- } else {
87828
- exports.storage.removeItem("debug");
87829
- }
87830
- } catch (error) {
87831
- }
87832
- }
87833
- function load() {
87834
- let r2;
87835
- try {
87836
- r2 = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
87837
- } catch (error) {
87838
- }
87839
- if (!r2 && typeof process !== "undefined" && "env" in process) {
87840
- r2 = process.env.DEBUG;
87841
- }
87842
- return r2;
87843
- }
87844
- function localstorage() {
87845
- try {
87846
- return localStorage;
87847
- } catch (error) {
87848
- }
87849
- }
87850
- module.exports = require_common2()(exports);
87851
- var { formatters } = module.exports;
87852
- formatters.j = function(v2) {
87853
- try {
87854
- return JSON.stringify(v2);
87855
- } catch (error) {
87856
- return "[UnexpectedJSONParseError]: " + error.message;
87857
- }
87858
- };
87859
- }
87860
- });
87861
-
87862
- // ../../node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js
87863
- var require_has_flag = __commonJS({
87864
- "../../node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module) {
87865
- "use strict";
87866
- module.exports = (flag, argv2 = process.argv) => {
87867
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
87868
- const position = argv2.indexOf(prefix + flag);
87869
- const terminatorPosition = argv2.indexOf("--");
87870
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
87871
- };
87872
- }
87873
- });
87874
-
87875
- // ../../node_modules/.bun/supports-color@8.1.1/node_modules/supports-color/index.js
87876
- var require_supports_color = __commonJS({
87877
- "../../node_modules/.bun/supports-color@8.1.1/node_modules/supports-color/index.js"(exports, module) {
87878
- "use strict";
87879
- var os = __require("os");
87880
- var tty = __require("tty");
87881
- var hasFlag = require_has_flag();
87882
- var { env } = process;
87883
- var flagForceColor;
87884
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
87885
- flagForceColor = 0;
87886
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
87887
- flagForceColor = 1;
87888
- }
87889
- function envForceColor() {
87890
- if ("FORCE_COLOR" in env) {
87891
- if (env.FORCE_COLOR === "true") {
87892
- return 1;
87893
- }
87894
- if (env.FORCE_COLOR === "false") {
87895
- return 0;
87896
- }
87897
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
87898
- }
87899
- }
87900
- function translateLevel(level) {
87901
- if (level === 0) {
87902
- return false;
87903
- }
87904
- return {
87905
- level,
87906
- hasBasic: true,
87907
- has256: level >= 2,
87908
- has16m: level >= 3
87909
- };
87910
- }
87911
- function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
87912
- const noFlagForceColor = envForceColor();
87913
- if (noFlagForceColor !== void 0) {
87914
- flagForceColor = noFlagForceColor;
87915
- }
87916
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
87917
- if (forceColor === 0) {
87918
- return 0;
87919
- }
87920
- if (sniffFlags) {
87921
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
87922
- return 3;
87923
- }
87924
- if (hasFlag("color=256")) {
87925
- return 2;
87926
- }
87927
- }
87928
- if (haveStream && !streamIsTTY && forceColor === void 0) {
87929
- return 0;
87930
- }
87931
- const min = forceColor || 0;
87932
- if (env.TERM === "dumb") {
87933
- return min;
87934
- }
87935
- if (process.platform === "win32") {
87936
- const osRelease = os.release().split(".");
87937
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
87938
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
87939
- }
87940
- return 1;
87941
- }
87942
- if ("CI" in env) {
87943
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
87944
- return 1;
87945
- }
87946
- return min;
87947
- }
87948
- if ("TEAMCITY_VERSION" in env) {
87949
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
87950
- }
87951
- if (env.COLORTERM === "truecolor") {
87952
- return 3;
87953
- }
87954
- if ("TERM_PROGRAM" in env) {
87955
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
87956
- switch (env.TERM_PROGRAM) {
87957
- case "iTerm.app":
87958
- return version >= 3 ? 3 : 2;
87959
- case "Apple_Terminal":
87960
- return 2;
87961
- }
87962
- }
87963
- if (/-256(color)?$/i.test(env.TERM)) {
87964
- return 2;
87965
- }
87966
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
87967
- return 1;
87968
- }
87969
- if ("COLORTERM" in env) {
87970
- return 1;
87971
- }
87972
- return min;
87973
- }
87974
- function getSupportLevel(stream, options = {}) {
87975
- const level = supportsColor(stream, {
87976
- streamIsTTY: stream && stream.isTTY,
87977
- ...options
87978
- });
87979
- return translateLevel(level);
87980
- }
87981
- module.exports = {
87982
- supportsColor: getSupportLevel,
87983
- stdout: getSupportLevel({ isTTY: tty.isatty(1) }),
87984
- stderr: getSupportLevel({ isTTY: tty.isatty(2) })
87985
- };
87986
- }
87987
- });
87988
-
87989
- // ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js
87990
- var require_node = __commonJS({
87991
- "../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js"(exports, module) {
87992
- "use strict";
87993
- var tty = __require("tty");
87994
- var util = __require("util");
87995
- exports.init = init;
87996
- exports.log = log2;
87997
- exports.formatArgs = formatArgs;
87998
- exports.save = save;
87999
- exports.load = load;
88000
- exports.useColors = useColors;
88001
- exports.destroy = util.deprecate(
88002
- () => {
88003
- },
88004
- "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
88005
- );
88006
- exports.colors = [6, 2, 3, 4, 5, 1];
88007
- try {
88008
- const supportsColor = require_supports_color();
88009
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
88010
- exports.colors = [
88011
- 20,
88012
- 21,
88013
- 26,
88014
- 27,
88015
- 32,
88016
- 33,
88017
- 38,
88018
- 39,
88019
- 40,
88020
- 41,
88021
- 42,
88022
- 43,
88023
- 44,
88024
- 45,
88025
- 56,
88026
- 57,
88027
- 62,
88028
- 63,
88029
- 68,
88030
- 69,
88031
- 74,
88032
- 75,
88033
- 76,
88034
- 77,
88035
- 78,
88036
- 79,
88037
- 80,
88038
- 81,
88039
- 92,
88040
- 93,
88041
- 98,
88042
- 99,
88043
- 112,
88044
- 113,
88045
- 128,
88046
- 129,
88047
- 134,
88048
- 135,
88049
- 148,
88050
- 149,
88051
- 160,
88052
- 161,
88053
- 162,
88054
- 163,
88055
- 164,
88056
- 165,
88057
- 166,
88058
- 167,
88059
- 168,
88060
- 169,
88061
- 170,
88062
- 171,
88063
- 172,
88064
- 173,
88065
- 178,
88066
- 179,
88067
- 184,
88068
- 185,
88069
- 196,
88070
- 197,
88071
- 198,
88072
- 199,
88073
- 200,
88074
- 201,
88075
- 202,
88076
- 203,
88077
- 204,
88078
- 205,
88079
- 206,
88080
- 207,
88081
- 208,
88082
- 209,
88083
- 214,
88084
- 215,
88085
- 220,
88086
- 221
88087
- ];
88088
- }
88089
- } catch (error) {
88090
- }
88091
- exports.inspectOpts = Object.keys(process.env).filter((key2) => {
88092
- return /^debug_/i.test(key2);
88093
- }).reduce((obj, key2) => {
88094
- const prop2 = key2.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k2) => {
88095
- return k2.toUpperCase();
88096
- });
88097
- let val = process.env[key2];
88098
- if (/^(yes|on|true|enabled)$/i.test(val)) {
88099
- val = true;
88100
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
88101
- val = false;
88102
- } else if (val === "null") {
88103
- val = null;
88104
- } else {
88105
- val = Number(val);
88106
- }
88107
- obj[prop2] = val;
88108
- return obj;
88109
- }, {});
88110
- function useColors() {
88111
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
88112
- }
88113
- function formatArgs(args) {
88114
- const { namespace: name, useColors: useColors2 } = this;
88115
- if (useColors2) {
88116
- const c3 = this.color;
88117
- const colorCode = "\x1B[3" + (c3 < 8 ? c3 : "8;5;" + c3);
88118
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
88119
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
88120
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
88121
- } else {
88122
- args[0] = getDate() + name + " " + args[0];
88123
- }
88124
- }
88125
- function getDate() {
88126
- if (exports.inspectOpts.hideDate) {
88127
- return "";
88128
- }
88129
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
88130
- }
88131
- function log2(...args) {
88132
- return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
88133
- }
88134
- function save(namespaces) {
88135
- if (namespaces) {
88136
- process.env.DEBUG = namespaces;
88137
- } else {
88138
- delete process.env.DEBUG;
88139
- }
88140
- }
88141
- function load() {
88142
- return process.env.DEBUG;
88143
- }
88144
- function init(debug) {
88145
- debug.inspectOpts = {};
88146
- const keys2 = Object.keys(exports.inspectOpts);
88147
- for (let i2 = 0; i2 < keys2.length; i2++) {
88148
- debug.inspectOpts[keys2[i2]] = exports.inspectOpts[keys2[i2]];
88149
- }
88150
- }
88151
- module.exports = require_common2()(exports);
88152
- var { formatters } = module.exports;
88153
- formatters.o = function(v2) {
88154
- this.inspectOpts.colors = this.useColors;
88155
- return util.inspect(v2, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
88156
- };
88157
- formatters.O = function(v2) {
88158
- this.inspectOpts.colors = this.useColors;
88159
- return util.inspect(v2, this.inspectOpts);
88160
- };
88161
- }
88162
- });
88163
-
88164
- // ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/index.js
88165
- var require_src2 = __commonJS({
88166
- "../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/index.js"(exports, module) {
88167
- "use strict";
88168
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
88169
- module.exports = require_browser();
88170
- } else {
88171
- module.exports = require_node();
88172
- }
88173
- }
88174
- });
88175
-
88176
87583
  // ../../node_modules/.bun/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
88177
87584
  var require_helpers = __commonJS({
88178
87585
  "../../node_modules/.bun/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(exports) {
@@ -88408,7 +87815,7 @@ var require_parse_proxy_response = __commonJS({
88408
87815
  };
88409
87816
  Object.defineProperty(exports, "__esModule", { value: true });
88410
87817
  exports.parseProxyResponse = void 0;
88411
- var debug_1 = __importDefault2(require_src2());
87818
+ var debug_1 = __importDefault2(__require("debug"));
88412
87819
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
88413
87820
  function parseProxyResponse(socket) {
88414
87821
  return new Promise((resolve48, reject) => {
@@ -88534,7 +87941,7 @@ var require_dist2 = __commonJS({
88534
87941
  var net2 = __importStar2(__require("net"));
88535
87942
  var tls = __importStar2(__require("tls"));
88536
87943
  var assert_1 = __importDefault2(__require("assert"));
88537
- var debug_1 = __importDefault2(require_src2());
87944
+ var debug_1 = __importDefault2(__require("debug"));
88538
87945
  var agent_base_1 = require_dist();
88539
87946
  var url_1 = __require("url");
88540
87947
  var parse_proxy_response_1 = require_parse_proxy_response();
@@ -95628,7 +95035,7 @@ Content-Type: ${partContentType}\r
95628
95035
  });
95629
95036
 
95630
95037
  // ../../node_modules/.bun/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/index.js
95631
- var require_src3 = __commonJS({
95038
+ var require_src2 = __commonJS({
95632
95039
  "../../node_modules/.bun/gaxios@7.1.4/node_modules/gaxios/build/cjs/src/index.js"(exports) {
95633
95040
  "use strict";
95634
95041
  var __createBinding2 = exports && exports.__createBinding || (Object.create ? (function(o, m2, k2, k22) {
@@ -97836,7 +97243,7 @@ var require_logging_utils = __commonJS({
97836
97243
  });
97837
97244
 
97838
97245
  // ../../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/index.js
97839
- var require_src4 = __commonJS({
97246
+ var require_src3 = __commonJS({
97840
97247
  "../../node_modules/.bun/google-logging-utils@1.1.3/node_modules/google-logging-utils/build/src/index.js"(exports) {
97841
97248
  "use strict";
97842
97249
  var __createBinding2 = exports && exports.__createBinding || (Object.create ? (function(o, m2, k2, k22) {
@@ -97861,7 +97268,7 @@ var require_src4 = __commonJS({
97861
97268
  });
97862
97269
 
97863
97270
  // ../../node_modules/.bun/gcp-metadata@8.1.2/node_modules/gcp-metadata/build/src/index.js
97864
- var require_src5 = __commonJS({
97271
+ var require_src4 = __commonJS({
97865
97272
  "../../node_modules/.bun/gcp-metadata@8.1.2/node_modules/gcp-metadata/build/src/index.js"(exports) {
97866
97273
  "use strict";
97867
97274
  var __createBinding2 = exports && exports.__createBinding || (Object.create ? (function(o, m2, k2, k22) {
@@ -97915,10 +97322,10 @@ var require_src5 = __commonJS({
97915
97322
  exports.getGCPResidency = getGCPResidency;
97916
97323
  exports.setGCPResidency = setGCPResidency;
97917
97324
  exports.requestTimeout = requestTimeout;
97918
- var gaxios_1 = require_src3();
97325
+ var gaxios_1 = require_src2();
97919
97326
  var jsonBigint = require_json_bigint();
97920
97327
  var gcp_residency_1 = require_gcp_residency();
97921
- var logger = __importStar2(require_src4());
97328
+ var logger = __importStar2(require_src3());
97922
97329
  exports.BASE_PATH = "/computeMetadata/v1";
97923
97330
  exports.HOST_ADDRESS = "http://169.254.169.254";
97924
97331
  exports.SECONDARY_HOST_ADDRESS = "http://metadata.google.internal.";
@@ -98893,9 +98300,9 @@ var require_authclient = __commonJS({
98893
98300
  Object.defineProperty(exports, "__esModule", { value: true });
98894
98301
  exports.AuthClient = exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS = exports.DEFAULT_UNIVERSE = void 0;
98895
98302
  var events_1 = __require("events");
98896
- var gaxios_1 = require_src3();
98303
+ var gaxios_1 = require_src2();
98897
98304
  var util_1 = require_util4();
98898
- var google_logging_utils_1 = require_src4();
98305
+ var google_logging_utils_1 = require_src3();
98899
98306
  var shared_cjs_1 = require_shared3();
98900
98307
  exports.DEFAULT_UNIVERSE = "googleapis.com";
98901
98308
  exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS = 5 * 60 * 1e3;
@@ -99179,7 +98586,7 @@ var require_oauth2client = __commonJS({
99179
98586
  "use strict";
99180
98587
  Object.defineProperty(exports, "__esModule", { value: true });
99181
98588
  exports.OAuth2Client = exports.ClientAuthentication = exports.CertificateFormat = exports.CodeChallengeMethod = void 0;
99182
- var gaxios_1 = require_src3();
98589
+ var gaxios_1 = require_src2();
99183
98590
  var querystring = __require("querystring");
99184
98591
  var stream = __require("stream");
99185
98592
  var formatEcdsa = require_ecdsa_sig_formatter();
@@ -99860,8 +99267,8 @@ var require_computeclient = __commonJS({
99860
99267
  "use strict";
99861
99268
  Object.defineProperty(exports, "__esModule", { value: true });
99862
99269
  exports.Compute = void 0;
99863
- var gaxios_1 = require_src3();
99864
- var gcpMetadata = require_src5();
99270
+ var gaxios_1 = require_src2();
99271
+ var gcpMetadata = require_src4();
99865
99272
  var oauth2client_1 = require_oauth2client();
99866
99273
  var Compute = class extends oauth2client_1.OAuth2Client {
99867
99274
  serviceAccountEmail;
@@ -100000,7 +99407,7 @@ var require_envDetect = __commonJS({
100000
99407
  exports.GCPEnv = void 0;
100001
99408
  exports.clear = clear;
100002
99409
  exports.getEnv = getEnv2;
100003
- var gcpMetadata = require_src5();
99410
+ var gcpMetadata = require_src4();
100004
99411
  var GCPEnv;
100005
99412
  (function(GCPEnv2) {
100006
99413
  GCPEnv2["APP_ENGINE"] = "APP_ENGINE";
@@ -100929,7 +100336,7 @@ var require_googleToken = __commonJS({
100929
100336
  "use strict";
100930
100337
  Object.defineProperty(exports, "__esModule", { value: true });
100931
100338
  exports.GoogleToken = void 0;
100932
- var gaxios_1 = require_src3();
100339
+ var gaxios_1 = require_src2();
100933
100340
  var tokenHandler_1 = require_tokenHandler();
100934
100341
  var revokeToken_1 = require_revokeToken();
100935
100342
  var GoogleToken = class {
@@ -101606,7 +101013,7 @@ var require_impersonated = __commonJS({
101606
101013
  Object.defineProperty(exports, "__esModule", { value: true });
101607
101014
  exports.Impersonated = exports.IMPERSONATED_ACCOUNT_TYPE = void 0;
101608
101015
  var oauth2client_1 = require_oauth2client();
101609
- var gaxios_1 = require_src3();
101016
+ var gaxios_1 = require_src2();
101610
101017
  var util_1 = require_util4();
101611
101018
  exports.IMPERSONATED_ACCOUNT_TYPE = "impersonated_service_account";
101612
101019
  var Impersonated = class _Impersonated extends oauth2client_1.OAuth2Client {
@@ -101785,7 +101192,7 @@ var require_oauth2common = __commonJS({
101785
101192
  Object.defineProperty(exports, "__esModule", { value: true });
101786
101193
  exports.OAuthClientAuthHandler = void 0;
101787
101194
  exports.getErrorFromOAuthErrorResponse = getErrorFromOAuthErrorResponse;
101788
- var gaxios_1 = require_src3();
101195
+ var gaxios_1 = require_src2();
101789
101196
  var crypto_1 = require_crypto3();
101790
101197
  var METHODS_SUPPORTING_REQUEST_BODY = ["PUT", "POST", "PATCH"];
101791
101198
  var OAuthClientAuthHandler = class {
@@ -101932,7 +101339,7 @@ var require_stscredentials = __commonJS({
101932
101339
  "use strict";
101933
101340
  Object.defineProperty(exports, "__esModule", { value: true });
101934
101341
  exports.StsCredentials = void 0;
101935
- var gaxios_1 = require_src3();
101342
+ var gaxios_1 = require_src2();
101936
101343
  var authclient_1 = require_authclient();
101937
101344
  var oauth2common_1 = require_oauth2common();
101938
101345
  var util_1 = require_util4();
@@ -102020,7 +101427,7 @@ var require_baseexternalclient = __commonJS({
102020
101427
  "use strict";
102021
101428
  Object.defineProperty(exports, "__esModule", { value: true });
102022
101429
  exports.BaseExternalAccountClient = exports.CLOUD_RESOURCE_MANAGER = exports.EXTERNAL_ACCOUNT_TYPE = exports.EXPIRATION_TIME_OFFSET = void 0;
102023
- var gaxios_1 = require_src3();
101430
+ var gaxios_1 = require_src2();
102024
101431
  var stream = __require("stream");
102025
101432
  var authclient_1 = require_authclient();
102026
101433
  var sts = require_stscredentials();
@@ -102712,7 +102119,7 @@ var require_identitypoolclient = __commonJS({
102712
102119
  var urlsubjecttokensupplier_1 = require_urlsubjecttokensupplier();
102713
102120
  var certificatesubjecttokensupplier_1 = require_certificatesubjecttokensupplier();
102714
102121
  var stscredentials_1 = require_stscredentials();
102715
- var gaxios_1 = require_src3();
102122
+ var gaxios_1 = require_src2();
102716
102123
  var IdentityPoolClient = class _IdentityPoolClient extends baseexternalclient_1.BaseExternalAccountClient {
102717
102124
  subjectTokenSupplier;
102718
102125
  /**
@@ -102818,7 +102225,7 @@ var require_awsrequestsigner = __commonJS({
102818
102225
  "use strict";
102819
102226
  Object.defineProperty(exports, "__esModule", { value: true });
102820
102227
  exports.AwsRequestSigner = void 0;
102821
- var gaxios_1 = require_src3();
102228
+ var gaxios_1 = require_src2();
102822
102229
  var crypto_1 = require_crypto3();
102823
102230
  var AWS_ALGORITHM = "AWS4-HMAC-SHA256";
102824
102231
  var AWS_REQUEST_TYPE = "aws4_request";
@@ -103127,7 +102534,7 @@ var require_awsclient = __commonJS({
103127
102534
  var baseexternalclient_1 = require_baseexternalclient();
103128
102535
  var defaultawssecuritycredentialssupplier_1 = require_defaultawssecuritycredentialssupplier();
103129
102536
  var util_1 = require_util4();
103130
- var gaxios_1 = require_src3();
102537
+ var gaxios_1 = require_src2();
103131
102538
  var AwsClient = class _AwsClient extends baseexternalclient_1.BaseExternalAccountClient {
103132
102539
  environmentId;
103133
102540
  awsSecurityCredentialsSupplier;
@@ -103687,7 +103094,7 @@ var require_externalAccountAuthorizedUserClient = __commonJS({
103687
103094
  exports.ExternalAccountAuthorizedUserClient = exports.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE = void 0;
103688
103095
  var authclient_1 = require_authclient();
103689
103096
  var oauth2common_1 = require_oauth2common();
103690
- var gaxios_1 = require_src3();
103097
+ var gaxios_1 = require_src2();
103691
103098
  var stream = __require("stream");
103692
103099
  var baseexternalclient_1 = require_baseexternalclient();
103693
103100
  exports.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE = "external_account_authorized_user";
@@ -103874,8 +103281,8 @@ var require_googleauth = __commonJS({
103874
103281
  exports.GoogleAuth = exports.GoogleAuthExceptionMessages = void 0;
103875
103282
  var child_process_1 = __require("child_process");
103876
103283
  var fs5 = __require("fs");
103877
- var gaxios_1 = require_src3();
103878
- var gcpMetadata = require_src5();
103284
+ var gaxios_1 = require_src2();
103285
+ var gcpMetadata = require_src4();
103879
103286
  var os = __require("os");
103880
103287
  var path2 = __require("path");
103881
103288
  var crypto_1 = require_crypto3();
@@ -104698,7 +104105,7 @@ var require_downscopedclient = __commonJS({
104698
104105
  "use strict";
104699
104106
  Object.defineProperty(exports, "__esModule", { value: true });
104700
104107
  exports.DownscopedClient = exports.EXPIRATION_TIME_OFFSET = exports.MAX_ACCESS_BOUNDARY_RULES_COUNT = void 0;
104701
- var gaxios_1 = require_src3();
104108
+ var gaxios_1 = require_src2();
104702
104109
  var stream = __require("stream");
104703
104110
  var authclient_1 = require_authclient();
104704
104111
  var sts = require_stscredentials();
@@ -104923,7 +104330,7 @@ var require_passthrough = __commonJS({
104923
104330
  });
104924
104331
 
104925
104332
  // ../../node_modules/.bun/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/index.js
104926
- var require_src6 = __commonJS({
104333
+ var require_src5 = __commonJS({
104927
104334
  "../../node_modules/.bun/google-auth-library@10.6.2/node_modules/google-auth-library/build/src/index.js"(exports) {
104928
104335
  "use strict";
104929
104336
  var __createBinding2 = exports && exports.__createBinding || (Object.create ? (function(o, m2, k2, k22) {
@@ -104948,8 +104355,8 @@ var require_src6 = __commonJS({
104948
104355
  Object.defineProperty(exports, "GoogleAuth", { enumerable: true, get: function() {
104949
104356
  return googleauth_1.GoogleAuth;
104950
104357
  } });
104951
- exports.gcpMetadata = require_src5();
104952
- exports.gaxios = require_src3();
104358
+ exports.gcpMetadata = require_src4();
104359
+ exports.gaxios = require_src2();
104953
104360
  var authclient_1 = require_authclient();
104954
104361
  Object.defineProperty(exports, "AuthClient", { enumerable: true, get: function() {
104955
104362
  return authclient_1.AuthClient;
@@ -119683,7 +119090,7 @@ var init_node4 = __esm({
119683
119090
  "../../node_modules/.bun/@google+genai@1.52.0/node_modules/@google/genai/dist/node/index.mjs"() {
119684
119091
  "use strict";
119685
119092
  import_p_retry = __toESM(require_p_retry(), 1);
119686
- import_google_auth_library = __toESM(require_src6(), 1);
119093
+ import_google_auth_library = __toESM(require_src5(), 1);
119687
119094
  init_wrapper();
119688
119095
  _defaultBaseGeminiUrl = void 0;
119689
119096
  _defaultBaseVertexUrl = void 0;
@@ -135547,6 +134954,15 @@ init_dist();
135547
134954
  import { dirname as dirname35, join as join91 } from "path";
135548
134955
  import { fileURLToPath as fileURLToPath12 } from "url";
135549
134956
  import { existsSync as existsSync82 } from "fs";
134957
+ var commandFailed = false;
134958
+ for (const stream of [process.stdout, process.stderr]) {
134959
+ stream.on("error", (err) => {
134960
+ if (err.code === "EPIPE") {
134961
+ commandFailed = true;
134962
+ process.exit(0);
134963
+ }
134964
+ });
134965
+ }
135550
134966
  (() => {
135551
134967
  const here = dirname35(fileURLToPath12(import.meta.url));
135552
134968
  const shader = join91(here, "shaderTransitionWorker.js");
@@ -135663,7 +135079,6 @@ if (!isHelp && !hasJsonFlag && command !== "upgrade") {
135663
135079
  });
135664
135080
  }
135665
135081
  var commandStart = Date.now();
135666
- var commandFailed = false;
135667
135082
  process.once("beforeExit", () => {
135668
135083
  _flush?.().catch(() => {
135669
135084
  });
@@ -135679,6 +135094,10 @@ process.on("exit", (code) => {
135679
135094
  _flushSync?.();
135680
135095
  });
135681
135096
  process.on("uncaughtException", (error) => {
135097
+ if (error.code === "EPIPE") {
135098
+ commandFailed = true;
135099
+ process.exit(0);
135100
+ }
135682
135101
  commandFailed = true;
135683
135102
  _trackCliError?.({
135684
135103
  error_name: error.name,