@hyperframes/studio 0.9.43 → 0.9.44

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.
Files changed (37) hide show
  1. package/dist/assets/{codec-DHChmhF2.js → codec-DYhkxayl.js} +1 -1
  2. package/dist/assets/{hyperframes-player-CdbweVDs.js → hyperframes-player-pPwFQY2W.js} +1 -1
  3. package/dist/assets/{index-4VGEAZyf.css → index-CU24FmKd.css} +1 -1
  4. package/dist/assets/{index-CjWDrWWG.js → index-Crhhpl7F.js} +120 -120
  5. package/dist/assets/{index-l-ti2dV8.js → index-Cv1BkoPn.js} +1 -1
  6. package/dist/assets/{pausedVideoDecoder-xqOQ0ciK.js → pausedVideoDecoder-Cns-60-8.js} +1 -1
  7. package/dist/{chunk-4QQMX4BX.js → chunk-67DSVBEI.js} +1 -1
  8. package/dist/{chunk-52AJB4PN.js → chunk-ZNUWV4FN.js} +1 -1
  9. package/dist/index.html +2 -2
  10. package/dist/index.js +653 -627
  11. package/dist/player.js +2 -2
  12. package/dist/styles.css +1 -1
  13. package/dist/ui.js +1 -1
  14. package/package.json +8 -8
  15. package/src/components/StudioOverlays.tsx +15 -13
  16. package/src/components/StudioToast.test.tsx +41 -0
  17. package/src/components/StudioToast.tsx +23 -39
  18. package/src/components/feedback/StudioFeedbackCard.tsx +5 -2
  19. package/src/components/ui/Menu.test.tsx +30 -1
  20. package/src/components/ui/Menu.tsx +1 -1
  21. package/src/hooks/timelineEditingHelpers.test.ts +48 -0
  22. package/src/hooks/timelineEditingHelpers.ts +2 -0
  23. package/src/hooks/timelineElementsAttribute.test.ts +46 -0
  24. package/src/hooks/timelineElementsAttribute.ts +14 -16
  25. package/src/hooks/timelineTrackVisibility.test.ts +34 -0
  26. package/src/hooks/useElementPicker.test.ts +9 -2
  27. package/src/hooks/useElementPicker.ts +4 -2
  28. package/src/hooks/useToast.ts +6 -18
  29. package/src/player/lib/thumbnailFrameSink.test.ts +92 -0
  30. package/src/player/lib/thumbnailFrameSink.ts +83 -0
  31. package/src/player/lib/thumbnailVideoDecoder.test.ts +43 -16
  32. package/src/player/lib/thumbnailVideoDecoder.ts +6 -6
  33. package/src/styles/components.css +19 -1
  34. package/src/styles/theme.css +3 -0
  35. package/src/utils/previewSafeMargins.ts +6 -10
  36. package/src/utils/sourcePatcher.test.ts +21 -0
  37. package/src/utils/sourcePatcher.ts +16 -8
package/dist/index.js CHANGED
@@ -89,7 +89,7 @@ import {
89
89
  whileScriptWrites,
90
90
  writeStudioUiPreferences,
91
91
  zoomToSelectedClips
92
- } from "./chunk-4QQMX4BX.js";
92
+ } from "./chunk-67DSVBEI.js";
93
93
  import {
94
94
  Button,
95
95
  ContextMenu,
@@ -121,7 +121,7 @@ import {
121
121
  fieldBase,
122
122
  fieldText,
123
123
  popupSurface
124
- } from "./chunk-52AJB4PN.js";
124
+ } from "./chunk-ZNUWV4FN.js";
125
125
  import {
126
126
  DEFAULT_STUDIO_KEYS,
127
127
  comboClashKey,
@@ -16977,6 +16977,7 @@ import {
16977
16977
  decodeAuthoredAttribute,
16978
16978
  HTML_ATTRIBUTE_ENTITIES
16979
16979
  } from "@hyperframes/parsers";
16980
+ import { stampHfIdsInPlace } from "@hyperframes/parsers/hf-ids";
16980
16981
  function escapeRegex(s) {
16981
16982
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16982
16983
  }
@@ -17143,6 +17144,11 @@ function findTagByClass(html2, target) {
17143
17144
  })[target.selectorIndex ?? 0];
17144
17145
  return found ? { tag: html2.slice(found.start, found.bodyEnd), start: found.start, end: found.bodyEnd } : null;
17145
17146
  }
