@dailies-studio/shot-editor 0.1.0 → 0.2.0

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 (432) hide show
  1. package/dist/.vite/manifest.json +382 -0
  2. package/dist/assets/AgentPanel-CQejLbiX.js +2 -0
  3. package/dist/assets/AgentPanel-DJEphah0.css +1 -0
  4. package/dist/assets/AgentQuestionDialog-BqkD0kXF.js +1 -0
  5. package/dist/assets/CodeStudio-Dv4ihHpz.js +23 -0
  6. package/dist/assets/CommentsPanel-B4yhhT1T.js +1 -0
  7. package/dist/assets/ComponentLibraryRail-Ch_dsAru.js +1 -0
  8. package/dist/assets/ComponentStage-BRhRotyH.js +1 -0
  9. package/dist/assets/CurvePane-BjFVabKX.css +1 -0
  10. package/dist/assets/CurvePane-R22WzllJ.js +1 -0
  11. package/dist/assets/ExportDialog-CWLQWTmG.js +2 -0
  12. package/dist/assets/FontPicker-DWKaYL7F.js +1 -0
  13. package/dist/assets/FontPicker-v0IOIArM.css +1 -0
  14. package/dist/assets/GenerateDrawer-Bh3SqDKt.js +2 -0
  15. package/dist/assets/InsertDrawer-Ce1fod1L.js +1 -0
  16. package/dist/assets/LibraryBrowser-D9sEGz5w.js +2 -0
  17. package/dist/assets/MakeItYoursSection-CMO4319_.js +2 -0
  18. package/dist/assets/MaterialGraphCanvas-BFzl4wWR.js +23 -0
  19. package/dist/assets/MaterialGraphCanvas-BIUD59ik.css +1 -0
  20. package/dist/assets/MaterialWorkspace-CqTWqaRA.js +14 -0
  21. package/dist/assets/PreferencesDialog-CBf9_OoD.js +1 -0
  22. package/dist/assets/PresetsSection-CUEaoCVU.js +1 -0
  23. package/dist/assets/SoundHistory-BeS8EW1h.js +1 -0
  24. package/dist/assets/SoundMode-BmcZru3i.js +3 -0
  25. package/dist/assets/StockSounds-DdAUGRYK.js +1 -0
  26. package/dist/assets/TemplateFieldSection-CaeXpLFo.js +1 -0
  27. package/dist/assets/VersionHistoryPanel-CxG6XhNP.js +1 -0
  28. package/dist/assets/board-B88EPuLO.css +1 -0
  29. package/dist/assets/board-CL-he7SL.js +3 -0
  30. package/dist/assets/components-0oOSPN0l.js +1 -0
  31. package/dist/assets/googleFontRanges-gp32wJMo.js +1 -0
  32. package/dist/assets/googleFonts-BNon6M7X.js +1 -0
  33. package/dist/assets/iconsAndAliases-DL7gXP5j.js +1863 -0
  34. package/dist/assets/index-4F5NQmI8.css +1 -0
  35. package/dist/assets/index-BGHQGV5z.js +117 -0
  36. package/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  37. package/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  38. package/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  39. package/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  40. package/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  41. package/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  42. package/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  43. package/dist/assets/libraryModel-CpIwfFha.js +1 -0
  44. package/dist/assets/lucide-6iK64tTB.js +9319 -0
  45. package/dist/assets/motionStamp-CH-Hew4E.js +1 -0
  46. package/dist/assets/takeMeasure-Tdg0TxEi.js +1 -0
  47. package/dist/assets/webmcp-BsB9gxWC.js +2 -0
  48. package/dist/index.html +34 -3
  49. package/package.json +12 -9
  50. package/src/addFamilies.ts +66 -0
  51. package/src/api.ts +1631 -55
  52. package/src/app/App.tsx +977 -198
  53. package/src/app/lazyPanel.tsx +137 -0
  54. package/src/app/lazySurfaces.tsx +203 -0
  55. package/src/audio/index.tsx +41 -10
  56. package/src/audio/meter.ts +485 -0
  57. package/src/audio/meterMath.ts +273 -0
  58. package/src/audio/meterStore.ts +155 -0
  59. package/src/audio/offlineMix.ts +289 -0
  60. package/src/audio/preview.ts +928 -118
  61. package/src/bridge.ts +15 -5
  62. package/src/bridgeTypes.ts +1611 -36
  63. package/src/channels.ts +17 -32
  64. package/src/fonts/googleFonts.ts +4 -0
  65. package/src/hostApi.ts +174 -0
  66. package/src/icons.tsx +770 -0
  67. package/src/layerWords.ts +61 -0
  68. package/src/main.tsx +56 -4
  69. package/src/panels/ResizeHandle.tsx +33 -43
  70. package/src/panels/agent/AgentDots.tsx +36 -0
  71. package/src/panels/agent/AgentPanel.tsx +119 -43
  72. package/src/panels/agent/AgentQuestionDialog.tsx +202 -0
  73. package/src/panels/agent/agent.css +113 -97
  74. package/src/panels/agent/agentGate.ts +35 -0
  75. package/src/panels/code/CodeDefaultsPanel.tsx +345 -0
  76. package/src/panels/code/CodeStudio.tsx +373 -0
  77. package/src/panels/code/FileTree.tsx +265 -0
  78. package/src/panels/code/codeBufferGuard.ts +52 -0
  79. package/src/panels/code/codeParts.tsx +321 -0
  80. package/src/panels/comments/CommentComposer.tsx +239 -0
  81. package/src/panels/comments/CommentThread.tsx +346 -0
  82. package/src/panels/comments/CommentsPanel.tsx +336 -0
  83. package/src/panels/comments/InboxButton.tsx +131 -0
  84. package/src/panels/comments/MentionMenu.tsx +98 -0
  85. package/src/panels/comments/parts.tsx +171 -0
  86. package/src/panels/export/ExportDialog.tsx +919 -96
  87. package/src/panels/export/ExportScrim.tsx +57 -0
  88. package/src/panels/files/AssetsTab.tsx +656 -0
  89. package/src/panels/files/FilePanel.tsx +1466 -216
  90. package/src/panels/files/LayerMarks.tsx +40 -0
  91. package/src/panels/files/LeftColumn.tsx +37 -0
  92. package/src/panels/files/McpSection.tsx +690 -47
  93. package/src/panels/files/MissingAssetsNotice.tsx +60 -0
  94. package/src/panels/files/assetDrag.ts +79 -0
  95. package/src/panels/files/resourceParts.tsx +255 -0
  96. package/src/panels/fonts/FontPicker.tsx +762 -0
  97. package/src/panels/fonts/faceCache.ts +207 -0
  98. package/src/panels/fonts/fontPicker.css +271 -0
  99. package/src/panels/fonts/pickerModel.ts +265 -0
  100. package/src/panels/fonts/pickerRequest.ts +46 -0
  101. package/src/panels/header/AccountAvatar.tsx +76 -0
  102. package/src/panels/header/AgentChip.tsx +77 -0
  103. package/src/panels/header/AppMenu.tsx +213 -0
  104. package/src/panels/header/Header.tsx +564 -84
  105. package/src/panels/header/HistoryControls.tsx +31 -5
  106. package/src/panels/header/PresenceStack.tsx +329 -0
  107. package/src/panels/header/ProjectTitle.tsx +232 -0
  108. package/src/panels/header/ShareButton.tsx +59 -0
  109. package/src/panels/header/StatusBadges.tsx +358 -27
  110. package/src/panels/header/SyncDeletedDialog.tsx +88 -0
  111. package/src/panels/header/ZoomControls.tsx +46 -15
  112. package/src/panels/header/agentHandoff.ts +52 -0
  113. package/src/panels/header/leave.ts +26 -0
  114. package/src/panels/help/HelpSection.tsx +189 -163
  115. package/src/panels/insert/InsertDrawer.tsx +723 -0
  116. package/src/panels/insert/iconSet.ts +109 -0
  117. package/src/panels/inspector/ExposeDot.tsx +117 -0
  118. package/src/panels/inspector/FramingRows.tsx +314 -44
  119. package/src/panels/inspector/InspectorFooter.tsx +91 -0
  120. package/src/panels/inspector/InspectorHead.tsx +425 -0
  121. package/src/panels/inspector/InspectorPanel.tsx +408 -124
  122. package/src/panels/inspector/KeyframeDot.tsx +373 -0
  123. package/src/panels/inspector/KeyframeSection.tsx +257 -0
  124. package/src/panels/inspector/MarkerSection.tsx +55 -11
  125. package/src/panels/inspector/ParamRow.tsx +84 -53
  126. package/src/panels/inspector/RightColumn.tsx +152 -0
  127. package/src/panels/inspector/TimeSection.tsx +866 -0
  128. package/src/panels/inspector/animate/EaseControl.tsx +244 -0
  129. package/src/panels/inspector/animate/PresetsSection.tsx +135 -0
  130. package/src/panels/inspector/animate/ShotSection.tsx +562 -48
  131. package/src/panels/inspector/design/AlignRow.tsx +95 -31
  132. package/src/panels/inspector/design/AppearanceSection.tsx +118 -9
  133. package/src/panels/inspector/design/ClonerSection.tsx +323 -62
  134. package/src/panels/inspector/design/ComponentSection.tsx +50 -43
  135. package/src/panels/inspector/design/CornerSection.tsx +45 -14
  136. package/src/panels/inspector/design/DefinitionProps.tsx +315 -0
  137. package/src/panels/inspector/design/DefinitionSection.tsx +136 -0
  138. package/src/panels/inspector/design/DeviceSection.tsx +210 -0
  139. package/src/panels/inspector/design/FillSection.tsx +83 -51
  140. package/src/panels/inspector/design/FontField.tsx +196 -0
  141. package/src/panels/inspector/design/HtmlSection.tsx +23 -12
  142. package/src/panels/inspector/design/InstanceSection.tsx +373 -154
  143. package/src/panels/inspector/design/MaskSection.tsx +84 -0
  144. package/src/panels/inspector/design/MaterialSection.tsx +177 -0
  145. package/src/panels/inspector/design/MediaSection.tsx +273 -120
  146. package/src/panels/inspector/design/MeshSection.tsx +910 -82
  147. package/src/panels/inspector/design/PaintRows.tsx +550 -0
  148. package/src/panels/inspector/design/PlateStyleSection.tsx +177 -0
  149. package/src/panels/inspector/design/ShadowSection.tsx +221 -48
  150. package/src/panels/inspector/design/SplineFollowSection.tsx +235 -0
  151. package/src/panels/inspector/design/StrokeSection.tsx +228 -43
  152. package/src/panels/inspector/design/TemplateFieldSection.tsx +57 -0
  153. package/src/panels/inspector/design/TransformSection.tsx +244 -50
  154. package/src/panels/inspector/design/TypographySection.tsx +679 -110
  155. package/src/panels/inspector/layout.ts +295 -0
  156. package/src/panels/inspector/propValue.ts +199 -0
  157. package/src/panels/inspector/scene/CameraSection.tsx +232 -22
  158. package/src/panels/inspector/scene/EffectsSection.tsx +722 -71
  159. package/src/panels/inspector/scene/MakeItYoursSection.tsx +180 -0
  160. package/src/panels/inspector/scene/SceneDocSection.tsx +191 -0
  161. package/src/panels/inspector/scene/SceneSection.tsx +219 -44
  162. package/src/panels/inspector/scene/TransitionSection.tsx +523 -72
  163. package/src/panels/inspector/storyboard/StoryboardReferenceSection.tsx +593 -0
  164. package/src/panels/inspector/storyboard/VideoStill.tsx +120 -0
  165. package/src/panels/inspector/timeModel.ts +190 -0
  166. package/src/panels/inspector/useDocWrite.ts +438 -146
  167. package/src/panels/library/LibraryBrowser.tsx +435 -0
  168. package/src/panels/library/LibraryGrid.tsx +190 -0
  169. package/src/panels/library/LibraryPreviewPanel.tsx +349 -0
  170. package/src/panels/library/LibraryRail.tsx +84 -0
  171. package/src/panels/library/LibrarySoundPanel.tsx +293 -0
  172. package/src/panels/library/SoundHistory.tsx +245 -0
  173. package/src/panels/library/StockSounds.tsx +390 -0
  174. package/src/panels/library/libraryModel.ts +147 -0
  175. package/src/panels/library/stockSearch.ts +77 -0
  176. package/src/panels/maskMarks.tsx +117 -0
  177. package/src/panels/material/MaterialCommentNode.tsx +54 -0
  178. package/src/panels/material/MaterialGraphCanvas.tsx +861 -0
  179. package/src/panels/material/MaterialGraphMenu.tsx +45 -0
  180. package/src/panels/material/MaterialGroupNode.tsx +56 -0
  181. package/src/panels/material/MaterialLibrary.tsx +253 -0
  182. package/src/panels/material/MaterialNode.tsx +453 -0
  183. package/src/panels/material/MaterialNodePalette.tsx +349 -0
  184. package/src/panels/material/MaterialParameterControls.tsx +525 -0
  185. package/src/panels/material/MaterialRerouteNode.tsx +42 -0
  186. package/src/panels/material/MaterialWorkspace.tsx +501 -0
  187. package/src/panels/material/NodePreview.tsx +70 -0
  188. package/src/panels/material/flowModel.ts +441 -0
  189. package/src/panels/material/parameterValues.ts +231 -0
  190. package/src/panels/material/previewScheduler.ts +235 -0
  191. package/src/panels/material/reactFlow.css +6 -0
  192. package/src/panels/material/socketGlyph.ts +85 -0
  193. package/src/panels/material/viewportMemory.ts +58 -0
  194. package/src/panels/preferences/PreferencesDialog.tsx +215 -0
  195. package/src/panels/share/ShareComponentDialog.tsx +247 -0
  196. package/src/panels/stage/StageMenu.tsx +35 -5
  197. package/src/panels/stage/StagePanel.tsx +338 -23
  198. package/src/panels/stage/cellSlots.tsx +70 -0
  199. package/src/panels/storyboard/BoardCanvas.tsx +739 -0
  200. package/src/panels/storyboard/BoardCursors.tsx +158 -0
  201. package/src/panels/storyboard/BoardDropDialog.tsx +161 -0
  202. package/src/panels/storyboard/BoardPlan.tsx +42 -0
  203. package/src/panels/storyboard/ComponentSheet.tsx +187 -0
  204. package/src/panels/storyboard/ComponentStage.tsx +235 -0
  205. package/src/panels/storyboard/MiniSketch.tsx +173 -0
  206. package/src/panels/storyboard/PartPicker.tsx +64 -0
  207. package/src/panels/storyboard/PlanPanel.tsx +617 -0
  208. package/src/panels/storyboard/ReferencePreview.tsx +217 -0
  209. package/src/panels/storyboard/ShotBrief.tsx +360 -0
  210. package/src/panels/storyboard/ShotCard.tsx +251 -0
  211. package/src/panels/storyboard/StagePreview.tsx +348 -0
  212. package/src/panels/storyboard/StillThumbs.tsx +162 -0
  213. package/src/panels/storyboard/StoryboardView.tsx +79 -0
  214. package/src/panels/storyboard/board.css +1065 -0
  215. package/src/panels/storyboard/board.ts +12 -0
  216. package/src/panels/storyboard/boardClipboard.ts +111 -0
  217. package/src/panels/storyboard/boardOrder.ts +68 -0
  218. package/src/panels/storyboard/boardRows.tsx +425 -0
  219. package/src/panels/storyboard/liveCap.ts +90 -0
  220. package/src/panels/storyboard/plan.css +295 -0
  221. package/src/panels/storyboard/posterCache.ts +133 -0
  222. package/src/panels/storyboard/shotboard/ComponentPicker.tsx +373 -0
  223. package/src/panels/storyboard/shotboard/ImagePicker.tsx +145 -0
  224. package/src/panels/storyboard/shotboard/ShotBoard.tsx +292 -0
  225. package/src/panels/storyboard/shotboard/SketchCanvas.tsx +443 -0
  226. package/src/panels/storyboard/shotboard/SketchInspector.tsx +471 -0
  227. package/src/panels/storyboard/shotboard/SketchItem.tsx +240 -0
  228. package/src/panels/storyboard/shotboard/SketchLayers.tsx +130 -0
  229. package/src/panels/storyboard/shotboard/SketchPlay.tsx +108 -0
  230. package/src/panels/storyboard/shotboard/SketchStrip.tsx +178 -0
  231. package/src/panels/storyboard/shotboard/SketchToolFooter.tsx +99 -0
  232. package/src/panels/storyboard/shotboard/sketch.css +1392 -0
  233. package/src/panels/storyboard/shotboard/sketchModel.ts +219 -0
  234. package/src/panels/storyboard/storyboardDrop.ts +164 -0
  235. package/src/panels/studio/ComponentLibraryRail.tsx +346 -0
  236. package/src/panels/studio/ComponentSidePanel.tsx +355 -0
  237. package/src/panels/studio/ComponentStudio.tsx +243 -0
  238. package/src/panels/studio/ComponentsHome.tsx +318 -0
  239. package/src/panels/studio/ComponentsPreview.tsx +179 -0
  240. package/src/panels/studio/EveryUse.tsx +244 -0
  241. package/src/panels/studio/ThisUsePanel.tsx +679 -0
  242. package/src/panels/studio/componentParts.tsx +341 -0
  243. package/src/panels/studio/components.ts +6 -0
  244. package/src/panels/studio/newCodeComponent.ts +66 -0
  245. package/src/panels/timeline/AudioFxButton.tsx +290 -0
  246. package/src/panels/timeline/AudioLane.tsx +674 -85
  247. package/src/panels/timeline/BlockRow.tsx +154 -85
  248. package/src/panels/timeline/ChannelRow.tsx +378 -129
  249. package/src/panels/timeline/CurvePane.tsx +508 -0
  250. package/src/panels/timeline/Filmstrip.tsx +361 -0
  251. package/src/panels/timeline/GenerateDrawer.tsx +407 -0
  252. package/src/panels/timeline/KeyStretch.tsx +115 -0
  253. package/src/panels/timeline/LifespanRow.tsx +730 -47
  254. package/src/panels/timeline/MarkerLane.tsx +46 -8
  255. package/src/panels/timeline/PlayButton.tsx +91 -0
  256. package/src/panels/timeline/PropertyPicker.tsx +254 -0
  257. package/src/panels/timeline/ShotRow.tsx +400 -0
  258. package/src/panels/timeline/SoundMode.tsx +1406 -0
  259. package/src/panels/timeline/TimelineDock.tsx +2338 -272
  260. package/src/panels/timeline/TransportVolume.tsx +163 -0
  261. package/src/panels/timeline/beatRuler.ts +74 -0
  262. package/src/panels/timeline/curveModel.ts +500 -0
  263. package/src/panels/timeline/duckUnderVoice.ts +68 -0
  264. package/src/panels/timeline/keyframeMenu.ts +138 -0
  265. package/src/panels/timeline/labelWidth.ts +49 -0
  266. package/src/panels/timeline/marquee.ts +155 -0
  267. package/src/panels/timeline/model.ts +1860 -199
  268. package/src/panels/timeline/snap.ts +125 -43
  269. package/src/panels/timeline/staggerPreview.tsx +92 -0
  270. package/src/panels/timeline/takeMeasure.ts +72 -0
  271. package/src/panels/timeline/useLive.ts +48 -0
  272. package/src/panels/timeline/viewport.ts +234 -0
  273. package/src/panels/toolbar/BackChip.tsx +116 -0
  274. package/src/panels/toolbar/CameraViewBar.tsx +118 -49
  275. package/src/panels/toolbar/CanvasBar.tsx +117 -0
  276. package/src/panels/toolbar/InsertButton.tsx +38 -0
  277. package/src/panels/toolbar/IsolationTrail.tsx +156 -0
  278. package/src/panels/toolbar/PanelToggles.tsx +86 -0
  279. package/src/panels/toolbar/ShadingBar.tsx +119 -26
  280. package/src/panels/toolbar/ToolDockBar.tsx +329 -80
  281. package/src/panels/toolbar/ToolFooter.tsx +102 -0
  282. package/src/panels/toolbar/ViewModeBar.tsx +247 -38
  283. package/src/panels/toolbar/WorkPlaneBar.tsx +94 -0
  284. package/src/panels/toolbar/useAddRows.tsx +326 -0
  285. package/src/panels/toolbar/useDismiss.ts +122 -0
  286. package/src/panels/versions/VersionHistoryPanel.tsx +274 -0
  287. package/src/panels/versions/versionModel.ts +103 -0
  288. package/src/panels/virtualWindow.ts +271 -0
  289. package/src/shotTokens.css +151 -60
  290. package/src/stage/FrustumGizmo.tsx +504 -84
  291. package/src/stage/GridPlane.tsx +225 -16
  292. package/src/stage/NodePreviews.tsx +628 -0
  293. package/src/stage/PerfHud.tsx +437 -47
  294. package/src/stage/SplitRenderer.tsx +816 -169
  295. package/src/stage/StageApp.tsx +4274 -486
  296. package/src/stage/StageRootBoundary.tsx +114 -0
  297. package/src/stage/StageTools.tsx +651 -151
  298. package/src/stage/TransformGizmo.tsx +696 -0
  299. package/src/stage/adaptivePresentation.ts +145 -0
  300. package/src/stage/bridgeClient.ts +2522 -41
  301. package/src/stage/exportWorker.ts +9 -0
  302. package/src/stage/feed.ts +305 -14
  303. package/src/stage/fontPreview.ts +176 -0
  304. package/src/stage/frustumGeometry.ts +319 -1
  305. package/src/stage/furnitureTokens.ts +33 -0
  306. package/src/stage/gizmoMath.ts +508 -16
  307. package/src/stage/gpuTimer.ts +276 -0
  308. package/src/stage/instanceModules.ts +194 -33
  309. package/src/stage/interactions/move.ts +24 -5
  310. package/src/stage/isolation.ts +291 -33
  311. package/src/stage/jsSelfProfiler.ts +325 -0
  312. package/src/stage/main.tsx +116 -16
  313. package/src/stage/modalState.ts +222 -23
  314. package/src/stage/moduleEpoch.ts +60 -0
  315. package/src/stage/motionPathStage.ts +279 -0
  316. package/src/stage/motionPreview.ts +74 -0
  317. package/src/stage/overlays/Overlays.tsx +1112 -159
  318. package/src/stage/overlays/Rulers.tsx +495 -0
  319. package/src/stage/panes.ts +159 -10
  320. package/src/stage/project.ts +68 -3
  321. package/src/stage/renderScaleController.ts +730 -0
  322. package/src/stage/rulers.ts +129 -0
  323. package/src/stage/sceneExtent.ts +75 -0
  324. package/src/stage/shading.ts +20 -0
  325. package/src/stage/splineStage.ts +632 -0
  326. package/src/stage/stagePerformanceTelemetry.ts +717 -0
  327. package/src/stage/stageTheme.ts +36 -0
  328. package/src/stage/stageWarmup.ts +11 -0
  329. package/src/stage/textAutoSize.ts +124 -0
  330. package/src/stage/tier1Export.ts +641 -0
  331. package/src/stage/tokenColor.ts +14 -9
  332. package/src/stage/view.ts +56 -9
  333. package/src/stage/workingView.ts +277 -33
  334. package/src/state/accountPrefs.ts +261 -0
  335. package/src/state/agentActions.ts +173 -15
  336. package/src/state/agentActivity.ts +198 -0
  337. package/src/state/agentQuestion.ts +239 -0
  338. package/src/state/bootOpen.ts +42 -0
  339. package/src/state/cameraVerbs.ts +139 -0
  340. package/src/state/clientId.ts +6 -1
  341. package/src/state/comments.ts +1099 -0
  342. package/src/state/context.tsx +19 -1
  343. package/src/state/editorPrefs.ts +220 -0
  344. package/src/state/errorReports.ts +121 -0
  345. package/src/state/fieldWrite.ts +161 -0
  346. package/src/state/fontRecents.ts +70 -0
  347. package/src/state/fonts.ts +656 -0
  348. package/src/state/graphClipboard.ts +414 -0
  349. package/src/state/imageThumbs.ts +216 -0
  350. package/src/state/insert.ts +444 -67
  351. package/src/state/isolationTrail.ts +92 -0
  352. package/src/state/keyMoves.ts +134 -0
  353. package/src/state/keyframeClipboard.ts +177 -0
  354. package/src/state/keymap.ts +1153 -117
  355. package/src/state/layoutPrefs.ts +272 -0
  356. package/src/state/layouts.ts +205 -0
  357. package/src/state/measureMedia.ts +167 -0
  358. package/src/state/menu.ts +2341 -28
  359. package/src/state/motionStamp.ts +7 -0
  360. package/src/state/panelSize.ts +375 -5
  361. package/src/state/pendingChanges.ts +119 -0
  362. package/src/state/playHold.ts +78 -0
  363. package/src/state/playbackPreparation.ts +562 -0
  364. package/src/state/posterCapture.ts +242 -0
  365. package/src/state/presence.ts +254 -0
  366. package/src/state/projectComponents.ts +160 -0
  367. package/src/state/renderEvents.ts +298 -18
  368. package/src/state/runtimeErrors.ts +46 -0
  369. package/src/state/selection.ts +12 -0
  370. package/src/state/shortcuts.ts +1606 -0
  371. package/src/state/sketchGuide.ts +51 -0
  372. package/src/state/splineRefs.ts +87 -0
  373. package/src/state/stageHealth.ts +259 -0
  374. package/src/state/stageWatchdog.ts +47 -0
  375. package/src/state/stillStage.ts +330 -0
  376. package/src/state/stillThumbs.ts +474 -0
  377. package/src/state/store.ts +23591 -2982
  378. package/src/state/storyboardModel.ts +528 -0
  379. package/src/state/sync.ts +1257 -0
  380. package/src/state/syncCache.ts +159 -0
  381. package/src/state/triangles.ts +13 -0
  382. package/src/state/types.ts +1698 -55
  383. package/src/state/unsavedGuard.ts +49 -0
  384. package/src/state/viewMode.ts +200 -0
  385. package/src/state/webmcp.ts +1128 -0
  386. package/src/state/workspace.ts +1147 -0
  387. package/src/styles/assets-tab.css +304 -0
  388. package/src/styles/canvas.css +545 -0
  389. package/src/styles/comments.css +1435 -0
  390. package/src/styles/controls.css +162 -0
  391. package/src/styles/dialogs.css +390 -0
  392. package/src/styles/insert-drawer.css +586 -0
  393. package/src/styles/inspector-board.css +207 -0
  394. package/src/styles/inspector-object.css +486 -0
  395. package/src/styles/inspector-shot.css +252 -0
  396. package/src/styles/inspector.css +360 -0
  397. package/src/styles/left-column.css +1628 -0
  398. package/src/styles/library-preview.css +575 -0
  399. package/src/styles/library.css +512 -0
  400. package/src/styles/modes/code.css +569 -0
  401. package/src/styles/modes/component.css +1561 -0
  402. package/src/styles/modes/material.css +1201 -0
  403. package/src/styles/modes/storyboard.css +518 -0
  404. package/src/styles/share-component.css +49 -0
  405. package/src/styles/shell.css +653 -0
  406. package/src/styles/shot-brief.css +360 -0
  407. package/src/styles/states.css +76 -0
  408. package/src/styles/sync.css +380 -0
  409. package/src/styles/timeline-graph.css +384 -0
  410. package/src/styles/timeline-meters.css +89 -0
  411. package/src/styles/timeline-rows.css +1959 -0
  412. package/src/styles/timeline-sound.css +1003 -0
  413. package/src/styles/timeline.css +754 -0
  414. package/src/styles/tool-footer.css +525 -0
  415. package/src/styles/topbar.css +886 -0
  416. package/src/styles/versions.css +262 -0
  417. package/src/styles.css +72 -2921
  418. package/src/tools.ts +108 -23
  419. package/dist/assets/index-B7notge7.css +0 -1
  420. package/dist/assets/index-BBE6Ta9L.js +0 -52
  421. package/src/panels/files/icons.tsx +0 -118
  422. package/src/panels/header/DocSwitcher.tsx +0 -85
  423. package/src/panels/header/TransportBar.tsx +0 -86
  424. package/src/panels/inspector/animate/BlockTiming.tsx +0 -341
  425. package/src/panels/inspector/animate/DuringBlocks.tsx +0 -85
  426. package/src/panels/inspector/animate/InOutPresets.tsx +0 -57
  427. package/src/panels/inspector/animate/ResolvedChannels.tsx +0 -150
  428. package/src/panels/inspector/animate/useBlocks.ts +0 -43
  429. package/src/panels/material/MaterialPicker.tsx +0 -172
  430. package/src/panels/timeline/SceneStrip.tsx +0 -145
  431. package/src/panels/toolbar/AddMenu.tsx +0 -230
  432. package/src/stage/MoveGizmo.tsx +0 -411
