hyperframes 0.8.115 → 0.8.116

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 (162) hide show
  1. package/dist/{add-ZSLFODRZ.js → add-5AOKGJRR.js} +16 -16
  2. package/dist/{animatedGifPrep-72A45YER.js → animatedGifPrep-XKCVQ4ZL.js} +7 -7
  3. package/dist/{asset-SGDOHBBN.js → asset-QE74HE7H.js} +2 -2
  4. package/dist/{assetCataloger-Q7BCDARF.js → assetCataloger-3VJRWB3N.js} +3 -3
  5. package/dist/{auth-5JGFN7SV.js → auth-HQE2GKY2.js} +2 -2
  6. package/dist/{autoUpdate-ZVTMYO7Z.js → autoUpdate-MH57H575.js} +2 -2
  7. package/dist/{backgroundChecks-IY3G5G2D.js → backgroundChecks-JP2GHEP4.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-QVLLL5DN.js → batchRender-KIFBKKVN.js} +4 -4
  10. package/dist/{beats-66KZIB5V.js → beats-V334Q2GV.js} +13 -13
  11. package/dist/{benchmark-AWFKSWQH.js → benchmark-62QZH5YE.js} +13 -13
  12. package/dist/{browser-J54EXMCE.js → browser-EK7OBU6W.js} +10 -10
  13. package/dist/{bundleWithLocalizedFonts-BLLHP2TO.js → bundleWithLocalizedFonts-263BUY7C.js} +2 -2
  14. package/dist/{capture-SLI2I5BS.js → capture-56HMZGJW.js} +10 -10
  15. package/dist/{capture-D4HRSVSK.js → capture-6F3XPKXI.js} +2 -2
  16. package/dist/{catalog-BUMLQU7L.js → catalog-JO7WHBYC.js} +16 -16
  17. package/dist/{check-HEZUK62C.js → check-S4RZIS26.js} +33 -33
  18. package/dist/{checkBrowser-RVJM6IUO.js → checkBrowser-NVWULRE7.js} +32 -32
  19. package/dist/{chunk-MPB7BQT7.js → chunk-23KZNTIV.js} +1 -1
  20. package/dist/{chunk-IOJAVV6J.js → chunk-2E4A277E.js} +1 -1
  21. package/dist/{chunk-CVBWF2MD.js → chunk-2HE5ZOXK.js} +1 -1
  22. package/dist/{chunk-TWJT2RGZ.js → chunk-34AE4KPB.js} +4 -4
  23. package/dist/{chunk-5MXN7WM4.js → chunk-63O3AR5U.js} +3 -3
  24. package/dist/{chunk-WZYHTXZY.js → chunk-6FRHKGRY.js} +1 -1
  25. package/dist/{chunk-AXXK3LWL.js → chunk-6TSA2KDM.js} +1 -1
  26. package/dist/{chunk-YNHP6OFJ.js → chunk-7Z2XNQ7F.js} +2 -2
  27. package/dist/{chunk-XMAL2A7Y.js → chunk-AIYKVE4Y.js} +1 -1
  28. package/dist/{chunk-IEE7GIVX.js → chunk-AKZD7VWZ.js} +2 -2
  29. package/dist/{chunk-ORAISNGN.js → chunk-C47XJXSK.js} +10 -10
  30. package/dist/{chunk-2H37RGJ2.js → chunk-CCWSLTWA.js} +10 -10
  31. package/dist/{chunk-SSZYJCAL.js → chunk-CHWO3UN6.js} +2 -2
  32. package/dist/{chunk-Y2Y4LBJD.js → chunk-CVE7OUZE.js} +3 -3
  33. package/dist/{chunk-3R6P5BIG.js → chunk-DRLB5STV.js} +2 -2
  34. package/dist/{chunk-KLZ7OCHR.js → chunk-ENQL7NCM.js} +3 -3
  35. package/dist/{chunk-T5HXGUM3.js → chunk-EWR3SLQV.js} +1 -1
  36. package/dist/{chunk-SAO3NQPF.js → chunk-EWUI4PU6.js} +1 -1
  37. package/dist/{chunk-2GWVY66H.js → chunk-FERBBWDU.js} +1 -1
  38. package/dist/{chunk-QXNRRMBQ.js → chunk-FFF36PQA.js} +2 -2
  39. package/dist/{chunk-UUDQD62L.js → chunk-FSLYPQ5Z.js} +1 -1
  40. package/dist/{chunk-4P2TOD7N.js → chunk-GNQF4NZW.js} +1 -1
  41. package/dist/{chunk-HOBR4IHC.js → chunk-IGWZCCLO.js} +7 -7
  42. package/dist/{chunk-2DX6JYL2.js → chunk-IX75NQSA.js} +2 -2
  43. package/dist/{chunk-SK53U3PF.js → chunk-JBZYEZPZ.js} +1 -1
  44. package/dist/{chunk-6SEUZGID.js → chunk-JYB7NKO6.js} +3 -3
  45. package/dist/{chunk-HPWPLV5J.js → chunk-KNCLHJB5.js} +3 -3
  46. package/dist/{chunk-M7XTMZF5.js → chunk-MZPMAU25.js} +2 -2
  47. package/dist/{chunk-SC7ICSIU.js → chunk-NCQV2NMY.js} +1 -1
  48. package/dist/{chunk-YJEGT5L6.js → chunk-NITBGIHR.js} +2 -2
  49. package/dist/{chunk-PZTEY73C.js → chunk-NRTZ2JPC.js} +1 -1
  50. package/dist/{chunk-BDNCUMZM.js → chunk-PAZUQZYV.js} +1 -1
  51. package/dist/{chunk-3J4EBX5M.js → chunk-PHBPRHKK.js} +1 -1
  52. package/dist/{chunk-3YTWSGBV.js → chunk-QITH7ALB.js} +4 -4
  53. package/dist/{chunk-XJQ7TRLG.js → chunk-RTLYNXAC.js} +1 -1
  54. package/dist/{chunk-4HIF3LI3.js → chunk-S5Q46UEI.js} +5 -5
  55. package/dist/{chunk-PLP4K6WZ.js → chunk-SXV67HVP.js} +92 -34
  56. package/dist/{chunk-ZBQP54CD.js → chunk-TEYBS6T3.js} +5 -5
  57. package/dist/{chunk-RDMAU7AJ.js → chunk-TRLP3CSL.js} +1 -1
  58. package/dist/{chunk-QMFCL2ZN.js → chunk-TY76XMMP.js} +2 -2
  59. package/dist/{chunk-SOEQWMNS.js → chunk-VJ2RAP65.js} +2 -2
  60. package/dist/{chunk-TMCJPHPP.js → chunk-VLB4NGRR.js} +1 -1
  61. package/dist/{chunk-VDASTWUM.js → chunk-VU5IDWKX.js} +2 -2
  62. package/dist/{chunk-P73WQPSB.js → chunk-WN62HDA7.js} +1 -1
  63. package/dist/{chunk-BQG33YTI.js → chunk-WUUEWXA2.js} +1 -1
  64. package/dist/chunk-WWL6YGYK.js +3541 -0
  65. package/dist/{chunk-74RAXWDF.js → chunk-XTCMIITZ.js} +1 -1
  66. package/dist/{chunk-5YSA3YXO.js → chunk-YX55Y7UO.js} +9 -9
  67. package/dist/{clean-X6Y252ZC.js → clean-DPW2FTMM.js} +17 -17
  68. package/dist/cli.js +50 -50
  69. package/dist/{cloud-EE4GALWR.js → cloud-OAYSRXAJ.js} +4 -4
  70. package/dist/{cloudrun-Y6A42KHE.js → cloudrun-NM2ZMAJV.js} +5 -5
  71. package/dist/{compare-K6XJZ3OC.js → compare-CZC6ROYF.js} +27 -27
  72. package/dist/{compiler-DYACPLUW.js → compiler-3MFRD377.js} +3 -3
  73. package/dist/{component-T6IYSCFP.js → component-6D5RBOWZ.js} +3 -3
  74. package/dist/{compositions-4KUTNS5L.js → compositions-5KCUVODZ.js} +12 -12
  75. package/dist/{delete-C64TWAPE.js → delete-ZGLELTUJ.js} +2 -2
  76. package/dist/{deterministicFonts-A4CNCSAL.js → deterministicFonts-O7BTFDJU.js} +2 -2
  77. package/dist/{dist-HRBNHR4M.js → dist-JAOG6MYW.js} +1 -1
  78. package/dist/{dist-KNGSQALD.js → dist-XSSXGBRH.js} +3 -3
  79. package/dist/{doctor-WJXZK5QN.js → doctor-CICSVC7I.js} +11 -11
  80. package/dist/{events-QRWJBSV4.js → events-V3O6Q5ZH.js} +9 -9
  81. package/dist/{events-FVG3Y6Q4.js → events-Y4NBIJBP.js} +10 -10
  82. package/dist/{feedback-NQHRUOZP.js → feedback-EA3K6QXT.js} +11 -11
  83. package/dist/{figma-MEX4CSIM.js → figma-WOOHCXDA.js} +3 -3
  84. package/dist/fontLocalizeCli.js +10 -10
  85. package/dist/{get-CMJIHGSA.js → get-64SDPINM.js} +2 -2
  86. package/dist/{gpuPolicy-5S4OZDME.js → gpuPolicy-TFCLAD64.js} +7 -7
  87. package/dist/{grade-compare-NIDMIUGZ.js → grade-compare-NXAFWDBR.js} +27 -27
  88. package/dist/{gsapParserAcorn-SZANFUAQ.js → gsapParserAcorn-FLWABPQM.js} +1 -1
  89. package/dist/{help-G6AWAWJW.js → help-6H4ICA27.js} +1 -1
  90. package/dist/{history-ZBOK2JQF.js → history-TPRRROOR.js} +17 -17
  91. package/dist/hyperframe-runtime.js +50 -50
  92. package/dist/hyperframe.manifest.json +1 -1
  93. package/dist/hyperframe.runtime.iife.js +50 -50
  94. package/dist/hyperframes-player.global.js +1 -1
  95. package/dist/{info-2ORQZ6I2.js → info-DDXWWAM3.js} +12 -12
  96. package/dist/{init-3PSKH6UR.js → init-KULZFAS7.js} +23 -23
  97. package/dist/{inspect-NR54RMEE.js → inspect-VEJH72DJ.js} +28 -28
  98. package/dist/{installer-YQUWHYBZ.js → installer-TBL3PE2J.js} +5 -5
  99. package/dist/{keyframes-KT7T4AEV.js → keyframes-W6KIRZ4O.js} +13 -13
  100. package/dist/{lambda-3FF4V3X3.js → lambda-JJXODPS5.js} +6 -6
  101. package/dist/{layout-RB3M37ER.js → layout-KVG7PJ3F.js} +28 -28
  102. package/dist/{lint-HR57M5YP.js → lint-GQ5IVVCN.js} +13 -13
  103. package/dist/{lintProject-TOLC6HDS.js → lintProject-FDJYTOVM.js} +1 -1
  104. package/dist/{list-YDXYHXHF.js → list-QZ7LV6HF.js} +2 -2
  105. package/dist/{login-N6UNRVYW.js → login-526R3KCB.js} +4 -4
  106. package/dist/{media-treatment-UXJOTNRO.js → media-treatment-H7LGSO3I.js} +13 -13
  107. package/dist/{models-Z3XFMGXB.js → models-WOEP555T.js} +8 -8
  108. package/dist/{motionShot-KQMCXJ77.js → motionShot-235LNUY7.js} +12 -12
  109. package/dist/{normalize-audio-XJQMDWRV.js → normalize-audio-GTAESDG6.js} +12 -12
  110. package/dist/{pipeline-U3OISHWV.js → pipeline-NBHOEZPA.js} +7 -7
  111. package/dist/{play-XP77PML5.js → play-SBTJLOWX.js} +22 -22
  112. package/dist/{preflight-CANFVC4Y.js → preflight-KQCXRC6W.js} +8 -8
  113. package/dist/{present-MWGA3O4S.js → present-TXULFA2J.js} +18 -18
  114. package/dist/{preview-X5GWZ3Q6.js → preview-E2U4ER7H.js} +18 -18
  115. package/dist/{producer-B2IHU7MA.js → producer-DR3TOPSC.js} +1 -1
  116. package/dist/{projectConfig-2A64YU5H.js → projectConfig-QBYFCJYE.js} +7 -7
  117. package/dist/{publication-CFYBPLRS.js → publication-TWGRIP5F.js} +3 -3
  118. package/dist/{publish-WE6AS77D.js → publish-JOUHOKGX.js} +9 -9
  119. package/dist/{remove-background-XSDOCVN5.js → remove-background-GQZIZBHM.js} +8 -8
  120. package/dist/{render-5TMRIC73.js → render-2LC2DUR3.js} +13 -13
  121. package/dist/{render-QX6AKB6Y.js → render-JR3YIYZ4.js} +4 -4
  122. package/dist/{render-HVZUCLYW.js → render-UVGS7PLJ.js} +22 -22
  123. package/dist/{render-batch-QJXFVTDE.js → render-batch-MYH6ZGO3.js} +4 -4
  124. package/dist/{renderCancellation-WSSSHRFR.js → renderCancellation-EIBZHTFW.js} +7 -7
  125. package/dist/renderSetupWorker.js +1 -1
  126. package/dist/{resolver-WTXO6WXA.js → resolver-4Z5YISAU.js} +5 -5
  127. package/dist/{sherpa-S6ZBBEFO.js → sherpa-UX3MQXO5.js} +8 -8
  128. package/dist/{skills-CDRSTETB.js → skills-GXETMIED.js} +12 -12
  129. package/dist/{skillsUpdateCheck-FKREJXSF.js → skillsUpdateCheck-XS7OE6FX.js} +3 -3
  130. package/dist/{snapshot-T4PFSXTH.js → snapshot-OAHQ3EVJ.js} +28 -28
  131. package/dist/{src-5BZDQAVN.js → src-AZ5YCYQP.js} +9 -9
  132. package/dist/{src-IZMCUYK7.js → src-X6ACPJHG.js} +6 -6
  133. package/dist/{staticProjectServer-VN4ARAH4.js → staticProjectServer-P4QSLLF6.js} +16 -16
  134. package/dist/{status-OJZWJB53.js → status-KDRWJBPW.js} +7 -7
  135. package/dist/studio/assets/{hyperframes-player-C-9N8nk0.js → hyperframes-player-mGYvPVpw.js} +1 -1
  136. package/dist/studio/assets/{index-BoUM6Xqb.js → index-BWHt0-ir.js} +1 -1
  137. package/dist/studio/assets/{index-CAvZ0AA-.js → index-DYNaXPVf.js} +201 -201
  138. package/dist/studio/assets/{index-CVuorIMv.js → index-Dr3hNpvS.js} +1 -1
  139. package/dist/studio/{chunk-TXZMMOMA.js → chunk-3F47EFCT.js} +100 -2
  140. package/dist/studio/chunk-3F47EFCT.js.map +1 -0
  141. package/dist/studio/{domEditingLayers-D7VYFJJD.js → domEditingLayers-OL7GLSS4.js} +2 -2
  142. package/dist/studio/index.d.ts +104 -22
  143. package/dist/studio/index.html +1 -1
  144. package/dist/studio/index.js +1131 -1044
  145. package/dist/studio/index.js.map +1 -1
  146. package/dist/{studio-api-CIO2NKK5.js → studio-api-SYQOPCMB.js} +10 -10
  147. package/dist/{studioServer-G5GNYWDI.js → studioServer-ANSX6DY2.js} +42 -42
  148. package/dist/{system-PPNNGVIM.js → system-B6UYANYL.js} +7 -7
  149. package/dist/{telemetry-GMDMISOX.js → telemetry-AZEW2DZP.js} +10 -10
  150. package/dist/{timeline-5LSQX4OS.js → timeline-VIKY65W6.js} +17 -17
  151. package/dist/{tokens-VBXAT7CK.js → tokens-SSGCAC7E.js} +2 -2
  152. package/dist/{transcribe-GYCAIIEQ.js → transcribe-O33POKJY.js} +13 -13
  153. package/dist/{transcribe-VGYAWRXS.js → transcribe-PF6BUHHQ.js} +8 -8
  154. package/dist/{updateCheck-AZEREUQV.js → updateCheck-Y4SUY6VE.js} +2 -2
  155. package/dist/{upgrade-S63QN2LA.js → upgrade-EGIS5OCB.js} +2 -2
  156. package/dist/{urlDownloader-SM6ODN5O.js → urlDownloader-UBY27GFW.js} +6 -6
  157. package/dist/{validate-7MNUK5MH.js → validate-FE74RMPD.js} +17 -17
  158. package/dist/{video-JEOHARTC.js → video-DODRESEY.js} +7 -7
  159. package/package.json +1 -1
  160. package/dist/chunk-RRPJEHHW.js +0 -3541
  161. package/dist/studio/chunk-TXZMMOMA.js.map +0 -1
  162. /package/dist/studio/{domEditingLayers-D7VYFJJD.js.map → domEditingLayers-OL7GLSS4.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-CAvZ0AA-.js";/*!
1
+ import{n as Qi}from"./index-DYNaXPVf.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -19,13 +19,104 @@ import {
19
19
  querySelectorAllSafely,
20
20
  withSelectorIndexPass
21
21
  } from "./chunk-5EKWJZLM.js";
