@hyperframes/studio 0.8.212 → 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;
@@ -28271,6 +28281,8 @@ function mediaUrlSourceOptions(reader) {
28271
28281
  const failuresByStart = /* @__PURE__ */ new Map();
28272
28282
  const inFlightReads = new AbortController();
28273
28283
  let ranges = reader === "thumbnail" ? "unknown" : "hidden";
28284
+ let etag;
28285
+ const noteEtag = (response) => void (etag ??= response.headers.get("ETag") ?? void 0);
28274
28286
  const fetchFn = async (input, init) => {
28275
28287
  const sent = ranges === "readable" ? boundedRange(init) : init;
28276
28288
  const asked = Number(rangeStart(sent, true) ?? 0);
@@ -28281,6 +28293,7 @@ function mediaUrlSourceOptions(reader) {
28281
28293
  );
28282
28294
  const response = await typedFetch(reader, input, sent ?? {}, asked, request2);
28283
28295
  if (ranges !== "hidden") ranges = rangesReadable(sent, response) ? "readable" : "hidden";
28296
+ noteEtag(response);
28284
28297
  return typedResponse(response, asked, request2);
28285
28298
  };
28286
28299
  const getRetryDelay = (_previousAttempts, error) => {
@@ -28293,8 +28306,9 @@ function mediaUrlSourceOptions(reader) {
28293
28306
  return 0.5 * (failed2 + 1);
28294
28307
  };
28295
28308
  const cancelReads = () => inFlightReads.abort(new DOMException("Media reads cancelled", "AbortError"));
28296
- if (reader === "probe") return { fetchFn, getRetryDelay, cancelReads };
28297
- 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 };
28298
28312
  }
28299
28313
  function reportMediaFetchFailure(error) {
28300
28314
  if (!(error instanceof MediaFetchError)) return;
@@ -28308,23 +28322,23 @@ var loadMediabunny = () => mediabunnyModule ??= import("mediabunny");
28308
28322
  var abortError = () => new DOMException("Aborted", "AbortError");
28309
28323
  var timedOut = (signal) => signal.reason?.name === "TimeoutError";
28310
28324
  var isAbortError = (error) => error?.name === "AbortError";
28311
- function dispose(source, entry2) {
28312
- if (entry2.disposed) return;
28313
- entry2.disposed = true;
28314
- if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28315
- if (pool.get(source) === entry2) pool.delete(source);
28316
- entry2.input?.dispose();
28317
- entry2.cancelReads?.();
28318
- }
28319
- function retire(source, entry2) {
28320
- if (pool.get(source) === entry2) pool.delete(source);
28321
- 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);
28322
28336
  }
28323
28337
  async function open(source, pooled) {
28324
28338
  const mediabunny = await loadMediabunny();
28325
- const entry2 = pooled();
28339
+ const entry3 = pooled();
28326
28340
  const live = () => {
28327
- if (entry2.disposed) throw abortError();
28341
+ if (entry3.disposed) throw abortError();
28328
28342
  };
28329
28343
  live();
28330
28344
  const options = mediaUrlSourceOptions("thumbnail");
@@ -28332,8 +28346,8 @@ async function open(source, pooled) {
28332
28346
  source: new mediabunny.UrlSource(source, options),
28333
28347
  formats: mediabunny.ALL_FORMATS
28334
28348
  });
28335
- entry2.input = input;
28336
- entry2.cancelReads = options.cancelReads;
28349
+ entry3.input = input;
28350
+ entry3.cancelReads = options.cancelReads;
28337
28351
  const track2 = await input.getPrimaryVideoTrack();
28338
28352
  live();
28339
28353
  if (!track2) throw new Error("Video source has no decodable video track");
@@ -28347,29 +28361,30 @@ async function open(source, pooled) {
28347
28361
  }
28348
28362
  const metadataDuration = await track2.getDurationFromMetadata({ skipLiveWait: true });
28349
28363
  live();
28350
- 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() };
28351
28366
  }
28352
28367
  function pooledSource(source, version) {
28353
28368
  const current = pool.get(source);
28354
28369
  if (current && current.version === version) return current;
28355
28370
  if (current) retire(source, current);
28356
- const entry2 = {
28371
+ const entry3 = {
28357
28372
  version,
28358
28373
  input: null,
28359
28374
  cancelReads: null,
28360
28375
  ready: false,
28361
- opened: open(source, () => entry2),
28376
+ opened: open(source, () => entry3),
28362
28377
  users: 0,
28363
28378
  progress: { framesFromAnyJob: 0 },
28364
28379
  idleTimer: null,
28365
28380
  disposed: false
28366
28381
  };
28367
- entry2.opened.then(
28368
- () => entry2.ready = true,
28369
- () => retire(source, entry2)
28382
+ entry3.opened.then(
28383
+ () => entry3.ready = true,
28384
+ () => retire(source, entry3)
28370
28385
  );
28371
- pool.set(source, entry2);
28372
- return entry2;
28386
+ pool.set(source, entry3);
28387
+ return entry3;
28373
28388
  }
28374
28389
  function untilAborted(pending2, signal) {
28375
28390
  if (signal.aborted) return Promise.reject(abortError());
@@ -28380,27 +28395,27 @@ function untilAborted(pending2, signal) {
28380
28395
  });
28381
28396
  }
28382
28397
  async function acquireThumbnailSource(source, version, signal, idleMs) {
28383
- const entry2 = pooledSource(source, version);
28384
- const waitedForOpen = !entry2.ready;
28385
- entry2.users += 1;
28386
- if (entry2.idleTimer !== null) clearTimeout(entry2.idleTimer);
28387
- 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;
28388
28403
  let released2 = false;
28389
28404
  const release2 = (failed2) => {
28390
28405
  if (released2) return;
28391
28406
  released2 = true;
28392
- entry2.users -= 1;
28393
- if (failed2) retire(source, entry2);
28394
- if (entry2.users > 0 || entry2.disposed) return;
28395
- if (pool.get(source) === entry2 && idleMs > 0) {
28396
- 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);
28397
28412
  } else {
28398
- dispose(source, entry2);
28413
+ dispose(source, entry3);
28399
28414
  }
28400
28415
  };
28401
28416
  try {
28402
- const { progress } = entry2;
28403
- 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 };
28404
28419
  } catch (error) {
28405
28420
  release2(!isAbortError(error) || timedOut(signal));
28406
28421
  throw error;
@@ -28450,6 +28465,154 @@ function releaseSharedFrames(held, budgetBytes) {
28450
28465
  }
28451
28466
  }
28452
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
+
28453
28616
  // src/player/lib/thumbnailVideoDecoder.ts
28454
28617
  var LAST_FRAME_INSET_S = 1e-3;
28455
28618
  function videoThumbnailTimestamps(start, duration, frameCount) {
@@ -28459,11 +28622,19 @@ function videoThumbnailTimestamps(start, duration, frameCount) {
28459
28622
  if (count === 1) return [safeStart + safeDuration / 2];
28460
28623
  const edges = Array.from(
28461
28624
  { length: count },
28462
- (_, index) => safeStart + safeDuration * index / count
28625
+ (_, index2) => safeStart + safeDuration * index2 / count
28463
28626
  );
28464
28627
  return [...edges, safeStart + Math.max(0, safeDuration - LAST_FRAME_INSET_S)];
28465
28628
  }
28466
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
+ }
28467
28638
  var accepts = (window2, time, decodedAt) => decodedAt >= window2.sourceStart && time - decodedAt <= (time >= window2.end ? 0 : window2.lead);
28468
28639
  var ClipResultError = class extends Error {
28469
28640
  };
@@ -28553,6 +28724,7 @@ async function decodeFrames(sink, times, slots, signal, resources, progress) {
28553
28724
  throwIfAborted(signal);
28554
28725
  const frame3 = shareFrame(target.key, target.decodedAt, URL.createObjectURL(blob), blob.size);
28555
28726
  progress.framesFromAnyJob += 1;
28727
+ resources.store?.(target.slot, target.decodedAt, blob);
28556
28728
  resources.urls[target.slot] = frame3.url;
28557
28729
  resources.held.push({ key: target.key, frame: frame3 });
28558
28730
  }
@@ -28575,6 +28747,42 @@ function loadedResult(resources, aspect, budgets, frameCount = resources.urls.le
28575
28747
  dispose: () => releaseDecodedResources(resources)
28576
28748
  };
28577
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
+ }
28578
28786
  async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPORT_BUDGETS) {
28579
28787
  const fit = request2.fit ?? "cover";
28580
28788
  const sourceKey = createThumbnailKey({ source: request2.source, version: request2.contentVersion });
@@ -28585,24 +28793,30 @@ async function decodeVideoThumbnail(request2, signal, budgets = TIMELINE_VIEWPOR
28585
28793
  canvases: /* @__PURE__ */ new Set(),
28586
28794
  releasedFrameBytes: budgets.sharedFrameCacheBytes
28587
28795
  };
28588
- const entry2 = sourceInfos.get(request2.source);
28589
- const known = entry2?.version === request2.contentVersion ? entry2?.info : void 0;
28796
+ const entry3 = sourceInfos.get(request2.source);
28590
28797
  try {
28798
+ const stored = await storedVersionOf(request2);
28799
+ const known = entry3 && entry3.version === request2.contentVersion ? entry3.info : stored && await readStoredInfo(stored);
28591
28800
  if (known) {
28592
- 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) {
28593
28807
  throwIfAborted(signal);
28594
28808
  return loadedResult(resources, known.aspect, budgets);
28595
28809
  }
28596
28810
  releaseDecodedResources(resources);
28597
28811
  }
28598
- return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources);
28812
+ return await decodeMissingFrames(request2, signal, budgets, keyOf17, resources, stored);
28599
28813
  } catch (error) {
28600
28814
  releaseDecodedResources(resources);
28601
28815
  reportMediaFetchFailure(error);
28602
28816
  throw error;
28603
28817
  }
28604
28818
  }
