@hyperframes/studio 0.8.211 → 0.8.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -54,7 +54,7 @@ import {
54
54
  whenPreviewBooted,
55
55
  writeStudioUiPreferences,
56
56
  zoomToSelectedClips
57
- } from "./chunk-HD6NXWGI.js";
57
+ } from "./chunk-UNZTUFD7.js";
58
58
  import {
59
59
  Button,
60
60
  ContextMenu,
@@ -492,8 +492,8 @@ function studioRouteKind(hash) {
492
492
  }
493
493
  var ROUTE_IDS_KEY = "hyperframes-studio:routeIds";
494
494
  var routeIds;
495
- function isRouteIdEntry(entry2) {
496
- return Array.isArray(entry2) && entry2.length === 2 && typeof entry2[0] === "string" && typeof entry2[1] === "string" && /^[0-9a-f]{8}$/.test(entry2[1]);
495
+ function isRouteIdEntry(entry3) {
496
+ return Array.isArray(entry3) && entry3.length === 2 && typeof entry3[0] === "string" && typeof entry3[1] === "string" && /^[0-9a-f]{8}$/.test(entry3[1]);
497
497
  }
498
498
  function readRouteIds() {
499
499
  try {
@@ -2109,15 +2109,15 @@ function getTimelineBeatEntries(beatTimes, beatStrengths, range, pinnedIndexes =
2109
2109
  const start = range?.start ?? Number.NEGATIVE_INFINITY;
2110
2110
  const end = range?.end ?? Number.POSITIVE_INFINITY;
2111
2111
  const selected = /* @__PURE__ */ new Set();
2112
- for (let index = findFirstTimeAtOrAfter(beatTimes, start); index < beatTimes.length; index++) {
2113
- const time = beatTimes[index];
2112
+ for (let index2 = findFirstTimeAtOrAfter(beatTimes, start); index2 < beatTimes.length; index2++) {
2113
+ const time = beatTimes[index2];
2114
2114
  if (time === void 0 || time >= end) break;
2115
- selected.add(index);
2115
+ selected.add(index2);
2116
2116
  }
2117
- for (const index of pinnedIndexes) {
2118
- if (index >= 0 && index < beatTimes.length) selected.add(index);
2117
+ for (const index2 of pinnedIndexes) {
2118
+ if (index2 >= 0 && index2 < beatTimes.length) selected.add(index2);
2119
2119
  }
2120
- return [...selected].sort((left, right) => left - right).map((index) => ({ index, time: beatTimes[index], strength: beatStrengths?.[index] }));
2120
+ return [...selected].sort((left, right) => left - right).map((index2) => ({ index: index2, time: beatTimes[index2], strength: beatStrengths?.[index2] }));
2121
2121
  }
2122
2122
  function getTimelineLaneTop(laneIndex) {
2123
2123
  return TRACK_H + Math.max(0, Math.trunc(laneIndex)) * LANE_H;
@@ -2875,8 +2875,8 @@ function buildPushUpCandidate(input) {
2875
2875
  });
2876
2876
  let siblingChanges = 0;
2877
2877
  let requiredZIndex = draggedZIndex + 1;
2878
- for (let index = input.beforeIndex; index >= 0; index -= 1) {
2879
- const layer = input.layers[index];
2878
+ for (let index2 = input.beforeIndex; index2 >= 0; index2 -= 1) {
2879
+ const layer = input.layers[index2];
2880
2880
  if (!layer) continue;
2881
2881
  const nextZIndex = layer.zIndex >= requiredZIndex ? layer.zIndex : requiredZIndex;
2882
2882
  siblingChanges += addLayerChanges(changes, layer, nextZIndex, draggedKey);
@@ -2893,8 +2893,8 @@ function buildPushDownCandidate(input) {
2893
2893
  });
2894
2894
  let siblingChanges = 0;
2895
2895
  let requiredZIndex = draggedZIndex - 1;
2896
- for (let index = input.afterIndex; index < input.layers.length; index += 1) {
2897
- const layer = input.layers[index];
2896
+ for (let index2 = input.afterIndex; index2 < input.layers.length; index2 += 1) {
2897
+ const layer = input.layers[index2];
2898
2898
  if (!layer) continue;
2899
2899
  const nextZIndex = layer.zIndex <= requiredZIndex ? layer.zIndex : requiredZIndex;
2900
2900
  siblingChanges += addLayerChanges(changes, layer, nextZIndex, draggedKey);
@@ -3235,9 +3235,9 @@ function buildTimelineGroupResizeMembers(elements, selectedKeys, grabbedKey, edg
3235
3235
  }
3236
3236
  function resolveTimelineGroupResizeChanges(members, edge, rawDelta, minDuration = resolveTimelineMinDuration()) {
3237
3237
  const result = resolveTimelineGroupResize(members, edge, rawDelta, minDuration);
3238
- return result.members.map((member, index) => ({
3239
- element: members[index].element,
3240
- key: members[index].key,
3238
+ return result.members.map((member, index2) => ({
3239
+ element: members[index2].element,
3240
+ key: members[index2].key,
3241
3241
  start: member.start,
3242
3242
  duration: member.duration,
3243
3243
  playbackStart: member.playbackStart
@@ -4355,8 +4355,8 @@ function generateTicks(duration, pixelsPerSecond, frameRate, range) {
4355
4355
  const maxTicks = 2e3;
4356
4356
  const tickRange = getTickRange(duration, range);
4357
4357
  const firstMajorIndex = Math.max(0, Math.floor(tickRange.start / majorInterval));
4358
- for (let index = firstMajorIndex; major.length < maxTicks; index++) {
4359
- const time = index * majorInterval;
4358
+ for (let index2 = firstMajorIndex; major.length < maxTicks; index2++) {
4359
+ const time = index2 * majorInterval;
4360
4360
  if (time > tickRange.end + 1e-3) break;
4361
4361
  if (time >= tickRange.start - 1e-3) major.push(roundTickValue(time));
4362
4362
  appendMinorTicks(minor, time, minorInterval, subdivisions, tickRange, maxTicks, major.length);
@@ -5210,9 +5210,9 @@ function structuralSelector(element) {
5210
5210
  }
5211
5211
  const parent = node.parentElement;
5212
5212
  if (!parent) break;
5213
- const index = [...parent.children].indexOf(node) + 1;
5214
- if (index < 1) return null;
5215
- parts.unshift(`${node.tagName.toLowerCase()}:nth-child(${index})`);
5213
+ const index2 = [...parent.children].indexOf(node) + 1;
5214
+ if (index2 < 1) return null;
5215
+ parts.unshift(`${node.tagName.toLowerCase()}:nth-child(${index2})`);
5216
5216
  }
5217
5217
  if (parts.length === 0) return null;
5218
5218
  const selector = parts.join(" > ");
@@ -5275,9 +5275,9 @@ function queryIframeElement(iframe, selector) {
5275
5275
  return null;
5276
5276
  }
5277
5277
  }
5278
- function collectAnimatableKeyframeProperties(entry2) {
5278
+ function collectAnimatableKeyframeProperties(entry3) {
5279
5279
  const properties = {};
5280
- for (const [property, value] of Object.entries(entry2)) {
5280
+ for (const [property, value] of Object.entries(entry3)) {
5281
5281
  if (property === "ease") continue;
5282
5282
  if (typeof value === "number") properties[property] = Math.round(value * 1e3) / 1e3;
5283
5283
  else if (typeof value === "string") properties[property] = value;
@@ -5290,12 +5290,12 @@ function parsePercentageKeyframes(kfObj) {
5290
5290
  if (Array.isArray(kfObj)) {
5291
5291
  const steps = kfObj;
5292
5292
  const timing = getObjectArrayKeyframeTiming(
5293
- steps.map((entry2) => entry2?.duration)
5293
+ steps.map((entry3) => entry3?.duration)
5294
5294
  );
5295
5295
  if (!timing) return null;
5296
- steps.forEach((entry2, i) => {
5297
- if (!entry2 || typeof entry2 !== "object") return;
5298
- const properties = collectAnimatableKeyframeProperties(entry2);
5296
+ steps.forEach((entry3, i) => {
5297
+ if (!entry3 || typeof entry3 !== "object") return;
5298
+ const properties = collectAnimatableKeyframeProperties(entry3);
5299
5299
  if (Object.keys(properties).length > 0) {
5300
5300
  keyframes.push({ percentage: timing.percentages[i], properties, step: i });
5301
5301
  }
@@ -6231,9 +6231,9 @@ var ADD_METHOD_LABELS = {
6231
6231
  // src/components/editor/easeCurveSvg.tsx
6232
6232
  import { jsx as jsx9 } from "react/jsx-runtime";
6233
6233
  function sampledPath(samples, x, y, evaluate) {
6234
- return Array.from({ length: samples + 1 }, (_, index) => {
6235
- const progress = index / samples;
6236
- return `${index === 0 ? "M" : "L"}${x(progress)},${y(evaluate(progress))}`;
6234
+ return Array.from({ length: samples + 1 }, (_, index2) => {
6235
+ const progress = index2 / samples;
6236
+ return `${index2 === 0 ? "M" : "L"}${x(progress)},${y(evaluate(progress))}`;
6237
6237
  }).join(" ");
6238
6238
  }
6239
6239
  function holdCurvePath(left, bottom, right, top) {
@@ -8113,13 +8113,13 @@ var TimelineDiamondLane = memo9(function TimelineDiamondLane2({
8113
8113
  }
8114
8114
  return percentage / 100 * clipWidthPx2;
8115
8115
  };
8116
- const markers = sorted.map((keyframe, index) => {
8116
+ const markers = sorted.map((keyframe, index2) => {
8117
8117
  const centerX = centerXOf(keyframe);
8118
8118
  if (keyframe.percentage < 0 || keyframe.percentage > 100) {
8119
8119
  return { keyframe, centerX, hitWidth: diamondSize, visualSize: diamondSize };
8120
8120
  }
8121
- const previous = sorted[index - 1];
8122
- const next = sorted[index + 1];
8121
+ const previous = sorted[index2 - 1];
8122
+ const next = sorted[index2 + 1];
8123
8123
  const previousGap = previous ? centerX - centerXOf(previous) : Infinity;
8124
8124
  const nextGap = next ? centerXOf(next) - centerX : Infinity;
8125
8125
  const nearestGap = Math.max(1, Math.min(previousGap, nextGap));
@@ -8841,9 +8841,9 @@ function computeLaneCounts(tracks, gsapAnimations) {
8841
8841
  function applyGroupStripHeights(tracks, rowHeights, groups, expandedLaneOwnerIds) {
8842
8842
  if (groups.length === 0) return rowHeights;
8843
8843
  const groupByAnchor = new Map(groups.map((group) => [group.anchorKey, group]));
8844
- return tracks.map(([track2], index) => {
8844
+ return tracks.map(([track2], index2) => {
8845
8845
  const group = groupByAnchor.get(track2);
8846
- if (!group || !expandedLaneOwnerIds.has(group.id)) return rowHeights[index] ?? TRACK_H;
8846
+ if (!group || !expandedLaneOwnerIds.has(group.id)) return rowHeights[index2] ?? TRACK_H;
8847
8847
  return TRACK_H + groupOwnLaneCount(group) * AUTOMATION_LANE_H;
8848
8848
  });
8849
8849
  }
@@ -9071,9 +9071,9 @@ function propertyItems(rowId, clip, keyframes) {
9071
9071
  ([leftKey, left], [rightKey, right]) => left.time - right.time || leftKey.localeCompare(rightKey)
9072
9072
  );
9073
9073
  const items = [];
9074
- for (let index = 0; index < ordered.length; index += 1) {
9075
- const [, current] = ordered[index];
9076
- const previous = ordered[index - 1]?.[1];
9074
+ for (let index2 = 0; index2 < ordered.length; index2 += 1) {
9075
+ const [, current] = ordered[index2];
9076
+ const previous = ordered[index2 - 1]?.[1];
9077
9077
  if (previous && current.time > previous.time && current.target.animationId !== void 0) {
9078
9078
  items.push({
9079
9079
  id: timelineEaseFocusId(id, current.target),
@@ -9261,12 +9261,12 @@ function resolveTimelineFocusFallback(previousRows, nextRows, currentId) {
9261
9261
  const previous = locateTimelineLogicalTarget(previousRows, currentId);
9262
9262
  if (!previous) return null;
9263
9263
  if (previous.itemIndex >= 0) {
9264
- for (let index = previous.itemIndex - 1; index >= 0; index -= 1) {
9265
- const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index].id);
9264
+ for (let index2 = previous.itemIndex - 1; index2 >= 0; index2 -= 1) {
9265
+ const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index2].id);
9266
9266
  if (candidate) return candidate.target;
9267
9267
  }
9268
- for (let index = previous.itemIndex + 1; index < previous.row.items.length; index += 1) {
9269
- const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index].id);
9268
+ for (let index2 = previous.itemIndex + 1; index2 < previous.row.items.length; index2 += 1) {
9269
+ const candidate = locateTimelineLogicalTarget(nextRows, previous.row.items[index2].id);
9270
9270
  if (candidate) return candidate.target;
9271
9271
  }
9272
9272
  }
@@ -9353,8 +9353,8 @@ function viewportPageSize(logicalRowCountByTrack, focusedTrackKey, geometry, vie
9353
9353
  Math.floor(geometry.getRowFromY(pageTop + Math.max(0, viewport2.clientHeight - 1e-3)))
9354
9354
  );
9355
9355
  let count = 0;
9356
- for (let index = first; index <= last; index += 1) {
9357
- count += logicalRowCountByTrack.get(geometry.rowKeys[index]) ?? 0;
9356
+ for (let index2 = first; index2 <= last; index2 += 1) {
9357
+ count += logicalRowCountByTrack.get(geometry.rowKeys[index2]) ?? 0;
9358
9358
  }
9359
9359
  return Math.max(1, count);
9360
9360
  }
@@ -9453,9 +9453,9 @@ function isTransitionPair(a, b) {
9453
9453
  function deriveTimelineTransitionSeams(elements) {
9454
9454
  const sorted = [...elements].sort((left, right) => left.start - right.start);
9455
9455
  const seams = [];
9456
- for (let index = 0; index < sorted.length - 1; index += 1) {
9457
- const outgoing = sorted[index];
9458
- const incoming = sorted[index + 1];
9456
+ for (let index2 = 0; index2 < sorted.length - 1; index2 += 1) {
9457
+ const outgoing = sorted[index2];
9458
+ const incoming = sorted[index2 + 1];
9459
9459
  if (outgoing.track !== incoming.track || !isTransitionPair(outgoing, incoming)) continue;
9460
9460
  const outgoingEnd = outgoing.start + outgoing.duration;
9461
9461
  const overlapStart = Math.max(outgoing.start, incoming.start);
@@ -9525,11 +9525,11 @@ function packZoneLanes(clips, base2, laneOf) {
9525
9525
  if (list) list.push(el);
9526
9526
  else byTrack.set(el.track, [el]);
9527
9527
  }
9528
- let used = 0;
9528
+ let used2 = 0;
9529
9529
  for (const track2 of [...byTrack.keys()].sort((a, b) => a - b)) {
9530
- used += packTrackLanes(byTrack.get(track2), base2 + used, laneOf);
9530
+ used2 += packTrackLanes(byTrack.get(track2), base2 + used2, laneOf);
9531
9531
  }
9532
- return used;
9532
+ return used2;
9533
9533
  }
9534
9534
  function normalizeToZones(elements) {
9535
9535
  if (elements.length === 0) return elements;
@@ -9594,7 +9594,7 @@ function layoutAfterTrackInsert(element, previewStart, insertRow, multi, deps) {
9594
9594
  const writableTracks = new Set(topologyOrder);
9595
9595
  topologyOrder = grouped.trackOrder.filter((track2) => writableTracks.has(track2));
9596
9596
  topologyInsertRow = grouped.trackOrder.slice(0, grouped.topologyRows[insertRow]).filter((track2) => writableTracks.has(track2)).length;
9597
- ranks = new Map(topologyOrder.map((track2, index) => [track2, index]));
9597
+ ranks = new Map(topologyOrder.map((track2, index2) => [track2, index2]));
9598
9598
  }
9599
9599
  const topologyTargetTrack = ranks ? topologyInsertRow - 0.5 : insertTrackValue(topologyOrder, topologyInsertRow);
9600
9600
  const normalized = normalizeToZones(
@@ -10077,13 +10077,13 @@ function beginStudioPendingEdit(revert) {
10077
10077
  commitOlderDebouncedEdits();
10078
10078
  let settle;
10079
10079
  const promise = trackStudioPendingEdit(new Promise((resolve) => settle = resolve));
10080
- const entry2 = pendingEdits.get(promise);
10081
- entry2.revert = revert;
10080
+ const entry3 = pendingEdits.get(promise);
10081
+ entry3.revert = revert;
10082
10082
  let landed = Promise.resolve(false);
10083
10083
  let saved2 = false;
10084
- entry2.landed = () => landed;
10084
+ entry3.landed = () => landed;
10085
10085
  const inFlight = {
10086
- reverted: () => entry2.revert === null && revert !== null,
10086
+ reverted: () => entry3.revert === null && revert !== null,
10087
10087
  within(run) {
10088
10088
  const outer = adopting;
10089
10089
  adopting = inFlight;
@@ -10094,16 +10094,16 @@ function beginStudioPendingEdit(revert) {
10094
10094
  }
10095
10095
  },
10096
10096
  drawUnlessUndone(draw) {
10097
- if (inFlight.reverted()) entry2.redraws.push(draw);
10097
+ if (inFlight.reverted()) entry3.redraws.push(draw);
10098
10098
  else draw();
10099
10099
  },
10100
10100
  drawKeepingUndone(draw) {
10101
10101
  if (!inFlight.reverted()) return draw();
10102
- entry2.showAgain?.();
10102
+ entry3.showAgain?.();
10103
10103
  try {
10104
10104
  return draw();
10105
10105
  } finally {
10106
- entry2.showAgain = revert();
10106
+ entry3.showAgain = revert();
10107
10107
  }
10108
10108
  },
10109
10109
  markSaved: () => void (saved2 = true)
@@ -11596,10 +11596,10 @@ function createTimelineClipMaxTrees(intervals) {
11596
11596
  const treeLeafCount = timelineClipTreeLeafCount(intervals.length);
11597
11597
  const maxPositiveEndTree = Array(treeLeafCount * 2).fill(Number.NEGATIVE_INFINITY);
11598
11598
  const maxPointStartTree = Array(treeLeafCount * 2).fill(Number.NEGATIVE_INFINITY);
11599
- for (let index = 0; index < intervals.length; index += 1) {
11600
- const interval = intervals[index];
11599
+ for (let index2 = 0; index2 < intervals.length; index2 += 1) {
11600
+ const interval = intervals[index2];
11601
11601
  if (!interval) continue;
11602
- const leaf = treeLeafCount + index;
11602
+ const leaf = treeLeafCount + index2;
11603
11603
  if (interval.end > interval.start) maxPositiveEndTree[leaf] = interval.end;
11604
11604
  else maxPointStartTree[leaf] = interval.start;
11605
11605
  }
@@ -11678,8 +11678,8 @@ function selectTimelineClipOverlap(interval, range, selected, identities) {
11678
11678
  if (identities !== void 0 && !identities.has(interval.identity)) return;
11679
11679
  selected.add(interval);
11680
11680
  }
11681
- function queryTimelineClipIndex(index, rowKey, range, pinnedIdentities = /* @__PURE__ */ new Set(), actorWindows = []) {
11682
- const row = index.rows.get(rowKey);
11681
+ function queryTimelineClipIndex(index2, rowKey, range, pinnedIdentities = /* @__PURE__ */ new Set(), actorWindows = []) {
11682
+ const row = index2.rows.get(rowKey);
11683
11683
  if (!row) return Object.freeze([]);
11684
11684
  const selected = /* @__PURE__ */ new Set();
11685
11685
  if (range.end > range.start) {
@@ -13209,7 +13209,7 @@ function rectsIntersect(a, b) {
13209
13209
  }
13210
13210
  function getOverlappingFamily(target, entries, isVisible) {
13211
13211
  const visibleEntries = entries.filter(
13212
- (entry2) => entry2.element === target || isVisible(entry2.element)
13212
+ (entry3) => entry3.element === target || isVisible(entry3.element)
13213
13213
  );
13214
13214
  let targetRect;
13215
13215
  try {
@@ -13224,10 +13224,10 @@ function getOverlappingFamily(target, entries, isVisible) {
13224
13224
  right: targetRect.right,
13225
13225
  bottom: targetRect.bottom
13226
13226
  };
13227
- return visibleEntries.filter((entry2) => {
13228
- if (entry2.element === target) return true;
13227
+ return visibleEntries.filter((entry3) => {
13228
+ if (entry3.element === target) return true;
13229
13229
  try {
13230
- const r = entry2.element.getBoundingClientRect();
13230
+ const r = entry3.element.getBoundingClientRect();
13231
13231
  return rectsIntersect(tr, { left: r.left, top: r.top, right: r.right, bottom: r.bottom });
13232
13232
  } catch {
13233
13233
  return false;
@@ -13281,16 +13281,16 @@ function renumberScoped(currentOrder, desiredOrder, target, family) {
13281
13281
  let start = Math.max(lo, minStart);
13282
13282
  if (hasUpper) start = Math.min(start, maxStart);
13283
13283
  const patches2 = [];
13284
- desiredOrder.forEach((entry2, i) => {
13285
- if (entry2.zIndex !== start + i) patches2.push({ element: entry2.element, zIndex: start + i });
13284
+ desiredOrder.forEach((entry3, i) => {
13285
+ if (entry3.zIndex !== start + i) patches2.push({ element: entry3.element, zIndex: start + i });
13286
13286
  });
13287
13287
  return patches2.length === 0 ? null : patches2;
13288
13288
  }
13289
13289
  }
13290
13290
  const desiredGlobal = buildGlobalOrder(family, desiredOrder, target);
13291
13291
  const patches = [];
13292
- desiredGlobal.forEach((entry2, i) => {
13293
- if (entry2.zIndex !== i) patches.push({ element: entry2.element, zIndex: i });
13292
+ desiredGlobal.forEach((entry3, i) => {
13293
+ if (entry3.zIndex !== i) patches.push({ element: entry3.element, zIndex: i });
13294
13294
  });
13295
13295
  return patches.length === 0 ? null : patches;
13296
13296
  }
@@ -13349,16 +13349,16 @@ function resolveZOrderChange(target, action, options) {
13349
13349
  function resolveZOrderReposition(target, desiredOrderBottomToTop) {
13350
13350
  const { entries } = getFamily(target);
13351
13351
  if (entries.length < 2) return null;
13352
- const byElement = new Map(entries.map((entry2) => [entry2.element, entry2]));
13352
+ const byElement = new Map(entries.map((entry3) => [entry3.element, entry3]));
13353
13353
  const desired = [];
13354
13354
  for (const el of desiredOrderBottomToTop) {
13355
- const entry2 = byElement.get(el);
13356
- if (!entry2) return null;
13357
- desired.push(entry2);
13355
+ const entry3 = byElement.get(el);
13356
+ if (!entry3) return null;
13357
+ desired.push(entry3);
13358
13358
  }
13359
- if (desired.length < 2 || !desired.some((entry2) => entry2.element === target)) return null;
13359
+ if (desired.length < 2 || !desired.some((entry3) => entry3.element === target)) return null;
13360
13360
  const currentOrder = toRenderOrder(desired);
13361
- if (currentOrder.every((entry2, i) => entry2.element === desired[i].element)) return null;
13361
+ if (currentOrder.every((entry3, i) => entry3.element === desired[i].element)) return null;
13362
13362
  return realizeOrder(currentOrder, desired, target, entries);
13363
13363
  }
13364
13364
  function resolveCrossedNeighbor(target, action, options) {
@@ -13882,8 +13882,8 @@ var MIN_EVENT_INTERVAL_MS = 6e4;
13882
13882
  function percentile(values, fraction) {
13883
13883
  if (values.length === 0) return void 0;
13884
13884
  const sorted = [...values].sort((a, b) => a - b);
13885
- const index = Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1);
13886
- return Number(sorted[Math.max(0, index)].toFixed(2));
13885
+ const index2 = Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1);
13886
+ return Number(sorted[Math.max(0, index2)].toFixed(2));
13887
13887
  }
13888
13888
  function summarizeTimelinePerformance(scroll, context, frameLatencies, frameIntervals) {
13889
13889
  const latencyP95 = percentile(frameLatencies, 0.95);
@@ -14412,16 +14412,16 @@ import { useCallback as useCallback20, useEffect as useEffect20, useMemo as useM
14412
14412
  import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
14413
14413
  function extractTimelineVirtualRowRange(range, pinnedRowIndexes) {
14414
14414
  const indexes = new Set(defaultRangeExtractor(range));
14415
- for (const index of pinnedRowIndexes) {
14416
- if (index >= 0 && index < range.count) indexes.add(index);
14415
+ for (const index2 of pinnedRowIndexes) {
14416
+ if (index2 >= 0 && index2 < range.count) indexes.add(index2);
14417
14417
  }
14418
14418
  return [...indexes].sort((left, right) => left - right);
14419
14419
  }
14420
14420
  function extractTimelineVirtualRowSeed(count, pinnedRowIndexes) {
14421
14421
  const seedCount = Math.min(count, TIMELINE_VIEWPORT_BUDGETS.rowOverscanPerSide * 2 + 1);
14422
- const indexes = new Set(Array.from({ length: seedCount }, (_, index) => index));
14423
- for (const index of pinnedRowIndexes) {
14424
- if (index >= 0 && index < count) indexes.add(index);
14422
+ const indexes = new Set(Array.from({ length: seedCount }, (_, index2) => index2));
14423
+ for (const index2 of pinnedRowIndexes) {
14424
+ if (index2 >= 0 && index2 < count) indexes.add(index2);
14425
14425
  }
14426
14426
  return [...indexes].sort((left, right) => left - right);
14427
14427
  }
@@ -14446,11 +14446,11 @@ function useTimelineVirtualRows({
14446
14446
  [focusedRowKey, pinnedRowKeys, rowGeometry]
14447
14447
  );
14448
14448
  const estimateSize = useCallback20(
14449
- (index) => rowGeometry.getRowHeight(index),
14449
+ (index2) => rowGeometry.getRowHeight(index2),
14450
14450
  [rowGeometry]
14451
14451
  );
14452
14452
  const getItemKey = useCallback20(
14453
- (index) => rowGeometry.rowKeys[index] ?? index,
14453
+ (index2) => rowGeometry.rowKeys[index2] ?? index2,
14454
14454
  [rowGeometry]
14455
14455
  );
14456
14456
  const rangeExtractor = useCallback20(
@@ -14484,21 +14484,21 @@ function useTimelineVirtualRows({
14484
14484
  }
14485
14485
  }, [enabled, focusedRowHeight, focusedRowIndex, sessionEpoch, viewportReady, virtualizer]);
14486
14486
  const compatibilityRows = useMemo22(
14487
- () => enabled ? null : rowGeometry.rowKeys.map((rowKey, index) => ({ index, rowKey })),
14487
+ () => enabled ? null : rowGeometry.rowKeys.map((rowKey, index2) => ({ index: index2, rowKey })),
14488
14488
  [enabled, rowGeometry]
14489
14489
  );
14490
14490
  if (compatibilityRows) return compatibilityRows;
14491
14491
  if (!viewportReady) {
14492
14492
  return extractTimelineVirtualRowSeed(rowGeometry.rowKeys.length, pinnedRowIndexes).map(
14493
- (index) => ({
14494
- index,
14495
- rowKey: rowGeometry.rowKeys[index] ?? index
14493
+ (index2) => ({
14494
+ index: index2,
14495
+ rowKey: rowGeometry.rowKeys[index2] ?? index2
14496
14496
  })
14497
14497
  );
14498
14498
  }
14499
- return virtualizer.getVirtualItems().map(({ index }) => ({
14500
- index,
14501
- rowKey: rowGeometry.rowKeys[index] ?? index
14499
+ return virtualizer.getVirtualItems().map(({ index: index2 }) => ({
14500
+ index: index2,
14501
+ rowKey: rowGeometry.rowKeys[index2] ?? index2
14502
14502
  }));
14503
14503
  }
14504
14504
 
@@ -15289,10 +15289,10 @@ var HeaderSlicedLabelMask = memo10(function HeaderSlicedLabelMask2({
15289
15289
  background
15290
15290
  }) {
15291
15291
  const settledScrollLeft = useSettledScrollLeft(scrollRef);
15292
- const index = settledScrollLeft === null ? -1 : tickIndexUnderHeader(major, pps, settledScrollLeft);
15293
- if (index < 0) return null;
15294
- const labelLeft = major[index] * pps - 0.5 + TICK_LABEL_INSET_PX;
15295
- const next = major[index + 1];
15292
+ const index2 = settledScrollLeft === null ? -1 : tickIndexUnderHeader(major, pps, settledScrollLeft);
15293
+ if (index2 < 0) return null;
15294
+ const labelLeft = major[index2] * pps - 0.5 + TICK_LABEL_INSET_PX;
15295
+ const next = major[index2 + 1];
15296
15296
  return /* @__PURE__ */ jsx26(
15297
15297
  "div",
15298
15298
  {
@@ -15303,7 +15303,7 @@ var HeaderSlicedLabelMask = memo10(function HeaderSlicedLabelMask2({
15303
15303
  top: 4,
15304
15304
  height: 12,
15305
15305
  // Up to the next label, so only this label's text band is covered.
15306
- width: next === void 0 ? 80 : (next - major[index]) * pps - TICK_LABEL_INSET_PX,
15306
+ width: next === void 0 ? 80 : (next - major[index2]) * pps - TICK_LABEL_INSET_PX,
15307
15307
  background
15308
15308
  }
15309
15309
  }
@@ -16077,7 +16077,7 @@ function errorFrom(reason) {
16077
16077
  return reason instanceof Error ? reason : new Error(String(reason));
16078
16078
  }
16079
16079
  function createThumbnailKey(parts) {
16080
- return Object.entries(parts).filter((entry2) => entry2[1] !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([name, value]) => `${encodeURIComponent(name)}=${encodeURIComponent(String(value))}`).join("&");
16080
+ return Object.entries(parts).filter((entry3) => entry3[1] !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([name, value]) => `${encodeURIComponent(name)}=${encodeURIComponent(String(value))}`).join("&");
16081
16081
  }
16082
16082
  function createThumbnailRequestIdentity(request2) {
16083
16083
  return createThumbnailKey({
@@ -16113,13 +16113,13 @@ var ThumbnailScheduler = class {
16113
16113
  }
16114
16114
  acquire(request2, listener2) {
16115
16115
  const scopedKey = createThumbnailRequestIdentity(request2);
16116
- let entry2 = this.entries.get(scopedKey);
16117
- if (entry2?.state === "error" && entry2.failedAt !== void 0 && this.now() - entry2.failedAt >= this.budgets.metadataFailureTtlMs) {
16118
- this.deleteEntry(scopedKey, entry2);
16119
- entry2 = this.entries.get(scopedKey);
16116
+ let entry3 = this.entries.get(scopedKey);
16117
+ if (entry3?.state === "error" && entry3.failedAt !== void 0 && this.now() - entry3.failedAt >= this.budgets.metadataFailureTtlMs) {
16118
+ this.deleteEntry(scopedKey, entry3);
16119
+ entry3 = this.entries.get(scopedKey);
16120
16120
  }
16121
- if (!entry2) {
16122
- entry2 = {
16121
+ if (!entry3) {
16122
+ entry3 = {
16123
16123
  request: request2,
16124
16124
  scopedKey,
16125
16125
  state: "queued",
@@ -16133,12 +16133,12 @@ var ThumbnailScheduler = class {
16133
16133
  snapshot: Object.freeze({ status: "queued" }),
16134
16134
  preempted: false
16135
16135
  };
16136
- this.entries.set(scopedKey, entry2);
16136
+ this.entries.set(scopedKey, entry3);
16137
16137
  }
16138
16138
  const leaseId = this.nextLeaseId++;
16139
- entry2.leases.set(leaseId, request2.priority);
16140
- entry2.listeners.set(leaseId, listener2);
16141
- entry2.lastAccess = this.nextSequence++;
16139
+ entry3.leases.set(leaseId, request2.priority);
16140
+ entry3.listeners.set(leaseId, listener2);
16141
+ entry3.lastAccess = this.nextSequence++;
16142
16142
  this.pump();
16143
16143
  let released2 = false;
16144
16144
  return {
@@ -16171,9 +16171,9 @@ var ThumbnailScheduler = class {
16171
16171
  };
16172
16172
  }
16173
16173
  getSnapshot(request2) {
16174
- const entry2 = this.entries.get(createThumbnailRequestIdentity(request2));
16175
- if (!entry2) return EMPTY_SNAPSHOT;
16176
- return entry2.snapshot;
16174
+ const entry3 = this.entries.get(createThumbnailRequestIdentity(request2));
16175
+ if (!entry3) return EMPTY_SNAPSHOT;
16176
+ return entry3.snapshot;
16177
16177
  }
16178
16178
  setScrolling(scrolling) {
16179
16179
  if (this.scrolling === scrolling) return;
@@ -16188,9 +16188,9 @@ var ThumbnailScheduler = class {
16188
16188
  this.pump();
16189
16189
  return;
16190
16190
  }
16191
- for (const entry2 of this.entries.values()) {
16192
- if (entry2.state !== "loading" || entry2.request.kind !== "composition") continue;
16193
- this.preempt(entry2);
16191
+ for (const entry3 of this.entries.values()) {
16192
+ if (entry3.state !== "loading" || entry3.request.kind !== "composition") continue;
16193
+ this.preempt(entry3);
16194
16194
  }
16195
16195
  }
16196
16196
  setPlaybackActive(active) {
@@ -16205,21 +16205,21 @@ var ThumbnailScheduler = class {
16205
16205
  this.pump();
16206
16206
  return;
16207
16207
  }
16208
- for (const entry2 of this.entries.values()) {
16209
- if (entry2.state === "loading") this.preempt(entry2);
16208
+ for (const entry3 of this.entries.values()) {
16209
+ if (entry3.state === "loading") this.preempt(entry3);
16210
16210
  }
16211
16211
  }
16212
- preempt(entry2) {
16213
- entry2.preempted = true;
16214
- entry2.controller?.abort();
16212
+ preempt(entry3) {
16213
+ entry3.preempted = true;
16214
+ entry3.controller?.abort();
16215
16215
  }
16216
16216
  /** Evict project cache entries that are no longer owned by mounted consumers. */
16217
16217
  invalidateProject(projectId) {
16218
- for (const [key2, entry2] of this.entries) {
16219
- if (entry2.request.projectId !== projectId) continue;
16220
- if (entry2.leases.size > 0) continue;
16221
- entry2.controller?.abort();
16222
- this.deleteEntry(key2, entry2);
16218
+ for (const [key2, entry3] of this.entries) {
16219
+ if (entry3.request.projectId !== projectId) continue;
16220
+ if (entry3.leases.size > 0) continue;
16221
+ entry3.controller?.abort();
16222
+ this.deleteEntry(key2, entry3);
16223
16223
  }
16224
16224
  }
16225
16225
  getDiagnostics() {
@@ -16228,14 +16228,14 @@ var ThumbnailScheduler = class {
16228
16228
  let leases = 0;
16229
16229
  let cacheEntries = 0;
16230
16230
  let waveformCacheEntries = 0;
16231
- for (const entry2 of this.entries.values()) {
16232
- if (entry2.state === "queued") queued++;
16233
- if (entry2.state === "loading") active++;
16234
- if (entry2.cached) {
16235
- if (entry2.request.kind === "waveform") waveformCacheEntries++;
16231
+ for (const entry3 of this.entries.values()) {
16232
+ if (entry3.state === "queued") queued++;
16233
+ if (entry3.state === "loading") active++;
16234
+ if (entry3.cached) {
16235
+ if (entry3.request.kind === "waveform") waveformCacheEntries++;
16236
16236
  else cacheEntries++;
16237
16237
  }
16238
- leases += entry2.leases.size;
16238
+ leases += entry3.leases.size;
16239
16239
  }
16240
16240
  return {
16241
16241
  queued,
@@ -16250,83 +16250,83 @@ var ThumbnailScheduler = class {
16250
16250
  }
16251
16251
  pump() {
16252
16252
  if (this.pageHidden) return;
16253
- const queued = Array.from(this.entries.values()).filter((entry2) => entry2.state === "queued" && entry2.leases.size > 0).sort((left, right) => {
16253
+ const queued = Array.from(this.entries.values()).filter((entry3) => entry3.state === "queued" && entry3.leases.size > 0).sort((left, right) => {
16254
16254
  const priorityDelta = this.entryPriority(right) - this.entryPriority(left);
16255
16255
  return priorityDelta || left.lastAccess - right.lastAccess;
16256
16256
  });
16257
- for (const entry2 of queued) {
16258
- if (this.isHeld(entry2)) continue;
16259
- const bucket = concurrencyBucket(entry2.request.kind);
16257
+ for (const entry3 of queued) {
16258
+ if (this.isHeld(entry3)) continue;
16259
+ const bucket = concurrencyBucket(entry3.request.kind);
16260
16260
  if (this.activeByBucket[bucket] >= this.bucketLimit(bucket)) continue;
16261
- this.start(entry2, bucket);
16261
+ this.start(entry3, bucket);
16262
16262
  }
16263
16263
  }
16264
- isHeld(entry2) {
16265
- const { kind, rich } = entry2.request;
16264
+ isHeld(entry3) {
16265
+ const { kind, rich } = entry3.request;
16266
16266
  if (this.scrolling && rich) return true;
16267
16267
  if (this.previewReloading && kind === "composition") return true;
16268
- return this.playbackActive && kind === "video" && this.entryPriority(entry2) < PRIORITY_SCORE.interaction;
16268
+ return this.playbackActive && kind === "video" && this.entryPriority(entry3) < PRIORITY_SCORE.interaction;
16269
16269
  }
16270
- start(entry2, bucket) {
16271
- entry2.state = "loading";
16272
- entry2.snapshot = Object.freeze({ status: "loading" });
16270
+ start(entry3, bucket) {
16271
+ entry3.state = "loading";
16272
+ entry3.snapshot = Object.freeze({ status: "loading" });
16273
16273
  const controller = new AbortController();
16274
- entry2.controller = controller;
16274
+ entry3.controller = controller;
16275
16275
  this.activeByBucket[bucket]++;
16276
- this.activeByKind[entry2.request.kind]++;
16276
+ this.activeByKind[entry3.request.kind]++;
16277
16277
  let slotFree = false;
16278
16278
  const freeSlot = () => {
16279
16279
  if (slotFree) return;
16280
16280
  slotFree = true;
16281
16281
  this.activeByBucket[bucket]--;
16282
- this.activeByKind[entry2.request.kind]--;
16282
+ this.activeByKind[entry3.request.kind]--;
16283
16283
  queueMicrotask(() => this.pump());
16284
16284
  };
16285
16285
  controller.signal.addEventListener("abort", freeSlot, { once: true });
16286
- this.notify(entry2);
16287
- const pending2 = this.loadWithTimeout(entry2, controller);
16288
- void pending2.then((result) => this.acceptResult(entry2, controller, result)).catch((reason) => {
16289
- if (this.entries.get(entry2.scopedKey) !== entry2) return;
16290
- if (controller.signal.aborted && entry2.leases.size === 0) {
16291
- this.deleteEntry(entry2.scopedKey, entry2);
16286
+ this.notify(entry3);
16287
+ const pending2 = this.loadWithTimeout(entry3, controller);
16288
+ void pending2.then((result) => this.acceptResult(entry3, controller, result)).catch((reason) => {
16289
+ if (this.entries.get(entry3.scopedKey) !== entry3) return;
16290
+ if (controller.signal.aborted && entry3.leases.size === 0) {
16291
+ this.deleteEntry(entry3.scopedKey, entry3);
16292
16292
  return;
16293
16293
  }
16294
- if (this.requeuePreempted(entry2)) return;
16295
- entry2.state = "error";
16296
- entry2.error = errorFrom(reason);
16297
- entry2.failedAt = this.now();
16298
- entry2.snapshot = Object.freeze({ status: "error", error: entry2.error });
16299
- this.notify(entry2);
16294
+ if (this.requeuePreempted(entry3)) return;
16295
+ entry3.state = "error";
16296
+ entry3.error = errorFrom(reason);
16297
+ entry3.failedAt = this.now();
16298
+ entry3.snapshot = Object.freeze({ status: "error", error: entry3.error });
16299
+ this.notify(entry3);
16300
16300
  this.evictFailures();
16301
16301
  }).finally(() => {
16302
- if (entry2.controller === controller) entry2.controller = null;
16302
+ if (entry3.controller === controller) entry3.controller = null;
16303
16303
  freeSlot();
16304
16304
  this.pump();
16305
16305
  });
16306
16306
  }
16307
- acceptResult(entry2, controller, result) {
16308
- if (controller.signal.aborted || this.entries.get(entry2.scopedKey) !== entry2) {
16307
+ acceptResult(entry3, controller, result) {
16308
+ if (controller.signal.aborted || this.entries.get(entry3.scopedKey) !== entry3) {
16309
16309
  this.safeDispose(result.dispose);
16310
- this.requeuePreempted(entry2);
16310
+ this.requeuePreempted(entry3);
16311
16311
  return;
16312
16312
  }
16313
16313
  this.validateResult(result);
16314
- entry2.state = "ready";
16315
- entry2.value = result.value;
16316
- entry2.weight = result.weight;
16317
- entry2.dispose = result.dispose;
16318
- this.cacheResult(entry2);
16319
- entry2.snapshot = Object.freeze({ status: "ready", value: result.value });
16320
- this.notify(entry2);
16314
+ entry3.state = "ready";
16315
+ entry3.value = result.value;
16316
+ entry3.weight = result.weight;
16317
+ entry3.dispose = result.dispose;
16318
+ this.cacheResult(entry3);
16319
+ entry3.snapshot = Object.freeze({ status: "ready", value: result.value });
16320
+ this.notify(entry3);
16321
16321
  this.evict();
16322
- if (!entry2.cached && entry2.leases.size === 0) this.deleteEntry(entry2.scopedKey, entry2);
16323
- }
16324
- requeuePreempted(entry2) {
16325
- if (!entry2.preempted || this.entries.get(entry2.scopedKey) !== entry2) return false;
16326
- entry2.preempted = false;
16327
- entry2.state = "queued";
16328
- entry2.snapshot = Object.freeze({ status: "queued" });
16329
- this.notify(entry2);
16322
+ if (!entry3.cached && entry3.leases.size === 0) this.deleteEntry(entry3.scopedKey, entry3);
16323
+ }
16324
+ requeuePreempted(entry3) {
16325
+ if (!entry3.preempted || this.entries.get(entry3.scopedKey) !== entry3) return false;
16326
+ entry3.preempted = false;
16327
+ entry3.state = "queued";
16328
+ entry3.snapshot = Object.freeze({ status: "queued" });
16329
+ this.notify(entry3);
16330
16330
  return true;
16331
16331
  }
16332
16332
  validateResult(result) {
@@ -16334,17 +16334,17 @@ var ThumbnailScheduler = class {
16334
16334
  this.safeDispose(result.dispose);
16335
16335
  throw new RangeError("Thumbnail result weight must be finite and non-negative");
16336
16336
  }
16337
- cacheResult(entry2) {
16338
- const isWaveform = entry2.request.kind === "waveform";
16337
+ cacheResult(entry3) {
16338
+ const isWaveform = entry3.request.kind === "waveform";
16339
16339
  const byteBudget = isWaveform ? this.budgets.waveformCacheBytes : this.budgets.thumbnailCacheBytes;
16340
- entry2.cached = !entry2.request.discardWhenReleased && entry2.weight <= byteBudget;
16341
- if (!entry2.cached) return;
16342
- if (isWaveform) this.waveformCacheBytes += entry2.weight;
16343
- else this.cacheBytes += entry2.weight;
16340
+ entry3.cached = !entry3.request.discardWhenReleased && entry3.weight <= byteBudget;
16341
+ if (!entry3.cached) return;
16342
+ if (isWaveform) this.waveformCacheBytes += entry3.weight;
16343
+ else this.cacheBytes += entry3.weight;
16344
16344
  }
16345
- entryPriority(entry2) {
16345
+ entryPriority(entry3) {
16346
16346
  let score = -1;
16347
- for (const priority of entry2.leases.values()) {
16347
+ for (const priority of entry3.leases.values()) {
16348
16348
  score = Math.max(score, PRIORITY_SCORE[priority]);
16349
16349
  }
16350
16350
  return score;
@@ -16360,21 +16360,21 @@ var ThumbnailScheduler = class {
16360
16360
  }
16361
16361
  evictPartition(waveform) {
16362
16362
  const cached5 = Array.from(this.entries.values()).filter(
16363
- (entry2) => entry2.cached && entry2.request.kind === "waveform" === waveform
16363
+ (entry3) => entry3.cached && entry3.request.kind === "waveform" === waveform
16364
16364
  );
16365
16365
  const perProject = /* @__PURE__ */ new Map();
16366
- for (const entry2 of cached5) {
16367
- perProject.set(entry2.request.projectId, (perProject.get(entry2.request.projectId) ?? 0) + 1);
16366
+ for (const entry3 of cached5) {
16367
+ perProject.set(entry3.request.projectId, (perProject.get(entry3.request.projectId) ?? 0) + 1);
16368
16368
  }
16369
16369
  cached5.sort((left, right) => left.lastAccess - right.lastAccess);
16370
16370
  let cacheEntries = cached5.length;
16371
- for (const entry2 of cached5) {
16372
- const projectEntries = perProject.get(entry2.request.projectId) ?? 0;
16371
+ for (const entry3 of cached5) {
16372
+ const projectEntries = perProject.get(entry3.request.projectId) ?? 0;
16373
16373
  if (!this.isCacheOverBudget(waveform, cacheEntries, projectEntries)) continue;
16374
- this.uncache(entry2);
16374
+ this.uncache(entry3);
16375
16375
  cacheEntries--;
16376
- perProject.set(entry2.request.projectId, projectEntries - 1);
16377
- if (entry2.leases.size === 0) this.deleteEntry(entry2.scopedKey, entry2);
16376
+ perProject.set(entry3.request.projectId, projectEntries - 1);
16377
+ if (entry3.leases.size === 0) this.deleteEntry(entry3.scopedKey, entry3);
16378
16378
  }
16379
16379
  }
16380
16380
  isCacheOverBudget(waveform, cacheEntries, projectEntries) {
@@ -16384,18 +16384,18 @@ var ThumbnailScheduler = class {
16384
16384
  const projectOverBudget = !waveform && projectEntries > this.budgets.thumbnailCacheEntriesPerProject;
16385
16385
  return cacheEntries > entryBudget || cacheBytes > byteBudget || projectOverBudget;
16386
16386
  }
16387
- uncache(entry2) {
16388
- entry2.cached = false;
16389
- if (entry2.request.kind === "waveform") this.waveformCacheBytes -= entry2.weight;
16390
- else this.cacheBytes -= entry2.weight;
16387
+ uncache(entry3) {
16388
+ entry3.cached = false;
16389
+ if (entry3.request.kind === "waveform") this.waveformCacheBytes -= entry3.weight;
16390
+ else this.cacheBytes -= entry3.weight;
16391
16391
  }
16392
- notify(entry2) {
16393
- for (const listener2 of new Set(entry2.listeners.values())) listener2();
16392
+ notify(entry3) {
16393
+ for (const listener2 of new Set(entry3.listeners.values())) listener2();
16394
16394
  }
16395
- loadWithTimeout(entry2, controller) {
16395
+ loadWithTimeout(entry3, controller) {
16396
16396
  let load;
16397
16397
  try {
16398
- load = entry2.request.load(controller.signal);
16398
+ load = entry3.request.load(controller.signal);
16399
16399
  } catch (reason) {
16400
16400
  load = Promise.reject(reason);
16401
16401
  }
@@ -16427,28 +16427,28 @@ var ThumbnailScheduler = class {
16427
16427
  );
16428
16428
  });
16429
16429
  }
16430
- deleteEntry(key2, entry2) {
16431
- if (this.entries.get(key2) !== entry2) return;
16430
+ deleteEntry(key2, entry3) {
16431
+ if (this.entries.get(key2) !== entry3) return;
16432
16432
  this.entries.delete(key2);
16433
- entry2.snapshot = EMPTY_SNAPSHOT;
16434
- this.notify(entry2);
16435
- if (entry2.cached) {
16436
- entry2.cached = false;
16437
- if (entry2.request.kind === "waveform") this.waveformCacheBytes -= entry2.weight;
16438
- else this.cacheBytes -= entry2.weight;
16433
+ entry3.snapshot = EMPTY_SNAPSHOT;
16434
+ this.notify(entry3);
16435
+ if (entry3.cached) {
16436
+ entry3.cached = false;
16437
+ if (entry3.request.kind === "waveform") this.waveformCacheBytes -= entry3.weight;
16438
+ else this.cacheBytes -= entry3.weight;
16439
16439
  }
16440
- if (!entry2.disposed) {
16441
- entry2.disposed = true;
16442
- this.safeDispose(entry2.dispose);
16440
+ if (!entry3.disposed) {
16441
+ entry3.disposed = true;
16442
+ this.safeDispose(entry3.dispose);
16443
16443
  }
16444
- entry2.listeners.clear();
16445
- entry2.leases.clear();
16444
+ entry3.listeners.clear();
16445
+ entry3.leases.clear();
16446
16446
  }
16447
16447
  evictFailures() {
16448
- const failed2 = Array.from(this.entries.values()).filter((entry2) => entry2.state === "error" && entry2.leases.size === 0).sort((left, right) => left.lastAccess - right.lastAccess);
16448
+ const failed2 = Array.from(this.entries.values()).filter((entry3) => entry3.state === "error" && entry3.leases.size === 0).sort((left, right) => left.lastAccess - right.lastAccess);
16449
16449
  const overflow = failed2.length - this.budgets.thumbnailCacheEntries;
16450
- for (const entry2 of failed2.slice(0, Math.max(0, overflow))) {
16451
- this.deleteEntry(entry2.scopedKey, entry2);
16450
+ for (const entry3 of failed2.slice(0, Math.max(0, overflow))) {
16451
+ this.deleteEntry(entry3.scopedKey, entry3);
16452
16452
  }
16453
16453
  }
16454
16454
  safeDispose(dispose2) {
@@ -16576,7 +16576,7 @@ var measure = (entries) => isTimelineZoomPreviewing() || commit(
16576
16576
  return strip ? [[strip.apply, { ...size, ...read(target, strip) }]] : [];
16577
16577
  })
16578
16578
  );
16579
- var onPresence = (entries) => measure(entries.filter((entry2) => entry2.isIntersecting));
16579
+ var onPresence = (entries) => measure(entries.filter((entry3) => entry3.isIntersecting));
16580
16580
  var pendingSizes = /* @__PURE__ */ new Map();
16581
16581
  var pendingSizesFrame = 0;
16582
16582
  var applyPendingSizes = () => {
@@ -16597,7 +16597,7 @@ function acquire() {
16597
16597
  resize: new ResizeObserver(applyResizesNextFrame),
16598
16598
  presence: observeIntersections(onPresence),
16599
16599
  gaps: observeIntersections(
16600
- (entries) => entries.some((entry2) => entry2.isIntersecting) && scheduleRefresh()
16600
+ (entries) => entries.some((entry3) => entry3.isIntersecting) && scheduleRefresh()
16601
16601
  ),
16602
16602
  stopZoomWatch: subscribeTimelineZoomPreview(remeasureAfterPreview)
16603
16603
  };
@@ -16682,9 +16682,9 @@ function decimatePeaks(peaks, startFraction, endFraction, barCount) {
16682
16682
  const end = Math.max(start + 1, Math.min(peaks.length, endIndex));
16683
16683
  const span = end - start;
16684
16684
  const bars = [];
16685
- for (let index = 0; index < barCount; index++) {
16686
- let from = start + Math.floor(index * span / barCount);
16687
- let to = start + Math.floor((index + 1) * span / barCount);
16685
+ for (let index2 = 0; index2 < barCount; index2++) {
16686
+ let from = start + Math.floor(index2 * span / barCount);
16687
+ let to = start + Math.floor((index2 + 1) * span / barCount);
16688
16688
  if (to <= from) {
16689
16689
  from = Math.min(from, end - 1);
16690
16690
  to = from + 1;
@@ -16707,8 +16707,8 @@ var FADE_GHOST_OPACITY = 0.27;
16707
16707
  var WAVEFORM_LAYER_Z = 10;
16708
16708
  var WHOLE_CLIP = { from: 0, to: 1 };
16709
16709
  function paintWaveformBars(context, bars, height, waveformBarRgb, waveformBaselineRgb, amplitudes) {
16710
- bars.forEach((bar, index) => {
16711
- const opacity = loudnessToOpacity(amplitudes[index] ?? 0);
16710
+ bars.forEach((bar, index2) => {
16711
+ const opacity = loudnessToOpacity(amplitudes[index2] ?? 0);
16712
16712
  context.fillStyle = `rgb(${waveformBaselineRgb})`;
16713
16713
  context.fillRect(bar.x, height - 2, bar.width, 2);
16714
16714
  const paint2 = (alpha, top, barHeight) => {
@@ -16739,12 +16739,12 @@ function drawWaveformCanvas(canvas, peaks, muted, trimStartFraction, trimEndFrac
16739
16739
  trimStartFraction + trim * span.to,
16740
16740
  Math.max(1, Math.ceil(width / BAR_STEP))
16741
16741
  );
16742
- const clipFraction = (index) => span.from + (index + 0.5) / amplitudes.length * (span.to - span.from);
16743
- const bars = amplitudes.map((amplitude, index) => ({
16744
- x: index * width / amplitudes.length,
16742
+ const clipFraction = (index2) => span.from + (index2 + 0.5) / amplitudes.length * (span.to - span.from);
16743
+ const bars = amplitudes.map((amplitude, index2) => ({
16744
+ x: index2 * width / amplitudes.length,
16745
16745
  width: Math.max(1, width / amplitudes.length),
16746
16746
  height: Math.max(3, amplitude * height),
16747
- gain: fades ? fadeGain(clipFraction(index) * fades.duration, fades.duration, fades) : 1
16747
+ gain: fades ? fadeGain(clipFraction(index2) * fades.duration, fades.duration, fades) : 1
16748
16748
  }));
16749
16749
  const channelToken = muted ? "--timeline-waveform-muted-rgb" : "--timeline-waveform-bar-rgb";
16750
16750
  const waveformBarRgb = getComputedStyle(canvas).getPropertyValue(channelToken);
@@ -16757,9 +16757,9 @@ function extractPeaks(channelData, barCount) {
16757
16757
  const peaks = [];
16758
16758
  const samplesPerBar = Math.floor(channelData.length / barCount);
16759
16759
  if (samplesPerBar === 0) return Array(barCount).fill(0);
16760
- for (let index = 0; index < barCount; index++) {
16760
+ for (let index2 = 0; index2 < barCount; index2++) {
16761
16761
  let max = 0;
16762
- const start = index * samplesPerBar;
16762
+ const start = index2 * samplesPerBar;
16763
16763
  const end = Math.min(start + samplesPerBar, channelData.length);
16764
16764
  for (let sample = start; sample < end; sample++) {
16765
16765
  max = Math.max(max, Math.abs(channelData[sample] ?? 0));
@@ -16806,7 +16806,7 @@ function useNearScreen(element) {
16806
16806
  useEffect22(() => {
16807
16807
  if (!element || typeof IntersectionObserver === "undefined") return;
16808
16808
  nearScreen ??= new IntersectionObserver(
16809
- (entries) => entries.forEach((entry2) => nearScreenListeners.get(entry2.target)?.(entry2.isIntersecting)),
16809
+ (entries) => entries.forEach((entry3) => nearScreenListeners.get(entry3.target)?.(entry3.isIntersecting)),
16810
16810
  NEAR_SCREEN
16811
16811
  );
16812
16812
  nearScreenListeners.set(element, setNear);
@@ -17584,10 +17584,10 @@ function serializeStudioFileMutation(writer, targetPath, task) {
17584
17584
  }
17585
17585
  function serializeStudioFileMutations(writer, targetPaths, task) {
17586
17586
  const paths = [...new Set(targetPaths)].sort();
17587
- const acquire2 = (index) => {
17588
- const path = paths[index];
17587
+ const acquire2 = (index2) => {
17588
+ const path = paths[index2];
17589
17589
  if (path === void 0) return task();
17590
- return serializeStudioFileMutation(writer, path, () => acquire2(index + 1));
17590
+ return serializeStudioFileMutation(writer, path, () => acquire2(index2 + 1));
17591
17591
  };
17592
17592
  return acquire2(0);
17593
17593
  }
@@ -18223,8 +18223,8 @@ function consumeStudioWriteToken(token, now2 = Date.now()) {
18223
18223
  }
18224
18224
  async function studioFileContentVersion(content) {
18225
18225
  const bytes = new TextEncoder().encode(content);
18226
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
18227
- const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join(
18226
+ const digest2 = await globalThis.crypto.subtle.digest("SHA-256", bytes);
18227
+ const hex = Array.from(new Uint8Array(digest2), (byte) => byte.toString(16).padStart(2, "0")).join(
18228
18228
  ""
18229
18229
  );
18230
18230
  return `"sha256:${hex}"`;
@@ -18384,8 +18384,8 @@ function planLiveRetime(before, after) {
18384
18384
  const now2 = parseGsapScriptAcorn(after).animations.filter(onTimeline);
18385
18385
  if (was.length !== now2.length) return RERUN;
18386
18386
  const tweens = [];
18387
- for (const [index, next] of now2.entries()) {
18388
- const prev = was[index];
18387
+ for (const [index2, next] of now2.entries()) {
18388
+ const prev = was[index2];
18389
18389
  if (untimedShape(prev) !== untimedShape(next)) return RERUN;
18390
18390
  if (!placedAlone(next) || !placedAlone(prev)) return RERUN;
18391
18391
  const duration = lengthOf(next);
@@ -18398,7 +18398,7 @@ function planLiveRetime(before, after) {
18398
18398
  wasStart: prev.resolvedStart,
18399
18399
  wasDuration,
18400
18400
  moved: next.resolvedStart !== prev.resolvedStart || duration !== wasDuration,
18401
- source: index
18401
+ source: index2
18402
18402
  });
18403
18403
  }
18404
18404
  tweens.sort((x, y) => x.wasStart - y.wasStart || x.source - y.source);
@@ -18474,7 +18474,7 @@ function animatedElsewhere(own, registry3, targets) {
18474
18474
  return timeline.getChildren(false, true, false).some((tween) => tween.targets?.().some((target) => targets.has(target))) || timeline.getChildren(false, false, true).some(visit);
18475
18475
  };
18476
18476
  const timelines = registry3.filter(
18477
- (entry2) => typeof entry2?.getChildren === "function"
18477
+ (entry3) => typeof entry3?.getChildren === "function"
18478
18478
  );
18479
18479
  return own.getChildren(false, false, true).some(visit) || timelines.some(visit);
18480
18480
  }
@@ -18608,8 +18608,8 @@ function timingGestureStep(kind, given) {
18608
18608
  }
18609
18609
  async function rollbackMutatedFiles(projectId, ownedSteps, onError) {
18610
18610
  let convergenceRequired = false;
18611
- for (let index = ownedSteps.length - 1; index >= 0; index -= 1) {
18612
- const step = ownedSteps[index];
18611
+ for (let index2 = ownedSteps.length - 1; index2 >= 0; index2 -= 1) {
18612
+ const step = ownedSteps[index2];
18613
18613
  if (!step || step.before === step.after) continue;
18614
18614
  try {
18615
18615
  if (await rollbackOwnedMutation(projectId, step.path, step.after, step.before) === "conflict") {
@@ -18850,10 +18850,10 @@ function deleteSelectedKeyframes(session) {
18850
18850
  coalesceKey: `delete-keyframes:${++deleteKeyframesCommitCounter}`,
18851
18851
  coalesceMs: Number.POSITIVE_INFINITY
18852
18852
  };
18853
- for (const [index, target] of targets.entries()) {
18853
+ for (const [index2, target] of targets.entries()) {
18854
18854
  session.handleGsapRemoveKeyframe(target.animationId, target.percentage, {
18855
18855
  ...coalesceOptions,
18856
- ...index === targets.length - 1 ? { softReload: true } : { skipReload: true }
18856
+ ...index2 === targets.length - 1 ? { softReload: true } : { skipReload: true }
18857
18857
  });
18858
18858
  }
18859
18859
  }
@@ -19075,13 +19075,23 @@ function operationChanges(elements, operation) {
19075
19075
  buildPatches: (html2, target) => applyPatchByTarget(html2, target, operation)
19076
19076
  }));
19077
19077
  }
19078
+ var RENAMED_MOUNT = /__hf\d+"?\]?$/;
19079
+ var lookup = (value, kind) => RENAMED_MOUNT.test(value) ? `runtime-renamed ${kind}` : kind;
19080
+ var selectorLookup = (selector) => selector.startsWith("[data-composition-id=") ? lookup(selector, "composition id") : /^\.[\w-]+$/.test(selector) && "class";
19081
+ function missedLookups(element, target) {
19082
+ const kinds = [target.hfId && "hf-id", target.id && lookup(target.id, "id")];
19083
+ const by = [...kinds, target.selector && selectorLookup(target.selector)].filter(Boolean);
19084
+ return `by ${by.join(", ") || "nothing"}; ${element.sourceFile ? "file from the clip" : "no file on the clip"}`;
19085
+ }
19078
19086
  function patchTimelineChangesInSource(source, targetPath, changes) {
19079
19087
  let current = source;
19080
19088
  for (const { element, buildPatches } of changes) {
19081
19089
  const target = buildPatchTarget(element);
19082
19090
  if (!target) throw new Error(`Timeline element ${element.id} is missing a patchable target`);
19083
19091
  if (!findTagByTarget(current, target)) {
19084
- throw new Error(`Unable to patch timeline element ${element.id} in ${targetPath}`);
19092
+ throw new Error(
19093
+ `Unable to patch timeline element ${element.id} in ${targetPath} (${missedLookups(element, target)})`
19094
+ );
19085
19095
  }
19086
19096
  current = buildPatches(current, target);
19087
19097
  }
@@ -20132,9 +20142,9 @@ function snapLaneTime(t2, targets, thresholdSec) {
20132
20142
  return best;
20133
20143
  }
20134
20144
  function segmentLineCommands(input) {
20135
- const { lane, range, index, xOf, yOf } = input;
20136
- const a = lane.points[index];
20137
- const b = lane.points[index + 1];
20145
+ const { lane, range, index: index2, xOf, yOf } = input;
20146
+ const a = lane.points[index2];
20147
+ const b = lane.points[index2 + 1];
20138
20148
  if (!a || !b) return [];
20139
20149
  if (!a.curve && a.viaX === void 0 && range.scale === "linear") {
20140
20150
  return [`L ${xOf(b.t)} ${yOf(b.v)}`];
@@ -20160,13 +20170,13 @@ function envelopePath(input) {
20160
20170
  return pts.join(" ");
20161
20171
  }
20162
20172
  function envelopeSegmentPath(input) {
20163
- const { lane, range, index, xOf, yOf } = input;
20164
- const a = lane.points[index];
20165
- const b = lane.points[index + 1];
20173
+ const { lane, range, index: index2, xOf, yOf } = input;
20174
+ const a = lane.points[index2];
20175
+ const b = lane.points[index2 + 1];
20166
20176
  if (!a || !b) return null;
20167
20177
  const pts = [
20168
20178
  `M ${xOf(a.t)} ${yOf(a.v)}`,
20169
- ...segmentLineCommands({ lane, range, index, xOf, yOf })
20179
+ ...segmentLineCommands({ lane, range, index: index2, xOf, yOf })
20170
20180
  ];
20171
20181
  return pts.join(" ");
20172
20182
  }
@@ -20396,13 +20406,13 @@ function armGroupDrag(lane, pressed, rangeSelection) {
20396
20406
  selection: rangeSelection ? { ...rangeSelection } : { t0: 0, t1: 0, v0: 0, v1: 0 }
20397
20407
  };
20398
20408
  }
20399
- function armSegmentDrag(lane, index, anchor2) {
20400
- const a = lane.points[index];
20401
- const b = lane.points[index + 1];
20409
+ function armSegmentDrag(lane, index2, anchor2) {
20410
+ const a = lane.points[index2];
20411
+ const b = lane.points[index2 + 1];
20402
20412
  if (!a || !b) return null;
20403
20413
  return {
20404
20414
  points: lane.points.map((p) => ({ ...p })),
20405
- indices: [index, index + 1],
20415
+ indices: [index2, index2 + 1],
20406
20416
  anchor: { ...anchor2 },
20407
20417
  selection: {
20408
20418
  t0: a.t,
@@ -20564,19 +20574,19 @@ function useAutomationSegmentDrag({
20564
20574
  (clientX, clientY) => {
20565
20575
  const box = getBox();
20566
20576
  if (!box) return null;
20567
- const index = segmentIndex(clientX, clientY);
20568
- if (index === null) return null;
20577
+ const index2 = segmentIndex(clientX, clientY);
20578
+ if (index2 === null) return null;
20569
20579
  const { t: t2 } = pointAt(clientX, clientY);
20570
20580
  const value = sampleAutomationLane3(lane, t2, range.scale);
20571
- return Math.abs(yOf(value) - (clientY - box.top)) <= SEGMENT_GRAB_PX ? index : null;
20581
+ return Math.abs(yOf(value) - (clientY - box.top)) <= SEGMENT_GRAB_PX ? index2 : null;
20572
20582
  },
20573
20583
  [getBox, lane, pointAt, range.scale, segmentIndex, yOf]
20574
20584
  );
20575
20585
  const arm = useCallback31(
20576
- (index, clientX, clientY) => {
20577
- snapshot3.current = armSegmentDrag(lane, index, pointAt(clientX, clientY));
20586
+ (index2, clientX, clientY) => {
20587
+ snapshot3.current = armSegmentDrag(lane, index2, pointAt(clientX, clientY));
20578
20588
  setHoverIndex(null);
20579
- setDragIndex(index);
20589
+ setDragIndex(index2);
20580
20590
  },
20581
20591
  [lane, pointAt]
20582
20592
  );
@@ -20734,8 +20744,8 @@ function useAutomationLaneGestures({
20734
20744
  });
20735
20745
  const gestureAt = useCallback32(
20736
20746
  (e) => {
20737
- const index = hitIndex(e.clientX, e.clientY);
20738
- if (index !== null) return { kind: "point", index };
20747
+ const index2 = hitIndex(e.clientX, e.clientY);
20748
+ if (index2 !== null) return { kind: "point", index: index2 };
20739
20749
  const segment = e.altKey ? segmentIndex(e.clientX, e.clientY) : segmentDrag.hitIndex(e.clientX, e.clientY);
20740
20750
  if (segment === null) return null;
20741
20751
  return { kind: e.altKey ? "curve" : "segment", index: segment };
@@ -20923,8 +20933,8 @@ function useAutomationLaneGestures({
20923
20933
  }
20924
20934
  if (dragIndex === null && curveIndex === null && segmentDrag.dragIndex === null) return;
20925
20935
  e.stopPropagation();
20926
- const index = dragIndex;
20927
- const shiftClicked = index !== null && e.shiftKey && !pressTravelled.current;
20936
+ const index2 = dragIndex;
20937
+ const shiftClicked = index2 !== null && e.shiftKey && !pressTravelled.current;
20928
20938
  setDragIndex(null);
20929
20939
  setCurveIndex(null);
20930
20940
  segmentDrag.finish();
@@ -20935,7 +20945,7 @@ function useAutomationLaneGestures({
20935
20945
  setHint(null);
20936
20946
  if (shiftClicked) {
20937
20947
  commitPoints(
20938
- lane.points.filter((_, i) => i !== index),
20948
+ lane.points.filter((_, i) => i !== index2),
20939
20949
  true
20940
20950
  );
20941
20951
  return;
@@ -21378,10 +21388,10 @@ function TimelineAutomationLane({
21378
21388
  if (draft && draft.basedOn !== automation && !gestureLive) setDraft(null);
21379
21389
  }, [automation, draft, gestureLive]);
21380
21390
  const removeAt = useCallback33(
21381
- (index) => {
21391
+ (index2) => {
21382
21392
  if (readOnly) return;
21383
21393
  commitPoints(
21384
- lane.points.filter((_, i) => i !== index),
21394
+ lane.points.filter((_, i) => i !== index2),
21385
21395
  true
21386
21396
  );
21387
21397
  },
@@ -21680,11 +21690,11 @@ function TimelineAutomationLaneSlot({
21680
21690
  const clips = elements.filter(isAudioOrVideoTimelineElement);
21681
21691
  const rowsByClip = /* @__PURE__ */ new Map();
21682
21692
  groupAutomationLanes(clips).forEach((group, rowIndex) => {
21683
- for (const entry2 of group.entries) {
21684
- const key2 = getTimelineElementIdentity(entry2.element);
21693
+ for (const entry3 of group.entries) {
21694
+ const key2 = getTimelineElementIdentity(entry3.element);
21685
21695
  const rows = rowsByClip.get(key2);
21686
- if (rows) rows.push({ lane: entry2.lane, rowIndex });
21687
- else rowsByClip.set(key2, [{ lane: entry2.lane, rowIndex }]);
21696
+ if (rows) rows.push({ lane: entry3.lane, rowIndex });
21697
+ else rowsByClip.set(key2, [{ lane: entry3.lane, rowIndex }]);
21688
21698
  }
21689
21699
  });
21690
21700
  const top = topOffset ?? getTimelineLaneTop(laneCount);
@@ -22676,9 +22686,9 @@ function clampedStyle(anchorRect) {
22676
22686
  const spaceBelow = window.innerHeight - anchorRect.bottom;
22677
22687
  const spaceAbove = anchorRect.top;
22678
22688
  const openUpward = spaceBelow < 260 && spaceAbove > spaceBelow;
22679
- const available = (openUpward ? spaceAbove : spaceBelow) - VIEWPORT_MARGIN - 4;
22689
+ const available2 = (openUpward ? spaceAbove : spaceBelow) - VIEWPORT_MARGIN - 4;
22680
22690
  const height = Math.min(
22681
- Math.max(MIN_POPOVER_HEIGHT, available),
22691
+ Math.max(MIN_POPOVER_HEIGHT, available2),
22682
22692
  window.innerHeight - VIEWPORT_MARGIN * 2
22683
22693
  );
22684
22694
  const inset = (desired) => Math.max(
@@ -23171,10 +23181,10 @@ function valuesBefore(animation2, animations) {
23171
23181
  const start = resolveTweenStart(animation2);
23172
23182
  if (start == null) return {};
23173
23183
  const endOf2 = (other) => (resolveTweenStart(other) ?? Infinity) + (other.method === "set" ? 0 : resolveTweenDuration(other));
23174
- const index = animations.indexOf(animation2);
23184
+ const index2 = animations.indexOf(animation2);
23175
23185
  const finished = animations.filter((other, i) => {
23176
- if (other.method === "from" || i === index) return false;
23177
- return endOf2(other) < start || endOf2(other) === start && i < index;
23186
+ if (other.method === "from" || i === index2) return false;
23187
+ return endOf2(other) < start || endOf2(other) === start && i < index2;
23178
23188
  }).sort((a, b) => endOf2(a) - endOf2(b));
23179
23189
  const values = {};
23180
23190
  for (const other of finished) {
@@ -23591,7 +23601,7 @@ function TimelineTrackHeader({
23591
23601
  const automationRows = useMemo30(
23592
23602
  () => groupAutomationLanes(trackElements).map((group) => {
23593
23603
  const active = group.entries.find(
23594
- (entry2) => (entry2.element.key ?? entry2.element.id) === activeKey
23604
+ (entry3) => (entry3.element.key ?? entry3.element.id) === activeKey
23595
23605
  );
23596
23606
  return {
23597
23607
  key: group.key,
@@ -23602,8 +23612,8 @@ function TimelineTrackHeader({
23602
23612
  // Every entry in a row is the same parameter, so the first answers for the
23603
23613
  // row when the active clip is absent from it.
23604
23614
  isCarve: (() => {
23605
- const entry2 = active ?? group.entries[0];
23606
- return entry2 ? isCarveLane(entry2.lane.target, elementFxChain(entry2.element)) : false;
23615
+ const entry3 = active ?? group.entries[0];
23616
+ return entry3 ? isCarveLane(entry3.lane.target, elementFxChain(entry3.element)) : false;
23607
23617
  })()
23608
23618
  };
23609
23619
  }),
@@ -23764,7 +23774,7 @@ function TimelineTrackHeader({
23764
23774
  },
23765
23775
  lane.group
23766
23776
  )),
23767
- isExpanded && automationRows.map((row, index) => {
23777
+ isExpanded && automationRows.map((row, index2) => {
23768
23778
  const revealTarget = row.target;
23769
23779
  return /* @__PURE__ */ jsx53(
23770
23780
  AutomationLaneHeaderRow,
@@ -23774,8 +23784,8 @@ function TimelineTrackHeader({
23774
23784
  name: row.name,
23775
23785
  param: row.param,
23776
23786
  alsoAutomatedBy: groupAutomatedTargets.has(row.key) ? groupLabelForNote ?? groupOwner : void 0,
23777
- top: getTimelineLaneTop(lanes.length) + index * AUTOMATION_LANE_H,
23778
- isLastLane: index === automationRows.length - 1,
23787
+ top: getTimelineLaneTop(lanes.length) + index2 * AUTOMATION_LANE_H,
23788
+ isLastLane: index2 === automationRows.length - 1,
23779
23789
  gutterBackground: gutterFill(theme.gutterBackground, isGroupMember),
23780
23790
  columnWidth: showTrackLabel ? LABEL_COL_W : contentOrigin,
23781
23791
  onRemove: onRemoveAutomationLane,
@@ -23805,7 +23815,7 @@ import {
23805
23815
  // src/player/components/TimelineTrackRow.tsx
23806
23816
  import { jsx as jsx54, jsxs as jsxs31 } from "react/jsx-runtime";
23807
23817
  function TimelineTrackRow({
23808
- index,
23818
+ index: index2,
23809
23819
  rowKey,
23810
23820
  logicalRow,
23811
23821
  propertyRows,
@@ -23823,8 +23833,8 @@ function TimelineTrackRow({
23823
23833
  "div",
23824
23834
  {
23825
23835
  role: "rowgroup",
23826
- "data-index": index,
23827
- "data-timeline-row": index,
23836
+ "data-index": index2,
23837
+ "data-timeline-row": index2,
23828
23838
  "data-timeline-row-key": rowKey,
23829
23839
  className: virtualized ? "absolute left-0 right-0" : "relative",
23830
23840
  style: {
@@ -24083,7 +24093,7 @@ function TimelineGroupLaneLabels({
24083
24093
  }) {
24084
24094
  const currentTime = useLivePlayheadTime();
24085
24095
  const laneGroups = groupAutomationLanes([groupElement]);
24086
- return /* @__PURE__ */ jsx56(Fragment16, { children: laneGroups.map((laneGroup, index) => {
24096
+ return /* @__PURE__ */ jsx56(Fragment16, { children: laneGroups.map((laneGroup, index2) => {
24087
24097
  const lane = laneGroup.entries[0]?.lane;
24088
24098
  if (!lane) return null;
24089
24099
  const parts = { name: laneGroup.name, param: laneGroup.param };
@@ -24098,7 +24108,7 @@ function TimelineGroupLaneLabels({
24098
24108
  disabled: !onReveal,
24099
24109
  className: "absolute left-0 flex items-center gap-1.5 overflow-hidden border-0 px-1.5 text-left text-[10px] text-[var(--timeline-text-secondary)] enabled:hover:text-[var(--timeline-text-solid)] focus-visible:outline-solid focus-visible:outline-1 focus-visible:outline-[var(--timeline-accent)]",
24100
24110
  style: {
24101
- top: top + index * AUTOMATION_LANE_H,
24111
+ top: top + index2 * AUTOMATION_LANE_H,
24102
24112
  width: columnWidth,
24103
24113
  height: AUTOMATION_LANE_H,
24104
24114
  background: gutterBackground,
@@ -24135,7 +24145,7 @@ function TimelineGroupLaneLabels({
24135
24145
  import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
24136
24146
  var GROUP_LANE_ACCENT = "var(--timeline-accent)";
24137
24147
  function TimelineGroupRow({
24138
- index,
24148
+ index: index2,
24139
24149
  rowKey,
24140
24150
  group,
24141
24151
  logicalRow,
@@ -24192,7 +24202,7 @@ function TimelineGroupRow({
24192
24202
  return /* @__PURE__ */ jsxs34(
24193
24203
  TimelineTrackRow,
24194
24204
  {
24195
- index,
24205
+ index: index2,
24196
24206
  rowKey,
24197
24207
  logicalRow,
24198
24208
  propertyRows: [],
@@ -24409,10 +24419,10 @@ import { jsx as jsx59 } from "react/jsx-runtime";
24409
24419
  function deriveTimelineClipJoins(elements) {
24410
24420
  const sorted = sortedLaneClips(elements);
24411
24421
  const joins = [];
24412
- for (let index = 1; index < sorted.length; index += 1) {
24413
- const previous = sorted[index - 1];
24422
+ for (let index2 = 1; index2 < sorted.length; index2 += 1) {
24423
+ const previous = sorted[index2 - 1];
24414
24424
  const end = previous.start + previous.duration;
24415
- if (Math.abs(sorted[index].start - end) < TRACK_GAP_EPSILON_S) joins.push(end);
24425
+ if (Math.abs(sorted[index2].start - end) < TRACK_GAP_EPSILON_S) joins.push(end);
24416
24426
  }
24417
24427
  return joins;
24418
24428
  }
@@ -25364,11 +25374,11 @@ function quantizeThumbnailFrameCount(frameCount) {
25364
25374
  const cap = 2 ** Math.floor(Math.log2(MAX_VISIBLE_THUMBNAIL_FRAMES));
25365
25375
  return Math.min(cap, 2 ** Math.ceil(Math.log2(safeCount)));
25366
25376
  }
25367
- function thumbnailFrameForTile(index, tileCount, frameCount) {
25377
+ function thumbnailFrameForTile(index2, tileCount, frameCount) {
25368
25378
  if (frameCount < 2) return 0;
25369
- if (tileCount > 1 && index >= tileCount - 1) return frameCount - 1;
25379
+ if (tileCount > 1 && index2 >= tileCount - 1) return frameCount - 1;
25370
25380
  const slices = frameCount - 1;
25371
- return Math.min(slices - 1, Math.floor((index + 0.5) * slices / tileCount));
25381
+ return Math.min(slices - 1, Math.floor((index2 + 0.5) * slices / tileCount));
25372
25382
  }
25373
25383
  function probeImageAspect(imageSrc, signal, tolerateSvgError = false) {
25374
25384
  return new Promise((resolve, reject) => {
@@ -25565,7 +25575,7 @@ async function normalizeClipsLoudness(projectId, elements, writers) {
25565
25575
  if (elements.some(volumeLaneOwnsGain)) throw new Error(VOLUME_LANE_REFUSAL);
25566
25576
  const plans = await Promise.all(elements.map((el) => requestNormalizePlan(projectId, el)));
25567
25577
  await writeClipGains(
25568
- elements.map((element, index) => ({ element, gain: plans[index]?.volume ?? 1 })),
25578
+ elements.map((element, index2) => ({ element, gain: plans[index2]?.volume ?? 1 })),
25569
25579
  writers,
25570
25580
  "Normalize loudness"
25571
25581
  );
@@ -26235,8 +26245,8 @@ function useHoverPreview(preview2) {
26235
26245
  function focusSibling(menu, step) {
26236
26246
  if (!menu) return;
26237
26247
  const items = Array.from(menu.querySelectorAll('[role="menuitemradio"]'));
26238
- const index = items.findIndex((item) => item === document.activeElement);
26239
- items[(index + step + items.length) % items.length]?.focus();
26248
+ const index2 = items.findIndex((item) => item === document.activeElement);
26249
+ items[(index2 + step + items.length) % items.length]?.focus();
26240
26250
  }
26241
26251
  function ChoiceSubmenu({
26242
26252
  label,
@@ -26337,13 +26347,13 @@ function ChoiceSubmenu({
26337
26347
  onKeyDown: onSubmenuKeyDown,
26338
26348
  children: [
26339
26349
  choiceRow(null, "None"),
26340
- sections.map((section, index) => /* @__PURE__ */ jsxs43("div", { children: [
26350
+ sections.map((section, index2) => /* @__PURE__ */ jsxs43("div", { children: [
26341
26351
  section.heading && /* @__PURE__ */ jsxs43(Fragment19, { children: [
26342
26352
  /* @__PURE__ */ jsx67("div", { className: menuClasses.divider }),
26343
26353
  /* @__PURE__ */ jsx67("div", { className: "px-3 py-1 text-[9px] uppercase tracking-wide text-neutral-500", children: section.heading })
26344
26354
  ] }),
26345
26355
  section.choices.map((choice) => choiceRow(choice.id, choice.label))
26346
- ] }, section.heading ?? index))
26356
+ ] }, section.heading ?? index2))
26347
26357
  ]
26348
26358
  }
26349
26359
  )
@@ -27019,11 +27029,11 @@ function mintLinkId(doc) {
27019
27029
  return mintLinkIdFrom(taken);
27020
27030
  }
27021
27031
  function firstFreeTrackIndex(source) {
27022
- const used = new Set(
27032
+ const used2 = new Set(
27023
27033
  Array.from(source.matchAll(/\bdata-track-index=["'](-?\d+)["']/g), (m) => Number(m[1]))
27024
27034
  );
27025
27035
  let track2 = 0;
27026
- while (used.has(track2)) track2 += 1;
27036
+ while (used2.has(track2)) track2 += 1;
27027
27037
  return track2;
27028
27038
  }
27029
27039
  function splitAutomation(raw) {
@@ -27863,8 +27873,8 @@ function TimelineKeyframeMenuOverlay() {
27863
27873
  } : void 0
27864
27874
  ),
27865
27875
  onCopyProperties: (elementId2, keyframe) => {
27866
- const entry2 = keyframeCache.get(elementId2);
27867
- const keyframeValue = entry2?.keyframes.find(
27876
+ const entry3 = keyframeCache.get(elementId2);
27877
+ const keyframeValue = entry3?.keyframes.find(
27868
27878
  (item) => Math.abs(item.percentage - keyframe.percentage) < 0.5
27869
27879
  );
27870
27880
  if (!keyframeValue) return false;
@@ -28193,7 +28203,7 @@ function networkCode(error) {
28193
28203
  return typeof name === "string" ? name : "unknown";
28194
28204
  }
28195
28205
  var typedFailure = (reader, error, start) => isAbort(error) ? error : new MediaFetchError(reader, null, networkCode(error), start);
28196
- function watchedRequest(reader, parents) {
28206
+ function watchedRequest(reader, parents, end) {
28197
28207
  const controller = new AbortController();
28198
28208
  let stalled = false;
28199
28209
  let timer;
@@ -28221,16 +28231,19 @@ function watchedRequest(reader, parents) {
28221
28231
  });
28222
28232
  };
28223
28233
  const failure = (error, start) => stalled ? new MediaFetchError(reader, null, "stalled", start) : typedFailure(reader, error, start);
28224
- return { signal: controller.signal, wait, done, failure };
28234
+ return { signal: controller.signal, wait, done, failure, end };
28225
28235
  }
28226
28236
  function typedBody(body, start, request2) {
28227
28237
  const source = body.getReader();
28238
+ const stopped = () => request2.end?.atTarget?.aborted && request2.end.ended(start);
28239
+ request2.signal.addEventListener("abort", stopped, { once: true });
28228
28240
  return new ReadableStream({
28229
28241
  async pull(controller) {
28230
28242
  try {
28231
28243
  const { done, value } = await request2.wait(source.read());
28232
28244
  if (!done) return controller.enqueue(value);
28233
28245
  request2.done();
28246
+ request2.end?.ended(start);
28234
28247
  controller.close();
28235
28248
  } catch (error) {
28236
28249
  request2.done();
@@ -28268,15 +28281,19 @@ function mediaUrlSourceOptions(reader) {
28268
28281
  const failuresByStart = /* @__PURE__ */ new Map();
28269
28282
  const inFlightReads = new AbortController();
28270
28283
  let ranges = reader === "thumbnail" ? "unknown" : "hidden";
28284
+ let etag;
28285
+ const noteEtag = (response) => void (etag ??= response.headers.get("ETag") ?? void 0);
28271
28286
  const fetchFn = async (input, init) => {
28272
28287
  const sent = ranges === "readable" ? boundedRange(init) : init;
28273
28288
  const asked = Number(rangeStart(sent, true) ?? 0);
28274
28289
  const request2 = watchedRequest(
28275
28290
  reader,
28276
- init?.signal ? [inFlightReads.signal, init.signal] : [inFlightReads.signal]
28291
+ init?.signal ? [inFlightReads.signal, init.signal] : [inFlightReads.signal],
28292
+ { ended: (start) => failuresByStart.delete(start), atTarget: init?.signal }
28277
28293
  );
28278
28294
  const response = await typedFetch(reader, input, sent ?? {}, asked, request2);
28279
28295
  if (ranges !== "hidden") ranges = rangesReadable(sent, response) ? "readable" : "hidden";
28296
+ noteEtag(response);
28280
28297
  return typedResponse(response, asked, request2);
28281
28298
  };
28282
28299
  const getRetryDelay = (_previousAttempts, error) => {
@@ -28289,8 +28306,9 @@ function mediaUrlSourceOptions(reader) {
28289
28306
  return 0.5 * (failed2 + 1);
28290
28307
  };
28291
28308
  const cancelReads = () => inFlightReads.abort(new DOMException("Media reads cancelled", "AbortError"));
28292
- if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads };
28293
- return { fetchFn, getRetryDelay, cancelReads, maxCacheSize: POOLED_READER_CACHE_BYTES };
28309
+ const etagOf = () => etag;
28310
+ if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads, etagOf };
28311
+ return { fetchFn, getRetryDelay, cancelReads, etagOf, maxCacheSize: POOLED_READER_CACHE_BYTES };
28294
28312
  }
28295
28313
  function reportMediaFetchFailure(error) {
28296
28314
  if (!(error instanceof MediaFetchError)) return;
@@ -28304,23 +28322,23 @@ var loadMediabunny = () => mediabunnyModule ??= import("mediabunny");
28304
28322
  var abortError = () => new DOMException("Aborted", "AbortError");
28305
28323
  var timedOut = (signal) => signal.reason?.name === "TimeoutError";
28306
28324
  var isAbortError = (error) => error?.name === "AbortError";
28307
- function dispose(source, entry2) {
28308
- if (entry2.disposed) return;
28309
- entry2.disposed = true;
28310
- if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28311
- if (pool.get(source) === entry2) pool.delete(source);
28312
- entry2.input?.dispose();
28313
- entry2.cancelReads?.();
28314
- }
28315
- function retire(source, entry2) {
28316
- if (pool.get(source) === entry2) pool.delete(source);
28317
- if (entry2.users === 0) dispose(source, entry2);
28325
+ function dispose(source, entry3) {
28326
+ if (entry3.disposed) return;
28327
+ entry3.disposed = true;
28328
+ if (entry3.idleTimer !== null) clearTimeout(entry3.idleTimer);
28329
+ if (pool.get(source) === entry3) pool.delete(source);
28330
+ entry3.input?.dispose();
28331
+ entry3.cancelReads?.();
28332
+ }
28333
+ function retire(source, entry3) {
28334
+ if (pool.get(source) === entry3) pool.delete(source);
28335
+ if (entry3.users === 0) dispose(source, entry3);
28318
28336
  }
28319
28337
  async function open(source, pooled) {
28320
28338
  const mediabunny = await loadMediabunny();
28321
- const entry2 = pooled();
28339
+ const entry3 = pooled();
28322
28340
  const live = () => {
28323
- if (entry2.disposed) throw abortError();
28341
+ if (entry3.disposed) throw abortError();
28324
28342
  };
28325
28343
  live();
28326
28344
  const options = mediaUrlSourceOptions("thumbnail");
@@ -28328,8 +28346,8 @@ async function open(source, pooled) {
28328
28346
  source: new mediabunny.UrlSource(source, options),
28329
28347
  formats: mediabunny.ALL_FORMATS
28330
28348
  });
28331
- entry2.input = input;
28332
- entry2.cancelReads = options.cancelReads;
28349
+ entry3.input = input;
28350
+ entry3.cancelReads = options.cancelReads;
28333
28351
  const track2 = await input.getPrimaryVideoTrack();
28334
28352
  live();
28335
28353
  if (!track2) throw new Error("Video source has no decodable video track");
@@ -28343,29 +28361,30 @@ async function open(source, pooled) {
28343
28361
  }
28344
28362
  const metadataDuration = await track2.getDurationFromMetadata({ skipLiveWait: true });
28345
28363
  live();
28346
- return { mediabunny, track: track2, info: { aspect: displayWidth / displayHeight, metadataDuration } };
28364
+ const info = { aspect: displayWidth / displayHeight, metadataDuration };
28365
+ return { mediabunny, track: track2, info, etag: options.etagOf() };
28347
28366
  }
28348
28367
  function pooledSource(source, version) {
28349
28368
  const current = pool.get(source);
28350
28369
  if (current && current.version === version) return current;
28351
28370
  if (current) retire(source, current);
28352
- const entry2 = {
28371
+ const entry3 = {
28353
28372
  version,
28354
28373
  input: null,
28355
28374
  cancelReads: null,
28356
28375
  ready: false,
28357
- opened: open(source, () => entry2),
28376
+ opened: open(source, () => entry3),
28358
28377
  users: 0,
28359
28378
  progress: { framesFromAnyJob: 0 },
28360
28379
  idleTimer: null,
28361
28380
  disposed: false
28362
28381
  };
28363
- entry2.opened.then(
28364
- () => entry2.ready = true,
28365
- () => retire(source, entry2)
28382
+ entry3.opened.then(
28383
+ () => entry3.ready = true,
28384
+ () => retire(source, entry3)
28366
28385
  );
28367
- pool.set(source, entry2);
28368
- return entry2;
28386
+ pool.set(source, entry3);
28387
+ return entry3;
28369
28388
  }
28370
28389
  function untilAborted(pending2, signal) {
28371
28390
  if (signal.aborted) return Promise.reject(abortError());
@@ -28376,27 +28395,27 @@ function untilAborted(pending2, signal) {
28376
28395
  });
28377
28396
  }
28378
28397
  async function acquireThumbnailSource(source, version, signal, idleMs) {
28379
- const entry2 = pooledSource(source, version);
28380
- const waitedForOpen = !entry2.ready;
28381
- entry2.users += 1;
28382
- if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28383
- entry2.idleTimer = null;
28398
+ const entry3 = pooledSource(source, version);
28399
+ const waitedForOpen = !entry3.ready;
28400
+ entry3.users += 1;
28401
+ if (entry3.idleTimer !== null) clearTimeout(entry3.idleTimer);
28402
+ entry3.idleTimer = null;
28384
28403
  let released2 = false;
28385
28404
  const release2 = (failed2) => {
28386
28405
  if (released2) return;
28387
28406
  released2 = true;
28388
- entry2.users -= 1;
28389
- if (failed2) retire(source, entry2);
28390
- if (entry2.users > 0 || entry2.disposed) return;
28391
- if (pool.get(source) === entry2 && idleMs > 0) {
28392
- entry2.idleTimer = setTimeout(() => dispose(source, entry2), idleMs);
28407
+ entry3.users -= 1;
28408
+ if (failed2) retire(source, entry3);
28409
+ if (entry3.users > 0 || entry3.disposed) return;
28410
+ if (pool.get(source) === entry3 && idleMs > 0) {
28411
+ entry3.idleTimer = setTimeout(() => dispose(source, entry3), idleMs);
28393
28412
  } else {
28394
- dispose(source, entry2);
28413
+ dispose(source, entry3);
28395
28414
  }
28396
28415
  };
28397
28416
  try {
28398
- const { progress } = entry2;
28399
- return { ...await untilAborted(entry2.opened, signal), release: release2, waitedForOpen, progress };
28417
+ const { progress } = entry3;
28418
+ return { ...await untilAborted(entry3.opened, signal), release: release2, waitedForOpen, progress };
28400
28419
  } catch (error) {
28401
28420
  release2(!isAbortError(error) || timedOut(signal));
28402
28421
  throw error;
@@ -28446,6 +28465,154 @@ function releaseSharedFrames(held, budgetBytes) {
28446
28465
  }
28447
28466
  }
28448
28467
 
28468
+ // src/player/lib/thumbnailDiskCache.ts
28469
+ var CACHE_PREFIX = "hf-thumbnails:";
28470
+ var INDEX_KEY = "hf-thumbnails-index";
28471
+ var ENTRY_ORIGIN = "https://hf-thumbnail.invalid/";
28472
+ var STORED_THUMBNAIL_BYTES = 256 * 1024 * 1024;
28473
+ var index;
28474
+ var dropped = /* @__PURE__ */ new Set();
28475
+ var saveTimer;
28476
+ var warned = false;
28477
+ var available = () => typeof caches !== "undefined" && typeof crypto?.subtle !== "undefined";
28478
+ async function quietly(work) {
28479
+ if (!available()) return void 0;
28480
+ try {
28481
+ return await work();
28482
+ } catch (error) {
28483
+ if (!warned) console.warn("[Studio] timeline thumbnails stay in memory:", error);
28484
+ warned = true;
28485
+ return void 0;
28486
+ }
28487
+ }
28488
+ async function digest(text) {
28489
+ const bytes = new Uint8Array(
28490
+ await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text))
28491
+ );
28492
+ return Array.from(bytes.subarray(0, 12), (byte) => byte.toString(16).padStart(2, "0")).join("");
28493
+ }
28494
+ var cacheNameOf = async ({ source, etag }) => `${CACHE_PREFIX}${await digest(source)}:${await digest(etag)}`;
28495
+ function savedIndex() {
28496
+ try {
28497
+ const saved2 = JSON.parse(localStorage.getItem(INDEX_KEY) ?? "null");
28498
+ return saved2?.etags && saved2.caches ? saved2 : void 0;
28499
+ } catch {
28500
+ return void 0;
28501
+ }
28502
+ }
28503
+ function loadIndex() {
28504
+ return index ??= savedIndex() ?? { etags: {}, caches: {} };
28505
+ }
28506
+ function laterOf(own, theirs) {
28507
+ if (own && own.usedAt >= theirs.usedAt) return void 0;
28508
+ return { usedAt: theirs.usedAt, bytes: Math.max(theirs.bytes, own?.bytes ?? 0) };
28509
+ }
28510
+ function mergedIndex() {
28511
+ const mine = loadIndex();
28512
+ const theirs = savedIndex() ?? { etags: {}, caches: {} };
28513
+ for (const [name, entry3] of Object.entries(theirs.caches)) {
28514
+ const later = dropped.has(name) ? void 0 : laterOf(mine.caches[name], entry3);
28515
+ if (later) mine.caches[name] = later;
28516
+ }
28517
+ mine.etags = { ...theirs.etags, ...mine.etags };
28518
+ dropped.clear();
28519
+ return mine;
28520
+ }
28521
+ function saveIndexSoon() {
28522
+ saveTimer ??= setTimeout(() => {
28523
+ saveTimer = void 0;
28524
+ try {
28525
+ localStorage.setItem(INDEX_KEY, JSON.stringify(mergedIndex()));
28526
+ } catch {
28527
+ }
28528
+ }, 1e3);
28529
+ }
28530
+ function used(name, addedBytes = 0) {
28531
+ const caches2 = loadIndex().caches;
28532
+ caches2[name] = { usedAt: Date.now(), bytes: (caches2[name]?.bytes ?? 0) + addedBytes };
28533
+ saveIndexSoon();
28534
+ }
28535
+ var storedVersion = (source) => quietly(async () => {
28536
+ const etag = loadIndex().etags[await digest(source)];
28537
+ if (!etag) return void 0;
28538
+ const response = await fetch(source, {
28539
+ headers: { Range: "bytes=0-0", "If-None-Match": etag }
28540
+ });
28541
+ await response.body?.cancel();
28542
+ return response.status === 304 ? { source, etag } : void 0;
28543
+ });
28544
+ var rememberVersion = (stored) => quietly(async () => {
28545
+ const key2 = await digest(stored.source);
28546
+ const saved2 = loadIndex();
28547
+ if (saved2.etags[key2] === stored.etag) return;
28548
+ saved2.etags[key2] = stored.etag;
28549
+ saveIndexSoon();
28550
+ const keep = await cacheNameOf(stored);
28551
+ for (const name of await caches.keys()) {
28552
+ if (!name.startsWith(`${CACHE_PREFIX}${key2}:`) || name === keep) continue;
28553
+ await caches.delete(name);
28554
+ delete saved2.caches[name];
28555
+ dropped.add(name);
28556
+ }
28557
+ });
28558
+ async function entry2(stored, path) {
28559
+ const name = await cacheNameOf(stored);
28560
+ return { name, cache: await caches.open(name), url: `${ENTRY_ORIGIN}${path}` };
28561
+ }
28562
+ async function storedEntry(stored, path) {
28563
+ const name = await cacheNameOf(stored);
28564
+ return await caches.has(name) ? entry2(stored, path) : void 0;
28565
+ }
28566
+ var readStoredInfo = (stored) => quietly(async () => {
28567
+ const found = await storedEntry(stored, "info");
28568
+ if (!found) return void 0;
28569
+ const { name, cache: cache2, url } = found;
28570
+ const info = await (await cache2.match(url))?.json();
28571
+ if (!(info && info.aspect > 0)) return void 0;
28572
+ used(name);
28573
+ return info;
28574
+ });
28575
+ var storeInfo = (stored, info) => quietly(async () => {
28576
+ const { name, cache: cache2, url } = await entry2(stored, "info");
28577
+ await cache2.put(url, new Response(JSON.stringify(info)));
28578
+ used(name);
28579
+ });
28580
+ var readStoredFrame = (stored, frame3) => quietly(async () => {
28581
+ const found = await storedEntry(stored, `frame?${encodeURIComponent(frame3)}`);
28582
+ if (!found) return void 0;
28583
+ const { name, cache: cache2, url } = found;
28584
+ const response = await cache2.match(url);
28585
+ const decodedAt = Number(response?.headers.get("x-decoded-at"));
28586
+ if (!response || !Number.isFinite(decodedAt)) return void 0;
28587
+ used(name);
28588
+ return { blob: await response.blob(), decodedAt };
28589
+ });
28590
+ var storeFrame = (stored, frame3, decodedAt, blob) => quietly(async () => {
28591
+ const { name, cache: cache2, url } = await entry2(stored, `frame?${encodeURIComponent(frame3)}`);
28592
+ const replaced = Number((await cache2.match(url))?.headers.get("x-bytes")) || 0;
28593
+ const headers = {
28594
+ "content-type": blob.type,
28595
+ "x-decoded-at": String(decodedAt),
28596
+ "x-bytes": String(blob.size)
28597
+ };
28598
+ await cache2.put(url, new Response(blob, { headers }));
28599
+ used(name, blob.size - replaced);
28600
+ await dropLeastUsed(STORED_THUMBNAIL_BYTES);
28601
+ });
28602
+ async function dropLeastUsed(budgetBytes) {
28603
+ const saved2 = loadIndex();
28604
+ let total = Object.values(saved2.caches).reduce((sum, { bytes }) => sum + bytes, 0);
28605
+ const oldestFirst = Object.entries(saved2.caches).sort(([, a], [, b]) => a.usedAt - b.usedAt);
28606
+ for (const [name, { bytes }] of oldestFirst) {
28607
+ if (total <= budgetBytes) break;
28608
+ await caches.delete(name);
28609
+ delete saved2.caches[name];
28610
+ dropped.add(name);
28611
+ total -= bytes;
28612
+ }
28613
+ saveIndexSoon();
28614
+ }
28615
+
28449
28616
  // src/player/lib/thumbnailVideoDecoder.ts
28450
28617
  var LAST_FRAME_INSET_S = 1e-3;
28451
28618
  function videoThumbnailTimestamps(start, duration, frameCount) {
@@ -28455,11 +28622,19 @@ function videoThumbnailTimestamps(start, duration, frameCount) {
28455
28622
  if (count === 1) return [safeStart + safeDuration / 2];
28456
28623
  const edges = Array.from(
28457
28624
  { length: count },
28458
- (_, index) => safeStart + safeDuration * index / count
28625
+ (_, index2) => safeStart + safeDuration * index2 / count
28459
28626
  );
28460
28627
  return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28461
28628
  }
28462
28629
  var sourceInfos = /* @__PURE__ */ new Map();
28630
+ var storedVersions = /* @__PURE__ */ new Map();
28631
+ var storedInfos = /* @__PURE__ */ new Set();
28632
+ var openOf = (request2) => `${request2.source}\0${request2.contentVersion ?? ""}`;
28633
+ function storedVersionOf(request2) {
28634
+ let pending2 = storedVersions.get(openOf(request2));
28635
+ if (!pending2) storedVersions.set(openOf(request2), pending2 = storedVersion(request2.source));
28636
+ return pending2;
28637
+ }
28463
28638
  var accepts = (window2, time, decodedAt) => decodedAt >= window2.sourceStart && time - decodedAt <= (time >= window2.end ? 0 : window2.lead);
28464
28639
  var ClipResultError = class extends Error {
28465
28640
  };
@@ -28549,6 +28724,7 @@ async function decodeFrames(sink, times, slots, signal, resources, progress) {
28549
28724
  throwIfAborted(signal);
28550
28725
  const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob), blob.size);
28551
28726
  progress.framesFromAnyJob += 1;
28727
+ resources.store?.(target.slot, target.decodedAt, blob);
28552
28728
  resources.urls[target.slot] = frame3.url;
28553
28729
  resources.held.push({ key: target.key, frame: frame3 });
28554
28730
  }
@@ -28571,6 +28747,42 @@ function loadedResult(resources, aspect, budgets, frameCount = resources.urls.le
28571
28747
  dispose: () => releaseDecodedResources(resources)
28572
28748
  };
28573
28749
  }
28750
+ var storedFrameName = (fit, info, budgets) => (time) => {
28751
+ const { width, height } = targetDimensions(info.aspect, budgets);
28752
+ return `${fit} ${width}x${height} ${time}`;
28753
+ };
28754
+ async function takeStoredFrames({ timestamps, window: window2 }, slots, keyOf17, nameOf, resources, stored) {
28755
+ const found = await Promise.all(
28756
+ slots.map((slot) => readStoredFrame(stored, nameOf(timestamps[slot])))
28757
+ );
28758
+ return slots.filter((slot, i) => {
28759
+ const time = timestamps[slot];
28760
+ const hit = found[i];
28761
+ if (!hit || !accepts(window2, time, hit.decodedAt)) return true;
28762
+ const key2 = keyOf17(time);
28763
+ const frame3 = shareFrame(key2, hit.decodedAt, URL.createObjectURL(hit.blob), hit.blob.size);
28764
+ resources.urls[slot] = frame3.url;
28765
+ resources.held.push({ key: key2, frame: frame3 });
28766
+ return false;
28767
+ });
28768
+ }
28769
+ function versionRead(request2, source) {
28770
+ if (!source.etag) return void 0;
28771
+ const version = { source: request2.source, etag: source.etag };
28772
+ storedVersions.set(openOf(request2), Promise.resolve(version));
28773
+ return version;
28774
+ }
28775
+ function storeForNextSession(request2, info, budgets, resources, version) {
28776
+ if (!version) return;
28777
+ const id = `${version.source}\0${version.etag}`;
28778
+ if (!storedInfos.has(id)) {
28779
+ storedInfos.add(id);
28780
+ void rememberVersion(version).then(() => storeInfo(version, info));
28781
+ }
28782
+ const nameOf = storedFrameName(request2.fit ?? "cover", info, budgets);
28783
+ const { timestamps } = stripTimes(request2, info, budgets);
28784
+ resources.store = (slot, decodedAt, blob) => void storeFrame(version, nameOf(timestamps[slot]), decodedAt, blob);
28785
+ }
28574
28786
  async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPORT_BUDGETS) {
28575
28787
  const fit = request2.fit ?? "cover";
28576
28788
  const sourceKey = createThumbnailKey({ source: request2.source, version: request2.contentVersion });
@@ -28581,24 +28793,30 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28581
28793
  canvases: /* @__PURE__ */ new Set(),
28582
28794
  releasedFrameBytes: budgets.sharedFrameCacheBytes
28583
28795
  };
28584
- const entry2 = sourceInfos.get(request2.source);
28585
- const known = entry2?.version === request2.contentVersion ? entry2?.info : void 0;
28796
+ const entry3 = sourceInfos.get(request2.source);
28586
28797
  try {
28798
+ const stored = await storedVersionOf(request2);
28799
+ const known = entry3 && entry3.version === request2.contentVersion ? entry3.info : stored && await readStoredInfo(stored);
28587
28800
  if (known) {
28588
- if (takeDecodedFrames(stripTimes(request2, known, budgets), keyOf17, resources).length === 0) {
28801
+ sourceInfos.set(request2.source, { version: request2.contentVersion, info: known });
28802
+ const strip = stripTimes(request2, known, budgets);
28803
+ const missing = takeDecodedFrames(strip, keyOf17, resources);
28804
+ const nameOf = storedFrameName(fit, known, budgets);
28805
+ const left = stored && missing.length > 0 ? await takeStoredFrames(strip, missing, keyOf17, nameOf, resources, stored) : missing;
28806
+ if (left.length === 0) {
28589
28807
  throwIfAborted(signal);
28590
28808
  return loadedResult(resources, known.aspect, budgets);
28591
28809
  }
28592
28810
  releaseDecodedResources(resources);
28593
28811
  }
28594
- return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources);
28812
+ return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources, stored);
28595
28813
  } catch (error) {
28596
28814
  releaseDecodedResources(resources);
28597
28815
  reportMediaFetchFailure(error);
28598
28816
  throw error;
28599
28817
  }
28600
28818
  }
28601
- async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources) {
28819
+ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources, stored) {
28602
28820
  let source;
28603
28821
  try {
28604
28822
  source = await acquireThumbnailSource(
@@ -28625,6 +28843,7 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28625
28843
  sourceInfos.set(request2.source, { version: request2.contentVersion, info });
28626
28844
  const strip = stripTimes(request2, info, budgets);
28627
28845
  const { timestamps, window: window2 } = strip;
28846
+ storeForNextSession(request2, info, budgets, resources, stored ?? versionRead(request2, source));
28628
28847
  const slots = takeDecodedFrames(
28629
28848
  strip,
28630
28849
  keyOf17,
@@ -28808,8 +29027,8 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
28808
29027
  frameW,
28809
29028
  frameCount,
28810
29029
  watchGap: watchGap2,
28811
- children: (index) => {
28812
- const src = urls[thumbnailFrameForTile(index, frameCount, urls.length)];
29030
+ children: (index2) => {
29031
+ const src = urls[thumbnailFrameForTile(index2, frameCount, urls.length)];
28813
29032
  return /* @__PURE__ */ jsx78(
28814
29033
  "div",
28815
29034
  {
@@ -28825,7 +29044,7 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
28825
29044
  }
28826
29045
  )
28827
29046
  },
28828
- index
29047
+ index2
28829
29048
  );
28830
29049
  }
28831
29050
  }
@@ -28975,7 +29194,7 @@ var CompositionThumbnail = memo23(function CompositionThumbnail2({
28975
29194
  animation: "hf-thumb-fade 200ms ease-out",
28976
29195
  mixBlendMode: "var(--timeline-composition-thumbnail-blend)"
28977
29196
  },
28978
- children: (index) => /* @__PURE__ */ jsx79(
29197
+ children: (index2) => /* @__PURE__ */ jsx79(
28979
29198
  "div",
28980
29199
  {
28981
29200
  className: "relative h-full shrink-0 overflow-hidden",
@@ -28991,7 +29210,7 @@ var CompositionThumbnail = memo23(function CompositionThumbnail2({
28991
29210
  }
28992
29211
  )
28993
29212
  },
28994
- index
29213
+ index2
28995
29214
  )
28996
29215
  }
28997
29216
  ),
@@ -29918,11 +30137,11 @@ function nonEmpty(value, fallback) {
29918
30137
  function optionalNonEmpty(value) {
29919
30138
  return value || void 0;
29920
30139
  }
29921
- function attachCompositionSource(entry2, element, compositionSrc) {
29922
- if (compositionSrc) return { ...entry2, compositionSrc };
30140
+ function attachCompositionSource(entry3, element, compositionSrc) {
30141
+ if (compositionSrc) return { ...entry3, compositionSrc };
29923
30142
  const innerVideo = element.querySelector("video[src]");
29924
- if (!innerVideo) return entry2;
29925
- return { ...entry2, src: optionalNonEmpty(innerVideo.getAttribute("src")), tag: "video" };
30143
+ if (!innerVideo) return entry3;
30144
+ return { ...entry3, src: optionalNonEmpty(innerVideo.getAttribute("src")), tag: "video" };
29926
30145
  }
29927
30146
  function buildMissingCompositionEntry(params) {
29928
30147
  const { doc, iframeWin, element, compositionId, rootDuration, fallbackIndex } = params;
@@ -29956,7 +30175,7 @@ function buildMissingCompositionEntry(params) {
29956
30175
  selectorIndex,
29957
30176
  sourceFile
29958
30177
  });
29959
- const entry2 = {
30178
+ const entry3 = {
29960
30179
  id: identity.id,
29961
30180
  label,
29962
30181
  transitionLabel: transitionLabels.get(element) ?? element.getAttribute("data-transition-label") ?? void 0,
@@ -29975,7 +30194,7 @@ function buildMissingCompositionEntry(params) {
29975
30194
  zIndex: readTimelineElementZIndex(element),
29976
30195
  src: optionalNonEmpty(element.getAttribute("src")) ? new URL(element.getAttribute("src"), element.baseURI).href : void 0
29977
30196
  };
29978
- return attachCompositionSource(entry2, element, compositionSrc);
30197
+ return attachCompositionSource(entry3, element, compositionSrc);
29979
30198
  }
29980
30199
  function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuration) {
29981
30200
  const existingIds = new Set(currentEls.map((e) => e.id));
@@ -29995,7 +30214,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
29995
30214
  if (!compId || compId === rootCompId) continue;
29996
30215
  if (existingIds.has(el.id) || existingIds.has(compId)) continue;
29997
30216
  resolveEnd ??= createReferenceEndResolver(createTimedElementLookup(doc), iframeWin);
29998
- const entry2 = buildMissingCompositionEntry({
30217
+ const entry3 = buildMissingCompositionEntry({
29999
30218
  doc,
30000
30219
  iframeWin,
30001
30220
  element: el,
@@ -30005,7 +30224,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
30005
30224
  resolveEnd,
30006
30225
  masterTime
30007
30226
  });
30008
- if (entry2) missing.push(entry2);
30227
+ if (entry3) missing.push(entry3);
30009
30228
  }
30010
30229
  if (!doc.querySelector("[data-composition-src], [data-composition-file]"))
30011
30230
  return { missing, updatedEls: currentEls, patched: false };
@@ -30059,7 +30278,7 @@ function createTimelineElementFromManifestClip(params) {
30059
30278
  selectorIndex,
30060
30279
  sourceFile
30061
30280
  });
30062
- const entry2 = {
30281
+ const entry3 = {
30063
30282
  id: identity.id,
30064
30283
  label,
30065
30284
  transitionLabel: hostEl && transitionLabels.get(hostEl) || hostEl?.getAttribute("data-transition-label") || void 0,
@@ -30087,42 +30306,42 @@ function createTimelineElementFromManifestClip(params) {
30087
30306
  playbackRate: clip.playbackRate
30088
30307
  };
30089
30308
  if (hostEl) {
30090
- applyMediaMetadataFromElement(entry2, hostEl);
30091
- if (!entry2.src) {
30309
+ applyMediaMetadataFromElement(entry3, hostEl);
30310
+ if (!entry3.src) {
30092
30311
  const rawSrc = hostEl.getAttribute("src");
30093
- if (rawSrc) entry2.src = new URL(rawSrc, hostEl.baseURI).href;
30312
+ if (rawSrc) entry3.src = new URL(rawSrc, hostEl.baseURI).href;
30094
30313
  }
30095
- if (hostEl.hasAttribute("data-hidden")) entry2.hidden = true;
30314
+ if (hostEl.hasAttribute("data-hidden")) entry3.hidden = true;
30096
30315
  const timelineRole = hostEl.getAttribute("data-timeline-role");
30097
- if (timelineRole) entry2.timelineRole = timelineRole;
30316
+ if (timelineRole) entry3.timelineRole = timelineRole;
30098
30317
  const link = hostEl.getAttribute("data-link");
30099
- if (link) entry2.link = link;
30318
+ if (link) entry3.link = link;
30100
30319
  const compositionScope = linkScopeOf(hostEl)?.getAttribute("data-composition-id");
30101
- if (compositionScope) entry2.compositionScope = compositionScope;
30320
+ if (compositionScope) entry3.compositionScope = compositionScope;
30102
30321
  const syncOrigin = hostEl.getAttribute("data-sync-origin");
30103
- if (syncOrigin) entry2.syncOrigin = syncOrigin;
30322
+ if (syncOrigin) entry3.syncOrigin = syncOrigin;
30104
30323
  const audioGroup = hostEl.getAttribute("data-audio-group");
30105
30324
  if (audioGroup) {
30106
- entry2.audioGroup = audioGroup;
30325
+ entry3.audioGroup = audioGroup;
30107
30326
  const info = groupInfoFor(doc ?? hostEl.ownerDocument, audioGroup);
30108
- entry2.audioGroupLabel = info.label;
30109
- entry2.audioGroupVolume = info.volume;
30110
- entry2.audioGroupHidden = info.hidden;
30111
- if (info.fxChain) entry2.audioGroupFxChain = info.fxChain;
30112
- if (info.automation) entry2.audioGroupAutomation = info.automation;
30327
+ entry3.audioGroupLabel = info.label;
30328
+ entry3.audioGroupVolume = info.volume;
30329
+ entry3.audioGroupHidden = info.hidden;
30330
+ if (info.fxChain) entry3.audioGroupFxChain = info.fxChain;
30331
+ if (info.automation) entry3.audioGroupAutomation = info.automation;
30113
30332
  }
30114
30333
  const masterChain = readMasterFxChain(doc ?? hostEl.ownerDocument);
30115
- if (masterChain) entry2.masterChain = masterChain;
30334
+ if (masterChain) entry3.masterChain = masterChain;
30116
30335
  const fxChain = hostEl.getAttribute("data-fx-chain");
30117
- if (fxChain) entry2.fxChain = fxChain;
30336
+ if (fxChain) entry3.fxChain = fxChain;
30118
30337
  const automation = hostEl.getAttribute("data-automation");
30119
- if (automation) entry2.automation = automation;
30120
- entry2.zIndex = readTimelineElementZIndex(hostEl);
30338
+ if (automation) entry3.automation = automation;
30339
+ entry3.zIndex = readTimelineElementZIndex(hostEl);
30121
30340
  }
30122
- if (clip.assetUrl) entry2.src = clip.assetUrl;
30341
+ if (clip.assetUrl) entry3.src = clip.assetUrl;
30123
30342
  if (clip.kind === "composition" && clip.compositionId) {
30124
- entry2.playbackStart ??= 0;
30125
- entry2.playbackRate ??= 1;
30343
+ entry3.playbackStart ??= 0;
30344
+ entry3.playbackRate ??= 1;
30126
30345
  let resolvedSrc = clip.compositionSrc;
30127
30346
  if (!resolvedSrc) {
30128
30347
  if (hostEl?.getAttribute("data-composition-id") !== clip.compositionId) {
@@ -30131,34 +30350,34 @@ function createTimelineElementFromManifestClip(params) {
30131
30350
  resolvedSrc = hostEl?.getAttribute("data-composition-src") ?? hostEl?.getAttribute("data-composition-file") ?? null;
30132
30351
  }
30133
30352
  if (resolvedSrc) {
30134
- entry2.compositionSrc = resolvedSrc;
30353
+ entry3.compositionSrc = resolvedSrc;
30135
30354
  } else if (hostEl) {
30136
30355
  const innerVideo = hostEl.querySelector("video[src]");
30137
30356
  if (innerVideo) {
30138
- entry2.src = innerVideo.getAttribute("src") || void 0;
30139
- entry2.tag = "video";
30357
+ entry3.src = innerVideo.getAttribute("src") || void 0;
30358
+ entry3.tag = "video";
30140
30359
  }
30141
30360
  }
30142
30361
  if (hostEl) {
30143
- entry2.domId = hostEl.id || void 0;
30144
- entry2.hfId = hostEl.getAttribute("data-hf-id") || void 0;
30145
- entry2.selector = getTimelineElementSelector(hostEl);
30146
- entry2.selectorIndex = doc && entry2.selector ? getTimelineElementSelectorIndex(doc, hostEl, entry2.selector) : void 0;
30147
- entry2.sourceFile = getTimelineElementSourceFile(hostEl);
30362
+ entry3.domId = hostEl.id || void 0;
30363
+ entry3.hfId = hostEl.getAttribute("data-hf-id") || void 0;
30364
+ entry3.selector = getTimelineElementSelector(hostEl);
30365
+ entry3.selectorIndex = doc && entry3.selector ? getTimelineElementSelectorIndex(doc, hostEl, entry3.selector) : void 0;
30366
+ entry3.sourceFile = getTimelineElementSourceFile(hostEl);
30148
30367
  const nextIdentity = buildTimelineElementIdentity({
30149
30368
  preferredId: clip.id,
30150
30369
  label,
30151
30370
  fallbackIndex,
30152
- domId: entry2.domId,
30153
- selector: entry2.selector,
30154
- selectorIndex: entry2.selectorIndex,
30155
- sourceFile: entry2.sourceFile
30371
+ domId: entry3.domId,
30372
+ selector: entry3.selector,
30373
+ selectorIndex: entry3.selectorIndex,
30374
+ sourceFile: entry3.sourceFile
30156
30375
  });
30157
- entry2.id = nextIdentity.id;
30158
- entry2.key = nextIdentity.key;
30376
+ entry3.id = nextIdentity.id;
30377
+ entry3.key = nextIdentity.key;
30159
30378
  }
30160
30379
  }
30161
- return entry2;
30380
+ return entry3;
30162
30381
  }
30163
30382
  function parseTimelineFromDOM(doc, rootDuration, timelines) {
30164
30383
  const rootComp = doc.querySelector("[data-composition-id]");
@@ -30206,7 +30425,7 @@ function parseTimelineFromDOM(doc, rootDuration, timelines) {
30206
30425
  selectorIndex,
30207
30426
  sourceFile
30208
30427
  });
30209
- const entry2 = {
30428
+ const entry3 = {
30210
30429
  id: identity.id,
30211
30430
  label,
30212
30431
  transitionLabel: transitionLabels.get(el) ?? el.getAttribute("data-transition-label") ?? void 0,
@@ -30227,59 +30446,59 @@ function parseTimelineFromDOM(doc, rootDuration, timelines) {
30227
30446
  zIndex: readTimelineElementZIndex(el)
30228
30447
  };
30229
30448
  const mediaEl = resolveMediaElement(el);
30230
- applyMediaMetadataFromElement(entry2, el);
30449
+ applyMediaMetadataFromElement(entry3, el);
30231
30450
  if (mediaEl) {
30232
30451
  if (mediaEl.tagName === "IMG") {
30233
- entry2.tag = "img";
30452
+ entry3.tag = "img";
30234
30453
  }
30235
30454
  const resolvedSrc = mediaEl.src || void 0;
30236
- if (resolvedSrc) entry2.src = resolvedSrc;
30455
+ if (resolvedSrc) entry3.src = resolvedSrc;
30237
30456
  }
30238
30457
  const domMasterChain = readMasterFxChain(doc);
30239
- if (domMasterChain) entry2.masterChain = domMasterChain;
30458
+ if (domMasterChain) entry3.masterChain = domMasterChain;
30240
30459
  const domFxChain = el.getAttribute("data-fx-chain");
30241
- if (domFxChain) entry2.fxChain = domFxChain;
30460
+ if (domFxChain) entry3.fxChain = domFxChain;
30242
30461
  const domAutomation = el.getAttribute("data-automation");
30243
- if (domAutomation) entry2.automation = domAutomation;
30462
+ if (domAutomation) entry3.automation = domAutomation;
30244
30463
  if (el.hasAttribute("data-timeline-locked")) {
30245
- entry2.timelineLocked = true;
30464
+ entry3.timelineLocked = true;
30246
30465
  }
30247
30466
  if (el.hasAttribute("data-hidden")) {
30248
- entry2.hidden = true;
30467
+ entry3.hidden = true;
30249
30468
  }
30250
30469
  const timelineRole = el.getAttribute("data-timeline-role");
30251
- if (timelineRole) entry2.timelineRole = timelineRole;
30470
+ if (timelineRole) entry3.timelineRole = timelineRole;
30252
30471
  const domLink = el.getAttribute("data-link");
30253
- if (domLink) entry2.link = domLink;
30472
+ if (domLink) entry3.link = domLink;
30254
30473
  const domCompositionScope = linkScopeOf(el)?.getAttribute("data-composition-id");
30255
- if (domCompositionScope) entry2.compositionScope = domCompositionScope;
30474
+ if (domCompositionScope) entry3.compositionScope = domCompositionScope;
30256
30475
  const domSyncOrigin = el.getAttribute("data-sync-origin");
30257
- if (domSyncOrigin) entry2.syncOrigin = domSyncOrigin;
30476
+ if (domSyncOrigin) entry3.syncOrigin = domSyncOrigin;
30258
30477
  const domAudioGroup = el.getAttribute("data-audio-group");
30259
30478
  if (domAudioGroup) {
30260
- entry2.audioGroup = domAudioGroup;
30479
+ entry3.audioGroup = domAudioGroup;
30261
30480
  const domGroupInfo = groupInfoFor(doc, domAudioGroup);
30262
- entry2.audioGroupLabel = domGroupInfo.label;
30263
- entry2.audioGroupVolume = domGroupInfo.volume;
30264
- entry2.audioGroupHidden = domGroupInfo.hidden;
30265
- if (domGroupInfo.fxChain) entry2.audioGroupFxChain = domGroupInfo.fxChain;
30266
- if (domGroupInfo.automation) entry2.audioGroupAutomation = domGroupInfo.automation;
30481
+ entry3.audioGroupLabel = domGroupInfo.label;
30482
+ entry3.audioGroupVolume = domGroupInfo.volume;
30483
+ entry3.audioGroupHidden = domGroupInfo.hidden;
30484
+ if (domGroupInfo.fxChain) entry3.audioGroupFxChain = domGroupInfo.fxChain;
30485
+ if (domGroupInfo.automation) entry3.audioGroupAutomation = domGroupInfo.automation;
30267
30486
  }
30268
30487
  const compSrc = el.getAttribute("data-composition-src") || el.getAttribute("data-composition-file");
30269
30488
  if (compSrc) {
30270
- entry2.compositionSrc = compSrc;
30489
+ entry3.compositionSrc = compSrc;
30271
30490
  } else if (compId && compId !== rootComp?.getAttribute("data-composition-id")) {
30272
30491
  const innerMedia = el.querySelector("video[src], img[src]");
30273
30492
  if (innerMedia) {
30274
- entry2.src = innerMedia.getAttribute("src") || void 0;
30275
- entry2.tag = innerMedia.tagName === "IMG" ? "img" : "video";
30493
+ entry3.src = innerMedia.getAttribute("src") || void 0;
30494
+ entry3.tag = innerMedia.tagName === "IMG" ? "img" : "video";
30276
30495
  }
30277
30496
  }
30278
- if (entry2.kind === "composition") {
30279
- entry2.playbackStart ??= 0;
30280
- entry2.playbackRate ??= 1;
30497
+ if (entry3.kind === "composition") {
30498
+ entry3.playbackStart ??= 0;
30499
+ entry3.playbackRate ??= 1;
30281
30500
  }
30282
- els.push(entry2);
30501
+ els.push(entry3);
30283
30502
  });
30284
30503
  return els;
30285
30504
  }
@@ -30436,11 +30655,11 @@ function safeContentDocument(iframe) {
30436
30655
  }
30437
30656
  function buildTimelineElementsFromClips(clips, iframeDoc) {
30438
30657
  const resolveHost = iframeDoc ? createTimelineDomNodeResolver(iframeDoc) : null;
30439
- return clips.map((clip, index) => {
30440
- const hostEl = resolveHost?.(clip, index) ?? null;
30658
+ return clips.map((clip, index2) => {
30659
+ const hostEl = resolveHost?.(clip, index2) ?? null;
30441
30660
  return createTimelineElementFromManifestClip({
30442
30661
  clip,
30443
- fallbackIndex: index,
30662
+ fallbackIndex: index2,
30444
30663
  doc: iframeDoc,
30445
30664
  hostEl
30446
30665
  });
@@ -30851,7 +31070,7 @@ function withTweenIndex(run) {
30851
31070
  }
30852
31071
  }
30853
31072
  function indexTweens(children) {
30854
- const index = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
31073
+ const index2 = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
30855
31074
  const add = (map, key2, tween) => {
30856
31075
  const list = map.get(key2);
30857
31076
  if (!list) map.set(key2, [tween]);
@@ -30859,19 +31078,19 @@ function indexTweens(children) {
30859
31078
  };
30860
31079
  for (const tween of children) {
30861
31080
  for (const target of tween.targets?.() ?? []) {
30862
- add(index.byElement, target, tween);
31081
+ add(index2.byElement, target, tween);
30863
31082
  const id = target.id;
30864
- if (id) add(index.byId, id, tween);
31083
+ if (id) add(index2.byId, id, tween);
30865
31084
  }
30866
31085
  }
30867
- return index;
31086
+ return index2;
30868
31087
  }
30869
31088
  function tweensTargeting(timeline, el) {
30870
31089
  if (!timeline || typeof timeline !== "object" || !tweenIndexes)
30871
31090
  return (timeline?.getChildren?.(true) ?? []).filter((tween) => matchesElement(tween, el));
30872
- let index = tweenIndexes.get(timeline);
30873
- if (!index) tweenIndexes.set(timeline, index = indexTweens(timeline.getChildren?.(true) ?? []));
30874
- return (el.id ? index.byId.get(el.id) : index.byElement.get(el)) ?? [];
31091
+ let index2 = tweenIndexes.get(timeline);
31092
+ if (!index2) tweenIndexes.set(timeline, index2 = indexTweens(timeline.getChildren?.(true) ?? []));
31093
+ return (el.id ? index2.byId.get(el.id) : index2.byElement.get(el)) ?? [];
30875
31094
  }
30876
31095
 
30877
31096
  // src/hooks/gsapParsedTween.ts
@@ -32380,17 +32599,17 @@ function validateFixtureSpec(spec) {
32380
32599
  const geometry = PROFILE_GEOMETRY[spec.profile];
32381
32600
  return geometry;
32382
32601
  }
32383
- function fixtureTrack(index, spec) {
32384
- if (index < TRACK_COUNT) return index;
32385
- if (spec.profile !== "dense-short") return index % TRACK_COUNT;
32602
+ function fixtureTrack(index2, spec) {
32603
+ if (index2 < TRACK_COUNT) return index2;
32604
+ if (spec.profile !== "dense-short") return index2 % TRACK_COUNT;
32386
32605
  const denseTrackCount = Math.ceil((spec.elementCount - TRACK_COUNT) / 127);
32387
- return (index - TRACK_COUNT) % Math.max(1, denseTrackCount);
32606
+ return (index2 - TRACK_COUNT) % Math.max(1, denseTrackCount);
32388
32607
  }
32389
- function fixtureStart(index, profile, duration, clipDuration2) {
32390
- const available = Math.max(0, duration - clipDuration2);
32391
- if (profile === "dense-short") return index % 128 * 0.5;
32392
- if (profile === "long-overlap") return index * 37 % Math.max(1, available);
32393
- return index * 17 % Math.max(1, available);
32608
+ function fixtureStart(index2, profile, duration, clipDuration2) {
32609
+ const available2 = Math.max(0, duration - clipDuration2);
32610
+ if (profile === "dense-short") return index2 % 128 * 0.5;
32611
+ if (profile === "long-overlap") return index2 * 37 % Math.max(1, available2);
32612
+ return index2 * 17 % Math.max(1, available2);
32394
32613
  }
32395
32614
  function keyframeData() {
32396
32615
  return {
@@ -32423,26 +32642,26 @@ function createTimelinePerformanceFixture(spec) {
32423
32642
  const keyframeCache = /* @__PURE__ */ new Map();
32424
32643
  const gsapAnimations = /* @__PURE__ */ new Map();
32425
32644
  const expandedClipIds = /* @__PURE__ */ new Set();
32426
- for (let index = 0; index < spec.elementCount; index += 1) {
32427
- const id = `perf-${spec.profile}-${spec.elementCount}-${index}`;
32428
- const start = fixtureStart(index, spec.profile, geometry.duration, geometry.clipDuration);
32429
- const track2 = fixtureTrack(index, spec);
32645
+ for (let index2 = 0; index2 < spec.elementCount; index2 += 1) {
32646
+ const id = `perf-${spec.profile}-${spec.elementCount}-${index2}`;
32647
+ const start = fixtureStart(index2, spec.profile, geometry.duration, geometry.clipDuration);
32648
+ const track2 = fixtureTrack(index2, spec);
32430
32649
  const element = {
32431
32650
  id,
32432
32651
  key: id,
32433
32652
  domId: id,
32434
32653
  selector: `#${id}`,
32435
- label: `Fixture ${index + 1}`,
32436
- tag: spec.profile === "remote-unsupported" && index % 2 === 0 ? "video" : "div",
32654
+ label: `Fixture ${index2 + 1}`,
32655
+ tag: spec.profile === "remote-unsupported" && index2 % 2 === 0 ? "video" : "div",
32437
32656
  start,
32438
32657
  duration: geometry.clipDuration,
32439
32658
  track: track2,
32440
32659
  authoredTrack: track2
32441
32660
  };
32442
32661
  if (spec.profile === "composition-heavy") {
32443
- element.compositionSrc = `compositions/perf-${index % 32}.html`;
32662
+ element.compositionSrc = `compositions/perf-${index2 % 32}.html`;
32444
32663
  } else if (spec.profile === "remote-unsupported") {
32445
- element.src = index % 2 === 0 ? `https://media.invalid/perf-${index % 32}.mp4` : `assets/perf-${index % 32}.unsupported`;
32664
+ element.src = index2 % 2 === 0 ? `https://media.invalid/perf-${index2 % 32}.mp4` : `assets/perf-${index2 % 32}.unsupported`;
32446
32665
  }
32447
32666
  if (spec.profile === "keyframe-heavy-expanded") {
32448
32667
  keyframeCache.set(id, keyframeData());
@@ -32535,9 +32754,9 @@ function evictMetadataOverflow() {
32535
32754
  ...Array.from(cache, ([key2, value]) => ({ key: key2, at: value.lastAccess, failed: false })),
32536
32755
  ...Array.from(failed, ([key2, value]) => ({ key: key2, at: value.lastAccess, failed: true }))
32537
32756
  ].sort((left, right) => left.at - right.at);
32538
- for (const entry2 of entries.slice(0, overflow)) {
32539
- if (entry2.failed) failed.delete(entry2.key);
32540
- else cache.delete(entry2.key);
32757
+ for (const entry3 of entries.slice(0, overflow)) {
32758
+ if (entry3.failed) failed.delete(entry3.key);
32759
+ else cache.delete(entry3.key);
32541
32760
  }
32542
32761
  }
32543
32762
  function applyCachedSourceDurations(elements, projectId) {
@@ -32620,6 +32839,10 @@ function shouldStopAfterSeek(input) {
32620
32839
  }
32621
32840
 
32622
32841
  // src/player/hooks/previewMessageRouter.ts
32842
+ import {
32843
+ parseMediaLoadFailure,
32844
+ RUNTIME_MEDIA_LOAD_FAILED
32845
+ } from "@hyperframes/core/runtime/protocol";
32623
32846
  function isForeignSource(e, iframe) {
32624
32847
  return Boolean(e.source && iframe && e.source !== iframe.contentWindow);
32625
32848
  }
@@ -32676,6 +32899,12 @@ function applyStoreReport(data) {
32676
32899
  case "preview-facts":
32677
32900
  store.setPreviewFacts(parsePreviewFacts(data.facts));
32678
32901
  return true;
32902
+ case "diagnostic": {
32903
+ if (data.code !== RUNTIME_MEDIA_LOAD_FAILED) return false;
32904
+ const failure = parseMediaLoadFailure(data.details);
32905
+ if (failure) store.setMediaLoadFailure(failure);
32906
+ return true;
32907
+ }
32679
32908
  default:
32680
32909
  return false;
32681
32910
  }
@@ -32744,8 +32973,8 @@ var RENDERED_FIELDS = [
32744
32973
  ];
32745
32974
  function timelineElementsChanged(previous, next) {
32746
32975
  if (next.length !== previous.length) return true;
32747
- return next.some((element, index) => {
32748
- const prior = previous[index];
32976
+ return next.some((element, index2) => {
32977
+ const prior = previous[index2];
32749
32978
  return !prior || RENDERED_FIELDS.some((key2) => element[key2] !== prior[key2]) || !sameTimelineText(element.text, prior.text);
32750
32979
  });
32751
32980
  }
@@ -33270,9 +33499,9 @@ function useCompositionStack({
33270
33499
  const compIdToSrcRef = useRef50(compIdToSrc);
33271
33500
  compIdToSrcRef.current = compIdToSrc;
33272
33501
  const handleNavigateComposition = useCallback42(
33273
- (index) => {
33502
+ (index2) => {
33274
33503
  usePlayerStore.getState().setElements([]);
33275
- updateCompositionStack((prev) => prev.slice(0, index + 1));
33504
+ updateCompositionStack((prev) => prev.slice(0, index2 + 1));
33276
33505
  },
33277
33506
  // eslint-disable-next-line react-hooks/exhaustive-deps
33278
33507
  []
@@ -36586,9 +36815,9 @@ function hasAuthorPointerEventsNone(el) {
36586
36815
  }
36587
36816
  function collectPointerEventsNoneTargets(elements) {
36588
36817
  const disabled = /* @__PURE__ */ new WeakSet();
36589
- for (const entry2 of elements) {
36590
- if (isHtmlElement(entry2) && hasAuthorPointerEventsNone(entry2)) {
36591
- disabled.add(entry2);
36818
+ for (const entry3 of elements) {
36819
+ if (isHtmlElement(entry3) && hasAuthorPointerEventsNone(entry3)) {
36820
+ disabled.add(entry3);
36592
36821
  }
36593
36822
  }
36594
36823
  return disabled;
@@ -37296,8 +37525,8 @@ function rectsEqual(a, b) {
37296
37525
  function groupOverlayItemsEqual(a, b) {
37297
37526
  if (a === b) return true;
37298
37527
  if (a.length !== b.length) return false;
37299
- return a.every((item, index) => {
37300
- const other = b[index];
37528
+ return a.every((item, index2) => {
37529
+ const other = b[index2];
37301
37530
  return Boolean(
37302
37531
  other && item.key === other.key && item.element === other.element && item.selection === other.selection && rectsEqual(item.rect, other.rect)
37303
37532
  );
@@ -37919,7 +38148,7 @@ function useDomEditOverlayRects({
37919
38148
  sel && hoverSel && selectionCacheKey(sel) === selectionCacheKey(hoverSel)
37920
38149
  );
37921
38150
  const hoverMatchesGroup = Boolean(
37922
- hoverSel && group.some((entry2) => selectionCacheKey(entry2) === selectionCacheKey(hoverSel))
38151
+ hoverSel && group.some((entry3) => selectionCacheKey(entry3) === selectionCacheKey(hoverSel))
37923
38152
  );
37924
38153
  if (!hoverSel || hoverMatchesSelection || hoverMatchesGroup) {
37925
38154
  resolvedHoverElementRef.current = null;
@@ -38053,7 +38282,7 @@ function OffCanvasIndicators({
38053
38282
  function ChildRectOutlines({
38054
38283
  rects
38055
38284
  }) {
38056
- return /* @__PURE__ */ jsx95(Fragment28, { children: rects.map((rect, index) => /* @__PURE__ */ jsx95(
38285
+ return /* @__PURE__ */ jsx95(Fragment28, { children: rects.map((rect, index2) => /* @__PURE__ */ jsx95(
38057
38286
  "div",
38058
38287
  {
38059
38288
  className: "pointer-events-none absolute border border-dashed border-white/20 rounded-xs",
@@ -38066,7 +38295,7 @@ function ChildRectOutlines({
38066
38295
  transform: rect.angle ? `rotate(${rect.angle}deg)` : void 0
38067
38296
  }
38068
38297
  },
38069
- index
38298
+ index2
38070
38299
  )) });
38071
38300
  }
38072
38301
 
@@ -38247,21 +38476,21 @@ function hasEditMarks(doc) {
38247
38476
  if (!Observer) return scanForEditMarks(doc);
38248
38477
  let cache2 = editMarkCaches.get(doc);
38249
38478
  if (!cache2) {
38250
- const entry2 = {
38479
+ const entry3 = {
38251
38480
  observer: new Observer(() => {
38252
- entry2.stale = true;
38481
+ entry3.stale = true;
38253
38482
  }),
38254
38483
  stale: true,
38255
38484
  has: false
38256
38485
  };
38257
- entry2.observer.observe(doc, {
38486
+ entry3.observer.observe(doc, {
38258
38487
  subtree: true,
38259
38488
  childList: true,
38260
38489
  attributes: true,
38261
38490
  attributeFilter: STUDIO_EDIT_ATTRS
38262
38491
  });
38263
- editMarkCaches.set(doc, entry2);
38264
- cache2 = entry2;
38492
+ editMarkCaches.set(doc, entry3);
38493
+ cache2 = entry3;
38265
38494
  }
38266
38495
  if (cache2.observer.takeRecords().length > 0) cache2.stale = true;
38267
38496
  if (cache2.stale) {
@@ -40771,8 +41000,8 @@ function createDomEditOverlayGestureHandlers(opts) {
40771
41000
  pointer: `${Math.round(rawDx)},${Math.round(rawDy)}`,
40772
41001
  applied: `${Math.round(dx)},${Math.round(dy)}`,
40773
41002
  committed: Object.fromEntries(
40774
- updates.map((update, index) => [
40775
- groupG.members[index]?.key ?? String(index),
41003
+ updates.map((update, index2) => [
41004
+ groupG.members[index2]?.key ?? String(index2),
40776
41005
  `${Math.round(update.next.x)},${Math.round(update.next.y)}`
40777
41006
  ])
40778
41007
  ),
@@ -42415,8 +42644,8 @@ function graphemeBounds(runs, start, end) {
42415
42644
  end: boundaries.find((boundary) => boundary >= end) ?? end
42416
42645
  };
42417
42646
  }
42418
- function atEndOfSegment({ index, segment }) {
42419
- return index + segment.length;
42647
+ function atEndOfSegment({ index: index2, segment }) {
42648
+ return index2 + segment.length;
42420
42649
  }
42421
42650
  function boundaryAtOrBefore(boundaries, offset) {
42422
42651
  let previous = offset;
@@ -42436,7 +42665,7 @@ function readCoveredInlineStyleChars(range) {
42436
42665
  const end = offsetOf2(host, range.endContainer, range.endOffset);
42437
42666
  if (start === null || end === null) return null;
42438
42667
  const collapsed = start === end;
42439
- const covered = charRuns(readRuns(host)).slice(collapsed ? Math.max(0, start - 1) : start, collapsed ? Math.max(1, start) : end).map((entry2) => ({ char: entry2.char, style: entry2.style, painter: entry2.painter ?? null }));
42668
+ const covered = charRuns(readRuns(host)).slice(collapsed ? Math.max(0, start - 1) : start, collapsed ? Math.max(1, start) : end).map((entry3) => ({ char: entry3.char, style: entry3.style, painter: entry3.painter ?? null }));
42440
42669
  return covered.length > 0 ? covered : null;
42441
42670
  }
42442
42671
  function editingHost(node) {
@@ -42497,8 +42726,8 @@ function identityOf(element) {
42497
42726
  }
42498
42727
  function ownStyle(element) {
42499
42728
  const style = {};
42500
- for (let index = 0; index < element.style.length; index += 1) {
42501
- const property = element.style.item(index);
42729
+ for (let index2 = 0; index2 < element.style.length; index2 += 1) {
42730
+ const property = element.style.item(index2);
42502
42731
  if (!property) continue;
42503
42732
  const value = element.style.getPropertyValue(property);
42504
42733
  if (isRichTextFormattingStyle(property, value)) style[property] = value;
@@ -42508,9 +42737,9 @@ function ownStyle(element) {
42508
42737
  function charRuns(runs) {
42509
42738
  const perChar = [];
42510
42739
  for (const run of runs) {
42511
- for (let index = 0; index < run.text.length; index += 1) {
42740
+ for (let index2 = 0; index2 < run.text.length; index2 += 1) {
42512
42741
  perChar.push({
42513
- char: run.text[index] ?? "",
42742
+ char: run.text[index2] ?? "",
42514
42743
  style: run.style,
42515
42744
  origin: run.origin,
42516
42745
  identity: run.identity,
@@ -42524,11 +42753,11 @@ function restyle(runs, start, end, delta) {
42524
42753
  const text = runs.map((run) => run.text).join("");
42525
42754
  const perChar = charRuns(runs);
42526
42755
  const next = [];
42527
- for (let index = 0; index < text.length; index += 1) {
42756
+ for (let index2 = 0; index2 < text.length; index2 += 1) {
42528
42757
  appendChar(
42529
42758
  next,
42530
- text[index] ?? "",
42531
- charAfter(perChar[index], index >= start && index < end, delta)
42759
+ text[index2] ?? "",
42760
+ charAfter(perChar[index2], index2 >= start && index2 < end, delta)
42532
42761
  );
42533
42762
  }
42534
42763
  return next;
@@ -42588,8 +42817,8 @@ function runNodes(doc, runs) {
42588
42817
  function runNode(doc, run, carried) {
42589
42818
  const key2 = styleKey(run.style);
42590
42819
  const nodes = [];
42591
- for (const [index, piece] of run.text.split(BREAK).entries()) {
42592
- if (index > 0) nodes.push(doc.createElement("br"));
42820
+ for (const [index2, piece] of run.text.split(BREAK).entries()) {
42821
+ if (index2 > 0) nodes.push(doc.createElement("br"));
42593
42822
  if (!piece) continue;
42594
42823
  if (!key2 && carried.size === 0) {
42595
42824
  nodes.push(doc.createTextNode(piece));
@@ -42854,7 +43083,7 @@ function swatchBackground(distinctColours, agreed) {
42854
43083
  if (distinctColours.length === 0) return agreed || DEFAULT_COLOR;
42855
43084
  if (distinctColours.length === 1) return distinctColours[0];
42856
43085
  const stops = distinctColours.map(
42857
- (colour, index) => `${colour} ${(index / (distinctColours.length - 1) * 100).toFixed(2)}%`
43086
+ (colour, index2) => `${colour} ${(index2 / (distinctColours.length - 1) * 100).toFixed(2)}%`
42858
43087
  );
42859
43088
  return `linear-gradient(135deg, ${stops.join(", ")})`;
42860
43089
  }
@@ -45305,7 +45534,7 @@ function useElementLifecycleOps({
45305
45534
  (entries, gestureCoalesceKey, actionKind) => {
45306
45535
  if (entries.length === 0) return Promise.resolve();
45307
45536
  return (async () => {
45308
- const releaseZPersists = entries.map((entry2) => beginLayerZPersist(entry2.element));
45537
+ const releaseZPersists = entries.map((entry3) => beginLayerZPersist(entry3.element));
45309
45538
  try {
45310
45539
  onReorderShadow?.(
45311
45540
  entries.map((e) => readHfId(e.element)).filter((id) => id != null)
@@ -45314,58 +45543,58 @@ function useElementLifecycleOps({
45314
45543
  const patchesBySourceFile = /* @__PURE__ */ new Map();
45315
45544
  const rollbacks = [];
45316
45545
  const revealCommits = [];
45317
- for (const entry2 of entries) {
45318
- const priorZIndex = entry2.element.style.zIndex;
45319
- const priorPosition = entry2.element.style.position;
45320
- const priorStoreEntry = entry2.key ? usePlayerStore.getState().elements.find((el) => (el.key ?? el.id) === entry2.key) : void 0;
45546
+ for (const entry3 of entries) {
45547
+ const priorZIndex = entry3.element.style.zIndex;
45548
+ const priorPosition = entry3.element.style.position;
45549
+ const priorStoreEntry = entry3.key ? usePlayerStore.getState().elements.find((el) => (el.key ?? el.id) === entry3.key) : void 0;
45321
45550
  let positionChanged = false;
45322
- const liftPriorPosition = entry2.element.getAttribute(LAYER_REVEAL_PRIOR_POSITION_ATTR);
45323
- const revealOwnership = beginLayerRevealCommit(entry2.element);
45551
+ const liftPriorPosition = entry3.element.getAttribute(LAYER_REVEAL_PRIOR_POSITION_ATTR);
45552
+ const revealOwnership = beginLayerRevealCommit(entry3.element);
45324
45553
  if (revealOwnership) {
45325
- revealCommits.push({ element: entry2.element, ownership: revealOwnership });
45554
+ revealCommits.push({ element: entry3.element, ownership: revealOwnership });
45326
45555
  }
45327
- entry2.element.style.zIndex = String(entry2.zIndex);
45556
+ entry3.element.style.zIndex = String(entry3.zIndex);
45328
45557
  const patches = [
45329
- { type: "inline-style", property: "z-index", value: String(entry2.zIndex) }
45558
+ { type: "inline-style", property: "z-index", value: String(entry3.zIndex) }
45330
45559
  ];
45331
45560
  try {
45332
- const win = entry2.element.ownerDocument?.defaultView;
45333
- const effectivePosition = liftPriorPosition ?? (win ? win.getComputedStyle(entry2.element).position : void 0);
45561
+ const win = entry3.element.ownerDocument?.defaultView;
45562
+ const effectivePosition = liftPriorPosition ?? (win ? win.getComputedStyle(entry3.element).position : void 0);
45334
45563
  if (effectivePosition === "static") {
45335
- entry2.element.style.position = "relative";
45564
+ entry3.element.style.position = "relative";
45336
45565
  positionChanged = true;
45337
45566
  patches.push({ type: "inline-style", property: "position", value: "relative" });
45338
45567
  }
45339
45568
  } catch {
45340
45569
  }
45341
- if (entry2.key) {
45342
- usePlayerStore.getState().updateElement(entry2.key, { zIndex: entry2.zIndex, hasExplicitZIndex: true });
45570
+ if (entry3.key) {
45571
+ usePlayerStore.getState().updateElement(entry3.key, { zIndex: entry3.zIndex, hasExplicitZIndex: true });
45343
45572
  }
45344
45573
  rollbacks.push(() => {
45345
45574
  if (revealOwnership) {
45346
- rollbackLayerRevealCommit(entry2.element, revealOwnership);
45575
+ rollbackLayerRevealCommit(entry3.element, revealOwnership);
45347
45576
  } else {
45348
- entry2.element.style.zIndex = priorZIndex;
45349
- if (positionChanged) entry2.element.style.position = priorPosition;
45577
+ entry3.element.style.zIndex = priorZIndex;
45578
+ if (positionChanged) entry3.element.style.position = priorPosition;
45350
45579
  }
45351
- if (entry2.key && priorStoreEntry) {
45352
- usePlayerStore.getState().updateElement(entry2.key, {
45580
+ if (entry3.key && priorStoreEntry) {
45581
+ usePlayerStore.getState().updateElement(entry3.key, {
45353
45582
  zIndex: priorStoreEntry.zIndex,
45354
45583
  hasExplicitZIndex: priorStoreEntry.hasExplicitZIndex
45355
45584
  });
45356
45585
  }
45357
45586
  });
45358
- const filePatches = patchesBySourceFile.get(entry2.sourceFile) ?? [];
45587
+ const filePatches = patchesBySourceFile.get(entry3.sourceFile) ?? [];
45359
45588
  filePatches.push({
45360
45589
  target: buildDomEditPatchTarget({
45361
- id: entry2.id,
45362
- hfId: readHfId(entry2.element),
45363
- selector: entry2.selector,
45364
- selectorIndex: entry2.selectorIndex
45590
+ id: entry3.id,
45591
+ hfId: readHfId(entry3.element),
45592
+ selector: entry3.selector,
45593
+ selectorIndex: entry3.selectorIndex
45365
45594
  }),
45366
45595
  operations: patches
45367
45596
  });
45368
- patchesBySourceFile.set(entry2.sourceFile, filePatches);
45597
+ patchesBySourceFile.set(entry3.sourceFile, filePatches);
45369
45598
  }
45370
45599
  const batches = [...patchesBySourceFile].map(([sourceFile, patches]) => ({
45371
45600
  sourceFile,
@@ -45671,17 +45900,17 @@ function describeZIndexElement(element) {
45671
45900
  }
45672
45901
  function resolveZIndexEntries(sel, patches, activeCompPath) {
45673
45902
  const entries = [];
45674
- const dropped = [];
45903
+ const dropped2 = [];
45675
45904
  for (const patch of patches) {
45676
45905
  if (patch.element === sel.element) {
45677
45906
  entries.push(selectedZIndexEntry(sel, patch.zIndex));
45678
45907
  continue;
45679
45908
  }
45680
- const entry2 = siblingZIndexEntry(patch.element, patch.zIndex, sel.sourceFile, activeCompPath);
45681
- if (entry2) entries.push(entry2);
45682
- else dropped.push(patch);
45909
+ const entry3 = siblingZIndexEntry(patch.element, patch.zIndex, sel.sourceFile, activeCompPath);
45910
+ if (entry3) entries.push(entry3);
45911
+ else dropped2.push(patch);
45683
45912
  }
45684
- return { entries, dropped };
45913
+ return { entries, dropped: dropped2 };
45685
45914
  }
45686
45915
  var isLive = (element) => element.isConnected && element.ownerDocument.defaultView !== null;
45687
45916
  function useDomEditZOrder() {
@@ -45696,12 +45925,12 @@ function useDomEditZOrder() {
45696
45925
  const commit2 = useCallback63(
45697
45926
  (sel, patches, action, crossed) => {
45698
45927
  if (readOnly) return false;
45699
- const { entries, dropped } = resolveZIndexEntries(sel, patches, activeCompPath);
45700
- if (dropped.length > 0) {
45701
- for (const patch of dropped) patch.element.style.zIndex = String(patch.zIndex);
45928
+ const { entries, dropped: dropped2 } = resolveZIndexEntries(sel, patches, activeCompPath);
45929
+ if (dropped2.length > 0) {
45930
+ for (const patch of dropped2) patch.element.style.zIndex = String(patch.zIndex);
45702
45931
  console.warn(
45703
45932
  "[studio] z-index reorder: dropping sibling(s) with no stable id/selector (will revert on reload):",
45704
- dropped.map((patch) => describeZIndexElement(patch.element)).join(", ")
45933
+ dropped2.map((patch) => describeZIndexElement(patch.element)).join(", ")
45705
45934
  );
45706
45935
  }
45707
45936
  if (entries.length === 0) return false;
@@ -45834,8 +46063,8 @@ function mintElementHandle(address) {
45834
46063
  if (address.hfId) return `hf${SEPARATOR}${scoped(address.hfId)}`;
45835
46064
  if (address.domId) return `dom${SEPARATOR}${scoped(address.domId)}`;
45836
46065
  if (address.selector) {
45837
- const index = address.selectorIndex ?? 0;
45838
- return `sel${SEPARATOR}${scoped(address.selector)}${INDEX_SEPARATOR}${index}`;
46066
+ const index2 = address.selectorIndex ?? 0;
46067
+ return `sel${SEPARATOR}${scoped(address.selector)}${INDEX_SEPARATOR}${index2}`;
45839
46068
  }
45840
46069
  return null;
45841
46070
  }
@@ -45905,13 +46134,13 @@ function parseElementHandle(handle) {
45905
46134
  const scoped2 = parseScopedValue(rest);
45906
46135
  return scoped2 ? { scheme, ...scoped2, index: 0 } : null;
45907
46136
  }
45908
- const index = Number(rest.slice(indexAt + 1));
45909
- if (!Number.isInteger(index) || index < 0) {
46137
+ const index2 = Number(rest.slice(indexAt + 1));
46138
+ if (!Number.isInteger(index2) || index2 < 0) {
45910
46139
  const scoped2 = parseScopedValue(rest);
45911
46140
  return scoped2 ? { scheme, ...scoped2, index: 0 } : null;
45912
46141
  }
45913
46142
  const scoped = parseScopedValue(rest.slice(0, indexAt));
45914
- return scoped ? { scheme, ...scoped, index } : null;
46143
+ return scoped ? { scheme, ...scoped, index: index2 } : null;
45915
46144
  }
45916
46145
  function resolveElementHandle(doc, handle) {
45917
46146
  const parsed = parseElementHandle(handle);
@@ -46488,11 +46717,11 @@ function findSourceContextIndex(items, targetIndex) {
46488
46717
  const target = items[targetIndex];
46489
46718
  let contextIndex = targetIndex;
46490
46719
  let parentDepth = target.depth - 1;
46491
- for (let index = targetIndex - 1; index >= 0 && parentDepth >= 0; index--) {
46492
- const item = items[index];
46720
+ for (let index2 = targetIndex - 1; index2 >= 0 && parentDepth >= 0; index2--) {
46721
+ const item = items[index2];
46493
46722
  if (item.depth !== parentDepth) continue;
46494
46723
  if (item.sourceFile !== target.sourceFile) break;
46495
- contextIndex = index;
46724
+ contextIndex = index2;
46496
46725
  parentDepth -= 1;
46497
46726
  }
46498
46727
  return contextIndex;
@@ -46500,8 +46729,8 @@ function findSourceContextIndex(items, targetIndex) {
46500
46729
  function collectSourceContours(items, contextIndex, target) {
46501
46730
  const context = items[contextIndex];
46502
46731
  const contours = [];
46503
- for (let index = contextIndex + 1; index < items.length; index++) {
46504
- const item = items[index];
46732
+ for (let index2 = contextIndex + 1; index2 < items.length; index2++) {
46733
+ const item = items[index2];
46505
46734
  if (item.depth <= context.depth) break;
46506
46735
  if (item.sourceFile === target.sourceFile && item.element !== target.element) {
46507
46736
  contours.push(item.element);
@@ -46553,8 +46782,8 @@ function measureTopologyLensGeometry(input) {
46553
46782
  rect: fieldUsesContext ? measuredField : target
46554
46783
  },
46555
46784
  target: { label: elements.target.tagName.toLowerCase(), rect: target },
46556
- contours: measured.slice(contourOffset).map((rect, index) => ({
46557
- label: elements.contours[index].tagName.toLowerCase(),
46785
+ contours: measured.slice(contourOffset).map((rect, index2) => ({
46786
+ label: elements.contours[index2].tagName.toLowerCase(),
46558
46787
  rect
46559
46788
  })).filter((item) => isRenderableRect(item.rect))
46560
46789
  };
@@ -46716,7 +46945,7 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
46716
46945
  }
46717
46946
  ),
46718
46947
  (state.phase === "acquiring" || state.phase === "sealing") && /* @__PURE__ */ jsxs74(Fragment32, { children: [
46719
- geometry.contours.map(({ label, rect }, index) => /* @__PURE__ */ jsx107(
46948
+ geometry.contours.map(({ label, rect }, index2) => /* @__PURE__ */ jsx107(
46720
46949
  "div",
46721
46950
  {
46722
46951
  "data-topology-contour": "true",
@@ -46724,10 +46953,10 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
46724
46953
  className: "hf-topology-contour pointer-events-none absolute z-1 rounded-sm",
46725
46954
  style: {
46726
46955
  ...rectStyle(rect),
46727
- animationDelay: `${Math.min(index, 5) * 28}ms`
46956
+ animationDelay: `${Math.min(index2, 5) * 28}ms`
46728
46957
  }
46729
46958
  },
46730
- index
46959
+ index2
46731
46960
  )),
46732
46961
  !reducedMotion2 && /* @__PURE__ */ jsx107(
46733
46962
  "div",
@@ -46829,17 +47058,17 @@ function updateKeyframeCacheFromParsed(animations, targetPath, selectionId, muta
46829
47058
  const mutated = mutationSelector ? resolveSelectorElementIds(mutationSelector, doc) : [];
46830
47059
  const targetIds = mutated.length > 0 ? mutated : selectionId ? [selectionId] : [];
46831
47060
  publishKeyframeCache((draft) => {
46832
- for (const [id, entry2] of merged) {
46833
- writeElementIntoDraft(draft, targetPath, id, entry2, sourceAnimations.get(id));
47061
+ for (const [id, entry3] of merged) {
47062
+ writeElementIntoDraft(draft, targetPath, id, entry3, sourceAnimations.get(id));
46834
47063
  }
46835
47064
  for (const targetId of targetIds) {
46836
47065
  if (!idsWithKeyframes.has(targetId)) deleteElementFromDraft(draft, targetPath, targetId);
46837
47066
  }
46838
47067
  });
46839
47068
  }
46840
- function writeElementIntoDraft(draft, sourceFile, elementId2, entry2, animations) {
47069
+ function writeElementIntoDraft(draft, sourceFile, elementId2, entry3, animations) {
46841
47070
  for (const key2 of elementCacheKeys(sourceFile, elementId2)) {
46842
- draft.keyframeCache.set(key2, entry2);
47071
+ draft.keyframeCache.set(key2, entry3);
46843
47072
  if (animations) draft.gsapAnimations.set(key2, animations);
46844
47073
  else draft.gsapAnimations.delete(key2);
46845
47074
  }
@@ -46860,10 +47089,10 @@ function cachedElementIdsForFile(sourceFile, keyframeCache, gsapAnimations) {
46860
47089
  if (key2.startsWith(sfPrefix)) ids.add(key2.slice(sfPrefix.length));
46861
47090
  }
46862
47091
  if (sourceFile !== "index.html") return ids;
46863
- for (const [key2, entry2] of keyframeCache) {
47092
+ for (const [key2, entry3] of keyframeCache) {
46864
47093
  const hash = key2.indexOf("#");
46865
47094
  const id = key2.slice(hash + 1);
46866
- if (hash > 0 && !key2.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry2) {
47095
+ if (hash > 0 && !key2.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry3) {
46867
47096
  ids.delete(id);
46868
47097
  }
46869
47098
  }
@@ -46915,8 +47144,8 @@ function replaceKeyframeCacheForFile(sourceFile, entries, animationsByElement) {
46915
47144
  )) {
46916
47145
  deleteElementFromDraft(draft, sourceFile, id);
46917
47146
  }
46918
- for (const [id, entry2] of entries) {
46919
- writeElementIntoDraft(draft, sourceFile, id, entry2, animationsByElement.get(id));
47147
+ for (const [id, entry3] of entries) {
47148
+ writeElementIntoDraft(draft, sourceFile, id, entry3, animationsByElement.get(id));
46920
47149
  }
46921
47150
  });
46922
47151
  }
@@ -47838,8 +48067,8 @@ function MotionPathLine(props) {
47838
48067
  // src/utils/keyframeUsage.ts
47839
48068
  function keyframeUsageActions(mutations, semanticActions) {
47840
48069
  const actions = /* @__PURE__ */ new Set();
47841
- for (const [index, mutation] of mutations.entries()) {
47842
- const semanticAction = semanticActions?.[index];
48070
+ for (const [index2, mutation] of mutations.entries()) {
48071
+ const semanticAction = semanticActions?.[index2];
47843
48072
  if (semanticAction) {
47844
48073
  actions.add(semanticAction);
47845
48074
  continue;
@@ -47871,16 +48100,16 @@ function changedMutationIndices(result, count, options) {
47871
48100
  if (!Array.isArray(changes) || changes.length !== count || changes.some((value) => typeof value !== "boolean"))
47872
48101
  return [];
47873
48102
  return changes.flatMap(
47874
- (changed, index) => changed && options?.[index]?.keyframeTelemetry !== false ? [index] : []
48103
+ (changed, index2) => changed && options?.[index2]?.keyframeTelemetry !== false ? [index2] : []
47875
48104
  );
47876
48105
  }
47877
48106
  function trackKeyframeCommit(mutations, result, options, memberOptions) {
47878
48107
  if (!result.ok || result.changed !== true || options.keyframeTelemetry === false) return;
47879
48108
  const indices = changedMutationIndices(result, mutations.length, memberOptions);
47880
48109
  const actions = keyframeUsageActions(
47881
- indices.map((index) => mutations[index]),
48110
+ indices.map((index2) => mutations[index2]),
47882
48111
  indices.map(
47883
- (index) => memberOptions?.[index]?.keyframeAction ?? (mutations.length === 1 ? options.keyframeAction : void 0)
48112
+ (index2) => memberOptions?.[index2]?.keyframeAction ?? (mutations.length === 1 ? options.keyframeAction : void 0)
47884
48113
  )
47885
48114
  );
47886
48115
  const action = primaryKeyframeAction(actions);
@@ -47910,7 +48139,7 @@ function observeGsapGesture(writer) {
47910
48139
  result,
47911
48140
  calls.length,
47912
48141
  calls.map((call) => call.options)
47913
- ).map((index) => calls[index]);
48142
+ ).map((index2) => calls[index2]);
47914
48143
  for (const action of keyframeUsageActions(
47915
48144
  members.map((call) => call.mutation),
47916
48145
  members.map((call) => call.options.keyframeAction)
@@ -48267,9 +48496,9 @@ function commitNodeDrop(drop) {
48267
48496
  }
48268
48497
  return done.then(() => trackPreviewEditResult("motion_path", "drag", writes.finish()));
48269
48498
  }
48270
- function commitAddWaypoint(animationId, index, x, y, commit2) {
48499
+ function commitAddWaypoint(animationId, index2, x, y, commit2) {
48271
48500
  return commit2(
48272
- { type: "add-motion-path-point", animationId, index, x, y },
48501
+ { type: "add-motion-path-point", animationId, index: index2, x, y },
48273
48502
  motionPathCommitOptions("Add waypoint", "button")
48274
48503
  );
48275
48504
  }
@@ -48279,9 +48508,9 @@ function commitAddKeyframe(animationId, percentage, x, y, commit2) {
48279
48508
  motionPathCommitOptions("Add keyframe", "button")
48280
48509
  );
48281
48510
  }
48282
- function commitRemoveWaypoint(animationId, index, commit2) {
48511
+ function commitRemoveWaypoint(animationId, index2, commit2) {
48283
48512
  return commit2(
48284
- { type: "remove-motion-path-point", animationId, index },
48513
+ { type: "remove-motion-path-point", animationId, index: index2 },
48285
48514
  motionPathCommitOptions("Remove waypoint", "button")
48286
48515
  );
48287
48516
  }
@@ -48608,15 +48837,15 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48608
48837
  const top = vr ? vr.top : rect.top;
48609
48838
  return { x: (e.clientX - left) / scale, y: (e.clientY - top) / scale };
48610
48839
  };
48611
- const onDown = (e, index, x, y, ref) => {
48840
+ const onDown = (e, index2, x, y, ref) => {
48612
48841
  if (!interactive) return;
48613
48842
  if (e.button !== 0) return;
48614
48843
  e.stopPropagation();
48615
48844
  const live = readGsapPositionFromIframe(iframeRef.current, selectorFor(selection) ?? "");
48616
- if (pressControl(e, controlForNode(e, abs[index], live))) return;
48845
+ if (pressControl(e, controlForNode(e, abs[index2], live))) return;
48617
48846
  e.target.setPointerCapture(e.pointerId);
48618
48847
  dragRef.current = {
48619
- index,
48848
+ index: index2,
48620
48849
  startX: e.clientX,
48621
48850
  startY: e.clientY,
48622
48851
  initX: x,
@@ -48625,7 +48854,7 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48625
48854
  pScale,
48626
48855
  ref
48627
48856
  };
48628
- setDraft({ index, x, y });
48857
+ setDraft({ index: index2, x, y });
48629
48858
  };
48630
48859
  const onMove = (e) => {
48631
48860
  const d = dragRef.current;
@@ -48715,11 +48944,11 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48715
48944
  }
48716
48945
  setGhost(null);
48717
48946
  };
48718
- const onRemove = (e, index) => {
48947
+ const onRemove = (e, index2) => {
48719
48948
  e.stopPropagation();
48720
48949
  if (!animId) return;
48721
48950
  setHoverNode(null);
48722
- void commitRemoveWaypoint(animId, index, commitMutation);
48951
+ void commitRemoveWaypoint(animId, index2, commitMutation);
48723
48952
  };
48724
48953
  const elementId2 = selection?.id ?? null;
48725
48954
  const onNodeContextMenu = (e, ref) => {
@@ -50086,12 +50315,12 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
50086
50315
  if (isPosOnly) {
50087
50316
  continue;
50088
50317
  }
50089
- const entry2 = {
50318
+ const entry3 = {
50090
50319
  format: "percentage",
50091
50320
  keyframes: data.keyframes,
50092
50321
  ...data.easeEach ? { easeEach: data.easeEach } : {}
50093
50322
  };
50094
- for (const key2 of keys) draft.keyframeCache.set(key2, entry2);
50323
+ for (const key2 of keys) draft.keyframeCache.set(key2, entry3);
50095
50324
  }
50096
50325
  });
50097
50326
  runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${version}`;
@@ -51219,7 +51448,7 @@ async function studioSetStyle(deps, input, signal = new AbortController().signal
51219
51448
  );
51220
51449
  }
51221
51450
  const entries = Object.entries(styles).filter(
51222
- (entry2) => typeof entry2[1] === "string"
51451
+ (entry3) => typeof entry3[1] === "string"
51223
51452
  );
51224
51453
  if (entries.length === 0) {
51225
51454
  return preDispatchFailure(
@@ -52163,11 +52392,11 @@ function onTabKeyDown(event, tab, api) {
52163
52392
  const tabs = [
52164
52393
  ...tab.closest('[role="tablist"]')?.querySelectorAll('[role="tab"]') ?? []
52165
52394
  ];
52166
- const index = tabs.indexOf(tab);
52395
+ const index2 = tabs.indexOf(tab);
52167
52396
  const last = tabs.length - 1;
52168
52397
  const targets = {
52169
- ArrowRight: index === last ? 0 : index + 1,
52170
- ArrowLeft: index === 0 ? last : index - 1,
52398
+ ArrowRight: index2 === last ? 0 : index2 + 1,
52399
+ ArrowLeft: index2 === 0 ? last : index2 - 1,
52171
52400
  Home: 0,
52172
52401
  End: last
52173
52402
  };
@@ -53180,7 +53409,7 @@ var ImageThumbnail = memo36(function ImageThumbnail2({
53180
53409
  frameW,
53181
53410
  frameCount,
53182
53411
  watchGap: watchGap2,
53183
- children: (index) => /* @__PURE__ */ jsx118(
53412
+ children: (index2) => /* @__PURE__ */ jsx118(
53184
53413
  "div",
53185
53414
  {
53186
53415
  className: "relative h-full shrink-0 overflow-hidden bg-neutral-900",
@@ -53196,7 +53425,7 @@ var ImageThumbnail = memo36(function ImageThumbnail2({
53196
53425
  }
53197
53426
  )
53198
53427
  },
53199
- index
53428
+ index2
53200
53429
  )
53201
53430
  }
53202
53431
  ),
@@ -54227,14 +54456,14 @@ function splitCssFunctions(value) {
54227
54456
  const functions = [];
54228
54457
  let depth = 0;
54229
54458
  let start = 0;
54230
- for (let index = 0; index < source.length; index += 1) {
54231
- const char = source[index];
54459
+ for (let index2 = 0; index2 < source.length; index2 += 1) {
54460
+ const char = source[index2];
54232
54461
  if (char === "(") depth += 1;
54233
54462
  if (char === ")") depth = Math.max(0, depth - 1);
54234
54463
  if (/\s/.test(char) && depth === 0) {
54235
- const part = source.slice(start, index).trim();
54464
+ const part = source.slice(start, index2).trim();
54236
54465
  if (part) functions.push(part);
54237
- start = index + 1;
54466
+ start = index2 + 1;
54238
54467
  }
54239
54468
  }
54240
54469
  const lastPart = source.slice(start).trim();
@@ -54256,7 +54485,7 @@ function setCssFilterFunctionPx(value, name, nextPx) {
54256
54485
  const nextValue = clampPanelNumber(nextPx, 0, 200, 0);
54257
54486
  const functions = splitCssFunctions(value && value.trim() !== EMPTY_FILTER_VALUE ? value : "");
54258
54487
  const lowerName = name.toLowerCase();
54259
- const filtered = functions.filter((entry2) => !entry2.toLowerCase().startsWith(`${lowerName}(`));
54488
+ const filtered = functions.filter((entry3) => !entry3.toLowerCase().startsWith(`${lowerName}(`));
54260
54489
  if (nextValue > 0) filtered.push(`${name}(${formatNumericValue(nextValue)}px)`);
54261
54490
  return filtered.length > 0 ? filtered.join(" ") : EMPTY_FILTER_VALUE;
54262
54491
  }
@@ -54302,19 +54531,19 @@ function extractBackgroundImageUrl(value) {
54302
54531
  const lowerValue = value.toLowerCase();
54303
54532
  const urlStart = lowerValue.indexOf("url(");
54304
54533
  if (urlStart < 0) return "";
54305
- let index = urlStart + 4;
54306
- while (index < value.length && (value[index] === " " || value[index] === "\n" || value[index] === "\r" || value[index] === " " || value[index] === "\f")) {
54307
- index += 1;
54534
+ let index2 = urlStart + 4;
54535
+ while (index2 < value.length && (value[index2] === " " || value[index2] === "\n" || value[index2] === "\r" || value[index2] === " " || value[index2] === "\f")) {
54536
+ index2 += 1;
54308
54537
  }
54309
- const quote = value[index] === '"' || value[index] === "'" ? value[index] : null;
54538
+ const quote = value[index2] === '"' || value[index2] === "'" ? value[index2] : null;
54310
54539
  if (quote) {
54311
- index += 1;
54312
- const endQuote = value.indexOf(quote, index);
54313
- return endQuote >= index ? value.slice(index, endQuote) : "";
54540
+ index2 += 1;
54541
+ const endQuote = value.indexOf(quote, index2);
54542
+ return endQuote >= index2 ? value.slice(index2, endQuote) : "";
54314
54543
  }
54315
- const endParen = value.indexOf(")", index);
54316
- if (endParen < index) return "";
54317
- return value.slice(index, endParen).trim();
54544
+ const endParen = value.indexOf(")", index2);
54545
+ if (endParen < index2) return "";
54546
+ return value.slice(index2, endParen).trim();
54318
54547
  }
54319
54548
  var ALWAYS_READ_CHANNELS = [
54320
54549
  "x",
@@ -56497,9 +56726,9 @@ function stripPreviewAssetPath(src, projectId) {
56497
56726
  const projectMarker = `/api/projects/${encodeURIComponent(projectId)}/preview/`;
56498
56727
  const genericMarker = "/preview/";
56499
56728
  const marker = pathname.includes(projectMarker) ? projectMarker : genericMarker;
56500
- const index = pathname.indexOf(marker);
56501
- if (index < 0) return null;
56502
- const assetPath = decodeURIComponent(pathname.slice(index + marker.length)).replace(/^\/+/, "");
56729
+ const index2 = pathname.indexOf(marker);
56730
+ if (index2 < 0) return null;
56731
+ const assetPath = decodeURIComponent(pathname.slice(index2 + marker.length)).replace(/^\/+/, "");
56503
56732
  if (!assetPath || assetPath.startsWith("comp/")) return null;
56504
56733
  return assetPath;
56505
56734
  }
@@ -57880,7 +58109,7 @@ function FontFamilyField({
57880
58109
  const importLocalFont = async (family) => {
57881
58110
  if (!onImportFonts) return null;
57882
58111
  const candidates = localFontData.filter((f) => fontFamilyFromAssetPath(`${f.family}.ttf`) === family).sort((a, b) => localFontSortScore(a) - localFontSortScore(b));
57883
- const font = candidates.find((entry2) => typeof entry2.blob === "function");
58112
+ const font = candidates.find((entry3) => typeof entry3.blob === "function");
57884
58113
  if (!font?.blob) return null;
57885
58114
  const blob = await font.blob();
57886
58115
  const style = sanitizeFontFilePart(font.style ?? "Regular") || "Regular";
@@ -58009,13 +58238,13 @@ function FontFamilyField({
58009
58238
  )
58010
58239
  ] }),
58011
58240
  fontNotice && /* @__PURE__ */ jsx132("div", { className: "border-b border-neutral-800 px-3 py-2 text-[10px] leading-4 text-neutral-500", children: fontNotice }),
58012
- /* @__PURE__ */ jsx132("div", { className: "max-h-64 overflow-y-auto p-1", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx132("div", { className: "px-2 py-3 text-[11px] text-neutral-500", children: "No fonts found." }) : filteredOptions.map((option, index) => /* @__PURE__ */ jsxs94(
58241
+ /* @__PURE__ */ jsx132("div", { className: "max-h-64 overflow-y-auto p-1", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx132("div", { className: "px-2 py-3 text-[11px] text-neutral-500", children: "No fonts found." }) : filteredOptions.map((option, index2) => /* @__PURE__ */ jsxs94(
58013
58242
  "button",
58014
58243
  {
58015
58244
  type: "button",
58016
- "data-font-option-index": index,
58245
+ "data-font-option-index": index2,
58017
58246
  onClick: () => commitFamily(option),
58018
- className: `flex w-full min-w-0 items-center justify-between gap-3 rounded-lg px-2 py-2 text-left text-[11px] transition-colors ${index === activeIndex ? "bg-neutral-800 text-neutral-50" : option.family === currentFamily ? "bg-studio-accent/15 text-neutral-50" : "text-neutral-300 hover:bg-neutral-900 hover:text-neutral-100"}`,
58247
+ className: `flex w-full min-w-0 items-center justify-between gap-3 rounded-lg px-2 py-2 text-left text-[11px] transition-colors ${index2 === activeIndex ? "bg-neutral-800 text-neutral-50" : option.family === currentFamily ? "bg-studio-accent/15 text-neutral-50" : "text-neutral-300 hover:bg-neutral-900 hover:text-neutral-100"}`,
58019
58248
  children: [
58020
58249
  /* @__PURE__ */ jsxs94("span", { className: "flex min-w-0 items-center gap-1.5", children: [
58021
58250
  /* @__PURE__ */ jsx132("span", { className: "truncate font-medium", style: { fontFamily: `"${option.family}"` }, children: option.family }),
@@ -58643,20 +58872,20 @@ function isDigit(char) {
58643
58872
  }
58644
58873
  function isSimpleNumber(value) {
58645
58874
  if (!value) return false;
58646
- let index = value[0] === "-" ? 1 : 0;
58875
+ let index2 = value[0] === "-" ? 1 : 0;
58647
58876
  let digits = 0;
58648
- while (isDigit(value[index])) {
58649
- index += 1;
58877
+ while (isDigit(value[index2])) {
58878
+ index2 += 1;
58650
58879
  digits += 1;
58651
58880
  }
58652
- if (value[index] === ".") {
58653
- index += 1;
58654
- while (isDigit(value[index])) {
58655
- index += 1;
58881
+ if (value[index2] === ".") {
58882
+ index2 += 1;
58883
+ while (isDigit(value[index2])) {
58884
+ index2 += 1;
58656
58885
  digits += 1;
58657
58886
  }
58658
58887
  }
58659
- return digits > 0 && index === value.length;
58888
+ return digits > 0 && index2 === value.length;
58660
58889
  }
58661
58890
  function parseCssNumber(value) {
58662
58891
  if (!value) return null;
@@ -58740,9 +58969,9 @@ function normalizeStops(stops) {
58740
58969
  { color: stops[0].color, position: 100 }
58741
58970
  ];
58742
58971
  }
58743
- const result = stops.map((stop2, index) => ({
58972
+ const result = stops.map((stop2, index2) => ({
58744
58973
  color: stop2.color,
58745
- position: stop2.position ?? index / (stops.length - 1) * 100
58974
+ position: stop2.position ?? index2 / (stops.length - 1) * 100
58746
58975
  }));
58747
58976
  return result.map((stop2) => ({
58748
58977
  color: stop2.color,
@@ -59167,8 +59396,8 @@ function GradientField({
59167
59396
  const parsed = parseGradient(value) ?? buildDefaultGradientModel(fallbackColor);
59168
59397
  const commit2 = (next) => onCommit(serializeGradient(next));
59169
59398
  const patch = (partial) => commit2({ ...parsed, ...partial });
59170
- const updateStop = (index, partial) => {
59171
- const stops = parsed.stops.map((stop2, i) => i === index ? { ...stop2, ...partial } : stop2);
59399
+ const updateStop = (index2, partial) => {
59400
+ const stops = parsed.stops.map((stop2, i) => i === index2 ? { ...stop2, ...partial } : stop2);
59172
59401
  commit2({ ...parsed, stops });
59173
59402
  };
59174
59403
  const addStop = (position) => {
@@ -59179,10 +59408,10 @@ function GradientField({
59179
59408
  track2("button", "Add gradient stop");
59180
59409
  commit2(nextGradient);
59181
59410
  };
59182
- const removeStop = (index) => {
59411
+ const removeStop = (index2) => {
59183
59412
  if (parsed.stops.length <= 2) return;
59184
- track2("button", `Remove gradient stop ${index + 1}`);
59185
- commit2({ ...parsed, stops: parsed.stops.filter((_, i) => i !== index) });
59413
+ track2("button", `Remove gradient stop ${index2 + 1}`);
59414
+ commit2({ ...parsed, stops: parsed.stops.filter((_, i) => i !== index2) });
59186
59415
  };
59187
59416
  const previewStyle = { backgroundImage: serializeGradient(parsed) };
59188
59417
  return /* @__PURE__ */ jsxs99("div", { className: "space-y-4", children: [
@@ -59199,12 +59428,12 @@ function GradientField({
59199
59428
  if (!rect || rect.width <= 0) return;
59200
59429
  addStop((event.clientX - rect.left) / rect.width * 100);
59201
59430
  },
59202
- children: parsed.stops.map((stop2, index) => /* @__PURE__ */ jsx138(
59431
+ children: parsed.stops.map((stop2, index2) => /* @__PURE__ */ jsx138(
59203
59432
  "div",
59204
59433
  {
59205
59434
  role: "slider",
59206
59435
  tabIndex: disabled ? -1 : 0,
59207
- "aria-label": `Stop ${index + 1} position`,
59436
+ "aria-label": `Stop ${index2 + 1} position`,
59208
59437
  "aria-valuenow": Math.round(stop2.position),
59209
59438
  "aria-valuemin": 0,
59210
59439
  "aria-valuemax": 100,
@@ -59214,7 +59443,7 @@ function GradientField({
59214
59443
  event.preventDefault();
59215
59444
  const step = event.shiftKey ? 10 : 1;
59216
59445
  const delta = event.key === "ArrowRight" ? step : -step;
59217
- updateStop(index, {
59446
+ updateStop(index2, {
59218
59447
  position: Math.max(0, Math.min(100, Math.round(stop2.position + delta)))
59219
59448
  });
59220
59449
  },
@@ -59237,7 +59466,7 @@ function GradientField({
59237
59466
  0,
59238
59467
  Math.min(100, (event.clientX - rect.left) / rect.width * 100)
59239
59468
  );
59240
- updateStop(index, { position: Math.round(next * 10) / 10 });
59469
+ updateStop(index2, { position: Math.round(next * 10) / 10 });
59241
59470
  },
59242
59471
  onPointerUp: (event) => {
59243
59472
  event.currentTarget.releasePointerCapture(event.pointerId);
@@ -59246,7 +59475,7 @@ function GradientField({
59246
59475
  event.currentTarget.releasePointerCapture(event.pointerId);
59247
59476
  }
59248
59477
  },
59249
- `stop-preview-${index}`
59478
+ `stop-preview-${index2}`
59250
59479
  ))
59251
59480
  }
59252
59481
  ),
@@ -59398,7 +59627,7 @@ function GradientField({
59398
59627
  }
59399
59628
  )
59400
59629
  ] }),
59401
- /* @__PURE__ */ jsx138("div", { className: "space-y-3", children: parsed.stops.map((stop2, index) => /* @__PURE__ */ jsxs99(
59630
+ /* @__PURE__ */ jsx138("div", { className: "space-y-3", children: parsed.stops.map((stop2, index2) => /* @__PURE__ */ jsxs99(
59402
59631
  "div",
59403
59632
  {
59404
59633
  className: "grid min-w-0 grid-cols-[minmax(0,1fr)_68px_28px] gap-2",
@@ -59406,10 +59635,10 @@ function GradientField({
59406
59635
  /* @__PURE__ */ jsx138(
59407
59636
  ColorField,
59408
59637
  {
59409
- label: `Stop ${index + 1}`,
59638
+ label: `Stop ${index2 + 1}`,
59410
59639
  value: stop2.color,
59411
59640
  disabled,
59412
- onCommit: (next) => updateStop(index, { color: next })
59641
+ onCommit: (next) => updateStop(index2, { color: next })
59413
59642
  }
59414
59643
  ),
59415
59644
  /* @__PURE__ */ jsx138(
@@ -59418,7 +59647,7 @@ function GradientField({
59418
59647
  label: "Pos",
59419
59648
  value: `${Math.round(stop2.position)}%`,
59420
59649
  disabled,
59421
- onCommit: (next) => updateStop(index, {
59650
+ onCommit: (next) => updateStop(index2, {
59422
59651
  position: Number.parseFloat(next.replace("%", "")) || 0
59423
59652
  })
59424
59653
  }
@@ -59428,15 +59657,15 @@ function GradientField({
59428
59657
  {
59429
59658
  type: "button",
59430
59659
  disabled: disabled || parsed.stops.length <= 2,
59431
- onClick: () => removeStop(index),
59660
+ onClick: () => removeStop(index2),
59432
59661
  className: "mt-[22px] flex h-10 items-center justify-center rounded-lg border border-neutral-700 bg-neutral-950 text-neutral-400 transition-colors hover:border-neutral-600 hover:text-text-0 disabled:cursor-not-allowed disabled:text-text-off",
59433
- "aria-label": `Remove stop ${index + 1}`,
59662
+ "aria-label": `Remove stop ${index2 + 1}`,
59434
59663
  children: /* @__PURE__ */ jsx138(X, { size: 12 })
59435
59664
  }
59436
59665
  )
59437
59666
  ]
59438
59667
  },
59439
- `stop-editor-${index}`
59668
+ `stop-editor-${index2}`
59440
59669
  )) })
59441
59670
  ] })
59442
59671
  ] });
@@ -60100,11 +60329,11 @@ function detectAvailableWeights(fontFamily) {
60100
60329
  if (!fonts) return ALL_WEIGHTS;
60101
60330
  const family = fontFamily.split(",")[0]?.trim().replace(/['"]/g, "");
60102
60331
  if (!family) return ALL_WEIGHTS;
60103
- const available = [];
60332
+ const available2 = [];
60104
60333
  for (const w of ALL_WEIGHTS) {
60105
- if (fonts.check(`${w} 16px "${family}"`)) available.push(w);
60334
+ if (fonts.check(`${w} 16px "${family}"`)) available2.push(w);
60106
60335
  }
60107
- return available.length > 0 ? available : ALL_WEIGHTS;
60336
+ return available2.length > 0 ? available2 : ALL_WEIGHTS;
60108
60337
  }
60109
60338
  function TextAreaField({
60110
60339
  label,
@@ -60479,7 +60708,7 @@ function TextSection({
60479
60708
  }
60480
60709
  )
60481
60710
  ] }),
60482
- /* @__PURE__ */ jsx141("div", { className: "grid gap-2", children: textFields.map((field, index) => {
60711
+ /* @__PURE__ */ jsx141("div", { className: "grid gap-2", children: textFields.map((field, index2) => {
60483
60712
  const active = field.key === activeField.key;
60484
60713
  return /* @__PURE__ */ jsx141(
60485
60714
  "button",
@@ -60496,7 +60725,7 @@ function TextSection({
60496
60725
  style: { backgroundColor: getTextFieldColor(field, styles) }
60497
60726
  }
60498
60727
  ),
60499
- /* @__PURE__ */ jsx141("span", { className: "min-w-0 truncate text-[11px] font-medium text-neutral-100", children: formatTextFieldPreview(field.value) || `Text ${index + 1}` })
60728
+ /* @__PURE__ */ jsx141("span", { className: "min-w-0 truncate text-[11px] font-medium text-neutral-100", children: formatTextFieldPreview(field.value) || `Text ${index2 + 1}` })
60500
60729
  ] }),
60501
60730
  /* @__PURE__ */ jsx141("span", { className: "shrink-0 rounded-md border border-neutral-700 bg-neutral-950 px-1.5 py-0.5 text-[10px] text-neutral-500", children: field.tagName })
60502
60731
  ] })
@@ -61010,7 +61239,7 @@ function PropertyRow({
61010
61239
  }
61011
61240
  function AddPropertyTrigger({
61012
61241
  adding,
61013
- available,
61242
+ available: available2,
61014
61243
  addLabel,
61015
61244
  addTitle,
61016
61245
  onAdd,
@@ -61018,7 +61247,7 @@ function AddPropertyTrigger({
61018
61247
  onClose,
61019
61248
  buttonClassName
61020
61249
  }) {
61021
- if (adding && available.length > 0) {
61250
+ if (adding && available2.length > 0) {
61022
61251
  return /* @__PURE__ */ jsxs106(
61023
61252
  "select",
61024
61253
  {
@@ -61032,12 +61261,12 @@ function AddPropertyTrigger({
61032
61261
  onBlur: onClose,
61033
61262
  children: [
61034
61263
  /* @__PURE__ */ jsx145("option", { value: "", disabled: true, children: "Choose property\u2026" }),
61035
- available.map((p) => /* @__PURE__ */ jsx145("option", { value: p, children: PROP_LABELS[p] ?? p }, p))
61264
+ available2.map((p) => /* @__PURE__ */ jsx145("option", { value: p, children: PROP_LABELS[p] ?? p }, p))
61036
61265
  ]
61037
61266
  }
61038
61267
  );
61039
61268
  }
61040
- if (available.length === 0) return null;
61269
+ if (available2.length === 0) return null;
61041
61270
  return /* @__PURE__ */ jsx145("button", { type: "button", onClick: onOpen, className: buttonClassName, title: addTitle, children: addLabel });
61042
61271
  }
61043
61272
  function parseNumericOrString(raw) {
@@ -61405,7 +61634,7 @@ var AnimationCard = memo39(function AnimationCard2({
61405
61634
  enabled,
61406
61635
  segments: animation2.arcPath?.segments
61407
61636
  }),
61408
- onUpdateSegment: (index, update) => onUpdateArcSegment?.(animation2.id, index, update),
61637
+ onUpdateSegment: (index2, update) => onUpdateArcSegment?.(animation2.id, index2, update),
61409
61638
  onToggleAutoRotate: (autoRotate) => onSetArcPath(animation2.id, {
61410
61639
  enabled: true,
61411
61640
  autoRotate,
@@ -61611,13 +61840,13 @@ function GsapAnimationList({
61611
61840
  }, [focusedHere]);
61612
61841
  return /* @__PURE__ */ jsxs109("div", { className: "space-y-2", children: [
61613
61842
  animations.length === 0 && /* @__PURE__ */ jsx148("p", { className: "text-[11px] leading-4 text-neutral-500", children: "No animations on this element yet. Add an effect below to animate it." }),
61614
- animations.map((animation2, index) => /* @__PURE__ */ createElement2(
61843
+ animations.map((animation2, index2) => /* @__PURE__ */ createElement2(
61615
61844
  AnimationCard,
61616
61845
  {
61617
61846
  ...trackedCallbacks,
61618
61847
  key: animation2.id,
61619
61848
  animation: animation2,
61620
- defaultExpanded: index === 0,
61849
+ defaultExpanded: index2 === 0,
61621
61850
  flat: variant === "flat",
61622
61851
  focusedSegment: focusedHere?.animationId === animation2.id ? focusedHere : null,
61623
61852
  onFocusSegmentConsumed: consumeFocusedEaseSegment
@@ -62803,7 +63032,7 @@ function FlatSegmentedRow({
62803
63032
  const track2 = useTrackDesignInput();
62804
63033
  return /* @__PURE__ */ jsxs116("div", { className: "flex min-h-[32px] items-center justify-between", children: [
62805
63034
  /* @__PURE__ */ jsx156("span", { className: "text-[11px] text-panel-text-3", children: label }),
62806
- /* @__PURE__ */ jsx156("span", { className: "flex items-center gap-0.5", children: options.map((option, index) => /* @__PURE__ */ jsxs116("span", { className: "flex items-center", children: [
63035
+ /* @__PURE__ */ jsx156("span", { className: "flex items-center gap-0.5", children: options.map((option, index2) => /* @__PURE__ */ jsxs116("span", { className: "flex items-center", children: [
62807
63036
  /* @__PURE__ */ jsx156(
62808
63037
  "button",
62809
63038
  {
@@ -62820,7 +63049,7 @@ function FlatSegmentedRow({
62820
63049
  children: option.node
62821
63050
  }
62822
63051
  ),
62823
- spacerAfterIndex === index && /* @__PURE__ */ jsx156("span", { className: "w-3", "aria-hidden": "true" })
63052
+ spacerAfterIndex === index2 && /* @__PURE__ */ jsx156("span", { className: "w-3", "aria-hidden": "true" })
62824
63053
  ] }, option.key)) })
62825
63054
  ] });
62826
63055
  }
@@ -63433,7 +63662,7 @@ function FlatTextLayerList({
63433
63662
  const track2 = useTrackDesignInput();
63434
63663
  return /* @__PURE__ */ jsxs117("div", { className: "mb-2 border-l-2 border-panel-border-input py-0.5 pl-[10px]", children: [
63435
63664
  /* @__PURE__ */ jsx158("div", { className: "mb-1.5 text-[9px] font-semibold uppercase tracking-[0.12em] text-panel-text-5", children: "Text layers" }),
63436
- /* @__PURE__ */ jsx158("div", { className: "space-y-1", children: fields.map((field, index) => {
63665
+ /* @__PURE__ */ jsx158("div", { className: "space-y-1", children: fields.map((field, index2) => {
63437
63666
  const active = field.key === activeFieldKey;
63438
63667
  return /* @__PURE__ */ jsxs117(
63439
63668
  "div",
@@ -63450,7 +63679,7 @@ function FlatTextLayerList({
63450
63679
  style: { backgroundColor: getTextFieldColor(field, styles) }
63451
63680
  }
63452
63681
  ),
63453
- /* @__PURE__ */ jsx158("span", { className: "min-w-0 flex-1 truncate text-[11px] text-panel-text-1", children: formatTextFieldPreview(field.value) || `Text ${index + 1}` }),
63682
+ /* @__PURE__ */ jsx158("span", { className: "min-w-0 flex-1 truncate text-[11px] text-panel-text-1", children: formatTextFieldPreview(field.value) || `Text ${index2 + 1}` }),
63454
63683
  /* @__PURE__ */ jsx158("span", { className: "shrink-0 font-mono text-[9px] text-panel-text-4", children: field.tagName }),
63455
63684
  fields.length > 1 && /* @__PURE__ */ jsx158(
63456
63685
  "button",
@@ -64542,11 +64771,11 @@ function audioFxRevealTarget(target, chain) {
64542
64771
  if (parsed.kind === "volume") return { kind: "volume" };
64543
64772
  if (parsed.kind === "rate") return null;
64544
64773
  if (parsed.kind === "preset") {
64545
- const index2 = (chain?.nodes ?? []).findIndex((node2) => node2.fromPreset === parsed.presetId);
64546
- return index2 >= 0 ? { kind: "preset", runKey: `${parsed.presetId}-${index2}` } : null;
64774
+ const index3 = (chain?.nodes ?? []).findIndex((node2) => node2.fromPreset === parsed.presetId);
64775
+ return index3 >= 0 ? { kind: "preset", runKey: `${parsed.presetId}-${index3}` } : null;
64547
64776
  }
64548
- const index = (chain?.nodes ?? []).findIndex((node2) => node2.id === parsed.nodeId);
64549
- const node = index >= 0 ? chain?.nodes[index] : void 0;
64777
+ const index2 = (chain?.nodes ?? []).findIndex((node2) => node2.id === parsed.nodeId);
64778
+ const node = index2 >= 0 ? chain?.nodes[index2] : void 0;
64550
64779
  if (!node) return null;
64551
64780
  if (node.fromCarve) return { kind: "carve" };
64552
64781
  if (node.fromEq) return { kind: "eq", eqId: node.fromEq };
@@ -64554,7 +64783,7 @@ function audioFxRevealTarget(target, chain) {
64554
64783
  const first = (chain?.nodes ?? []).findIndex((n) => n.fromPreset === node.fromPreset);
64555
64784
  return { kind: "preset", runKey: `${node.fromPreset}-${first}` };
64556
64785
  }
64557
- return { kind: "node", index, nodeId: parsed.nodeId };
64786
+ return { kind: "node", index: index2, nodeId: parsed.nodeId };
64558
64787
  }
64559
64788
  function revealRowSelector(where) {
64560
64789
  if (!where) return null;
@@ -64849,8 +65078,8 @@ function fxFamilyOf(node) {
64849
65078
  function fxFamilyTint(node) {
64850
65079
  const family = fxFamilyOf(node);
64851
65080
  const siblings = HF_AUDIO_FX.filter((def) => fxFamilyOf({ type: def.id }) === family);
64852
- const index = siblings.findIndex((def) => def.id === node.type);
64853
- const step = siblings.length > 1 ? Math.max(0, index) / (siblings.length - 1) : 0;
65081
+ const index2 = siblings.findIndex((def) => def.id === node.type);
65082
+ const step = siblings.length > 1 ? Math.max(0, index2) / (siblings.length - 1) : 0;
64854
65083
  return `hsl(${FAMILY_HUE[family]}, 32%, ${(62 + step * 14).toFixed(1)}%)`;
64855
65084
  }
64856
65085
 
@@ -65557,7 +65786,7 @@ function automatedKeysOf(node, params, automatedTargets) {
65557
65786
  function FxNodeParams({
65558
65787
  node,
65559
65788
  def,
65560
- index,
65789
+ index: index2,
65561
65790
  disabled,
65562
65791
  automatedTargets,
65563
65792
  liveAutomationValues,
@@ -65585,7 +65814,7 @@ function FxNodeParams({
65585
65814
  params: node.params ?? defaultAudioFxParams3(node.type),
65586
65815
  liveValues,
65587
65816
  disabled,
65588
- onChange: (params) => onPreview(index, params),
65817
+ onChange: (params) => onPreview(index2, params),
65589
65818
  onCommit: (next) => {
65590
65819
  const before = node.params ?? defaultAudioFxParams3(node.type);
65591
65820
  for (const [key2, value] of Object.entries(next)) {
@@ -65594,7 +65823,7 @@ function FxNodeParams({
65594
65823
  trackParamCommitted(node.type, key2, value, "details", { trackKind });
65595
65824
  trackInput(typeof value === "number" ? "slider" : "select", key2);
65596
65825
  }
65597
- onUpdate(index, { params: next });
65826
+ onUpdate(index2, { params: next });
65598
65827
  },
65599
65828
  automatedKeys: automatedKeysOf(node, def.params, automatedTargets),
65600
65829
  onAutomate: nodeId && onAutomateParam ? (key2) => {
@@ -65618,7 +65847,7 @@ function FxNodeDerivedKnob({
65618
65847
  disabled,
65619
65848
  bypassed,
65620
65849
  params,
65621
- index,
65850
+ index: index2,
65622
65851
  onPreview,
65623
65852
  onUpdate,
65624
65853
  trackKind
@@ -65632,10 +65861,10 @@ function FxNodeDerivedKnob({
65632
65861
  param: derived,
65633
65862
  value: audioFxProfileStrength(node.type, params),
65634
65863
  disabled: Boolean(disabled) || bypassed,
65635
- onChange: (_k, v) => onPreview(index, applyAudioFxProfile(node.type, Number(v), params)),
65864
+ onChange: (_k, v) => onPreview(index2, applyAudioFxProfile(node.type, Number(v), params)),
65636
65865
  onCommit: (_k, v) => {
65637
65866
  trackProfileCommitted(node.type, Number(v), { trackKind });
65638
- onUpdate(index, { params: applyAudioFxProfile(node.type, Number(v), params) });
65867
+ onUpdate(index2, { params: applyAudioFxProfile(node.type, Number(v), params) });
65639
65868
  trackInput("slider", "profile-strength");
65640
65869
  }
65641
65870
  }
@@ -65652,7 +65881,7 @@ function FxNodePrimaryKnob({
65652
65881
  primary,
65653
65882
  copy,
65654
65883
  params,
65655
- index,
65884
+ index: index2,
65656
65885
  disabled,
65657
65886
  bypassed,
65658
65887
  automatedTargets,
@@ -65670,7 +65899,7 @@ function FxNodePrimaryKnob({
65670
65899
  {
65671
65900
  node,
65672
65901
  def: onlyPrimary,
65673
- index,
65902
+ index: index2,
65674
65903
  disabled: Boolean(disabled) || bypassed,
65675
65904
  automatedTargets,
65676
65905
  liveAutomationValues,
@@ -65701,7 +65930,7 @@ function FxNodeOpenBody({
65701
65930
  onToggleDetails,
65702
65931
  copy,
65703
65932
  params,
65704
- index,
65933
+ index: index2,
65705
65934
  disabled,
65706
65935
  bypassed,
65707
65936
  automatedTargets,
@@ -65723,7 +65952,7 @@ function FxNodeOpenBody({
65723
65952
  disabled,
65724
65953
  bypassed,
65725
65954
  params,
65726
- index,
65955
+ index: index2,
65727
65956
  onPreview,
65728
65957
  onUpdate,
65729
65958
  trackKind
@@ -65737,7 +65966,7 @@ function FxNodeOpenBody({
65737
65966
  primary,
65738
65967
  copy,
65739
65968
  params,
65740
- index,
65969
+ index: index2,
65741
65970
  disabled,
65742
65971
  bypassed,
65743
65972
  automatedTargets,
@@ -65771,7 +66000,7 @@ function FxNodeOpenBody({
65771
66000
  {
65772
66001
  node,
65773
66002
  def,
65774
- index,
66003
+ index: index2,
65775
66004
  disabled: Boolean(disabled) || bypassed,
65776
66005
  automatedTargets,
65777
66006
  liveAutomationValues,
@@ -65909,7 +66138,7 @@ function FxNodeHeader({
65909
66138
  }
65910
66139
  function FxNodeRow({
65911
66140
  node,
65912
- index,
66141
+ index: index2,
65913
66142
  position,
65914
66143
  automatedTargets,
65915
66144
  liveAutomationValues,
@@ -65959,17 +66188,17 @@ function FxNodeRow({
65959
66188
  label: node.label ?? EFFECT_COPY[node.type]?.title ?? registryDef.label,
65960
66189
  open: open2,
65961
66190
  bypassed,
65962
- first: index === 0,
66191
+ first: index2 === 0,
65963
66192
  last,
65964
66193
  disabled,
65965
66194
  onToggleOpen,
65966
66195
  onToggleBypass: () => {
65967
66196
  trackNodeBypassed(node.type, !bypassed, { trackKind });
65968
- onUpdate(index, { enabled: bypassed });
66197
+ onUpdate(index2, { enabled: bypassed });
65969
66198
  trackInput("toggle", "effect-bypass");
65970
66199
  },
65971
- onMove: (delta) => onMove(index, delta),
65972
- onRemove: () => onRemove(index)
66200
+ onMove: (delta) => onMove(index2, delta),
66201
+ onRemove: () => onRemove(index2)
65973
66202
  }
65974
66203
  ),
65975
66204
  summary ? /* @__PURE__ */ jsx170(
@@ -65995,7 +66224,7 @@ function FxNodeRow({
65995
66224
  onToggleDetails: () => setDetails((was) => !was),
65996
66225
  copy,
65997
66226
  params,
65998
- index,
66227
+ index: index2,
65999
66228
  disabled,
66000
66229
  bypassed,
66001
66230
  automatedTargets,
@@ -66516,9 +66745,9 @@ function FxSection({
66516
66745
  [chain, onChainChange, trackInput]
66517
66746
  );
66518
66747
  const previewNode = useCallback90(
66519
- (index, params) => onChainPreview?.({
66748
+ (index2, params) => onChainPreview?.({
66520
66749
  ...chain,
66521
- nodes: chain.nodes.map((n, i) => i === index ? { ...n, params } : n)
66750
+ nodes: chain.nodes.map((n, i) => i === index2 ? { ...n, params } : n)
66522
66751
  }),
66523
66752
  [chain, onChainPreview]
66524
66753
  );
@@ -66559,7 +66788,7 @@ function FxSection({
66559
66788
  [chain, mutate, clearAudition, trackKind]
66560
66789
  );
66561
66790
  const updateNode = useCallback90(
66562
- (index, patch) => mutate(chain.nodes.map((n, i) => i === index ? { ...n, ...patch } : n)),
66791
+ (index2, patch) => mutate(chain.nodes.map((n, i) => i === index2 ? { ...n, ...patch } : n)),
66563
66792
  [chain.nodes, mutate]
66564
66793
  );
66565
66794
  const setRunAmount = useCallback90(
@@ -66589,13 +66818,13 @@ function FxSection({
66589
66818
  [chain.nodes, mutate, onRemoveNodesAutomation, trackKind]
66590
66819
  );
66591
66820
  const removeNode = useCallback90(
66592
- (index) => {
66593
- const removed = chain.nodes[index];
66821
+ (index2) => {
66822
+ const removed = chain.nodes[index2];
66594
66823
  const removedId = removed?.id;
66595
66824
  if (removedId) onRemoveNodeAutomation?.(removedId);
66596
66825
  if (removed) trackNodeRemoved(removed.type, nodeOrigin(removed), { trackKind });
66597
66826
  mutate(
66598
- chain.nodes.filter((_, i) => i !== index),
66827
+ chain.nodes.filter((_, i) => i !== index2),
66599
66828
  "remove-effect"
66600
66829
  );
66601
66830
  setOpenNode(null);
@@ -66679,11 +66908,11 @@ function FxSection({
66679
66908
  [chain, mutate, onRemoveNodesAutomation]
66680
66909
  );
66681
66910
  const moveNode = useCallback90(
66682
- (index, delta) => {
66683
- const target = index + delta;
66911
+ (index2, delta) => {
66912
+ const target = index2 + delta;
66684
66913
  if (target < 0 || target >= chain.nodes.length) return;
66685
66914
  const next = [...chain.nodes];
66686
- const [moved] = next.splice(index, 1);
66915
+ const [moved] = next.splice(index2, 1);
66687
66916
  next.splice(target, 0, moved);
66688
66917
  if (moved) trackNodeMoved(moved.type, delta < 0 ? "up" : "down", { trackKind });
66689
66918
  mutate(next, "move-effect");
@@ -68010,10 +68239,10 @@ function valueFromPointer(clientX, clientY, rect, tab) {
68010
68239
  };
68011
68240
  }
68012
68241
  function curvePath(samples, tab) {
68013
- return [...samples].map((sample, index) => {
68014
- const input = tab.kind === "rgb" ? index / (samples.length - 1) : index / samples.length * 360;
68242
+ return [...samples].map((sample, index2) => {
68243
+ const input = tab.kind === "rgb" ? index2 / (samples.length - 1) : index2 / samples.length * 360;
68015
68244
  const point = graphPoint(input, sample, tab);
68016
- return `${index === 0 ? "M" : "L"}${point.x.toFixed(2)},${point.y.toFixed(2)}`;
68245
+ return `${index2 === 0 ? "M" : "L"}${point.x.toFixed(2)},${point.y.toFixed(2)}`;
68017
68246
  }).join(" ");
68018
68247
  }
68019
68248
  function samplesFor(points, tab) {
@@ -68049,10 +68278,10 @@ function nearestInputPointIndex(points, input, tab) {
68049
68278
  const inputSpan = tab.kind === "rgb" ? 1 : 360;
68050
68279
  let closest = -1;
68051
68280
  let distance = 12 / (GRAPH_SIZE - GRAPH_PADDING * 2);
68052
- points.forEach((point, index) => {
68281
+ points.forEach((point, index2) => {
68053
68282
  const nextDistance = (tab.kind === "hue" ? circularHueDistance(point[0], input) : Math.abs(point[0] - input)) / inputSpan;
68054
68283
  if (nextDistance < distance) {
68055
- closest = index;
68284
+ closest = index2;
68056
68285
  distance = nextDistance;
68057
68286
  }
68058
68287
  });
@@ -68062,12 +68291,12 @@ function nearestGraphPointIndex(points, input, output, tab) {
68062
68291
  const target = graphPoint(input, output, tab);
68063
68292
  let closest = -1;
68064
68293
  let distance = 12;
68065
- points.forEach((point, index) => {
68294
+ points.forEach((point, index2) => {
68066
68295
  const candidate = graphPoint(point[0], point[1], tab);
68067
68296
  const xDistance = tab.kind === "hue" ? circularHueDistance(point[0], input) / 360 * (GRAPH_SIZE - GRAPH_PADDING * 2) : candidate.x - target.x;
68068
68297
  const nextDistance = Math.hypot(xDistance, candidate.y - target.y);
68069
68298
  if (nextDistance < distance) {
68070
- closest = index;
68299
+ closest = index2;
68071
68300
  distance = nextDistance;
68072
68301
  }
68073
68302
  });
@@ -68090,37 +68319,37 @@ function insertPoint(points, input, output, tab) {
68090
68319
  next.sort((a, b) => a[0] - b[0]);
68091
68320
  return { points: next, selected: next.indexOf(point) };
68092
68321
  }
68093
- function safeRgbInput(points, index, input) {
68094
- if (index === 0) return 0;
68095
- if (index === points.length - 1) return 1;
68322
+ function safeRgbInput(points, index2, input) {
68323
+ if (index2 === 0) return 0;
68324
+ if (index2 === points.length - 1) return 1;
68096
68325
  return clampNumber(
68097
68326
  input,
68098
- (points[index - 1]?.[0] ?? 0) + INPUT_EPSILON,
68099
- (points[index + 1]?.[0] ?? 1) - INPUT_EPSILON
68327
+ (points[index2 - 1]?.[0] ?? 0) + INPUT_EPSILON,
68328
+ (points[index2 + 1]?.[0] ?? 1) - INPUT_EPSILON
68100
68329
  );
68101
68330
  }
68102
- function hueInputCollides(points, index, input) {
68331
+ function hueInputCollides(points, index2, input) {
68103
68332
  return points.some(
68104
- (point, pointIndex) => pointIndex !== index && circularHueDistance(point[0], input) < INPUT_EPSILON * 360
68333
+ (point, pointIndex) => pointIndex !== index2 && circularHueDistance(point[0], input) < INPUT_EPSILON * 360
68105
68334
  );
68106
68335
  }
68107
- function safeHueInput(points, index, input) {
68336
+ function safeHueInput(points, index2, input) {
68108
68337
  const initial = clampNumber(input, 0, 359.999);
68109
- if (!hueInputCollides(points, index, initial)) return initial;
68338
+ if (!hueInputCollides(points, index2, initial)) return initial;
68110
68339
  const spacing = INPUT_EPSILON * 360;
68111
68340
  for (let step = 1; step <= points.length + 1; step += 1) {
68112
68341
  const clockwise = (initial + spacing * step) % 360;
68113
- if (!hueInputCollides(points, index, clockwise)) return clockwise;
68342
+ if (!hueInputCollides(points, index2, clockwise)) return clockwise;
68114
68343
  const counterClockwise = (initial - spacing * step + 360) % 360;
68115
- if (!hueInputCollides(points, index, counterClockwise)) return counterClockwise;
68344
+ if (!hueInputCollides(points, index2, counterClockwise)) return counterClockwise;
68116
68345
  }
68117
68346
  return initial;
68118
68347
  }
68119
- function movePoint(points, index, input, output, tab) {
68348
+ function movePoint(points, index2, input, output, tab) {
68120
68349
  const next = [...points];
68121
- const safeInput = tab.kind === "rgb" ? safeRgbInput(next, index, input) : safeHueInput(next, index, input);
68350
+ const safeInput = tab.kind === "rgb" ? safeRgbInput(next, index2, input) : safeHueInput(next, index2, input);
68122
68351
  const moved = tab.kind === "rgb" ? [safeInput, clampNumber(output, 0, 1)] : [safeInput, clampNumber(output, tab.min, tab.max)];
68123
- next[index] = moved;
68352
+ next[index2] = moved;
68124
68353
  next.sort((a, b) => a[0] - b[0]);
68125
68354
  return { points: next, selected: next.indexOf(moved) };
68126
68355
  }
@@ -68269,19 +68498,19 @@ function CurveGraph({
68269
68498
  event.currentTarget.getBoundingClientRect(),
68270
68499
  tab
68271
68500
  );
68272
- let index = nearestGraphPointIndex(points, value.input, value.output, tab);
68501
+ let index2 = nearestGraphPointIndex(points, value.input, value.output, tab);
68273
68502
  let nextPoints = points;
68274
- if (index < 0) {
68503
+ if (index2 < 0) {
68275
68504
  const inserted = insertPoint(points, value.input, value.output, tab);
68276
68505
  if (!inserted) return;
68277
68506
  nextPoints = inserted.points;
68278
- index = inserted.selected;
68507
+ index2 = inserted.selected;
68279
68508
  }
68280
68509
  event.currentTarget.setPointerCapture(event.pointerId);
68281
- pointerRef.current = { pointerId: event.pointerId, index, points: nextPoints };
68510
+ pointerRef.current = { pointerId: event.pointerId, index: index2, points: nextPoints };
68282
68511
  onBegin();
68283
- onSelect(index);
68284
- const moved = movePoint(nextPoints, index, value.input, value.output, tab);
68512
+ onSelect(index2);
68513
+ const moved = movePoint(nextPoints, index2, value.input, value.output, tab);
68285
68514
  pointerRef.current.index = moved.selected;
68286
68515
  pointerRef.current.points = moved.points;
68287
68516
  onPreview(moved.points, moved.selected);
@@ -68361,20 +68590,20 @@ function CurveGraph({
68361
68590
  strokeWidth: "1.5"
68362
68591
  }
68363
68592
  ),
68364
- points.map(([input, output], index) => {
68593
+ points.map(([input, output], index2) => {
68365
68594
  const point = graphPoint(input, output, tab);
68366
68595
  return /* @__PURE__ */ jsx178(
68367
68596
  "circle",
68368
68597
  {
68369
- "data-color-curve-point": index,
68598
+ "data-color-curve-point": index2,
68370
68599
  cx: point.x,
68371
68600
  cy: point.y,
68372
- r: selectedIndex === index ? 3.5 : 2.5,
68373
- fill: selectedIndex === index ? "#fff" : tab.color,
68601
+ r: selectedIndex === index2 ? 3.5 : 2.5,
68602
+ fill: selectedIndex === index2 ? "#fff" : tab.color,
68374
68603
  stroke: "#111",
68375
68604
  strokeWidth: "1"
68376
68605
  },
68377
- `${input}-${index}`
68606
+ `${input}-${index2}`
68378
68607
  );
68379
68608
  })
68380
68609
  ]
@@ -68520,7 +68749,7 @@ function ColorCurves({
68520
68749
  if (selectedIndex === null) return;
68521
68750
  if (tab.kind === "rgb" && (selectedIndex === 0 || selectedIndex === points.length - 1)) return;
68522
68751
  transaction.cancel();
68523
- const nextPoints = tab.kind === "hue" && points.length <= 3 ? [] : points.filter((_, index) => index !== selectedIndex);
68752
+ const nextPoints = tab.kind === "hue" && points.length <= 3 ? [] : points.filter((_, index2) => index2 !== selectedIndex);
68524
68753
  const next = withPoints(draft, tab, nextPoints);
68525
68754
  setDraft(next);
68526
68755
  setSelectedIndex(null);
@@ -68874,8 +69103,8 @@ function drawHistogram(context, analysis, width, height) {
68874
69103
  const maximum = maximumDensity(analysis.histogram);
68875
69104
  context.beginPath();
68876
69105
  context.moveTo(0, height);
68877
- analysis.histogram.forEach((count, index) => {
68878
- context.lineTo(index / 255 * width, height - densityAlpha(count, maximum) * height);
69106
+ analysis.histogram.forEach((count, index2) => {
69107
+ context.lineTo(index2 / 255 * width, height - densityAlpha(count, maximum) * height);
68879
69108
  });
68880
69109
  context.lineTo(width, height);
68881
69110
  context.closePath();
@@ -68888,7 +69117,7 @@ function drawDensity(context, density, columnOffset, columnCount, color, xOffset
68888
69117
  let maximum = 0;
68889
69118
  const start = columnOffset * 256;
68890
69119
  const end = (columnOffset + columnCount) * 256;
68891
- for (let index = start; index < end; index += 1) maximum = Math.max(maximum, density[index] ?? 0);
69120
+ for (let index2 = start; index2 < end; index2 += 1) maximum = Math.max(maximum, density[index2] ?? 0);
68892
69121
  context.fillStyle = `rgb(${color.join(" ")})`;
68893
69122
  for (let x = 0; x < columnCount; x += 1) {
68894
69123
  for (let y = 0; y < 256; y += 1) {
@@ -69122,7 +69351,7 @@ function PropertyPanelColorSecondary({
69122
69351
  }, [sampleFrame, samplePixels, selected, showMatte]);
69123
69352
  const replaceSelected = (next) => {
69124
69353
  if (!selected) return;
69125
- onCommit(secondaries.map((secondary, index) => index === activeIndex ? next : secondary));
69354
+ onCommit(secondaries.map((secondary, index2) => index2 === activeIndex ? next : secondary));
69126
69355
  };
69127
69356
  const addSecondary = () => {
69128
69357
  if (secondaries.length >= SECONDARY_CAPABILITIES.max) return;
@@ -69131,7 +69360,7 @@ function PropertyPanelColorSecondary({
69131
69360
  };
69132
69361
  const removeSelected = () => {
69133
69362
  if (!selected) return;
69134
- const next = secondaries.filter((_, index) => index !== activeIndex);
69363
+ const next = secondaries.filter((_, index2) => index2 !== activeIndex);
69135
69364
  onCommit(next);
69136
69365
  setSelectedIndex(Math.max(0, Math.min(activeIndex, next.length - 1)));
69137
69366
  setSampleFrame(null);
@@ -69140,21 +69369,21 @@ function PropertyPanelColorSecondary({
69140
69369
  };
69141
69370
  return /* @__PURE__ */ jsxs139("div", { className: "space-y-1.5", "data-flat-grade-secondary": "true", children: [
69142
69371
  /* @__PURE__ */ jsxs139("div", { className: "flex items-center justify-between gap-2", children: [
69143
- /* @__PURE__ */ jsx182("span", { className: "flex items-center gap-1", children: secondaries.map((_, index) => /* @__PURE__ */ jsx182(
69372
+ /* @__PURE__ */ jsx182("span", { className: "flex items-center gap-1", children: secondaries.map((_, index2) => /* @__PURE__ */ jsx182(
69144
69373
  "button",
69145
69374
  {
69146
69375
  type: "button",
69147
- "aria-pressed": activeIndex === index,
69376
+ "aria-pressed": activeIndex === index2,
69148
69377
  onClick: () => {
69149
- setSelectedIndex(index);
69378
+ setSelectedIndex(index2);
69150
69379
  setSampleFrame(null);
69151
69380
  setSamplePixels(null);
69152
69381
  setCaptureError(null);
69153
69382
  },
69154
- className: `h-6 min-w-6 border-b-2 px-1 font-mono text-[10px] ${activeIndex === index ? "border-panel-accent text-panel-text-0" : "border-transparent text-panel-text-4 hover:text-panel-text-2"}`,
69155
- children: index + 1
69383
+ className: `h-6 min-w-6 border-b-2 px-1 font-mono text-[10px] ${activeIndex === index2 ? "border-panel-accent text-panel-text-0" : "border-transparent text-panel-text-4 hover:text-panel-text-2"}`,
69384
+ children: index2 + 1
69156
69385
  },
69157
- index
69386
+ index2
69158
69387
  )) }),
69159
69388
  /* @__PURE__ */ jsxs139("span", { className: "flex items-center gap-2", children: [
69160
69389
  /* @__PURE__ */ jsx182(
@@ -70369,7 +70598,7 @@ function enumOptions(key2, labels) {
70369
70598
  const first = control?.min ?? 0;
70370
70599
  const count = (control?.max ?? labels.length - 1) - first + 1;
70371
70600
  if (labels.length !== count) throw new Error(`${key2} labels do not match Core capabilities`);
70372
- return labels.map((label, index) => ({ value: String(first + index), label }));
70601
+ return labels.map((label, index2) => ({ value: String(first + index2), label }));
70373
70602
  }
70374
70603
  var ASCII_STYLES = enumOptions("asciiStyle", [
70375
70604
  "Standard",
@@ -70766,7 +70995,7 @@ function FlatEffectsSection({
70766
70995
  const palette = grading.palette;
70767
70996
  return /* @__PURE__ */ jsxs143("div", { "data-flat-effects-palette": "true", className: "space-y-2 py-1", children: [
70768
70997
  /* @__PURE__ */ jsx187("div", { className: "grid grid-cols-3 gap-1", children: HF_COLOR_GRADING_PALETTES.map((preset) => {
70769
- const selected = palette?.length === preset.colors.length && palette.every((color, index) => color === preset.colors[index]);
70998
+ const selected = palette?.length === preset.colors.length && palette.every((color, index2) => color === preset.colors[index2]);
70770
70999
  return /* @__PURE__ */ jsxs143(
70771
71000
  "button",
70772
71001
  {
@@ -70817,16 +71046,16 @@ function FlatEffectsSection({
70817
71046
  )
70818
71047
  ] }),
70819
71048
  /* @__PURE__ */ jsxs143("div", { className: "flex flex-wrap items-center gap-1.5", children: [
70820
- palette.map((color, index) => /* @__PURE__ */ jsxs143("span", { className: "group/swatch relative", children: [
71049
+ palette.map((color, index2) => /* @__PURE__ */ jsxs143("span", { className: "group/swatch relative", children: [
70821
71050
  /* @__PURE__ */ jsx187(
70822
71051
  "input",
70823
71052
  {
70824
71053
  type: "color",
70825
- "aria-label": `Palette color ${index + 1}`,
71054
+ "aria-label": `Palette color ${index2 + 1}`,
70826
71055
  value: color,
70827
71056
  onChange: (event) => {
70828
71057
  const nextPalette = [...palette];
70829
- nextPalette[index] = event.target.value;
71058
+ nextPalette[index2] = event.target.value;
70830
71059
  onCommitColorGrading({ ...grading, palette: nextPalette });
70831
71060
  },
70832
71061
  className: "h-6 w-6 cursor-pointer rounded-xs border border-panel-border-input bg-transparent p-0"
@@ -70836,16 +71065,16 @@ function FlatEffectsSection({
70836
71065
  "button",
70837
71066
  {
70838
71067
  type: "button",
70839
- "aria-label": `Remove palette color ${index + 1}`,
71068
+ "aria-label": `Remove palette color ${index2 + 1}`,
70840
71069
  onClick: () => onCommitColorGrading({
70841
71070
  ...grading,
70842
- palette: palette.filter((_, colorIndex) => colorIndex !== index)
71071
+ palette: palette.filter((_, colorIndex) => colorIndex !== index2)
70843
71072
  }),
70844
71073
  className: "absolute -right-1 -top-1 hidden h-3.5 w-3.5 items-center justify-center rounded-full bg-panel-bg text-panel-text-2 shadow-sm group-hover/swatch:flex",
70845
71074
  children: /* @__PURE__ */ jsx187(X, { size: 8 })
70846
71075
  }
70847
71076
  )
70848
- ] }, `${index}-${color}`)),
71077
+ ] }, `${index2}-${color}`)),
70849
71078
  palette.length < 6 && /* @__PURE__ */ jsx187(
70850
71079
  "button",
70851
71080
  {
@@ -75147,20 +75376,20 @@ function buildOverrides(model) {
75147
75376
  for (const segId of group.segmentIds) {
75148
75377
  const seg = model.segments.get(segId);
75149
75378
  if (seg && Object.keys(seg.style).length > 0) {
75150
- const entry2 = { wordIndex: globalWordIndex };
75151
- if (seg.wordId) entry2.wordId = seg.wordId;
75379
+ const entry3 = { wordIndex: globalWordIndex };
75380
+ if (seg.wordId) entry3.wordId = seg.wordId;
75152
75381
  const s = seg.style;
75153
- if (s.x !== void 0) entry2.x = s.x;
75154
- if (s.y !== void 0) entry2.y = s.y;
75155
- if (s.scaleX !== void 0) entry2.scale = s.scaleX;
75156
- if (s.rotation !== void 0) entry2.rotation = s.rotation;
75157
- if (s.activeColor !== void 0) entry2.activeColor = s.activeColor;
75158
- if (s.dimColor !== void 0) entry2.dimColor = s.dimColor;
75159
- if (s.opacity !== void 0) entry2.opacity = s.opacity;
75160
- if (s.fontSize !== void 0) entry2.fontSize = s.fontSize;
75161
- if (s.fontWeight !== void 0) entry2.fontWeight = s.fontWeight;
75162
- if (s.fontFamily !== void 0) entry2.fontFamily = s.fontFamily;
75163
- entries.push(entry2);
75382
+ if (s.x !== void 0) entry3.x = s.x;
75383
+ if (s.y !== void 0) entry3.y = s.y;
75384
+ if (s.scaleX !== void 0) entry3.scale = s.scaleX;
75385
+ if (s.rotation !== void 0) entry3.rotation = s.rotation;
75386
+ if (s.activeColor !== void 0) entry3.activeColor = s.activeColor;
75387
+ if (s.dimColor !== void 0) entry3.dimColor = s.dimColor;
75388
+ if (s.opacity !== void 0) entry3.opacity = s.opacity;
75389
+ if (s.fontSize !== void 0) entry3.fontSize = s.fontSize;
75390
+ if (s.fontWeight !== void 0) entry3.fontWeight = s.fontWeight;
75391
+ if (s.fontFamily !== void 0) entry3.fontFamily = s.fontFamily;
75392
+ entries.push(entry3);
75164
75393
  }
75165
75394
  globalWordIndex++;
75166
75395
  }
@@ -75338,16 +75567,16 @@ function createOwnHistory() {
75338
75567
  noteClaim: (id) => {
75339
75568
  claimed = { count: claimed.count + 1, id };
75340
75569
  },
75341
- stepped: (entry2) => {
75342
- if (entry2.undoes) undoneIds.add(entry2.undoes);
75570
+ stepped: (entry3) => {
75571
+ if (entry3.undoes) undoneIds.add(entry3.undoes);
75343
75572
  if (undoneIds.size > OWN_ENTRIES_KEPT) undoneIds.delete(undoneIds.values().next().value);
75344
- const undone = entry2.undoes ? own.get(entry2.undoes) : void 0;
75573
+ const undone = entry3.undoes ? own.get(entry3.undoes) : void 0;
75345
75574
  if (!undone) return;
75346
75575
  const swapped = Object.entries(undone).map(([path, f]) => [
75347
75576
  path,
75348
75577
  { before: f.after, after: f.before }
75349
75578
  ]);
75350
- remember(entry2.id, Object.fromEntries(swapped));
75579
+ remember(entry3.id, Object.fromEntries(swapped));
75351
75580
  },
75352
75581
  afterOf: (id) => Object.fromEntries(Object.entries(id && own.get(id) || {}).map(([p, f]) => [p, f.after])),
75353
75582
  predict: (direction) => {
@@ -75429,8 +75658,8 @@ async function restoredFiles(paths, previous, readFile) {
75429
75658
  );
75430
75659
  }
75431
75660
  function redoneAt(view) {
75432
- const undo = view.entries.find((entry2) => entry2.id === view.forward?.id);
75433
- return view.entries.find((entry2) => entry2.id === undo?.undoes)?.endedAt ?? null;
75661
+ const undo = view.entries.find((entry3) => entry3.id === view.forward?.id);
75662
+ return view.entries.find((entry3) => entry3.id === undo?.undoes)?.endedAt ?? null;
75434
75663
  }
75435
75664
  function usePersistentEditHistory({ projectId }) {
75436
75665
  const [view, setView] = useState115(EMPTY3);
@@ -76145,11 +76374,11 @@ function useFileManager({
76145
76374
  showToast(`Skipped (too large): ${data.skipped.join(", ")}`);
76146
76375
  }
76147
76376
  if (data.invalid?.length) {
76148
- const why = data.invalid.map((entry2) => `${entry2.name} (${entry2.reason})`).join(", ");
76377
+ const why = data.invalid.map((entry3) => `${entry3.name} (${entry3.reason})`).join(", ");
76149
76378
  showToast(`Not added: ${why}`);
76150
76379
  }
76151
76380
  if (data.unchecked?.length) {
76152
- const names = data.unchecked.map((entry2) => entry2.name).join(", ");
76381
+ const names = data.unchecked.map((entry3) => entry3.name).join(", ");
76153
76382
  showToast(`Added ${names}, ${data.unchecked[0].reason}`, "info");
76154
76383
  }
76155
76384
  await refreshFileTree();
@@ -76472,7 +76701,7 @@ function syncStaleEditMarks(doc, file) {
76472
76701
  }
76473
76702
  function hasAmbiguousGsapScriptChange(previousScripts, restoredScripts) {
76474
76703
  if (previousScripts.length <= 1 && restoredScripts.length <= 1) return false;
76475
- return previousScripts.length !== restoredScripts.length || previousScripts.some((script, index) => script !== restoredScripts[index]);
76704
+ return previousScripts.length !== restoredScripts.length || previousScripts.some((script, index2) => script !== restoredScripts[index2]);
76476
76705
  }
76477
76706
  function restoreScripted(prevDoc, nextDoc, isActive) {
76478
76707
  const [before, after] = [prevDoc, nextDoc].map(
@@ -77224,16 +77453,16 @@ import { useCallback as useCallback109 } from "react";
77224
77453
 
77225
77454
  // src/utils/timelineDropTrackInsert.ts
77226
77455
  function planDropTrackInsert(input) {
77227
- const { elements, trackOrder, insertRow, dropped } = input;
77456
+ const { elements, trackOrder, insertRow, dropped: dropped2 } = input;
77228
77457
  const newElement = {
77229
- ...dropped,
77230
- key: dropped.id,
77458
+ ...dropped2,
77459
+ key: dropped2.id,
77231
77460
  // Parked on an existing lane so it adds no lane of its own to the topology.
77232
77461
  track: elements[0]?.track ?? 0,
77233
77462
  // sameSourceFile compares this raw field: borrow the peers' value, not the resolved path.
77234
77463
  sourceFile: elements[0]?.sourceFile
77235
77464
  };
77236
- const layout = layoutAfterTrackInsert(newElement, dropped.start, insertRow, null, {
77465
+ const layout = layoutAfterTrackInsert(newElement, dropped2.start, insertRow, null, {
77237
77466
  elements: [...elements, newElement],
77238
77467
  trackOrder: [...trackOrder]
77239
77468
  });
@@ -77242,13 +77471,13 @@ function planDropTrackInsert(input) {
77242
77471
  const renumbers = [];
77243
77472
  for (const norm of layout.normalized) {
77244
77473
  const key2 = norm.key ?? norm.id;
77245
- if (key2 === dropped.id) continue;
77474
+ if (key2 === dropped2.id) continue;
77246
77475
  const src = byKey.get(key2);
77247
77476
  if (!src || norm.track === (src.authoredTrack ?? src.track)) continue;
77248
77477
  if (!canMoveTimelineElement(src)) return null;
77249
77478
  renumbers.push({ element: src, track: norm.track });
77250
77479
  }
77251
- const track2 = layout.normalized.find((n) => (n.key ?? n.id) === dropped.id)?.track;
77480
+ const track2 = layout.normalized.find((n) => (n.key ?? n.id) === dropped2.id)?.track;
77252
77481
  return track2 == null ? null : { track: track2, renumbers };
77253
77482
  }
77254
77483
  function applyTrackRenumbers(source, plan) {
@@ -77266,27 +77495,27 @@ function applyTrackRenumbers(source, plan) {
77266
77495
  }
77267
77496
  return out;
77268
77497
  }
77269
- function resolveRowDrop(elements, placed, lane, dropped) {
77270
- const audio = isAudioTimelineElement(dropped);
77498
+ function resolveRowDrop(elements, placed, lane, dropped2) {
77499
+ const audio = isAudioTimelineElement(dropped2);
77271
77500
  const row = elements.filter((e) => e.track === lane);
77272
77501
  const otherKindRow = row.length > 0 && !row.some((e) => isAudioTimelineElement(e) === audio);
77273
- const asClip = { ...dropped, key: dropped.id, track: lane, sourceFile: elements[0]?.sourceFile };
77502
+ const asClip = { ...dropped2, key: dropped2.id, track: lane, sourceFile: elements[0]?.sourceFile };
77274
77503
  const track2 = otherKindRow ? lane : authoredTrackForLane(lane, elements, asClip);
77275
77504
  const onTrack = [...elements, ...placed].filter((e) => isAudioTimelineElement(e) === audio && (e.authoredTrack ?? e.track) === track2).map((e) => ({ ...e, track: track2 }));
77276
77505
  return {
77277
77506
  track: track2,
77278
- start: resolveNearestFreeStart(onTrack, track2, dropped.start, dropped.duration, null)
77507
+ start: resolveNearestFreeStart(onTrack, track2, dropped2.start, dropped2.duration, null)
77279
77508
  };
77280
77509
  }
77281
77510
  function resolveDropTrack(input) {
77282
- const { source, elements, placement, dropped } = input;
77511
+ const { source, elements, placement, dropped: dropped2 } = input;
77283
77512
  if (placement.insertRow == null) {
77284
- return { source, ...resolveRowDrop(elements, input.placed ?? [], placement.track, dropped) };
77513
+ return { source, ...resolveRowDrop(elements, input.placed ?? [], placement.track, dropped2) };
77285
77514
  }
77286
77515
  const { insertRow, trackOrder } = placement;
77287
- const plan = planDropTrackInsert({ elements, trackOrder, insertRow, dropped });
77516
+ const plan = planDropTrackInsert({ elements, trackOrder, insertRow, dropped: dropped2 });
77288
77517
  if (!plan) throw new Error("Cannot open a new track here: a locked clip would have to move.");
77289
- return { source: applyTrackRenumbers(source, plan), track: plan.track, start: dropped.start };
77518
+ return { source: applyTrackRenumbers(source, plan), track: plan.track, start: dropped2.start };
77290
77519
  }
77291
77520
 
77292
77521
  // src/utils/timelineCompositionInsert.ts
@@ -77355,8 +77584,8 @@ function selectAndRevealTimelineElement(key2) {
77355
77584
  }
77356
77585
 
77357
77586
  // src/hooks/useTimelineAssetDropOps.ts
77358
- function fileDropPlacement(index, next, dropped, previous) {
77359
- if (index === 0) return { ...dropped, ...next };
77587
+ function fileDropPlacement(index2, next, dropped2, previous) {
77588
+ if (index2 === 0) return { ...dropped2, ...next };
77360
77589
  return previous ? { start: previous.start + previous.duration, track: previous.track } : next;
77361
77590
  }
77362
77591
  function timelineDropTarget(sourceFile, placement) {
@@ -77525,17 +77754,17 @@ function useTimelineAssetDropOps({
77525
77754
  durations
77526
77755
  );
77527
77756
  const gesture = { placed: [], onNewTrack: false };
77528
- for (const [index, assetPath] of uploaded.entries()) {
77529
- const next = placements[index] ?? placements[0];
77757
+ for (const [index2, assetPath] of uploaded.entries()) {
77758
+ const next = placements[index2] ?? placements[0];
77530
77759
  const clip = await dropAssetAt(
77531
77760
  assetPath,
77532
- fileDropPlacement(index, next, placement, gesture.placed.at(-1)),
77533
- durations[index],
77761
+ fileDropPlacement(index2, next, placement, gesture.placed.at(-1)),
77762
+ durations[index2],
77534
77763
  gesture
77535
77764
  );
77536
77765
  if (!clip) continue;
77537
77766
  gesture.placed.push(clip);
77538
- if (index === 0 && placement?.insertRow != null) gesture.onNewTrack = true;
77767
+ if (index2 === 0 && placement?.insertRow != null) gesture.onNewTrack = true;
77539
77768
  }
77540
77769
  },
77541
77770
  [
@@ -78356,17 +78585,17 @@ function useTimelineEditGuard(canEdit, showToast) {
78356
78585
  cached5.onRefused = onRefused;
78357
78586
  return cached5.wrapped;
78358
78587
  }
78359
- const entry2 = {};
78360
- entry2.resolveTargets = resolveTargets;
78361
- entry2.onRefused = onRefused;
78362
- entry2.wrapped = ((...args) => {
78363
- const reason = refuseEditRef.current(entry2.resolveTargets(...args));
78588
+ const entry3 = {};
78589
+ entry3.resolveTargets = resolveTargets;
78590
+ entry3.onRefused = onRefused;
78591
+ entry3.wrapped = ((...args) => {
78592
+ const reason = refuseEditRef.current(entry3.resolveTargets(...args));
78364
78593
  if (reason !== null)
78365
- return Promise.resolve(entry2.onRefused?.(reason, ...args));
78594
+ return Promise.resolve(entry3.onRefused?.(reason, ...args));
78366
78595
  return fn(...args);
78367
78596
  });
78368
- guardedRef.current.set(key2, entry2);
78369
- return entry2.wrapped;
78597
+ guardedRef.current.set(key2, entry3);
78598
+ return entry3.wrapped;
78370
78599
  },
78371
78600
  []
78372
78601
  );
@@ -80055,18 +80284,18 @@ function domEditSelectionsEqual(a, b) {
80055
80284
  }
80056
80285
  function domEditSelectionInGroup(group, selection) {
80057
80286
  if (!selection) return false;
80058
- return group.some((entry2) => domEditSelectionsTargetSame(entry2, selection));
80287
+ return group.some((entry3) => domEditSelectionsTargetSame(entry3, selection));
80059
80288
  }
80060
80289
  function toggleDomEditGroupSelection(group, selection) {
80061
80290
  if (domEditSelectionInGroup(group, selection)) {
80062
- return group.filter((entry2) => !domEditSelectionsTargetSame(entry2, selection));
80291
+ return group.filter((entry3) => !domEditSelectionsTargetSame(entry3, selection));
80063
80292
  }
80064
80293
  return [...group, selection];
80065
80294
  }
80066
80295
  function replaceDomEditGroupSelection(group, selection) {
80067
80296
  let replaced = false;
80068
- const nextGroup = group.map((entry2) => {
80069
- if (!domEditSelectionsTargetSame(entry2, selection)) return entry2;
80297
+ const nextGroup = group.map((entry3) => {
80298
+ if (!domEditSelectionsTargetSame(entry3, selection)) return entry3;
80070
80299
  replaced = true;
80071
80300
  return selection;
80072
80301
  });
@@ -80970,7 +81199,7 @@ function describeBatchPatchTarget(patch) {
80970
81199
  return patch.target.id ?? patch.target.hfId ?? patch.target.selector ?? "(unaddressed)";
80971
81200
  }
80972
81201
  function reportUnmatchedBatchPatches(batch, matched) {
80973
- const unmatchedIds = batch.patches.filter((_, index) => matched[index] === false).map(describeBatchPatchTarget);
81202
+ const unmatchedIds = batch.patches.filter((_, index2) => matched[index2] === false).map(describeBatchPatchTarget);
80974
81203
  if (unmatchedIds.length === 0) return;
80975
81204
  console.warn(
80976
81205
  `[studio] z-index reorder: server could not match ${unmatchedIds.length} patch target(s) in ${batch.sourceFile} (the whole z-order gesture will revert on reload):`,
@@ -81011,8 +81240,8 @@ async function patchElementBatches(projectId, batches) {
81011
81240
  if (typeof result !== "object" || result === null || !("durable" in result) || typeof result.durable !== "boolean" || !("files" in result) || !Array.isArray(result.files) || result.files.length !== batches.length || !result.files.every(isAtomicElementPatchFile) || !result.durable && result.files.some((file) => file.changed)) {
81012
81241
  throw new StudioSaveHttpError("Invalid atomic element patch response", 502);
81013
81242
  }
81014
- const files = result.files.map((file, index) => {
81015
- const batch = batches[index];
81243
+ const files = result.files.map((file, index2) => {
81244
+ const batch = batches[index2];
81016
81245
  const matched = file.matched ?? [];
81017
81246
  if (!batch || file.sourceFile !== batch.sourceFile || matched.length !== 0 && matched.length !== batch.patches.length) {
81018
81247
  throw new StudioSaveHttpError("Invalid atomic element patch response", 502);
@@ -81318,7 +81547,7 @@ function refreshTimelineRowText(el) {
81318
81547
 
81319
81548
  // src/hooks/domEditTextFieldCommitOps.ts
81320
81549
  function hasSameKeysInSamePositions(originalFields, nextFields) {
81321
- return originalFields.every((field, index) => nextFields[index]?.key === field.key);
81550
+ return originalFields.every((field, index2) => nextFields[index2]?.key === field.key);
81322
81551
  }
81323
81552
  function inlineStyleValue(styles, property) {
81324
81553
  return Object.prototype.hasOwnProperty.call(styles, property) ? styles[property] : null;
@@ -81585,13 +81814,13 @@ function useDomEditAttributeCommits({
81585
81814
  iframe?.contentDocument,
81586
81815
  selection,
81587
81816
  activeCompPath,
81588
- entries.map((entry2) => entry2.fullAttr)
81817
+ entries.map((entry3) => entry3.fullAttr)
81589
81818
  );
81590
81819
  },
81591
81820
  apply: () => {
81592
81821
  if (!captured) return;
81593
- for (const entry2 of entries) {
81594
- setOrRemovePreviewAttribute(captured.element, entry2.fullAttr, entry2.value);
81822
+ for (const entry3 of entries) {
81823
+ setOrRemovePreviewAttribute(captured.element, entry3.fullAttr, entry3.value);
81595
81824
  }
81596
81825
  },
81597
81826
  persist: () => persistDomEditOperations(selection, ops, {
@@ -81603,11 +81832,11 @@ function useDomEditAttributeCommits({
81603
81832
  shouldRevert: (error) => isLatestCommit() && !(error instanceof DomEditPersistPreparedWriteError),
81604
81833
  revert: () => {
81605
81834
  if (!captured) return;
81606
- for (const entry2 of entries) {
81835
+ for (const entry3 of entries) {
81607
81836
  setOrRemovePreviewAttribute(
81608
81837
  captured.element,
81609
- entry2.fullAttr,
81610
- captured.previousValues.get(entry2.fullAttr) ?? null
81838
+ entry3.fullAttr,
81839
+ captured.previousValues.get(entry3.fullAttr) ?? null
81611
81840
  );
81612
81841
  }
81613
81842
  },
@@ -82051,7 +82280,7 @@ function useDomEditTextCommits({
82051
82280
  const handleDomTextFieldStyleCommit = useCallback130(
82052
82281
  async (fieldKey, property, value) => {
82053
82282
  if (!domEditSelection) return;
82054
- const field = domEditSelection.textFields.find((entry2) => entry2.key === fieldKey);
82283
+ const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
82055
82284
  if (!field) return;
82056
82285
  if (field.source === "self") {
82057
82286
  await handleDomStyleCommit(property, value);
@@ -82067,17 +82296,17 @@ function useDomEditTextCommits({
82067
82296
  }
82068
82297
  }
82069
82298
  const nextTextFields = domEditSelection.textFields.map(
82070
- (entry2) => entry2.key === fieldKey ? {
82071
- ...entry2,
82299
+ (entry3) => entry3.key === fieldKey ? {
82300
+ ...entry3,
82072
82301
  inlineStyles: {
82073
- ...entry2.inlineStyles,
82302
+ ...entry3.inlineStyles,
82074
82303
  [property]: normalizedValue
82075
82304
  },
82076
82305
  computedStyles: {
82077
- ...entry2.computedStyles,
82306
+ ...entry3.computedStyles,
82078
82307
  [property]: normalizedValue
82079
82308
  }
82080
- } : entry2
82309
+ } : entry3
82081
82310
  );
82082
82311
  await commitDomTextFields(domEditSelection, nextTextFields, { importedFont });
82083
82312
  },
@@ -82112,13 +82341,13 @@ function useDomEditTextCommits({
82112
82341
  const handleDomRemoveTextField = useCallback130(
82113
82342
  async (fieldKey) => {
82114
82343
  if (!domEditSelection) return;
82115
- const field = domEditSelection.textFields.find((entry2) => entry2.key === fieldKey);
82344
+ const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
82116
82345
  if (!field) return;
82117
82346
  if (field.source === "self") {
82118
82347
  await handleDomTextCommit("", fieldKey);
82119
82348
  return;
82120
82349
  }
82121
- const nextTextFields = domEditSelection.textFields.filter((entry2) => entry2.key !== fieldKey);
82350
+ const nextTextFields = domEditSelection.textFields.filter((entry3) => entry3.key !== fieldKey);
82122
82351
  await commitDomTextFields(domEditSelection, nextTextFields);
82123
82352
  },
82124
82353
  [commitDomTextFields, domEditSelection, handleDomTextCommit]
@@ -83966,12 +84195,12 @@ function applyPreviewSync(iframe, result, options, reloadPreview, nestedFiles) {
83966
84195
  if (patches.length > 0) {
83967
84196
  const deferSeek = options.deferPreviewSync === true;
83968
84197
  const missed = patches.find(
83969
- (patch, index) => !patchRuntimeTweenInPlace(
84198
+ (patch, index2) => !patchRuntimeTweenInPlace(
83970
84199
  iframe,
83971
84200
  patch.selector,
83972
84201
  patch.change,
83973
84202
  void 0,
83974
- deferSeek || index < patches.length - 1
84203
+ deferSeek || index2 < patches.length - 1
83975
84204
  )
83976
84205
  );
83977
84206
  if (missed) {
@@ -84763,9 +84992,9 @@ import { useCallback as useCallback143 } from "react";
84763
84992
 
84764
84993
  // src/hooks/gsapGroupPreflight.ts
84765
84994
  function firstPreflightFailure(results, updates, savedOnElement, activeCompPath) {
84766
- for (const [index, result] of results.entries()) {
84995
+ for (const [index2, result] of results.entries()) {
84767
84996
  if (result.status !== "rejected") continue;
84768
- const selection = updates[index]?.selection;
84997
+ const selection = updates[index2]?.selection;
84769
84998
  if (selection) return { error: result.reason, selection };
84770
84999
  }
84771
85000
  return secondFile(updates, savedOnElement, activeCompPath);
@@ -84874,8 +85103,8 @@ function useGsapAwareGroupMove({
84874
85103
  const lastScriptWrite = updates.findLastIndex(
84875
85104
  ({ selection }) => !offsetMembers.has(selection)
84876
85105
  );
84877
- for (const [index, { selection, next }] of updates.entries()) {
84878
- renderOnCommit = index === lastScriptWrite;
85106
+ for (const [index2, { selection, next }] of updates.entries()) {
85107
+ renderOnCommit = index2 === lastScriptWrite;
84879
85108
  const plain = offsetMembers.get(selection);
84880
85109
  if (plain !== void 0) {
84881
85110
  const staged = writes.drawKeepingUndone(
@@ -85195,7 +85424,7 @@ async function applyArcKeyframeAtPlayhead(session, sel, arcAnim, t2, iframe) {
85195
85424
  targetSelector,
85196
85425
  position: roundTo3(start),
85197
85426
  duration: roundTo3(duration),
85198
- keyframes: nodes.filter((_, index) => index !== timedNodeIndex),
85427
+ keyframes: nodes.filter((_, index2) => index2 !== timedNodeIndex),
85199
85428
  ease: "none"
85200
85429
  },
85201
85430
  { label: "Remove keyframe", softReload: true }
@@ -85690,10 +85919,10 @@ async function commitStaticSet(selection, propEntries, selector, animations, com
85690
85919
  }
85691
85920
  function groupStaticSetEntries(propEntries) {
85692
85921
  const byGroup = /* @__PURE__ */ new Map();
85693
- for (const entry2 of propEntries) {
85694
- const group = classifyPropertyGroup4(entry2[0]);
85922
+ for (const entry3 of propEntries) {
85923
+ const group = classifyPropertyGroup4(entry3[0]);
85695
85924
  const batch = byGroup.get(group) ?? [];
85696
- batch.push(entry2);
85925
+ batch.push(entry3);
85697
85926
  byGroup.set(group, batch);
85698
85927
  }
85699
85928
  return byGroup;
@@ -86670,9 +86899,9 @@ async function moveDomGroupBy(moves, commitGroup) {
86670
86899
  restoreManualOffsetDragMembers(members);
86671
86900
  throw error;
86672
86901
  }
86673
- const updates = members.map((member, index) => ({
86902
+ const updates = members.map((member, index2) => ({
86674
86903
  selection: member.selection,
86675
- next: applyManualOffsetDragCommit(member, screens[index].x, screens[index].y),
86904
+ next: applyManualOffsetDragCommit(member, screens[index2].x, screens[index2].y),
86676
86905
  plainTranslate: member.plainTranslate
86677
86906
  }));
86678
86907
  try {
@@ -88899,8 +89128,8 @@ function renamedIds(before, after) {
88899
89128
  const ids = (html2) => Array.from(html2.matchAll(ID_ATTRS), (match) => match[1]);
88900
89129
  const renamed = ids(after);
88901
89130
  const renames = /* @__PURE__ */ new Map();
88902
- ids(before).forEach((from, index) => {
88903
- const to = renamed[index];
89131
+ ids(before).forEach((from, index2) => {
89132
+ const to = renamed[index2];
88904
89133
  if (to && to !== from) renames.set(from, to);
88905
89134
  });
88906
89135
  return renames;
@@ -88939,13 +89168,13 @@ function selectorList(text) {
88939
89168
  const selectors = [];
88940
89169
  let depth = 0;
88941
89170
  let start = 0;
88942
- for (let index = 0; index < text.length; index++) {
88943
- const char = text[index];
89171
+ for (let index2 = 0; index2 < text.length; index2++) {
89172
+ const char = text[index2];
88944
89173
  if (char === "(" || char === "[") depth++;
88945
89174
  else if (char === ")" || char === "]") depth--;
88946
89175
  else if (char === "," && depth === 0) {
88947
- selectors.push(text.slice(start, index).trim());
88948
- start = index + 1;
89176
+ selectors.push(text.slice(start, index2).trim());
89177
+ start = index2 + 1;
88949
89178
  }
88950
89179
  }
88951
89180
  selectors.push(text.slice(start).trim());
@@ -88990,10 +89219,10 @@ function savedMarkupElseLive(saved2, live, sourceFile) {
88990
89219
  async function readSavedMarkup(readSaved, paths, lives) {
88991
89220
  const sources = /* @__PURE__ */ new Map();
88992
89221
  return Promise.all(
88993
- paths.map(async (path, index) => {
89222
+ paths.map(async (path, index2) => {
88994
89223
  if (!sources.has(path)) sources.set(path, readSaved(path).then(parseSavedSource));
88995
89224
  const saved2 = await sources.get(path);
88996
- return savedMarkupElseLive(saved2, lives[index], path);
89225
+ return savedMarkupElseLive(saved2, lives[index2], path);
88997
89226
  })
88998
89227
  );
88999
89228
  }
@@ -89118,8 +89347,8 @@ function useClipboard({
89118
89347
  async (targets) => {
89119
89348
  const paths = targets.elements.map((el) => el.sourceFile || activeCompPath || "index.html");
89120
89349
  const markup = await readSavedMarkup(readSaved, paths, targets.lives);
89121
- return targets.elements.map((element, index) => ({
89122
- html: markup[index],
89350
+ return targets.elements.map((element, index2) => ({
89351
+ html: markup[index2],
89123
89352
  start: element.start,
89124
89353
  duration: element.duration,
89125
89354
  // authoredTrack, not track: `track` can be a display-lane number
@@ -90023,8 +90252,8 @@ function useToast() {
90023
90252
  setToasts((prev) => {
90024
90253
  const next = [...prev, { id, message, tone }];
90025
90254
  while (next.length > MAX_TOASTS) {
90026
- const dropped = next.shift();
90027
- if (dropped) clearTimer(dropped.id);
90255
+ const dropped2 = next.shift();
90256
+ if (dropped2) clearTimer(dropped2.id);
90028
90257
  }
90029
90258
  return next;
90030
90259
  });
@@ -90932,7 +91161,7 @@ function useImpression(anchor2, route) {
90932
91161
  };
90933
91162
  if (typeof IntersectionObserver === "undefined") return record();
90934
91163
  const seen = new IntersectionObserver((entries) => {
90935
- if (!entries.some((entry2) => entry2.isIntersecting)) return;
91164
+ if (!entries.some((entry3) => entry3.isIntersecting)) return;
90936
91165
  seen.disconnect();
90937
91166
  record();
90938
91167
  });
@@ -91884,8 +92113,8 @@ function partitionKeyframesByGroup(keyframes) {
91884
92113
  }
91885
92114
  return groupOrder.map((group) => byGroup.get(group));
91886
92115
  }
91887
- function reloadOnlyLast(index, count) {
91888
- return index === count - 1 ? { softReload: true } : { skipReload: true };
92116
+ function reloadOnlyLast(index2, count) {
92117
+ return index2 === count - 1 ? { softReload: true } : { skipReload: true };
91889
92118
  }
91890
92119
  function recordingEnd(selection) {
91891
92120
  const start = Number.parseFloat(selection.dataAttributes?.start ?? "0") || 0;
@@ -92030,7 +92259,7 @@ function useGestureCommit({
92030
92259
  ...kf.ease ? { ease: kf.ease } : {}
92031
92260
  }));
92032
92261
  const constantSpeed = { ease: "none" };
92033
- const mapped = keyframes.map((kf, index) => ({
92262
+ const mapped = keyframes.map((kf, index2) => ({
92034
92263
  percentage: roundPct3(
92035
92264
  progressAtTime(
92036
92265
  runEase,
@@ -92038,7 +92267,7 @@ function useGestureCommit({
92038
92267
  )
92039
92268
  ),
92040
92269
  properties: kf.properties,
92041
- ...kf.ease ? { ease: kf.ease } : index > 0 ? constantSpeed : {}
92270
+ ...kf.ease ? { ease: kf.ease } : index2 > 0 ? constantSpeed : {}
92042
92271
  }));
92043
92272
  const merged = [...preserved, ...mapped].sort((a, b) => a.percentage - b.percentage);
92044
92273
  await commit2(
@@ -92055,7 +92284,7 @@ function useGestureCommit({
92055
92284
  );
92056
92285
  } else {
92057
92286
  const keyframeGroups = partitionKeyframesByGroup(keyframes);
92058
- for (const [index, groupKfs] of keyframeGroups.entries()) {
92287
+ for (const [index2, groupKfs] of keyframeGroups.entries()) {
92059
92288
  await commit2(
92060
92289
  {
92061
92290
  type: "add-with-keyframes",
@@ -92072,7 +92301,7 @@ function useGestureCommit({
92072
92301
  {
92073
92302
  label: "Gesture recording (new range)",
92074
92303
  ...coalesceOptions,
92075
- ...reloadOnlyLast(index, keyframeGroups.length)
92304
+ ...reloadOnlyLast(index2, keyframeGroups.length)
92076
92305
  }
92077
92306
  );
92078
92307
  }
@@ -92080,7 +92309,7 @@ function useGestureCommit({
92080
92309
  }
92081
92310
  } else {
92082
92311
  const keyframeGroups = partitionKeyframesByGroup(keyframes);
92083
- for (const [index, groupKfs] of keyframeGroups.entries()) {
92312
+ for (const [index2, groupKfs] of keyframeGroups.entries()) {
92084
92313
  await commit2(
92085
92314
  {
92086
92315
  type: "add-with-keyframes",
@@ -92094,7 +92323,7 @@ function useGestureCommit({
92094
92323
  {
92095
92324
  label: "Gesture recording",
92096
92325
  ...coalesceOptions,
92097
- ...reloadOnlyLast(index, keyframeGroups.length)
92326
+ ...reloadOnlyLast(index2, keyframeGroups.length)
92098
92327
  }
92099
92328
  );
92100
92329
  }
@@ -92819,7 +93048,7 @@ var stopCurrentPreview = null;
92819
93048
  function AudioRow({
92820
93049
  projectId,
92821
93050
  asset,
92822
- used,
93051
+ used: used2,
92823
93052
  meta,
92824
93053
  onCopy,
92825
93054
  copyFeedback,
@@ -92852,7 +93081,7 @@ function AudioRow({
92852
93081
  const setPreviewAsset = useAssetPreviewStore((s) => s.setPreviewAsset);
92853
93082
  const clearPreviewAsset = useAssetPreviewStore((s) => s.clearPreviewAsset);
92854
93083
  const activateRow = useCallback166(() => {
92855
- if (used) {
93084
+ if (used2) {
92856
93085
  const clip = findClipForAsset(elements, asset);
92857
93086
  if (clip) {
92858
93087
  clearPreviewAsset();
@@ -92864,7 +93093,7 @@ function AudioRow({
92864
93093
  }
92865
93094
  setPreviewAsset(asset, projectId);
92866
93095
  }, [
92867
- used,
93096
+ used2,
92868
93097
  elements,
92869
93098
  asset,
92870
93099
  projectId,
@@ -93010,7 +93239,7 @@ function AudioRow({
93010
93239
  /* @__PURE__ */ jsx217(
93011
93240
  "span",
93012
93241
  {
93013
- className: `text-[12px] font-medium truncate ${used ? "text-panel-text-1" : "text-panel-text-3"}`,
93242
+ className: `text-[12px] font-medium truncate ${used2 ? "text-panel-text-1" : "text-panel-text-3"}`,
93014
93243
  children: name
93015
93244
  }
93016
93245
  ),
@@ -93018,7 +93247,7 @@ function AudioRow({
93018
93247
  meta?.duration ? `${meta.duration}s \xB7 ` : "",
93019
93248
  subtype
93020
93249
  ] }),
93021
- used && /* @__PURE__ */ jsx217("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm shrink-0", children: "in use" }),
93250
+ used2 && /* @__PURE__ */ jsx217("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm shrink-0", children: "in use" }),
93022
93251
  (isCopied || copyFailed) && /* @__PURE__ */ jsx217(
93023
93252
  "span",
93024
93253
  {
@@ -93240,7 +93469,7 @@ function useProbedDuration(src, skip) {
93240
93469
  function AssetCard({
93241
93470
  projectId,
93242
93471
  asset,
93243
- used,
93472
+ used: used2,
93244
93473
  duration,
93245
93474
  onCopy,
93246
93475
  copyFeedback,
@@ -93271,7 +93500,7 @@ function AssetCard({
93271
93500
  pointerDownRef.current = { x: e.clientX, y: e.clientY };
93272
93501
  }, []);
93273
93502
  const activateCard = useCallback167(() => {
93274
- if (used) {
93503
+ if (used2) {
93275
93504
  const clip = findClipForAsset(elements, asset);
93276
93505
  if (clip) {
93277
93506
  clearPreviewAsset();
@@ -93283,7 +93512,7 @@ function AssetCard({
93283
93512
  }
93284
93513
  setPreviewAsset(asset, projectId);
93285
93514
  }, [
93286
- used,
93515
+ used2,
93287
93516
  elements,
93288
93517
  asset,
93289
93518
  projectId,
@@ -93351,14 +93580,14 @@ function AssetCard({
93351
93580
  )
93352
93581
  ] }),
93353
93582
  (!isImage && !isVideo || isImage && imgError) && /* @__PURE__ */ jsx220("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsx220("span", { className: "text-[10px] font-medium text-neutral-600", children: extension }) }),
93354
- used && /* @__PURE__ */ jsx220("span", { className: "absolute top-1 left-1 text-[9px] font-semibold leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-1", children: "Added" }),
93583
+ used2 && /* @__PURE__ */ jsx220("span", { className: "absolute top-1 left-1 text-[9px] font-semibold leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-1", children: "Added" }),
93355
93584
  durationLabel && /* @__PURE__ */ jsx220("span", { className: "absolute top-1 right-1 text-[9px] font-medium leading-none px-1.5 py-[3px] rounded-sm bg-neutral-950/80 text-panel-text-2 tabular-nums", children: durationLabel })
93356
93585
  ] }),
93357
93586
  /* @__PURE__ */ jsxs172("div", { className: "flex items-center justify-center gap-1", children: [
93358
93587
  /* @__PURE__ */ jsx220(
93359
93588
  "span",
93360
93589
  {
93361
- className: `text-[10px] leading-tight text-center ${used ? "text-panel-text-2" : "text-panel-text-4"}`,
93590
+ className: `text-[10px] leading-tight text-center ${used2 ? "text-panel-text-2" : "text-panel-text-4"}`,
93362
93591
  title: fullName,
93363
93592
  children: truncateMiddle(fullName, 22)
93364
93593
  }
@@ -93385,7 +93614,7 @@ function AssetCard({
93385
93614
  }
93386
93615
  function FontRow({
93387
93616
  asset,
93388
- used,
93617
+ used: used2,
93389
93618
  onCopy,
93390
93619
  copyFeedback,
93391
93620
  onDelete,
@@ -93421,13 +93650,13 @@ function FontRow({
93421
93650
  /* @__PURE__ */ jsx220(
93422
93651
  "span",
93423
93652
  {
93424
- className: `text-xs font-medium truncate block ${used ? "text-panel-text-1" : "text-panel-text-3"}`,
93653
+ className: `text-xs font-medium truncate block ${used2 ? "text-panel-text-1" : "text-panel-text-3"}`,
93425
93654
  children: name
93426
93655
  }
93427
93656
  ),
93428
93657
  /* @__PURE__ */ jsxs172("div", { className: "flex items-center gap-1.5", children: [
93429
93658
  /* @__PURE__ */ jsx220("span", { className: "text-[10px] text-neutral-600 truncate", children: extension }),
93430
- used && /* @__PURE__ */ jsx220("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm", children: "in use" }),
93659
+ used2 && /* @__PURE__ */ jsx220("span", { className: "text-[9px] font-medium text-accent-ink bg-panel-accent/10 px-1.5 py-px rounded-sm", children: "in use" }),
93431
93660
  /* @__PURE__ */ jsx220(CopyChip, { feedback: copyFeedback, asset })
93432
93661
  ] })
93433
93662
  ] })
@@ -93458,9 +93687,9 @@ function filterByUsage(assets, usedPaths, usageFilter) {
93458
93687
  return assets;
93459
93688
  }
93460
93689
  function countUsage(assets, usedPaths) {
93461
- let used = 0;
93462
- for (const a of assets) if (usedPaths.has(a)) used++;
93463
- return { used, unused: assets.length - used };
93690
+ let used2 = 0;
93691
+ for (const a of assets) if (usedPaths.has(a)) used2++;
93692
+ return { used: used2, unused: assets.length - used2 };
93464
93693
  }
93465
93694
  function deriveUsedPaths(elements) {
93466
93695
  const paths = /* @__PURE__ */ new Set();
@@ -94429,7 +94658,7 @@ function useNearViewport() {
94429
94658
  if (!element || near4) return;
94430
94659
  if (typeof IntersectionObserver === "undefined") return setNear(true);
94431
94660
  const observer = new IntersectionObserver(
94432
- (entries) => entries.some((entry2) => entry2.isIntersecting) && setNear(true),
94661
+ (entries) => entries.some((entry3) => entry3.isIntersecting) && setNear(true),
94433
94662
  { root: element.closest("[data-composition-list]"), rootMargin: "200px" }
94434
94663
  );
94435
94664
  observer.observe(element);
@@ -95542,7 +95771,7 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
95542
95771
  ]
95543
95772
  }
95544
95773
  ),
95545
- visibleLayers.map((layer, index) => {
95774
+ visibleLayers.map((layer, index2) => {
95546
95775
  const selected = layer.key === selectedKey;
95547
95776
  const isDragged = layer.key === dragKey;
95548
95777
  const draggable = isLayerDraggable(layer);
@@ -95556,12 +95785,12 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
95556
95785
  return /* @__PURE__ */ jsxs179(
95557
95786
  "div",
95558
95787
  {
95559
- "data-layer-index": index,
95788
+ "data-layer-index": index2,
95560
95789
  role: "button",
95561
95790
  tabIndex: 0,
95562
95791
  onClick: () => !dragKey && handleSelectLayer(layer),
95563
95792
  onDoubleClick: () => !dragKey && handleLayerDoubleClick(layer),
95564
- onPointerDown: (e) => handleRowPointerDown(index, e),
95793
+ onPointerDown: (e) => handleRowPointerDown(index2, e),
95565
95794
  onPointerEnter: () => !dragKey && handleLayerHover(layer),
95566
95795
  onKeyDown: (e) => {
95567
95796
  if (e.key === "Enter" || e.key === " ") {