22
+ import {
23
+ __export
24
+ } from "./chunk-PZ5AY32C.js";
25
+
26
+ // src/components/editor/manualEditingAvailability.ts
27
+ var manualEditingAvailability_exports = {};
28
+ __export(manualEditingAvailability_exports, {
29
+ STUDIO_API_SAME_ORIGIN_CREDENTIALS: () => STUDIO_API_SAME_ORIGIN_CREDENTIALS,
30
+ STUDIO_FLAT_INSPECTOR_ENABLED: () => STUDIO_FLAT_INSPECTOR_ENABLED,
31
+ STUDIO_SDK_CUTOVER_ENABLED: () => STUDIO_SDK_CUTOVER_ENABLED,
32
+ STUDIO_SDK_CUTOVER_FAMILIES: () => STUDIO_SDK_CUTOVER_FAMILIES,
33
+ STUDIO_SDK_RESOLVER_SHADOW_ENABLED: () => STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
34
+ resolveStudioBooleanEnvFlag: () => resolveStudioBooleanEnvFlag
35
+ });
36
+
37
+ // src/utils/sdkCutoverPolicy.ts
38
+ var STUDIO_SDK_OPERATION_FAMILIES = [
39
+ "dom",
40
+ "timing",
41
+ "gsap-animation",
42
+ "gsap-keyframe",
43
+ "lifecycle"
44
+ ];
45
+ function resolveEnabledSdkFamilies(env2, masterEnabled) {
46
+ if (!masterEnabled) return /* @__PURE__ */ new Set();
47
+ const raw = env2["VITE_STUDIO_SDK_CUTOVER_FAMILIES"];
48
+ if (typeof raw !== "string" || raw.trim() === "") return new Set(STUDIO_SDK_OPERATION_FAMILIES);
49
+ const requested = raw.split(",").map((family) => family.trim()).filter(Boolean);
50
+ const known = new Set(STUDIO_SDK_OPERATION_FAMILIES);
51
+ const unknown = requested.filter((family) => !known.has(family));
52
+ if (unknown.length > 0) {
53
+ throw new Error(`Unknown Studio SDK cutover families: ${unknown.join(", ")}`);
54
+ }
55
+ return new Set(requested);
56
+ }
57
+ function isSdkFamilyEnabled(masterEnabled, configured, family) {
58
+ return masterEnabled && (configured?.has(family) ?? true);
59
+ }
60
+
61
+ // src/components/editor/manualEditingAvailability.ts
62
+ var TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on", "enabled"]);
63
+ var FALSY_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off", "disabled"]);
64
+ function resolveStudioBooleanEnvFlag(env2, names, fallback) {
65
+ for (const name of names) {
66
+ const value = env2[name];
67
+ if (typeof value === "boolean") return value;
68
+ if (typeof value !== "string") continue;
69
+ const normalized = value.trim().toLowerCase();
70
+ if (!normalized) continue;
71
+ if (TRUTHY_ENV_VALUES.has(normalized)) return true;
72
+ if (FALSY_ENV_VALUES.has(normalized)) return false;
73
+ }
74
+ return fallback;
75
+ }
76
+ var runtimeEnv = typeof window !== "undefined" ? window.__HF_STUDIO_ENV__ ?? {} : {};
77
+ var env = { ...import.meta.env ?? {}, ...runtimeEnv };
78
+ var STUDIO_SDK_CUTOVER_ENABLED = resolveStudioBooleanEnvFlag(
79
+ env,
80
+ ["VITE_STUDIO_SDK_CUTOVER_ENABLED"],
81
+ true
82
+ );
83
+ var STUDIO_SDK_CUTOVER_FAMILIES = resolveEnabledSdkFamilies(
84
+ env,
85
+ STUDIO_SDK_CUTOVER_ENABLED
86
+ );
87
+ var STUDIO_SDK_RESOLVER_SHADOW_ENABLED = resolveStudioBooleanEnvFlag(
88
+ env,
89
+ ["VITE_STUDIO_SDK_RESOLVER_SHADOW_ENABLED"],
90
+ true
91
+ );
92
+ var STUDIO_FLAT_INSPECTOR_ENABLED = resolveStudioBooleanEnvFlag(
93
+ env,
94
+ ["VITE_STUDIO_ENABLE_FLAT_INSPECTOR", "VITE_STUDIO_FLAT_INSPECTOR_ENABLED"],
95
+ true
96
+ );
97
+ var STUDIO_API_SAME_ORIGIN_CREDENTIALS = resolveStudioBooleanEnvFlag(
98
+ env,
99
+ ["VITE_STUDIO_API_SAME_ORIGIN_CREDENTIALS"],
100
+ false
101
+ );
102
+
103
+ // src/utils/studioApiFetch.ts
104
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
105
+ function studioApiCredentials() {
106
+ if (STUDIO_API_SAME_ORIGIN_CREDENTIALS) return "same-origin";
107
+ const host = globalThis.location?.hostname;
108
+ return !host || LOOPBACK_HOSTS.has(host) ? "omit" : "same-origin";
109
+ }
110
+ function studioApiFetch(input, init) {
111
+ return globalThis.fetch(input, { ...init, credentials: studioApiCredentials() });
112
+ }
22
113
 
23
114
  // src/components/editor/probeSourceElement.ts
24
115
  var pending = /* @__PURE__ */ new Map();