28605
- async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources) {
28819
+ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources, stored) {
28606
28820
  let source;
28607
28821
  try {
28608
28822
  source = await acquireThumbnailSource(
@@ -28629,6 +28843,7 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28629
28843
  sourceInfos.set(request2.source, { version: request2.contentVersion, info });
28630
28844
  const strip = stripTimes(request2, info, budgets);
28631
28845
  const { timestamps, window: window2 } = strip;
28846
+ storeForNextSession(request2, info, budgets, resources, stored ?? versionRead(request2, source));
28632
28847
  const slots = takeDecodedFrames(
28633
28848
  strip,
28634
28849
  keyOf17,
@@ -28812,8 +29027,8 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
28812
29027
  frameW,
28813
29028
  frameCount,
28814
29029
  watchGap: watchGap2,
28815
- children: (index) => {
28816
- const src = urls[thumbnailFrameForTile(index, frameCount, urls.length)];
29030
+ children: (index2) => {
29031
+ const src = urls[thumbnailFrameForTile(index2, frameCount, urls.length)];
28817
29032
  return /* @__PURE__ */ jsx78(
28818
29033
  "div",
28819
29034
  {
@@ -28829,7 +29044,7 @@ var VideoThumbnail = memo22(function VideoThumbnail2({
28829
29044
  }
28830
29045
  )
28831
29046
  },
28832
- index
29047
+ index2
28833
29048
  );
28834
29049
  }
28835
29050
  }
@@ -28979,7 +29194,7 @@ var CompositionThumbnail = memo23(function CompositionThumbnail2({
28979
29194
  animation: "hf-thumb-fade 200ms ease-out",
28980
29195
  mixBlendMode: "var(--timeline-composition-thumbnail-blend)"
28981
29196
  },
28982
- children: (index) => /* @__PURE__ */ jsx79(
29197
+ children: (index2) => /* @__PURE__ */ jsx79(
28983
29198
  "div",
28984
29199
  {
28985
29200
  className: "relative h-full shrink-0 overflow-hidden",
@@ -28995,7 +29210,7 @@ var CompositionThumbnail = memo23(function CompositionThumbnail2({
28995
29210
  }
28996
29211
  )
28997
29212
  },
28998
- index
29213
+ index2
28999
29214
  )
29000
29215
  }
29001
29216
  ),
@@ -29922,11 +30137,11 @@ function nonEmpty(value, fallback) {
29922
30137
  function optionalNonEmpty(value) {
29923
30138
  return value || void 0;
29924
30139
  }
29925
- function attachCompositionSource(entry2, element, compositionSrc) {
29926
- if (compositionSrc) return { ...entry2, compositionSrc };
30140
+ function attachCompositionSource(entry3, element, compositionSrc) {
30141
+ if (compositionSrc) return { ...entry3, compositionSrc };
29927
30142
  const innerVideo = element.querySelector("video[src]");
29928
- if (!innerVideo) return entry2;
29929
- return { ...entry2, src: optionalNonEmpty(innerVideo.getAttribute("src")), tag: "video" };
30143
+ if (!innerVideo) return entry3;
30144
+ return { ...entry3, src: optionalNonEmpty(innerVideo.getAttribute("src")), tag: "video" };
29930
30145
  }
29931
30146
  function buildMissingCompositionEntry(params) {
29932
30147
  const { doc, iframeWin, element, compositionId, rootDuration, fallbackIndex } = params;
@@ -29960,7 +30175,7 @@ function buildMissingCompositionEntry(params) {
29960
30175
  selectorIndex,
29961
30176
  sourceFile
29962
30177
  });
29963
- const entry2 = {
30178
+ const entry3 = {
29964
30179
  id: identity.id,
29965
30180
  label,
29966
30181
  transitionLabel: transitionLabels.get(element) ?? element.getAttribute("data-transition-label") ?? void 0,
@@ -29979,7 +30194,7 @@ function buildMissingCompositionEntry(params) {
29979
30194
  zIndex: readTimelineElementZIndex(element),
29980
30195
  src: optionalNonEmpty(element.getAttribute("src")) ? new URL(element.getAttribute("src"), element.baseURI).href : void 0
29981
30196
  };
29982
- return attachCompositionSource(entry2, element, compositionSrc);
30197
+ return attachCompositionSource(entry3, element, compositionSrc);
29983
30198
  }
29984
30199
  function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuration) {
29985
30200
  const existingIds = new Set(currentEls.map((e) => e.id));
@@ -29999,7 +30214,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
29999
30214
  if (!compId || compId === rootCompId) continue;
30000
30215
  if (existingIds.has(el.id) || existingIds.has(compId)) continue;
30001
30216
  resolveEnd ??= createReferenceEndResolver(createTimedElementLookup(doc), iframeWin);
30002
- const entry2 = buildMissingCompositionEntry({
30217
+ const entry3 = buildMissingCompositionEntry({
30003
30218
  doc,
30004
30219
  iframeWin,
30005
30220
  element: el,
@@ -30009,7 +30224,7 @@ function buildMissingCompositionElements(doc, iframeWin, currentEls, rootDuratio
30009
30224
  resolveEnd,
30010
30225
  masterTime
30011
30226
  });
30012
- if (entry2) missing.push(entry2);
30227
+ if (entry3) missing.push(entry3);
30013
30228
  }
30014
30229
  if (!doc.querySelector("[data-composition-src], [data-composition-file]"))
30015
30230
  return { missing, updatedEls: currentEls, patched: false };
@@ -30063,7 +30278,7 @@ function createTimelineElementFromManifestClip(params) {
30063
30278
  selectorIndex,
30064
30279
  sourceFile
30065
30280
  });
30066
- const entry2 = {
30281
+ const entry3 = {
30067
30282
  id: identity.id,
30068
30283
  label,
30069
30284
  transitionLabel: hostEl && transitionLabels.get(hostEl) || hostEl?.getAttribute("data-transition-label") || void 0,
@@ -30091,42 +30306,42 @@ function createTimelineElementFromManifestClip(params) {
30091
30306
  playbackRate: clip.playbackRate
30092
30307
  };
30093
30308
  if (hostEl) {
30094
- applyMediaMetadataFromElement(entry2, hostEl);
30095
- if (!entry2.src) {
30309
+ applyMediaMetadataFromElement(entry3, hostEl);
30310
+ if (!entry3.src) {
30096
30311
  const rawSrc = hostEl.getAttribute("src");
30097
- if (rawSrc) entry2.src = new URL(rawSrc, hostEl.baseURI).href;
30312
+ if (rawSrc) entry3.src = new URL(rawSrc, hostEl.baseURI).href;
30098
30313
  }
30099
- if (hostEl.hasAttribute("data-hidden")) entry2.hidden = true;
30314
+ if (hostEl.hasAttribute("data-hidden")) entry3.hidden = true;
30100
30315
  const timelineRole = hostEl.getAttribute("data-timeline-role");
30101
- if (timelineRole) entry2.timelineRole = timelineRole;
30316
+ if (timelineRole) entry3.timelineRole = timelineRole;
30102
30317
  const link = hostEl.getAttribute("data-link");
30103
- if (link) entry2.link = link;
30318
+ if (link) entry3.link = link;
30104
30319
  const compositionScope = linkScopeOf(hostEl)?.getAttribute("data-composition-id");
30105
- if (compositionScope) entry2.compositionScope = compositionScope;
30320
+ if (compositionScope) entry3.compositionScope = compositionScope;
30106
30321
  const syncOrigin = hostEl.getAttribute("data-sync-origin");
30107
- if (syncOrigin) entry2.syncOrigin = syncOrigin;
30322
+ if (syncOrigin) entry3.syncOrigin = syncOrigin;
30108
30323
  const audioGroup = hostEl.getAttribute("data-audio-group");
30109
30324
  if (audioGroup) {
30110
- entry2.audioGroup = audioGroup;
30325
+ entry3.audioGroup = audioGroup;
30111
30326
  const info = groupInfoFor(doc ?? hostEl.ownerDocument, audioGroup);
30112
- entry2.audioGroupLabel = info.label;
30113
- entry2.audioGroupVolume = info.volume;
30114
- entry2.audioGroupHidden = info.hidden;
30115
- if (info.fxChain) entry2.audioGroupFxChain = info.fxChain;
30116
- 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;
30117
30332
  }
30118
30333
  const masterChain = readMasterFxChain(doc ?? hostEl.ownerDocument);
30119
- if (masterChain) entry2.masterChain = masterChain;
30334
+ if (masterChain) entry3.masterChain = masterChain;
30120
30335
  const fxChain = hostEl.getAttribute("data-fx-chain");
30121
- if (fxChain) entry2.fxChain = fxChain;
30336
+ if (fxChain) entry3.fxChain = fxChain;
30122
30337
  const automation = hostEl.getAttribute("data-automation");
30123
- if (automation) entry2.automation = automation;
30124
- entry2.zIndex = readTimelineElementZIndex(hostEl);
30338
+ if (automation) entry3.automation = automation;
30339
+ entry3.zIndex = readTimelineElementZIndex(hostEl);
30125
30340
  }
30126
- if (clip.assetUrl) entry2.src = clip.assetUrl;
30341
+ if (clip.assetUrl) entry3.src = clip.assetUrl;
30127
30342
  if (clip.kind === "composition" && clip.compositionId) {
30128
- entry2.playbackStart ??= 0;
30129
- entry2.playbackRate ??= 1;
30343
+ entry3.playbackStart ??= 0;
30344
+ entry3.playbackRate ??= 1;
30130
30345
  let resolvedSrc = clip.compositionSrc;
30131
30346
  if (!resolvedSrc) {
30132
30347
  if (hostEl?.getAttribute("data-composition-id") !== clip.compositionId) {
@@ -30135,34 +30350,34 @@ function createTimelineElementFromManifestClip(params) {
30135
30350
  resolvedSrc = hostEl?.getAttribute("data-composition-src") ?? hostEl?.getAttribute("data-composition-file") ?? null;
30136
30351
  }
30137
30352
  if (resolvedSrc) {
30138
- entry2.compositionSrc = resolvedSrc;
30353
+ entry3.compositionSrc = resolvedSrc;
30139
30354
  } else if (hostEl) {
30140
30355
  const innerVideo = hostEl.querySelector("video[src]");
30141
30356
  if (innerVideo) {
30142
- entry2.src = innerVideo.getAttribute("src") || void 0;
30143
- entry2.tag = "video";
30357
+ entry3.src = innerVideo.getAttribute("src") || void 0;
30358
+ entry3.tag = "video";
30144
30359
  }
30145
30360
  }
30146
30361
  if (hostEl) {
30147
- entry2.domId = hostEl.id || void 0;
30148
- entry2.hfId = hostEl.getAttribute("data-hf-id") || void 0;
30149
- entry2.selector = getTimelineElementSelector(hostEl);
30150
- entry2.selectorIndex = doc && entry2.selector ? getTimelineElementSelectorIndex(doc, hostEl, entry2.selector) : void 0;
30151
- 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);
30152
30367
  const nextIdentity = buildTimelineElementIdentity({
30153
30368
  preferredId: clip.id,
30154
30369
  label,
30155
30370
  fallbackIndex,
30156
- domId: entry2.domId,
30157
- selector: entry2.selector,
30158
- selectorIndex: entry2.selectorIndex,
30159
- sourceFile: entry2.sourceFile
30371
+ domId: entry3.domId,
30372
+ selector: entry3.selector,
30373
+ selectorIndex: entry3.selectorIndex,
30374
+ sourceFile: entry3.sourceFile
30160
30375
  });
30161
- entry2.id = nextIdentity.id;
30162
- entry2.key = nextIdentity.key;
30376
+ entry3.id = nextIdentity.id;
30377
+ entry3.key = nextIdentity.key;
30163
30378
  }
30164
30379
  }
30165
- return entry2;
30380
+ return entry3;
30166
30381
  }
30167
30382
  function parseTimelineFromDOM(doc, rootDuration, timelines) {
30168
30383
  const rootComp = doc.querySelector("[data-composition-id]");
@@ -30210,7 +30425,7 @@ function parseTimelineFromDOM(doc, rootDuration, timelines) {
30210
30425
  selectorIndex,
30211
30426
  sourceFile
30212
30427
  });
30213
- const entry2 = {
30428
+ const entry3 = {
30214
30429
  id: identity.id,
30215
30430
  label,
30216
30431
  transitionLabel: transitionLabels.get(el) ?? el.getAttribute("data-transition-label") ?? void 0,
@@ -30231,59 +30446,59 @@ function parseTimelineFromDOM(doc, rootDuration, timelines) {
30231
30446
  zIndex: readTimelineElementZIndex(el)
30232
30447
  };
30233
30448
  const mediaEl = resolveMediaElement(el);
30234
- applyMediaMetadataFromElement(entry2, el);
30449
+ applyMediaMetadataFromElement(entry3, el);
30235
30450
  if (mediaEl) {
30236
30451
  if (mediaEl.tagName === "IMG") {
30237
- entry2.tag = "img";
30452
+ entry3.tag = "img";
30238
30453
  }
30239
30454
  const resolvedSrc = mediaEl.src || void 0;
30240
- if (resolvedSrc) entry2.src = resolvedSrc;
30455
+ if (resolvedSrc) entry3.src = resolvedSrc;
30241
30456
  }
30242
30457
  const domMasterChain = readMasterFxChain(doc);
30243
- if (domMasterChain) entry2.masterChain = domMasterChain;
30458
+ if (domMasterChain) entry3.masterChain = domMasterChain;
30244
30459
  const domFxChain = el.getAttribute("data-fx-chain");
30245
- if (domFxChain) entry2.fxChain = domFxChain;
30460
+ if (domFxChain) entry3.fxChain = domFxChain;
30246
30461
  const domAutomation = el.getAttribute("data-automation");
30247
- if (domAutomation) entry2.automation = domAutomation;
30462
+ if (domAutomation) entry3.automation = domAutomation;
30248
30463
  if (el.hasAttribute("data-timeline-locked")) {
30249
- entry2.timelineLocked = true;
30464
+ entry3.timelineLocked = true;
30250
30465
  }
30251
30466
  if (el.hasAttribute("data-hidden")) {
30252
- entry2.hidden = true;
30467
+ entry3.hidden = true;
30253
30468
  }
30254
30469
  const timelineRole = el.getAttribute("data-timeline-role");
30255
- if (timelineRole) entry2.timelineRole = timelineRole;
30470
+ if (timelineRole) entry3.timelineRole = timelineRole;
30256
30471
  const domLink = el.getAttribute("data-link");
30257
- if (domLink) entry2.link = domLink;
30472
+ if (domLink) entry3.link = domLink;
30258
30473
  const domCompositionScope = linkScopeOf(el)?.getAttribute("data-composition-id");
30259
- if (domCompositionScope) entry2.compositionScope = domCompositionScope;
30474
+ if (domCompositionScope) entry3.compositionScope = domCompositionScope;
30260
30475
  const domSyncOrigin = el.getAttribute("data-sync-origin");
30261
- if (domSyncOrigin) entry2.syncOrigin = domSyncOrigin;
30476
+ if (domSyncOrigin) entry3.syncOrigin = domSyncOrigin;
30262
30477
  const domAudioGroup = el.getAttribute("data-audio-group");
30263
30478
  if (domAudioGroup) {
30264
- entry2.audioGroup = domAudioGroup;
30479
+ entry3.audioGroup = domAudioGroup;
30265
30480
  const domGroupInfo = groupInfoFor(doc, domAudioGroup);
30266
- entry2.audioGroupLabel = domGroupInfo.label;
30267
- entry2.audioGroupVolume = domGroupInfo.volume;
30268
- entry2.audioGroupHidden = domGroupInfo.hidden;
30269
- if (domGroupInfo.fxChain) entry2.audioGroupFxChain = domGroupInfo.fxChain;
30270
- 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;
30271
30486
  }
30272
30487
  const compSrc = el.getAttribute("data-composition-src") || el.getAttribute("data-composition-file");
30273
30488
  if (compSrc) {
30274
- entry2.compositionSrc = compSrc;
30489
+ entry3.compositionSrc = compSrc;
30275
30490
  } else if (compId && compId !== rootComp?.getAttribute("data-composition-id")) {
30276
30491
  const innerMedia = el.querySelector("video[src], img[src]");
30277
30492
  if (innerMedia) {
30278
- entry2.src = innerMedia.getAttribute("src") || void 0;
30279
- entry2.tag = innerMedia.tagName === "IMG" ? "img" : "video";
30493
+ entry3.src = innerMedia.getAttribute("src") || void 0;
30494
+ entry3.tag = innerMedia.tagName === "IMG" ? "img" : "video";
30280
30495
  }
30281
30496
  }
30282
- if (entry2.kind === "composition") {
30283
- entry2.playbackStart ??= 0;
30284
- entry2.playbackRate ??= 1;
30497
+ if (entry3.kind === "composition") {
30498
+ entry3.playbackStart ??= 0;
30499
+ entry3.playbackRate ??= 1;
30285
30500
  }
30286
- els.push(entry2);
30501
+ els.push(entry3);
30287
30502
  });
30288
30503
  return els;
30289
30504
  }
@@ -30440,11 +30655,11 @@ function safeContentDocument(iframe) {
30440
30655
  }
30441
30656
  function buildTimelineElementsFromClips(clips, iframeDoc) {
30442
30657
  const resolveHost = iframeDoc ? createTimelineDomNodeResolver(iframeDoc) : null;
30443
- return clips.map((clip, index) => {
30444
- const hostEl = resolveHost?.(clip, index) ?? null;
30658
+ return clips.map((clip, index2) => {
30659
+ const hostEl = resolveHost?.(clip, index2) ?? null;
30445
30660
  return createTimelineElementFromManifestClip({
30446
30661
  clip,
30447
- fallbackIndex: index,
30662
+ fallbackIndex: index2,
30448
30663
  doc: iframeDoc,
30449
30664
  hostEl
30450
30665
  });
@@ -30855,7 +31070,7 @@ function withTweenIndex(run) {
30855
31070
  }
30856
31071
  }
30857
31072
  function indexTweens(children) {
30858
- const index = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
31073
+ const index2 = { byElement: /* @__PURE__ */ new Map(), byId: /* @__PURE__ */ new Map() };
30859
31074
  const add = (map, key2, tween) => {
30860
31075
  const list = map.get(key2);
30861
31076
  if (!list) map.set(key2, [tween]);
@@ -30863,19 +31078,19 @@ function indexTweens(children) {
30863
31078
  };
30864
31079
  for (const tween of children) {
30865
31080
  for (const target of tween.targets?.() ?? []) {
30866
- add(index.byElement, target, tween);
31081
+ add(index2.byElement, target, tween);
30867
31082
  const id = target.id;
30868
- if (id) add(index.byId, id, tween);
31083
+ if (id) add(index2.byId, id, tween);
30869
31084
  }
30870
31085
  }
30871
- return index;
31086
+ return index2;
30872
31087
  }
30873
31088
  function tweensTargeting(timeline, el) {
30874
31089
  if (!timeline || typeof timeline !== "object" || !tweenIndexes)
30875
31090
  return (timeline?.getChildren?.(true) ?? []).filter((tween) => matchesElement(tween, el));
30876
- let index = tweenIndexes.get(timeline);
30877
- if (!index) tweenIndexes.set(timeline, index = indexTweens(timeline.getChildren?.(true) ?? []));
30878
- 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)) ?? [];
30879
31094
  }
30880
31095
 
30881
31096
  // src/hooks/gsapParsedTween.ts
@@ -32384,17 +32599,17 @@ function validateFixtureSpec(spec) {
32384
32599
  const geometry = PROFILE_GEOMETRY[spec.profile];
32385
32600
  return geometry;
32386
32601
  }
32387
- function fixtureTrack(index, spec) {
32388
- if (index < TRACK_COUNT) return index;
32389
- 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;
32390
32605
  const denseTrackCount = Math.ceil((spec.elementCount - TRACK_COUNT) / 127);
32391
- return (index - TRACK_COUNT) % Math.max(1, denseTrackCount);
32606
+ return (index2 - TRACK_COUNT) % Math.max(1, denseTrackCount);
32392
32607
  }
32393
- function fixtureStart(index, profile, duration, clipDuration2) {
32394
- const available = Math.max(0, duration - clipDuration2);
32395
- if (profile === "dense-short") return index % 128 * 0.5;
32396
- if (profile === "long-overlap") return index * 37 % Math.max(1, available);
32397
- 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);
32398
32613
  }
32399
32614
  function keyframeData() {
32400
32615
  return {
@@ -32427,26 +32642,26 @@ function createTimelinePerformanceFixture(spec) {
32427
32642
  const keyframeCache = /* @__PURE__ */ new Map();
32428
32643
  const gsapAnimations = /* @__PURE__ */ new Map();
32429
32644
  const expandedClipIds = /* @__PURE__ */ new Set();
32430
- for (let index = 0; index < spec.elementCount; index += 1) {
32431
- const id = `perf-${spec.profile}-${spec.elementCount}-${index}`;
32432
- const start = fixtureStart(index, spec.profile, geometry.duration, geometry.clipDuration);
32433
- 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);
32434
32649
  const element = {
32435
32650
  id,
32436
32651
  key: id,
32437
32652
  domId: id,
32438
32653
  selector: `#${id}`,
32439
- label: `Fixture ${index + 1}`,
32440
- 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",
32441
32656
  start,
32442
32657
  duration: geometry.clipDuration,
32443
32658
  track: track2,
32444
32659
  authoredTrack: track2
32445
32660
  };
32446
32661
  if (spec.profile === "composition-heavy") {
32447
- element.compositionSrc = `compositions/perf-${index % 32}.html`;
32662
+ element.compositionSrc = `compositions/perf-${index2 % 32}.html`;
32448
32663
  } else if (spec.profile === "remote-unsupported") {
32449
- 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`;
32450
32665
  }
32451
32666
  if (spec.profile === "keyframe-heavy-expanded") {
32452
32667
  keyframeCache.set(id, keyframeData());
@@ -32539,9 +32754,9 @@ function evictMetadataOverflow() {
32539
32754
  ...Array.from(cache, ([key2, value]) => ({ key: key2, at: value.lastAccess, failed: false })),
32540
32755
  ...Array.from(failed, ([key2, value]) => ({ key: key2, at: value.lastAccess, failed: true }))
32541
32756
  ].sort((left, right) => left.at - right.at);
32542
- for (const entry2 of entries.slice(0, overflow)) {
32543
- if (entry2.failed) failed.delete(entry2.key);
32544
- 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);
32545
32760
  }
32546
32761
  }
32547
32762
  function applyCachedSourceDurations(elements, projectId) {
@@ -32624,6 +32839,10 @@ function shouldStopAfterSeek(input) {
32624
32839
  }
32625
32840
 
32626
32841
  // src/player/hooks/previewMessageRouter.ts
32842
+ import {
32843
+ parseMediaLoadFailure,
32844
+ RUNTIME_MEDIA_LOAD_FAILED
32845
+ } from "@hyperframes/core/runtime/protocol";
32627
32846
  function isForeignSource(e, iframe) {
32628
32847
  return Boolean(e.source && iframe && e.source !== iframe.contentWindow);
32629
32848
  }
@@ -32680,6 +32899,12 @@ function applyStoreReport(data) {
32680
32899
  case "preview-facts":
32681
32900
  store.setPreviewFacts(parsePreviewFacts(data.facts));
32682
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
+ }
32683
32908
  default:
32684
32909
  return false;
32685
32910
  }
@@ -32748,8 +32973,8 @@ var RENDERED_FIELDS = [
32748
32973
  ];
32749
32974
  function timelineElementsChanged(previous, next) {
32750
32975
  if (next.length !== previous.length) return true;
32751
- return next.some((element, index) => {
32752
- const prior = previous[index];
32976
+ return next.some((element, index2) => {
32977
+ const prior = previous[index2];
32753
32978
  return !prior || RENDERED_FIELDS.some((key2) => element[key2] !== prior[key2]) || !sameTimelineText(element.text, prior.text);
32754
32979
  });
32755
32980
  }
@@ -33274,9 +33499,9 @@ function useCompositionStack({
33274
33499
  const compIdToSrcRef = useRef50(compIdToSrc);
33275
33500
  compIdToSrcRef.current = compIdToSrc;
33276
33501
  const handleNavigateComposition = useCallback42(
33277
- (index) => {
33502
+ (index2) => {
33278
33503
  usePlayerStore.getState().setElements([]);
33279
- updateCompositionStack((prev) => prev.slice(0, index + 1));
33504
+ updateCompositionStack((prev) => prev.slice(0, index2 + 1));
33280
33505
  },
33281
33506
  // eslint-disable-next-line react-hooks/exhaustive-deps
33282
33507
  []
@@ -36590,9 +36815,9 @@ function hasAuthorPointerEventsNone(el) {
36590
36815
  }
36591
36816
  function collectPointerEventsNoneTargets(elements) {
36592
36817
  const disabled = /* @__PURE__ */ new WeakSet();
36593
- for (const entry2 of elements) {
36594
- if (isHtmlElement(entry2) && hasAuthorPointerEventsNone(entry2)) {
36595
- disabled.add(entry2);
36818
+ for (const entry3 of elements) {
36819
+ if (isHtmlElement(entry3) && hasAuthorPointerEventsNone(entry3)) {
36820
+ disabled.add(entry3);
36596
36821
  }
36597
36822
  }
36598
36823
  return disabled;
@@ -37300,8 +37525,8 @@ function rectsEqual(a, b) {
37300
37525
  function groupOverlayItemsEqual(a, b) {
37301
37526
  if (a === b) return true;
37302
37527
  if (a.length !== b.length) return false;
37303
- return a.every((item, index) => {
37304
- const other = b[index];
37528
+ return a.every((item, index2) => {
37529
+ const other = b[index2];
37305
37530
  return Boolean(
37306
37531
  other && item.key === other.key && item.element === other.element && item.selection === other.selection && rectsEqual(item.rect, other.rect)
37307
37532
  );
@@ -37923,7 +38148,7 @@ function useDomEditOverlayRects({
37923
38148
  sel && hoverSel && selectionCacheKey(sel) === selectionCacheKey(hoverSel)
37924
38149
  );
37925
38150
  const hoverMatchesGroup = Boolean(
37926
- hoverSel && group.some((entry2) => selectionCacheKey(entry2) === selectionCacheKey(hoverSel))
38151
+ hoverSel && group.some((entry3) => selectionCacheKey(entry3) === selectionCacheKey(hoverSel))
37927
38152
  );
37928
38153
  if (!hoverSel || hoverMatchesSelection || hoverMatchesGroup) {
37929
38154
  resolvedHoverElementRef.current = null;
@@ -38057,7 +38282,7 @@ function OffCanvasIndicators({
38057
38282
  function ChildRectOutlines({
38058
38283
  rects
38059
38284
  }) {
38060
- return /* @__PURE__ */ jsx95(Fragment28, { children: rects.map((rect, index) => /* @__PURE__ */ jsx95(
38285
+ return /* @__PURE__ */ jsx95(Fragment28, { children: rects.map((rect, index2) => /* @__PURE__ */ jsx95(
38061
38286
  "div",
38062
38287
  {
38063
38288
  className: "pointer-events-none absolute border border-dashed border-white/20 rounded-xs",
@@ -38070,7 +38295,7 @@ function ChildRectOutlines({
38070
38295
  transform: rect.angle ? `rotate(${rect.angle}deg)` : void 0
38071
38296
  }
38072
38297
  },
38073
- index
38298
+ index2
38074
38299
  )) });
38075
38300
  }
38076
38301
 
@@ -38251,21 +38476,21 @@ function hasEditMarks(doc) {
38251
38476
  if (!Observer) return scanForEditMarks(doc);
38252
38477
  let cache2 = editMarkCaches.get(doc);
38253
38478
  if (!cache2) {
38254
- const entry2 = {
38479
+ const entry3 = {
38255
38480
  observer: new Observer(() => {
38256
- entry2.stale = true;
38481
+ entry3.stale = true;
38257
38482
  }),
38258
38483
  stale: true,
38259
38484
  has: false
38260
38485
  };
38261
- entry2.observer.observe(doc, {
38486
+ entry3.observer.observe(doc, {
38262
38487
  subtree: true,
38263
38488
  childList: true,
38264
38489
  attributes: true,
38265
38490
  attributeFilter: STUDIO_EDIT_ATTRS
38266
38491
  });
38267
- editMarkCaches.set(doc, entry2);
38268
- cache2 = entry2;
38492
+ editMarkCaches.set(doc, entry3);
38493
+ cache2 = entry3;
38269
38494
  }
38270
38495
  if (cache2.observer.takeRecords().length > 0) cache2.stale = true;
38271
38496
  if (cache2.stale) {
@@ -40775,8 +41000,8 @@ function createDomEditOverlayGestureHandlers(opts) {
40775
41000
  pointer: `${Math.round(rawDx)},${Math.round(rawDy)}`,
40776
41001
  applied: `${Math.round(dx)},${Math.round(dy)}`,
40777
41002
  committed: Object.fromEntries(
40778
- updates.map((update, index) => [
40779
- groupG.members[index]?.key ?? String(index),
41003
+ updates.map((update, index2) => [
41004
+ groupG.members[index2]?.key ?? String(index2),
40780
41005
  `${Math.round(update.next.x)},${Math.round(update.next.y)}`
40781
41006
  ])
40782
41007
  ),
@@ -42419,8 +42644,8 @@ function graphemeBounds(runs, start, end) {
42419
42644
  end: boundaries.find((boundary) => boundary >= end) ?? end
42420
42645
  };
42421
42646
  }
42422
- function atEndOfSegment({ index, segment }) {
42423
- return index + segment.length;
42647
+ function atEndOfSegment({ index: index2, segment }) {
42648
+ return index2 + segment.length;
42424
42649
  }
42425
42650
  function boundaryAtOrBefore(boundaries, offset) {
42426
42651
  let previous = offset;
@@ -42440,7 +42665,7 @@ function readCoveredInlineStyleChars(range) {
42440
42665
  const end = offsetOf2(host, range.endContainer, range.endOffset);
42441
42666
  if (start === null || end === null) return null;
42442
42667
  const collapsed = start === end;
42443
- 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 }));
42444
42669
  return covered.length > 0 ? covered : null;
42445
42670
  }
42446
42671
  function editingHost(node) {
@@ -42501,8 +42726,8 @@ function identityOf(element) {
42501
42726
  }
42502
42727
  function ownStyle(element) {
42503
42728
  const style = {};
42504
- for (let index = 0; index < element.style.length; index += 1) {
42505
- const property = element.style.item(index);
42729
+ for (let index2 = 0; index2 < element.style.length; index2 += 1) {
42730
+ const property = element.style.item(index2);
42506
42731
  if (!property) continue;
42507
42732
  const value = element.style.getPropertyValue(property);
42508
42733
  if (isRichTextFormattingStyle(property, value)) style[property] = value;
@@ -42512,9 +42737,9 @@ function ownStyle(element) {
42512
42737
  function charRuns(runs) {
42513
42738
  const perChar = [];
42514
42739
  for (const run of runs) {
42515
- for (let index = 0; index < run.text.length; index += 1) {
42740
+ for (let index2 = 0; index2 < run.text.length; index2 += 1) {
42516
42741
  perChar.push({
42517
- char: run.text[index] ?? "",
42742
+ char: run.text[index2] ?? "",
42518
42743
  style: run.style,
42519
42744
  origin: run.origin,
42520
42745
  identity: run.identity,
@@ -42528,11 +42753,11 @@ function restyle(runs, start, end, delta) {
42528
42753
  const text = runs.map((run) => run.text).join("");
42529
42754
  const perChar = charRuns(runs);
42530
42755
  const next = [];
42531
- for (let index = 0; index < text.length; index += 1) {
42756
+ for (let index2 = 0; index2 < text.length; index2 += 1) {
42532
42757
  appendChar(
42533
42758
  next,
42534
- text[index] ?? "",
42535
- charAfter(perChar[index], index >= start && index < end, delta)
42759
+ text[index2] ?? "",
42760
+ charAfter(perChar[index2], index2 >= start && index2 < end, delta)
42536
42761
  );
42537
42762
  }
42538
42763
  return next;
@@ -42592,8 +42817,8 @@ function runNodes(doc, runs) {
42592
42817
  function runNode(doc, run, carried) {
42593
42818
  const key2 = styleKey(run.style);
42594
42819
  const nodes = [];
42595
- for (const [index, piece] of run.text.split(BREAK).entries()) {
42596
- 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"));
42597
42822
  if (!piece) continue;
42598
42823
  if (!key2 && carried.size === 0) {
42599
42824
  nodes.push(doc.createTextNode(piece));
@@ -42858,7 +43083,7 @@ function swatchBackground(distinctColours, agreed) {
42858
43083
  if (distinctColours.length === 0) return agreed || DEFAULT_COLOR;
42859
43084
  if (distinctColours.length === 1) return distinctColours[0];
42860
43085
  const stops = distinctColours.map(
42861
- (colour, index) => `${colour} ${(index / (distinctColours.length - 1) * 100).toFixed(2)}%`
43086
+ (colour, index2) => `${colour} ${(index2 / (distinctColours.length - 1) * 100).toFixed(2)}%`
42862
43087
  );
42863
43088
  return `linear-gradient(135deg, ${stops.join(", ")})`;
42864
43089
  }
@@ -45309,7 +45534,7 @@ function useElementLifecycleOps({
45309
45534
  (entries, gestureCoalesceKey, actionKind) => {
45310
45535
  if (entries.length === 0) return Promise.resolve();
45311
45536
  return (async () => {
45312
- const releaseZPersists = entries.map((entry2) => beginLayerZPersist(entry2.element));
45537
+ const releaseZPersists = entries.map((entry3) => beginLayerZPersist(entry3.element));
45313
45538
  try {
45314
45539
  onReorderShadow?.(
45315
45540
  entries.map((e) => readHfId(e.element)).filter((id) => id != null)
@@ -45318,58 +45543,58 @@ function useElementLifecycleOps({
45318
45543
  const patchesBySourceFile = /* @__PURE__ */ new Map();
45319
45544
  const rollbacks = [];
45320
45545
  const revealCommits = [];
45321
- for (const entry2 of entries) {
45322
- const priorZIndex = entry2.element.style.zIndex;
45323
- const priorPosition = entry2.element.style.position;
45324
- 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;
45325
45550
  let positionChanged = false;
45326
- const liftPriorPosition = entry2.element.getAttribute(LAYER_REVEAL_PRIOR_POSITION_ATTR);
45327
- const revealOwnership = beginLayerRevealCommit(entry2.element);
45551
+ const liftPriorPosition = entry3.element.getAttribute(LAYER_REVEAL_PRIOR_POSITION_ATTR);
45552
+ const revealOwnership = beginLayerRevealCommit(entry3.element);
45328
45553
  if (revealOwnership) {
45329
- revealCommits.push({ element: entry2.element, ownership: revealOwnership });
45554
+ revealCommits.push({ element: entry3.element, ownership: revealOwnership });
45330
45555
  }
45331
- entry2.element.style.zIndex = String(entry2.zIndex);
45556
+ entry3.element.style.zIndex = String(entry3.zIndex);
45332
45557
  const patches = [
45333
- { type: "inline-style", property: "z-index", value: String(entry2.zIndex) }
45558
+ { type: "inline-style", property: "z-index", value: String(entry3.zIndex) }
45334
45559
  ];
45335
45560
  try {
45336
- const win = entry2.element.ownerDocument?.defaultView;
45337
- 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);
45338
45563
  if (effectivePosition === "static") {
45339
- entry2.element.style.position = "relative";
45564
+ entry3.element.style.position = "relative";
45340
45565
  positionChanged = true;
45341
45566
  patches.push({ type: "inline-style", property: "position", value: "relative" });
45342
45567
  }
45343
45568
  } catch {
45344
45569
  }
45345
- if (entry2.key) {
45346
- 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 });
45347
45572
  }
45348
45573
  rollbacks.push(() => {
45349
45574
  if (revealOwnership) {
45350
- rollbackLayerRevealCommit(entry2.element, revealOwnership);
45575
+ rollbackLayerRevealCommit(entry3.element, revealOwnership);
45351
45576
  } else {
45352
- entry2.element.style.zIndex = priorZIndex;
45353
- if (positionChanged) entry2.element.style.position = priorPosition;
45577
+ entry3.element.style.zIndex = priorZIndex;
45578
+ if (positionChanged) entry3.element.style.position = priorPosition;
45354
45579
  }
45355
- if (entry2.key && priorStoreEntry) {
45356
- usePlayerStore.getState().updateElement(entry2.key, {
45580
+ if (entry3.key && priorStoreEntry) {
45581
+ usePlayerStore.getState().updateElement(entry3.key, {
45357
45582
  zIndex: priorStoreEntry.zIndex,
45358
45583
  hasExplicitZIndex: priorStoreEntry.hasExplicitZIndex
45359
45584
  });
45360
45585
  }
45361
45586
  });
45362
- const filePatches = patchesBySourceFile.get(entry2.sourceFile) ?? [];
45587
+ const filePatches = patchesBySourceFile.get(entry3.sourceFile) ?? [];
45363
45588
  filePatches.push({
45364
45589
  target: buildDomEditPatchTarget({
45365
- id: entry2.id,
45366
- hfId: readHfId(entry2.element),
45367
- selector: entry2.selector,
45368
- selectorIndex: entry2.selectorIndex
45590
+ id: entry3.id,
45591
+ hfId: readHfId(entry3.element),
45592
+ selector: entry3.selector,
45593
+ selectorIndex: entry3.selectorIndex
45369
45594
  }),
45370
45595
  operations: patches
45371
45596
  });
45372
- patchesBySourceFile.set(entry2.sourceFile, filePatches);
45597
+ patchesBySourceFile.set(entry3.sourceFile, filePatches);
45373
45598
  }
45374
45599
  const batches = [...patchesBySourceFile].map(([sourceFile, patches]) => ({
45375
45600
  sourceFile,
@@ -45675,17 +45900,17 @@ function describeZIndexElement(element) {
45675
45900
  }
45676
45901
  function resolveZIndexEntries(sel, patches, activeCompPath) {
45677
45902
  const entries = [];
45678
- const dropped = [];
45903
+ const dropped2 = [];
45679
45904
  for (const patch of patches) {
45680
45905
  if (patch.element === sel.element) {
45681
45906
  entries.push(selectedZIndexEntry(sel, patch.zIndex));
45682
45907
  continue;
45683
45908
  }
45684
- const entry2 = siblingZIndexEntry(patch.element, patch.zIndex, sel.sourceFile, activeCompPath);
45685
- if (entry2) entries.push(entry2);
45686
- 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);
45687
45912
  }
45688
- return { entries, dropped };
45913
+ return { entries, dropped: dropped2 };
45689
45914
  }
45690
45915
  var isLive = (element) => element.isConnected && element.ownerDocument.defaultView !== null;
45691
45916
  function useDomEditZOrder() {
@@ -45700,12 +45925,12 @@ function useDomEditZOrder() {
45700
45925
  const commit2 = useCallback63(
45701
45926
  (sel, patches, action, crossed) => {
45702
45927
  if (readOnly) return false;
45703
- const { entries, dropped } = resolveZIndexEntries(sel, patches, activeCompPath);
45704
- if (dropped.length > 0) {
45705
- 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);
45706
45931
  console.warn(
45707
45932
  "[studio] z-index reorder: dropping sibling(s) with no stable id/selector (will revert on reload):",
45708
- dropped.map((patch) => describeZIndexElement(patch.element)).join(", ")
45933
+ dropped2.map((patch) => describeZIndexElement(patch.element)).join(", ")
45709
45934
  );
45710
45935
  }
45711
45936
  if (entries.length === 0) return false;
@@ -45838,8 +46063,8 @@ function mintElementHandle(address) {
45838
46063
  if (address.hfId) return `hf${SEPARATOR}${scoped(address.hfId)}`;
45839
46064
  if (address.domId) return `dom${SEPARATOR}${scoped(address.domId)}`;
45840
46065
  if (address.selector) {
45841
- const index = address.selectorIndex ?? 0;
45842
- 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}`;
45843
46068
  }
45844
46069
  return null;
45845
46070
  }
@@ -45909,13 +46134,13 @@ function parseElementHandle(handle) {
45909
46134
  const scoped2 = parseScopedValue(rest);
45910
46135
  return scoped2 ? { scheme, ...scoped2, index: 0 } : null;
45911
46136
  }
45912
- const index = Number(rest.slice(indexAt + 1));
45913
- if (!Number.isInteger(index) || index < 0) {
46137
+ const index2 = Number(rest.slice(indexAt + 1));
46138
+ if (!Number.isInteger(index2) || index2 < 0) {
45914
46139
  const scoped2 = parseScopedValue(rest);
45915
46140
  return scoped2 ? { scheme, ...scoped2, index: 0 } : null;
45916
46141
  }
45917
46142
  const scoped = parseScopedValue(rest.slice(0, indexAt));
45918
- return scoped ? { scheme, ...scoped, index } : null;
46143
+ return scoped ? { scheme, ...scoped, index: index2 } : null;
45919
46144
  }
45920
46145
  function resolveElementHandle(doc, handle) {
45921
46146
  const parsed = parseElementHandle(handle);
@@ -46492,11 +46717,11 @@ function findSourceContextIndex(items, targetIndex) {
46492
46717
  const target = items[targetIndex];
46493
46718
  let contextIndex = targetIndex;
46494
46719
  let parentDepth = target.depth - 1;
46495
- for (let index = targetIndex - 1; index >= 0 && parentDepth >= 0; index--) {
46496
- const item = items[index];
46720
+ for (let index2 = targetIndex - 1; index2 >= 0 && parentDepth >= 0; index2--) {
46721
+ const item = items[index2];
46497
46722
  if (item.depth !== parentDepth) continue;
46498
46723
  if (item.sourceFile !== target.sourceFile) break;
46499
- contextIndex = index;
46724
+ contextIndex = index2;
46500
46725
  parentDepth -= 1;
46501
46726
  }
46502
46727
  return contextIndex;
@@ -46504,8 +46729,8 @@ function findSourceContextIndex(items, targetIndex) {
46504
46729
  function collectSourceContours(items, contextIndex, target) {
46505
46730
  const context = items[contextIndex];
46506
46731
  const contours = [];
46507
- for (let index = contextIndex + 1; index < items.length; index++) {
46508
- const item = items[index];
46732
+ for (let index2 = contextIndex + 1; index2 < items.length; index2++) {
46733
+ const item = items[index2];
46509
46734
  if (item.depth <= context.depth) break;
46510
46735
  if (item.sourceFile === target.sourceFile && item.element !== target.element) {
46511
46736
  contours.push(item.element);
@@ -46557,8 +46782,8 @@ function measureTopologyLensGeometry(input) {
46557
46782
  rect: fieldUsesContext ? measuredField : target
46558
46783
  },
46559
46784
  target: { label: elements.target.tagName.toLowerCase(), rect: target },
46560
- contours: measured.slice(contourOffset).map((rect, index) => ({
46561
- label: elements.contours[index].tagName.toLowerCase(),
46785
+ contours: measured.slice(contourOffset).map((rect, index2) => ({
46786
+ label: elements.contours[index2].tagName.toLowerCase(),
46562
46787
  rect
46563
46788
  })).filter((item) => isRenderableRect(item.rect))
46564
46789
  };
@@ -46720,7 +46945,7 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
46720
46945
  }
46721
46946
  ),
46722
46947
  (state.phase === "acquiring" || state.phase === "sealing") && /* @__PURE__ */ jsxs74(Fragment32, { children: [
46723
- geometry.contours.map(({ label, rect }, index) => /* @__PURE__ */ jsx107(
46948
+ geometry.contours.map(({ label, rect }, index2) => /* @__PURE__ */ jsx107(
46724
46949
  "div",
46725
46950
  {
46726
46951
  "data-topology-contour": "true",
@@ -46728,10 +46953,10 @@ function TopologyLens({ iframeRef, activeCompositionPath }) {
46728
46953
  className: "hf-topology-contour pointer-events-none absolute z-1 rounded-sm",
46729
46954
  style: {
46730
46955
  ...rectStyle(rect),
46731
- animationDelay: `${Math.min(index, 5) * 28}ms`
46956
+ animationDelay: `${Math.min(index2, 5) * 28}ms`
46732
46957
  }
46733
46958
  },
46734
- index
46959
+ index2
46735
46960
  )),
46736
46961
  !reducedMotion2 && /* @__PURE__ */ jsx107(
46737
46962
  "div",
@@ -46833,17 +47058,17 @@ function updateKeyframeCacheFromParsed(animations, targetPath, selectionId, muta
46833
47058
  const mutated = mutationSelector ? resolveSelectorElementIds(mutationSelector, doc) : [];
46834
47059
  const targetIds = mutated.length > 0 ? mutated : selectionId ? [selectionId] : [];
46835
47060
  publishKeyframeCache((draft) => {
46836
- for (const [id, entry2] of merged) {
46837
- writeElementIntoDraft(draft, targetPath, id, entry2, sourceAnimations.get(id));
47061
+ for (const [id, entry3] of merged) {
47062
+ writeElementIntoDraft(draft, targetPath, id, entry3, sourceAnimations.get(id));
46838
47063
  }
46839
47064
  for (const targetId of targetIds) {
46840
47065
  if (!idsWithKeyframes.has(targetId)) deleteElementFromDraft(draft, targetPath, targetId);
46841
47066
  }
46842
47067
  });
46843
47068
  }
46844
- function writeElementIntoDraft(draft, sourceFile, elementId2, entry2, animations) {
47069
+ function writeElementIntoDraft(draft, sourceFile, elementId2, entry3, animations) {
46845
47070
  for (const key2 of elementCacheKeys(sourceFile, elementId2)) {
46846
- draft.keyframeCache.set(key2, entry2);
47071
+ draft.keyframeCache.set(key2, entry3);
46847
47072
  if (animations) draft.gsapAnimations.set(key2, animations);
46848
47073
  else draft.gsapAnimations.delete(key2);
46849
47074
  }
@@ -46864,10 +47089,10 @@ function cachedElementIdsForFile(sourceFile, keyframeCache, gsapAnimations) {
46864
47089
  if (key2.startsWith(sfPrefix)) ids.add(key2.slice(sfPrefix.length));
46865
47090
  }
46866
47091
  if (sourceFile !== "index.html") return ids;
46867
- for (const [key2, entry2] of keyframeCache) {
47092
+ for (const [key2, entry3] of keyframeCache) {
46868
47093
  const hash = key2.indexOf("#");
46869
47094
  const id = key2.slice(hash + 1);
46870
- if (hash > 0 && !key2.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry2) {
47095
+ if (hash > 0 && !key2.startsWith(sfPrefix) && keyframeCache.get(sfPrefix + id) === entry3) {
46871
47096
  ids.delete(id);
46872
47097
  }
46873
47098
  }
@@ -46919,8 +47144,8 @@ function replaceKeyframeCacheForFile(sourceFile, entries, animationsByElement) {
46919
47144
  )) {
46920
47145
  deleteElementFromDraft(draft, sourceFile, id);
46921
47146
  }
46922
- for (const [id, entry2] of entries) {
46923
- writeElementIntoDraft(draft, sourceFile, id, entry2, animationsByElement.get(id));
47147
+ for (const [id, entry3] of entries) {
47148
+ writeElementIntoDraft(draft, sourceFile, id, entry3, animationsByElement.get(id));
46924
47149
  }
46925
47150
  });
46926
47151
  }
@@ -47842,8 +48067,8 @@ function MotionPathLine(props) {
47842
48067
  // src/utils/keyframeUsage.ts
47843
48068
  function keyframeUsageActions(mutations, semanticActions) {
47844
48069
  const actions = /* @__PURE__ */ new Set();
47845
- for (const [index, mutation] of mutations.entries()) {
47846
- const semanticAction = semanticActions?.[index];
48070
+ for (const [index2, mutation] of mutations.entries()) {
48071
+ const semanticAction = semanticActions?.[index2];
47847
48072
  if (semanticAction) {
47848
48073
  actions.add(semanticAction);
47849
48074
  continue;
@@ -47875,16 +48100,16 @@ function changedMutationIndices(result, count, options) {
47875
48100
  if (!Array.isArray(changes) || changes.length !== count || changes.some((value) => typeof value !== "boolean"))
47876
48101
  return [];
47877
48102
  return changes.flatMap(
47878
- (changed, index) => changed && options?.[index]?.keyframeTelemetry !== false ? [index] : []
48103
+ (changed, index2) => changed && options?.[index2]?.keyframeTelemetry !== false ? [index2] : []
47879
48104
  );
47880
48105
  }
47881
48106
  function trackKeyframeCommit(mutations, result, options, memberOptions) {
47882
48107
  if (!result.ok || result.changed !== true || options.keyframeTelemetry === false) return;
47883
48108
  const indices = changedMutationIndices(result, mutations.length, memberOptions);
47884
48109
  const actions = keyframeUsageActions(
47885
- indices.map((index) => mutations[index]),
48110
+ indices.map((index2) => mutations[index2]),
47886
48111
  indices.map(
47887
- (index) => memberOptions?.[index]?.keyframeAction ?? (mutations.length === 1 ? options.keyframeAction : void 0)
48112
+ (index2) => memberOptions?.[index2]?.keyframeAction ?? (mutations.length === 1 ? options.keyframeAction : void 0)
47888
48113
  )
47889
48114
  );
47890
48115
  const action = primaryKeyframeAction(actions);
@@ -47914,7 +48139,7 @@ function observeGsapGesture(writer) {
47914
48139
  result,
47915
48140
  calls.length,
47916
48141
  calls.map((call) => call.options)
47917
- ).map((index) => calls[index]);
48142
+ ).map((index2) => calls[index2]);
47918
48143
  for (const action of keyframeUsageActions(
47919
48144
  members.map((call) => call.mutation),
47920
48145
  members.map((call) => call.options.keyframeAction)
@@ -48271,9 +48496,9 @@ function commitNodeDrop(drop) {
48271
48496
  }
48272
48497
  return done.then(() => trackPreviewEditResult("motion_path", "drag", writes.finish()));
48273
48498
  }
48274
- function commitAddWaypoint(animationId, index, x, y, commit2) {
48499
+ function commitAddWaypoint(animationId, index2, x, y, commit2) {
48275
48500
  return commit2(
48276
- { type: "add-motion-path-point", animationId, index, x, y },
48501
+ { type: "add-motion-path-point", animationId, index: index2, x, y },
48277
48502
  motionPathCommitOptions("Add waypoint", "button")
48278
48503
  );
48279
48504
  }
@@ -48283,9 +48508,9 @@ function commitAddKeyframe(animationId, percentage, x, y, commit2) {
48283
48508
  motionPathCommitOptions("Add keyframe", "button")
48284
48509
  );
48285
48510
  }
48286
- function commitRemoveWaypoint(animationId, index, commit2) {
48511
+ function commitRemoveWaypoint(animationId, index2, commit2) {
48287
48512
  return commit2(
48288
- { type: "remove-motion-path-point", animationId, index },
48513
+ { type: "remove-motion-path-point", animationId, index: index2 },
48289
48514
  motionPathCommitOptions("Remove waypoint", "button")
48290
48515
  );
48291
48516
  }
@@ -48612,15 +48837,15 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48612
48837
  const top = vr ? vr.top : rect.top;
48613
48838
  return { x: (e.clientX - left) / scale, y: (e.clientY - top) / scale };
48614
48839
  };
48615
- const onDown = (e, index, x, y, ref) => {
48840
+ const onDown = (e, index2, x, y, ref) => {
48616
48841
  if (!interactive) return;
48617
48842
  if (e.button !== 0) return;
48618
48843
  e.stopPropagation();
48619
48844
  const live = readGsapPositionFromIframe(iframeRef.current, selectorFor(selection) ?? "");
48620
- if (pressControl(e, controlForNode(e, abs[index], live))) return;
48845
+ if (pressControl(e, controlForNode(e, abs[index2], live))) return;
48621
48846
  e.target.setPointerCapture(e.pointerId);
48622
48847
  dragRef.current = {
48623
- index,
48848
+ index: index2,
48624
48849
  startX: e.clientX,
48625
48850
  startY: e.clientY,
48626
48851
  initX: x,
@@ -48629,7 +48854,7 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48629
48854
  pScale,
48630
48855
  ref
48631
48856
  };
48632
- setDraft({ index, x, y });
48857
+ setDraft({ index: index2, x, y });
48633
48858
  };
48634
48859
  const onMove = (e) => {
48635
48860
  const d = dragRef.current;
@@ -48719,11 +48944,11 @@ var MotionPathOverlay = memo31(function MotionPathOverlay2({
48719
48944
  }
48720
48945
  setGhost(null);
48721
48946
  };
48722
- const onRemove = (e, index) => {
48947
+ const onRemove = (e, index2) => {
48723
48948
  e.stopPropagation();
48724
48949
  if (!animId) return;
48725
48950
  setHoverNode(null);
48726
- void commitRemoveWaypoint(animId, index, commitMutation);
48951
+ void commitRemoveWaypoint(animId, index2, commitMutation);
48727
48952
  };
48728
48953
  const elementId2 = selection?.id ?? null;
48729
48954
  const onNodeContextMenu = (e, ref) => {
@@ -50090,12 +50315,12 @@ function usePopulateKeyframeCacheForFile(projectId, sourceFile, version, iframeR
50090
50315
  if (isPosOnly) {
50091
50316
  continue;
50092
50317
  }
50093
- const entry2 = {
50318
+ const entry3 = {
50094
50319
  format: "percentage",
50095
50320
  keyframes: data.keyframes,
50096
50321
  ...data.easeEach ? { easeEach: data.easeEach } : {}
50097
50322
  };
50098
- for (const key2 of keys) draft.keyframeCache.set(key2, entry2);
50323
+ for (const key2 of keys) draft.keyframeCache.set(key2, entry3);
50099
50324
  }
50100
50325
  });
50101
50326
  runtimeScanDoneRef.current = `kf-cache:${projectId}:${sf}:${version}`;
@@ -51223,7 +51448,7 @@ async function studioSetStyle(deps, input, signal = new AbortController().signal
51223
51448
  );
51224
51449
  }
51225
51450
  const entries = Object.entries(styles).filter(
51226
- (entry2) => typeof entry2[1] === "string"
51451
+ (entry3) => typeof entry3[1] === "string"
51227
51452
  );
51228
51453
  if (entries.length === 0) {
51229
51454
  return preDispatchFailure(
@@ -52167,11 +52392,11 @@ function onTabKeyDown(event, tab, api) {
52167
52392
  const tabs = [
52168
52393
  ...tab.closest('[role="tablist"]')?.querySelectorAll('[role="tab"]') ?? []
52169
52394
  ];
52170
- const index = tabs.indexOf(tab);
52395
+ const index2 = tabs.indexOf(tab);
52171
52396
  const last = tabs.length - 1;
52172
52397
  const targets = {
52173
- ArrowRight: index === last ? 0 : index + 1,
52174
- ArrowLeft: index === 0 ? last : index - 1,
52398
+ ArrowRight: index2 === last ? 0 : index2 + 1,
52399
+ ArrowLeft: index2 === 0 ? last : index2 - 1,
52175
52400
  Home: 0,
52176
52401
  End: last
52177
52402
  };
@@ -53184,7 +53409,7 @@ var ImageThumbnail = memo36(function ImageThumbnail2({
53184
53409
  frameW,
53185
53410
  frameCount,
53186
53411
  watchGap: watchGap2,
53187
- children: (index) => /* @__PURE__ */ jsx118(
53412
+ children: (index2) => /* @__PURE__ */ jsx118(
53188
53413
  "div",
53189
53414
  {
53190
53415
  className: "relative h-full shrink-0 overflow-hidden bg-neutral-900",
@@ -53200,7 +53425,7 @@ var ImageThumbnail = memo36(function ImageThumbnail2({
53200
53425
  }
53201
53426
  )
53202
53427
  },
53203
- index
53428
+ index2
53204
53429
  )
53205
53430
  }
53206
53431
  ),
@@ -54231,14 +54456,14 @@ function splitCssFunctions(value) {
54231
54456
  const functions = [];
54232
54457
  let depth = 0;
54233
54458
  let start = 0;
54234
- for (let index = 0; index < source.length; index += 1) {
54235
- const char = source[index];
54459
+ for (let index2 = 0; index2 < source.length; index2 += 1) {
54460
+ const char = source[index2];
54236
54461
  if (char === "(") depth += 1;
54237
54462
  if (char === ")") depth = Math.max(0, depth - 1);
54238
54463
  if (/\s/.test(char) && depth === 0) {
54239
- const part = source.slice(start, index).trim();
54464
+ const part = source.slice(start, index2).trim();
54240
54465
  if (part) functions.push(part);
54241
- start = index + 1;
54466
+ start = index2 + 1;
54242
54467
  }
54243
54468
  }
54244
54469
  const lastPart = source.slice(start).trim();
@@ -54260,7 +54485,7 @@ function setCssFilterFunctionPx(value, name, nextPx) {
54260
54485
  const nextValue = clampPanelNumber(nextPx, 0, 200, 0);
54261
54486
  const functions = splitCssFunctions(value && value.trim() !== EMPTY_FILTER_VALUE ? value : "");
54262
54487
  const lowerName = name.toLowerCase();
54263
- const filtered = functions.filter((entry2) => !entry2.toLowerCase().startsWith(`${lowerName}(`));
54488
+ const filtered = functions.filter((entry3) => !entry3.toLowerCase().startsWith(`${lowerName}(`));
54264
54489
  if (nextValue > 0) filtered.push(`${name}(${formatNumericValue(nextValue)}px)`);
54265
54490
  return filtered.length > 0 ? filtered.join(" ") : EMPTY_FILTER_VALUE;
54266
54491
  }
@@ -54306,19 +54531,19 @@ function extractBackgroundImageUrl(value) {
54306
54531
  const lowerValue = value.toLowerCase();
54307
54532
  const urlStart = lowerValue.indexOf("url(");
54308
54533
  if (urlStart < 0) return "";
54309
- let index = urlStart + 4;
54310
- while (index < value.length && (value[index] === " " || value[index] === "\n" || value[index] === "\r" || value[index] === " " || value[index] === "\f")) {
54311
- 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;
54312
54537
  }
54313
- const quote = value[index] === '"' || value[index] === "'" ? value[index] : null;
54538
+ const quote = value[index2] === '"' || value[index2] === "'" ? value[index2] : null;
54314
54539
  if (quote) {
54315
- index += 1;
54316
- const endQuote = value.indexOf(quote, index);
54317
- 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) : "";
54318
54543
  }
54319
- const endParen = value.indexOf(")", index);
54320
- if (endParen < index) return "";
54321
- return value.slice(index, endParen).trim();
54544
+ const endParen = value.indexOf(")", index2);
54545
+ if (endParen < index2) return "";
54546
+ return value.slice(index2, endParen).trim();
54322
54547
  }
54323
54548
  var ALWAYS_READ_CHANNELS = [
54324
54549
  "x",
@@ -56501,9 +56726,9 @@ function stripPreviewAssetPath(src, projectId) {
56501
56726
  const projectMarker = `/api/projects/${encodeURIComponent(projectId)}/preview/`;
56502
56727
  const genericMarker = "/preview/";
56503
56728
  const marker = pathname.includes(projectMarker) ? projectMarker : genericMarker;
56504
- const index = pathname.indexOf(marker);
56505
- if (index < 0) return null;
56506
- 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(/^\/+/, "");
56507
56732
  if (!assetPath || assetPath.startsWith("comp/")) return null;
56508
56733
  return assetPath;
56509
56734
  }
@@ -57884,7 +58109,7 @@ function FontFamilyField({
57884
58109
  const importLocalFont = async (family) => {
57885
58110
  if (!onImportFonts) return null;
57886
58111
  const candidates = localFontData.filter((f) => fontFamilyFromAssetPath(`${f.family}.ttf`) === family).sort((a, b) => localFontSortScore(a) - localFontSortScore(b));
57887
- const font = candidates.find((entry2) => typeof entry2.blob === "function");
58112
+ const font = candidates.find((entry3) => typeof entry3.blob === "function");
57888
58113
  if (!font?.blob) return null;
57889
58114
  const blob = await font.blob();
57890
58115
  const style = sanitizeFontFilePart(font.style ?? "Regular") || "Regular";
@@ -58013,13 +58238,13 @@ function FontFamilyField({
58013
58238
  )
58014
58239
  ] }),
58015
58240
  fontNotice && /* @__PURE__ */ jsx132("div", { className: "border-b border-neutral-800 px-3 py-2 text-[10px] leading-4 text-neutral-500", children: fontNotice }),
58016
- /* @__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(
58017
58242
  "button",
58018
58243
  {
58019
58244
  type: "button",
58020
- "data-font-option-index": index,
58245
+ "data-font-option-index": index2,
58021
58246
  onClick: () => commitFamily(option),
58022
- 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"}`,
58023
58248
  children: [
58024
58249
  /* @__PURE__ */ jsxs94("span", { className: "flex min-w-0 items-center gap-1.5", children: [
58025
58250
  /* @__PURE__ */ jsx132("span", { className: "truncate font-medium", style: { fontFamily: `"${option.family}"` }, children: option.family }),
@@ -58647,20 +58872,20 @@ function isDigit(char) {
58647
58872
  }
58648
58873
  function isSimpleNumber(value) {
58649
58874
  if (!value) return false;
58650
- let index = value[0] === "-" ? 1 : 0;
58875
+ let index2 = value[0] === "-" ? 1 : 0;
58651
58876
  let digits = 0;
58652
- while (isDigit(value[index])) {
58653
- index += 1;
58877
+ while (isDigit(value[index2])) {
58878
+ index2 += 1;
58654
58879
  digits += 1;
58655
58880
  }
58656
- if (value[index] === ".") {
58657
- index += 1;
58658
- while (isDigit(value[index])) {
58659
- index += 1;
58881
+ if (value[index2] === ".") {
58882
+ index2 += 1;
58883
+ while (isDigit(value[index2])) {
58884
+ index2 += 1;
58660
58885
  digits += 1;
58661
58886
  }
58662
58887
  }
58663
- return digits > 0 && index === value.length;
58888
+ return digits > 0 && index2 === value.length;
58664
58889
  }
58665
58890
  function parseCssNumber(value) {
58666
58891
  if (!value) return null;
@@ -58744,9 +58969,9 @@ function normalizeStops(stops) {
58744
58969
  { color: stops[0].color, position: 100 }
58745
58970
  ];
58746
58971
  }
58747
- const result = stops.map((stop2, index) => ({
58972
+ const result = stops.map((stop2, index2) => ({
58748
58973
  color: stop2.color,
58749
- position: stop2.position ?? index / (stops.length - 1) * 100
58974
+ position: stop2.position ?? index2 / (stops.length - 1) * 100
58750
58975
  }));
58751
58976
  return result.map((stop2) => ({
58752
58977
  color: stop2.color,
@@ -59171,8 +59396,8 @@ function GradientField({
59171
59396
  const parsed = parseGradient(value) ?? buildDefaultGradientModel(fallbackColor);
59172
59397
  const commit2 = (next) => onCommit(serializeGradient(next));
59173
59398
  const patch = (partial) => commit2({ ...parsed, ...partial });
59174
- const updateStop = (index, partial) => {
59175
- 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);
59176
59401
  commit2({ ...parsed, stops });
59177
59402
  };
59178
59403
  const addStop = (position) => {
@@ -59183,10 +59408,10 @@ function GradientField({
59183
59408
  track2("button", "Add gradient stop");
59184
59409
  commit2(nextGradient);
59185
59410
  };
59186
- const removeStop = (index) => {
59411
+ const removeStop = (index2) => {
59187
59412
  if (parsed.stops.length <= 2) return;
59188
- track2("button", `Remove gradient stop ${index + 1}`);
59189
- 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) });
59190
59415
  };
59191
59416
  const previewStyle = { backgroundImage: serializeGradient(parsed) };
59192
59417
  return /* @__PURE__ */ jsxs99("div", { className: "space-y-4", children: [
@@ -59203,12 +59428,12 @@ function GradientField({
59203
59428
  if (!rect || rect.width <= 0) return;
59204
59429
  addStop((event.clientX - rect.left) / rect.width * 100);
59205
59430
  },
59206
- children: parsed.stops.map((stop2, index) => /* @__PURE__ */ jsx138(
59431
+ children: parsed.stops.map((stop2, index2) => /* @__PURE__ */ jsx138(
59207
59432
  "div",
59208
59433
  {
59209
59434
  role: "slider",
59210
59435
  tabIndex: disabled ? -1 : 0,
59211
- "aria-label": `Stop ${index + 1} position`,
59436
+ "aria-label": `Stop ${index2 + 1} position`,
59212
59437
  "aria-valuenow": Math.round(stop2.position),
59213
59438
  "aria-valuemin": 0,
59214
59439
  "aria-valuemax": 100,
@@ -59218,7 +59443,7 @@ function GradientField({
59218
59443
  event.preventDefault();
59219
59444
  const step = event.shiftKey ? 10 : 1;
59220
59445
  const delta = event.key === "ArrowRight" ? step : -step;
59221
- updateStop(index, {
59446
+ updateStop(index2, {
59222
59447
  position: Math.max(0, Math.min(100, Math.round(stop2.position + delta)))
59223
59448
  });
59224
59449
  },
@@ -59241,7 +59466,7 @@ function GradientField({
59241
59466
  0,
59242
59467
  Math.min(100, (event.clientX - rect.left) / rect.width * 100)
59243
59468
  );
59244
- updateStop(index, { position: Math.round(next * 10) / 10 });
59469
+ updateStop(index2, { position: Math.round(next * 10) / 10 });
59245
59470
  },
59246
59471
  onPointerUp: (event) => {
59247
59472
  event.currentTarget.releasePointerCapture(event.pointerId);
@@ -59250,7 +59475,7 @@ function GradientField({
59250
59475
  event.currentTarget.releasePointerCapture(event.pointerId);
59251
59476
  }
59252
59477
  },
59253
- `stop-preview-${index}`
59478
+ `stop-preview-${index2}`
59254
59479
  ))
59255
59480
  }
59256
59481
  ),
@@ -59402,7 +59627,7 @@ function GradientField({
59402
59627
  }
59403
59628
  )
59404
59629
  ] }),
59405
- /* @__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(
59406
59631
  "div",
59407
59632
  {
59408
59633
  className: "grid min-w-0 grid-cols-[minmax(0,1fr)_68px_28px] gap-2",
@@ -59410,10 +59635,10 @@ function GradientField({
59410
59635
  /* @__PURE__ */ jsx138(
59411
59636
  ColorField,
59412
59637
  {
59413
- label: `Stop ${index + 1}`,
59638
+ label: `Stop ${index2 + 1}`,
59414
59639
  value: stop2.color,
59415
59640
  disabled,
59416
- onCommit: (next) => updateStop(index, { color: next })
59641
+ onCommit: (next) => updateStop(index2, { color: next })
59417
59642
  }
59418
59643
  ),
59419
59644
  /* @__PURE__ */ jsx138(
@@ -59422,7 +59647,7 @@ function GradientField({
59422
59647
  label: "Pos",
59423
59648
  value: `${Math.round(stop2.position)}%`,
59424
59649
  disabled,
59425
- onCommit: (next) => updateStop(index, {
59650
+ onCommit: (next) => updateStop(index2, {
59426
59651
  position: Number.parseFloat(next.replace("%", "")) || 0
59427
59652
  })
59428
59653
  }
@@ -59432,15 +59657,15 @@ function GradientField({
59432
59657
  {
59433
59658
  type: "button",
59434
59659
  disabled: disabled || parsed.stops.length <= 2,
59435
- onClick: () => removeStop(index),
59660
+ onClick: () => removeStop(index2),
59436
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",
59437
- "aria-label": `Remove stop ${index + 1}`,
59662
+ "aria-label": `Remove stop ${index2 + 1}`,
59438
59663
  children: /* @__PURE__ */ jsx138(X, { size: 12 })
59439
59664
  }
59440
59665
  )
59441
59666
  ]
59442
59667
  },
59443
- `stop-editor-${index}`
59668
+ `stop-editor-${index2}`
59444
59669
  )) })
59445
59670
  ] })
59446
59671
  ] });
@@ -60104,11 +60329,11 @@ function detectAvailableWeights(fontFamily) {
60104
60329
  if (!fonts) return ALL_WEIGHTS;
60105
60330
  const family = fontFamily.split(",")[0]?.trim().replace(/['"]/g, "");
60106
60331
  if (!family) return ALL_WEIGHTS;
60107
- const available = [];
60332
+ const available2 = [];
60108
60333
  for (const w of ALL_WEIGHTS) {
60109
- if (fonts.check(`${w} 16px "${family}"`)) available.push(w);
60334
+ if (fonts.check(`${w} 16px "${family}"`)) available2.push(w);
60110
60335
  }
60111
- return available.length > 0 ? available : ALL_WEIGHTS;
60336
+ return available2.length > 0 ? available2 : ALL_WEIGHTS;
60112
60337
  }
60113
60338
  function TextAreaField({
60114
60339
  label,
@@ -60483,7 +60708,7 @@ function TextSection({
60483
60708
  }
60484
60709
  )
60485
60710
  ] }),
60486
- /* @__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) => {
60487
60712
  const active = field.key === activeField.key;
60488
60713
  return /* @__PURE__ */ jsx141(
60489
60714
  "button",
@@ -60500,7 +60725,7 @@ function TextSection({
60500
60725
  style: { backgroundColor: getTextFieldColor(field, styles) }
60501
60726
  }
60502
60727
  ),
60503
- /* @__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}` })
60504
60729
  ] }),
60505
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 })
60506
60731
  ] })
@@ -61014,7 +61239,7 @@ function PropertyRow({
61014
61239
  }
61015
61240
  function AddPropertyTrigger({
61016
61241
  adding,
61017
- available,
61242
+ available: available2,
61018
61243
  addLabel,
61019
61244
  addTitle,
61020
61245
  onAdd,
@@ -61022,7 +61247,7 @@ function AddPropertyTrigger({
61022
61247
  onClose,
61023
61248
  buttonClassName
61024
61249
  }) {
61025
- if (adding && available.length > 0) {
61250
+ if (adding && available2.length > 0) {
61026
61251
  return /* @__PURE__ */ jsxs106(
61027
61252
  "select",
61028
61253
  {
@@ -61036,12 +61261,12 @@ function AddPropertyTrigger({
61036
61261
  onBlur: onClose,
61037
61262
  children: [
61038
61263
  /* @__PURE__ */ jsx145("option", { value: "", disabled: true, children: "Choose property\u2026" }),
61039
- 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))
61040
61265
  ]
61041
61266
  }
61042
61267
  );
61043
61268
  }
61044
- if (available.length === 0) return null;
61269
+ if (available2.length === 0) return null;
61045
61270
  return /* @__PURE__ */ jsx145("button", { type: "button", onClick: onOpen, className: buttonClassName, title: addTitle, children: addLabel });
61046
61271
  }
61047
61272
  function parseNumericOrString(raw) {
@@ -61409,7 +61634,7 @@ var AnimationCard = memo39(function AnimationCard2({
61409
61634
  enabled,
61410
61635
  segments: animation2.arcPath?.segments
61411
61636
  }),
61412
- onUpdateSegment: (index, update) => onUpdateArcSegment?.(animation2.id, index, update),
61637
+ onUpdateSegment: (index2, update) => onUpdateArcSegment?.(animation2.id, index2, update),
61413
61638
  onToggleAutoRotate: (autoRotate) => onSetArcPath(animation2.id, {
61414
61639
  enabled: true,
61415
61640
  autoRotate,
@@ -61615,13 +61840,13 @@ function GsapAnimationList({
61615
61840
  }, [focusedHere]);
61616
61841
  return /* @__PURE__ */ jsxs109("div", { className: "space-y-2", children: [
61617
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." }),
61618
- animations.map((animation2, index) => /* @__PURE__ */ createElement2(
61843
+ animations.map((animation2, index2) => /* @__PURE__ */ createElement2(
61619
61844
  AnimationCard,
61620
61845
  {
61621
61846
  ...trackedCallbacks,
61622
61847
  key: animation2.id,
61623
61848
  animation: animation2,
61624
- defaultExpanded: index === 0,
61849
+ defaultExpanded: index2 === 0,
61625
61850
  flat: variant === "flat",
61626
61851
  focusedSegment: focusedHere?.animationId === animation2.id ? focusedHere : null,
61627
61852
  onFocusSegmentConsumed: consumeFocusedEaseSegment
@@ -62807,7 +63032,7 @@ function FlatSegmentedRow({
62807
63032
  const track2 = useTrackDesignInput();
62808
63033
  return /* @__PURE__ */ jsxs116("div", { className: "flex min-h-[32px] items-center justify-between", children: [
62809
63034
  /* @__PURE__ */ jsx156("span", { className: "text-[11px] text-panel-text-3", children: label }),
62810
- /* @__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: [
62811
63036
  /* @__PURE__ */ jsx156(
62812
63037
  "button",
62813
63038
  {
@@ -62824,7 +63049,7 @@ function FlatSegmentedRow({
62824
63049
  children: option.node
62825
63050
  }
62826
63051
  ),
62827
- spacerAfterIndex === index && /* @__PURE__ */ jsx156("span", { className: "w-3", "aria-hidden": "true" })
63052
+ spacerAfterIndex === index2 && /* @__PURE__ */ jsx156("span", { className: "w-3", "aria-hidden": "true" })
62828
63053
  ] }, option.key)) })
62829
63054
  ] });
62830
63055
  }
@@ -63437,7 +63662,7 @@ function FlatTextLayerList({
63437
63662
  const track2 = useTrackDesignInput();
63438
63663
  return /* @__PURE__ */ jsxs117("div", { className: "mb-2 border-l-2 border-panel-border-input py-0.5 pl-[10px]", children: [
63439
63664
  /* @__PURE__ */ jsx158("div", { className: "mb-1.5 text-[9px] font-semibold uppercase tracking-[0.12em] text-panel-text-5", children: "Text layers" }),
63440
- /* @__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) => {
63441
63666
  const active = field.key === activeFieldKey;
63442
63667
  return /* @__PURE__ */ jsxs117(
63443
63668
  "div",
@@ -63454,7 +63679,7 @@ function FlatTextLayerList({
63454
63679
  style: { backgroundColor: getTextFieldColor(field, styles) }
63455
63680
  }
63456
63681
  ),
63457
- /* @__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}` }),
63458
63683
  /* @__PURE__ */ jsx158("span", { className: "shrink-0 font-mono text-[9px] text-panel-text-4", children: field.tagName }),
63459
63684
  fields.length > 1 && /* @__PURE__ */ jsx158(
63460
63685
  "button",
@@ -64546,11 +64771,11 @@ function audioFxRevealTarget(target, chain) {
64546
64771
  if (parsed.kind === "volume") return { kind: "volume" };
64547
64772
  if (parsed.kind === "rate") return null;
64548
64773
  if (parsed.kind === "preset") {
64549
- const index2 = (chain?.nodes ?? []).findIndex((node2) => node2.fromPreset === parsed.presetId);
64550
- 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;
64551
64776
  }
64552
- const index = (chain?.nodes ?? []).findIndex((node2) => node2.id === parsed.nodeId);
64553
- 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;
64554
64779
  if (!node) return null;
64555
64780
  if (node.fromCarve) return { kind: "carve" };
64556
64781
  if (node.fromEq) return { kind: "eq", eqId: node.fromEq };
@@ -64558,7 +64783,7 @@ function audioFxRevealTarget(target, chain) {
64558
64783
  const first = (chain?.nodes ?? []).findIndex((n) => n.fromPreset === node.fromPreset);
64559
64784
  return { kind: "preset", runKey: `${node.fromPreset}-${first}` };
64560
64785
  }
64561
- return { kind: "node", index, nodeId: parsed.nodeId };
64786
+ return { kind: "node", index: index2, nodeId: parsed.nodeId };
64562
64787
  }
64563
64788
  function revealRowSelector(where) {
64564
64789
  if (!where) return null;
@@ -64853,8 +65078,8 @@ function fxFamilyOf(node) {
64853
65078
  function fxFamilyTint(node) {
64854
65079
  const family = fxFamilyOf(node);
64855
65080
  const siblings = HF_AUDIO_FX.filter((def) => fxFamilyOf({ type: def.id }) === family);
64856
- const index = siblings.findIndex((def) => def.id === node.type);
64857
- 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;
64858
65083
  return `hsl(${FAMILY_HUE[family]}, 32%, ${(62 + step * 14).toFixed(1)}%)`;
64859
65084
  }
64860
65085
 
@@ -65561,7 +65786,7 @@ function automatedKeysOf(node, params, automatedTargets) {
65561
65786
  function FxNodeParams({
65562
65787
  node,
65563
65788
  def,
65564
- index,
65789
+ index: index2,
65565
65790
  disabled,
65566
65791
  automatedTargets,
65567
65792
  liveAutomationValues,
@@ -65589,7 +65814,7 @@ function FxNodeParams({
65589
65814
  params: node.params ?? defaultAudioFxParams3(node.type),
65590
65815
  liveValues,
65591
65816
  disabled,
65592
- onChange: (params) => onPreview(index, params),
65817
+ onChange: (params) => onPreview(index2, params),
65593
65818
  onCommit: (next) => {
65594
65819
  const before = node.params ?? defaultAudioFxParams3(node.type);
65595
65820
  for (const [key2, value] of Object.entries(next)) {
@@ -65598,7 +65823,7 @@ function FxNodeParams({
65598
65823
  trackParamCommitted(node.type, key2, value, "details", { trackKind });
65599
65824
  trackInput(typeof value === "number" ? "slider" : "select", key2);
65600
65825
  }
65601
- onUpdate(index, { params: next });
65826
+ onUpdate(index2, { params: next });
65602
65827
  },
65603
65828
  automatedKeys: automatedKeysOf(node, def.params, automatedTargets),
65604
65829
  onAutomate: nodeId && onAutomateParam ? (key2) => {
@@ -65622,7 +65847,7 @@ function FxNodeDerivedKnob({
65622
65847
  disabled,
65623
65848
  bypassed,
65624
65849
  params,
65625
- index,
65850
+ index: index2,
65626
65851
  onPreview,
65627
65852
  onUpdate,
65628
65853
  trackKind
@@ -65636,10 +65861,10 @@ function FxNodeDerivedKnob({
65636
65861
  param: derived,
65637
65862
  value: audioFxProfileStrength(node.type, params),
65638
65863
  disabled: Boolean(disabled) || bypassed,
65639
- onChange: (_k, v) => onPreview(index, applyAudioFxProfile(node.type, Number(v), params)),
65864
+ onChange: (_k, v) => onPreview(index2, applyAudioFxProfile(node.type, Number(v), params)),
65640
65865
  onCommit: (_k, v) => {
65641
65866
  trackProfileCommitted(node.type, Number(v), { trackKind });
65642
- onUpdate(index, { params: applyAudioFxProfile(node.type, Number(v), params) });
65867
+ onUpdate(index2, { params: applyAudioFxProfile(node.type, Number(v), params) });
65643
65868
  trackInput("slider", "profile-strength");
65644
65869
  }
65645
65870
  }
@@ -65656,7 +65881,7 @@ function FxNodePrimaryKnob({
65656
65881
  primary,
65657
65882
  copy,
65658
65883
  params,
65659
- index,
65884
+ index: index2,
65660
65885
  disabled,
65661
65886
  bypassed,
65662
65887
  automatedTargets,
@@ -65674,7 +65899,7 @@ function FxNodePrimaryKnob({
65674
65899
  {
65675
65900
  node,
65676
65901
  def: onlyPrimary,
65677
- index,
65902
+ index: index2,
65678
65903
  disabled: Boolean(disabled) || bypassed,
65679
65904
  automatedTargets,
65680
65905
  liveAutomationValues,
@@ -65705,7 +65930,7 @@ function FxNodeOpenBody({
65705
65930
  onToggleDetails,
65706
65931
  copy,
65707
65932
  params,
65708
- index,
65933
+ index: index2,
65709
65934
  disabled,
65710
65935
  bypassed,
65711
65936
  automatedTargets,
@@ -65727,7 +65952,7 @@ function FxNodeOpenBody({
65727
65952
  disabled,
65728
65953
  bypassed,
65729
65954
  params,
65730
- index,
65955
+ index: index2,
65731
65956
  onPreview,
65732
65957
  onUpdate,
65733
65958
  trackKind
@@ -65741,7 +65966,7 @@ function FxNodeOpenBody({
65741
65966
  primary,
65742
65967
  copy,
65743
65968
  params,
65744
- index,
65969
+ index: index2,
65745
65970
  disabled,
65746
65971
  bypassed,
65747
65972
  automatedTargets,
@@ -65775,7 +66000,7 @@ function FxNodeOpenBody({
65775
66000
  {
65776
66001
  node,
65777
66002
  def,
65778
- index,
66003
+ index: index2,
65779
66004
  disabled: Boolean(disabled) || bypassed,
65780
66005
  automatedTargets,
65781
66006
  liveAutomationValues,
@@ -65913,7 +66138,7 @@ function FxNodeHeader({
65913
66138
  }
65914
66139
  function FxNodeRow({
65915
66140
  node,
65916
- index,
66141
+ index: index2,
65917
66142
  position,
65918
66143
  automatedTargets,
65919
66144
  liveAutomationValues,
@@ -65963,17 +66188,17 @@ function FxNodeRow({
65963
66188
  label: node.label ?? EFFECT_COPY[node.type]?.title ?? registryDef.label,
65964
66189
  open: open2,
65965
66190
  bypassed,
65966
- first: index === 0,
66191
+ first: index2 === 0,
65967
66192
  last,
65968
66193
  disabled,
65969
66194
  onToggleOpen,
65970
66195
  onToggleBypass: () => {
65971
66196
  trackNodeBypassed(node.type, !bypassed, { trackKind });
65972
- onUpdate(index, { enabled: bypassed });
66197
+ onUpdate(index2, { enabled: bypassed });
65973
66198
  trackInput("toggle", "effect-bypass");
65974
66199
  },
65975
- onMove: (delta) => onMove(index, delta),
65976
- onRemove: () => onRemove(index)
66200
+ onMove: (delta) => onMove(index2, delta),
66201
+ onRemove: () => onRemove(index2)
65977
66202
  }
65978
66203
  ),
65979
66204
  summary ? /* @__PURE__ */ jsx170(
@@ -65999,7 +66224,7 @@ function FxNodeRow({
65999
66224
  onToggleDetails: () => setDetails((was) => !was),
66000
66225
  copy,
66001
66226
  params,
66002
- index,
66227
+ index: index2,
66003
66228
  disabled,
66004
66229
  bypassed,
66005
66230
  automatedTargets,
@@ -66520,9 +66745,9 @@ function FxSection({
66520
66745
  [chain, onChainChange, trackInput]
66521
66746
  );
66522
66747
  const previewNode = useCallback90(
66523
- (index, params) => onChainPreview?.({
66748
+ (index2, params) => onChainPreview?.({
66524
66749
  ...chain,
66525
- nodes: chain.nodes.map((n, i) => i === index ? { ...n, params } : n)
66750
+ nodes: chain.nodes.map((n, i) => i === index2 ? { ...n, params } : n)
66526
66751
  }),
66527
66752
  [chain, onChainPreview]
66528
66753
  );
@@ -66563,7 +66788,7 @@ function FxSection({
66563
66788
  [chain, mutate, clearAudition, trackKind]
66564
66789
  );
66565
66790
  const updateNode = useCallback90(
66566
- (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)),
66567
66792
  [chain.nodes, mutate]
66568
66793
  );
66569
66794
  const setRunAmount = useCallback90(
@@ -66593,13 +66818,13 @@ function FxSection({
66593
66818
  [chain.nodes, mutate, onRemoveNodesAutomation, trackKind]
66594
66819
  );
66595
66820
  const removeNode = useCallback90(
66596
- (index) => {
66597
- const removed = chain.nodes[index];
66821
+ (index2) => {
66822
+ const removed = chain.nodes[index2];
66598
66823
  const removedId = removed?.id;
66599
66824
  if (removedId) onRemoveNodeAutomation?.(removedId);
66600
66825
  if (removed) trackNodeRemoved(removed.type, nodeOrigin(removed), { trackKind });
66601
66826
  mutate(
66602
- chain.nodes.filter((_, i) => i !== index),
66827
+ chain.nodes.filter((_, i) => i !== index2),
66603
66828
  "remove-effect"
66604
66829
  );
66605
66830
  setOpenNode(null);
@@ -66683,11 +66908,11 @@ function FxSection({
66683
66908
  [chain, mutate, onRemoveNodesAutomation]
66684
66909
  );
66685
66910
  const moveNode = useCallback90(
66686
- (index, delta) => {
66687
- const target = index + delta;
66911
+ (index2, delta) => {
66912
+ const target = index2 + delta;
66688
66913
  if (target < 0 || target >= chain.nodes.length) return;
66689
66914
  const next = [...chain.nodes];
66690
- const [moved] = next.splice(index, 1);
66915
+ const [moved] = next.splice(index2, 1);
66691
66916
  next.splice(target, 0, moved);
66692
66917
  if (moved) trackNodeMoved(moved.type, delta < 0 ? "up" : "down", { trackKind });
66693
66918
  mutate(next, "move-effect");
@@ -68014,10 +68239,10 @@ function valueFromPointer(clientX, clientY, rect, tab) {
68014
68239
  };
68015
68240
  }
68016
68241
  function curvePath(samples, tab) {
68017
- return [...samples].map((sample, index) => {
68018
- 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;
68019
68244
  const point = graphPoint(input, sample, tab);
68020
- 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)}`;
68021
68246
  }).join(" ");
68022
68247
  }
68023
68248
  function samplesFor(points, tab) {
@@ -68053,10 +68278,10 @@ function nearestInputPointIndex(points, input, tab) {
68053
68278
  const inputSpan = tab.kind === "rgb" ? 1 : 360;
68054
68279
  let closest = -1;
68055
68280
  let distance = 12 / (GRAPH_SIZE - GRAPH_PADDING * 2);
68056
- points.forEach((point, index) => {
68281
+ points.forEach((point, index2) => {
68057
68282
  const nextDistance = (tab.kind === "hue" ? circularHueDistance(point[0], input) : Math.abs(point[0] - input)) / inputSpan;
68058
68283
  if (nextDistance < distance) {
68059
- closest = index;
68284
+ closest = index2;
68060
68285
  distance = nextDistance;
68061
68286
  }
68062
68287
  });
@@ -68066,12 +68291,12 @@ function nearestGraphPointIndex(points, input, output, tab) {
68066
68291
  const target = graphPoint(input, output, tab);
68067
68292
  let closest = -1;
68068
68293
  let distance = 12;
68069
- points.forEach((point, index) => {
68294
+ points.forEach((point, index2) => {
68070
68295
  const candidate = graphPoint(point[0], point[1], tab);
68071
68296
  const xDistance = tab.kind === "hue" ? circularHueDistance(point[0], input) / 360 * (GRAPH_SIZE - GRAPH_PADDING * 2) : candidate.x - target.x;
68072
68297
  const nextDistance = Math.hypot(xDistance, candidate.y - target.y);
68073
68298
  if (nextDistance < distance) {
68074
- closest = index;
68299
+ closest = index2;
68075
68300
  distance = nextDistance;
68076
68301
  }
68077
68302
  });
@@ -68094,37 +68319,37 @@ function insertPoint(points, input, output, tab) {
68094
68319
  next.sort((a, b) => a[0] - b[0]);
68095
68320
  return { points: next, selected: next.indexOf(point) };
68096
68321
  }
68097
- function safeRgbInput(points, index, input) {
68098
- if (index === 0) return 0;
68099
- 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;
68100
68325
  return clampNumber(
68101
68326
  input,
68102
- (points[index - 1]?.[0] ?? 0) + INPUT_EPSILON,
68103
- (points[index + 1]?.[0] ?? 1) - INPUT_EPSILON
68327
+ (points[index2 - 1]?.[0] ?? 0) + INPUT_EPSILON,
68328
+ (points[index2 + 1]?.[0] ?? 1) - INPUT_EPSILON
68104
68329
  );
68105
68330
  }
68106
- function hueInputCollides(points, index, input) {
68331
+ function hueInputCollides(points, index2, input) {
68107
68332
  return points.some(
68108
- (point, pointIndex) => pointIndex !== index && circularHueDistance(point[0], input) < INPUT_EPSILON * 360
68333
+ (point, pointIndex) => pointIndex !== index2 && circularHueDistance(point[0], input) < INPUT_EPSILON * 360
68109
68334
  );
68110
68335
  }
68111
- function safeHueInput(points, index, input) {
68336
+ function safeHueInput(points, index2, input) {
68112
68337
  const initial = clampNumber(input, 0, 359.999);
68113
- if (!hueInputCollides(points, index, initial)) return initial;
68338
+ if (!hueInputCollides(points, index2, initial)) return initial;
68114
68339
  const spacing = INPUT_EPSILON * 360;
68115
68340
  for (let step = 1; step <= points.length + 1; step += 1) {
68116
68341
  const clockwise = (initial + spacing * step) % 360;
68117
- if (!hueInputCollides(points, index, clockwise)) return clockwise;
68342
+ if (!hueInputCollides(points, index2, clockwise)) return clockwise;
68118
68343
  const counterClockwise = (initial - spacing * step + 360) % 360;
68119
- if (!hueInputCollides(points, index, counterClockwise)) return counterClockwise;
68344
+ if (!hueInputCollides(points, index2, counterClockwise)) return counterClockwise;
68120
68345
  }
68121
68346
  return initial;
68122
68347
  }
68123
- function movePoint(points, index, input, output, tab) {
68348
+ function movePoint(points, index2, input, output, tab) {
68124
68349
  const next = [...points];
68125
- 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);
68126
68351
  const moved = tab.kind === "rgb" ? [safeInput, clampNumber(output, 0, 1)] : [safeInput, clampNumber(output, tab.min, tab.max)];
68127
- next[index] = moved;
68352
+ next[index2] = moved;
68128
68353
  next.sort((a, b) => a[0] - b[0]);
68129
68354
  return { points: next, selected: next.indexOf(moved) };
68130
68355
  }
@@ -68273,19 +68498,19 @@ function CurveGraph({
68273
68498
  event.currentTarget.getBoundingClientRect(),
68274
68499
  tab
68275
68500
  );
68276
- let index = nearestGraphPointIndex(points, value.input, value.output, tab);
68501
+ let index2 = nearestGraphPointIndex(points, value.input, value.output, tab);
68277
68502
  let nextPoints = points;
68278
- if (index < 0) {
68503
+ if (index2 < 0) {
68279
68504
  const inserted = insertPoint(points, value.input, value.output, tab);
68280
68505
  if (!inserted) return;
68281
68506
  nextPoints = inserted.points;
68282
- index = inserted.selected;
68507
+ index2 = inserted.selected;
68283
68508
  }
68284
68509
  event.currentTarget.setPointerCapture(event.pointerId);
68285
- pointerRef.current = { pointerId: event.pointerId, index, points: nextPoints };
68510
+ pointerRef.current = { pointerId: event.pointerId, index: index2, points: nextPoints };
68286
68511
  onBegin();
68287
- onSelect(index);
68288
- const moved = movePoint(nextPoints, index, value.input, value.output, tab);
68512
+ onSelect(index2);
68513
+ const moved = movePoint(nextPoints, index2, value.input, value.output, tab);
68289
68514
  pointerRef.current.index = moved.selected;
68290
68515
  pointerRef.current.points = moved.points;
68291
68516
  onPreview(moved.points, moved.selected);
@@ -68365,20 +68590,20 @@ function CurveGraph({
68365
68590
  strokeWidth: "1.5"
68366
68591
  }
68367
68592
  ),
68368
- points.map(([input, output], index) => {
68593
+ points.map(([input, output], index2) => {
68369
68594
  const point = graphPoint(input, output, tab);
68370
68595
  return /* @__PURE__ */ jsx178(
68371
68596
  "circle",
68372
68597
  {
68373
- "data-color-curve-point": index,
68598
+ "data-color-curve-point": index2,
68374
68599
  cx: point.x,
68375
68600
  cy: point.y,
68376
- r: selectedIndex === index ? 3.5 : 2.5,
68377
- fill: selectedIndex === index ? "#fff" : tab.color,
68601
+ r: selectedIndex === index2 ? 3.5 : 2.5,
68602
+ fill: selectedIndex === index2 ? "#fff" : tab.color,
68378
68603
  stroke: "#111",
68379
68604
  strokeWidth: "1"
68380
68605
  },
68381
- `${input}-${index}`
68606
+ `${input}-${index2}`
68382
68607
  );
68383
68608
  })
68384
68609
  ]
@@ -68524,7 +68749,7 @@ function ColorCurves({
68524
68749
  if (selectedIndex === null) return;
68525
68750
  if (tab.kind === "rgb" && (selectedIndex === 0 || selectedIndex === points.length - 1)) return;
68526
68751
  transaction.cancel();
68527
- 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);
68528
68753
  const next = withPoints(draft, tab, nextPoints);
68529
68754
  setDraft(next);
68530
68755
  setSelectedIndex(null);
@@ -68878,8 +69103,8 @@ function drawHistogram(context, analysis, width, height) {
68878
69103
  const maximum = maximumDensity(analysis.histogram);
68879
69104
  context.beginPath();
68880
69105
  context.moveTo(0, height);
68881
- analysis.histogram.forEach((count, index) => {
68882
- 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);
68883
69108
  });
68884
69109
  context.lineTo(width, height);
68885
69110
  context.closePath();
@@ -68892,7 +69117,7 @@ function drawDensity(context, density, columnOffset, columnCount, color, xOffset
68892
69117
  let maximum = 0;
68893
69118
  const start = columnOffset * 256;
68894
69119
  const end = (columnOffset + columnCount) * 256;
68895
- 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);
68896
69121
  context.fillStyle = `rgb(${color.join(" ")})`;
68897
69122
  for (let x = 0; x < columnCount; x += 1) {
68898
69123
  for (let y = 0; y < 256; y += 1) {
@@ -69126,7 +69351,7 @@ function PropertyPanelColorSecondary({
69126
69351
  }, [sampleFrame, samplePixels, selected, showMatte]);
69127
69352
  const replaceSelected = (next) => {
69128
69353
  if (!selected) return;
69129
- onCommit(secondaries.map((secondary, index) => index === activeIndex ? next : secondary));
69354
+ onCommit(secondaries.map((secondary, index2) => index2 === activeIndex ? next : secondary));
69130
69355
  };
69131
69356
  const addSecondary = () => {
69132
69357
  if (secondaries.length >= SECONDARY_CAPABILITIES.max) return;
@@ -69135,7 +69360,7 @@ function PropertyPanelColorSecondary({
69135
69360
  };
69136
69361
  const removeSelected = () => {
69137
69362
  if (!selected) return;
69138
- const next = secondaries.filter((_, index) => index !== activeIndex);
69363
+ const next = secondaries.filter((_, index2) => index2 !== activeIndex);
69139
69364
  onCommit(next);
69140
69365
  setSelectedIndex(Math.max(0, Math.min(activeIndex, next.length - 1)));
69141
69366
  setSampleFrame(null);
@@ -69144,21 +69369,21 @@ function PropertyPanelColorSecondary({
69144
69369
  };
69145
69370
  return /* @__PURE__ */ jsxs139("div", { className: "space-y-1.5", "data-flat-grade-secondary": "true", children: [
69146
69371
  /* @__PURE__ */ jsxs139("div", { className: "flex items-center justify-between gap-2", children: [
69147
- /* @__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(
69148
69373
  "button",
69149
69374
  {
69150
69375
  type: "button",
69151
- "aria-pressed": activeIndex === index,
69376
+ "aria-pressed": activeIndex === index2,
69152
69377
  onClick: () => {
69153
- setSelectedIndex(index);
69378
+ setSelectedIndex(index2);
69154
69379
  setSampleFrame(null);
69155
69380
  setSamplePixels(null);
69156
69381
  setCaptureError(null);
69157
69382
  },
69158
- 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"}`,
69159
- 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
69160
69385
  },
69161
- index
69386
+ index2
69162
69387
  )) }),
69163
69388
  /* @__PURE__ */ jsxs139("span", { className: "flex items-center gap-2", children: [
69164
69389
  /* @__PURE__ */ jsx182(
@@ -70373,7 +70598,7 @@ function enumOptions(key2, labels) {
70373
70598
  const first = control?.min ?? 0;
70374
70599
  const count = (control?.max ?? labels.length - 1) - first + 1;
70375
70600
  if (labels.length !== count) throw new Error(`${key2} labels do not match Core capabilities`);
70376
- return labels.map((label, index) => ({ value: String(first + index), label }));
70601
+ return labels.map((label, index2) => ({ value: String(first + index2), label }));
70377
70602
  }
70378
70603
  var ASCII_STYLES = enumOptions("asciiStyle", [
70379
70604
  "Standard",
@@ -70770,7 +70995,7 @@ function FlatEffectsSection({
70770
70995
  const palette = grading.palette;
70771
70996
  return /* @__PURE__ */ jsxs143("div", { "data-flat-effects-palette": "true", className: "space-y-2 py-1", children: [
70772
70997
  /* @__PURE__ */ jsx187("div", { className: "grid grid-cols-3 gap-1", children: HF_COLOR_GRADING_PALETTES.map((preset) => {
70773
- 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]);
70774
70999
  return /* @__PURE__ */ jsxs143(
70775
71000
  "button",
70776
71001
  {
@@ -70821,16 +71046,16 @@ function FlatEffectsSection({
70821
71046
  )
70822
71047
  ] }),
70823
71048
  /* @__PURE__ */ jsxs143("div", { className: "flex flex-wrap items-center gap-1.5", children: [
70824
- 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: [
70825
71050
  /* @__PURE__ */ jsx187(
70826
71051
  "input",
70827
71052
  {
70828
71053
  type: "color",
70829
- "aria-label": `Palette color ${index + 1}`,
71054
+ "aria-label": `Palette color ${index2 + 1}`,
70830
71055
  value: color,
70831
71056
  onChange: (event) => {
70832
71057
  const nextPalette = [...palette];
70833
- nextPalette[index] = event.target.value;
71058
+ nextPalette[index2] = event.target.value;
70834
71059
  onCommitColorGrading({ ...grading, palette: nextPalette });
70835
71060
  },
70836
71061
  className: "h-6 w-6 cursor-pointer rounded-xs border border-panel-border-input bg-transparent p-0"
@@ -70840,16 +71065,16 @@ function FlatEffectsSection({
70840
71065
  "button",
70841
71066
  {
70842
71067
  type: "button",
70843
- "aria-label": `Remove palette color ${index + 1}`,
71068
+ "aria-label": `Remove palette color ${index2 + 1}`,
70844
71069
  onClick: () => onCommitColorGrading({
70845
71070
  ...grading,
70846
- palette: palette.filter((_, colorIndex) => colorIndex !== index)
71071
+ palette: palette.filter((_, colorIndex) => colorIndex !== index2)
70847
71072
  }),
70848
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",
70849
71074
  children: /* @__PURE__ */ jsx187(X, { size: 8 })
70850
71075
  }
70851
71076
  )
70852
- ] }, `${index}-${color}`)),
71077
+ ] }, `${index2}-${color}`)),
70853
71078
  palette.length < 6 && /* @__PURE__ */ jsx187(
70854
71079
  "button",
70855
71080
  {
@@ -75151,20 +75376,20 @@ function buildOverrides(model) {
75151
75376
  for (const segId of group.segmentIds) {
75152
75377
  const seg = model.segments.get(segId);
75153
75378
  if (seg && Object.keys(seg.style).length > 0) {
75154
- const entry2 = { wordIndex: globalWordIndex };
75155
- if (seg.wordId) entry2.wordId = seg.wordId;
75379
+ const entry3 = { wordIndex: globalWordIndex };
75380
+ if (seg.wordId) entry3.wordId = seg.wordId;
75156
75381
  const s = seg.style;
75157
- if (s.x !== void 0) entry2.x = s.x;
75158
- if (s.y !== void 0) entry2.y = s.y;
75159
- if (s.scaleX !== void 0) entry2.scale = s.scaleX;
75160
- if (s.rotation !== void 0) entry2.rotation = s.rotation;
75161
- if (s.activeColor !== void 0) entry2.activeColor = s.activeColor;
75162
- if (s.dimColor !== void 0) entry2.dimColor = s.dimColor;
75163
- if (s.opacity !== void 0) entry2.opacity = s.opacity;
75164
- if (s.fontSize !== void 0) entry2.fontSize = s.fontSize;
75165
- if (s.fontWeight !== void 0) entry2.fontWeight = s.fontWeight;
75166
- if (s.fontFamily !== void 0) entry2.fontFamily = s.fontFamily;
75167
- 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);
75168
75393
  }
75169
75394
  globalWordIndex++;
75170
75395
  }
@@ -75342,16 +75567,16 @@ function createOwnHistory() {
75342
75567
  noteClaim: (id) => {
75343
75568
  claimed = { count: claimed.count + 1, id };
75344
75569
  },
75345
- stepped: (entry2) => {
75346
- if (entry2.undoes) undoneIds.add(entry2.undoes);
75570
+ stepped: (entry3) => {
75571
+ if (entry3.undoes) undoneIds.add(entry3.undoes);
75347
75572
  if (undoneIds.size > OWN_ENTRIES_KEPT) undoneIds.delete(undoneIds.values().next().value);
75348
- const undone = entry2.undoes ? own.get(entry2.undoes) : void 0;
75573
+ const undone = entry3.undoes ? own.get(entry3.undoes) : void 0;
75349
75574
  if (!undone) return;
75350
75575
  const swapped = Object.entries(undone).map(([path, f]) => [
75351
75576
  path,
75352
75577
  { before: f.after, after: f.before }
75353
75578
  ]);
75354
- remember(entry2.id, Object.fromEntries(swapped));
75579
+ remember(entry3.id, Object.fromEntries(swapped));
75355
75580
  },
75356
75581
  afterOf: (id) => Object.fromEntries(Object.entries(id && own.get(id) || {}).map(([p, f]) => [p, f.after])),
75357
75582
  predict: (direction) => {
@@ -75433,8 +75658,8 @@ async function restoredFiles(paths, previous, readFile) {
75433
75658
  );
75434
75659
  }
75435
75660
  function redoneAt(view) {
75436
- const undo = view.entries.find((entry2) => entry2.id === view.forward?.id);
75437
- 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;
75438
75663
  }
75439
75664
  function usePersistentEditHistory({ projectId }) {
75440
75665
  const [view, setView] = useState115(EMPTY3);
@@ -76149,11 +76374,11 @@ function useFileManager({
76149
76374
  showToast(`Skipped (too large): ${data.skipped.join(", ")}`);
76150
76375
  }
76151
76376
  if (data.invalid?.length) {
76152
- const why = data.invalid.map((entry2) => `${entry2.name} (${entry2.reason})`).join(", ");
76377
+ const why = data.invalid.map((entry3) => `${entry3.name} (${entry3.reason})`).join(", ");
76153
76378
  showToast(`Not added: ${why}`);
76154
76379
  }
76155
76380
  if (data.unchecked?.length) {
76156
- const names = data.unchecked.map((entry2) => entry2.name).join(", ");
76381
+ const names = data.unchecked.map((entry3) => entry3.name).join(", ");
76157
76382
  showToast(`Added ${names}, ${data.unchecked[0].reason}`, "info");
76158
76383
  }
76159
76384
  await refreshFileTree();
@@ -76476,7 +76701,7 @@ function syncStaleEditMarks(doc, file) {
76476
76701
  }
76477
76702
  function hasAmbiguousGsapScriptChange(previousScripts, restoredScripts) {
76478
76703
  if (previousScripts.length <= 1 && restoredScripts.length <= 1) return false;
76479
- 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]);
76480
76705
  }
76481
76706
  function restoreScripted(prevDoc, nextDoc, isActive) {
76482
76707
  const [before, after] = [prevDoc, nextDoc].map(
@@ -77228,16 +77453,16 @@ import { useCallback as useCallback109 } from "react";
77228
77453
 
77229
77454
  // src/utils/timelineDropTrackInsert.ts
77230
77455
  function planDropTrackInsert(input) {
77231
- const { elements, trackOrder, insertRow, dropped } = input;
77456
+ const { elements, trackOrder, insertRow, dropped: dropped2 } = input;
77232
77457
  const newElement = {
77233
- ...dropped,
77234
- key: dropped.id,
77458
+ ...dropped2,
77459
+ key: dropped2.id,
77235
77460
  // Parked on an existing lane so it adds no lane of its own to the topology.
77236
77461
  track: elements[0]?.track ?? 0,
77237
77462
  // sameSourceFile compares this raw field: borrow the peers' value, not the resolved path.
77238
77463
  sourceFile: elements[0]?.sourceFile
77239
77464
  };
77240
- const layout = layoutAfterTrackInsert(newElement, dropped.start, insertRow, null, {
77465
+ const layout = layoutAfterTrackInsert(newElement, dropped2.start, insertRow, null, {
77241
77466
  elements: [...elements, newElement],
77242
77467
  trackOrder: [...trackOrder]
77243
77468
  });
@@ -77246,13 +77471,13 @@ function planDropTrackInsert(input) {
77246
77471
  const renumbers = [];
77247
77472
  for (const norm of layout.normalized) {
77248
77473
  const key2 = norm.key ?? norm.id;
77249
- if (key2 === dropped.id) continue;
77474
+ if (key2 === dropped2.id) continue;
77250
77475
  const src = byKey.get(key2);
77251
77476
  if (!src || norm.track === (src.authoredTrack ?? src.track)) continue;
77252
77477
  if (!canMoveTimelineElement(src)) return null;
77253
77478
  renumbers.push({ element: src, track: norm.track });
77254
77479
  }
77255
- 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;
77256
77481
  return track2 == null ? null : { track: track2, renumbers };
77257
77482
  }
77258
77483
  function applyTrackRenumbers(source, plan) {
@@ -77270,27 +77495,27 @@ function applyTrackRenumbers(source, plan) {
77270
77495
  }
77271
77496
  return out;
77272
77497
  }
77273
- function resolveRowDrop(elements, placed, lane, dropped) {
77274
- const audio = isAudioTimelineElement(dropped);
77498
+ function resolveRowDrop(elements, placed, lane, dropped2) {
77499
+ const audio = isAudioTimelineElement(dropped2);
77275
77500
  const row = elements.filter((e) => e.track === lane);
77276
77501
  const otherKindRow = row.length > 0 && !row.some((e) => isAudioTimelineElement(e) === audio);
77277
- 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 };
77278
77503
  const track2 = otherKindRow ? lane : authoredTrackForLane(lane, elements, asClip);
77279
77504
  const onTrack = [...elements, ...placed].filter((e) => isAudioTimelineElement(e) === audio && (e.authoredTrack ?? e.track) === track2).map((e) => ({ ...e, track: track2 }));
77280
77505
  return {
77281
77506
  track: track2,
77282
- start: resolveNearestFreeStart(onTrack, track2, dropped.start, dropped.duration, null)
77507
+ start: resolveNearestFreeStart(onTrack, track2, dropped2.start, dropped2.duration, null)
77283
77508
  };
77284
77509
  }
77285
77510
  function resolveDropTrack(input) {
77286
- const { source, elements, placement, dropped } = input;
77511
+ const { source, elements, placement, dropped: dropped2 } = input;
77287
77512
  if (placement.insertRow == null) {
77288
- return { source, ...resolveRowDrop(elements, input.placed ?? [], placement.track, dropped) };
77513
+ return { source, ...resolveRowDrop(elements, input.placed ?? [], placement.track, dropped2) };
77289
77514
  }
77290
77515
  const { insertRow, trackOrder } = placement;
77291
- const plan = planDropTrackInsert({ elements, trackOrder, insertRow, dropped });
77516
+ const plan = planDropTrackInsert({ elements, trackOrder, insertRow, dropped: dropped2 });
77292
77517
  if (!plan) throw new Error("Cannot open a new track here: a locked clip would have to move.");
77293
- return { source: applyTrackRenumbers(source, plan), track: plan.track, start: dropped.start };
77518
+ return { source: applyTrackRenumbers(source, plan), track: plan.track, start: dropped2.start };
77294
77519
  }
77295
77520
 
77296
77521
  // src/utils/timelineCompositionInsert.ts
@@ -77359,8 +77584,8 @@ function selectAndRevealTimelineElement(key2) {
77359
77584
  }
77360
77585
 
77361
77586
  // src/hooks/useTimelineAssetDropOps.ts
77362
- function fileDropPlacement(index, next, dropped, previous) {
77363
- if (index === 0) return { ...dropped, ...next };
77587
+ function fileDropPlacement(index2, next, dropped2, previous) {
77588
+ if (index2 === 0) return { ...dropped2, ...next };
77364
77589
  return previous ? { start: previous.start + previous.duration, track: previous.track } : next;
77365
77590
  }
77366
77591
  function timelineDropTarget(sourceFile, placement) {
@@ -77529,17 +77754,17 @@ function useTimelineAssetDropOps({
77529
77754
  durations
77530
77755
  );
77531
77756
  const gesture = { placed: [], onNewTrack: false };
77532
- for (const [index, assetPath] of uploaded.entries()) {
77533
- const next = placements[index] ?? placements[0];
77757
+ for (const [index2, assetPath] of uploaded.entries()) {
77758
+ const next = placements[index2] ?? placements[0];
77534
77759
  const clip = await dropAssetAt(
77535
77760
  assetPath,
77536
- fileDropPlacement(index, next, placement, gesture.placed.at(-1)),
77537
- durations[index],
77761
+ fileDropPlacement(index2, next, placement, gesture.placed.at(-1)),
77762
+ durations[index2],
77538
77763
  gesture
77539
77764
  );
77540
77765
  if (!clip) continue;
77541
77766
  gesture.placed.push(clip);
77542
- if (index === 0 && placement?.insertRow != null) gesture.onNewTrack = true;
77767
+ if (index2 === 0 && placement?.insertRow != null) gesture.onNewTrack = true;
77543
77768
  }
77544
77769
  },
77545
77770
  [
@@ -78360,17 +78585,17 @@ function useTimelineEditGuard(canEdit, showToast) {
78360
78585
  cached5.onRefused = onRefused;
78361
78586
  return cached5.wrapped;
78362
78587
  }
78363
- const entry2 = {};
78364
- entry2.resolveTargets = resolveTargets;
78365
- entry2.onRefused = onRefused;
78366
- entry2.wrapped = ((...args) => {
78367
- 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));
78368
78593
  if (reason !== null)
78369
- return Promise.resolve(entry2.onRefused?.(reason, ...args));
78594
+ return Promise.resolve(entry3.onRefused?.(reason, ...args));
78370
78595
  return fn(...args);
78371
78596
  });
78372
- guardedRef.current.set(key2, entry2);
78373
- return entry2.wrapped;
78597
+ guardedRef.current.set(key2, entry3);
78598
+ return entry3.wrapped;
78374
78599
  },
78375
78600
  []
78376
78601
  );
@@ -80059,18 +80284,18 @@ function domEditSelectionsEqual(a, b) {
80059
80284
  }
80060
80285
  function domEditSelectionInGroup(group, selection) {
80061
80286
  if (!selection) return false;
80062
- return group.some((entry2) => domEditSelectionsTargetSame(entry2, selection));
80287
+ return group.some((entry3) => domEditSelectionsTargetSame(entry3, selection));
80063
80288
  }
80064
80289
  function toggleDomEditGroupSelection(group, selection) {
80065
80290
  if (domEditSelectionInGroup(group, selection)) {
80066
- return group.filter((entry2) => !domEditSelectionsTargetSame(entry2, selection));
80291
+ return group.filter((entry3) => !domEditSelectionsTargetSame(entry3, selection));
80067
80292
  }
80068
80293
  return [...group, selection];
80069
80294
  }
80070
80295
  function replaceDomEditGroupSelection(group, selection) {
80071
80296
  let replaced = false;
80072
- const nextGroup = group.map((entry2) => {
80073
- if (!domEditSelectionsTargetSame(entry2, selection)) return entry2;
80297
+ const nextGroup = group.map((entry3) => {
80298
+ if (!domEditSelectionsTargetSame(entry3, selection)) return entry3;
80074
80299
  replaced = true;
80075
80300
  return selection;
80076
80301
  });
@@ -80974,7 +81199,7 @@ function describeBatchPatchTarget(patch) {
80974
81199
  return patch.target.id ?? patch.target.hfId ?? patch.target.selector ?? "(unaddressed)";
80975
81200
  }
80976
81201
  function reportUnmatchedBatchPatches(batch, matched) {
80977
- const unmatchedIds = batch.patches.filter((_, index) => matched[index] === false).map(describeBatchPatchTarget);
81202
+ const unmatchedIds = batch.patches.filter((_, index2) => matched[index2] === false).map(describeBatchPatchTarget);
80978
81203
  if (unmatchedIds.length === 0) return;
80979
81204
  console.warn(
80980
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):`,
@@ -81015,8 +81240,8 @@ async function patchElementBatches(projectId, batches) {
81015
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)) {
81016
81241
  throw new StudioSaveHttpError("Invalid atomic element patch response", 502);
81017
81242
  }
81018
- const files = result.files.map((file, index) => {
81019
- const batch = batches[index];
81243
+ const files = result.files.map((file, index2) => {
81244
+ const batch = batches[index2];
81020
81245
  const matched = file.matched ?? [];
81021
81246
  if (!batch || file.sourceFile !== batch.sourceFile || matched.length !== 0 && matched.length !== batch.patches.length) {
81022
81247
  throw new StudioSaveHttpError("Invalid atomic element patch response", 502);
@@ -81322,7 +81547,7 @@ function refreshTimelineRowText(el) {
81322
81547
 
81323
81548
  // src/hooks/domEditTextFieldCommitOps.ts
81324
81549
  function hasSameKeysInSamePositions(originalFields, nextFields) {
81325
- return originalFields.every((field, index) => nextFields[index]?.key === field.key);
81550
+ return originalFields.every((field, index2) => nextFields[index2]?.key === field.key);
81326
81551
  }
81327
81552
  function inlineStyleValue(styles, property) {
81328
81553
  return Object.prototype.hasOwnProperty.call(styles, property) ? styles[property] : null;
@@ -81589,13 +81814,13 @@ function useDomEditAttributeCommits({
81589
81814
  iframe?.contentDocument,
81590
81815
  selection,
81591
81816
  activeCompPath,
81592
- entries.map((entry2) => entry2.fullAttr)
81817
+ entries.map((entry3) => entry3.fullAttr)
81593
81818
  );
81594
81819
  },
81595
81820
  apply: () => {
81596
81821
  if (!captured) return;
81597
- for (const entry2 of entries) {
81598
- setOrRemovePreviewAttribute(captured.element, entry2.fullAttr, entry2.value);
81822
+ for (const entry3 of entries) {
81823
+ setOrRemovePreviewAttribute(captured.element, entry3.fullAttr, entry3.value);
81599
81824
  }
81600
81825
  },
81601
81826
  persist: () => persistDomEditOperations(selection, ops, {
@@ -81607,11 +81832,11 @@ function useDomEditAttributeCommits({
81607
81832
  shouldRevert: (error) => isLatestCommit() && !(error instanceof DomEditPersistPreparedWriteError),
81608
81833
  revert: () => {
81609
81834
  if (!captured) return;
81610
- for (const entry2 of entries) {
81835
+ for (const entry3 of entries) {
81611
81836
  setOrRemovePreviewAttribute(
81612
81837
  captured.element,
81613
- entry2.fullAttr,
81614
- captured.previousValues.get(entry2.fullAttr) ?? null
81838
+ entry3.fullAttr,
81839
+ captured.previousValues.get(entry3.fullAttr) ?? null
81615
81840
  );
81616
81841
  }
81617
81842
  },
@@ -82055,7 +82280,7 @@ function useDomEditTextCommits({
82055
82280
  const handleDomTextFieldStyleCommit = useCallback130(
82056
82281
  async (fieldKey, property, value) => {
82057
82282
  if (!domEditSelection) return;
82058
- const field = domEditSelection.textFields.find((entry2) => entry2.key === fieldKey);
82283
+ const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
82059
82284
  if (!field) return;
82060
82285
  if (field.source === "self") {
82061
82286
  await handleDomStyleCommit(property, value);
@@ -82071,17 +82296,17 @@ function useDomEditTextCommits({
82071
82296
  }
82072
82297
  }
82073
82298
  const nextTextFields = domEditSelection.textFields.map(
82074
- (entry2) => entry2.key === fieldKey ? {
82075
- ...entry2,
82299
+ (entry3) => entry3.key === fieldKey ? {
82300
+ ...entry3,
82076
82301
  inlineStyles: {
82077
- ...entry2.inlineStyles,
82302
+ ...entry3.inlineStyles,
82078
82303
  [property]: normalizedValue
82079
82304
  },
82080
82305
  computedStyles: {
82081
- ...entry2.computedStyles,
82306
+ ...entry3.computedStyles,
82082
82307
  [property]: normalizedValue
82083
82308
  }
82084
- } : entry2
82309
+ } : entry3
82085
82310
  );
82086
82311
  await commitDomTextFields(domEditSelection, nextTextFields, { importedFont });
82087
82312
  },
@@ -82116,13 +82341,13 @@ function useDomEditTextCommits({
82116
82341
  const handleDomRemoveTextField = useCallback130(
82117
82342
  async (fieldKey) => {
82118
82343
  if (!domEditSelection) return;
82119
- const field = domEditSelection.textFields.find((entry2) => entry2.key === fieldKey);
82344
+ const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
82120
82345
  if (!field) return;
82121
82346
  if (field.source === "self") {
82122
82347
  await handleDomTextCommit("", fieldKey);
82123
82348
  return;
82124
82349
  }
82125
- const nextTextFields = domEditSelection.textFields.filter((entry2) => entry2.key !== fieldKey);
82350
+ const nextTextFields = domEditSelection.textFields.filter((entry3) => entry3.key !== fieldKey);
82126
82351
  await commitDomTextFields(domEditSelection, nextTextFields);
82127
82352
  },
82128
82353
  [commitDomTextFields, domEditSelection, handleDomTextCommit]
@@ -83970,12 +84195,12 @@ function applyPreviewSync(iframe, result, options, reloadPreview, nestedFiles) {
83970
84195
  if (patches.length > 0) {
83971
84196
  const deferSeek = options.deferPreviewSync === true;
83972
84197
  const missed = patches.find(
83973
- (patch, index) => !patchRuntimeTweenInPlace(
84198
+ (patch, index2) => !patchRuntimeTweenInPlace(
83974
84199
  iframe,
83975
84200
  patch.selector,
83976
84201
  patch.change,
83977
84202
  void 0,
83978
- deferSeek || index < patches.length - 1
84203
+ deferSeek || index2 < patches.length - 1
83979
84204
  )
83980
84205
  );
83981
84206
  if (missed) {
@@ -84767,9 +84992,9 @@ import { useCallback as useCallback143 } from "react";
84767
84992
 
84768
84993
  // src/hooks/gsapGroupPreflight.ts
84769
84994
  function firstPreflightFailure(results, updates, savedOnElement, activeCompPath) {
84770
- for (const [index, result] of results.entries()) {
84995
+ for (const [index2, result] of results.entries()) {
84771
84996
  if (result.status !== "rejected") continue;
84772
- const selection = updates[index]?.selection;
84997
+ const selection = updates[index2]?.selection;
84773
84998
  if (selection) return { error: result.reason, selection };
84774
84999
  }
84775
85000
  return secondFile(updates, savedOnElement, activeCompPath);
@@ -84878,8 +85103,8 @@ function useGsapAwareGroupMove({
84878
85103
  const lastScriptWrite = updates.findLastIndex(
84879
85104
  ({ selection }) => !offsetMembers.has(selection)
84880
85105
  );
84881
- for (const [index, { selection, next }] of updates.entries()) {
84882
- renderOnCommit = index === lastScriptWrite;
85106
+ for (const [index2, { selection, next }] of updates.entries()) {
85107
+ renderOnCommit = index2 === lastScriptWrite;
84883
85108
  const plain = offsetMembers.get(selection);
84884
85109
  if (plain !== void 0) {
84885
85110
  const staged = writes.drawKeepingUndone(
@@ -85199,7 +85424,7 @@ async function applyArcKeyframeAtPlayhead(session, sel, arcAnim, t2, iframe) {
85199
85424
  targetSelector,
85200
85425
  position: roundTo3(start),
85201
85426
  duration: roundTo3(duration),
85202
- keyframes: nodes.filter((_, index) => index !== timedNodeIndex),
85427
+ keyframes: nodes.filter((_, index2) => index2 !== timedNodeIndex),
85203
85428
  ease: "none"
85204
85429
  },
85205
85430
  { label: "Remove keyframe", softReload: true }
@@ -85694,10 +85919,10 @@ async function commitStaticSet(selection, propEntries, selector, animations, com
85694
85919
  }
85695
85920
  function groupStaticSetEntries(propEntries) {
85696
85921
  const byGroup = /* @__PURE__ */ new Map();
85697
- for (const entry2 of propEntries) {
85698
- const group = classifyPropertyGroup4(entry2[0]);
85922
+ for (const entry3 of propEntries) {
85923
+ const group = classifyPropertyGroup4(entry3[0]);
85699
85924
  const batch = byGroup.get(group) ?? [];
85700
- batch.push(entry2);
85925
+ batch.push(entry3);
85701
85926
  byGroup.set(group, batch);
85702
85927
  }
85703
85928
  return byGroup;
@@ -86674,9 +86899,9 @@ async function moveDomGroupBy(moves, commitGroup) {
86674
86899
  restoreManualOffsetDragMembers(members);
86675
86900
  throw error;
86676
86901
  }
86677
- const updates = members.map((member, index) => ({
86902
+ const updates = members.map((member, index2) => ({
86678
86903
  selection: member.selection,
86679
- next: applyManualOffsetDragCommit(member, screens[index].x, screens[index].y),
86904
+ next: applyManualOffsetDragCommit(member, screens[index2].x, screens[index2].y),
86680
86905
  plainTranslate: member.plainTranslate
86681
86906
  }));
86682
86907
  try {
@@ -88903,8 +89128,8 @@ function renamedIds(before, after) {
88903
89128
  const ids = (html2) => Array.from(html2.matchAll(ID_ATTRS), (match) => match[1]);
88904
89129
  const renamed = ids(after);
88905
89130
  const renames = /* @__PURE__ */ new Map();
88906
- ids(before).forEach((from, index) => {
88907
- const to = renamed[index];
89131
+ ids(before).forEach((from, index2) => {
89132
+ const to = renamed[index2];
88908
89133
  if (to && to !== from) renames.set(from, to);
88909
89134
  });
88910
89135
  return renames;
@@ -88943,13 +89168,13 @@ function selectorList(text) {
88943
89168
  const selectors = [];
88944
89169
  let depth = 0;
88945
89170
  let start = 0;
88946
- for (let index = 0; index < text.length; index++) {
88947
- const char = text[index];
89171
+ for (let index2 = 0; index2 < text.length; index2++) {
89172
+ const char = text[index2];
88948
89173
  if (char === "(" || char === "[") depth++;
88949
89174
  else if (char === ")" || char === "]") depth--;
88950
89175
  else if (char === "," && depth === 0) {
88951
- selectors.push(text.slice(start, index).trim());
88952
- start = index + 1;
89176
+ selectors.push(text.slice(start, index2).trim());
89177
+ start = index2 + 1;
88953
89178
  }
88954
89179
  }
88955
89180
  selectors.push(text.slice(start).trim());
@@ -88994,10 +89219,10 @@ function savedMarkupElseLive(saved2, live, sourceFile) {
88994
89219
  async function readSavedMarkup(readSaved, paths, lives) {
88995
89220
  const sources = /* @__PURE__ */ new Map();
88996
89221
  return Promise.all(
88997
- paths.map(async (path, index) => {
89222
+ paths.map(async (path, index2) => {
88998
89223
  if (!sources.has(path)) sources.set(path, readSaved(path).then(parseSavedSource));
88999
89224
  const saved2 = await sources.get(path);
89000
- return savedMarkupElseLive(saved2, lives[index], path);
89225
+ return savedMarkupElseLive(saved2, lives[index2], path);
89001
89226
  })
89002
89227
  );
89003
89228
  }
@@ -89122,8 +89347,8 @@ function useClipboard({
89122
89347
  async (targets) => {
89123
89348
  const paths = targets.elements.map((el) => el.sourceFile || activeCompPath || "index.html");
89124
89349
  const markup = await readSavedMarkup(readSaved, paths, targets.lives);
89125
- return targets.elements.map((element, index) => ({
89126
- html: markup[index],
89350
+ return targets.elements.map((element, index2) => ({
89351
+ html: markup[index2],
89127
89352
  start: element.start,
89128
89353
  duration: element.duration,
89129
89354
  // authoredTrack, not track: `track` can be a display-lane number
@@ -90027,8 +90252,8 @@ function useToast() {
90027
90252
  setToasts((prev) => {
90028
90253
  const next = [...prev, { id, message, tone }];
90029
90254
  while (next.length > MAX_TOASTS) {
90030
- const dropped = next.shift();
90031
- if (dropped) clearTimer(dropped.id);
90255
+ const dropped2 = next.shift();
90256
+ if (dropped2) clearTimer(dropped2.id);
90032
90257
  }
90033
90258
  return next;
90034
90259
  });
@@ -90936,7 +91161,7 @@ function useImpression(anchor2, route) {
90936
91161
  };
90937
91162
  if (typeof IntersectionObserver === "undefined") return record();
90938
91163
  const seen = new IntersectionObserver((entries) => {
90939
- if (!entries.some((entry2) => entry2.isIntersecting)) return;
91164
+ if (!entries.some((entry3) => entry3.isIntersecting)) return;
90940
91165
  seen.disconnect();
90941
91166
  record();
90942
91167
  });
@@ -91888,8 +92113,8 @@ function partitionKeyframesByGroup(keyframes) {
91888
92113
  }
91889
92114
  return groupOrder.map((group) => byGroup.get(group));
91890
92115
  }
91891
- function reloadOnlyLast(index, count) {
91892
- return index === count - 1 ? { softReload: true } : { skipReload: true };
92116
+ function reloadOnlyLast(index2, count) {
92117
+ return index2 === count - 1 ? { softReload: true } : { skipReload: true };
91893
92118
  }
91894
92119
  function recordingEnd(selection) {
91895
92120
  const start = Number.parseFloat(selection.dataAttributes?.start ?? "0") || 0;
@@ -92034,7 +92259,7 @@ function useGestureCommit({
92034
92259
  ...kf.ease ? { ease: kf.ease } : {}
92035
92260
  }));
92036
92261
  const constantSpeed = { ease: "none" };
92037
- const mapped = keyframes.map((kf, index) => ({
92262
+ const mapped = keyframes.map((kf, index2) => ({
92038
92263
  percentage: roundPct3(
92039
92264
  progressAtTime(
92040
92265
  runEase,
@@ -92042,7 +92267,7 @@ function useGestureCommit({
92042
92267
  )
92043
92268
  ),
92044
92269
  properties: kf.properties,
92045
- ...kf.ease ? { ease: kf.ease } : index > 0 ? constantSpeed : {}
92270
+ ...kf.ease ? { ease: kf.ease } : index2 > 0 ? constantSpeed : {}
92046
92271
  }));
92047
92272
  const merged = [...preserved, ...mapped].sort((a, b) => a.percentage - b.percentage);
92048
92273
  await commit2(
@@ -92059,7 +92284,7 @@ function useGestureCommit({
92059
92284
  );
92060
92285
  } else {
92061
92286
  const keyframeGroups = partitionKeyframesByGroup(keyframes);
92062
- for (const [index, groupKfs] of keyframeGroups.entries()) {
92287
+ for (const [index2, groupKfs] of keyframeGroups.entries()) {
92063
92288
  await commit2(
92064
92289
  {
92065
92290
  type: "add-with-keyframes",
@@ -92076,7 +92301,7 @@ function useGestureCommit({
92076
92301
  {
92077
92302
  label: "Gesture recording (new range)",
92078
92303
  ...coalesceOptions,
92079
- ...reloadOnlyLast(index, keyframeGroups.length)
92304
+ ...reloadOnlyLast(index2, keyframeGroups.length)
92080
92305
  }
92081
92306
  );
92082
92307
  }
@@ -92084,7 +92309,7 @@ function useGestureCommit({
92084
92309
  }
92085
92310
  } else {
92086
92311
  const keyframeGroups = partitionKeyframesByGroup(keyframes);
92087
- for (const [index, groupKfs] of keyframeGroups.entries()) {
92312
+ for (const [index2, groupKfs] of keyframeGroups.entries()) {
92088
92313
  await commit2(
92089
92314
  {
92090
92315
  type: "add-with-keyframes",
@@ -92098,7 +92323,7 @@ function useGestureCommit({
92098
92323
  {
92099
92324
  label: "Gesture recording",
92100
92325
  ...coalesceOptions,
92101
- ...reloadOnlyLast(index, keyframeGroups.length)
92326
+ ...reloadOnlyLast(index2, keyframeGroups.length)
92102
92327
  }
92103
92328
  );
92104
92329
  }
@@ -92823,7 +93048,7 @@ var stopCurrentPreview = null;
92823
93048
  function AudioRow({
92824
93049
  projectId,
92825
93050
  asset,
92826
- used,
93051
+ used: used2,
92827
93052
  meta,
92828
93053
  onCopy,
92829
93054
  copyFeedback,
@@ -92856,7 +93081,7 @@ function AudioRow({
92856
93081
  const setPreviewAsset = useAssetPreviewStore((s) => s.setPreviewAsset);
92857
93082
  const clearPreviewAsset = useAssetPreviewStore((s) => s.clearPreviewAsset);
92858
93083
  const activateRow = useCallback166(() => {
92859
- if (used) {
93084
+ if (used2) {
92860
93085
  const clip = findClipForAsset(elements, asset);
92861
93086
  if (clip) {
92862
93087
  clearPreviewAsset();
@@ -92868,7 +93093,7 @@ function AudioRow({
92868
93093
  }
92869
93094
  setPreviewAsset(asset, projectId);
92870
93095
  }, [
92871
- used,
93096
+ used2,
92872
93097
  elements,
92873
93098
  asset,
92874
93099
  projectId,
@@ -93014,7 +93239,7 @@ function AudioRow({
93014
93239
  /* @__PURE__ */ jsx217(
93015
93240
  "span",
93016
93241
  {
93017
- 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"}`,
93018
93243
  children: name
93019
93244
  }
93020
93245
  ),
@@ -93022,7 +93247,7 @@ function AudioRow({
93022
93247
  meta?.duration ? `${meta.duration}s \xB7 ` : "",
93023
93248
  subtype
93024
93249
  ] }),
93025
- 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" }),
93026
93251
  (isCopied || copyFailed) && /* @__PURE__ */ jsx217(
93027
93252
  "span",
93028
93253
  {
@@ -93244,7 +93469,7 @@ function useProbedDuration(src, skip) {
93244
93469
  function AssetCard({
93245
93470
  projectId,
93246
93471
  asset,
93247
- used,
93472
+ used: used2,
93248
93473
  duration,
93249
93474
  onCopy,
93250
93475
  copyFeedback,
@@ -93275,7 +93500,7 @@ function AssetCard({
93275
93500
  pointerDownRef.current = { x: e.clientX, y: e.clientY };
93276
93501
  }, []);
93277
93502
  const activateCard = useCallback167(() => {
93278
- if (used) {
93503
+ if (used2) {
93279
93504
  const clip = findClipForAsset(elements, asset);
93280
93505
  if (clip) {
93281
93506
  clearPreviewAsset();
@@ -93287,7 +93512,7 @@ function AssetCard({
93287
93512
  }
93288
93513
  setPreviewAsset(asset, projectId);
93289
93514
  }, [
93290
- used,
93515
+ used2,
93291
93516
  elements,
93292
93517
  asset,
93293
93518
  projectId,
@@ -93355,14 +93580,14 @@ function AssetCard({
93355
93580
  )
93356
93581
  ] }),
93357
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 }) }),
93358
- 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" }),
93359
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 })
93360
93585
  ] }),
93361
93586
  /* @__PURE__ */ jsxs172("div", { className: "flex items-center justify-center gap-1", children: [
93362
93587
  /* @__PURE__ */ jsx220(
93363
93588
  "span",
93364
93589
  {
93365
- 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"}`,
93366
93591
  title: fullName,
93367
93592
  children: truncateMiddle(fullName, 22)
93368
93593
  }
@@ -93389,7 +93614,7 @@ function AssetCard({
93389
93614
  }
93390
93615
  function FontRow({
93391
93616
  asset,
93392
- used,
93617
+ used: used2,
93393
93618
  onCopy,
93394
93619
  copyFeedback,
93395
93620
  onDelete,
@@ -93425,13 +93650,13 @@ function FontRow({
93425
93650
  /* @__PURE__ */ jsx220(
93426
93651
  "span",
93427
93652
  {
93428
- 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"}`,
93429
93654
  children: name
93430
93655
  }
93431
93656
  ),
93432
93657
  /* @__PURE__ */ jsxs172("div", { className: "flex items-center gap-1.5", children: [
93433
93658
  /* @__PURE__ */ jsx220("span", { className: "text-[10px] text-neutral-600 truncate", children: extension }),
93434
- 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" }),
93435
93660
  /* @__PURE__ */ jsx220(CopyChip, { feedback: copyFeedback, asset })
93436
93661
  ] })
93437
93662
  ] })
@@ -93462,9 +93687,9 @@ function filterByUsage(assets, usedPaths, usageFilter) {
93462
93687
  return assets;
93463
93688
  }
93464
93689
  function countUsage(assets, usedPaths) {
93465
- let used = 0;
93466
- for (const a of assets) if (usedPaths.has(a)) used++;
93467
- 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 };
93468
93693
  }
93469
93694
  function deriveUsedPaths(elements) {
93470
93695
  const paths = /* @__PURE__ */ new Set();
@@ -94433,7 +94658,7 @@ function useNearViewport() {
94433
94658
  if (!element || near4) return;
94434
94659
  if (typeof IntersectionObserver === "undefined") return setNear(true);
94435
94660
  const observer = new IntersectionObserver(
94436
- (entries) => entries.some((entry2) => entry2.isIntersecting) && setNear(true),
94661
+ (entries) => entries.some((entry3) => entry3.isIntersecting) && setNear(true),
94437
94662
  { root: element.closest("[data-composition-list]"), rootMargin: "200px" }
94438
94663
  );
94439
94664
  observer.observe(element);
@@ -95546,7 +95771,7 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
95546
95771
  ]
95547
95772
  }
95548
95773
  ),
95549
- visibleLayers.map((layer, index) => {
95774
+ visibleLayers.map((layer, index2) => {
95550
95775
  const selected = layer.key === selectedKey;
95551
95776
  const isDragged = layer.key === dragKey;
95552
95777
  const draggable = isLayerDraggable(layer);
@@ -95560,12 +95785,12 @@ var LayersPanel = memo52(function LayersPanel2({ host }) {
95560
95785
  return /* @__PURE__ */ jsxs179(
95561
95786
  "div",
95562
95787
  {
95563
- "data-layer-index": index,
95788
+ "data-layer-index": index2,
95564
95789
  role: "button",
95565
95790
  tabIndex: 0,
95566
95791
  onClick: () => !dragKey && handleSelectLayer(layer),
95567
95792
  onDoubleClick: () => !dragKey && handleLayerDoubleClick(layer),
95568
- onPointerDown: (e) => handleRowPointerDown(index, e),
95793
+ onPointerDown: (e) => handleRowPointerDown(index2, e),
95569
95794
  onPointerEnter: () => !dragKey && handleLayerHover(layer),
95570
95795
  onKeyDown: (e) => {
95571
95796
  if (e.key === "Enter" || e.key === " ") {