hyperframes 0.8.0 → 0.8.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
@@ -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.8.0" : "0.0.0-dev";
53
+ VERSION = true ? "0.8.1" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -783,19 +783,19 @@ function __awaiter(thisArg, _arguments, P2, generator) {
783
783
  resolve77(value);
784
784
  });
785
785
  }
786
- return new (P2 || (P2 = Promise))(function(resolve77, reject) {
786
+ return new (P2 || (P2 = Promise))(function(resolve77, reject2) {
787
787
  function fulfilled(value) {
788
788
  try {
789
789
  step(generator.next(value));
790
790
  } catch (e3) {
791
- reject(e3);
791
+ reject2(e3);
792
792
  }
793
793
  }
794
794
  function rejected(value) {
795
795
  try {
796
796
  step(generator["throw"](value));
797
797
  } catch (e3) {
798
- reject(e3);
798
+ reject2(e3);
799
799
  }
800
800
  }
801
801
  function step(result) {
@@ -936,7 +936,7 @@ function __asyncGenerator(thisArg, _arguments, generator) {
936
936
  }, i2;
937
937
  function awaitReturn(f3) {
938
938
  return function(v2) {
939
- return Promise.resolve(v2).then(f3, reject);
939
+ return Promise.resolve(v2).then(f3, reject2);
940
940
  };
941
941
  }
942
942
  function verb(n2, f3) {
@@ -957,12 +957,12 @@ function __asyncGenerator(thisArg, _arguments, generator) {
957
957
  }
958
958
  }
959
959
  function step(r2) {
960
- r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q2[0][2], r2);
960
+ r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject2) : settle(q2[0][2], r2);
961
961
  }
962
962
  function fulfill(value) {
963
963
  resume("next", value);
964
964
  }
965
- function reject(value) {
965
+ function reject2(value) {
966
966
  resume("throw", value);
967
967
  }
968
968
  function settle(f3, v2) {
@@ -990,15 +990,15 @@ function __asyncValues(o) {
990
990
  }, i2);
991
991
  function verb(n2) {
992
992
  i2[n2] = o[n2] && function(v2) {
993
- return new Promise(function(resolve77, reject) {
994
- v2 = o[n2](v2), settle(resolve77, reject, v2.done, v2.value);
993
+ return new Promise(function(resolve77, reject2) {
994
+ v2 = o[n2](v2), settle(resolve77, reject2, v2.done, v2.value);
995
995
  });
996
996
  };
997
997
  }
998
- function settle(resolve77, reject, d2, v2) {
998
+ function settle(resolve77, reject2, d2, v2) {
999
999
  Promise.resolve(v2).then(function(v3) {
1000
1000
  resolve77({ value: v3, done: d2 });
1001
- }, reject);
1001
+ }, reject2);
1002
1002
  }
1003
1003
  }
1004
1004
  function __makeTemplateObject(cooked, raw) {
@@ -28077,14 +28077,14 @@ var require_lib = __commonJS({
28077
28077
  };
28078
28078
  var mixinPluginNames = Object.keys(mixinPlugins);
28079
28079
  var ExpressionParser = class extends LValParser {
28080
- checkProto(prop2, isRecord21, sawProto, refExpressionErrors) {
28080
+ checkProto(prop2, isRecord23, sawProto, refExpressionErrors) {
28081
28081
  if (prop2.type === "SpreadElement" || this.isObjectMethod(prop2) || prop2.computed || prop2.shorthand) {
28082
28082
  return sawProto;
28083
28083
  }
28084
28084
  const key2 = prop2.key;
28085
28085
  const name = key2.type === "Identifier" ? key2.name : key2.value;
28086
28086
  if (name === "__proto__") {
28087
- if (isRecord21) {
28087
+ if (isRecord23) {
28088
28088
  this.raise(Errors.RecordNoProto, key2);
28089
28089
  return true;
28090
28090
  }
@@ -29142,8 +29142,8 @@ var require_lib = __commonJS({
29142
29142
  parseTemplateSubstitution() {
29143
29143
  return this.parseExpression();
29144
29144
  }
29145
- parseObjectLike(close, isPattern, isRecord21, refExpressionErrors) {
29146
- if (isRecord21) {
29145
+ parseObjectLike(close, isPattern, isRecord23, refExpressionErrors) {
29146
+ if (isRecord23) {
29147
29147
  this.expectPlugin("recordAndTuple");
29148
29148
  }
29149
29149
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
@@ -29168,9 +29168,9 @@ var require_lib = __commonJS({
29168
29168
  prop2 = this.parseBindingProperty();
29169
29169
  } else {
29170
29170
  prop2 = this.parsePropertyDefinition(refExpressionErrors);
29171
- sawProto = this.checkProto(prop2, isRecord21, sawProto, refExpressionErrors);
29171
+ sawProto = this.checkProto(prop2, isRecord23, sawProto, refExpressionErrors);
29172
29172
  }
29173
- if (isRecord21 && !this.isObjectProperty(prop2) && prop2.type !== "SpreadElement") {
29173
+ if (isRecord23 && !this.isObjectProperty(prop2) && prop2.type !== "SpreadElement") {
29174
29174
  this.raise(Errors.InvalidRecordProperty, prop2);
29175
29175
  }
29176
29176
  if (prop2.shorthand) {
@@ -29183,7 +29183,7 @@ var require_lib = __commonJS({
29183
29183
  let type = "ObjectExpression";
29184
29184
  if (isPattern) {
29185
29185
  type = "ObjectPattern";
29186
- } else if (isRecord21) {
29186
+ } else if (isRecord23) {
29187
29187
  type = "RecordExpression";
29188
29188
  }
29189
29189
  return this.finishNode(node, type);
@@ -40807,7 +40807,7 @@ function formatAttributes(attributes2, opts) {
40807
40807
  var _a4;
40808
40808
  if (!attributes2)
40809
40809
  return;
40810
- const encode3 = ((_a4 = opts.encodeEntities) !== null && _a4 !== void 0 ? _a4 : opts.decodeEntities) === false ? replaceQuotes : opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML : escapeAttribute;
40810
+ const encode4 = ((_a4 = opts.encodeEntities) !== null && _a4 !== void 0 ? _a4 : opts.decodeEntities) === false ? replaceQuotes : opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML : escapeAttribute;
40811
40811
  return Object.keys(attributes2).map((key2) => {
40812
40812
  var _a5, _b;
40813
40813
  const value = (_a5 = attributes2[key2]) !== null && _a5 !== void 0 ? _a5 : "";
@@ -40817,7 +40817,7 @@ function formatAttributes(attributes2, opts) {
40817
40817
  if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
40818
40818
  return key2;
40819
40819
  }
40820
- return `${key2}="${encode3(value)}"`;
40820
+ return `${key2}="${encode4(value)}"`;
40821
40821
  }).join(" ");
40822
40822
  }
40823
40823
  function render(node, options = {}) {
@@ -65186,9 +65186,9 @@ async function awaitBeforeDeadline(operation, deadline, label2) {
65186
65186
  try {
65187
65187
  return await Promise.race([
65188
65188
  operation,
65189
- new Promise((_, reject) => {
65189
+ new Promise((_, reject2) => {
65190
65190
  timeout = setTimeout(
65191
- () => reject(new Error(`beginFrame probe timeout during ${label2}`)),
65191
+ () => reject2(new Error(`beginFrame probe timeout during ${label2}`)),
65192
65192
  remainingMs
65193
65193
  );
65194
65194
  })
@@ -66511,10 +66511,10 @@ async function produceDrawElementFrame(page, width, height, quality = 80, syncTo
66511
66511
  );
66512
66512
  }
66513
66513
  const frameId = ++state.nextId;
66514
- const encodeResult = new Promise((resolve77, reject) => {
66514
+ const encodeResult = new Promise((resolve77, reject2) => {
66515
66515
  const timer = setTimeout(() => {
66516
66516
  if (state.pending.delete(frameId)) {
66517
- reject(new Error(`drawElement worker encode timed out (frame ${frameId})`));
66517
+ reject2(new Error(`drawElement worker encode timed out (frame ${frameId})`));
66518
66518
  }
66519
66519
  }, 3e4);
66520
66520
  state.pending.set(frameId, {
@@ -66524,7 +66524,7 @@ async function produceDrawElementFrame(page, width, height, quality = 80, syncTo
66524
66524
  },
66525
66525
  reject: (e3) => {
66526
66526
  clearTimeout(timer);
66527
- reject(e3);
66527
+ reject2(e3);
66528
66528
  }
66529
66529
  });
66530
66530
  });
@@ -66671,10 +66671,10 @@ async function produceDrawElementFrameBatch(page, times, width, height, quality
66671
66671
  for (let i2 = 0; i2 < times.length; i2++) {
66672
66672
  const frameId = ++state.nextId;
66673
66673
  fids.push(frameId);
66674
- const p2 = new Promise((resolve77, reject) => {
66674
+ const p2 = new Promise((resolve77, reject2) => {
66675
66675
  const timer = setTimeout(() => {
66676
66676
  if (state.pending.delete(frameId)) {
66677
- reject(new Error(`drawElement worker encode timed out (frame ${frameId})`));
66677
+ reject2(new Error(`drawElement worker encode timed out (frame ${frameId})`));
66678
66678
  }
66679
66679
  }, 3e4);
66680
66680
  state.pending.set(frameId, {
@@ -66684,7 +66684,7 @@ async function produceDrawElementFrameBatch(page, times, width, height, quality
66684
66684
  },
66685
66685
  reject: (e3) => {
66686
66686
  clearTimeout(timer);
66687
- reject(e3);
66687
+ reject2(e3);
66688
66688
  }
66689
66689
  });
66690
66690
  });
@@ -66951,10 +66951,10 @@ async function initThreeDProjectionInPage() {
66951
66951
  const toDataUrl = async (url) => {
66952
66952
  const resp = await fetch(url);
66953
66953
  const blob = await resp.blob();
66954
- return new Promise((resolve77, reject) => {
66954
+ return new Promise((resolve77, reject2) => {
66955
66955
  const r2 = new FileReader();
66956
66956
  r2.onload = () => resolve77(String(r2.result));
66957
- r2.onerror = () => reject(new Error(`FileReader failed for ${url}`));
66957
+ r2.onerror = () => reject2(new Error(`FileReader failed for ${url}`));
66958
66958
  r2.readAsDataURL(blob);
66959
66959
  });
66960
66960
  };
@@ -67752,7 +67752,7 @@ function getDrawElementVerificationDetails(err) {
67752
67752
  async function decodeDynamicCssBackgroundImages(page) {
67753
67753
  await page.evaluate(async () => {
67754
67754
  const root = globalThis;
67755
- const decode = root.__hfDecodeDynamicCssBackgroundImages ??= async () => {
67755
+ const decode2 = root.__hfDecodeDynamicCssBackgroundImages ??= async () => {
67756
67756
  const decoded = root.__hf_css_background_decoded ??= /* @__PURE__ */ new Set();
67757
67757
  const urls = [];
67758
67758
  const parseBackgroundUrls = (value) => {
@@ -67813,7 +67813,7 @@ async function decodeDynamicCssBackgroundImages(page) {
67813
67813
  })
67814
67814
  );
67815
67815
  };
67816
- await decode();
67816
+ await decode2();
67817
67817
  });
67818
67818
  }
67819
67819
  function appendBrowserDiagnostic(session, text2) {
@@ -71599,12 +71599,12 @@ function createFrameReorderBuffer(startFrame, endFrame) {
71599
71599
  let cursor = startFrame;
71600
71600
  let aborted = null;
71601
71601
  const pending = /* @__PURE__ */ new Map();
71602
- const enqueueAt = (frame, resolve77, reject) => {
71602
+ const enqueueAt = (frame, resolve77, reject2) => {
71603
71603
  const list = pending.get(frame);
71604
71604
  if (list === void 0) {
71605
- pending.set(frame, [{ resolve: resolve77, reject }]);
71605
+ pending.set(frame, [{ resolve: resolve77, reject: reject2 }]);
71606
71606
  } else {
71607
- list.push({ resolve: resolve77, reject });
71607
+ list.push({ resolve: resolve77, reject: reject2 });
71608
71608
  }
71609
71609
  };
71610
71610
  const flushAt = (frame) => {
@@ -71613,31 +71613,31 @@ function createFrameReorderBuffer(startFrame, endFrame) {
71613
71613
  pending.delete(frame);
71614
71614
  for (const waiter of list) waiter.resolve();
71615
71615
  };
71616
- const waitForFrame = (frame) => new Promise((resolve77, reject) => {
71616
+ const waitForFrame = (frame) => new Promise((resolve77, reject2) => {
71617
71617
  if (aborted) {
71618
- reject(aborted);
71618
+ reject2(aborted);
71619
71619
  return;
71620
71620
  }
71621
71621
  if (frame === cursor) {
71622
71622
  resolve77();
71623
71623
  return;
71624
71624
  }
71625
- enqueueAt(frame, resolve77, reject);
71625
+ enqueueAt(frame, resolve77, reject2);
71626
71626
  });
71627
71627
  const advanceTo = (frame) => {
71628
71628
  cursor = frame;
71629
71629
  flushAt(frame);
71630
71630
  };
71631
- const waitForAllDone = () => new Promise((resolve77, reject) => {
71631
+ const waitForAllDone = () => new Promise((resolve77, reject2) => {
71632
71632
  if (aborted) {
71633
- reject(aborted);
71633
+ reject2(aborted);
71634
71634
  return;
71635
71635
  }
71636
71636
  if (cursor >= endFrame) {
71637
71637
  resolve77();
71638
71638
  return;
71639
71639
  }
71640
- enqueueAt(endFrame, resolve77, reject);
71640
+ enqueueAt(endFrame, resolve77, reject2);
71641
71641
  });
71642
71642
  const abort = (err) => {
71643
71643
  if (aborted) return;
@@ -72168,7 +72168,7 @@ async function waitForCacheLock(signal) {
72168
72168
  if (signal?.aborted) {
72169
72169
  throw new UrlDownloadError("cancelled", false, "Download cancelled");
72170
72170
  }
72171
- await new Promise((resolve77, reject) => {
72171
+ await new Promise((resolve77, reject2) => {
72172
72172
  const timeout = setTimeout(() => {
72173
72173
  signal?.removeEventListener("abort", onAbort);
72174
72174
  resolve77();
@@ -72176,7 +72176,7 @@ async function waitForCacheLock(signal) {
72176
72176
  const onAbort = () => {
72177
72177
  clearTimeout(timeout);
72178
72178
  signal?.removeEventListener("abort", onAbort);
72179
- reject(new UrlDownloadError("cancelled", false, "Download cancelled"));
72179
+ reject2(new UrlDownloadError("cancelled", false, "Download cancelled"));
72180
72180
  };
72181
72181
  signal?.addEventListener("abort", onAbort, { once: true });
72182
72182
  });
@@ -73092,7 +73092,21 @@ function resolveAliasDisplayName2(alias) {
73092
73092
  if (!slug) return void 0;
73093
73093
  return CANONICAL_FONT_DISPLAY_NAMES2[slug];
73094
73094
  }
73095
- var CANVAS_DIMENSIONS2, VALID_CANVAS_RESOLUTIONS2, COMPOSITION_VARIABLE_TYPES2, FONT_ALIAS_MAP2, FONT_ALIAS_KEYS2, CANONICAL_FONT_DISPLAY_NAMES2, COMPOSITION_ATTRIBUTES3, CANONICAL_AUTHORED_TIMING_ATTRIBUTES3, DERIVED_TIMING_ATTRIBUTES3, LEGACY_TIMING_ATTRIBUTES3;
73095
+ function isRecord4(v2) {
73096
+ return typeof v2 === "object" && v2 !== null;
73097
+ }
73098
+ function isVariableType2(t2) {
73099
+ return typeof t2 === "string" && t2 in DEFAULT_TYPEOF2;
73100
+ }
73101
+ function isCompositionVariable2(v2) {
73102
+ if (!isRecord4(v2)) return false;
73103
+ if (typeof v2.id !== "string" || typeof v2.label !== "string") return false;
73104
+ if (!isVariableType2(v2.type)) return false;
73105
+ if (typeof v2.default !== DEFAULT_TYPEOF2[v2.type]) return false;
73106
+ if (v2.type === "enum" && !Array.isArray(v2.options)) return false;
73107
+ return true;
73108
+ }
73109
+ var CANVAS_DIMENSIONS2, VALID_CANVAS_RESOLUTIONS2, COMPOSITION_VARIABLE_TYPES2, FONT_ALIAS_MAP2, FONT_ALIAS_KEYS2, CANONICAL_FONT_DISPLAY_NAMES2, DEFAULT_TYPEOF2, COMPOSITION_ATTRIBUTES3, CANONICAL_AUTHORED_TIMING_ATTRIBUTES3, DERIVED_TIMING_ATTRIBUTES3, LEGACY_TIMING_ATTRIBUTES3;
73096
73110
  var init_composition = __esm({
73097
73111
  "../parsers/dist/composition.js"() {
73098
73112
  "use strict";
@@ -73217,6 +73231,15 @@ var init_composition = __esm({
73217
73231
  lato: "Lato",
73218
73232
  poppins: "Poppins"
73219
73233
  };
73234
+ DEFAULT_TYPEOF2 = {
73235
+ string: "string",
73236
+ number: "number",
73237
+ color: "string",
73238
+ boolean: "boolean",
73239
+ enum: "string",
73240
+ font: "string",
73241
+ image: "string"
73242
+ };
73220
73243
  COMPOSITION_ATTRIBUTES3 = Object.freeze({
73221
73244
  start: "data-start",
73222
73245
  duration: "data-duration",
@@ -77114,7 +77137,7 @@ var require_processor = __commonJS({
77114
77137
  if (options === void 0) {
77115
77138
  options = {};
77116
77139
  }
77117
- return new Promise(function(resolve77, reject) {
77140
+ return new Promise(function(resolve77, reject2) {
77118
77141
  try {
77119
77142
  var root_1 = _this._root(rule, options);
77120
77143
  Promise.resolve(_this.func(root_1)).then(function(transform) {
@@ -77124,9 +77147,9 @@ var require_processor = __commonJS({
77124
77147
  rule.selector = string;
77125
77148
  }
77126
77149
  return { transform, root: root_1, string };
77127
- }).then(resolve77, reject);
77150
+ }).then(resolve77, reject2);
77128
77151
  } catch (e3) {
77129
- reject(e3);
77152
+ reject2(e3);
77130
77153
  return;
77131
77154
  }
77132
77155
  });
@@ -81218,9 +81241,9 @@ function shouldBlockRender(strictErrors, strictAll, totalErrors, totalWarnings)
81218
81241
  return strictErrors && totalErrors > 0 || strictAll && (totalErrors > 0 || totalWarnings > 0);
81219
81242
  }
81220
81243
  function execFileAsync(file, args) {
81221
- return new Promise((resolvePromise, reject) => {
81244
+ return new Promise((resolvePromise, reject2) => {
81222
81245
  execFile(file, args, { timeout: PROBE_TIMEOUT_MS }, (error, stdout2) => {
81223
- if (error) reject(error);
81246
+ if (error) reject2(error);
81224
81247
  else resolvePromise(stdout2.toString());
81225
81248
  });
81226
81249
  });
@@ -95513,12 +95536,54 @@ async function fetchItemManifest(name, type, baseUrl = DEFAULT_REGISTRY_URL) {
95513
95536
  throw err;
95514
95537
  }
95515
95538
  }
95539
+ function describeCauseChain(err) {
95540
+ const parts = [];
95541
+ let current2 = err;
95542
+ const seen = /* @__PURE__ */ new Set();
95543
+ while (current2 instanceof Error && !seen.has(current2)) {
95544
+ seen.add(current2);
95545
+ const code = current2.code;
95546
+ const text2 = code && !current2.message.includes(String(code)) ? `${current2.message} [${String(code)}]` : current2.message;
95547
+ if (text2 && !parts.includes(text2)) parts.push(text2);
95548
+ current2 = current2.cause;
95549
+ }
95550
+ if (parts.length === 0) return String(err);
95551
+ const [head, ...rest] = parts;
95552
+ return rest.length ? `${head} (${rest.join("; ")})` : head;
95553
+ }
95554
+ function isRetryableTransport(err) {
95555
+ const text2 = describeCauseChain(err).toLowerCase();
95556
+ if (/certificate|self-signed|self signed|unable to verify|altname|ssl|tls/.test(text2)) {
95557
+ return false;
95558
+ }
95559
+ return /fetch failed|econnreset|econnrefused|etimedout|eai_again|socket hang up|timeouterror|aborted|network/.test(
95560
+ text2
95561
+ );
95562
+ }
95563
+ async function fetchWithRetry(url, attempts = 3) {
95564
+ let lastErr;
95565
+ for (let attempt = 1; attempt <= attempts; attempt++) {
95566
+ try {
95567
+ return await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
95568
+ } catch (err) {
95569
+ lastErr = err;
95570
+ if (attempt === attempts || !isRetryableTransport(err)) break;
95571
+ await new Promise((resolve77) => setTimeout(resolve77, 150 * attempt));
95572
+ }
95573
+ }
95574
+ throw lastErr;
95575
+ }
95516
95576
  async function fetchItemFile(item, file, destPath, baseUrl = DEFAULT_REGISTRY_URL) {
95517
95577
  if (/(^|[/\\])\.\.([/\\]|$)/.test(file.path)) {
95518
95578
  throw new Error(`Unsafe file.path "${file.path}": path segments may not contain "..".`);
95519
95579
  }
95520
95580
  const url = `${baseUrl}/${ITEM_TYPE_DIRS[item.type]}/${item.name}/${file.path}`;
95521
- const res = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
95581
+ let res;
95582
+ try {
95583
+ res = await fetchWithRetry(url);
95584
+ } catch (err) {
95585
+ throw new Error(`File fetch failed: ${url} \u2014 ${describeCauseChain(err)}`, { cause: err });
95586
+ }
95522
95587
  if (!res.ok) {
95523
95588
  throw new Error(`File fetch failed: ${url} \u2014 HTTP ${res.status}`);
95524
95589
  }
@@ -95545,7 +95610,8 @@ __export(resolver_exports, {
95545
95610
  loadAllItems: () => loadAllItems,
95546
95611
  resolveItem: () => resolveItem,
95547
95612
  resolveItemWithDependencies: () => resolveItemWithDependencies,
95548
- resolveItemsByTag: () => resolveItemsByTag
95613
+ resolveItemsByTag: () => resolveItemsByTag,
95614
+ unreachableRegistryMessage: () => unreachableRegistryMessage
95549
95615
  });
95550
95616
  function defaultWarn(message) {
95551
95617
  process.stderr.write(`hyperframes:registry ${message}
@@ -95585,17 +95651,21 @@ async function resolveItem(name, options = {}) {
95585
95651
  }
95586
95652
  const item = items[items.length - 1];
95587
95653
  if (!item) {
95588
- throw new Error(`Item "${name}" not found \u2014 registry unreachable or empty.`);
95654
+ throw new Error(unreachableRegistryMessage(name, options.baseUrl));
95589
95655
  }
95590
95656
  return item;
95591
95657
  }
95658
+ function unreachableRegistryMessage(name, baseUrl) {
95659
+ const where = baseUrl && !baseUrl.startsWith(DEFAULT_REGISTRY_URL) ? ` Contacted ${baseUrl}, set by this project's hyperframes.json, not the public registry.` : "";
95660
+ return `Item "${name}" not found \u2014 registry unreachable or empty.${where}`;
95661
+ }
95592
95662
  async function resolveItemWithDependencies(name, options = {}) {
95593
95663
  const entries2 = await listRegistryItems(void 0, options);
95594
95664
  const entry = entries2.find((e3) => e3.name === name);
95595
95665
  if (!entry) {
95596
95666
  const available = entries2.map((e3) => e3.name).join(", ");
95597
95667
  throw new Error(
95598
- available.length > 0 ? `Item "${name}" not found in registry. Available: ${available}` : `Item "${name}" not found \u2014 registry unreachable or empty.`
95668
+ available.length > 0 ? `Item "${name}" not found in registry. Available: ${available}` : unreachableRegistryMessage(name, options.baseUrl)
95599
95669
  );
95600
95670
  }
95601
95671
  const entryByName = new Map(entries2.map((e3) => [e3.name, e3]));
@@ -95610,7 +95680,7 @@ async function resolveItemWithDependencies(name, options = {}) {
95610
95680
  if (!registryEntry) {
95611
95681
  const available = entries2.map((e3) => e3.name).join(", ");
95612
95682
  throw new Error(
95613
- available.length > 0 ? `Dependency "${itemName}" not found in registry. Available: ${available}` : `Dependency "${itemName}" not found \u2014 registry unreachable or empty.`
95683
+ available.length > 0 ? `Dependency "${itemName}" not found in registry. Available: ${available}` : unreachableRegistryMessage(itemName, options.baseUrl)
95614
95684
  );
95615
95685
  }
95616
95686
  const pending = fetchItemManifest(registryEntry.name, registryEntry.type, options.baseUrl);
@@ -95651,10 +95721,108 @@ var init_resolver = __esm({
95651
95721
  }
95652
95722
  });
95653
95723
 
95724
+ // ../core/dist/variables.js
95725
+ var init_variables = __esm({
95726
+ "../core/dist/variables.js"() {
95727
+ "use strict";
95728
+ init_composition();
95729
+ init_getVariables();
95730
+ init_validateVariables();
95731
+ }
95732
+ });
95733
+
95734
+ // src/registry/variableDefaults.ts
95735
+ function findDeclaration(source) {
95736
+ const at4 = source.indexOf(`${ATTR}=`);
95737
+ if (at4 === -1) return null;
95738
+ const quote = source[at4 + ATTR.length + 1];
95739
+ if (quote !== "'" && quote !== '"') return null;
95740
+ const start = at4 + ATTR.length + 2;
95741
+ const end = source.indexOf(quote, start);
95742
+ if (end === -1) return null;
95743
+ return { start, end, raw: source.slice(start, end) };
95744
+ }
95745
+ function decode(raw) {
95746
+ return raw.replace(/&#39;/g, "'").replace(/&quot;/g, '"');
95747
+ }
95748
+ function encode2(json, quote) {
95749
+ return quote === "'" ? json.replace(/'/g, "&#39;") : json.replace(/"/g, "&quot;");
95750
+ }
95751
+ function optionValues(decl) {
95752
+ return decl.type === "enum" ? decl.options.map((option) => option.value) : null;
95753
+ }
95754
+ function rejectEnum(decl, value) {
95755
+ const options = optionValues(decl);
95756
+ if (!options) return null;
95757
+ return options.includes(String(value)) ? null : `not one of ${options.join(", ")}`;
95758
+ }
95759
+ function rejectNumber(decl, value) {
95760
+ if (decl.type !== "number") return null;
95761
+ const n2 = typeof value === "number" ? value : Number(value);
95762
+ if (!Number.isFinite(n2)) return "not a number";
95763
+ if (decl.min !== void 0 && n2 < decl.min) return `below min ${decl.min}`;
95764
+ if (decl.max !== void 0 && n2 > decl.max) return `above max ${decl.max}`;
95765
+ return null;
95766
+ }
95767
+ function reject(decl, value) {
95768
+ return rejectEnum(decl, value) ?? rejectNumber(decl, value);
95769
+ }
95770
+ function applyVariableDefaults(source, values) {
95771
+ const ids = Object.keys(values);
95772
+ if (ids.length === 0) return { html: source, applied: [], unknown: [], invalid: [] };
95773
+ const found = findDeclaration(source);
95774
+ if (!found) return { html: source, applied: [], unknown: ids, invalid: [] };
95775
+ let parsed;
95776
+ try {
95777
+ parsed = JSON.parse(decode(found.raw));
95778
+ } catch {
95779
+ return { html: source, applied: [], unknown: ids, invalid: [] };
95780
+ }
95781
+ if (!Array.isArray(parsed)) return { html: source, applied: [], unknown: ids, invalid: [] };
95782
+ const declared = parsed.filter(isCompositionVariable2);
95783
+ if (declared.length !== parsed.length) {
95784
+ return { html: source, applied: [], unknown: ids, invalid: [] };
95785
+ }
95786
+ const applied = [];
95787
+ const invalid = [];
95788
+ const byId = new Map(declared.map((decl) => [decl.id, decl]));
95789
+ const updated = /* @__PURE__ */ new Map();
95790
+ for (const [id, value] of Object.entries(values)) {
95791
+ const decl = byId.get(id);
95792
+ if (!decl) continue;
95793
+ const reason = reject(decl, value);
95794
+ if (reason) {
95795
+ invalid.push({ id, reason });
95796
+ continue;
95797
+ }
95798
+ updated.set(id, decl.type === "number" ? Number(value) : String(value));
95799
+ applied.push(id);
95800
+ }
95801
+ const unknown = ids.filter((id) => !byId.has(id));
95802
+ if (applied.length === 0) return { html: source, applied, unknown, invalid };
95803
+ const quote = source[found.start - 1];
95804
+ const body = declared.map((decl) => {
95805
+ const next = updated.has(decl.id) ? { ...decl, default: updated.get(decl.id) } : decl;
95806
+ return ` ${JSON.stringify(next)}`;
95807
+ }).join(",\n");
95808
+ const rewritten = encode2(`[
95809
+ ${body}
95810
+ ]`, quote);
95811
+ const html = source.slice(0, found.start) + rewritten + source.slice(found.end);
95812
+ return { html, applied, unknown, invalid };
95813
+ }
95814
+ var ATTR;
95815
+ var init_variableDefaults = __esm({
95816
+ "src/registry/variableDefaults.ts"() {
95817
+ "use strict";
95818
+ init_variables();
95819
+ ATTR = "data-composition-variables";
95820
+ }
95821
+ });
95822
+
95654
95823
  // src/registry/installer.ts
95655
95824
  var installer_exports = {};
95656
95825
  __export(installer_exports, {
95657
- assertSafeTarget: () => assertSafeTarget,
95658
95826
  hasLocalEdits: () => hasLocalEdits,
95659
95827
  installItem: () => installItem
95660
95828
  });
@@ -95705,6 +95873,9 @@ function assertSafeTarget(destDir, target) {
95705
95873
  throw new Error(`Unsafe target "${target}": resolves outside destDir ${destDir}.`);
95706
95874
  }
95707
95875
  }
95876
+ function isInstalledComponentSnippet(item, file) {
95877
+ return item.type === "hyperframes:component" && file.target.toLowerCase().endsWith(".html");
95878
+ }
95708
95879
  function isInstalledRegistryBlockComposition(item, file) {
95709
95880
  return item.type === "hyperframes:block" && file.type === "hyperframes:composition" && file.target.toLowerCase().endsWith(".html");
95710
95881
  }
@@ -95715,6 +95886,30 @@ function addRegistryItemMarker(source, item) {
95715
95886
  return `<!-- hyperframes-registry-item: ${item.name} -->
95716
95887
  ${source}`;
95717
95888
  }
95889
+ async function installOneFile(item, file, destDir, baseUrl, record, options) {
95890
+ const destPath = resolve11(destDir, file.target);
95891
+ if (!options.force && existsSync23(destPath) && hasLocalEdits(record, file.target, readFileSync13(destPath))) {
95892
+ return { destPath, target: file.target, preserved: true, hash: null, vars: null };
95893
+ }
95894
+ await fetchItemFile(item, file, destPath, baseUrl);
95895
+ if (isInstalledRegistryBlockComposition(item, file)) {
95896
+ const source = readFileSync13(destPath, "utf-8");
95897
+ writeFileSync9(destPath, addRegistryItemMarker(source, item), "utf-8");
95898
+ }
95899
+ let vars = null;
95900
+ if (options.variableValues && isInstalledComponentSnippet(item, file)) {
95901
+ const source = readFileSync13(destPath, "utf-8");
95902
+ vars = applyVariableDefaults(source, options.variableValues);
95903
+ if (vars.applied.length > 0) writeFileSync9(destPath, vars.html, "utf-8");
95904
+ }
95905
+ return {
95906
+ destPath,
95907
+ target: file.target,
95908
+ preserved: false,
95909
+ hash: digest(readFileSync13(destPath)),
95910
+ vars
95911
+ };
95912
+ }
95718
95913
  async function installItem(item, options) {
95719
95914
  const baseUrl = options.baseUrl ?? DEFAULT_REGISTRY_URL;
95720
95915
  const destDir = resolve11(options.destDir);
@@ -95723,23 +95918,9 @@ async function installItem(item, options) {
95723
95918
  }
95724
95919
  const record = readInstallRecord(destDir);
95725
95920
  const outcomes = await Promise.all(
95726
- item.files.map(async (file) => {
95727
- const destPath = resolve11(destDir, file.target);
95728
- if (!options.force && existsSync23(destPath) && hasLocalEdits(record, file.target, readFileSync13(destPath))) {
95729
- return { destPath, target: file.target, preserved: true, hash: null };
95730
- }
95731
- await fetchItemFile(item, file, destPath, baseUrl);
95732
- if (isInstalledRegistryBlockComposition(item, file)) {
95733
- const source = readFileSync13(destPath, "utf-8");
95734
- writeFileSync9(destPath, addRegistryItemMarker(source, item), "utf-8");
95735
- }
95736
- return {
95737
- destPath,
95738
- target: file.target,
95739
- preserved: false,
95740
- hash: digest(readFileSync13(destPath))
95741
- };
95742
- })
95921
+ item.files.map(
95922
+ (file) => installOneFile(item, file, destDir, baseUrl, record, options)
95923
+ )
95743
95924
  );
95744
95925
  const written = outcomes.filter((o) => !o.preserved).map((o) => o.destPath);
95745
95926
  const preserved = outcomes.filter((o) => o.preserved).map((o) => o.destPath);
@@ -95749,13 +95930,26 @@ async function installItem(item, options) {
95749
95930
  }
95750
95931
  writeInstallRecord(destDir, record);
95751
95932
  }
95752
- return { written, preserved };
95933
+ const vars = outcomes.map((o) => o.vars).filter((v2) => v2 !== null);
95934
+ return {
95935
+ written,
95936
+ preserved,
95937
+ variablesApplied: vars.flatMap((v2) => v2.applied),
95938
+ // An id nothing declared is only genuinely unknown once every file has had
95939
+ // a chance at it, so intersect rather than union.
95940
+ variablesUnknown: vars.length ? vars.reduce(
95941
+ (acc, v2) => acc.filter((id) => v2.unknown.includes(id)),
95942
+ vars[0].unknown
95943
+ ) : [],
95944
+ variablesInvalid: vars.flatMap((v2) => v2.invalid)
95945
+ };
95753
95946
  }
95754
95947
  var INSTALL_RECORD;
95755
95948
  var init_installer = __esm({
95756
95949
  "src/registry/installer.ts"() {
95757
95950
  "use strict";
95758
95951
  init_remote();
95952
+ init_variableDefaults();
95759
95953
  INSTALL_RECORD = "hyperframes.lock.json";
95760
95954
  }
95761
95955
  });
@@ -96105,6 +96299,7 @@ __export(ffmpeg_exports, {
96105
96299
  detectH264EncoderMode: () => detectH264EncoderMode,
96106
96300
  findFFmpeg: () => findFFmpeg,
96107
96301
  findFFprobe: () => findFFprobe,
96302
+ getFFmpegInstallCommand: () => getFFmpegInstallCommand,
96108
96303
  getFFmpegInstallHint: () => getFFmpegInstallHint,
96109
96304
  resolveH264EncoderMode: () => resolveH264EncoderMode
96110
96305
  });
@@ -96129,26 +96324,40 @@ function findFFmpeg() {
96129
96324
  function findFFprobe() {
96130
96325
  return findFfBinary("ffprobe", { configuredMustExist: true });
96131
96326
  }
96132
- function getFFmpegInstallHint() {
96327
+ function getFFmpegInstallCommand() {
96133
96328
  switch (process.platform) {
96134
96329
  case "darwin":
96135
96330
  return "brew install ffmpeg";
96136
96331
  case "linux": {
96137
96332
  const distro = detectLinuxDistro();
96333
+ if (distro.family === "unknown") return void 0;
96138
96334
  return ffmpegInstallCommand(distro.family);
96139
96335
  }
96336
+ // winget ships with Windows 10 1809+ and Windows 11. Machines without it
96337
+ // still get the manual download route from the hint below.
96140
96338
  case "win32":
96141
- return "Download the 64-bit Windows build from https://ffmpeg.org/download.html#build-windows and add its bin/ directory to PATH.";
96339
+ return "winget install --id Gyan.FFmpeg -e";
96142
96340
  default:
96143
- return "https://ffmpeg.org/download.html";
96341
+ return void 0;
96342
+ }
96343
+ }
96344
+ function getFFmpegInstallHint() {
96345
+ const command2 = getFFmpegInstallCommand();
96346
+ if (command2 && process.platform === "win32") {
96347
+ return `${command2}, or download the 64-bit build from ${FFMPEG_DOWNLOAD_URL}#build-windows and add its bin/ directory to PATH.`;
96144
96348
  }
96349
+ if (command2) return command2;
96350
+ if (process.platform === "linux") return ffmpegInstallCommand("unknown");
96351
+ return FFMPEG_DOWNLOAD_URL;
96145
96352
  }
96353
+ var FFMPEG_DOWNLOAD_URL;
96146
96354
  var init_ffmpeg = __esm({
96147
96355
  "src/browser/ffmpeg.ts"() {
96148
96356
  "use strict";
96149
96357
  init_ffBinaries();
96150
96358
  init_linuxDeps();
96151
96359
  init_ffBinaries();
96360
+ FFMPEG_DOWNLOAD_URL = "https://ffmpeg.org/download.html";
96152
96361
  }
96153
96362
  });
96154
96363
 
@@ -96183,7 +96392,7 @@ function downloadFile(url, dest, options = {}) {
96183
96392
  const tmp = `${dest}.${process.pid}.${randomUUID6()}.tmp`;
96184
96393
  const timeoutMs = options.timeoutMs ?? DEFAULT_DOWNLOAD_TIMEOUT_MS;
96185
96394
  const maxBytes = options.maxBytes;
96186
- return new Promise((resolve77, reject) => {
96395
+ return new Promise((resolve77, reject2) => {
96187
96396
  const follow = (u, hops = 0) => {
96188
96397
  let activeResponse;
96189
96398
  let responsePipelineStarted = false;
@@ -96198,7 +96407,7 @@ function downloadFile(url, dest, options = {}) {
96198
96407
  if (hops >= MAX_REDIRECTS2) {
96199
96408
  res.resume();
96200
96409
  removePartialFile(tmp);
96201
- reject(
96410
+ reject2(
96202
96411
  new Error(`Download failed: more than ${MAX_REDIRECTS2} redirects from ${url}`)
96203
96412
  );
96204
96413
  return;
@@ -96208,7 +96417,7 @@ function downloadFile(url, dest, options = {}) {
96208
96417
  follow(redirectTarget(location, u), hops + 1);
96209
96418
  } catch (error) {
96210
96419
  removePartialFile(tmp);
96211
- reject(error);
96420
+ reject2(error);
96212
96421
  }
96213
96422
  return;
96214
96423
  }
@@ -96216,7 +96425,7 @@ function downloadFile(url, dest, options = {}) {
96216
96425
  if (res.statusCode !== 200) {
96217
96426
  res.resume();
96218
96427
  removePartialFile(tmp);
96219
- reject(new Error(`Download failed: HTTP ${res.statusCode}`));
96428
+ reject2(new Error(`Download failed: HTTP ${res.statusCode}`));
96220
96429
  return;
96221
96430
  }
96222
96431
  const file = createWriteStream2(tmp);
@@ -96227,12 +96436,12 @@ function downloadFile(url, dest, options = {}) {
96227
96436
  resolve77();
96228
96437
  }).catch((err) => {
96229
96438
  removePartialFile(tmp);
96230
- reject(requestError ?? err);
96439
+ reject2(requestError ?? err);
96231
96440
  });
96232
96441
  });
96233
96442
  } catch (error) {
96234
96443
  removePartialFile(tmp);
96235
- reject(error);
96444
+ reject2(error);
96236
96445
  return;
96237
96446
  }
96238
96447
  request.setTimeout(timeoutMs, () => {
@@ -96245,7 +96454,7 @@ function downloadFile(url, dest, options = {}) {
96245
96454
  return;
96246
96455
  }
96247
96456
  removePartialFile(tmp);
96248
- reject(err);
96457
+ reject2(err);
96249
96458
  });
96250
96459
  };
96251
96460
  follow(url);
@@ -98202,7 +98411,7 @@ function hasGit2() {
98202
98411
  }
98203
98412
  function spawnNpx(args, opts = {}) {
98204
98413
  const npx = buildNpxCommand(args);
98205
- return new Promise((resolve77, reject) => {
98414
+ return new Promise((resolve77, reject2) => {
98206
98415
  const child = spawn6(npx.command, npx.args, {
98207
98416
  // Route the child's stdout to the parent's stderr (fd 2), keeping stdin
98208
98417
  // inherited. `skills update --json` runs this installer before printing its
@@ -98233,10 +98442,10 @@ function spawnNpx(args, opts = {}) {
98233
98442
  child.on("close", (code, signal) => {
98234
98443
  if (code === 0) resolve77();
98235
98444
  else if (signal === "SIGINT" || code === 130)
98236
- reject(new CliResultSignal({ exitCode: 0, kind: "success", presented: true }));
98237
- else reject(new Error(`npx ${args.join(" ")} exited with code ${code}`));
98445
+ reject2(new CliResultSignal({ exitCode: 0, kind: "success", presented: true }));
98446
+ else reject2(new Error(`npx ${args.join(" ")} exited with code ${code}`));
98238
98447
  });
98239
- child.on("error", reject);
98448
+ child.on("error", reject2);
98240
98449
  });
98241
98450
  }
98242
98451
  function skillSelectionArgs(selection) {
@@ -101513,8 +101722,8 @@ async function waitForProxy(promise, timeoutMs = DEFAULT_PROXY_WAIT_TIMEOUT_MS)
101513
101722
  try {
101514
101723
  return await Promise.race([
101515
101724
  promise,
101516
- new Promise((_resolve, reject) => {
101517
- timer = setTimeout(() => reject(new ProxyWaitTimeoutError(timeoutMs)), timeoutMs);
101725
+ new Promise((_resolve, reject2) => {
101726
+ timer = setTimeout(() => reject2(new ProxyWaitTimeoutError(timeoutMs)), timeoutMs);
101518
101727
  timer.unref();
101519
101728
  })
101520
101729
  ]);
@@ -101557,14 +101766,14 @@ function getCanonicalProxyCachePath(source, variant) {
101557
101766
  );
101558
101767
  }
101559
101768
  function acquireSlot() {
101560
- return new Promise((resolveSlot, reject) => {
101769
+ return new Promise((resolveSlot, reject2) => {
101561
101770
  const tryAcquire = () => {
101562
101771
  if (activeTranscodes < MAX_CONCURRENT_TRANSCODES) {
101563
101772
  activeTranscodes++;
101564
101773
  resolveSlot();
101565
101774
  } else {
101566
101775
  if (waitQueue.length >= MAX_QUEUED_TRANSCODES) {
101567
- reject(new ProxyCapacityError());
101776
+ reject2(new ProxyCapacityError());
101568
101777
  return;
101569
101778
  }
101570
101779
  waitQueue.push(tryAcquire);
@@ -101641,7 +101850,7 @@ async function runFfmpeg2(sourcePath, outputPath, variant) {
101641
101850
  evenScale,
101642
101851
  `format=${pixelFormat}`
101643
101852
  ].join(",") : [evenScale, `format=${pixelFormat}`].join(",");
101644
- return new Promise((resolvePromise, reject) => {
101853
+ return new Promise((resolvePromise, reject2) => {
101645
101854
  const commonArgs = ["-y", "-i", sourcePath, "-vf", videoFilter];
101646
101855
  const h264Args = [
101647
101856
  "-c:v",
@@ -101704,13 +101913,13 @@ async function runFfmpeg2(sourcePath, outputPath, variant) {
101704
101913
  stderrTail = (stderrTail + chunk.toString()).slice(-STDERR_TAIL_MAX_CHARS);
101705
101914
  });
101706
101915
  proc.on("error", (err) => {
101707
- reject(new ProxyTranscodeError(`failed to spawn ffmpeg: ${err.message}`, null, stderrTail));
101916
+ reject2(new ProxyTranscodeError(`failed to spawn ffmpeg: ${err.message}`, null, stderrTail));
101708
101917
  });
101709
101918
  proc.on("close", (code, signal) => {
101710
101919
  if (code === 0) {
101711
101920
  resolvePromise();
101712
101921
  } else if (signal) {
101713
- reject(
101922
+ reject2(
101714
101923
  new ProxyTranscodeError(
101715
101924
  `ffmpeg killed by ${signal} (timeout ${TRANSCODE_TIMEOUT_MS}ms or external kill)`,
101716
101925
  null,
@@ -101718,7 +101927,7 @@ async function runFfmpeg2(sourcePath, outputPath, variant) {
101718
101927
  )
101719
101928
  );
101720
101929
  } else {
101721
- reject(new ProxyTranscodeError(`ffmpeg exited with code ${code}`, code, stderrTail));
101930
+ reject2(new ProxyTranscodeError(`ffmpeg exited with code ${code}`, code, stderrTail));
101722
101931
  }
101723
101932
  });
101724
101933
  });
@@ -108949,7 +109158,7 @@ function computePeaks(floats, count) {
108949
109158
  return peaks.map((p2) => p2 / maxPeak);
108950
109159
  }
108951
109160
  function decodeAudioPeaks(audioPath) {
108952
- return new Promise((resolvePromise, reject) => {
109161
+ return new Promise((resolvePromise, reject2) => {
108953
109162
  const proc = spawn9(
108954
109163
  findFfBinary("ffmpeg") ?? "ffmpeg",
108955
109164
  [
@@ -108972,19 +109181,19 @@ function decodeAudioPeaks(audioPath) {
108972
109181
  proc.stdout?.on("data", (chunk) => chunks.push(chunk));
108973
109182
  proc.on("close", (code) => {
108974
109183
  if (code !== 0 && chunks.length === 0) {
108975
- reject(new Error(`ffmpeg exited with code ${code}`));
109184
+ reject2(new Error(`ffmpeg exited with code ${code}`));
108976
109185
  return;
108977
109186
  }
108978
109187
  const buf = Buffer.concat(chunks);
108979
109188
  const numSamples = Math.floor(buf.length / 4);
108980
109189
  if (numSamples === 0) {
108981
- reject(new Error("ffmpeg produced no audio samples"));
109190
+ reject2(new Error("ffmpeg produced no audio samples"));
108982
109191
  return;
108983
109192
  }
108984
109193
  const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + numSamples * 4);
108985
109194
  resolvePromise(computePeaks(new Float32Array(ab), PEAK_COUNT));
108986
109195
  });
108987
- proc.on("error", reject);
109196
+ proc.on("error", reject2);
108988
109197
  });
108989
109198
  }
108990
109199
  async function generateWaveformCache(projectDir, assetPath) {
@@ -112434,7 +112643,7 @@ function registerWaveformRoutes(api, adapter2) {
112434
112643
  return c3.json({ peaks });
112435
112644
  });
112436
112645
  }
112437
- function isRecord4(value) {
112646
+ function isRecord5(value) {
112438
112647
  return typeof value === "object" && value !== null;
112439
112648
  }
112440
112649
  function collectFontsFromDir(dir) {
@@ -112458,10 +112667,10 @@ function listInstalledFontFamilies() {
112458
112667
  return cachedFonts;
112459
112668
  }
112460
112669
  function parseGoogleFontMetadata(value) {
112461
- if (!isRecord4(value) || !Array.isArray(value.familyMetadataList)) return [];
112670
+ if (!isRecord5(value) || !Array.isArray(value.familyMetadataList)) return [];
112462
112671
  const families = [];
112463
112672
  for (const entry of value.familyMetadataList) {
112464
- if (!isRecord4(entry) || typeof entry.family !== "string") continue;
112673
+ if (!isRecord5(entry) || typeof entry.family !== "string") continue;
112465
112674
  families.push(entry.family);
112466
112675
  }
112467
112676
  return families;
@@ -113197,10 +113406,10 @@ var init_dist9 = __esm({
113197
113406
  let entry = this.entries.get(key2);
113198
113407
  if (!entry) {
113199
113408
  let resolve510;
113200
- let reject;
113409
+ let reject2;
113201
113410
  const promise = new Promise((resolvePromise, rejectPromise) => {
113202
113411
  resolve510 = resolvePromise;
113203
- reject = rejectPromise;
113412
+ reject2 = rejectPromise;
113204
113413
  });
113205
113414
  entry = {
113206
113415
  key: key2,
@@ -113210,7 +113419,7 @@ var init_dist9 = __esm({
113210
113419
  work,
113211
113420
  promise,
113212
113421
  resolve: resolve510,
113213
- reject
113422
+ reject: reject2
113214
113423
  };
113215
113424
  this.entries.set(key2, entry);
113216
113425
  this.queue.push(entry);
@@ -113223,7 +113432,7 @@ var init_dist9 = __esm({
113223
113432
  return /* @__PURE__ */ new Set([...this.entries.keys(), ...[...this.activeEntries].map((entry) => entry.key)]);
113224
113433
  }
113225
113434
  lease(entry, signal) {
113226
- return new Promise((resolve510, reject) => {
113435
+ return new Promise((resolve510, reject2) => {
113227
113436
  let released = false;
113228
113437
  const release4 = () => {
113229
113438
  if (released) return;
@@ -113241,7 +113450,7 @@ var init_dist9 = __esm({
113241
113450
  };
113242
113451
  const onAbort = () => {
113243
113452
  release4();
113244
- reject(new DOMException("Aborted", "AbortError"));
113453
+ reject2(new DOMException("Aborted", "AbortError"));
113245
113454
  };
113246
113455
  signal.addEventListener("abort", onAbort, { once: true });
113247
113456
  entry.promise.then(
@@ -113251,7 +113460,7 @@ var init_dist9 = __esm({
113251
113460
  },
113252
113461
  (reason) => {
113253
113462
  release4();
113254
- reject(reason);
113463
+ reject2(reason);
113255
113464
  }
113256
113465
  );
113257
113466
  });
@@ -117435,10 +117644,10 @@ var require_compress_binding = __commonJS({
117435
117644
  });
117436
117645
  } else {
117437
117646
  if (readAsync) {
117438
- return new Promise(function(resolve77, reject) {
117647
+ return new Promise(function(resolve77, reject2) {
117439
117648
  readAsync(wasmBinaryFile, function(response) {
117440
117649
  resolve77(new Uint8Array(response));
117441
- }, reject);
117650
+ }, reject2);
117442
117651
  });
117443
117652
  }
117444
117653
  }
@@ -118991,10 +119200,10 @@ var require_decompress_binding = __commonJS({
118991
119200
  });
118992
119201
  } else {
118993
119202
  if (readAsync) {
118994
- return new Promise(function(resolve77, reject) {
119203
+ return new Promise(function(resolve77, reject2) {
118995
119204
  readAsync(wasmBinaryFile, function(response) {
118996
119205
  resolve77(new Uint8Array(response));
118997
- }, reject);
119206
+ }, reject2);
118998
119207
  });
118999
119208
  }
119000
119209
  }
@@ -120596,14 +120805,14 @@ function throwIfCallerAborted(signal) {
120596
120805
  async function waitForFontFetchRetry(delayMs, signal) {
120597
120806
  throwIfCallerAborted(signal);
120598
120807
  if (delayMs <= 0) return;
120599
- await new Promise((resolve77, reject) => {
120808
+ await new Promise((resolve77, reject2) => {
120600
120809
  const timeout = setTimeout(() => {
120601
120810
  signal?.removeEventListener("abort", onAbort);
120602
120811
  resolve77();
120603
120812
  }, delayMs);
120604
120813
  const onAbort = () => {
120605
120814
  clearTimeout(timeout);
120606
- reject(signal ? callerAbortReason(signal) : new DOMException("Cancelled", "AbortError"));
120815
+ reject2(signal ? callerAbortReason(signal) : new DOMException("Cancelled", "AbortError"));
120607
120816
  };
120608
120817
  signal?.addEventListener("abort", onAbort, { once: true });
120609
120818
  if (signal?.aborted) onAbort();
@@ -125334,10 +125543,10 @@ function resolveDeStallTimeoutMs() {
125334
125543
  return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_DE_STALL_MS;
125335
125544
  }
125336
125545
  function raceAgainstStall(promise, deadlineMs, message, signal) {
125337
- return new Promise((resolve77, reject) => {
125546
+ return new Promise((resolve77, reject2) => {
125338
125547
  const timer = setTimeout(
125339
125548
  () => {
125340
- reject(
125549
+ reject2(
125341
125550
  new Error(
125342
125551
  signal?.aborted ? "[Render] Sequential drawElement capture aborted while a capture call was in flight." : message
125343
125552
  )
@@ -125352,7 +125561,7 @@ function raceAgainstStall(promise, deadlineMs, message, signal) {
125352
125561
  },
125353
125562
  (error) => {
125354
125563
  clearTimeout(timer);
125355
- reject(error);
125564
+ reject2(error);
125356
125565
  }
125357
125566
  );
125358
125567
  });
@@ -126233,8 +126442,8 @@ async function createShaderTransitionWorkerPool(opts) {
126233
126442
  if (terminated) {
126234
126443
  throw new Error("shader-blend pool already terminated");
126235
126444
  }
126236
- return new Promise((resolve77, reject) => {
126237
- const task = traceEnabled ? { req, resolve: resolve77, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve77, reject };
126445
+ return new Promise((resolve77, reject2) => {
126446
+ const task = traceEnabled ? { req, resolve: resolve77, reject: reject2, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve77, reject: reject2 };
126238
126447
  const idle = slots.find((s2) => !s2.busy && !s2.dead);
126239
126448
  if (idle) {
126240
126449
  queue.unshift(task);
@@ -126242,7 +126451,7 @@ async function createShaderTransitionWorkerPool(opts) {
126242
126451
  } else if (slots.some((s2) => !s2.dead)) {
126243
126452
  queue.push(task);
126244
126453
  } else {
126245
- reject(new Error("shader-blend pool has no live workers"));
126454
+ reject2(new Error("shader-blend pool has no live workers"));
126246
126455
  }
126247
126456
  });
126248
126457
  },
@@ -130135,7 +130344,7 @@ async function startHealthWorker(options = {}) {
130135
130344
  stdout: false,
130136
130345
  stderr: false
130137
130346
  });
130138
- await new Promise((resolve77, reject) => {
130347
+ await new Promise((resolve77, reject2) => {
130139
130348
  const onMessage = (msg) => {
130140
130349
  if (msg?.type === "listening") {
130141
130350
  worker.off("error", onError);
@@ -130144,13 +130353,13 @@ async function startHealthWorker(options = {}) {
130144
130353
  } else if (msg?.type === "listen-error") {
130145
130354
  worker.off("error", onError);
130146
130355
  worker.off("message", onMessage);
130147
- reject(new Error(`[healthWorker] failed to bind port ${port}: ${msg.error}`));
130356
+ reject2(new Error(`[healthWorker] failed to bind port ${port}: ${msg.error}`));
130148
130357
  }
130149
130358
  };
130150
130359
  const onError = (err) => {
130151
130360
  worker.off("error", onError);
130152
130361
  worker.off("message", onMessage);
130153
- reject(err);
130362
+ reject2(err);
130154
130363
  };
130155
130364
  worker.on("message", onMessage);
130156
130365
  worker.on("error", onError);
@@ -130885,7 +131094,7 @@ var init_parityContract2 = __esm({
130885
131094
  function getDistributedRenderCapabilities() {
130886
131095
  return DISTRIBUTED_RENDER_CAPABILITIES;
130887
131096
  }
130888
- function isRecord5(value) {
131097
+ function isRecord6(value) {
130889
131098
  return value !== null && typeof value === "object" && !Array.isArray(value);
130890
131099
  }
130891
131100
  function protocolMatches(descriptor, expected) {
@@ -130897,7 +131106,7 @@ function capabilitiesAccept(capabilities, protocol) {
130897
131106
  );
130898
131107
  }
130899
131108
  function readPlanProtocol(planJson, capabilities = DISTRIBUTED_RENDER_CAPABILITIES.roles.chunk) {
130900
- if (!isRecord5(planJson)) {
131109
+ if (!isRecord6(planJson)) {
130901
131110
  throw new PlanProtocolUnsupportedError("plan.json must contain a JSON object");
130902
131111
  }
130903
131112
  if (!Object.prototype.hasOwnProperty.call(planJson, "protocol")) {
@@ -130909,7 +131118,7 @@ function readPlanProtocol(planJson, capabilities = DISTRIBUTED_RENDER_CAPABILITI
130909
131118
  return PLAN_PROTOCOL_V1;
130910
131119
  }
130911
131120
  const descriptor = planJson.protocol;
130912
- if (!isRecord5(descriptor)) {
131121
+ if (!isRecord6(descriptor)) {
130913
131122
  throw new PlanProtocolUnsupportedError("plan.json protocol descriptor must be an object");
130914
131123
  }
130915
131124
  for (const field of ["schemaVersion", "artifactLayout", "hashSchema"]) {
@@ -132239,7 +132448,7 @@ function canFallbackToCopy(error) {
132239
132448
  const code = error.code;
132240
132449
  return code === "EXDEV" || code === "EPERM" || code === "EACCES" || code === "ENOTSUP";
132241
132450
  }
132242
- function isRecord6(value) {
132451
+ function isRecord7(value) {
132243
132452
  return typeof value === "object" && value !== null && !Array.isArray(value);
132244
132453
  }
132245
132454
  function manifestDigests(manifestBytes) {
@@ -132249,11 +132458,11 @@ function manifestDigests(manifestBytes) {
132249
132458
  } catch {
132250
132459
  throw new PlanV2IntegrityError("manifest publisher received invalid JSON");
132251
132460
  }
132252
- if (!isRecord6(value) || !Array.isArray(value.artifacts)) {
132461
+ if (!isRecord7(value) || !Array.isArray(value.artifacts)) {
132253
132462
  throw new PlanV2IntegrityError("manifest publisher requires an artifacts array");
132254
132463
  }
132255
132464
  return value.artifacts.map((artifact, index) => {
132256
- if (!isRecord6(artifact)) {
132465
+ if (!isRecord7(artifact)) {
132257
132466
  throw new PlanV2IntegrityError(`manifest artifacts[${index}] must be an object`);
132258
132467
  }
132259
132468
  return assertPlanV2Sha256(artifact.sha256, `manifest artifacts[${index}].sha256`);
@@ -132345,7 +132554,7 @@ import {
132345
132554
  import { createHash as createHash17 } from "crypto";
132346
132555
  import { tmpdir as tmpdir11 } from "os";
132347
132556
  import { dirname as dirname30, isAbsolute as isAbsolute13, join as join71, relative as relative15, resolve as resolve37, sep as sep11 } from "path";
132348
- function isRecord7(value) {
132557
+ function isRecord8(value) {
132349
132558
  return value !== null && typeof value === "object" && !Array.isArray(value);
132350
132559
  }
132351
132560
  function isSha256(value) {
@@ -132517,7 +132726,7 @@ function parseChunkSlices(value) {
132517
132726
  const indexes = /* @__PURE__ */ new Set();
132518
132727
  return value.map((chunk, position) => {
132519
132728
  const field = `meta/chunks.json[${position}]`;
132520
- if (!isRecord7(chunk)) throw new PlanV2IntegrityError(`${field} must be an object`);
132729
+ if (!isRecord8(chunk)) throw new PlanV2IntegrityError(`${field} must be an object`);
132521
132730
  const index = readNonNegativeInteger2(chunk.index, `${field}.index`);
132522
132731
  const startFrame = readNonNegativeInteger2(chunk.startFrame, `${field}.startFrame`);
132523
132732
  const endFrame = readPositiveInteger2(chunk.endFrame, `${field}.endFrame`);
@@ -132591,7 +132800,7 @@ function buildPlanV2Publication(executionPlanDir) {
132591
132800
  throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
132592
132801
  }
132593
132802
  const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
132594
- if (!isRecord7(executionPlanValue)) {
132803
+ if (!isRecord8(executionPlanValue)) {
132595
132804
  throw new PlanV2IntegrityError("execution plan.json must be an object");
132596
132805
  }
132597
132806
  const executionPlan = executionPlanValue;
@@ -132609,7 +132818,7 @@ function buildPlanV2Publication(executionPlanDir) {
132609
132818
  const artifacts = [];
132610
132819
  const blobs = /* @__PURE__ */ new Map();
132611
132820
  const dimensions = executionPlan.dimensions;
132612
- if (!isRecord7(dimensions)) {
132821
+ if (!isRecord8(dimensions)) {
132613
132822
  throw new PlanV2IntegrityError("execution plan.json.dimensions must be an object");
132614
132823
  }
132615
132824
  validateExtractionCacheCompleteSentinels(executionPlanDir);
@@ -132792,7 +133001,7 @@ function readDistributedFormat(value) {
132792
133001
  return value;
132793
133002
  }
132794
133003
  function parseArtifact(value, index) {
132795
- if (!isRecord7(value)) throw new PlanV2IntegrityError(`artifacts[${index}] must be an object`);
133004
+ if (!isRecord8(value)) throw new PlanV2IntegrityError(`artifacts[${index}] must be an object`);
132796
133005
  const path2 = readString2(value.path, `artifacts[${index}].path`);
132797
133006
  assertSafeRelativePath(path2);
132798
133007
  if (!isSha256(value.sha256)) {
@@ -132822,8 +133031,8 @@ function parseArtifact(value, index) {
132822
133031
  };
132823
133032
  }
132824
133033
  function parsePlanV2Manifest(value) {
132825
- if (!isRecord7(value)) throw new PlanV2IntegrityError("manifest must be an object");
132826
- if (!isRecord7(value.protocol) || value.protocol.schemaVersion !== PLAN_PROTOCOL_V2.schemaVersion || value.protocol.artifactLayout !== PLAN_PROTOCOL_V2.artifactLayout || value.protocol.hashSchema !== PLAN_PROTOCOL_V2.hashSchema) {
133034
+ if (!isRecord8(value)) throw new PlanV2IntegrityError("manifest must be an object");
133035
+ if (!isRecord8(value.protocol) || value.protocol.schemaVersion !== PLAN_PROTOCOL_V2.schemaVersion || value.protocol.artifactLayout !== PLAN_PROTOCOL_V2.artifactLayout || value.protocol.hashSchema !== PLAN_PROTOCOL_V2.hashSchema) {
132827
133036
  throw new PlanV2IntegrityError("manifest protocol is not the supported v2 descriptor");
132828
133037
  }
132829
133038
  if (!isSha256(value.planHash) || !isSha256(value.sourcePlanV1Hash)) {
@@ -132839,7 +133048,7 @@ function parsePlanV2Manifest(value) {
132839
133048
  }
132840
133049
  if (!paths.has("plan.json"))
132841
133050
  throw new PlanV2IntegrityError("manifest must include the local execution plan.json artifact");
132842
- if (!isRecord7(value.limitations) || value.limitations.videoDependencyMode !== "exact-rendered-frames" && value.limitations.videoDependencyMode !== "full-source-pack") {
133051
+ if (!isRecord8(value.limitations) || value.limitations.videoDependencyMode !== "exact-rendered-frames" && value.limitations.videoDependencyMode !== "full-source-pack") {
132843
133052
  throw new PlanV2IntegrityError("unsupported video dependency mode");
132844
133053
  }
132845
133054
  const parsed = {
@@ -132949,7 +133158,7 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
132949
133158
  const markerPath = join71(planDir, PLAN_V2_MATERIALIZATION_MARKER);
132950
133159
  if (!existsSync65(markerPath)) return null;
132951
133160
  const marker = readJsonFile(markerPath, "materialization marker");
132952
- if (!isRecord7(marker) || !isRecord7(marker.manifest) || !isRecord7(marker.target)) {
133161
+ if (!isRecord8(marker) || !isRecord8(marker.manifest) || !isRecord8(marker.target)) {
132953
133162
  throw new PlanV2IntegrityError("malformed materialization marker");
132954
133163
  }
132955
133164
  const target = marker.target;
@@ -134546,15 +134755,15 @@ ${decoder.getStderr().slice(-400)}`
134546
134755
  return processed;
134547
134756
  }
134548
134757
  function waitForExit(proc, label2, getStderr) {
134549
- return new Promise((resolve77, reject) => {
134550
- proc.on("error", reject);
134758
+ return new Promise((resolve77, reject2) => {
134759
+ proc.on("error", reject2);
134551
134760
  proc.on("exit", (code, signal) => {
134552
134761
  if (code === 0 && !signal) {
134553
134762
  resolve77();
134554
134763
  return;
134555
134764
  }
134556
134765
  const cause = signal ? `killed by ${signal}` : `exited with code ${code}`;
134557
- reject(new Error(`${label2} ${cause}: ${getStderr().slice(-400)}`));
134766
+ reject2(new Error(`${label2} ${cause}: ${getStderr().slice(-400)}`));
134558
134767
  });
134559
134768
  });
134560
134769
  }
@@ -134579,6 +134788,234 @@ var init_pipeline = __esm({
134579
134788
  }
134580
134789
  });
134581
134790
 
134791
+ // src/browser/preflight.ts
134792
+ var preflight_exports = {};
134793
+ __export(preflight_exports, {
134794
+ checkDisk: () => checkDisk,
134795
+ parseToolVersion: () => parseToolVersion,
134796
+ runEnvironmentChecks: () => runEnvironmentChecks
134797
+ });
134798
+ import { execFileSync as execFileSync8 } from "child_process";
134799
+ import { existsSync as existsSync69 } from "fs";
134800
+ import { platform as platform7 } from "os";
134801
+ function parseToolVersion(raw) {
134802
+ const m2 = raw.match(/(ffmpeg|ffprobe)\s+version\s+([\d][\d.\-\w]*)/i);
134803
+ return m2 ? `${m2[1]} ${m2[2]}` : raw.trim();
134804
+ }
134805
+ function configuredMissingDetail(envName) {
134806
+ const configured = process.env[envName]?.trim();
134807
+ if (!configured || existsSync69(configured)) return void 0;
134808
+ return `Configured path does not exist: ${envName}="${configured}"`;
134809
+ }
134810
+ function readToolVersion(binaryPath) {
134811
+ try {
134812
+ const raw = execFileSync8(binaryPath, ["-version"], { encoding: "utf-8", timeout: 5e3 }).split("\n")[0] ?? "";
134813
+ const version2 = parseToolVersion(raw);
134814
+ return { ok: true, detail: version2 ? `${version2} at ${binaryPath}` : binaryPath };
134815
+ } catch (error) {
134816
+ const status = typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
134817
+ const exitDetail = typeof status === "number" ? ` (exit code ${status})` : "";
134818
+ return {
134819
+ ok: false,
134820
+ detail: `Failed to run "${binaryPath}" -version${exitDetail}.`
134821
+ };
134822
+ }
134823
+ }
134824
+ function checkFFmpeg() {
134825
+ const missingConfigured = configuredMissingDetail(FFMPEG_PATH_ENV);
134826
+ if (missingConfigured) {
134827
+ return {
134828
+ name: "FFmpeg",
134829
+ ok: false,
134830
+ level: "error",
134831
+ title: "FFmpeg not found",
134832
+ detail: missingConfigured,
134833
+ hint: getFFmpegInstallHint()
134834
+ };
134835
+ }
134836
+ const path2 = findFFmpeg();
134837
+ if (path2) {
134838
+ const version2 = readToolVersion(path2);
134839
+ if (!version2.ok) {
134840
+ return {
134841
+ name: "FFmpeg",
134842
+ ok: false,
134843
+ level: "error",
134844
+ title: "FFmpeg cannot start",
134845
+ detail: version2.detail,
134846
+ hint: "Install a working 64-bit FFmpeg build with all required runtime DLLs.",
134847
+ path: path2
134848
+ };
134849
+ }
134850
+ return { name: "FFmpeg", ok: true, level: "ok", detail: version2.detail, path: path2 };
134851
+ }
134852
+ return {
134853
+ name: "FFmpeg",
134854
+ ok: false,
134855
+ level: "error",
134856
+ title: "FFmpeg not found",
134857
+ // Second sentence dropped: "the render cannot proceed" is already said by
134858
+ // the error this accompanies, and in Studio by the disabled Export button.
134859
+ detail: "FFmpeg is required to encode video.",
134860
+ hint: getFFmpegInstallHint()
134861
+ };
134862
+ }
134863
+ function checkFFprobe() {
134864
+ const missingConfigured = configuredMissingDetail(FFPROBE_PATH_ENV);
134865
+ if (missingConfigured) {
134866
+ return {
134867
+ name: "FFprobe",
134868
+ ok: false,
134869
+ level: "error",
134870
+ title: "FFprobe not found",
134871
+ detail: missingConfigured,
134872
+ hint: getFFmpegInstallHint()
134873
+ };
134874
+ }
134875
+ const path2 = findFFprobe();
134876
+ if (path2) {
134877
+ const version2 = readToolVersion(path2);
134878
+ return { name: "FFprobe", ok: true, level: "ok", detail: version2.detail, path: path2 };
134879
+ }
134880
+ return {
134881
+ name: "FFprobe",
134882
+ ok: false,
134883
+ level: "error",
134884
+ title: "FFprobe not found",
134885
+ detail: "FFprobe is required to probe media assets. It ships with FFmpeg but was not found on PATH.",
134886
+ hint: getFFmpegInstallHint()
134887
+ };
134888
+ }
134889
+ function chromeSharedLibOutcome(executablePath, found) {
134890
+ if (process.platform !== "linux") return found;
134891
+ const probe = probeChromeSharedLibs(executablePath);
134892
+ if (probe.probeUnavailable || probe.ok) return found;
134893
+ const distro = detectLinuxDistro();
134894
+ return {
134895
+ name: "Chrome",
134896
+ ok: false,
134897
+ level: "error",
134898
+ title: "Chrome cannot launch (missing system libraries)",
134899
+ detail: `Chrome at ${executablePath} is missing shared libraries on ${distroLabel(distro)}: ${probe.missing.join(", ")}`,
134900
+ hint: chromeDepsInstallCommand(distro.family),
134901
+ path: executablePath
134902
+ };
134903
+ }
134904
+ async function checkChrome(browserPath) {
134905
+ if (browserPath) {
134906
+ if (existsSync69(browserPath)) {
134907
+ return chromeSharedLibOutcome(browserPath, {
134908
+ name: "Chrome",
134909
+ ok: true,
134910
+ level: "ok",
134911
+ detail: `explicit: ${browserPath}`,
134912
+ path: browserPath
134913
+ });
134914
+ }
134915
+ return {
134916
+ name: "Chrome",
134917
+ ok: false,
134918
+ level: "error",
134919
+ title: "Chrome not found",
134920
+ detail: `Chrome binary not found at "${browserPath}".`,
134921
+ hint: "Run: npx hyperframes browser ensure"
134922
+ };
134923
+ }
134924
+ let info;
134925
+ try {
134926
+ info = await findBrowser();
134927
+ } catch {
134928
+ info = void 0;
134929
+ }
134930
+ if (info) {
134931
+ return chromeSharedLibOutcome(info.executablePath, {
134932
+ name: "Chrome",
134933
+ ok: true,
134934
+ level: "ok",
134935
+ detail: `${info.source}: ${info.executablePath}`,
134936
+ path: info.executablePath
134937
+ });
134938
+ }
134939
+ return {
134940
+ name: "Chrome",
134941
+ ok: false,
134942
+ level: "error",
134943
+ title: "Chrome not found",
134944
+ detail: "Chrome Headless Shell is required for local rendering.",
134945
+ hint: "Run: npx hyperframes browser ensure"
134946
+ };
134947
+ }
134948
+ function checkDisk(path2 = ".", freeDiskMb = getFreeDiskMb) {
134949
+ const freeMb = freeDiskMb(path2);
134950
+ if (freeMb === null) {
134951
+ return { name: "Disk", ok: true, level: "ok", detail: "Unable to check" };
134952
+ }
134953
+ const freeGb = (freeMb / 1024).toFixed(1);
134954
+ if (freeMb < 1024) {
134955
+ return {
134956
+ name: "Disk",
134957
+ ok: false,
134958
+ level: "error",
134959
+ title: "Low disk space",
134960
+ detail: `${freeGb} GB free at ${path2}`,
134961
+ hint: "Renders produce large temp files. Free disk space before rendering."
134962
+ };
134963
+ }
134964
+ return { name: "Disk", ok: true, level: "ok", detail: `${freeGb} GB free at ${path2}` };
134965
+ }
134966
+ function checkWindowsUncPath(projectDir = process.cwd()) {
134967
+ if (platform7() !== "win32") return void 0;
134968
+ if (!projectDir.startsWith("\\\\")) return void 0;
134969
+ return {
134970
+ name: "Windows path",
134971
+ ok: true,
134972
+ level: "warn",
134973
+ detail: `UNC path: ${projectDir}`,
134974
+ hint: "Chrome may fail to launch from a network share. Use a local drive if render startup fails."
134975
+ };
134976
+ }
134977
+ async function runEnvironmentChecks(options = {}) {
134978
+ const outcomes = [];
134979
+ const ffmpeg = checkFFmpeg();
134980
+ outcomes.push(ffmpeg);
134981
+ const ffprobe = checkFFprobe();
134982
+ outcomes.push(ffprobe);
134983
+ let browser;
134984
+ if (options.includeBrowser) {
134985
+ const chrome = await checkChrome(options.browserPath);
134986
+ outcomes.push(chrome);
134987
+ if (chrome.ok && chrome.path) {
134988
+ browser = {
134989
+ executablePath: chrome.path,
134990
+ source: options.browserPath ? "env" : "cache"
134991
+ };
134992
+ }
134993
+ }
134994
+ if (options.includeDisk) {
134995
+ const diskPaths = [...new Set(options.diskPaths ?? [options.projectDir ?? "."])];
134996
+ outcomes.push(...diskPaths.map((path2) => checkDisk(path2)));
134997
+ }
134998
+ if (options.includeWindowsUnc) {
134999
+ const unc = checkWindowsUncPath(options.projectDir);
135000
+ if (unc) outcomes.push(unc);
135001
+ }
135002
+ return {
135003
+ outcomes,
135004
+ ...ffmpeg.ok && ffmpeg.path ? { ffmpegPath: ffmpeg.path } : {},
135005
+ ...ffprobe.path ? { ffprobePath: ffprobe.path } : {},
135006
+ ...browser ? { browser } : {}
135007
+ };
135008
+ }
135009
+ var init_preflight = __esm({
135010
+ "src/browser/preflight.ts"() {
135011
+ "use strict";
135012
+ init_manager2();
135013
+ init_ffmpeg();
135014
+ init_linuxDeps();
135015
+ init_system();
135016
+ }
135017
+ });
135018
+
134582
135019
  // src/server/studioServer.ts
134583
135020
  var studioServer_exports = {};
134584
135021
  __export(studioServer_exports, {
@@ -134589,7 +135026,7 @@ __export(studioServer_exports, {
134589
135026
  });
134590
135027
  import { Hono as Hono5 } from "hono";
134591
135028
  import { streamSSE as streamSSE4 } from "hono/streaming";
134592
- import { existsSync as existsSync69, readFileSync as readFileSync41, writeFileSync as writeFileSync27, statSync as statSync25, unlinkSync as unlinkSync6 } from "fs";
135029
+ import { existsSync as existsSync70, readFileSync as readFileSync41, writeFileSync as writeFileSync27, statSync as statSync25, unlinkSync as unlinkSync6 } from "fs";
134593
135030
  import { resolve as resolve38, join as join78, basename as basename11 } from "path";
134594
135031
  async function loadStudioProducer() {
134595
135032
  return isDevMode() ? await Promise.resolve().then(() => (init_src2(), src_exports2)) : await Promise.resolve().then(() => (init_src2(), src_exports2));
@@ -134600,12 +135037,12 @@ function resolveDistDir() {
134600
135037
  function resolveStudioBundle() {
134601
135038
  const builtPath = resolve38(__dirname, "studio");
134602
135039
  const builtIndex = resolve38(builtPath, "index.html");
134603
- if (existsSync69(builtIndex)) {
135040
+ if (existsSync70(builtIndex)) {
134604
135041
  return { dir: builtPath, indexPath: builtIndex, available: true, checkedPaths: [builtIndex] };
134605
135042
  }
134606
135043
  const devPath = resolve38(__dirname, "..", "..", "..", "studio", "dist");
134607
135044
  const devIndex = resolve38(devPath, "index.html");
134608
- if (existsSync69(devIndex)) {
135045
+ if (existsSync70(devIndex)) {
134609
135046
  return {
134610
135047
  dir: devPath,
134611
135048
  indexPath: devIndex,
@@ -134622,9 +135059,9 @@ function resolveStudioBundle() {
134622
135059
  }
134623
135060
  function resolveRuntimePath() {
134624
135061
  const builtPath = resolve38(__dirname, "hyperframe-runtime.js");
134625
- if (existsSync69(builtPath)) return builtPath;
135062
+ if (existsSync70(builtPath)) return builtPath;
134626
135063
  const iifePath = resolve38(__dirname, "hyperframe.runtime.iife.js");
134627
- if (existsSync69(iifePath)) return iifePath;
135064
+ if (existsSync70(iifePath)) return iifePath;
134628
135065
  const devPath = resolve38(
134629
135066
  __dirname,
134630
135067
  "..",
@@ -134634,12 +135071,12 @@ function resolveRuntimePath() {
134634
135071
  "dist",
134635
135072
  "hyperframe.runtime.iife.js"
134636
135073
  );
134637
- if (existsSync69(devPath)) return devPath;
135074
+ if (existsSync70(devPath)) return devPath;
134638
135075
  return builtPath;
134639
135076
  }
134640
135077
  function readStudioManualEditManifestContent(projectDir) {
134641
135078
  const manifestPath2 = join78(projectDir, STUDIO_MANUAL_EDITS_PATH2);
134642
- if (!existsSync69(manifestPath2)) return "";
135079
+ if (!existsSync70(manifestPath2)) return "";
134643
135080
  try {
134644
135081
  return readFileSync41(manifestPath2, "utf-8");
134645
135082
  } catch {
@@ -134750,7 +135187,7 @@ async function closeThumbnailBrowser() {
134750
135187
  async function loadPreviewServerBuildSignature() {
134751
135188
  const runtimeSignature = await loadRuntimeSourceSignature();
134752
135189
  const studioBundle = resolveStudioBundle();
134753
- const studioIndex = studioBundle.available && existsSync69(studioBundle.indexPath) ? readFileSync41(studioBundle.indexPath, "utf-8") : "";
135190
+ const studioIndex = studioBundle.available && existsSync70(studioBundle.indexPath) ? readFileSync41(studioBundle.indexPath, "utf-8") : "";
134754
135191
  return hashSignatureParts([
134755
135192
  VERSION,
134756
135193
  runtimeSignature,
@@ -134764,7 +135201,7 @@ async function loadPreviewServerBuildSignature() {
134764
135201
  }
134765
135202
  function rewriteWrittenToHostViewport(projectDir, written) {
134766
135203
  const indexPath2 = join78(projectDir, "index.html");
134767
- if (!existsSync69(indexPath2)) return;
135204
+ if (!existsSync70(indexPath2)) return;
134768
135205
  const indexHtml = readFileSync41(indexPath2, "utf-8");
134769
135206
  const hostW = indexHtml.match(/data-width="(\d+)"/)?.[1];
134770
135207
  const hostH = indexHtml.match(/data-height="(\d+)"/)?.[1];
@@ -134876,7 +135313,7 @@ function createStudioServer(options) {
134876
135313
  for (const suffix of ["", ".meta.json"]) {
134877
135314
  const fp = suffix ? opts.outputPath.replace(/\.(mp4|webm|mov)$/, suffix) : opts.outputPath;
134878
135315
  try {
134879
- if (existsSync69(fp)) unlinkSync6(fp);
135316
+ if (existsSync70(fp)) unlinkSync6(fp);
134880
135317
  } catch {
134881
135318
  }
134882
135319
  }
@@ -134963,7 +135400,7 @@ function createStudioServer(options) {
134963
135400
  return null;
134964
135401
  }
134965
135402
  const sourcePath = join78(opts.project.dir, opts.compPath);
134966
- if (existsSync69(sourcePath)) {
135403
+ if (existsSync70(sourcePath)) {
134967
135404
  assertWebGpuRequirement(
134968
135405
  readFileSync41(sourcePath, "utf-8"),
134969
135406
  session.requestedGpuMode,
@@ -135089,7 +135526,7 @@ function createStudioServer(options) {
135089
135526
  });
135090
135527
  app.get("/api/runtime.js", (c3) => {
135091
135528
  const serve4 = async () => {
135092
- const runtimeSource = await loadRuntimeSource() ?? (existsSync69(runtimePath) ? readFileSync41(runtimePath, "utf-8") : null);
135529
+ const runtimeSource = await loadRuntimeSource() ?? (existsSync70(runtimePath) ? readFileSync41(runtimePath, "utf-8") : null);
135093
135530
  if (!runtimeSource) return c3.text("runtime not available", 404);
135094
135531
  return c3.body(runtimeSource, 200, {
135095
135532
  "Content-Type": "text/javascript",
@@ -135124,6 +135561,27 @@ function createStudioServer(options) {
135124
135561
  }
135125
135562
  });
135126
135563
  });
135564
+ let ffmpegReady = false;
135565
+ app.get("/api/environment/ffmpeg", async (c3) => {
135566
+ if (ffmpegReady) return c3.json({ ok: true });
135567
+ const [{ runEnvironmentChecks: runEnvironmentChecks2 }, { getFFmpegInstallCommand: getFFmpegInstallCommand2 }] = await Promise.all([
135568
+ Promise.resolve().then(() => (init_preflight(), preflight_exports)),
135569
+ Promise.resolve().then(() => (init_ffmpeg(), ffmpeg_exports))
135570
+ ]);
135571
+ const { outcomes } = await runEnvironmentChecks2();
135572
+ const failed = outcomes.find((outcome) => !outcome.ok);
135573
+ if (!failed) {
135574
+ ffmpegReady = true;
135575
+ return c3.json({ ok: true });
135576
+ }
135577
+ return c3.json({
135578
+ ok: false,
135579
+ title: failed.title ?? `${failed.name} not found`,
135580
+ detail: failed.detail,
135581
+ hint: failed.hint,
135582
+ command: getFFmpegInstallCommand2()
135583
+ });
135584
+ });
135127
135585
  let cachedFFmpegPath;
135128
135586
  app.post("/api/projects/:id/render", async (c3, next) => {
135129
135587
  const { findFFmpeg: findFFmpeg2, getFFmpegInstallHint: getFFmpegInstallHint2 } = await Promise.resolve().then(() => (init_ffmpeg(), ffmpeg_exports));
@@ -135150,7 +135608,7 @@ function createStudioServer(options) {
135150
135608
  });
135151
135609
  const serveStudioStaticFile = (c3) => {
135152
135610
  const filePath = resolve38(studioDir, c3.req.path.slice(1));
135153
- if (!existsSync69(filePath) || !statSync25(filePath).isFile()) return c3.text("not found", 404);
135611
+ if (!existsSync70(filePath) || !statSync25(filePath).isFile()) return c3.text("not found", 404);
135154
135612
  const content = readFileSync41(filePath);
135155
135613
  return new Response(content, {
135156
135614
  headers: { "Content-Type": getMimeType(filePath), "Cache-Control": "no-store" }
@@ -135171,7 +135629,7 @@ function createStudioServer(options) {
135171
135629
  }
135172
135630
  app.get("*", (c3) => {
135173
135631
  const indexPath2 = resolve38(studioDir, "index.html");
135174
- if (!existsSync69(indexPath2)) {
135632
+ if (!existsSync70(indexPath2)) {
135175
135633
  return c3.html(
135176
135634
  `<!doctype html>
135177
135635
  <html>
@@ -135268,7 +135726,7 @@ __export(preview_exports, {
135268
135726
  });
135269
135727
  import { spawn as spawn13 } from "child_process";
135270
135728
  import {
135271
- existsSync as existsSync70,
135729
+ existsSync as existsSync71,
135272
135730
  lstatSync as lstatSync7,
135273
135731
  mkdirSync as mkdirSync37,
135274
135732
  readFileSync as readFileSync43,
@@ -135563,7 +136021,7 @@ function compactSelectionPayload(selection) {
135563
136021
  }
135564
136022
  function studioLandingSearch(projectDir) {
135565
136023
  const storyboardPath = join79(projectDir, STORYBOARD_FILENAME);
135566
- if (!existsSync70(storyboardPath)) return "";
136024
+ if (!existsSync71(storyboardPath)) return "";
135567
136025
  let frames;
135568
136026
  try {
135569
136027
  frames = parseStoryboard(readFileSync43(storyboardPath, "utf8")).frames;
@@ -135572,7 +136030,7 @@ function studioLandingSearch(projectDir) {
135572
136030
  }
135573
136031
  if (frames.some((f3) => f3.status === "built")) return "?view=storyboard";
135574
136032
  const srcs = frames.map((f3) => f3.src).filter((s2) => typeof s2 === "string" && s2.length > 0);
135575
- const planning = frames.length > 0 && frames.every((f3) => f3.status === "outline") && srcs.length > 0 && !srcs.some((s2) => existsSync70(join79(projectDir, s2)));
136033
+ const planning = frames.length > 0 && frames.every((f3) => f3.status === "outline") && srcs.length > 0 && !srcs.some((s2) => existsSync71(join79(projectDir, s2)));
135576
136034
  return planning ? "?view=storyboard" : "";
135577
136035
  }
135578
136036
  function studioDeepLink(url, projectName, projectDir) {
@@ -135604,7 +136062,7 @@ function linkProjectIntoStudioData(dir, projectsDir, projectName) {
135604
136062
  mkdirSync37(projectsDir, { recursive: true });
135605
136063
  let createdSymlink = false;
135606
136064
  if (dir !== symlinkPath) {
135607
- if (existsSync70(symlinkPath)) {
136065
+ if (existsSync71(symlinkPath)) {
135608
136066
  try {
135609
136067
  const stat3 = lstatSync7(symlinkPath);
135610
136068
  if (stat3.isSymbolicLink() && resolve39(readlinkSync(symlinkPath)) !== resolve39(dir)) {
@@ -135613,7 +136071,7 @@ function linkProjectIntoStudioData(dir, projectsDir, projectName) {
135613
136071
  } catch {
135614
136072
  }
135615
136073
  }
135616
- if (!existsSync70(symlinkPath)) {
136074
+ if (!existsSync71(symlinkPath)) {
135617
136075
  symlinkSync3(dir, symlinkPath, process.platform === "win32" ? "junction" : "dir");
135618
136076
  createdSymlink = true;
135619
136077
  }
@@ -135624,7 +136082,7 @@ function removeSymlinkOnExit(createdSymlink, symlinkPath) {
135624
136082
  if (!createdSymlink) return;
135625
136083
  process.on("exit", () => {
135626
136084
  try {
135627
- if (existsSync70(symlinkPath)) unlinkSync7(symlinkPath);
136085
+ if (existsSync71(symlinkPath)) unlinkSync7(symlinkPath);
135628
136086
  } catch {
135629
136087
  }
135630
136088
  });
@@ -136188,7 +136646,7 @@ __export(init_exports, {
136188
136646
  resolveVideoDurationSeconds: () => resolveVideoDurationSeconds
136189
136647
  });
136190
136648
  import {
136191
- existsSync as existsSync71,
136649
+ existsSync as existsSync73,
136192
136650
  mkdirSync as mkdirSync38,
136193
136651
  copyFileSync as copyFileSync9,
136194
136652
  cpSync as cpSync5,
@@ -136198,7 +136656,7 @@ import {
136198
136656
  } from "fs";
136199
136657
  import { resolve as resolve40, basename as basename13, join as join80, dirname as dirname34 } from "path";
136200
136658
  import { fileURLToPath as fileURLToPath9 } from "url";
136201
- import { execFileSync as execFileSync8, spawn as spawn14 } from "child_process";
136659
+ import { execFileSync as execFileSync9, spawn as spawn14 } from "child_process";
136202
136660
  function resolveVideoDurationSeconds({
136203
136661
  streamDuration,
136204
136662
  frameDuration,
@@ -136212,7 +136670,7 @@ function probeVideo(filePath) {
136212
136670
  try {
136213
136671
  const ffprobePath = findFFprobe();
136214
136672
  if (!ffprobePath) return void 0;
136215
- const raw = execFileSync8(
136673
+ const raw = execFileSync9(
136216
136674
  ffprobePath,
136217
136675
  ["-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "--", filePath],
136218
136676
  { encoding: "utf-8", timeout: 15e3 }
@@ -136291,14 +136749,14 @@ function resolveAssetDir(devSegments, builtSegments) {
136291
136749
  const base2 = dirname34(fileURLToPath9(import.meta.url));
136292
136750
  const devPath = resolve40(base2, ...devSegments);
136293
136751
  const builtPath = resolve40(base2, ...builtSegments);
136294
- return existsSync71(devPath) ? devPath : builtPath;
136752
+ return existsSync73(devPath) ? devPath : builtPath;
136295
136753
  }
136296
136754
  function getStaticTemplateDir(templateId) {
136297
136755
  const base2 = dirname34(fileURLToPath9(import.meta.url));
136298
136756
  const devPath = resolve40(base2, "..", "templates", templateId);
136299
- if (existsSync71(devPath)) return devPath;
136757
+ if (existsSync73(devPath)) return devPath;
136300
136758
  const registryPath = resolve40(base2, "..", "..", "..", "..", "registry", "examples", templateId);
136301
- if (existsSync71(registryPath)) return registryPath;
136759
+ if (existsSync73(registryPath)) return registryPath;
136302
136760
  return resolve40(base2, "templates", templateId);
136303
136761
  }
136304
136762
  function getSharedTemplateDir() {
@@ -136324,7 +136782,7 @@ function buildPackageScripts() {
136324
136782
  }
136325
136783
  function writeDefaultPackageJson(destDir, projectName) {
136326
136784
  const packageJsonPath = resolve40(destDir, "package.json");
136327
- if (existsSync71(packageJsonPath)) return;
136785
+ if (existsSync73(packageJsonPath)) return;
136328
136786
  writeFileSync28(
136329
136787
  packageJsonPath,
136330
136788
  `${JSON.stringify(
@@ -136546,7 +137004,7 @@ function applyResolutionPreset(destDir, resolution) {
136546
137004
  async function scaffoldProject(destDir, name, templateId, localVideoName, durationSeconds, tailwind = false, resolution, authoringSkill) {
136547
137005
  mkdirSync38(destDir, { recursive: true });
136548
137006
  const templateDir = getStaticTemplateDir(templateId);
136549
- if (existsSync71(join80(templateDir, "index.html"))) {
137007
+ if (existsSync73(join80(templateDir, "index.html"))) {
136550
137008
  cpSync5(templateDir, destDir, { recursive: true });
136551
137009
  } else {
136552
137010
  await fetchRemoteTemplate(templateId, destDir);
@@ -136567,7 +137025,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
136567
137025
  ),
136568
137026
  "utf-8"
136569
137027
  );
136570
- if (!existsSync71(resolve40(destDir, "hyperframes.json"))) {
137028
+ if (!existsSync73(resolve40(destDir, "hyperframes.json"))) {
136571
137029
  const { writeProjectConfig: writeProjectConfig2, DEFAULT_PROJECT_CONFIG: DEFAULT_PROJECT_CONFIG2 } = await Promise.resolve().then(() => (init_projectConfig(), projectConfig_exports));
136572
137030
  const { normalizeSkillSlug: normalizeSkillSlug2 } = await Promise.resolve().then(() => (init_skill(), skill_exports));
136573
137031
  const skill = normalizeSkillSlug2(authoringSkill);
@@ -136578,7 +137036,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
136578
137036
  }
136579
137037
  writeDefaultPackageJson(destDir, name);
136580
137038
  const sharedDir = getSharedTemplateDir();
136581
- if (existsSync71(sharedDir)) {
137039
+ if (existsSync73(sharedDir)) {
136582
137040
  for (const entry of readdirSync26(sharedDir, { withFileTypes: true })) {
136583
137041
  const src = join80(sharedDir, entry.name);
136584
137042
  const dest = resolve40(destDir, entry.name);
@@ -136798,7 +137256,7 @@ var init_init = __esm({
136798
137256
  const templateId2 = exampleFlag ?? "blank";
136799
137257
  const name2 = args.name ?? "my-video";
136800
137258
  const destDir2 = resolve40(name2);
136801
- if (existsSync71(destDir2) && readdirSync26(destDir2).length > 0) {
137259
+ if (existsSync73(destDir2) && readdirSync26(destDir2).length > 0) {
136802
137260
  console.error(c.error(`Directory already exists and is not empty: ${name2}`));
136803
137261
  failCommand();
136804
137262
  }
@@ -136807,12 +137265,12 @@ var init_init = __esm({
136807
137265
  failCommand();
136808
137266
  }
136809
137267
  const videoPath = videoFlag ? resolve40(videoFlag) : void 0;
136810
- if (videoPath && !existsSync71(videoPath)) {
137268
+ if (videoPath && !existsSync73(videoPath)) {
136811
137269
  console.error(c.error(`Video file not found: ${videoFlag}`));
136812
137270
  failCommand();
136813
137271
  }
136814
137272
  const audioPath = audioFlag ? resolve40(audioFlag) : void 0;
136815
- if (audioPath && !existsSync71(audioPath)) {
137273
+ if (audioPath && !existsSync73(audioPath)) {
136816
137274
  console.error(c.error(`Audio file not found: ${audioFlag}`));
136817
137275
  failCommand();
136818
137276
  }
@@ -136875,7 +137333,7 @@ var init_init = __esm({
136875
137333
  }
136876
137334
  trackInitTemplate(templateId2, { tailwind });
136877
137335
  const transcriptFile2 = resolve40(destDir2, "transcript.json");
136878
- if (existsSync71(transcriptFile2)) {
137336
+ if (existsSync73(transcriptFile2)) {
136879
137337
  await patchTranscript(destDir2, transcriptFile2);
136880
137338
  }
136881
137339
  console.log(c.success(`Created ${c.accent(name2 + "/")}`));
@@ -136939,7 +137397,7 @@ var init_init = __esm({
136939
137397
  name = nameResult;
136940
137398
  }
136941
137399
  const destDir = resolve40(name);
136942
- if (existsSync71(destDir) && readdirSync26(destDir).length > 0) {
137400
+ if (existsSync73(destDir) && readdirSync26(destDir).length > 0) {
136943
137401
  const overwrite = await ue({
136944
137402
  message: `Directory ${c.accent(name)} already exists and is not empty. Overwrite?`,
136945
137403
  initialValue: false
@@ -136954,7 +137412,7 @@ var init_init = __esm({
136954
137412
  let videoDuration;
136955
137413
  if (videoFlag) {
136956
137414
  const videoPath = resolve40(videoFlag);
136957
- if (!existsSync71(videoPath)) {
137415
+ if (!existsSync73(videoPath)) {
136958
137416
  R2.error(`File not found: ${videoFlag}`);
136959
137417
  me("Setup cancelled.");
136960
137418
  failCommand();
@@ -136966,7 +137424,7 @@ var init_init = __esm({
136966
137424
  videoDuration = result.meta.durationSeconds;
136967
137425
  } else if (audioFlag) {
136968
137426
  const audioPath = resolve40(audioFlag);
136969
- if (!existsSync71(audioPath)) {
137427
+ if (!existsSync73(audioPath)) {
136970
137428
  R2.error(`File not found: ${audioFlag}`);
136971
137429
  me("Setup cancelled.");
136972
137430
  failCommand();
@@ -137068,7 +137526,7 @@ ${c.dim("Use --example blank for offline use.")}`
137068
137526
  }
137069
137527
  trackInitTemplate(templateId, { tailwind });
137070
137528
  const transcriptFile = resolve40(destDir, "transcript.json");
137071
- if (existsSync71(transcriptFile)) {
137529
+ if (existsSync73(transcriptFile)) {
137072
137530
  await patchTranscript(destDir, transcriptFile);
137073
137531
  }
137074
137532
  const files = readdirSync26(destDir);
@@ -137089,9 +137547,9 @@ ${c.dim("Use --example blank for offline use.")}`
137089
137547
 
137090
137548
  // src/utils/clipboard.ts
137091
137549
  import { spawnSync as spawnSync3 } from "child_process";
137092
- import { platform as platform7 } from "os";
137550
+ import { platform as platform8 } from "os";
137093
137551
  function detectProvider() {
137094
- const os = platform7();
137552
+ const os = platform8();
137095
137553
  if (os === "darwin") {
137096
137554
  return { cmd: "pbcopy", args: [] };
137097
137555
  }
@@ -137139,12 +137597,13 @@ __export(add_exports, {
137139
137597
  AddError: () => AddError,
137140
137598
  buildSnippet: () => buildSnippet,
137141
137599
  default: () => add_default,
137600
+ describeInstallFailure: () => describeInstallFailure,
137142
137601
  examples: () => examples4,
137143
137602
  parseVariableValues: () => parseVariableValues,
137144
137603
  remapTarget: () => remapTarget,
137145
137604
  runAdd: () => runAdd
137146
137605
  });
137147
- import { existsSync as existsSync73 } from "fs";
137606
+ import { existsSync as existsSync74 } from "fs";
137148
137607
  import { resolve as resolve41, relative as relative17 } from "path";
137149
137608
  function remapTarget(item, originalTarget, paths) {
137150
137609
  if (item.type === "hyperframes:block") {
@@ -137196,28 +137655,51 @@ function assertCompatibleOrThrow(items, cliVersion) {
137196
137655
  throw err;
137197
137656
  }
137198
137657
  }
137199
- async function installAll(installPlan, destDir, baseUrl, force) {
137658
+ async function installAll(installPlan, destDir, baseUrl, force, requestedName, variableValues) {
137200
137659
  const written = [];
137201
137660
  const preserved = [];
137661
+ let variablesApplied = [];
137662
+ let variablesUnknown = [];
137663
+ let variablesInvalid = [];
137202
137664
  try {
137203
137665
  for (const planItem of installPlan) {
137204
- const result = await installItem(planItem, { destDir, baseUrl, force });
137666
+ const result = await installItem(planItem, {
137667
+ destDir,
137668
+ baseUrl,
137669
+ force,
137670
+ // Only the item the user named. A dependency dragged in behind it never
137671
+ // declared these variables and must not be rewritten by them.
137672
+ variableValues: planItem.name === requestedName ? variableValues : null
137673
+ });
137205
137674
  written.push(...result.written);
137206
137675
  preserved.push(...result.preserved);
137676
+ if (planItem.name === requestedName) {
137677
+ variablesApplied = result.variablesApplied;
137678
+ variablesUnknown = result.variablesUnknown;
137679
+ variablesInvalid = result.variablesInvalid;
137680
+ }
137207
137681
  }
137208
137682
  } catch (err) {
137209
- throw new AddError(
137210
- `Install failed: ${err instanceof Error ? err.message : String(err)}`,
137211
- "install-failed"
137212
- );
137683
+ throw new AddError(describeInstallFailure(err, baseUrl), "install-failed");
137213
137684
  }
137214
- return { written, preserved };
137685
+ return { written, preserved, variablesApplied, variablesUnknown, variablesInvalid };
137686
+ }
137687
+ function describeInstallFailure(err, registry) {
137688
+ const message = err instanceof Error ? err.message : String(err);
137689
+ const cause = err instanceof Error && err.cause instanceof Error ? err.cause.message : "";
137690
+ const transport = /fetch failed|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|socket hang up|aborted/i;
137691
+ if (!transport.test(`${message} ${cause}`)) return `Install failed: ${message}`;
137692
+ const custom = registry && !registry.startsWith(DEFAULT_REGISTRY_URL) ? `
137693
+ This project's hyperframes.json sets registry to ${registry}, so that is the host being contacted, not the public registry. If it is down or private, that is the failure.` : "";
137694
+ return `Install failed: could not download the item's files.
137695
+ ${message}
137696
+ Item files are not cached, so every install fetches them. This is usually the registry host or the network rather than a bad command.` + custom + "\n Retry, or set HTTPS_PROXY if you are behind a proxy.";
137215
137697
  }
137216
137698
  async function runAdd(opts) {
137217
137699
  const projectDir = resolve41(opts.projectDir);
137218
137700
  let config = loadProjectConfig(projectDir);
137219
- const hasConfig = existsSync73(projectConfigPath(projectDir));
137220
- if (!hasConfig && existsSync73(resolve41(projectDir, "index.html"))) {
137701
+ const hasConfig = existsSync74(projectConfigPath(projectDir));
137702
+ if (!hasConfig && existsSync74(resolve41(projectDir, "index.html"))) {
137221
137703
  writeProjectConfig(projectDir, DEFAULT_PROJECT_CONFIG);
137222
137704
  config = DEFAULT_PROJECT_CONFIG;
137223
137705
  }
@@ -137242,11 +137724,14 @@ async function runAdd(opts) {
137242
137724
  target: remapTarget(resolvedItem, f3.target, config.paths)
137243
137725
  }))
137244
137726
  }));
137245
- const { written, preserved } = await installAll(
137727
+ const variableValues = parseVariableValues(opts.vars);
137728
+ const { written, preserved, variablesApplied, variablesUnknown, variablesInvalid } = await installAll(
137246
137729
  installPlan,
137247
137730
  projectDir,
137248
137731
  config.registry,
137249
- opts.force ?? false
137732
+ opts.force ?? false,
137733
+ item.name,
137734
+ variableValues
137250
137735
  );
137251
137736
  for (const planItem of installPlan) {
137252
137737
  trackRegistryItemAdded({
@@ -137258,8 +137743,14 @@ async function runAdd(opts) {
137258
137743
  const itemForInstall = installPlan[installPlan.length - 1];
137259
137744
  const primaryFile = itemForInstall.files.find((f3) => f3.type === "hyperframes:snippet") ?? itemForInstall.files.find((f3) => f3.type === "hyperframes:composition") ?? itemForInstall.files[0];
137260
137745
  const snippetTargetRel = primaryFile?.target ?? "";
137261
- const snippet = buildSnippet(item, snippetTargetRel, parseVariableValues(opts.vars));
137746
+ const snippet = buildSnippet(item, snippetTargetRel, variableValues);
137262
137747
  const clipboardCopied = !opts.skipClipboard && snippet ? copyToClipboard(snippet) : false;
137748
+ for (const { id, reason } of variablesInvalid) {
137749
+ warnings.push(`--vars ${id} ignored: ${reason}`);
137750
+ }
137751
+ if (variablesUnknown.length > 0) {
137752
+ warnings.push(`--vars ignored (not declared by ${item.name}): ${variablesUnknown.join(", ")}`);
137753
+ }
137263
137754
  return {
137264
137755
  ok: true,
137265
137756
  name: item.name,
@@ -137270,6 +137761,7 @@ async function runAdd(opts) {
137270
137761
  installed: installPlan.map((planItem) => planItem.name),
137271
137762
  snippet,
137272
137763
  clipboardCopied,
137764
+ variablesApplied,
137273
137765
  warnings
137274
137766
  };
137275
137767
  }
@@ -137350,7 +137842,7 @@ var init_add = __esm({
137350
137842
  const projectDir = resolve41(args.dir ?? process.cwd());
137351
137843
  const json = args.json === true;
137352
137844
  const skipClipboard = args.clipboard === false;
137353
- const hasConfigBefore = existsSync73(projectConfigPath(projectDir));
137845
+ const hasConfigBefore = existsSync74(projectConfigPath(projectDir));
137354
137846
  try {
137355
137847
  const result = await runAdd({
137356
137848
  name: args.name,
@@ -137359,7 +137851,7 @@ var init_add = __esm({
137359
137851
  force: args.force,
137360
137852
  vars: args.vars
137361
137853
  });
137362
- const wroteConfig = !hasConfigBefore && existsSync73(projectConfigPath(projectDir));
137854
+ const wroteConfig = !hasConfigBefore && existsSync74(projectConfigPath(projectDir));
137363
137855
  if (json) {
137364
137856
  console.log(JSON.stringify(result));
137365
137857
  return;
@@ -137380,6 +137872,9 @@ var init_add = __esm({
137380
137872
  for (const file of result.written) {
137381
137873
  console.log(` ${c.dim(relative17(projectDir, file))}`);
137382
137874
  }
137875
+ if (result.variablesApplied.length > 0) {
137876
+ console.log(` ${c.dim(`variables applied: ${result.variablesApplied.join(", ")}`)}`);
137877
+ }
137383
137878
  if (result.snippet) {
137384
137879
  console.log("");
137385
137880
  console.log(c.dim("Include snippet:"));
@@ -137397,7 +137892,7 @@ var init_add = __esm({
137397
137892
  failCommand();
137398
137893
  }
137399
137894
  let config = loadProjectConfig(projectDir);
137400
- if (!existsSync73(projectConfigPath(projectDir)) && existsSync73(resolve41(projectDir, "index.html"))) {
137895
+ if (!existsSync74(projectConfigPath(projectDir)) && existsSync74(resolve41(projectDir, "index.html"))) {
137401
137896
  writeProjectConfig(projectDir, DEFAULT_PROJECT_CONFIG);
137402
137897
  config = DEFAULT_PROJECT_CONFIG;
137403
137898
  }
@@ -137467,23 +137962,48 @@ function tokenize(text2) {
137467
137962
  function hasNoSearchableTokens(query2) {
137468
137963
  return tokenize(query2).length === 0 && query2.trim().length > 0;
137469
137964
  }
137965
+ function expandCompounds(want, order, vocabulary) {
137966
+ const infer = (token) => {
137967
+ if (!want.has(token)) want.set(token, INFERRED_TOKEN_WEIGHT);
137968
+ };
137969
+ for (const token of order) {
137970
+ if (token.length < 6) continue;
137971
+ for (let cut = 3; cut <= token.length - 3; cut++) {
137972
+ const head = token.slice(0, cut);
137973
+ const tail = token.slice(cut);
137974
+ if (vocabulary.has(head) && vocabulary.has(tail)) {
137975
+ infer(head);
137976
+ infer(tail);
137977
+ break;
137978
+ }
137979
+ }
137980
+ }
137981
+ for (let i2 = 0; i2 < order.length - 1; i2++) {
137982
+ const joined = `${order[i2]}${order[i2 + 1]}`;
137983
+ if (vocabulary.has(joined)) infer(joined);
137984
+ }
137985
+ }
137470
137986
  function rankByWords(query2, items, textOf) {
137471
- const want = new Set(tokenize(query2));
137987
+ const asked = tokenize(query2);
137988
+ const want = new Map(asked.map((token) => [token, 1]));
137472
137989
  if (want.size === 0) return items.map((item) => ({ item, score: 0 }));
137473
137990
  const parsed = items.map((item) => {
137474
137991
  const { strong, weak } = textOf(item);
137475
137992
  const strongTokens = new Set(tokenize(strong));
137476
137993
  return { item, strongTokens, allTokens: /* @__PURE__ */ new Set([...strongTokens, ...tokenize(weak)]) };
137477
137994
  });
137995
+ const vocabulary = /* @__PURE__ */ new Set();
137996
+ for (const entry of parsed) for (const token of entry.allTokens) vocabulary.add(token);
137997
+ expandCompounds(want, asked, vocabulary);
137478
137998
  const idf = /* @__PURE__ */ new Map();
137479
- for (const token of want) {
137999
+ for (const token of want.keys()) {
137480
138000
  const df = parsed.reduce((count, p2) => count + (p2.allTokens.has(token) ? 1 : 0), 0);
137481
138001
  idf.set(token, Math.log((parsed.length + 1) / (df + 1)) + 1);
137482
138002
  }
137483
138003
  return parsed.map(({ item, strongTokens, allTokens }) => {
137484
138004
  let shared = 0;
137485
- for (const token of want) {
137486
- const weight = idf.get(token) ?? 1;
138005
+ for (const [token, asking] of want) {
138006
+ const weight = (idf.get(token) ?? 1) * asking;
137487
138007
  if (strongTokens.has(token)) shared += STRONG_FIELD_WEIGHT * weight;
137488
138008
  else if (allTokens.has(token)) shared += weight;
137489
138009
  }
@@ -137497,7 +138017,7 @@ function nameOf(item) {
137497
138017
  const named = item;
137498
138018
  return typeof named?.name === "string" ? named.name : "";
137499
138019
  }
137500
- var STOP, STRONG_FIELD_WEIGHT, PLURAL_RULES;
138020
+ var STOP, STRONG_FIELD_WEIGHT, PLURAL_RULES, INFERRED_TOKEN_WEIGHT;
137501
138021
  var init_localSearch = __esm({
137502
138022
  "src/registry/localSearch.ts"() {
137503
138023
  "use strict";
@@ -137515,12 +138035,13 @@ var init_localSearch = __esm({
137515
138035
  [/s$/, ""]
137516
138036
  // counts -> count, pulses -> pulse
137517
138037
  ];
138038
+ INFERRED_TOKEN_WEIGHT = 0.35;
137518
138039
  }
137519
138040
  });
137520
138041
 
137521
138042
  // src/registry/localModel.ts
137522
138043
  import { createHash as createHash19 } from "crypto";
137523
- import { existsSync as existsSync74, mkdirSync as mkdirSync39, readFileSync as readFileSync45, unlinkSync as unlinkSync8 } from "fs";
138044
+ import { existsSync as existsSync75, mkdirSync as mkdirSync39, readFileSync as readFileSync45, unlinkSync as unlinkSync8 } from "fs";
137524
138045
  import { homedir as homedir15 } from "os";
137525
138046
  import { join as join81 } from "path";
137526
138047
  function localModelConsent() {
@@ -137537,7 +138058,7 @@ function localTokenizerPath() {
137537
138058
  }
137538
138059
  function modelFileIsValid(file) {
137539
138060
  const path2 = file.dest();
137540
- if (!existsSync74(path2)) return false;
138061
+ if (!existsSync75(path2)) return false;
137541
138062
  try {
137542
138063
  return createHash19("sha256").update(readFileSync45(path2)).digest("hex") === file.sha256;
137543
138064
  } catch {
@@ -137676,7 +138197,7 @@ function wordPiece(word, config) {
137676
138197
  }
137677
138198
  return pieces;
137678
138199
  }
137679
- function encode2(text2, config) {
138200
+ function encode3(text2, config) {
137680
138201
  const tokens = [config.clsToken];
137681
138202
  for (const word of preTokenize(normalize(text2))) tokens.push(...wordPiece(word, config));
137682
138203
  tokens.push(config.sepToken);
@@ -137727,7 +138248,7 @@ async function loadLocalEmbedder() {
137727
138248
  async embed(texts, options) {
137728
138249
  if (texts.length === 0) return [];
137729
138250
  const prefix = options?.isQuery ? QUERY_INSTRUCTION : "";
137730
- const encodings = texts.map((text2) => truncate(encode2(prefix + text2, config)));
138251
+ const encodings = texts.map((text2) => truncate(encode3(prefix + text2, config)));
137731
138252
  const width = Math.max(...encodings.map((e3) => e3.ids.length));
137732
138253
  const batch = encodings.length;
137733
138254
  const ids = new BigInt64Array(batch * width);
@@ -137791,7 +138312,7 @@ var init_localEmbedder = __esm({
137791
138312
  });
137792
138313
 
137793
138314
  // src/registry/localSemantic.ts
137794
- import { existsSync as existsSync75, mkdirSync as mkdirSync40, readFileSync as readFileSync47, writeFileSync as writeFileSync29 } from "fs";
138315
+ import { existsSync as existsSync76, mkdirSync as mkdirSync40, readFileSync as readFileSync47, writeFileSync as writeFileSync29 } from "fs";
137795
138316
  import { homedir as homedir16 } from "os";
137796
138317
  import { join as join83 } from "path";
137797
138318
  function localVectorDirectory() {
@@ -137845,7 +138366,7 @@ async function fetchLocalVectors(registryBaseUrl, options = {}) {
137845
138366
  }
137846
138367
  }
137847
138368
  function hasLocalVectors(directory = localVectorDirectory()) {
137848
- return existsSync75(join83(directory, "local-vectors.bin")) && existsSync75(join83(directory, "local-vectors.json"));
138369
+ return existsSync76(join83(directory, "local-vectors.bin")) && existsSync76(join83(directory, "local-vectors.json"));
137849
138370
  }
137850
138371
  function loadLocalVectors(directory = localVectorDirectory()) {
137851
138372
  const meta = JSON.parse(
@@ -138345,7 +138866,7 @@ var init_mediaProxyPreview = __esm({
138345
138866
  });
138346
138867
 
138347
138868
  // src/utils/compositionServer.ts
138348
- import { createReadStream as createReadStream6, existsSync as existsSync76, statSync as statSync26 } from "fs";
138869
+ import { createReadStream as createReadStream6, existsSync as existsSync77, statSync as statSync26 } from "fs";
138349
138870
  import { resolve as resolve44, dirname as dirname35 } from "path";
138350
138871
  import { Readable as Readable3 } from "stream";
138351
138872
  import { fileURLToPath as fileURLToPath10 } from "url";
@@ -138360,7 +138881,7 @@ function resolveRuntimePath2() {
138360
138881
  // Monorepo dev: src/<dir>/ → src/ → cli/ → packages/ then into core/dist/
138361
138882
  resolve44(d2, "..", "..", "..", "core", "dist", "hyperframe.runtime.iife.js")
138362
138883
  ];
138363
- return candidates.find((p2) => existsSync76(p2)) ?? null;
138884
+ return candidates.find((p2) => existsSync77(p2)) ?? null;
138364
138885
  }
138365
138886
  function resolvePlayerPath() {
138366
138887
  const d2 = helperDir();
@@ -138369,7 +138890,7 @@ function resolvePlayerPath() {
138369
138890
  resolve44(d2, "hyperframes-player.global.js"),
138370
138891
  resolve44(d2, "..", "hyperframes-player.global.js")
138371
138892
  ];
138372
- return candidates.find((p2) => existsSync76(p2)) ?? null;
138893
+ return candidates.find((p2) => existsSync77(p2)) ?? null;
138373
138894
  }
138374
138895
  function resolveSlideshowPath() {
138375
138896
  const d2 = helperDir();
@@ -138378,7 +138899,7 @@ function resolveSlideshowPath() {
138378
138899
  resolve44(d2, "hyperframes-slideshow.global.js"),
138379
138900
  resolve44(d2, "..", "hyperframes-slideshow.global.js")
138380
138901
  ];
138381
- return candidates.find((p2) => existsSync76(p2)) ?? null;
138902
+ return candidates.find((p2) => existsSync77(p2)) ?? null;
138382
138903
  }
138383
138904
  function injectRuntime(html) {
138384
138905
  return injectTagsAtHeadStart(html, `<script src="/runtime.js"></script>`);
@@ -138506,7 +139027,7 @@ __export(play_exports, {
138506
139027
  examples: () => examples6,
138507
139028
  registerCompositionRoute: () => registerCompositionRoute
138508
139029
  });
138509
- import { existsSync as existsSync77, readFileSync as readFileSync48 } from "fs";
139030
+ import { existsSync as existsSync78, readFileSync as readFileSync48 } from "fs";
138510
139031
  import { resolve as resolve45 } from "path";
138511
139032
  async function registerCompositionRoute(app, project, autoProxy) {
138512
139033
  const { isSafePath: isSafePath2 } = await Promise.resolve().then(() => (init_studio_api(), studio_api_exports));
@@ -138514,7 +139035,7 @@ async function registerCompositionRoute(app, project, autoProxy) {
138514
139035
  const reqPath = ctx.req.path.replace("/composition/", "");
138515
139036
  const filePath = resolve45(project.dir, reqPath);
138516
139037
  if (!isSafePath2(project.dir, filePath)) return ctx.text("Forbidden", 403);
138517
- if (!existsSync77(filePath)) return ctx.text("Not found", 404);
139038
+ if (!existsSync78(filePath)) return ctx.text("Not found", 404);
138518
139039
  if (filePath.endsWith(".html")) {
138519
139040
  let html = injectRuntime(readFileSync48(filePath, "utf-8"));
138520
139041
  if (autoProxy) {
@@ -138749,7 +139270,7 @@ __export(present_exports, {
138749
139270
  default: () => present_default,
138750
139271
  examples: () => examples7
138751
139272
  });
138752
- import { existsSync as existsSync78, readFileSync as readFileSync49 } from "fs";
139273
+ import { existsSync as existsSync79, readFileSync as readFileSync49 } from "fs";
138753
139274
  import { resolve as resolve46 } from "path";
138754
139275
  function buildPresentPage(projectName, islandJson) {
138755
139276
  return `<!doctype html>
@@ -138983,7 +139504,7 @@ var init_present = __esm({
138983
139504
  const reqPath = ctx.req.path.replace("/composition/", "");
138984
139505
  const filePath = resolve46(project.dir, reqPath);
138985
139506
  if (!isSafePath2(project.dir, filePath)) return ctx.text("Forbidden", 403);
138986
- if (!existsSync78(filePath)) return ctx.text("Not found", 404);
139507
+ if (!existsSync79(filePath)) return ctx.text("Not found", 404);
138987
139508
  if (filePath.endsWith(".html")) return ctx.html(readFileSync49(filePath, "utf-8"));
138988
139509
  return ctx.body(readFileSync49(filePath), 200, { "Content-Type": assetContentType(filePath) });
138989
139510
  });
@@ -139628,9 +140149,9 @@ async function startLoopback(opts) {
139628
140149
  const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
139629
140150
  let resolveResult;
139630
140151
  let rejectResult;
139631
- const result = new Promise((resolve77, reject) => {
140152
+ const result = new Promise((resolve77, reject2) => {
139632
140153
  resolveResult = resolve77;
139633
- rejectResult = reject;
140154
+ rejectResult = reject2;
139634
140155
  });
139635
140156
  let redirectUri = "";
139636
140157
  const server = createServer(
@@ -139656,10 +140177,10 @@ async function startLoopback(opts) {
139656
140177
  return { result, redirectUri, close };
139657
140178
  }
139658
140179
  async function listen(server, port) {
139659
- await new Promise((resolve77, reject) => {
139660
- server.once("error", reject);
140180
+ await new Promise((resolve77, reject2) => {
140181
+ server.once("error", reject2);
139661
140182
  server.listen(port, "127.0.0.1", () => {
139662
- server.off("error", reject);
140183
+ server.off("error", reject2);
139663
140184
  resolve77();
139664
140185
  });
139665
140186
  });
@@ -140323,12 +140844,12 @@ var init_auth = __esm({
140323
140844
 
140324
140845
  // src/utils/projectLink.ts
140325
140846
  import { randomUUID as randomUUID11 } from "crypto";
140326
- import { existsSync as existsSync79, mkdirSync as mkdirSync41, readFileSync as readFileSync50, writeFileSync as writeFileSync30 } from "fs";
140847
+ import { existsSync as existsSync80, mkdirSync as mkdirSync41, readFileSync as readFileSync50, writeFileSync as writeFileSync30 } from "fs";
140327
140848
  import { homedir as homedir18 } from "os";
140328
140849
  import { join as join85, resolve as resolve47 } from "path";
140329
140850
  function readJsonRecord(path2) {
140330
140851
  try {
140331
- if (!existsSync79(path2)) return null;
140852
+ if (!existsSync80(path2)) return null;
140332
140853
  const parsed = JSON.parse(readFileSync50(path2, "utf-8"));
140333
140854
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
140334
140855
  return parsed;
@@ -140411,14 +140932,14 @@ var init_projectLink = __esm({
140411
140932
 
140412
140933
  // src/utils/publishProject.ts
140413
140934
  import { basename as basename14, dirname as dirname37, join as join86, posix as posix5, relative as relative18, resolve as resolve48 } from "path";
140414
- import { existsSync as existsSync80, readdirSync as readdirSync27, readFileSync as readFileSync51, statSync as statSync27 } from "fs";
140935
+ import { existsSync as existsSync81, readdirSync as readdirSync27, readFileSync as readFileSync51, statSync as statSync27 } from "fs";
140415
140936
  import AdmZip from "adm-zip";
140416
140937
  import ignore2 from "ignore";
140417
- function isRecord8(value) {
140938
+ function isRecord9(value) {
140418
140939
  return typeof value === "object" && value !== null && !Array.isArray(value);
140419
140940
  }
140420
140941
  function dataRecord(payload) {
140421
- if (!isRecord8(payload) || !isRecord8(payload["data"])) return null;
140942
+ if (!isRecord9(payload) || !isRecord9(payload["data"])) return null;
140422
140943
  return payload["data"];
140423
140944
  }
140424
140945
  function stringField2(record, key2) {
@@ -140469,7 +140990,7 @@ function parseStagedUploadResponse(payload, archiveByteLength) {
140469
140990
  function getUploadHeaders(data2, uploadUrl, contentType, archiveByteLength) {
140470
140991
  const headers = {};
140471
140992
  const uploadHeaders = data2["upload_headers"];
140472
- if (isRecord8(uploadHeaders)) {
140993
+ if (isRecord9(uploadHeaders)) {
140473
140994
  for (const [key2, value] of Object.entries(uploadHeaders)) {
140474
140995
  if (typeof value === "string" && key2.trim()) {
140475
140996
  headers[key2] = value;
@@ -140495,7 +141016,7 @@ async function readErrorMessage(response, fallback) {
140495
141016
  const contentType = response.headers.get("content-type") || "";
140496
141017
  if (contentType.includes("application/json")) {
140497
141018
  const payload = await readJson(response);
140498
- if (isRecord8(payload) && typeof payload["message"] === "string") {
141019
+ if (isRecord9(payload) && typeof payload["message"] === "string") {
140499
141020
  return payload["message"];
140500
141021
  }
140501
141022
  }
@@ -140506,7 +141027,7 @@ async function readErrorMessage(response, fallback) {
140506
141027
  return text2.trim() ? `${fallback}: ${text2.trim().slice(0, 180)}` : fallback;
140507
141028
  }
140508
141029
  function systemErrorMetadata(value) {
140509
- if (!isRecord8(value)) return [];
141030
+ if (!isRecord9(value)) return [];
140510
141031
  const metadata = [];
140511
141032
  if (typeof value["code"] === "string") metadata.push(value["code"]);
140512
141033
  if (typeof value["syscall"] === "string") metadata.push(`syscall=${value["syscall"]}`);
@@ -140574,7 +141095,7 @@ function shouldIgnoreSegment(segment) {
140574
141095
  function createProjectIgnore(rootDir) {
140575
141096
  const matcher = ignore2().add(DEFAULT_PROJECT_IGNORE);
140576
141097
  const ignorePath = join86(rootDir, HYPERFRAMES_IGNORE_FILE);
140577
- if (existsSync80(ignorePath)) {
141098
+ if (existsSync81(ignorePath)) {
140578
141099
  matcher.add(readFileSync51(ignorePath, "utf-8"));
140579
141100
  }
140580
141101
  return matcher;
@@ -140618,7 +141139,7 @@ function tryResolveExternal(ctx, rawPath, referrerAbsDir) {
140618
141139
  const absPath = resolve48(referrerAbsDir, rawPath);
140619
141140
  if (isPathInside(absPath, ctx.absProjectDir)) return null;
140620
141141
  try {
140621
- if (!existsSync80(absPath) || !statSync27(absPath).isFile()) return null;
141142
+ if (!existsSync81(absPath) || !statSync27(absPath).isFile()) return null;
140622
141143
  } catch {
140623
141144
  return null;
140624
141145
  }
@@ -140904,7 +141425,7 @@ var init_publishProject = __esm({
140904
141425
  });
140905
141426
 
140906
141427
  // src/utils/publishProxyBake.ts
140907
- import { existsSync as existsSync81 } from "fs";
141428
+ import { existsSync as existsSync83 } from "fs";
140908
141429
  import { readFile as readFile4 } from "fs/promises";
140909
141430
  import { basename as basename15, dirname as dirname38, resolve as resolve49 } from "path";
140910
141431
  function emptyManifest() {
@@ -140962,7 +141483,7 @@ async function bakeMediaProxies(projectDir, fileContents) {
140962
141483
  const rootRelativeSrc = rewriteAssetPath(
140963
141484
  entryPath,
140964
141485
  cleaned,
140965
- (path2) => existsSync81(resolve49(absProjectDir, path2))
141486
+ (path2) => existsSync83(resolve49(absProjectDir, path2))
140966
141487
  );
140967
141488
  for (const candidate of resolveLocalAssetCandidates(absProjectDir, rootRelativeSrc)) {
140968
141489
  const archivePath = proxyByAbsolutePath.get(candidate);
@@ -141007,7 +141528,7 @@ __export(publish_exports, {
141007
141528
  parseUpdateTarget: () => parseUpdateTarget
141008
141529
  });
141009
141530
  import { join as join87, relative as relative19, resolve as resolve50 } from "path";
141010
- import { existsSync as existsSync83 } from "fs";
141531
+ import { existsSync as existsSync84 } from "fs";
141011
141532
  function parseUpdateTarget(value) {
141012
141533
  const trimmed = value.trim();
141013
141534
  const pathMatch = trimmed.match(/\/p\/([^/?#]+)/);
@@ -141078,7 +141599,7 @@ var init_publish = __esm({
141078
141599
  const rawArg = args.dir;
141079
141600
  const dir = resolve50(rawArg ?? ".");
141080
141601
  const indexPath2 = join87(dir, "index.html");
141081
- if (existsSync83(indexPath2)) {
141602
+ if (existsSync84(indexPath2)) {
141082
141603
  const lintResult = await lintProject(dir);
141083
141604
  if (lintResult.totalErrors > 0 || lintResult.totalWarnings > 0) {
141084
141605
  console.log();
@@ -141700,7 +142221,7 @@ function reportVariableIssues(issues, options) {
141700
142221
  failCommand();
141701
142222
  }
141702
142223
  }
141703
- var init_variables = __esm({
142224
+ var init_variables2 = __esm({
141704
142225
  "src/utils/variables.ts"() {
141705
142226
  "use strict";
141706
142227
  init_commandResult();
@@ -141723,7 +142244,7 @@ __export(batchRender_exports, {
141723
142244
  });
141724
142245
  import { mkdirSync as mkdirSync43, readFileSync as readFileSync55, writeFileSync as writeFileSync31 } from "fs";
141725
142246
  import { dirname as dirname40, join as join89, resolve as resolve53, sep as sep12 } from "path";
141726
- function isRecord9(value) {
142247
+ function isRecord10(value) {
141727
142248
  return value !== null && typeof value === "object" && !Array.isArray(value);
141728
142249
  }
141729
142250
  function parseJson(raw, source) {
@@ -141735,7 +142256,7 @@ function parseJson(raw, source) {
141735
142256
  }
141736
142257
  function parseBatchRows(raw, source) {
141737
142258
  const parsed = parseJson(raw, source);
141738
- const rows = Array.isArray(parsed) ? parsed : isRecord9(parsed) ? parsed.rows : void 0;
142259
+ const rows = Array.isArray(parsed) ? parsed : isRecord10(parsed) ? parsed.rows : void 0;
141739
142260
  if (!Array.isArray(rows)) {
141740
142261
  throw new BatchRenderInputError(
141741
142262
  "Invalid batch payload",
@@ -141746,7 +142267,7 @@ function parseBatchRows(raw, source) {
141746
142267
  throw new BatchRenderInputError("Empty batch", `${source} contains zero rows.`);
141747
142268
  }
141748
142269
  return rows.map((row, index) => {
141749
- if (!isRecord9(row)) {
142270
+ if (!isRecord10(row)) {
141750
142271
  throw new BatchRenderInputError(
141751
142272
  "Invalid batch row",
141752
142273
  `Row ${index} must be a JSON object of variable values.`
@@ -142027,7 +142548,7 @@ var init_batchRender = __esm({
142027
142548
  init_colors();
142028
142549
  init_format();
142029
142550
  init_errorMessage();
142030
- init_variables();
142551
+ init_variables2();
142031
142552
  BatchRenderInputError = class extends Error {
142032
142553
  title;
142033
142554
  hint;
@@ -142250,7 +142771,7 @@ var init_execute = __esm({
142250
142771
  init_lintProject();
142251
142772
  init_errorMessage();
142252
142773
  init_commandResult();
142253
- init_variables();
142774
+ init_variables2();
142254
142775
  init_events();
142255
142776
  init_plan2();
142256
142777
  }
@@ -142271,7 +142792,7 @@ var init_producer = __esm({
142271
142792
  });
142272
142793
 
142273
142794
  // src/utils/webmAlphaCheck.ts
142274
- import { execFileSync as execFileSync9 } from "child_process";
142795
+ import { execFileSync as execFileSync10 } from "child_process";
142275
142796
  function webmAlphaAdvisory(format, probe) {
142276
142797
  if (format !== "webm") return void 0;
142277
142798
  if (!probe.probed) return void 0;
@@ -142287,7 +142808,7 @@ function probeWebmAlpha(filePath) {
142287
142808
  try {
142288
142809
  const ffprobePath = findFFprobe();
142289
142810
  if (!ffprobePath) return { probed: false, alphaMode: false };
142290
- const raw = execFileSync9(
142811
+ const raw = execFileSync10(
142291
142812
  ffprobePath,
142292
142813
  [
142293
142814
  "-v",
@@ -142326,7 +142847,7 @@ function sampledAlphaIsFullyOpaque(filePath) {
142326
142847
  const ffmpegPath = findFFmpeg();
142327
142848
  if (!ffmpegPath) return void 0;
142328
142849
  try {
142329
- const buf = execFileSync9(
142850
+ const buf = execFileSync10(
142330
142851
  ffmpegPath,
142331
142852
  [
142332
142853
  "-v",
@@ -142581,226 +143102,6 @@ var init_dockerRunArgs = __esm({
142581
143102
  }
142582
143103
  });
142583
143104
 
142584
- // src/browser/preflight.ts
142585
- import { execFileSync as execFileSync10 } from "child_process";
142586
- import { existsSync as existsSync84 } from "fs";
142587
- import { platform as platform8 } from "os";
142588
- function parseToolVersion(raw) {
142589
- const m2 = raw.match(/(ffmpeg|ffprobe)\s+version\s+([\d][\d.\-\w]*)/i);
142590
- return m2 ? `${m2[1]} ${m2[2]}` : raw.trim();
142591
- }
142592
- function configuredMissingDetail(envName) {
142593
- const configured = process.env[envName]?.trim();
142594
- if (!configured || existsSync84(configured)) return void 0;
142595
- return `Configured path does not exist: ${envName}="${configured}"`;
142596
- }
142597
- function readToolVersion(binaryPath) {
142598
- try {
142599
- const raw = execFileSync10(binaryPath, ["-version"], { encoding: "utf-8", timeout: 5e3 }).split("\n")[0] ?? "";
142600
- const version2 = parseToolVersion(raw);
142601
- return { ok: true, detail: version2 ? `${version2} at ${binaryPath}` : binaryPath };
142602
- } catch (error) {
142603
- const status = typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
142604
- const exitDetail = typeof status === "number" ? ` (exit code ${status})` : "";
142605
- return {
142606
- ok: false,
142607
- detail: `Failed to run "${binaryPath}" -version${exitDetail}.`
142608
- };
142609
- }
142610
- }
142611
- function checkFFmpeg() {
142612
- const missingConfigured = configuredMissingDetail(FFMPEG_PATH_ENV);
142613
- if (missingConfigured) {
142614
- return {
142615
- name: "FFmpeg",
142616
- ok: false,
142617
- level: "error",
142618
- title: "FFmpeg not found",
142619
- detail: missingConfigured,
142620
- hint: getFFmpegInstallHint()
142621
- };
142622
- }
142623
- const path2 = findFFmpeg();
142624
- if (path2) {
142625
- const version2 = readToolVersion(path2);
142626
- if (!version2.ok) {
142627
- return {
142628
- name: "FFmpeg",
142629
- ok: false,
142630
- level: "error",
142631
- title: "FFmpeg cannot start",
142632
- detail: version2.detail,
142633
- hint: "Install a working 64-bit FFmpeg build with all required runtime DLLs.",
142634
- path: path2
142635
- };
142636
- }
142637
- return { name: "FFmpeg", ok: true, level: "ok", detail: version2.detail, path: path2 };
142638
- }
142639
- return {
142640
- name: "FFmpeg",
142641
- ok: false,
142642
- level: "error",
142643
- title: "FFmpeg not found",
142644
- detail: "FFmpeg is required to encode video. The render cannot proceed without it.",
142645
- hint: getFFmpegInstallHint()
142646
- };
142647
- }
142648
- function checkFFprobe() {
142649
- const missingConfigured = configuredMissingDetail(FFPROBE_PATH_ENV);
142650
- if (missingConfigured) {
142651
- return {
142652
- name: "FFprobe",
142653
- ok: false,
142654
- level: "error",
142655
- title: "FFprobe not found",
142656
- detail: missingConfigured,
142657
- hint: getFFmpegInstallHint()
142658
- };
142659
- }
142660
- const path2 = findFFprobe();
142661
- if (path2) {
142662
- const version2 = readToolVersion(path2);
142663
- return { name: "FFprobe", ok: true, level: "ok", detail: version2.detail, path: path2 };
142664
- }
142665
- return {
142666
- name: "FFprobe",
142667
- ok: false,
142668
- level: "error",
142669
- title: "FFprobe not found",
142670
- detail: "FFprobe is required to probe media assets. It ships with FFmpeg but was not found on PATH.",
142671
- hint: getFFmpegInstallHint()
142672
- };
142673
- }
142674
- function chromeSharedLibOutcome(executablePath, found) {
142675
- if (process.platform !== "linux") return found;
142676
- const probe = probeChromeSharedLibs(executablePath);
142677
- if (probe.probeUnavailable || probe.ok) return found;
142678
- const distro = detectLinuxDistro();
142679
- return {
142680
- name: "Chrome",
142681
- ok: false,
142682
- level: "error",
142683
- title: "Chrome cannot launch (missing system libraries)",
142684
- detail: `Chrome at ${executablePath} is missing shared libraries on ${distroLabel(distro)}: ${probe.missing.join(", ")}`,
142685
- hint: chromeDepsInstallCommand(distro.family),
142686
- path: executablePath
142687
- };
142688
- }
142689
- async function checkChrome(browserPath) {
142690
- if (browserPath) {
142691
- if (existsSync84(browserPath)) {
142692
- return chromeSharedLibOutcome(browserPath, {
142693
- name: "Chrome",
142694
- ok: true,
142695
- level: "ok",
142696
- detail: `explicit: ${browserPath}`,
142697
- path: browserPath
142698
- });
142699
- }
142700
- return {
142701
- name: "Chrome",
142702
- ok: false,
142703
- level: "error",
142704
- title: "Chrome not found",
142705
- detail: `Chrome binary not found at "${browserPath}".`,
142706
- hint: "Run: npx hyperframes browser ensure"
142707
- };
142708
- }
142709
- let info;
142710
- try {
142711
- info = await findBrowser();
142712
- } catch {
142713
- info = void 0;
142714
- }
142715
- if (info) {
142716
- return chromeSharedLibOutcome(info.executablePath, {
142717
- name: "Chrome",
142718
- ok: true,
142719
- level: "ok",
142720
- detail: `${info.source}: ${info.executablePath}`,
142721
- path: info.executablePath
142722
- });
142723
- }
142724
- return {
142725
- name: "Chrome",
142726
- ok: false,
142727
- level: "error",
142728
- title: "Chrome not found",
142729
- detail: "Chrome Headless Shell is required for local rendering.",
142730
- hint: "Run: npx hyperframes browser ensure"
142731
- };
142732
- }
142733
- function checkDisk(path2 = ".", freeDiskMb = getFreeDiskMb) {
142734
- const freeMb = freeDiskMb(path2);
142735
- if (freeMb === null) {
142736
- return { name: "Disk", ok: true, level: "ok", detail: "Unable to check" };
142737
- }
142738
- const freeGb = (freeMb / 1024).toFixed(1);
142739
- if (freeMb < 1024) {
142740
- return {
142741
- name: "Disk",
142742
- ok: false,
142743
- level: "error",
142744
- title: "Low disk space",
142745
- detail: `${freeGb} GB free at ${path2}`,
142746
- hint: "Renders produce large temp files. Free disk space before rendering."
142747
- };
142748
- }
142749
- return { name: "Disk", ok: true, level: "ok", detail: `${freeGb} GB free at ${path2}` };
142750
- }
142751
- function checkWindowsUncPath(projectDir = process.cwd()) {
142752
- if (platform8() !== "win32") return void 0;
142753
- if (!projectDir.startsWith("\\\\")) return void 0;
142754
- return {
142755
- name: "Windows path",
142756
- ok: true,
142757
- level: "warn",
142758
- detail: `UNC path: ${projectDir}`,
142759
- hint: "Chrome may fail to launch from a network share. Use a local drive if render startup fails."
142760
- };
142761
- }
142762
- async function runEnvironmentChecks(options = {}) {
142763
- const outcomes = [];
142764
- const ffmpeg = checkFFmpeg();
142765
- outcomes.push(ffmpeg);
142766
- const ffprobe = checkFFprobe();
142767
- outcomes.push(ffprobe);
142768
- let browser;
142769
- if (options.includeBrowser) {
142770
- const chrome = await checkChrome(options.browserPath);
142771
- outcomes.push(chrome);
142772
- if (chrome.ok && chrome.path) {
142773
- browser = {
142774
- executablePath: chrome.path,
142775
- source: options.browserPath ? "env" : "cache"
142776
- };
142777
- }
142778
- }
142779
- if (options.includeDisk) {
142780
- const diskPaths = [...new Set(options.diskPaths ?? [options.projectDir ?? "."])];
142781
- outcomes.push(...diskPaths.map((path2) => checkDisk(path2)));
142782
- }
142783
- if (options.includeWindowsUnc) {
142784
- const unc = checkWindowsUncPath(options.projectDir);
142785
- if (unc) outcomes.push(unc);
142786
- }
142787
- return {
142788
- outcomes,
142789
- ...ffmpeg.ok && ffmpeg.path ? { ffmpegPath: ffmpeg.path } : {},
142790
- ...ffprobe.path ? { ffprobePath: ffprobe.path } : {},
142791
- ...browser ? { browser } : {}
142792
- };
142793
- }
142794
- var init_preflight = __esm({
142795
- "src/browser/preflight.ts"() {
142796
- "use strict";
142797
- init_manager2();
142798
- init_ffmpeg();
142799
- init_linuxDeps();
142800
- init_system();
142801
- }
142802
- });
142803
-
142804
143105
  // src/browser/macosOldChromeCrash.ts
142805
143106
  function isMacosOldChromeCrashError(errorMessage2) {
142806
143107
  if (!/Failed to launch the browser process/i.test(errorMessage2)) return false;
@@ -143021,16 +143322,16 @@ async function renderDocker(projectDir, outputPath, options) {
143021
143322
  console.log("");
143022
143323
  }
143023
143324
  try {
143024
- await new Promise((resolvePromise, reject) => {
143325
+ await new Promise((resolvePromise, reject2) => {
143025
143326
  const child = spawn15("docker", dockerArgs, {
143026
143327
  // When quiet, still show stderr so container errors surface
143027
143328
  stdio: options.quiet ? ["pipe", "pipe", "inherit"] : "inherit"
143028
143329
  });
143029
143330
  child.on("close", (code) => {
143030
143331
  if (code === 0) resolvePromise();
143031
- else reject(new Error(`Docker render exited with code ${code}`));
143332
+ else reject2(new Error(`Docker render exited with code ${code}`));
143032
143333
  });
143033
- child.on("error", (err) => reject(err));
143334
+ child.on("error", (err) => reject2(err));
143034
143335
  });
143035
143336
  } catch (error) {
143036
143337
  handleRenderError(error, options, startTime, true, "Check Docker is running: docker info");
@@ -146044,7 +146345,7 @@ async function collectRotationSample(page, time) {
146044
146345
  return raw.flatMap((value) => parseRotationSample(value, time));
146045
146346
  }
146046
146347
  function parseRotationSample(value, time) {
146047
- if (!isRecord10(value)) return [];
146348
+ if (!isRecord11(value)) return [];
146048
146349
  const selector = stringValue2(value, "selector");
146049
146350
  const cx = numberValue2(value, "cx");
146050
146351
  const cy = numberValue2(value, "cy");
@@ -146070,7 +146371,7 @@ function requiredNumbers(value, keys2) {
146070
146371
  return out;
146071
146372
  }
146072
146373
  function parseOffPivotRotationSample(value) {
146073
- if (!isRecord10(value)) return [];
146374
+ if (!isRecord11(value)) return [];
146074
146375
  const selector = stringValue2(value, "selector");
146075
146376
  const nums = requiredNumbers(value, OFF_PIVOT_REQUIRED_NUMBERS);
146076
146377
  if (!selector || !nums) return [];
@@ -146322,7 +146623,7 @@ async function finishContrast(page, screenshot, time, candidates) {
146322
146623
  }
146323
146624
  function parsePreparedContrast(raw) {
146324
146625
  return raw.flatMap((value) => {
146325
- if (!isRecord10(value)) return [];
146626
+ if (!isRecord11(value)) return [];
146326
146627
  const raw2 = Reflect.get(value, "candidate");
146327
146628
  const candidate = parseContrastCandidate(raw2);
146328
146629
  const anchor = parseAnchor(Reflect.get(value, "anchor"));
@@ -146330,7 +146631,7 @@ function parsePreparedContrast(raw) {
146330
146631
  });
146331
146632
  }
146332
146633
  function parseContrastCandidate(value) {
146333
- if (!isRecord10(value)) return null;
146634
+ if (!isRecord11(value)) return null;
146334
146635
  const selector = stringValue2(value, "selector");
146335
146636
  const text2 = stringValue2(value, "text");
146336
146637
  const fg = rgbaValue(Reflect.get(value, "fg"));
@@ -146339,7 +146640,7 @@ function parseContrastCandidate(value) {
146339
146640
  return selector && text2 !== null && fg && large !== null && bbox ? { selector, text: text2, fg, large, bbox } : null;
146340
146641
  }
146341
146642
  function parseFinishedContrast(value) {
146342
- if (!isRecord10(value)) return [];
146643
+ if (!isRecord11(value)) return [];
146343
146644
  const selector = stringValue2(value, "selector");
146344
146645
  const text2 = stringValue2(value, "text");
146345
146646
  const ratio = numberValue2(value, "ratio");
@@ -146360,7 +146661,7 @@ function joinContrastEntries(finished2, prepared) {
146360
146661
  });
146361
146662
  }
146362
146663
  function parseLayoutIssue(value) {
146363
- if (!isRecord10(value)) return [];
146664
+ if (!isRecord11(value)) return [];
146364
146665
  const code = layoutCodeValue(Reflect.get(value, "code"));
146365
146666
  const severity = severityValue(Reflect.get(value, "severity"));
146366
146667
  const time = numberValue2(value, "time");
@@ -146373,7 +146674,7 @@ function parseLayoutIssue(value) {
146373
146674
  return [issue];
146374
146675
  }
146375
146676
  function parseGeometryCandidate(value, time) {
146376
- if (!isRecord10(value)) return [];
146677
+ if (!isRecord11(value)) return [];
146377
146678
  const rect = parseRect(Reflect.get(value, "rect"));
146378
146679
  const elementRect = parseRect(Reflect.get(value, "elementRect"));
146379
146680
  if (!rect || !elementRect) return [];
@@ -146421,9 +146722,9 @@ function assignOptionalLayoutFields(issue, value) {
146421
146722
  if (coveredFraction !== null) issue.coveredFraction = coveredFraction;
146422
146723
  }
146423
146724
  function recordField(value, key2) {
146424
- if (!isRecord10(value)) return null;
146725
+ if (!isRecord11(value)) return null;
146425
146726
  const field = Reflect.get(value, key2);
146426
- return isRecord10(field) ? field : null;
146727
+ return isRecord11(field) ? field : null;
146427
146728
  }
146428
146729
  function parseMotionFrame(value, time, selectors, scopes) {
146429
146730
  const rawData = recordField(value, "data");
@@ -146440,14 +146741,14 @@ function parseMotionFrame(value, time, selectors, scopes) {
146440
146741
  return { time, data: data2, liveness };
146441
146742
  }
146442
146743
  function parseFrameSample(value) {
146443
- if (!isRecord10(value)) return null;
146744
+ if (!isRecord11(value)) return null;
146444
146745
  const rect = parseRect(Reflect.get(value, "rect"));
146445
146746
  const opacity = numberValue2(value, "opacity");
146446
146747
  const visible = booleanValue(value, "visible");
146447
146748
  return rect && opacity !== null && visible !== null ? { rect, opacity, visible } : null;
146448
146749
  }
146449
146750
  function parseAnchor(value) {
146450
- if (!isRecord10(value)) return null;
146751
+ if (!isRecord11(value)) return null;
146451
146752
  const selector = stringValue2(value, "selector");
146452
146753
  const sourceFile = stringValue2(value, "sourceFile");
146453
146754
  const time = numberValue2(value, "time");
@@ -146479,7 +146780,7 @@ function fallbackAnchor(request) {
146479
146780
  };
146480
146781
  }
146481
146782
  function parseBbox(value) {
146482
- if (!isRecord10(value)) return null;
146783
+ if (!isRecord11(value)) return null;
146483
146784
  const x3 = numberValue2(value, "x");
146484
146785
  const y = numberValue2(value, "y");
146485
146786
  const width = numberValue2(value, "width") ?? numberValue2(value, "w");
@@ -146487,7 +146788,7 @@ function parseBbox(value) {
146487
146788
  return x3 !== null && y !== null && width !== null && height !== null ? { x: x3, y, width, height } : null;
146488
146789
  }
146489
146790
  function parseRect(value) {
146490
- if (!isRecord10(value)) return null;
146791
+ if (!isRecord11(value)) return null;
146491
146792
  const left = numberValue2(value, "left");
146492
146793
  const top = numberValue2(value, "top");
146493
146794
  const right = numberValue2(value, "right");
@@ -146497,7 +146798,7 @@ function parseRect(value) {
146497
146798
  return left !== null && top !== null && right !== null && bottom !== null && width !== null && height !== null ? { left, top, right, bottom, width, height } : null;
146498
146799
  }
146499
146800
  function parseOverflow(value) {
146500
- if (!isRecord10(value)) return null;
146801
+ if (!isRecord11(value)) return null;
146501
146802
  const overflow = {};
146502
146803
  for (const side of ["left", "right", "top", "bottom"]) {
146503
146804
  const amount = numberValue2(value, side);
@@ -146517,7 +146818,7 @@ function rgbaValue(value) {
146517
146818
  return [red, green, blue, alpha].every((channel) => typeof channel === "number") ? [red, green, blue, alpha] : null;
146518
146819
  }
146519
146820
  function stringRecord(value) {
146520
- if (!isRecord10(value)) return null;
146821
+ if (!isRecord11(value)) return null;
146521
146822
  const record = {};
146522
146823
  for (const key2 of Object.keys(value)) {
146523
146824
  const entry = Reflect.get(value, key2);
@@ -146530,7 +146831,7 @@ function assignOptionalString(issue, source, key2) {
146530
146831
  const value = stringValue2(source, key2);
146531
146832
  if (value !== null) issue[key2] = value;
146532
146833
  }
146533
- function isRecord10(value) {
146834
+ function isRecord11(value) {
146534
146835
  return typeof value === "object" && value !== null && !Array.isArray(value);
146535
146836
  }
146536
146837
  function stringValue2(value, key2) {
@@ -155011,7 +155312,7 @@ var require_p_retry = __commonJS({
155011
155312
  return error;
155012
155313
  };
155013
155314
  var isNetworkError = (errorMessage2) => networkErrorMsgs.includes(errorMessage2);
155014
- var pRetry2 = (input2, options) => new Promise((resolve77, reject) => {
155315
+ var pRetry2 = (input2, options) => new Promise((resolve77, reject2) => {
155015
155316
  options = {
155016
155317
  onFailedAttempt: () => {
155017
155318
  },
@@ -155024,25 +155325,25 @@ var require_p_retry = __commonJS({
155024
155325
  resolve77(await input2(attemptNumber));
155025
155326
  } catch (error) {
155026
155327
  if (!(error instanceof Error)) {
155027
- reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
155328
+ reject2(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
155028
155329
  return;
155029
155330
  }
155030
155331
  if (error instanceof AbortError3) {
155031
155332
  operation.stop();
155032
- reject(error.originalError);
155333
+ reject2(error.originalError);
155033
155334
  } else if (error instanceof TypeError && !isNetworkError(error.message)) {
155034
155335
  operation.stop();
155035
- reject(error);
155336
+ reject2(error);
155036
155337
  } else {
155037
155338
  decorateErrorWithCounts(error, attemptNumber, options);
155038
155339
  try {
155039
155340
  await options.onFailedAttempt(error);
155040
155341
  } catch (error2) {
155041
- reject(error2);
155342
+ reject2(error2);
155042
155343
  return;
155043
155344
  }
155044
155345
  if (!operation.retry(error)) {
155045
- reject(operation.mainError());
155346
+ reject2(operation.mainError());
155046
155347
  }
155047
155348
  }
155048
155349
  }
@@ -155686,8 +155987,8 @@ var require_helpers = __commonJS({
155686
155987
  function req(url, opts = {}) {
155687
155988
  const href = typeof url === "string" ? url : url.href;
155688
155989
  const req2 = (href.startsWith("https:") ? https2 : http4).request(url, opts);
155689
- const promise = new Promise((resolve77, reject) => {
155690
- req2.once("response", resolve77).once("error", reject).end();
155990
+ const promise = new Promise((resolve77, reject2) => {
155991
+ req2.once("response", resolve77).once("error", reject2).end();
155691
155992
  });
155692
155993
  req2.then = promise.then.bind(promise);
155693
155994
  return req2;
@@ -155864,7 +156165,7 @@ var require_parse_proxy_response = __commonJS({
155864
156165
  var debug_1 = __importDefault2(__require("debug"));
155865
156166
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
155866
156167
  function parseProxyResponse(socket) {
155867
- return new Promise((resolve77, reject) => {
156168
+ return new Promise((resolve77, reject2) => {
155868
156169
  let buffersLength = 0;
155869
156170
  const buffers = [];
155870
156171
  function read() {
@@ -155882,12 +156183,12 @@ var require_parse_proxy_response = __commonJS({
155882
156183
  function onend() {
155883
156184
  cleanup();
155884
156185
  debug("onend");
155885
- reject(new Error("Proxy connection ended before receiving CONNECT response"));
156186
+ reject2(new Error("Proxy connection ended before receiving CONNECT response"));
155886
156187
  }
155887
156188
  function onerror(err) {
155888
156189
  cleanup();
155889
156190
  debug("onerror %o", err);
155890
- reject(err);
156191
+ reject2(err);
155891
156192
  }
155892
156193
  function ondata(b2) {
155893
156194
  buffers.push(b2);
@@ -155903,7 +156204,7 @@ var require_parse_proxy_response = __commonJS({
155903
156204
  const firstLine = headerParts.shift();
155904
156205
  if (!firstLine) {
155905
156206
  socket.destroy();
155906
- return reject(new Error("No header received from proxy CONNECT response"));
156207
+ return reject2(new Error("No header received from proxy CONNECT response"));
155907
156208
  }
155908
156209
  const firstLineParts = firstLine.split(" ");
155909
156210
  const statusCode = +firstLineParts[1];
@@ -155915,7 +156216,7 @@ var require_parse_proxy_response = __commonJS({
155915
156216
  const firstColon = header.indexOf(":");
155916
156217
  if (firstColon === -1) {
155917
156218
  socket.destroy();
155918
- return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
156219
+ return reject2(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
155919
156220
  }
155920
156221
  const key2 = header.slice(0, firstColon).toLowerCase();
155921
156222
  const value = header.slice(firstColon + 1).trimStart();
@@ -156344,9 +156645,9 @@ var require_ponyfill_es2018 = __commonJS({
156344
156645
  return new TypeError("Cannot " + name + " a stream using a released reader");
156345
156646
  }
156346
156647
  function defaultReaderClosedPromiseInitialize(reader) {
156347
- reader._closedPromise = newPromise((resolve77, reject) => {
156648
+ reader._closedPromise = newPromise((resolve77, reject2) => {
156348
156649
  reader._closedPromise_resolve = resolve77;
156349
- reader._closedPromise_reject = reject;
156650
+ reader._closedPromise_reject = reject2;
156350
156651
  });
156351
156652
  }
156352
156653
  function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
@@ -156519,9 +156820,9 @@ var require_ponyfill_es2018 = __commonJS({
156519
156820
  }
156520
156821
  let resolvePromise;
156521
156822
  let rejectPromise;
156522
- const promise = newPromise((resolve77, reject) => {
156823
+ const promise = newPromise((resolve77, reject2) => {
156523
156824
  resolvePromise = resolve77;
156524
- rejectPromise = reject;
156825
+ rejectPromise = reject2;
156525
156826
  });
156526
156827
  const readRequest = {
156527
156828
  _chunkSteps: (chunk) => resolvePromise({ value: chunk, done: false }),
@@ -156625,9 +156926,9 @@ var require_ponyfill_es2018 = __commonJS({
156625
156926
  const reader = this._reader;
156626
156927
  let resolvePromise;
156627
156928
  let rejectPromise;
156628
- const promise = newPromise((resolve77, reject) => {
156929
+ const promise = newPromise((resolve77, reject2) => {
156629
156930
  resolvePromise = resolve77;
156630
- rejectPromise = reject;
156931
+ rejectPromise = reject2;
156631
156932
  });
156632
156933
  const readRequest = {
156633
156934
  _chunkSteps: (chunk) => {
@@ -157645,9 +157946,9 @@ var require_ponyfill_es2018 = __commonJS({
157645
157946
  }
157646
157947
  let resolvePromise;
157647
157948
  let rejectPromise;
157648
- const promise = newPromise((resolve77, reject) => {
157949
+ const promise = newPromise((resolve77, reject2) => {
157649
157950
  resolvePromise = resolve77;
157650
- rejectPromise = reject;
157951
+ rejectPromise = reject2;
157651
157952
  });
157652
157953
  const readIntoRequest = {
157653
157954
  _chunkSteps: (chunk) => resolvePromise({ value: chunk, done: false }),
@@ -157958,11 +158259,11 @@ var require_ponyfill_es2018 = __commonJS({
157958
158259
  wasAlreadyErroring = true;
157959
158260
  reason = void 0;
157960
158261
  }
157961
- const promise = newPromise((resolve77, reject) => {
158262
+ const promise = newPromise((resolve77, reject2) => {
157962
158263
  stream._pendingAbortRequest = {
157963
158264
  _promise: void 0,
157964
158265
  _resolve: resolve77,
157965
- _reject: reject,
158266
+ _reject: reject2,
157966
158267
  _reason: reason,
157967
158268
  _wasAlreadyErroring: wasAlreadyErroring
157968
158269
  };
@@ -157978,10 +158279,10 @@ var require_ponyfill_es2018 = __commonJS({
157978
158279
  if (state === "closed" || state === "errored") {
157979
158280
  return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
157980
158281
  }
157981
- const promise = newPromise((resolve77, reject) => {
158282
+ const promise = newPromise((resolve77, reject2) => {
157982
158283
  const closeRequest = {
157983
158284
  _resolve: resolve77,
157984
- _reject: reject
158285
+ _reject: reject2
157985
158286
  };
157986
158287
  stream._closeRequest = closeRequest;
157987
158288
  });
@@ -157993,10 +158294,10 @@ var require_ponyfill_es2018 = __commonJS({
157993
158294
  return promise;
157994
158295
  }
157995
158296
  function WritableStreamAddWriteRequest(stream) {
157996
- const promise = newPromise((resolve77, reject) => {
158297
+ const promise = newPromise((resolve77, reject2) => {
157997
158298
  const writeRequest = {
157998
158299
  _resolve: resolve77,
157999
- _reject: reject
158300
+ _reject: reject2
158000
158301
  };
158001
158302
  stream._writeRequests.push(writeRequest);
158002
158303
  });
@@ -158611,9 +158912,9 @@ var require_ponyfill_es2018 = __commonJS({
158611
158912
  return new TypeError("Cannot " + name + " a stream using a released writer");
158612
158913
  }
158613
158914
  function defaultWriterClosedPromiseInitialize(writer) {
158614
- writer._closedPromise = newPromise((resolve77, reject) => {
158915
+ writer._closedPromise = newPromise((resolve77, reject2) => {
158615
158916
  writer._closedPromise_resolve = resolve77;
158616
- writer._closedPromise_reject = reject;
158917
+ writer._closedPromise_reject = reject2;
158617
158918
  writer._closedPromiseState = "pending";
158618
158919
  });
158619
158920
  }
@@ -158648,9 +158949,9 @@ var require_ponyfill_es2018 = __commonJS({
158648
158949
  writer._closedPromiseState = "resolved";
158649
158950
  }
158650
158951
  function defaultWriterReadyPromiseInitialize(writer) {
158651
- writer._readyPromise = newPromise((resolve77, reject) => {
158952
+ writer._readyPromise = newPromise((resolve77, reject2) => {
158652
158953
  writer._readyPromise_resolve = resolve77;
158653
- writer._readyPromise_reject = reject;
158954
+ writer._readyPromise_reject = reject2;
158654
158955
  });
158655
158956
  writer._readyPromiseState = "pending";
158656
158957
  }
@@ -158736,7 +159037,7 @@ var require_ponyfill_es2018 = __commonJS({
158736
159037
  source._disturbed = true;
158737
159038
  let shuttingDown = false;
158738
159039
  let currentWrite = promiseResolvedWith(void 0);
158739
- return newPromise((resolve77, reject) => {
159040
+ return newPromise((resolve77, reject2) => {
158740
159041
  let abortAlgorithm;
158741
159042
  if (signal !== void 0) {
158742
159043
  abortAlgorithm = () => {
@@ -158879,7 +159180,7 @@ var require_ponyfill_es2018 = __commonJS({
158879
159180
  signal.removeEventListener("abort", abortAlgorithm);
158880
159181
  }
158881
159182
  if (isError) {
158882
- reject(error);
159183
+ reject2(error);
158883
159184
  } else {
158884
159185
  resolve77(void 0);
158885
159186
  }
@@ -160298,9 +160599,9 @@ var require_ponyfill_es2018 = __commonJS({
160298
160599
  return controller._finishPromise;
160299
160600
  }
160300
160601
  const readable = stream._readable;
160301
- controller._finishPromise = newPromise((resolve77, reject) => {
160602
+ controller._finishPromise = newPromise((resolve77, reject2) => {
160302
160603
  controller._finishPromise_resolve = resolve77;
160303
- controller._finishPromise_reject = reject;
160604
+ controller._finishPromise_reject = reject2;
160304
160605
  });
160305
160606
  const cancelPromise = controller._cancelAlgorithm(reason);
160306
160607
  TransformStreamDefaultControllerClearAlgorithms(controller);
@@ -160325,9 +160626,9 @@ var require_ponyfill_es2018 = __commonJS({
160325
160626
  return controller._finishPromise;
160326
160627
  }
160327
160628
  const readable = stream._readable;
160328
- controller._finishPromise = newPromise((resolve77, reject) => {
160629
+ controller._finishPromise = newPromise((resolve77, reject2) => {
160329
160630
  controller._finishPromise_resolve = resolve77;
160330
- controller._finishPromise_reject = reject;
160631
+ controller._finishPromise_reject = reject2;
160331
160632
  });
160332
160633
  const flushPromise = controller._flushAlgorithm();
160333
160634
  TransformStreamDefaultControllerClearAlgorithms(controller);
@@ -160356,9 +160657,9 @@ var require_ponyfill_es2018 = __commonJS({
160356
160657
  return controller._finishPromise;
160357
160658
  }
160358
160659
  const writable = stream._writable;
160359
- controller._finishPromise = newPromise((resolve77, reject) => {
160660
+ controller._finishPromise = newPromise((resolve77, reject2) => {
160360
160661
  controller._finishPromise_resolve = resolve77;
160361
- controller._finishPromise_reject = reject;
160662
+ controller._finishPromise_reject = reject2;
160362
160663
  });
160363
160664
  const cancelPromise = controller._cancelAlgorithm(reason);
160364
160665
  TransformStreamDefaultControllerClearAlgorithms(controller);
@@ -162326,7 +162627,7 @@ import zlib2 from "zlib";
162326
162627
  import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "stream";
162327
162628
  import { Buffer as Buffer4 } from "buffer";
162328
162629
  async function fetch3(url, options_) {
162329
- return new Promise((resolve77, reject) => {
162630
+ return new Promise((resolve77, reject2) => {
162330
162631
  const request = new Request2(url, options_);
162331
162632
  const { parsedURL, options } = getNodeRequestOptions(request);
162332
162633
  if (!supportedSchemas.has(parsedURL.protocol)) {
@@ -162343,7 +162644,7 @@ async function fetch3(url, options_) {
162343
162644
  let response = null;
162344
162645
  const abort = () => {
162345
162646
  const error = new AbortError("The operation was aborted.");
162346
- reject(error);
162647
+ reject2(error);
162347
162648
  if (request.body && request.body instanceof Stream2.Readable) {
162348
162649
  request.body.destroy(error);
162349
162650
  }
@@ -162371,7 +162672,7 @@ async function fetch3(url, options_) {
162371
162672
  }
162372
162673
  };
162373
162674
  request_.on("error", (error) => {
162374
- reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, "system", error));
162675
+ reject2(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, "system", error));
162375
162676
  finalize();
162376
162677
  });
162377
162678
  fixResponseChunkedTransferBadEnding(request_, (error) => {
@@ -162404,14 +162705,14 @@ async function fetch3(url, options_) {
162404
162705
  locationURL = location === null ? null : new URL(location, request.url);
162405
162706
  } catch {
162406
162707
  if (request.redirect !== "manual") {
162407
- reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
162708
+ reject2(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
162408
162709
  finalize();
162409
162710
  return;
162410
162711
  }
162411
162712
  }
162412
162713
  switch (request.redirect) {
162413
162714
  case "error":
162414
- reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
162715
+ reject2(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
162415
162716
  finalize();
162416
162717
  return;
162417
162718
  case "manual":
@@ -162421,7 +162722,7 @@ async function fetch3(url, options_) {
162421
162722
  break;
162422
162723
  }
162423
162724
  if (request.counter >= request.follow) {
162424
- reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
162725
+ reject2(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
162425
162726
  finalize();
162426
162727
  return;
162427
162728
  }
@@ -162444,7 +162745,7 @@ async function fetch3(url, options_) {
162444
162745
  }
162445
162746
  }
162446
162747
  if (response_.statusCode !== 303 && request.body && options_.body instanceof Stream2.Readable) {
162447
- reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
162748
+ reject2(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
162448
162749
  finalize();
162449
162750
  return;
162450
162751
  }
@@ -162462,7 +162763,7 @@ async function fetch3(url, options_) {
162462
162763
  return;
162463
162764
  }
162464
162765
  default:
162465
- return reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
162766
+ return reject2(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
162466
162767
  }
162467
162768
  }
162468
162769
  if (signal) {
@@ -162472,7 +162773,7 @@ async function fetch3(url, options_) {
162472
162773
  }
162473
162774
  let body = pump(response_, new PassThrough2(), (error) => {
162474
162775
  if (error) {
162475
- reject(error);
162776
+ reject2(error);
162476
162777
  }
162477
162778
  });
162478
162779
  if (process.version < "v12.10") {
@@ -162500,7 +162801,7 @@ async function fetch3(url, options_) {
162500
162801
  if (codings === "gzip" || codings === "x-gzip") {
162501
162802
  body = pump(body, zlib2.createGunzip(zlibOptions), (error) => {
162502
162803
  if (error) {
162503
- reject(error);
162804
+ reject2(error);
162504
162805
  }
162505
162806
  });
162506
162807
  response = new Response2(body, responseOptions);
@@ -162510,20 +162811,20 @@ async function fetch3(url, options_) {
162510
162811
  if (codings === "deflate" || codings === "x-deflate") {
162511
162812
  const raw = pump(response_, new PassThrough2(), (error) => {
162512
162813
  if (error) {
162513
- reject(error);
162814
+ reject2(error);
162514
162815
  }
162515
162816
  });
162516
162817
  raw.once("data", (chunk) => {
162517
162818
  if ((chunk[0] & 15) === 8) {
162518
162819
  body = pump(body, zlib2.createInflate(), (error) => {
162519
162820
  if (error) {
162520
- reject(error);
162821
+ reject2(error);
162521
162822
  }
162522
162823
  });
162523
162824
  } else {
162524
162825
  body = pump(body, zlib2.createInflateRaw(), (error) => {
162525
162826
  if (error) {
162526
- reject(error);
162827
+ reject2(error);
162527
162828
  }
162528
162829
  });
162529
162830
  }
@@ -162541,7 +162842,7 @@ async function fetch3(url, options_) {
162541
162842
  if (codings === "br") {
162542
162843
  body = pump(body, zlib2.createBrotliDecompress(), (error) => {
162543
162844
  if (error) {
162544
- reject(error);
162845
+ reject2(error);
162545
162846
  }
162546
162847
  });
162547
162848
  response = new Response2(body, responseOptions);
@@ -162551,7 +162852,7 @@ async function fetch3(url, options_) {
162551
162852
  response = new Response2(body, responseOptions);
162552
162853
  resolve77(response);
162553
162854
  });
162554
- writeToStream(request_, request).catch(reject);
162855
+ writeToStream(request_, request).catch(reject2);
162555
162856
  });
162556
162857
  }
162557
162858
  function fixResponseChunkedTransferBadEnding(request, errorCallback) {
@@ -168631,18 +168932,18 @@ var require_jwtaccess = __commonJS({
168631
168932
  }
168632
168933
  }
168633
168934
  fromStreamAsync(inputStream) {
168634
- return new Promise((resolve77, reject) => {
168935
+ return new Promise((resolve77, reject2) => {
168635
168936
  if (!inputStream) {
168636
- reject(new Error("Must pass in a stream containing the service account auth settings."));
168937
+ reject2(new Error("Must pass in a stream containing the service account auth settings."));
168637
168938
  }
168638
168939
  let s2 = "";
168639
- inputStream.setEncoding("utf8").on("data", (chunk) => s2 += chunk).on("error", reject).on("end", () => {
168940
+ inputStream.setEncoding("utf8").on("data", (chunk) => s2 += chunk).on("error", reject2).on("end", () => {
168640
168941
  try {
168641
168942
  const data2 = JSON.parse(s2);
168642
168943
  this.fromJSON(data2);
168643
168944
  resolve77();
168644
168945
  } catch (err) {
168645
- reject(err);
168946
+ reject2(err);
168646
168947
  }
168647
168948
  });
168648
168949
  });
@@ -168879,18 +169180,18 @@ var require_jwtclient = __commonJS({
168879
169180
  }
168880
169181
  }
168881
169182
  fromStreamAsync(inputStream) {
168882
- return new Promise((resolve77, reject) => {
169183
+ return new Promise((resolve77, reject2) => {
168883
169184
  if (!inputStream) {
168884
169185
  throw new Error("Must pass in a stream containing the service account auth settings.");
168885
169186
  }
168886
169187
  let s2 = "";
168887
- inputStream.setEncoding("utf8").on("error", reject).on("data", (chunk) => s2 += chunk).on("end", () => {
169188
+ inputStream.setEncoding("utf8").on("error", reject2).on("data", (chunk) => s2 += chunk).on("end", () => {
168888
169189
  try {
168889
169190
  const data2 = JSON.parse(s2);
168890
169191
  this.fromJSON(data2);
168891
169192
  resolve77();
168892
169193
  } catch (e3) {
168893
- reject(e3);
169194
+ reject2(e3);
168894
169195
  }
168895
169196
  });
168896
169197
  });
@@ -169021,18 +169322,18 @@ var require_refreshclient = __commonJS({
169021
169322
  }
169022
169323
  }
169023
169324
  async fromStreamAsync(inputStream) {
169024
- return new Promise((resolve77, reject) => {
169325
+ return new Promise((resolve77, reject2) => {
169025
169326
  if (!inputStream) {
169026
- return reject(new Error("Must pass in a stream containing the user refresh token."));
169327
+ return reject2(new Error("Must pass in a stream containing the user refresh token."));
169027
169328
  }
169028
169329
  let s2 = "";
169029
- inputStream.setEncoding("utf8").on("error", reject).on("data", (chunk) => s2 += chunk).on("end", () => {
169330
+ inputStream.setEncoding("utf8").on("error", reject2).on("data", (chunk) => s2 += chunk).on("end", () => {
169030
169331
  try {
169031
169332
  const data2 = JSON.parse(s2);
169032
169333
  this.fromJSON(data2);
169033
169334
  return resolve77();
169034
169335
  } catch (err) {
169035
- return reject(err);
169336
+ return reject2(err);
169036
169337
  }
169037
169338
  });
169038
169339
  });
@@ -170863,7 +171164,7 @@ var require_pluggable_auth_handler = __commonJS({
170863
171164
  * @return A promise that resolves with the executable response.
170864
171165
  */
170865
171166
  retrieveResponseFromExecutable(envMap) {
170866
- return new Promise((resolve77, reject) => {
171167
+ return new Promise((resolve77, reject2) => {
170867
171168
  const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
170868
171169
  env: { ...process.env, ...Object.fromEntries(envMap) }
170869
171170
  });
@@ -170877,7 +171178,7 @@ var require_pluggable_auth_handler = __commonJS({
170877
171178
  const timeout = setTimeout(() => {
170878
171179
  child.removeAllListeners();
170879
171180
  child.kill();
170880
- return reject(new Error("The executable failed to finish within the timeout specified."));
171181
+ return reject2(new Error("The executable failed to finish within the timeout specified."));
170881
171182
  }, this.timeoutMillis);
170882
171183
  child.on("close", (code) => {
170883
171184
  clearTimeout(timeout);
@@ -170888,12 +171189,12 @@ var require_pluggable_auth_handler = __commonJS({
170888
171189
  return resolve77(response);
170889
171190
  } catch (error) {
170890
171191
  if (error instanceof executable_response_1.ExecutableResponseError) {
170891
- return reject(error);
171192
+ return reject2(error);
170892
171193
  }
170893
- return reject(new executable_response_1.ExecutableResponseError(`The executable returned an invalid response: ${output}`));
171194
+ return reject2(new executable_response_1.ExecutableResponseError(`The executable returned an invalid response: ${output}`));
170894
171195
  }
170895
171196
  } else {
170896
- return reject(new ExecutableError(output, code.toString()));
171197
+ return reject2(new ExecutableError(output, code.toString()));
170897
171198
  }
170898
171199
  });
170899
171200
  });
@@ -171788,12 +172089,12 @@ var require_googleauth = __commonJS({
171788
172089
  }
171789
172090
  }
171790
172091
  fromStreamAsync(inputStream, options) {
171791
- return new Promise((resolve77, reject) => {
172092
+ return new Promise((resolve77, reject2) => {
171792
172093
  if (!inputStream) {
171793
172094
  throw new Error("Must pass in a stream containing the Google auth settings.");
171794
172095
  }
171795
172096
  const chunks = [];
171796
- inputStream.setEncoding("utf8").on("error", reject).on("data", (chunk) => chunks.push(chunk)).on("end", () => {
172097
+ inputStream.setEncoding("utf8").on("error", reject2).on("data", (chunk) => chunks.push(chunk)).on("end", () => {
171797
172098
  try {
171798
172099
  try {
171799
172100
  const data2 = JSON.parse(chunks.join(""));
@@ -171811,7 +172112,7 @@ var require_googleauth = __commonJS({
171811
172112
  return resolve77(client);
171812
172113
  }
171813
172114
  } catch (err) {
171814
- return reject(err);
172115
+ return reject2(err);
171815
172116
  }
171816
172117
  });
171817
172118
  });
@@ -179656,7 +179957,7 @@ function __asyncGenerator2(thisArg, _arguments, generator) {
179656
179957
  }, i2;
179657
179958
  function awaitReturn(f3) {
179658
179959
  return function(v2) {
179659
- return Promise.resolve(v2).then(f3, reject);
179960
+ return Promise.resolve(v2).then(f3, reject2);
179660
179961
  };
179661
179962
  }
179662
179963
  function verb(n2, f3) {
@@ -179677,12 +179978,12 @@ function __asyncGenerator2(thisArg, _arguments, generator) {
179677
179978
  }
179678
179979
  }
179679
179980
  function step(r2) {
179680
- r2.value instanceof __await2 ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q2[0][2], r2);
179981
+ r2.value instanceof __await2 ? Promise.resolve(r2.value.v).then(fulfill, reject2) : settle(q2[0][2], r2);
179681
179982
  }
179682
179983
  function fulfill(value) {
179683
179984
  resume("next", value);
179684
179985
  }
179685
- function reject(value) {
179986
+ function reject2(value) {
179686
179987
  resume("throw", value);
179687
179988
  }
179688
179989
  function settle(f3, v2) {
@@ -179697,15 +179998,15 @@ function __asyncValues2(o) {
179697
179998
  }, i2);
179698
179999
  function verb(n2) {
179699
180000
  i2[n2] = o[n2] && function(v2) {
179700
- return new Promise(function(resolve77, reject) {
179701
- v2 = o[n2](v2), settle(resolve77, reject, v2.done, v2.value);
180001
+ return new Promise(function(resolve77, reject2) {
180002
+ v2 = o[n2](v2), settle(resolve77, reject2, v2.done, v2.value);
179702
180003
  });
179703
180004
  };
179704
180005
  }
179705
- function settle(resolve77, reject, d2, v2) {
180006
+ function settle(resolve77, reject2, d2, v2) {
179706
180007
  Promise.resolve(v2).then(function(v3) {
179707
180008
  resolve77({ value: v3, done: d2 });
179708
- }, reject);
180009
+ }, reject2);
179709
180010
  }
179710
180011
  }
179711
180012
  function isValidResponse(response) {
@@ -195091,11 +195392,11 @@ function round4(value) {
195091
195392
  function average(values) {
195092
195393
  return values.reduce((sum, value) => sum + value, 0) / Math.max(1, values.length);
195093
195394
  }
195094
- function isRecord11(value) {
195395
+ function isRecord12(value) {
195095
195396
  return typeof value === "object" && value !== null && !Array.isArray(value);
195096
195397
  }
195097
195398
  function asRecord(value) {
195098
- return isRecord11(value) ? value : {};
195399
+ return isRecord12(value) ? value : {};
195099
195400
  }
195100
195401
  function probeMedia2(mediaPath, ffprobePath) {
195101
195402
  try {
@@ -195627,7 +195928,7 @@ function containsColorGradingVariableRef(value) {
195627
195928
  if (typeof value !== "object" || value === null) return false;
195628
195929
  return Object.values(value).some(containsColorGradingVariableRef);
195629
195930
  }
195630
- function isRecord12(value) {
195931
+ function isRecord13(value) {
195631
195932
  return typeof value === "object" && value !== null && !Array.isArray(value);
195632
195933
  }
195633
195934
  function parseStoredGrading(raw) {
@@ -195639,16 +195940,16 @@ function parseStoredGrading(raw) {
195639
195940
  }
195640
195941
  }
195641
195942
  function mergeGradingPatch(current2, patch) {
195642
- if (!isRecord12(current2) || !isRecord12(patch)) return patch;
195943
+ if (!isRecord13(current2) || !isRecord13(patch)) return patch;
195643
195944
  const merged = { ...current2 };
195644
195945
  for (const [key2, value] of Object.entries(patch)) {
195645
- merged[key2] = isRecord12(value) && isRecord12(merged[key2]) ? mergeGradingPatch(merged[key2], value) : value;
195946
+ merged[key2] = isRecord13(value) && isRecord13(merged[key2]) ? mergeGradingPatch(merged[key2], value) : value;
195646
195947
  }
195647
195948
  return merged;
195648
195949
  }
195649
195950
  function serializeGradingPatch(before3, patch) {
195650
195951
  assertKnownGradingShape(patch);
195651
- if (isColorGradingVariableRef(before3) && isRecord12(patch)) {
195952
+ if (isColorGradingVariableRef(before3) && isRecord13(patch)) {
195652
195953
  throw new Error("Cannot merge a grading patch into an unresolved whole-grade variable");
195653
195954
  }
195654
195955
  const current2 = typeof before3 === "string" && !isColorGradingVariableRef(before3) ? { preset: before3 } : before3;
@@ -196021,7 +196322,7 @@ import {
196021
196322
  import { tmpdir as tmpdir17 } from "os";
196022
196323
  import { basename as basename27, dirname as dirname54, extname as extname21, join as join111, resolve as resolve70 } from "path";
196023
196324
  import sharp2 from "sharp";
196024
- function isRecord13(value) {
196325
+ function isRecord14(value) {
196025
196326
  return typeof value === "object" && value !== null && !Array.isArray(value);
196026
196327
  }
196027
196328
  function hasOwn3(record, key2) {
@@ -196082,22 +196383,22 @@ function serializedGradingForCell(cell) {
196082
196383
  return serializeHfColorGrading(normalized2);
196083
196384
  }
196084
196385
  function lutSrcFromGrading(grading) {
196085
- if (!isRecord13(grading) || !hasOwn3(grading, "lut")) return null;
196386
+ if (!isRecord14(grading) || !hasOwn3(grading, "lut")) return null;
196086
196387
  const lut = grading.lut;
196087
196388
  if (typeof lut === "string" && lut.trim()) return lut.trim();
196088
- if (!isRecord13(lut)) return null;
196389
+ if (!isRecord14(lut)) return null;
196089
196390
  const src = lut.src;
196090
196391
  return typeof src === "string" && src.trim() ? src.trim() : null;
196091
196392
  }
196092
196393
  function rewriteGradingLutSrc(grading, src) {
196093
- if (!isRecord13(grading) || !hasOwn3(grading, "lut")) return grading;
196394
+ if (!isRecord14(grading) || !hasOwn3(grading, "lut")) return grading;
196094
196395
  const lut = grading.lut;
196095
196396
  const next = cloneRecord(grading);
196096
196397
  if (typeof lut === "string") {
196097
196398
  next.lut = { src };
196098
196399
  return next;
196099
196400
  }
196100
- if (isRecord13(lut)) {
196401
+ if (isRecord14(lut)) {
196101
196402
  const nextLut = cloneRecord(lut);
196102
196403
  nextLut.src = src;
196103
196404
  next.lut = nextLut;
@@ -196118,7 +196419,7 @@ function parseGradesFile(filePath) {
196118
196419
  throw new Error("Grades file must be a JSON array of { label, grading } objects");
196119
196420
  }
196120
196421
  return parsed.map((entry, index) => {
196121
- if (!isRecord13(entry)) {
196422
+ if (!isRecord14(entry)) {
196122
196423
  throw new Error(`Grade entry ${index + 1} must be an object with label and grading`);
196123
196424
  }
196124
196425
  const label2 = entry.label;
@@ -197282,10 +197583,10 @@ async function streamToFile(url, destPath) {
197282
197583
  if (!r2.body) throw new Error(`empty response body for ${url}`);
197283
197584
  const file = createWriteStream4(destPath, { flags: "wx" });
197284
197585
  let streamError = null;
197285
- const streamErrored = new Promise((_, reject) => {
197586
+ const streamErrored = new Promise((_, reject2) => {
197286
197587
  file.once("error", (e3) => {
197287
197588
  streamError = e3;
197288
- reject(e3);
197589
+ reject2(e3);
197289
197590
  });
197290
197591
  });
197291
197592
  let bytes = 0;
@@ -198914,9 +199215,9 @@ async function withRemainingBudget(work, remainingMs, label2) {
198914
199215
  try {
198915
199216
  return await Promise.race([
198916
199217
  work,
198917
- new Promise((_resolve, reject) => {
199218
+ new Promise((_resolve, reject2) => {
198918
199219
  timer = setTimeout(() => {
198919
- reject(new StageBudgetTimeoutError(label2, remainingMs));
199220
+ reject2(new StageBudgetTimeoutError(label2, remainingMs));
198920
199221
  }, remainingMs);
198921
199222
  })
198922
199223
  ]);
@@ -199627,9 +199928,9 @@ function resolveVisionRequestTimeoutMs() {
199627
199928
  async function runBoundedVisionRequest(request, timeoutMs) {
199628
199929
  const controller = new AbortController();
199629
199930
  let timer;
199630
- const timeout = new Promise((_resolve, reject) => {
199931
+ const timeout = new Promise((_resolve, reject2) => {
199631
199932
  timer = setTimeout(() => {
199632
- reject(new VisionRequestTimeoutError(timeoutMs));
199933
+ reject2(new VisionRequestTimeoutError(timeoutMs));
199633
199934
  controller.abort();
199634
199935
  }, timeoutMs);
199635
199936
  });
@@ -202347,7 +202648,7 @@ var init_render2 = __esm({
202347
202648
  "use strict";
202348
202649
  init_commandResult();
202349
202650
  init_colors();
202350
- init_variables();
202651
+ init_variables2();
202351
202652
  init_dimensions();
202352
202653
  init_state();
202353
202654
  }
@@ -202599,7 +202900,7 @@ var init_render_batch = __esm({
202599
202900
  init_commandResult();
202600
202901
  init_colors();
202601
202902
  init_format();
202602
- init_variables();
202903
+ init_variables2();
202603
202904
  init_errorMessage();
202604
202905
  init_dimensions();
202605
202906
  init_state();
@@ -203950,7 +204251,7 @@ var init_cloudrun = __esm({
203950
204251
  init_dist();
203951
204252
  init_parseOutputResolution();
203952
204253
  init_colors();
203953
- init_variables();
204254
+ init_variables2();
203954
204255
  init_errorMessage();
203955
204256
  init_compositionFps();
203956
204257
  examples34 = [
@@ -204238,10 +204539,10 @@ function signalAbortError(signal) {
204238
204539
  return reason instanceof Error ? reason : new Error("Poll aborted");
204239
204540
  }
204240
204541
  function defaultAbortableSleep(signal) {
204241
- return (ms) => new Promise((resolve77, reject) => {
204542
+ return (ms) => new Promise((resolve77, reject2) => {
204242
204543
  const onAbort = () => {
204243
204544
  clearTimeout(timer);
204244
- reject(signalAbortError(signal));
204545
+ reject2(signalAbortError(signal));
204245
204546
  };
204246
204547
  const timer = setTimeout(() => {
204247
204548
  signal?.removeEventListener("abort", onAbort);
@@ -204320,7 +204621,7 @@ async function downloadToFile(url, destPath, options = {}) {
204320
204621
  return { path: destPath, bytes };
204321
204622
  }
204322
204623
  function waitForDrain(file, signal) {
204323
- return new Promise((resolve77, reject) => {
204624
+ return new Promise((resolve77, reject2) => {
204324
204625
  const cleanup = () => {
204325
204626
  file.off("drain", onDrain);
204326
204627
  file.off("error", onError);
@@ -204333,16 +204634,16 @@ function waitForDrain(file, signal) {
204333
204634
  };
204334
204635
  const onError = (err) => {
204335
204636
  cleanup();
204336
- reject(err);
204637
+ reject2(err);
204337
204638
  };
204338
204639
  const onClose = () => {
204339
204640
  cleanup();
204340
- reject(new Error("write stream closed before drain"));
204641
+ reject2(new Error("write stream closed before drain"));
204341
204642
  };
204342
204643
  const onAbort = () => {
204343
204644
  cleanup();
204344
204645
  const reason = signal?.reason;
204345
- reject(reason instanceof Error ? reason : new Error("Download aborted"));
204646
+ reject2(reason instanceof Error ? reason : new Error("Download aborted"));
204346
204647
  };
204347
204648
  file.once("drain", onDrain);
204348
204649
  file.once("error", onError);
@@ -205224,7 +205525,7 @@ var init_render3 = __esm({
205224
205525
  init_project();
205225
205526
  init_errorMessage();
205226
205527
  init_publishProject();
205227
- init_variables();
205528
+ init_variables2();
205228
205529
  init_updateCheck();
205229
205530
  init_cloud();
205230
205531
  init_errors2();
@@ -206147,10 +206448,10 @@ async function collectApiKey(inline) {
206147
206448
  return await promptForKey();
206148
206449
  }
206149
206450
  async function readAllWithTimeout(stream, timeoutMs) {
206150
- return await new Promise((resolve77, reject) => {
206451
+ return await new Promise((resolve77, reject2) => {
206151
206452
  const chunks = [];
206152
206453
  const timer = setTimeout(() => {
206153
- reject(new Error(`Timed out waiting for stdin (${timeoutMs}ms). Pipe the key explicitly.`));
206454
+ reject2(new Error(`Timed out waiting for stdin (${timeoutMs}ms). Pipe the key explicitly.`));
206154
206455
  }, timeoutMs);
206155
206456
  stream.on("data", (chunk) => {
206156
206457
  chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
@@ -206161,7 +206462,7 @@ async function readAllWithTimeout(stream, timeoutMs) {
206161
206462
  });
206162
206463
  stream.on("error", (err) => {
206163
206464
  clearTimeout(timer);
206164
- reject(err);
206465
+ reject2(err);
206165
206466
  });
206166
206467
  });
206167
206468
  }
@@ -206714,7 +207015,7 @@ async function readFigmaErrorMessage(res) {
206714
207015
  }
206715
207016
  try {
206716
207017
  const body = JSON.parse(text2);
206717
- if (isRecord14(body)) {
207018
+ if (isRecord15(body)) {
206718
207019
  if (typeof body.err === "string")
206719
207020
  return body.err;
206720
207021
  if (typeof body.message === "string")
@@ -206729,20 +207030,20 @@ function requireNodeId(ref2) {
206729
207030
  throw new Error(`figma ref ${ref2.fileKey} has no nodeId`);
206730
207031
  return ref2.nodeId;
206731
207032
  }
206732
- function isRecord14(value) {
207033
+ function isRecord15(value) {
206733
207034
  return typeof value === "object" && value !== null;
206734
207035
  }
206735
207036
  function optionalString(value) {
206736
207037
  return typeof value === "string" ? value : void 0;
206737
207038
  }
206738
207039
  function toVariablePayload(payload) {
206739
- if (!isRecord14(payload) || typeof payload.name !== "string")
207040
+ if (!isRecord15(payload) || typeof payload.name !== "string")
206740
207041
  return null;
206741
207042
  return {
206742
207043
  name: payload.name,
206743
207044
  key: optionalString(payload.key),
206744
207045
  resolvedType: optionalString(payload.resolvedType),
206745
- valuesByMode: isRecord14(payload.valuesByMode) ? payload.valuesByMode : void 0,
207046
+ valuesByMode: isRecord15(payload.valuesByMode) ? payload.valuesByMode : void 0,
206746
207047
  variableCollectionId: optionalString(payload.variableCollectionId)
206747
207048
  };
206748
207049
  }
@@ -206817,7 +207118,7 @@ function createFigmaClient(options) {
206817
207118
  scopeHint: SCOPE_HINTS.fileContent,
206818
207119
  endpoint: "images"
206819
207120
  });
206820
- const images = isRecord14(body) && isRecord14(body.images) ? body.images : {};
207121
+ const images = isRecord15(body) && isRecord15(body.images) ? body.images : {};
206821
207122
  return nodeIds.map((nodeId) => {
206822
207123
  const url = images[nodeId];
206823
207124
  return {
@@ -206832,8 +207133,8 @@ function createFigmaClient(options) {
206832
207133
  scopeHint: SCOPE_HINTS.fileContent,
206833
207134
  endpoint: "files_images"
206834
207135
  });
206835
- const meta = isRecord14(body) && isRecord14(body.meta) ? body.meta : {};
206836
- const images = isRecord14(meta.images) ? meta.images : {};
207136
+ const meta = isRecord15(body) && isRecord15(body.meta) ? body.meta : {};
207137
+ const images = isRecord15(meta.images) ? meta.images : {};
206837
207138
  const out = /* @__PURE__ */ new Map();
206838
207139
  for (const [ref2, url] of Object.entries(images)) {
206839
207140
  if (typeof url === "string")
@@ -206846,9 +207147,9 @@ function createFigmaClient(options) {
206846
207147
  enterpriseGated: true,
206847
207148
  endpoint: "variables_local"
206848
207149
  });
206849
- const meta = isRecord14(body) && isRecord14(body.meta) ? body.meta : {};
206850
- const variables = isRecord14(meta.variables) ? meta.variables : {};
206851
- const collections = isRecord14(meta.variableCollections) ? meta.variableCollections : {};
207150
+ const meta = isRecord15(body) && isRecord15(body.meta) ? body.meta : {};
207151
+ const variables = isRecord15(meta.variables) ? meta.variables : {};
207152
+ const collections = isRecord15(meta.variableCollections) ? meta.variableCollections : {};
206852
207153
  const typed = {};
206853
207154
  for (const [id, payload] of Object.entries(variables)) {
206854
207155
  const v2 = toVariablePayload(payload);
@@ -206862,9 +207163,9 @@ function createFigmaClient(options) {
206862
207163
  scopeHint: SCOPE_HINTS.libraryContent,
206863
207164
  endpoint: "styles"
206864
207165
  });
206865
- const meta = isRecord14(body) && isRecord14(body.meta) ? body.meta : {};
207166
+ const meta = isRecord15(body) && isRecord15(body.meta) ? body.meta : {};
206866
207167
  const styles = Array.isArray(meta.styles) ? meta.styles : [];
206867
- return styles.filter((s2) => isRecord14(s2) && typeof s2.key === "string" && typeof s2.name === "string" && typeof s2.style_type === "string");
207168
+ return styles.filter((s2) => isRecord15(s2) && typeof s2.key === "string" && typeof s2.name === "string" && typeof s2.style_type === "string");
206868
207169
  },
206869
207170
  async nodeTree(ref2) {
206870
207171
  const nodeId = requireNodeId(ref2);
@@ -206873,10 +207174,10 @@ function createFigmaClient(options) {
206873
207174
  scopeHint: SCOPE_HINTS.fileContent,
206874
207175
  endpoint: "files_nodes"
206875
207176
  });
206876
- const nodes = isRecord14(body) && isRecord14(body.nodes) ? body.nodes : {};
207177
+ const nodes = isRecord15(body) && isRecord15(body.nodes) ? body.nodes : {};
206877
207178
  const entry = nodes[nodeId];
206878
- const doc = isRecord14(entry) ? entry.document : void 0;
206879
- if (!isRecord14(doc) || typeof doc.id !== "string" || typeof doc.name !== "string" || typeof doc.type !== "string")
207179
+ const doc = isRecord15(entry) ? entry.document : void 0;
207180
+ if (!isRecord15(doc) || typeof doc.id !== "string" || typeof doc.name !== "string" || typeof doc.type !== "string")
206880
207181
  throw new FigmaClientError("NODE_NOT_FOUND", `node ${nodeId} not found in ${ref2.fileKey}`, void 0, "files_nodes");
206881
207182
  return { ...doc, id: doc.id, name: doc.name, type: doc.type };
206882
207183
  },
@@ -206885,8 +207186,8 @@ function createFigmaClient(options) {
206885
207186
  scopeHint: SCOPE_HINTS.fileMetadata,
206886
207187
  endpoint: "file_meta"
206887
207188
  });
206888
- const version2 = isRecord14(body) && typeof body.version === "string" ? body.version : "";
206889
- const lastModified = isRecord14(body) && typeof body.lastModified === "string" ? body.lastModified : "";
207189
+ const version2 = isRecord15(body) && typeof body.version === "string" ? body.version : "";
207190
+ const lastModified = isRecord15(body) && typeof body.lastModified === "string" ? body.lastModified : "";
206890
207191
  return { version: version2, lastModified };
206891
207192
  }
206892
207193
  };
@@ -207228,11 +207529,11 @@ import { join as join134 } from "path";
207228
207529
  function bindingsPath(projectDir) {
207229
207530
  return join134(mediaDir(projectDir), BINDINGS_FILE);
207230
207531
  }
207231
- function isRecord15(value) {
207532
+ function isRecord16(value) {
207232
207533
  return typeof value === "object" && value !== null;
207233
207534
  }
207234
207535
  function isBindingRecord(value) {
207235
- return isRecord15(value) && value.kind === "binding" && typeof value.figmaId === "string" && typeof value.sourceFileKey === "string" && typeof value.compositionVariableId === "string" && typeof value.version === "string";
207536
+ return isRecord16(value) && value.kind === "binding" && typeof value.figmaId === "string" && typeof value.sourceFileKey === "string" && typeof value.compositionVariableId === "string" && typeof value.version === "string";
207236
207537
  }
207237
207538
  function readLines(projectDir) {
207238
207539
  return readJsonlValues(bindingsPath(projectDir));
@@ -207258,14 +207559,14 @@ var init_bindings = __esm({
207258
207559
  });
207259
207560
 
207260
207561
  // ../core/dist/figma/color.js
207261
- function isRecord16(value) {
207562
+ function isRecord17(value) {
207262
207563
  return typeof value === "object" && value !== null;
207263
207564
  }
207264
207565
  function toHexByte(channel) {
207265
207566
  return Math.round(channel * 255).toString(16).padStart(2, "0").toUpperCase();
207266
207567
  }
207267
207568
  function figmaColorToCss(value, extraOpacity = 1) {
207268
- if (!isRecord16(value))
207569
+ if (!isRecord17(value))
207269
207570
  return null;
207270
207571
  const { r: r2, g, b: b2, a } = value;
207271
207572
  if (typeof r2 !== "number" || typeof g !== "number" || typeof b2 !== "number")
@@ -207283,11 +207584,11 @@ var init_color = __esm({
207283
207584
  });
207284
207585
 
207285
207586
  // ../core/dist/figma/nodeDocument.js
207286
- function isRecord17(value) {
207587
+ function isRecord18(value) {
207287
207588
  return typeof value === "object" && value !== null;
207288
207589
  }
207289
207590
  function asNodeDocument(value) {
207290
- if (isRecord17(value) && typeof value.id === "string" && typeof value.name === "string" && typeof value.type === "string") {
207591
+ if (isRecord18(value) && typeof value.id === "string" && typeof value.name === "string" && typeof value.type === "string") {
207291
207592
  return { ...value, id: value.id, name: value.name, type: value.type };
207292
207593
  }
207293
207594
  return null;
@@ -207310,17 +207611,17 @@ var init_nodeDocument = __esm({
207310
207611
  });
207311
207612
 
207312
207613
  // ../core/dist/figma/resolveBindings.js
207313
- function isRecord18(value) {
207614
+ function isRecord19(value) {
207314
207615
  return typeof value === "object" && value !== null;
207315
207616
  }
207316
207617
  function aliasId(value) {
207317
- if (isRecord18(value) && value.type === "VARIABLE_ALIAS" && typeof value.id === "string")
207618
+ if (isRecord19(value) && value.type === "VARIABLE_ALIAS" && typeof value.id === "string")
207318
207619
  return value.id;
207319
207620
  return null;
207320
207621
  }
207321
207622
  function boundVariableSites(node, out) {
207322
207623
  const bound = node.boundVariables;
207323
- if (!isRecord18(bound))
207624
+ if (!isRecord19(bound))
207324
207625
  return;
207325
207626
  for (const [property, value] of Object.entries(bound)) {
207326
207627
  const candidates = Array.isArray(value) ? value : [value];
@@ -207333,7 +207634,7 @@ function boundVariableSites(node, out) {
207333
207634
  }
207334
207635
  function styleSites(node, out) {
207335
207636
  const styles = node.styles;
207336
- if (!isRecord18(styles))
207637
+ if (!isRecord19(styles))
207337
207638
  return;
207338
207639
  for (const [slot, styleId] of Object.entries(styles)) {
207339
207640
  if (typeof styleId === "string" && styleId.length > 0)
@@ -207379,12 +207680,12 @@ var init_resolveBindings = __esm({
207379
207680
  });
207380
207681
 
207381
207682
  // ../core/dist/figma/nodeToHtml.js
207382
- function isRecord19(value) {
207683
+ function isRecord20(value) {
207383
207684
  return typeof value === "object" && value !== null;
207384
207685
  }
207385
207686
  function boxOf(node) {
207386
207687
  const b2 = node.absoluteBoundingBox;
207387
- if (isRecord19(b2) && typeof b2.x === "number" && typeof b2.y === "number" && typeof b2.width === "number" && typeof b2.height === "number")
207688
+ if (isRecord20(b2) && typeof b2.x === "number" && typeof b2.y === "number" && typeof b2.width === "number" && typeof b2.height === "number")
207388
207689
  return { x: b2.x, y: b2.y, width: b2.width, height: b2.height };
207389
207690
  return null;
207390
207691
  }
@@ -207399,7 +207700,7 @@ function firstVisibleFill(node) {
207399
207700
  if (!Array.isArray(fills))
207400
207701
  return null;
207401
207702
  for (const fill of fills) {
207402
- if (isRecord19(fill) && fill.visible !== false)
207703
+ if (isRecord20(fill) && fill.visible !== false)
207403
207704
  return fill;
207404
207705
  }
207405
207706
  return null;
@@ -207410,7 +207711,7 @@ function gradientCss(fill) {
207410
207711
  return null;
207411
207712
  const parts = [];
207412
207713
  for (const stop of stops) {
207413
- if (!isRecord19(stop) || typeof stop.position !== "number")
207714
+ if (!isRecord20(stop) || typeof stop.position !== "number")
207414
207715
  return null;
207415
207716
  const color = figmaColorToCss(stop.color);
207416
207717
  if (color === null)
@@ -207435,7 +207736,7 @@ function hasImageFill(node) {
207435
207736
  return firstVisibleFill(node)?.type === "IMAGE";
207436
207737
  }
207437
207738
  function dropShadowCss(effect) {
207438
- if (!isRecord19(effect.offset))
207739
+ if (!isRecord20(effect.offset))
207439
207740
  return null;
207440
207741
  const color = figmaColorToCss(effect.color);
207441
207742
  const { x: x3, y } = effect.offset;
@@ -207445,7 +207746,7 @@ function dropShadowCss(effect) {
207445
207746
  return `box-shadow: ${round5(x3)}px ${round5(y)}px ${round5(radius)}px ${color}`;
207446
207747
  }
207447
207748
  function effectCss(effect) {
207448
- if (!isRecord19(effect) || effect.visible === false)
207749
+ if (!isRecord20(effect) || effect.visible === false)
207449
207750
  return null;
207450
207751
  if (effect.type === "DROP_SHADOW")
207451
207752
  return dropShadowCss(effect);
@@ -207465,7 +207766,7 @@ function effectsCss(node, styles) {
207465
207766
  }
207466
207767
  function textCss(node, styles) {
207467
207768
  const s2 = node.style;
207468
- if (!isRecord19(s2))
207769
+ if (!isRecord20(s2))
207469
207770
  return;
207470
207771
  if (typeof s2.fontFamily === "string")
207471
207772
  styles.push(`font-family: '${s2.fontFamily.replace(/['"\\;]/g, "")}'`);
@@ -207613,13 +207914,13 @@ var init_nodeToHtml = __esm({
207613
207914
  });
207614
207915
 
207615
207916
  // ../core/dist/figma/tokensToVariables.js
207616
- function isRecord20(value) {
207917
+ function isRecord21(value) {
207617
207918
  return typeof value === "object" && value !== null;
207618
207919
  }
207619
207920
  function baseModeValue(payload, collections) {
207620
207921
  const modes = payload.valuesByMode ?? {};
207621
207922
  const collection = collections[payload.variableCollectionId ?? ""];
207622
- if (isRecord20(collection) && typeof collection.defaultModeId === "string") {
207923
+ if (isRecord21(collection) && typeof collection.defaultModeId === "string") {
207623
207924
  const preferred = modes[collection.defaultModeId];
207624
207925
  if (preferred !== void 0)
207625
207926
  return preferred;
@@ -207630,7 +207931,7 @@ function baseModeValue(payload, collections) {
207630
207931
  }
207631
207932
  function collectionName(payload, collections) {
207632
207933
  const collection = collections[payload.variableCollectionId ?? ""];
207633
- return isRecord20(collection) && typeof collection.name === "string" ? collection.name : null;
207934
+ return isRecord21(collection) && typeof collection.name === "string" ? collection.name : null;
207634
207935
  }
207635
207936
  function resolveValue2(start, vars) {
207636
207937
  const chain = [];
@@ -207643,7 +207944,7 @@ function resolveValue2(start, vars) {
207643
207944
  if (!payload)
207644
207945
  return null;
207645
207946
  const value = baseModeValue(payload, vars.variableCollections);
207646
- if (isRecord20(value) && value.type === "VARIABLE_ALIAS" && typeof value.id === "string") {
207947
+ if (isRecord21(value) && value.type === "VARIABLE_ALIAS" && typeof value.id === "string") {
207647
207948
  currentId = value.id;
207648
207949
  continue;
207649
207950
  }