25
116
  async function sendBatch(projectId, sourceFile, probes) {
26
117
  let exists = [];
27
118
  try {
28
- const response = await fetch(
119
+ const response = await studioApiFetch(
29
120
  buildProjectApiPath(
30
121
  projectId,
31
122
  `/file-mutations/probe-elements/${encodeURIComponent(sourceFile)}`
@@ -800,6 +891,13 @@ function buildDomEditPatchTarget(selection) {
800
891
  }
801
892
 
802
893
  export {
894
+ isSdkFamilyEnabled,
895
+ STUDIO_SDK_CUTOVER_ENABLED,
896
+ STUDIO_SDK_CUTOVER_FAMILIES,
897
+ STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
898
+ STUDIO_FLAT_INSPECTOR_ENABLED,
899
+ manualEditingAvailability_exports,
900
+ studioApiFetch,
803
901
  isElementComputedVisible,
804
902
  getDomLayerPatchTarget,
805
903
  resolveAllVisualDomEditTargets,
@@ -830,4 +928,4 @@ export {
830
928
  readHfId,
831
929
  buildDomEditPatchTarget
832
930
  };
833
- //# sourceMappingURL=chunk-TXZMMOMA.js.map
931
+ //# sourceMappingURL=chunk-3F47EFCT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/editor/manualEditingAvailability.ts","../src/utils/sdkCutoverPolicy.ts","../src/utils/studioApiFetch.ts","../src/components/editor/probeSourceElement.ts","../src/components/editor/domEditingLayers.ts","../src/components/editor/domEditingGroups.ts","../src/components/editor/domEditingElement.ts","../src/components/editor/domEditingRootLayer.ts","../src/components/editor/domEditLayerWalkCache.ts"],"sourcesContent":["export type StudioFeatureFlagEnv = Record<string, boolean | string | undefined>;\n\nconst TRUTHY_ENV_VALUES = new Set([\"1\", \"true\", \"yes\", \"on\", \"enabled\"]);\nconst FALSY_ENV_VALUES = new Set([\"0\", \"false\", \"no\", \"off\", \"disabled\"]);\n\nexport function resolveStudioBooleanEnvFlag(\n env: StudioFeatureFlagEnv,\n names: string[],\n fallback: boolean,\n): boolean {\n for (const name of names) {\n const value = env[name];\n if (typeof value === \"boolean\") return value;\n if (typeof value !== \"string\") continue;\n\n const normalized = value.trim().toLowerCase();\n if (!normalized) continue;\n if (TRUTHY_ENV_VALUES.has(normalized)) return true;\n if (FALSY_ENV_VALUES.has(normalized)) return false;\n }\n\n return fallback;\n}\n\n// `import.meta.env` is a Vite-only extension. In non-Vite ESM hosts\n// (Next.js / Turbopack, Node, jest in some configs) it's undefined,\n// and downstream `env[name]` reads would crash. Fall back to `{}` so\n// every flag resolves to its declared default outside Vite. Direct\n// property access keeps Vite's compile-time transform happy.\n//\n// When the studio is served as a pre-built SPA by the embedded Hono server,\n// `import.meta.env` values were baked at build time. The server injects\n// `window.__HF_STUDIO_ENV__` with any `VITE_STUDIO_*` env vars from the\n// user's shell, so runtime overrides take precedence over baked defaults.\nconst runtimeEnv =\n typeof window !== \"undefined\"\n ? ((window as Window & { __HF_STUDIO_ENV__?: StudioFeatureFlagEnv }).__HF_STUDIO_ENV__ ?? {})\n : {};\nconst env = { ...(import.meta.env ?? {}), ...runtimeEnv } as StudioFeatureFlagEnv;\n\n// Stage 7 SDK cutover — routes Studio edits through SDK dispatch instead of the\n// server patch/mutation routes. Default TRUE as of the flip release (spec:\n// 2026-09-17-studio-sdk-cutover-flip-design.md). Kill switch:\n// VITE_STUDIO_SDK_CUTOVER_ENABLED=false (works at runtime via __HF_STUDIO_ENV__).\nexport const STUDIO_SDK_CUTOVER_ENABLED = resolveStudioBooleanEnvFlag(\n env,\n [\"VITE_STUDIO_SDK_CUTOVER_ENABLED\"],\n true,\n);\n\n/**\n * Per-family selection. Unset = every family (the master alone enables all).\n * Set `VITE_STUDIO_SDK_CUTOVER_FAMILIES=dom,timing` to RESTRICT to a subset.\n */\nexport const STUDIO_SDK_CUTOVER_FAMILIES = resolveEnabledSdkFamilies(\n env,\n STUDIO_SDK_CUTOVER_ENABLED,\n);\n\n// Resolver-parity tripwire (telemetry-only, decoupled from cutover).\n// Runs the SDK resolver alongside any edit and emits sdk_resolver_shadow on\n// divergence. Default true; disable via VITE_STUDIO_SDK_RESOLVER_SHADOW_ENABLED=false.\n// Soak gate: retire once zero element_not_found divergences over a clean window.\nexport const STUDIO_SDK_RESOLVER_SHADOW_ENABLED = resolveStudioBooleanEnvFlag(\n env,\n [\"VITE_STUDIO_SDK_RESOLVER_SHADOW_ENABLED\"],\n true,\n);\n\n// Studio inspector redesign (\"Ledger, flat\" — design_handoff_studio_inspector):\n// flat identity header/footer/groups. Default true as of v0.7.59+ bug-fix pass\n// (right-aligned values, Stroke select-only, promote-badge overlap, Layout/\n// Style section gating); disable via VITE_STUDIO_FLAT_INSPECTOR_ENABLED=false\n// to fall back to the legacy panel.\nexport const STUDIO_FLAT_INSPECTOR_ENABLED = resolveStudioBooleanEnvFlag(\n env,\n [\"VITE_STUDIO_ENABLE_FLAT_INSPECTOR\", \"VITE_STUDIO_FLAT_INSPECTOR_ENABLED\"],\n true,\n);\n\n// A host whose mounted API authenticates with same-origin cookies sets this; studioApiFetch then sends them, and its\n// requests share the preview media's sockets again.\nexport const STUDIO_API_SAME_ORIGIN_CREDENTIALS = resolveStudioBooleanEnvFlag(\n env,\n [\"VITE_STUDIO_API_SAME_ORIGIN_CREDENTIALS\"],\n false,\n);\n\nimport { resolveEnabledSdkFamilies } from \"../../utils/sdkCutoverPolicy\";\n","export const STUDIO_SDK_OPERATION_FAMILIES = [\n \"dom\",\n \"timing\",\n \"gsap-animation\",\n \"gsap-keyframe\",\n \"lifecycle\",\n] as const;\n\nexport type StudioSdkOperationFamily = (typeof STUDIO_SDK_OPERATION_FAMILIES)[number];\n\ninterface StudioSdkFamilyStatus {\n owner: string;\n deadline: string;\n parityEvidence: string;\n graduated: boolean;\n}\n\nconst STUDIO_SDK_FAMILY_STATUS = {\n dom: {\n owner: \"studio-foundations\",\n deadline: \"2026-09-30\",\n parityEvidence: \"sdkCutoverParity.test.ts\",\n graduated: false,\n },\n timing: {\n owner: \"studio-foundations\",\n deadline: \"2026-10-15\",\n parityEvidence: \"sdkCutover.test.ts timing corpus\",\n graduated: false,\n },\n \"gsap-animation\": {\n owner: \"studio-foundations\",\n deadline: \"2026-10-31\",\n parityEvidence: \"sdkCutover.test.ts GSAP animation corpus\",\n graduated: false,\n },\n \"gsap-keyframe\": {\n owner: \"studio-foundations\",\n deadline: \"2026-11-15\",\n parityEvidence: \"sdkCutover.test.ts GSAP keyframe corpus\",\n graduated: false,\n },\n lifecycle: {\n owner: \"studio-foundations\",\n deadline: \"2026-11-30\",\n parityEvidence: \"sdkCutover.test.ts lifecycle corpus\",\n graduated: false,\n },\n} as const satisfies Record<StudioSdkOperationFamily, StudioSdkFamilyStatus>;\n\nexport function resolveEnabledSdkFamilies(\n env: Record<string, boolean | string | undefined>,\n masterEnabled: boolean,\n): ReadonlySet<StudioSdkOperationFamily> {\n if (!masterEnabled) return new Set();\n const raw = env[\"VITE_STUDIO_SDK_CUTOVER_FAMILIES\"];\n // Unset/blank = every family. The list exists to RESTRICT (kill switch per family).\n if (typeof raw !== \"string\" || raw.trim() === \"\") return new Set(STUDIO_SDK_OPERATION_FAMILIES);\n const requested = raw\n .split(\",\")\n .map((family) => family.trim())\n .filter(Boolean);\n const known = new Set<string>(STUDIO_SDK_OPERATION_FAMILIES);\n const unknown = requested.filter((family) => !known.has(family));\n if (unknown.length > 0) {\n throw new Error(`Unknown Studio SDK cutover families: ${unknown.join(\", \")}`);\n }\n return new Set(requested as StudioSdkOperationFamily[]);\n}\n\nexport function isSdkFamilyEnabled(\n masterEnabled: boolean,\n configured: ReadonlySet<StudioSdkOperationFamily> | undefined,\n family: StudioSdkOperationFamily,\n): boolean {\n // `undefined` preserves compatibility for isolated tests/embedders that mock\n // only the historical master flag. Production always supplies an explicit set.\n return masterEnabled && (configured?.has(family) ?? true);\n}\n\nexport function renderStudioSdkCutoverReport(): string {\n const rows = STUDIO_SDK_OPERATION_FAMILIES.map((family) => {\n const status = STUDIO_SDK_FAMILY_STATUS[family];\n return `| ${family} | ${status.owner} | ${status.deadline} | ${status.parityEvidence} | ${status.graduated ? \"yes\" : \"no\"} |`;\n });\n return [\n \"# Studio SDK cutover report\",\n \"\",\n \"Default: SDK persist ON for every family. Kill switches:\",\n \" `VITE_STUDIO_SDK_CUTOVER_ENABLED=false` (all families → server path)\",\n \" `VITE_STUDIO_SDK_CUTOVER_FAMILIES=dom,timing` (only listed families → SDK; rest → server)\",\n \"\",\n \"A family graduates only after zero unexplained resolver/serialization divergences over its agreed corpus and soak window.\",\n \"\",\n \"| Family | Owner | Deadline | Parity evidence | Graduated |\",\n \"| --- | --- | --- | --- | --- |\",\n ...rows,\n \"\",\n ].join(\"\\n\");\n}\n","import { STUDIO_API_SAME_ORIGIN_CREDENTIALS } from \"../components/editor/manualEditingAvailability\";\n\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\"]);\n\nfunction studioApiCredentials(): RequestCredentials {\n if (STUDIO_API_SAME_ORIGIN_CREDENTIALS) return \"same-origin\";\n const host = globalThis.location?.hostname;\n return !host || LOOPBACK_HOSTS.has(host) ? \"omit\" : \"same-origin\";\n}\n\nexport function studioApiFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> {\n return globalThis.fetch(input, { ...init, credentials: studioApiCredentials() });\n}\n","import { buildProjectApiPath } from \"../../utils/projectRouting\";\nimport { studioApiFetch } from \"../../utils/studioApiFetch\";\n\ntype ProbeTarget = { id?: string; hfId?: string; selector?: string; selectorIndex?: number };\n\ninterface PendingProbe {\n target: ProbeTarget;\n resolve: (exists: boolean) => void;\n}\n\nconst pending = new Map<string, PendingProbe[]>();\n\nasync function sendBatch(projectId: string, sourceFile: string, probes: PendingProbe[]) {\n let exists: boolean[] = [];\n try {\n const response = await studioApiFetch(\n buildProjectApiPath(\n projectId,\n `/file-mutations/probe-elements/${encodeURIComponent(sourceFile)}`,\n ),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ targets: probes.map((probe) => probe.target) }),\n },\n );\n if (response.ok) {\n const data = await response.json();\n if (Array.isArray(data?.exists)) exists = data.exists;\n }\n } catch {}\n probes.forEach((probe, index) => probe.resolve(exists[index] !== false));\n}\n\nexport function probeSourceElement(\n projectId: string,\n sourceFile: string,\n target: ProbeTarget,\n): Promise<boolean> {\n return new Promise((resolve) => {\n const key = `${projectId}\\0${sourceFile}`;\n let probes = pending.get(key);\n if (!probes) {\n const batch: PendingProbe[] = [];\n probes = batch;\n pending.set(key, batch);\n setTimeout(() => {\n pending.delete(key);\n void sendBatch(projectId, sourceFile, batch);\n }, 0);\n }\n probes.push({ target, resolve });\n });\n}\n","import { probeSourceElement } from \"./probeSourceElement\";\nimport { isAudibleVideoNode } from \"../../player/lib/timelineElementHelpers\";\nimport type { PatchOperation } from \"../../utils/sourcePatcher\";\nimport {\n resolveEditingAffordances,\n resolveEditingSections,\n type EditableElementFacts,\n} from \"@hyperframes/core/editing\";\nimport { groupScopedLayerRoots, resolveGroupCapture } from \"./domEditingGroups\";\nimport type {\n DomEditCapabilities,\n DomEditContextOptions,\n DomEditLayerItem,\n DomEditSelection,\n DomEditTextField,\n} from \"./domEditingTypes\";\nimport {\n buildElementLabel,\n buildStableSelector,\n findClosestByAttribute,\n getCuratedComputedStyles,\n getDataAttributes,\n getInlineStyles,\n getSelectorIndex,\n getSourceFileForElement,\n isEditableTextLeaf,\n isHtmlElement,\n} from \"./domEditingDom\";\nimport {\n findElementForSelection,\n getSelectionCandidate,\n isDomLayerElement,\n} from \"./domEditingElement\";\nimport { isCompositionRootLayer } from \"./domEditingRootLayer\";\nimport { withSelectorIndexPass } from \"../../utils/sourceScopedSelectorIndex\";\nimport { type DomEditLayerWalkCache, readDomEditLayerWalkEntry } from \"./domEditLayerWalkCache\";\n\nfunction sameTagChildIndex(el: HTMLElement): number {\n let index = 0;\n let sibling = el.previousElementSibling;\n while (sibling) {\n if (sibling.tagName === el.tagName) index += 1;\n sibling = sibling.previousElementSibling;\n }\n return index;\n}\n\nfunction getTextFieldLabel(\n _tagName: string,\n index: number,\n total: number,\n source: \"self\" | \"child\",\n): string {\n if (source === \"self\" || total === 1) return \"Content\";\n return `Text ${index + 1}`;\n}\n\nfunction buildTextField(\n el: HTMLElement,\n index: number,\n total: number,\n source: \"self\" | \"child\",\n sourceChildIndex?: number,\n): DomEditTextField {\n const tagName = el.tagName.toLowerCase();\n const key = el.getAttribute(\"data-hf-text-key\") ?? `${source}:${index}:${tagName}`;\n return {\n key,\n label: getTextFieldLabel(tagName, index, total, source),\n value: el.textContent ?? \"\",\n tagName,\n attributes: Array.from(el.attributes)\n .filter((attribute) => attribute.name !== \"style\")\n .map((attribute) => ({\n name: attribute.name,\n value: attribute.value,\n })),\n inlineStyles: getInlineStyles(el),\n computedStyles: getCuratedComputedStyles(el),\n source,\n ...(sourceChildIndex == null ? {} : { sourceChildIndex }),\n };\n}\n\n// fallow-ignore-next-line complexity\nexport function collectDomEditTextFields(el: HTMLElement): DomEditTextField[] {\n const childElements = Array.from(el.children).filter(isHtmlElement).filter(isEditableTextLeaf);\n\n if (childElements.length > 0) {\n const hasMixedContent = Array.from(el.childNodes).some(\n (node) => node.nodeType === 3 && node.textContent?.trim(),\n );\n\n if (hasMixedContent) {\n const fields: DomEditTextField[] = [];\n let childIdx = 0;\n for (const node of el.childNodes) {\n if (node.nodeType === 3) {\n const text = node.textContent ?? \"\";\n if (!text.trim()) continue;\n fields.push({\n key: `text-node:${childIdx}`,\n label: `Text ${childIdx + 1}`,\n value: text,\n tagName: \"#text\",\n attributes: [],\n inlineStyles: {},\n computedStyles: {},\n source: \"text-node\",\n });\n childIdx++;\n } else if (isHtmlElement(node) && isEditableTextLeaf(node)) {\n fields.push(\n buildTextField(node, childIdx, childElements.length, \"child\", sameTagChildIndex(node)),\n );\n childIdx++;\n }\n }\n return fields;\n }\n\n return childElements.map((child, index) =>\n buildTextField(child, index, childElements.length, \"child\", sameTagChildIndex(child)),\n );\n }\n\n if (isEditableTextLeaf(el)) {\n return [buildTextField(el, 0, 1, \"self\")];\n }\n\n return [];\n}\n\nfunction escapeHtmlText(value: string): string {\n return value.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\n\nfunction serializeTextFieldStyle(field: DomEditTextField): string {\n const entries = Object.entries(field.inlineStyles).filter(([, value]) => Boolean(value));\n if (entries.length === 0) return \"\";\n return entries.map(([key, value]) => `${key}: ${value}`).join(\"; \");\n}\n\nexport function serializeDomEditTextFields(fields: DomEditTextField[]): string {\n return fields\n .filter((field) => field.source === \"child\" || field.source === \"text-node\")\n .map((field) => {\n if (field.source === \"text-node\") {\n return escapeHtmlText(field.value);\n }\n const attrs = [\n ...field.attributes.filter((attribute) => attribute.name !== \"data-hf-text-key\"),\n { name: \"data-hf-text-key\", value: field.key },\n ]\n .map((attribute) => ` ${attribute.name}=\"${attribute.value.replace(/\"/g, \"&quot;\")}\"`)\n .join(\"\");\n const style = serializeTextFieldStyle(field);\n const styleAttr = style ? ` style=\"${style.replace(/\"/g, \"&quot;\")}\"` : \"\";\n return `<${field.tagName}${attrs}${styleAttr}>${escapeHtmlText(field.value)}</${field.tagName}>`;\n })\n .join(\"\");\n}\n\nexport function buildDefaultDomEditTextField(base?: Partial<DomEditTextField>): DomEditTextField {\n return {\n key: `child:new:${Date.now()}`,\n label: \"Text\",\n value: \"New text\",\n tagName: \"span\",\n attributes: [],\n inlineStyles: {\n \"font-family\": base?.computedStyles?.[\"font-family\"] ?? \"inherit\",\n \"font-size\": base?.computedStyles?.[\"font-size\"] ?? \"16px\",\n \"font-weight\": base?.computedStyles?.[\"font-weight\"] ?? \"400\",\n color: base?.computedStyles?.color ?? \"inherit\",\n },\n computedStyles: {},\n source: \"child\",\n };\n}\n\nexport interface DomEditChildLocator {\n childSelector: string;\n childIndex: number;\n}\n\nexport function buildTextFieldChildLocator(\n fields: DomEditTextField[],\n fieldKey: string,\n): DomEditChildLocator | null {\n const field = fields.find((candidate) => candidate.key === fieldKey);\n if (!field || field.source !== \"child\") return null;\n // sourceChildIndex is only absent for a synthetic field that was never read\n // back from the live DOM (e.g. one built by buildDefaultDomEditTextField).\n // Guessing its position by counting same-tag \"child\" fields elsewhere in\n // the array is unreliable and can silently locate the wrong element — fail\n // closed instead so the caller falls back to the unsupported-structure path.\n if (field.sourceChildIndex == null) return null;\n\n return {\n childSelector: `:scope > ${field.tagName}`,\n childIndex: field.sourceChildIndex,\n };\n}\n\nfunction capabilityFacts(geometry: {\n hasStableTarget: boolean;\n tag: string;\n inlineStyles: Record<string, string>;\n computedStyles: Record<string, string>;\n isCompositionHost: boolean;\n isCompositionRoot: boolean;\n isInsideLockedComposition: boolean;\n isMasterView: boolean;\n existsInSource: boolean;\n}): EditableElementFacts {\n return {\n ...geometry,\n hasEditableText: false,\n hasTimingStart: false,\n animationCount: 0,\n };\n}\n\n/**\n * Build core EditableElementFacts from a fully-resolved DomEditSelection.\n * `animationCount` is supplied by the caller because live GSAP tweens arrive on\n * a separate channel (the PropertyPanel `gsapAnimations` prop), not on the\n * selection — `selection.gsapAnimations` is never populated.\n */\nexport function domEditSelectionToFacts(\n selection: DomEditSelection,\n animationCount = selection.gsapAnimations?.length ?? 0,\n): EditableElementFacts {\n return {\n hasStableTarget: Boolean(selection.selector || selection.hfId),\n tag: selection.tagName,\n inlineStyles: selection.inlineStyles,\n computedStyles: selection.computedStyles,\n isCompositionHost: selection.isCompositionHost,\n isCompositionRoot: false,\n isInsideLockedComposition: selection.isInsideLockedComposition,\n isMasterView: false,\n existsInSource: true,\n hasEditableText: selection.textFields.length > 0,\n hasTimingStart: selection.dataAttributes.start != null,\n animationCount,\n hasAudio: isAudibleVideoNode(selection.element),\n };\n}\n\n/**\n * Resolve DOM edit capabilities for a given element.\n * Thin wrapper over core resolveEditingAffordances — kept for backward\n * compatibility (tests and the barrel import this signature directly).\n */\nexport function resolveDomEditCapabilities(args: {\n selector?: string;\n hfId?: string;\n tagName?: string;\n inlineStyles: Record<string, string>;\n computedStyles: Record<string, string>;\n isCompositionHost: boolean;\n isCompositionRoot?: boolean;\n isInsideLockedComposition: boolean;\n isMasterView: boolean;\n existsInSource?: boolean;\n}): DomEditCapabilities {\n return resolveEditingAffordances(\n capabilityFacts({\n hasStableTarget: Boolean(args.selector || args.hfId),\n tag: (args.tagName ?? \"div\").toLowerCase(),\n inlineStyles: args.inlineStyles,\n computedStyles: args.computedStyles,\n isCompositionHost: args.isCompositionHost,\n isCompositionRoot: args.isCompositionRoot ?? false,\n isInsideLockedComposition: args.isInsideLockedComposition ?? false,\n isMasterView: args.isMasterView,\n existsInSource: args.existsInSource ?? true,\n }),\n ).capabilities;\n}\n\n// fallow-ignore-next-line complexity\nexport async function resolveDomEditSelection(\n startEl: HTMLElement | null,\n options: DomEditContextOptions & {\n projectId?: string | null;\n skipSourceProbe?: boolean;\n exactTarget?: boolean;\n },\n): Promise<DomEditSelection | null> {\n if (!startEl) return null;\n const doc = startEl.ownerDocument;\n\n let capture = options.exactTarget\n ? ({ kind: \"unit\", element: startEl } as const)\n : resolveGroupCapture(startEl, options.activeGroupElement ?? null);\n if (capture.kind === \"out-of-scope\") {\n // Drill-in is non-sticky: clicking/hovering OUTSIDE the drilled-into group\n // exits it and resolves the target normally, rather than selecting nothing\n // (which felt like \"can't select anything\" once you'd drilled in).\n capture = resolveGroupCapture(startEl, null);\n }\n let current: HTMLElement | null =\n capture.kind === \"unit\" ? capture.element : getSelectionCandidate(startEl, options);\n while (current && current !== doc.body && current !== doc.documentElement) {\n const selector = buildStableSelector(current);\n const hfId = readHfId(current);\n if (!selector && !hfId) {\n current = current.parentElement;\n continue;\n }\n\n const { sourceFile, compositionPath } = getSourceFileForElement(\n current,\n options.activeCompositionPath,\n );\n const selectorIndex = selector\n ? getSelectorIndex(doc, current, selector, sourceFile, options.activeCompositionPath)\n : undefined;\n const compositionSrc =\n current.getAttribute(\"data-composition-src\") ??\n current.getAttribute(\"data-composition-file\") ??\n undefined;\n const inlineStyles = getInlineStyles(current);\n const computedStyles = getCuratedComputedStyles(current);\n const isCompositionRoot =\n (current.hasAttribute(\"data-composition-id\") && !compositionSrc) ||\n isCompositionRootLayer(current, doc, computedStyles);\n const textFields = collectDomEditTextFields(current);\n const isInsideLocked = Boolean(findClosestByAttribute(current, [\"data-timeline-locked\"]));\n let existsInSource: boolean | undefined;\n if (!options.skipSourceProbe && options.projectId && (current.id || selector || hfId)) {\n const probeTarget: { id?: string; hfId?: string; selector?: string; selectorIndex?: number } =\n {};\n if (current.id) probeTarget.id = current.id;\n if (hfId) probeTarget.hfId = hfId;\n if (selector) probeTarget.selector = selector;\n if (selectorIndex != null) probeTarget.selectorIndex = selectorIndex;\n existsInSource = await probeSourceElement(options.projectId, sourceFile, probeTarget);\n }\n const capabilities = resolveEditingAffordances(\n capabilityFacts({\n hasStableTarget: Boolean(selector || hfId),\n tag: current.tagName.toLowerCase(),\n inlineStyles,\n computedStyles,\n isCompositionHost: Boolean(compositionSrc),\n isCompositionRoot,\n isInsideLockedComposition: isInsideLocked,\n isMasterView: options.isMasterView,\n existsInSource: existsInSource ?? true,\n }),\n ).capabilities;\n const rect = current.getBoundingClientRect();\n\n return {\n element: current,\n id: current.id || undefined,\n hfId,\n selector,\n selectorIndex,\n sourceFile,\n compositionPath,\n compositionSrc,\n isCompositionHost: Boolean(compositionSrc),\n isInsideLockedComposition: isInsideLocked,\n label: buildElementLabel(current),\n tagName: current.tagName.toLowerCase(),\n boundingBox: {\n x: rect.left,\n y: rect.top,\n width: rect.width,\n height: rect.height,\n },\n textContent: current.textContent?.trim() || null,\n dataAttributes: getDataAttributes(current),\n inlineStyles,\n computedStyles,\n textFields,\n capabilities,\n };\n }\n\n return null;\n}\n\nexport async function refreshDomEditSelection(\n selection: DomEditSelection,\n activeCompositionPath: string | null,\n): Promise<DomEditSelection | null> {\n const doc = selection.element.ownerDocument;\n const nextElement = findElementForSelection(doc, selection, activeCompositionPath);\n return nextElement\n ? resolveDomEditSelection(nextElement, {\n activeCompositionPath,\n isMasterView: !activeCompositionPath || activeCompositionPath === \"index.html\",\n })\n : null;\n}\n\n// ─── Layer items ─────────────────────────────────────────────────────────────\n\nexport function getDomEditLayerKey(\n target: Pick<DomEditSelection, \"id\" | \"selector\" | \"selectorIndex\" | \"sourceFile\">,\n): string {\n const selectorIndex = target.selectorIndex ?? 0;\n return `${target.sourceFile}:${target.id ?? target.selector ?? \"layer\"}:${selectorIndex}`;\n}\n\nexport function countDomEditChildLayers(\n root: HTMLElement | null | undefined,\n options: DomEditContextOptions,\n maxCount = 99,\n): number {\n if (!root) return 0;\n\n let count = 0;\n const visit = (el: HTMLElement) => {\n for (const child of Array.from(el.children)) {\n if (!isHtmlElement(child)) continue;\n if (isDomLayerElement(child)) {\n count += 1;\n if (count >= maxCount) return;\n }\n visit(child);\n if (count >= maxCount) return;\n }\n };\n\n visit(root);\n return count;\n}\n\n// Every editable element under `root`, in document order. `maxItems` is a\n// caller's rendering budget, not a property of the document: hit-testing\n// callers (marquee, off-canvas indicators) must see all of it, and sharing a\n// truncated list left everything past the cut unselectable however far you drag.\nexport function collectDomEditLayerItems(\n root: HTMLElement | null | undefined,\n options: DomEditContextOptions,\n maxItems = Number.POSITIVE_INFINITY,\n cache?: DomEditLayerWalkCache,\n): DomEditLayerItem[] {\n if (!root) return [];\n cache?.beginWalk(options.activeCompositionPath);\n\n const items: DomEditLayerItem[] = [];\n // fallow-ignore-next-line complexity\n const visit = (el: HTMLElement, depth: number) => {\n if (items.length >= maxItems) return;\n\n const entry = readDomEditLayerWalkEntry(el, options.activeCompositionPath, cache);\n if (entry) {\n const { target } = entry;\n items.push({\n key: getDomEditLayerKey(target),\n element: el,\n label: entry.label,\n tagName: el.tagName.toLowerCase(),\n depth,\n childCount: entry.childCount,\n id: target.id ?? undefined,\n hfId: target.hfId ?? undefined,\n selector: target.selector ?? undefined,\n selectorIndex: target.selectorIndex,\n sourceFile: target.sourceFile,\n });\n }\n\n const nextDepth = entry ? depth + 1 : depth;\n for (const child of Array.from(el.children)) {\n if (!isHtmlElement(child)) continue;\n visit(child, nextDepth);\n if (items.length >= maxItems) return;\n }\n };\n\n // Every item resolves its selector's occurrence index, and unshared that is a\n // whole-document query per element — quadratic once a composition repeats a\n // card or tile class. The walk is one synchronous read of a document it does\n // not mutate, so one index per selector serves the whole of it. The pass lives\n // here rather than in each caller because this function owns the loop.\n withSelectorIndexPass(root.ownerDocument, () => {\n // Drilled into a group → show only its members; otherwise the whole tree.\n for (const el of groupScopedLayerRoots(root, options.activeGroupElement ?? null)) visit(el, 0);\n });\n return items;\n}\n\nexport function liveLayerElement(\n layer: DomEditLayerItem,\n doc: Document | null | undefined,\n activeCompositionPath: string | null,\n): HTMLElement {\n if (layer.element.isConnected || !doc) return layer.element;\n return findElementForSelection(doc, layer, activeCompositionPath) ?? layer.element;\n}\n\n// ─── Patch operations ────────────────────────────────────────────────────────\n\nexport function buildDomEditStylePatchOperation(\n property: string,\n value: string | null,\n childLocator?: DomEditChildLocator,\n): PatchOperation {\n return {\n type: \"inline-style\",\n property,\n value,\n ...childLocator,\n };\n}\n\nexport function buildDomEditTextPatchOperation(\n value: string,\n childLocator?: DomEditChildLocator,\n): PatchOperation {\n return { type: \"text-content\", property: \"text\", value, ...childLocator };\n}\n\n/** Replace an element's contents with markup, for a change no per-child operation\n * can express (a text layer added, removed or reordered). Sanitized at both ends. */\nexport function buildDomEditRichTextPatchOperation(value: string): PatchOperation {\n return { type: \"rich-text\", property: \"\", value };\n}\n\n// ─── Non-editable reason ─────────────────────────────────────────────────────\n\nfunction hasSupportedDirectEdit(capabilities: DomEditCapabilities): boolean {\n return (\n capabilities.canEditStyles ||\n capabilities.canMove ||\n capabilities.canResize ||\n capabilities.canApplyManualOffset ||\n capabilities.canApplyManualSize ||\n capabilities.canApplyManualRotation\n );\n}\n\nexport function getDomEditNonEditableReason(\n element: HTMLElement,\n selection: DomEditSelection | null,\n): string | null {\n if (!selection) {\n return \"No stable source target\";\n }\n\n if (selection.element !== element) {\n return selection.isCompositionHost\n ? \"Nested composition boundary\"\n : `Selection resolves to ${selection.label}`;\n }\n\n if (!hasSupportedDirectEdit(selection.capabilities)) {\n return selection.capabilities.reasonIfDisabled ?? \"No supported direct edits\";\n }\n\n return null;\n}\n\nexport function getDomEditTargetKey(\n selection: Pick<DomEditSelection, \"id\" | \"hfId\" | \"selector\" | \"selectorIndex\" | \"sourceFile\">,\n): string {\n return [\n selection.sourceFile || \"index.html\",\n selection.hfId ?? \"\",\n selection.id ?? \"\",\n selection.selector ?? \"\",\n selection.selectorIndex ?? \"\",\n ].join(\"|\");\n}\n\nexport function isTextEditableSelection(selection: DomEditSelection): boolean {\n return resolveEditingSections(domEditSelectionToFacts(selection)).text;\n}\n\n// buildElementAgentPrompt is in domEditingAgentPrompt.ts\n\nexport function readHfId(element: Element): string | undefined {\n return element.getAttribute(\"data-hf-id\")?.trim() || undefined;\n}\n\nexport function buildDomEditPatchTarget(\n selection: Pick<DomEditSelection, \"id\" | \"hfId\" | \"selector\" | \"selectorIndex\">,\n): { id?: string | null; hfId?: string; selector?: string; selectorIndex?: number } {\n return {\n id: selection.id,\n hfId: selection.hfId,\n selector: selection.selector,\n selectorIndex: selection.selectorIndex,\n };\n}\n","import { isHtmlElement } from \"./domEditingDom\";\n\n// `data-hf-group` selection semantics: a group wrapper is selected as one unit\n// until the user drills into it; once drilled in, clicks resolve to its children\n// (or to the next nested group inside it). One level of drill-in at a time keeps\n// nested groups navigable.\n\nexport type GroupCapture =\n | { kind: \"unit\"; element: HTMLElement } // select this group wrapper as one unit\n | { kind: \"child\" } // resolve the clicked element normally\n | { kind: \"out-of-scope\" }; // clicked outside the drilled-into group → select nothing\n\n// Layer-tree roots: the drilled-into group's element children, else the doc root.\nexport function groupScopedLayerRoots(\n root: HTMLElement,\n activeGroupElement: HTMLElement | null,\n): HTMLElement[] {\n const els = activeGroupElement?.isConnected ? Array.from(activeGroupElement.children) : [root];\n return els.filter(isHtmlElement);\n}\n\nexport function resolveGroupCapture(\n startEl: HTMLElement,\n activeGroupElement: HTMLElement | null,\n): GroupCapture {\n const groups: HTMLElement[] = [];\n for (let n: HTMLElement | null = startEl; n; n = n.parentElement) {\n if (n.hasAttribute(\"data-hf-group\")) groups.push(n);\n }\n const result = ((): GroupCapture => {\n if (!activeGroupElement) {\n const outermost = groups[groups.length - 1];\n return outermost ? { kind: \"unit\", element: outermost } : { kind: \"child\" };\n }\n const idx = groups.indexOf(activeGroupElement);\n if (idx === -1) return { kind: \"out-of-scope\" };\n const nestedInside = groups[idx - 1];\n return nestedInside ? { kind: \"unit\", element: nestedInside } : { kind: \"child\" };\n })();\n return result;\n}\n","/**\n * Element visibility, visual scoring, layer patch targets, element finders,\n * and the `findElementForSelection` / `findElementForTimelineElement` lookups.\n */\nimport type {\n DomEditContextOptions,\n DomEditSelection,\n DomEditViewport,\n TimelineElementDomTarget,\n TimelineElementDomTargetOptions,\n} from \"./domEditingTypes\";\nimport {\n buildStableSelector,\n escapeCssString,\n getSelectorIndex,\n getSourceFileForElement,\n isHtmlElement,\n isElementVisibleThroughAncestors,\n normalizeTimelineCompositionSource,\n querySelectorAllSafely,\n} from \"./domEditingDom\";\n\n// ─── Visibility ──────────────────────────────────────────────────────────────\n\nexport function isElementComputedVisible(\n el: HTMLElement,\n memo?: Map<HTMLElement, boolean>,\n): boolean {\n return isElementVisibleThroughAncestors(el, memo);\n}\n\nconst VISUAL_LEAF_TAGS = new Set([\"img\", \"video\", \"canvas\", \"svg\", \"audio\"]);\n\n// fallow-ignore-next-line complexity\nfunction hasVisualPresence(el: HTMLElement): boolean {\n const win = el.ownerDocument.defaultView;\n if (!win) return false;\n const cs = win.getComputedStyle(el);\n if (cs.backgroundImage !== \"none\") return true;\n if (\n cs.backgroundColor &&\n cs.backgroundColor !== \"transparent\" &&\n cs.backgroundColor !== \"rgba(0, 0, 0, 0)\"\n )\n return true;\n if (cs.borderWidth && parseFloat(cs.borderWidth) > 0 && cs.borderStyle !== \"none\") return true;\n if (cs.boxShadow && cs.boxShadow !== \"none\") return true;\n return false;\n}\n\nfunction isEmptyVisualContainer(el: HTMLElement): boolean {\n const tag = el.tagName.toLowerCase();\n if (VISUAL_LEAF_TAGS.has(tag)) return false;\n if (hasVisualPresence(el)) return false;\n\n const { children } = el;\n if (children.length === 0) {\n return (el.textContent ?? \"\").trim().length === 0;\n }\n\n for (let i = 0; i < children.length; i += 1) {\n const child = children[i];\n if (!isHtmlElement(child)) continue;\n if (VISUAL_LEAF_TAGS.has(child.tagName.toLowerCase())) return false;\n if (isElementComputedVisible(child)) return false;\n }\n\n return true;\n}\n\nfunction hasRenderedBox(el: HTMLElement): boolean {\n const rect = el.getBoundingClientRect();\n if (rect.width <= 1 || rect.height <= 1) return false;\n if (!isElementComputedVisible(el)) return false;\n if (isEmptyVisualContainer(el)) return false;\n return true;\n}\n\n// ─── Visual scoring ──────────────────────────────────────────────────────────\n\n// ─── Layer patch target ──────────────────────────────────────────────────────\n\nconst DOM_LAYER_IGNORED_TAGS = new Set([\n \"base\",\n \"br\",\n \"canvas\",\n \"link\",\n \"meta\",\n \"script\",\n \"source\",\n \"style\",\n \"template\",\n \"track\",\n \"wbr\",\n]);\n\n/**\n * Is the element rendered at all? The half of `getDomLayerPatchTarget` that a\n * plain style write can flip, and the only half that reads computed style.\n * Exported so a caller memoizing a layer walk can give it its own (short)\n * cache lifetime — see `domEditLayerWalkCache`.\n */\nexport function isInspectableLayerElement(el: HTMLElement): boolean {\n const tagName = el.tagName.toLowerCase();\n if (DOM_LAYER_IGNORED_TAGS.has(tagName)) return false;\n\n const computed = el.ownerDocument.defaultView?.getComputedStyle(el);\n if (computed?.display === \"none\" || computed?.visibility === \"hidden\") return false;\n\n return true;\n}\n\n/**\n * How the element is ADDRESSED — its selector, that selector's occurrence index\n * within the source file, and the file itself. Independent of whether the\n * element currently renders, so it survives every style write and moves only\n * when an identity attribute changes or the document's population of elements\n * sharing the selector does.\n */\n/**\n * The selector an element is addressed by, or undefined when it cannot be a\n * layer at all. Sole owner of that rule: `isDomLayerElement` answers the same\n * question without paying for the occurrence index, and a second copy of the\n * conditions would go stale the first time one of them changed.\n */\nfunction resolveLayerSelector(el: HTMLElement): string | undefined {\n if (el.hasAttribute(\"data-composition-id\")) return undefined;\n return buildStableSelector(el);\n}\n\nexport function resolveDomLayerIdentity(\n el: HTMLElement,\n activeCompositionPath: string | null,\n): Pick<DomEditSelection, \"id\" | \"hfId\" | \"selector\" | \"selectorIndex\" | \"sourceFile\"> | null {\n const selector = resolveLayerSelector(el);\n if (!selector) return null;\n\n const { sourceFile } = getSourceFileForElement(el, activeCompositionPath);\n return {\n id: el.id || undefined,\n hfId: el.getAttribute(\"data-hf-id\") || undefined,\n selector,\n selectorIndex: getSelectorIndex(\n el.ownerDocument,\n el,\n selector,\n sourceFile,\n activeCompositionPath,\n ),\n sourceFile,\n };\n}\n\nexport function getDomLayerPatchTarget(\n el: HTMLElement,\n activeCompositionPath: string | null,\n): Pick<DomEditSelection, \"id\" | \"hfId\" | \"selector\" | \"selectorIndex\" | \"sourceFile\"> | null {\n return isInspectableLayerElement(el) ? resolveDomLayerIdentity(el, activeCompositionPath) : null;\n}\n\n/**\n * Is `el` a layer at all? Exactly the condition under which\n * `getDomLayerPatchTarget` returns non-null, for callers that want the yes/no\n * and throw the target away.\n *\n * Worth its own function because the target carries the selector's OCCURRENCE\n * INDEX, and resolving that is a whole-document query — which the yes/no does\n * not depend on. Counting an element's layer children asked for one per child.\n */\nexport function isDomLayerElement(el: HTMLElement): boolean {\n return isInspectableLayerElement(el) && resolveLayerSelector(el) !== undefined;\n}\n\n// ─── Clip ancestor / selection candidate ─────────────────────────────────────\n\nfunction getPreferredClipAncestor(startEl: HTMLElement): HTMLElement | null {\n let current: HTMLElement | null = startEl;\n while (current) {\n if (current.classList.contains(\"clip\")) {\n const isCompositionHost =\n current.hasAttribute(\"data-composition-src\") ||\n current.hasAttribute(\"data-composition-file\");\n if (!isCompositionHost || current === startEl) return current;\n }\n current = current.parentElement;\n }\n return null;\n}\n\nexport function getSelectionCandidate(\n startEl: HTMLElement,\n options: DomEditContextOptions,\n): HTMLElement {\n if (options.preferClipAncestor) {\n const clipAncestor = getPreferredClipAncestor(startEl);\n if (clipAncestor) {\n return clipAncestor;\n }\n }\n\n return startEl;\n}\n\n// ─── Visual target resolution ─────────────────────────────────────────────────\n\nexport function resolveVisualDomEditSelectionTarget(\n elementsFromPoint: Iterable<Element | null | undefined>,\n options: Pick<DomEditContextOptions, \"activeCompositionPath\">,\n): HTMLElement | null {\n const candidates = resolveAllVisualDomEditTargets(elementsFromPoint, options);\n return candidates[0] ?? null;\n}\n\n/**\n * Returns all independently-selectable elements at the given point, in paint\n * order (topmost first). Used for click-cycling through stacked layers.\n *\n * Each entry in the returned array is an independent \"layer\" — an element\n * that is not an ancestor of an earlier entry. This gives one result per\n * z-stacked element rather than one per DOM node.\n */\nexport function resolveAllVisualDomEditTargets(\n elementsFromPoint: Iterable<Element | null | undefined>,\n options: Pick<DomEditContextOptions, \"activeCompositionPath\">,\n): HTMLElement[] {\n const raw: HTMLElement[] = [];\n\n for (const entry of elementsFromPoint) {\n if (!isHtmlElement(entry)) continue;\n if (hasRenderedBox(entry) && getDomLayerPatchTarget(entry, options.activeCompositionPath)) {\n raw.push(entry);\n }\n }\n\n if (raw.length === 0) return [];\n\n // First pass: for each contiguous ancestor-descendant run, keep only the\n // deepest (most specific) element, matching the original single-pick logic.\n const layers: HTMLElement[] = [];\n let best = raw[0];\n for (let i = 1; i < raw.length; i++) {\n const el = raw[i];\n if (best.contains(el)) {\n best = el; // go deeper in this subtree\n } else {\n layers.push(best);\n best = el;\n }\n }\n layers.push(best);\n\n return layers;\n}\n\n// ─── Raster detection ────────────────────────────────────────────────────────\n\nfunction hasRasterBackground(selection: Pick<DomEditSelection, \"computedStyles\">): boolean {\n const backgroundImage = selection.computedStyles[\"background-image\"]?.trim();\n return Boolean(backgroundImage && backgroundImage !== \"none\");\n}\n\nexport function isLargeRasterDomEditSelection(\n selection: Pick<DomEditSelection, \"boundingBox\" | \"computedStyles\" | \"tagName\">,\n viewport?: DomEditViewport | null,\n): boolean {\n const tagName = selection.tagName.toLowerCase();\n const isRasterLike = tagName === \"img\" || hasRasterBackground(selection);\n if (!isRasterLike) return false;\n\n const { width, height } = selection.boundingBox;\n if (width <= 1 || height <= 1) return false;\n if (!viewport || viewport.width <= 1 || viewport.height <= 1) {\n return width >= 960 && height >= 540;\n }\n\n const areaRatio = (width * height) / (viewport.width * viewport.height);\n const widthRatio = width / viewport.width;\n const heightRatio = height / viewport.height;\n return areaRatio >= 0.4 || (widthRatio >= 0.7 && heightRatio >= 0.5);\n}\n\n// ─── Element finders ──────────────────────────────────────────────────────────\n\ntype FindElementSelection = Pick<DomEditSelection, \"id\" | \"hfId\" | \"selector\" | \"selectorIndex\"> & {\n sourceFile?: string;\n};\n\nexport function findElementForSelection(\n doc: Document,\n selection: FindElementSelection,\n activeCompositionPath: string | null = null,\n): HTMLElement | null {\n const sourceMatches = (candidate: Element): candidate is HTMLElement =>\n isHtmlElement(candidate) &&\n (!selection.sourceFile ||\n getSourceFileForElement(candidate, activeCompositionPath).sourceFile ===\n selection.sourceFile);\n const findAll = (selector: string): HTMLElement[] =>\n querySelectorAllSafely(doc, selector).filter(sourceMatches);\n\n if (selection.hfId) {\n const byHfId = findAll(`[data-hf-id=\"${escapeCssString(selection.hfId)}\"]`)[0];\n if (byHfId) return byHfId;\n }\n\n if (selection.id) {\n // Flattened sub-compositions can repeat authored ids. getElementById returns\n // only the first document match, so filter every id match by source first.\n const byId = findAll(`[id=\"${escapeCssString(selection.id)}\"]`)[0];\n if (byId) return byId;\n }\n\n if (!selection.selector) return null;\n return findAll(selection.selector)[selection.selectorIndex ?? 0] ?? null;\n}\n\n// The selected node while mounted, else its copy in the selection's own file (ids repeat across files), else any copy.\nexport function findPreviewNode(\n doc: Document | null | undefined,\n el: DomEditSelection,\n): Element | null {\n if (!doc) return null;\n if (el.element?.isConnected && el.element.ownerDocument === doc) return el.element;\n return (\n findElementForSelection(doc, el) ??\n findElementForSelection(doc, { ...el, sourceFile: undefined })\n );\n}\n\n// fallow-ignore-next-line complexity\nexport function findElementForTimelineElement(\n doc: Document,\n element: TimelineElementDomTarget,\n options: TimelineElementDomTargetOptions,\n): HTMLElement | null {\n const elementId = typeof element.id === \"string\" ? element.id : \"\";\n const compositionSource =\n normalizeTimelineCompositionSource(element.compositionSrc) ??\n options.compIdToSrc?.get(elementId);\n const sourceFile =\n compositionSource ??\n normalizeTimelineCompositionSource(element.sourceFile) ??\n options.activeCompositionPath ??\n \"index.html\";\n const escapedElementId = escapeCssString(elementId);\n const escapedCompositionSource = compositionSource ? escapeCssString(compositionSource) : null;\n const selector =\n element.selector ??\n (compositionSource\n ? `[data-composition-src=\"${escapedCompositionSource}\"],[data-composition-file=\"${escapedCompositionSource}\"],[data-composition-id=\"${escapedElementId}\"]`\n : escapedElementId\n ? `[data-composition-id=\"${escapedElementId}\"]`\n : undefined);\n\n if (selector || element.domId) {\n const targetElement = findElementForSelection(\n doc,\n {\n id: element.domId ?? undefined,\n selector,\n selectorIndex: element.selectorIndex,\n sourceFile,\n },\n options.activeCompositionPath,\n );\n if (targetElement) return targetElement;\n }\n\n const hasExplicitDomTarget = Boolean(element.domId || element.selector || compositionSource);\n if (options.isMasterView || hasExplicitDomTarget || !options.activeCompositionPath) {\n return null;\n }\n\n const root = doc.querySelector(\"[data-composition-id]\");\n if (!isHtmlElement(root)) return null;\n return getSourceFileForElement(root, options.activeCompositionPath).sourceFile === sourceFile\n ? root\n : null;\n}\n\n// ─── Layer children ───────────────────────────────────────────────────────────\n\n/** `el`'s direct children that are layers. No longer takes the context options:\n * layer-ness does not depend on the active composition path. */\nexport function getDirectLayerChildren(el: HTMLElement): HTMLElement[] {\n return Array.from(el.children).filter(\n (child): child is HTMLElement => isHtmlElement(child) && isDomLayerElement(child),\n );\n}\n","import { parsePx } from \"./domEditingDom\";\n\nconst COMPOSITION_ROOT_LAYER_EPSILON_PX = 1;\n\nfunction readPositiveDimension(value: string | null): number | null {\n if (!value) return null;\n const parsed = Number.parseFloat(value);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : null;\n}\n\nfunction approximatelyEqual(a: number, b: number) {\n return Math.abs(a - b) <= COMPOSITION_ROOT_LAYER_EPSILON_PX;\n}\n\nfunction getCompositionRootBounds(doc: Document) {\n const root =\n doc.querySelector<HTMLElement>(\"[data-composition-id]\") ?? doc.documentElement ?? null;\n const rootWidth = readPositiveDimension(root?.getAttribute(\"data-width\") ?? null);\n const rootHeight = readPositiveDimension(root?.getAttribute(\"data-height\") ?? null);\n if (!root || !rootWidth || !rootHeight) return null;\n return { rect: root.getBoundingClientRect(), width: rootWidth, height: rootHeight };\n}\n\nfunction getRenderedLayerSize(element: HTMLElement, computedStyles: Record<string, string>) {\n const rect = element.getBoundingClientRect();\n const width = rect.width || parsePx(computedStyles.width);\n const height = rect.height || parsePx(computedStyles.height);\n return width && height ? { width, height } : null;\n}\n\nfunction matchesCompositionRootBounds(\n elementRect: DOMRect,\n elementSize: { width: number; height: number },\n rootBounds: { rect: DOMRect; width: number; height: number },\n) {\n return (\n approximatelyEqual(elementRect.left, rootBounds.rect.left) &&\n approximatelyEqual(elementRect.top, rootBounds.rect.top) &&\n approximatelyEqual(elementSize.width, rootBounds.width) &&\n approximatelyEqual(elementSize.height, rootBounds.height)\n );\n}\n\nfunction isExplicitFullBleedLayer(computedStyles: Record<string, string>) {\n return computedStyles.position === \"absolute\" || computedStyles.position === \"fixed\";\n}\n\nexport function isCompositionRootLayer(\n element: HTMLElement,\n doc: Document,\n computedStyles: Record<string, string>,\n) {\n if (element.parentElement !== doc.body) return false;\n if (element.hasAttribute(\"data-hf-allow-root-edit\")) return false;\n if (isExplicitFullBleedLayer(computedStyles)) return false;\n\n const rootBounds = getCompositionRootBounds(doc);\n const elementSize = getRenderedLayerSize(element, computedStyles);\n return Boolean(\n rootBounds &&\n elementSize &&\n matchesCompositionRootBounds(element.getBoundingClientRect(), elementSize, rootBounds),\n );\n}\n","/**\n * Incremental memory for `collectDomEditLayerItems`.\n *\n * The layer walk is re-run from scratch every time a MutationObserver says the\n * preview changed, and the observer's loudest source is inline `style` — which\n * is exactly what animation writes. So a paused-looking editor re-derived every\n * element's patch target, label and child count several times a second, and each\n * derivation costs two `getComputedStyle` reads (its own plus one per direct\n * child), two ancestor walks for the source file, and a `textContent` read whose\n * cost is the element's whole subtree.\n *\n * None of that depends on the traversal — only on the element. So the traversal\n * stays live (it is pointer-chasing, and `depth` genuinely is positional) and the\n * per-element half is memoized, with the mutation records deciding what to drop.\n *\n * WHAT MAKES A CACHED ENTRY WRONG, and how each is caught:\n *\n * - the element's own attributes (`style` -> computed display, `class`/`id`/\n * `data-hf-group` -> selector and label) -> attribute record on it\n * - an ancestor's `visibility`, the ONLY inherited input to the\n * display/visibility gate (`display:none` on an ancestor does not change a\n * descendant's own computed `display`) -> attribute record on the\n * ancestor, whose subtree is\n * dropped only when the\n * style declares visibility\n * - a direct child appearing or disappearing from the layer list, which moves\n * the parent's `childCount` -> the parent is dropped\n * alongside every element\n * - descendant text, which moves an ancestor's label -> characterData record,\n * ancestors dropped\n * - selector occurrence indices, which shift for EVERY element sharing a\n * selector when one element's identity changes -> whole cache dropped\n * - nodes added or removed, which shift indices, order, labels and counts at\n * once and cannot be attributed to one element -> whole cache dropped\n * - a different active composition path, or a new composition-id -> source-file\n * map, both of which re-scope every source file -> checked per walk\n *\n * The bias is deliberate and matches the duration cache in the runtime: a\n * redundant recomputation is a missed optimisation, a missed one is a wrong\n * layer tree.\n */\n\nimport { buildElementLabel, getCompositionSourceMapRevision, isHtmlElement } from \"./domEditingDom\";\nimport {\n getDirectLayerChildren,\n isInspectableLayerElement,\n resolveDomLayerIdentity,\n} from \"./domEditingElement\";\nimport type { DomEditSelection } from \"./domEditingTypes\";\n\n/** How an element is addressed. Survives style writes; see `readIdentity`. */\nexport type DomEditLayerIdentity = Pick<\n DomEditSelection,\n \"id\" | \"hfId\" | \"selector\" | \"selectorIndex\" | \"sourceFile\"\n>;\n\n/** Whether the element renders, and how many of its direct children are layers.\n * Both are computed style reads, and both a style write can flip. Filled\n * lazily: `childCount` is only asked for once an element is known to be one. */\ninterface PresenceMemo {\n inspectable?: boolean;\n childCount?: number;\n}\n\ninterface IdentityMemo {\n identity?: DomEditLayerIdentity | null;\n label?: string;\n}\n\n/**\n * Attributes that decide an element's SELECTOR, and therefore the occurrence\n * index of every other element sharing that selector. One of these changing\n * renumbers elements the record does not mention, so the only sound response is\n * to drop everything. `class` is here because `buildStableSelector` falls back\n * to the preferred class.\n */\nconst SELECTOR_IDENTITY_ATTRIBUTES = new Set([\n \"id\",\n \"class\",\n \"data-hf-group\",\n \"data-composition-id\",\n \"data-composition-file\",\n \"data-composition-src\",\n \"data-hf-original-composition-id\",\n]);\n\n/**\n * The observer configuration the cache's invalidation is written against.\n * Exported so the refresh loop and the tests cannot drift from it.\n *\n * No `attributeFilter`: an unlisted attribute is one the cache would never learn\n * about, and serving a stale entry is worse than the extra records.\n */\nexport const DOM_EDIT_LAYER_OBSERVER_INIT: MutationObserverInit = {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n};\n\n/**\n * The inline `visibility` each element last presented. Deliberately NOT cleared\n * by `invalidateAll`: it records what the DOM said, not a value derived from it.\n */\nconst lastInlineVisibility = new WeakMap<HTMLElement, string>();\n\n/**\n * Did this style write move the element's inline `visibility`?\n *\n * `visibility` is inherited, so changing it changes the layer-list membership of\n * the element's whole subtree, and only then is the subtree worth dropping.\n *\n * The comparison is on the PARSED value, remembered per element. Testing the\n * attribute TEXT for \"visibility\" looks equivalent and is not: the standard\n * GSAP fade (`autoAlpha`) writes `visibility: visible` once and leaves it in the\n * attribute for the rest of the clip, so a text test stays true for every\n * transform tick afterwards. That is a whole-subtree walk per animation frame,\n * in the observer callback rather than behind the rebuild throttle, on exactly\n * the elements a composition animates most.\n *\n * An element seen for the first time reports changed, which costs one drop and\n * is the safe answer: its entries were derived before this write.\n */\nfunction inlineVisibilityChanged(el: HTMLElement): boolean {\n const next = el.style.visibility;\n if (lastInlineVisibility.get(el) === next) return false;\n lastInlineVisibility.set(el, next);\n return true;\n}\n\nexport interface DomEditLayerWalkCache {\n /**\n * Start a walk. Drops everything when the scoping inputs the entries were\n * built under no longer hold. Call once per `collectDomEditLayerItems`.\n */\n beginWalk(activeCompositionPath: string | null): void;\n /**\n * Does `el` render? Cheap to invalidate and invalidated often: any attribute\n * write on the element, on its parent, or a `visibility` write on an ancestor\n * drops it, because all three can flip the answer.\n */\n readInspectable(el: HTMLElement, compute: () => boolean): boolean;\n /** How many of `el`'s direct children are layers. Same lifetime as\n * `readInspectable`: it is a sum over their answers. */\n readChildCount(el: HTMLElement, compute: () => number): number;\n /**\n * `el`'s selector, occurrence index and source file. A SEPARATE, much longer\n * lifetime than presence: a style write cannot renumber a selector, so this\n * survives one, and it is the only part of the walk that queries the\n * document. That split is what makes an ordinary animation frame cost no\n * document queries at all.\n */\n readIdentity(\n el: HTMLElement,\n compute: () => DomEditLayerIdentity | null,\n ): DomEditLayerIdentity | null;\n /** `el`'s display label. Shares the identity lifetime, plus descendant text. */\n readLabel(el: HTMLElement, compute: () => string): string;\n /** Apply mutation records. Safe to call with an empty array. */\n ingest(records: MutationRecord[]): void;\n /** Forget every entry — the fallback for anything not attributable. */\n invalidateAll(): void;\n}\n\nexport function createDomEditLayerWalkCache(): DomEditLayerWalkCache {\n let presence = new WeakMap<HTMLElement, PresenceMemo>();\n let identities = new WeakMap<HTMLElement, IdentityMemo>();\n let scope: string | null = null;\n\n const invalidateAll = () => {\n presence = new WeakMap();\n identities = new WeakMap();\n };\n\n const drop = (el: HTMLElement | null) => {\n if (el) presence.delete(el);\n };\n\n const dropSubtree = (el: HTMLElement) => {\n for (const descendant of el.querySelectorAll(\"*\")) {\n if (isHtmlElement(descendant)) presence.delete(descendant);\n }\n };\n\n const ingestOne = (record: MutationRecord): boolean => {\n // Structural change: order, occurrence indices, labels and child counts all\n // move at once, and the record names the parent rather than everything\n // affected. This is the documented full-rebuild fallback.\n if (record.type === \"childList\") return false;\n\n if (record.type === \"characterData\") {\n // `buildElementLabel` falls back to `textContent`, so edited text changes\n // the label of every ancestor that contains it.\n for (\n let ancestor = record.target.parentElement;\n ancestor;\n ancestor = ancestor.parentElement\n ) {\n identities.delete(ancestor);\n }\n return true;\n }\n\n const target = record.target;\n if (!isHtmlElement(target)) return true;\n if (record.attributeName && SELECTOR_IDENTITY_ATTRIBUTES.has(record.attributeName))\n return false;\n\n drop(target);\n // The parent counts its layer children, and this element may have just\n // joined or left that count.\n drop(target.parentElement);\n if (record.attributeName === \"style\" && inlineVisibilityChanged(target)) dropSubtree(target);\n return true;\n };\n\n return {\n beginWalk(activeCompositionPath) {\n const nextScope = `${activeCompositionPath ?? \"\"}|${getCompositionSourceMapRevision()}`;\n if (nextScope === scope) return;\n scope = nextScope;\n invalidateAll();\n },\n readInspectable(el, compute) {\n const memo = presence.get(el) ?? {};\n if (memo.inspectable === undefined) {\n memo.inspectable = compute();\n presence.set(el, memo);\n }\n return memo.inspectable;\n },\n readChildCount(el, compute) {\n const memo = presence.get(el) ?? {};\n if (memo.childCount === undefined) {\n memo.childCount = compute();\n presence.set(el, memo);\n }\n return memo.childCount;\n },\n readIdentity(el, compute) {\n const memo = identities.get(el) ?? {};\n if (memo.identity === undefined) {\n memo.identity = compute();\n identities.set(el, memo);\n }\n return memo.identity;\n },\n readLabel(el, compute) {\n const memo = identities.get(el) ?? {};\n if (memo.label === undefined) {\n memo.label = compute();\n identities.set(el, memo);\n }\n return memo.label;\n },\n ingest(records) {\n for (const record of records) {\n if (!ingestOne(record)) {\n invalidateAll();\n return;\n }\n }\n },\n invalidateAll,\n };\n}\n\n/** One element's contribution to a layer walk. `depth` is absent on purpose: it\n * belongs to the traversal, not to the element. */\nexport interface DomEditLayerWalkEntry {\n target: DomEditLayerIdentity;\n label: string;\n childCount: number;\n}\n\n/**\n * Everything `collectDomEditLayerItems` needs about ONE element, served from\n * `cache` where it is still valid. Null when the element is not a layer.\n *\n * The four reads go through the cache separately rather than as one record\n * because they do not go stale together: a style write flips whether an element\n * renders without touching how it is addressed. Without a cache this is exactly\n * the original per-element derivation, which is what every other caller of the\n * walk still gets.\n *\n * Lives here rather than in the walk so the two halves of the memoization —\n * what is stored and what is read — sit in one file.\n */\nexport function readDomEditLayerWalkEntry(\n el: HTMLElement,\n activeCompositionPath: string | null,\n cache?: DomEditLayerWalkCache,\n): DomEditLayerWalkEntry | null {\n const inspectable = cache\n ? cache.readInspectable(el, () => isInspectableLayerElement(el))\n : isInspectableLayerElement(el);\n if (!inspectable) return null;\n\n const identity = () => resolveDomLayerIdentity(el, activeCompositionPath);\n const target = cache ? cache.readIdentity(el, identity) : identity();\n if (!target) return null;\n\n const label = () => buildElementLabel(el);\n const childCount = () => getDirectLayerChildren(el).length;\n return {\n target,\n label: cache ? cache.readLabel(el, label) : label(),\n childCount: cache ? cache.readChildCount(el, childCount) : childCount(),\n };\n}\n\n/**\n * Apply the records the observer has taken in but not yet delivered.\n *\n * Records arrive in a microtask, so an edit made earlier in THIS task would\n * otherwise be read back against entries that predate it. Taking them suppresses\n * the observer's own callback for them, which is equivalent here: that callback\n * only ingests and marks a rebuild owed, and a caller draining is rebuilding\n * regardless. A caller with no observer yet has nothing pending.\n */\nexport function drainPendingLayerMutations(\n observer: MutationObserver | null,\n cache: DomEditLayerWalkCache,\n): void {\n if (!observer) return;\n cache.ingest(observer.takeRecords());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AA,EACpD;AAEA,SAAO;AACT;AAEO,SAAS,oBACd,WACQ;AACR,SAAO;AAAA,IACL,UAAU,cAAc;AAAA,IACxB,UAAU,QAAQ;AAAA,IAClB,UAAU,MAAM;AAAA,IAChB,UAAU,YAAY;AAAA,IACtB,UAAU,iBAAiB;AAAA,EAC7B,EAAE,KAAK,GAAG;AACZ;AAEO,SAAS,wBAAwB,WAAsC;AAC5E,SAAO,uBAAuB,wBAAwB,SAAS,CAAC,EAAE;AACpE;AAIO,SAAS,SAAS,SAAsC;AAC7D,SAAO,QAAQ,aAAa,YAAY,GAAG,KAAK,KAAK;AACvD;AAEO,SAAS,wBACd,WACkF;AAClF,SAAO;AAAA,IACL,IAAI,UAAU;AAAA,IACd,MAAM,UAAU;AAAA,IAChB,UAAU,UAAU;AAAA,IACpB,eAAe,UAAU;AAAA,EAC3B;AACF;","names":["env","env"]}
@@ -19,7 +19,7 @@ import {
19
19
  resolveDomEditCapabilities,
20
20
  resolveDomEditSelection,
21
21
  serializeDomEditTextFields
22
- } from "./chunk-TXZMMOMA.js";
22
+ } from "./chunk-3F47EFCT.js";
23
23
  import "./chunk-5EKWJZLM.js";
24
24
  import "./chunk-PZ5AY32C.js";
25
25
  export {
@@ -44,4 +44,4 @@ export {
44
44
  resolveDomEditSelection,
45
45
  serializeDomEditTextFields
46
46
  };
47
- //# sourceMappingURL=domEditingLayers-D7VYFJJD.js.map
47
+ //# sourceMappingURL=domEditingLayers-OL7GLSS4.js.map
@@ -2032,9 +2032,31 @@ interface PreviewCompositionSize {
2032
2032
  height: number;
2033
2033
  }
2034
2034
 
2035
- interface NLEPreviewProps {
2035
+ interface CompositionLevel {
2036
+ /** Unique id — "master" or composition file path */
2037
+ id: string;
2038
+ /** Display label — "Master" or filename without extension */
2039
+ label: string;
2040
+ /** Preview URL for this composition level */
2041
+ previewUrl: string;
2042
+ }
2043
+ interface CompositionBreadcrumbProps {
2044
+ stack: CompositionLevel[];
2045
+ onNavigate: (index: number) => void;
2046
+ }
2047
+ declare function CompositionBreadcrumb({ stack, onNavigate }: CompositionBreadcrumbProps): react_jsx_runtime.JSX.Element | null;
2048
+
2049
+ interface NLEContextValue {
2036
2050
  projectId: string;
2037
- iframeRef: RefObject<HTMLIFrameElement | null>;
2051
+ iframeRef: React.MutableRefObject<HTMLIFrameElement | null>;
2052
+ play: () => void;
2053
+ pause: () => void;
2054
+ togglePlay: () => void;
2055
+ seek: (time: number, options?: {
2056
+ keepPlaying?: boolean;
2057
+ follow?: boolean;
2058
+ }) => boolean;
2059
+ refreshPlayer: () => void;
2038
2060
  onIframeLoad: () => void;
2039
2061
  previewSlots: PreviewIframeSlot[];
2040
2062
  onShadowIframeLoad: (gen: number) => void;
@@ -2042,6 +2064,29 @@ interface NLEPreviewProps {
2042
2064
  onShadowError: (gen: number, message: string) => void;
2043
2065
  setShadowIframeNode: (node: HTMLIFrameElement | null) => void;
2044
2066
  resetPreviewSlots: () => void;
2067
+ containerRef: React.MutableRefObject<HTMLDivElement | null>;
2068
+ compositionStack: CompositionLevel[];
2069
+ updateCompositionStack: React.Dispatch<React.SetStateAction<CompositionLevel[]>>;
2070
+ handleNavigateComposition: (index: number) => void;
2071
+ handleDrillDown: (element: TimelineElement) => void;
2072
+ compIdToSrc: Map<string, string>;
2073
+ compositionLoading: boolean;
2074
+ setCompositionLoading: (loading: boolean) => void;
2075
+ timelineDisabled: boolean;
2076
+ timelineSessionEpoch: number;
2077
+ hasLoadedOnceRef: React.MutableRefObject<boolean>;
2078
+ previewCompositionSize: {
2079
+ width: number;
2080
+ height: number;
2081
+ } | null;
2082
+ setPreviewCompositionSize: (size: {
2083
+ width: number;
2084
+ height: number;
2085
+ } | null) => void;
2086
+ }
2087
+
2088
+ interface NLEPreviewProps extends Pick<NLEContextValue, "projectId" | "onIframeLoad" | "previewSlots" | "onShadowIframeLoad" | "onShadowReadyChange" | "onShadowError" | "setShadowIframeNode" | "resetPreviewSlots"> {
2089
+ iframeRef: RefObject<HTMLIFrameElement | null>;
2045
2090
  onCompositionLoadingChange?: (loading: boolean) => void;
2046
2091
  portrait?: boolean;
2047
2092
  directUrl?: string;
@@ -2061,20 +2106,6 @@ interface ShortcutsButtonProps {
2061
2106
  }
2062
2107
  declare function ShortcutsButton({ sections, disabled, onSeek }: ShortcutsButtonProps): react_jsx_runtime.JSX.Element;
2063
2108
 
2064
- interface CompositionLevel {
2065
- /** Unique id — "master" or composition file path */
2066
- id: string;
2067
- /** Display label — "Master" or filename without extension */
2068
- label: string;
2069
- /** Preview URL for this composition level */
2070
- previewUrl: string;
2071
- }
2072
- interface CompositionBreadcrumbProps {
2073
- stack: CompositionLevel[];
2074
- onNavigate: (index: number) => void;
2075
- }
2076
- declare function CompositionBreadcrumb({ stack, onNavigate }: CompositionBreadcrumbProps): react_jsx_runtime.JSX.Element | null;
2077
-
2078
2109
  interface UseCompositionStackOptions {
2079
2110
  projectId: string;
2080
2111
  activeCompositionPath?: string | null;
@@ -2243,6 +2274,21 @@ declare function useRenderClipContent({ projectIdRef, compIdToSrc, activePreview
2243
2274
  label: string;
2244
2275
  }, context?: TimelineClipRenderContext) => ReactNode;
2245
2276
 
2277
+ interface UseThumbnailStillOptions {
2278
+ sessionEpoch?: number;
2279
+ priority?: ThumbnailPriority;
2280
+ }
2281
+ type ThumbnailStill = {
2282
+ status: "loading";
2283
+ } | {
2284
+ status: "ready";
2285
+ url: string;
2286
+ } | {
2287
+ status: "failed";
2288
+ };
2289
+ /** A host picture's server still through the thumbnail scheduler, so it yields to a preview reload. */
2290
+ declare function useThumbnailStill(url: string | null, projectId: string, { sessionEpoch, priority }?: UseThumbnailStillOptions): ThumbnailStill;
2291
+
2246
2292
  interface DomEditCompositionRect {
2247
2293
  left: number;
2248
2294
  top: number;
@@ -2733,6 +2779,7 @@ interface RecordEditInput$4 {
2733
2779
  interface ApplyCallbacks {
2734
2780
  readFile: (path: string) => Promise<string>;
2735
2781
  serialize?: <T>(paths: readonly string[], task: () => Promise<T>) => Promise<T>;
2782
+ claimedAfter?: number;
2736
2783
  }
2737
2784
  interface UsePersistentEditHistoryOptions {
2738
2785
  projectId: string | null;
@@ -2771,6 +2818,7 @@ declare function usePersistentEditHistory({ projectId }: UsePersistentEditHistor
2771
2818
  id: string;
2772
2819
  files: RestoreFiles;
2773
2820
  } | null;
2821
+ claims: () => number;
2774
2822
  noteOutsideChange: () => void;
2775
2823
  };
2776
2824
 
@@ -2852,7 +2900,9 @@ type StudioSaveDrainResult<Failure = unknown> = {
2852
2900
 
2853
2901
  type StudioPendingEditsDrainResult = StudioSaveDrainResult;
2854
2902
  declare function revertNewestStudioPendingEdit(): (() => void) | null;
2855
- declare function flushStudioPendingEdits(): Promise<StudioPendingEditsDrainResult>;
2903
+ declare function flushStudioPendingEdits({ onlyCurrent, }?: {
2904
+ onlyCurrent?: boolean | undefined;
2905
+ }): Promise<StudioPendingEditsDrainResult>;
2856
2906
 
2857
2907
  interface HistoryResult {
2858
2908
  ok: boolean;
@@ -2867,6 +2917,7 @@ interface HistoryResult {
2867
2917
  interface HistoryFileCallbacks {
2868
2918
  readFile: (path: string) => Promise<string>;
2869
2919
  serialize?: <T>(paths: readonly string[], task: () => Promise<T>) => Promise<T>;
2920
+ claimedAfter?: number;
2870
2921
  }
2871
2922
  interface EditHistoryHandle {
2872
2923
  undo: (cb: HistoryFileCallbacks) => Promise<HistoryResult>;
@@ -2875,6 +2926,7 @@ interface EditHistoryHandle {
2875
2926
  id: string;
2876
2927
  files: RestoreFiles;
2877
2928
  } | null;
2929
+ claims?: () => number;
2878
2930
  state: {
2879
2931
  undo: ReadonlyArray<{
2880
2932
  createdAt: number;
@@ -2885,7 +2937,7 @@ interface EditHistoryHandle {
2885
2937
  };
2886
2938
  }
2887
2939
  interface UseEditHistoryActionsOptions {
2888
- editHistory: Pick<EditHistoryHandle, "undo" | "redo" | "predict">;
2940
+ editHistory: Pick<EditHistoryHandle, "undo" | "redo" | "predict" | "claims">;
2889
2941
  readOptionalProjectFile: (path: string) => Promise<string>;
2890
2942
  readProjectFile: (path: string) => Promise<string>;
2891
2943
  writeProjectFile: (path: string, content: string) => Promise<void>;
@@ -3300,6 +3352,15 @@ interface RecordEditInput$2 {
3300
3352
  }>;
3301
3353
  }
3302
3354
 
3355
+ interface DomGroupMove {
3356
+ selection: DomEditSelection;
3357
+ /** Composition px: the element's box moves by exactly this in the film. */
3358
+ delta: {
3359
+ x: number;
3360
+ y: number;
3361
+ };
3362
+ }
3363
+
3303
3364
  interface UseDomEditSessionParams extends DomEditTimelineParams {
3304
3365
  compositionLoading: boolean;
3305
3366
  showToast: (message: string, tone?: "error" | "info") => void;
@@ -3353,7 +3414,7 @@ declare function useDomEditSession({ projectId, activeCompPath, compIdToSrc, cap
3353
3414
  clearDomSelection: () => void;
3354
3415
  refreshDomEditSelectionFromPreview: (selection: DomEditSelection) => Promise<void>;
3355
3416
  handleDomStyleCommit: (property: string, value: string) => Promise<DomEditCommitOutcome>;
3356
- handleDomStyleCommitForSelection: (selection: DomEditSelection, property: string, value: string) => Promise<DomEditCommitOutcome>;
3417
+ handleDomStyleCommitForSelection: (selection: DomEditSelection, propertyOrStylesAsOnePatch: string | Record<string, string>, value?: string) => Promise<DomEditCommitOutcome>;
3357
3418
  handleDomAttributeCommit: (attr: string, value: string) => Promise<void>;
3358
3419
  handleDomAttributeLiveCommit: (attr: string, value: string | null, onSettled?: (ok: boolean) => void, live?: {
3359
3420
  previewOnly?: boolean;
@@ -3366,7 +3427,10 @@ declare function useDomEditSession({ projectId, activeCompPath, compIdToSrc, cap
3366
3427
  x: number;
3367
3428
  y: number;
3368
3429
  }, modifiers?: MoveCommitOptions) => Promise<GeometryCommitResult | undefined>;
3369
- handleDomGroupPathOffsetCommit: (updates: DomEditGroupPathOffsetCommit[]) => Promise<GeometryCommitResult>;
3430
+ handleDomGroupPathOffsetCommit: (updates: DomEditGroupPathOffsetCommit[], options?: {
3431
+ refusalToast?: boolean;
3432
+ }) => Promise<GeometryCommitResult>;
3433
+ handleDomGroupMoveBy: (moves: DomGroupMove[]) => Promise<void>;
3370
3434
  handleDomZIndexReorderCommit: (entries: Array<{
3371
3435
  element: HTMLElement;
3372
3436
  zIndex: number;
@@ -3544,7 +3608,7 @@ type DomEditValue = ReturnType<typeof useDomEditSession>;
3544
3608
  interface DomEditSelectionValue extends Pick<DomEditValue, "domEditSelection" | "domEditGroupSelections" | "domEditHoverSelection" | "activeGroupElement" | "domEditSelectionRef" | "selectedGsapAnimations" | "gsapMultipleTimelines" | "gsapUnsupportedTimelinePattern" | "agentModalOpen" | "agentModalAnchorPoint" | "copiedAgentPrompt" | "agentPromptSelectionContext"> {
3545
3609
  }
3546
3610
  declare function useDomEditSelectionContext(): DomEditSelectionValue;
3547
- declare function DomEditProvider({ value: { domEditSelection, domEditGroupSelections, domEditHoverSelection, agentModalOpen, agentModalAnchorPoint, copiedAgentPrompt, agentPromptSelectionContext, domEditSelectionRef, handleTimelineElementSelect, handlePreviewCanvasMouseDown, handlePreviewCanvasPointerMove, handlePreviewCanvasPointerLeave, applyDomSelection, clearDomSelection, refreshDomEditSelectionFromPreview, handleDomStyleCommit, handleDomStyleCommitForSelection, handleDomAttributeCommit, handleDomAttributeLiveCommit, handleDomAttributeQuietCommit, handleDomHtmlAttributeCommit, handleDomAttributesCommit, handleDomAttributeBatchCommit, handleDomPathOffsetCommit, handleDomGroupPathOffsetCommit, handleDomZIndexReorderCommit, handleDomBoxSizeCommit, handleDomRotationCommit, handleDomManualEditsReset, handleDomTextCommit, handleDomTextCommitForSelection, handleDomRichTextCommit, handleDomTextFieldStyleCommit, handleDomAddTextField, handleDomRemoveTextField, getGsapAnimationsForSelection, handleAskAgent, handleAgentModalSubmit, handleBlockedDomMove, handleDomManualDragStart, handleDomEditElementDelete, handleGroupSelection, handleUngroupSelection, setActiveGroupElement, activeGroupElement, buildDomSelectionFromTarget, buildDomSelectionForTimelineElement, updateDomEditHoverSelection, resolveImportedFontAsset, setAgentModalOpen, setAgentPromptSelectionContext, setAgentModalAnchorPoint, selectedGsapAnimations, gsapMultipleTimelines, gsapUnsupportedTimelinePattern, handleGsapUpdateProperty, handleGsapUpdateMeta, handleGsapDeleteAnimation, handleGsapDeleteAllForElement, handleGsapAddAnimation, handleGsapAddProperty, handleGsapRemoveProperty, handleGsapUpdateFromProperty, handleGsapAddFromProperty, handleGsapRemoveFromProperty, handleGsapAddKeyframe, handleGsapAddKeyframeBatch, handleGsapRemoveKeyframe, handleGsapMoveKeyframeToPlayhead, handleGsapMoveKeyframe, handleGsapResizeKeyframedTween, handleGsapConvertToKeyframes, handleGsapRemoveAllKeyframes, handleResetSelectedElementKeyframes, commitAnimatedProperty, commitAnimatedProperties, handleSetArcPath, handleUpdateArcSegment, handleUnroll, invalidateGsapCache, previewIframeRef, commitMutation, applyMarqueeSelection, handleUpdateKeyframeEase, handleUpdateSegmentEase, handleSetAllKeyframeEases, }, children, }: {
3611
+ declare function DomEditProvider({ value: { domEditSelection, domEditGroupSelections, domEditHoverSelection, agentModalOpen, agentModalAnchorPoint, copiedAgentPrompt, agentPromptSelectionContext, domEditSelectionRef, handleTimelineElementSelect, handlePreviewCanvasMouseDown, handlePreviewCanvasPointerMove, handlePreviewCanvasPointerLeave, applyDomSelection, clearDomSelection, refreshDomEditSelectionFromPreview, handleDomStyleCommit, handleDomStyleCommitForSelection, handleDomAttributeCommit, handleDomAttributeLiveCommit, handleDomAttributeQuietCommit, handleDomHtmlAttributeCommit, handleDomAttributesCommit, handleDomAttributeBatchCommit, handleDomPathOffsetCommit, handleDomGroupPathOffsetCommit, handleDomGroupMoveBy, handleDomZIndexReorderCommit, handleDomBoxSizeCommit, handleDomRotationCommit, handleDomManualEditsReset, handleDomTextCommit, handleDomTextCommitForSelection, handleDomRichTextCommit, handleDomTextFieldStyleCommit, handleDomAddTextField, handleDomRemoveTextField, getGsapAnimationsForSelection, handleAskAgent, handleAgentModalSubmit, handleBlockedDomMove, handleDomManualDragStart, handleDomEditElementDelete, handleGroupSelection, handleUngroupSelection, setActiveGroupElement, activeGroupElement, buildDomSelectionFromTarget, buildDomSelectionForTimelineElement, updateDomEditHoverSelection, resolveImportedFontAsset, setAgentModalOpen, setAgentPromptSelectionContext, setAgentModalAnchorPoint, selectedGsapAnimations, gsapMultipleTimelines, gsapUnsupportedTimelinePattern, handleGsapUpdateProperty, handleGsapUpdateMeta, handleGsapDeleteAnimation, handleGsapDeleteAllForElement, handleGsapAddAnimation, handleGsapAddProperty, handleGsapRemoveProperty, handleGsapUpdateFromProperty, handleGsapAddFromProperty, handleGsapRemoveFromProperty, handleGsapAddKeyframe, handleGsapAddKeyframeBatch, handleGsapRemoveKeyframe, handleGsapMoveKeyframeToPlayhead, handleGsapMoveKeyframe, handleGsapResizeKeyframedTween, handleGsapConvertToKeyframes, handleGsapRemoveAllKeyframes, handleResetSelectedElementKeyframes, commitAnimatedProperty, commitAnimatedProperties, handleSetArcPath, handleUpdateArcSegment, handleUnroll, invalidateGsapCache, previewIframeRef, commitMutation, applyMarqueeSelection, handleUpdateKeyframeEase, handleUpdateSegmentEase, handleSetAllKeyframeEases, }, children, }: {
3548
3612
  value: DomEditValue;
3549
3613
  children: ReactNode;
3550
3614
  }): react_jsx_runtime.JSX.Element;
@@ -3712,6 +3776,24 @@ declare function useDomStyleCommit({ projectId, iframeRef, writeProjectFile, rec
3712
3776
  waitForPendingSaves: () => Promise<DomEditSaveDrainResult>;
3713
3777
  };
3714
3778
 
3779
+ declare function ColorField({ label, value, disabled, onReset, flat, mixed, onPreview, onCommit, }: {
3780
+ label: string;
3781
+ value: string;
3782
+ disabled?: boolean;
3783
+ onReset?: () => void;
3784
+ flat?: boolean;
3785
+ mixed?: boolean;
3786
+ onPreview?: (nextValue: string) => void;
3787
+ onCommit: (nextValue: string) => void;
3788
+ }): react_jsx_runtime.JSX.Element;
3789
+
3790
+ declare function GradientField({ value, fallbackColor, disabled, onCommit, }: {
3791
+ value: string;
3792
+ fallbackColor: string | undefined;
3793
+ disabled?: boolean;
3794
+ onCommit: (nextValue: string) => void;
3795
+ }): react_jsx_runtime.JSX.Element;
3796
+
3715
3797
  /**
3716
3798
  * Studio's `Player` must show the project, with `beginTimelineSession(projectId)` run before it
3717
3799
  * mounts; drain `waitForPendingSaves` before switching projects.
@@ -4119,4 +4201,4 @@ declare function buildStudioTools(depsRef: {
4119
4201
  readonly current: StudioAgentToolsDeps;
4120
4202
  }): ModelContextTool[];
4121
4203
 
4122
- export { type AgentModalAnchorPoint, type AgentPromptElementInfo, AskAgentModal, type AskAgentModalProps, AudioMeterStrip, type AudioMeterStripProps, AudioWaveform, type AudioWaveformProps, type BlockedTimelineEditIntent, type CanEditTimelineElement, CompositionBreadcrumb, type CompositionDimensions, type CompositionLevel, CompositionThumbnail, ConnectedDomEditOverlay, type ConnectedDomEditOverlayProps, DEFAULT_SHORTCUT_SECTIONS, Dock, type DockController, type DomEditCapabilities, type DomEditCommitDeclineReason, type DomEditCommitOutcome, type DomEditGroupPathOffsetCommit, DomEditOverlay, type DomEditOverlayProps, DomEditProvider, type DomEditSelection, type DomEditZOrder, type DomGeometryCommits, type EditHistoryHandle, EditorShell, type EditorShellProps, type ExternalFileChangeBlockedState, type ExternalFileChangeCoordinatorHandle, ExternalFileConflictBanner, type FadeEdge, type FadeHandleBox, type FadeHandleClipBox, type FfmpegStatus, FileTree, GridOverlay, ImageThumbnail, type ImageThumbnailProps, type MarqueeGestures, type MarqueeGesturesDeps, MarqueeOverlay, type MarqueeOverlayProps, type Rect$1 as MarqueeRect, type ModelContextTool, NLEPreview, type PanelId, type PatchOperation, type PersistedRenderSettings, type PickedElement, PlayerControls, type PlayerHandle, type PlayerHandleElement, type PlayerHandleListener, type PlayerHandleTimeListener, type DomEditCompositionRect as PreviewCompositionRect, PreviewGuides, PreviewOverlayProvider, type PreviewOverlayProviderProps, type PreviewPromotion, PreviewReadOnlyProvider, type PreviewSnapPreferences, PropertyPanel, type RenderJob, RenderQueue, type RenderQueueProps, type ResolutionPreset, SNAP_THRESHOLD_PX, type ShortcutHint, type ShortcutSection, ShortcutsButton, type ShortcutsButtonProps, type SnapContext, type SnapEdge, type SnapGuide, SnapGuideOverlay, type SnapGuideOverlayProps, type SnapGuidesState, type Rect as SnapRect, type SnapResult, type SnapTarget, SnapToolbar, SourceEditor, type SpacingGuide, type StartRenderOptions, type StudioAgentToolsDeps, StudioApp, StudioFileConflictError, type StudioLookSnapshot, type StudioPendingEditsDrainResult, TRACK_H, type ThumbnailPriority, Timeline, TimelineClipMenu, type TimelineClipMenuItem, type TimelineClipRenderContext, type TimelineEditCallbacks, type TimelineEditOutcome, type TimelineEditPermission, TimelineEditPopover, TimelineEditProvider, type TimelineElement, TimelineEmptyStatePart, TimelineFrame, TimelineGapMenu, TimelineHistoryButtons, type TimelineHistoryButtonsProps, TimelineKeyframeMenu, TimelineLanes, TimelineOverlays, TimelinePane, type TimelinePaneProps, TimelinePlayhead, TimelineProvider, TimelineRazorGuide, TimelineRuler, TimelineShortcutHint, type TimelineTheme, type TimelineTimeRange$1 as TimelineTimeRange, TimelineToolbar, type TimelineToolbarProps, type TimelineTrackPadding, type TimelineZIndexReorderCommit, type ToolResult, type UseClipboardOptions, type UseDomEditSessionParams, type UseDomGeometryCommitOptions, type UseDomStyleCommitOptions, type UseEditHistoryActionsOptions, type UsePersistentEditHistoryOptions, type UsePreviewPersistenceParams, type UseProjectFileWriterOptions, type UseRenderClipContentOptions, type UseTimelineEditingOptions, VideoThumbnail, type ZOrderAction, applyPatch, buildCompositionSnapTarget, buildGridSnapEdges, buildPickerAgentContextPreview, buildPickerAgentPrompt, buildStudioTools, collectSnapContext, collectStudioLookScene, displayTrackOrder, extractSnapTargets, fadeHandleBoxes, findElementBlock, flushStudioPendingEdits, formatTime, getPersistedRenderSettings, liveTime, mergeStyleIntoTag, openAudioGainDialog, parseStyleString, persistRenderSettings, resolveDomEditSelection, resolveEquidistanceGuides, resolveGuideLineRect, resolveIframe, resolveSnapAdjustment, resolveSourceFile, revertNewestStudioPendingEdit, snapEngagedForTravel, useAudioGainDialogStore, useAudioMetersVisible, useClipboard, useCompositionStack, useDockLayoutStore, useDomEditSelectionContext, useDomEditSession, useDomEditZOrder, useDomGeometryCommit, useDomStyleCommit, useEditHistoryActions, useElementPicker, useLivePreviewIframe, useMarqueeGestures, usePersistentEditHistory, usePlayerHandle, usePlayerStore, usePreviewCompositionRect, usePreviewGuidesStore, usePreviewIframeStore, usePreviewOverlayContext, usePreviewPersistence, useProjectFileWriter, useRenderClipContent, useRenderQueue, useTimelineContext, useTimelineEditing, useTimelinePlayer };
4204
+ export { type AgentModalAnchorPoint, type AgentPromptElementInfo, AskAgentModal, type AskAgentModalProps, AudioMeterStrip, type AudioMeterStripProps, AudioWaveform, type AudioWaveformProps, type BlockedTimelineEditIntent, type CanEditTimelineElement, ColorField, CompositionBreadcrumb, type CompositionDimensions, type CompositionLevel, CompositionThumbnail, ConnectedDomEditOverlay, type ConnectedDomEditOverlayProps, DEFAULT_SHORTCUT_SECTIONS, Dock, type DockController, type DomEditCapabilities, type DomEditCommitDeclineReason, type DomEditCommitOutcome, type DomEditGroupPathOffsetCommit, DomEditOverlay, type DomEditOverlayProps, DomEditProvider, type DomEditSelection, type DomEditZOrder, type DomGeometryCommits, type EditHistoryHandle, EditorShell, type EditorShellProps, type ExternalFileChangeBlockedState, type ExternalFileChangeCoordinatorHandle, ExternalFileConflictBanner, type FadeEdge, type FadeHandleBox, type FadeHandleClipBox, type FfmpegStatus, FileTree, GradientField, GridOverlay, ImageThumbnail, type ImageThumbnailProps, type MarqueeGestures, type MarqueeGesturesDeps, MarqueeOverlay, type MarqueeOverlayProps, type Rect$1 as MarqueeRect, type ModelContextTool, NLEPreview, type PanelId, type PatchOperation, type PersistedRenderSettings, type PickedElement, PlayerControls, type PlayerHandle, type PlayerHandleElement, type PlayerHandleListener, type PlayerHandleTimeListener, type DomEditCompositionRect as PreviewCompositionRect, PreviewGuides, PreviewOverlayProvider, type PreviewOverlayProviderProps, type PreviewPromotion, PreviewReadOnlyProvider, type PreviewSnapPreferences, PropertyPanel, type RenderJob, RenderQueue, type RenderQueueProps, type ResolutionPreset, SNAP_THRESHOLD_PX, type ShortcutHint, type ShortcutSection, ShortcutsButton, type ShortcutsButtonProps, type SnapContext, type SnapEdge, type SnapGuide, SnapGuideOverlay, type SnapGuideOverlayProps, type SnapGuidesState, type Rect as SnapRect, type SnapResult, type SnapTarget, SnapToolbar, SourceEditor, type SpacingGuide, type StartRenderOptions, type StudioAgentToolsDeps, StudioApp, StudioFileConflictError, type StudioLookSnapshot, type StudioPendingEditsDrainResult, TRACK_H, type ThumbnailPriority, type ThumbnailStill, Timeline, TimelineClipMenu, type TimelineClipMenuItem, type TimelineClipRenderContext, type TimelineEditCallbacks, type TimelineEditOutcome, type TimelineEditPermission, TimelineEditPopover, TimelineEditProvider, type TimelineElement, TimelineEmptyStatePart, TimelineFrame, TimelineGapMenu, TimelineHistoryButtons, type TimelineHistoryButtonsProps, TimelineKeyframeMenu, TimelineLanes, TimelineOverlays, TimelinePane, type TimelinePaneProps, TimelinePlayhead, TimelineProvider, TimelineRazorGuide, TimelineRuler, TimelineShortcutHint, type TimelineTheme, type TimelineTimeRange$1 as TimelineTimeRange, TimelineToolbar, type TimelineToolbarProps, type TimelineTrackPadding, type TimelineZIndexReorderCommit, type ToolResult, type UseClipboardOptions, type UseDomEditSessionParams, type UseDomGeometryCommitOptions, type UseDomStyleCommitOptions, type UseEditHistoryActionsOptions, type UsePersistentEditHistoryOptions, type UsePreviewPersistenceParams, type UseProjectFileWriterOptions, type UseRenderClipContentOptions, type UseThumbnailStillOptions, type UseTimelineEditingOptions, VideoThumbnail, type ZOrderAction, applyPatch, buildCompositionSnapTarget, buildGridSnapEdges, buildPickerAgentContextPreview, buildPickerAgentPrompt, buildStudioTools, collectSnapContext, collectStudioLookScene, displayTrackOrder, extractSnapTargets, fadeHandleBoxes, findElementBlock, flushStudioPendingEdits, formatTime, getPersistedRenderSettings, liveTime, mergeStyleIntoTag, openAudioGainDialog, parseStyleString, persistRenderSettings, resolveDomEditSelection, resolveEquidistanceGuides, resolveGuideLineRect, resolveIframe, resolveSnapAdjustment, resolveSourceFile, revertNewestStudioPendingEdit, snapEngagedForTravel, useAudioGainDialogStore, useAudioMetersVisible, useClipboard, useCompositionStack, useDockLayoutStore, useDomEditSelectionContext, useDomEditSession, useDomEditZOrder, useDomGeometryCommit, useDomStyleCommit, useEditHistoryActions, useElementPicker, useLivePreviewIframe, useMarqueeGestures, usePersistentEditHistory, usePlayerHandle, usePlayerStore, usePreviewCompositionRect, usePreviewGuidesStore, usePreviewIframeStore, usePreviewOverlayContext, usePreviewPersistence, useProjectFileWriter, useRenderClipContent, useRenderQueue, useThumbnailStill, useTimelineContext, useTimelineEditing, useTimelinePlayer };
@@ -14,7 +14,7 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-CAvZ0AA-.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-DYNaXPVf.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-t1LH6H5H.css">
19
19
  </head>
20
20
  <body>