@@ -0,0 +1 @@
1
+ import{q as Ne,v as s,dH as ve,dI as ke,u as Se,dJ as Oe,B as me,dK as Le,dL as Ie,dM as Ue,dN as Be,A as ge,b5 as Ee,dO as we,dP as Fe,dQ as Ae,dR as qe,dS as We,dT as ze,dU as He,dV as Me,dW as Ce,dX as Re,dY as $e,dZ as Te,d_ as Ve,d$ as Ge,e0 as _e,e1 as Qe,e2 as Xe,e3 as Ye,e4 as Je,e5 as Ze,e6 as et,ca as tt,e7 as st,e8 as nt,e9 as at,ea as lt,eb as ot}from"./index-BGHQGV5z.js";function De(t){return[...t.people.map(e=>({person:e,share:!1})),...t.canShare?t.others.map(e=>({person:e,share:!0})):[]]}const Pe=(t,e)=>`${t}-opt-${e}`;function ct(t){const e=Ne.c(7),{result:n}=t;let o;if(e[0]!==t||e[1]!==n){const h=De(n),m=new Map(n.people.map(dt)),i=(d,f)=>{const y=ve(d.person);return s.jsxs("div",{id:Pe(t.id,f),role:"option","aria-selected":f===t.active,className:`mention-row${f===t.active?" is-active":""}${d.share?" is-outside":""}`,"data-testid":"mention-option",onPointerDown:mt,onPointerEnter:()=>t.onActive(f),onClick:()=>t.onPick(d),children:[s.jsx(ke,{userId:d.person.id,label:y,size:24}),s.jsx("span",{className:"mention-name",children:y}),d.person.guest?s.jsx("span",{className:"comment-guest",children:"GUEST"}):null,d.share?s.jsx("span",{className:"mention-share",children:"Share and mention"}):s.jsx("span",{className:"mention-role",children:rt(m.get(d.person.id))})]},d.person.id)};let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"mention-section",role:"presentation",children:"People on this project"}),e[3]=c):c=e[3];let b;e[4]!==n.canShare||e[5]!==n.people.length?(b=n.people.length===0?n.canShare?s.jsx("div",{className:"mention-empty",children:"No one on this Project matches."}):s.jsx("p",{className:"mention-note","data-testid":"mention-no-share",children:"No one on this Project matches. To mention someone else, ask a Project admin to share it with them."}):null,e[4]=n.canShare,e[5]=n.people.length,e[6]=b):b=e[6],o=s.jsxs("div",{id:t.id,role:"listbox","aria-label":"People to mention",className:"mention-menu","data-testid":"mention-menu",children:[c,b,h.filter(it).map((d,f)=>i(d,f)),n.canShare&&n.others.length>0?s.jsxs("div",{className:"mention-outside",role:"presentation",children:[s.jsx("div",{className:"mention-section",children:"In the workspace, no access"}),h.map((d,f)=>d.share?i(d,f):null)]}):null]}),e[0]=t,e[1]=n,e[2]=o}else o=e[2];return o}function it(t){return!t.share}function mt(t){return t.preventDefault()}function dt(t){return[t.id,t.role]}function rt(t){return t===void 0?"":t==="project_admin"?"Admin":t.charAt(0).toUpperCase()+t.slice(1)}const ht=Ie-200;function Ke(t){const e=Ne.c(97),n=Se(),{comments:o}=n,h=Oe().texts[t.threadKey]??"",m=me.useRef(null),i=me.useId(),[c,b]=me.useState(0);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];const[f,y]=me.useState(d),[v,l]=me.useState(null),[N,r]=me.useState(0),[A,C]=me.useState(null),[j,O]=me.useState(null),[k,S]=me.useState(!1);let w;e[1]!==c||e[2]!==h?(w=Le(h,c),e[1]=c,e[2]=h,e[3]=w):w=e[3];const p=w,x=p!==null&&p.start!==A&&v!==null;let g;e[4]!==v?(g=v===null?[]:De(v),e[4]=v,e[5]=g):g=e[5];const $=g;let F,L;e[6]===Symbol.for("react.memo_cache_sentinel")?(F=()=>{m.current?.focus()},L=[],e[6]=F,e[7]=L):(F=e[6],L=e[7]),me.useEffect(F,L);const D=p===null||p.start===A?null:p.query;let H,V;e[8]!==o||e[9]!==D?(H=()=>{if(D===null){l(null);return}let a;return a=!0,o.mentionable(D).then(u=>{a&&(l(u),r(0))},()=>{a&&l(null)}),()=>{a=!1}},V=[o,D],e[8]=o,e[9]=D,e[10]=H,e[11]=V):(H=e[10],V=e[11]),me.useEffect(H,V);let W;e[12]!==o||e[13]!==t.threadKey?(W=(a,u)=>{o.setText(t.threadKey,a),b(u),O(null)},e[12]=o,e[13]=t.threadKey,e[14]=W):W=e[14];const B=W;let de;e[15]!==c||e[16]!==p||e[17]!==n||e[18]!==h||e[19]!==B?(de=a=>{if(p===null)return;const u=ve(a.person),I=Ue(h,p.start,c,u);if(B(I.text,I.caret),y(be=>[...be.filter(ye=>ye.id!==a.person.id),{id:a.person.id,label:u}]),a.share){const be=n.getState().name;be!==null&&window.open(`/projects/?share=${encodeURIComponent(`shot/${be}`)}&with=${encodeURIComponent(a.person.id)}`,"_blank")}requestAnimationFrame(()=>m.current?.setSelectionRange(I.caret,I.caret))},e[15]=c,e[16]=p,e[17]=n,e[18]=h,e[19]=B,e[20]=de):de=e[20];const Y=de;let ae;e[21]!==o||e[22]!==f||e[23]!==k||e[24]!==t.picture||e[25]!==t.threadKey||e[26]!==h?(ae=async()=>{if(k)return;S(!0);const a=await o.post(t.threadKey,Be(h,f),t.picture);S(!1),O(a),a===null&&y([])},e[21]=o,e[22]=f,e[23]=k,e[24]=t.picture,e[25]=t.threadKey,e[26]=h,e[27]=ae):ae=e[27];const z=ae;let G;e[28]!==N||e[29]!==x||e[30]!==$||e[31]!==Y||e[32]!==z||e[33]!==t||e[34]!==p?(G=a=>{if(x&&$.length>0&&(a.key==="ArrowDown"||a.key==="ArrowUp")){a.preventDefault();const u=a.key==="ArrowDown"?1:-1;r(I=>(I+u+$.length)%$.length)}else if(x&&$.length>0&&(a.key==="Enter"||a.key==="Tab")&&!a.ctrlKey&&!a.metaKey)a.preventDefault(),Y($[Math.min(N,$.length-1)]);else if(a.key==="Escape")a.preventDefault(),x?C(p.start):t.onCancel();else if(a.key==="Enter"&&(a.ctrlKey||a.metaKey))a.preventDefault(),z();else return;a.stopPropagation()},e[28]=N,e[29]=x,e[30]=$,e[31]=Y,e[32]=z,e[33]=t,e[34]=p,e[35]=G):G=e[35];const re=G,_=h.trim().length>Ie,P=h.trim()==="";let le;e[36]!==_||e[37]!==h.length?(le=h.length>=ht?s.jsxs("span",{className:`comment-counter${_?" is-over":""}`,"data-testid":"comment-counter",children:[h.length,"/",Ie]}):null,e[36]=_,e[37]=h.length,e[38]=le):le=e[38];const J=le;let oe;e[39]!==h||e[40]!==B?(oe=s.jsx("button",{type:"button",className:"comment-at","aria-label":"Mention someone",title:"Mention someone",onPointerDown:ut,onClick:()=>{const a=m.current,u=a?.selectionStart??h.length,I=u>0&&!/\s/.test(h[u-1])?" @":"@";B(h.slice(0,u)+I+h.slice(u),u+I.length),C(null),requestAnimationFrame(()=>{a?.focus(),a?.setSelectionRange(u+I.length,u+I.length)})},children:"@"}),e[39]=h,e[40]=B,e[41]=oe):oe=e[41];const Q=oe,Z=P||_||k;let ee;e[42]!==z?(ee=()=>void z(),e[42]=z,e[43]=ee):ee=e[43];let X;e[44]!==Z||e[45]!==ee?(X=s.jsx("button",{type:"button",className:"comment-post","data-testid":"comment-post",disabled:Z,onClick:ee,children:"Post"}),e[44]=Z,e[45]=ee,e[46]=X):X=e[46];const te=X,je=t.variant==="new"?2:1,ue=t.variant==="new"?"Add a comment, @ to mention":"Reply, @ to mention",ce=t.variant==="new"?"Comment":"Reply";let se;e[47]!==N||e[48]!==i||e[49]!==x||e[50]!==$?(se=x&&$.length>0?{"aria-activedescendant":Pe(i,N)}:{},e[47]=N,e[48]=i,e[49]=x,e[50]=$,e[51]=se):se=e[51];let K;e[52]!==B?(K=a=>B(a.target.value,a.target.selectionStart),e[52]=B,e[53]=K):K=e[53];let xe;e[54]===Symbol.for("react.memo_cache_sentinel")?(xe=a=>b(a.currentTarget.selectionStart),e[54]=xe):xe=e[54];let fe;e[55]!==i||e[56]!==x||e[57]!==re||e[58]!==je||e[59]!==ue||e[60]!==ce||e[61]!==se||e[62]!==K||e[63]!==h?(fe=s.jsx("textarea",{ref:m,className:"comment-field","data-testid":"comment-field",rows:je,value:h,placeholder:ue,"aria-label":ce,role:"combobox","aria-autocomplete":"list","aria-expanded":x,"aria-controls":i,...se,onChange:K,onSelect:xe,onKeyDown:re}),e[55]=i,e[56]=x,e[57]=re,e[58]=je,e[59]=ue,e[60]=ce,e[61]=se,e[62]=K,e[63]=h,e[64]=fe):fe=e[64];const q=fe;let pe;e[65]!==N||e[66]!==i||e[67]!==x||e[68]!==Y||e[69]!==v?(pe=x?s.jsx(ct,{id:i,result:v,active:N,onPick:Y,onActive:r}):null,e[65]=N,e[66]=i,e[67]=x,e[68]=Y,e[69]=v,e[70]=pe):pe=e[70];const U=pe;let ie;e[71]!==j?(ie=j===null?null:s.jsx("p",{className:"comment-refusal",role:"alert",children:j}),e[71]=j,e[72]=ie):ie=e[72];const E=ie;if(t.variant==="reply"){let a;e[73]!==Q||e[74]!==J||e[75]!==te||e[76]!==q?(a=s.jsxs("div",{className:"comment-reply-row",children:[q,J,Q,te]}),e[73]=Q,e[74]=J,e[75]=te,e[76]=q,e[77]=a):a=e[77];let u;return e[78]!==E||e[79]!==U||e[80]!==a?(u=s.jsxs("div",{className:"comment-reply","data-testid":"comment-composer",children:[U,E,a]}),e[78]=E,e[79]=U,e[80]=a,e[81]=u):u=e[81],u}let R;e[82]!==q?(R=s.jsx("div",{className:"comment-composer-field",children:q}),e[82]=q,e[83]=R):R=e[83];let M;e[84]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx("span",{className:"comment-hint",children:"Ctrl Enter to post · Esc to cancel"}),e[84]=M):M=e[84];let T;e[85]!==Q||e[86]!==J?(T=s.jsxs("div",{className:"comment-composer-hints",children:[Q,M,J]}),e[85]=Q,e[86]=J,e[87]=T):T=e[87];let ne;e[88]!==te||e[89]!==T?(ne=s.jsxs("div",{className:"comment-composer-foot",children:[T,te]}),e[88]=te,e[89]=T,e[90]=ne):ne=e[90];let he;return e[91]!==E||e[92]!==U||e[93]!==t.head||e[94]!==R||e[95]!==ne?(he=s.jsxs("div",{className:"comment-composer","data-testid":"comment-composer",children:[t.head,R,E,ne,U]}),e[91]=E,e[92]=U,e[93]=t.head,e[94]=R,e[95]=ne,e[96]=he):he=e[96],he}function ut(t){return t.preventDefault()}function ft(t){const e=Ne.c(142),n=Se(),{comments:o}=n,{detail:h,names:m,threads:i}=Oe(),c=ge(jt),b=ge(xt),{open:d,menu:f}=Ee(),[y,v]=me.useState(null);if(h===null||c===null)return null;const l=h;let N;e[0]!==c||e[1]!==l.anchor?(N=we(c,l.anchor),e[0]=c,e[1]=l.anchor,e[2]=N):N=e[2];const r=N;let A;e[3]!==c||e[4]!==l.anchor?(A=Fe(c,l.anchor),e[3]=c,e[4]=l.anchor,e[5]=A):A=e[5];const C=A,j=l.status==="resolved";let O;e[6]!==l.anchor.kind?(O=Ae(l.anchor.kind),e[6]=l.anchor.kind,e[7]=O):O=e[7];const k=O;let S,w,p,x,g,$,F,L,D;if(e[8]!==o||e[9]!==c||e[10]!==k||e[11]!==m||e[12]!==d||e[13]!==C||e[14]!==t.className||e[15]!==j||e[16]!==n||e[17]!==l||e[18]!==i||e[19]!==r.text||e[20]!==r.time){const z=qe(c,i,l);let G;e[30]!==l.links?(G=new Set(l.links.map(pt)),e[30]=l.links,e[31]=G):G=e[31];const re=G;let _,P;if(e[32]!==o||e[33]!==c||e[34]!==k||e[35]!==re||e[36]!==m||e[37]!==l.can.reply||e[38]!==l.id||e[39]!==i){let E;e[42]!==k||e[43]!==re?(E=u=>Ae(u.anchor.kind)!==k&&(u.status==="open"||re.has(u.id)),e[42]=k,e[43]=re,e[44]=E):E=e[44];const R=i.filter(E),M=k==="board"?"Link to Studio":"Link to board",T=!l.can.reply||R.length===0,ne=R.length===0?k==="board"?"No Studio comments to link":"No board comments to link":void 0,he=R.map(u=>({kind:"action",id:u.id,label:bt(c,u,m),checked:re.has(u.id),onSelect:()=>P(re.has(u.id)?o.unlink(l.id,u.id):o.link(l.id,u.id))}));let a;e[45]!==M||e[46]!==T||e[47]!==ne||e[48]!==he?(a={kind:"submenu",label:M,disabled:T,title:ne,items:he},e[45]=M,e[46]=T,e[47]=ne,e[48]=he,e[49]=a):a=e[49],_=a,P=u=>{u.then(v)},e[32]=o,e[33]=c,e[34]=k,e[35]=re,e[36]=m,e[37]=l.can.reply,e[38]=l.id,e[39]=i,e[40]=_,e[41]=P}else _=e[40],P=e[41];let le;e[50]!==d?(le=(E,R)=>{const M=E.currentTarget.getBoundingClientRect();d({x:M.left,y:M.bottom+4},R)},e[50]=d,e[51]=le):le=e[51];const J=le;let oe;e[52]!==o||e[53]!==d||e[54]!==P||e[55]!==l.assignee||e[56]!==l.id?(oe=E=>{const R=E.currentTarget.getBoundingClientRect();o.mentionable("").then(M=>d({x:R.left,y:R.bottom+4},[...M.people.map(T=>({kind:"action",id:T.id,label:ve(T),checked:l.assignee?.id===T.id,onSelect:()=>P(o.assign(l.id,T.id))})),{kind:"separator"},{kind:"action",id:"unassign",label:"Unassign",disabled:l.assignee===null,onSelect:()=>P(o.assign(l.id,null))}]),M=>v(M instanceof Error?M.message:String(M)))},e[52]=o,e[53]=d,e[54]=P,e[55]=l.assignee,e[56]=l.id,e[57]=oe):oe=e[57];const Q=oe;p=`comment-thread${t.className===void 0?"":` ${t.className}`}`,x="dialog",g=`Comment, ${r.time===null?"":`${r.time} · `}${r.text}`,$="comment-thread",F=l.anchor.kind;let Z;e[58]!==r.time?(Z=r.time===null?null:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"comment-thread-time",children:r.time}),s.jsx("span",{className:"comment-thread-dot","aria-hidden":"true",children:"·"})]}),e[58]=r.time,e[59]=Z):Z=e[59];let ee;e[60]!==r.text?(ee=s.jsx("span",{className:"comment-thread-where",children:r.text}),e[60]=r.text,e[61]=ee):ee=e[61];let X;e[62]!==o||e[63]!==j||e[64]!==P||e[65]!==l.can.resolve||e[66]!==l.id?(X=l.can.resolve?s.jsxs("button",{type:"button",className:"comment-thread-resolve","data-testid":"comment-resolve",onClick:()=>P(o.setStatus(l.id,j?"open":"resolved")),children:[We,j?"Reopen":"Resolve"]}):null,e[62]=o,e[63]=j,e[64]=P,e[65]=l.can.resolve,e[66]=l.id,e[67]=X):X=e[67];let te;e[68]!==o||e[69]!==_||e[70]!==J||e[71]!==P||e[72]!==l.can.delete||e[73]!==l.id?(te=s.jsx("button",{type:"button",className:"comment-thread-more","aria-label":"More",onClick:E=>J(E,[{kind:"action",id:"close",label:"Close",shortcut:"Esc",onSelect:()=>o.close()},_,{kind:"separator"},{kind:"action",id:"delete",label:"Delete thread",danger:!0,disabled:!l.can.delete,title:l.can.delete?void 0:"Only its author or a Project editor can delete a thread",onSelect:()=>P(o.remove(l.id))}]),children:"···"}),e[68]=o,e[69]=_,e[70]=J,e[71]=P,e[72]=l.can.delete,e[73]=l.id,e[74]=te):te=e[74],e[75]!==Z||e[76]!==ee||e[77]!==X||e[78]!==te?(L=s.jsxs("div",{className:"comment-thread-head",children:[Z,ee,X,te]}),e[75]=Z,e[76]=ee,e[77]=X,e[78]=te,e[79]=L):L=e[79];let je;e[80]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx("span",{className:"comment-thread-meta-label",children:"Assignee"}),e[80]=je):je=e[80];const ue=!l.can.assign;let ce;e[81]!==l.assignee?(ce=l.assignee===null?s.jsx("span",{className:"comment-assignee-none",children:"Unassigned"}):s.jsxs(s.Fragment,{children:[s.jsx(ke,{userId:l.assignee.id,label:ve(l.assignee),size:18}),s.jsx("span",{children:ve(l.assignee)})]}),e[81]=l.assignee,e[82]=ce):ce=e[82];const se=l.can.assign?ze:null;let K;e[83]!==Q||e[84]!==ue||e[85]!==ce||e[86]!==se?(K=s.jsxs("button",{type:"button",className:"comment-assignee","data-testid":"comment-assignee",disabled:ue,onClick:Q,children:[ce,se]}),e[83]=Q,e[84]=ue,e[85]=ce,e[86]=se,e[87]=K):K=e[87];let xe;e[88]===Symbol.for("react.memo_cache_sentinel")?(xe=s.jsx("span",{className:"comment-thread-spacer"}),e[88]=xe):xe=e[88];const fe=`comment-status${j?" is-resolved":""}`;let q;e[89]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx("span",{className:"comment-status-dot","aria-hidden":"true"}),e[89]=q):q=e[89];const pe=j?"Resolved":"Open";let U;e[90]!==fe||e[91]!==pe?(U=s.jsxs("span",{className:fe,children:[q,pe]}),e[90]=fe,e[91]=pe,e[92]=U):U=e[92],e[93]!==K||e[94]!==U?(D=s.jsxs("div",{className:"comment-thread-meta",children:[je,K,xe,U]}),e[93]=K,e[94]=U,e[95]=D):D=e[95],e[96]!==C||e[97]!==l.id||e[98]!==l.snapshotKey||e[99]!==r.text?(S=C!==null&&l.snapshotKey!==null?s.jsx("img",{className:"comment-thread-snapshot",src:He(l.id),alt:`${r.text}, as it was`}):null,e[96]=C,e[97]=l.id,e[98]=l.snapshotKey,e[99]=r.text,e[100]=S):S=e[100];let ie;e[101]!==c||e[102]!==m||e[103]!==n?(ie=E=>s.jsx(Nt,{doc:c,note:E,names:m,onOpen:()=>void n.openThread(E.id)},E.id),e[101]=c,e[102]=m,e[103]=n,e[104]=ie):ie=e[104],w=z.map(ie),e[8]=o,e[9]=c,e[10]=k,e[11]=m,e[12]=d,e[13]=C,e[14]=t.className,e[15]=j,e[16]=n,e[17]=l,e[18]=i,e[19]=r.text,e[20]=r.time,e[21]=S,e[22]=w,e[23]=p,e[24]=x,e[25]=g,e[26]=$,e[27]=F,e[28]=L,e[29]=D}else S=e[21],w=e[22],p=e[23],x=e[24],g=e[25],$=e[26],F=e[27],L=e[28],D=e[29];let H;e[105]!==l.head||e[106]!==l.messages?(H=l.messages??(l.head===null?[]:[l.head]),e[105]=l.head,e[106]=l.messages,e[107]=H):H=e[107];let V;if(e[108]!==m||e[109]!==H){let z;e[111]!==m?(z=G=>s.jsx(gt,{message:G,names:m},G.id),e[111]=m,e[112]=z):z=e[112],V=H.map(z),e[108]=m,e[109]=H,e[110]=V}else V=e[110];let W;e[113]!==V?(W=s.jsx("div",{className:"comment-thread-messages",children:V}),e[113]=V,e[114]=W):W=e[114];let B;e[115]!==y?(B=y===null?null:s.jsx("p",{className:"comment-refusal",role:"alert",children:y}),e[115]=y,e[116]=B):B=e[116];let de;e[117]!==c||e[118]!==b||e[119]!==j||e[120]!==n||e[121]!==l?(de=b||j||!Me()?null:s.jsx("div",{className:"comment-thread-agent",children:s.jsxs("button",{type:"button",className:"comment-agent-button","data-testid":"comment-ask-agent",onClick:()=>n.openAgentWith(Re(c,[l])),children:[Ce(13),"Ask agent to fix"]})}),e[117]=c,e[118]=b,e[119]=j,e[120]=n,e[121]=l,e[122]=de):de=e[122];let Y;e[123]!==o||e[124]!==l.can.reply||e[125]!==l.id?(Y=l.can.reply?s.jsx(Ke,{threadKey:l.id,variant:"reply",onCancel:()=>o.close()},l.id):null,e[123]=o,e[124]=l.can.reply,e[125]=l.id,e[126]=Y):Y=e[126];let ae;return e[127]!==f||e[128]!==S||e[129]!==w||e[130]!==W||e[131]!==B||e[132]!==de||e[133]!==Y||e[134]!==p||e[135]!==x||e[136]!==g||e[137]!==$||e[138]!==F||e[139]!==L||e[140]!==D?(ae=s.jsxs("div",{className:p,role:x,"aria-label":g,"data-testid":$,"data-kind":F,children:[L,D,S,w,W,B,de,Y,f]}),e[127]=f,e[128]=S,e[129]=w,e[130]=W,e[131]=B,e[132]=de,e[133]=Y,e[134]=p,e[135]=x,e[136]=g,e[137]=$,e[138]=F,e[139]=L,e[140]=D,e[141]=ae):ae=e[141],ae}function pt(t){return t.threadId}function xt(t){return t.readOnly}function jt(t){return t.doc}function bt(t,e,n){const o=we(t,e.anchor),h=$e(e.head?.body??"",n).slice(0,40)||"Comment";return`${o.time===null?"":`${o.time} `}${o.text}: ${h}`}function Nt(t){const e=Ne.c(19),{note:n}=t,o=n.anchor.kind==="studio";let h;e[0]!==n.anchor||e[1]!==t.doc?(h=we(t.doc,n.anchor),e[0]=n.anchor,e[1]=t.doc,e[2]=h):h=e[2];const m=h,i=n.head?.body??"";let c;e[3]!==t.names||e[4]!==i?(c=$e(i,t.names).slice(0,80),e[3]=t.names,e[4]=i,e[5]=c):c=e[5];const b=c,d=o?"comment-studio-note":"comment-board-note";let f;e[6]!==m.time?(f=m.time===null?null:s.jsx("span",{className:"comment-note-time",children:m.time}),e[6]=m.time,e[7]=f):f=e[7];const y=o?"Studio note":"Board note",v=b||"Comment";let l;e[8]!==y||e[9]!==v?(l=s.jsxs("span",{className:"comment-note-text",children:[y,": “",v,"”"]}),e[8]=y,e[9]=v,e[10]=l):l=e[10];const N=o?"Open in Studio":"Open on board";let r;e[11]!==t.onOpen||e[12]!==N?(r=s.jsx("button",{type:"button",className:"comment-note-open",onClick:t.onOpen,children:N}),e[11]=t.onOpen,e[12]=N,e[13]=r):r=e[13];let A;return e[14]!==d||e[15]!==f||e[16]!==l||e[17]!==r?(A=s.jsxs("div",{className:"comment-note","data-testid":d,children:[f,l,r]}),e[14]=d,e[15]=f,e[16]=l,e[17]=r,e[18]=A):A=e[18],A}function gt(t){const e=Ne.c(51),{message:n}=t,{comments:o}=Se(),{open:h,menu:m}=Ee(),[i,c]=me.useState(null),[b,d]=me.useState(null);let f;e[0]!==o||e[1]!==i||e[2]!==n.id||e[3]!==n.threadId?(f=async()=>{if(i===null)return;const g=await o.editMessage(n.threadId,n.id,i);d(g),g===null&&c(null)},e[0]=o,e[1]=i,e[2]=n.id,e[3]=n.threadId,e[4]=f):f=e[4];const y=f;let v;e[5]!==n.authorId||e[6]!==n.authorLabel?(v=s.jsx(ke,{userId:n.authorId,label:n.authorLabel,size:24}),e[5]=n.authorId,e[6]=n.authorLabel,e[7]=v):v=e[7];let l;e[8]!==n.authorLabel?(l=s.jsx("span",{className:"comment-message-name",children:n.authorLabel}),e[8]=n.authorLabel,e[9]=l):l=e[9];let N;e[10]!==n.createdAt?(N=new Date(n.createdAt).toLocaleString(),e[10]=n.createdAt,e[11]=N):N=e[11];let r;e[12]!==n.createdAt?(r=Te(n.createdAt),e[12]=n.createdAt,e[13]=r):r=e[13];const A=n.editedAt===null?"":" · edited";let C;e[14]!==N||e[15]!==r||e[16]!==A?(C=s.jsxs("span",{className:"comment-message-time",title:N,children:[r,A]}),e[14]=N,e[15]=r,e[16]=A,e[17]=C):C=e[17];let j;e[18]!==n.viaAgent?(j=n.viaAgent?s.jsxs("span",{className:"comment-via-agent","data-testid":"comment-via-agent",title:"An agent wrote this for them",children:[Ce(9),"via agent"]}):null,e[18]=n.viaAgent,e[19]=j):j=e[19];let O;e[20]!==o||e[21]!==i||e[22]!==n.body||e[23]!==n.can.delete||e[24]!==n.can.edit||e[25]!==n.deleted||e[26]!==n.id||e[27]!==n.threadId||e[28]!==h?(O=(n.can.edit||n.can.delete)&&!n.deleted&&i===null?s.jsx("button",{type:"button",className:"comment-message-more","aria-label":"Message actions",onClick:g=>{const $=g.currentTarget.getBoundingClientRect();h({x:$.left,y:$.bottom+4},[{kind:"action",id:"edit",label:"Edit",disabled:!n.can.edit,onSelect:()=>c(n.body)},{kind:"action",id:"delete",label:"Delete",danger:!0,disabled:!n.can.delete,onSelect:()=>void o.deleteMessage(n.threadId,n.id).then(d)}])},children:"···"}):null,e[20]=o,e[21]=i,e[22]=n.body,e[23]=n.can.delete,e[24]=n.can.edit,e[25]=n.deleted,e[26]=n.id,e[27]=n.threadId,e[28]=h,e[29]=O):O=e[29];let k;e[30]!==l||e[31]!==C||e[32]!==j||e[33]!==O?(k=s.jsxs("div",{className:"comment-message-head",children:[l,C,j,O]}),e[30]=l,e[31]=C,e[32]=j,e[33]=O,e[34]=k):k=e[34];let S;e[35]!==i||e[36]!==n.body||e[37]!==n.deleted||e[38]!==t.names||e[39]!==y?(S=n.deleted?s.jsx("p",{className:"comment-message-body is-deleted",children:"Message deleted"}):i===null?s.jsx(Ve,{body:n.body,names:t.names,className:"comment-message-body"}):s.jsxs("div",{className:"comment-message-edit",children:[s.jsx("textarea",{className:"comment-field","aria-label":"Edit message",value:i,autoFocus:!0,onChange:g=>c(g.target.value),onKeyDown:g=>{if(g.key==="Escape")c(null);else if(g.key==="Enter"&&(g.ctrlKey||g.metaKey))y();else return;g.preventDefault(),g.stopPropagation()}}),s.jsxs("div",{className:"comment-message-edit-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>c(null),children:"Cancel"}),s.jsx("button",{type:"button",className:"comment-post",onClick:()=>void y(),children:"Save"})]})]}),e[35]=i,e[36]=n.body,e[37]=n.deleted,e[38]=t.names,e[39]=y,e[40]=S):S=e[40];let w;e[41]!==b?(w=b===null?null:s.jsx("p",{className:"comment-refusal",role:"alert",children:b}),e[41]=b,e[42]=w):w=e[42];let p;e[43]!==S||e[44]!==w||e[45]!==k?(p=s.jsxs("div",{className:"comment-message-main",children:[k,S,w]}),e[43]=S,e[44]=w,e[45]=k,e[46]=p):p=e[46];let x;return e[47]!==m||e[48]!==v||e[49]!==p?(x=s.jsxs("div",{className:"comment-message","data-testid":"comment-message",children:[v,p,m]}),e[47]=m,e[48]=v,e[49]=p,e[50]=x):x=e[50],x}const vt=[{value:"open",label:"Open"},{value:"resolved",label:"Resolved"},{value:"mine",label:"Mine"},{value:"mentions",label:"Mentions"}];function Tt(){const t=Ne.c(100),e=Se(),n=Oe(),o=ge(At),h=ge(It),m=ge($t),i=ge(Ct);if(o===null)return null;const{filter:c,matched:b,openId:d,detail:f,draft:y,names:v,loaded:l,error:N}=n;let r,A,C,j,O,k,S,w,p,x,g,$,F;if(t[0]!==f||t[1]!==o||t[2]!==y||t[3]!==N||t[4]!==c||t[5]!==l||t[6]!==b||t[7]!==v||t[8]!==m||t[9]!==d||t[10]!==i||t[11]!==n.inbox.items||t[12]!==n.projectId||t[13]!==n.threads||t[14]!==e){const V=m?Ge(n.threads):_e(n.threads);r=V.filter(wt);const W=Qe(V,c,b),B=m?Xe(o,W):[],de=m?Ye(o,W):[],Y=m?[]:Je(o,W);let ae;t[28]!==o||t[29]!==d||t[30]!==n.threads?(ae=new Map(Ze(o,n.threads,d).map(St)),t[28]=o,t[29]=d,t[30]=n.threads,t[31]=ae):ae=t[31];const z=ae,G=c==="open"?et(V,Date.now()):[],re=i===null?0:r.filter(a=>a.anchor.kind==="studio"&&a.anchor.sceneId===i).length,_=!m&&i!==null&&o.scenesById[i]!==void 0;let P;t[32]!==o||t[33]!==_||t[34]!==i?(P=_?`${tt(o,i)??""} ${st(o,i)}`.trim():"Comments",t[32]=o,t[33]=_,t[34]=i,t[35]=P):P=t[35];const le=P,J=_?re:r.length;let oe;t[36]!==y||t[37]!==m?(oe=y!==null&&y.anchor.kind!=="frame"&&Ae(y.anchor.kind)===(m?"board":"studio")?y.anchor:null,t[36]=y,t[37]=m,t[38]=oe):oe=t[38];const Q=oe;let Z;if(t[39]!==n.inbox.items||t[40]!==n.projectId){let a;t[42]!==n.projectId?(a=u=>u.kind==="mention"&&u.readAt===null&&u.projectId===n.projectId,t[42]=n.projectId,t[43]=a):a=t[43],Z=n.inbox.items.some(a),t[39]=n.inbox.items,t[40]=n.projectId,t[41]=Z}else Z=t[41];const ee=Z;let X;t[44]!==n.inbox.items?(X=new Set(n.inbox.items.filter(kt).map(yt)),t[44]=n.inbox.items,t[45]=X):X=t[45];const te=X,je=a=>a==="open"?r.length:a==="resolved"?V.length-r.length:a===c&&b!==null?W.length:null;let ue;t[46]!==f||t[47]!==d?(ue=a=>a.id===d&&f!==null,t[46]=f,t[47]=d,t[48]=ue):ue=t[48];const ce=ue;let se;t[49]!==ce||t[50]!==v||t[51]!==d||t[52]!==e?(se=(a,u,I)=>s.jsxs("div",{children:[s.jsx(Mt,{thread:a,names:v,active:a.id===d,orphan:u,lead:I,onOpen:()=>void e.openThread(a.id)}),ce(a)?s.jsx(ft,{className:"is-inline"}):null]},a.id),t[49]=ce,t[50]=v,t[51]=d,t[52]=e,t[53]=se):se=t[53];const K=se,xe=c==="open"?m?"No open comments. Select a card and press C to comment on it.":"No open Studio comments. Press C, then click the picture to leave one at the playhead.":c==="resolved"?"Nothing resolved yet.":c==="mine"?"No threads you started or were assigned.":"No one has mentioned you here.";g="comments-panel",$="comments-panel",F=m?"board":"studio";const fe=m?"Storyboard":"Studio";let q;t[54]!==fe?(q=s.jsx("span",{className:"comments-place-title",children:fe}),t[54]=fe,t[55]=q):q=t[55];const pe=m?"talks about the plan":"talks about the picture at a moment";let U;t[56]!==pe?(U=s.jsx("span",{className:"comments-place-sub",children:pe}),t[56]=pe,t[57]=U):U=t[57];let ie;t[58]===Symbol.for("react.memo_cache_sentinel")?(ie=s.jsx("span",{className:"comment-thread-spacer"}),t[58]=ie):ie=t[58];const E=`${le} · ${J} open`;let R;t[59]!==le?(R=s.jsx("span",{className:"comments-place-chip-name",children:le}),t[59]=le,t[60]=R):R=t[60];let M;t[61]!==J?(M=s.jsxs("span",{className:"comments-place-chip-count",children:[" · ",J," open"]}),t[61]=J,t[62]=M):M=t[62];let T;t[63]!==E||t[64]!==R||t[65]!==M?(T=s.jsxs("span",{className:"comments-place-chip",title:E,children:[R,M]}),t[63]=E,t[64]=R,t[65]=M,t[66]=T):T=t[66],t[67]!==q||t[68]!==U||t[69]!==T?(j=s.jsxs("div",{className:"comments-place-bar","data-testid":"comments-place-bar",children:[q,U,ie,T]}),t[67]=q,t[68]=U,t[69]=T,t[70]=j):j=t[70],O=s.jsx("div",{className:"comments-filters",role:"radiogroup","aria-label":"Show",children:vt.map(a=>{const u=je(a.value);return s.jsxs("button",{type:"button",role:"radio","aria-checked":c===a.value,className:`comments-filter${c===a.value?" is-active":""}`,"data-testid":`comments-filter-${a.value}`,onClick:()=>void e.comments.setFilter(a.value),children:[a.label,u===null?null:s.jsx("span",{className:"comments-filter-count",children:u}),a.value==="mentions"&&ee?s.jsx("span",{className:"comments-unread-dot","aria-label":"New"}):null]},a.value)})}),A="comments-list",t[71]!==Q?(C=Q===null?null:s.jsx(Ot,{anchor:Q}),t[71]=Q,t[72]=C):C=t[72],k=N!==null?s.jsx("p",{className:"comments-empty",role:"alert",children:N}):!l||c!=="open"&&c!=="resolved"&&b===null?s.jsx("p",{className:"comments-empty",children:"Loading comments…"}):W.length===0&&G.length===0&&Q===null?s.jsx("p",{className:"comments-empty","data-testid":"comments-empty",children:xe}):null;let ne;t[73]!==K?(ne=(a,u)=>s.jsxs("section",{className:`comments-shot${u>0?" is-later":""}`,"data-testid":"comments-card",children:[s.jsxs("header",{className:"comments-shot-head",children:[s.jsx("span",{className:"comments-card-label",children:a.orphan===null?`On card · ${a.label}`:a.label}),s.jsx("span",{className:"comment-thread-spacer"}),a.orphan===null?s.jsx(lt,{target:a.target}):null]}),a.threads.map(I=>K(I,a.orphan!==null))]},a.id),t[73]=K,t[74]=ne):ne=t[74],S=B.map(ne);let he;t[75]!==o||t[76]!==z||t[77]!==K?(he=(a,u)=>s.jsxs("section",{className:`comments-shot${u>0?" is-later":""}`,"data-testid":"comments-studio-shot",children:[s.jsxs("header",{className:"comments-shot-head",children:[a.number===null?null:s.jsx("span",{className:"comments-shot-number",children:a.number}),s.jsx("span",{className:"comments-shot-name",children:a.name}),s.jsx("span",{className:"comment-thread-spacer"}),a.open>0?s.jsxs("span",{className:"comments-shot-open",children:[a.open," open"]}):null]}),a.threads.map(I=>{const be=we(o,I.anchor),ye=z.get(I.id);return K(I,a.number===null,s.jsxs("span",{className:"comments-thread-where",children:[ye===void 0?null:s.jsx("span",{className:"comments-studio-pin",children:ye}),s.jsx("span",{className:"comments-studio-time",children:be.time}),s.jsx("span",{className:"comments-thread-where-text",children:be.text})]}))})]},a.sceneId),t[75]=o,t[76]=z,t[77]=K,t[78]=he):he=t[78],w=Y.map(he),p=de.map((a,u)=>s.jsxs("section",{className:`comments-shot${u>0||B.length>0?" is-later":""}`,children:[s.jsxs("header",{className:"comments-shot-head",children:[a.number===null?null:s.jsx("span",{className:"comments-shot-number",children:a.number}),s.jsx("span",{className:"comments-shot-name",children:a.name}),s.jsx("span",{className:"comment-thread-spacer"}),a.open>0?s.jsxs("span",{className:"comments-shot-open",children:[a.open," open"]}):null]}),a.frames.map((I,be)=>s.jsxs("div",{className:"comments-frame",children:[s.jsx("div",{className:`comments-frame-head${be>0?" is-later":""}`,children:I.orphan===null?s.jsxs(s.Fragment,{children:[s.jsx(nt,{sceneId:a.sceneId,frame:I.frame,width:32,height:18,className:"comments-frame-thumb"}),s.jsxs("span",{className:"comments-frame-label",children:[I.label," · ",(I.frame/(o.fps.num/o.fps.den)).toFixed(1)," s"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"comments-frame-thumb is-removed","aria-hidden":"true"}),s.jsx("span",{className:"comments-frame-removed",children:"Frame removed"}),s.jsxs("span",{className:"comments-frame-was",children:["was ",I.label]})]})}),I.threads.map(ye=>K(ye,I.orphan!==null))]},I.stillId))]},`${a.number??"gone"}:${a.sceneId}`)),x=G.length>0?s.jsxs("section",{className:"comments-today","data-testid":"comments-resolved-today",children:[s.jsx("div",{className:"comments-today-label",children:"Resolved today"}),G.map(a=>s.jsxs("button",{type:"button",className:"comments-today-row",onClick:()=>void e.openThread(a.id),children:[at,s.jsx("span",{className:"comments-today-title",children:$e(a.head?.body??"",v)||"Comment"}),te.has(a.id)?s.jsxs("span",{className:"comment-via-agent",children:[Ce(9),"via agent"]}):null]},a.id))]}):null,t[0]=f,t[1]=o,t[2]=y,t[3]=N,t[4]=c,t[5]=l,t[6]=b,t[7]=v,t[8]=m,t[9]=d,t[10]=i,t[11]=n.inbox.items,t[12]=n.projectId,t[13]=n.threads,t[14]=e,t[15]=r,t[16]=A,t[17]=C,t[18]=j,t[19]=O,t[20]=k,t[21]=S,t[22]=w,t[23]=p,t[24]=x,t[25]=g,t[26]=$,t[27]=F}else r=t[15],A=t[16],C=t[17],j=t[18],O=t[19],k=t[20],S=t[21],w=t[22],p=t[23],x=t[24],g=t[25],$=t[26],F=t[27];let L;t[79]!==A||t[80]!==C||t[81]!==k||t[82]!==S||t[83]!==w||t[84]!==p||t[85]!==x?(L=s.jsxs("div",{className:A,children:[C,k,S,w,p,x]}),t[79]=A,t[80]=C,t[81]=k,t[82]=S,t[83]=w,t[84]=p,t[85]=x,t[86]=L):L=t[86];let D;t[87]!==o||t[88]!==r||t[89]!==h||t[90]!==e?(D=h||r.length===0||!Me()?null:s.jsx("div",{className:"comments-foot",children:s.jsxs("button",{type:"button",className:"comments-agent-all","data-testid":"comments-ask-agent",onClick:()=>e.openAgentWith(Re(o,r)),children:[Ce(13),"Ask agent to fix ",r.length," open"]})}),t[87]=o,t[88]=r,t[89]=h,t[90]=e,t[91]=D):D=t[91];let H;return t[92]!==j||t[93]!==O||t[94]!==L||t[95]!==D||t[96]!==g||t[97]!==$||t[98]!==F?(H=s.jsxs("div",{className:g,"data-testid":$,"data-place":F,children:[j,O,L,D]}),t[92]=j,t[93]=O,t[94]=L,t[95]=D,t[96]=g,t[97]=$,t[98]=F,t[99]=H):H=t[99],H}function yt(t){return t.threadId}function kt(t){return t.kind==="resolved"&&t.viaAgent}function St(t){return[t.threadId,t.initials]}function wt(t){return t.status==="open"}function Ct(t){return t.enteredScene??t.sceneId}function $t(t){return t.storyboardOpen}function It(t){return t.readOnly}function At(t){return t.doc}function Ot(t){const e=Ne.c(15),n=Se(),o=ge(Et);if(o===null)return null;let h;e[0]!==o||e[1]!==t.anchor?(h=we(o,t.anchor),e[0]=o,e[1]=t.anchor,e[2]=h):h=e[2];const m=h;let i;e[3]!==n.comments?(i=()=>n.comments.cancelDraft(),e[3]=n.comments,e[4]=i):i=e[4];let c;e[5]!==m.time?(c=m.time===null?null:s.jsx("span",{className:"comments-studio-time",children:m.time}),e[5]=m.time,e[6]=c):c=e[6];let b;e[7]!==m.text?(b=s.jsx("span",{className:"comment-composer-shot",children:m.text}),e[7]=m.text,e[8]=b):b=e[8];let d;e[9]!==c||e[10]!==b?(d=s.jsxs("div",{className:"comment-composer-head",children:[c,b]}),e[9]=c,e[10]=b,e[11]=d):d=e[11];let f;return e[12]!==i||e[13]!==d?(f=s.jsx("div",{className:"comment-thread is-inline comments-draft","data-testid":"comments-draft",children:s.jsx(Ke,{threadKey:ot,variant:"new",onCancel:i,head:d})}),e[12]=i,e[13]=d,e[14]=f):f=e[14],f}function Et(t){return t.doc}function Mt(t){const e=Ne.c(43),{thread:n}=t,o=n.head?.authorLabel??"Someone",h=Math.max(0,n.messageCount-1),m=`comments-thread${t.active?" is-active":""}`,i=t.active?"true":void 0,c=t.onOpen;let b;e[0]!==o||e[1]!==n.createdBy?(b=s.jsx(ke,{userId:n.createdBy,label:o,size:22,className:"is-tailed"}),e[0]=o,e[1]=n.createdBy,e[2]=b):b=e[2];const d=t.lead;let f;e[3]!==o?(f=s.jsx("span",{className:"comments-thread-name",children:o}),e[3]=o,e[4]=f):f=e[4];let y;e[5]!==n.lastMessageAt?(y=Te(n.lastMessageAt),e[5]=n.lastMessageAt,e[6]=y):y=e[6];let v;e[7]!==y?(v=s.jsx("span",{className:"comments-thread-time",children:y}),e[7]=y,e[8]=v):v=e[8];let l;e[9]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("span",{className:"comment-thread-spacer"}),e[9]=l):l=e[9];let N;e[10]!==n.viewer.unread?(N=n.viewer.unread?s.jsx("span",{className:"comments-unread-dot","aria-label":"Unread","data-testid":"comments-unread"}):null,e[10]=n.viewer.unread,e[11]=N):N=e[11];let r;e[12]!==f||e[13]!==v||e[14]!==N?(r=s.jsxs("span",{className:"comments-thread-head",children:[f,v,l,N]}),e[12]=f,e[13]=v,e[14]=N,e[15]=r):r=e[15];const A=n.head?.body??"";let C;e[16]!==t.names||e[17]!==A?(C=$e(A,t.names),e[16]=t.names,e[17]=A,e[18]=C):C=e[18];let j;e[19]!==C?(j=s.jsx("span",{className:"comments-thread-body",children:C}),e[19]=C,e[20]=j):j=e[20];const O=h===0?"No replies":h===1?"1 reply":`${h} replies`;let k;e[21]!==O?(k=s.jsx("span",{children:O}),e[21]=O,e[22]=k):k=e[22];let S;e[23]!==n.assignee?(S=n.assignee===null?s.jsx("span",{children:"Unassigned"}):s.jsxs("span",{className:"comments-thread-assignee",children:[s.jsx(ke,{userId:n.assignee.id,label:ve(n.assignee),size:14}),ve(n.assignee)]}),e[23]=n.assignee,e[24]=S):S=e[24];let w;e[25]!==k||e[26]!==S?(w=s.jsxs("span",{className:"comments-thread-meta",children:[k,S]}),e[25]=k,e[26]=S,e[27]=w):w=e[27];let p;e[28]!==t.orphan||e[29]!==n.anchor?(p=t.orphan?s.jsx("span",{className:"comments-thread-orphan",children:n.anchor.kind==="frame"?"Shows the picture you saw. Undo the delete and the pin comes back.":"Undo the delete and it comes back where it was."}):null,e[28]=t.orphan,e[29]=n.anchor,e[30]=p):p=e[30];let x;e[31]!==t.lead||e[32]!==r||e[33]!==j||e[34]!==w||e[35]!==p?(x=s.jsxs("span",{className:"comments-thread-main",children:[d,r,j,w,p]}),e[31]=t.lead,e[32]=r,e[33]=j,e[34]=w,e[35]=p,e[36]=x):x=e[36];let g;return e[37]!==t.onOpen||e[38]!==m||e[39]!==i||e[40]!==x||e[41]!==b?(g=s.jsxs("button",{type:"button",className:m,"data-testid":"comments-thread","aria-current":i,onClick:c,children:[b,x]}),e[37]=t.onOpen,e[38]=m,e[39]=i,e[40]=x,e[41]=b,e[42]=g):g=e[42],g}export{Tt as CommentsPanel};
@@ -0,0 +1 @@
1
+ import{q as I,u as T,A as C,B as v,ae as B,af as H,v as n,ag as M,ah as q,ai as F,N as U,aj as Q,ak as Y,al as G,am as V,an as W,ao as K,ap as P,aq as E,ar as J,as as X,at as ee,au as te,av as ne}from"./index-BGHQGV5z.js";const oe=e=>e(),R=1.25;function he(){const e=I.c(20),t=T(),s=C(ae),l=C(se),d=C(B),{prompt:c,dialog:i}=H(),a=l===null?void 0:s?.components?.[l];if(s===null||a===void 0||!d)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(M,{name:"centre",children:n.jsx("div",{className:"stage-window component-studio-hole","aria-hidden":"true","data-testid":"studio-preview-hole"})}),e[0]=r):r=e[0];const h=`Component ${a.name}`;let m;e[1]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(q,{testId:"studio-back",guard:oe}),e[1]=m):m=e[1];let u;e[2]!==a.id?(u={kind:"studio",def:a.id},e[2]=a.id,e[3]=u):u=e[3];let j;e[4]!==a.id||e[5]!==a.name||e[6]!==c||e[7]!==t?(j=()=>{c({title:"Rename component",label:"Name",initialValue:a.name}).then(w=>{w!==null&&t.renameComponent(a.id,w)})},e[4]=a.id,e[5]=a.name,e[6]=c,e[7]=t,e[8]=j):j=e[8];let f;e[9]!==a.name||e[10]!==j?(f=n.jsx("button",{type:"button",className:"component-studio-name","data-testid":"studio-rename",title:"Rename this component",onClick:j,children:a.name}),e[9]=a.name,e[10]=j,e[11]=f):f=e[11];let b;e[12]!==u||e[13]!==f?(b=n.jsx(F,{sel:u,name:f}),e[12]=u,e[13]=f,e[14]=b):b=e[14];let x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs("div",{className:"component-studio-tools",children:[n.jsx(ie,{}),n.jsx(ce,{})]}),e[15]=x):x=e[15];let N;return e[16]!==i||e[17]!==h||e[18]!==b?(N=n.jsxs(n.Fragment,{children:[r,n.jsx(M,{name:"bar",children:n.jsxs("div",{className:"component-studio-bar",role:"group","aria-label":h,"data-testid":"component-studio",children:[i,m,b,x]})})]}),e[16]=i,e[17]=h,e[18]=b,e[19]=N):N=e[19],N}function se(e){return e.editingDef}function ae(e){return e.doc}const S={preview:"components-tab-preview",edit:"components-tab-edit"};let _=!1;function ie(){const e=I.c(10),t=T(),s=C(le);let l;e[0]!==s?(l=()=>{_&&(_=!1,document.querySelector(`[data-testid="${S[s]}"]`)?.focus())},e[0]=s,e[1]=l):l=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[2]=d):d=e[2],v.useEffect(l,d);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=[{value:"preview",label:"Preview",title:"The component alone on the stage",testId:S.preview},{value:"edit",label:"Edit",title:"Edit the component",testId:S.edit}],e[3]=c):c=e[3];let i;e[4]!==t||e[5]!==s?(i=r=>{if(r===s)return;const h=document.activeElement;_=h instanceof HTMLElement&&Object.values(S).includes(h.dataset.testid??""),t.setComponentsTab(r==="edit"?"edit":"preview")},e[4]=t,e[5]=s,e[6]=i):i=e[6];let a;return e[7]!==i||e[8]!==s?(a=n.jsx(U,{ariaLabel:"Components view",className:"is-bar components-tab-switch",value:s,options:c,onChange:i}),e[7]=i,e[8]=s,e[9]=a):a=e[9],a}function le(e){return e.componentsTab}function ce(){const e=I.c(29),t=T(),s=C(me),l=C(de);let d;e[0]!==l||e[1]!==t?(d=l?n.jsx("button",{type:"button",className:"btn","data-testid":"studio-refit",title:"Frame the component head-on again (Home)",onClick:()=>t.fitWorkingView(),children:"Recenter"}):null,e[0]=l,e[1]=t,e[2]=d):d=e[2];let c;e[3]!==t||e[4]!==s?(c=()=>t.setStudioZoom(s/R),e[3]=t,e[4]=s,e[5]=c):c=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Q,{}),e[6]=i):i=e[6];let a;e[7]!==c?(a=n.jsx("button",{type:"button",className:"btn is-icon","data-testid":"studio-zoom-out","aria-label":"Zoom out",title:"Zoom out",onClick:c,children:i}),e[7]=c,e[8]=a):a=e[8];let r;e[9]!==t?(r=()=>t.setStudioZoom(1),e[9]=t,e[10]=r):r=e[10];let h;e[11]!==s?(h=Math.round(s*100),e[11]=s,e[12]=h):h=e[12];let m;e[13]!==r||e[14]!==h?(m=n.jsxs("button",{type:"button",className:"btn zoom-readout","data-testid":"studio-zoom-level",title:"Reset the zoom",onClick:r,children:[h,"%"]}),e[13]=r,e[14]=h,e[15]=m):m=e[15];let u;e[16]!==t||e[17]!==s?(u=()=>t.setStudioZoom(s*R),e[16]=t,e[17]=s,e[18]=u):u=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Y,{}),e[19]=j):j=e[19];let f;e[20]!==u?(f=n.jsx("button",{type:"button",className:"btn is-icon","data-testid":"studio-zoom-in","aria-label":"Zoom in",title:"Zoom in",onClick:u,children:j}),e[20]=u,e[21]=f):f=e[21];let b;e[22]!==a||e[23]!==m||e[24]!==f?(b=n.jsxs("div",{className:"zoom-controls",role:"group","aria-label":"Zoom",children:[a,m,f]}),e[22]=a,e[23]=m,e[24]=f,e[25]=b):b=e[25];let x;return e[26]!==d||e[27]!==b?(x=n.jsxs(n.Fragment,{children:[d,b]}),e[26]=d,e[27]=b,e[28]=x):x=e[28],x}function de(e){return e.isolationOrbit}function me(e){return e.studioZoom}const re="Community is part of the hosted studio.";function fe(e){const t=T(),s=C(o=>o.library),l=C(o=>o.workspaceComponents),d=C(o=>o.componentHomes),c=C(o=>o.readOnly),{guard:i,dialog:a}=G(),[r,h]=v.useState(""),m=e.query??r,u=e.onQuery??h,[j,f]=v.useState(!1),[b,x]=v.useState(""),N=m.trim().toLowerCase(),w=v.useMemo(()=>V(e.doc,s),[e.doc,s]),k=v.useMemo(()=>W(e.doc,s,l,d,w),[e.doc,s,l,d,w]),$=o=>N.length===0||o.toLowerCase().includes(N),D=w.filter(o=>$(o.name)),A=k.filter(o=>$(K(o))),L=ne()!==void 0;v.useEffect(()=>{t.refreshWorkspaceComponents()},[t]);const Z=o=>{const p=b.trim()===""?"Component":b.trim();f(!1),x(""),i(o==="studio"?()=>t.createEmptyComponent(p):()=>void t.newCodeComponent(p))};return n.jsxs("section",{className:"component-library","aria-label":"Components",children:[a,e.current===null?null:n.jsx("label",{className:"file-search components-search",children:n.jsx("input",{type:"search",value:m,placeholder:"Search components","aria-label":"Search components","data-testid":"studio-search",onChange:o=>u(o.target.value)})}),n.jsxs("div",{className:"rail-scroll",children:[n.jsx("ul",{className:"components-list is-home",children:n.jsx(O,{kind:"home",name:"All components",count:w.length+k.length,current:e.current===null,testId:"components-all",title:"Every component of this Project and your library",disabled:!1,onOpen:()=>i(()=>void t.openComponents())})}),n.jsxs("div",{className:"components-section-head","data-testid":"components-project-head",children:[n.jsx("h2",{className:"components-section-title",children:"This project"}),n.jsx("button",{type:"button",className:"components-section-action","data-testid":"studio-new-component","aria-label":"New component","aria-expanded":j,disabled:c,title:"New component",onClick:()=>f(o=>!o),children:"New"})]}),j?n.jsxs("form",{className:"components-new-row","data-testid":"components-new-row",onSubmit:o=>{o.preventDefault(),Z("studio")},children:[n.jsx("input",{className:"components-new-name","data-testid":"components-new-name","aria-label":"New component name",placeholder:"Component",value:b,autoFocus:!0,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),f(!1))}}),n.jsx("button",{type:"submit",className:"btn","data-testid":"components-new-studio",title:"A Studio-made component",children:"3D"}),n.jsx("button",{type:"button",className:"btn","data-testid":"components-new-code",title:"A code component from the three starter",onClick:()=>Z("code"),children:"Code"})]}):null,n.jsx("ul",{className:"components-list","data-testid":"studio-def-list",children:D.map(o=>{const p=o.sel,y=P(p,e.current);return n.jsx(O,{kind:p.kind,name:o.name,current:y,testId:o.refusal===null?void 0:"components-row-unsupported",title:o.refusal??o.name,disabled:o.refusal!==null,onOpen:()=>{if(o.refusal!==null){t.reportError(o.refusal);return}p.kind==="studio"?i(()=>void t.selectComponent(p)):t.selectComponent(p)}},p.kind==="studio"?p.def:p.module)})}),D.length===0&&N.length>0?n.jsxs("p",{className:"insp-empty",children:["No component matches “",m.trim(),"”."]}):null,n.jsxs("div",{className:"components-section-head is-library","data-testid":"components-library-head",children:[n.jsx("h2",{className:"components-section-title",children:"Your library"}),n.jsx("span",{className:"components-section-count","data-testid":"components-library-count",children:k.length})]}),n.jsx("ul",{className:"components-list","data-testid":"components-library-list",children:A.map(o=>{if(o.kind==="studio"){const g=o.component;return n.jsx(O,{kind:"studio",name:g.name,author:E(o),current:!1,title:z(o),disabled:!1,trailing:n.jsx("button",{type:"button",className:"components-use-here","data-testid":"components-use-here",disabled:c,title:`Copy ${g.name} into this Project, linked to its recorded version`,onClick:()=>i(()=>void t.addLibraryComponent(g.id)),children:"Use here"})},g.id)}const{module:p,refusal:y}=o;return n.jsx(O,{kind:"code",name:o.name,author:E(o),current:P({kind:"code",module:p},e.current),testId:y===null?void 0:"components-row-unsupported",title:y??z(o),disabled:y!==null,onOpen:()=>{if(y!==null){t.reportError(y);return}i(()=>void t.openCodeComponent(p))}},p)})}),l!==null&&k.length===0?n.jsx("p",{className:"insp-empty",children:"Code made for no Project, Dailies Library installs and components you add to your library show here."}):null]}),n.jsx("div",{className:"components-rail-footer",children:n.jsxs("button",{type:"button",className:"components-browse","data-testid":"components-browse",disabled:!L,title:L?"Open Community in a new tab":re,onClick:()=>window.open(J(),"_blank","noopener"),children:[n.jsx("span",{children:"Browse Community"}),n.jsx("span",{className:"components-browse-arrow","aria-hidden":"true",children:"→"})]})})]})}function O(e){const t=I.c(27);let s;t[0]!==e.kind?(s=e.kind==="code"?n.jsx(te,{}):e.kind==="home"?X:ee,t[0]=e.kind,t[1]=s):s=t[1];let l;t[2]!==s?(l=n.jsx("span",{className:"components-item-tile","aria-hidden":"true",children:s}),t[2]=s,t[3]=l):l=t[3];let d;t[4]!==e.name?(d=n.jsx("span",{className:"components-item-name",children:e.name}),t[4]=e.name,t[5]=d):d=t[5];let c;t[6]!==e.author?(c=e.author===void 0?null:n.jsx("span",{className:"components-item-author",children:e.author}),t[6]=e.author,t[7]=c):c=t[7];let i;t[8]!==e.count||t[9]!==e.kind?(i=e.kind==="home"?n.jsx("span",{className:"components-section-count",children:e.count}):n.jsx("span",{className:"components-item-kind",children:e.kind==="code"?"CODE":"3D"}),t[8]=e.count,t[9]=e.kind,t[10]=i):i=t[10];let a;t[11]!==l||t[12]!==d||t[13]!==c||t[14]!==i?(a=n.jsxs(n.Fragment,{children:[l,d,c,i]}),t[11]=l,t[12]=d,t[13]=c,t[14]=i,t[15]=a):a=t[15];const r=a,h=`components-item${e.current?" is-current":""}`;let m;t[16]!==r||t[17]!==e.current||t[18]!==e.disabled||t[19]!==e.onOpen||t[20]!==e.title?(m=e.onOpen===void 0?n.jsx("span",{className:"components-item-main",title:e.title,children:r}):n.jsx("button",{type:"button",className:"components-item-main","aria-current":e.current,"aria-disabled":e.disabled||void 0,title:e.title,onClick:e.onOpen,children:r}),t[16]=r,t[17]=e.current,t[18]=e.disabled,t[19]=e.onOpen,t[20]=e.title,t[21]=m):m=t[21];let u;return t[22]!==e.testId||t[23]!==e.trailing||t[24]!==h||t[25]!==m?(u=n.jsxs("li",{className:h,"data-testid":e.testId,children:[m,e.trailing]}),t[22]=e.testId,t[23]=e.trailing,t[24]=h,t[25]=m,t[26]=u):u=t[26],u}function z(e){const t=e.kind==="code"?e.recorded:e.component,s=t===void 0?null:new Date(t.createdAt).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}),l=s===null?E(e):`${E(e)} · recorded ${s}`;return e.kind==="code"?`Open ${e.name} · ${l}`:`${e.component.name} · ${l}. Use here adds a copy to this Project`}export{fe as C,ce as S,ie as a,he as b,z as w};
@@ -0,0 +1 @@
1
+ import{cX as z,cY as X,q as K,B as a,cZ as Z,c_ as Q,n as k,av as ee,v as C,c$ as te,d0 as ne,cK as oe,d1 as se,d2 as re,d3 as ae,d4 as ie,d5 as le,d6 as ce}from"./index-BGHQGV5z.js";const ue="dailies-component-posters",G="posters",w=new Map,_=new Set;function de(t,e,n){let o;try{o=z(X(n))}catch{o="props"}return`${t}|${e}|${o}`}let q=null;function Y(){return q??=new Promise(t=>{try{if(typeof indexedDB>"u"){t(null);return}const e=indexedDB.open(ue,1);e.onupgradeneeded=()=>e.result.createObjectStore(G),e.onsuccess=()=>t(e.result),e.onerror=()=>t(null),e.onblocked=()=>t(null)}catch{t(null)}}),q}async function fe(t){const e=await Y();return e===null?null:new Promise(n=>{try{const o=e.transaction(G,"readonly").objectStore(G).get(t);o.onsuccess=()=>n(o.result instanceof Blob?o.result:null),o.onerror=()=>n(null)}catch{n(null)}})}async function me(t){const e=w.get(t);if(e!==void 0)return e;const n=await fe(t);if(n===null)return null;const o=w.get(t);if(o!==void 0)return o;const s=URL.createObjectURL(n);return w.set(t,s),s}function he(t,e){const n=w.get(t);n!==void 0&&URL.revokeObjectURL(n);const o=URL.createObjectURL(e);w.set(t,o);for(const s of[..._])s(t);return Y().then(s=>{try{s?.transaction(G,"readwrite").objectStore(G).put(e,t)}catch{}}),o}function ge(t){const e=K.c(5);let n;e[0]!==t?(n=()=>t===null?null:w.get(t)??null,e[0]=t,e[1]=n):n=e[1];const[o,s]=a.useState(n);let r,i;return e[2]!==t?(r=()=>{if(t===null){s(null);return}let c;c=!0,s(w.get(t)??null),me(t).then(h=>{c&&h!==null&&s(h)});const l=h=>{h===t&&s(w.get(t)??null)};return _.add(l),()=>{c=!1,_.delete(l)}},i=[t],e[2]=t,e[3]=r,e[4]=i):(r=e[3],i=e[4]),a.useEffect(r,i),o}const pe=6,P=new Map,F=new Set;function Se(t){const e=P.get(t);return e!==void 0?(P.set(t,e+1),!0):P.size>=pe?!1:(P.set(t,1),!0)}function ve(t){const e=P.get(t);if(e!==void 0){if(e>1){P.set(t,e-1);return}P.delete(t);for(const n of[...F])n()}}function be(t,e){const n=K.c(4),[o,s]=a.useState(!1);let r,i;return n[0]!==t||n[1]!==e?(r=()=>{if(!e)return;let c;c=!1;const l=()=>{c||!Se(t)||(c=!0,F.delete(l),s(!0))};return l(),c||F.add(l),()=>{F.delete(l),s(!1),c&&ve(t)}},i=[e,t],n[0]=t,n[1]=e,n[2]=r,n[3]=i):(r=n[2],i=n[3]),a.useEffect(r,i),o&&e}function we(t){const e=K.c(3),[n,o]=a.useState(!1);let s,r;return e[0]!==t?(s=()=>{if(t===null)return;if(typeof IntersectionObserver>"u"){o(!0);return}const i=new IntersectionObserver(c=>{for(const l of c)o(l.isIntersecting)});return i.observe(t),()=>i.disconnect()},r=[t],e[0]=t,e[1]=s,e[2]=r):(s=e[1],r=e[2]),a.useEffect(s,r),n}const W=480;function ye(t){return{width:W,height:Math.max(1,Math.round(W*t.height/t.width))}}function Ee(t,e,n){return Math.floor(Math.max(0,t)/1e3*e)%Math.max(1,Math.round(n))}function Pe(t){const{doc:e,size:n,lengthFrames:o,frame:s}=t,r=a.useRef(null),[i,c]=a.useState(null),l=we(i),h=t.live??!0,u=be(t.slotKey,l&&h),j=a.useRef(Z(Q(k()))).current,[g]=a.useState(ee),[y,x]=a.useState(g===void 0),v=a.useRef(!1),[d,E]=a.useState(null),[S,b]=a.useState("loading"),B=a.useRef(t.onReady);B.current=t.onReady;const M=e===null?0:e.fps.num/e.fps.den,R=ge(t.posterKey),I=a.useRef(!1);a.useEffect(()=>{if(g===void 0)return;let f=!0;const p=()=>{f&&x(!0)};return g.ready.then(p,p),()=>{f=!1}},[g]),a.useEffect(()=>{const f=r.current;if(f===null||!y||!u)return;const p=new AbortController,L=Re({onReady:()=>{b("ready"),B.current?.()},onError:m=>b(m)}),D=()=>{E(null),b("loading"),ne(f,L,{signal:p.signal}).then(m=>{p.signal.aborted||(m.setStoryboardPreview(!0),E(m))}).catch(m=>{p.signal.aborted||b(m instanceof Error?m.message:String(m))})},O=()=>{const m=f.contentWindow;if(g!==void 0&&m!==null){if(m.navigator.serviceWorker?.controller==null&&!v.current){v.current=!0,m.location.reload();return}const U=g.compileVersion();if(U!==null){const V=new BroadcastChannel(te);V.postMessage(U),V.close()}}D()};return f.addEventListener("load",O),g===void 0&&D(),()=>{p.abort(),f.removeEventListener("load",O),E(null),b("loading")}},[g,y,u]),a.useEffect(()=>{d===null||e===null||(d.loadDoc(e),d.seek(s??0))},[d,e,s]);const N=t.posterKey,{width:A,height:H}=n;a.useEffect(()=>{if(d===null||S!=="ready"||N===null)return;const f=new AbortController;I.current=!0;const p=ye({width:A,height:H});return d.captureFrame({frame:s??0,width:p.width,height:p.height,format:"webp",signal:f.signal}).then(L=>{f.signal.aborted||he(N,L)}).catch(()=>{}).finally(()=>{I.current=!1}),()=>{f.abort(),I.current=!1}},[d,S,N,s,A,H]),a.useEffect(()=>{if(d===null||s!==void 0||M<=0)return;let f=0,p=-1;const L=performance.now(),D=O=>{const m=Ee(O-L,M,o);m!==p&&!I.current&&(p=m,d.seek(m)),f=requestAnimationFrame(D)};return f=requestAnimationFrame(D),()=>cancelAnimationFrame(f)},[d,s,M,o]);const $=u&&S==="ready",T=`${A} / ${H}`;return C.jsxs("div",{ref:c,className:t.className===void 0?"component-stage":`component-stage ${t.className}`,"data-live":$?"true":void 0,style:{aspectRatio:T},children:[!$&&R!==null?C.jsx("img",{className:"component-stage-poster",src:R,alt:"",draggable:!1}):null,!u&&R===null?t.fallback:null,u?C.jsx("iframe",{ref:r,className:"component-stage-frame",src:y?j:void 0,title:t.title,tabIndex:-1,style:{aspectRatio:T,opacity:$||R===null?1:0}}):null,u?S==="ready"||R!==null?null:C.jsx("span",{className:"component-stage-status",role:"status",children:S==="loading"?"Loading the preview…":S}):l&&h&&R===null?C.jsx("span",{className:"component-stage-status",role:"status",children:"Preview paused"}):null]})}function Re(t){const e=()=>{},n=()=>!1;return{onReady:()=>t.onReady(),onError:o=>t.onError(o),onStageBusy:e,onPerformance:e,onMaterialCompile:e,onPick:e,onEnterLayer:e,onTextEdit:e,onContextMenu:e,onMeshStats:e,onMeshMaterialSlots:e,onInstanceNaturalSize:e,onTextAutoSize:e,onCommentPin:e,onStudioCommentAt:e,onKeyLightStart:n,onKeyLight:e,onKeyLightEnd:e,onIsolationOrbitTaken:e,onFitRequest:e,onViewChange:e,onWorkingViewChange:e,onActivePane:e,onGestureStart:n,onGesture:e,onGestureEnd:e,onFramingGestureStart:n,onFramingGesture:n,onFramingGestureEnd:e,onLeavePilot:e,onCameraDriver:e,onWaypointGesture:e,onDraw:e,onPenCommit:e,onSplineCreateCommit:e,onSplinePointPick:e,onSplinePointGestureStart:n,onSplinePointGesture:e,onSplinePointGestureEnd:e,onSplineSegmentInsert:e,onSplinePointDelete:e,onSplinePointModeEnd:e,onGuideGestureStart:n,onGuideGesture:e,onGuideGestureEnd:e,onGuideSet:e,onGuideRemove:e,onPathKeyGestureStart:n,onPathKeyGesture:e,onPathKeyGestureEnd:e,onPathKeyDoubleClick:e,onKey:n,onPieceFailures:e,onStageHealth:e}}const Ce=2;function Me(t,e,n,o,s){return ce(t,{component:e.component??"",label:e.label,props:e.props,binding:n},o,s)}function Le(t,e,n,o,s){const{sized:r,sceneId:i}=ie({size:t.size,fps:t.fps,assets:e.assets},o,s),c={...r,components:{...e.nested,[e.def.id]:e.def},...Object.keys(e.materials).length===0?{}:{materials:e.materials}},l=le(c,i,e.def.id);if(l.instanceId===null)return null;const h=l.doc.scenesById[i],u=h.layersById[l.instanceId];return u?.kind!=="component"?null:{...l.doc,scenesById:{...l.doc.scenesById,[i]:{...h,layersById:{...h.layersById,[u.id]:{...u,component:{...u.component,overrides:n}}}}}}}function De(t){if(t===null)return"none";try{return z(X(t))}catch{return z(JSON.stringify(t))}}const J=new WeakMap;function Ge(t,e){let n=J.get(t);n===void 0&&(n=new Map,J.set(t,n));let o=n.get(e);if(o===void 0){const s=se(t,e);o={closure:s,hash:De(s)},n.set(e,o)}return o}function xe(t,e){const n=K.c(3);let o;n[0]!==e||n[1]!==t?(o={key:e,value:t},n[0]=e,n[1]=t,n[2]=o):o=n[2];const[s,r]=a.useState(o);return s.key!==e?(r({key:e,value:t}),t):s.value}function Be(t,e){const n=(s,r)=>typeof document>"u"?r:getComputedStyle(document.documentElement).getPropertyValue(s).trim()||r,o=n("--surface-sunken","#080808");return t==="light"?n("--paper-97","#f5f5f8"):t==="brand"?re(e)??o:o}function Ie(t,e){return t===void 0?void 0:ae({availability:e??"inferred",contract:t})}function Fe(t){const{doc:e,item:n,contract:o,availability:s}=t,r=e.fps.num/e.fps.den,i=n.component===void 0?n.def:void 0,c=i===void 0?null:Ge(e,i),l=c?.closure??null,h=c===null?o?.contractHash??n.contractHash??"none":c.hash,u=xe(l,h),j=u===null?t.lengthFrames:oe(u.def),g=Math.max(1,Math.round(t.loopFrames??j??Ce*r)),y=t.background===void 0?void 0:Be(t.background,e),x=a.useMemo(()=>Ie(o,s),[o,s]),{width:v,height:d}=e.size,{num:E,den:S}=e.fps,b=e.assets,B=a.useMemo(()=>u!==null?Le({size:{width:v,height:d},fps:{num:E,den:S}},u,n.props,g,y):Me({size:{width:v,height:d},fps:{num:E,den:S},assets:b},n,x,g,y),[v,d,E,S,b,n,u,x,g,y]),M=a.useMemo(()=>({width:v,height:d}),[v,d]);return C.jsx(Pe,{doc:B,size:M,lengthFrames:g,...n.frame===void 0?{}:{frame:n.frame},...t.live===void 0?{}:{live:t.live},slotKey:n.id,posterKey:de(n.component??n.def??n.id,h,n.props),title:`Preview of ${n.label}`,fallback:t.fallback})}export{Fe as C,Ce as D,Pe as S,Ie as a,Ge as c,Ee as l,de as p,ge as u};
@@ -0,0 +1 @@
1
+ @layer component-sheets{.curves-scroll{flex:1;min-width:0;min-height:0;overflow-x:auto;overflow-y:hidden}.curves-content{position:relative;min-width:100%;height:100%;touch-action:none}.curves-ruler{position:relative;height:var(--curves-ruler-h, 28px);border-bottom:1px solid var(--line);cursor:ew-resize;overflow:hidden}.curves-ruler-tick{position:absolute;top:var(--space-4);padding-left:var(--space-3);font:var(--type-micro) / var(--leading-xs) var(--font-numeric);font-variant-numeric:var(--numeric);color:var(--ink-3);white-space:nowrap;pointer-events:none}.curves-ruler-tick.is-last{padding-left:0;padding-right:var(--space-3);translate:-100%}.curves-svg{display:block}.curves-offrange{fill:#00000040;pointer-events:none}.curves-grid{stroke:var(--line);pointer-events:none}.curves-vlabels{position:sticky;left:0;width:0;height:0;z-index:2}.curves-vlabel{position:absolute;left:var(--space-2);padding:0 var(--space-1);font:var(--type-micro) / var(--leading-xs) var(--font-numeric);font-variant-numeric:var(--numeric);color:var(--ink-2);background:var(--surface-panel);border-radius:var(--radius-2xs);white-space:nowrap;pointer-events:none}.curves-unit{position:absolute;top:calc(var(--curves-ruler-h, 28px) + var(--space-6));left:var(--space-7);font:var(--type-sm) / var(--leading-xs) var(--font-numeric);color:var(--ink-2);white-space:nowrap;pointer-events:none}.curves-path{fill:none;stroke:var(--curve-color, var(--accent));stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.curves-path.is-spring{stroke:var(--spring)}.curves-other{opacity:.6;pointer-events:none}.curves-other-path{fill:none;stroke:var(--curve-color, var(--ink-3));stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.curves-okf{fill:var(--surface-panel);stroke:var(--curve-color, var(--ink-3));stroke-width:1.5}.curves-tip{position:absolute;display:flex;align-items:center;gap:var(--space-4);height:24px;padding:0 var(--space-4);translate:-50% calc(-100% - var(--space-4));background:var(--fill-rest);border:1px solid var(--line);border-radius:var(--radius-sm);font:var(--type-micro) / var(--leading-xs) var(--font-numeric);font-variant-numeric:var(--numeric);white-space:nowrap;pointer-events:none;z-index:4}.curves-tip-pos{color:var(--ink-1)}.curves-tip-ease{font-family:var(--font-sans);color:var(--accent-ink)}.curves-ghost{fill:none;stroke:var(--ink-3);stroke-width:1.5;stroke-dasharray:4 3;opacity:.7;pointer-events:none}.curves-handle-line{stroke:var(--curve-color, var(--accent));stroke-dasharray:3 3;opacity:.55;pointer-events:none}.curves-handle{fill:var(--surface-panel);stroke:var(--curve-color, var(--accent));stroke-width:1.5;cursor:grab}.curves-handle:hover{fill:var(--curve-color, var(--accent))}.curves-kf{fill:var(--surface-panel);stroke:var(--kf);stroke-width:1.5;cursor:pointer}.curves-kf:hover{stroke-width:2}.curves-kf.is-selected{fill:var(--kf);stroke:var(--ink-1)}.curves-retime{fill:var(--accent);fill-opacity:.18;cursor:ew-resize}.curves-retime:hover{fill-opacity:.5}.curves-marquee{position:absolute;border:1px solid var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent);pointer-events:none;z-index:2}.curves-playhead{position:absolute;top:var(--space-3);bottom:0;left:0;width:1px;background:var(--playhead, var(--accent));pointer-events:none;z-index:3}}
@@ -0,0 +1 @@
1
+ import{B as f,cw as dt,cx as mt,v as a,cy as je,cz as Ge,cA as ze,cB as ft,cC as pt,cD as qe,E as We,u as ht,A as ve,cE as vt,cF as xt,cG as yt,cH as bt,cI as gt,cJ as Pt,i as It,cK as jt,cL as Mt,b5 as wt,cM as $e,cN as kt,cO as Ze,cP as Nt,cQ as Ft,h as St,q as Je,c6 as Qe,cR as Ct,l as Et,cS as Rt,cT as Tt,cU as Kt,cV as Lt,cW as At}from"./index-BGHQGV5z.js";const _e=40;function $t(n,r){if(n.length===0)return{min:0,max:1};let c=1/0,l=-1/0;for(const u of n)u.value<c&&(c=u.value),u.value>l&&(l=u.value);c===l&&(c-=1,l+=1);const p=(l-c)*r;return{min:c-p,max:l+p}}function ie(n,r,c){const l=n.max-n.min;return l===0?r/2:(n.max-c)/l*r}function Dt(n,r,c){return r===0?n.max:n.max-c/r*(n.max-n.min)}function Ot(n,r=5){const c=n.max-n.min;if(!(c>0)||!Number.isFinite(c))return[];const l=c/Math.max(1,r),p=10**Math.floor(Math.log10(l)),u=l/p,i=(u<1.5?1:u<3.5?2:u<7.5?5:10)*p,b=[],I=Math.ceil(n.min/i-1e-9),j=Math.floor(n.max/i+1e-9);for(let T=I;T<=j;T++)b.push(T*i+0);return b}function Xt(n,r=50){for(let c=1;c<=1e12;c*=10)for(const l of[1,2,5])if(l*c*n>=r)return l*c;return 1e12}function Bt(n,r){if(n.length===0||r.length===0)return[];const c=[];let l=null,p=0;for(const u of n){for(;p<r.length&&r[p].frame<=u.frame;)p++;const i=p-1,b=i<0||i>=r.length-1?"bezier":r[i].ease;if(l===null||l.ease!==b){const I=c[c.length-1],j=I?.points[I.points.length-1];l={ease:b,points:j!==void 0?[j]:[]},c.push(l)}l.points.push(u)}return c}function Fe(n,r,c){const l=n.y2-n.y1;return{x:n.x1+r*(n.x2-n.x1),y:l===0?n.y1-c*_e:n.y1+c*l}}function Ht(n,r,c){const l=n.x2-n.x1,p=n.y2-n.y1,u=l===0?0:(r-n.x1)/l,i=p===0?(n.y1-c)/_e:(c-n.y1)/p;return{x:Math.min(1,Math.max(0,u)),y:i}}function De(n){if(n.length===0)return{lo:0,span:1};let r=1/0,c=-1/0;for(const p of n)p.value<r&&(r=p.value),p.value>c&&(c=p.value);const l=c-r;return l>1e-9?{lo:r,span:l}:{lo:r-.5,span:1}}function xe(n,r){return n===null?r:(r-n.lo)/n.span}function Yt(n,r){return n===null?r:n.lo+r*n.span}function Vt(n){if(n.frames.length===0)return null;const r=Math.min(...n.frames),c=Math.max(...n.frames),l=n.viewportPx-n.insetPx;return{pxPerFrame:c>r&&l>0?Math.min(n.bounds.max,Math.max(n.bounds.min,l/(c-r))):n.pxPerFrame,scrollFrame:r}}const Me=28,Oe=32,R=24,Se=2,Ce=2e3,Ee=3,Ut=.1,Xe=4,Gt=5,Be=3.5,He=4;function re(n,r){return ie(n.range,n.height,xe(n.norm,r))}function zt(n,r){return Yt(n.norm,Dt(n.range,n.height,r))}function qt(n){const r=qe(n),c=r===null?"Custom":We.find(l=>l.id===r)?.label??"Custom";return c.charAt(0)+c.slice(1).toLowerCase()}const Wt=n=>String(Number(n.toFixed(2)));function Re(n,r,c){return n.map((l,p)=>`${p===0?"M":"L"}${(l.frame*r).toFixed(1)} ${c(l.value).toFixed(2)}`).join(" ")}const Zt=n=>String(Number(n.toFixed(4)));function Ye(n){return n.kind==="kf"||n.kind==="handle"||n.kind==="retime"}function Jt({model:n,onKeyContextMenu:r,normalize:c=!1,frameAll:l=0,playhead:p}){const u=n.focusedCurve,i=f.useRef(n);i.current=n;const b=u?.rowId??"",I=n.durationFrames,j=n.frame,T=n.pxPerFrame,se=n.selectedKeyframes,ae=f.useRef(null),we=f.useRef(null),y=f.useRef(null),X=f.useRef(null),[Ne,g]=f.useState(0),[P,B]=f.useState(null),[ye,q]=f.useState(null),k=f.useRef(null);function $(){X.current&&(window.removeEventListener("keydown",X.current,!0),X.current=null)}function W(e){return y.current!==null?!1:(y.current=e,!0)}function Z(){const e=y.current;y.current=null,$(),B(null),e&&Ye(e)&&e.moved&&i.current.gesture.end(!1)}function H(){const e=t=>{t.key==="Escape"&&(t.stopPropagation(),Z())};X.current=e,window.addEventListener("keydown",e,!0)}f.useLayoutEffect(()=>{const e=ae.current;if(!e)return;const t=()=>g(Math.max(0,e.clientHeight-Me));t();const o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[]),dt({scrollRef:ae,labelWidth:R,ppf:T,min:n.pxPerFrameBounds.min,max:n.pxPerFrameBounds.max,read:()=>i.current.pxPerFrame,setPxPerFrame:e=>i.current.setPxPerFrame(e)}),f.useLayoutEffect(()=>{if(l===0)return;const e=ae.current,t=i.current;if(!e)return;const o=[t.focusedCurve,...t.curves??[]].flatMap(d=>d?.keyframes.map(F=>F.frame)??[]),h=Vt({frames:o,viewportPx:e.clientWidth,insetPx:R+Oe,pxPerFrame:t.pxPerFrame,bounds:t.pxPerFrameBounds});if(h!==null){if(h.pxPerFrame===t.pxPerFrame){e.scrollLeft=h.scrollFrame*t.pxPerFrame;return}k.current=h.scrollFrame,t.setPxPerFrame(h.pxPerFrame)}},[l]),f.useLayoutEffect(()=>{const e=k.current,t=ae.current;e===null||!t||(k.current=null,t.scrollLeft=e*T)},[T]),f.useEffect(()=>()=>{const e=y.current;y.current=null,$(),e&&Ye(e)&&e.moved&&i.current.gesture.end(!1)},[]);const w=u?.keyframes??[],be=w.length>0?w[w.length-1].frame:0,D=Math.max(I,be+1),S=Math.max(I-1,be),ue=f.useMemo(()=>{if(!u)return[];const e=Math.min(Ce,Math.max(2,Math.round(S*Se)+1));return u.sample(0,S,e)},[u,S]),ge=u?.ghost??null,oe=f.useMemo(()=>{if(!ge)return[];const e=Math.min(Ce,Math.max(2,Math.round(S*Se)+1));return ge.sample(0,S,e)},[ge,S]),Pe=n.curves,de=f.useMemo(()=>{const e=Math.min(Ce,Math.max(2,Math.round(S*Se)+1));return(Pe??[]).map(t=>{const o=t.sample(0,S,e),h=t.keyframes.map(d=>({frame:d.frame,value:d.value}));return{curve:t,samples:o,norm:c?De(o.concat(h)):null}})},[Pe,S,c]),Y=f.useMemo(()=>ue.concat(w.map(e=>({frame:e.frame,value:e.value}))),[ue,w]),me=f.useMemo(()=>c?De(Y):null,[c,Y]),V={range:f.useMemo(()=>{const e=(o,h)=>o.map(d=>({frame:d.frame,value:xe(h,d.value)})),t=e(Y,me).concat(e(oe,me)).concat(de.flatMap(o=>e(o.samples,o.norm)));return $t(t,Ut)},[Y,me,oe,de]),height:Ne,pxPerFrame:T,norm:me},U=y.current,G=U&&"mapping"in U?U.mapping:V,{range:C,height:N,norm:J}=G,x=G.pxPerFrame,Q=R+Math.ceil(D*x)+Oe,s=f.useMemo(()=>w.map(e=>({frame:e.frame,ease:e.easeOut.type})),[w]),m=f.useMemo(()=>Bt(ue,s),[ue,s]),v=f.useMemo(()=>m.map(e=>({spring:e.ease==="spring",d:Re(e.points,x,t=>ie(C,N,xe(J,t)))})),[m,x,C,N,J]),K=f.useMemo(()=>oe.length===0?null:Re(oe,x,e=>ie(C,N,xe(J,e))),[oe,x,C,N,J]),_=f.useMemo(()=>de.map(e=>({rowId:e.curve.rowId,color:e.curve.color,d:Re(e.samples,x,t=>ie(C,N,xe(e.norm,t))),keys:e.curve.keyframes.map(t=>({id:t.id,x:t.frame*x,y:ie(C,N,xe(e.norm,t.value))}))})),[de,x,C,N]),L=mt(D,Xt(x)),pe=Ot(C);if(!u)return null;const Ie=ye===null||U!==null?void 0:w.find(e=>e.id===ye),ee=Ie===void 0?null:{kf:Ie},ce=e=>({rowId:b,keyframeId:e}),et=e=>se.has(je(ce(e.id))),te=w.filter(et).map(e=>({ref:ce(e.id),frame:e.frame,value:e.value})),ne=te.length>=2?{min:te[0].frame,max:te[te.length-1].frame}:null;function ke(e,t){const o=we.current;if(!o)return null;const h=o.getBoundingClientRect();return{x:e-h.left-R,y:t-h.top}}function Te(e){const t=ke(e,0);t!==null&&i.current.setFrame(Math.max(0,Math.round(t.x/x)))}function tt(e){if(e.button===0){if(e.currentTarget.setPointerCapture(e.pointerId),e.shiftKey){const t=ke(e.clientX,e.clientY);if(t===null)return;const o={x:t.x,y:t.y,w:0,h:0};if(!W({kind:"marquee",pointerId:e.pointerId,startX:t.x,startY:t.y,additive:e.ctrlKey||e.metaKey,box:o}))return;B(o),H();return}W({kind:"scrub",pointerId:e.pointerId})&&Te(e.clientX)}}function nt(e){const t=y.current;if(!t||t.pointerId!==e.pointerId)return;if(t.kind==="scrub"){Te(e.clientX);return}if(t.kind!=="marquee")return;const o=ke(e.clientX,e.clientY);o!==null&&(t.box={x:Math.min(t.startX,o.x),y:Math.min(t.startY,o.y),w:Math.abs(o.x-t.startX),h:Math.abs(o.y-t.startY)},B(t.box))}function rt(e){const t=y.current;if(!t||t.pointerId!==e.pointerId)return;if(t.kind==="scrub"){y.current=null;return}if(t.kind!=="marquee")return;const o=t.box;y.current=null,$(),B(null);const h=w.filter(d=>{const F=d.frame*x,M=Me+re(G,d.value);return F>=o.x&&F<=o.x+o.w&&M>=o.y&&M<=o.y+o.h}).map(d=>ce(d.id));i.current.selectKeyframes(h,t.additive?"add":"set")}function st(e){const t=ke(e.clientX,e.clientY);t!==null&&i.current.toggleKeyframe(b,Math.max(0,Math.round(t.x/x)))}function O(){Z()}function at(e,t){e.button!==0||ne===null||(e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),W({kind:"retime",pointerId:e.pointerId,startX:e.clientX,moved:!1,which:t,anchorFrame:t==="left"?ne.max:ne.min,grabFrame:t==="left"?ne.min:ne.max,keys:te,minFactor:pt([te.map(o=>o.frame)]),mapping:V}))}function ot(e){const t=y.current;if(!t||t.kind!=="retime"||t.pointerId!==e.pointerId)return;const o=e.clientX-t.startX;if(!t.moved){if(Math.abs(o)<Ee)return;t.moved=!0,i.current.gesture.begin(),H()}const h=t.grabFrame-t.anchorFrame;if(h===0)return;let d=(t.grabFrame+o/t.mapping.pxPerFrame-t.anchorFrame)/h;d=Math.max(t.minFactor,d),h<0&&(d=Math.min(d,t.anchorFrame/-h));const F=ft([t.keys.map(E=>E.frame)],t.anchorFrame,d);if(F===null)return;const M=new Map(t.keys.map((E,A)=>[E.ref.keyframeId,F[0][A]])),z=[...t.keys].sort((E,A)=>{const le=Math.abs(E.frame-t.anchorFrame),he=Math.abs(A.frame-t.anchorFrame);return d<1?le-he:he-le});i.current.gesture.capture(z.flatMap(E=>{const A=M.get(E.ref.keyframeId);return A===E.frame?[]:[{kind:"move",refs:[E.ref],deltaFrames:A-E.frame}]}))}function ct(e){const t=y.current;!t||t.kind!=="retime"||t.pointerId!==e.pointerId||(y.current=null,$(),t.moved&&i.current.gesture.end(!0))}function lt(e,t){if(e.button!==0)return;e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),q(null);const o=ce(t.id);W({kind:"kf",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,moved:!1,ref:o,refs:[],values:[],startValue:t.value,wasSelected:se.has(je(o)),snap:!e.altKey,mapping:V})}function it(e){const t=y.current;if(!t||t.kind!=="kf"||t.pointerId!==e.pointerId)return;const o=e.clientX-t.startX,h=e.clientY-t.startY;if(!t.moved){if(Math.hypot(o,h)<Ee)return;t.moved=!0,t.wasSelected||i.current.selectKeyframes([t.ref],"set");const M=t.wasSelected?i.current.selectedAddrs.filter(z=>je(z)!==je(t.ref)):[];t.refs=[t.ref,...M],t.values=t.wasSelected?te:[{ref:t.ref,frame:0,value:t.startValue}],i.current.gesture.begin(),H()}const d=o/t.mapping.pxPerFrame,F=M=>zt(t.mapping,re(t.mapping,M)+h);i.current.gesture.capture([{kind:"move",refs:t.refs,deltaFrames:d,snap:t.snap},...t.values.map(M=>({kind:"setValue",ref:M.ref,value:F(M.value)}))])}function ut(e){const t=y.current;if(!t||t.kind!=="kf"||t.pointerId!==e.pointerId)return;if(y.current=null,$(),t.moved){i.current.gesture.end(!0);return}const o=e.ctrlKey||e.metaKey?"toggle":e.shiftKey?"add":"set";i.current.selectKeyframes([t.ref],o)}function Ke(e,t,o,h){if(e.button!==0||t.easeOut.type!=="bezier")return;e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId);const d=V;W({kind:"handle",pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,moved:!1,leftRef:ce(t.id),segPx:{x1:t.frame*d.pxPerFrame,y1:re(d,t.value),x2:o.frame*d.pxPerFrame,y2:re(d,o.value)},base:[...t.easeOut.handles],which:h,mapping:d})}function Le(e){const t=y.current;if(!t||t.kind!=="handle"||t.pointerId!==e.pointerId)return;const o=e.clientX-t.startX,h=e.clientY-t.startY;if(!t.moved){if(Math.hypot(o,h)<Ee)return;t.moved=!0,i.current.gesture.begin(),H()}const d=t.which*2,F=Fe(t.segPx,t.base[d],t.base[d+1]),M=Ht(t.segPx,F.x+o,F.y+h),z=[...t.base];z[d]=M.x,z[d+1]=M.y,i.current.gesture.capture([{kind:"setEase",refs:[t.leftRef],ease:{type:"bezier",handles:z}}])}function Ae(e){const t=y.current;!t||t.kind!=="handle"||t.pointerId!==e.pointerId||(y.current=null,$(),t.moved&&i.current.gesture.end(!0))}return a.jsx("div",{ref:ae,className:"curves-scroll",onPointerDown:tt,onPointerMove:nt,onPointerUp:rt,onPointerCancel:O,onLostPointerCapture:O,onDoubleClick:st,children:a.jsxs("div",{ref:we,className:"curves-content",style:{width:Q,"--curves-ruler-h":`${Me}px`},children:[a.jsxs("div",{className:"curves-vlabels",children:[u.unit!==void 0&&!c&&a.jsx("span",{className:"curves-unit",children:u.unit}),pe.map(e=>a.jsx("span",{className:"curves-vlabel",style:{top:Me+ie(C,N,e)-8},children:Zt(e)},e))]}),a.jsx("div",{className:"curves-ruler",children:L.map((e,t)=>{const o=t===L.length-1&&t>0;return a.jsx("span",{className:`curves-ruler-tick${o?" is-last":""}`,style:{left:R+e*x},children:o?`${e} f`:e},e)})}),a.jsxs("svg",{className:"curves-svg",width:Q,height:N,children:[pe.map(e=>{const t=ie(C,N,e);return a.jsx("line",{className:"curves-grid",x1:0,y1:t,x2:Q,y2:t},e)}),a.jsxs("g",{transform:`translate(${R} 0)`,children:[I>0&&I*x<Q-R&&a.jsx("rect",{className:"curves-offrange",x:I*x,y:0,width:Q-R-I*x,height:N}),_.map(e=>a.jsxs("g",{className:"curves-other","data-row":e.rowId,style:e.color===void 0?void 0:{"--curve-color":e.color},children:[a.jsx("path",{className:"curves-other-path",d:e.d}),e.keys.map(t=>a.jsx("circle",{className:"curves-okf",cx:t.x,cy:t.y,r:Xe-1},t.id))]},e.rowId)),a.jsxs("g",{className:"curves-focus",style:u.color===void 0?void 0:{"--curve-color":u.color},children:[K!==null&&a.jsx("path",{className:"curves-ghost",d:K}),v.map((e,t)=>a.jsx("path",{className:`curves-path${e.spring?" is-spring":""}`,d:e.d},t)),w.map((e,t)=>{const o=w[t+1],h=e.easeOut;if(!o||h.type!=="bezier")return null;const d={x1:e.frame*x,y1:re(G,e.value),x2:o.frame*x,y2:re(G,o.value)},[F,M,z,E]=h.handles,A=Fe(d,F,M),le=Fe(d,z,E);return a.jsxs("g",{children:[a.jsx("line",{className:"curves-handle-line",x1:d.x1,y1:d.y1,x2:A.x,y2:A.y}),a.jsx("line",{className:"curves-handle-line",x1:d.x2,y1:d.y2,x2:le.x,y2:le.y}),a.jsx("circle",{className:"curves-handle",cx:A.x,cy:A.y,r:Be,onPointerDown:he=>Ke(he,e,o,0),onPointerMove:Le,onPointerUp:Ae,onPointerCancel:O,onLostPointerCapture:O}),a.jsx("circle",{className:"curves-handle",cx:le.x,cy:le.y,r:Be,onPointerDown:he=>Ke(he,e,o,1),onPointerMove:Le,onPointerUp:Ae,onPointerCancel:O,onLostPointerCapture:O})]},`h${e.id}`)}),ne!==null&&["left","right"].map(e=>{const t=e==="left"?ne.min:ne.max;return a.jsx("rect",{className:"curves-retime","data-retime":e,x:t*x-He,y:0,width:He*2,height:N,onPointerDown:o=>at(o,e),onPointerMove:ot,onPointerUp:ct,onPointerCancel:O,onLostPointerCapture:O,children:a.jsxs("title",{children:["Drag to retime the ",te.length," selected keyframes"]})},e)}),w.map(e=>{const t=se.has(je(ce(e.id)));return a.jsx("circle",{className:`curves-kf${t?" is-selected":""}`,cx:e.frame*x,cy:re(G,e.value),r:t?Gt:Xe,onPointerEnter:()=>q(e.id),onPointerLeave:()=>q(o=>o===e.id?null:o),onPointerDown:o=>lt(o,e),onPointerMove:it,onPointerUp:ut,onPointerCancel:O,onLostPointerCapture:O,onDoubleClick:o=>o.stopPropagation(),onContextMenu:r===void 0?void 0:o=>{o.preventDefault(),o.stopPropagation(),r(ce(e.id),{x:o.clientX,y:o.clientY})}},e.id)})]})]})]}),ee!==null&&a.jsxs("div",{className:"curves-tip",role:"tooltip",style:{left:R+ee.kf.frame*x,top:Me+re(G,ee.kf.value)},children:[a.jsxs("span",{className:"curves-tip-pos",children:[ee.kf.frame," f · ",Wt(ee.kf.value)]}),a.jsx("span",{className:"curves-tip-ease",children:qt(ee.kf.easeOut)})]}),P!==null&&a.jsx("div",{className:"curves-marquee","data-testid":"curves-marquee",style:{left:R+P.x,top:P.y,width:P.w,height:P.h}}),p===void 0?a.jsx(Ge,{frame:j,ppf:x,offset:R,className:"curves-playhead",children:a.jsx(ze,{frame:j})}):p({ppf:x,offset:R})]})})}const Ve=["var(--curve-1)","var(--curve-2)","var(--curve-3)","var(--curve-4)"],Qt=[{id:"linear",label:"Linear",glyph:"M2 12L12 2"},{id:"ease-in",label:"Ease in",glyph:"M2 12C8 12 10 8 12 2"},{id:"ease-out",label:"Ease out",glyph:"M2 12C4 6 6 2 12 2"},{id:"ease-in-out",label:"Ease in-out",glyph:"M2 12C7 12 7 2 12 2"},{id:"hold",label:"Hold",glyph:"M2 12H8V2H12"}],_t=n=>We.find(r=>r.id===n)?.ease;function rn(){const n=ht(),r=ve(s=>s.doc),c=ve(s=>s.editingDef),l=ve(s=>s.sceneId),p=ve(s=>s.selection),u=ve(s=>s.selectedKeyframes),i=vt({selectedKeyframes:u}),b=ve(s=>s.dockPpf),I=xt(),[j,T]=f.useState("selected"),[se,ae]=f.useState(!1),[we,y]=f.useState(0),[X,Ne]=f.useState(()=>new Set),g=yt({selectedKeyframe:i,selection:p,containerId:c??l},r??void 0),P=f.useMemo(()=>r===null||g===null?[]:j==="all"?bt(r,g.containerId):gt(r,g.containerId,g.layerId),[r,j,g?.containerId,g?.layerId]),[B,ye]=f.useState(null),q=f.useMemo(()=>i===null?null:P.find(m=>m.subject.path===i.path&&m.subject.layerId===i.layerId&&m.numberTrack)?.subject??null,[P,i?.path,i?.layerId]);f.useEffect(()=>{q!==null&&!Pt(q,B)&&ye(q)},[q]);const k=B!==null&&P.some(s=>s.id===Ue(B)&&s.numberTrack)?B:P.find(s=>s.numberTrack)?.subject??null,$=f.useMemo(()=>{const s=new Map;return P.filter(m=>m.numberTrack).forEach((m,v)=>s.set(m.id,Ve[v%Ve.length])),s},[P]),W=f.useMemo(()=>P.filter(s=>s.numberTrack&&X.has(s.id)).map(s=>s.subject),[P,X]),Z=c!==null&&g!==null&&It(g.containerId),H=g?.containerId??null,w=Z||r===null||H===null?0:r.scenesById[H]?.durationFrames??0,be=s=>r===null||H===null?0:Z?s.defFrame:Math.min(Et(r,H,s.frame),Math.max(0,w-1)),D=f.useMemo(()=>{if(r===null||g===null)return null;const s=Z?r.components?.[g.containerId]:void 0,m=s!==void 0?jt(s):r.scenesById[g.containerId]?.durationFrames??0;return Mt({store:n,doc:r,containerId:g.containerId,containerFrames:m,frame:0,fps:r.fps,pxPerFrame:b,focus:k,rows:P,selected:u,defOpen:Z,visible:W,colors:$})},[n,r,g?.containerId,g?.layerId,Z,b,k,P,u,W,$]),S=wt(),ue=(s,m)=>{const v=Rt(s.rowId);if(r===null||v===null)return;const K=$e(r,v.containerId,v.layerId)?.[v.path],_=K?.keyframes.findIndex(ee=>ee.id===s.keyframeId)??-1,L=_<0?void 0:K.keyframes[_];if(K===void 0||L===void 0)return;const pe={containerId:v.containerId,layerId:v.layerId,path:v.path,frame:L.frame},Ie=Tt(n.getState().selectedKeyframes,pe);Ie.length===1&&n.selectKeyframe(pe),S.open(m,Kt({store:n,key:{kind:K.kind,ease:L.easeOut,last:_===K.keyframes.length-1,curved:K.spatialInterp!==void 0},targets:Ie,at:pe}))};if(r===null)return null;const ge=s=>{const m=s.currentTarget.getBoundingClientRect();S.open({x:m.left,y:m.bottom+4},[{kind:"action",id:"selected",label:"Selected",checked:j==="selected",onSelect:()=>T("selected")},{kind:"action",id:"all",label:"All animated",checked:j==="all",onSelect:()=>T("all")}])},oe=u.flatMap(s=>{const m=$e(r,s.containerId,s.layerId)?.[s.path]?.keyframes.find(v=>v.frame===s.frame);return m===void 0?[]:[m.easeOut]}),Pe=new Set(oe.map(qe)),de=Pe.size===1?[...Pe][0]:null,Y=u.length===0,me=s=>{const m=_t(s);Y||m===void 0||n.setKeyframesEase(u.map(v=>({containerId:v.containerId,layerId:v.layerId,path:v.path,frame:v.frame})),m)},fe=u.length===1?u[0]:null,V=fe===null||k===null||D?.focusedCurve==null?void 0:fe.containerId===k.containerId&&fe.layerId===k.layerId&&fe.path===k.path?D.focusedCurve.keyframes.find(s=>s.frame===fe.frame):void 0,U=V===void 0||k===null?null:{ref:{rowId:Ze(k),keyframeId:V.id},frame:V.frame,value:V.value,...kt(k.path)},G=(s,m)=>m===null?r.scenesById[s]?.name??null:St(r,s)?.layersById[m]?.label??null,C=P.filter(s=>s.numberTrack).length,N=s=>Ne(m=>{const v=new Set(m);return v.has(s)?v.delete(s):v.add(s),v}),J=[];let x;for(const s of P){const m=s.subject.layerId??"";if(m!==x){x=m;const L=G(s.subject.containerId,s.subject.layerId);L!==null&&J.push(a.jsxs("div",{className:"curve-scope",children:[a.jsx(Lt,{className:"curve-scope-icon","aria-hidden":"true"}),a.jsx("span",{className:"curve-scope-name",children:L})]},`owner-${m}`))}const v=s.id===Ue(k),K=s.numberTrack&&(v||X.has(s.id)),_=$.get(s.id);J.push(a.jsxs("button",{type:"button",className:`curve-row${v?" is-focused":""}${K?" is-shown":""}${s.numberTrack?"":" is-flat"}`,style:{"--depth":s.depth,..._===void 0?{}:{"--curve-color":_}},"data-testid":`curve-row-${s.subject.path}${s.subject.component===void 0?"":`-${s.subject.component}`}`,disabled:!s.numberTrack,title:s.numberTrack?v?`Editing the ${s.label} curve`:`Edit the ${s.label} curve. Shift-click to ${X.has(s.id)?"hide it":"show it beside the focused one"}`:`${s.label} has no value axis to draw`,onClick:L=>{if(L.shiftKey){v||N(s.id);return}ye(s.subject)},children:[a.jsx("span",{className:`curve-row-dot${s.numberTrack?"":" is-none"}`,"aria-hidden":"true"}),a.jsx("span",{className:"curve-row-name",children:s.label}),s.numberTrack&&a.jsx(tn,{doc:r,subject:s.subject,frameOf:be})]},s.id))}const Q=D!==null&&D.focusedCurve!==null;return a.jsxs("div",{className:"curve-pane","data-testid":"curve-pane",children:[S.menu,a.jsxs("div",{className:"curve-toolbar",children:[a.jsxs("div",{className:"curve-toolbar-scope",style:{width:I},children:[a.jsxs("span",{className:"curve-count",children:["Curves · ",C]}),a.jsxs("button",{type:"button",className:"curve-scope-btn","aria-haspopup":"menu","aria-label":`Show curves: ${j==="all"?"All animated":"Selected"}`,onClick:ge,children:[j==="all"?"All animated":"Selected",a.jsx(Nt,{"aria-hidden":"true"})]})]}),a.jsxs("div",{className:"curve-toolbar-main",children:[a.jsx("div",{className:"curve-presets",role:"group","aria-label":"Ease presets",children:Qt.map(s=>{const m=!Y&&de===s.id;return a.jsxs("button",{type:"button",className:`curve-preset${m?" is-active":""}`,"aria-pressed":m,"aria-disabled":Y,title:Y?"Select keyframes to set their ease":`Set the selected keyframes to ${s.label.toLowerCase()}`,onClick:()=>me(s.id),children:[a.jsx("svg",{className:"curve-preset-glyph",viewBox:"0 0 14 14","aria-hidden":"true",children:a.jsx("path",{d:s.glyph})}),s.label]},s.id)})}),a.jsx("span",{className:"curve-divider","aria-hidden":"true"}),a.jsx("div",{className:"curve-readouts",children:U!==null&&D!==null?a.jsx(Ft,{fields:U,gesture:D.gesture,bare:!0},`${U.ref.rowId}:${U.ref.keyframeId}`):a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"curve-readout",title:"Select one keyframe on this curve to edit its frame",children:[a.jsx("span",{className:"curve-readout-label",children:"Frame"}),a.jsx("span",{className:"curve-readout-value",children:"–"})]}),a.jsxs("span",{className:"curve-readout",title:"Select one keyframe on this curve to edit its value",children:[a.jsx("span",{className:"curve-readout-label",children:"Value"}),a.jsx("span",{className:"curve-readout-value",children:"–"})]})]})})]}),a.jsxs("div",{className:"curve-toolbar-view",children:[a.jsx("button",{type:"button",className:`curve-tool${se?" is-on":""}`,"aria-pressed":se,title:"Scale every curve to its own range, so their timing reads on one axis",onClick:()=>ae(s=>!s),children:"Normalize"}),a.jsx("button",{type:"button",className:"curve-tool is-filled",disabled:!Q,title:"Zoom to fit every key on show",onClick:()=>y(s=>s+1),children:"Frame all"})]})]}),a.jsxs("div",{className:"curve-body",children:[a.jsxs("div",{className:"curve-rows",style:{width:I},children:[a.jsx("div",{className:"curve-list",children:J}),C>0&&a.jsx("div",{className:"curve-hint",children:"Click a curve to edit. Shift-click to show more."})]}),a.jsx("div",{className:"curve-graph",children:P.length===0?a.jsx("div",{className:"curve-empty",children:g===null||g.layerId===null&&j==="selected"?"Keyframe a property to see its curve.":j==="all"?"Nothing in this shot is animated yet. Add a keyframe from the rows or the inspector.":"This element has no keyframes yet. Add one from the rows or the inspector."}):Q?a.jsx(Jt,{model:D,onKeyContextMenu:ue,normalize:se,frameAll:we,playhead:({ppf:s,offset:m})=>a.jsx(en,{ppf:s,offset:m,frameOf:be})}):a.jsx("div",{className:"curve-empty",children:"None of these properties has a value axis to draw. Their keys stay in the rows."})})]})]})}function en(n){const r=Je.c(7),{ppf:c,offset:l,frameOf:p}=n,u=Qe(p);let i;r[0]!==u?(i=a.jsx(ze,{frame:u}),r[0]=u,r[1]=i):i=r[1];let b;return r[2]!==u||r[3]!==l||r[4]!==c||r[5]!==i?(b=a.jsx(Ge,{frame:u,ppf:c,offset:l,className:"curves-playhead",children:i}),r[2]=u,r[3]=l,r[4]=c,r[5]=i,r[6]=b):b=r[6],b}function tn(n){const r=Je.c(6),{doc:c,subject:l,frameOf:p}=n;let u;r[0]!==c||r[1]!==p||r[2]!==l?(u=I=>At(c,l,p(I),c.fps),r[0]=c,r[1]=p,r[2]=l,r[3]=u):u=r[3];const i=Qe(u);let b;return r[4]!==i?(b=i===null?null:a.jsx("span",{className:"curve-row-value",children:Ct(i,.01)}),r[4]=i,r[5]=b):b=r[5],b}function Ue(n){return n===null?"":Ze(n)}export{rn as CurvePane};
@@ -0,0 +1,2 @@
1
+ import{d7 as P,d8 as G,d9 as We,da as ze,db as ot,cn as rt,dc as at,Y as ge,dd as Pe,de as it,df as lt,dg as dt,dh as ct,di as ut,dj as ht,dk as pt,u as ft,A as R,B as u,dl as xt,dm as pe,dn as mt,dp as gt,Z as wt,dq as bt,dr as vt,ds as jt,dt as Oe,v as t,P as yt,N as fe,du as St,dv as kt,dw as Nt,dx as Et,dy as Ct,dz as At,dA as $t,av as Rt,q as we,dB as Tt,dC as Bt,dD as Ft,dE as It,dF as Mt,dG as Pt}from"./index-BGHQGV5z.js";const Ot=.1,_t=10**(Ot/20);function Dt(o){return 20*Math.log10(o)}function Lt(o){const e=Dt(o);return Number.isFinite(e)?`${e>=0?"+":""}${e.toFixed(2)}`:"-inf"}function _e(o){const e=o.map(n=>`"${n}"`);return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}function Wt(o){if(!(o.value>_t))return null;const e=(1/o.value).toFixed(2),n=o.clips.length===0?".":o.clips.length===1?`: ${_e(o.clips)} is the only clip playing there.`:`: ${_e(o.clips)} overlap there.`,r=o.clips.length===1?`Multiply its gain by ${e} and re-render.`:o.clips.length===0?`Multiply the clip gains by ${e} and re-render.`:`Multiply those clips' gain by ${e}, or fade one under the other, and re-render.`;return`warning: the audio mix peaks at ${Lt(o.value)} dBFS on frame ${o.frame}${n} Everything above full scale is flattened when the file is written, which is audible as distortion. ${r}`}function De(o,e){let n=0,r=0;for(let a=0;a<o.length;a++){const l=o[a];if(!Number.isFinite(l))throw new Error(`the audio mix came out corrupt: channel ${e} sample ${a} is ${l}, which would be written to the file as silence. Refusing to export audio that is not what the preview played.`);const d=l<0?-l:l;d>n&&(n=d,r=a)}return{value:n,index:r}}function zt(o,e,n){const r=De(o[0],0),a=De(o[1],1),l=a.value>r.value||a.value===r.value&&a.index<r.index?a:r;return{value:l.value,sampleIndex:l.index,frame:Math.floor(l.index*n.num/(G*n.den)),clips:e.filter(d=>{const p=Math.round(P(d.start,n)*G),h=Math.round(P(d.end,n)*G);return p<=l.index&&l.index<h}).map(d=>d.name)}}const Vt="export capability probe timed out";function qt(o){return Math.max(1,Math.ceil(o.num/(50*o.den)))}function Ut(){if(typeof OfflineAudioContext>"u")throw new Error("audio mixing needs OfflineAudioContext (a real browser)");return{fetchBytes:async o=>{const e=await fetch(o);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.arrayBuffer()},decode:(o,e)=>o.decodeAudioData(e),createContext:(o,e,n)=>new OfflineAudioContext(o,e,n)}}const ae=o=>o instanceof Error?o.message:String(o);function Gt(o,e,n,r,a,l){const d=e.pan??0,p=pt(e),h=ct(e,p.start,a);if(h>=n.duration)return null;const g=ut(e,p.start,r,a,l);if(g.length===0)return null;const f=o.createGain();f.gain.setValueAtTime(g[0].gain,P(g[0].frame,a));for(const $ of g.slice(1))f.gain.linearRampToValueAtTime($.gain,P($.frame,a));const w=o.createBufferSource();if(w.buffer=n,w.connect(f),d===0)f.connect(o.destination);else if(ht(o,f,o.destination,d)===null)throw new Error(`audio clip ${e.name} is panned and this context has no ChannelSplitter`);return w.start(P(p.start,a),h,P(g.at(-1).frame-p.start,a)),{start:p.start,end:g.at(-1).frame}}async function Ht(o,e,n=Ut()){const r=typeof e=="object"?e:void 0,a=typeof e=="string"?We(o,e)??o:o,l=ze(a),d=new Map(l.map(i=>[i.clip.id,i.pan])),p=l.map(i=>i.clip).filter(i=>i.muted!==!0&&(r===void 0||i.frame<r.start+r.frames&&i.frame+i.durationFrames>r.start));if(p.length===0)return null;const h=new Map;for(const i of ot(a))try{const v=await n.fetchBytes(`/studio/assets/${encodeURIComponent(rt(i.path))}`);h.set(i.path,JSON.parse(new TextDecoder().decode(v)))}catch(v){throw new Error(`audio analysis for ${i.path}: ${ae(v)}. A ducked bed cannot be mixed until its voice is measured.`)}const g=at(a,i=>h.get(i.path)),f=r===void 0?ge(a):r.start+r.frames,w=Pe(f,a.fps);if(w<=0)return null;const $=n.createContext(2,w,G),T=new Map,H=[];for(const i of p){const v=a.assets[i.asset];if(v===void 0)throw new Error(`audio clip ${i.id} references unknown asset ${i.asset}`);if(v.kind!=="audio")throw new Error(`audio clip ${i.id} references asset ${i.asset}, which is a ${v.kind}`);const x=it(i,v);let m=T.get(x);if(!m){let Q;try{Q=await n.fetchBytes(`/studio/assets/${encodeURIComponent(x)}`)}catch(M){throw new Error(x===v.path?`audio asset ${v.path}: ${ae(M)}`:`audio clip ${i.id}: its effects could not be rendered (${ae(M)})`)}try{m=await n.decode($,Q)}catch(M){throw new Error(`audio asset ${x}: could not decode (${ae(M)})`)}T.set(x,m)}const B=Gt($,dt(i,d.get(i.id)),m,f,a.fps,lt(g.get(i.id)??i.gainTrack,i.frame,a.fps));B&&H.push({name:i.id,...B})}const O=await $.startRendering(),J=r===void 0?0:Pe(r.start,a.fps),_=[O.getChannelData(0).subarray(J),O.getChannelData(1).subarray(J)],D=r?.start??0;return{sampleRate:G,channels:_,peak:zt(_,H.map(i=>({...i,start:Math.max(0,i.start-D),end:i.end-D})),a.fps)}}const q="",U="work-area";function xe(o){if(o.doc===null||o.workArea===null||At(o)!==null||o.enteredScene!==null)return null;const e=$t(o);return e.frames<ge(o.doc)?e:null}const me=3,Le="the stage reloaded while its encoders were checked",Jt=[["stage_crashed",/stage crashed/],["piece_failed",/piece\(s\)/],["context_lost",/context (is|was) lost/],["render_failed",/render failure/],["module_failed",/module\(s\) failed/],["component_crashed",/crashed while rendering/],["dom_output",/DOM output/],["project_changed",/project changed/]],Qt=["off","private","workspace","link"],Ve="dailies.export.share";function Yt(){try{const o=localStorage.getItem(Ve);return Qt.find(e=>e===o)??"off"}catch{return"off"}}function Kt(o){try{localStorage.setItem(Ve,o)}catch{}}const Xt={off:"The file goes to your downloads only.",private:"Also saved to Videos. Only you can open its page. You can change this later in Videos.",workspace:"Also saved to Videos. Members of this workspace can open its page. You can change this later in Videos.",link:"Also saved to Videos. Anyone with the link can watch it. You can change this later in Videos."};function Zt(o,e){const n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}function os(o){const e=ft(),n=R(s=>s.doc),r=R(s=>s.name),a=R(s=>s.sceneId),l=R(s=>s.renderJob),d=R(s=>s.exportLock),p=u.useSyncExternalStore(e.agentQuestion.subscribe,()=>e.agentQuestion.getState().exportAsk),h=p!==null&&p.projectId===n?.id?p:null,[g]=u.useState(()=>h?.export??null),f=Rt()!==void 0,[w,$]=u.useState(g?.format??"mp4"),[T,H]=u.useState(g?.quality??"social"),[O,J]=u.useState(()=>{if(g!==null){const s=g.scene;return s!==void 0&&e.getState().doc?.scenesById[s]!==void 0?s:q}return xe(e.getState())===null?q:U}),_=R(s=>xe(s)?.start??null),D=R(s=>xe(s)?.frames??null),i=_===null||D===null?null:{start:_,frames:D},v=O===U&&i===null?q:O,x=v===q||v===U?void 0:v,m=v===U?i:null,B=R(xt),[Q,M]=u.useState({runs:[]}),[be,F]=u.useState(null),[ie,qe]=u.useState(!0),[Y,ve]=u.useState("browser"),[j,L]=u.useState(null),[je,ye]=u.useState(1),[Ue,Ge]=u.useState(0),[Se,K]=u.useState(null),[X,He]=u.useState(()=>{const s=Yt();return g!==null&&f&&s==="off"?"private":s}),[Je,Z]=u.useState(null),[ke,le]=u.useState(null),[Qe,Ye]=u.useState(!1),[Ne,Ee]=u.useState(null),Ce=u.useId(),W=u.useRef(!0);u.useEffect(()=>()=>{W.current=!1},[]);const ee=d!==null,Ae=u.useRef(null),$e=u.useRef(null),Re=u.useRef(null);u.useEffect(()=>{const s=document.activeElement;if(s!==null&&s!==document.body)return;const c=ee?$e.current:Ae.current;(c!==null&&!c.disabled?c:Re.current?.closest('[role="dialog"]'))?.focus()},[ee]);const Te=d?.where;u.useEffect(()=>{Te==="server"&&F(null)},[Te]),u.useEffect(()=>{if(e.stage()===null){L("unavailable");return}const s=new AbortController;return(async()=>{for(let c=1;c<=me;c++){const b=e.stage();if(b===null)break;ye(c);let y;try{y=await pe(b.exportCapability(),{stage:()=>e.stage(),bridgeAtStart:b,signal:s.signal,reloaded:Le})}catch(k){if(s.signal.aborted)return;if(k instanceof Error&&k.message===Le)continue;L("unavailable");return}if(s.signal.aborted)return;if(!(y.mp4.ok===!1&&y.mp4.reason===Vt)){L(y);return}}s.signal.aborted||L(e.stage()===null?"unavailable":"unanswered")})(),()=>s.abort()},[e,Ue]);const Ke=()=>{L(null),ye(1),Ge(s=>s+1)},Be=j===null||typeof j=="string"?void 0:w==="gif"?j.gif:j.mp4,te=Be?.ok===!0;if(u.useEffect(()=>{!f&&Y==="browser"&&j!==null&&!te&&ve("server")},[f,Y,j,te]),u.useEffect(()=>{if(r===null||f)return;let s=!0;const c=e.getState().renderJob;return mt(r).then(b=>{s&&(M(b.stats),gt(e,r,b,c))}).catch(()=>{}),()=>{s=!1}},[r,e,l?.phase,f]),n===null||r===null)return null;const de=wt(n),z=m!==null?m.frames:x===void 0?ge(n):(de.find(s=>s.id===x)?.end??0)-(de.find(s=>s.id===x)?.start??0),Fe=(s,c)=>m===null||s<m.start+m.frames&&s+c>m.start,Xe=n.size.width*n.size.height/1e6,ce=x===void 0?n:We(n,x)??n,Ie=ze(ce).filter(s=>Fe(s.clip.frame,s.clip.durationFrames)),E=Ie.filter(s=>s.clip.muted!==!0).length,V=f?"browser":Y,se=V==="browser"&&j!==null&&typeof j!="string"&&!j.audio.ok?j.audio.reason:void 0,ne=w==="mp4"&&ie&&E>0&&se===void 0,ue=ne?bt(n,m??x):{required:[],courtesy:[]},oe=vt(ue),Me=m!==null?"work area":x===void 0?"Project":"Shot",Ze=ce.scenes.some(s=>{const c=ce.scenesById[s]?.effects?.motionBlur,b=de.find(y=>y.id===s);return c!==void 0&&c.samples>1&&(b===void 0||Fe(b.start,b.end-b.start))}),et=jt({width:n.size.width,height:n.size.height,durationFrames:z,fps:n.fps,quality:Oe(T),audio:ne}),he=(s,c,b)=>{s!==null&&e.agentQuestion.reportVideo(s,r,c).catch(y=>{e.reportError(`${b} was exported, but telling the agent failed: ${y instanceof Error?y.message:String(y)}`)})},tt=async()=>{if(d!==null)return;const s=h;F(null);try{if(await e.flush(),e.getState().exportLock!==null)return;const c=await Mt(r,{format:w,quality:T,...x===void 0?{}:{sceneId:x},...m===null?{}:{frameRange:{start:m.start,end:m.start+m.frames}},...ie?{}:{audio:!1}});e.setRenderJob(c),s!==null&&e.agentQuestion.exportOnServer(c.id)}catch(c){c instanceof Pt&&c.conflict?e.getState().exportLock?.where!=="server"&&F(c.message):F(c instanceof Error?c.message:String(c))}},st=async()=>{const s=h,c=e.stage();if(c===null){F("the stage is not connected: reload and try again");return}let b;try{b=e.beginBrowserExport()}catch{return}F(null),le(null),Ee(null),K(null),Z(null);const y={stage:()=>e.stage(),bridgeAtStart:c,signal:b,reloaded:"the stage reloaded: export aborted"};try{const k=ne?await pe((o.mixAudio??Ht)(n,m??x),y):null;if(e.getState().doc!==n)throw new Error("the project changed while its audio was prepared; export refused so sound and video cannot come from different revisions");k!==null&&le(Wt(k.peak));const C=Oe(T),S=await pe(c.exportMovie({format:w,...x===void 0?{}:{sceneId:x},...m===null?{}:{window:m},...w==="gif"?{}:{quantizer:C.crf,videoBitrate:Math.round(C.bitsPerPixel*n.size.width*n.size.height*(n.fps.num/n.fps.den))},...k!==null?{audio:k}:{},signal:b,onProgress:(A,re)=>e.exportProgress(A,re)}),y),N=`${Tt(n,x,m!==null)}${S.extension}`;Zt(S.blob,N),K({phase:"done",filename:N}),f&&X!=="off"?(Z({phase:"saving"}),Bt(S.blob,{project:r,title:n.title??r,filename:N,visibility:X,...oe===""?{}:{credits:Ft(ue)},durationMs:Math.round(z*1e3*n.fps.den/n.fps.num),width:n.size.width,height:n.size.height}).then(A=>{W.current&&Z({phase:"saved",url:A.url}),he(s,{where:"videos",id:A.id,url:A.url},N)},A=>{const re=A instanceof Error?A.message:String(A);W.current?Z({phase:"failed",message:re}):e.reportError(`${N} downloaded, but saving it to Videos failed: ${re}`),he(s,{where:"downloads",filename:N},N)})):he(s,{where:"downloads",filename:N},N),S.encoding?.rateControl==="bitrate"&&S.encoding.encoder==="software"&&Ee("This browser encoded the video in software, so its first second may look softer than the rest."+(f?"":" The studio server render does not have this problem.")),S.audioSkippedReason!==void 0&&le(`The video saved without sound: ${S.audioSkippedReason}.`+(f?"":" The studio server render can include it."))}catch(k){const C=k instanceof Error?k.message:String(k);if(C==="export cancelled"){K({phase:"cancelled"});return}const S=/export refused/.test(C)?Jt.find(([,N])=>N.test(C))?.[0]??null:void 0;It({code:S===void 0?"export.failed":"export.refused",...S==="piece_failed"?{}:{message:C},projectId:n.id,...x===void 0?{}:{shot:x},detail:{format:w,...S===void 0?{}:{refusal:S}}}),W.current?(K(null),F(C)):e.reportError(C)}finally{e.endBrowserExport()}},nt=()=>{B===null&&(V==="browser"?st():tt())};return t.jsx(yt,{open:!0,title:"Export",size:"wide",onClose:o.onClose,...ee?{}:{actions:t.jsx("button",{ref:Ae,type:"button",className:"btn is-primary",disabled:B!==null||V==="browser"&&(j===null||!te),onClick:nt,children:"Export"})},children:t.jsxs("div",{ref:Re,className:"export-dialog","data-testid":"export-dialog",children:[t.jsxs("div",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Format"}),t.jsx(fe,{ariaLabel:"Export format",className:"is-accent is-lg export-switch",value:w,options:[{value:"mp4",label:"MP4"},{value:"gif",label:"GIF"}],onChange:s=>$(s)})]}),f?null:t.jsxs("div",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Render on"}),t.jsx(fe,{ariaLabel:"Render destination",className:"is-accent is-lg export-switch is-destination",value:Y,options:[{value:"browser",label:"This browser"},{value:"server",label:"Studio server"}],onChange:s=>ve(s)})]}),j===null?t.jsx("p",{className:"export-note","data-testid":"export-capability-checking",children:je===1?"Checking this browser's encoder…":`The encoder check ran out of time, so it is checking again (${je} of ${me})…`}):null,j==="unavailable"?t.jsxs("p",{className:"export-note","data-testid":"export-capability-note",children:["The browser export renders through the stage, which is not connected."," ",f?"Reload the editor to reconnect it.":"The studio server render still works."]}):null,j==="unanswered"?t.jsxs("p",{className:"export-note","data-testid":"export-capability-note",children:["This browser's encoder did not answer in ",me," checks."," ",t.jsx("button",{type:"button",className:"link-button",onClick:Ke,children:"Check again"}),f?"":" The studio server render still works."]}):null,j!==null&&typeof j!="string"&&!te?t.jsxs("p",{className:"export-note","data-testid":"export-capability-note",children:["This browser can't encode the ",w==="gif"?"GIF":"MP4",":"," ",Be?.reason??"this stage predates the in-browser GIF encoder.",f?"":" The studio server render still works."]}):null,B!==null&&!ee?t.jsx("p",{className:"export-note","data-testid":"export-blocked-note",children:B}):null,h!==null?t.jsx("p",{className:"export-note","data-testid":"export-agent-note",children:"The agent asked for this export, and is told where the video is saved."}):null,f?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Share"}),t.jsx(fe,{ariaLabel:"Save to Videos",className:"is-accent is-lg export-switch is-share",value:X,options:[{value:"off",label:"Don't save"},{value:"private",label:"Only me"},{value:"workspace",label:"Workspace"},{value:"link",label:"Anyone with the link"}],onChange:s=>{He(s),Kt(s)}})]}),t.jsx("p",{className:"export-note","data-testid":"export-share-note",children:Xt[X]})]}):null,t.jsxs("label",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Quality"}),t.jsx("select",{className:"select is-field export-select","aria-label":"Export quality",value:T,onChange:s=>H(s.target.value),children:St.map(s=>t.jsx("option",{value:s.id,children:s.label},s.id))})]}),t.jsxs("label",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Range"}),t.jsxs("select",{className:"select is-field export-select","aria-label":"Export range",value:v,onChange:s=>J(s.target.value),children:[t.jsx("option",{value:q,children:"Whole Project"}),i===null?null:t.jsx("option",{value:U,children:"Work area"}),n.scenes.map(s=>t.jsxs("option",{value:s,children:[n.scenesById[s]?.name??s,s===a?" (open)":""]},s))]})]}),x!==void 0&&kt(n,x)?t.jsx("p",{className:"export-note","data-testid":"export-transition-note",children:"The transition into this shot plays from the shot before it, so a single-shot render starts on a cut. Render the whole Project to include it."}):null,Ze&&V==="browser"?t.jsxs("p",{className:"export-note","data-testid":"export-blur-note",children:["Motion blur is not rendered in a browser export.",f?"":" The studio server render includes it."]}):null,t.jsxs("label",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Audio"}),t.jsxs("span",{className:"export-audio","data-testid":"export-audio",children:[t.jsx("input",{className:"checkbox",type:"checkbox","aria-label":"Include audio","aria-describedby":Ce,checked:ne,disabled:w==="gif"||E===0||se!==void 0,onChange:s=>qe(s.currentTarget.checked)}),t.jsx("span",{className:"export-audio-hint",id:Ce,children:E===0?Ie.length===0?`no audio clips in this ${Me}`:`every audio clip in this ${Me} is muted`:w==="gif"?`${E} clip${E===1?"":"s"}, but GIF has no audio track`:se!==void 0?`this browser cannot encode audio: ${se}.${f?"":" The studio server render includes it."}`:ie?`${E} clip${E===1?"":"s"} included`:`${E} clip${E===1?"":"s"} will be dropped`})]})]}),oe===""?null:t.jsxs("div",{className:"export-credits","data-testid":"export-credits",children:[t.jsxs("div",{className:"export-row",children:[t.jsx("span",{className:"export-label",children:"Credits"}),t.jsx("button",{type:"button",className:"btn is-outline","data-testid":"export-credits-copy",onClick:()=>{navigator.clipboard?.writeText(oe).then(()=>{W.current&&Ye(!0)},()=>{})},children:Qe?"Copied":"Copy credits"})]}),t.jsx("p",{className:"export-note","data-testid":"export-credits-note",children:ue.required.length>0?"Required by CC BY: put these lines in the video's description or end card.":"No credit is required. These lines thank the people whose sounds you used."}),t.jsx("pre",{className:"export-credits-text","data-testid":"export-credits-text",children:oe})]}),t.jsxs("dl",{className:"export-estimate","data-testid":"export-estimate",children:[t.jsx("dt",{children:"Frames"}),t.jsx("dd",{children:w==="gif"?Math.ceil(z/qt(n.fps)):z}),t.jsx("dt",{children:"Size"}),t.jsx("dd",{children:w==="gif"?"varies with palette":Nt(et)}),V==="server"?t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:"Time"}),t.jsx("dd",{children:Et(Q,Xe,z)})]}):null]}),t.jsx("div",{className:"export-outcome-slot",role:"status",children:d!==null?t.jsx(I,{kind:"rendering",title:"Rendering",action:t.jsx("button",{ref:$e,type:"button",className:"btn export-outcome-cancel",onClick:()=>e.cancelExport(),children:"Cancel export"}),children:t.jsxs("p",{className:"export-outcome-copy","data-testid":"export-progress","aria-live":"off",children:[Ct(d),d.where==="browser"?" in this browser":""]})}):be!==null?t.jsx(I,{kind:"failed",title:"Failed",children:t.jsx("p",{className:"export-outcome-copy","data-testid":"export-error",children:be})}):Se!==null?t.jsx(es,{job:Se,shared:Je}):l!==null?t.jsx(ss,{job:l}):null}),(l?.warnings??[]).map(s=>t.jsx("p",{className:"export-note","data-testid":"export-warning",children:s},s)),ke!==null&&t.jsx("p",{className:"export-note","data-testid":"export-audio-notice",children:ke}),Ne!==null&&t.jsx("p",{className:"export-note","data-testid":"export-encoder-notice",children:Ne})]})})}function I(o){const e=we.c(10),n=`export-outcome is-${o.kind}`;let r;e[0]!==o.title?(r=t.jsx("span",{className:"export-outcome-title",children:o.title}),e[0]=o.title,e[1]=r):r=e[1];let a;e[2]!==o.action||e[3]!==r?(a=t.jsxs("div",{className:"export-outcome-head",children:[r,o.action]}),e[2]=o.action,e[3]=r,e[4]=a):a=e[4];let l;return e[5]!==o.children||e[6]!==o.kind||e[7]!==n||e[8]!==a?(l=t.jsxs("section",{className:n,"data-outcome":o.kind,children:[a,o.children]}),e[5]=o.children,e[6]=o.kind,e[7]=n,e[8]=a,e[9]=l):l=e[9],l}function es(o){const e=we.c(9),{job:n,shared:r}=o,[a,l]=u.useState(!1);if(n.phase==="done"){let p;e[0]!==n.filename?(p=t.jsxs("p",{className:"export-outcome-copy","data-testid":"export-progress",children:["Saved ",n.filename," to your downloads."]}),e[0]=n.filename,e[1]=p):p=e[1];let h;e[2]!==a||e[3]!==r?(h=r===null?null:r.phase==="saving"?t.jsx("p",{className:"export-outcome-copy","data-testid":"export-share",children:"Saving to Videos…"}):r.phase==="failed"?t.jsxs("p",{className:"export-outcome-copy","data-testid":"export-share",children:["Saving to Videos failed: ",r.message,". The download still stands."]}):t.jsxs("p",{className:"export-outcome-copy export-share-links","data-testid":"export-share",children:[t.jsx("button",{type:"button",className:"link-button",onClick:()=>{navigator.clipboard?.writeText(r.url).then(()=>l(!0),ts)},children:a?"Link copied":"Copy link"}),t.jsx("a",{className:"link-button",href:r.url,target:"_blank",rel:"noopener",children:"Open page ↗"})]}),e[2]=a,e[3]=r,e[4]=h):h=e[4];let g;return e[5]!==p||e[6]!==h?(g=t.jsxs(I,{kind:"done",title:"Saved",children:[p,h]}),e[5]=p,e[6]=h,e[7]=g):g=e[7],g}let d;return e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(I,{kind:"cancelled",title:"Cancelled",children:t.jsx("p",{className:"export-outcome-copy","data-testid":"export-progress",children:"Export cancelled. Nothing was saved."})}),e[8]=d):d=e[8],d}function ts(){}function ss(o){const e=we.c(13),{job:n}=o;if(n.phase==="done"){let h;return e[0]!==n.out?(h=t.jsx(I,{kind:"done",title:"Saved",children:t.jsxs("p",{className:"export-outcome-copy","data-testid":"export-progress",children:["Written to ",n.out]})}),e[0]=n.out,e[1]=h):h=e[1],h}if(n.phase==="cancelled"){let h;return e[2]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(I,{kind:"cancelled",title:"Cancelled",children:t.jsx("p",{className:"export-outcome-copy","data-testid":"export-progress",children:"Render cancelled. Nothing was written."})}),e[2]=h):h=e[2],h}const r=n.error??"The render failed.";let a;e[3]!==r?(a=t.jsx("p",{className:"export-outcome-copy","data-testid":"export-progress",children:r}),e[3]=r,e[4]=a):a=e[4];let l;e[5]!==n.diagnostics?(l=n.diagnostics!==void 0&&t.jsxs("p",{className:"export-outcome-copy","data-testid":"export-diagnostics",children:["Diagnostics for the failing frame: ",t.jsx("code",{children:n.diagnostics})]}),e[5]=n.diagnostics,e[6]=l):l=e[6];let d;e[7]!==n.log?(d=n.log!==void 0&&n.log.length>0&&t.jsxs("details",{className:"export-log","data-testid":"export-log",children:[t.jsxs("summary",{children:[t.jsx("svg",{className:"export-log-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:t.jsx("path",{d:"m3 4.5 3 3 3-3"})}),"Render output"]}),t.jsx("pre",{children:n.log.join(`
2
+ `)})]}),e[7]=n.log,e[8]=d):d=e[8];let p;return e[9]!==a||e[10]!==l||e[11]!==d?(p=t.jsxs(I,{kind:"failed",title:"Failed",children:[a,l,d]}),e[9]=a,e[10]=l,e[11]=d,e[12]=p):p=e[12],p}export{os as ExportDialog};
@@ -0,0 +1 @@
1
+ import{bK as P,bL as fe,bM as se,bN as V,bO as de,bP as he,bQ as pe,bR as ke,bS as me,bT as ge,u as B,B as u,aY as ye,v as o,bU as be,A as L,bV as ve,b0 as J,bW as xe,bX as ee,N as je,bY as K,bZ as we,b_ as Ne,b$ as Fe,q as Ee,c0 as Re,c1 as Ce,c2 as Se,c3 as Me}from"./index-BGHQGV5z.js";const O={project:"In this Project",recent:"Recent",workspace:"Workspace fonts",google:"Google Fonts"};function Ie(n,e){const s=P(n);return s===e?0:s.startsWith(e)?1:s.split(" ").some(i=>i.startsWith(e))?2:s.includes(e)?3:-1}const oe=n=>ge(n)?{kind:"variable"}:{kind:"count",count:n.weights.length,unit:"weight"};function te(n,e){const s=P(e.family);return{type:"font",id:`${n}:${s}`,key:s,family:e.family,section:n,pick:{kind:"google",entry:e},machine:!1,face:pe(e),tag:oe(e),category:e.category,recent:{kind:"google",family:e.family}}}function ne(n,e,s){const i=P(e);return{type:"font",id:`${n}:${i}`,key:i,family:e,section:n,pick:{kind:"workspace",family:e,fonts:s},machine:!1,face:ke(s),tag:s.some(h=>h.wghtAxis!==void 0)?{kind:"variable"}:{kind:"count",count:s.length,unit:"style"},category:null,recent:{kind:"workspace",family:e}}}function Ae(n,e,s){const i=n.source==="catalog"&&s!==null?V(s,n.family):void 0,h=n.pick.faces;return{type:"font",id:`project:${n.key}`,key:n.key,family:n.family,section:"project",pick:n.pick,machine:!1,face:he(n,e.assets,s),tag:i!==void 0?oe(i):h.some(f=>f.axis!==void 0)?{kind:"variable"}:{kind:"count",count:h.length,unit:"style"},category:i?.category??null,recent:n.source==="file"?null:{kind:n.source==="catalog"?"google":"workspace",family:n.family}}}function De(n,e,s){const i=s===null?void 0:V(s,e);return{type:"font",id:`project:${n}`,key:n,family:e,section:"project",pick:i===void 0?null:{kind:"google",entry:i},machine:!0,face:{family:e,url:null},tag:{kind:"machine"},category:i?.category??null,recent:i===void 0?null:{kind:"google",family:i.family}}}function Pe(n){const e=new Map;for(const s of n){const i=e.get(s.family);i===void 0?e.set(s.family,[s]):i.push(s)}return[...e]}function Te(n){const{doc:e,catalog:s,workspace:i,query:h,category:f}=n,N=P(h),F=c=>c.category===null?f===null:me({category:c.category},f),M=new Set,d=[],p=(c,y)=>{let m=y.filter(F);N.length>0&&c!=="google"&&(m=m.map((r,k)=>({row:r,at:k,tier:Ie(r.family,N)})).filter(r=>r.tier>=0).sort((r,k)=>r.tier-k.tier||r.at-k.at).map(r=>r.row));const g=[];for(const r of m)M.has(r.key)||(M.add(r.key),g.push(r));g.length!==0&&d.push({type:"head",id:`head:${c}`,label:O[c],...c==="google"?{count:g.length}:{}},...g)},I=fe(e,s,i);return p("project",[...I.families.map(c=>Ae(c,e,s)),...I.machine.filter(c=>c.key===n.current||!se(c.family)).map(c=>De(c.key,c.family,s))]),p("recent",n.recents.flatMap(c=>{if(c.kind==="google"){const m=s===null?void 0:V(s,c.family);return m===void 0?[]:[te("recent",m)]}const y=(i??[]).filter(m=>P(m.family)===P(c.family));return y.length===0?[]:[ne("recent",y[0].family,y)]})),i!==null?p("workspace",Pe(i).map(([c,y])=>ne("workspace",c,y))):n.workspaceFailed&&d.push({type:"head",id:"head:workspace",label:O.workspace},{type:"note",id:"note:workspace",text:"Workspace fonts did not load. Open the picker again to retry.",busy:!1}),s!==null?p("google",de(s,h).map(c=>te("google",c))):d.push({type:"head",id:"head:google",label:O.google},n.catalogFailed?{type:"note",id:"note:google",text:"Google Fonts did not load. Open the picker again to retry.",busy:!1}:{type:"note",id:"note:google",text:"Loading Google Fonts…",busy:!0}),d}const D=32,$e=8,He=560,Ke=.7,Le=12,_e=200;function Ue(n,e){const s=Math.max(e-n.bottom,n.top)-Le;return Math.floor(Math.max(_e,Math.min(He,e*Ke,s)))}function Xe(n){const e=B(),s=u.useRef(null),i=u.useRef(null),h=d=>{e.previewFont(null),n.onClose(d)};ye(!0,n.anchor,d=>{const p=d?.frameElement;if(!(p instanceof HTMLElement))return h("refocus");h("stay"),p.focus()},{window:!1,blur:!1});const f=()=>(n.view==="list"?s.current:i.current)?.focus();u.useEffect(f,[n.view]);const N=()=>{const d=n.anchor.current?.getBoundingClientRect();return d===void 0?null:Ue(d,window.innerHeight)},[F,M]=u.useState(N);return u.useEffect(()=>{const d=()=>M(N());return window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[]),o.jsx(be,{open:!0,anchor:n.anchor,align:"right",className:"font-picker",onPlaced:f,onClose:d=>h(d==="escape"?"refocus":"stay"),children:o.jsx("div",{className:"font-picker-frame",...F===null?{}:{style:{height:F}},onPointerDown:d=>{d.target.closest("input, button, a")===null&&d.preventDefault()},onKeyDown:d=>d.stopPropagation(),children:n.view==="list"?o.jsx(We,{...n,search:s,dismiss:h}):o.jsx(ze,{choose:i,onBack:()=>n.onView("list"),onDone:()=>h("refocus")})})})}function We(n){const e=B(),s=L(t=>t.doc),i=L(t=>t.fontCatalog),h=L(t=>t.workspaceFonts),[f,N]=u.useState(!1),[F,M]=u.useState(!1),[d]=u.useState(ve),[p,I]=u.useState(""),[c,y]=u.useState(null),[m,g]=u.useState(null),r=u.useRef(!1),k=u.useRef(!0),E=u.useRef(null),x=u.useRef(null),R=u.useRef(null),l=u.useId(),b=`${l}-list`,T=t=>`${l}-option-${t}`;u.useEffect(()=>{let t=!0;return e.loadFontCatalog().then(a=>{t&&a===null&&N(!0)}),e.loadWorkspaceFonts(!0).then(a=>{t&&a===null&&M(!0)}),()=>{t=!1,e.previewFont(null)}},[e]);const j=n.current===null?null:P(n.current),v=u.useMemo(()=>s===null?[]:Te({doc:s,catalog:i,catalogFailed:f,workspace:h?.fonts??null,workspaceFailed:F,recents:d,query:p,category:c,current:j}),[s,i,f,h,F,d,p,c,j]),C=u.useMemo(()=>v.flatMap((t,a)=>t.type==="font"?[a]:[]),[v]),ae=u.useMemo(()=>new Map(C.map((t,a)=>[t,a+1])),[C]),w=u.useMemo(()=>{if(m!==null){const a=v.findIndex(S=>S.id===m);if(a>=0)return a}const t=p===""&&j!==null?v.findIndex(a=>a.type==="font"&&a.key===j):-1;return t>=0?t:C[0]??-1},[m,v,C,p,j]),G=v[w],A=G?.type==="font"?G:null;u.useEffect(()=>{if(!r.current)return;const t=A?.key===j&&(A.machine||!n.currentMachine);e.previewFont(A===null||t?null:A.pick)},[A?.id]),u.useLayoutEffect(()=>{const t=x.current;if(!k.current||t===null||w<0)return;k.current=!1;const a=(v[w-1]?.type==="head"?w-1:w)*D,S=(w+1)*D;a<t.scrollTop?t.scrollTop=a:S>t.scrollTop+t.clientHeight&&(t.scrollTop=S-t.clientHeight)},[w,v]);const ce=J({listRef:R,scrollSelector:".font-picker-scroll",count:v.length,rowHeight:D,enabled:!0}),z=J({listRef:R,scrollSelector:".font-picker-scroll",count:v.length,rowHeight:D,enabled:!0,overscanRows:0}),_=t=>{const a=t===void 0?void 0:v[t];a?.type==="font"&&(r.current=!0,k.current=!0,g(a.id))},H=t=>{const a=C.indexOf(w);_(C[a<0?0:Math.max(0,Math.min(C.length-1,a+t))])},q=()=>{const t=x.current?.clientHeight??0;return t>0?Math.max(1,Math.floor(t/D)-1):$e},X=t=>{if(t.machine&&t.pick===null&&se(t.family)){n.dismiss("refocus");return}if(t.machine&&t.pick===null){n.onView("upload");return}t.machine&&t.key===j?e.selfHostFont():t.pick!==null&&(t.key!==j||n.currentMachine)&&e.applyFont(t.pick),t.recent!==null&&Me(t.recent),n.dismiss("refocus")},Y=t=>{y(t),g(null),r.current=!0,k.current=!0},le=t=>{const a=K.length,S=K.findIndex($=>$.category===c);Y(K[((S+t)%a+a)%a].category)},Q=p.trim()!==""&&C.length===0&&(i!==null||f),ie=t=>{if(!t.nativeEvent.isComposing){if(t.altKey&&(t.key==="ArrowLeft"||t.key==="ArrowRight")){le(t.key==="ArrowRight"?1:-1),t.preventDefault();return}if(t.altKey&&!t.ctrlKey&&!t.metaKey&&t.code==="KeyU"){n.onView("upload"),t.preventDefault();return}switch(t.key){case"ArrowDown":H(1);break;case"ArrowUp":H(-1);break;case"PageDown":H(q());break;case"PageUp":H(-q());break;case"Home":_(C[0]);break;case"End":_(C[C.length-1]);break;case"Enter":A!==null?X(A):Q&&n.onView("upload");break;case"Tab":n.dismiss("tab");return;default:return}t.preventDefault()}},re=(t,a)=>{const S={x:a.clientX,y:a.clientY},$=E.current;E.current=S,!($!==null&&$.x===S.x&&$.y===S.y||t===w)&&(r.current=!0,g(v[t].id))},ue=(t,a)=>t.type==="head"?o.jsxs("li",{role:"presentation",className:"caps font-picker-head",children:[t.label,t.count!==void 0&&o.jsx("span",{className:"font-picker-num",children:t.count.toLocaleString("en-US")})]},t.id):t.type==="note"?o.jsxs("li",{role:"presentation",className:"font-picker-note","aria-busy":t.busy,children:[t.busy&&o.jsx("span",{className:"font-picker-spinner","aria-hidden":"true"}),t.text]},t.id):o.jsx(Ve,{id:T(a),row:t,position:ae.get(a),size:C.length,active:a===w,onScreen:a>=z.start&&a<z.end,current:t.key===j,onHover:S=>re(a,S),onPick:()=>X(t)},t.id),U=[];let W=0;const Z=(t,a)=>{a>t&&U.push(o.jsx("li",{role:"presentation","aria-hidden":"true",className:"font-picker-gap",style:{height:(a-t)*D}},`gap-${t}-${a}`))};for(const t of xe(ce,v.length,w>=0?[w]:[])){Z(W,t.start);for(let a=t.start;a<t.end;a++)U.push(ue(v[a],a));W=t.end}return Z(W,v.length),o.jsxs("div",{className:"font-picker-body",style:{"--font-picker-row-h":`${D}px`},children:[o.jsxs("div",{className:"font-picker-top",children:[o.jsxs("label",{className:"search-field font-picker-search",children:[o.jsx(ee,{"aria-hidden":"true"}),o.jsx("input",{ref:n.search,type:"text",role:"combobox","aria-label":"Search fonts","aria-expanded":"true","aria-controls":b,"aria-autocomplete":"list","aria-keyshortcuts":"Alt+ArrowLeft Alt+ArrowRight Alt+U",...A!==null?{"aria-activedescendant":T(w)}:{},autoComplete:"off",spellCheck:!1,placeholder:"Search fonts",value:p,onChange:t=>{I(t.target.value),g(null),r.current=!0,k.current=!0},onKeyDown:ie})]}),o.jsx("div",{className:"font-picker-chips",onPointerDown:t=>t.preventDefault(),children:o.jsx(je,{className:"is-chips",ariaLabel:"Font category",value:c??"all",options:K.map(t=>({value:t.category??"all",label:t.label})),onChange:t=>Y(t==="all"?null:t)})})]}),o.jsxs("div",{className:"font-picker-scroll",ref:x,children:[o.jsx("ul",{id:b,ref:R,role:"listbox","aria-label":"Fonts",className:"font-picker-list",children:U}),Q&&o.jsxs("div",{className:"empty font-picker-empty",children:[o.jsxs("p",{className:"empty-line",children:[o.jsx(ee,{"aria-hidden":"true"}),"No fonts match “",p.trim(),"”"]}),o.jsx("button",{type:"button",className:"btn",onClick:()=>n.onView("upload"),children:"Upload font file"})]})]}),o.jsxs("div",{className:"font-picker-foot",children:[o.jsxs("span",{className:"font-picker-keys",children:[o.jsx("kbd",{className:"kbd",children:"↑"}),o.jsx("kbd",{className:"kbd",children:"↓"})," Move",o.jsx("kbd",{className:"kbd",children:"↵"})," Apply",o.jsx("kbd",{className:"kbd",children:"Esc"})," Close"]}),o.jsxs("button",{type:"button",className:"btn is-ghost",title:"Upload font (Alt+U)","aria-keyshortcuts":"Alt+U",onClick:()=>n.onView("upload"),children:[o.jsx(we,{"aria-hidden":"true"}),"Upload font"]})]})]})}const Oe=n=>n.kind==="variable"?"variable":n.kind==="machine"?"machine font":`${n.count} ${n.unit}${n.count===1?"":"s"}`;function Ve(n){const e=Ee.c(36),{row:s}=n,i=Re(n.onScreen?s.face:null),h=i==="loading",f=s.tag,N=n.id,F=n.active,M=n.position,d=n.size,p=s.family,I=n.current?"current font":null;let c;e[0]!==f?(c=Oe(f),e[0]=f,e[1]=c):c=e[1];let y;e[2]!==s.family||e[3]!==I||e[4]!==c?(y=[p,I,c].filter(Boolean),e[2]=s.family,e[3]=I,e[4]=c,e[5]=y):y=e[5];const m=y.join(", "),g=`font-picker-row${n.active?" is-active":""}${h?" is-loading":""}`;let r;e[6]!==n.current?(r=n.current&&o.jsx(Ce,{}),e[6]=n.current,e[7]=r):r=e[7];let k;e[8]!==r?(k=o.jsx("span",{className:"font-picker-check","aria-hidden":"true",children:r}),e[8]=r,e[9]=k):k=e[9];let E;e[10]!==s.face||e[11]!==i?(E=i==="ready"&&s.face!==null?{style:{fontFamily:Se(s.face)}}:{},e[10]=s.face,e[11]=i,e[12]=E):E=e[12];let x;e[13]!==s.family||e[14]!==E?(x=o.jsx("span",{className:"font-picker-name",...E,children:s.family}),e[13]=s.family,e[14]=E,e[15]=x):x=e[15];let R;e[16]!==h?(R=h&&o.jsx("span",{className:"font-picker-spinner","aria-hidden":"true"}),e[16]=h,e[17]=R):R=e[17];let l;e[18]!==f.count||e[19]!==f.kind||e[20]!==f.unit?(l=f.kind==="variable"?o.jsx("span",{className:"badge",children:"Variable"}):f.kind==="machine"?o.jsx("span",{className:"font-picker-machine",children:"Machine font"}):o.jsxs("span",{className:"font-picker-count",children:[o.jsx("span",{className:"font-picker-num",children:f.count})," ",f.unit,f.count===1?"":"s"]}),e[18]=f.count,e[19]=f.kind,e[20]=f.unit,e[21]=l):l=e[21];let b;return e[22]!==h||e[23]!==n.active||e[24]!==n.id||e[25]!==n.onHover||e[26]!==n.onPick||e[27]!==n.position||e[28]!==n.size||e[29]!==k||e[30]!==x||e[31]!==R||e[32]!==l||e[33]!==m||e[34]!==g?(b=o.jsxs("li",{id:N,role:"option","aria-selected":F,"aria-posinset":M,"aria-setsize":d,"aria-busy":h,"aria-label":m,className:g,onPointerMove:n.onHover,onClick:n.onPick,children:[k,x,R,l]}),e[22]=h,e[23]=n.active,e[24]=n.id,e[25]=n.onHover,e[26]=n.onPick,e[27]=n.position,e[28]=n.size,e[29]=k,e[30]=x,e[31]=R,e[32]=l,e[33]=m,e[34]=g,e[35]=b):b=e[35],b}const Be=".ttf,.otf,.woff,.woff2",Ge=n=>Number((n/1e6).toFixed(1));function ze(n){const e=B(),s=L(l=>l.workspaceFonts),[i,h]=u.useState(!1),[f,N]=u.useState(!1),[F,M]=u.useState(null),[d,p]=u.useState(!1),I=u.useRef(null),c=u.useRef(!0),y=u.useId(),m=()=>{p(!1),e.loadWorkspaceFonts(!0).then(l=>{c.current&&l===null&&p(!0)})};u.useEffect(()=>(c.current=!0,m(),()=>{c.current=!1}),[e]);const g=s===null?null:s.canManage?s.fonts.length>=s.maxFonts?`This workspace has ${s.fonts.length} of ${s.maxFonts} font files. Remove one in Manage workspace fonts.`:null:"Your role can't add workspace fonts.",r=g!==null||f,k=async l=>{if(r||l.length===0)return;N(!0),M(null);const{outcome:b}=await e.uploadWorkspaceFonts(l);c.current&&(N(!1),b.status==="applied"?n.onDone():b.status!=="superseded"&&M(b.message??"The font file did not upload."))},E=l=>[...l.dataTransfer.types].includes("Files"),x=l=>{E(l)&&(l.preventDefault(),l.dataTransfer.dropEffect=r?"none":"copy",r||h(!0))},R=l=>{if(l.key!=="Tab")return;const b=[...l.currentTarget.querySelectorAll("button, a[href]")],T=b[0],j=b[b.length-1];T===void 0||j===void 0||(l.shiftKey&&document.activeElement===T?(l.preventDefault(),j.focus()):!l.shiftKey&&document.activeElement===j&&(l.preventDefault(),T.focus()))};return o.jsxs("div",{className:"font-picker-body font-picker-upload",onKeyDown:R,children:[o.jsxs("div",{className:"font-picker-upload-head",children:[o.jsxs("button",{type:"button",className:"btn is-ghost font-picker-back",onClick:n.onBack,children:[o.jsx(Ne,{"aria-hidden":"true"}),"Back"]}),o.jsx("span",{className:"font-picker-title",children:"Upload font"})]}),o.jsxs("div",{className:`drop font-picker-drop${i?" is-over":""}${r?" is-disabled":""}`,"aria-disabled":r,"aria-busy":f,...g!==null?{"aria-describedby":y}:{},onDragEnter:x,onDragOver:x,onDragLeave:l=>{l.currentTarget.contains(l.relatedTarget)||h(!1)},onDrop:l=>{E(l)&&(l.preventDefault(),h(!1),k([...l.dataTransfer.files]))},children:[o.jsx("span",{children:f?"Uploading…":"Drop font files here"}),o.jsx("button",{ref:n.choose,type:"button",className:"btn","aria-disabled":r,...g!==null?{"aria-describedby":y}:{},onClick:()=>{r||I.current?.click()},children:"Choose file"}),o.jsxs("span",{className:"font-picker-limits",children:["ttf · otf · woff · woff2",s!==null&&o.jsxs(o.Fragment,{children:[" ","· up to ",o.jsx("span",{className:"font-picker-num",children:Ge(s.limitBytes)})," MB"]})]}),o.jsx("input",{ref:I,type:"file",hidden:!0,accept:Be,multiple:!0,onChange:l=>{const b=[...l.target.files??[]];l.target.value="",k(b)}})]}),s===null&&d?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"font-picker-line is-warn",role:"alert",children:"Workspace fonts did not load."}),o.jsx("button",{type:"button",className:"btn font-picker-retry",onClick:m,children:"Try again"})]}):s===null?o.jsx("p",{className:"font-picker-line is-quiet","aria-busy":"true",children:"Reading workspace fonts…"}):o.jsxs("p",{className:"font-picker-line",children:[o.jsx("span",{className:"font-picker-num",children:s.fonts.length})," of ",o.jsx("span",{className:"font-picker-num",children:s.maxFonts})," font files"]}),g!==null&&o.jsx("p",{id:y,className:"font-picker-line",children:g}),F!==null&&o.jsx("p",{className:"font-picker-line is-warn",role:"alert",children:F}),o.jsx("p",{className:"font-picker-line is-quiet",children:"Only upload fonts you have a license to use."}),o.jsx("a",{className:"font-picker-manage",href:Fe,target:"_blank",rel:"noopener",children:"Manage workspace fonts ↗"})]})}export{D as FONT_PICKER_ROW_H,Xe as FontPicker};
@@ -0,0 +1 @@
1
+ @layer component-sheets{.font-picker{width:340px;display:flex;flex-direction:column;overflow:hidden}.font-picker-frame{max-height:min(560px,70vh);min-height:0;display:flex;flex-direction:column}.font-picker-body{--font-picker-row-h: 32px;flex:1 1 auto;min-height:0;display:flex;flex-direction:column}.font-picker-top{flex:none;display:flex;flex-direction:column;gap:var(--space-4);padding:var(--space-4);border-bottom:1px solid var(--line-soft)}.font-picker-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.font-picker-list{margin:0;padding:0;list-style:none}.font-picker-gap{margin:0;padding:0}.font-picker-head{display:flex;align-items:center;justify-content:space-between;height:var(--font-picker-row-h);padding:0 var(--space-6)}.font-picker-num{font-family:var(--font-numeric);font-variant-numeric:var(--numeric)}.font-picker-note{display:flex;align-items:center;gap:var(--space-4);height:var(--font-picker-row-h);padding:0 var(--space-6);font-size:var(--type-md);line-height:var(--leading-xs);color:var(--ink-3)}.font-picker-row{display:flex;align-items:center;gap:var(--space-4);height:var(--font-picker-row-h);margin:0 var(--space-3);padding:0 var(--space-4);border-radius:var(--radius-sm);color:var(--ink-1);cursor:default;user-select:none}.font-picker-row.is-active{background:var(--accent-quiet)}.font-picker-check{flex:none;display:inline-flex;justify-content:center;width:16px;color:var(--accent-ink)}.font-picker-check>svg{width:12px;height:12px}.font-picker-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--type-title);line-height:var(--leading-md)}.font-picker-row.is-loading .font-picker-name{color:var(--ink-3)}.font-picker-count{flex:none;font-size:var(--type-sm);line-height:var(--leading-xs);color:var(--ink-3)}.font-picker-machine{flex:none;font-size:var(--type-sm);line-height:var(--leading-xs);color:var(--warn)}.font-picker-spinner{flex:none;width:10px;height:10px;border:1.5px solid var(--line-strong);border-top-color:var(--ink-2);border-radius:var(--radius-full)}@media(prefers-reduced-motion:no-preference){.font-picker-spinner{animation:font-picker-turn .9s linear infinite}}@keyframes font-picker-turn{to{transform:rotate(360deg)}}.font-picker-foot{flex:none;display:flex;align-items:center;justify-content:space-between;gap:var(--space-4);padding:var(--space-2) var(--space-3) var(--space-2) var(--space-6);border-top:1px solid var(--line-soft)}.font-picker-keys{display:inline-flex;align-items:center;gap:var(--space-2);font-size:var(--type-sm);line-height:var(--leading-xs);color:var(--ink-3)}.font-picker-upload{gap:var(--space-4);padding:var(--space-4) var(--space-6) var(--space-6)}.font-picker-upload-head{display:flex;align-items:center;gap:var(--space-4)}.font-picker-back>svg{transform:rotate(180deg)}.font-picker-title{font-size:var(--type-title);line-height:var(--leading-md);font-weight:var(--weight-medium);color:var(--ink-1)}.font-picker-drop{flex-direction:column}.font-picker-drop.is-disabled>span{color:var(--ink-disabled)}.font-picker-limits{font-size:var(--type-sm);line-height:var(--leading-xs)}.font-picker-line{margin:0;font-size:var(--type-md);line-height:var(--leading-xs);color:var(--ink-2)}.font-picker-line.is-quiet{color:var(--ink-3)}.font-picker-line.is-warn{color:var(--warn)}.font-picker-retry{align-self:flex-start}.font-picker-manage{align-self:flex-start;font-size:var(--type-md);line-height:var(--leading-xs);color:var(--accent-ink);text-decoration:none;border-radius:var(--radius-xs)}.font-picker-manage:hover{text-decoration:underline}.font-picker-manage:focus-visible{outline:none;box-shadow:var(--focus-ring)}}
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/takeMeasure-Tdg0TxEi.js","assets/index-BGHQGV5z.js","assets/index-4F5NQmI8.css"])))=>i.map(i=>d[i]);
2
+ import{Y as me,Z as he,u as pe,A as V,B as c,_ as ge,$ as fe,a0 as xe,v as t,a1 as ke,a2 as be,N as ve,a3 as je,a4 as Ne}from"./index-BGHQGV5z.js";const Q=3e3,G=12e4,Se=100,Me=40,W=(l,m)=>Math.round(l*1e3*m.fps.den/m.fps.num);function A(l,m){const r=(l??"").trim().slice(0,Se).trim();return r===""?m:r}function ye(l){const m=W(me(l),l);if(m<Q)return null;const r=new Map;for(const s of he(l)){const n=W(s.start,l);n>0&&n<m&&r.set(n,A(l.scenesById[s.id]?.name,"Shot"))}for(const s of l.markers??[]){const n=s.label?.trim()??"",d=W(s.frame,l);n===""||n.startsWith("beat:")||d<=0||d>=m||r.set(d,A(n,"Marker"))}const k=A(l.scenesById[l.scenes[0]??""]?.name,"Opening"),b=[0,...[...r.keys()].sort((s,n)=>s-n)];let a=b.map((s,n)=>({name:n===0?k:r.get(s),startMs:s,durationMs:(b[n+1]??m)-s}));for(;;){const s=a.findIndex(n=>n.durationMs<Q);if(s===-1)break;if(s===0){const[n,d]=[a[0],a[1]];a=[{name:n.name,startMs:0,durationMs:n.durationMs+d.durationMs},...a.slice(2)]}else{const n=a[s-1],d={...n,durationMs:n.durationMs+a[s].durationMs};a=[...a.slice(0,s-1),d,...a.slice(s+1)]}}let i=a.flatMap(s=>{if(s.durationMs<=G)return[s];const n=Math.ceil(s.durationMs/G),d=Math.floor(s.durationMs/n);let p=s.durationMs-d*n,f=s.startMs;return Array.from({length:n},(I,L)=>{const C=d+(p>0?1:0);p=Math.max(0,p-1);const j={name:A(`${s.name} (${L+1})`,s.name),startMs:f,durationMs:C};return f+=C,j})});for(;i.length>Me;){let s=-1;for(let p=0;p+1<i.length;p++){const f=i[p].durationMs+i[p+1].durationMs;f<=G&&(s===-1||f<i[s].durationMs+i[s+1].durationMs)&&(s=p)}if(s===-1)break;const[n,d]=[i[s],i[s+1]];i=[...i.slice(0,s),{name:n.name,startMs:n.startMs,durationMs:n.durationMs+d.durationMs},...i.slice(s+2)]}return i}const X={sfx:"Sound effect",music:"Music",voice:"Voice"},we={sfx:"Short airy whoosh, left to right",music:"Warm lo-fi beat, soft keys, 90 bpm",voice:"What the voice says, as it should be spoken."};function O(l){return l instanceof Error?l.message:String(l)}const Ce="/projects/?view=settings-keys";function Ee(l,m=1){return`${l.host==="local"?"Uses ELEVENLABS_API_KEY on this machine":"Uses this workspace's ElevenLabs key"}${m>1?" · two takes are two generations":""}`}function Ae(l){const m=pe(),r=V(e=>e.doc),k=V(e=>e.name),b=V(e=>e.selectedAudio),[a,i]=c.useState(null),[s,n]=c.useState("sfx"),[d,p]=c.useState({sfx:"",music:"",voice:""}),[f,I]=c.useState({sfx:4,music:30}),[L,C]=c.useState(null),[j,ee]=c.useState(!0),[Y,se]=c.useState(!1),[H,te]=c.useState(!0),[ne,ae]=c.useState(!1),[E,T]=c.useState(null),[U,N]=c.useState(null),[g,oe]=c.useState(null),[le,re]=c.useState(null);c.useEffect(()=>{if(k===null)return;let e=!0;return ge(k).then(o=>{e&&(i(o),I({sfx:o.caps.sfx.defaultSeconds,music:o.caps.music.defaultSeconds}))},o=>{e&&N(O(o))}),()=>{e=!1}},[k]);const S=r===null?[]:fe(r),ce=c.useMemo(()=>{if(r===null)return;const e=b.length>0?r.audio?.[b[0]]:void 0;return xe(r,e?.track).id},[r,b]),v=S.find(e=>e.id===le)??S.find(e=>e.id===ce)??S[0],x=c.useMemo(()=>r===null?null:ye(r),[r]);if(r===null||k===null)return null;const $=d[s],D=a?.kinds[s],Z=a?.voices??[],K=L??Z[0]?.id,R=x===null?0:x.reduce((e,o)=>e+o.durationMs,0),P=x===null?"The film is shorter than 3 seconds, the shortest a section can be":a!==null&&R>a.caps.music.maxSeconds*1e3?`The film is ${Math.round(R/1e3)} s; music can be at most ${a.caps.music.maxSeconds} s`:null,M=s==="music"&&ne&&x!==null&&P===null,_=s==="sfx"&&H?2:1,q={project:k,kind:s,prompt:$,...s==="voice"?K===void 0?{}:{voice:K}:M?{seconds:R/1e3,instrumental:j,sections:x.map(({name:e,durationMs:o})=>({name:e,durationMs:o}))}:{seconds:f[s],...s==="music"?{instrumental:j}:{loop:Y}}},z=a===null?0:s==="voice"?a.caps.voice.maxChars:a.caps.promptMaxChars,y=a!==null&&s!=="voice"?a.caps[s]:null,B=E===null&&D?.ok===!0&&$.trim()!=="",F=async()=>{T("generate"),N(null);try{const e={...q},o=await Promise.allSettled(Array.from({length:_},()=>je(e))),h=o.flatMap(u=>u.status==="fulfilled"?[u.value.take]:[]);if(h.length===0)throw o[0].reason;let w={order:h,reasons:[],tone:null};if(s==="sfx")try{w=await(await Ne(async()=>{const{judgeTakes:u}=await import("./takeMeasure-Tdg0TxEi.js");return{judgeTakes:u}},__vite__mapDeps([0,1,2]))).judgeTakes(h,e.seconds??0)}catch{h.length>1&&(w={...w,reasons:["These takes could not be measured here, so listen to both."]})}const ie=o.flatMap(u=>u.status==="rejected"?[O(u.reason)]:[]);oe({...w,reasons:[...w.reasons,...ie.map(u=>`A take failed: ${u}`)],scored:M}),i(u=>u===null?u:{...u,recent:[...h,...u.recent.filter(de=>!h.some(ue=>ue.id===de.id))]})}catch(e){N(O(e))}finally{T(null)}},J=async(e,o=!1)=>{T("place"),N(null);try{await m.placeTake(e,v?.id,o?0:void 0)}catch(h){N(O(h))}finally{T(null)}};return t.jsxs("div",{className:"sound-gen","data-testid":"generate-drawer",children:[t.jsxs("div",{className:"sound-gen-head",children:[t.jsx("span",{className:"sound-gen-glyph","aria-hidden":"true",children:ke}),t.jsx("span",{className:"sound-gen-title",children:"Generate"}),t.jsx("button",{type:"button",className:"btn is-ghost is-icon","aria-label":"Close",title:"Back to the mixer",onClick:l.onClose,children:be})]}),t.jsxs("div",{className:"sound-gen-body",children:[t.jsx(ve,{className:"sound-gen-kinds",ariaLabel:"What to generate",value:s,onChange:e=>n(e==="music"||e==="voice"?e:"sfx"),options:["sfx","music","voice"].map(e=>({value:e,label:X[e],testId:`generate-kind-${e}`}))}),t.jsx("textarea",{className:"text-input sound-gen-prompt","data-testid":"generate-prompt","aria-label":s==="voice"?"Script":"Describe the sound",placeholder:we[s],value:$,maxLength:z>0?z:void 0,rows:s==="voice"?4:2,onChange:e=>{const o=e.currentTarget.value;p(h=>({...h,[s]:o}))},onKeyDown:e=>{e.stopPropagation(),e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&B&&(e.preventDefault(),F())}}),s==="voice"?t.jsxs("label",{className:"sound-gen-field",children:[t.jsx("span",{className:"sound-gen-label",children:"Voice"}),t.jsx("select",{className:"select sound-gen-select","data-testid":"generate-voice",value:K??"",onChange:e=>C(e.currentTarget.value),children:Z.map(e=>t.jsxs("option",{value:e.id,children:[e.name,", ",e.description]},e.id))})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"sound-gen-row",children:[t.jsxs("label",{className:"sound-gen-field",children:[t.jsx("span",{className:"sound-gen-label",children:"Seconds"}),t.jsx("input",{className:"text-input sound-gen-seconds","data-testid":"generate-seconds",type:"number",min:y?.minSeconds,max:y?.maxSeconds,step:s==="sfx"?.5:1,disabled:M,value:M?q.seconds??0:f[s],onKeyDown:e=>e.stopPropagation(),onChange:e=>{const o=Number(e.currentTarget.value);!Number.isFinite(o)||y===null||I(h=>({...h,[s]:Math.min(y.maxSeconds,Math.max(y.minSeconds,o))}))}})]}),t.jsxs("label",{className:"sound-gen-check",children:[t.jsx("input",{type:"checkbox",checked:s==="music"?j:Y,onChange:e=>(s==="music"?ee:se)(e.currentTarget.checked)}),s==="music"?"Instrumental":"Loop"]})]}),s==="sfx"?t.jsxs("label",{className:"sound-gen-check",title:"Make two takes and lead with the one that measures better",children:[t.jsx("input",{type:"checkbox","data-testid":"generate-two-takes",checked:H,onChange:e=>te(e.currentTarget.checked)}),"Two takes, keep the better"]}):t.jsxs("label",{className:"sound-gen-check",title:P??"Compose to the Project's cuts and named markers",children:[t.jsx("input",{type:"checkbox","data-testid":"generate-fit",checked:M,disabled:P!==null,onChange:e=>ae(e.currentTarget.checked)}),"Score to the cuts",x===null?"":` (${x.length} section${x.length===1?"":"s"})`]})]}),t.jsxs("div",{className:"sound-gen-price","data-testid":"generate-price",children:[a===null?"Checking what this studio can make…":D?.ok!==!0?D?.reason??"Not available here":Ee(a,_),a?.needsKey==="add"?t.jsxs(t.Fragment,{children:[" ",t.jsx("a",{className:"sound-gen-key-link","data-testid":"generate-add-key",href:Ce,target:"_blank",rel:"noopener",children:"Open AI keys ↗"})]}):null]}),t.jsx("button",{type:"button",className:"btn is-primary sound-gen-go","data-testid":"generate-go",disabled:!B,onClick:()=>void F(),children:E==="generate"?"Generating…":`Generate ${X[s].toLowerCase()}`}),U===null?null:t.jsx("p",{className:"sound-gen-error",role:"alert",children:U}),g===null?null:t.jsxs("div",{className:"sound-gen-take","data-testid":"generate-take",children:[g.order.map((e,o)=>t.jsxs("div",{className:"sound-gen-take-row","data-testid":"generate-take-row",children:[t.jsxs("span",{className:"sound-gen-take-name",title:e.prompt,children:[g.order.length>1?o===0?"Kept · ":"Other take · ":"",e.prompt]}),t.jsx("audio",{className:"sound-gen-audio",controls:!0,preload:"metadata",src:e.url}),t.jsxs("button",{type:"button",className:o===0?"btn is-primary":"btn is-outline","data-testid":o===0?"generate-place":"generate-place-other",disabled:E!==null||v===void 0,onClick:()=>void J(e,g.scored),children:["Add to ",v?.name??"track"," ",g.scored?"at the start":"at playhead"]})]},e.id)),g.reasons.length===0?null:t.jsx("p",{className:"sound-gen-why","data-testid":"generate-why",children:g.reasons.join(" ")}),g.tone===null?null:t.jsx("p",{className:"sound-gen-why","data-testid":"generate-tone",children:g.tone}),t.jsx("div",{className:"sound-gen-take-actions",children:t.jsx("button",{type:"button",className:"btn is-outline",disabled:!B,onClick:()=>void F(),children:_>1?"Two more takes":"Another take"})})]}),S.length>1?t.jsxs("label",{className:"sound-gen-field",children:[t.jsx("span",{className:"sound-gen-label",children:"Track"}),t.jsx("select",{className:"select sound-gen-select","data-testid":"generate-track",value:v?.id??"",onChange:e=>re(e.currentTarget.value),children:S.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))})]}):null,a!==null&&a.recent.length>0?t.jsxs("div",{className:"sound-gen-recent",children:[t.jsx("span",{className:"sound-gen-label",children:"Recent"}),t.jsx("ul",{className:"sound-gen-list",children:a.recent.map(e=>t.jsxs("li",{className:"sound-gen-item",children:[t.jsx("span",{className:"sound-gen-item-kind",children:X[e.kind]}),t.jsx("span",{className:"sound-gen-item-prompt",title:e.prompt,children:e.prompt}),t.jsx("button",{type:"button",className:"btn is-ghost sound-gen-item-add",disabled:E!==null||v===void 0,title:`Add to ${v?.name??"track"} ${e.scored===!0?"at the start, where its sections line up":"at the playhead"}`,onClick:()=>void J(e,e.scored===!0),children:"Add"})]},e.id))})]}):null]})]})}export{Ce as ADD_KEY_HREF,Ae as GenerateDrawer,Ee as keyLine};
@@ -0,0 +1 @@
1
+ import{a4 as Z,q as D,A as T,v as n,u as G,g as ce,aQ as ie,B as b,aR as re,aS as oe,a2 as K,aT as ue,aU as Y,aV as de,aW as fe,aX as me,aY as he,aZ as be,a_ as ne,a$ as ge,b0 as xe,U as ye,b1 as je,b2 as Ne,b3 as ve,b4 as Se}from"./index-BGHQGV5z.js";const ke=/export \{ ([^}]+) \} from '\.\/icons\/([a-z0-9-]+)\.mjs'/g;function Re(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/(?<![0-9]x)(?<=[a-zA-Z])(?=[0-9])/g,"-").toLowerCase()}function Ie(t,e){const l=[];for(const a of t.matchAll(ke)){const c=(a[1]??"").split(",").map(o=>o.trim().replace(/^default as /,"")).filter(o=>o!==""),i=a[2]??"",d=c[0],m=d===void 0?void 0:e[d];if(i===""||!Array.isArray(m))continue;const f=[...new Set(c.map(Re))].filter(o=>o!==i);l.push({name:i,aliases:f,node:m,search:[i,...f].join(" ")})}return l.sort((a,c)=>a.name<c.name?-1:a.name>c.name?1:0),l}function Ce(t,e){const l=e.trim().toLowerCase();if(l==="")return t;const a=l.split(/\s+/),c=i=>i.name===l?0:i.name.startsWith(l)?1:2;return t.filter(i=>a.every(d=>i.search.includes(d))).map((i,d)=>({entry:i,index:d,rank:c(i)})).sort((i,d)=>i.rank-d.rank||i.index-d.index).map(({entry:i})=>i)}let F=null;function we(){return F??=Promise.all([Z(()=>import("./iconsAndAliases-DL7gXP5j.js"),[]),Z(()=>import("./lucide-6iK64tTB.js"),[])]).then(([t,e])=>Ie(t.default,e.icons),t=>{throw F=null,t}),F}const P=34,Ee=7,ee=6,te="ground",se=[{type:"solid",color:"#000000"},{type:"solid",color:"#0a0a0a"},{type:"solid",color:"#0e1a2b"},{type:"solid",color:"#f5f5f5"},{type:"solid",color:"#ff4d1f"},{type:"solid",color:"#0099ff"},{type:"linear-gradient",angleDeg:135,stops:[{at:0,color:"#1b2a4a"},{at:1,color:"#0a0a0a"}]},{type:"linear-gradient",angleDeg:135,stops:[{at:0,color:"#ff8a3d"},{at:1,color:"#7a2bff"}]},{type:"linear-gradient",angleDeg:180,stops:[{at:0,color:"#f5f5f5"},{at:1,color:"#bfc6d1"}]},{type:"radial-gradient",stops:[{at:0,color:"#2b3a67"},{at:1,color:"#05070d"}]},{type:"radial-gradient",stops:[{at:0,color:"#ffe1c2"},{at:1,color:"#ff5c69"}]},{type:"linear-gradient",angleDeg:135,stops:[{at:0,color:"#2fd4bf"},{at:1,color:"#0e1a2b"}]}],q=32,Ae={width:1,height:1};function Oe(t,e){const{width:l,height:a}=e,c=l>=a;return{width:c?q:q*l/a,height:c?q*a/l:q,background:Ne(t,l,a)}}function H(t){if(t.type==="solid")return t.color;const e=t.stops.map(l=>l.color).join(" to ");return`${t.type==="linear-gradient"?"Linear":"Radial"} ${e}`}const _e=(t,e)=>JSON.stringify(t)===JSON.stringify(e);function z(t,e){const l=e.trim().toLowerCase();if(l==="")return!0;const a=t.toLowerCase();return l.split(/\s+/).every(c=>a.includes(c))}function Le(t){return t.key==="media"?"Media…":t.key==="html"?"Html":t.label}const Te=t=>t.charAt(0).toUpperCase()+t.slice(1);function Me(t){const e=new Map;for(const l of t){const a=l.effect?.category??"other",c=e.get(a);c===void 0?e.set(a,[l]):c.push(l)}return[...e].map(([l,a])=>({category:l,rows:a}))}function Qe(){const t=D.c(2),e=T(Be);let l;return t[0]!==e?(l=e?n.jsx(De,{}):null,t[0]=e,t[1]=l):l=t[1],l}function Be(t){return t.insertDrawer!==null&&!t.readOnly}function De(){const t=G(),e=T(s=>s.insertDrawer),l=T(s=>s.doc===null||ce(s)),a=T(s=>s.library),c=T(s=>s.searchFocus),{rows:i,busy:d,fileInput:m}=ie({wantLibrary:!0,claimImagePick:!1}),[f,o]=b.useState(""),[h,u]=b.useState(e?.section??"Basics"),[r,N]=b.useState(null),g=b.useRef(null),x=b.useRef(null),k=b.useRef(new Map),R=l?ne("Insert","adds"):null,_=T(re),C=R??_,y=f.trim()!=="",E=b.useRef(c);b.useEffect(()=>{c!==E.current&&x.current?.focus()},[c]),b.useLayoutEffect(()=>{if(e===null)return;u(e.section);const s=g.current,w=k.current.get(e.section);s===null||w===void 0||(s.scrollTop=w.offsetTop)},[e]);const v=()=>{const s=g.current;if(s===null)return;const w=s.scrollTop+s.clientHeight>=s.scrollHeight-1;let S="Basics";for(const M of Y){const X=k.current.get(M);X!==void 0&&(w||X.offsetTop<=s.scrollTop+1)&&(S=M)}u(S)},j=s=>w=>{w===null?k.current.delete(s):k.current.set(s,w)},A=i.filter(s=>s.section!=="Effects"&&z(s.label,f)),O=b.useMemo(()=>a.filter(s=>s.host==="three"&&s.effect!==void 0&&oe(s.id)===null),[a]),B=s=>`${s.name} ${s.effect?.category??""} ${(s.effect?.tags??[]).join(" ")}`,I=O.filter(s=>!(s.effect?.tags.includes(te)??!1)&&z(B(s),f)),L=O.filter(s=>(s.effect?.tags.includes(te)??!1)&&z(B(s),f)),p=y?[]:se,$=s=>t.reportError(s instanceof Error?s.message:String(s)),V=s=>void t.addInstanceLayer(s).catch($),le=s=>void t.useAsBackground(s).catch($),J=b.useRef(null),ae=(s,w)=>{const S=J.current;if(S!==null&&S.id===s&&performance.now()-S.at<400)return;const M=w.getBoundingClientRect();N({id:s,left:M.right+4,top:Math.max(8,Math.min(M.top,window.innerHeight-160))})},W=()=>{r!==null&&(J.current={id:r.id,at:performance.now()}),N(null)},Q=s=>n.jsx(pe,{row:s,refusal:C,menuOpen:r?.id===s.id,onAdd:()=>V(s.id),onMenu:w=>ae(s.id,w)},s.id);return n.jsxs("section",{className:"insert-drawer","aria-label":"Insert",children:[n.jsxs("header",{className:"insert-head",children:[n.jsx("span",{className:"insert-title",children:"Insert"}),n.jsx("kbd",{className:"insert-hint",children:"Esc"}),n.jsx("button",{type:"button",className:"insert-close","aria-label":"Close Insert",title:"Close (Esc)",onClick:()=>t.closeInsertDrawer(),children:K})]}),n.jsx("div",{className:"insert-search-row",children:n.jsxs("label",{className:`insert-search${y?" has-query":""}`,children:[n.jsx("span",{className:"insert-search-icon","aria-hidden":"true",children:ue}),n.jsx("input",{ref:x,type:"search",className:"insert-search-input",placeholder:"Search","aria-label":"Search everything you can insert",value:f,onChange:s=>o(s.currentTarget.value),onKeyDown:s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),f!==""?o(""):t.closeInsertDrawer())}}),y?n.jsx("button",{type:"button",className:"insert-search-clear","aria-label":"Clear search",onClick:()=>o(""),children:K}):n.jsx("kbd",{className:"insert-hint",children:"/"})]})}),n.jsx("nav",{className:"insert-chips","aria-label":"Jump to a section",children:Y.map(s=>n.jsx("button",{type:"button",className:`insert-chip${h===s?" is-active":""}`,"aria-current":h===s?"true":void 0,onClick:()=>t.openInsertDrawer(s),children:s},s))}),n.jsxs("div",{ref:g,className:"insert-list",onScroll:v,children:[n.jsx(U,{name:"Basics",count:A.length,sectionRef:j("Basics"),children:de.map(s=>{const w=A.filter(S=>S.family===s);return w.length===0?null:n.jsxs("div",{className:"insert-family",children:[n.jsx("div",{className:"insert-sub",children:s}),n.jsx("div",{className:"insert-tiles",children:w.map(S=>{const M=C??(S.disabled===!0?S.title??S.label:null)??(d&&(S.key==="media"||S.key==="mesh")?"Waiting for the last file to finish importing":null);return n.jsxs("button",{type:"button",className:"insert-tile",disabled:M!==null,title:M??S.title??S.label,onClick:S.run,children:[n.jsx("span",{className:"insert-tile-icon","aria-hidden":"true",children:fe(S.key)}),n.jsx("span",{className:"insert-tile-label",children:Le(S)})]},S.key)})})]},s)})}),n.jsx(ze,{query:f,asked:e?.section==="Icons",refusal:C,listRef:g,sectionRef:j("Icons")}),n.jsxs(U,{name:"Shaders",count:I.length,sectionRef:j("Shaders"),children:[Me(I).map(s=>n.jsxs("div",{className:"insert-family",children:[n.jsxs("div",{className:"insert-sub",children:[Te(s.category),n.jsx("span",{className:"insert-count",children:s.rows.length})]}),n.jsx("div",{className:"insert-tiles",children:s.rows.map(Q)})]},s.category)),y?null:n.jsxs("button",{type:"button",className:"insert-link",onClick:()=>t.setLibraryBrowserOpen(!0),children:[n.jsx("span",{className:"insert-link-icon","aria-hidden":"true",children:me}),"Materials and blueprints are in the Library"]})]}),n.jsxs(U,{name:"Backgrounds",count:p.length+L.length,sectionRef:j("Backgrounds"),children:[p.length===0?null:n.jsx(Pe,{refusal:R}),L.length===0?null:n.jsxs("div",{className:"insert-family",children:[n.jsxs("div",{className:"insert-sub",children:["Shader grounds",n.jsx("span",{className:"insert-count",children:L.length})]}),n.jsx("div",{className:"insert-tiles",children:L.map(Q)})]})]}),y?n.jsx("p",{className:"insert-footnote",children:"Search looks in every section. A section with no match stays as one line."}):null]}),r===null?null:n.jsx($e,{left:r.left,top:r.top,onClose:W,onAdd:()=>{W(),V(r.id)},onBackground:()=>{W(),le(r.id)}}),m]})}function U(t){const e=D.c(12);let l;e[0]!==t.name?(l=n.jsx("span",{className:"insert-section-label",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let a;e[2]!==t.count?(a=t.count===null?null:n.jsx("span",{className:"insert-count",children:t.count}),e[2]=t.count,e[3]=a):a=e[3];let c;e[4]!==l||e[5]!==a?(c=n.jsxs("div",{className:"insert-section-head",children:[l,a]}),e[4]=l,e[5]=a,e[6]=c):c=e[6];const i=t.count===0?null:t.children;let d;return e[7]!==t.name||e[8]!==t.sectionRef||e[9]!==c||e[10]!==i?(d=n.jsxs("section",{ref:t.sectionRef,className:"insert-section","aria-label":t.name,"data-section":t.name,children:[c,i]}),e[7]=t.name,e[8]=t.sectionRef,e[9]=c,e[10]=i,e[11]=d):d=e[11],d}function pe(t){const e=D.c(23),{row:l}=t,[a,c]=b.useState(!1),i=l.effect?.thumb,d=`insert-shader${t.menuOpen?" is-menu-open":""}`,m=t.refusal!==null,f=t.refusal??l.name;let o;e[0]!==a||e[1]!==l.effect?.category||e[2]!==i?(o=n.jsx("span",{className:"insert-thumb",children:i===void 0||a?n.jsx("span",{className:"insert-thumb-glyph","aria-hidden":"true",children:ve(l.effect?.category??"")}):n.jsx("img",{src:i,alt:"",loading:"lazy",decoding:"async",onError:()=>c(!0)})}),e[0]=a,e[1]=l.effect?.category,e[2]=i,e[3]=o):o=e[3];let h;e[4]!==l.name?(h=n.jsx("span",{className:"insert-shader-label",children:l.name}),e[4]=l.name,e[5]=h):h=e[5];let u;e[6]!==t.onAdd||e[7]!==m||e[8]!==f||e[9]!==o||e[10]!==h?(u=n.jsxs("button",{type:"button",className:"insert-shader-add",disabled:m,title:f,onClick:t.onAdd,children:[o,h]}),e[6]=t.onAdd,e[7]=m,e[8]=f,e[9]=o,e[10]=h,e[11]=u):u=e[11];const r=`More for ${l.name}`,N=t.refusal!==null;let g;e[12]!==t?(g=R=>t.onMenu(R.currentTarget.parentElement??R.currentTarget),e[12]=t,e[13]=g):g=e[13];let x;e[14]!==t.menuOpen||e[15]!==r||e[16]!==N||e[17]!==g?(x=n.jsx("button",{type:"button",className:"insert-shader-more","aria-label":r,"aria-haspopup":"menu","aria-expanded":t.menuOpen,disabled:N,onClick:g,children:Se}),e[14]=t.menuOpen,e[15]=r,e[16]=N,e[17]=g,e[18]=x):x=e[18];let k;return e[19]!==d||e[20]!==u||e[21]!==x?(k=n.jsxs("div",{className:d,children:[u,x]}),e[19]=d,e[20]=u,e[21]=x,e[22]=k):k=e[22],k}function $e(t){const e=D.c(20),l=b.useRef(null);he(!0,l,t.onClose);let a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>l.current?.querySelector("button")?.focus(),c=[],e[0]=a,e[1]=c):(a=e[0],c=e[1]),b.useLayoutEffect(a,c);let i;e[2]!==t.left||e[3]!==t.top?(i={left:t.left,top:t.top},e[2]=t.left,e[3]=t.top,e[4]=i):i=e[4];let d,m,f;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("span",{className:"insert-menu-icon","aria-hidden":"true",children:ye}),m=n.jsx("span",{className:"insert-menu-label",children:"Add to shot"}),f=n.jsx("kbd",{className:"insert-hint",children:"Enter"}),e[5]=d,e[6]=m,e[7]=f):(d=e[5],m=e[6],f=e[7]);let o;e[8]!==t.onAdd?(o=n.jsxs("button",{type:"button",role:"menuitem",className:"insert-menu-row",onClick:t.onAdd,children:[d,m,f]}),e[8]=t.onAdd,e[9]=o):o=e[9];let h,u;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"insert-menu-icon","aria-hidden":"true",children:je}),u=n.jsx("span",{className:"insert-menu-label",children:"Use as background"}),e[10]=h,e[11]=u):(h=e[10],u=e[11]);let r;e[12]!==t.onBackground?(r=n.jsxs("button",{type:"button",role:"menuitem",className:"insert-menu-row is-background",onClick:t.onBackground,children:[h,u]}),e[12]=t.onBackground,e[13]=r):r=e[13];let N,g;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx("div",{className:"insert-menu-divider",role:"separator"}),g=n.jsx("p",{className:"insert-menu-note",children:"Places it at the back, sized to the frame, locked and named Background. One undo."}),e[14]=N,e[15]=g):(N=e[14],g=e[15]);let x;return e[16]!==i||e[17]!==o||e[18]!==r?(x=be.createPortal(n.jsxs("div",{ref:l,className:"insert-menu",role:"menu",style:i,children:[o,r,N,g]}),document.body),e[16]=i,e[17]=o,e[18]=r,e[19]=x):x=e[19],x}function Pe(t){const e=D.c(12),l=G(),a=T(Fe),c=T(We),i=T(qe)??Ae;let d;e[0]!==t.refusal||e[1]!==a?(d=t.refusal??(a===null?ne("Scene paint","sets"):null),e[0]=t.refusal,e[1]=a,e[2]=d):d=e[2];const m=d;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsxs("div",{className:"insert-sub",children:["Scene paint",n.jsx("span",{className:"insert-count",children:"solid · gradient"})]}),e[3]=f):f=e[3];let o;e[4]!==c||e[5]!==i||e[6]!==a||e[7]!==l||e[8]!==m?(o=se.map(u=>{const r=_e(c,u);return n.jsx("button",{type:"button",className:`insert-swatch${r?" is-active":""}`,style:Oe(u,i),"aria-pressed":r,"aria-label":H(u),title:m??H(u),disabled:m!==null,onClick:()=>{a!==null&&l.edit(N=>ge(N,a,{background:u},l.getState().frame))}},H(u))}),e[4]=c,e[5]=i,e[6]=a,e[7]=l,e[8]=m,e[9]=o):o=e[9];let h;return e[10]!==o?(h=n.jsxs("div",{className:"insert-family",children:[f,n.jsx("div",{className:"insert-swatches",children:o})]}),e[10]=o,e[11]=h):h=e[11],h}function qe(t){return t.doc?.size}function We(t){return t.enteredScene===null?void 0:t.doc?.scenesById[t.enteredScene]?.background}function Fe(t){return t.enteredScene}function He(t){return b.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},...t.node.map(([e,l],a)=>b.createElement(e,{key:a,...l})))}function ze(t){const e=D.c(37),l=G(),[a,c]=b.useState(null),[i,d]=b.useState(!1),[m,f]=b.useState(!1),o=b.useRef(null);let h;e[0]!==t.asked||e[1]!==t.query||e[2]!==m?(h=t.asked||t.query.trim()!==""||m,e[0]=t.asked,e[1]=t.query,e[2]=m,e[3]=h):h=e[3];const u=h;let r;e[4]!==t.listRef.current||e[5]!==m?(r=()=>{const I=o.current,L=t.listRef.current;if(m||I===null||L===null||typeof IntersectionObserver>"u")return;const p=new IntersectionObserver($=>{$.some(Ge)&&f(!0)},{root:L});return p.observe(I),()=>p.disconnect()},e[4]=t.listRef.current,e[5]=m,e[6]=r):r=e[6];let N;e[7]!==t.listRef||e[8]!==m?(N=[m,t.listRef],e[7]=t.listRef,e[8]=m,e[9]=N):N=e[9],b.useEffect(r,N);const[g,x]=b.useState(0);let k;e[10]!==a||e[11]!==u?(k=()=>{if(!u||a!==null)return;let I;return I=!0,d(!1),we().then(L=>{I&&c(L)},()=>{I&&d(!0)}),()=>{I=!1}},e[10]=a,e[11]=u,e[12]=k):k=e[12];let R;e[13]!==g||e[14]!==a||e[15]!==u?(R=[u,a,g],e[13]=g,e[14]=a,e[15]=u,e[16]=R):R=e[16],b.useEffect(k,R);let _,C;e[17]!==t.query||e[18]!==a?(C=a===null?null:Ce(a,t.query),e[17]=t.query,e[18]=a,e[19]=C):C=e[19],_=C;const y=_;let E;e[20]!==t?(E=I=>{o.current=I,t.sectionRef(I)},e[20]=t,e[21]=E):E=e[21];let v;e[22]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"insert-section-label",children:"Icons"}),e[22]=v):v=e[22];let j;e[23]!==y?(j=y===null?null:n.jsx("span",{className:"insert-count",children:y.length}),e[23]=y,e[24]=j):j=e[24];let A;e[25]!==j?(A=n.jsxs("div",{className:"insert-section-head",children:[v,j]}),e[25]=j,e[26]=A):A=e[26];let O;e[27]!==i||e[28]!==y||e[29]!==t.refusal||e[30]!==l||e[31]!==u?(O=y!==null?y.length===0?null:n.jsx(Ve,{icons:y,refusal:t.refusal,onPick:I=>l.addIconLayer(I.name,I.node)}):i?n.jsxs("div",{className:"insert-status",children:["Icons did not load.",n.jsx("button",{type:"button",className:"insert-retry",onClick:()=>x(Ue),children:"Retry"})]}):u?n.jsx("div",{className:"insert-status",children:"Loading icons…"}):null,e[27]=i,e[28]=y,e[29]=t.refusal,e[30]=l,e[31]=u,e[32]=O):O=e[32];let B;return e[33]!==A||e[34]!==O||e[35]!==E?(B=n.jsxs("section",{ref:E,className:"insert-section","aria-label":"Icons","data-section":"Icons",children:[A,O]}),e[33]=A,e[34]=O,e[35]=E,e[36]=B):B=e[36],B}function Ue(t){return t+1}function Ge(t){return t.isIntersecting}function Ve(t){const e=D.c(23),l=b.useRef(null),a=b.useRef(null),[c,i]=b.useState(ee),[d,m]=b.useState(0);let f,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{const v=l.current;if(v===null)return;const j=()=>{const O=v.clientWidth;i(O>0?Math.max(1,Math.floor((O+2)/P)):ee)};if(j(),typeof ResizeObserver>"u")return;const A=new ResizeObserver(j);return A.observe(v),()=>A.disconnect()},o=[],e[0]=f,e[1]=o):(f=e[0],o=e[1]),b.useLayoutEffect(f,o);const h=Math.ceil(t.icons.length/c);let u;e[2]!==h?(u={listRef:a,scrollSelector:".insert-icons",count:h,rowHeight:P,enabled:!0},e[2]=h,e[3]=u):u=e[3];const r=xe(u),N=Math.ceil((d+Ee*P)/P),g=Math.max(0,t.icons.length-N*c);let x;if(e[4]!==c||e[5]!==t||e[6]!==r.end||e[7]!==r.start){x=[];for(let v=r.start;v<r.end;v=v+1,v)x.push(n.jsx("div",{className:"insert-icon-row",children:t.icons.slice(v*c,v*c+c).map(j=>n.jsx("button",{type:"button",className:"insert-icon","data-name":j.name,"aria-label":j.name,title:t.refusal??j.name,disabled:t.refusal!==null,onClick:()=>t.onPick(j),children:n.jsx(He,{node:j.node})},j.name))},v));e[4]=c,e[5]=t,e[6]=r.end,e[7]=r.start,e[8]=x}else x=e[8];let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=v=>m(v.currentTarget.scrollTop),e[9]=k):k=e[9];let R;e[10]!==r.before?(R=n.jsx("div",{style:{height:r.before}}),e[10]=r.before,e[11]=R):R=e[11];let _;e[12]!==r.after?(_=n.jsx("div",{style:{height:r.after}}),e[12]=r.after,e[13]=_):_=e[13];let C;e[14]!==x||e[15]!==R||e[16]!==_?(C=n.jsx("div",{ref:l,className:"insert-icons",onScroll:k,children:n.jsxs("div",{ref:a,className:"insert-icon-grid",children:[R,x,_]})}),e[14]=x,e[15]=R,e[16]=_,e[17]=C):C=e[17];let y;e[18]!==g?(y=g===0?null:n.jsxs("div",{className:"insert-more",children:[g," more below"]}),e[18]=g,e[19]=y):y=e[19];let E;return e[20]!==C||e[21]!==y?(E=n.jsxs(n.Fragment,{children:[C,y]}),e[20]=C,e[21]=y,e[22]=E):E=e[22],E}export{Qe as InsertDrawer,se as SCENE_PAINTS};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StockSounds-DdAUGRYK.js","assets/index-BGHQGV5z.js","assets/index-4F5NQmI8.css","assets/libraryModel-CpIwfFha.js","assets/ComponentStage-BRhRotyH.js","assets/SoundHistory-BeS8EW1h.js"])))=>i.map(i=>d[i]);
2
+ import{q as he,B as y,v as t,ec as ge,u as ke,A as B,ed as Be,ee as Ee,D as Se,ef as Le,U as xe,bo as De,bq as Te,Q as Fe,R as Ce,eg as Ge,eh as Ye,ei as qe,ej as Ve,ek as We,aP as _e,el as ze,P as Qe,aT as Je,em as Xe,en as Me,a4 as Ue}from"./index-BGHQGV5z.js";import{k as ye,d as ve,p as je,L as Ze,C as fe,s as et,c as tt,v as st,o as lt,a as at,S as Ae,g as rt,b as nt,e as it}from"./libraryModel-CpIwfFha.js";import{C as ot}from"./ComponentStage-BRhRotyH.js";function ct(r){if(r===null)return 1;const e=getComputedStyle(r).gridTemplateColumns.split(" ").filter(s=>/px$/.test(s));return Math.max(1,e.length)}function dt(r){const e=he.c(23),{sections:s,selected:h,onSelect:d,onAdd:a}=r,f=y.useRef(null),u=y.useId();let p;if(e[0]!==s||e[1]!==h){const i=s.flatMap(ut);p=i.some(x=>x.id===h)?h:i[0]?.id??null,e[0]=s,e[1]=h,e[2]=p}else p=e[2];const n=p;let j;e[3]!==a||e[4]!==d?(j=(i,x)=>{if(i.key==="Enter"){i.preventDefault(),a(x);return}if(i.key===" "){i.preventDefault(),d(x.id);return}const g=[...f.current?.querySelectorAll('[role="option"]')??[]],b=g.indexOf(i.currentTarget);if(b<0)return;const w=ct(i.currentTarget.parentElement),A=i.key==="ArrowRight"?b+1:i.key==="ArrowLeft"?b-1:i.key==="ArrowDown"?b+w:i.key==="ArrowUp"?b-w:i.key==="Home"?0:i.key==="End"?g.length-1:null;if(A===null)return;i.preventDefault();const R=g[Math.max(0,Math.min(g.length-1,A))];if(R===void 0)return;const M=R.dataset.library;M!==void 0&&d(M),R.focus()},e[3]=a,e[4]=d,e[5]=j):j=e[5];const o=j;let m;if(e[6]!==u||e[7]!==a||e[8]!==o||e[9]!==d||e[10]!==s||e[11]!==h||e[12]!==n){let i;e[14]!==u||e[15]!==a||e[16]!==o||e[17]!==d||e[18]!==h||e[19]!==n?(i=(x,g)=>{const b=`${u}-h${g}`;return t.jsxs("section",{className:"library-section",children:[x.heading===void 0?null:t.jsxs("h3",{className:"library-section-head",id:b,children:[x.heading,t.jsx("span",{children:x.rows.length})]}),t.jsx("ul",{className:"library-grid",role:"listbox","aria-label":x.heading===void 0?x.label:void 0,"aria-labelledby":x.heading===void 0?void 0:b,children:x.rows.map(w=>t.jsx(pt,{row:w,selected:w.id===h,tabbable:w.id===n,onSelect:()=>d(w.id),onAdd:()=>a(w),onKeyDown:A=>o(A,w)},w.id))})]},x.label)},e[14]=u,e[15]=a,e[16]=o,e[17]=d,e[18]=h,e[19]=n,e[20]=i):i=e[20],m=s.map(i),e[6]=u,e[7]=a,e[8]=o,e[9]=d,e[10]=s,e[11]=h,e[12]=n,e[13]=m}else m=e[13];let c;return e[21]!==m?(c=t.jsx("div",{className:"library-gallery",ref:f,children:m}),e[21]=m,e[22]=c):c=e[22],c}function ut(r){return r.rows}function pt(r){const e=he.c(23),{row:s,selected:h,tabbable:d,onSelect:a,onAdd:f,onKeyDown:u}=r;let p;e[0]!==s?(p=ye(s),e[0]=s,e[1]=p):p=e[1];const n=p;let j;e[2]!==s?(j=ve(s),e[2]=s,e[3]=j):j=e[3];const o=j,m=`library-card is-${n}`,c=d?0:-1;let i;e[4]!==n||e[5]!==o||e[6]!==s.thumb?(i=t.jsx("div",{className:"library-card-art",children:s.thumb===void 0?t.jsxs("span",{className:"library-card-placeholder","aria-hidden":"true",children:[ge[n],t.jsx("span",{children:o})]}):t.jsx("img",{src:s.thumb,alt:"",loading:"lazy",draggable:!1})}),e[4]=n,e[5]=o,e[6]=s.thumb,e[7]=i):i=e[7];let x;e[8]!==o?(x=t.jsx("span",{className:"library-card-name",children:o}),e[8]=o,e[9]=x):x=e[9];let g;e[10]!==s.description?(g=s.description===void 0?null:t.jsx("span",{className:"library-card-note",children:s.description}),e[10]=s.description,e[11]=g):g=e[11];let b;return e[12]!==f||e[13]!==u||e[14]!==a||e[15]!==s.id||e[16]!==h||e[17]!==m||e[18]!==c||e[19]!==i||e[20]!==x||e[21]!==g?(b=t.jsxs("li",{className:m,role:"option","aria-selected":h,tabIndex:c,"data-library":s.id,title:s.id,onClick:a,onDoubleClick:f,onKeyDown:u,draggable:!1,children:[i,x,g]}),e[12]=f,e[13]=u,e[14]=a,e[15]=s.id,e[16]=h,e[17]=m,e[18]=c,e[19]=i,e[20]=x,e[21]=g,e[22]=b):b=e[22],b}const ht=[],Re=7,$e=r=>r.path.slice(r.path.lastIndexOf("/")+1);function bt(r){const e=he.c(86),{item:s,canAdd:h,adding:d}=r,a=ke();let f;e[0]!==s.id?(f=N=>N.libraryItems[s.id],e[0]=s.id,e[1]=f):f=e[1];const u=B(f),p=B(xt),n=B(yt),[j,o]=y.useState(!1),[m,c]=y.useState(null),[i,x]=y.useState(null),[g,b]=y.useState(!1),[w,A]=y.useState(!1),[R,M]=y.useState(null),Q=B(mt),O=B(ft),$=y.useRef(null);let U,G;e[2]!==s.id||e[3]!==a?(U=()=>{let N;return N=!0,a.loadLibraryItem(s.id).then(E=>{N&&E===null&&o(!0)}),()=>{N=!1}},G=[s.id,a],e[2]=s.id,e[3]=a,e[4]=U,e[5]=G):(U=e[4],G=e[5]),y.useEffect(U,G);let D,Y;e[6]===Symbol.for("react.memo_cache_sentinel")?(D=()=>()=>{$.current?.pause(),$.current=null},Y=[],e[6]=D,e[7]=Y):(D=e[6],Y=e[7]),y.useEffect(D,Y);let I,q;e[8]!==p||e[9]!==n?(I=()=>{$.current!==null&&($.current.muted=p,$.current.volume=n)},q=[p,n],e[8]=p,e[9]=n,e[10]=I,e[11]=q):(I=e[10],q=e[11]),y.useEffect(I,q);const k=u?.sounds?.files??ht;let V;e[12]!==s?(V=ve(s),e[12]=s,e[13]=V):V=e[13];const L=V;let T;e[14]!==k||e[15]!==m?(T=k.find(N=>N.path===m)??k[0],e[14]=k,e[15]=m,e[16]=T):T=e[16];const S=T;let v;e[17]!==k||e[18]!==g?(v=g?k:k.slice(0,Re),e[17]=k,e[18]=g,e[19]=v):v=e[19];const C=v;let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=()=>{$.current?.pause(),$.current=null,x(null)},e[20]=K):K=e[20];const W=K;let F;e[21]!==s.id||e[22]!==p||e[23]!==i||e[24]!==n?(F=N=>{if(c(N.path),i===N.path){W();return}$.current?.pause();const E=new Audio(Le(s.id,N.path));E.muted=p,E.volume=n;const _=()=>{$.current===E&&($.current=null,x(null))};E.addEventListener("ended",_),E.addEventListener("error",_),$.current=E,x(N.path),E.play().catch(_)},e[21]=s.id,e[22]=p,e[23]=i,e[24]=n,e[25]=F):F=e[25];const Z=F;let le;e[26]!==a?(le=(N,E)=>{A(!0),M(null),a.dismissError(),N().then(()=>{const _=a.getState().error;_!==null?M(_):E&&a.getState().libraryBrowserOpen&&a.setLibraryBrowserOpen(!1)}).finally(()=>A(!1))},e[26]=a,e[27]=le):le=e[27];const ee=le;let te;e[28]!==s.id||e[29]!==ee||e[30]!==a?(te=N=>ee(()=>a.dropLibraryOnFrame(s.id,$e(N)),!0),e[28]=s.id,e[29]=ee,e[30]=a,e[31]=te):te=e[31];const ae=te;let oe;e[32]!==s.id||e[33]!==ee||e[34]!==a?(oe=N=>ee(async()=>{Te(a)&&await a.addStoryboardLibrarySound(null,s.id,$e(N))},!1),e[32]=s.id,e[33]=ee,e[34]=a,e[35]=oe):oe=e[35];const de=oe;let se;if(u===void 0){const N=j?"The sounds could not be read.":"Loading the sounds…";let E;e[36]!==N?(E=t.jsx("p",{className:"library-preview-note",children:N}),e[36]=N,e[37]=E):E=e[37],se=E}else if(k.length===0){let N;e[38]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("p",{className:"library-preview-note",children:"This pack ships no sounds."}),e[38]=N):N=e[38],se=N}else{const N=`Sounds in ${L}`;let E;if(e[39]!==Z||e[40]!==i||e[41]!==S||e[42]!==C){let X;e[44]!==Z||e[45]!==i||e[46]!==S?(X=be=>{const Ne=Ee(be),Oe=be===S,Pe=i===be.path;return t.jsxs("li",{className:Oe?"library-sound-row is-selected":"library-sound-row","data-file":be.path,children:[t.jsx("button",{type:"button",className:"library-sound-play","aria-label":Pe?`Stop ${Ne}`:`Play ${Ne}`,onClick:()=>Z(be),children:Pe?Fe:Ce}),t.jsxs("button",{type:"button",className:"library-sound-pick","aria-pressed":Oe,onClick:()=>c(be.path),children:[t.jsx("span",{className:"library-sound-name",children:Ne}),t.jsx("span",{className:"library-sound-length",children:Se(be.durationMs/1e3)})]})]},be.path)},e[44]=Z,e[45]=i,e[46]=S,e[47]=X):X=e[47],E=C.map(X),e[39]=Z,e[40]=i,e[41]=S,e[42]=C,e[43]=E}else E=e[43];let _;e[48]!==N||e[49]!==E?(_=t.jsx("ul",{className:"library-sound-list","aria-label":N,children:E}),e[48]=N,e[49]=E,e[50]=_):_=e[50];let ne;e[51]!==k.length||e[52]!==g?(ne=k.length>Re&&!g?t.jsxs("button",{type:"button",className:"library-sound-more",onClick:()=>b(!0),children:["Show all ",k.length," sounds",Be]}):null,e[51]=k.length,e[52]=g,e[53]=ne):ne=e[53];let ie;e[54]!==ae||e[55]!==d||e[56]!==O||e[57]!==w||e[58]!==h||e[59]!==R||e[60]!==s.id||e[61]!==de||e[62]!==Q||e[63]!==S?(ie=S===void 0?null:t.jsxs("div",{className:"library-sound-selected","data-testid":"library-sound-selected",children:[t.jsxs("p",{className:"library-sound-selected-name",children:[t.jsx("span",{children:Ee(S)}),t.jsx("span",{className:"library-sound-length",children:Se(S.durationMs/1e3)})]}),t.jsx(jt,{url:Le(s.id,S.path)}),t.jsxs("button",{type:"button",className:"btn is-primary is-lg","data-testid":"library-add-sound",disabled:!h||d||w,"aria-disabled":Q!==null||void 0,title:h?Q??"Import this sound and place it at the playhead of the open Shot.":"Open a Project to add library items.",onClick:()=>{Q===null&&ae(S)},children:[xe,w?"Adding…":"Add to shot"]}),t.jsx("button",{type:"button",className:"btn is-outline is-lg","data-testid":"library-pin-sound",disabled:!h||d||w,title:h?`Import this sound and pin it as a card the agent reads.${O?"":" Opens the storyboard."}`:"Open a Project to add library items.",onClick:()=>de(S),children:"Pin to board"}),R===null?null:t.jsx("p",{className:"library-preview-error",role:"alert","data-testid":"library-add-error",children:R}),t.jsx("p",{className:"library-preview-hint",children:"Add places it in the open Shot. Pin saves it for later."})]}),e[54]=ae,e[55]=d,e[56]=O,e[57]=w,e[58]=h,e[59]=R,e[60]=s.id,e[61]=de,e[62]=Q,e[63]=S,e[64]=ie):ie=e[64];let pe;e[65]!==_||e[66]!==ne||e[67]!==ie?(pe=t.jsxs(t.Fragment,{children:[_,ne,ie]}),e[65]=_,e[66]=ne,e[67]=ie,e[68]=pe):pe=e[68],se=pe}const ue=`Preview: ${L}`;let z;e[69]!==L?(z=t.jsx("h2",{className:"library-preview-name",children:L}),e[69]=L,e[70]=z):z=e[70];let l;e[71]!==k.length?(l=k.length===0?null:t.jsxs("p",{className:"library-preview-note",children:[je(k.length,"sound")," · Choose one to preview"]}),e[71]=k.length,e[72]=l):l=e[72];let P;e[73]!==z||e[74]!==l?(P=t.jsxs("div",{className:"library-preview-purpose",children:[z,l]}),e[73]=z,e[74]=l,e[75]=P):P=e[75];let H;e[76]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx("span",{children:"Sound pack"}),e[76]=H):H=e[76];let J;e[77]!==s.version?(J=s.version===void 0?null:t.jsxs("span",{children:["v",s.version]}),e[77]=s.version,e[78]=J):J=e[78];let re;e[79]!==J?(re=t.jsxs("footer",{className:"library-preview-meta",children:[H,J]}),e[79]=J,e[80]=re):re=e[80];let ce;return e[81]!==se||e[82]!==ue||e[83]!==P||e[84]!==re?(ce=t.jsxs("aside",{className:"library-preview is-sounds","aria-label":ue,"data-testid":"library-preview",children:[P,se,re]}),e[81]=se,e[82]=ue,e[83]=P,e[84]=re,e[85]=ce):ce=e[85],ce}function ft(r){return r.storyboardOpen}function mt(r){return De(r,"sound")}function yt(r){return r.previewVolume}function xt(r){return r.previewMuted}function jt(r){const e=he.c(8),{url:s}=r,h=y.useRef(null),[d,a]=y.useState(null);let f,u;e[0]!==s?(f=()=>{let m;return m=!0,a(null),Ge({path:s},{fetchBytes:async()=>{const c=new URL(s,location.href).origin===location.origin,i=await fetch(s,c?{}:{credentials:"omit",referrerPolicy:"no-referrer"});if(!i.ok)throw new Error(`${s}: ${i.status}`);return await i.arrayBuffer()}}).then(c=>{m&&a(c)}).catch(gt),()=>{m=!1}},u=[s],e[0]=s,e[1]=f,e[2]=u):(f=e[1],u=e[2]),y.useEffect(f,u);let p,n;e[3]!==d?(p=()=>{const m=h.current;m===null||d===null||d.peaks.length===0||Ye(m,{data:d,fromSeconds:0,toSeconds:d.sourceSeconds||1,widthPx:m.clientWidth||240,heightPx:m.clientHeight||46,color:getComputedStyle(m).color})},n=[d],e[3]=d,e[4]=p,e[5]=n):(p=e[4],n=e[5]),y.useEffect(p,n);const j=d!==null&&d.peaks.length>0?"true":"false";let o;return e[6]!==j?(o=t.jsx("div",{className:"library-sound-wave",children:t.jsx("canvas",{ref:h,"aria-hidden":"true","data-testid":"library-sound-wave","data-drawn":j})}),e[6]=j,e[7]=o):o=e[7],o}function gt(){}const vt={},Ie={component:"Component",blueprint:"Blueprint",material:"Material",shot:"Shot",images:"Image pack",sounds:"Sound pack"},Ke=r=>ye(r)==="component";function Nt(r){const e=he.c(97),{item:s,destination:h,onBoard:d,canAdd:a,adding:f,onAdd:u,onClaim:p,onPin:n,error:j,expanded:o,onExpand:m}=r,[c,i]=y.useState(!1),x=B(Ct),g=B(kt),b=B(St),w=y.useRef(null),A=y.useRef(o);let R,M;if(e[0]!==o?(R=()=>{const X=A.current&&!o;A.current=o,X&&(document.activeElement===null||document.activeElement===document.body)&&w.current?.focus()},M=[o],e[0]=o,e[1]=R,e[2]=M):(R=e[1],M=e[2]),y.useEffect(R,M),s===null){let X;return e[3]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx("aside",{className:"library-preview","aria-label":"Preview",children:t.jsx("p",{className:"library-preview-empty",children:"Click an item to preview it."})}),e[3]=X):X=e[3],X}let Q;e[4]!==s?(Q=ye(s),e[4]=s,e[5]=Q):Q=e[5];const O=Q;let $;e[6]!==s?($=ve(s),e[6]=s,e[7]=$):$=e[7];const U=$;let G;e[8]!==s.host||e[9]!==x?(G=s.host==="three"?x:Ve(s.host),e[8]=s.host,e[9]=x,e[10]=G):G=e[10];const D=G;if(O==="sounds"){let X;return e[11]!==f||e[12]!==a||e[13]!==s?(X=t.jsx(bt,{item:s,canAdd:a,adding:f},s.id),e[11]=f,e[12]=a,e[13]=s,e[14]=X):X=e[14],X}let Y;e[15]!==s?(Y=Ke(s),e[15]=s,e[16]=Y):Y=e[16];const I=Y,q=O==="component"||O==="shot",k=O==="component"?g??"no Shot open":O==="shot"?"a new Project":h,V=`Preview: ${U}`,L=o?`About this ${Ie[O].toLowerCase()}`:"Preview";let T;e[17]!==L?(T=t.jsx("h2",{children:L}),e[17]=L,e[18]=T):T=e[18];let S;e[19]!==o||e[20]!==m||e[21]!==I?(S=I&&!o?t.jsx("button",{ref:w,type:"button",className:"btn is-ghost is-icon","aria-label":"Open a larger preview",title:"Open a larger preview",onClick:()=>m(!0),children:We}):null,e[19]=o,e[20]=m,e[21]=I,e[22]=S):S=e[22];let v;e[23]!==T||e[24]!==S?(v=t.jsxs("header",{className:"library-preview-head",children:[T,S]}),e[23]=T,e[24]=S,e[25]=v):v=e[25];let C;e[26]!==o||e[27]!==s||e[28]!==U||e[29]!==m||e[30]!==I?(C=o?null:t.jsxs("div",{className:"library-preview-thumb",children:[t.jsx(He,{item:s}),I?t.jsx("button",{type:"button",className:"library-preview-play","aria-label":`Play ${U}`,title:"Play it larger",onClick:()=>m(!0),children:Ce}):null]}),e[26]=o,e[27]=s,e[28]=U,e[29]=m,e[30]=I,e[31]=C):C=e[31];let K;e[32]!==U?(K=t.jsx("h3",{className:"library-preview-name",children:U}),e[32]=U,e[33]=K):K=e[33];let W;e[34]!==s.description?(W=s.description===void 0?null:t.jsx("p",{className:"library-preview-note",children:s.description}),e[34]=s.description,e[35]=W):W=e[35];let F;e[36]!==K||e[37]!==W?(F=t.jsxs("div",{className:"library-preview-purpose",children:[K,W]}),e[36]=K,e[37]=W,e[38]=F):F=e[38];let Z;e[39]!==k?(Z=t.jsxs("span",{"data-testid":"library-destination",children:["Destination: ",k]}),e[39]=k,e[40]=Z):Z=e[40];let le;e[41]!==d?(le=d>0?t.jsxs("span",{"data-testid":"library-preview-on-board",children:["On the board ×",d]}):null,e[41]=d,e[42]=le):le=e[42];let ee;e[43]!==Z||e[44]!==le?(ee=t.jsxs("p",{className:"library-preview-destination",children:[Z,le]}),e[43]=Z,e[44]=le,e[45]=ee):ee=e[45];let te;e[46]!==f||e[47]!==a||e[48]!==O||e[49]!==u||e[50]!==D||e[51]!==g?(te=O==="component"?t.jsxs("button",{type:"button",className:"btn is-primary is-lg","data-testid":"library-add",disabled:!a||f,"aria-disabled":D!==null||void 0,title:a?D??`Install into this Project and place it in ${g??"the open Shot"}. Undo removes the layer; the installed files stay.`:"Open a Project to add library items.",onClick:()=>{D===null&&u()},children:[xe,f?"Adding…":"Add to shot"]}):null,e[46]=f,e[47]=a,e[48]=O,e[49]=u,e[50]=D,e[51]=g,e[52]=te):te=e[52];let ae;e[53]!==f||e[54]!==a||e[55]!==O||e[56]!==p?(ae=O==="shot"?t.jsxs("button",{type:"button",className:"btn is-primary is-lg","data-testid":"library-claim",disabled:!a||f,title:a?"Copy this shot into a new Project of its own and open it. This Project stays as it is.":"Open a Project to add library items.",onClick:p,children:[xe,"Use as new Project"]}):null,e[53]=f,e[54]=a,e[55]=O,e[56]=p,e[57]=ae):ae=e[57];const oe=q?"btn is-outline is-lg":"btn is-primary is-lg",de=!a||f,se=a?`Pin a card to ${h}. The agent reads it when it builds.${b?"":" Opens the storyboard."}`:"Open a Project to add library items.",ue=q?null:xe;let z;e[58]!==n||e[59]!==oe||e[60]!==de||e[61]!==se||e[62]!==ue?(z=t.jsxs("button",{type:"button",className:oe,"data-testid":"library-pin",disabled:de,title:se,onClick:n,children:[ue,"Pin to board"]}),e[58]=n,e[59]=oe,e[60]=de,e[61]=se,e[62]=ue,e[63]=z):z=e[63];let l;e[64]!==j?(l=j===null?null:t.jsx("p",{className:"library-preview-error",role:"alert","data-testid":"library-add-error",children:j}),e[64]=j,e[65]=l):l=e[65];const P=O==="component"?"Add places it in the open Shot. Pin saves it for later.":O==="shot"?"Use as new Project copies it into a Project of its own and opens it. Pin saves it on this board for the agent.":"This has no layer of its own. Pin it so the agent can use it.";let H;e[66]!==P?(H=t.jsx("p",{className:"library-preview-hint",children:P}),e[66]=P,e[67]=H):H=e[67];let J;e[68]!==ee||e[69]!==te||e[70]!==ae||e[71]!==z||e[72]!==l||e[73]!==H?(J=t.jsxs("div",{className:"library-preview-add",children:[ee,te,ae,z,l,H]}),e[68]=ee,e[69]=te,e[70]=ae,e[71]=z,e[72]=l,e[73]=H,e[74]=J):J=e[74];let re;e[75]!==s.useFor?(re=s.useFor===void 0?null:t.jsxs("section",{className:"library-preview-usage","aria-label":"Good for",children:[t.jsx("h3",{children:"Good for"}),t.jsx("p",{children:s.useFor})]}),e[75]=s.useFor,e[76]=re):re=e[76];let ce;e[77]!==s.avoidFor||e[78]!==c?(ce=s.avoidFor===void 0?null:t.jsxs("div",{className:"library-preview-more",children:[t.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>i(wt),children:["More usage guidance",Be]}),c?t.jsxs("p",{children:["Not for: ",s.avoidFor]}):null]}),e[77]=s.avoidFor,e[78]=c,e[79]=ce):ce=e[79];const N=Ie[O],E=O==="component"?` · ${s.host==="three"?"3D":"2D"}`:"";let _;e[80]!==N||e[81]!==E?(_=t.jsxs("span",{children:[N,E]}),e[80]=N,e[81]=E,e[82]=_):_=e[82];let ne;e[83]!==s.version?(ne=s.version===void 0?null:t.jsxs("span",{children:["v",s.version]}),e[83]=s.version,e[84]=ne):ne=e[84];let ie;e[85]!==_||e[86]!==ne?(ie=t.jsxs("footer",{className:"library-preview-meta",children:[_,ne]}),e[85]=_,e[86]=ne,e[87]=ie):ie=e[87];let pe;return e[88]!==v||e[89]!==C||e[90]!==F||e[91]!==J||e[92]!==re||e[93]!==ce||e[94]!==ie||e[95]!==V?(pe=t.jsxs("aside",{className:"library-preview","aria-label":V,"data-testid":"library-preview",children:[v,C,F,J,re,ce,ie]}),e[88]=v,e[89]=C,e[90]=F,e[91]=J,e[92]=re,e[93]=ce,e[94]=ie,e[95]=V,e[96]=pe):pe=e[96],pe}function wt(r){return!r}function St(r){return r.storyboardOpen}function kt(r){return r.storyboardOpen||r.enteredScene===null?null:r.doc?.scenesById[r.enteredScene]?.name??null}function Ct(r){return De(r)}function He(r){const e=he.c(2),{item:s}=r;let h;return e[0]!==s?(h=s.thumb===void 0?t.jsx("span",{className:"library-preview-placeholder","aria-hidden":"true",children:ge[ye(s)]}):t.jsx("img",{className:"library-preview-art",src:s.thumb,alt:""}),e[0]=s,e[1]=h):h=e[1],h}function Ot(r){const e=he.c(59),{item:s,backTo:h,onClose:d}=r,a=ke();let f;e[0]!==s?(f=ve(s),e[0]=s,e[1]=f):f=e[1];const u=f,p=B(Et),n=s.installedAs??null;let j;e[2]!==n?(j=C=>n===null?void 0:C.library.find(K=>K.id===n),e[2]=n,e[3]=j):j=e[3];const o=B(j);let m;e[4]!==n?(m=C=>n===null?void 0:C.contracts[n],e[4]=n,e[5]=m):m=e[5];const c=B(m),[i,x]=y.useState(!0),g=y.useRef(null);let b,w;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=()=>g.current?.focus(),w=[],e[6]=b,e[7]=w):(b=e[6],w=e[7]),y.useEffect(b,w);let A;e[8]!==n||e[9]!==o?.host||e[10]!==a?(A=()=>{n!==null&&o?.host==="three"&&a.loadContract(n)},e[8]=n,e[9]=o?.host,e[10]=a,e[11]=A):A=e[11];const R=o?.host;let M;e[12]!==n||e[13]!==a||e[14]!==R?(M=[n,R,a],e[12]=n,e[13]=a,e[14]=R,e[15]=M):M=e[15],y.useEffect(A,M);let Q,O;e[16]!==u||e[17]!==i||e[18]!==n?(O=n===null?null:{id:"ref_library_preview",type:"component",component:n,label:u,props:vt,...i?{}:{frame:0}},e[16]=u,e[17]=i,e[18]=n,e[19]=O):O=e[19],Q=O;const $=Q,U=p!==null&&$!==null&&o?.host==="three";let G;if(U&&o!==void 0){let C;e[20]!==$||e[21]!==c||e[22]!==p||e[23]!==s.lengthFrames||e[24]!==o.contractAvailability?(C=t.jsx(ot,{doc:p,item:$,contract:c,availability:o.contractAvailability,lengthFrames:s.lengthFrames}),e[20]=$,e[21]=c,e[22]=p,e[23]=s.lengthFrames,e[24]=o.contractAvailability,e[25]=C):C=e[25],G=C}else{let C;e[26]!==s?(C=t.jsx(He,{item:s}),e[26]=s,e[27]=C):C=e[27];const K=p===null?"Open a Project to play this live.":o?.host==="dom"?qe:"Add or pin it to play it live here. Previewing never installs it.";let W;e[28]!==K?(W=t.jsx("p",{children:K}),e[28]=K,e[29]=W):W=e[29];let F;e[30]!==C||e[31]!==W?(F=t.jsxs("div",{className:"library-expanded-still",children:[C,W]}),e[30]=C,e[31]=W,e[32]=F):F=e[32],G=F}const D=p===null?0:p.fps.num/p.fps.den,Y=`Preview: ${u}`;let I;e[33]!==h||e[34]!==d?(I=t.jsxs("button",{ref:g,type:"button",className:"library-expanded-back",onClick:d,children:[_e,"Back to ",h]}),e[33]=h,e[34]=d,e[35]=I):I=e[35];let q;e[36]!==u?(q=t.jsx("h2",{children:u}),e[36]=u,e[37]=q):q=e[37];let k;e[38]!==I||e[39]!==q?(k=t.jsxs("div",{children:[I,q]}),e[38]=I,e[39]=q,e[40]=k):k=e[40];let V;e[41]!==d?(V=t.jsx("button",{type:"button",className:"btn is-outline is-icon is-lg","aria-label":"Close the larger preview",title:"Close the larger preview",onClick:d,children:ze}),e[41]=d,e[42]=V):V=e[42];let L;e[43]!==k||e[44]!==V?(L=t.jsxs("header",{className:"library-expanded-head",children:[k,V]}),e[43]=k,e[44]=V,e[45]=L):L=e[45];let T;e[46]!==G?(T=t.jsx("div",{className:"library-expanded-stage",children:G}),e[46]=G,e[47]=T):T=e[47];let S;e[48]!==D||e[49]!==s.lengthFrames||e[50]!==U||e[51]!==u||e[52]!==i?(S=U?t.jsxs("div",{className:"library-expanded-transport",children:[t.jsx("button",{type:"button",className:"library-preview-play","aria-label":i?`Stop ${u}`:`Play ${u}`,onClick:()=>x(Pt),children:i?Fe:Ce}),s.lengthFrames===void 0||!(D>0)?null:t.jsxs("span",{className:"library-expanded-length",children:["Loops every ",Se(s.lengthFrames/D)]})]}):null,e[48]=D,e[49]=s.lengthFrames,e[50]=U,e[51]=u,e[52]=i,e[53]=S):S=e[53];let v;return e[54]!==Y||e[55]!==L||e[56]!==T||e[57]!==S?(v=t.jsxs("section",{className:"library-expanded","aria-label":Y,"data-testid":"library-expanded",children:[L,T,S]}),e[54]=Y,e[55]=L,e[56]=T,e[57]=S,e[58]=v):v=e[58],v}function Pt(r){return!r}function Et(r){return r.doc}function Lt(r){const e=he.c(28),{category:s,counts:h,onCategory:d,backLabel:a,onBack:f,project:u,onBoard:p}=r;let n;if(u===null){let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"library-rail-project",children:"No Project open"}),t.jsx("span",{children:"Open a Project to add library items."})]}),e[0]=b):b=e[0],n=b}else{let b;e[1]!==u?(b=t.jsxs("span",{className:"library-rail-project",children:["Project · ",u]}),e[1]=u,e[2]=b):b=e[2];let w;e[3]!==p?(w=je(p,"library item"),e[3]=p,e[4]=w):w=e[4];let A;e[5]!==w?(A=t.jsxs("span",{"data-testid":"library-on-board",children:[w," on the storyboard"]}),e[5]=w,e[6]=A):A=e[6];let R;e[7]!==b||e[8]!==A?(R=t.jsxs(t.Fragment,{children:[b,A]}),e[7]=b,e[8]=A,e[9]=R):R=e[9],n=R}let j;e[10]!==a?(j=t.jsx("span",{children:a}),e[10]=a,e[11]=j):j=e[11];let o;e[12]!==f||e[13]!==j?(o=t.jsxs("button",{type:"button",className:"library-back","data-testid":"library-back",onClick:f,children:[_e,j]}),e[12]=f,e[13]=j,e[14]=o):o=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"library-rail-title",children:[t.jsx("span",{"aria-hidden":"true",children:"Library"}),t.jsx("span",{className:"library-rail-sub",children:"Pieces for your next shot"})]}),e[15]=m):m=e[15];let c;e[16]!==s||e[17]!==h||e[18]!==d?(c=Ze.map(b=>t.jsxs("button",{type:"button",className:"library-rail-row","data-category":b,"aria-pressed":b===s,onClick:()=>d(b),children:[ge[b],t.jsx("span",{className:"library-rail-label",children:fe[b]}),h.has(b)?t.jsx("span",{className:"library-rail-count",children:h.get(b)}):null]},b)),e[16]=s,e[17]=h,e[18]=d,e[19]=c):c=e[19];let i;e[20]!==c?(i=t.jsx("div",{className:"library-rail-rows",children:c}),e[20]=c,e[21]=i):i=e[21];let x;e[22]!==n?(x=t.jsx("div",{className:"library-rail-foot",children:n}),e[22]=n,e[23]=x):x=e[23];let g;return e[24]!==o||e[25]!==i||e[26]!==x?(g=t.jsxs("nav",{className:"library-rail","aria-label":"Library categories",children:[o,m,i,x]}),e[24]=o,e[25]=i,e[26]=x,e[27]=g):g=e[27],g}const At=Me("Stock sounds",()=>Ue(()=>import("./StockSounds-DdAUGRYK.js"),__vite__mapDeps([0,1,2,3,4])).then(r=>r.StockSounds),t.jsx("section",{className:"library-catalog","aria-busy":"true"})),Rt=Me("Generated sounds",()=>Ue(()=>import("./SoundHistory-BeS8EW1h.js"),__vite__mapDeps([5,1,2])).then(r=>r.SoundHistory),t.jsx("section",{className:"library-catalog","aria-busy":"true"})),we=[];function $t(){const r=ke(),e=B(l=>l.libraryBrowserOpen),s=B(l=>l.libraryCatalog)??we,h=B(l=>l.libraryCatalogLoaded),d=B(l=>l.libraryCatalogError),a=B(l=>l.libraryCatalogProblems)??we,f=B(l=>l.doc?.resources?.references)??we,u=B(l=>l.doc!==null),p=B(l=>l.enteredScene===null?null:l.doc?.scenesById[l.enteredScene]?.name??"Shot"),n=B(l=>l.storyboardOpen),j=B(l=>l.doc===null?null:l.doc.title??l.name??l.doc.name),[o,m]=y.useState(""),[c,i]=y.useState("component"),[x,g]=y.useState("curated"),[b,w]=y.useState(null),[A,R]=y.useState(null),[M,Q]=y.useState(null),[O,$]=y.useState(null),[U,G]=y.useState(!1),[D,Y]=y.useState(!1),I=y.useRef(null),q=y.useRef(null),k=y.useRef(null),V=y.useId();y.useEffect(()=>{if(!D)return;const l=P=>{const H=P.target;k.current?.contains(H)||q.current?.contains(H)||Y(!1)};return window.addEventListener("pointerdown",l,!0),()=>window.removeEventListener("pointerdown",l,!0)},[D]),y.useEffect(()=>{if(!e)return;const l=P=>{P.key!=="/"||P.ctrlKey||P.metaKey||P.altKey||Xe(P.target)||(P.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e]);const L=y.useMemo(()=>et(s),[s]),T=y.useMemo(()=>tt(L),[L]),S=y.useMemo(()=>st(L,c,o,x),[L,c,o,x]),v=L.find(l=>l.id===b)??null,C=y.useMemo(()=>lt(L,f),[L,f]),K=L.filter(l=>C.has(l.id)).length,W=()=>{Y(!1),r.setLibraryBrowserOpen(!1)},F=(l,P)=>{if(w(l.id),A!==null||!u||ye(l)==="sounds")return;R(l.id),Q(null),r.dismissError();let H=Promise.resolve();P==="place"?H=r.dropLibraryOnFrame(l.id):P==="claim"?H=r.claimLibraryShot(l.id):Te(r)&&(H=r.addStoryboardLibraryItem(l.id,null)),H.finally(()=>{R(null);const J=r.getState().error;J!==null?Q({id:l.id,message:J}):P!=="pin"&&r.setLibraryBrowserOpen(!1)})},Z=l=>F(l,nt(l)?"place":"pin"),le=l=>F(l,"pin"),ee=()=>{G(!0),r.refreshLibraryCatalog().finally(()=>G(!1))},te=v!==null&&O===v.id&&Ke(v),ae=l=>{$(null),i(l)},oe=B(l=>l.libraryBrowserCategory);y.useEffect(()=>{e&&oe!==null&&ae(oe)},[e,oe]);const de=it(c),se=fe[c].toLowerCase(),ue=()=>{if(!h)return d===null||U?t.jsx(me,{icon:"all",message:"Loading the library…"}):t.jsx(me,{icon:"all",message:"The library could not be read.",detail:d,action:t.jsx("button",{type:"button",className:"btn is-outline",onClick:ee,children:"Retry"})});if(L.length===0)return t.jsx(me,{icon:"all",message:"This build ships no library items."});if(S.length===0)return o.trim()===""?t.jsx(me,{icon:c,message:`This build ships no ${se}.`}):t.jsx(me,{icon:c,message:`No ${c==="all"?"items":se} match ${JSON.stringify(o.trim())}.`,action:t.jsx("button",{type:"button",className:"btn is-outline",onClick:()=>{m(""),I.current?.focus()},children:"Clear search"})});const l=c==="all"?rt(S).map(P=>({heading:fe[P.kind],label:fe[P.kind],rows:P.rows})):[{label:fe[c],rows:S}];return t.jsx(dt,{sections:l,selected:b,onSelect:w,onAdd:Z})};let z=`Back to ${j??"the editor"}`;return n?z="Back to storyboard":p!==null&&(z=`Back to ${p}`),t.jsxs(Qe,{open:e,className:"library-browser",title:"Library",onClose:W,children:[t.jsxs("div",{className:"library-main",children:[t.jsx(Lt,{category:c,counts:T,onCategory:ae,backLabel:z,onBack:W,project:j,onBoard:K}),c==="stock"?t.jsx(At,{canAdd:u}):c==="generated"?t.jsx(Rt,{canAdd:u}):te&&v!==null?t.jsx(Ot,{item:v,backTo:se,onClose:()=>$(null)}):t.jsxs("section",{className:"library-catalog","aria-label":fe[c],children:[t.jsxs("header",{className:"library-catalog-head",children:[t.jsxs("div",{children:[t.jsx("h2",{children:fe[c]}),t.jsx("p",{children:at[c]})]}),t.jsx("span",{"data-testid":"library-count",children:je(S.length,de)})]}),t.jsxs("div",{className:"library-search-row",children:[t.jsxs("label",{className:"search-field",children:[Je,t.jsx("input",{ref:I,type:"search",value:o,placeholder:"Search library","aria-label":"Search library","data-testid":"library-search",onChange:l=>m(l.target.value)}),t.jsx("kbd",{className:"kbd","aria-hidden":"true",children:"/"})]}),t.jsx("select",{className:"select is-quiet","aria-label":"Sort","data-testid":"library-sort",value:x,onChange:l=>g(l.target.value),children:Object.keys(Ae).map(l=>t.jsx("option",{value:l,children:Ae[l]},l))})]}),ue()]}),c==="stock"||c==="generated"?null:t.jsx(Nt,{item:v,destination:"Project storyboard",onBoard:v===null?0:C.get(v.id)??0,canAdd:u,adding:A!==null,onAdd:()=>{v!==null&&Z(v)},onClaim:()=>{v!==null&&F(v,"claim")},onPin:()=>{v!==null&&le(v)},error:M!==null&&M.id===v?.id?M.message:null,expanded:te,onExpand:l=>$(l&&v!==null?v.id:null)},v?.id)]}),t.jsxs("footer",{className:"library-status","data-testid":"library-status",onKeyDown:l=>{l.key!=="Escape"||!D||(l.stopPropagation(),Y(!1),q.current?.focus())},children:[t.jsx("span",{children:te?"Play the preview to see the motion.":c==="sounds"?"Choose a pack, then preview an individual sound.":c==="stock"?"Search, then press Enter. Only sounds you may use in a video are listed.":c==="generated"?"Pick a take to hear it, then add it to the timeline.":"Click an item to preview it."}),a.length===0?null:t.jsxs("span",{className:"library-status-problems","data-testid":"library-browser-problems",children:[je(a.length,"item")," unavailable",t.jsx("button",{ref:q,type:"button",className:"library-status-details","aria-expanded":D,"aria-controls":V,onClick:()=>Y(l=>!l),children:"Details"})]}),D&&a.length>0?t.jsx("div",{ref:k,id:V,className:"popover library-problems",role:"region","aria-label":"Unavailable items",children:t.jsx("ul",{"data-testid":"library-problems-list",children:a.map(l=>t.jsxs("li",{children:[t.jsx("span",{children:l.id}),t.jsx("span",{children:l.error})]},l.id))})}):null]})]})}function me(r){const e=he.c(9),{icon:s,message:h,detail:d,action:a}=r,f=ge[s];let u;e[0]!==h?(u=t.jsx("p",{children:h}),e[0]=h,e[1]=u):u=e[1];let p;e[2]!==d?(p=d===void 0?null:t.jsx("p",{className:"library-state-detail",children:d}),e[2]=d,e[3]=p):p=e[3];let n;return e[4]!==a||e[5]!==f||e[6]!==u||e[7]!==p?(n=t.jsxs("div",{className:"library-state",role:"status",children:[f,u,p,a]}),e[4]=a,e[5]=f,e[6]=u,e[7]=p,e[8]=n):n=e[8],n}const Tt=Object.freeze(Object.defineProperty({__proto__:null,LibraryBrowser:$t},Symbol.toStringTag,{value:"Module"}));export{Tt as L,jt as S};
@@ -0,0 +1,2 @@
1
+ import{a5 as R,a6 as F,a7 as _,A,B as v,v as o,y as M,q as $,u as C,h as O,a8 as B,x as L,a9 as w,aa as P,z as D,ab as G,ac as K,l as z,a as W,ad as q}from"./index-BGHQGV5z.js";const U=[{id:"launch",label:"Product launch"},{id:"feature",label:"Feature"},{id:"app",label:"App promo"},{id:"logo",label:"Logo"},{id:"text",label:"Text"},{id:"update",label:"Changelog"}];U.map(l=>l.id);const V=l=>_.includes(l);function T(l,e,s,t,a,n){for(const r of F(a,n)){const i=n[r];i.swap===void 0||!V(i.kind)||l.push({layerId:r,containerId:e,container:s,containerName:t,label:i.swap.label,kind:i.kind})}}function Y(l){const e=[];for(const t of l.scenes){const a=l.scenesById[t];a!==void 0&&T(e,t,"scene",a.name,a.layers,a.layersById)}const s=R(l);for(const t of Object.keys(s).sort()){const a=s[t];T(e,t,"component",a.name,a.roots,a.layersById)}return e}function te(){const l=A(s=>s.doc),e=v.useMemo(()=>l===null?[]:Y(l),[l]);return l===null||e.length===0?null:o.jsx(M,{title:"Make it yours",persistKey:"shot:make-it-yours",summary:`${e.length} ${e.length===1?"field":"fields"}`,children:o.jsx("ul",{className:"make-it-yours","data-testid":"make-it-yours",children:e.map(s=>o.jsx(H,{doc:l,field:s},`${s.containerId}/${s.layerId}`))})})}function H(l){const e=$.c(47),{doc:s,field:t}=l,a=C();let n,r,i;if(e[0]!==s||e[1]!==t.containerId||e[2]!==t.layerId){i=Symbol.for("react.early_return_sentinel");e:{if(n=O(s,t.containerId)?.layersById[t.layerId],n===void 0){i=null;break e}r=n.locked===!0?B(n):null}e[0]=s,e[1]=t.containerId,e[2]=t.layerId,e[3]=n,e[4]=r,e[5]=i}else n=e[3],r=e[4],i=e[5];if(i!==Symbol.for("react.early_return_sentinel"))return i;const c=r;let d;e[6]!==t.container?(d=t.container==="component"?["changes every use"]:[],e[6]=t.container,e[7]=d):d=e[7];let p;e[8]!==c?(p=c===null?[]:["Locked"],e[8]=c,e[9]=p):p=e[9];let g;e[10]!==t.containerName||e[11]!==d||e[12]!==p?(g=[t.containerName,...d,...p],e[10]=t.containerName,e[11]=d,e[12]=p,e[13]=g):g=e[13];const j=g.join(" · ");let k;e[14]!==s||e[15]!==n?(k=n.kind==="image"||n.kind==="video"?o.jsx(J,{doc:s,layer:n}):null,e[14]=s,e[15]=n,e[16]=k):k=e[16];const S=t.container==="component"?`Open ${t.containerName} and select this layer`:`Go to ${t.containerName} and select this layer`;let I;e[17]!==t||e[18]!==a?(I=()=>Z(a,t),e[17]=t,e[18]=a,e[19]=I):I=e[19];let u;e[20]!==t.label?(u=o.jsx("span",{className:"make-it-yours-label",children:t.label}),e[20]=t.label,e[21]=u):u=e[21];let f;e[22]!==j?(f=o.jsx("span",{className:"make-it-yours-where",children:j}),e[22]=j,e[23]=f):f=e[23];let h;e[24]!==f||e[25]!==S||e[26]!==I||e[27]!==u?(h=o.jsxs("button",{type:"button",className:"make-it-yours-name",title:S,onClick:I,children:[u,f]}),e[24]=f,e[25]=S,e[26]=I,e[27]=u,e[28]=h):h=e[28];let x;e[29]!==t||e[30]!==n.kind||e[31]!==c?(x=n.kind==="image"||n.kind==="video"?o.jsx(Q,{field:t,kind:n.kind,lock:c}):null,e[29]=t,e[30]=n.kind,e[31]=c,e[32]=x):x=e[32];let m;e[33]!==h||e[34]!==x||e[35]!==k?(m=o.jsxs("div",{className:"make-it-yours-head",children:[k,h,x]}),e[33]=h,e[34]=x,e[35]=k,e[36]=m):m=e[36];let y;e[37]!==t||e[38]!==n.kind||e[39]!==n.text||e[40]!==c||e[41]!==a?(y=n.kind==="text"?o.jsx(L,{value:n.text.content,ariaLabel:`${t.label}, text`,multiline:n.text.content.includes(`
2
+ `),...c===null?{}:{readOnly:!0,title:c},onCommit:E=>X(a,t,E)}):null,e[37]=t,e[38]=n.kind,e[39]=n.text,e[40]=c,e[41]=a,e[42]=y):y=e[42];let b;return e[43]!==t.layerId||e[44]!==m||e[45]!==y?(b=o.jsxs("li",{className:"make-it-yours-row","data-field":t.layerId,children:[m,y]}),e[43]=t.layerId,e[44]=m,e[45]=y,e[46]=b):b=e[46],b}function J(l){const e=$.c(8),{doc:s,layer:t}=l,a=s.assets[t.kind==="image"?t.image.asset:t.video.asset];let n;e[0]!==a?(n=a===void 0?{title:"File missing"}:{},e[0]=a,e[1]=n):n=e[1];let r;e[2]!==a||e[3]!==t.kind?(r=a===void 0?null:t.kind==="image"?o.jsx("img",{className:"make-it-yours-media",src:w(a.path),alt:"",draggable:!1,loading:"lazy"}):o.jsx(P,{className:"make-it-yours-media",src:w(a.path),atSeconds:null}),e[2]=a,e[3]=t.kind,e[4]=r):r=e[4];let i;return e[5]!==n||e[6]!==r?(i=o.jsx("span",{className:"make-it-yours-thumb","aria-hidden":"true",...n,children:r}),e[5]=n,e[6]=r,e[7]=i):i=e[7],i}function Q(l){const e=$.c(22),{field:s,kind:t,lock:a}=l,n=C(),r=D(),i=v.useRef(null),[c,d]=v.useState(!1);let p;e[0]!==s.containerId||e[1]!==s.layerId||e[2]!==n?(p=E=>{d(!0),n.replaceLayerMedia(s.layerId,E,s.containerId).catch(N=>n.reportError(N instanceof Error?N.message:String(N))).finally(()=>d(!1))},e[0]=s.containerId,e[1]=s.layerId,e[2]=n,e[3]=p):p=e[3];const g=p,j=`Replace, ${s.label}`,k=a??`Swap ${s.label} for a file of your own`,S=r||c,I=a!==null||void 0;let u;e[4]!==a||e[5]!==n?(u=()=>{a===null?i.current?.click():n.reportError(a)},e[4]=a,e[5]=n,e[6]=u):u=e[6];let f;e[7]!==j||e[8]!==k||e[9]!==S||e[10]!==I||e[11]!==u?(f=o.jsx("button",{type:"button",className:"btn","aria-label":j,title:k,disabled:S,"aria-disabled":I,onClick:u,children:"Replace…"}),e[7]=j,e[8]=k,e[9]=S,e[10]=I,e[11]=u,e[12]=f):f=e[12];const h=`${s.label}, ${t} file`,x=t==="video"?G:K;let m;e[13]!==g?(m=E=>{const N=E.currentTarget.files?.[0];E.currentTarget.value="",N!==void 0&&g(N)},e[13]=g,e[14]=m):m=e[14];let y;e[15]!==m||e[16]!==h||e[17]!==x?(y=o.jsx("input",{ref:i,type:"file",hidden:!0,"aria-label":h,accept:x,onChange:m}),e[15]=m,e[16]=h,e[17]=x,e[18]=y):y=e[18];let b;return e[19]!==y||e[20]!==f?(b=o.jsxs(o.Fragment,{children:[f,y]}),e[19]=y,e[20]=f,e[21]=b):b=e[21],b}function X(l,e,s){const t=l.getState();if(t.doc===null)return;const a=z(t.doc,e.containerId,W(t));let n=null;l.edit(i=>{const c=q(i,e.containerId,[e.layerId],d=>d.kind==="text"?{...d,text:{...d.text,content:s}}:d,a);return n=c.refusal,c.doc})&&n!==null&&l.reportError(n)}function Z(l,e){if(e.container==="component"){l.editComponent(e.containerId),l.getState().editingDef===e.containerId&&l.select([e.layerId]);return}l.enterScene(e.containerId),l.getState().enteredScene===e.containerId&&l.select([e.layerId])}export{te as MakeItYoursSection};