17147
+ function servedSource(html2, target) {
17148
+ if (!target.hfId || findTagByTarget(html2, target)) return html2;
17149
+ const stamped = stampHfIdsInPlace(html2);
17150
+ return findTagByTarget(stamped, target) ? stamped : html2;
17151
+ }
17146
17152
  function findTagByTarget(html2, target) {
17147
17153
  if (target.hfId) {
17148
17154
  const result = findTagByAttribute(html2, "data-hf-id", target.hfId);
@@ -17161,7 +17167,7 @@ function findTagByTarget(html2, target) {
17161
17167
  return findTagByClass(html2, target);
17162
17168
  }
17163
17169
  function readAttributeByTarget(html2, target, attr2) {
17164
- const match = findTagByTarget(html2, target);
17170
+ const match = findTagByTarget(servedSource(html2, target), target);
17165
17171
  if (!match) return void 0;
17166
17172
  return readTagAttribute(match.tag, attr2.startsWith("data-") ? attr2 : `data-${attr2}`);
17167
17173
  }
@@ -17170,7 +17176,7 @@ function readTagAttribute(tag, attr2) {
17170
17176
  return value?.kind === "value" ? decodeAuthoredAttribute(value.value) : void 0;
17171
17177
  }
17172
17178
  function readTagSnippetByTarget(html2, target) {
17173
- const match = findTagByTarget(html2, target);
17179
+ const match = findTagByTarget(servedSource(html2, target), target);
17174
17180
  return match?.tag;
17175
17181
  }
17176
17182
  function patchAttributeByTarget(html2, target, attr2, value) {
@@ -17266,21 +17272,22 @@ function applyPatch(html2, elementId2, op) {
17266
17272
  }
17267
17273
  }
17268
17274
  function applyPatchByTarget(html2, target, op) {
17275
+ const source = servedSource(html2, target);
17269
17276
  if (target.id) {
17270
- const patchedById = applyPatch(html2, target.id, op);
17271
- if (patchedById !== html2 || !target.selector) {
17277
+ const patchedById = applyPatch(source, target.id, op);
17278
+ if (patchedById !== source || !target.selector && !target.hfId) {
17272
17279
  return patchedById;
17273
17280
  }
17274
17281
  }
17275
17282
  switch (op.type) {
17276
17283
  case "inline-style":
17277
- return patchInlineStyleByTarget(html2, target, op.property, op.value);
17284
+ return patchInlineStyleByTarget(source, target, op.property, op.value);
17278
17285
  case "attribute":
17279
- return patchAttributeByTarget(html2, target, op.property, op.value);
17286
+ return patchAttributeByTarget(source, target, op.property, op.value);
17280
17287
  case "html-attribute":
17281
- return patchHtmlAttributeByTarget(html2, target, op.property, op.value);
17288
+ return patchHtmlAttributeByTarget(source, target, op.property, op.value);
17282
17289
  case "text-content":
17283
- return op.value !== null ? patchTextContentByTarget(html2, target, op.value) : html2;
17290
+ return op.value !== null ? patchTextContentByTarget(source, target, op.value) : html2;
17284
17291
  default:
17285
17292
  return html2;
17286
17293
  }
@@ -18815,6 +18822,7 @@ function patchTimelineChangesInSource(source, targetPath, changes) {
18815
18822
  for (const { element, buildPatches } of changes) {
18816
18823
  const target = buildPatchTarget(element);
18817
18824
  if (!target) throw new Error(`Timeline element ${element.id} is missing a patchable target`);
18825
+ current2 = servedSource(current2, target);
18818
18826
  if (!findTagByTarget(current2, target)) {
18819
18827
  throw new Error(
18820
18828
  `Unable to patch timeline element ${element.id} in ${targetPath} (${missedLookups(element, target)})`
@@ -27887,6 +27895,54 @@ function bindThumbnailPlaybackHold(store, scheduler) {
27887
27895
  return store.subscribe((state) => scheduler.setPlaybackActive(state.isPlaying));
27888
27896
  }
27889
27897
 
27898
+ // src/player/lib/thumbnailFrameSink.ts
27899
+ function newCanvas({ width, height }) {
27900
+ if (typeof document === "undefined") return new OffscreenCanvas(width, height);
27901
+ const canvas = document.createElement("canvas");
27902
+ canvas.width = width;
27903
+ canvas.height = height;
27904
+ return canvas;
27905
+ }
27906
+ function coverCrop(source, target) {
27907
+ const scale = Math.max(target.width / source.width, target.height / source.height);
27908
+ const width = Math.min(source.width, target.width / scale);
27909
+ const height = Math.min(source.height, target.height / scale);
27910
+ return { x: (source.width - width) / 2, y: (source.height - height) / 2, width, height };
27911
+ }
27912
+ async function drawScaled(sample, context, target, fit) {
27913
+ const frame3 = sample.toVideoFrame();
27914
+ const source = { width: frame3.displayWidth, height: frame3.displayHeight };
27915
+ const crop = fit === "cover" ? coverCrop(source, target) : { x: 0, y: 0, ...source };
27916
+ const bitmap = await createImageBitmap(frame3, crop.x, crop.y, crop.width, crop.height, {
27917
+ resizeWidth: target.width,
27918
+ resizeHeight: target.height,
27919
+ resizeQuality: "medium"
27920
+ }).finally(() => frame3.close());
27921
+ try {
27922
+ context.drawImage(bitmap, 0, 0, target.width, target.height);
27923
+ } finally {
27924
+ bitmap.close();
27925
+ }
27926
+ }
27927
+ async function* scaledFrames(sink, times, target, fit) {
27928
+ for await (const sample of sink.samplesAtTimestamps(times)) {
27929
+ if (!sample) {
27930
+ yield null;
27931
+ continue;
27932
+ }
27933
+ try {
27934
+ const canvas = newCanvas(target);
27935
+ const context = canvas.getContext("2d");
27936
+ if (!context) throw new Error("Thumbnail canvas has no 2d context");
27937
+ if (sample.rotation === 0 && !sample.flipped) await drawScaled(sample, context, target, fit);
27938
+ else sample.drawWithFit(context, { fit });
27939
+ yield { canvas };
27940
+ } finally {
27941
+ sample.close();
27942
+ }
27943
+ }
27944
+ }
27945
+
27890
27946
  // src/player/lib/thumbnailSourcePool.ts
27891
27947
  var pool = /* @__PURE__ */ new Map();
27892
27948
  var mediabunnyModule = null;
@@ -28441,12 +28497,10 @@ async function decodeMissingFrames(request2, signal, budgets, keyOf17, resources
28441
28497
  }
28442
28498
  }
28443
28499
  const target = targetDimensions(info.aspect, budgets);
28444
- const sink = new mediabunny.CanvasSink(track2, {
28445
- width: target.width,
28446
- height: target.height,
28447
- fit: request2.fit ?? "cover",
28448
- poolSize: 1
28449
- });
28500
+ const frames = new mediabunny.VideoSampleSink(track2);
28501
+ const sink = {
28502
+ canvasesAtTimestamps: (timestamps2) => scaledFrames(frames, timestamps2, target, request2.fit ?? "cover")
28503
+ };
28450
28504
  const times = decodeTimesAtNearbyKeyframes();
28451
28505
  await decodeFrames(sink, times, slots, signal, resources, source.progress);
28452
28506
  }
@@ -35066,12 +35120,12 @@ function useDomEditCompositionRect({
35066
35120
  }
35067
35121
 
35068
35122
  // src/utils/previewSafeMargins.ts
35069
- var ACTION_SAFE_PERCENT = 90;
35070
- var TITLE_SAFE_PERCENT = 80;
35071
- var SAFE_BOX_PERCENTS = [ACTION_SAFE_PERCENT, TITLE_SAFE_PERCENT];
35072
- function safeBoxInsetPercent(boxPercent) {
35073
- return (100 - boxPercent) / 2;
35074
- }
35123
+ import {
35124
+ ACTION_SAFE_PERCENT,
35125
+ SAFE_BOX_PERCENTS,
35126
+ TITLE_SAFE_PERCENT,
35127
+ safeBoxInsetPercent
35128
+ } from "@hyperframes/core/safe-areas";
35075
35129
 
35076
35130
  // src/components/editor/PreviewOverlayProvider.tsx
35077
35131
  import { createContext as createContext6, useContext as useContext10, useRef as useRef59, useState as useState43 } from "react";
@@ -76385,60 +76439,87 @@ function AskAgentModal({
76385
76439
  );
76386
76440
  }
76387
76441
 
76442
+ // src/hooks/useToast.ts
76443
+ import { useState as useState117, useCallback as useCallback101, useRef as useRef129 } from "react";
76444
+ var AUTO_DISMISS_MS = 4e3;
76445
+ var MAX_TOASTS = 3;
76446
+ var toastPersists = (tone) => tone === "error";
76447
+ var nextToastId = 1;
76448
+ function useToast() {
76449
+ const [toasts, setToasts] = useState117([]);
76450
+ const timersRef = useRef129(/* @__PURE__ */ new Map());
76451
+ const clearTimer = useCallback101((id) => {
76452
+ const timer = timersRef.current.get(id);
76453
+ if (timer) {
76454
+ clearTimeout(timer);
76455
+ timersRef.current.delete(id);
76456
+ }
76457
+ }, []);
76458
+ const dismissToast = useCallback101(
76459
+ (id) => {
76460
+ clearTimer(id);
76461
+ setToasts((prev) => prev.filter((t2) => t2.id !== id));
76462
+ },
76463
+ [clearTimer]
76464
+ );
76465
+ const showToast = useCallback101(
76466
+ (message, tone = "error") => {
76467
+ const id = nextToastId++;
76468
+ setToasts((prev) => {
76469
+ const next = [...prev, { id, message, tone }];
76470
+ while (next.length > MAX_TOASTS) {
76471
+ const dropped2 = next.shift();
76472
+ if (dropped2) clearTimer(dropped2.id);
76473
+ }
76474
+ return next;
76475
+ });
76476
+ if (!toastPersists(tone)) {
76477
+ const timer = setTimeout(() => dismissToast(id), AUTO_DISMISS_MS);
76478
+ timersRef.current.set(id, timer);
76479
+ }
76480
+ return id;
76481
+ },
76482
+ [clearTimer, dismissToast]
76483
+ );
76484
+ useMountEffect(() => () => {
76485
+ for (const timer of timersRef.current.values()) clearTimeout(timer);
76486
+ timersRef.current.clear();
76487
+ });
76488
+ return { toasts, showToast, dismissToast };
76489
+ }
76490
+
76388
76491
  // src/components/StudioToast.tsx
76389
76492
  import { jsx as jsx205, jsxs as jsxs158 } from "react/jsx-runtime";
76390
- function StudioToast({ message, tone, leaving, onDismiss }) {
76391
- const isError2 = tone === "error";
76392
- return /* @__PURE__ */ jsx205(
76493
+ function StudioToast({ message, tone, onDismiss }) {
76494
+ const persists = toastPersists(tone);
76495
+ return /* @__PURE__ */ jsxs158(
76393
76496
  "div",
76394
76497
  {
76395
- role: isError2 ? "alert" : "status",
76396
- className: `motion-reduce:animate-none ${leaving ? "hf-toast-exit" : "hf-toast-enter"}`,
76397
- children: /* @__PURE__ */ jsxs158(
76398
- "div",
76399
- {
76400
- className: `relative flex max-w-[min(420px,calc(100vw-48px))] items-center gap-3 overflow-hidden rounded-2xl py-3 pl-4 pr-2 text-[12px] ${toastSurface(isError2)}`,
76401
- children: [
76402
- /* @__PURE__ */ jsx205(
76403
- "span",
76404
- {
76405
- className: `min-w-0 wrap-break-word leading-5 ${isError2 ? "text-danger-ink" : "text-text-0"}`,
76406
- children: message
76407
- }
76408
- ),
76409
- onDismiss && /* @__PURE__ */ jsx205(
76410
- "button",
76411
- {
76412
- type: "button",
76413
- onClick: onDismiss,
76414
- className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-neutral-500 transition-colors hover:bg-hover hover:text-neutral-300",
76415
- "aria-label": "Dismiss",
76416
- children: /* @__PURE__ */ jsx205(
76417
- "svg",
76418
- {
76419
- width: "10",
76420
- height: "10",
76421
- viewBox: "0 0 10 10",
76422
- fill: "none",
76423
- stroke: "currentColor",
76424
- strokeWidth: "1.5",
76425
- children: /* @__PURE__ */ jsx205("path", { d: "M2 2l6 6M8 2l-6 6" })
76426
- }
76427
- )
76428
- }
76429
- )
76430
- ]
76431
- }
76432
- )
76498
+ role: tone === "error" ? "alert" : "status",
76499
+ onClick: persists ? void 0 : onDismiss,
76500
+ onKeyDown: (event) => {
76501
+ if (event.key === "Escape") onDismiss();
76502
+ },
76503
+ className: `hf-notice-in flex min-h-12 w-fit max-w-[min(680px,100%)] items-center gap-1.5 rounded-3xl bg-text-0 py-1.5 pr-1.5 pl-5 text-[14px] leading-5 font-medium wrap-anywhere text-bg-0 shadow-notice not-has-[button]:pr-5 ${persists ? "" : "cursor-pointer"}`,
76504
+ children: [
76505
+ /* @__PURE__ */ jsx205("span", { className: "min-w-0 flex-1 text-pretty", children: message }),
76506
+ persists && /* @__PURE__ */ jsx205(
76507
+ "button",
76508
+ {
76509
+ type: "button",
76510
+ onClick: onDismiss,
76511
+ className: "relative ml-2 grid h-9 w-9 shrink-0 place-items-center rounded-full text-bg-0/72 transition-[background-color,color,scale] duration-hover ease-out hover:bg-bg-0/16 hover:text-bg-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-bg-0 active:scale-[0.96]",
76512
+ "aria-label": "Dismiss",
76513
+ children: /* @__PURE__ */ jsx205(X, { size: 14 })
76514
+ }
76515
+ )
76516
+ ]
76433
76517
  }
76434
76518
  );
76435
76519
  }
76436
- function toastSurface(isError2) {
76437
- return `border shadow-popover bg-raised ${isError2 ? "border-danger/40" : "border-border"}`;
76438
- }
76439
76520
 
76440
76521
  // src/components/feedback/StudioFeedbackCard.tsx
76441
- import { memo as memo44, useState as useState117, useCallback as useCallback101, useRef as useRef129, useEffect as useEffect115 } from "react";
76522
+ import { memo as memo44, useState as useState118, useCallback as useCallback102, useRef as useRef130, useEffect as useEffect115 } from "react";
76442
76523
 
76443
76524
  // src/components/feedback/projectProvenance.ts
76444
76525
  var CONFIG_FILE = "hyperframes.json";
@@ -76508,30 +76589,30 @@ var CRASH_FOLLOW_UP = {
76508
76589
  { label: "Just opened it", hint: "It broke before I did anything" }
76509
76590
  ]
76510
76591
  };
76511
- var AUTO_DISMISS_MS = 3e4;
76592
+ var AUTO_DISMISS_MS2 = 3e4;
76512
76593
  var EXIT_MS = 160;
76513
76594
  var THANKS_MS = 1e4;
76514
76595
  var INTERVIEW_URL = "https://calendar.app.google/yRHT7oPsHWcqFfFv5";
76515
76596
  var RATINGS = Array.from({ length: 11 }, (_, n) => n);
76516
76597
  var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
76517
- const [request2, setRequest] = useState117(null);
76518
- const [step, setStep] = useState117("rating");
76519
- const [rating, setRating] = useState117(null);
76520
- const [followUp, setFollowUp] = useState117(FAILURE_FOLLOW_UP);
76521
- const [comment, setComment] = useState117("");
76522
- const [hint, setHint] = useState117(null);
76523
- const [exiting, setExiting] = useState117(false);
76524
- const inputRef = useRef129(null);
76525
- const timerRef = useRef129(null);
76526
- const stateRef = useRef129({ request: request2, rating, step });
76598
+ const [request2, setRequest] = useState118(null);
76599
+ const [step, setStep] = useState118("rating");
76600
+ const [rating, setRating] = useState118(null);
76601
+ const [followUp, setFollowUp] = useState118(FAILURE_FOLLOW_UP);
76602
+ const [comment, setComment] = useState118("");
76603
+ const [hint, setHint] = useState118(null);
76604
+ const [exiting, setExiting] = useState118(false);
76605
+ const inputRef = useRef130(null);
76606
+ const timerRef = useRef130(null);
76607
+ const stateRef = useRef130({ request: request2, rating, step });
76527
76608
  stateRef.current = { request: request2, rating, step };
76528
- const clearTimer = useCallback101(() => {
76609
+ const clearTimer = useCallback102(() => {
76529
76610
  if (timerRef.current) {
76530
76611
  clearTimeout(timerRef.current);
76531
76612
  timerRef.current = null;
76532
76613
  }
76533
76614
  }, []);
76534
- const close = useCallback101(
76615
+ const close = useCallback102(
76535
76616
  (via) => {
76536
76617
  const { request: req, rating: picked, step: at } = stateRef.current;
76537
76618
  if (!req) return;
@@ -76572,13 +76653,13 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
76572
76653
  );
76573
76654
  useEffect115(() => {
76574
76655
  if (!request2 || step === "thanks" || rating !== null || comment !== "") return;
76575
- timerRef.current = setTimeout(() => close("timeout"), AUTO_DISMISS_MS);
76656
+ timerRef.current = setTimeout(() => close("timeout"), AUTO_DISMISS_MS2);
76576
76657
  return clearTimer;
76577
76658
  }, [request2, step, rating, comment, close, clearTimer]);
76578
76659
  useEffect115(() => {
76579
76660
  if (step === "comment") inputRef.current?.focus();
76580
76661
  }, [step]);
76581
- const submit = useCallback101(
76662
+ const submit = useCallback102(
76582
76663
  (preset) => {
76583
76664
  const req = stateRef.current.request;
76584
76665
  if (!req) return;
@@ -76605,7 +76686,7 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
76605
76686
  },
76606
76687
  [rating, comment, followUp.id, close, clearTimer]
76607
76688
  );
76608
- const pickRating = useCallback101((n) => {
76689
+ const pickRating = useCallback102((n) => {
76609
76690
  setRating(n);
76610
76691
  setFollowUp(followUpFor(n));
76611
76692
  setStep("comment");
@@ -76625,7 +76706,7 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
76625
76706
  children: /* @__PURE__ */ jsxs159(
76626
76707
  "div",
76627
76708
  {
76628
- className: `flex w-[min(340px,calc(100vw-48px))] flex-col gap-2.5 overflow-hidden rounded-2xl px-3.5 py-3 ${toastSurface(failed2)}`,
76709
+ className: `flex w-[min(340px,calc(100vw-48px))] flex-col gap-2.5 overflow-hidden rounded-2xl px-3.5 py-3 ${cardSurface(failed2)}`,
76629
76710
  children: [
76630
76711
  /* @__PURE__ */ jsxs159("div", { className: "flex items-start gap-3", children: [
76631
76712
  /* @__PURE__ */ jsx206(
@@ -76754,6 +76835,9 @@ var StudioFeedbackCard = memo44(function StudioFeedbackCard2() {
76754
76835
  }
76755
76836
  );
76756
76837
  });
76838
+ function cardSurface(isError2) {
76839
+ return `border shadow-popover bg-raised ${isError2 ? "border-danger/40" : "border-border"}`;
76840
+ }
76757
76841
 
76758
76842
  // src/components/StudioOverlays.tsx
76759
76843
  import { Fragment as Fragment55, jsx as jsx207, jsxs as jsxs160 } from "react/jsx-runtime";
@@ -76804,18 +76888,17 @@ var StudioOverlays = memo45(function StudioOverlays2({
76804
76888
  }
76805
76889
  }
76806
76890
  ),
76807
- /* @__PURE__ */ jsxs160("div", { className: "absolute bottom-6 right-6 z-91 flex flex-col items-end gap-2", children: [
76808
- toasts.map((toast) => /* @__PURE__ */ jsx207(
76891
+ /* @__PURE__ */ jsxs160("div", { className: "pointer-events-none absolute inset-x-6 bottom-6 z-91 flex items-end gap-2", children: [
76892
+ /* @__PURE__ */ jsx207("div", { className: "flex min-w-0 flex-1 flex-col items-center gap-2 *:pointer-events-auto", children: toasts.map((toast) => /* @__PURE__ */ jsx207(
76809
76893
  StudioToast,
76810
76894
  {
76811
76895
  message: toast.message,
76812
76896
  tone: toast.tone,
76813
- leaving: toast.leaving,
76814
76897
  onDismiss: () => dismissToast(toast.id)
76815
76898
  },
76816
76899
  toast.id
76817
- )),
76818
- /* @__PURE__ */ jsx207(StudioFeedbackCard, {})
76900
+ )) }),
76901
+ /* @__PURE__ */ jsx207("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx207(StudioFeedbackCard, {}) })
76819
76902
  ] })
76820
76903
  ] });
76821
76904
  });
@@ -76845,7 +76928,7 @@ function SaveQueuePausedBanner({ message, onRetry }) {
76845
76928
  }
76846
76929
 
76847
76930
  // src/components/ExternalFileConflictBanner.tsx
76848
- import { useRef as useRef130, useState as useState118 } from "react";
76931
+ import { useRef as useRef131, useState as useState119 } from "react";
76849
76932
  import { Fragment as Fragment56, jsx as jsx209, jsxs as jsxs162 } from "react/jsx-runtime";
76850
76933
  function errorMessage(error) {
76851
76934
  return error instanceof Error ? error.message : String(error);
@@ -76862,7 +76945,7 @@ function ConflictReview({
76862
76945
  conflict,
76863
76946
  onClose
76864
76947
  }) {
76865
- const containerRef = useRef130(null);
76948
+ const containerRef = useRef131(null);
76866
76949
  useDialogBehavior({ open: true, onClose, containerRef });
76867
76950
  const external = conflict.error.currentContent ?? "(The server did not return file contents.)";
76868
76951
  const studio = conflict.error.attemptedContent;
@@ -76939,7 +77022,7 @@ function FailedDraftReview({
76939
77022
  content,
76940
77023
  onClose
76941
77024
  }) {
76942
- const containerRef = useRef130(null);
77025
+ const containerRef = useRef131(null);
76943
77026
  useDialogBehavior({ open: true, onClose, containerRef });
76944
77027
  return /* @__PURE__ */ jsx209(
76945
77028
  "div",
@@ -77004,7 +77087,7 @@ function FailedDraftReview({
77004
77087
  function ExternalFileConflictBanner({
77005
77088
  coordinator
77006
77089
  }) {
77007
- const [reviewing, setReviewing] = useState118(false);
77090
+ const [reviewing, setReviewing] = useState119(false);
77008
77091
  const blocked = coordinator.blocked;
77009
77092
  if (!blocked) return null;
77010
77093
  const conflict = blocked.status === "conflict" ? blocked : null;
@@ -77075,10 +77158,10 @@ function ExternalFileConflictBanner({
77075
77158
  }
77076
77159
 
77077
77160
  // src/components/ProjectUnreachableBanner.tsx
77078
- import { useEffect as useEffect116, useState as useState119 } from "react";
77161
+ import { useEffect as useEffect116, useState as useState120 } from "react";
77079
77162
  import { Fragment as Fragment57, jsx as jsx210, jsxs as jsxs163 } from "react/jsx-runtime";
77080
77163
  function ProjectUnreachableBanner({ projectId }) {
77081
- const [served, setServed] = useState119(null);
77164
+ const [served, setServed] = useState120(null);
77082
77165
  useEffect116(() => {
77083
77166
  let cancelled = false;
77084
77167
  studioApiFetch("/api/projects").then((res) => res.ok ? res.json() : { projects: [] }).then((data) => {
@@ -77141,7 +77224,7 @@ function CompositionMissingBanner({ path }) {
77141
77224
  }
77142
77225
 
77143
77226
  // src/captions/hooks/useCaptionSync.ts
77144
- import { useCallback as useCallback102, useRef as useRef131 } from "react";
77227
+ import { useCallback as useCallback103, useRef as useRef132 } from "react";
77145
77228
  function buildOverrides(model) {
77146
77229
  const entries = [];
77147
77230
  let globalWordIndex = 0;
@@ -77172,13 +77255,13 @@ function buildOverrides(model) {
77172
77255
  return entries;
77173
77256
  }
77174
77257
  function useCaptionSync(projectId) {
77175
- const projectIdRef = useRef131(projectId);
77258
+ const projectIdRef = useRef132(projectId);
77176
77259
  projectIdRef.current = projectId;
77177
- const debounceRef = useRef131(null);
77178
- const suppressSaveRef = useRef131(false);
77179
- const pendingRef = useRef131(false);
77180
- const editSeqRef = useRef131(0);
77181
- const save = useCallback102(() => {
77260
+ const debounceRef = useRef132(null);
77261
+ const suppressSaveRef = useRef132(false);
77262
+ const pendingRef = useRef132(false);
77263
+ const editSeqRef = useRef132(0);
77264
+ const save = useCallback103(() => {
77182
77265
  const state = useCaptionStore.getState();
77183
77266
  if (!state.model || !state.sourceFilePath) {
77184
77267
  pendingRef.current = false;
@@ -77244,7 +77327,7 @@ function useCaptionSync(projectId) {
77244
77327
  useCaptionStore.getState().setRetrySave(null);
77245
77328
  };
77246
77329
  });
77247
- const loadOverrides = useCallback102(async () => {
77330
+ const loadOverrides = useCallback103(async () => {
77248
77331
  const state = useCaptionStore.getState();
77249
77332
  if (!state.model || !state.sourceFilePath) return;
77250
77333
  const pid = projectIdRef.current;
@@ -77307,7 +77390,7 @@ function useCaptionSync(projectId) {
77307
77390
  }
77308
77391
 
77309
77392
  // src/hooks/usePersistentEditHistory.ts
77310
- import { useCallback as useCallback103, useEffect as useEffect117, useMemo as useMemo71, useRef as useRef132, useState as useState120 } from "react";
77393
+ import { useCallback as useCallback104, useEffect as useEffect117, useMemo as useMemo71, useRef as useRef133, useState as useState121 } from "react";
77311
77394
  var EMPTY3 = { entries: [], back: null, forward: null };
77312
77395
  var OWN_ENTRIES_KEPT = 100;
77313
77396
  function createOwnHistory() {
@@ -77437,15 +77520,15 @@ function redoneAt(view) {
77437
77520
  return view.entries.find((entry3) => entry3.id === undo?.undoes)?.endedAt ?? null;
77438
77521
  }
77439
77522
  function usePersistentEditHistory({ projectId }) {
77440
- const [view, setView] = useState120(EMPTY3);
77441
- const [loaded, setLoaded] = useState120(false);
77442
- const heldClaimRef = useRef132(null);
77443
- const projectIdRef = useRef132(projectId);
77523
+ const [view, setView] = useState121(EMPTY3);
77524
+ const [loaded, setLoaded] = useState121(false);
77525
+ const heldClaimRef = useRef133(null);
77526
+ const projectIdRef = useRef133(projectId);
77444
77527
  projectIdRef.current = projectId;
77445
- const [own] = useState120(createOwnHistory);
77446
- const [pageKeyScope] = useState120(generateId);
77447
- const claimKey = useCallback103((key2) => `${pageKeyScope}:${key2}`, [pageKeyScope]);
77448
- const refresh2 = useCallback103(async () => {
77528
+ const [own] = useState121(createOwnHistory);
77529
+ const [pageKeyScope] = useState121(generateId);
77530
+ const claimKey = useCallback104((key2) => `${pageKeyScope}:${key2}`, [pageKeyScope]);
77531
+ const refresh2 = useCallback104(async () => {
77449
77532
  if (!projectId) return;
77450
77533
  const seen = own.changes();
77451
77534
  const response = await studioApiFetch(historyUrl(projectId)).catch(() => null);
@@ -77466,7 +77549,7 @@ function usePersistentEditHistory({ projectId }) {
77466
77549
  setStudioPendingEditClaimClock(own.claimCount);
77467
77550
  return () => setStudioPendingEditClaimClock(null);
77468
77551
  }, [own]);
77469
- const recordEdit = useCallback103(
77552
+ const recordEdit = useCallback104(
77470
77553
  async ({ label, coalesceKey, coalesceMs, files, targets, created = [] }) => {
77471
77554
  if (!projectId) return;
77472
77555
  const paths = [...Object.keys(files), ...created];
@@ -77491,7 +77574,7 @@ function usePersistentEditHistory({ projectId }) {
77491
77574
  },
77492
77575
  [projectId, refresh2, own, claimKey]
77493
77576
  );
77494
- const step = useCallback103(
77577
+ const step = useCallback104(
77495
77578
  async (direction, callbacks) => {
77496
77579
  if (!projectId) return { ok: false, reason: "empty" };
77497
77580
  const candidate = direction === "undo" && callbacks.claimedAfter !== void 0 ? own.claimedAfter(callbacks.claimedAfter) : null;
@@ -77539,12 +77622,12 @@ function usePersistentEditHistory({ projectId }) {
77539
77622
  },
77540
77623
  [projectId, view, refresh2, own]
77541
77624
  );
77542
- const noteOutsideChange = useCallback103(() => {
77625
+ const noteOutsideChange = useCallback104(() => {
77543
77626
  own.overtake();
77544
77627
  void refresh2();
77545
77628
  }, [own, refresh2]);
77546
- const undo = useCallback103((callbacks) => step("undo", callbacks), [step]);
77547
- const redo = useCallback103((callbacks) => step("redo", callbacks), [step]);
77629
+ const undo = useCallback104((callbacks) => step("undo", callbacks), [step]);
77630
+ const redo = useCallback104((callbacks) => step("redo", callbacks), [step]);
77548
77631
  const state = useMemo71(() => {
77549
77632
  const backAt = Math.max(view.back?.endedAt ?? 0, heldClaimRef.current?.at ?? 0);
77550
77633
  const redoAt = redoneAt(view);
@@ -77573,7 +77656,7 @@ function usePersistentEditHistory({ projectId }) {
77573
77656
  }
77574
77657
 
77575
77658
  // src/hooks/usePanelLayout.ts
77576
- import { useCallback as useCallback104, useEffect as useEffect118, useRef as useRef133 } from "react";
77659
+ import { useCallback as useCallback105, useEffect as useEffect118, useRef as useRef134 } from "react";
77577
77660
  function panelForTab(tab) {
77578
77661
  return tab === "block-params" ? "design" : tab;
77579
77662
  }
@@ -77584,7 +77667,7 @@ function usePanelLayout(initialState2) {
77584
77667
  const controller = useDockLayoutStore((state) => state.controller);
77585
77668
  const lastActive = useDockLayoutStore((state) => state.lastActive);
77586
77669
  const visiblePanels = useDockLayoutStore((state) => state.visiblePanels);
77587
- const initialRef = useRef133(initialState2);
77670
+ const initialRef = useRef134(initialState2);
77588
77671
  useEffect118(() => {
77589
77672
  if (!controller) return;
77590
77673
  const { rightCollapsed: rightCollapsed2, rightPanelTab: rightPanelTab2 } = initialRef.current ?? {};
@@ -77608,13 +77691,13 @@ function usePanelLayout(initialState2) {
77608
77691
  const visibleRight = visiblePanelInZone("right", lastActive, visiblePanels);
77609
77692
  const rightPanelTab = tabForPanel(visibleRight);
77610
77693
  const rightCollapsed = visibleRight === null;
77611
- const setRightPanelTab = useCallback104((tab) => {
77694
+ const setRightPanelTab = useCallback105((tab) => {
77612
77695
  const store = useDockLayoutStore.getState();
77613
77696
  const shown3 = visiblePanelInZone("right", store.lastActive, store.visiblePanels);
77614
77697
  store.activatePanel(panelForTab(tab));
77615
77698
  if (tabForPanel(shown3) !== tab) trackStudioEvent("tab_switch", { panel: "right_panel", tab });
77616
77699
  }, []);
77617
- const setRightCollapsed = useCallback104((collapsed) => {
77700
+ const setRightCollapsed = useCallback105((collapsed) => {
77618
77701
  const store = useDockLayoutStore.getState();
77619
77702
  if (!collapsed && visiblePanelInZone("right", store.lastActive, store.visiblePanels) === null) {
77620
77703
  store.activatePanel("design");
@@ -77629,10 +77712,10 @@ function usePanelLayout(initialState2) {
77629
77712
  }
77630
77713
 
77631
77714
  // src/hooks/useFileManager.ts
77632
- import { useState as useState122, useCallback as useCallback108, useRef as useRef136 } from "react";
77715
+ import { useState as useState123, useCallback as useCallback109, useRef as useRef137 } from "react";
77633
77716
 
77634
77717
  // src/hooks/useFileTree.ts
77635
- import { useState as useState121, useCallback as useCallback105, useEffect as useEffect119, useMemo as useMemo72, useRef as useRef134 } from "react";
77718
+ import { useState as useState122, useCallback as useCallback106, useEffect as useEffect119, useMemo as useMemo72, useRef as useRef135 } from "react";
77636
77719
 
77637
77720
  // src/utils/rejectionTelemetry.ts
77638
77721
  function errorProps(value) {
@@ -77659,7 +77742,7 @@ function reportRefreshFailure(err) {
77659
77742
  trackStudioEvent("file_tree_refresh_failed", { error_name, error_message });
77660
77743
  }
77661
77744
  function useFileTree({ projectId, projectIdRef }) {
77662
- const [fetched, setFetched] = useState121(null);
77745
+ const [fetched, setFetched] = useState122(null);
77663
77746
  const current2 = fetched?.projectId === projectId ? fetched : null;
77664
77747
  const fileTree = current2?.fileTree ?? EMPTY_FILE_LIST;
77665
77748
  const compositionPaths = current2?.compositionPaths ?? EMPTY_FILE_LIST;
@@ -77691,10 +77774,10 @@ function useFileTree({ projectId, projectIdRef }) {
77691
77774
  cancelled = true;
77692
77775
  };
77693
77776
  }, [projectId]);
77694
- const refreshRequestRef = useRef134(0);
77695
- const refreshAbortRef = useRef134(null);
77696
- const failureReportedRef = useRef134(false);
77697
- const refreshFileTree = useCallback105(async () => {
77777
+ const refreshRequestRef = useRef135(0);
77778
+ const refreshAbortRef = useRef135(null);
77779
+ const failureReportedRef = useRef135(false);
77780
+ const refreshFileTree = useCallback106(async () => {
77698
77781
  const pid = projectIdRef.current;
77699
77782
  if (!pid) return;
77700
77783
  refreshAbortRef.current?.abort();
@@ -77747,7 +77830,7 @@ function useFileTree({ projectId, projectIdRef }) {
77747
77830
  }
77748
77831
 
77749
77832
  // src/hooks/useEditorSave.ts
77750
- import { useCallback as useCallback106, useRef as useRef135 } from "react";
77833
+ import { useCallback as useCallback107, useRef as useRef136 } from "react";
77751
77834
  var FAILURE_BURST_MS = 5e3;
77752
77835
  function useEditorSave({
77753
77836
  editingPathRef,
@@ -77758,14 +77841,14 @@ function useEditorSave({
77758
77841
  setRefreshKey,
77759
77842
  showToast
77760
77843
  }) {
77761
- const saveRafRef = useRef135(null);
77762
- const refreshRafRef = useRef135(null);
77763
- const lastFailureToastAtRef = useRef135(null);
77764
- const lastFailureReportRef = useRef135(null);
77765
- const pendingCandidateRef = useRef135(null);
77766
- const inFlightRef = useRef135(null);
77767
- const inFlightCandidateRef = useRef135(null);
77768
- const reportFailure = useCallback106(
77844
+ const saveRafRef = useRef136(null);
77845
+ const refreshRafRef = useRef136(null);
77846
+ const lastFailureToastAtRef = useRef136(null);
77847
+ const lastFailureReportRef = useRef136(null);
77848
+ const pendingCandidateRef = useRef136(null);
77849
+ const inFlightRef = useRef136(null);
77850
+ const inFlightCandidateRef = useRef136(null);
77851
+ const reportFailure = useCallback107(
77769
77852
  (path, error) => {
77770
77853
  const now2 = Date.now();
77771
77854
  const properties = buildStudioSaveFailureProperties({
@@ -77795,7 +77878,7 @@ function useEditorSave({
77795
77878
  },
77796
77879
  [showToast]
77797
77880
  );
77798
- const persistCandidate = useCallback106(
77881
+ const persistCandidate = useCallback107(
77799
77882
  (candidate) => {
77800
77883
  const task = saveProjectFilesWithHistory({
77801
77884
  projectId: candidate.projectId,
@@ -77826,7 +77909,7 @@ function useEditorSave({
77826
77909
  },
77827
77910
  [readProjectFile, recordEdit, reportFailure, setRefreshKey, writeProjectFile]
77828
77911
  );
77829
- const handleContentChange = useCallback106(
77912
+ const handleContentChange = useCallback107(
77830
77913
  (content) => {
77831
77914
  const pid = projectIdRef.current;
77832
77915
  if (!pid) return;
@@ -77842,7 +77925,7 @@ function useEditorSave({
77842
77925
  },
77843
77926
  [editingPathRef, projectIdRef, persistCandidate]
77844
77927
  );
77845
- const flushPendingSave = useCallback106(async () => {
77928
+ const flushPendingSave = useCallback107(async () => {
77846
77929
  if (saveRafRef.current != null) {
77847
77930
  cancelAnimationFrame(saveRafRef.current);
77848
77931
  saveRafRef.current = null;
@@ -77856,7 +77939,7 @@ function useEditorSave({
77856
77939
  }
77857
77940
  return await inFlightRef.current ?? { status: "clean" };
77858
77941
  }, [persistCandidate]);
77859
- const discardPendingSave = useCallback106(() => {
77942
+ const discardPendingSave = useCallback107(() => {
77860
77943
  if (saveRafRef.current != null) cancelAnimationFrame(saveRafRef.current);
77861
77944
  saveRafRef.current = null;
77862
77945
  pendingCandidateRef.current = null;
@@ -77871,7 +77954,7 @@ function useEditorSave({
77871
77954
  }
77872
77955
 
77873
77956
  // src/hooks/useProjectFileWriter.ts
77874
- import { useCallback as useCallback107, useMemo as useMemo73 } from "react";
77957
+ import { useCallback as useCallback108, useMemo as useMemo73 } from "react";
77875
77958
  async function fetchProjectFile(projectId, path, query) {
77876
77959
  if (!projectId) throw new Error("No active project");
77877
77960
  const response = await studioApiFetch(
@@ -77888,13 +77971,13 @@ function useProjectFileWriter({ projectId }) {
77888
77971
  [projectId]
77889
77972
  );
77890
77973
  const fileVersions = fileVersionScope.versions;
77891
- const observeProjectFileVersion = useCallback107(
77974
+ const observeProjectFileVersion = useCallback108(
77892
77975
  (path, version) => {
77893
77976
  fileVersions.set(path, version);
77894
77977
  },
77895
77978
  [fileVersions]
77896
77979
  );
77897
- const readProjectFile = useCallback107(
77980
+ const readProjectFile = useCallback108(
77898
77981
  async (path) => {
77899
77982
  const { content, version } = await fetchProjectFile(projectId, path, "");
77900
77983
  if (typeof content !== "string") throw new Error(`Missing file contents for ${path}`);
@@ -77903,7 +77986,7 @@ function useProjectFileWriter({ projectId }) {
77903
77986
  },
77904
77987
  [fileVersions, projectId]
77905
77988
  );
77906
- const readOptionalProjectFile = useCallback107(
77989
+ const readOptionalProjectFile = useCallback108(
77907
77990
  async (path) => {
77908
77991
  const { content, version } = await fetchProjectFile(projectId, path, "?optional=1");
77909
77992
  fileVersions.set(path, version);
@@ -77911,7 +77994,7 @@ function useProjectFileWriter({ projectId }) {
77911
77994
  },
77912
77995
  [fileVersions, projectId]
77913
77996
  );
77914
- const writeProjectFile = useCallback107(
77997
+ const writeProjectFile = useCallback108(
77915
77998
  async (path, content, expectedContent) => {
77916
77999
  if (!projectId) throw new Error("No active project");
77917
78000
  const writeProjectId = projectId;
@@ -78007,13 +78090,13 @@ function useFileManager({
78007
78090
  recordEdit,
78008
78091
  setRefreshKey
78009
78092
  }) {
78010
- const [editingFile, setEditingFile] = useState122(null);
78011
- const [revealSourceOffset, setRevealSourceOffset] = useState122(null);
78012
- const editingPathRef = useRef136(editingFile?.path);
78093
+ const [editingFile, setEditingFile] = useState123(null);
78094
+ const [revealSourceOffset, setRevealSourceOffset] = useState123(null);
78095
+ const editingPathRef = useRef137(editingFile?.path);
78013
78096
  editingPathRef.current = editingFile?.path;
78014
- const projectIdRef = useRef136(projectId);
78097
+ const projectIdRef = useRef137(projectId);
78015
78098
  projectIdRef.current = projectId;
78016
- const importedFontAssetsRef = useRef136([]);
78099
+ const importedFontAssetsRef = useRef137([]);
78017
78100
  const {
78018
78101
  fileVersions,
78019
78102
  readProjectFile,
@@ -78030,12 +78113,12 @@ function useFileManager({
78030
78113
  assets,
78031
78114
  fontAssets
78032
78115
  } = useFileTree({ projectId, projectIdRef });
78033
- const updateEditingFileContent = useCallback108((path, content) => {
78116
+ const updateEditingFileContent = useCallback109((path, content) => {
78034
78117
  if (editingPathRef.current === path) {
78035
78118
  setEditingFile({ path, content });
78036
78119
  }
78037
78120
  }, []);
78038
- const writeProjectFile = useCallback108(
78121
+ const writeProjectFile = useCallback109(
78039
78122
  async (path, content, expectedContent) => {
78040
78123
  const writeProjectId = projectIdRef.current;
78041
78124
  await writeProjectFileRaw(path, content, expectedContent);
@@ -78055,7 +78138,7 @@ function useFileManager({
78055
78138
  showToast
78056
78139
  });
78057
78140
  const { saveRafRef, handleContentChange } = editorSave;
78058
- const overwriteExternalConflict = useCallback108(
78141
+ const overwriteExternalConflict = useCallback109(
78059
78142
  async (conflict) => {
78060
78143
  await serializeStudioFileMutation(writeProjectFile, conflict.filePath, async () => {
78061
78144
  if (conflict.currentContent != null) {
@@ -78073,9 +78156,9 @@ function useFileManager({
78073
78156
  },
78074
78157
  [fileVersions, updateEditingFileContent, writeProjectFile]
78075
78158
  );
78076
- const revealRequestIdRef = useRef136(0);
78077
- const revealAbortRef = useRef136(null);
78078
- const handleFileSelect = useCallback108(
78159
+ const revealRequestIdRef = useRef137(0);
78160
+ const revealAbortRef = useRef137(null);
78161
+ const handleFileSelect = useCallback109(
78079
78162
  (path) => {
78080
78163
  const pid = projectIdRef.current;
78081
78164
  if (!pid) return;
@@ -78100,7 +78183,7 @@ function useFileManager({
78100
78183
  },
78101
78184
  [fileVersions, showToast]
78102
78185
  );
78103
- const openSourceForSelection = useCallback108(
78186
+ const openSourceForSelection = useCallback109(
78104
78187
  (sourceFile, target) => {
78105
78188
  const pid = projectIdRef.current;
78106
78189
  if (!pid || !sourceFile) return;
@@ -78132,7 +78215,7 @@ function useFileManager({
78132
78215
  },
78133
78216
  [editingFile?.content, fileVersions]
78134
78217
  );
78135
- const uploadProjectFiles = useCallback108(
78218
+ const uploadProjectFiles = useCallback109(
78136
78219
  async (files, dir) => {
78137
78220
  const pid = projectIdRef.current;
78138
78221
  const fileList = Array.from(files);
@@ -78175,7 +78258,7 @@ function useFileManager({
78175
78258
  },
78176
78259
  [refreshFileTree, setRefreshKey, showToast]
78177
78260
  );
78178
- const handleCreateFile = useCallback108(
78261
+ const handleCreateFile = useCallback109(
78179
78262
  async (path) => {
78180
78263
  const pid = projectIdRef.current;
78181
78264
  if (!pid) return;
@@ -78202,7 +78285,7 @@ function useFileManager({
78202
78285
  },
78203
78286
  [refreshFileTree, handleFileSelect, showToast]
78204
78287
  );
78205
- const handleCreateFolder = useCallback108(
78288
+ const handleCreateFolder = useCallback109(
78206
78289
  async (path) => {
78207
78290
  const pid = projectIdRef.current;
78208
78291
  if (!pid) return;
@@ -78224,7 +78307,7 @@ function useFileManager({
78224
78307
  },
78225
78308
  [refreshFileTree, showToast]
78226
78309
  );
78227
- const handleDeleteFile = useCallback108(
78310
+ const handleDeleteFile = useCallback109(
78228
78311
  async (path) => {
78229
78312
  const pid = projectIdRef.current;
78230
78313
  if (!pid) return;
@@ -78245,7 +78328,7 @@ function useFileManager({
78245
78328
  },
78246
78329
  [refreshFileTree, showToast]
78247
78330
  );
78248
- const handleRenameFile = useCallback108(
78331
+ const handleRenameFile = useCallback109(
78249
78332
  async (oldPath, newPath) => {
78250
78333
  const pid = projectIdRef.current;
78251
78334
  if (!pid) return;
@@ -78271,7 +78354,7 @@ function useFileManager({
78271
78354
  },
78272
78355
  [refreshFileTree, handleFileSelect, setRefreshKey, showToast]
78273
78356
  );
78274
- const handleDuplicateFile = useCallback108(
78357
+ const handleDuplicateFile = useCallback109(
78275
78358
  async (path) => {
78276
78359
  const pid = projectIdRef.current;
78277
78360
  if (!pid) return;
@@ -78293,13 +78376,13 @@ function useFileManager({
78293
78376
  [refreshFileTree, handleFileSelect, showToast]
78294
78377
  );
78295
78378
  const handleMoveFile = handleRenameFile;
78296
- const handleImportFiles = useCallback108(
78379
+ const handleImportFiles = useCallback109(
78297
78380
  async (files, dir) => {
78298
78381
  return uploadProjectFiles(Array.from(files), dir);
78299
78382
  },
78300
78383
  [uploadProjectFiles]
78301
78384
  );
78302
- const handleImportFonts = useCallback108(
78385
+ const handleImportFonts = useCallback109(
78303
78386
  async (files) => {
78304
78387
  const pid = projectIdRef.current;
78305
78388
  if (!pid) return [];
@@ -78368,7 +78451,7 @@ function useFileManager({
78368
78451
  }
78369
78452
 
78370
78453
  // src/hooks/usePreviewPersistence.ts
78371
- import { useCallback as useCallback109, useRef as useRef137, useState as useState123 } from "react";
78454
+ import { useCallback as useCallback110, useRef as useRef138, useState as useState124 } from "react";
78372
78455
 
78373
78456
  // src/utils/gsapUndoRestore.ts
78374
78457
  import { ensureHfIds as ensureHfIds2, isCompositionTemplate as isCompositionTemplate2 } from "@hyperframes/parsers/hf-ids";
@@ -78741,12 +78824,12 @@ function usePreviewPersistence({
78741
78824
  reloadPreview
78742
78825
  }) {
78743
78826
  void _recordEdit;
78744
- const [domEditSaveQueuePaused, setDomEditSaveQueuePaused] = useState123(null);
78745
- const domTextCommitVersionRef = useRef137(0);
78746
- const showToastRef = useRef137(showToast);
78827
+ const [domEditSaveQueuePaused, setDomEditSaveQueuePaused] = useState124(null);
78828
+ const domTextCommitVersionRef = useRef138(0);
78829
+ const showToastRef = useRef138(showToast);
78747
78830
  showToastRef.current = showToast;
78748
- const domEditSaveQueueRef = useRef137(null);
78749
- const applyStudioManualEditsToPreviewRef = useRef137(async () => {
78831
+ const domEditSaveQueueRef = useRef138(null);
78832
+ const applyStudioManualEditsToPreviewRef = useRef138(async () => {
78750
78833
  });
78751
78834
  if (!domEditSaveQueueRef.current) {
78752
78835
  domEditSaveQueueRef.current = createDomEditSaveQueue({
@@ -78766,31 +78849,31 @@ function usePreviewPersistence({
78766
78849
  }
78767
78850
  });
78768
78851
  }
78769
- const queueDomEditSave = useCallback109((save) => {
78852
+ const queueDomEditSave = useCallback110((save) => {
78770
78853
  return domEditSaveQueueRef.current?.enqueue(save) ?? save();
78771
78854
  }, []);
78772
- const drainPendingDomEditSaves = useCallback109(async () => {
78855
+ const drainPendingDomEditSaves = useCallback110(async () => {
78773
78856
  return drainStudioSaveQueues(flushStudioPendingEdits, async () => {
78774
78857
  return await domEditSaveQueueRef.current?.waitForIdle() ?? { status: "clean" };
78775
78858
  });
78776
78859
  }, []);
78777
- const waitForPendingDomEditSaves = useCallback109(async () => {
78860
+ const waitForPendingDomEditSaves = useCallback110(async () => {
78778
78861
  const result = await drainPendingDomEditSaves();
78779
78862
  if (result.status !== "clean") throw result.error;
78780
78863
  }, [drainPendingDomEditSaves]);
78781
- const settlePendingEdits = useCallback109(async () => {
78864
+ const settlePendingEdits = useCallback110(async () => {
78782
78865
  const queued = domEditSaveQueueRef.current?.waitForIdle();
78783
78866
  await flushStudioPendingEdits({ onlyCurrent: true });
78784
78867
  await queued;
78785
78868
  }, []);
78786
- const resetDomEditSaveQueueBreaker = useCallback109(() => {
78869
+ const resetDomEditSaveQueueBreaker = useCallback110(() => {
78787
78870
  domEditSaveQueueRef.current?.reset();
78788
78871
  setDomEditSaveQueuePaused(null);
78789
78872
  }, []);
78790
78873
  useMountEffect(() => () => {
78791
78874
  domEditSaveQueueRef.current?.destroy();
78792
78875
  });
78793
- const applyCurrentStudioManualEditsToPreview = useCallback109(
78876
+ const applyCurrentStudioManualEditsToPreview = useCallback110(
78794
78877
  (iframe = previewIframeRef.current) => {
78795
78878
  if (!iframe) return;
78796
78879
  if (!readIframeDocument(iframe)) return;
@@ -78798,18 +78881,18 @@ function usePreviewPersistence({
78798
78881
  },
78799
78882
  [previewIframeRef]
78800
78883
  );
78801
- const applyStudioManualEditsToPreview = useCallback109(
78884
+ const applyStudioManualEditsToPreview = useCallback110(
78802
78885
  async (iframe = previewIframeRef.current) => {
78803
78886
  applyCurrentStudioManualEditsToPreview(iframe);
78804
78887
  },
78805
78888
  [applyCurrentStudioManualEditsToPreview, previewIframeRef]
78806
78889
  );
78807
78890
  applyStudioManualEditsToPreviewRef.current = applyStudioManualEditsToPreview;
78808
- const heldPreviewDoc = useCallback109(() => {
78891
+ const heldPreviewDoc = useCallback110(() => {
78809
78892
  const doc = previewIframeRef.current?.contentDocument;
78810
78893
  return doc && isStudioManualEditGestureLiveIn(doc) ? doc : null;
78811
78894
  }, [previewIframeRef]);
78812
- const syncHistoryPreviewAfterApply = useCallback109(
78895
+ const syncHistoryPreviewAfterApply = useCallback110(
78813
78896
  async (restore2) => {
78814
78897
  const projectId = usePlayerStore.getState().timelineProjectId;
78815
78898
  const nestedFiles = await settleNestedReads(
@@ -78842,7 +78925,7 @@ function usePreviewPersistence({
78842
78925
  },
78843
78926
  [previewIframeRef, activeCompPathRef, reloadPreview, heldPreviewDoc]
78844
78927
  );
78845
- const showHistoryRestoreNow = useCallback109(
78928
+ const showHistoryRestoreNow = useCallback110(
78846
78929
  (files) => {
78847
78930
  if (!domEditSaveQueueRef.current?.isIdle() || hasStudioPendingEdits() || heldPreviewDoc())
78848
78931
  return null;
@@ -78879,11 +78962,11 @@ function usePreviewPersistence({
78879
78962
  }
78880
78963
 
78881
78964
  // src/hooks/usePreviewDocumentVersion.ts
78882
- import { useCallback as useCallback110, useEffect as useEffect120, useRef as useRef138, useState as useState124 } from "react";
78965
+ import { useCallback as useCallback111, useEffect as useEffect120, useRef as useRef139, useState as useState125 } from "react";
78883
78966
  function usePreviewDocumentVersion() {
78884
- const [previewDocumentVersion, setPreviewDocumentVersion] = useState124(0);
78885
- const refreshTimersRef = useRef138([]);
78886
- const refresh2 = useCallback110(() => {
78967
+ const [previewDocumentVersion, setPreviewDocumentVersion] = useState125(0);
78968
+ const refreshTimersRef = useRef139([]);
78969
+ const refresh2 = useCallback111(() => {
78887
78970
  for (const id of refreshTimersRef.current) clearTimeout(id);
78888
78971
  refreshTimersRef.current = [];
78889
78972
  setPreviewDocumentVersion((v) => v + 1);
@@ -78902,10 +78985,10 @@ function usePreviewDocumentVersion() {
78902
78985
  }
78903
78986
 
78904
78987
  // src/hooks/useTimelineEditing.ts
78905
- import { useRef as useRef146 } from "react";
78988
+ import { useRef as useRef147 } from "react";
78906
78989
 
78907
78990
  // src/hooks/useRazorSplit.ts
78908
- import { useCallback as useCallback112, useRef as useRef140 } from "react";
78991
+ import { useCallback as useCallback113, useRef as useRef141 } from "react";
78909
78992
 
78910
78993
  // src/utils/razorSplitTransaction.ts
78911
78994
  function targetIdentity(path, target) {
@@ -79030,7 +79113,7 @@ function runAtomicCutTransaction(input) {
79030
79113
  }
79031
79114
 
79032
79115
  // src/hooks/useFreezeFrame.ts
79033
- import { useCallback as useCallback111, useRef as useRef139 } from "react";
79116
+ import { useCallback as useCallback112, useRef as useRef140 } from "react";
79034
79117
  function isFreezeFrameResponse(value) {
79035
79118
  if (typeof value !== "object" || value === null) return false;
79036
79119
  const body = value;
@@ -79079,9 +79162,9 @@ async function requestFreezeFrame(input) {
79079
79162
  return body;
79080
79163
  }
79081
79164
  function useFreezeFrame(options) {
79082
- const optionsRef = useRef139(options);
79165
+ const optionsRef = useRef140(options);
79083
79166
  optionsRef.current = options;
79084
- return useCallback111(async (element, playhead) => {
79167
+ return useCallback112(async (element, playhead) => {
79085
79168
  const opts = optionsRef.current;
79086
79169
  if (opts.isRecordingRef?.current) {
79087
79170
  opts.showToast("Cannot edit timeline while recording", "error");
@@ -79126,9 +79209,9 @@ function useRazorSplit({
79126
79209
  forceReloadSdkSession,
79127
79210
  isRecordingRef
79128
79211
  }) {
79129
- const projectIdRef = useRef140(projectId);
79212
+ const projectIdRef = useRef141(projectId);
79130
79213
  projectIdRef.current = projectId;
79131
- const synchronize = useCallback112(() => {
79214
+ const synchronize = useCallback113(() => {
79132
79215
  let failure2;
79133
79216
  try {
79134
79217
  forceReloadSdkSession?.();
@@ -79142,7 +79225,7 @@ function useRazorSplit({
79142
79225
  }
79143
79226
  if (failure2) throw failure2;
79144
79227
  }, [forceReloadSdkSession, reloadPreview]);
79145
- const runCut = useCallback112(
79228
+ const runCut = useCallback113(
79146
79229
  async (elements, splitTime, mode) => {
79147
79230
  const pid = projectIdRef.current;
79148
79231
  if (!pid || elements.length === 0) return;
@@ -79182,7 +79265,7 @@ function useRazorSplit({
79182
79265
  writeProjectFile
79183
79266
  ]
79184
79267
  );
79185
- const handleRazorSplit = useCallback112(
79268
+ const handleRazorSplit = useCallback113(
79186
79269
  async (element, splitTime) => {
79187
79270
  if (isRecordingRef?.current) {
79188
79271
  showToast("Cannot edit timeline while recording", "error");
@@ -79210,7 +79293,7 @@ function useRazorSplit({
79210
79293
  },
79211
79294
  [isRecordingRef, runCut, showToast]
79212
79295
  );
79213
- const handleRazorSplitAll = useCallback112(
79296
+ const handleRazorSplitAll = useCallback113(
79214
79297
  async (splitTime) => {
79215
79298
  if (isRecordingRef?.current) {
79216
79299
  showToast("Cannot edit timeline while recording", "error");
@@ -79248,7 +79331,7 @@ function useRazorSplit({
79248
79331
  }
79249
79332
 
79250
79333
  // src/hooks/useTimelineAssetDropOps.ts
79251
- import { useCallback as useCallback113 } from "react";
79334
+ import { useCallback as useCallback114 } from "react";
79252
79335
 
79253
79336
  // src/utils/timelineDropTrackInsert.ts
79254
79337
  function planDropTrackInsert(input) {
@@ -79413,7 +79496,7 @@ function useTimelineAssetDropOps({
79413
79496
  observeProjectFileVersion,
79414
79497
  checkEditable
79415
79498
  }) {
79416
- const dropAssetAt = useCallback113(
79499
+ const dropAssetAt = useCallback114(
79417
79500
  // fallow-ignore-next-line complexity
79418
79501
  async (assetPath, placement, durationOverride, gesture = { placed: [], onNewTrack: false }) => {
79419
79502
  if (isRecordingRef?.current) {
@@ -79522,13 +79605,13 @@ function useTimelineAssetDropOps({
79522
79605
  checkEditable
79523
79606
  ]
79524
79607
  );
79525
- const handleTimelineAssetDrop = useCallback113(
79608
+ const handleTimelineAssetDrop = useCallback114(
79526
79609
  async (assetPath, placement, durationOverride) => {
79527
79610
  await dropAssetAt(assetPath, placement, durationOverride);
79528
79611
  },
79529
79612
  [dropAssetAt]
79530
79613
  );
79531
- const handleTimelineFileDrop = useCallback113(
79614
+ const handleTimelineFileDrop = useCallback114(
79532
79615
  // fallow-ignore-next-line complexity
79533
79616
  async (files, placement) => {
79534
79617
  if (isRecordingRef?.current) {
@@ -79578,7 +79661,7 @@ function useTimelineAssetDropOps({
79578
79661
  showToast
79579
79662
  ]
79580
79663
  );
79581
- const handleTimelineCompositionDrop = useCallback113(
79664
+ const handleTimelineCompositionDrop = useCallback114(
79582
79665
  async (sourcePath, placement) => {
79583
79666
  if (isRecordingRef?.current) {
79584
79667
  showToast("Cannot edit timeline while recording", "error");
@@ -79629,10 +79712,10 @@ function useTimelineAssetDropOps({
79629
79712
  }
79630
79713
 
79631
79714
  // src/hooks/timelineAudioGroupVolume.ts
79632
- import { useCallback as useCallback115 } from "react";
79715
+ import { useCallback as useCallback116 } from "react";
79633
79716
 
79634
79717
  // src/hooks/timelineEditPermission.ts
79635
- import { useCallback as useCallback114 } from "react";
79718
+ import { useCallback as useCallback115 } from "react";
79636
79719
  function projectForTimelineSave(isRecording, projectId, showToast) {
79637
79720
  if (isRecording) {
79638
79721
  showToast("Cannot edit timeline while recording", "error");
@@ -79652,7 +79735,7 @@ function timelineEditRefusal(canEdit, targets) {
79652
79735
  return null;
79653
79736
  }
79654
79737
  function useTimelineEditRefusal(canEdit, showToast) {
79655
- return useCallback114(
79738
+ return useCallback115(
79656
79739
  (targets) => {
79657
79740
  const reason = timelineEditRefusal(canEdit, targets);
79658
79741
  if (reason !== null) showToast(reason, "error");
@@ -79663,7 +79746,7 @@ function useTimelineEditRefusal(canEdit, showToast) {
79663
79746
  }
79664
79747
  function useTimelineEditGate(canEdit, showToast) {
79665
79748
  const refuse2 = useTimelineEditRefusal(canEdit, showToast);
79666
- return useCallback114(
79749
+ return useCallback115(
79667
79750
  (targets) => refuse2(targets) === null,
79668
79751
  [refuse2]
79669
79752
  );
@@ -79674,7 +79757,7 @@ import { HF_AUDIO_FX_ATTR as HF_AUDIO_FX_ATTR13 } from "@hyperframes/core/audio-
79674
79757
  import { HF_AUDIO_AUTOMATION_ATTR as HF_AUDIO_AUTOMATION_ATTR8 } from "@hyperframes/core/audio-automation";
79675
79758
 
79676
79759
  // src/hooks/liveLanes.ts
79677
- import { useRef as useRef141, useState as useState125 } from "react";
79760
+ import { useRef as useRef142, useState as useState126 } from "react";
79678
79761
  function createLiveLanes(project, composition) {
79679
79762
  const before = /* @__PURE__ */ new Map();
79680
79763
  const sources = /* @__PURE__ */ new Map();
@@ -79779,9 +79862,9 @@ function restoredValue({ path, target, attr: attr2 }, files) {
79779
79862
  return html2 === void 0 || !target ? void 0 : readTargetAttribute(html2, target, attr2);
79780
79863
  }
79781
79864
  function useLiveLanes(projectIdRef, activeCompPath) {
79782
- const compositionRef = useRef141(activeCompPath);
79865
+ const compositionRef = useRef142(activeCompPath);
79783
79866
  compositionRef.current = activeCompPath;
79784
- const [lanes] = useState125(
79867
+ const [lanes] = useState126(
79785
79868
  () => createLiveLanes(
79786
79869
  () => projectIdRef.current ?? "",
79787
79870
  () => compositionRef.current ?? ""
@@ -79892,7 +79975,7 @@ function useSetAudioGroupAttribute({
79892
79975
  isRecordingRef
79893
79976
  }) {
79894
79977
  const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
79895
- const setLive = useCallback115(
79978
+ const setLive = useCallback116(
79896
79979
  (groupId, attr2, value) => {
79897
79980
  const key2 = audioGroupAttributeLiveKey(groupId, attr2);
79898
79981
  const target = previewIframeRef.current?.contentDocument?.getElementById(groupId);
@@ -79906,22 +79989,22 @@ function useSetAudioGroupAttribute({
79906
79989
  },
79907
79990
  [liveLanes, previewIframeRef, activeCompPath]
79908
79991
  );
79909
- const laneApply = useCallback115(
79992
+ const laneApply = useCallback116(
79910
79993
  (groupId, attr2) => ({
79911
79994
  preview: (value) => patchLiveGroupAttribute(previewIframeRef.current, groupId, attr2, value),
79912
79995
  store: (value) => syncStoredGroupAttribute(groupId, attr2, value)
79913
79996
  }),
79914
79997
  [previewIframeRef]
79915
79998
  );
79916
- const claimLive = useCallback115(
79999
+ const claimLive = useCallback116(
79917
80000
  (groupId, attr2, source) => liveLanes.claim(audioGroupAttributeLiveKey(groupId, attr2), laneApply(groupId, attr2), source),
79918
80001
  [liveLanes, laneApply]
79919
80002
  );
79920
- const revertLive = useCallback115(
80003
+ const revertLive = useCallback116(
79921
80004
  (groupId, attr2) => liveLanes.revert(audioGroupAttributeLiveKey(groupId, attr2), laneApply(groupId, attr2)),
79922
80005
  [liveLanes, laneApply]
79923
80006
  );
79924
- const setQuiet = useCallback115(
80007
+ const setQuiet = useCallback116(
79925
80008
  async (groupId, attr2, value, label) => {
79926
80009
  const project = projectIdRef.current;
79927
80010
  const pid = projectForTimelineSave(isRecordingRef?.current, project, showToast);
@@ -79975,7 +80058,7 @@ function useSetAudioGroupAttribute({
79975
80058
  }
79976
80059
 
79977
80060
  // src/hooks/timelineElementFxAttribute.ts
79978
- import { useCallback as useCallback116 } from "react";
80061
+ import { useCallback as useCallback117 } from "react";
79979
80062
  function patchLiveElementAttribute(iframe, element, attr2, value, activeCompPath) {
79980
80063
  const target = findTimelineElementInIframe(iframe, element, activeCompPath);
79981
80064
  if (!target) return;
@@ -80035,7 +80118,7 @@ function useSetElementAttribute({
80035
80118
  isRecordingRef
80036
80119
  }) {
80037
80120
  const liveLanes = useLiveLanes(projectIdRef, activeCompPath);
80038
- const setLive = useCallback116(
80121
+ const setLive = useCallback117(
80039
80122
  (element, attr2, value) => {
80040
80123
  const key2 = elementAttributeLiveKey(element, activeCompPath, attr2);
80041
80124
  const target = findTimelineElementInIframe(previewIframeRef.current, element, activeCompPath);
@@ -80048,14 +80131,14 @@ function useSetElementAttribute({
80048
80131
  },
80049
80132
  [liveLanes, previewIframeRef, activeCompPath]
80050
80133
  );
80051
- const laneApply = useCallback116(
80134
+ const laneApply = useCallback117(
80052
80135
  (element, attr2) => ({
80053
80136
  preview: (value) => patchLiveElementAttribute(previewIframeRef.current, element, attr2, value, activeCompPath),
80054
80137
  store: (value) => syncStoredElementAttribute(element, attr2, value)
80055
80138
  }),
80056
80139
  [previewIframeRef, activeCompPath]
80057
80140
  );
80058
- const claimLive = useCallback116(
80141
+ const claimLive = useCallback117(
80059
80142
  (element, attr2) => liveLanes.claim(
80060
80143
  elementAttributeLiveKey(element, activeCompPath, attr2),
80061
80144
  laneApply(element, attr2),
@@ -80063,14 +80146,14 @@ function useSetElementAttribute({
80063
80146
  ),
80064
80147
  [liveLanes, laneApply, activeCompPath]
80065
80148
  );
80066
- const revertLive = useCallback116(
80149
+ const revertLive = useCallback117(
80067
80150
  (element, attr2) => liveLanes.revert(
80068
80151
  elementAttributeLiveKey(element, activeCompPath, attr2),
80069
80152
  laneApply(element, attr2)
80070
80153
  ),
80071
80154
  [liveLanes, laneApply, activeCompPath]
80072
80155
  );
80073
- const setQuiet = useCallback116(
80156
+ const setQuiet = useCallback117(
80074
80157
  async (element, attr2, value, label) => {
80075
80158
  const project = projectIdRef.current;
80076
80159
  const pid = projectForTimelineSave(isRecordingRef?.current, project, showToast);
@@ -80122,14 +80205,16 @@ function useSetElementAttribute({
80122
80205
  }
80123
80206
 
80124
80207
  // src/hooks/timelineElementsAttribute.ts
80125
- import { useCallback as useCallback117 } from "react";
80126
- function editsByFile(edits, activeCompPath) {
80208
+ import { useCallback as useCallback118 } from "react";
80209
+ function editsByFile(edits, attr2, activeCompPath) {
80127
80210
  const byFile = /* @__PURE__ */ new Map();
80128
80211
  for (const { element, value } of edits) {
80129
- const target = buildPatchTarget(element);
80130
- if (!target) throw new Error("A clip has no id to save it by");
80131
80212
  const path = element.sourceFile || activeCompPath || "index.html";
80132
- byFile.set(path, [...byFile.get(path) ?? [], { target, value }]);
80213
+ const change = {
80214
+ element,
80215
+ buildPatches: (html2, target) => applyPatchByTarget(html2, target, { type: "attribute", property: attr2, value })
80216
+ };
80217
+ byFile.set(path, [...byFile.get(path) ?? [], change]);
80133
80218
  }
80134
80219
  return byFile;
80135
80220
  }
@@ -80151,7 +80236,7 @@ function useSetElementsAttribute({
80151
80236
  pendingTimelineEditPathRef,
80152
80237
  isRecordingRef
80153
80238
  }) {
80154
- return useCallback117(
80239
+ return useCallback118(
80155
80240
  async (edits, attr2, label) => {
80156
80241
  const projectId = projectForTimelineSave(
80157
80242
  isRecordingRef?.current,
@@ -80161,14 +80246,11 @@ function useSetElementsAttribute({
80161
80246
  if (typeof projectId !== "string") return projectId;
80162
80247
  if (edits.length === 0) return { status: "saved" };
80163
80248
  try {
80164
- const byFile = editsByFile(edits, activeCompPath);
80249
+ const byFile = editsByFile(edits, attr2, activeCompPath);
80165
80250
  const files = Object.fromEntries(
80166
- [...byFile].map(([path, patches]) => [
80251
+ [...byFile].map(([path, changes]) => [
80167
80252
  path,
80168
- (before) => patches.reduce(
80169
- (html2, { target, value }) => applyPatchByTarget(html2, target, { type: "attribute", property: attr2, value }),
80170
- before
80171
- )
80253
+ (before) => patchTimelineChangesInSource(before, path, changes)
80172
80254
  ])
80173
80255
  );
80174
80256
  for (const path of byFile.keys()) pendingTimelineEditPathRef.current.add(path);
@@ -80202,7 +80284,7 @@ function useSetElementsAttribute({
80202
80284
  }
80203
80285
 
80204
80286
  // src/hooks/useTimelineDeleteOps.ts
80205
- import { useCallback as useCallback118, useRef as useRef142 } from "react";
80287
+ import { useCallback as useCallback119, useRef as useRef143 } from "react";
80206
80288
  function applyRippleShifts(survivors, changes) {
80207
80289
  if (!changes) return survivors;
80208
80290
  const newStartByElement = new Map(changes.map((c) => [c.element, c.start]));
@@ -80228,8 +80310,8 @@ function useTimelineDeleteOps({
80228
80310
  previewIframeRef,
80229
80311
  handleTimelineGroupMove
80230
80312
  }) {
80231
- const rippleNoticeShownRef = useRef142(false);
80232
- const handleTimelineElementsDelete = useCallback118(
80313
+ const rippleNoticeShownRef = useRef143(false);
80314
+ const handleTimelineElementsDelete = useCallback119(
80233
80315
  // fallow-ignore-next-line complexity
80234
80316
  async (selection, alsoUnlink = []) => {
80235
80317
  if (isRecordingRef?.current) {
@@ -80363,7 +80445,7 @@ function useTimelineDeleteOps({
80363
80445
  handleTimelineGroupMove
80364
80446
  ]
80365
80447
  );
80366
- const handleTimelineElementDelete = useCallback118(
80448
+ const handleTimelineElementDelete = useCallback119(
80367
80449
  async (element) => {
80368
80450
  await handleTimelineElementsDelete([element]);
80369
80451
  },
@@ -80373,13 +80455,13 @@ function useTimelineDeleteOps({
80373
80455
  }
80374
80456
 
80375
80457
  // src/hooks/useTimelineEditGuard.ts
80376
- import { useCallback as useCallback119, useRef as useRef143 } from "react";
80458
+ import { useCallback as useCallback120, useRef as useRef144 } from "react";
80377
80459
  function useTimelineEditGuard(canEdit, showToast) {
80378
80460
  const refuseEdit = useTimelineEditRefusal(canEdit, showToast);
80379
- const refuseEditRef = useRef143(refuseEdit);
80461
+ const refuseEditRef = useRef144(refuseEdit);
80380
80462
  refuseEditRef.current = refuseEdit;
80381
- const guardedRef = useRef143(/* @__PURE__ */ new WeakMap());
80382
- const guard = useCallback119(
80463
+ const guardedRef = useRef144(/* @__PURE__ */ new WeakMap());
80464
+ const guard = useCallback120(
80383
80465
  (resolveTargets, fn, onRefused) => {
80384
80466
  const key2 = fn;
80385
80467
  const cached5 = guardedRef.current.get(key2);
@@ -80406,7 +80488,7 @@ function useTimelineEditGuard(canEdit, showToast) {
80406
80488
  }
80407
80489
 
80408
80490
  // src/hooks/useTimelineLinkEditing.ts
80409
- import { useCallback as useCallback120 } from "react";
80491
+ import { useCallback as useCallback121 } from "react";
80410
80492
 
80411
80493
  // src/hooks/timelineLinkEditPlan.ts
80412
80494
  var keyOf15 = (el) => el.key ?? el.id;
@@ -80533,7 +80615,7 @@ function useTimelineLinkEditing({
80533
80615
  forceReloadSdkSession,
80534
80616
  handleTimelineElementsDelete
80535
80617
  }) {
80536
- const handleLinkEdit = useCallback120(
80618
+ const handleLinkEdit = useCallback121(
80537
80619
  async (edit) => {
80538
80620
  if (isRecordingRef?.current) {
80539
80621
  showToast("Cannot edit timeline while recording", "error");
@@ -80588,7 +80670,7 @@ function useTimelineLinkEditing({
80588
80670
  writeProjectFile
80589
80671
  ]
80590
80672
  );
80591
- const handleLinkedElementsDelete = useCallback120(
80673
+ const handleLinkedElementsDelete = useCallback121(
80592
80674
  (selection) => {
80593
80675
  if (isLinkedSelectionOn()) return handleTimelineElementsDelete(withLinkPartners(selection));
80594
80676
  const removed = new Set(selection.map(keyOf16));
@@ -80599,11 +80681,11 @@ function useTimelineLinkEditing({
80599
80681
  },
80600
80682
  [handleTimelineElementsDelete]
80601
80683
  );
80602
- const handleLinkedElementDelete = useCallback120(
80684
+ const handleLinkedElementDelete = useCallback121(
80603
80685
  (element) => handleLinkedElementsDelete([element]),
80604
80686
  [handleLinkedElementsDelete]
80605
80687
  );
80606
- const handleDeleteElementOnly = useCallback120(
80688
+ const handleDeleteElementOnly = useCallback121(
80607
80689
  (element) => {
80608
80690
  const orphans = clipsToUnlink([element], usePlayerStore.getState().elements).filter(
80609
80691
  (el) => keyOf16(el) !== keyOf16(element)
@@ -80621,10 +80703,10 @@ function useTimelineLinkEditing({
80621
80703
  }
80622
80704
 
80623
80705
  // src/hooks/useTrackPendingTimelineEdit.ts
80624
- import { useCallback as useCallback121, useRef as useRef144 } from "react";
80706
+ import { useCallback as useCallback122, useRef as useRef145 } from "react";
80625
80707
  function useTrackPendingTimelineEdit() {
80626
- const wrappedRef = useRef144(/* @__PURE__ */ new WeakMap());
80627
- return useCallback121((fn) => {
80708
+ const wrappedRef = useRef145(/* @__PURE__ */ new WeakMap());
80709
+ return useCallback122((fn) => {
80628
80710
  const key2 = fn;
80629
80711
  const cached5 = wrappedRef.current.get(key2);
80630
80712
  if (cached5) return cached5;
@@ -80635,11 +80717,11 @@ function useTrackPendingTimelineEdit() {
80635
80717
  }
80636
80718
 
80637
80719
  // src/hooks/timelineAudioGroupCreate.ts
80638
- import { useCallback as useCallback123 } from "react";
80720
+ import { useCallback as useCallback124 } from "react";
80639
80721
  import { HF_AUDIO_GROUP_ATTR as HF_AUDIO_GROUP_ATTR5, HF_AUDIO_GROUP_TAG as HF_AUDIO_GROUP_TAG6 } from "@hyperframes/core/audio-groups";
80640
80722
 
80641
80723
  // src/hooks/timelineTrackVisibility.ts
80642
- import { useCallback as useCallback122 } from "react";
80724
+ import { useCallback as useCallback123 } from "react";
80643
80725
  function getTimelineElementTargetPath(element, activeCompPath) {
80644
80726
  return element.sourceFile || activeCompPath || "index.html";
80645
80727
  }
@@ -80790,7 +80872,7 @@ function useTimelineTrackVisibilityEditing({
80790
80872
  forceReloadSdkSession
80791
80873
  }) {
80792
80874
  const timelineElements = usePlayerStore((state) => state.elements);
80793
- return useCallback122(
80875
+ return useCallback123(
80794
80876
  async (track2, hidden, displayNumber) => {
80795
80877
  if (isRecordingRef?.current) {
80796
80878
  showToast("Cannot edit timeline while recording", "error");
@@ -80844,7 +80926,7 @@ function useTimelineElementVisibilityEditing({
80844
80926
  forceReloadSdkSession
80845
80927
  }) {
80846
80928
  const timelineElements = usePlayerStore((state) => state.elements);
80847
- return useCallback122(
80929
+ return useCallback123(
80848
80930
  async (elementKey3, hidden) => {
80849
80931
  if (isRecordingRef?.current) {
80850
80932
  showToast("Cannot edit timeline while recording", "error");
@@ -81019,7 +81101,7 @@ function useAudioGroupCarveAssignment({
81019
81101
  checkEditable
81020
81102
  }) {
81021
81103
  const timelineElements = usePlayerStore((state) => state.elements);
81022
- return useCallback123(
81104
+ return useCallback124(
81023
81105
  async (clipIds, groupId, groupLabel2) => {
81024
81106
  if (isRecordingRef?.current) {
81025
81107
  showToast("Cannot edit timeline while recording", "error");
@@ -81074,7 +81156,7 @@ function useAudioGroupCarveAssignment({
81074
81156
  }
81075
81157
 
81076
81158
  // src/hooks/useTimelineGroupEditing.ts
81077
- import { useCallback as useCallback124 } from "react";
81159
+ import { useCallback as useCallback125 } from "react";
81078
81160
  function targetPathFor(element, activeCompPath) {
81079
81161
  return element.sourceFile || activeCompPath || "index.html";
81080
81162
  }
@@ -81107,7 +81189,7 @@ function useTimelineGroupEditing({
81107
81189
  showToast,
81108
81190
  writeProjectFile
81109
81191
  }) {
81110
- const enqueueGroupOperation = useCallback124(
81192
+ const enqueueGroupOperation = useCallback125(
81111
81193
  (label, operation) => {
81112
81194
  if (isRecordingRef?.current) {
81113
81195
  showToast("Cannot edit timeline while recording", "error");
@@ -81126,7 +81208,7 @@ function useTimelineGroupEditing({
81126
81208
  },
81127
81209
  [editQueueRef, isRecordingRef, projectIdRef, showToast]
81128
81210
  );
81129
- const persistServerBatch = useCallback124(
81211
+ const persistServerBatch = useCallback125(
81130
81212
  async (projectId, label, batchChanges, coalesceKey, coalesceMs) => {
81131
81213
  await persistTimelineBatchEdit({
81132
81214
  projectId,
@@ -81149,7 +81231,7 @@ function useTimelineGroupEditing({
81149
81231
  writeProjectFile
81150
81232
  ]
81151
81233
  );
81152
- const trySdkBatchPersist = useCallback124(
81234
+ const trySdkBatchPersist = useCallback125(
81153
81235
  async (input) => {
81154
81236
  const sharedPath = allChangesSharePath(input.changes, activeCompPath);
81155
81237
  const canUseSdk = !input.needsExtension && sharedPath !== null && input.eligible && input.sdkChanges.every((change) => change !== null);
@@ -81185,7 +81267,7 @@ function useTimelineGroupEditing({
81185
81267
  writeProjectFile
81186
81268
  ]
81187
81269
  );
81188
- const handleTimelineGroupMove = useCallback124(
81270
+ const handleTimelineGroupMove = useCallback125(
81189
81271
  (changes, options) => {
81190
81272
  if (changes.length === 0) return Promise.resolve();
81191
81273
  for (const change of changes) {
@@ -81284,7 +81366,7 @@ function useTimelineGroupEditing({
81284
81366
  writeProjectFile
81285
81367
  ]
81286
81368
  );
81287
- const handleTimelineGroupResize = useCallback124(
81369
+ const handleTimelineGroupResize = useCallback125(
81288
81370
  (changes, options) => {
81289
81371
  if (changes.length === 0) return Promise.resolve();
81290
81372
  for (const change of changes) {
@@ -81384,7 +81466,7 @@ function useTimelineGroupEditing({
81384
81466
  }
81385
81467
 
81386
81468
  // src/hooks/useTimelineClipTimingEditing.ts
81387
- import { useCallback as useCallback125 } from "react";
81469
+ import { useCallback as useCallback126 } from "react";
81388
81470
  function useTimelineClipTimingEditing({
81389
81471
  activeCompPath,
81390
81472
  timelineElements,
@@ -81403,7 +81485,7 @@ function useTimelineClipTimingEditing({
81403
81485
  editQueueRef,
81404
81486
  projectIdRef
81405
81487
  }) {
81406
- const enqueueEdit = useCallback125(
81488
+ const enqueueEdit = useCallback126(
81407
81489
  (element, label, buildPatches, step) => {
81408
81490
  if (isRecordingRef?.current) {
81409
81491
  showToast("Cannot edit timeline while recording", "error");
@@ -81443,7 +81525,7 @@ function useTimelineClipTimingEditing({
81443
81525
  projectIdRef
81444
81526
  ]
81445
81527
  );
81446
- const handleTimelineElementMove = useCallback125(
81528
+ const handleTimelineElementMove = useCallback126(
81447
81529
  // fallow-ignore-next-line complexity
81448
81530
  (element, updates) => {
81449
81531
  const commitMove = () => {
@@ -81550,7 +81632,7 @@ function useTimelineClipTimingEditing({
81550
81632
  projectIdRef
81551
81633
  ]
81552
81634
  );
81553
- const handleTimelineElementResize = useCallback125(
81635
+ const handleTimelineElementResize = useCallback126(
81554
81636
  // fallow-ignore-next-line complexity
81555
81637
  (element, updates) => {
81556
81638
  const authoredStart = toAuthoredStart(element, updates.start);
@@ -81636,11 +81718,11 @@ function useTimelineClipTimingEditing({
81636
81718
  }
81637
81719
 
81638
81720
  // src/hooks/useBlockedTimelineEditToast.ts
81639
- import { useCallback as useCallback126, useRef as useRef145 } from "react";
81721
+ import { useCallback as useCallback127, useRef as useRef146 } from "react";
81640
81722
  var BLOCKED_TOAST_INTERVAL_MS = 1500;
81641
81723
  function useBlockedTimelineEditToast(showToast) {
81642
- const lastAtRef = useRef145(0);
81643
- return useCallback126(
81724
+ const lastAtRef = useRef146(0);
81725
+ return useCallback127(
81644
81726
  (_element) => {
81645
81727
  const now2 = Date.now();
81646
81728
  if (now2 - lastAtRef.current < BLOCKED_TOAST_INTERVAL_MS) return;
@@ -81672,9 +81754,9 @@ function useTimelineEditing({
81672
81754
  handleDomZIndexReorderCommitRef,
81673
81755
  canEdit
81674
81756
  }) {
81675
- const projectIdRef = useRef146(projectId);
81757
+ const projectIdRef = useRef147(projectId);
81676
81758
  projectIdRef.current = projectId;
81677
- const editQueueRef = useRef146(Promise.resolve());
81759
+ const editQueueRef = useRef147(Promise.resolve());
81678
81760
  const track2 = useTrackPendingTimelineEdit();
81679
81761
  const checkEditable = useTimelineEditGate(canEdit, showToast);
81680
81762
  const guard = useTimelineEditGuard(canEdit, showToast);
@@ -81932,7 +82014,7 @@ function useTimelineEditing({
81932
82014
  }
81933
82015
 
81934
82016
  // src/hooks/timelineMoveAdapter.ts
81935
- import { useCallback as useCallback127 } from "react";
82017
+ import { useCallback as useCallback128 } from "react";
81936
82018
  function persistTimelineMoveEditsAtomically(edits, coalesceKey, operation, deps) {
81937
82019
  return deps.handleTimelineGroupMove(
81938
82020
  edits.map(({ element, updates }) => ({
@@ -81949,7 +82031,7 @@ function persistTimelineMoveEditsAtomically(edits, coalesceKey, operation, deps)
81949
82031
  );
81950
82032
  }
81951
82033
  function useTimelineMoveEditsHandler(handleTimelineGroupMove) {
81952
- return useCallback127(
82034
+ return useCallback128(
81953
82035
  async (edits, coalesceKey, operation = "timing") => {
81954
82036
  const deps = { handleTimelineGroupMove };
81955
82037
  await persistTimelineMoveEditsAtomically(edits, coalesceKey, operation, deps);
@@ -81959,10 +82041,10 @@ function useTimelineMoveEditsHandler(handleTimelineGroupMove) {
81959
82041
  }
81960
82042
 
81961
82043
  // src/hooks/useDomEditSession.ts
81962
- import { useCallback as useCallback152 } from "react";
82044
+ import { useCallback as useCallback153 } from "react";
81963
82045
 
81964
82046
  // src/hooks/useAskAgentModal.ts
81965
- import { useState as useState126, useCallback as useCallback128, useRef as useRef147, useEffect as useEffect121 } from "react";
82047
+ import { useState as useState127, useCallback as useCallback129, useRef as useRef148, useEffect as useEffect121 } from "react";
81966
82048
  function useAskAgentModal({
81967
82049
  activeCompPath,
81968
82050
  projectDir,
@@ -81971,15 +82053,15 @@ function useAskAgentModal({
81971
82053
  domEditSelectionRef,
81972
82054
  domEditSelection
81973
82055
  }) {
81974
- const [agentPromptTagSnippet, setAgentPromptTagSnippet] = useState126();
81975
- const [agentPromptSelectionContext, setAgentPromptSelectionContext] = useState126();
81976
- const [agentModalAnchorPoint, setAgentModalAnchorPoint] = useState126(
82056
+ const [agentPromptTagSnippet, setAgentPromptTagSnippet] = useState127();
82057
+ const [agentPromptSelectionContext, setAgentPromptSelectionContext] = useState127();
82058
+ const [agentModalAnchorPoint, setAgentModalAnchorPoint] = useState127(
81977
82059
  null
81978
82060
  );
81979
- const [copiedAgentPrompt, setCopiedAgentPrompt] = useState126(false);
81980
- const [agentModalOpen, setAgentModalOpen] = useState126(false);
81981
- const copiedAgentTimerRef = useRef147(null);
81982
- const preloadAgentPromptSnippet = useCallback128(
82061
+ const [copiedAgentPrompt, setCopiedAgentPrompt] = useState127(false);
82062
+ const [agentModalOpen, setAgentModalOpen] = useState127(false);
82063
+ const copiedAgentTimerRef = useRef148(null);
82064
+ const preloadAgentPromptSnippet = useCallback129(
81983
82065
  async (selection) => {
81984
82066
  const pid = projectIdRef.current;
81985
82067
  if (!pid) return;
@@ -82001,7 +82083,7 @@ function useAskAgentModal({
82001
82083
  },
82002
82084
  [activeCompPath, domEditSelectionRef, projectIdRef]
82003
82085
  );
82004
- const handleAskAgent = useCallback128(() => {
82086
+ const handleAskAgent = useCallback129(() => {
82005
82087
  if (!domEditSelection) return;
82006
82088
  setAgentPromptTagSnippet(void 0);
82007
82089
  setAgentPromptSelectionContext(void 0);
@@ -82009,7 +82091,7 @@ function useAskAgentModal({
82009
82091
  void preloadAgentPromptSnippet(domEditSelection);
82010
82092
  setAgentModalOpen(true);
82011
82093
  }, [domEditSelection, preloadAgentPromptSnippet]);
82012
- const handleAgentModalSubmit = useCallback128(
82094
+ const handleAgentModalSubmit = useCallback129(
82013
82095
  async (userInstruction) => {
82014
82096
  if (!domEditSelection) return;
82015
82097
  const targetPath = domEditSelection.sourceFile || activeCompPath || "index.html";
@@ -82074,7 +82156,7 @@ function useAskAgentModal({
82074
82156
  }
82075
82157
 
82076
82158
  // src/hooks/useDomSelection.ts
82077
- import { useState as useState127, useCallback as useCallback129, useRef as useRef148, useEffect as useEffect123 } from "react";
82159
+ import { useState as useState128, useCallback as useCallback130, useRef as useRef149, useEffect as useEffect123 } from "react";
82078
82160
 
82079
82161
  // src/utils/domEditHelpers.ts
82080
82162
  function domEditSelectionsTargetSame(a, b) {
@@ -82318,23 +82400,23 @@ function useDomSelection({
82318
82400
  refreshKey,
82319
82401
  rightPanelTab
82320
82402
  }) {
82321
- const [domEditSelection, setDomEditSelection] = useState127(null);
82322
- const [domEditGroupSelections, setDomEditGroupSelections] = useState127([]);
82323
- const [domEditHoverSelection, setDomEditHoverSelection] = useState127(null);
82324
- const [activeGroupElement, setActiveGroupElementState] = useState127(null);
82325
- const rightPanelTabRef = useRef148(rightPanelTab);
82403
+ const [domEditSelection, setDomEditSelection] = useState128(null);
82404
+ const [domEditGroupSelections, setDomEditGroupSelections] = useState128([]);
82405
+ const [domEditHoverSelection, setDomEditHoverSelection] = useState128(null);
82406
+ const [activeGroupElement, setActiveGroupElementState] = useState128(null);
82407
+ const rightPanelTabRef = useRef149(rightPanelTab);
82326
82408
  rightPanelTabRef.current = rightPanelTab;
82327
- const domEditSelectionRef = useRef148(domEditSelection);
82328
- const domEditGroupSelectionsRef = useRef148(domEditGroupSelections);
82329
- const domEditHoverSelectionRef = useRef148(domEditHoverSelection);
82330
- const activeGroupElementRef = useRef148(activeGroupElement);
82331
- const compositionIdentityRef = useRef148({ activeCompPath, projectId });
82332
- const timelineSelectSeqRef = useRef148(0);
82409
+ const domEditSelectionRef = useRef149(domEditSelection);
82410
+ const domEditGroupSelectionsRef = useRef149(domEditGroupSelections);
82411
+ const domEditHoverSelectionRef = useRef149(domEditHoverSelection);
82412
+ const activeGroupElementRef = useRef149(activeGroupElement);
82413
+ const compositionIdentityRef = useRef149({ activeCompPath, projectId });
82414
+ const timelineSelectSeqRef = useRef149(0);
82333
82415
  domEditSelectionRef.current = domEditSelection;
82334
82416
  domEditGroupSelectionsRef.current = domEditGroupSelections;
82335
82417
  domEditHoverSelectionRef.current = domEditHoverSelection;
82336
82418
  activeGroupElementRef.current = activeGroupElement;
82337
- const announceTimelineSelection2 = useCallback129(
82419
+ const announceTimelineSelection2 = useCallback130(
82338
82420
  (group, primary, replaceSet) => announceTimelineSelection(
82339
82421
  {
82340
82422
  timelineElements,
@@ -82355,7 +82437,7 @@ function useDomSelection({
82355
82437
  timelineElements
82356
82438
  ]
82357
82439
  );
82358
- const applyDomSelection = useCallback129(
82440
+ const applyDomSelection = useCallback130(
82359
82441
  // fallow-ignore-next-line complexity
82360
82442
  (selection, options) => {
82361
82443
  if (!selection) {
@@ -82414,10 +82496,10 @@ function useDomSelection({
82414
82496
  },
82415
82497
  [announceTimelineSelection2, setRightCollapsed, setRightPanelTab]
82416
82498
  );
82417
- const clearDomSelection = useCallback129(() => {
82499
+ const clearDomSelection = useCallback130(() => {
82418
82500
  applyDomSelection(null, { revealPanel: false });
82419
82501
  }, [applyDomSelection]);
82420
- const setActiveGroupElement = useCallback129(
82502
+ const setActiveGroupElement = useCallback130(
82421
82503
  (el) => {
82422
82504
  if (activeGroupElementRef.current === el) return;
82423
82505
  activeGroupElementRef.current = el;
@@ -82426,7 +82508,7 @@ function useDomSelection({
82426
82508
  },
82427
82509
  [applyDomSelection]
82428
82510
  );
82429
- const buildDomSelectionFromTarget = useCallback129(
82511
+ const buildDomSelectionFromTarget = useCallback130(
82430
82512
  (target, options, iframe = previewIframeRef.current) => {
82431
82513
  return resolveFoundSelection(iframe, target, {
82432
82514
  activeCompositionPath: activeCompPath,
@@ -82441,7 +82523,7 @@ function useDomSelection({
82441
82523
  },
82442
82524
  [activeCompPath, isMasterView, previewIframeRef, projectId]
82443
82525
  );
82444
- const resolveDomSelectionFromPreviewPoint = useCallback129(
82526
+ const resolveDomSelectionFromPreviewPoint = useCallback130(
82445
82527
  // fallow-ignore-next-line complexity
82446
82528
  async (clientX, clientY, options) => {
82447
82529
  const iframe = previewIframeRef.current;
@@ -82466,7 +82548,7 @@ function useDomSelection({
82466
82548
  },
82467
82549
  [buildDomSelectionFromTarget, captionEditMode, previewIframeRef]
82468
82550
  );
82469
- const resolveAllDomSelectionsFromPreviewPoint = useCallback129(
82551
+ const resolveAllDomSelectionsFromPreviewPoint = useCallback130(
82470
82552
  // fallow-ignore-next-line complexity
82471
82553
  async (clientX, clientY) => {
82472
82554
  const iframe = previewIframeRef.current;
@@ -82485,14 +82567,14 @@ function useDomSelection({
82485
82567
  },
82486
82568
  [buildDomSelectionFromTarget, captionEditMode, previewIframeRef]
82487
82569
  );
82488
- const updateDomEditHoverSelection = useCallback129((selection) => {
82570
+ const updateDomEditHoverSelection = useCallback130((selection) => {
82489
82571
  const current2 = domEditHoverSelectionRef.current;
82490
82572
  const sameHandle = current2?.handle === selection?.handle;
82491
82573
  if (domEditSelectionsTargetSame(current2, selection) && sameHandle) return;
82492
82574
  domEditHoverSelectionRef.current = selection;
82493
82575
  setDomEditHoverSelection(selection);
82494
82576
  }, []);
82495
- const buildDomSelectionForTimelineElement = useCallback129(
82577
+ const buildDomSelectionForTimelineElement = useCallback130(
82496
82578
  // fallow-ignore-next-line complexity
82497
82579
  async (element) => {
82498
82580
  const iframe = previewIframeRef.current;
@@ -82517,7 +82599,7 @@ function useDomSelection({
82517
82599
  },
82518
82600
  [activeCompPath, buildDomSelectionFromTarget, compIdToSrc, isMasterView, previewIframeRef]
82519
82601
  );
82520
- const handleTimelineElementSelect = useCallback129(
82602
+ const handleTimelineElementSelect = useCallback130(
82521
82603
  async (element) => {
82522
82604
  const seq = ++timelineSelectSeqRef.current;
82523
82605
  if (!element) {
@@ -82535,9 +82617,9 @@ function useDomSelection({
82535
82617
  },
82536
82618
  [applyDomSelection, buildDomSelectionForTimelineElement, previewIframeRef]
82537
82619
  );
82538
- const refreshDomEditGroupSelectionsFromPreviewRef = useRef148(async () => {
82620
+ const refreshDomEditGroupSelectionsFromPreviewRef = useRef149(async () => {
82539
82621
  });
82540
- const refreshDomEditSelectionFromPreview = useCallback129(
82622
+ const refreshDomEditSelectionFromPreview = useCallback130(
82541
82623
  // fallow-ignore-next-line complexity
82542
82624
  async (selection, iframe = previewIframeRef.current) => {
82543
82625
  const stillSelected = () => domEditSelectionsTargetSame(domEditSelectionRef.current, selection);
@@ -82571,7 +82653,7 @@ function useDomSelection({
82571
82653
  },
82572
82654
  [activeCompPath, applyDomSelection, buildDomSelectionFromTarget, previewIframeRef]
82573
82655
  );
82574
- const refreshDomEditGroupSelectionsFromPreview = useCallback129(
82656
+ const refreshDomEditGroupSelectionsFromPreview = useCallback130(
82575
82657
  // fallow-ignore-next-line complexity
82576
82658
  async (selections, iframe = previewIframeRef.current) => {
82577
82659
  const nextGroup = [];
@@ -82627,7 +82709,7 @@ function useDomSelection({
82627
82709
  applyDomSelection(null, { revealPanel: false });
82628
82710
  }, [applyDomSelection, captionEditMode]);
82629
82711
  useStudioTestHooks({ previewIframeRef, buildDomSelectionFromTarget, applyDomSelection });
82630
- const applyMarqueeSelection = useCallback129(
82712
+ const applyMarqueeSelection = useCallback130(
82631
82713
  // fallow-ignore-next-line complexity
82632
82714
  (selections, mode) => {
82633
82715
  logSelect("marquee", { hits: selections.length, mode });
@@ -82701,7 +82783,7 @@ function useDomSelection({
82701
82783
  }
82702
82784
 
82703
82785
  // src/hooks/usePreviewInteraction.ts
82704
- import { useCallback as useCallback130, useRef as useRef149 } from "react";
82786
+ import { useCallback as useCallback131, useRef as useRef150 } from "react";
82705
82787
  var CYCLE_RADIUS_PX = 6;
82706
82788
  var CYCLE_WINDOW_MS = 600;
82707
82789
  var DOUBLE_CLICK_MS = 400;
@@ -82718,10 +82800,10 @@ function usePreviewInteraction({
82718
82800
  setActiveGroupElement,
82719
82801
  onClickToSource
82720
82802
  }) {
82721
- const cycleRef = useRef149(null);
82722
- const lastDownRef = useRef149(null);
82723
- const hoverSeqRef = useRef149(0);
82724
- const pausePreviewPlayback = useCallback130(() => {
82803
+ const cycleRef = useRef150(null);
82804
+ const lastDownRef = useRef150(null);
82805
+ const hoverSeqRef = useRef150(0);
82806
+ const pausePreviewPlayback = useCallback131(() => {
82725
82807
  const pausedTime = pauseStudioPreviewPlayback(previewIframeRef.current);
82726
82808
  const playerStore = usePlayerStore.getState();
82727
82809
  playerStore.setIsPlaying(false);
@@ -82730,7 +82812,7 @@ function usePreviewInteraction({
82730
82812
  liveTime.notify(pausedTime);
82731
82813
  }
82732
82814
  }, [previewIframeRef]);
82733
- const handlePreviewCanvasMouseDown = useCallback130(
82815
+ const handlePreviewCanvasMouseDown = useCallback131(
82734
82816
  // fallow-ignore-next-line complexity
82735
82817
  async (e, options) => {
82736
82818
  if (captionEditMode || compositionLoading) return;
@@ -82833,7 +82915,7 @@ function usePreviewInteraction({
82833
82915
  setActiveGroupElement
82834
82916
  ]
82835
82917
  );
82836
- const handlePreviewCanvasPointerMove = useCallback130(
82918
+ const handlePreviewCanvasPointerMove = useCallback131(
82837
82919
  // fallow-ignore-next-line complexity
82838
82920
  async (e, options) => {
82839
82921
  const seq = ++hoverSeqRef.current;
@@ -82855,11 +82937,11 @@ function usePreviewInteraction({
82855
82937
  updateDomEditHoverSelection
82856
82938
  ]
82857
82939
  );
82858
- const handlePreviewCanvasPointerLeave = useCallback130(() => {
82940
+ const handlePreviewCanvasPointerLeave = useCallback131(() => {
82859
82941
  hoverSeqRef.current += 1;
82860
82942
  updateDomEditHoverSelection(null);
82861
82943
  }, [updateDomEditHoverSelection]);
82862
- const handleBlockedDomMove = useCallback130(
82944
+ const handleBlockedDomMove = useCallback131(
82863
82945
  (selection, reason) => {
82864
82946
  showToast(
82865
82947
  reason ?? selection.capabilities.reasonIfDisabled ?? "This element can't be adjusted directly from the preview.",
@@ -82868,7 +82950,7 @@ function usePreviewInteraction({
82868
82950
  },
82869
82951
  [showToast]
82870
82952
  );
82871
- const handleDomManualDragStart = useCallback130(() => {
82953
+ const handleDomManualDragStart = useCallback131(() => {
82872
82954
  pausePreviewPlayback();
82873
82955
  }, [pausePreviewPlayback]);
82874
82956
  return {
@@ -82881,7 +82963,7 @@ function usePreviewInteraction({
82881
82963
  }
82882
82964
 
82883
82965
  // src/hooks/useDomEditCommits.ts
82884
- import { useCallback as useCallback136 } from "react";
82966
+ import { useCallback as useCallback137 } from "react";
82885
82967
  import { findUnsafeDomPatchValues as findUnsafeDomPatchValues3 } from "@hyperframes/core/studio-api/finite-mutation";
82886
82968
 
82887
82969
  // src/utils/studioFontHelpers.ts
@@ -82935,7 +83017,7 @@ function importedFontFaceCssFor(asset, sourceFile) {
82935
83017
  }
82936
83018
 
82937
83019
  // src/hooks/useDomEditPersist.ts
82938
- import { useCallback as useCallback131, useRef as useRef150 } from "react";
83020
+ import { useCallback as useCallback132, useRef as useRef151 } from "react";
82939
83021
  import { findUnsafeDomPatchValues as findUnsafeDomPatchValues2 } from "@hyperframes/core/studio-api/finite-mutation";
82940
83022
 
82941
83023
  // src/hooks/gsapScriptCommitHelpers.ts
@@ -83159,8 +83241,8 @@ function useDomEditPersist({
83159
83241
  forceReloadSdkSession,
83160
83242
  onTrySdkPersist
83161
83243
  }) {
83162
- const reportedUnresolvableRef = useRef150(/* @__PURE__ */ new Set());
83163
- const performPersistDomEditOperations = useCallback131(
83244
+ const reportedUnresolvableRef = useRef151(/* @__PURE__ */ new Set());
83245
+ const performPersistDomEditOperations = useCallback132(
83164
83246
  // fallow-ignore-next-line complexity
83165
83247
  async (selection, operations, options, expectedProjectId) => {
83166
83248
  if (projectIdRef.current !== expectedProjectId) {
@@ -83286,7 +83368,7 @@ function useDomEditPersist({
83286
83368
  previewIframeRef
83287
83369
  ]
83288
83370
  );
83289
- const persistDomEditOperations = useCallback131(
83371
+ const persistDomEditOperations = useCallback132(
83290
83372
  (selection, operations, options) => {
83291
83373
  const expectedProjectId = projectIdRef.current;
83292
83374
  if (!expectedProjectId) return Promise.reject(new Error("No active project"));
@@ -83301,13 +83383,13 @@ function useDomEditPersist({
83301
83383
  }
83302
83384
 
83303
83385
  // src/hooks/useDomEditPositionPatchCommit.ts
83304
- import { useCallback as useCallback132 } from "react";
83386
+ import { useCallback as useCallback133 } from "react";
83305
83387
  function useDomEditPositionPatchCommit({
83306
83388
  activeCompPath,
83307
83389
  persistDomEditOperations,
83308
83390
  showToast
83309
83391
  }) {
83310
- return useCallback132(
83392
+ return useCallback133(
83311
83393
  (selection, patches, options) => {
83312
83394
  return persistDomEditOperations(selection, patches, {
83313
83395
  label: options.label,
@@ -83338,7 +83420,7 @@ function useDomEditPositionPatchCommit({
83338
83420
  }
83339
83421
 
83340
83422
  // src/hooks/useDomEditTextCommits.ts
83341
- import { useCallback as useCallback134, useRef as useRef152 } from "react";
83423
+ import { useCallback as useCallback135, useRef as useRef153 } from "react";
83342
83424
 
83343
83425
  // src/hooks/refreshTimelineRowText.ts
83344
83426
  function refreshTimelineRowText(el) {
@@ -83490,7 +83572,7 @@ async function commitDomStyles(context, selection, stylesInEitherCase) {
83490
83572
  }
83491
83573
 
83492
83574
  // src/hooks/useDomEditAttributeCommits.ts
83493
- import { useCallback as useCallback133, useRef as useRef151 } from "react";
83575
+ import { useCallback as useCallback134, useRef as useRef152 } from "react";
83494
83576
  import { HF_AUDIO_GROUP_ATTR as HF_AUDIO_GROUP_ATTR6, HF_AUDIO_GROUP_TAG as HF_AUDIO_GROUP_TAG8 } from "@hyperframes/core/audio-groups";
83495
83577
  function resolveFullAttrName(attr2, prefixData) {
83496
83578
  return prefixData && !attr2.startsWith("data-") ? `data-${attr2}` : attr2;
@@ -83541,8 +83623,8 @@ function useDomEditAttributeCommits({
83541
83623
  refreshDomEditSelectionFromPreview,
83542
83624
  persistDomEditOperations
83543
83625
  }) {
83544
- const domAttributeCommitVersionRef = useRef151(/* @__PURE__ */ new Map());
83545
- const commitDataAttribute = useCallback133(
83626
+ const domAttributeCommitVersionRef = useRef152(/* @__PURE__ */ new Map());
83627
+ const commitDataAttribute = useCallback134(
83546
83628
  async (attr2, value, options) => {
83547
83629
  if (!domEditSelection) return;
83548
83630
  const iframe = previewIframeRef.current;
@@ -83602,7 +83684,7 @@ function useDomEditAttributeCommits({
83602
83684
  previewIframeRef
83603
83685
  ]
83604
83686
  );
83605
- const commitAttributeOps = useCallback133(
83687
+ const commitAttributeOps = useCallback134(
83606
83688
  async (selection, ops, options) => {
83607
83689
  const iframe = previewIframeRef.current;
83608
83690
  const entries = ops.map((op) => ({
@@ -83672,7 +83754,7 @@ function useDomEditAttributeCommits({
83672
83754
  previewIframeRef
83673
83755
  ]
83674
83756
  );
83675
- const handleDomAttributesCommit = useCallback133(
83757
+ const handleDomAttributesCommit = useCallback134(
83676
83758
  async (selection, attrs) => {
83677
83759
  await commitAttributeOps(
83678
83760
  selection,
@@ -83691,7 +83773,7 @@ function useDomEditAttributeCommits({
83691
83773
  },
83692
83774
  [commitAttributeOps]
83693
83775
  );
83694
- const handleDomAttributeBatchCommit = useCallback133(
83776
+ const handleDomAttributeBatchCommit = useCallback134(
83695
83777
  (selection, ops, options) => commitAttributeOps(selection, ops, {
83696
83778
  label: options.label,
83697
83779
  coalescePrefix: "attr-batch",
@@ -83702,7 +83784,7 @@ function useDomEditAttributeCommits({
83702
83784
  }),
83703
83785
  [commitAttributeOps]
83704
83786
  );
83705
- const handleDomAttributeCommit = useCallback133(
83787
+ const handleDomAttributeCommit = useCallback134(
83706
83788
  async (attr2, value) => {
83707
83789
  await commitDataAttribute(attr2, value, {
83708
83790
  label: `Edit ${attr2.replace(/-/g, " ")}`,
@@ -83713,7 +83795,7 @@ function useDomEditAttributeCommits({
83713
83795
  },
83714
83796
  [commitDataAttribute]
83715
83797
  );
83716
- const handleDomAttributeLiveCommit = useCallback133(
83798
+ const handleDomAttributeLiveCommit = useCallback134(
83717
83799
  async (attr2, value, onSettled, live) => {
83718
83800
  await commitDataAttribute(attr2, value, {
83719
83801
  label: `Edit ${attr2.replace(/^(data-)?/, "").replace(/-/g, " ")}`,
@@ -83725,7 +83807,7 @@ function useDomEditAttributeCommits({
83725
83807
  },
83726
83808
  [commitDataAttribute]
83727
83809
  );
83728
- const handleDomAttributeQuietCommit = useCallback133(
83810
+ const handleDomAttributeQuietCommit = useCallback134(
83729
83811
  async (attr2, value) => {
83730
83812
  await commitDataAttribute(attr2, value, {
83731
83813
  label: `Edit ${attr2.replace(/^(data-)?/, "").replace(/-/g, " ")}`,
@@ -83736,7 +83818,7 @@ function useDomEditAttributeCommits({
83736
83818
  },
83737
83819
  [commitDataAttribute]
83738
83820
  );
83739
- const handleDomHtmlAttributeCommit = useCallback133(
83821
+ const handleDomHtmlAttributeCommit = useCallback134(
83740
83822
  async (attr2, value) => {
83741
83823
  if (!domEditSelection) return;
83742
83824
  const iframe = previewIframeRef.current;
@@ -83832,12 +83914,12 @@ function useDomEditTextCommits({
83832
83914
  resolveImportedFontAsset,
83833
83915
  readOnlyPreview
83834
83916
  }) {
83835
- const latestReadOnlyPreviewRef = useRef152(readOnlyPreview);
83917
+ const latestReadOnlyPreviewRef = useRef153(readOnlyPreview);
83836
83918
  latestReadOnlyPreviewRef.current = readOnlyPreview;
83837
- const latestSelectionRef = useRef152(domEditSelection);
83919
+ const latestSelectionRef = useRef153(domEditSelection);
83838
83920
  latestSelectionRef.current = domEditSelection;
83839
- const domTextCommitVersionRef = useRef152(/* @__PURE__ */ new Map());
83840
- const domStyleCommitVersionRef = useRef152(/* @__PURE__ */ new Map());
83921
+ const domTextCommitVersionRef = useRef153(/* @__PURE__ */ new Map());
83922
+ const domStyleCommitVersionRef = useRef153(/* @__PURE__ */ new Map());
83841
83923
  const {
83842
83924
  handleDomAttributeCommit,
83843
83925
  handleDomAttributeLiveCommit,
@@ -83853,7 +83935,7 @@ function useDomEditTextCommits({
83853
83935
  refreshDomEditSelectionFromPreview,
83854
83936
  persistDomEditOperations
83855
83937
  });
83856
- const handleDomStyleCommitForSelection = useCallback134(
83938
+ const handleDomStyleCommitForSelection = useCallback135(
83857
83939
  (selection, propertyOrStylesAsOnePatch, value = "") => commitDomStyles(
83858
83940
  {
83859
83941
  activeCompPath,
@@ -83876,11 +83958,11 @@ function useDomEditTextCommits({
83876
83958
  previewIframeRef
83877
83959
  ]
83878
83960
  );
83879
- const handleDomStyleCommit = useCallback134(
83961
+ const handleDomStyleCommit = useCallback135(
83880
83962
  (property, value) => domEditSelection ? handleDomStyleCommitForSelection(domEditSelection, property, value) : Promise.resolve(domEditCommitDeclined("no-selection")),
83881
83963
  [domEditSelection, handleDomStyleCommitForSelection]
83882
83964
  );
83883
- const handleDomTextCommitForSelection = useCallback134(
83965
+ const handleDomTextCommitForSelection = useCallback135(
83884
83966
  async (selection, value, fieldKey) => {
83885
83967
  if (!isTextEditableSelection(selection)) {
83886
83968
  return domEditCommitDeclined("not-text-editable");
@@ -83942,11 +84024,11 @@ function useDomEditTextCommits({
83942
84024
  showToast
83943
84025
  ]
83944
84026
  );
83945
- const handleDomTextCommit = useCallback134(
84027
+ const handleDomTextCommit = useCallback135(
83946
84028
  (value, fieldKey) => domEditSelection ? handleDomTextCommitForSelection(domEditSelection, value, fieldKey) : Promise.resolve(domEditCommitDeclined("no-selection")),
83947
84029
  [domEditSelection, handleDomTextCommitForSelection]
83948
84030
  );
83949
- const handleDomRichTextCommit = useCallback134(
84031
+ const handleDomRichTextCommit = useCallback135(
83950
84032
  async ({ element, html: html2, previousHtml }) => {
83951
84033
  const putBack = () => {
83952
84034
  if (element.isConnected && element.innerHTML === html2) element.innerHTML = previousHtml;
@@ -84020,7 +84102,7 @@ function useDomEditTextCommits({
84020
84102
  showToast
84021
84103
  ]
84022
84104
  );
84023
- const commitDomTextFields = useCallback134(
84105
+ const commitDomTextFields = useCallback135(
84024
84106
  async (selection, nextTextFields, options) => {
84025
84107
  const isLatestTextCommit = bumpDomEditCommitMapVersion(
84026
84108
  domTextCommitVersionRef.current,
@@ -84085,7 +84167,7 @@ function useDomEditTextCommits({
84085
84167
  showToast
84086
84168
  ]
84087
84169
  );
84088
- const handleDomTextFieldStyleCommit = useCallback134(
84170
+ const handleDomTextFieldStyleCommit = useCallback135(
84089
84171
  async (fieldKey, property, value) => {
84090
84172
  if (!domEditSelection) return;
84091
84173
  const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
@@ -84126,7 +84208,7 @@ function useDomEditTextCommits({
84126
84208
  previewIframeRef
84127
84209
  ]
84128
84210
  );
84129
- const handleDomAddTextField = useCallback134(
84211
+ const handleDomAddTextField = useCallback135(
84130
84212
  async (afterFieldKey) => {
84131
84213
  if (!domEditSelection) return null;
84132
84214
  if (!domEditSelection.textFields.some((field) => field.source === "child")) return null;
@@ -84146,7 +84228,7 @@ function useDomEditTextCommits({
84146
84228
  },
84147
84229
  [commitDomTextFields, domEditSelection]
84148
84230
  );
84149
- const handleDomRemoveTextField = useCallback134(
84231
+ const handleDomRemoveTextField = useCallback135(
84150
84232
  async (fieldKey) => {
84151
84233
  if (!domEditSelection) return;
84152
84234
  const field = domEditSelection.textFields.find((entry3) => entry3.key === fieldKey);
@@ -84180,7 +84262,7 @@ function useDomEditTextCommits({
84180
84262
  }
84181
84263
 
84182
84264
  // src/hooks/useDomGeometryCommits.ts
84183
- import { useCallback as useCallback135 } from "react";
84265
+ import { useCallback as useCallback136 } from "react";
84184
84266
 
84185
84267
  // src/components/editor/elementPositionOffset.ts
84186
84268
  var layoutBox = (el) => ({
@@ -84324,7 +84406,7 @@ function useDomGeometryCommits({
84324
84406
  commitPositionPatchToHtml,
84325
84407
  readOnlyPreview
84326
84408
  }) {
84327
- const stageElementPositionOffset = useCallback135(
84409
+ const stageElementPositionOffset = useCallback136(
84328
84410
  (selection, next, plainTranslate, coalesceKey) => stageElementOffset(
84329
84411
  { commitPositionPatchToHtml, showToast, readOnlyPreview },
84330
84412
  selection,
@@ -84334,7 +84416,7 @@ function useDomGeometryCommits({
84334
84416
  ),
84335
84417
  [commitPositionPatchToHtml, readOnlyPreview, showToast]
84336
84418
  );
84337
- const handleDomBoxSizeCommit = useCallback135(
84419
+ const handleDomBoxSizeCommit = useCallback136(
84338
84420
  (selection, next, offset, restore2, undoKey) => {
84339
84421
  if (readOnlyPreview) return Promise.resolve(void 0);
84340
84422
  const element = selection.element;
@@ -84362,11 +84444,11 @@ function useDomGeometryCommits({
84362
84444
  },
84363
84445
  [commitPositionPatchToHtml, readOnlyPreview]
84364
84446
  );
84365
- const handleDomRotationCommit = useCallback135(
84447
+ const handleDomRotationCommit = useCallback136(
84366
84448
  (selection, next) => savePlainRotation({ commitPositionPatchToHtml, readOnlyPreview }, selection, next),
84367
84449
  [commitPositionPatchToHtml, readOnlyPreview]
84368
84450
  );
84369
- const handleDomManualEditsReset = useCallback135(
84451
+ const handleDomManualEditsReset = useCallback136(
84370
84452
  (selection) => {
84371
84453
  const element = selection.element;
84372
84454
  const beforeOffset = captureStudioPathOffset(element);
@@ -84426,7 +84508,7 @@ function useDomEditCommits({
84426
84508
  onReorderShadow,
84427
84509
  readOnlyPreview
84428
84510
  }) {
84429
- const resolveImportedFontAsset = useCallback136(
84511
+ const resolveImportedFontAsset = useCallback137(
84430
84512
  (fontFamilyValue) => {
84431
84513
  const family = primaryFontFamilyValue(fontFamilyValue);
84432
84514
  if (!family) return null;
@@ -84458,7 +84540,7 @@ function useDomEditCommits({
84458
84540
  forceReloadSdkSession,
84459
84541
  onTrySdkPersist
84460
84542
  });
84461
- const commitDomEditPatchBatches = useCallback136(
84543
+ const commitDomEditPatchBatches = useCallback137(
84462
84544
  (batches, options) => {
84463
84545
  const expectedProjectId = projectIdRef.current;
84464
84546
  if (!expectedProjectId) return Promise.reject(new Error("No active project"));
@@ -84629,7 +84711,7 @@ function useDomEditCommits({
84629
84711
  }
84630
84712
 
84631
84713
  // src/hooks/useGroupCommits.ts
84632
- import { useCallback as useCallback137 } from "react";
84714
+ import { useCallback as useCallback138 } from "react";
84633
84715
  function resolveAuthoredTrack(selection, timelineElements) {
84634
84716
  const id = findMatchingTimelineElementId(selection, timelineElements);
84635
84717
  if (!id) return void 0;
@@ -84708,7 +84790,7 @@ async function commitStructuralMutation(pid, targetPath, route, body, label, dep
84708
84790
  }
84709
84791
  function useGroupCommits(params) {
84710
84792
  const { activeCompPath, showToast, projectIdRef, timelineElements } = params;
84711
- const groupSelection = useCallback137(
84793
+ const groupSelection = useCallback138(
84712
84794
  async (members) => {
84713
84795
  const pid = projectIdRef.current;
84714
84796
  if (!pid || members.length === 0) return null;
@@ -84737,7 +84819,7 @@ function useGroupCommits(params) {
84737
84819
  },
84738
84820
  [activeCompPath, projectIdRef, showToast, params, timelineElements]
84739
84821
  );
84740
- const ungroupSelection = useCallback137(
84822
+ const ungroupSelection = useCallback138(
84741
84823
  async (group) => {
84742
84824
  const pid = projectIdRef.current;
84743
84825
  if (!pid) return;
@@ -84762,7 +84844,7 @@ function useGroupCommits(params) {
84762
84844
  }
84763
84845
 
84764
84846
  // src/hooks/useGsapScriptCommits.ts
84765
- import { useCallback as useCallback143, useMemo as useMemo74, useRef as useRef154 } from "react";
84847
+ import { useCallback as useCallback144, useMemo as useMemo74, useRef as useRef155 } from "react";
84766
84848
  import { findUnsafeMutationValues } from "@hyperframes/core/studio-api/finite-mutation";
84767
84849
 
84768
84850
  // src/hooks/gsapRuntimePatch.ts
@@ -84963,7 +85045,7 @@ function gsapWriteFile(selection, activeCompPath) {
84963
85045
  }
84964
85046
 
84965
85047
  // src/hooks/useGsapAnimationOps.ts
84966
- import { useCallback as useCallback138 } from "react";
85048
+ import { useCallback as useCallback139 } from "react";
84967
85049
  function useGsapAnimationOps({
84968
85050
  projectIdRef,
84969
85051
  activeCompPath,
@@ -84974,7 +85056,7 @@ function useGsapAnimationOps({
84974
85056
  sdkDeps,
84975
85057
  writeProjectFile
84976
85058
  }) {
84977
- const updateGsapMeta = useCallback138(
85059
+ const updateGsapMeta = useCallback139(
84978
85060
  async (selection, animationId, updates) => {
84979
85061
  if (sdkSession && sdkDeps) {
84980
85062
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
@@ -84995,7 +85077,7 @@ function useGsapAnimationOps({
84995
85077
  },
84996
85078
  [commitMutationSafely, activeCompPath, sdkSession, sdkDeps]
84997
85079
  );
84998
- const deleteGsapAnimation = useCallback138(
85080
+ const deleteGsapAnimation = useCallback139(
84999
85081
  async (selection, animationId) => {
85000
85082
  if (sdkSession && sdkDeps) {
85001
85083
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
@@ -85016,7 +85098,7 @@ function useGsapAnimationOps({
85016
85098
  },
85017
85099
  [commitMutationSafely, activeCompPath, sdkSession, sdkDeps]
85018
85100
  );
85019
- const deleteAllForSelector = useCallback138(
85101
+ const deleteAllForSelector = useCallback139(
85020
85102
  async (selection, targetSelector) => {
85021
85103
  if (sdkSession && sdkDeps) {
85022
85104
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
@@ -85037,7 +85119,7 @@ function useGsapAnimationOps({
85037
85119
  },
85038
85120
  [commitMutation, activeCompPath, sdkSession, sdkDeps]
85039
85121
  );
85040
- const addGsapAnimation = useCallback138(
85122
+ const addGsapAnimation = useCallback139(
85041
85123
  // fallow-ignore-next-line complexity
85042
85124
  async (selection, method, _currentTime) => {
85043
85125
  const address = ensureElementAddressable(selection);
@@ -85112,7 +85194,7 @@ function useGsapAnimationOps({
85112
85194
  writeProjectFile
85113
85195
  ]
85114
85196
  );
85115
- const addWithKeyframes = useCallback138(
85197
+ const addWithKeyframes = useCallback139(
85116
85198
  async (selection, targetSelector, position, duration, keyframes, ease, label = "Add animation with keyframes") => {
85117
85199
  if (sdkSession && sdkDeps) {
85118
85200
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
@@ -85144,7 +85226,7 @@ function useGsapAnimationOps({
85144
85226
  },
85145
85227
  [commitMutation, activeCompPath, sdkSession, sdkDeps]
85146
85228
  );
85147
- const replaceWithKeyframes = useCallback138(
85229
+ const replaceWithKeyframes = useCallback139(
85148
85230
  async (selection, animationId, targetSelector, position, duration, keyframes, ease, label = "Replace animation with keyframes") => {
85149
85231
  if (sdkSession && sdkDeps) {
85150
85232
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
@@ -85189,9 +85271,9 @@ function useGsapAnimationOps({
85189
85271
  }
85190
85272
 
85191
85273
  // src/hooks/useGsapArcPathOps.ts
85192
- import { useCallback as useCallback139 } from "react";
85274
+ import { useCallback as useCallback140 } from "react";
85193
85275
  function useGsapArcPathOps(commitMutationSafely) {
85194
- const setArcPath = useCallback139(
85276
+ const setArcPath = useCallback140(
85195
85277
  (selection, animationId, config) => {
85196
85278
  commitMutationSafely(
85197
85279
  selection,
@@ -85201,7 +85283,7 @@ function useGsapArcPathOps(commitMutationSafely) {
85201
85283
  },
85202
85284
  [commitMutationSafely]
85203
85285
  );
85204
- const updateArcSegment = useCallback139(
85286
+ const updateArcSegment = useCallback140(
85205
85287
  (selection, animationId, segmentIndex, update) => {
85206
85288
  commitMutationSafely(
85207
85289
  selection,
@@ -85211,7 +85293,7 @@ function useGsapArcPathOps(commitMutationSafely) {
85211
85293
  },
85212
85294
  [commitMutationSafely]
85213
85295
  );
85214
- const removeArcPath = useCallback139(
85296
+ const removeArcPath = useCallback140(
85215
85297
  (selection, animationId) => {
85216
85298
  commitMutationSafely(
85217
85299
  selection,
@@ -85225,7 +85307,7 @@ function useGsapArcPathOps(commitMutationSafely) {
85225
85307
  }
85226
85308
 
85227
85309
  // src/hooks/useGsapKeyframeOps.ts
85228
- import { useCallback as useCallback140 } from "react";
85310
+ import { useCallback as useCallback141 } from "react";
85229
85311
 
85230
85312
  // src/utils/optimisticUpdate.ts
85231
85313
  async function executeOptimistic(options) {
@@ -85326,7 +85408,7 @@ function useGsapKeyframeOps({
85326
85408
  sdkSession,
85327
85409
  sdkDeps
85328
85410
  }) {
85329
- const addKeyframe = useCallback140(
85411
+ const addKeyframe = useCallback141(
85330
85412
  (selection, animationId, percentage, property, value) => {
85331
85413
  const sourceFile = selection.sourceFile || activeCompPath || "index.html";
85332
85414
  const mutation = {
@@ -85391,7 +85473,7 @@ function useGsapKeyframeOps({
85391
85473
  },
85392
85474
  [activeCompPath, commitMutation, trackGsapSaveFailure, sdkSession, sdkDeps]
85393
85475
  );
85394
- const addKeyframeBatch = useCallback140(
85476
+ const addKeyframeBatch = useCallback141(
85395
85477
  async (selection, animationId, percentage, properties, commitOverrides) => {
85396
85478
  if (sdkSession && sdkDeps) {
85397
85479
  const sourceFile = selection.sourceFile || activeCompPath || "index.html";
@@ -85422,7 +85504,7 @@ function useGsapKeyframeOps({
85422
85504
  },
85423
85505
  [commitMutation, activeCompPath, sdkSession, sdkDeps]
85424
85506
  );
85425
- const removeKeyframe = useCallback140(
85507
+ const removeKeyframe = useCallback141(
85426
85508
  (selection, animationId, percentage, commitOverrides) => {
85427
85509
  const sourceFile = selection.sourceFile || activeCompPath || "index.html";
85428
85510
  const mutation = { type: "remove-keyframe", animationId, percentage };
@@ -85462,7 +85544,7 @@ function useGsapKeyframeOps({
85462
85544
  },
85463
85545
  [activeCompPath, commitMutation, trackGsapSaveFailure, sdkSession, sdkDeps]
85464
85546
  );
85465
- const moveKeyframe = useCallback140(
85547
+ const moveKeyframe = useCallback141(
85466
85548
  async (selection, animationId, fromPercentage, toPercentage) => {
85467
85549
  const mutation = { type: "move-keyframe", animationId, fromPercentage, toPercentage };
85468
85550
  try {
@@ -85482,7 +85564,7 @@ function useGsapKeyframeOps({
85482
85564
  },
85483
85565
  [commitMutation, trackGsapSaveFailure]
85484
85566
  );
85485
- const resizeKeyframedTween = useCallback140(
85567
+ const resizeKeyframedTween = useCallback141(
85486
85568
  async (selection, animationId, position, duration, pctRemap) => {
85487
85569
  const mutation = {
85488
85570
  type: "resize-keyframed-tween",
@@ -85508,7 +85590,7 @@ function useGsapKeyframeOps({
85508
85590
  },
85509
85591
  [commitMutation, trackGsapSaveFailure]
85510
85592
  );
85511
- const convertToKeyframes = useCallback140(
85593
+ const convertToKeyframes = useCallback141(
85512
85594
  async (selection, animationId, resolvedFromValues, duration, commitOverrides = { softReload: true }) => {
85513
85595
  if (sdkSession && sdkDeps) {
85514
85596
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
@@ -85536,7 +85618,7 @@ function useGsapKeyframeOps({
85536
85618
  },
85537
85619
  [commitMutation, activeCompPath, sdkSession, sdkDeps]
85538
85620
  );
85539
- const removeAllKeyframes = useCallback140(
85621
+ const removeAllKeyframes = useCallback141(
85540
85622
  async (selection, animationId, action = "remove_all", telemetry = true) => {
85541
85623
  const targetPath = selection.sourceFile || activeCompPath || "index.html";
85542
85624
  const clearCache = () => {
@@ -85580,7 +85662,7 @@ function useGsapKeyframeOps({
85580
85662
  },
85581
85663
  [commitMutationSafely, activeCompPath, sdkSession, sdkDeps]
85582
85664
  );
85583
- const commitKeyframeAtTime = useCallback140(
85665
+ const commitKeyframeAtTime = useCallback141(
85584
85666
  (selection, absoluteTime, animations, properties) => commitKeyframeAtTimeImpl(selection, absoluteTime, animations, properties, commitMutation),
85585
85667
  [commitMutation]
85586
85668
  );
@@ -85597,7 +85679,7 @@ function useGsapKeyframeOps({
85597
85679
  }
85598
85680
 
85599
85681
  // src/hooks/useGsapPropertyDebounce.ts
85600
- import { useCallback as useCallback141, useEffect as useEffect124, useRef as useRef153 } from "react";
85682
+ import { useCallback as useCallback142, useEffect as useEffect124, useRef as useRef154 } from "react";
85601
85683
  import { parseGsapScriptAcorn as parseGsapScriptAcorn2 } from "@hyperframes/core/gsap-parser-acorn";
85602
85684
  var DEBOUNCE_MS = 150;
85603
85685
  function mergeTweenProperties(sdkSession, animationId, edited, kind) {
@@ -85613,11 +85695,11 @@ function mergeTweenProperties(sdkSession, animationId, edited, kind) {
85613
85695
  }
85614
85696
  }
85615
85697
  function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85616
- const pendingPropertyEditRef = useRef153(null);
85617
- const debounceTimerRef = useRef153(null);
85618
- const sdkRef = useRef153(sdk);
85698
+ const pendingPropertyEditRef = useRef154(null);
85699
+ const debounceTimerRef = useRef154(null);
85700
+ const sdkRef = useRef154(sdk);
85619
85701
  sdkRef.current = sdk;
85620
- const flushPendingPropertyEdit = useCallback141(async () => {
85702
+ const flushPendingPropertyEdit = useCallback142(async () => {
85621
85703
  const pending2 = pendingPropertyEditRef.current;
85622
85704
  if (!pending2) return;
85623
85705
  pendingPropertyEditRef.current = null;
@@ -85657,7 +85739,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85657
85739
  sdkRef.current?.onFlushError?.(error, selection, mutation, label);
85658
85740
  }
85659
85741
  }, [commitMutationSafely]);
85660
- const updateGsapProperty = useCallback141(
85742
+ const updateGsapProperty = useCallback142(
85661
85743
  (selection, animationId, property, value) => {
85662
85744
  pendingPropertyEditRef.current = { selection, animationId, property, value };
85663
85745
  if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
@@ -85673,7 +85755,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85673
85755
  void flushPendingPropertyEdit();
85674
85756
  };
85675
85757
  }, [flushPendingPropertyEdit]);
85676
- const addGsapProperty = useCallback141(
85758
+ const addGsapProperty = useCallback142(
85677
85759
  // fallow-ignore-next-line complexity
85678
85760
  async (selection, animationId, property) => {
85679
85761
  let defaultValue = KEYFRAME_PROPERTY_DEFAULTS[property] ?? 0;
@@ -85717,7 +85799,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85717
85799
  },
85718
85800
  [commitMutationSafely]
85719
85801
  );
85720
- const removeProperty = useCallback141(
85802
+ const removeProperty = useCallback142(
85721
85803
  async (selection, animationId, property, from) => {
85722
85804
  const { sdkSession, sdkDeps, activeCompPath } = sdkRef.current ?? {};
85723
85805
  if (sdkSession && sdkDeps) {
@@ -85753,11 +85835,11 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85753
85835
  },
85754
85836
  [commitMutationSafely]
85755
85837
  );
85756
- const removeGsapProperty = useCallback141(
85838
+ const removeGsapProperty = useCallback142(
85757
85839
  (selection, animationId, property) => removeProperty(selection, animationId, property, false),
85758
85840
  [removeProperty]
85759
85841
  );
85760
- const updateGsapFromProperty = useCallback141(
85842
+ const updateGsapFromProperty = useCallback142(
85761
85843
  async (selection, animationId, property, value) => {
85762
85844
  const { sdkSession, sdkDeps, activeCompPath } = sdkRef.current ?? {};
85763
85845
  if (sdkSession && sdkDeps) {
@@ -85796,7 +85878,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85796
85878
  },
85797
85879
  [commitMutationSafely]
85798
85880
  );
85799
- const addGsapFromProperty = useCallback141(
85881
+ const addGsapFromProperty = useCallback142(
85800
85882
  async (selection, animationId, property) => {
85801
85883
  const defaultValue = KEYFRAME_PROPERTY_DEFAULTS[property] ?? 0;
85802
85884
  const { sdkSession, sdkDeps, activeCompPath } = sdkRef.current ?? {};
@@ -85830,7 +85912,7 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85830
85912
  },
85831
85913
  [commitMutationSafely]
85832
85914
  );
85833
- const removeGsapFromProperty = useCallback141(
85915
+ const removeGsapFromProperty = useCallback142(
85834
85916
  (selection, animationId, property) => removeProperty(selection, animationId, property, true),
85835
85917
  [removeProperty]
85836
85918
  );
@@ -85845,12 +85927,12 @@ function useGsapPropertyDebounce(commitMutationSafely, sdk) {
85845
85927
  }
85846
85928
 
85847
85929
  // src/hooks/useSafeGsapCommitMutation.ts
85848
- import { useCallback as useCallback142 } from "react";
85930
+ import { useCallback as useCallback143 } from "react";
85849
85931
  function getGsapMutationType(mutation) {
85850
85932
  return typeof mutation.type === "string" ? mutation.type : "gsap";
85851
85933
  }
85852
85934
  function useGsapSaveFailureTelemetry(activeCompPath) {
85853
- return useCallback142(
85935
+ return useCallback143(
85854
85936
  (error, selection, mutation, label) => {
85855
85937
  trackStudioSaveFailure({
85856
85938
  source: "gsap_commit",
@@ -85867,7 +85949,7 @@ function useGsapSaveFailureTelemetry(activeCompPath) {
85867
85949
  );
85868
85950
  }
85869
85951
  function useSafeGsapCommitMutation(commitMutation, trackGsapSaveFailure, showToast) {
85870
- return useCallback142(
85952
+ return useCallback143(
85871
85953
  (selection, mutation, options) => (
85872
85954
  // Return the chain so awaiting consumers (gesture commit, enable-keyframes)
85873
85955
  // run their post-actions AFTER the server save settles, not immediately.
@@ -86038,10 +86120,10 @@ function instantPatchesFor(options) {
86038
86120
  }
86039
86121
  function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef, editHistory, reloadPreview, onCacheInvalidate, onFileContentChanged, showToast, sdkSession, publishSdkSession, writeProjectFile, forceReloadSdkSession }) {
86040
86122
  const activeProjectId = projectIdRef.current;
86041
- const activeCompPathRef = useRef154(activeCompPath);
86123
+ const activeCompPathRef = useRef155(activeCompPath);
86042
86124
  activeCompPathRef.current = activeCompPath;
86043
- const serializerRef = useRef154(createKeyedSerializer());
86044
- const recordMutationEdit = useCallback143(async (targetPath, selection, result, options) => {
86125
+ const serializerRef = useRef155(createKeyedSerializer());
86126
+ const recordMutationEdit = useCallback144(async (targetPath, selection, result, options) => {
86045
86127
  if (result.before == null || result.after == null) return;
86046
86128
  await editHistory.recordEdit({
86047
86129
  label: options.label,
@@ -86051,7 +86133,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86051
86133
  files: { [targetPath]: { before: result.before, after: result.after } }
86052
86134
  });
86053
86135
  }, [editHistory]);
86054
- const finalizeSuccessfulMutation = useCallback143(async (projectId, compositionPath, selection, mutation, targetPath, result, options) => {
86136
+ const finalizeSuccessfulMutation = useCallback144(async (projectId, compositionPath, selection, mutation, targetPath, result, options) => {
86055
86137
  if (projectIdRef.current !== projectId) return;
86056
86138
  const previewIsActive = isActiveCommitTarget(
86057
86139
  projectIdRef,
@@ -86088,7 +86170,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86088
86170
  nestedFiles
86089
86171
  });
86090
86172
  }, [projectIdRef, previewIframeRef, reloadPreview, onCacheInvalidate, onFileContentChanged, forceReloadSdkSession, recordMutationEdit]);
86091
- const runCommit = useCallback143((pid, compositionPath, targetPath, selection, mutation, options) => whileScriptWrites(async () => {
86173
+ const runCommit = useCallback144((pid, compositionPath, targetPath, selection, mutation, options) => whileScriptWrites(async () => {
86092
86174
  const result = await runMutationRequest(
86093
86175
  [mutation],
86094
86176
  options,
@@ -86100,7 +86182,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86100
86182
  options.onResult?.(result);
86101
86183
  await finalizeSuccessfulMutation(pid, compositionPath, selection, mutation, targetPath, result, options);
86102
86184
  }), [showToast, finalizeSuccessfulMutation]);
86103
- const runBatchCommit = useCallback143((pid, compositionPath, targetPath, calls, options) => whileScriptWrites(async () => {
86185
+ const runBatchCommit = useCallback144((pid, compositionPath, targetPath, calls, options) => whileScriptWrites(async () => {
86104
86186
  const first = calls[0];
86105
86187
  const last = calls.at(-1);
86106
86188
  if (!first || !last) return;
@@ -86157,7 +86239,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86157
86239
  return commit2;
86158
86240
  }, [runCommit, runBatchCommit, activeCompPath, activeProjectId, writeProjectFile]);
86159
86241
  const trackGsapSaveFailure = useGsapSaveFailureTelemetry(activeCompPath);
86160
- const handleGsapSaveFailure = useCallback143(
86242
+ const handleGsapSaveFailure = useCallback144(
86161
86243
  (error, selection, mutation, label) => {
86162
86244
  trackGsapSaveFailure(error, selection, mutation, label);
86163
86245
  if (!isStudioSaveErrorAlreadyToasted(error)) {
@@ -86167,7 +86249,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86167
86249
  [showToast, trackGsapSaveFailure]
86168
86250
  );
86169
86251
  const commitMutationSafely = useSafeGsapCommitMutation(commitMutation, handleGsapSaveFailure);
86170
- const sdkRefresh = useCallback143(
86252
+ const sdkRefresh = useCallback144(
86171
86253
  (after) => {
86172
86254
  const script = extractGsapScriptText(after);
86173
86255
  if (script) {
@@ -86179,7 +86261,7 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86179
86261
  },
86180
86262
  [previewIframeRef, reloadPreview, onCacheInvalidate]
86181
86263
  );
86182
- const readProjectFileContent2 = useCallback143(
86264
+ const readProjectFileContent2 = useCallback144(
86183
86265
  (path) => {
86184
86266
  if (!activeProjectId) throw new Error("No active project");
86185
86267
  return readProjectFileContent(activeProjectId, path);
@@ -86235,10 +86317,10 @@ function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIframeRef,
86235
86317
  }
86236
86318
 
86237
86319
  // src/hooks/useDomEditWiring.ts
86238
- import { useCallback as useCallback146, useEffect as useEffect126, useRef as useRef157 } from "react";
86320
+ import { useCallback as useCallback147, useEffect as useEffect126, useRef as useRef158 } from "react";
86239
86321
 
86240
86322
  // src/hooks/useDomEditPreviewSync.ts
86241
- import { useEffect as useEffect125, useRef as useRef155 } from "react";
86323
+ import { useEffect as useEffect125, useRef as useRef156 } from "react";
86242
86324
  function useDomEditPreviewSync({
86243
86325
  previewIframe,
86244
86326
  captionEditMode,
@@ -86288,7 +86370,7 @@ function useDomEditPreviewSync({
86288
86370
  applyStudioManualEditsToPreviewRef,
86289
86371
  gsapCacheVersion
86290
86372
  ]);
86291
- const openSourceRef = useRef155(openSourceForSelection);
86373
+ const openSourceRef = useRef156(openSourceForSelection);
86292
86374
  openSourceRef.current = openSourceForSelection;
86293
86375
  useEffect125(
86294
86376
  // fallow-ignore-next-line complexity
@@ -86307,7 +86389,7 @@ function useDomEditPreviewSync({
86307
86389
  }
86308
86390
 
86309
86391
  // src/hooks/useGsapAnimationFetchFallback.ts
86310
- import { useCallback as useCallback144 } from "react";
86392
+ import { useCallback as useCallback145 } from "react";
86311
86393
  var FETCH_ERROR_RETRIES = 1;
86312
86394
  var FETCH_ERROR_DELAY_MS = 120;
86313
86395
  var delay = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
@@ -86335,7 +86417,7 @@ async function fetchElementAnimationsWithRetry(projectId, gsapSourceFile, target
86335
86417
  }
86336
86418
  }
86337
86419
  function useGsapAnimationFetchFallback(projectId) {
86338
- return useCallback144(
86420
+ return useCallback145(
86339
86421
  (selection, options) => async () => {
86340
86422
  if (!projectId) return [];
86341
86423
  const target = { id: selection.id ?? null, selector: selection.selector ?? null };
@@ -86353,7 +86435,7 @@ function useGsapAnimationFetchFallback(projectId) {
86353
86435
  }
86354
86436
 
86355
86437
  // src/hooks/useGsapSelectionHandlers.ts
86356
- import { useCallback as useCallback145, useRef as useRef156 } from "react";
86438
+ import { useCallback as useCallback146, useRef as useRef157 } from "react";
86357
86439
  function useGsapSelectionHandlers({
86358
86440
  domEditSelection,
86359
86441
  updateGsapProperty,
@@ -86377,13 +86459,13 @@ function useGsapSelectionHandlers({
86377
86459
  selectedGsapAnimations,
86378
86460
  showToast
86379
86461
  }) {
86380
- const lastSelectionRef = useRef156(null);
86462
+ const lastSelectionRef = useRef157(null);
86381
86463
  if (domEditSelection) lastSelectionRef.current = domEditSelection;
86382
- const resolveWriteSelection2 = useCallback145(
86464
+ const resolveWriteSelection2 = useCallback146(
86383
86465
  (selectionOverride) => selectionOverride === void 0 ? domEditSelection ?? lastSelectionRef.current : selectionOverride,
86384
86466
  [domEditSelection]
86385
86467
  );
86386
- const trackGsapHandlerFailure = useCallback145(
86468
+ const trackGsapHandlerFailure = useCallback146(
86387
86469
  (error, selection, mutationType, label) => {
86388
86470
  trackStudioSaveFailure({
86389
86471
  source: "gsap_commit",
@@ -86401,7 +86483,7 @@ function useGsapSelectionHandlers({
86401
86483
  },
86402
86484
  [showToast]
86403
86485
  );
86404
- const observeGsapMutation = useCallback145(
86486
+ const observeGsapMutation = useCallback146(
86405
86487
  (mutation, selection, mutationType, label) => mutation.then(
86406
86488
  () => true,
86407
86489
  (error) => {
@@ -86411,14 +86493,14 @@ function useGsapSelectionHandlers({
86411
86493
  ),
86412
86494
  [trackGsapHandlerFailure]
86413
86495
  );
86414
- const handleGsapUpdateProperty = useCallback145(
86496
+ const handleGsapUpdateProperty = useCallback146(
86415
86497
  (animId, prop, value) => {
86416
86498
  if (!domEditSelection) return;
86417
86499
  updateGsapProperty(domEditSelection, animId, prop, value);
86418
86500
  },
86419
86501
  [domEditSelection, updateGsapProperty]
86420
86502
  );
86421
- const handleGsapUpdateMeta = useCallback145(
86503
+ const handleGsapUpdateMeta = useCallback146(
86422
86504
  (animId, updates, selectionOverride) => {
86423
86505
  const sel = resolveWriteSelection2(selectionOverride);
86424
86506
  if (!sel) return Promise.resolve(false);
@@ -86431,7 +86513,7 @@ function useGsapSelectionHandlers({
86431
86513
  },
86432
86514
  [resolveWriteSelection2, observeGsapMutation, updateGsapMeta]
86433
86515
  );
86434
- const handleGsapDeleteAnimation = useCallback145(
86516
+ const handleGsapDeleteAnimation = useCallback146(
86435
86517
  (animId, selectionOverride) => {
86436
86518
  const sel = resolveWriteSelection2(selectionOverride);
86437
86519
  if (!sel) return Promise.resolve(false);
@@ -86444,7 +86526,7 @@ function useGsapSelectionHandlers({
86444
86526
  },
86445
86527
  [resolveWriteSelection2, deleteGsapAnimation, observeGsapMutation]
86446
86528
  );
86447
- const handleGsapDeleteAllForElement = useCallback145(
86529
+ const handleGsapDeleteAllForElement = useCallback146(
86448
86530
  (targetSelector) => {
86449
86531
  const sel = domEditSelection ?? lastSelectionRef.current;
86450
86532
  if (!sel) return;
@@ -86458,7 +86540,7 @@ function useGsapSelectionHandlers({
86458
86540
  },
86459
86541
  [domEditSelection, deleteAllForSelector, observeGsapMutation]
86460
86542
  );
86461
- const handleGsapAddAnimation = useCallback145(
86543
+ const handleGsapAddAnimation = useCallback146(
86462
86544
  (method, selectionOverride) => {
86463
86545
  const selection = resolveWriteSelection2(selectionOverride);
86464
86546
  if (!selection) return Promise.resolve(false);
@@ -86477,7 +86559,7 @@ function useGsapSelectionHandlers({
86477
86559
  },
86478
86560
  [resolveWriteSelection2, addGsapAnimation, handleDomManualEditsReset, observeGsapMutation]
86479
86561
  );
86480
- const handleGsapAddProperty = useCallback145(
86562
+ const handleGsapAddProperty = useCallback146(
86481
86563
  (animId, prop) => {
86482
86564
  if (!domEditSelection) return;
86483
86565
  observeGsapMutation(
@@ -86489,7 +86571,7 @@ function useGsapSelectionHandlers({
86489
86571
  },
86490
86572
  [domEditSelection, addGsapProperty, observeGsapMutation]
86491
86573
  );
86492
- const handleGsapRemoveProperty = useCallback145(
86574
+ const handleGsapRemoveProperty = useCallback146(
86493
86575
  (animId, prop) => {
86494
86576
  if (!domEditSelection) return;
86495
86577
  observeGsapMutation(
@@ -86501,7 +86583,7 @@ function useGsapSelectionHandlers({
86501
86583
  },
86502
86584
  [domEditSelection, observeGsapMutation, removeGsapProperty]
86503
86585
  );
86504
- const handleGsapUpdateFromProperty = useCallback145(
86586
+ const handleGsapUpdateFromProperty = useCallback146(
86505
86587
  (animId, prop, value) => {
86506
86588
  if (!domEditSelection) return;
86507
86589
  observeGsapMutation(
@@ -86513,7 +86595,7 @@ function useGsapSelectionHandlers({
86513
86595
  },
86514
86596
  [domEditSelection, observeGsapMutation, updateGsapFromProperty]
86515
86597
  );
86516
- const handleGsapAddFromProperty = useCallback145(
86598
+ const handleGsapAddFromProperty = useCallback146(
86517
86599
  (animId, prop) => {
86518
86600
  if (!domEditSelection) return;
86519
86601
  observeGsapMutation(
@@ -86525,7 +86607,7 @@ function useGsapSelectionHandlers({
86525
86607
  },
86526
86608
  [domEditSelection, addGsapFromProperty, observeGsapMutation]
86527
86609
  );
86528
- const handleGsapRemoveFromProperty = useCallback145(
86610
+ const handleGsapRemoveFromProperty = useCallback146(
86529
86611
  (animId, prop) => {
86530
86612
  if (!domEditSelection) return;
86531
86613
  observeGsapMutation(
@@ -86537,7 +86619,7 @@ function useGsapSelectionHandlers({
86537
86619
  },
86538
86620
  [domEditSelection, observeGsapMutation, removeGsapFromProperty]
86539
86621
  );
86540
- const handleGsapAddKeyframe = useCallback145(
86622
+ const handleGsapAddKeyframe = useCallback146(
86541
86623
  (animId, percentage, property, value, selectionOverride) => {
86542
86624
  const sel = resolveWriteSelection2(selectionOverride);
86543
86625
  if (!sel) return;
@@ -86545,7 +86627,7 @@ function useGsapSelectionHandlers({
86545
86627
  },
86546
86628
  [resolveWriteSelection2, addKeyframe]
86547
86629
  );
86548
- const handleGsapAddKeyframeBatch = useCallback145(
86630
+ const handleGsapAddKeyframeBatch = useCallback146(
86549
86631
  (animId, percentage, properties, commitOverrides, selectionOverride) => {
86550
86632
  const sel = resolveWriteSelection2(selectionOverride);
86551
86633
  if (!sel) return Promise.resolve();
@@ -86557,7 +86639,7 @@ function useGsapSelectionHandlers({
86557
86639
  },
86558
86640
  [resolveWriteSelection2, addKeyframeBatch, trackGsapHandlerFailure]
86559
86641
  );
86560
- const handleGsapRemoveKeyframe = useCallback145(
86642
+ const handleGsapRemoveKeyframe = useCallback146(
86561
86643
  (animId, percentage, commitOverrides, selectionOverride) => {
86562
86644
  const sel = resolveWriteSelection2(selectionOverride);
86563
86645
  if (!sel) return;
@@ -86566,7 +86648,7 @@ function useGsapSelectionHandlers({
86566
86648
  },
86567
86649
  [resolveWriteSelection2, removeKeyframe]
86568
86650
  );
86569
- const handleGsapMoveKeyframeToPlayhead = useCallback145(
86651
+ const handleGsapMoveKeyframeToPlayhead = useCallback146(
86570
86652
  (animId, fromPercentage, selectionOverride, animationOverride) => {
86571
86653
  const sel = resolveWriteSelection2(selectionOverride);
86572
86654
  if (!sel) return;
@@ -86577,7 +86659,7 @@ function useGsapSelectionHandlers({
86577
86659
  },
86578
86660
  [resolveWriteSelection2, selectedGsapAnimations, moveKeyframe]
86579
86661
  );
86580
- const handleGsapMoveKeyframe = useCallback145(
86662
+ const handleGsapMoveKeyframe = useCallback146(
86581
86663
  (animId, fromPercentage, toPercentage, selectionOverride) => {
86582
86664
  const sel = resolveWriteSelection2(selectionOverride);
86583
86665
  if (!sel) return Promise.resolve(false);
@@ -86586,7 +86668,7 @@ function useGsapSelectionHandlers({
86586
86668
  },
86587
86669
  [resolveWriteSelection2, moveKeyframe]
86588
86670
  );
86589
- const handleGsapResizeKeyframedTween = useCallback145(
86671
+ const handleGsapResizeKeyframedTween = useCallback146(
86590
86672
  (animId, position, duration, pctRemap, selectionOverride) => {
86591
86673
  const sel = resolveWriteSelection2(selectionOverride);
86592
86674
  if (!sel) return Promise.resolve(false);
@@ -86595,7 +86677,7 @@ function useGsapSelectionHandlers({
86595
86677
  },
86596
86678
  [resolveWriteSelection2, resizeKeyframedTween]
86597
86679
  );
86598
- const handleGsapConvertToKeyframes = useCallback145(
86680
+ const handleGsapConvertToKeyframes = useCallback146(
86599
86681
  (animId, resolvedFromValues, duration, commitOverrides, selectionOverride) => {
86600
86682
  const sel = resolveWriteSelection2(selectionOverride);
86601
86683
  if (!sel) return Promise.resolve();
@@ -86607,7 +86689,7 @@ function useGsapSelectionHandlers({
86607
86689
  },
86608
86690
  [resolveWriteSelection2, convertToKeyframes, trackGsapHandlerFailure]
86609
86691
  );
86610
- const handleGsapRemoveAllKeyframes = useCallback145(
86692
+ const handleGsapRemoveAllKeyframes = useCallback146(
86611
86693
  (animId, selectionOverride, telemetry = true) => {
86612
86694
  const selection = resolveWriteSelection2(selectionOverride);
86613
86695
  if (!selection) return Promise.resolve(false);
@@ -86618,7 +86700,7 @@ function useGsapSelectionHandlers({
86618
86700
  },
86619
86701
  [resolveWriteSelection2, trackGsapHandlerFailure, removeAllKeyframes]
86620
86702
  );
86621
- const handleResetSelectedElementKeyframes = useCallback145(() => {
86703
+ const handleResetSelectedElementKeyframes = useCallback146(() => {
86622
86704
  if (!domEditSelection) return false;
86623
86705
  const withKeyframes = selectedGsapAnimations.find((a) => a.keyframes);
86624
86706
  if (!withKeyframes) return false;
@@ -86693,7 +86775,7 @@ function useDomEditWiring(params) {
86693
86775
  removeAllKeyframes,
86694
86776
  handleDomManualEditsReset
86695
86777
  } = params;
86696
- const onClickToSource = useCallback146(
86778
+ const onClickToSource = useCallback147(
86697
86779
  (selection) => {
86698
86780
  if (!openSourceForSelection) return;
86699
86781
  if (!selection.sourceFile) return;
@@ -86715,7 +86797,7 @@ function useDomEditWiring(params) {
86715
86797
  const key2 = matchKey ? matchKey.key ?? matchKey.id : null;
86716
86798
  if (key2 && key2 !== selectedElementId) setSelectedElementId(key2);
86717
86799
  }, [domEditSelection?.id]);
86718
- const prevRefreshKeyRef = useRef157(refreshKey);
86800
+ const prevRefreshKeyRef = useRef158(refreshKey);
86719
86801
  useEffect126(() => {
86720
86802
  if (refreshKey !== prevRefreshKeyRef.current) {
86721
86803
  prevRefreshKeyRef.current = refreshKey;
@@ -86791,7 +86873,7 @@ function useDomEditWiring(params) {
86791
86873
  }
86792
86874
 
86793
86875
  // src/hooks/useGsapAwareGroupMove.ts
86794
- import { useCallback as useCallback147 } from "react";
86876
+ import { useCallback as useCallback148 } from "react";
86795
86877
 
86796
86878
  // src/hooks/gsapGroupPreflight.ts
86797
86879
  function firstPreflightFailure(results, updates, savedOnElement, activeCompPath) {
@@ -86821,7 +86903,7 @@ function useGsapAwareGroupMove({
86821
86903
  stageElementPositionOffset,
86822
86904
  showToast
86823
86905
  }) {
86824
- const handleGsapAwareGroupPathOffsetCommit = useCallback147(
86906
+ const handleGsapAwareGroupPathOffsetCommit = useCallback148(
86825
86907
  async (updates, options = {}) => {
86826
86908
  const writes = observeGsapGesture(gsapCommitMutation);
86827
86909
  const writer = writes.commit;
@@ -86963,7 +87045,7 @@ function useGsapAwareGroupMove({
86963
87045
  }
86964
87046
 
86965
87047
  // src/hooks/useGsapAwareEditing.ts
86966
- import { useCallback as useCallback150 } from "react";
87048
+ import { useCallback as useCallback151 } from "react";
86967
87049
 
86968
87050
  // src/hooks/gsapResizePreflight.ts
86969
87051
  function resizeRoute(animations, fetchedAnimations) {
@@ -86996,7 +87078,7 @@ function preflightGsapResizeIntercept(selection, animations, iframe, fetchedAnim
86996
87078
  }
86997
87079
 
86998
87080
  // src/hooks/useEnableKeyframes.ts
86999
- import { useCallback as useCallback148 } from "react";
87081
+ import { useCallback as useCallback149 } from "react";
87000
87082
  var enableKeyframesTransactionCounter = 0;
87001
87083
  function animatedProps(anim) {
87002
87084
  if (!anim) return ["x", "y"];
@@ -87254,7 +87336,7 @@ async function applyArcKeyframeAtPlayhead(session, sel, arcAnim, t2, iframe) {
87254
87336
  );
87255
87337
  }
87256
87338
  function useEnableKeyframes(sessionRef) {
87257
- return useCallback148(async () => {
87339
+ return useCallback149(async () => {
87258
87340
  const session = sessionRef.current;
87259
87341
  if (!session) return;
87260
87342
  const sel = session.domEditSelection;
@@ -87629,7 +87711,7 @@ async function tryGsapResizeIntercept(selection, size, animations, iframe, commi
87629
87711
  }
87630
87712
 
87631
87713
  // src/hooks/useAnimatedPropertyCommit.ts
87632
- import { useCallback as useCallback149 } from "react";
87714
+ import { useCallback as useCallback150 } from "react";
87633
87715
  import { classifyPropertyGroup as classifyPropertyGroup4 } from "@hyperframes/core/gsap-parser";
87634
87716
  function pickBestAnimation(animations, selector, property) {
87635
87717
  const targetGroup = property ? classifyPropertyGroup4(property) : void 0;
@@ -87868,7 +87950,7 @@ async function commitKeyframeProps(selection, anim, props, propEntries, primaryP
87868
87950
  }
87869
87951
  function useAnimatedPropertyCommit(deps) {
87870
87952
  const { selectedGsapAnimations, gsapCommitMutation, previewIframeRef, bumpGsapCache } = deps;
87871
- const commitAnimatedProperties = useCallback149(
87953
+ const commitAnimatedProperties = useCallback150(
87872
87954
  // This is the single routing boundary for set, keyframe, whole-tween, and first-group writes.
87873
87955
  // fallow-ignore-next-line complexity
87874
87956
  async (selection, props, commit2 = gsapCommitMutation) => {
@@ -87974,7 +88056,7 @@ function useAnimatedPropertyCommit(deps) {
87974
88056
  },
87975
88057
  [selectedGsapAnimations, gsapCommitMutation, previewIframeRef, bumpGsapCache]
87976
88058
  );
87977
- const commitAnimatedProperty = useCallback149(
88059
+ const commitAnimatedProperty = useCallback150(
87978
88060
  (selection, property, value) => commitAnimatedProperties(selection, { [property]: value }),
87979
88061
  [commitAnimatedProperties]
87980
88062
  );
@@ -88001,14 +88083,14 @@ function useGsapAwareEditing({
88001
88083
  setArcPath,
88002
88084
  updateArcSegment
88003
88085
  }) {
88004
- const getGsapAnimationsForSelection = useCallback150(
88086
+ const getGsapAnimationsForSelection = useCallback151(
88005
88087
  (selection) => {
88006
88088
  if (domEditSelection?.element === selection.element) return selectedGsapAnimations;
88007
88089
  return makeFetchFallback(selection, { failOnFetchError: true })();
88008
88090
  },
88009
88091
  [domEditSelection, selectedGsapAnimations, makeFetchFallback]
88010
88092
  );
88011
- const handleGsapAwarePathOffsetCommit = useCallback150(
88093
+ const handleGsapAwarePathOffsetCommit = useCallback151(
88012
88094
  async (selection, next, modifiers) => {
88013
88095
  const writes = observeGsapGesture(gsapCommitMutation);
88014
88096
  if (modifiers?.plainTranslate ?? editsPlainCss(selection.element, "move")) {
@@ -88062,7 +88144,7 @@ function useGsapAwareEditing({
88062
88144
  stageElementPositionOffset,
88063
88145
  showToast
88064
88146
  });
88065
- const handleGsapAwareBoxSizeCommit = useCallback150(
88147
+ const handleGsapAwareBoxSizeCommit = useCallback151(
88066
88148
  async (selection, next, offset, restore2 = () => void 0, route) => {
88067
88149
  const writes = observeGsapGesture(gsapCommitMutation);
88068
88150
  if (route?.plainTranslate ?? editsPlainCss(selection.element, "resize")) {
@@ -88206,7 +88288,7 @@ function useGsapAwareEditing({
88206
88288
  getGsapAnimationsForSelection
88207
88289
  ]
88208
88290
  );
88209
- const handleGsapAwareRotationCommit = useCallback150(
88291
+ const handleGsapAwareRotationCommit = useCallback151(
88210
88292
  async (selection, next) => {
88211
88293
  const writes = observeGsapGesture(gsapCommitMutation);
88212
88294
  if (next.plain === void 0 ? editsPlainCss(selection.element, "rotate") : next.plain) {
@@ -88253,7 +88335,7 @@ function useGsapAwareEditing({
88253
88335
  previewIframeRef,
88254
88336
  bumpGsapCache
88255
88337
  });
88256
- const commitAnimatedProperties = useCallback150(
88338
+ const commitAnimatedProperties = useCallback151(
88257
88339
  async (selection, properties) => {
88258
88340
  try {
88259
88341
  await writeSizeWithCrop(
@@ -88275,25 +88357,25 @@ function useGsapAwareEditing({
88275
88357
  trackGsapInteractionFailure
88276
88358
  ]
88277
88359
  );
88278
- const commitAnimatedProperty = useCallback150(
88360
+ const commitAnimatedProperty = useCallback151(
88279
88361
  (selection, property, value) => commitAnimatedProperties(selection, { [property]: value }),
88280
88362
  [commitAnimatedProperties]
88281
88363
  );
88282
- const handleSetArcPath = useCallback150(
88364
+ const handleSetArcPath = useCallback151(
88283
88365
  (animId, config) => {
88284
88366
  if (!domEditSelection) return;
88285
88367
  setArcPath(domEditSelection, animId, config);
88286
88368
  },
88287
88369
  [domEditSelection, setArcPath]
88288
88370
  );
88289
- const handleUpdateArcSegment = useCallback150(
88371
+ const handleUpdateArcSegment = useCallback151(
88290
88372
  (animId, segmentIndex, update) => {
88291
88373
  if (!domEditSelection) return;
88292
88374
  updateArcSegment(domEditSelection, animId, segmentIndex, update);
88293
88375
  },
88294
88376
  [domEditSelection, updateArcSegment]
88295
88377
  );
88296
- const noopCommit = useCallback150(async () => {
88378
+ const noopCommit = useCallback151(async () => {
88297
88379
  }, []);
88298
88380
  const trackGsapSaveFailure = useGsapSaveFailureTelemetry(null);
88299
88381
  const safeGsapCommit = useSafeGsapCommitMutation(
@@ -88301,14 +88383,14 @@ function useGsapAwareEditing({
88301
88383
  trackGsapSaveFailure,
88302
88384
  showToast
88303
88385
  );
88304
- const commitMutation = useCallback150(
88386
+ const commitMutation = useCallback151(
88305
88387
  async (mutation, options, selection = domEditSelection) => {
88306
88388
  if (!selection) return;
88307
88389
  await safeGsapCommit(selection, mutation, options);
88308
88390
  },
88309
88391
  [domEditSelection, safeGsapCommit]
88310
88392
  );
88311
- const handleUnroll = useCallback150(() => {
88393
+ const handleUnroll = useCallback151(() => {
88312
88394
  void commitMutation(
88313
88395
  { type: "unroll-timeline" },
88314
88396
  { label: "Unroll to literal tweens", softReload: true }
@@ -88330,7 +88412,7 @@ function useGsapAwareEditing({
88330
88412
  }
88331
88413
 
88332
88414
  // src/hooks/useStudioSelectionPublisher.ts
88333
- import { useEffect as useEffect127, useRef as useRef158 } from "react";
88415
+ import { useEffect as useEffect127, useRef as useRef159 } from "react";
88334
88416
 
88335
88417
  // src/utils/studioSelectionSnapshot.ts
88336
88418
  function round34(value) {
@@ -88421,8 +88503,8 @@ function useStudioSelectionPublisher({
88421
88503
  previewDocumentVersion,
88422
88504
  refreshDomEditSelectionFromPreview
88423
88505
  }) {
88424
- const lastSelectionRefreshKeyRef = useRef158(refreshKey);
88425
- const pendingSelectionRefreshKeyRef = useRef158(null);
88506
+ const lastSelectionRefreshKeyRef = useRef159(refreshKey);
88507
+ const pendingSelectionRefreshKeyRef = useRef159(null);
88426
88508
  useEffect127(() => {
88427
88509
  if (!projectId) return;
88428
88510
  const selection = domEditSelection && selectionElementLive(domEditSelection) ? buildStudioSelectionSnapshot({
@@ -88459,12 +88541,12 @@ function useStudioSelectionPublisher({
88459
88541
  }
88460
88542
 
88461
88543
  // src/hooks/useKeyframeEaseCommits.ts
88462
- import { useCallback as useCallback151 } from "react";
88544
+ import { useCallback as useCallback152 } from "react";
88463
88545
  function useKeyframeEaseCommits({
88464
88546
  gsapCommitMutation,
88465
88547
  domEditSelectionRef
88466
88548
  }) {
88467
- const handleUpdateSegmentEase = useCallback151(
88549
+ const handleUpdateSegmentEase = useCallback152(
88468
88550
  (targets, ease) => {
88469
88551
  const selection = domEditSelectionRef.current;
88470
88552
  if (!selection || targets.length === 0) return;
@@ -88498,11 +88580,11 @@ function useKeyframeEaseCommits({
88498
88580
  },
88499
88581
  [gsapCommitMutation, domEditSelectionRef]
88500
88582
  );
88501
- const handleUpdateKeyframeEase = useCallback151(
88583
+ const handleUpdateKeyframeEase = useCallback152(
88502
88584
  (animationId, percentage, ease) => handleUpdateSegmentEase([{ animationId, tweenPercentage: percentage }], ease),
88503
88585
  [handleUpdateSegmentEase]
88504
88586
  );
88505
- const handleSetAllKeyframeEases = useCallback151(
88587
+ const handleSetAllKeyframeEases = useCallback152(
88506
88588
  (animationId, ease) => {
88507
88589
  const sel = domEditSelectionRef.current;
88508
88590
  if (!sel) return;
@@ -88522,7 +88604,7 @@ function useKeyframeEaseCommits({
88522
88604
  }
88523
88605
 
88524
88606
  // src/hooks/useCommitPreflightCapabilities.ts
88525
- import { useEffect as useEffect128, useMemo as useMemo75, useRef as useRef159, useState as useState128 } from "react";
88607
+ import { useEffect as useEffect128, useMemo as useMemo75, useRef as useRef160, useState as useState129 } from "react";
88526
88608
  function runCommitPreflights(selection, fileAnimations, iframe, group) {
88527
88609
  const target = { id: selection.id ?? null, selector: selection.selector ?? null };
88528
88610
  const animations = getAnimationsForElement(fileAnimations, target, selection.element);
@@ -88582,8 +88664,8 @@ function useCommitPreflightCapabilities({
88582
88664
  previewIframeRef,
88583
88665
  version
88584
88666
  }) {
88585
- const parsesRef = useRef159(/* @__PURE__ */ new Map());
88586
- const [parseTick, setParseTick] = useState128(0);
88667
+ const parsesRef = useRef160(/* @__PURE__ */ new Map());
88668
+ const [parseTick, setParseTick] = useState129(0);
88587
88669
  useEffect128(() => {
88588
88670
  if (!enabled || !projectId) return;
88589
88671
  const targets = selection ? [selection, ...groupSelections] : groupSelections;
@@ -88641,11 +88723,11 @@ function timelineElementsForDelete(members, elements) {
88641
88723
  }
88642
88724
 
88643
88725
  // src/hooks/useLivePreviewIframe.ts
88644
- import { useEffect as useEffect129, useRef as useRef160, useState as useState129 } from "react";
88726
+ import { useEffect as useEffect129, useRef as useRef161, useState as useState130 } from "react";
88645
88727
  function useLivePreviewIframe2(host) {
88646
- const [promoted, setPromoted] = useState129();
88728
+ const [promoted, setPromoted] = useState130();
88647
88729
  const live = host && promoted?.host === host ? promoted.live : host;
88648
- const liveRef = useRef160(live);
88730
+ const liveRef = useRef161(live);
88649
88731
  liveRef.current = live;
88650
88732
  useEffect129(() => {
88651
88733
  if (!host) return;
@@ -88937,7 +89019,7 @@ function useDomEditSession({
88937
89019
  forceReloadSdkSession,
88938
89020
  timelineElements
88939
89021
  });
88940
- const handleDomEditElementDelete = useCallback152(
89022
+ const handleDomEditElementDelete = useCallback153(
88941
89023
  async (selection, options) => {
88942
89024
  if (isRecordingRef?.current) {
88943
89025
  showToast("Cannot edit timeline while recording", "error");
@@ -88960,7 +89042,7 @@ function useDomEditSession({
88960
89042
  timelineElements
88961
89043
  ]
88962
89044
  );
88963
- const handleGroupSelection = useCallback152(() => {
89045
+ const handleGroupSelection = useCallback153(() => {
88964
89046
  const group = domEditGroupSelectionsRef.current;
88965
89047
  const single = domEditSelectionRef.current;
88966
89048
  const members = group.length > 0 ? group : single ? [single] : [];
@@ -88978,7 +89060,7 @@ function useDomEditSession({
88978
89060
  trackStudioEvent("group", { action: "create", count: members.length });
88979
89061
  void groupSelection(members);
88980
89062
  }, [domEditGroupSelectionsRef, domEditSelectionRef, groupSelection, showToast]);
88981
- const handleUngroupSelection = useCallback152(() => {
89063
+ const handleUngroupSelection = useCallback153(() => {
88982
89064
  const sel = domEditSelectionRef.current;
88983
89065
  if (!sel || selectionDataAttribute(sel, "data-hf-group") === null) {
88984
89066
  showToast("Select a group to ungroup", "info");
@@ -89083,7 +89165,7 @@ function useDomEditSession({
89083
89165
  setArcPath,
89084
89166
  updateArcSegment
89085
89167
  });
89086
- const handleDomGroupMoveBy = useCallback152(
89168
+ const handleDomGroupMoveBy = useCallback153(
89087
89169
  (moves) => moveDomGroupBy(
89088
89170
  moves,
89089
89171
  (updates) => handleGsapAwareGroupPathOffsetCommit(updates, { refusalToast: false })
@@ -89209,7 +89291,7 @@ function useSdkSelectionSync(session, domEditSelection, domEditGroupSelections)
89209
89291
  import { useEffect as useEffect132 } from "react";
89210
89292
 
89211
89293
  // src/hooks/useSdkSession.ts
89212
- import { useState as useState130, useEffect as useEffect131, useCallback as useCallback153, useRef as useRef161 } from "react";
89294
+ import { useState as useState131, useEffect as useEffect131, useCallback as useCallback154, useRef as useRef162 } from "react";
89213
89295
  import { openComposition as openComposition3 } from "@hyperframes/sdk";
89214
89296
 
89215
89297
  // src/hooks/externalFileReloadBus.ts
@@ -89319,20 +89401,20 @@ function disposeSdkSession(session) {
89319
89401
  }
89320
89402
  }
89321
89403
  function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded = false, onAbsentRead) {
89322
- const [ownedSession, setOwnedSession] = useState130(null);
89323
- const ownedSessionRef = useRef161(null);
89324
- const sessionOwnersRef = useRef161(/* @__PURE__ */ new WeakMap());
89325
- const generationRef = useRef161(0);
89326
- const projectIdRef = useRef161(projectId);
89404
+ const [ownedSession, setOwnedSession] = useState131(null);
89405
+ const ownedSessionRef = useRef162(null);
89406
+ const sessionOwnersRef = useRef162(/* @__PURE__ */ new WeakMap());
89407
+ const generationRef = useRef162(0);
89408
+ const projectIdRef = useRef162(projectId);
89327
89409
  projectIdRef.current = projectId;
89328
- const activeCompPathRef = useRef161(activeCompPath);
89410
+ const activeCompPathRef = useRef162(activeCompPath);
89329
89411
  activeCompPathRef.current = activeCompPath;
89330
- const [reloadToken, setReloadToken] = useState130(0);
89331
- const reloadTokenRef = useRef161(reloadToken);
89412
+ const [reloadToken, setReloadToken] = useState131(0);
89413
+ const reloadTokenRef = useRef162(reloadToken);
89332
89414
  reloadTokenRef.current = reloadToken;
89333
- const [unreachableProject, setUnreachableProject] = useState130(null);
89334
- const [compositionMissing, setCompositionMissing] = useState130(false);
89335
- const refreshedAbsentPathsRef = useRef161(/* @__PURE__ */ new Set());
89415
+ const [unreachableProject, setUnreachableProject] = useState131(null);
89416
+ const [compositionMissing, setCompositionMissing] = useState131(false);
89417
+ const refreshedAbsentPathsRef = useRef162(/* @__PURE__ */ new Set());
89336
89418
  useEffect131(() => {
89337
89419
  refreshedAbsentPathsRef.current.clear();
89338
89420
  }, [projectId]);
@@ -89425,8 +89507,8 @@ function useSdkSession(projectId, activeCompPath, fileTree = [], fileTreeLoaded
89425
89507
  }
89426
89508
  };
89427
89509
  }, [projectId, activeCompPath, reloadToken]);
89428
- const forceReload = useCallback153(() => setReloadToken((t2) => t2 + 1), []);
89429
- const publish = useCallback153(({ candidate, expectedSession, targetPath }) => {
89510
+ const forceReload = useCallback154(() => setReloadToken((t2) => t2 + 1), []);
89511
+ const publish = useCallback154(({ candidate, expectedSession, targetPath }) => {
89430
89512
  const expectedOwner = sessionOwnersRef.current.get(expectedSession);
89431
89513
  const current2 = ownedSessionRef.current;
89432
89514
  if (!isSessionOwnerActive(
@@ -89469,7 +89551,7 @@ function useStudioSdkSessions(projectId, activeCompPath, masterCompPath, fileTre
89469
89551
  }
89470
89552
 
89471
89553
  // src/hooks/useStudioExternalFileChanges.ts
89472
- import { useCallback as useCallback155 } from "react";
89554
+ import { useCallback as useCallback156 } from "react";
89473
89555
 
89474
89556
  // src/utils/externalConflictStorage.ts
89475
89557
  var DB_NAME = "hyperframes-studio-external-conflicts";
@@ -89570,7 +89652,7 @@ async function deleteExternalConflictSnapshot(projectId, filePath) {
89570
89652
  }
89571
89653
 
89572
89654
  // src/hooks/useExternalFileChangeCoordinator.ts
89573
- import { useCallback as useCallback154, useEffect as useEffect133, useRef as useRef162, useState as useState131 } from "react";
89655
+ import { useCallback as useCallback155, useEffect as useEffect133, useRef as useRef163, useState as useState132 } from "react";
89574
89656
  function testHotAdapter() {
89575
89657
  const value = globalThis.__HF_STUDIO_HOT_TEST_ADAPTER__;
89576
89658
  if (!value || typeof value !== "object") return null;
@@ -89627,15 +89709,15 @@ function useExternalFileChangeCoordinator({
89627
89709
  onAcceptedPersistedFileChange,
89628
89710
  refreshFileTree
89629
89711
  }) {
89630
- const [blocked, setBlockedState] = useState131(null);
89631
- const generationRef = useRef162(0);
89632
- const mountedRef = useRef162(true);
89633
- const lastEventIdentityRef = useRef162(null);
89634
- const blockedRef = useRef162(null);
89635
- const snapshotWriteTailRef = useRef162(Promise.resolve());
89636
- const drainingRef = useRef162(false);
89637
- const pendingPayloadRef = useRef162(null);
89638
- const setBlocked = useCallback154((next) => {
89712
+ const [blocked, setBlockedState] = useState132(null);
89713
+ const generationRef = useRef163(0);
89714
+ const mountedRef = useRef163(true);
89715
+ const lastEventIdentityRef = useRef163(null);
89716
+ const blockedRef = useRef163(null);
89717
+ const snapshotWriteTailRef = useRef163(Promise.resolve());
89718
+ const drainingRef = useRef163(false);
89719
+ const pendingPayloadRef = useRef163(null);
89720
+ const setBlocked = useCallback155((next) => {
89639
89721
  const held = blockedRef.current;
89640
89722
  const current2 = next && held ? { ...next, payload: mergeFileChangePayloads(held.payload, next.payload) } : next;
89641
89723
  blockedRef.current = current2;
@@ -89694,7 +89776,7 @@ function useExternalFileChangeCoordinator({
89694
89776
  cancelled = true;
89695
89777
  };
89696
89778
  }, [loadConflictSnapshot, projectId, recoveryFilePath, setBlocked]);
89697
- const deliverOwed = useCallback154(
89779
+ const deliverOwed = useCallback155(
89698
89780
  (owed, accept = true) => {
89699
89781
  const path = readStudioFileChangePath(owed) ?? ".";
89700
89782
  const affectsPreview = readFileChangeAffectsPreview(owed);
@@ -89709,7 +89791,7 @@ function useExternalFileChangeCoordinator({
89709
89791
  },
89710
89792
  [onAcceptedPersistedFileChange, reloadPreview, reloadSdkSession, refreshFileTree]
89711
89793
  );
89712
- const persistSnapshotInOrder = useCallback154(async (write) => {
89794
+ const persistSnapshotInOrder = useCallback155(async (write) => {
89713
89795
  const next = snapshotWriteTailRef.current.catch(() => void 0).then(write);
89714
89796
  snapshotWriteTailRef.current = next.then(
89715
89797
  () => void 0,
@@ -89717,7 +89799,7 @@ function useExternalFileChangeCoordinator({
89717
89799
  );
89718
89800
  await next;
89719
89801
  }, []);
89720
- const drainOnePending = useCallback154(
89802
+ const drainOnePending = useCallback155(
89721
89803
  // fallow-ignore-next-line complexity
89722
89804
  async (payload) => {
89723
89805
  const path = readStudioFileChangePath(payload);
@@ -89819,9 +89901,9 @@ function useExternalFileChangeCoordinator({
89819
89901
  deliverOwed
89820
89902
  ]
89821
89903
  );
89822
- const drainOnePendingRef = useRef162(drainOnePending);
89904
+ const drainOnePendingRef = useRef163(drainOnePending);
89823
89905
  drainOnePendingRef.current = drainOnePending;
89824
- const startDrainLoop = useCallback154(async () => {
89906
+ const startDrainLoop = useCallback155(async () => {
89825
89907
  if (drainingRef.current) return;
89826
89908
  drainingRef.current = true;
89827
89909
  try {
@@ -89835,7 +89917,7 @@ function useExternalFileChangeCoordinator({
89835
89917
  drainingRef.current = false;
89836
89918
  }
89837
89919
  }, []);
89838
- const processChange = useCallback154(
89920
+ const processChange = useCallback155(
89839
89921
  // fallow-ignore-next-line complexity
89840
89922
  (payload) => {
89841
89923
  const path = readStudioFileChangePath(payload);
@@ -89879,7 +89961,7 @@ function useExternalFileChangeCoordinator({
89879
89961
  },
89880
89962
  [projectId, pendingTimelineEditPathRef, startDrainLoop, onAcceptedPersistedFileChange]
89881
89963
  );
89882
- const processChangeRef = useRef162(processChange);
89964
+ const processChangeRef = useRef163(processChange);
89883
89965
  processChangeRef.current = processChange;
89884
89966
  useEffect133(() => {
89885
89967
  const handler = (delivery) => {
@@ -89899,14 +89981,14 @@ function useExternalFileChangeCoordinator({
89899
89981
  const catchUp = () => processChangeRef.current({ path: "." });
89900
89982
  return sseFileChangeChannel(handler, catchUp);
89901
89983
  }, []);
89902
- const retry = useCallback154(async () => {
89984
+ const retry = useCallback155(async () => {
89903
89985
  const current2 = blockedRef.current;
89904
89986
  if (!current2 || current2.status === "conflict" || current2.recovered) return;
89905
89987
  resetSaveQueues?.();
89906
89988
  lastEventIdentityRef.current = null;
89907
89989
  processChange(current2.payload);
89908
89990
  }, [processChange, resetSaveQueues]);
89909
- const useExternalFile = useCallback154(
89991
+ const useExternalFile = useCallback155(
89910
89992
  // fallow-ignore-next-line complexity
89911
89993
  async () => {
89912
89994
  const current2 = blockedRef.current;
@@ -89932,7 +90014,7 @@ function useExternalFileChangeCoordinator({
89932
90014
  resetSaveQueues
89933
90015
  ]
89934
90016
  );
89935
- const keepStudioFile = useCallback154(async () => {
90017
+ const keepStudioFile = useCallback155(async () => {
89936
90018
  const current2 = blockedRef.current;
89937
90019
  if (!current2 || !projectId) return;
89938
90020
  if (current2.generation !== generationRef.current) return;
@@ -90006,19 +90088,19 @@ function useStudioExternalFileChanges({
90006
90088
  const { flushPendingSourceSave, discardPendingSourceSave } = fileManager;
90007
90089
  const { drainPendingDomEditSaves, resetDomEditSaveQueueBreaker } = previewPersistence;
90008
90090
  const bumpThumbnailRevisions = usePlayerStore((state) => state.bumpThumbnailRevisions);
90009
- const onAcceptedPersistedFileChange = useCallback155(
90091
+ const onAcceptedPersistedFileChange = useCallback156(
90010
90092
  (_path, affectedCompositions) => {
90011
90093
  onOutsideChange?.();
90012
90094
  bumpThumbnailRevisions(affectedCompositions);
90013
90095
  },
90014
90096
  [bumpThumbnailRevisions, onOutsideChange]
90015
90097
  );
90016
- const drainPendingChanges = useCallback155(async () => {
90098
+ const drainPendingChanges = useCallback156(async () => {
90017
90099
  const source = await flushPendingSourceSave();
90018
90100
  if (source.status !== "clean") return source;
90019
90101
  return drainPendingDomEditSaves();
90020
90102
  }, [drainPendingDomEditSaves, flushPendingSourceSave]);
90021
- const discardPendingChanges = useCallback155(() => {
90103
+ const discardPendingChanges = useCallback156(() => {
90022
90104
  discardPendingSourceSave();
90023
90105
  resetDomEditSaveQueueBreaker();
90024
90106
  }, [discardPendingSourceSave, resetDomEditSaveQueueBreaker]);
@@ -90046,7 +90128,7 @@ function useStudioExternalFileChanges({
90046
90128
  }
90047
90129
 
90048
90130
  // src/hooks/useBlockHandlers.ts
90049
- import { useCallback as useCallback156, useMemo as useMemo76, useRef as useRef163, useState as useState132 } from "react";
90131
+ import { useCallback as useCallback157, useMemo as useMemo76, useRef as useRef164, useState as useState133 } from "react";
90050
90132
 
90051
90133
  // src/utils/blockInstaller.ts
90052
90134
  function getMaxZIndexFromIframe(iframe) {
@@ -90239,7 +90321,7 @@ function useBlockHandlers({
90239
90321
  setRightCollapsed,
90240
90322
  setRightPanelTab
90241
90323
  }) {
90242
- const [activeBlockParams, setActiveBlockParams] = useState132(null);
90324
+ const [activeBlockParams, setActiveBlockParams] = useState133(null);
90243
90325
  const blockCtx = useMemo76(
90244
90326
  () => ({
90245
90327
  activeCompPath: blockCtxDeps.activeCompPath,
@@ -90263,9 +90345,9 @@ function useBlockHandlers({
90263
90345
  blockCtxDeps.showToast
90264
90346
  ]
90265
90347
  );
90266
- const installingBlockRef = useRef163(false);
90348
+ const installingBlockRef = useRef164(false);
90267
90349
  const { showToast, dismissToast } = blockCtxDeps;
90268
- const runBlockInstall = useCallback156(
90350
+ const runBlockInstall = useCallback157(
90269
90351
  async (blockName, install) => {
90270
90352
  if (installingBlockRef.current) {
90271
90353
  showToast("A block is already installing. One moment\u2026", "info");
@@ -90282,7 +90364,7 @@ function useBlockHandlers({
90282
90364
  },
90283
90365
  [showToast, dismissToast]
90284
90366
  );
90285
- const handleAddBlock = useCallback156(
90367
+ const handleAddBlock = useCallback157(
90286
90368
  (blockName) => {
90287
90369
  if (!projectId) return;
90288
90370
  void (async () => {
@@ -90312,7 +90394,7 @@ function useBlockHandlers({
90312
90394
  },
90313
90395
  [projectId, blockCtx, previewIframeRef, runBlockInstall, setRightCollapsed, setRightPanelTab]
90314
90396
  );
90315
- const handleTimelineBlockDrop = useCallback156(
90397
+ const handleTimelineBlockDrop = useCallback157(
90316
90398
  (blockName, placement) => {
90317
90399
  if (!projectId) return;
90318
90400
  void runBlockInstall(
@@ -90331,7 +90413,7 @@ function useBlockHandlers({
90331
90413
  },
90332
90414
  [projectId, blockCtx, previewIframeRef, runBlockInstall]
90333
90415
  );
90334
- const handleAddMediaOverlay = useCallback156(
90416
+ const handleAddMediaOverlay = useCallback157(
90335
90417
  async (blockName, placement) => {
90336
90418
  if (!projectId) return;
90337
90419
  const { compositionPath, ...timelinePlacement } = placement;
@@ -90350,7 +90432,7 @@ function useBlockHandlers({
90350
90432
  },
90351
90433
  [projectId, blockCtx, previewIframeRef, runBlockInstall]
90352
90434
  );
90353
- const handlePreviewBlockDrop = useCallback156(
90435
+ const handlePreviewBlockDrop = useCallback157(
90354
90436
  (blockName, position) => {
90355
90437
  if (!projectId) return;
90356
90438
  void runBlockInstall(
@@ -90380,7 +90462,7 @@ function useBlockHandlers({
90380
90462
  }
90381
90463
 
90382
90464
  // src/hooks/useAppHotkeys.ts
90383
- import { useCallback as useCallback158, useEffect as useEffect134, useRef as useRef164 } from "react";
90465
+ import { useCallback as useCallback159, useEffect as useEffect134, useRef as useRef165 } from "react";
90384
90466
 
90385
90467
  // src/hooks/appHotkeysDispatch.ts
90386
90468
  function handleUndoRedoKey(event, onUndo, onRedo) {
@@ -90578,7 +90660,7 @@ function dispatchPlainKey(event, _key, cb) {
90578
90660
  }
90579
90661
 
90580
90662
  // src/hooks/useEditHistoryActions.ts
90581
- import { useCallback as useCallback157, useMemo as useMemo77 } from "react";
90663
+ import { useCallback as useCallback158, useMemo as useMemo77 } from "react";
90582
90664
  function useEditHistoryActions({
90583
90665
  editHistory,
90584
90666
  readOptionalProjectFile,
@@ -90592,15 +90674,15 @@ function useEditHistoryActions({
90592
90674
  activeCompPath,
90593
90675
  forceReloadSdkSession
90594
90676
  }) {
90595
- const readHistoryFile = useCallback157(
90677
+ const readHistoryFile = useCallback158(
90596
90678
  (path) => path === STUDIO_MOTION_PATH ? readOptionalProjectFile(path) : readProjectFile(path),
90597
90679
  [readOptionalProjectFile, readProjectFile]
90598
90680
  );
90599
- const serializeHistoryFiles = useCallback157(
90681
+ const serializeHistoryFiles = useCallback158(
90600
90682
  (paths, task) => serializeStudioFileMutations(writeProjectFile, paths, task),
90601
90683
  [writeProjectFile]
90602
90684
  );
90603
- const apply = useCallback157(
90685
+ const apply = useCallback158(
90604
90686
  async (direction) => {
90605
90687
  const noun = direction === "undo" ? "Undo" : "Redo";
90606
90688
  if (direction === "undo" && cancelNewestStudioWaitingPress()) return;
@@ -90664,8 +90746,8 @@ function useEditHistoryActions({
90664
90746
  forceReloadSdkSession
90665
90747
  ]
90666
90748
  );
90667
- const undo = useCallback157(() => whileScriptWrites(() => apply("undo")), [apply]);
90668
- const redo = useCallback157(() => whileScriptWrites(() => apply("redo")), [apply]);
90749
+ const undo = useCallback158(() => whileScriptWrites(() => apply("undo")), [apply]);
90750
+ const redo = useCallback158(() => whileScriptWrites(() => apply("redo")), [apply]);
90669
90751
  return useMemo77(() => ({ undo, redo }), [undo, redo]);
90670
90752
  }
90671
90753
  function fromShown(files, shown3) {
@@ -90740,7 +90822,7 @@ function useAppHotkeys({
90740
90822
  forceReloadSdkSession,
90741
90823
  readOnlyPreview
90742
90824
  }) {
90743
- const previewHistoryCleanupRef = useRef164(null);
90825
+ const previewHistoryCleanupRef = useRef165(null);
90744
90826
  const fileHistory = useEditHistoryActions({
90745
90827
  editHistory,
90746
90828
  readOptionalProjectFile,
@@ -90754,7 +90836,7 @@ function useAppHotkeys({
90754
90836
  activeCompPath,
90755
90837
  forceReloadSdkSession
90756
90838
  });
90757
- const applyHistory = useCallback158(
90839
+ const applyHistory = useCallback159(
90758
90840
  async (direction) => {
90759
90841
  const captionState = useCaptionStore.getState();
90760
90842
  if (captionState.isEditMode && isCaptionPreviewVisible()) {
@@ -90770,9 +90852,9 @@ function useAppHotkeys({
90770
90852
  },
90771
90853
  [editHistory.state, fileHistory, showToast]
90772
90854
  );
90773
- const handleUndo = useCallback158(() => applyHistory("undo"), [applyHistory]);
90774
- const handleRedo = useCallback158(() => applyHistory("redo"), [applyHistory]);
90775
- const cbRef = useRef164(null);
90855
+ const handleUndo = useCallback159(() => applyHistory("undo"), [applyHistory]);
90856
+ const handleRedo = useCallback159(() => applyHistory("redo"), [applyHistory]);
90857
+ const cbRef = useRef165(null);
90776
90858
  cbRef.current = {
90777
90859
  handleTimelineElementsDelete,
90778
90860
  handleLinkEdit,
@@ -90794,7 +90876,7 @@ function useAppHotkeys({
90794
90876
  showToast,
90795
90877
  readOnlyPreview
90796
90878
  };
90797
- const handleAppKeyDown = useCallback158((event) => {
90879
+ const handleAppKeyDown = useCallback159((event) => {
90798
90880
  const cb = cbRef.current;
90799
90881
  const key2 = event.key.toLowerCase();
90800
90882
  if (dispatchLinkShortcut(event, cb)) return;
@@ -90805,7 +90887,7 @@ function useAppHotkeys({
90805
90887
  window.addEventListener("keydown", handleAppKeyDown, true);
90806
90888
  return () => window.removeEventListener("keydown", handleAppKeyDown, true);
90807
90889
  }, [handleAppKeyDown]);
90808
- const syncPreviewHotkeys = useCallback158(
90890
+ const syncPreviewHotkeys = useCallback159(
90809
90891
  (iframe) => {
90810
90892
  previewHistoryCleanupRef.current?.();
90811
90893
  previewHistoryCleanupRef.current = null;
@@ -90835,7 +90917,7 @@ function useAppHotkeys({
90835
90917
  }
90836
90918
 
90837
90919
  // src/hooks/useClipboard.ts
90838
- import { useCallback as useCallback159, useRef as useRef165 } from "react";
90920
+ import { useCallback as useCallback160, useRef as useRef166 } from "react";
90839
90921
  import { EXCLUDED_TAGS, mintHfId, walkCompositionDescendants as walkCompositionDescendants2 } from "@hyperframes/parsers/hf-ids";
90840
90922
 
90841
90923
  // src/utils/clipboardPayload.ts
@@ -91112,10 +91194,10 @@ function useClipboard({
91112
91194
  previewIframeRef,
91113
91195
  waitForPendingDomEditSaves
91114
91196
  }) {
91115
- const clipboardRef = useRef165(null);
91116
- const projectIdRef = useRef165(projectId);
91197
+ const clipboardRef = useRef166(null);
91198
+ const projectIdRef = useRef166(projectId);
91117
91199
  projectIdRef.current = projectId;
91118
- const readSaved = useCallback159(
91200
+ const readSaved = useCallback160(
91119
91201
  async (path) => {
91120
91202
  const pid = projectIdRef.current;
91121
91203
  if (!pid) throw new Error("No project is open.");
@@ -91129,7 +91211,7 @@ function useClipboard({
91129
91211
  },
91130
91212
  [waitForPendingDomEditSaves, writeProjectFile]
91131
91213
  );
91132
- const findSelectedClips = useCallback159(() => {
91214
+ const findSelectedClips = useCallback160(() => {
91133
91215
  const selected = getSelectedElements();
91134
91216
  if (selected.length === 0) return null;
91135
91217
  const lives = [];
@@ -91143,7 +91225,7 @@ function useClipboard({
91143
91225
  }
91144
91226
  return { elements: selected, lives };
91145
91227
  }, [activeCompPath, previewIframeRef, showToast]);
91146
- const readClips = useCallback159(
91228
+ const readClips = useCallback160(
91147
91229
  async (targets) => {
91148
91230
  const paths = targets.elements.map((el) => el.sourceFile || activeCompPath || "index.html");
91149
91231
  const markup = await readSavedMarkup(readSaved, paths, targets.lives);
@@ -91159,7 +91241,7 @@ function useClipboard({
91159
91241
  },
91160
91242
  [activeCompPath, readSaved]
91161
91243
  );
91162
- const copyTimelineSelection = useCallback159(() => {
91244
+ const copyTimelineSelection = useCallback160(() => {
91163
91245
  const targets = findSelectedClips();
91164
91246
  if (!targets) return null;
91165
91247
  const sourceFile = targets.elements[0]?.sourceFile || activeCompPath || "index.html";
@@ -91174,7 +91256,7 @@ function useClipboard({
91174
91256
  };
91175
91257
  });
91176
91258
  }, [activeCompPath, findSelectedClips, readClips, showToast]);
91177
- const copyDomSelection = useCallback159(
91259
+ const copyDomSelection = useCallback160(
91178
91260
  (domSelection) => {
91179
91261
  const live = getSelectedDomElement(previewIframeRef, domSelection, activeCompPath);
91180
91262
  if (!live) {
@@ -91196,7 +91278,7 @@ function useClipboard({
91196
91278
  },
91197
91279
  [activeCompPath, previewIframeRef, readSaved, showToast]
91198
91280
  );
91199
- const copyToClipboard = useCallback159(() => {
91281
+ const copyToClipboard = useCallback160(() => {
91200
91282
  const domSelection = domEditSelectionRef.current;
91201
91283
  let pending2;
91202
91284
  if (usePlayerStore.getState().selectedElementId) pending2 = copyTimelineSelection();
@@ -91218,8 +91300,8 @@ function useClipboard({
91218
91300
  });
91219
91301
  return own;
91220
91302
  }, [copyDomSelection, copyTimelineSelection, domEditSelectionRef, showToast]);
91221
- const handleCopy2 = useCallback159(() => copyToClipboard() !== null, [copyToClipboard]);
91222
- const handlePaste2 = useCallback159(
91303
+ const handleCopy2 = useCallback160(() => copyToClipboard() !== null, [copyToClipboard]);
91304
+ const handlePaste2 = useCallback160(
91223
91305
  async (options) => {
91224
91306
  const payload = await clipboardRef.current;
91225
91307
  if (!payload) {
@@ -91267,7 +91349,7 @@ function useClipboard({
91267
91349
  },
91268
91350
  [activeCompPath, recordEdit, reloadPreview, showToast, writeProjectFile]
91269
91351
  );
91270
- const handleDuplicate = useCallback159(
91352
+ const handleDuplicate = useCallback160(
91271
91353
  async (options) => {
91272
91354
  const targets = findSelectedClips();
91273
91355
  if (!targets) return false;
@@ -91319,7 +91401,7 @@ function useClipboard({
91319
91401
  writeProjectFile
91320
91402
  ]
91321
91403
  );
91322
- const handleCut = useCallback159(async () => {
91404
+ const handleCut = useCallback160(async () => {
91323
91405
  const selected = getSelectedElements();
91324
91406
  const domSelection = domEditSelectionRef.current;
91325
91407
  const copied = copyToClipboard();
@@ -91339,12 +91421,12 @@ function useClipboard({
91339
91421
  handleTimelineElementsDelete,
91340
91422
  handleDomEditElementDelete
91341
91423
  ]);
91342
- const canPaste = useCallback159(() => clipboardRef.current !== null, []);
91424
+ const canPaste = useCallback160(() => clipboardRef.current !== null, []);
91343
91425
  return { handleCopy: handleCopy2, handlePaste: handlePaste2, handleCut, handleDuplicate, canPaste };
91344
91426
  }
91345
91427
 
91346
91428
  // src/hooks/useCaptionDetection.ts
91347
- import { useEffect as useEffect135, useRef as useRef166 } from "react";
91429
+ import { useEffect as useEffect135, useRef as useRef167 } from "react";
91348
91430
 
91349
91431
  // src/captions/parser.ts
91350
91432
  import {
@@ -91639,7 +91721,7 @@ function useCaptionDetection({
91639
91721
  setRightCollapsed
91640
91722
  }) {
91641
91723
  const livePreviewIframe = useLivePreviewIframe();
91642
- const prevCompPathRef = useRef166(activeCompPath);
91724
+ const prevCompPathRef = useRef167(activeCompPath);
91643
91725
  useEffect135(() => {
91644
91726
  if (prevCompPathRef.current !== activeCompPath) {
91645
91727
  prevCompPathRef.current = activeCompPath;
@@ -91740,12 +91822,12 @@ function useCaptionDetection({
91740
91822
  }
91741
91823
 
91742
91824
  // src/hooks/useConsoleErrorCapture.ts
91743
- import { useCallback as useCallback160, useEffect as useEffect136, useRef as useRef167, useState as useState133 } from "react";
91825
+ import { useCallback as useCallback161, useEffect as useEffect136, useRef as useRef168, useState as useState134 } from "react";
91744
91826
  import { STUDIO_PREVIEW_ERRORS } from "@hyperframes/core/studio-preview-mark";
91745
91827
  function useConsoleErrorCapture(previewIframe) {
91746
- const [consoleErrors, setConsoleErrors] = useState133(null);
91747
- const consoleErrorsRef = useRef167([]);
91748
- const resetErrors = useCallback160(() => {
91828
+ const [consoleErrors, setConsoleErrors] = useState134(null);
91829
+ const consoleErrorsRef = useRef168([]);
91830
+ const resetErrors = useCallback161(() => {
91749
91831
  consoleErrorsRef.current = [];
91750
91832
  setConsoleErrors(null);
91751
91833
  }, []);
@@ -91809,34 +91891,34 @@ function useConsoleErrorCapture(previewIframe) {
91809
91891
  }
91810
91892
 
91811
91893
  // src/hooks/useFrameCapture.ts
91812
- import { useMemo as useMemo78, useState as useState134, useCallback as useCallback161, useRef as useRef168 } from "react";
91894
+ import { useMemo as useMemo78, useState as useState135, useCallback as useCallback162, useRef as useRef169 } from "react";
91813
91895
  function useFrameCapture({
91814
91896
  projectId,
91815
91897
  activeCompPath,
91816
91898
  showToast,
91817
91899
  waitForPendingDomEditSaves
91818
91900
  }) {
91819
- const [captureFrameTime, setCaptureFrameTime] = useState134(
91901
+ const [captureFrameTime, setCaptureFrameTime] = useState135(
91820
91902
  () => usePlayerStore.getState().currentTime
91821
91903
  );
91822
- const [capturing, setCapturing] = useState134(false);
91823
- const capturingRef = useRef168(false);
91824
- const livePlayheadRef = useRef168(captureFrameTime);
91904
+ const [capturing, setCapturing] = useState135(false);
91905
+ const capturingRef = useRef169(false);
91906
+ const livePlayheadRef = useRef169(captureFrameTime);
91825
91907
  useMountEffect(
91826
91908
  () => liveTime.subscribe((time) => {
91827
91909
  livePlayheadRef.current = time;
91828
91910
  })
91829
91911
  );
91830
- const playheadTime = useCallback161(() => {
91912
+ const playheadTime = useCallback162(() => {
91831
91913
  const { isPlaying, currentTime } = usePlayerStore.getState();
91832
91914
  return isPlaying ? livePlayheadRef.current : currentTime;
91833
91915
  }, []);
91834
- const [captureStamp, setCaptureStamp] = useState134(Date.now);
91835
- const refreshCaptureFrameTime = useCallback161(() => {
91916
+ const [captureStamp, setCaptureStamp] = useState135(Date.now);
91917
+ const refreshCaptureFrameTime = useCallback162(() => {
91836
91918
  setCaptureFrameTime(playheadTime());
91837
91919
  setCaptureStamp(Date.now());
91838
91920
  }, [playheadTime]);
91839
- const handleCaptureFrameClick = useCallback161(
91921
+ const handleCaptureFrameClick = useCallback162(
91840
91922
  async (event) => {
91841
91923
  if (!projectId) return;
91842
91924
  event.preventDefault();
@@ -91920,7 +92002,7 @@ function useFrameCapture({
91920
92002
  }
91921
92003
 
91922
92004
  // src/hooks/useLintModal.ts
91923
- import { useState as useState135, useCallback as useCallback162, useEffect as useEffect137, useRef as useRef169, useMemo as useMemo79 } from "react";
92005
+ import { useState as useState136, useCallback as useCallback163, useEffect as useEffect137, useRef as useRef170, useMemo as useMemo79 } from "react";
91924
92006
  function parseFinding(f) {
91925
92007
  return {
91926
92008
  severity: f.severity === "error" ? "error" : "warning",
@@ -91936,11 +92018,11 @@ async function fetchLintFindings(projectId) {
91936
92018
  return (data.findings ?? []).map(parseFinding);
91937
92019
  }
91938
92020
  function useLintModal(projectId, refreshKey) {
91939
- const [lintModal, setLintModal] = useState135(null);
91940
- const [linting, setLinting] = useState135(false);
91941
- const [backgroundFindings, setBackgroundFindings] = useState135([]);
91942
- const autoLintRanRef = useRef169(false);
91943
- const runBackgroundLint = useCallback162(async () => {
92021
+ const [lintModal, setLintModal] = useState136(null);
92022
+ const [linting, setLinting] = useState136(false);
92023
+ const [backgroundFindings, setBackgroundFindings] = useState136([]);
92024
+ const autoLintRanRef = useRef170(false);
92025
+ const runBackgroundLint = useCallback163(async () => {
91944
92026
  if (!projectId) return;
91945
92027
  if (!isPreviewBooted(projectId) && !await whenPreviewBooted(projectId)) return;
91946
92028
  try {
@@ -91948,7 +92030,7 @@ function useLintModal(projectId, refreshKey) {
91948
92030
  } catch {
91949
92031
  }
91950
92032
  }, [projectId]);
91951
- const handleLint = useCallback162(async () => {
92033
+ const handleLint = useCallback163(async () => {
91952
92034
  if (!projectId) return;
91953
92035
  setLinting(true);
91954
92036
  try {
@@ -91962,7 +92044,7 @@ function useLintModal(projectId, refreshKey) {
91962
92044
  setLinting(false);
91963
92045
  }
91964
92046
  }, [projectId]);
91965
- const prevProjectIdRef = useRef169(projectId);
92047
+ const prevProjectIdRef = useRef170(projectId);
91966
92048
  useEffect137(() => {
91967
92049
  if (projectId !== prevProjectIdRef.current) {
91968
92050
  autoLintRanRef.current = false;
@@ -91977,8 +92059,8 @@ function useLintModal(projectId, refreshKey) {
91977
92059
  const timer = setTimeout(() => void runBackgroundLint(), 1e3);
91978
92060
  return () => clearTimeout(timer);
91979
92061
  }, [projectId, refreshKey, runBackgroundLint]);
91980
- const closeLintModal = useCallback162(() => setLintModal(null), []);
91981
- const groupFindings = useCallback162(
92062
+ const closeLintModal = useCallback163(() => setLintModal(null), []);
92063
+ const groupFindings = useCallback163(
91982
92064
  (keyFn) => {
91983
92065
  const map = /* @__PURE__ */ new Map();
91984
92066
  for (const f of backgroundFindings) {
@@ -92014,64 +92096,6 @@ function useLintModal(projectId, refreshKey) {
92014
92096
  };
92015
92097
  }
92016
92098
 
92017
- // src/hooks/useToast.ts
92018
- import { useState as useState136, useCallback as useCallback163, useRef as useRef170 } from "react";
92019
- var AUTO_DISMISS_MS2 = 4e3;
92020
- var EXIT_MS2 = 160;
92021
- var MAX_TOASTS = 3;
92022
- var nextToastId = 1;
92023
- function useToast() {
92024
- const [toasts, setToasts] = useState136([]);
92025
- const timersRef = useRef170(/* @__PURE__ */ new Map());
92026
- const clearTimer = useCallback163((id) => {
92027
- const timer = timersRef.current.get(id);
92028
- if (timer) {
92029
- clearTimeout(timer);
92030
- timersRef.current.delete(id);
92031
- }
92032
- }, []);
92033
- const removeToast = useCallback163(
92034
- (id) => {
92035
- clearTimer(id);
92036
- setToasts((prev) => prev.filter((t2) => t2.id !== id));
92037
- },
92038
- [clearTimer]
92039
- );
92040
- const dismissToast = useCallback163(
92041
- (id) => {
92042
- clearTimer(id);
92043
- setToasts((prev) => prev.map((t2) => t2.id === id ? { ...t2, leaving: true } : t2));
92044
- const timer = setTimeout(() => removeToast(id), EXIT_MS2);
92045
- timersRef.current.set(id, timer);
92046
- },
92047
- [clearTimer, removeToast]
92048
- );
92049
- const showToast = useCallback163(
92050
- (message, tone = "error") => {
92051
- const id = nextToastId++;
92052
- setToasts((prev) => {
92053
- const next = [...prev, { id, message, tone }];
92054
- while (next.length > MAX_TOASTS) {
92055
- const dropped2 = next.shift();
92056
- if (dropped2) clearTimer(dropped2.id);
92057
- }
92058
- return next;
92059
- });
92060
- if (tone !== "error") {
92061
- const timer = setTimeout(() => dismissToast(id), AUTO_DISMISS_MS2);
92062
- timersRef.current.set(id, timer);
92063
- }
92064
- return id;
92065
- },
92066
- [clearTimer, dismissToast]
92067
- );
92068
- useMountEffect(() => () => {
92069
- for (const timer of timersRef.current.values()) clearTimeout(timer);
92070
- timersRef.current.clear();
92071
- });
92072
- return { toasts, showToast, dismissToast };
92073
- }
92074
-
92075
92099
  // src/hooks/useStudioUrlState.ts
92076
92100
  import { useCallback as useCallback164, useEffect as useEffect138, useRef as useRef171, useState as useState137 } from "react";
92077
92101
 
@@ -104338,7 +104362,9 @@ function ownSourceFile(live, iframe) {
104338
104362
  return getSourceFileForElement(live, previewed).sourceFile;
104339
104363
  }
104340
104364
  function patchByHfId(files, hfId, ownFile, op) {
104341
- const matches = Object.keys(files).filter((file) => findTagByTarget(files[file] ?? "", { hfId }));
104365
+ const matches = Object.keys(files).filter(
104366
+ (file) => readTagSnippetByTarget(files[file] ?? "", { hfId }) !== void 0
104367
+ );
104342
104368
  const path = matches.includes(ownFile) ? ownFile : matches.length === 1 ? matches[0] : void 0;
104343
104369
  const before = path ? files[path] : void 0;
104344
104370
  return path && before ? { path, before, after: applyPatchByTarget(before, { hfId }, op) } : null;