@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,3 @@
1
+ import{q as X,u as ue,eA as Qs,B as R,v as n,eB as Je,eC as en,eD as tn,eE as sn,I as xe,eF as nn,eG as Gt,eH as ln,eI as Zt,x as Ee,z as Fe,eJ as Lt,eK as an,eL as Qe,eM as Ue,eN as on,eO as rn,eP as gs,eQ as ot,N as Le,A as B,b5 as Pt,eR as xs,ej as cn,eS as Ot,eT as Dt,eU as ks,eV as rt,ea as dn,D as Ae,d7 as Be,eW as Rt,eX as Mt,eY as et,eZ as un,e_ as fn,e$ as ft,f0 as At,f1 as hn,f2 as js,f3 as mn,f4 as Ss,f5 as pn,f6 as Ft,U as De,dV as vs,f7 as bn,f8 as Jt,f9 as yn,ck as Nt,fa as gn,fb as xn,aX as kn,fc as jn,dJ as Sn,fd as vn,fe as Nn,ff as Ns,fg as Cn,fh as wn,aa as _t,fi as $n,fj as Cs,F as lt,fk as In,P as En,fl as Tn,a1 as Bt,fm as ws,fn as Ht,fo as Qt,fp as es,fq as Ln,fr as Pn,fs as On,d2 as Dn,a9 as Ve,ft as ht,fu as Rn,fv as Mn,cP as An,fw as Fn,fx as _n,fy as Bn,fz as Hn,bU as $s,a2 as Is,aT as Es,fA as Ts,am as zn,fB as Kn,an as Un,aq as Vn,aS as Wn,as as Xe,fC as Ls,fD as st,fE as Ps,fF as Ct,fG as Xn,fH as Yn,fI as qn,b1 as Gn,fJ as Zn,fK as mt,fL as Jn,fM as Qn,fN as Os,fO as ve,ch as nt,fP as el,fQ as tl,fR as ts,fS as sl,fT as nl,fU as ss,fV as gt,fW as Ds,fX as ll,fY as al,fZ as at,f_ as il,em as ol,f$ as rl,g0 as cl,g1 as dl,aP as ns,R as ul,g2 as Rs,g3 as Ms,w as fl,g4 as hl,ag as ml,cK as pl,g5 as As,g6 as Fs,y as ct,g7 as _s,g8 as bl,g9 as yl,ga as Bs,gb as gl,gc as xl,gd as xt,ge as kl,gf as kt,gg as wt,M as jl,gh as Sl,gi as vl,gj as Nl,gk as Cl}from"./index-BGHQGV5z.js";import{C as Hs,c as wl,p as $l,u as Il,a as El,S as Tl,l as Ll,D as Pl}from"./ComponentStage-BRhRotyH.js";import{b as ls,s as Ol}from"./libraryModel-CpIwfFha.js";const as=(t,e)=>{const l=t.getBoundingClientRect();return e?{left:l.left,top:l.top,width:l.width,height:l.height,scrollLeft:0,scrollTop:0,scrollWidth:l.width,scrollHeight:l.height}:{left:l.left,top:l.top,width:l.width,height:l.height,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight}};function Dl(t,e,l){return t.scrollWidth<=0||t.scrollHeight<=0||e<t.left||e>t.left+t.width||l<t.top||l>t.top+t.height?null:{x:(e-t.left+t.scrollLeft)/t.scrollWidth,y:(l-t.top+t.scrollTop)/t.scrollHeight}}function Rl(t,e,l){return{left:e*t.scrollWidth,top:l*t.scrollHeight}}function Ml(t,e){return e===null?t?.space==="canvas":t?.space==="sketch"&&t.where===e}function zs(t){const e=X.c(19),{canvas:l,where:s}=t,i=s===void 0?null:s,a=ue(),{live:r,people:o}=Qs(),d=i!==null;let c,u;e[0]!==l||e[1]!==r||e[2]!==a||e[3]!==i?(c=()=>{if(!r||l===null)return;const g=new AbortController;let y;y=null;const j=()=>{const x=y===null?null:Dl(as(l,i!==null),y.x,y.y),S=i===null?{space:"canvas"}:{space:"sketch",where:i};a.presence.update({cursor:x===null?null:{...x,...S}})},k=()=>{y=null,a.presence.update({cursor:null})};return l.addEventListener("pointermove",x=>{y={x:x.clientX,y:x.clientY},j()},{signal:g.signal}),l.addEventListener("scroll",()=>y!==null&&j(),{signal:g.signal}),l.addEventListener("pointerleave",k,{signal:g.signal}),()=>{g.abort(),k()}},u=[r,l,a,i],e[0]=l,e[1]=r,e[2]=a,e[3]=i,e[4]=c,e[5]=u):(c=e[4],u=e[5]),R.useEffect(c,u);const[,f]=R.useState(0);let m;e[6]!==l||e[7]!==f?(m=()=>{if(l===null||typeof ResizeObserver>"u")return;const g=new ResizeObserver(()=>f(Al));return g.observe(l),()=>g.disconnect()},e[6]=l,e[7]=f,e[8]=m):m=e[8];let h;if(e[9]!==l?(h=[l],e[9]=l,e[10]=h):h=e[10],R.useEffect(m,h),!r||l===null)return null;let p,b;if(e[11]!==l||e[12]!==d||e[13]!==o||e[14]!==i){b=Symbol.for("react.early_return_sentinel");e:{let g;e[17]!==i?(g=x=>Ml(x.cursor,i),e[17]=i,e[18]=g):g=e[18];const y=o.filter(g);if(y.length===0){b=null;break e}const j=as(l,d),k=d?{scrollWidth:j.width,scrollHeight:j.height}:{scrollWidth:l.scrollWidth,scrollHeight:l.scrollHeight};p=n.jsx("div",{className:"board-cursors","aria-hidden":"true","data-testid":"board-cursors",style:{width:k.scrollWidth,height:k.scrollHeight},children:y.map(x=>{const S=Rl(k,x.cursor.x,x.cursor.y);return n.jsxs("div",{className:"board-cursor","data-testid":"board-cursor","data-user":x.user,style:{left:S.left,top:S.top},children:[n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",children:n.jsx("path",{d:"M1 1 L1 13 L4.5 9.8 L7 15 L9.2 14 L6.8 8.9 L11.5 8.9 Z",fill:x.color,stroke:"#0B0B0B",strokeWidth:"1",strokeLinejoin:"round"})}),n.jsx("span",{className:"board-cursor-tag",style:{background:x.color},children:x.name})]},x.user)})})}e[11]=l,e[12]=d,e[13]=o,e[14]=i,e[15]=p,e[16]=b}else p=e[15],b=e[16];return b!==Symbol.for("react.early_return_sentinel")?b:p}function Al(t){return t+1}function Me(t){return t.kind==="shot"?t.shot.part?.id??t.shot.sceneId:t.part.id}function Fl(t,e,l,s){const i=e.findIndex(f=>Me(f)===l);if(i<0)return t;const a=Math.max(0,Math.min(e.length,Math.trunc(s))),r=a>i?a-1:a;if(r===i)return t;const o=[...e],[d]=o.splice(i,1);o.splice(r,0,d);const c=is(t,o,!1),u=o.map(Me).join(" ");return Je(c).map(Me).join(" ")===u?c:is(t,o,!0)}function is(t,e,l){let s=t;return e.flatMap(a=>{if(a.kind==="placeholder")return[a.part.id];if(a.shot.part!==null)return[a.shot.part.id];const r=l?en(s,a.shot.sceneId):null;return r===null?[]:(s=r.doc,[r.part])}).forEach((a,r)=>{s=tn(s,a,r)}),e.flatMap(a=>a.kind==="shot"?[a.shot.sceneId]:[]).forEach((a,r)=>{s=sn(s,a,r)}),s}function _l(t,e,l,s,i){if(i.shiftKey&&l!==null){const a=e.indexOf(l),r=e.indexOf(s);if(a!==-1&&r!==-1)return{selection:e.slice(Math.min(a,r),Math.max(a,r)+1),anchor:l}}return i.ctrlKey||i.metaKey?{selection:t.includes(s)?t.filter(a=>a!==s):[...t,s],anchor:s}:{selection:[s],anchor:s}}function Bl(t,e,l){const s=Lt(t,e);if(s===null)return{kind:"none",reason:""};const i=e.part===void 0?void 0:t.storyboard?.parts.find(r=>r.id===e.part),a=i?.scene===void 0?void 0:t.scenesById[i.scene];if(s.state==="satisfied"){const r=s.evidence?.scene??a?.id??null,o=r===null?void 0:t.scenesById[r];return o!==void 0&&r!==null?{kind:"in",sceneId:r,layerId:s.evidence?.layer??null,label:`In ${o.name}`}:{kind:"none",reason:s.reason}}if(s.state==="done")return{kind:"none",reason:s.reason};if(e.type==="sound"&&e.asset===void 0)return{kind:"choose-file"};if(e.type==="library"||e.type==="note")return{kind:"none",reason:s.reason};if(i!==void 0&&i.scene===void 0)return{kind:"none",reason:`Create a Shot for ${i.label} first.`};if(i!==void 0&&a===void 0)return{kind:"none",reason:`The Shot ${i.label} was linked to is gone. Link another.`};if(e.type==="component"){const r=e.component===void 0?null:l(e.component);if(r===null)return{kind:"none",reason:`${e.component??e.label} is not in the registry.`};if(r!=="three")return{kind:"none",reason:cn(r)}}return i===void 0&&e.type!=="transition"&&e.type!=="sound"?{kind:"place-in",title:"Choose the Shot to place it in"}:{kind:"place",title:a===void 0?"Place it in the video":`Place it in ${a.name}`}}function Hl(t){const e=X.c(36),{doc:l,item:s,sceneId:i}=t,a=ue(),r=B(zl);let o;e[0]!==l||e[1]!==s?(o=Lt(l,s),e[0]=l,e[1]=s,e[2]=o):o=e[2];const d=o;let c;e[3]!==r?(c=$=>r.find(I=>I.id===$)?.host??null,e[3]=r,e[4]=c):c=e[4];let u;e[5]!==l||e[6]!==s||e[7]!==c?(u=Bl(l,s,c),e[5]=l,e[6]=s,e[7]=c,e[8]=u):u=e[8];const f=u,m=R.useRef(null),h=Pt(),[p,b]=R.useState(!1),g=Fe(),y=p||g,j=i===void 0?void 0:l.scenesById[i];let k;e[9]!==a?(k=$=>{b(!0),$.catch(I=>a.reportError(I instanceof Error?I.message:String(I))).finally(()=>b(!1))},e[9]=a,e[10]=k):k=e[10];const x=k;let S;e[11]!==l.scenes||e[12]!==l.scenesById||e[13]!==s||e[14]!==h||e[15]!==x||e[16]!==a?(S=$=>{const I=l.scenes.map(w=>({kind:"action",id:`ledger-place-in-${w}`,label:l.scenesById[w]?.name??w,onSelect:()=>x(a.placeStoryboardItem(s.id,w))}));if(I.length===0){a.reportError("This Project has no Shot yet. Create one from a planned shot first.");return}h.open($,I)},e[11]=l.scenes,e[12]=l.scenesById,e[13]=s,e[14]=h,e[15]=x,e[16]=a,e[17]=S):S=e[17];const v=S;let C;e[18]!==f.kind||e[19]!==f.label||e[20]!==f.layerId||e[21]!==f.reason||e[22]!==f.sceneId||e[23]!==f.title||e[24]!==y||e[25]!==s||e[26]!==v||e[27]!==d?.state||e[28]!==x||e[29]!==i||e[30]!==j||e[31]!==a?(C=f.kind==="place"?n.jsx("button",{type:"button",className:"btn",title:f.title,disabled:y,onClick:()=>x(a.placeStoryboardItem(s.id)),children:"Place"}):f.kind==="place-in"&&i!==void 0&&j!==void 0?n.jsx("button",{type:"button",className:"btn",title:`Place it in ${j.name}`,disabled:y,onClick:()=>x(a.placeStoryboardItem(s.id,i)),children:"Place"}):f.kind==="place-in"?n.jsx("button",{type:"button",className:"btn",title:f.title,"aria-haspopup":"menu",disabled:y,onClick:$=>{const I=$.currentTarget.getBoundingClientRect();v({x:I.left,y:I.bottom+6})},children:"Place in…"}):f.kind==="in"?n.jsx("button",{type:"button",className:"btn ledger-in",title:"Open the Shot on what satisfies this",onClick:()=>a.openStoryboardShot(f.sceneId,f.layerId),children:f.label}):f.kind==="choose-file"?n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"btn",disabled:y,onClick:()=>m.current?.click(),children:"Choose file…"}),n.jsx("input",{ref:m,type:"file",hidden:!0,accept:xs,"data-testid":"ledger-sound-file",onChange:$=>{const I=$.currentTarget.files?.[0];$.currentTarget.value="",I!==void 0&&x(a.setSoundFile(s.id,I))}})]}):d?.state==="missing"?n.jsx("button",{type:"button",className:"btn","aria-disabled":"true",title:f.reason,onClick:()=>a.reportError(f.reason),children:"Place"}):n.jsx("span",{className:"ledger-note",title:f.reason,children:d?.state==="done"?"Ticked by hand":f.reason}),e[18]=f.kind,e[19]=f.label,e[20]=f.layerId,e[21]=f.reason,e[22]=f.sceneId,e[23]=f.title,e[24]=y,e[25]=s,e[26]=v,e[27]=d?.state,e[28]=x,e[29]=i,e[30]=j,e[31]=a,e[32]=C):C=e[32];let E;return e[33]!==h.menu||e[34]!==C?(E=n.jsxs(n.Fragment,{children:[C,h.menu]}),e[33]=h.menu,e[34]=C,e[35]=E):E=e[35],E}function zl(t){return t.library}function Oe(t){const e=X.c(12);let l;e[0]!==t.prose?(l=t.prose===!0?{align:"start"}:{},e[0]=t.prose,e[1]=l):l=e[1];const s=`insp-dim${t.prose===!0?" is-text":""}`;let i;e[2]!==t.title?(i=t.title===void 0?{}:{title:t.title},e[2]=t.title,e[3]=i):i=e[3];let a;e[4]!==t.children||e[5]!==s||e[6]!==i?(a=n.jsx("span",{className:s,...i,children:t.children}),e[4]=t.children,e[5]=s,e[6]=i,e[7]=a):a=e[7];let r;return e[8]!==t.label||e[9]!==l||e[10]!==a?(r=n.jsx(xe,{label:t.label,className:"insp-readout",...l,children:a}),e[8]=t.label,e[9]=l,e[10]=a,e[11]=r):r=e[11],r}const Kl={satisfied:" is-success",done:" is-success",missing:" is-accent",unchecked:""};function Ks(t){const e=X.c(32),{doc:l,item:s}=t,i=ue(),a=Fe();let r;e[0]!==l||e[1]!==s?(r=Lt(l,s),e[0]=l,e[1]=s,e[2]=r):r=e[2];const o=r;if(o===null)return null;const d=an[o.state],c=s.done===!0,u=[o.evidence?.scene,o.evidence?.layer,o.evidence?.clip].filter(Vl),f=`badge${Kl[o.state]}`;let m;e[3]!==d.label||e[4]!==f?(m=n.jsx("span",{className:f,"data-testid":"requirement-status",children:d.label}),e[3]=d.label,e[4]=f,e[5]=m):m=e[5];const h=o.reason||d.title,p=u.length===0?"":` (${u.map(Ul).join(" ")})`;let b;e[6]!==h||e[7]!==p?(b=n.jsxs("span",{className:"insp-dim is-text",children:[h,p]}),e[6]=h,e[7]=p,e[8]=b):b=e[8];let g;e[9]!==m||e[10]!==b?(g=n.jsxs(xe,{label:"Status",align:"start",className:"insp-readout",children:[m,b]}),e[9]=m,e[10]=b,e[11]=g):g=e[11];let y;e[12]!==l||e[13]!==s?(y=n.jsx(Hl,{doc:l,item:s}),e[12]=l,e[13]=s,e[14]=y):y=e[14];const j=`btn${c?" is-active":""}`,k=c?"Clear the tick: the status goes back to what the video holds":"Tick it by hand, whatever the video holds";let x;e[15]!==c||e[16]!==s.id||e[17]!==i?(x=()=>i.setStoryboardDone(s.id,!c),e[15]=c,e[16]=s.id,e[17]=i,e[18]=x):x=e[18];const S=c?"Clear done":"Mark done";let v;e[19]!==c||e[20]!==a||e[21]!==k||e[22]!==x||e[23]!==S||e[24]!==j?(v=n.jsx("button",{type:"button",className:j,"aria-pressed":c,disabled:a,title:k,onClick:x,children:S}),e[19]=c,e[20]=a,e[21]=k,e[22]=x,e[23]=S,e[24]=j,e[25]=v):v=e[25];let C;e[26]!==v||e[27]!==y?(C=n.jsxs(xe,{children:[y,v]}),e[26]=v,e[27]=y,e[28]=C):C=e[28];let E;return e[29]!==C||e[30]!==g?(E=n.jsxs(n.Fragment,{children:[g,C]}),e[29]=C,e[30]=g,e[31]=E):E=e[31],E}function Ul(t){return`#${t}`}function Vl(t){return t!==void 0}const Wl=nn.map(t=>({value:t,label:Gt[t].label,title:Gt[t].title})),Xl=ln.map(t=>({value:t,label:Zt[t].label,title:Zt[t].title}));function os(t){return typeof t=="number"&&Number.isFinite(t)?Math.max(0,Math.round(t)):null}function zt(t){const e=X.c(29),{card:l}=t,s=ue(),i=Fe();let a;e[0]!==l.id?(a=(g,y)=>{const j=os(y);return j===null?g:ot(g,l.id,{frame:j})},e[0]=l.id,e[1]=a):a=e[1];const r=Qe(a),o=l.type==="component"?l.frame:void 0;let d;e[2]!==l.id||e[3]!==l.type||e[4]!==r||e[5]!==o||e[6]!==i||e[7]!==s?(d=l.type==="component"?n.jsx(xe,{children:n.jsx(Ue,{value:o??Number.NaN,label:"Frame",ariaLabel:"Frame, component",min:0,step:1,title:"The moment of the component this card means. The preview holds it.",onCommit:g=>{const y=os(g);y!==null&&s.updateReference(l.id,{frame:y})},onScrubStart:r.start,onScrub:r.move,onScrubEnd:r.end,trailing:o===void 0?null:n.jsx("button",{type:"button",className:"insp-key","aria-label":"Clear the component frame",title:"Loop the preview again",disabled:i,onClick:g=>{const y=g.currentTarget.closest(".numfield")?.querySelector(".numfield-input");s.updateReference(l.id,{frame:null}),y?.focus()},children:n.jsx(on,{})})})}):null,e[2]=l.id,e[3]=l.type,e[4]=r,e[5]=o,e[6]=i,e[7]=s,e[8]=d):d=e[8];let c;e[9]!==l?(c=rn(l),e[9]=l,e[10]=c):c=e[10];let u;e[11]!==l.id||e[12]!==s?(u=g=>s.updateReference(l.id,{use:g==="asset"?"asset":null}),e[11]=l.id,e[12]=s,e[13]=u):u=e[13];let f;e[14]!==c||e[15]!==u?(f=n.jsx(xe,{label:"Use",children:n.jsx(Le,{options:Wl,value:c,ariaLabel:"Use",onChange:u})}),e[14]=c,e[15]=u,e[16]=f):f=e[16];let m;e[17]!==l?(m=gs(l),e[17]=l,e[18]=m):m=e[18];let h;e[19]!==l.id||e[20]!==s?(h=g=>s.updateReference(l.id,{importance:g==="optional"?"optional":null}),e[19]=l.id,e[20]=s,e[21]=h):h=e[21];let p;e[22]!==m||e[23]!==h?(p=n.jsx(xe,{label:"Importance",children:n.jsx(Le,{options:Xl,value:m,ariaLabel:"Importance",onChange:h})}),e[22]=m,e[23]=h,e[24]=p):p=e[24];let b;return e[25]!==d||e[26]!==f||e[27]!==p?(b=n.jsxs(n.Fragment,{children:[d,f,p]}),e[25]=d,e[26]=f,e[27]=p,e[28]=b):b=e[28],b}function Kt(t){const e=X.c(7),{card:l}=t,s=ue(),i=l.note??"";let a;e[0]!==l.id||e[1]!==l.note||e[2]!==s?(a=o=>{const d=o.trim();d!==(l.note??"")&&s.updateReference(l.id,{note:d===""?null:d})},e[0]=l.id,e[1]=l.note,e[2]=s,e[3]=a):a=e[3];let r;return e[4]!==i||e[5]!==a?(r=n.jsx(xe,{label:"Note",align:"start",children:n.jsx(Ee,{multiline:!0,value:i,placeholder:"What should the agent notice?",ariaLabel:"Note",onCommit:a})}),e[4]=i,e[5]=a,e[6]=r):r=e[6],r}const it="application/x-dailies-shot",Yl=[ft,At,"Files"],ql=346,Gl={planned:"",building:" is-building",built:" is-success"};function Zl(t,e){return`${t} ${t===1?"sketch":"sketches"} · ${e} pinned`}const Jl=n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"6",cy:"4",r:"1.25"}),n.jsx("circle",{cx:"10",cy:"4",r:"1.25"}),n.jsx("circle",{cx:"6",cy:"8",r:"1.25"}),n.jsx("circle",{cx:"10",cy:"8",r:"1.25"}),n.jsx("circle",{cx:"6",cy:"12",r:"1.25"}),n.jsx("circle",{cx:"10",cy:"12",r:"1.25"})]});function Ql(t){const e=X.c(158),{doc:l,entry:s,at:i,selected:a}=t,r=ue(),o=Ot(),d=B(na),c=s.kind==="shot"?s.shot.part:s.part,u=s.kind==="shot"?s.shot:null;let f;e[0]!==s?(f=Me(s),e[0]=s,e[1]=f):f=e[1];const m=f,h=s.kind==="shot"?s.name:s.part.label;let p;e[2]!==o||e[3]!==c?(p=Dt(c,o),e[2]=o,e[3]=c,e[4]=p):p=e[4];const b=p,g=u?.scene??null;let y,j,k,x,S,v,C,E,$,I,w,T,D,F,P,O,L,M,U,A,z,V,W,Z,J;if(e[5]!==i||e[6]!==l||e[7]!==s||e[8]!==m||e[9]!==h||e[10]!==c||e[11]!==t||e[12]!==d||e[13]!==a||e[14]!==u||e[15]!==b||e[16]!==r||e[17]!==g){const te=ks(l,c,g);let ee,fe;if(e[43]!==i||e[44]!==l||e[45]!==s||e[46]!==m||e[47]!==h||e[48]!==c||e[49]!==t||e[50]!==d||e[51]!==a||e[52]!==u||e[53]!==b||e[54]!==r){const je=c===null?0:(l.resources?.references??[]).filter(le=>le.part===c.id).length,me=String(i+1);let he;e[78]!==me?(he=me.padStart(2,"0"),e[78]=me,e[79]=he):he=e[79];const be=he,pe=c?.voice!==void 0?`“${c.voice}”`:c?.notes,ye=ta,Se=ea;let oe;e[80]!==c||e[81]!==u||e[82]!==r?(oe=le=>{le.currentTarget.classList.remove("is-drop");const ge=le.dataTransfer,Ne=c?.id??null,we=c===null&&u!==null?{scene:u.sceneId}:{},$e=Rt(ge),H=$e===null?Mt(ge):null,K=Array.from(ge.files??[]);if(!($e===null&&H===null&&K.length===0)){if(le.preventDefault(),le.stopPropagation(),$e?.kind==="reference"){const ie=r.getState().storyboardSelection,se=ie.includes($e.id)?ie.filter(et):[$e.id];r.attachStoryboardItems(se,Ne,we)}else if(H!==null)r.addReferenceForAsset(H.asset,Ne,{...we,select:!1});else if(K.length>0){const ie=un(K);ie.length>0&&r.addStoryboardFiles(ie,Ne,{...we,select:!1});const se=fn(K);se!==null&&r.reportError(se)}}},e[80]=c,e[81]=u,e[82]=r,e[83]=oe):oe=e[83];const ce=oe;Z=`shot-card${a?" is-selected":""}`,J=`shot-card-${m}`,y=m,j=b,k="option",x=a,S=`${be} ${h}, ${rt[b]}`,v=0,C=!d,e[84]!==m||e[85]!==t?(E=le=>{le.target===le.currentTarget&&(le.dataTransfer.setData(it,m),le.dataTransfer.effectAllowed="move",t.onDragMove?.(m))},e[84]=m,e[85]=t,e[86]=E):E=e[86],e[87]!==t?($=()=>t.onDragMove?.(null),e[87]=t,e[88]=$):$=e[88],e[89]!==m||e[90]!==t?(I=le=>t.onPress(m,le),e[89]=m,e[90]=t,e[91]=I):I=e[91],e[92]!==s||e[93]!==m||e[94]!==t?(w=le=>{le.target===le.currentTarget&&(le.key==="Enter"?t.onOpen(s):le.key===" "&&(le.preventDefault(),t.onPress(m,le)))},e[92]=s,e[93]=m,e[94]=t,e[95]=w):w=e[95],e[96]!==s||e[97]!==t?(T=le=>t.onMenu(s,le),e[96]=s,e[97]=t,e[98]=T):T=e[98],D=ye,F=Se,P=ce,e[99]!==l||e[100]!==s?(O=n.jsx(la,{doc:l,entry:s}),e[99]=l,e[100]=s,e[101]=O):O=e[101],e[102]!==d?(L=d?null:n.jsx("span",{className:"shot-card-grip","aria-hidden":"true",title:"Drag to move",children:Jl}),e[102]=d,e[103]=L):L=e[103];let Y;e[104]!==be?(Y=n.jsx("span",{className:"shot-card-number",children:be}),e[104]=be,e[105]=Y):Y=e[105];let re;e[106]!==h?(re=n.jsx("span",{className:"shot-card-name",children:h}),e[106]=h,e[107]=re):re=e[107];const N=`badge${Gl[b]}`,_=rt[b];let q;e[108]!==b||e[109]!==N||e[110]!==_?(q=n.jsx("span",{className:N,"data-status":b,"data-testid":"shot-status",children:_}),e[108]=b,e[109]=N,e[110]=_,e[111]=q):q=e[111];let ne;e[112]!==Y||e[113]!==re||e[114]!==q?(ne=n.jsxs("div",{className:"shot-card-title",children:[Y,re,q]}),e[112]=Y,e[113]=re,e[114]=q,e[115]=ne):ne=e[115];let de;e[116]!==pe||e[117]!==c?.voice?(de=pe===void 0?null:n.jsx("p",{className:c?.voice!==void 0?"shot-card-voice":"shot-card-notes",title:pe,children:pe}),e[116]=pe,e[117]=c?.voice,e[118]=de):de=e[118],e[119]!==ne||e[120]!==de?(M=n.jsxs("div",{className:"shot-card-body",children:[ne,de]}),e[119]=ne,e[120]=de,e[121]=M):M=e[121],z="shot-card-foot",ee="shot-card-counts",fe=Zl(c?.sketches?.length??0,je),e[43]=i,e[44]=l,e[45]=s,e[46]=m,e[47]=h,e[48]=c,e[49]=t,e[50]=d,e[51]=a,e[52]=u,e[53]=b,e[54]=r,e[55]=y,e[56]=j,e[57]=k,e[58]=x,e[59]=S,e[60]=v,e[61]=C,e[62]=E,e[63]=$,e[64]=I,e[65]=w,e[66]=T,e[67]=D,e[68]=F,e[69]=P,e[70]=O,e[71]=L,e[72]=M,e[73]=ee,e[74]=fe,e[75]=z,e[76]=Z,e[77]=J}else y=e[55],j=e[56],k=e[57],x=e[58],S=e[59],v=e[60],C=e[61],E=e[62],$=e[63],I=e[64],w=e[65],T=e[66],D=e[67],F=e[68],P=e[69],O=e[70],L=e[71],M=e[72],ee=e[73],fe=e[74],z=e[75],Z=e[76],J=e[77];e[122]!==ee||e[123]!==fe?(V=n.jsx("span",{className:ee,children:fe}),e[122]=ee,e[123]=fe,e[124]=V):V=e[124],e[125]!==c||e[126]!==a?(W=c===null||!a?null:n.jsx(dn,{target:{partId:c.id}}),e[125]=c,e[126]=a,e[127]=W):W=e[127],U="shot-card-length",A=Ae(Be(te,l.fps)),e[5]=i,e[6]=l,e[7]=s,e[8]=m,e[9]=h,e[10]=c,e[11]=t,e[12]=d,e[13]=a,e[14]=u,e[15]=b,e[16]=r,e[17]=g,e[18]=y,e[19]=j,e[20]=k,e[21]=x,e[22]=S,e[23]=v,e[24]=C,e[25]=E,e[26]=$,e[27]=I,e[28]=w,e[29]=T,e[30]=D,e[31]=F,e[32]=P,e[33]=O,e[34]=L,e[35]=M,e[36]=U,e[37]=A,e[38]=z,e[39]=V,e[40]=W,e[41]=Z,e[42]=J}else y=e[18],j=e[19],k=e[20],x=e[21],S=e[22],v=e[23],C=e[24],E=e[25],$=e[26],I=e[27],w=e[28],T=e[29],D=e[30],F=e[31],P=e[32],O=e[33],L=e[34],M=e[35],U=e[36],A=e[37],z=e[38],V=e[39],W=e[40],Z=e[41],J=e[42];let Q;e[128]!==U||e[129]!==A?(Q=n.jsx("span",{className:U,children:A}),e[128]=U,e[129]=A,e[130]=Q):Q=e[130];let G;e[131]!==Q||e[132]!==z||e[133]!==V||e[134]!==W?(G=n.jsxs("footer",{className:z,children:[V,W,Q]}),e[131]=Q,e[132]=z,e[133]=V,e[134]=W,e[135]=G):G=e[135];let ae;return e[136]!==y||e[137]!==j||e[138]!==k||e[139]!==x||e[140]!==S||e[141]!==v||e[142]!==C||e[143]!==E||e[144]!==$||e[145]!==I||e[146]!==w||e[147]!==T||e[148]!==D||e[149]!==F||e[150]!==P||e[151]!==O||e[152]!==L||e[153]!==M||e[154]!==G||e[155]!==Z||e[156]!==J?(ae=n.jsxs("article",{className:Z,"data-testid":J,"data-comment-target":y,"data-status":j,role:k,"aria-selected":x,"aria-label":S,tabIndex:v,draggable:C,onDragStart:E,onDragEnd:$,onClick:I,onKeyDown:w,onContextMenu:T,onDragOver:D,onDragLeave:F,onDrop:P,children:[O,L,M,G]}),e[136]=y,e[137]=j,e[138]=k,e[139]=x,e[140]=S,e[141]=v,e[142]=C,e[143]=E,e[144]=$,e[145]=I,e[146]=w,e[147]=T,e[148]=D,e[149]=F,e[150]=P,e[151]=O,e[152]=L,e[153]=M,e[154]=G,e[155]=Z,e[156]=J,e[157]=ae):ae=e[157],ae}function ea(t){t.currentTarget.contains(t.relatedTarget)||t.currentTarget.classList.remove("is-drop")}function ta(t){const e=Array.from(t.dataTransfer.types??[]);e.some(sa)&&(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=e.includes("Files")?"copy":"move",t.currentTarget.classList.add("is-drop"))}function sa(t){return Yl.includes(t)}function na(t){return t.readOnly}function la(t){const e=X.c(34),{doc:l,entry:s}=t,i=s.kind==="shot"?s.shot.part:s.part,a=s.kind==="shot"?s.shot:null;let r;e[0]!==i?.sketches?(r=i?.sketches??[],e[0]=i?.sketches,e[1]=r):r=e[1];const o=r,[d,c]=R.useState(0),u=a!==null&&i?.built!==void 0,f=a===null?null:u?i.built.frame:o.length>0?null:a.stills[0]?.frame??null,m=hn(a?.sceneId??"",f??0),h=o[Math.min(d,o.length-1)];let p;e[2]!==f||e[3]!==a||e[4]!==h?(p=a!==null&&f!==null||h===void 0?[]:[h.id],e[2]=f,e[3]=a,e[4]=h,e[5]=p):p=e[5];const b=js(i?.id??"",p);if(a!==null&&f!==null){const v=u?"built":"frame",C=m?.status??"pending";let E;e[6]!==m?(E=m?.url===void 0?null:n.jsx("img",{src:m.url,alt:"",draggable:!1}),e[6]=m,e[7]=E):E=e[7];let $;e[8]!==u?($=u?n.jsxs("span",{className:"shot-card-built",children:[mn,"Built"]}):null,e[8]=u,e[9]=$):$=e[9];let I;return e[10]!==v||e[11]!==C||e[12]!==E||e[13]!==$?(I=n.jsxs("div",{className:"shot-card-picture","data-picture":v,"data-status":C,children:[E,$]}),e[10]=v,e[11]=C,e[12]=E,e[13]=$,e[14]=I):I=e[14],I}if(h===void 0){let v;return e[15]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("div",{className:"shot-card-picture is-paper","data-picture":"empty",children:n.jsx("span",{className:"shot-card-sketch-empty",children:"No sketch yet"})}),e[15]=v):v=e[15],v}let g;e[16]===Symbol.for("react.memo_cache_sentinel")?(g=()=>c(0),e[16]=g):g=e[16];let y;e[17]!==h.id||e[18]!==b?(y=b.get(h.id)??null,e[17]=h.id,e[18]=b,e[19]=y):y=e[19];let j;e[20]!==l||e[21]!==h||e[22]!==y?(j=n.jsx(Ss,{doc:l,sketch:h,width:ql,picture:y}),e[20]=l,e[21]=h,e[22]=y,e[23]=j):j=e[23];let k;if(e[24]!==h||e[25]!==o){let v;e[27]!==h?(v=(C,E)=>n.jsx("span",{className:`shot-card-dot${C===h?" is-shown":""}`,title:C.label??`Sketch ${E+1}`,onPointerEnter:()=>c(E)},C.id),e[27]=h,e[28]=v):v=e[28],k=o.map(v),e[24]=h,e[25]=o,e[26]=k}else k=e[26];let x;e[29]!==k?(x=n.jsx("span",{className:"shot-card-dots",children:k}),e[29]=k,e[30]=x):x=e[30];let S;return e[31]!==j||e[32]!==x?(S=n.jsxs("div",{className:"shot-card-picture is-paper","data-picture":"sketch",onPointerLeave:g,children:[j,x]}),e[31]=j,e[32]=x,e[33]=S):S=e[33],S}const aa=[ft,At,"Files","text/uri-list","text/plain"],dt=t=>`/studio/assets/${encodeURIComponent(t)}`,rs=t=>String(t+1).padStart(2,"0");function ia(t){const e=X.c(3),[l,s]=R.useState(null);let i,a;return e[0]!==t?(i=()=>{if(t===null||typeof ResizeObserver>"u")return;const r=()=>{const d=t.querySelector(".shot-cell")?.offsetWidth??0;s(d>0?Math.max(1,Math.floor(t.clientWidth/d)):null)},o=new ResizeObserver(r);return o.observe(t),r(),()=>o.disconnect()},a=[t],e[0]=t,e[1]=i,e[2]=a):(i=e[1],a=e[2]),R.useEffect(i,a),l}function oa({rootRef:t}){const e=ue(),l=B(N=>N.doc),s=B(N=>N.storyboardSelection),i=B(N=>N.boardBuilding),a=B(N=>N.canComment),r=B(N=>N.libraryLoaded),o=B(N=>N.libraryCatalogLoaded),d=Pt(),{toast:c,node:u}=pn(),f=R.useRef(null),[m,h]=R.useState(!1),[p,b]=R.useState(!1),[g,y]=R.useState(null),[j,k]=R.useState(null),[x,S]=R.useState(null),[v,C]=R.useState(null),[E,$]=R.useState(null),I=ia(E),w=R.useMemo(()=>l===null?[]:Ft(l),[l]),T=R.useMemo(()=>l===null?[]:Je(l),[l]),D=w.some(N=>N.type==="component"||N.type==="library");R.useEffect(()=>{D&&(r||e.refreshLibrary(),o||e.refreshLibraryCatalog())},[D,r,o,e]);const F=R.useCallback(()=>{k(null),S(null)},[]);if(l===null)return null;const P=N=>{const _=Array.from(N.dataTransfer.types??[]);_.some(q=>aa.includes(q))&&(N.preventDefault(),N.dataTransfer.dropEffect=_.includes(ft)&&!_.includes("Files")?"move":"copy",b(!0))},O=N=>{b(!1);const _=N.dataTransfer,q=()=>N.preventDefault(),ne=Rt(_);if(ne!==null){if(q(),ne.kind==="reference"){const we=e.getState().storyboardSelection;e.attachStoryboardItems(we.includes(ne.id)?we.filter(et):[ne.id],null)}return}const de=Mt(_);if(de!==null){q(),e.addReferenceForAsset(de.asset,null,{select:!1});return}const le=Array.from(_.files??[]);if(le.length>0){q(),e.openBoardDrop(le);return}const ge=yn(_);if(ge!==null){q(),e.addLinkReference(ge,null,{select:!1});return}const Ne=Array.from(_.types??[]).includes("text/plain")?_.getData("text/plain").trim():"";Ne!==""&&(q(),e.addStoryboardNote(null,{select:!1,text:Ne}))},L=N=>{if(j===null||!Array.from(N.dataTransfer.types??[]).includes(it))return;N.preventDefault(),N.dataTransfer.dropEffect="move";const _=N.target instanceof Element?N.target.closest("[data-slot]"):null;if(_===null)return;const q=Number(_.dataset.slot),ne=_.querySelector(".shot-card")?.getBoundingClientRect();S(ne===void 0||N.clientX<=ne.left+ne.width/2?q:q+1)},M=N=>{const _=Array.from(N.dataTransfer.types??[]).includes(it)?N.dataTransfer.getData(it):"",q=x;F(),!(_===""||q===null)&&(N.preventDefault(),e.edit(ne=>Fl(ne,Je(ne),_,q)))},U=N=>{const _=N.getBoundingClientRect();d.open({x:_.left,y:_.bottom+6},Nt(e.getState(),[{kind:"action",id:"board-upload",label:"Upload",icon:De,onSelect:()=>f.current?.click()},{kind:"action",id:"board-note",label:"Note",icon:gn,onSelect:()=>void e.addStoryboardNote(null)},{kind:"action",id:"board-link",label:"Link",icon:xn,onSelect:()=>h(!0)},{kind:"action",id:"board-library",label:"From Library",icon:kn,onSelect:()=>e.setLibraryBrowserOpen(!0)},{kind:"separator"},{kind:"action",id:"board-assets",label:"Project assets",icon:jn.project,onSelect:()=>e.setBoardAssetsOpen(!0)}]))},A=w.map(N=>N.id),z=T.map(Me),V=N=>(_,q)=>{const ne=_l(e.getState().storyboardSelection,N,g,_,q);e.setStoryboardSelection(ne.selection),y(ne.anchor)},W=N=>{N.kind==="placeholder"?e.openShotBoard(N.part.id):e.openShotBoard(N.shot.part?.id??N.shot.sceneId)},Z=R.useRef(null),J=(N,_)=>{(_.detail??0)>=2&&Z.current!==null||(Z.current=N,V(z)(N,_))},Q=N=>{const _=N.target instanceof Element?N.target.closest(".shot-card")?.getAttribute("data-comment-target"):null,q=Z.current??_??null;Z.current=null;const ne=T.find(de=>Me(de)===q);ne!==void 0&&W(ne)},G=N=>{N.kind==="placeholder"?e.openPlannedShot(N.part.id):N.shot.part!==null?e.openPlannedShot(N.shot.part.id):e.openStoryboardShot(N.shot.sceneId)},ae=N=>a?[{kind:"action",id:"board-comment",label:"Comment",onSelect:()=>e.commentOnCard(N)}]:[],te=(N,_,q)=>{N.preventDefault(),N.stopPropagation(),e.getState().storyboardSelection.includes(_)||e.setStoryboardSelection([_]),d.open({x:N.clientX,y:N.clientY},Nt(e.getState(),q))},ee=(N,_)=>{const q=Me(N);te(_,q,[{kind:"action",id:"board-open-board",label:"Open",onSelect:()=>W(N)},{kind:"action",id:"board-open-shot",label:"Open in Studio",onSelect:()=>G(N)},...Jt(q)?ae({partId:q}):[],...Jt(q)?[{kind:"action",id:"board-delete-shot",label:"Delete",danger:!0,onSelect:()=>e.deleteStoryboardItems([q])}]:[]])},fe=(N,_)=>{te(_,N.id,[...ae({referenceId:N.id}),{kind:"action",id:"board-delete-card",label:"Delete",danger:!0,onSelect:()=>{const q=e.getState().storyboardSelection.filter(et);e.deleteStoryboardItems(q.includes(N.id)?q:[N.id])}}])},je=()=>{const _=e.buildPlannedShots()[0];_!==void 0&&c({message:"Being built in Studio by Agent",action:{label:"Open in Studio",run:()=>e.openPlannedShot(_)}})},me=(l.storyboard?.parts??[]).some(N=>N.built===void 0&&!i.some(_=>_.part===N.id)),he=l.resources?.branding??[],be=he.filter(N=>N.type==="asset"&&N.fontFamily!==void 0),pe=he.filter(N=>N.type==="asset"&&N.fontFamily===void 0&&l.assets[N.asset]?.kind==="image"),ye=he.filter(N=>N.type==="color"),Se=he.filter(N=>N.type==="guidance"),oe=w.length+be.length+pe.length+(ye.length>0?1:0)+Se.length,ce=T.reduce((N,_)=>N+ks(l,_.kind==="shot"?_.shot.part:_.part,_.kind==="shot"?_.shot.scene:null),0),Y=(N,_=!1)=>n.jsx("span",{className:`shot-insert${_?" is-before":""}`,"data-testid":"shot-insert","aria-hidden":"true"},N),re=T.map((N,_)=>{const q=Me(N),ne=_===T.length-1,de=N.kind==="shot"?N.cut:null,le=!ne&&I!==null&&(_+1)%I===0;return n.jsxs("div",{className:"shot-cell","data-slot":_,children:[x===0&&_===0?Y("before",!0):null,n.jsx(Ql,{doc:l,entry:N,at:_,selected:s.includes(q),onPress:J,onOpen:W,onMenu:ee,onDragMove:ge=>ge===null?F():k(ge)}),n.jsxs("div",{className:`shot-gutter${x===_+1?" is-insert":""}`,children:[x===_+1?Y("after"):null,ne?null:de===null?n.jsx("span",{className:"shot-transition-chip",children:"Cut"}):n.jsx("button",{type:"button",className:`shot-transition-chip${s.includes(de.id)?" is-selected":""}`,"data-testid":`shot-transition-${de.id}`,onClick:ge=>{ge.stopPropagation(),e.setStoryboardSelection([de.id])},children:de.label}),le?n.jsx("span",{className:"shot-gutter-wrap",children:`into ${rs(_+1)}`}):null]})]},q)});return n.jsxs("div",{ref:t,className:`board-canvas${p?" is-drop":""}`,"data-testid":"board-canvas",tabIndex:-1,onDragOver:P,onDragLeave:N=>{N.currentTarget.contains(N.relatedTarget)||b(!1)},onDrop:O,onClickCapture:N=>{N.detail<2&&(Z.current=null)},onClick:N=>{!(N.target instanceof Element)||!N.currentTarget.contains(N.target)||N.detail>=2&&Z.current!==null||N.target.closest(".style-card, .shot-card, button, input")===null&&e.setStoryboardSelection([])},onDoubleClick:Q,children:[n.jsxs("header",{className:"panel-head board-bar",children:[n.jsx("h2",{className:"board-bar-title",children:"Storyboard"}),n.jsxs("span",{className:"board-bar-summary","data-testid":"board-shots-summary",children:[T.length===1?"1 shot":`${T.length} shots`," · ",Ae(Be(ce,l.fps))]}),n.jsx("span",{className:"board-bar-spacer"}),n.jsxs("button",{type:"button",className:"btn","data-testid":"board-add-shot",onClick:()=>e.addPlannedShot(),children:[De,"Shot"]}),vs()?n.jsx("button",{type:"button",className:"btn is-primary","data-testid":"board-build",disabled:!me,title:me?void 0:"Every planned shot is built or being built.",onClick:je,children:"Build planned shots"}):null]}),n.jsxs("div",{className:"board-desk",ref:C,children:[n.jsxs("section",{className:"style-wall","data-testid":"style-wall","aria-label":"Style",children:[n.jsxs("header",{className:"board-section-head",children:[n.jsx("h3",{className:"caps",children:"Style · whole reel"}),n.jsx("span",{className:"board-section-hint",children:"The agent uses these wherever they fit."}),n.jsx("span",{className:"board-bar-spacer"}),n.jsx("span",{className:"board-section-count","data-testid":"style-wall-count",children:oe===1?"1 item":`${oe} items`}),n.jsx("button",{type:"button",className:"btn is-icon is-ghost board-section-add","aria-label":"Add to Style","aria-haspopup":"menu","data-testid":"board-add",onClick:N=>U(N.currentTarget),children:De})]}),n.jsxs("div",{className:"style-wall-items",role:"listbox","aria-label":"Style cards","aria-multiselectable":!0,children:[w.map(N=>n.jsx(da,{doc:l,item:N,selected:s.includes(N.id),onPress:V(A),onMenu:fe},N.id)),pe.map(N=>n.jsx("div",{className:"style-card",title:N.guidance??N.label,"data-testid":"style-brand-image",children:n.jsx("img",{src:dt(l.assets[N.asset].path),alt:N.label,loading:"lazy",draggable:!1})},N.id)),be.map(N=>n.jsx(ra,{item:N,path:l.assets[N.asset]?.kind==="font"?l.assets[N.asset].path:null},N.id)),ye.length===0?null:n.jsxs("div",{className:"style-card is-palette","data-testid":"style-palette",children:[n.jsx("span",{className:"style-palette-swatches",children:ye.map(N=>n.jsx("span",{className:"style-palette-swatch",style:{background:N.value},title:`${N.label} ${N.value}`},N.id))}),n.jsxs("span",{className:"style-palette-name",children:["Palette · ",ye.length]})]}),Se.map(N=>n.jsxs("div",{className:"style-card is-note","data-testid":"style-guidance",children:[n.jsx("span",{className:"style-note-text",children:N.text}),n.jsxs("span",{className:"style-note-meta",children:["Guidance · ",N.label]})]},N.id)),m?n.jsx("input",{className:"style-drop is-link",type:"url",autoFocus:!0,placeholder:"https://","aria-label":"Link address","data-testid":"board-link-field",onKeyDown:N=>{if(N.stopPropagation(),N.key==="Escape"&&h(!1),N.key!=="Enter")return;const _=N.currentTarget.value.trim();_!==""&&e.addLinkReference(_,null,{select:!1})!==null&&h(!1)},onBlur:()=>h(!1)}):n.jsxs("button",{type:"button",className:`drop style-drop${p?" is-over":""}`,"data-testid":"board-drop-slot","aria-haspopup":"menu",onClick:N=>U(N.currentTarget),children:[De,p?"Release to add":"Drop, paste or link"]})]})]}),n.jsxs("section",{className:"board-shots","aria-label":"Shots",children:[n.jsxs("header",{className:"board-section-head",children:[n.jsx("h3",{className:"caps",children:"Shots"}),n.jsx("span",{className:"board-section-hint",children:"Double-click a shot to open its shot board."})]}),n.jsxs("div",{ref:$,className:`board-shots-row${j===null?"":" is-moving"}`,role:"listbox","aria-label":"Shot cards","aria-multiselectable":!0,onDragOver:L,onDrop:M,onDragLeave:N=>{N.currentTarget.contains(N.relatedTarget)||S(null)},children:[re,n.jsxs("button",{type:"button",className:"shot-add-slot","data-testid":"board-add-shot-slot","data-slot":T.length,onClick:()=>e.addPlannedShot(),children:[De,n.jsx("span",{className:"shot-add-slot-title",children:"Shot"}),n.jsx("span",{className:"shot-add-slot-hint",children:`Adds ${rs(T.length)} at the end. Drag to move it.`})]})]})]}),n.jsx(zs,{canvas:v})]}),n.jsx("input",{ref:f,type:"file",hidden:!0,multiple:!0,accept:bn,"data-testid":"board-upload-input",onChange:N=>{const _=Array.from(N.currentTarget.files??[]);N.currentTarget.value="",_.length>0&&e.openBoardDrop(_)}}),d.menu,u]})}const cs=t=>`dailies-brand-${t.replace(/[^a-z0-9]+/gi,"-")}`;function ra(t){const e=X.c(11),{item:l,path:s}=t;let i,a;e[0]!==s?(i=()=>{if(s===null||typeof FontFace>"u")return;const m=new FontFace(cs(s),`url(${JSON.stringify(dt(s))})`,{weight:"1 1000"});return document.fonts.add(m),m.load().catch(ca),()=>{document.fonts.delete(m)}},a=[s],e[0]=s,e[1]=i,e[2]=a):(i=e[1],a=e[2]),R.useEffect(i,a);const r=`"${l.fontFamily}", var(--font-sans)`,o=l.guidance??l.label,d=s===null?r:`"${cs(s)}", ${r}`;let c;e[3]!==d?(c=n.jsx("span",{className:"style-font-sample",style:{fontFamily:d},children:"Aa"}),e[3]=d,e[4]=c):c=e[4];let u;e[5]!==l.fontFamily?(u=n.jsx("span",{className:"style-font-name",children:l.fontFamily}),e[5]=l.fontFamily,e[6]=u):u=e[6];let f;return e[7]!==o||e[8]!==c||e[9]!==u?(f=n.jsxs("div",{className:"style-card is-font",title:o,"data-testid":"style-font",children:[c,u]}),e[7]=o,e[8]=c,e[9]=u,e[10]=f):f=e[10],f}function ca(){}function da(t){const e=X.c(41),{doc:l,item:s,selected:i}=t,a=ue(),r=B(ua),{threads:o}=Sn();let d,c;if(e[0]!==l||e[1]!==s.id||e[2]!==o){const T=vn(l,o,{referenceId:s.id});d=T.board+T.studio,c=Nn(T),e[0]=l,e[1]=s.id,e[2]=o,e[3]=d,e[4]=c}else d=e[3],c=e[4];const u=c,[f,m]=R.useState(!1),h=s.type==="asset"?l.assets[s.asset]?.kind==="video"?"video":"image":s.type==="note"||s.type==="component"||s.type==="link"?s.type:"other",p=`style-card${h==="note"||h==="component"||h==="link"?` is-${h}`:""}${i?" is-selected":""}`,b=`style-card-${s.id}`;let g;e[5]!==s.id?(g=T=>Ns(T.dataTransfer,{kind:"reference",id:s.id}),e[5]=s.id,e[6]=g):g=e[6];let y,j;e[7]!==s.id||e[8]!==t?(y=T=>t.onPress(s.id,T),j=T=>{T.target!==T.currentTarget||T.key!==" "||(T.preventDefault(),t.onPress(s.id,T))},e[7]=s.id,e[8]=t,e[9]=y,e[10]=j):(y=e[9],j=e[10]);let k;e[11]!==s||e[12]!==t?(k=T=>t.onMenu(s,T),e[11]=s,e[12]=t,e[13]=k):k=e[13];let x,S,v,C;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=()=>m(!0),v=()=>m(!1),C=()=>m(!0),x=()=>m(!1),e[14]=x,e[15]=S,e[16]=v,e[17]=C):(x=e[14],S=e[15],v=e[16],C=e[17]);const E=f||i;let $;e[18]!==l||e[19]!==s||e[20]!==E?($=n.jsx(fa,{doc:l,item:s,live:E}),e[18]=l,e[19]=s,e[20]=E,e[21]=$):$=e[21];let I;e[22]!==r||e[23]!==s.id||e[24]!==d||e[25]!==a||e[26]!==u?(I=r?n.jsx("button",{type:"button",className:`style-card-comment${d>0?" is-pin":""}`,"aria-label":d>0?`Comment on this card. ${u}`:"Comment on this card",title:d>0?`${u}. Comment (C)`:"Comment (C)","data-testid":"style-card-comment",onClick:T=>{T.stopPropagation(),a.commentOnCard({referenceId:s.id})},children:d>0?d:Cn}):d>0?n.jsx("span",{className:"style-card-comment is-pin","aria-label":u,title:u,children:d}):null,e[22]=r,e[23]=s.id,e[24]=d,e[25]=a,e[26]=u,e[27]=I):I=e[27];let w;return e[28]!==s.id||e[29]!==s.label||e[30]!==h||e[31]!==i||e[32]!==p||e[33]!==$||e[34]!==I||e[35]!==b||e[36]!==g||e[37]!==y||e[38]!==j||e[39]!==k?(w=n.jsxs("div",{className:p,"data-testid":b,"data-kind":h,"data-comment-target":s.id,role:"option","aria-selected":i,"aria-label":s.label,tabIndex:0,draggable:!0,onDragStart:g,onClick:y,onKeyDown:j,onContextMenu:k,onPointerEnter:S,onPointerLeave:v,onFocus:C,onBlur:x,children:[$,I]}),e[28]=s.id,e[29]=s.label,e[30]=h,e[31]=i,e[32]=p,e[33]=$,e[34]=I,e[35]=b,e[36]=g,e[37]=y,e[38]=j,e[39]=k,e[40]=w):w=e[40],w}function ua(t){return t.canComment}function fa(t){const e=X.c(30),{doc:l,item:s,live:i}=t;if(s.type==="note"){const r=s.text.trim()===""?"Empty note":s.text;let o;e[0]!==r?(o=n.jsx("span",{className:"style-note-text",children:r}),e[0]=r,e[1]=o):o=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("span",{className:"style-note-meta",children:"Note"}),e[2]=d):d=e[2];let c;return e[3]!==o?(c=n.jsxs(n.Fragment,{children:[o,d]}),e[3]=o,e[4]=c):c=e[4],c}if(s.type==="component"){let r;return e[5]!==l||e[6]!==s||e[7]!==i?(r=n.jsx(pa,{doc:l,item:s,live:i}),e[5]=l,e[6]=s,e[7]=i,e[8]=r):r=e[8],r}if(s.type==="asset"){const r=l.assets[s.asset];if(r?.kind==="video"){const o=s.frame===void 0?null:s.frame*l.fps.den/l.fps.num;let d;e[9]!==r.path?(d=dt(r.path),e[9]=r.path,e[10]=d):d=e[10];let c;return e[11]!==o||e[12]!==d?(c=n.jsx(_t,{className:"style-card-media",src:d,atSeconds:o}),e[11]=o,e[12]=d,e[13]=c):c=e[13],c}if(r?.kind==="image"){let o;e[14]!==r.path?(o=dt(r.path),e[14]=r.path,e[15]=o):o=e[15];let d;return e[16]!==o?(d=n.jsx("img",{className:"style-card-media",src:o,alt:"",loading:"lazy",draggable:!1}),e[16]=o,e[17]=d):d=e[17],d}}if(s.type==="link"){let r;e[18]!==s.url?(r=wn(s.url),e[18]=s.url,e[19]=r):r=e[19];let o;e[20]!==r?(o=n.jsx("span",{className:"style-link-host",children:r}),e[20]=r,e[21]=o):o=e[21];const d=s.title??s.url;let c;e[22]!==d?(c=n.jsx("span",{className:"style-link-title",children:d}),e[22]=d,e[23]=c):c=e[23];let u;return e[24]!==o||e[25]!==c?(u=n.jsxs(n.Fragment,{children:[o,c]}),e[24]=o,e[25]=c,e[26]=u):u=e[26],u}let a;return e[27]!==l||e[28]!==s?(a=n.jsx($t,{doc:l,item:s}),e[27]=l,e[28]=s,e[29]=a):a=e[29],a}function $t(t){const e=X.c(11),{doc:l,item:s}=t,i=B(ma),a=B(ha);let r;e[0]!==i||e[1]!==s||e[2]!==a?(r=$n(s,i,a),e[0]=i,e[1]=s,e[2]=a,e[3]=r):r=e[3];const o=r,d=s.type==="asset"?l.assets[s.asset]:void 0;let c;return e[4]!==l.fps||e[5]!==s||e[6]!==d||e[7]!==o.libraryKind||e[8]!==o.libraryMissing||e[9]!==o.libraryThumb?(c=n.jsx(Cs,{item:s,asset:d,fps:l.fps,libraryThumb:o.libraryThumb,libraryKind:o.libraryKind,libraryMissing:o.libraryMissing}),e[4]=l.fps,e[5]=s,e[6]=d,e[7]=o.libraryKind,e[8]=o.libraryMissing,e[9]=o.libraryThumb,e[10]=c):c=e[10],c}function ha(t){return t.libraryCatalogLoaded}function ma(t){return t.libraryCatalog}function pa(t){const e=X.c(24),{doc:l,item:s,live:i}=t,a=ue(),r=s.component??null;let o;e[0]!==r?(o=S=>r===null?void 0:S.library.find(v=>v.id===r),e[0]=r,e[1]=o):o=e[1];const d=B(o);let c;e[2]!==r?(c=S=>r===null?void 0:S.contracts[r],e[2]=r,e[3]=c):c=e[3];const u=B(c);let f;e[4]!==r?(f=S=>r===null?void 0:S.libraryCatalog.find(v=>v.installedAs===r)?.lengthFrames,e[4]=r,e[5]=f):f=e[5];const m=B(f);let h,p;e[6]!==r||e[7]!==i||e[8]!==a?(h=()=>{i&&r!==null&&a.loadContract(r)},p=[i,r,a],e[6]=r,e[7]=i,e[8]=a,e[9]=h,e[10]=p):(h=e[9],p=e[10]),R.useEffect(h,p);const b=s.def===void 0?void 0:l.components?.[s.def],g=b!==void 0||d?.host==="three";let y;e[11]!==u||e[12]!==l||e[13]!==s||e[14]!==m||e[15]!==i||e[16]!==d?.contractAvailability||e[17]!==g?(y=n.jsx("div",{className:"style-component-preview",children:g?n.jsx(Hs,{doc:l,item:s,contract:u,availability:d?.contractAvailability,lengthFrames:m,live:i,fallback:n.jsx($t,{doc:l,item:s})}):n.jsx($t,{doc:l,item:s})}),e[11]=u,e[12]=l,e[13]=s,e[14]=m,e[15]=i,e[16]=d?.contractAvailability,e[17]=g,e[18]=y):y=e[18];const j=b?.name??s.label;let k;e[19]!==j?(k=n.jsx("span",{className:"style-component-foot",children:n.jsx("span",{className:"style-component-name",children:j})}),e[19]=j,e[20]=k):k=e[20];let x;return e[21]!==y||e[22]!==k?(x=n.jsxs(n.Fragment,{children:[y,k]}),e[21]=y,e[22]=k,e[23]=x):x=e[23],x}const jt="";function Ut(t){const e=X.c(27);let l;e[0]!==t.parts||e[1]!==t.value?(l=t.value!==null&&t.parts.some(m=>m.id===t.value),e[0]=t.parts,e[1]=t.value,e[2]=l):l=e[2];const s=l;let i;e[3]!==t.noneLabel?(i={value:jt,label:t.noneLabel},e[3]=t.noneLabel,e[4]=i):i=e[4];let a;if(e[5]!==s||e[6]!==t.parts||e[7]!==t.value||e[8]!==i){let m;e[10]!==s||e[11]!==t.value?(m=t.value!==null&&!s?[{value:t.value,label:`${t.value} (unknown)`}]:[],e[10]=s,e[11]=t.value,e[12]=m):m=e[12],a=[i,...t.parts.map(ba),...m],e[5]=s,e[6]=t.parts,e[7]=t.value,e[8]=i,e[9]=a}else a=e[9];const r=a,o=t.value??jt;let d;e[13]!==t?(d=m=>t.onChange(m===jt?null:m),e[13]=t,e[14]=d):d=e[14];let c;e[15]!==t.autoOpen?(c=t.autoOpen===void 0?{}:{autoOpen:t.autoOpen},e[15]=t.autoOpen,e[16]=c):c=e[16];let u;e[17]!==t.onClose?(u=t.onClose===void 0?{}:{onClose:t.onClose},e[17]=t.onClose,e[18]=u):u=e[18];let f;return e[19]!==r||e[20]!==t.ariaLabel||e[21]!==t.noneLabel||e[22]!==o||e[23]!==d||e[24]!==c||e[25]!==u?(f=n.jsx(lt,{options:r,value:o,ariaLabel:t.ariaLabel,placeholder:t.noneLabel,onChange:d,...c,...u}),e[19]=r,e[20]=t.ariaLabel,e[21]=t.noneLabel,e[22]=o,e[23]=d,e[24]=c,e[25]=u,e[26]=f):f=e[26],f}function ba(t){return{value:t.id,label:t.label}}const St=10;function ya(){const t=ue(),e=B(x=>x.boardDrop),l=B(x=>x.doc),[s,i]=R.useState("style"),[a,r]=R.useState(null),[o,d]=R.useState(""),c=e?.files??null;R.useEffect(()=>{if(c===null)return;const x=t.getState().doc?.storyboard?.parts??[],S=t.getState().storyboardSelection.find(v=>x.some(C=>C.id===v));i("style"),d(""),r(S??x[0]?.id??null)},[c,t]);const u=R.useMemo(()=>(c??[]).slice(0,St).map(x=>({name:x.name,url:x.type.startsWith("image/")?URL.createObjectURL(x):null})),[c]);if(R.useEffect(()=>()=>{for(const x of u)x.url!==null&&URL.revokeObjectURL(x.url)},[u]),e===null||l===null)return null;const f=l.storyboard?.parts??[],m=e.files.length,p=e.files.every(x=>x.type.startsWith("image/"))?m===1?"image":"images":m===1?"file":"files",b=a!==null&&f.some(x=>x.id===a)?a:null,g=b===null?null:In(l,b),y=s==="style"?"Add to Style":s==="keep"?"Keep in Assets":`Pin to ${g??"a shot"}`,j=()=>{t.commitBoardDrop(s==="shot"?{scope:s,partId:b??"",note:o}:{scope:s,note:o})},k=(x,S,v)=>n.jsxs("button",{type:"button",className:`board-drop-scope${s===x?" is-selected":""}`,"data-testid":`board-drop-scope-${x}`,"aria-pressed":s===x,disabled:x==="shot"&&f.length===0,title:x==="shot"&&f.length===0?"Add a shot first":void 0,onClick:()=>i(x),children:[n.jsx("span",{className:"board-drop-scope-title",children:S}),n.jsx("span",{className:"board-drop-scope-desc",children:v})]});return n.jsxs(En,{open:!0,className:"board-drop",title:n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"board-drop-title","data-testid":"board-drop-title",children:[m," ",p," dropped"]}),n.jsx("span",{className:"board-drop-esc","aria-hidden":"true",children:"Esc"})]}),onClose:()=>t.closeBoardDrop(),actions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"btn board-drop-cancel","data-testid":"board-drop-cancel",onClick:()=>t.closeBoardDrop(),children:"Cancel"}),n.jsx("button",{type:"button",className:"btn is-primary","data-testid":"board-drop-commit",disabled:s==="shot"&&b===null,onClick:j,children:y})]}),children:[n.jsxs("div",{className:"board-drop-thumbs","data-testid":"board-drop-thumbs",children:[u.map((x,S)=>x.url===null?n.jsx("span",{className:"board-drop-thumb is-file",title:x.name,children:x.name},S):n.jsx("img",{className:"board-drop-thumb",src:x.url,alt:x.name},S)),m>St?n.jsxs("span",{className:"board-drop-thumb is-more",children:["+",m-St]}):null]}),n.jsxs("label",{className:"board-drop-field",children:[n.jsx("span",{className:"board-drop-label",children:"Why these?"}),n.jsx("textarea",{className:"board-drop-note","data-testid":"board-drop-note",rows:2,value:o,placeholder:"Say what to take from them.",onChange:x=>d(x.currentTarget.value),onKeyDown:x=>x.stopPropagation()})]}),n.jsxs("div",{className:"board-drop-field",children:[n.jsx("span",{className:"board-drop-label",children:"Where does it count?"}),n.jsxs("div",{className:"board-drop-scopes",children:[k("style","Style","Whole reel. The agent uses it where it fits."),k("shot","One shot",g===null?"Pin to one shot. Only that shot.":`Pin to ${g}. Only that shot.`),k("keep","Keep","Save to Assets. Not used yet.")]}),s==="shot"?n.jsx(Ut,{parts:f,value:b,noneLabel:"Pick a shot",ariaLabel:"Shot to pin to",onChange:r}):null]}),n.jsxs("p",{className:"board-drop-agent","data-testid":"board-drop-agent",children:[n.jsx("span",{className:"board-drop-agent-dot","aria-hidden":"true"}),Tn(m,o,s,g)]})]})}const ds="application/x-dailies-plan-beat",ga={planned:"",building:" is-building",built:" is-success"};function pt(t,e){const l=Je(t).findIndex(s=>(s.kind==="shot"?s.shot.part?.id:s.part.id)===e);return l<0?null:String(l+1).padStart(2,"0")}function xa(t,e){const l=/^\s*(\d+(?:\.\d+)?|\.\d+)\s*(s|f)?\s*$/i.exec(t);if(l===null)return null;const s=Number(l[1]),i=l[2]?.toLowerCase()==="f"?s:s*e;return Number.isFinite(i)&&i>0?i/e:null}function ka(t,e,l){const s=[...t],i=Math.max(0,Math.min(s.length-1,l));if(e<0||e>=s.length||i===e)return s;const[a]=s.splice(e,1);return s.splice(i,0,a),s}const us=(t,e)=>{const l=t.trim();return l===""?null:e===void 0?l:l.slice(0,e).trim()};function Us(t){const e=X.c(30),l=ue(),s=B(ja);let i;e[0]!==t.part.id?(i=y=>y.storyboardRenaming===t.part.id,e[0]=t.part.id,e[1]=i):i=e[1];const a=B(i),r=R.useRef(null),o=R.useRef(!1);let d,c;if(e[2]!==a?(d=()=>{a||!o.current||(o.current=!1,r.current?.focus())},c=[a],e[2]=a,e[3]=d,e[4]=c):(d=e[3],c=e[4]),R.useEffect(d,c),a&&!s){let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{o.current=!0},e[5]=y):y=e[5];let j;return e[6]!==t.part?(j=n.jsx(Sa,{part:t.part,onKeyClose:y},t.part.id),e[6]=t.part,e[7]=j):j=e[7],j}if(s){let y;e[8]!==t.testId?(y=t.testId===void 0?{}:{"data-testid":t.testId},e[8]=t.testId,e[9]=y):y=e[9];let j;return e[10]!==t.className||e[11]!==t.part.label||e[12]!==y?(j=n.jsx("span",{className:t.className,...y,title:t.part.label,children:t.part.label}),e[10]=t.className,e[11]=t.part.label,e[12]=y,e[13]=j):j=e[13],j}let u;e[14]!==t.part.id||e[15]!==l?(u=()=>l.beginStoryboardRename(t.part.id),e[14]=t.part.id,e[15]=l,e[16]=u):u=e[16];const f=u;let m;e[17]!==t.testId?(m=t.testId===void 0?{}:{"data-testid":t.testId},e[17]=t.testId,e[18]=m):m=e[18];const h=`${t.part.label}: double-click or F2 to rename`;let p,b;e[19]!==f?(p=y=>{y.detail===0&&f()},b=y=>{y.key!=="F2"&&y.key!=="Enter"||(y.preventDefault(),y.stopPropagation(),f())},e[19]=f,e[20]=p,e[21]=b):(p=e[20],b=e[21]);let g;return e[22]!==f||e[23]!==t.className||e[24]!==t.part.label||e[25]!==m||e[26]!==h||e[27]!==p||e[28]!==b?(g=n.jsx("button",{ref:r,type:"button",className:t.className,...m,title:h,onDoubleClick:f,onClick:p,onKeyDown:b,children:t.part.label}),e[22]=f,e[23]=t.className,e[24]=t.part.label,e[25]=m,e[26]=h,e[27]=p,e[28]=b,e[29]=g):g=e[29],g}function ja(t){return t.readOnly}function Sa(t){const e=X.c(16),{part:l,onKeyClose:s}=t,i=ue();let a;e[0]!==l.id||e[1]!==i?(a=()=>{i.getState().storyboardRenaming===l.id&&i.beginStoryboardRename(null)},e[0]=l.id,e[1]=i,e[2]=a):a=e[2];const r=a;let o;e[3]!==s?(o=f=>{(f.key==="Enter"||f.key==="Escape")&&s()},e[3]=s,e[4]=o):o=e[4];let d;e[5]!==l.id||e[6]!==l.label||e[7]!==i?(d=f=>{const m=f.trim();m!==""&&m!==l.label&&i.updateStoryboardPart(l.id,{label:m})},e[5]=l.id,e[6]=l.label,e[7]=i,e[8]=d):d=e[8];let c;e[9]!==l.label||e[10]!==d?(c=n.jsx(Ee,{autoFocus:!0,value:l.label,ariaLabel:"Shot name",onCommit:d}),e[9]=l.label,e[10]=d,e[11]=c):c=e[11];let u;return e[12]!==r||e[13]!==o||e[14]!==c?(u=n.jsx("span",{className:"plan-rename",onBlur:r,onKeyDownCapture:o,children:c}),e[12]=r,e[13]=o,e[14]=c,e[15]=u):u=e[15],u}function Vs(t){const e=X.c(67),l=ue(),s=B(Na),i=B(va),a=Ot(),r=t.variant??"shot";let o,d,c,u,f;if(e[0]!==s||e[1]!==t.partId||e[2]!==t.sketchId||e[3]!==l){u=Symbol.for("react.early_return_sentinel");e:{if(d=s?.storyboard?.parts.find(A=>A.id===t.partId),s===null||d===void 0){u=null;break e}f=A=>{l.edit(z=>ws(z,d.id,A))},o=pt(s,d.id),c=d.sketches?.find(A=>A.id===t.sketchId)??d.sketches?.[0]}e[0]=s,e[1]=t.partId,e[2]=t.sketchId,e[3]=l,e[4]=o,e[5]=d,e[6]=c,e[7]=u,e[8]=f}else o=e[4],d=e[5],c=e[6],u=e[7],f=e[8];if(u!==Symbol.for("react.early_return_sentinel"))return u;const m=c;let h;e[9]!==t.footer||e[10]!==r?(h=t.footer!==void 0?n.jsx("footer",{className:"panel-foot",children:t.footer}):r==="shot"?n.jsxs("footer",{className:"panel-foot is-note",children:[Bt,"The agent reads the plan and sketches."]}):null,e[9]=t.footer,e[10]=r,e[11]=h):h=e[11];const p=h;let b;e[12]!==a||e[13]!==o||e[14]!==d||e[15]!==r?(b=r==="shot"?n.jsxs("header",{className:"panel-head plan-head",children:[n.jsx("h3",{className:"caps",children:"Plan"}),o===null?null:n.jsx("span",{className:"plan-head-shot",children:`Shot ${o}`})]}):n.jsxs("header",{className:"panel-head plan-head",children:[o===null?null:n.jsx("span",{className:"plan-head-number",children:o}),n.jsx("h3",{className:"plan-head-title",children:n.jsx(Us,{part:d,className:"plan-head-name"})}),n.jsx(Ca,{status:Dt(d,a)})]}),e[12]=a,e[13]=o,e[14]=d,e[15]=r,e[16]=b):b=e[16];const g=d.id;let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("h4",{className:"caps",children:"What we see"}),e[17]=y):y=e[17];const j=d.notes??"";let k;e[18]!==f?(k=A=>f({notes:us(A)}),e[18]=f,e[19]=k):k=e[19];let x;e[20]!==j||e[21]!==k?(x=n.jsxs("div",{className:"plan-field",children:[y,n.jsx(Ee,{multiline:!0,value:j,placeholder:"What the viewer sees in this shot",ariaLabel:"What we see",onCommit:k})]}),e[20]=j,e[21]=k,e[22]=x):x=e[22];let S;e[23]!==f?(S=A=>f({motion:A}),e[23]=f,e[24]=S):S=e[24];let v;e[25]!==d||e[26]!==S?(v=n.jsx(wa,{part:d,onWrite:S}),e[25]=d,e[26]=S,e[27]=v):v=e[27];let C;e[28]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("h4",{className:"caps",children:"Voice"}),e[28]=C):C=e[28];const E=d.voice??"";let $;e[29]!==f?($=A=>f({voice:us(A,Hn)}),e[29]=f,e[30]=$):$=e[30];let I;e[31]!==E||e[32]!==$?(I=n.jsxs("div",{className:"plan-field",children:[C,n.jsx(Ee,{value:E,placeholder:"The line we hear",ariaLabel:"Voice",onCommit:$})]}),e[31]=E,e[32]=$,e[33]=I):I=e[33];let w;e[34]!==f?(w=A=>f({durationFrames:A}),e[34]=f,e[35]=w):w=e[35];let T;e[36]!==s||e[37]!==d||e[38]!==w?(T=n.jsx(Ia,{doc:s,part:d,onLength:w}),e[36]=s,e[37]=d,e[38]=w,e[39]=T):T=e[39];let D;e[40]!==s||e[41]!==m?(D=m===void 0?null:n.jsx(Ta,{doc:s,sketch:m}),e[40]=s,e[41]=m,e[42]=D):D=e[42];let F;e[43]!==s||e[44]!==d||e[45]!==m?(F=n.jsx(Oa,{doc:s,part:d,sketch:m}),e[43]=s,e[44]=d,e[45]=m,e[46]=F):F=e[46];let P;e[47]!==s?(P=Ft(s),e[47]=s,e[48]=P):P=e[48];let O;e[49]!==P.length?(O=n.jsx(Aa,{count:P.length}),e[49]=P.length,e[50]=O):O=e[50];let L;e[51]!==d.id||e[52]!==v||e[53]!==I||e[54]!==T||e[55]!==D||e[56]!==F||e[57]!==O||e[58]!==x?(L=n.jsxs("div",{className:"plan-body",children:[x,v,I,T,D,F,O]},g),e[51]=d.id,e[52]=v,e[53]=I,e[54]=T,e[55]=D,e[56]=F,e[57]=O,e[58]=x,e[59]=L):L=e[59];let M;e[60]!==i||e[61]!==L?(M=n.jsx(Ht,{value:i,children:L}),e[60]=i,e[61]=L,e[62]=M):M=e[62];let U;return e[63]!==p||e[64]!==M||e[65]!==b?(U=n.jsxs("section",{className:"plan-panel","data-testid":"plan-panel","aria-label":"Plan",children:[b,M,p]}),e[63]=p,e[64]=M,e[65]=b,e[66]=U):U=e[66],U}function va(t){return t.readOnly}function Na(t){return t.doc}function Ca(t){const e=X.c(3),{status:l}=t,s=`badge${ga[l]}`,i=rt[l];let a;return e[0]!==s||e[1]!==i?(a=n.jsx("span",{className:s,"data-testid":"plan-status",children:i}),e[0]=s,e[1]=i,e[2]=a):a=e[2],a}function wa(t){const e=X.c(30);let l;e[0]!==t.part.motion?(l=t.part.motion??[],e[0]=t.part.motion,e[1]=l):l=e[1];const s=l,i=B($a),a=Fe(),[r,o]=R.useState(!1),d=R.useRef(null),c=R.useRef(null),u=R.useRef(null),f=s.length>=Qt;let m;e[2]!==t?(m=O=>t.onWrite(O.length===0?null:O),e[2]=t,e[3]=m):m=e[3];const h=m;let p;e[4]!==s||e[5]!==h?(p=(O,L)=>{const M=L.trim();M!==s[O]?.text&&h(M===""?s.filter((U,A)=>A!==O):s.map((U,A)=>A===O?{...U,text:M}:U))},e[4]=s,e[5]=h,e[6]=p):p=e[6];const b=p;let g;e[7]!==s||e[8]!==h?(g=(O,L)=>{L<0||L>=s.length||L===O||h(ka(s,O,L))},e[7]=s,e[8]=h,e[9]=g):g=e[9];const y=g,j=O=>L=>{if(!L.altKey||i||L.key!=="ArrowUp"&&L.key!=="ArrowDown")return;L.preventDefault();const M=O+(L.key==="ArrowUp"?-1:1);M<0||M>=s.length||(c.current=M,y(O,M))};let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{const O=c.current;O!==null&&(c.current=null,u.current?.querySelector(`[aria-label="Beat ${O+1}"]`)?.focus())},e[10]=k):k=e[10],R.useEffect(k);const x=O=>L=>{const M=d.current;d.current=null,!(M===null||!L.dataTransfer.types.includes(ds))&&(L.preventDefault(),y(M,O))},S="plan-field";let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("h4",{className:"caps",children:"How it moves"}),e[11]=v):v=e[11];const C=s.length===1?"1 beat":`${s.length} beats`;let E;e[12]!==C?(E=n.jsxs("div",{className:"plan-field-head",children:[v,n.jsx("span",{className:"plan-count",children:C})]}),e[12]=C,e[13]=E):E=e[13];const $="plan-beats",I="How it moves",w=s.map((O,L)=>n.jsxs("li",{className:"plan-beat","data-testid":"plan-beat",draggable:!i,title:"Drag, or Alt+arrow, to reorder",onDragStart:M=>{d.current=L,M.dataTransfer.setData(ds,String(L)),M.dataTransfer.effectAllowed="move"},onDragOver:M=>{d.current!==null&&(M.preventDefault(),M.dataTransfer.dropEffect="move")},onDrop:x(L),onDragEnd:()=>{d.current=null},onKeyDown:j(L),children:[n.jsx("span",{className:"plan-beat-number",children:L+1}),n.jsx(es,{trailing:n.jsx("button",{type:"button",className:"insp-key is-danger","aria-label":`Remove beat ${L+1}`,title:"Remove beat",disabled:a,onClick:()=>h(s.filter((M,U)=>U!==L)),children:n.jsx(Ln,{})}),children:n.jsx(Ee,{value:O.text,ariaLabel:`Beat ${L+1}`,onCommit:M=>b(L,M)})})]},`${L}:${O.text}`));let T;e[14]!==r||e[15]!==s||e[16]!==f||e[17]!==h?(T=r?n.jsxs("li",{className:"plan-beat is-draft",onBlur:()=>o(!1),children:[n.jsx("span",{className:"plan-beat-number",children:s.length+1}),n.jsx(es,{children:n.jsx(Ee,{value:"",autoFocus:!0,placeholder:"What moves next",ariaLabel:`Beat ${s.length+1}`,onCommit:O=>{const L=O.trim();L!==""&&!f&&h([...s,{text:L}])}})})]}):null,e[14]=r,e[15]=s,e[16]=f,e[17]=h,e[18]=T):T=e[18];let D;e[19]!==w||e[20]!==T?(D=n.jsxs("ol",{ref:u,className:$,"aria-label":I,children:[w,T]}),e[19]=w,e[20]=T,e[21]=D):D=e[21];let F;e[22]!==r||e[23]!==f||e[24]!==a?(F=r?null:n.jsxs("button",{type:"button",className:"plan-add-beat","data-testid":"plan-add-beat",disabled:a||f,title:f?`A shot holds at most ${Qt} beats`:void 0,onClick:()=>o(!0),children:[n.jsx("span",{className:"plan-add-beat-icon","aria-hidden":"true",children:De}),"Add beat"]}),e[22]=r,e[23]=f,e[24]=a,e[25]=F):F=e[25];let P;return e[26]!==D||e[27]!==F||e[28]!==E?(P=n.jsxs("div",{className:S,children:[E,D,F]}),e[26]=D,e[27]=F,e[28]=E,e[29]=P):P=e[29],P}function $a(t){return t.readOnly}function Ia(t){const e=X.c(55),{doc:l,part:s}=t,[i,a]=R.useState(!1),r=R.useId(),o=l.fps.num/l.fps.den;let d;e[0]!==l.fps||e[1]!==s.durationFrames?(d=Be(s.durationFrames,l.fps),e[0]=l.fps,e[1]=s.durationFrames,e[2]=d):d=e[2];const c=d,u=s.scene!==void 0&&l.scenes.includes(s.scene)?s.scene:null;let f,m;if(e[3]!==l||e[4]!==u){const V=u===null?void 0:Pn(l).find(W=>W.sceneId===u);f=V===void 0?"Cut":On(l,V),m=/^(.*?)\s(\d+\.\d{2}s)$/.exec(f),e[3]=l,e[4]=u,e[5]=f,e[6]=m}else f=e[5],m=e[6];const h=m;let p;e[7]!==o?(p=V=>Math.max(1,Math.round(V*o)),e[7]=o,e[8]=p):p=e[8];const b=p;let g;e[9]!==b||e[10]!==s.id?(g=(V,W)=>typeof W=="number"&&Number.isFinite(W)?ws(V,s.id,{durationFrames:b(W)}):V,e[9]=b,e[10]=s.id,e[11]=g):g=e[11];const y=Qe(g);let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx("h4",{className:"caps",children:"Length"}),e[12]=j):j=e[12];const k=1/o,x=1/o;let S;e[13]!==o?(S=V=>xa(V,o),e[13]=o,e[14]=S):S=e[14];let v;e[15]!==b||e[16]!==t?(v=V=>t.onLength(b(V)),e[15]=b,e[16]=t,e[17]=v):v=e[17];let C;e[18]!==y.end||e[19]!==y.move||e[20]!==y.start||e[21]!==c||e[22]!==k||e[23]!==x||e[24]!==S||e[25]!==v?(C=n.jsxs("div",{className:"plan-field plan-length",children:[j,n.jsx(Ue,{value:c,min:k,step:x,format:Ae,parse:S,ariaLabel:"Length",onCommit:v,onScrubStart:y.start,onScrub:y.move,onScrubEnd:y.end})]}),e[18]=y.end,e[19]=y.move,e[20]=y.start,e[21]=c,e[22]=k,e[23]=x,e[24]=S,e[25]=v,e[26]=C):C=e[26];let E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx("h4",{className:"caps",children:"Cut to next"}),e[27]=E):E=e[27];const $=`Cut to next: ${f}`;let I;e[28]!==i||e[29]!==r||e[30]!==u?(I=u===null?{}:{"aria-expanded":i,"aria-controls":r},e[28]=i,e[29]=r,e[30]=u,e[31]=I):I=e[31];const w=u===null,T=u===null?"Set once this shot has a Shot in Studio":"Edit the cut into the next shot";let D;e[32]===Symbol.for("react.memo_cache_sentinel")?(D=()=>a(Ea),e[32]=D):D=e[32];const F=h?.[1]??f;let P;e[33]!==F?(P=n.jsx("span",{className:"combobox-value",children:F}),e[33]=F,e[34]=P):P=e[34];let O;e[35]!==h?(O=h===null?null:n.jsx("span",{className:"plan-cut-length",children:h[2]}),e[35]=h,e[36]=O):O=e[36];let L;e[37]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(An,{className:"combobox-caret field-caret"}),e[37]=L):L=e[37];let M;e[38]!==$||e[39]!==I||e[40]!==w||e[41]!==T||e[42]!==P||e[43]!==O?(M=n.jsxs("div",{className:"plan-field plan-cut",children:[E,n.jsxs("button",{type:"button",className:"select combobox-trigger plan-cut-select","data-testid":"plan-cut","aria-label":$,...I,disabled:w,title:T,onClick:D,children:[P,O,L]})]}),e[38]=$,e[39]=I,e[40]=w,e[41]=T,e[42]=P,e[43]=O,e[44]=M):M=e[44];let U;e[45]!==M||e[46]!==C?(U=n.jsxs("div",{className:"plan-timing",children:[C,M]}),e[45]=M,e[46]=C,e[47]=U):U=e[47];let A;e[48]!==i||e[49]!==r||e[50]!==u?(A=i&&u!==null?n.jsx("div",{className:"plan-cut-rows",id:r,"data-testid":"plan-cut-rows",children:n.jsx(Fn,{sceneId:u,lengthLabel:"Length"})}):null,e[48]=i,e[49]=r,e[50]=u,e[51]=A):A=e[51];let z;return e[52]!==U||e[53]!==A?(z=n.jsxs(n.Fragment,{children:[U,A]}),e[52]=U,e[53]=A,e[54]=z):z=e[54],z}function Ea(t){return!t}function Ta(t){const e=X.c(34),l=ue(),{sketch:s}=t;let i,a,r,o,d,c,u,f,m;if(e[0]!==t.doc||e[1]!==s.ground){const j=Dn(t.doc),k=La;u="plan-field",e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("h4",{className:"caps",children:"Ground"}),e[11]=f):f=e[11],i=Le,d="Ground",c=s.ground??"paper",e[12]===Symbol.for("react.memo_cache_sentinel")?(r={value:"paper",label:n.jsxs(n.Fragment,{children:[k("paper"),"Paper"]})},e[12]=r):r=e[12],e[13]===Symbol.for("react.memo_cache_sentinel")?(o={value:"dark",label:n.jsxs(n.Fragment,{children:[k("dark"),"Dark"]})},e[13]=o):o=e[13],a="brand",m=n.jsxs(n.Fragment,{children:[k("brand",j??void 0),"Brand"]}),e[0]=t.doc,e[1]=s.ground,e[2]=i,e[3]=a,e[4]=r,e[5]=o,e[6]=d,e[7]=c,e[8]=u,e[9]=f,e[10]=m}else i=e[2],a=e[3],r=e[4],o=e[5],d=e[6],c=e[7],u=e[8],f=e[9],m=e[10];let h;e[14]!==a||e[15]!==m?(h={value:a,label:m},e[14]=a,e[15]=m,e[16]=h):h=e[16];let p;e[17]!==r||e[18]!==o||e[19]!==h?(p=[r,o,h],e[17]=r,e[18]=o,e[19]=h,e[20]=p):p=e[20];let b;e[21]!==s.id||e[22]!==l?(b=j=>l.edit(k=>_n(k,s.id,{ground:j==="dark"||j==="brand"?j:null})),e[21]=s.id,e[22]=l,e[23]=b):b=e[23];let g;e[24]!==i||e[25]!==b||e[26]!==d||e[27]!==c||e[28]!==p?(g=n.jsx(i,{ariaLabel:d,value:c,options:p,onChange:b}),e[24]=i,e[25]=b,e[26]=d,e[27]=c,e[28]=p,e[29]=g):g=e[29];let y;return e[30]!==g||e[31]!==u||e[32]!==f?(y=n.jsxs("div",{className:u,children:[f,g]}),e[30]=g,e[31]=u,e[32]=f,e[33]=y):y=e[33],y}function La(t,e){return n.jsx("span",{className:`plan-swatch is-${t}`,"aria-hidden":"true",style:e===void 0?void 0:{background:e}})}const Pa=(t,e)=>{const l=Bn(t,e);return l.charAt(0).toUpperCase()+l.slice(1)};function Oa(t){const e=X.c(15),{doc:l,part:s,sketch:i}=t,a=B(Ra);let r;e[0]!==l.resources?.references?(r=l.resources?.references??[],e[0]=l.resources?.references,e[1]=r):r=e[1];let o;if(e[2]!==l||e[3]!==s||e[4]!==a||e[5]!==i?.items||e[6]!==r){let d;e[8]!==s?(d=p=>p.part===s.id,e[8]=s,e[9]=d):d=e[9];const c=r.filter(d);let u;e[10]!==i?.items?(u=i?.items??[],e[10]=i?.items,e[11]=u):u=e[11];let f;e[12]!==u?(f=new Set(u.flatMap(Da)),e[12]=u,e[13]=f):f=e[13];const m=f;let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("h4",{className:"caps",children:"Pinned to this shot"}),e[14]=h):h=e[14],o=n.jsxs("div",{className:"plan-field",children:[n.jsxs("div",{className:"plan-field-head",children:[h,n.jsx("span",{className:"plan-count is-numeric",children:c.length})]}),c.length===0?n.jsx("p",{className:"plan-none",children:"Nothing pinned yet. Drop cards on this shot."}):n.jsx("ul",{className:"plan-pins","aria-label":"Pinned to this shot",children:c.map(p=>n.jsx(Ma,{doc:l,item:p,onSketch:m.has(p.id),readOnly:a},p.id))})]}),e[2]=l,e[3]=s,e[4]=a,e[5]=i?.items,e[6]=r,e[7]=o}else o=e[7];return o}function Da(t){return t.kind==="ref"?[t.ref]:[]}function Ra(t){return t.readOnly}function Ma(t){const e=X.c(34),{doc:l,item:s}=t,i=s.type==="asset"?l.assets[s.asset]:void 0,a=i?.kind==="image"?i:void 0;let r;e[0]!==a?(r=a===void 0?"":Ve(a.path),e[0]=a,e[1]=r):r=e[1];const o=ht(r,a?.hash??"",20);let d;e[2]!==s.label?(d=s.label.trim()||"Untitled card",e[2]=s.label,e[3]=d):d=e[3];const c=d,u=gs(s)==="must",f=`plan-pin-${s.id}`,m=!t.readOnly,h=t.readOnly?void 0:"Drag onto the sketch";let p;e[4]!==s.id?(p=C=>Ns(C.dataTransfer,{kind:"reference",id:s.id}),e[4]=s.id,e[5]=p):p=e[5];let b;e[6]!==a||e[7]!==s||e[8]!==o?(b=a===void 0?Rn(s):o===null?null:n.jsx("img",{src:o,alt:"",draggable:!1}),e[6]=a,e[7]=s,e[8]=o,e[9]=b):b=e[9];let g;e[10]!==b?(g=n.jsx("span",{className:"plan-pin-thumb","aria-hidden":"true",children:b}),e[10]=b,e[11]=g):g=e[11];let y;e[12]!==c?(y=n.jsx("span",{className:"plan-pin-name",children:c}),e[12]=c,e[13]=y):y=e[13];let j;e[14]!==t.onSketch?(j=t.onSketch?n.jsx("span",{className:"plan-pin-on","data-testid":"plan-pin-on-sketch",children:"on sketch"}):null,e[14]=t.onSketch,e[15]=j):j=e[15];let k;e[16]!==s||e[17]!==u?(k=Mn(s)?n.jsx("span",{className:`badge${u?" is-accent":""}`,children:u?"Must":"Optional"}):null,e[16]=s,e[17]=u,e[18]=k):k=e[18];let x;e[19]!==l.assets||e[20]!==s?(x=Pa(s,l.assets),e[19]=l.assets,e[20]=s,e[21]=x):x=e[21];let S;e[22]!==x?(S=n.jsx("span",{className:"plan-pin-kind",children:x}),e[22]=x,e[23]=S):S=e[23];let v;return e[24]!==k||e[25]!==S||e[26]!==f||e[27]!==m||e[28]!==h||e[29]!==p||e[30]!==g||e[31]!==y||e[32]!==j?(v=n.jsxs("li",{className:"plan-pin","data-testid":f,draggable:m,title:h,onDragStart:p,children:[g,y,j,k,S]}),e[24]=k,e[25]=S,e[26]=f,e[27]=m,e[28]=h,e[29]=p,e[30]=g,e[31]=y,e[32]=j,e[33]=v):v=e[33],v}function Aa(t){const e=X.c(3),{count:l}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("h4",{className:"caps",children:"Style"}),e[0]=s):s=e[0];const i=l===0?"No Style cards yet":`${l} ${l===1?"item applies":"items apply"} to every shot`;let a;return e[1]!==i?(a=n.jsxs("div",{className:"plan-style","data-testid":"plan-style",children:[s,n.jsx("p",{className:"plan-style-text",children:i})]}),e[1]=i,e[2]=a):a=e[2],a}const Fa=t=>new Set((t?.resources?.references??[]).map(e=>e.id));async function Vt(t,e,l,s){let i=t.getState().doc?.resources?.references?.find(a=>a.part===e&&l(a));if(i===void 0){const a=Fa(t.getState().doc);await s(),i=(t.getState().doc?.resources?.references??[]).find(r=>!a.has(r.id)&&r.part===e&&r.type==="component")}i!==void 0&&await t.addSketchItemFromCard(i.id)}const fs=t=>(e,l)=>Vt(e,l,s=>s.type==="component"&&s.def===t,()=>{const s=e.getState().doc?.components?.[t]?.name??"Component";e.edit(i=>Ls(i,{},{type:"component",label:s,def:t,props:{},use:"asset",part:l},"component"))}),hs=t=>(e,l)=>Vt(e,l,s=>s.type==="component"&&s.component===t,()=>e.addStoryboardComponent(t,l,{use:"asset",select:!1})),_a=t=>async e=>{e.reportError(t)};function Ba(t,e,l,s,i,a){const r=a.trim().toLowerCase(),o=[],d=(h,p,b,g)=>({key:`code:${h}`,name:p,kind:"code",section:b,...g===null?{add:hs(h)}:{refusal:g,add:_a(g)}}),c=zn(t,e),u=Kn(t,e,s).project.filter(h=>h.host==="three"&&!c.some(p=>p.sel.kind==="code"&&p.sel.module===h.id)).map(h=>({sel:{kind:"code",module:h.id},name:h.name,refusal:null})),f=[...c,...u];for(const h of f){const p=h.sel;o.push(p.kind==="studio"?{key:`def:${p.def}`,name:h.name,kind:"studio",section:"project",add:fs(p.def)}:d(p.module,h.name,"project",h.refusal))}const m=new Set(f.flatMap(h=>h.sel.kind==="code"?[h.sel.module]:[]));for(const h of Un(t,e,l,s,f)){const p=Vn(h);if(h.kind==="code"){m.add(h.module),o.push({...d(h.module,h.name,"workspace",h.refusal),key:`ws:${h.module}`,where:p});continue}const b=h.component;o.push({key:`ws:${b.id}`,name:b.name,kind:"studio",section:"workspace",where:p,title:`Adds a copy of ${b.name} to this Project`,add:async(g,y)=>{const j=await g.importWorkspaceComponent(b.id);j!==null&&await fs(j)(g,y)}})}for(const h of i)h.source!=="builtin"||!ls(h)||o.push({key:`builtin:${h.id}`,name:Wn(h.id)??h.displayName??h.name,kind:"code",section:"builtin",group:h.group,...h.thumb===void 0?{}:{thumb:h.thumb},add:hs(h.id)});for(const h of Ol(i))!ls(h)||h.installedAs!==void 0&&m.has(h.installedAs)||o.push({key:`lib:${h.id}`,name:h.displayName??h.name,kind:"code",section:"library",...h.thumb===void 0?{}:{thumb:h.thumb},add:(p,b)=>Vt(p,b,g=>g.type==="component"&&h.installedAs!==void 0&&g.component===h.installedAs,()=>p.addStoryboardLibraryItem(h.id,b,{use:"asset",select:!1}))});return o.filter(h=>r===""||h.name.toLowerCase().includes(r))}const Ha=t=>t.charAt(0).toUpperCase()+t.slice(1);function za(t){const e=ue(),l=B(k=>k.doc),s=B(k=>k.library),i=B(k=>k.libraryLoaded),a=B(k=>k.workspaceComponents),r=B(k=>k.componentHomes),o=B(k=>k.libraryCatalog),d=B(k=>k.libraryCatalogLoaded),[c,u]=R.useState(""),[f,m]=R.useState(null);R.useEffect(()=>{t.open&&(i||e.refreshLibrary(),d||e.refreshLibraryCatalog())},[t.open,i,d,e]),R.useEffect(()=>{t.open&&e.refreshWorkspaceComponents()},[t.open,e]);const h=R.useMemo(()=>l===null?[]:Ba(l,s,a,r,o,c),[l,s,a,r,o,c]);if(l===null)return null;const p=pt(l,t.partId)??"this shot",b=c.trim()!=="",g=k=>{if(f===null){if(k.refusal!==void 0){e.reportError(k.refusal);return}m(k.key),k.add(e,t.partId).finally(()=>{m(null),t.onClose()})}},y=k=>n.jsx("ul",{className:"sketch-picker-rows",children:k.map(x=>n.jsx("li",{className:"sketch-picker-row",children:n.jsxs("button",{type:"button",className:"sketch-picker-row-main","data-testid":`component-picker-${x.key}`,disabled:f!==null,"aria-disabled":x.refusal===void 0?void 0:!0,"aria-label":`Add ${x.name}`,title:x.refusal??x.title,onClick:()=>g(x),children:[n.jsx("span",{className:"sketch-picker-thumb","aria-hidden":"true",children:x.thumb===void 0?Xe:n.jsx("img",{src:x.thumb,alt:"",draggable:!1})}),n.jsx("span",{className:"sketch-picker-name",children:x.name}),x.where===void 0?null:n.jsx("span",{className:"sketch-picker-where",children:x.where}),n.jsx("span",{className:"sketch-picker-kind",children:n.jsx("span",{className:"badge",children:x.kind==="studio"?"3D":"CODE"})}),n.jsx("span",{className:"sketch-picker-add","aria-hidden":"true",children:De})]})},x.key))}),j=(k,x,S,v)=>{const C=h.filter($=>$.section===k);if(b&&C.length===0)return null;const E=k==="builtin"?[...new Set(C.map($=>$.group??""))]:null;return n.jsxs("div",{className:"sketch-picker-section","data-testid":`component-picker-section-${k}`,children:[n.jsxs("div",{className:"sketch-picker-section-head",children:[n.jsx("h4",{className:"caps",children:x}),v===void 0?null:n.jsx("span",{className:"sketch-picker-hint",children:v})]}),C.length===0?n.jsx("p",{className:"sketch-picker-none",children:S}):E===null?y(C):E.map($=>n.jsxs("div",{children:[n.jsx("h5",{className:"sketch-picker-group",children:Ha($)}),y(C.filter(I=>(I.group??"")===$))]},$))]})};return n.jsx($s,{open:t.open,anchor:t.anchor,onClose:t.onClose,side:"above",gap:10,className:"sketch-picker",children:n.jsxs("section",{className:"sketch-picker-body","aria-label":"Add a component","data-testid":"component-picker",children:[n.jsxs("header",{className:"sketch-picker-head",children:[n.jsx("h3",{className:"sketch-picker-title",children:"Add a component"}),n.jsx("button",{type:"button",className:"sketch-icon-button","aria-label":"Close",onClick:t.onClose,children:Is})]}),n.jsxs("label",{className:"sketch-picker-search",children:[Es,n.jsx("input",{value:c,placeholder:"Search components","aria-label":"Search components",onChange:k=>u(k.target.value)})]}),n.jsxs("div",{className:"sketch-picker-sections",children:[j("project","In this project",i?"No components in this Project yet.":"Reading the components…"),j("workspace","Your library","Code made for no Project, Dailies Library installs and components you add to your library show here."),j("builtin","Built in",d?"No built-in components in this build.":"Reading the Library…"),j("library","Dailies Library",d?"Nothing more to add from the Dailies Library.":"Reading the Library…","Installs on add"),b&&h.length===0?n.jsx("p",{className:"sketch-picker-none",children:`No component matches “${c.trim()}”.`}):null]}),n.jsxs("footer",{className:"sketch-picker-foot is-split",children:[n.jsxs("button",{type:"button",className:"link-button sketch-picker-browse",onClick:()=>{t.onClose(),e.setLibraryBrowserOpen(!0,"component")},children:["Browse the Dailies Library…",Ts]}),n.jsx("span",{className:"sketch-picker-hint",children:`Lands as a card on ${p}`})]})]})})}function We(t){if(t.kind==="arrow"){const[e,l]=t.from,[s,i]=t.to;return{x:(e+s)/2,y:(l+i)/2,w:Math.abs(s-e),h:Math.abs(i-l)}}return{x:t.position[0],y:t.position[1],w:t.size[0],h:t.size[1]}}function It(t,e,l){return t.kind==="arrow"?{from:[t.from[0]+e,t.from[1]+l],to:[t.to[0]+e,t.to[1]+l]}:{position:[t.position[0]+e,t.position[1]+l]}}function tt(t){return t.replace(/^[0-9a-f]{8}-/,"")}function Wt(t,e){switch(e.kind){case"text":return e.role==="title"?"Title":e.role==="body"?"Body":"Caption";case"box":return"Box";case"arrow":return"Arrow";case"ref":{const l=st(t,e);if(l?.type==="component")return"Component";if(l?.type==="asset"){const s=t.assets[l.asset]?.kind;if(s==="video")return"Video";if(s==="image")return"Image"}return"Missing"}}}function bt(t,e){if(e.def!==void 0){const l=t.components?.[e.def];if(l!==void 0)return l.name}return e.component!==void 0?e.component.split("#").at(-1):e.label}function Ye(t,e){switch(e.kind){case"text":return e.text;case"box":return e.label??"Box";case"arrow":return e.label??"Arrow";case"ref":{const l=st(t,e);if(l===void 0)return"Missing card";if(l.type==="component"){const s=bt(t,l),i=l.props.label;return typeof i=="string"&&i.trim()!==""?`${i.trim()} · ${s}`:s}if(l.type==="asset"){const s=t.assets[l.asset];return s===void 0?l.label:tt(s.path)}return l.label}}}function Ka(t,e,l,s){const i=t.width/e.width;return[Math.round((l-t.left)/i-e.width/2),Math.round((s-t.top)/i-e.height/2)]}function Ua(t,e,l){const s=t.map(i=>{const a=We(i);return{layerId:i.id,sceneId:"sketch",left:a.x-a.w/2,right:a.x+a.w/2,top:a.y-a.h/2,bottom:a.y+a.h/2}});return qn(e,s,{sceneId:"sketch",add:l})}function Va(t,e,l,s,i){const a={position:[t.x,t.y,0],size:[t.w,t.h],tilt:[0,0],rollDeg:0,opacity:1},r=e.sx!==0&&e.sy!==0,o=Yn(a,{kind:"resize",dx:l,dy:s,handle:e,keepAspect:i&&r});let[d,c]=o.size;if(i&&!r&&t.h>0){const u=t.w/t.h;e.sx!==0?c=Math.max(1,d/u):d=Math.max(1,c*u)}return{x:o.position[0],y:o.position[1],w:Math.round(d),h:Math.round(c)}}function Wa(t,e,l){const s=Xn[e],i=t.map(u=>{const f=We(u);return s==="x"?{item:u,centre:f.x,extent:f.w}:{item:u,centre:f.y,extent:f.h}}),a={},r=(u,f)=>{f!==0&&(a[u.id]=s==="x"?It(u,f,0):It(u,0,f))};if(Ps.has(e)){if(i.length<Ct)return a;const u=[...i].sort((g,y)=>g.centre-y.centre),f=u[0],m=u.at(-1),p=(m.centre+m.extent/2-(f.centre-f.extent/2)-u.reduce((g,y)=>g+y.extent,0))/(u.length-1);let b=f.centre+f.extent/2;for(const g of u.slice(1,-1))r(g.item,b+p+g.extent/2-g.centre),b+=p+g.extent;return a}const o=(s==="x"?l.width:l.height)/2,d=i.length===1?-o:Math.min(...i.map(u=>u.centre-u.extent/2)),c=i.length===1?o:Math.max(...i.map(u=>u.centre+u.extent/2));for(const u of i){const f=e==="left"||e==="top"?d+u.extent/2:e==="right"||e==="bottom"?c-u.extent/2:(d+c)/2;r(u.item,f-u.centre)}return a}const ze=[.25,.5,.7,1,1.25,1.5,2,3,4];function ms(t,e){return e>0?ze.find(l=>l>t+1e-6)??ze.at(-1):[...ze].reverse().find(l=>l<t-1e-6)??ze[0]}function Xa(t,e,l,s){const i=t.width-l*2,a=(t.height-l*2-s)*e.width/e.height;return Math.max(160,Math.floor(Math.min(i,a)))}function Ya(t,e){const l=e.trim().toLowerCase(),s=o=>l===""||o.toLowerCase().includes(l),i=o=>o?.kind==="image"||o?.kind==="video",a=Object.values(t.assets).filter(i).map(o=>({key:o.id,name:tt(o.path),asset:o,pick:{kind:"asset",asset:o.id}})),r=Ft(t).flatMap(o=>{const d=o.type==="asset"?t.assets[o.asset]:void 0;return i(d)?[{key:o.id,name:o.label,asset:d,pick:{kind:"card",card:o.id}}]:[]});return{assets:a.filter(o=>s(o.name)),style:r.filter(o=>s(o.name))}}function Ws(t){const e=ue(),l=B(f=>f.doc),[s,i]=R.useState(""),[a,r]=R.useState("assets"),o=R.useRef(null),d=R.useMemo(()=>l===null?{assets:[],style:[]}:Ya(l,s),[l,s]);if(l===null)return null;const c=d[a],u=f=>{t.onClose(),t.onPick!==void 0?t.onPick(f):f.kind==="asset"?e.addSketchItemFromAsset(f.asset):e.addSketchItemFromCard(f.card)};return n.jsx($s,{open:t.open,anchor:t.anchor,onClose:t.onClose,side:"above",gap:10,className:"sketch-picker",children:n.jsxs("section",{className:"sketch-picker-body","aria-label":t.title??"Add an image","data-testid":"image-picker",children:[n.jsxs("header",{className:"sketch-picker-head",children:[n.jsx("h3",{className:"sketch-picker-title",children:t.title??"Add an image"}),n.jsx("button",{type:"button",className:"sketch-icon-button","aria-label":"Close",onClick:t.onClose,children:Is})]}),n.jsxs("label",{className:"sketch-picker-search",children:[Es,n.jsx("input",{value:s,placeholder:"Search images","aria-label":"Search images",onChange:f=>i(f.target.value)})]}),n.jsx(Le,{ariaLabel:"Where from",value:a,options:[{value:"assets",label:n.jsxs(n.Fragment,{children:["Project assets ",n.jsx("span",{className:"sketch-picker-count",children:d.assets.length})]}),testId:"image-picker-assets"},{value:"style",label:n.jsxs(n.Fragment,{children:["Style ",n.jsx("span",{className:"sketch-picker-count",children:d.style.length})]}),testId:"image-picker-style"}],onChange:f=>r(f==="style"?"style":"assets")}),c.length===0?n.jsx("p",{className:"sketch-picker-none",children:a==="style"?"No Style pictures yet.":"No pictures in this Project yet. Upload one."}):n.jsx("div",{className:"sketch-picker-grid",children:c.map(f=>n.jsx(qa,{tile:f,onPick:()=>u(f.pick)},f.key))}),t.onPick===void 0?n.jsxs("footer",{className:"sketch-picker-foot",children:[n.jsxs("button",{type:"button",className:"btn",onClick:()=>o.current?.click(),children:[Gn,"Upload…"]}),n.jsx("span",{className:"sketch-picker-hint",children:"or drop files on the sketch, or paste"}),n.jsx("input",{ref:o,type:"file",hidden:!0,multiple:!0,accept:`${Zn.join(",")},image/*,video/*`,"data-testid":"image-picker-upload",onChange:f=>{const m=Array.from(f.currentTarget.files??[]);f.currentTarget.value="",m.length!==0&&(t.onClose(),e.addSketchItemsFromFiles(m))}})]}):null]})})}function qa(t){const e=X.c(11),{tile:l,onPick:s}=t,i=l.asset.kind==="image";let a;e[0]!==i||e[1]!==l.asset.path?(a=i?Ve(l.asset.path):"",e[0]=i,e[1]=l.asset.path,e[2]=a):a=e[2];const r=ht(a,i?l.asset.hash:"",106);let o;e[3]!==i||e[4]!==r||e[5]!==l.asset.path?(o=i?r===null?null:n.jsx("img",{src:r,alt:"",draggable:!1}):n.jsx(_t,{className:"sketch-picker-media",src:Ve(l.asset.path),atSeconds:null}),e[3]=i,e[4]=r,e[5]=l.asset.path,e[6]=o):o=e[6];let d;return e[7]!==s||e[8]!==o||e[9]!==l.name?(d=n.jsx("button",{type:"button",className:"sketch-picker-tile",title:l.name,"aria-label":l.name,onClick:s,children:o}),e[7]=s,e[8]=o,e[9]=l.name,e[10]=d):d=e[10],d}const Xt=24,ut=(t,e)=>`${e/t.size.width*100}cqw`;function Ga(t,e){return`${Wt(t,e)}: ${Ye(t,e)}`}function Xs(t){const e=X.c(38),{doc:l,item:s}=t;if(s.kind==="arrow"){let c;return e[0]!==s||e[1]!==t?(c=n.jsx(Qa,{...t,item:s}),e[0]=s,e[1]=t,e[2]=c):c=e[2],c}let i;e[3]!==t?(i=t.inert===!0?{}:Ys(t),e[3]=t,e[4]=i):i=e[4];const a=i;let r;e[5]!==l||e[6]!==s.position||e[7]!==s.size?(r=mt(l,s.position,s.size),e[5]=l,e[6]=s.position,e[7]=s.size,e[8]=r):r=e[8];const o=r;if(s.kind==="text"){const c=`sketch-item is-text is-${s.role}`,u=s.align??"start",f=Jn[s.role];let m;e[9]!==l||e[10]!==f?(m=ut(l,f),e[9]=l,e[10]=f,e[11]=m):m=e[11];let h;e[12]!==o||e[13]!==m?(h={...o,fontSize:m},e[12]=o,e[13]=m,e[14]=h):h=e[14];let p;e[15]!==s.text||e[16]!==t.editing||e[17]!==t.onEditEnd?(p=t.editing===!0?n.jsx(ei,{text:s.text,onEnd:t.onEditEnd}):s.text,e[15]=s.text,e[16]=t.editing,e[17]=t.onEditEnd,e[18]=p):p=e[18];let b;return e[19]!==a||e[20]!==c||e[21]!==u||e[22]!==h||e[23]!==p?(b=n.jsx("div",{...a,className:c,"data-align":u,style:h,children:p}),e[19]=a,e[20]=c,e[21]=u,e[22]=h,e[23]=p,e[24]=b):b=e[24],b}if(s.kind==="box"){const c=s.tone??"light";let u;e[25]!==l||e[26]!==s.label?(u=s.label===void 0?null:n.jsx("span",{className:"sketch-item-label",style:{fontSize:ut(l,Xt)},children:s.label}),e[25]=l,e[26]=s.label,e[27]=u):u=e[27];let f;return e[28]!==a||e[29]!==o||e[30]!==c||e[31]!==u?(f=n.jsx("div",{...a,className:"sketch-item is-box","data-tone":c,style:o,children:u}),e[28]=a,e[29]=o,e[30]=c,e[31]=u,e[32]=f):f=e[32],f}let d;return e[33]!==s||e[34]!==a||e[35]!==t||e[36]!==o?(d=n.jsx(Za,{...t,item:s,own:a,style:o}),e[33]=s,e[34]=a,e[35]=t,e[36]=o,e[37]=d):d=e[37],d}function Ys(t){return{"data-item":t.item.id,"data-testid":`sketch-item-${t.item.id}`,"data-selected":t.selected?"":void 0,tabIndex:0,role:"button","aria-pressed":t.selected,"aria-label":Ga(t.doc,t.item)}}function Za(t){const e=X.c(47),{doc:l,item:s}=t;let i;e[0]!==l||e[1]!==s?(i=st(l,s),e[0]=l,e[1]=s,e[2]=i):i=e[2];const a=i,r=a?.type==="asset"?l.assets[a.asset]:void 0,o=r?.kind==="image"?r:void 0,d=s.size[0]/l.size.width*t.paperPx;let c;e[3]!==o?(c=o===void 0?"":Ve(o.path),e[3]=o,e[4]=c):c=e[4];const u=ht(c,o?.hash??"",d),f=s.fit??"cover";if(o!==void 0){let y;e[5]!==f||e[6]!==u?(y=u===null?null:n.jsx("img",{src:u,alt:"",draggable:!1,style:{objectFit:f}}),e[5]=f,e[6]=u,e[7]=y):y=e[7];let j;e[8]!==o||e[9]!==t.inert?(j=t.inert===!0?null:n.jsxs("span",{className:"sketch-item-caption","aria-hidden":"true",children:[ve("image"),tt(o.path)]}),e[8]=o,e[9]=t.inert,e[10]=j):j=e[10];let k;return e[11]!==t.own||e[12]!==t.style||e[13]!==y||e[14]!==j?(k=n.jsxs("div",{...t.own,className:"sketch-item is-image",style:t.style,children:[y,j]}),e[11]=t.own,e[12]=t.style,e[13]=y,e[14]=j,e[15]=k):k=e[15],k}if(r?.kind==="video"&&a?.type==="asset"){const y=a.frame===void 0?null:a.frame*l.fps.den/l.fps.num,j=t.own,k=t.style;let x;e[16]!==r.path?(x=Ve(r.path),e[16]=r.path,e[17]=x):x=e[17];let S;e[18]!==y||e[19]!==x?(S=n.jsx(_t,{className:"sketch-item-media",src:x,atSeconds:y}),e[18]=y,e[19]=x,e[20]=S):S=e[20];let v;e[21]!==r.path||e[22]!==t.inert?(v=t.inert===!0?null:n.jsxs("span",{className:"sketch-item-caption","aria-hidden":"true",children:[ve("video"),tt(r.path)]}),e[21]=r.path,e[22]=t.inert,e[23]=v):v=e[23];let C;return e[24]!==t.own||e[25]!==t.style||e[26]!==S||e[27]!==v?(C=n.jsxs("div",{...j,className:"sketch-item is-image",style:k,children:[S,v]}),e[24]=t.own,e[25]=t.style,e[26]=S,e[27]=v,e[28]=C):C=e[28],C}if(a?.type==="component"){let y;e[29]!==a||e[30]!==l?(y=n.jsx(Ja,{doc:l,card:a}),e[29]=a,e[30]=l,e[31]=y):y=e[31];let j;e[32]!==t.inert?(j=t.inert===!0?null:n.jsxs("span",{className:"sketch-item-tag","aria-hidden":"true",children:[Xe,"component"]}),e[32]=t.inert,e[33]=j):j=e[33];let k;return e[34]!==t.own||e[35]!==t.style||e[36]!==y||e[37]!==j?(k=n.jsxs("div",{...t.own,className:"sketch-item is-component",style:t.style,children:[y,j]}),e[34]=t.own,e[35]=t.style,e[36]=y,e[37]=j,e[38]=k):k=e[38],k}const m=t.own,h=t.style;let p;e[39]!==l?(p=ut(l,Xt),e[39]=l,e[40]=p):p=e[40];let b;e[41]!==p?(b=n.jsx("span",{className:"sketch-item-label",style:{fontSize:p},children:"Missing"}),e[41]=p,e[42]=b):b=e[42];let g;return e[43]!==t.own||e[44]!==t.style||e[45]!==b?(g=n.jsx("div",{...m,className:"sketch-item is-missing",style:h,children:b}),e[43]=t.own,e[44]=t.style,e[45]=b,e[46]=g):g=e[46],g}function Ja(t){const e=X.c(19),{doc:l,card:s}=t;let i;e[0]!==s.component?(i=p=>s.component===void 0?void 0:p.contracts[s.component],e[0]=s.component,e[1]=i):i=e[1];const a=B(i),r=s.def!==void 0&&l.components?.[s.def]!==void 0;let o;e[2]!==s.contractHash||e[3]!==s.def||e[4]!==a?.contractHash||e[5]!==l||e[6]!==r?(o=r?wl(l,s.def).hash:a?.contractHash??s.contractHash??"none",e[2]=s.contractHash,e[3]=s.def,e[4]=a?.contractHash,e[5]=l,e[6]=r,e[7]=o):o=e[7];const d=o,c=s.component??s.def??s.id;let u;e[8]!==s.props||e[9]!==d||e[10]!==c?(u=$l(c,d,s.props),e[8]=s.props,e[9]=d,e[10]=c,e[11]=u):u=e[11];const f=Il(u);if(f!==null){let p;return e[12]!==f?(p=n.jsx("img",{className:"sketch-item-poster",src:f,alt:"",draggable:!1}),e[12]=f,e[13]=p):p=e[13],p}let m;e[14]!==s||e[15]!==l?(m=bt(l,s),e[14]=s,e[15]=l,e[16]=m):m=e[16];let h;return e[17]!==m?(h=n.jsx("span",{className:"sketch-item-tile",children:m}),e[17]=m,e[18]=h):h=e[18],h}function Qa(t){const e=X.c(25),{doc:l,item:s}=t,{width:i,height:a}=l.size;let r;e[0]!==s.from||e[1]!==s.to?(r=Qn(s.from,s.to),e[0]=s.from,e[1]=s.to,e[2]=r):r=e[2];const o=r;let d;e[3]!==t?(d=t.inert===!0?null:Ys(t),e[3]=t,e[4]=d):d=e[4];const c=d,u=t.selected?"":void 0,f=`${-i/2} ${-a/2} ${i} ${a}`,m=c===null?!0:void 0;let h;e[5]!==o||e[6]!==c?(h=c===null?null:n.jsx("path",{className:"sketch-arrow-hit",d:o,...c}),e[5]=o,e[6]=c,e[7]=h):h=e[7];let p;e[8]!==o?(p=n.jsx("path",{className:"sketch-arrow-line",d:o}),e[8]=o,e[9]=p):p=e[9];let b;e[10]!==u||e[11]!==f||e[12]!==m||e[13]!==h||e[14]!==p?(b=n.jsxs("svg",{className:"sketch-item is-arrow","data-selected":u,viewBox:f,preserveAspectRatio:"none","aria-hidden":m,children:[h,p]}),e[10]=u,e[11]=f,e[12]=m,e[13]=h,e[14]=p,e[15]=b):b=e[15];let g;e[16]!==l||e[17]!==a||e[18]!==s.label||e[19]!==s.to||e[20]!==i?(g=s.label===void 0?null:n.jsx("span",{className:"sketch-item-label is-arrow","aria-hidden":"true",style:{left:`${(s.to[0]/i+.5)*100}%`,top:`${((s.to[1]-40)/a+.5)*100}%`,fontSize:ut(l,Xt)},children:s.label}),e[16]=l,e[17]=a,e[18]=s.label,e[19]=s.to,e[20]=i,e[21]=g):g=e[21];let y;return e[22]!==b||e[23]!==g?(y=n.jsxs(n.Fragment,{children:[b,g]}),e[22]=b,e[23]=g,e[24]=y):y=e[24],y}function ei(t){const e=X.c(12),l=R.useRef(null),s=R.useRef(!1);let i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{l.current?.focus(),l.current?.select()},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),R.useEffect(i,a);let r;e[2]!==t?(r=m=>{s.current||(s.current=!0,t.onEnd?.(m))},e[2]=t,e[3]=r):r=e[3];const o=r;let d;e[4]!==o?(d=m=>{m.stopPropagation(),(m.key==="Escape"||m.key==="Enter"&&!m.shiftKey)&&(m.preventDefault(),o(m.currentTarget.value))},e[4]=o,e[5]=d):d=e[5];const c=d;let u;e[6]!==o?(u=m=>o(m.currentTarget.value),e[6]=o,e[7]=u):u=e[7];let f;return e[8]!==c||e[9]!==t.text||e[10]!==u?(f=n.jsx("textarea",{ref:l,className:"sketch-text-editor",defaultValue:t.text,maxLength:Os,"aria-label":"Text",onKeyDown:c,onPointerDown:ti,onBlur:u}),e[8]=c,e[9]=t.text,e[10]=u,e[11]=f):f=e[11],f}function ti(t){return t.stopPropagation()}const ps=3,si=6,ni=[480,270],li=[760,120],ai=400,vt=16,ii=["nw","ne","se","sw","n","e","s","w"];function oi(t){const e=X.c(136),{doc:l,sketch:s,width:i}=t,a=ue(),r=B(di),o=B(ci),d=B(ri),[c,u]=R.useState(null);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[0]=f):f=e[0];const[m,h]=R.useState(f),[p,b]=R.useState(null),[g,y]=R.useState(null),[j,k]=R.useState(null),x=R.useRef(!1),S=l.size;let v;e[1]!==s?.items?(v=s?.items??[],e[1]=s?.items,e[2]=v):v=e[2];const C=v;let E;e[3]!==r?(E=new Set(r),e[3]=r,e[4]=E):E=e[4];const $=E;let I;e[5]!==C||e[6]!==r[0]||e[7]!==r.length?(I=r.length===1?C.find(H=>H.id===r[0]):void 0,e[5]=C,e[6]=r[0],e[7]=r.length,e[8]=I):I=e[8];const w=I;let T;e[9]!==l||e[10]!==t.partId?(T=pt(l,t.partId)??"this shot",e[9]=l,e[10]=t.partId,e[11]=T):T=e[11];const D=T;let F;e[12]!==S||e[13]!==c?(F=(H,K)=>Ka(c.getBoundingClientRect(),S,H,K),e[12]=S,e[13]=c,e[14]=F):F=e[14];const P=F;let O;e[15]!==S.width||e[16]!==c?(O=()=>c.getBoundingClientRect().width/S.width,e[15]=S.width,e[16]=c,e[17]=O):O=e[17];const L=O;let M;e[18]!==S||e[19]!==C||e[20]!==L||e[21]!==a?(M=(H,K)=>{const ie=C.filter(Ce=>K.includes(Ce.id)),se=C.filter(Ce=>!K.includes(Ce.id)).map(bs),ke=L();let Ie;Ie=!1,nt(H,{onMove(Ce){const Te=Ce.clientX-H.clientX,Ge=Ce.clientY-H.clientY;if(!Ie&&Math.hypot(Te,Ge)<ps)return;Ie||(Ie=!0,a.beginSketchDrag());const Ze={dx:Te/ke,dy:Ge/ke},_e=Ce.altKey?{...Ze,guides:[]}:el(ie.map(bs),se,S,Ze,si/ke),He=Math.round(_e.dx),Pe=Math.round(_e.dy);h(_e.guides),a.dragSketchItems(Object.fromEntries(ie.map(qt=>[qt.id,It(qt,He,Pe)])))},onEnd(Ce){h([]),Ie&&a.endSketchDrag(Ce)}})},e[18]=S,e[19]=C,e[20]=L,e[21]=a,e[22]=M):M=e[22];const U=M;let A;e[23]!==l||e[24]!==L||e[25]!==a?(A=(H,K,ie)=>{const se=L(),ke=We(K),Ie=K.kind==="ref"&&(ys(l,K)==="image"||ys(l,K)==="video");let Ce;Ce=!1,nt(H,{onMove(Te){const Ge=(Te.clientX-H.clientX)/se,Ze=(Te.clientY-H.clientY)/se;Ce||(Ce=!0,a.beginSketchDrag());let _e;if(K.kind==="arrow"){const He=ie==="from"?K.from:K.to,Pe=[Math.round(He[0]+Ge),Math.round(He[1]+Ze)];_e=ie==="from"?{from:Pe}:{to:Pe}}else{const He=Ie!==Te.shiftKey,Pe=Va(ke,tl[ie],Ge,Ze,He);_e={position:[Math.round(Pe.x),Math.round(Pe.y)],size:[Pe.w,Pe.h]}}a.dragSketchItems({[K.id]:_e})},onEnd(Te){Ce&&a.endSketchDrag(Te)}})},e[23]=l,e[24]=L,e[25]=a,e[26]=A):A=e[26];const z=A;let V;e[27]!==C||e[28]!==P||e[29]!==r||e[30]!==a?(V=(H,K)=>{const ie=P(H.clientX,H.clientY),se=K?r:[];let ke;ke=!1,nt(H,{onMove(Ie){if(!ke&&Math.hypot(Ie.clientX-H.clientX,Ie.clientY-H.clientY)<ps)return;ke=!0;const Ce=P(Ie.clientX,Ie.clientY),Te=ts({x:ie[0],y:ie[1]},{x:Ce[0],y:Ce[1]});b(Te),a.setSketchSelection(Ua(C,Te,se))},onEnd(){b(null),!ke&&!K&&a.setSketchSelection([])}})},e[27]=C,e[28]=P,e[29]=r,e[30]=a,e[31]=V):V=e[31];const W=V;let Z;e[32]!==P||e[33]!==t||e[34]!==a?(Z=(H,K)=>{const ie=P(H.clientX,H.clientY);let se;se=ie,nt(H,{onMove(ke){se=P(ke.clientX,ke.clientY),y(K==="arrow"?{kind:K,from:ie,to:se}:{kind:K,rect:ts({x:ie[0],y:ie[1]},{x:se[0],y:se[1]})})},onEnd(ke){if(y(null),!ke)return;const Ie=ui(K,ie,se),Ce=a.addSketchItems([Ie]);a.setSketchTool("select"),K==="text"&&Ce[0]!==void 0&&t.onEdit(Ce[0])}})},e[32]=P,e[33]=t,e[34]=a,e[35]=Z):Z=e[35];const J=Z;let Q;e[36]!==J||e[37]!==W||e[38]!==U||e[39]!==w||e[40]!==d||e[41]!==z||e[42]!==$||e[43]!==r||e[44]!==a||e[45]!==o?(Q=H=>{if(H.button!==0)return;x.current=!0;const K=H.target,ie=K.closest("[data-handle]")?.dataset.handle,se=K.closest("[data-item]")?.getAttribute("data-item")??null;if(!d&&(o==="box"||o==="text"||o==="arrow")){H.preventDefault(),J(H,o);return}if(ie!==void 0&&w!==void 0&&!d){H.preventDefault(),z(H,w,ie);return}if(se!==null){let ke;H.shiftKey?ke=$.has(se)?r.filter(Ie=>Ie!==se):[...r,se]:ke=$.has(se)?r:[se],a.setSketchSelection(ke),!d&&ke.includes(se)&&U(H,ke);return}W(H,H.shiftKey)},e[36]=J,e[37]=W,e[38]=U,e[39]=w,e[40]=d,e[41]=z,e[42]=$,e[43]=r,e[44]=a,e[45]=o,e[46]=Q):Q=e[46];const G=Q;let ae;e[47]!==d?(ae=H=>{const K=Array.from(H.dataTransfer.types);return!d&&(K.includes("Files")||K.includes(At)||K.includes(ft))},e[47]=d,e[48]=ae):ae=e[48];const te=ae;let ee;e[49]!==P||e[50]!==te?(ee=H=>{te(H)&&(H.preventDefault(),H.dataTransfer.dropEffect="copy",k(P(H.clientX,H.clientY)))},e[49]=P,e[50]=te,e[51]=ee):ee=e[51];const fe=ee;let je;e[52]!==P||e[53]!==a||e[54]!==te?(je=H=>{if(k(null),!te(H))return;const K=P(H.clientX,H.clientY),ie=Array.from(H.dataTransfer.files??[]),se=Mt(H.dataTransfer),ke=Rt(H.dataTransfer);ie.length===0&&se===null&&ke?.kind!=="reference"||(H.preventDefault(),ie.length>0?a.addSketchItemsFromFiles(ie,K):se!==null?a.addSketchItemFromAsset(se.asset,K):ke?.kind==="reference"&&a.addSketchItemFromCard(ke.id,K))},e[52]=P,e[53]=a,e[54]=te,e[55]=je):je=e[55];const me=je;let he;e[56]!==C||e[57]!==t||e[58]!==d?(he=H=>{const K=H.target.closest("[data-item]")?.getAttribute("data-item"),ie=C.find(se=>se.id===K);ie?.kind==="text"&&!d&&t.onEdit(ie.id)},e[56]=C,e[57]=t,e[58]=d,e[59]=he):he=e[59];const be=he;let pe;e[60]!==$||e[61]!==a?(pe=H=>{const K=H.target.getAttribute("data-item");K!==null&&!x.current&&!$.has(K)&&a.setSketchSelection([K])},e[60]=$,e[61]=a,e[62]=pe):pe=e[62];const ye=pe,Se=s?.ground??"paper",oe=`${S.width} / ${S.height}`;let ce;e[63]!==oe||e[64]!==i?(ce={width:i,aspectRatio:oe},e[63]=oe,e[64]=i,e[65]=ce):ce=e[65];let Y;e[66]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>{x.current=!1},e[66]=Y):Y=e[66];let re;e[67]===Symbol.for("react.memo_cache_sentinel")?(re=H=>{H.currentTarget.contains(H.relatedTarget)||k(null)},e[67]=re):re=e[67];let N;if(e[68]!==l||e[69]!==C||e[70]!==t||e[71]!==$||e[72]!==a||e[73]!==i){let H;e[75]!==l||e[76]!==t||e[77]!==$||e[78]!==a||e[79]!==i?(H=K=>n.jsx(Xs,{doc:l,item:K,paperPx:i,selected:$.has(K.id),editing:t.editing===K.id,onEditEnd:ie=>{t.onEdit(null);const se=ie.trim();se===""?a.removeSketchItems([K.id]):K.kind==="text"&&se!==K.text&&a.updateSketchItem(K.id,{text:se})}},K.id),e[75]=l,e[76]=t,e[77]=$,e[78]=a,e[79]=i,e[80]=H):H=e[80],N=C.map(H),e[68]=l,e[69]=C,e[70]=t,e[71]=$,e[72]=a,e[73]=i,e[74]=N}else N=e[74];let _;e[81]!==g||e[82]!==C.length?(_=C.length===0&&g===null?n.jsx(pi,{}):null,e[81]=g,e[82]=C.length,e[83]=_):_=e[83];let q;if(e[84]!==l||e[85]!==C||e[86]!==$){let H;e[88]!==$?(H=ie=>$.has(ie.id),e[88]=$,e[89]=H):H=e[89];let K;e[90]!==l?(K=ie=>n.jsx("span",{className:"sketch-selection",style:qs(l,We(ie)),"aria-hidden":"true"},ie.id),e[90]=l,e[91]=K):K=e[91],q=C.filter(H).map(K),e[84]=l,e[85]=C,e[86]=$,e[87]=q}else q=e[87];let ne;e[92]!==l||e[93]!==w||e[94]!==t.editing||e[95]!==d?(ne=w!==void 0&&!d&&t.editing===null?n.jsx(fi,{doc:l,item:w}):null,e[92]=l,e[93]=w,e[94]=t.editing,e[95]=d,e[96]=ne):ne=e[96];let de;if(e[97]!==S.height||e[98]!==S.width||e[99]!==m){let H;e[101]!==S.height||e[102]!==S.width?(H=K=>n.jsx("span",{className:`sketch-guide is-${K.axis}`,"aria-hidden":"true",style:K.axis==="x"?{left:`${(K.at/S.width+.5)*100}%`}:{top:`${(K.at/S.height+.5)*100}%`}},`${K.axis}${K.at}`),e[101]=S.height,e[102]=S.width,e[103]=H):H=e[103],de=m.map(H),e[97]=S.height,e[98]=S.width,e[99]=m,e[100]=de}else de=e[100];let le;e[104]!==l||e[105]!==p?(le=p===null?null:n.jsx("span",{className:"sketch-marquee","data-testid":"sketch-marquee","aria-hidden":"true",style:Gs(l,p)}),e[104]=l,e[105]=p,e[106]=le):le=e[106];let ge;e[107]!==l||e[108]!==g?(ge=g===null?null:n.jsx(mi,{doc:l,draft:g}),e[107]=l,e[108]=g,e[109]=ge):ge=e[109];let Ne;e[110]!==j||e[111]!==S.height||e[112]!==S.width||e[113]!==D?(Ne=j===null?null:n.jsxs("span",{className:"sketch-drop","aria-hidden":"true",style:{left:`${(j[0]/S.width+.5)*100}%`,top:`${(j[1]/S.height+.5)*100}%`},children:[ve("image"),n.jsx("span",{className:"sketch-drop-chip",children:`Drop to add · creates a card pinned to ${D}`})]}),e[110]=j,e[111]=S.height,e[112]=S.width,e[113]=D,e[114]=Ne):Ne=e[114];let we;e[115]!==c||e[116]!==s?(we=s===void 0?null:n.jsx(zs,{canvas:c,where:s.id}),e[115]=c,e[116]=s,e[117]=we):we=e[117];let $e;return e[118]!==be||e[119]!==fe||e[120]!==me||e[121]!==ye||e[122]!==G||e[123]!==Se||e[124]!==ce||e[125]!==N||e[126]!==_||e[127]!==q||e[128]!==ne||e[129]!==de||e[130]!==le||e[131]!==ge||e[132]!==Ne||e[133]!==we||e[134]!==o?($e=n.jsxs("div",{ref:u,className:"sketch-paper","data-ground":Se,"data-tool":o,"data-testid":"sketch-paper",style:ce,onPointerDown:G,onPointerUp:Y,onDoubleClick:be,onFocus:ye,onDragOver:fe,onDragLeave:re,onDrop:me,children:[N,_,q,ne,de,le,ge,Ne,we]}),e[118]=be,e[119]=fe,e[120]=me,e[121]=ye,e[122]=G,e[123]=Se,e[124]=ce,e[125]=N,e[126]=_,e[127]=q,e[128]=ne,e[129]=de,e[130]=le,e[131]=ge,e[132]=Ne,e[133]=we,e[134]=o,e[135]=$e):$e=e[135],$e}function ri(t){return t.readOnly}function ci(t){return t.sketchTool}function di(t){return t.sketchSelection}function bs(t){const e=We(t);return{position:[e.x,e.y,0],size:[e.w,e.h]}}function ys(t,e){const l=t.resources?.references?.find(s=>s.id===e.ref);return l?.type==="asset"?t.assets[l.asset]?.kind:l?.type}const qs=(t,e)=>mt(t,[e.x,e.y],[e.w,e.h]),Gs=(t,e)=>mt(t,[(e.left+e.right)/2,(e.top+e.bottom)/2],[e.right-e.left,e.bottom-e.top]);function ui(t,e,l){if(t==="arrow"){const d=Math.hypot(l[0]-e[0],l[1]-e[1])>=vt;return{kind:"arrow",from:e,to:d?l:[e[0]+ai,e[1]]}}const s=Math.abs(l[0]-e[0]),i=Math.abs(l[1]-e[1]),a=s>=vt&&i>=vt,r=a?[s,i]:[...t==="box"?ni:li],o=a?[Math.round((e[0]+l[0])/2),Math.round((e[1]+l[1])/2)]:e;return t==="box"?{kind:"box",position:o,size:r}:{kind:"text",text:"Text",role:"title",position:o,size:r}}function fi(t){const e=X.c(10),{doc:l,item:s}=t;if(s.kind==="arrow"){let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["from","to"],e[0]=o):o=e[0];let d;return e[1]!==l||e[2]!==s?(d=n.jsx(n.Fragment,{children:o.map(c=>n.jsx("span",{className:"sketch-handle is-end","data-handle":c,"data-testid":`sketch-handle-${c}`,"aria-hidden":"true",style:{left:`${(s[c][0]/l.size.width+.5)*100}%`,top:`${(s[c][1]/l.size.height+.5)*100}%`}},c))}),e[1]=l,e[2]=s,e[3]=d):d=e[3],d}let i;e[4]!==l||e[5]!==s?(i=qs(l,We(s)),e[4]=l,e[5]=s,e[6]=i):i=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=ii.map(hi),e[7]=a):a=e[7];let r;return e[8]!==i?(r=n.jsx("span",{className:"sketch-handles",style:i,"aria-hidden":"true",children:a}),e[8]=i,e[9]=r):r=e[9],r}function hi(t){return n.jsx("span",{className:`sketch-handle is-${t}`,"data-handle":t,"data-testid":`sketch-handle-${t}`},t)}function mi(t){const e=X.c(11),{doc:l,draft:s}=t;if(s.kind==="arrow"){const{width:o,height:d}=l.size,c=`${-o/2} ${-d/2} ${o} ${d}`,u=`M ${s.from[0]} ${s.from[1]} L ${s.to[0]} ${s.to[1]}`;let f;e[0]!==u?(f=n.jsx("path",{d:u}),e[0]=u,e[1]=f):f=e[1];let m;return e[2]!==c||e[3]!==f?(m=n.jsx("svg",{className:"sketch-draft is-arrow",viewBox:c,preserveAspectRatio:"none","aria-hidden":"true",children:f}),e[2]=c,e[3]=f,e[4]=m):m=e[4],m}const i=`sketch-draft is-${s.kind}`;let a;e[5]!==l||e[6]!==s.rect?(a=Gs(l,s.rect),e[5]=l,e[6]=s.rect,e[7]=a):a=e[7];let r;return e[8]!==i||e[9]!==a?(r=n.jsx("span",{className:i,style:a,"aria-hidden":"true"}),e[8]=i,e[9]=a,e[10]=r):r=e[10],r}function pi(){const t=X.c(6),e=ue(),l=B(yi);let s;t[0]!==l||t[1]!==e?(s=(o,d,c,u)=>n.jsxs("button",{type:"button",className:"sketch-start","data-testid":`sketch-start-${c}`,disabled:l,onPointerDown:bi,onClick:()=>e.setSketchTool(c),children:[n.jsx("span",{className:"sketch-start-icon","aria-hidden":"true",children:d}),n.jsxs("span",{className:"sketch-start-label",children:[o,u===void 0?null:n.jsx("kbd",{className:"sketch-start-key",children:u})]})]}),t[0]=l,t[1]=e,t[2]=s):s=t[2];const i=s;let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"sketch-empty-copy",children:[n.jsx("h3",{className:"sketch-empty-title",children:"Sketch the shot"}),n.jsx("p",{className:"sketch-empty-lead",children:"Place what we see, roughly. The agent and the Studio read it."})]}),t[3]=a):a=t[3];let r;return t[4]!==i?(r=n.jsxs("div",{className:"sketch-empty","data-testid":"sketch-empty",children:[a,n.jsxs("div",{className:"sketch-empty-starts",children:[i("Drop images",ve("image"),"image"),i("Add a component",Xe,"component"),i("Draw a box",ve("rect"),"box","R")]})]}),t[4]=i,t[5]=r):r=t[5],r}function bi(t){return t.stopPropagation()}function yi(t){return t.readOnly}const Et="application/x-dailies-sketch-layer",gi={Title:ve("text"),Body:ve("text"),Caption:ve("text"),Image:ve("image"),Video:ve("video"),Component:Xe,Box:ve("rect"),Arrow:ve("arrow"),Missing:ve("rect")};function xi(t){const e=X.c(16),{doc:l,sketch:s}=t,i=ue(),a=B(Si),r=B(ji),o=R.useRef(null),d=R.useRef(null);let c;e[0]!==s?.items?(c=s?.items??[],e[0]=s?.items,e[1]=c):c=e[1];const u=c,f=[...u].reverse();let m;e[2]!==a?(m=new Set(a),e[2]=a,e[3]=m):m=e[3];const h=m;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const w=d.current;w!==null&&(d.current=null,o.current?.querySelector(`[data-row="${w}"]`)?.focus())},e[4]=p):p=e[4],R.useEffect(p);let b;e[5]!==u.length?(b=w=>u.length-1-w,e[5]=u.length,e[6]=b):b=e[6];const g=b,y=(w,T,D)=>{if(w.key!=="ArrowUp"&&w.key!=="ArrowDown")return;w.preventDefault(),w.stopPropagation();const F=D+(w.key==="ArrowUp"?-1:1);if(F<0||F>=f.length)return;if(w.altKey){if(r)return;d.current=T.id,i.restackSketchItem(T.id,g(F));return}const P=f[F];d.current=P.id,i.setSketchSelection(w.shiftKey?[...a,P.id]:[P.id])};let j;e[7]!==g||e[8]!==i?(j=(w,T)=>{const D=w.dataTransfer.getData(Et);D!==""&&(w.preventDefault(),i.restackSketchItem(D,g(T)))},e[7]=g,e[8]=i,e[9]=j):j=e[9];const k=j,x="sketch-layers",S="Layers",v="sketch-layers";let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx("h3",{className:"caps",children:"Layers"}),e[10]=C):C=e[10];let E;e[11]!==u.length?(E=n.jsxs("header",{className:"panel-head sketch-layers-head",children:[C,n.jsx("span",{className:"sketch-count",children:u.length})]}),e[11]=u.length,e[12]=E):E=e[12];const $=f.length===0?n.jsx("p",{className:"sketch-layers-empty",children:"Nothing on this sketch yet."}):n.jsx("ul",{ref:o,className:"sketch-layer-list",role:"listbox","aria-label":"Layers","aria-multiselectable":"true",children:f.map((w,T)=>{const D=Wt(l,w),F=h.has(w.id);return n.jsxs("li",{className:"sketch-layer",role:"option","aria-selected":F,tabIndex:0,"data-row":w.id,"data-testid":`sketch-layer-${w.id}`,draggable:!r,title:r?void 0:"Drag to restack, or Alt+arrow",onClick:P=>{P.shiftKey?i.setSketchSelection(F?a.filter(O=>O!==w.id):[...a,w.id]):i.setSketchSelection([w.id])},onKeyDown:P=>y(P,w,T),onDragStart:P=>{P.dataTransfer.setData(Et,w.id),P.dataTransfer.effectAllowed="move"},onDragOver:ki,onDrop:P=>k(P,T),children:[n.jsx("span",{className:"sketch-layer-icon","aria-hidden":"true",children:gi[D]}),n.jsx("span",{className:"sketch-layer-name",children:Ye(l,w)}),n.jsx("span",{className:"sketch-layer-kind",children:D})]},w.id)})});let I;return e[13]!==E||e[14]!==$?(I=n.jsxs("aside",{className:x,"aria-label":S,"data-testid":v,children:[E,$]}),e[13]=E,e[14]=$,e[15]=I):I=e[15],I}function ki(t){t.dataTransfer.types.includes(Et)&&(t.preventDefault(),t.dataTransfer.dropEffect="move")}function ji(t){return t.readOnly}function Si(t){return t.sketchSelection}const vi={light:"light",dark:"dark",accent:"accent"};function Ni(t){const e=X.c(63),{doc:l,sketch:s}=t,i=ue(),a=B(Ii),r=B($i),o=B(wi);let d;e[0]!==l||e[1]!==s?(d=sl(l,s).join(`
2
+ `),e[0]=l,e[1]=s,e[2]=d):d=e[2];const c=d;let u,f;e[3]!==c||e[4]!==o||e[5]!==i?(u=()=>{for(const te of c===""?[]:c.split(`
3
+ `))i.loadContract(te);c!==""&&!o&&i.refreshLibrary()},f=[c,o,i],e[3]=c,e[4]=o,e[5]=i,e[6]=u,e[7]=f):(u=e[6],f=e[7]),R.useEffect(u,f);let m;e[8]!==l.storyboard?.parts||e[9]!==t.partId?(m=l.storyboard?.parts.find(te=>te.id===t.partId),e[8]=l.storyboard?.parts,e[9]=t.partId,e[10]=m):m=e[10];const p=Math.max(1,m?.durationFrames??1);let b,g;e[11]!==a||e[12]!==r?(g=te=>El(a[te],r.find(ee=>ee.id===te)?.contractAvailability),e[11]=a,e[12]=r,e[13]=g):g=e[13];let y;e[14]!==l||e[15]!==t.partId||e[16]!==s.id||e[17]!==g?(y=nl(l,t.partId,s.id,g),e[14]=l,e[15]=t.partId,e[16]=s.id,e[17]=g,e[18]=y):y=e[18],b=y;const j=b;let k,x;e[19]!==l.size.height||e[20]!==l.size.width?(x={width:l.size.width,height:l.size.height},e[19]=l.size.height,e[20]=l.size.width,e[21]=x):x=e[21],k=x;const S=k,[v,C]=R.useState(null),[E,$]=R.useState(0),I=l.fps.num/l.fps.den;let w,T;e[22]!==I||e[23]!==p||e[24]!==v?(T=()=>{if(v===null)return;let te;te=0;const ee=fe=>{$(Ll(fe-v,I,p)),te=requestAnimationFrame(ee)};return te=requestAnimationFrame(ee),()=>cancelAnimationFrame(te)},w=[v,I,p],e[22]=I,e[23]=p,e[24]=v,e[25]=w,e[26]=T):(w=e[25],T=e[26]),R.useEffect(T,w);const D=s.ground??"paper",F=`${S.width} / ${S.height}`;let P;e[27]!==t.width||e[28]!==F?(P={width:t.width,aspectRatio:F},e[27]=t.width,e[28]=F,e[29]=P):P=e[29];const O=`${s.label??"Sketch"} playing`;let L;e[30]===Symbol.for("react.memo_cache_sentinel")?(L=()=>C(Ci),e[30]=L):L=e[30];let M;e[31]!==p||e[32]!==S||e[33]!==j||e[34]!==O?(M=n.jsx(Tl,{doc:j,size:S,lengthFrames:p,slotKey:"sketch-play",posterKey:null,title:O,className:"sketch-play-stage",onReady:L}),e[31]=p,e[32]=S,e[33]=j,e[34]=O,e[35]=M):M=e[35];let U;if(e[36]!==l||e[37]!==t.width||e[38]!==s.items){let te;e[40]!==l||e[41]!==t.width?(te=ee=>ee.kind==="arrow"?n.jsx(Xs,{doc:l,item:ee,paperPx:t.width,selected:!1,inert:!0},ee.id):ee.kind!=="box"?null:n.jsx("span",{className:"sketch-play-box",style:mt(l,ee.position,ee.size),children:ee.label===void 0?null:n.jsx("span",{className:"sketch-play-chip",children:`${ee.label} · ${vi[ee.tone??"light"]}`})},ee.id),e[40]=l,e[41]=t.width,e[42]=te):te=e[42],U=s.items.map(te),e[36]=l,e[37]=t.width,e[38]=s.items,e[39]=U}else U=e[39];let A;e[43]!==U?(A=n.jsx("div",{className:"sketch-play-overlay","aria-hidden":"true",children:U}),e[43]=U,e[44]=A):A=e[44];const z=`${E/p*100}%`;let V;e[45]!==z?(V=n.jsx("span",{className:"sketch-play-progress","aria-hidden":"true",children:n.jsx("span",{style:{width:z}})}),e[45]=z,e[46]=V):V=e[46];let W;e[47]===Symbol.for("react.memo_cache_sentinel")?(W=n.jsx("span",{className:"sketch-play-dot","aria-hidden":"true"}),e[47]=W):W=e[47];let Z;e[48]!==l.fps||e[49]!==E?(Z=ss(E,l.fps),e[48]=l.fps,e[49]=E,e[50]=Z):Z=e[50];const J=`/ ${ss(p,l.fps)}`;let Q;e[51]!==J?(Q=n.jsx("span",{className:"sketch-play-total",children:J}),e[51]=J,e[52]=Q):Q=e[52];let G;e[53]!==Z||e[54]!==Q?(G=n.jsxs("span",{className:"sketch-play-time","data-testid":"sketch-play-time",children:[W,Z,Q]}),e[53]=Z,e[54]=Q,e[55]=G):G=e[55];let ae;return e[56]!==D||e[57]!==P||e[58]!==M||e[59]!==A||e[60]!==V||e[61]!==G?(ae=n.jsxs("div",{className:"sketch-paper is-playing","data-ground":D,"data-testid":"sketch-play",style:P,children:[M,A,V,G]}),e[56]=D,e[57]=P,e[58]=M,e[59]=A,e[60]=V,e[61]=G,e[62]=ae):ae=e[62],ae}function Ci(t){return t??performance.now()}function wi(t){return t.libraryLoaded}function $i(t){return t.library}function Ii(t){return t.contracts}const Tt="application/x-dailies-sketch-thumb",Ei=128,Ti="Type a time in seconds (1.6) or in frames (48f).";function Li(t,e){return e.frame===void 0?"":Ae(e.frame*t.fps.den/t.fps.num)}function Pi(t,e){const l=/^\s*(\d+(?:\.\d*)?|\.\d+)\s*(s|f)?\s*$/i.exec(t);if(l===null)return null;const s=Number(l[1]),i=l[2]?.toLowerCase()==="f"?s:s*e;return Number.isFinite(i)?Math.round(i):null}function Oi(t){const e=X.c(37),{doc:l,sketches:s}=t,i=ue(),a=B(Mi),r=Pt(),[o,d]=R.useState(null),c=l.fps.num/l.fps.den,u=t.partId;let f;e[0]!==s?(f=s.map(Ri),e[0]=s,e[1]=f):f=e[1];const m=js(u,f);let h;e[2]!==r||e[3]!==s.length||e[4]!==i?(h=(x,S)=>{x.preventDefault(),i.selectSketch(S.id);const v=s.length>=gt;r.open({x:x.clientX,y:x.clientY},Nt(i.getState(),[{kind:"action",id:"sketch-rename",label:"Rename",onSelect:()=>d({id:S.id,field:"label"})},{kind:"action",id:"sketch-time",label:"Set time",onSelect:()=>d({id:S.id,field:"time"})},{kind:"action",id:"sketch-duplicate",label:"Duplicate",disabled:v,title:v?`A shot holds at most ${gt} sketches.`:void 0,onSelect:()=>i.duplicateSketch(S.id)},{kind:"action",id:"sketch-delete",label:"Delete",danger:!0,onSelect:()=>i.removeSketch(S.id)}]))},e[2]=r,e[3]=s.length,e[4]=i,e[5]=h):h=e[5];const p=h;let b;e[6]!==t.current||e[7]!==t.partId||e[8]!==i?(b=()=>{t.current!==null?i.duplicateSketch(t.current):i.addSketch(t.partId)},e[6]=t.current,e[7]=t.partId,e[8]=i,e[9]=b):b=e[9];const g=b;let y;if(e[10]!==l||e[11]!==o||e[12]!==c||e[13]!==p||e[14]!==m||e[15]!==t.current||e[16]!==a||e[17]!==s||e[18]!==i){let x;e[20]!==l||e[21]!==o||e[22]!==c||e[23]!==p||e[24]!==m||e[25]!==t.current||e[26]!==a||e[27]!==i?(x=(S,v)=>{const C=S.id===t.current,E=`${v+1} · ${S.label??`Sketch ${v+1}`}`,$=Li(l,S);return n.jsxs("div",{className:"sketch-thumb-cell","data-testid":`sketch-thumb-${S.id}`,draggable:!a&&o===null,onDragStart:I=>{I.dataTransfer.setData(Tt,S.id),I.dataTransfer.effectAllowed="move"},onDragOver:Di,onDrop:I=>{const w=I.dataTransfer.getData(Tt);w!==""&&(I.preventDefault(),i.moveSketch(w,v))},children:[n.jsx("button",{type:"button",className:"sketch-thumb","aria-pressed":C,"aria-label":`${E}${$===""?"":` at ${$}`}`,title:"Press to show it. Right press for more.",onClick:()=>i.selectSketch(S.id),onContextMenu:I=>p(I,S),children:n.jsx(Ss,{doc:l,sketch:S,width:Ei,picture:m.get(S.id)??null})}),n.jsx("div",{className:"sketch-thumb-label",...o?.id===S.id?{onBlur:()=>d(null)}:{},children:o?.id===S.id&&o.field==="label"?n.jsx(Ee,{autoFocus:!0,value:S.label??"",ariaLabel:"Sketch name",onCommit:I=>{const w=I.trim().slice(0,Ds).trim();w!==(S.label??"")&&i.updateSketch(S.id,{label:w===""?null:w})}}):o?.id===S.id&&o.field==="time"?n.jsx(Ee,{autoFocus:!0,value:$,placeholder:"0.00s",ariaLabel:"Sketch time",onCommit:I=>{if(I.trim()===""){S.frame!==void 0&&i.updateSketch(S.id,{frame:null});return}const w=Pi(I,c);w===null?i.reportError(Ti):w!==S.frame&&i.updateSketch(S.id,{frame:w})}}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:`sketch-thumb-name${C?" is-current":""}`,children:E}),n.jsx("span",{className:"sketch-thumb-time",children:$})]})})]},S.id)},e[20]=l,e[21]=o,e[22]=c,e[23]=p,e[24]=m,e[25]=t.current,e[26]=a,e[27]=i,e[28]=x):x=e[28],y=s.map(x),e[10]=l,e[11]=o,e[12]=c,e[13]=p,e[14]=m,e[15]=t.current,e[16]=a,e[17]=s,e[18]=i,e[19]=y}else y=e[19];let j;e[29]!==g||e[30]!==a||e[31]!==s.length?(j=s.length>=gt?null:n.jsxs("button",{type:"button",className:"sketch-add","data-testid":"sketch-add",disabled:a,onClick:g,children:[n.jsx("span",{className:"sketch-add-icon","aria-hidden":"true",children:De}),"Sketch"]}),e[29]=g,e[30]=a,e[31]=s.length,e[32]=j):j=e[32];let k;return e[33]!==r.menu||e[34]!==y||e[35]!==j?(k=n.jsxs("div",{className:"sketch-strip",role:"group","aria-label":"Sketches","data-testid":"sketch-strip",children:[y,j,r.menu]}),e[33]=r.menu,e[34]=y,e[35]=j,e[36]=k):k=e[36],k}function Di(t){t.dataTransfer.types.includes(Tt)&&(t.preventDefault(),t.dataTransfer.dropEffect="move")}function Ri(t){return t.id}function Mi(t){return t.readOnly}const Ai=n.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round","aria-hidden":"true",children:n.jsx("path",{d:"M5 3.5 18.5 12l-6 1.6-3 5.9z"})}),Fi=[{id:"select",label:"Select",key:"V",icon:Ai},{id:"text",label:"Text",key:"T",icon:ve("text")},{id:"box",label:"Box",key:"R",icon:ve("rect")},{id:"arrow",label:"Arrow",key:"A",icon:ve("arrow")},{id:"image",label:"Image",key:"I",icon:ve("image")},{id:"component",label:"Component",key:"C",icon:Xe}];function _i(t){const e=X.c(30),l=ue(),s=B(Hi),i=B(Bi),a=`${Math.round(t.zoom*100)}%`;let r;e[0]!==s||e[1]!==t.anchors||e[2]!==i||e[3]!==l?(r=Fi.map(k=>{const x=s===k.id,S=k.id==="image"||k.id==="component";return n.jsxs("button",{ref:k.id==="image"?t.anchors.image:k.id==="component"?t.anchors.component:void 0,type:"button",className:`sketch-tool${x?" is-armed":""}`,"data-testid":`sketch-tool-${k.id}`,"aria-pressed":x,"aria-label":k.label,title:`${k.label} (${k.key})`,disabled:i&&k.id!=="select",onClick:()=>l.setSketchTool(x&&S?"select":k.id),children:[n.jsx("span",{className:"sketch-tool-icon","aria-hidden":"true",children:k.icon}),n.jsx("span",{className:"sketch-tool-label",children:k.label}),n.jsx("kbd",{className:"sketch-tool-key",children:k.key})]},k.id)}),e[0]=s,e[1]=t.anchors,e[2]=i,e[3]=l,e[4]=r):r=e[4];let o;e[5]!==r?(o=n.jsx("div",{className:"sketch-tools",role:"toolbar","aria-label":"Tools",children:r}),e[5]=r,e[6]=o):o=e[6];const d=t.zoom<=ze[0];let c;e[7]!==t?(c=()=>t.onZoom(ms(t.zoom,-1)),e[7]=t,e[8]=c):c=e[8];let u;e[9]!==d||e[10]!==c?(u=n.jsx("button",{type:"button",className:"sketch-icon-button","aria-label":"Zoom out",disabled:d,onClick:c,children:ll}),e[9]=d,e[10]=c,e[11]=u):u=e[11];let f;e[12]!==a?(f=n.jsx("span",{className:"sketch-zoom-value","data-testid":"sketch-zoom","aria-live":"polite",children:a}),e[12]=a,e[13]=f):f=e[13];const m=t.zoom>=ze.at(-1);let h;e[14]!==t?(h=()=>t.onZoom(ms(t.zoom,1)),e[14]=t,e[15]=h):h=e[15];let p;e[16]!==m||e[17]!==h?(p=n.jsx("button",{type:"button",className:"sketch-icon-button","aria-label":"Zoom in",disabled:m,onClick:h,children:De}),e[16]=m,e[17]=h,e[18]=p):p=e[18];let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("span",{className:"sketch-divider","aria-hidden":"true"}),e[19]=b):b=e[19];let g;e[20]!==t?(g=n.jsx("button",{type:"button",className:"sketch-fit",onClick:()=>t.onZoom(1),children:"Fit"}),e[20]=t,e[21]=g):g=e[21];let y;e[22]!==g||e[23]!==u||e[24]!==f||e[25]!==p?(y=n.jsxs("div",{className:"sketch-zoom",role:"group","aria-label":"Zoom",children:[u,f,p,b,g]}),e[22]=g,e[23]=u,e[24]=f,e[25]=p,e[26]=y):y=e[26];let j;return e[27]!==o||e[28]!==y?(j=n.jsxs("footer",{className:"sketch-footer","aria-label":"Sketch tools","data-testid":"sketch-footer",children:[o,y]}),e[27]=o,e[28]=y,e[29]=j):j=e[29],j}function Bi(t){return t.readOnly}function Hi(t){return t.sketchTool}const zi=24,Ki=120,Ui={width:1280,height:800},Vi={planned:"",building:" is-building",built:" is-success"};function Wi(t){return Je(t).map(e=>e.kind==="shot"?e.shot.part?.id??e.shot.sceneId:e.part.id)}function Xi(t){const e=X.c(81),{partId:l,rootRef:s}=t,i=ue(),a=B(Zi),r=B(Gi),o=B(qi),d=B(Yi),[c,u]=R.useState(1),[f,m]=R.useState(null),[h,p]=R.useState(null),[b,g]=R.useState(Ui),y=R.useRef(null),j=R.useRef(null);let k,x;e[0]!==h?(k=()=>{if(h===null||typeof ResizeObserver>"u")return;const oe=()=>{const{width:Y,height:re}=h.getBoundingClientRect();Y>0&&re>0&&g({width:Y,height:re})};oe();const ce=new ResizeObserver(oe);return ce.observe(h),()=>ce.disconnect()},x=[h],e[0]=h,e[1]=k,e[2]=x):(k=e[1],x=e[2]),R.useLayoutEffect(k,x);let S,v;e[3]!==a||e[4]!==f?(S=()=>{f!==null&&(a===null||at(a,f)===null)&&m(null)},v=[a,f],e[3]=a,e[4]=f,e[5]=S,e[6]=v):(S=e[5],v=e[6]),R.useEffect(S,v);let C;e[7]!==a?.storyboard?.parts||e[8]!==l?(C=a?.storyboard?.parts.find(oe=>oe.id===l),e[7]=a?.storyboard?.parts,e[8]=l,e[9]=C):C=e[9];const E=C;if(a===null||E===void 0)return null;let $,I;e[10]!==a||e[11]!==l||e[12]!==r?($=al(a,l),I=$.find(oe=>oe.id===r)??$[0],e[10]=a,e[11]=l,e[12]=r,e[13]=$,e[14]=I):($=e[13],I=e[14]);const w=I;let T;e[15]!==b||e[16]!==a.size||e[17]!==c?(T=Math.round(Xa(b,a.size,zi,Ki)*c),e[15]=b,e[16]=a.size,e[17]=c,e[18]=T):T=e[18];const D=T;let F;e[19]!==a||e[20]!==i?(F=oe=>{const ce=i.getState();switch(oe.kind){case"sketchMove":return ce.sketchSelection.length===0?!1:(i.nudgeSketchItems(ce.sketchSelection,oe.dx,oe.dy),!0);case"sketchRestack":{const Y=ce.sketchSelection.length===1?at(a,ce.sketchSelection[0]):null;return Y===null?!1:(i.restackSketchItem(Y.item.id,Y.index+oe.by),!0)}case"sketchEdit":{const Y=ce.sketchSelection.length===1?at(a,ce.sketchSelection[0]):null;return Y?.item.kind!=="text"||ce.readOnly||ce.sketchPlaying?!1:(m(Y.item.id),!0)}case"sketchTool":return ce.sketchPlaying?!1:(i.setSketchTool(oe.tool),!0)}},e[19]=a,e[20]=i,e[21]=F):F=e[21];const P=F;let O;e[22]!==P?(O=oe=>{const ce=oe.target;if(!oe.currentTarget.contains(ce)||oe.key==="Enter"&&ce.closest("button, [role=option], a")!==null)return;const Y=il(oe,{editing:ol(ce),hasSelection:!1,storyboard:!0});Y===null||!Y.kind.startsWith("sketch")||P(Y)&&(oe.preventDefault(),oe.stopPropagation())},e[22]=P,e[23]=O):O=e[23];const L=O,M=`Shot board: ${E.label}`;let U;e[24]!==a||e[25]!==w?(U=n.jsx(xi,{doc:a,sketch:w}),e[24]=a,e[25]=w,e[26]=U):U=e[26];const A=(w?.items.length??0)===0;let z;e[27]!==a||e[28]!==E||e[29]!==A?(z=n.jsx(Ji,{doc:a,part:E,empty:A}),e[27]=a,e[28]=E,e[29]=A,e[30]=z):z=e[30];let V;e[31]!==D?(V={width:D},e[31]=D,e[32]=V):V=e[32];let W;e[33]!==a||e[34]!==f||e[35]!==l||e[36]!==d||e[37]!==w||e[38]!==D?(W=d&&w!==void 0?n.jsx(Ni,{doc:a,partId:l,sketch:w,width:D}):n.jsx(oi,{doc:a,partId:l,sketch:w,width:D,editing:f,onEdit:m}),e[33]=a,e[34]=f,e[35]=l,e[36]=d,e[37]=w,e[38]=D,e[39]=W):W=e[39];const Z=w?.id??null;let J;e[40]!==a||e[41]!==l||e[42]!==$||e[43]!==Z?(J=n.jsx(Oi,{doc:a,partId:l,sketches:$,current:Z}),e[40]=a,e[41]=l,e[42]=$,e[43]=Z,e[44]=J):J=e[44];let Q;e[45]!==d||e[46]!==J?(Q=n.jsx("div",{className:"sketch-desk-strip",inert:d,children:J}),e[45]=d,e[46]=J,e[47]=Q):Q=e[47];let G;e[48]!==V||e[49]!==W||e[50]!==Q?(G=n.jsx("div",{ref:p,className:"sketch-desk","data-testid":"sketch-desk",children:n.jsxs("div",{className:"sketch-desk-stack",style:V,children:[W,Q]})}),e[48]=V,e[49]=W,e[50]=Q,e[51]=G):G=e[51];let ae;e[52]===Symbol.for("react.memo_cache_sentinel")?(ae={image:y,component:j},e[52]=ae):ae=e[52];let te;e[53]!==c?(te=n.jsx(_i,{zoom:c,onZoom:u,anchors:ae}),e[53]=c,e[54]=te):te=e[54];let ee;e[55]!==d||e[56]!==te?(ee=n.jsx("div",{className:"sketch-footer-cell",inert:d,children:te}),e[55]=d,e[56]=te,e[57]=ee):ee=e[57];let fe;e[58]!==z||e[59]!==G||e[60]!==ee?(fe=n.jsxs("div",{className:"shot-board-main",children:[z,G,ee]}),e[58]=z,e[59]=G,e[60]=ee,e[61]=fe):fe=e[61];const je=o==="image"&&!d;let me;e[62]!==i?(me=()=>i.setSketchTool("select"),e[62]=i,e[63]=me):me=e[63];let he;e[64]!==je||e[65]!==me?(he=n.jsx(Ws,{open:je,anchor:y,onClose:me}),e[64]=je,e[65]=me,e[66]=he):he=e[66];const be=o==="component"&&!d;let pe;e[67]!==i?(pe=()=>i.setSketchTool("select"),e[67]=i,e[68]=pe):pe=e[68];let ye;e[69]!==l||e[70]!==be||e[71]!==pe?(ye=n.jsx(za,{open:be,anchor:j,partId:l,onClose:pe}),e[69]=l,e[70]=be,e[71]=pe,e[72]=ye):ye=e[72];let Se;return e[73]!==L||e[74]!==s||e[75]!==M||e[76]!==U||e[77]!==fe||e[78]!==he||e[79]!==ye?(Se=n.jsxs("div",{ref:s,className:"shot-board",tabIndex:-1,"data-testid":"shot-board","aria-label":M,onKeyDown:L,children:[U,fe,he,ye]}),e[73]=L,e[74]=s,e[75]=M,e[76]=U,e[77]=fe,e[78]=he,e[79]=ye,e[80]=Se):Se=e[80],Se}function Yi(t){return t.sketchPlaying}function qi(t){return t.sketchTool}function Gi(t){return t.storyboardSketch}function Zi(t){return t.doc}function Ji(t){const e=X.c(66),{doc:l,part:s,empty:i}=t,a=ue(),r=Ot(),o=B(to),d=B(eo),c=B(Qi);let u;e[0]!==d||e[1]!==c?(u=rl(d,c),e[0]=d,e[1]=c,e[2]=u):u=e[2];const f=u;let m,h;e[3]!==l||e[4]!==s.id?(m=Wi(l),h=m.indexOf(s.id),e[3]=l,e[4]=s.id,e[5]=m,e[6]=h):(m=e[5],h=e[6]);const p=h,b=p>0?m[p-1]:void 0,g=p>=0&&p<m.length-1?m[p+1]:void 0,y=Dt(s,r),j=Ae(Be(s.durationFrames,l.fps)),k=cl(l,s),x=k===s.durationFrames?`${j} loop`:`${j} planned loop (its Shot runs ${Ae(Be(k,l.fps))})`;let S;e[7]!==a?(S=()=>a.closeShotBoard(),e[7]=a,e[8]=S):S=e[8];let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"sketch-bar-word",children:"Storyboard"}),e[9]=v):v=e[9];let C;e[10]!==S?(C=n.jsxs("button",{type:"button",className:"sketch-crumb","data-testid":"sketch-crumb","aria-label":"Storyboard",title:"Back to the Storyboard",onClick:S,children:[ns,v]}),e[10]=S,e[11]=C):C=e[11];let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx("span",{className:"sketch-divider","aria-hidden":"true"}),e[12]=E):E=e[12];let $;e[13]!==l||e[14]!==s.id?($=pt(l,s.id),e[13]=l,e[14]=s.id,e[15]=$):$=e[15];let I;e[16]!==$?(I=n.jsx("span",{className:"sketch-bar-number",children:$}),e[16]=$,e[17]=I):I=e[17];let w;e[18]!==s?(w=n.jsx("h2",{className:"sketch-bar-heading",children:n.jsx(Us,{part:s,className:"sketch-bar-name",testId:"sketch-bar-name"})}),e[18]=s,e[19]=w):w=e[19];const T=`badge${Vi[y]}`,D=rt[y];let F;e[20]!==T||e[21]!==D?(F=n.jsx("span",{className:T,children:D}),e[20]=T,e[21]=D,e[22]=F):F=e[22];let P;e[23]!==F||e[24]!==I||e[25]!==w?(P=n.jsxs("div",{className:"sketch-bar-title",children:[I,w,F]}),e[23]=F,e[24]=I,e[25]=w,e[26]=P):P=e[26];const O=b===void 0;let L;e[27]!==b||e[28]!==a?(L=()=>b!==void 0&&a.openShotBoard(b),e[27]=b,e[28]=a,e[29]=L):L=e[29];let M;e[30]!==O||e[31]!==L?(M=n.jsx("button",{type:"button",className:"sketch-icon-button","aria-label":"Previous shot",disabled:O,onClick:L,children:ns}),e[30]=O,e[31]=L,e[32]=M):M=e[32];const U=g===void 0;let A;e[33]!==g||e[34]!==a?(A=()=>g!==void 0&&a.openShotBoard(g),e[33]=g,e[34]=a,e[35]=A):A=e[35];let z;e[36]!==U||e[37]!==A?(z=n.jsx("button",{type:"button",className:"sketch-icon-button","aria-label":"Next shot",disabled:U,onClick:A,children:Ts}),e[36]=U,e[37]=A,e[38]=z):z=e[38];let V;e[39]!==M||e[40]!==z?(V=n.jsxs("div",{className:"sketch-bar-nav",children:[M,z]}),e[39]=M,e[40]=z,e[41]=V):V=e[41];let W;e[42]!==P||e[43]!==V||e[44]!==C?(W=n.jsxs("div",{className:"sketch-bar-group",children:[C,E,P,V]}),e[42]=P,e[43]=V,e[44]=C,e[45]=W):W=e[45];let Z;e[46]!==i||e[47]!==x||e[48]!==o||e[49]!==a?(Z=o?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"sketch-bar-playing",children:`Playing · ${x}`}),n.jsxs("button",{type:"button",className:"btn is-active","data-testid":"sketch-stop",onClick:()=>a.setSketchPlaying(!1),children:[n.jsx("span",{className:"sketch-stop-square","aria-hidden":"true"}),"Stop",n.jsx("kbd",{className:"sketch-stop-key",children:"Esc"})]})]}):n.jsxs("button",{type:"button",className:"btn","data-testid":"sketch-play-button",disabled:i,"aria-label":"Play",title:i?"Put something on the sketch to play it.":"Play the sketch in one stage",onClick:()=>a.setSketchPlaying(!0),children:[ul,n.jsx("span",{className:"sketch-bar-word",children:"Play"})]}),e[46]=i,e[47]=x,e[48]=o,e[49]=a,e[50]=Z):Z=e[50];let J;e[51]!==l||e[52]!==f||e[53]!==s.id||e[54]!==a?(J=vs()?n.jsxs("button",{type:"button",className:"btn","data-testid":"sketch-ask-agent",disabled:!f.ready,"aria-label":"Ask agent",title:f.ready?"Ask the agent to build this shot from its sketches":f.title,onClick:()=>{a.buildPlannedShots([s.id]).length===0&&a.openAgentWith(dl(l,[s.id]))},children:[Bt,n.jsx("span",{className:"sketch-bar-word",children:"Ask agent"})]}):null,e[51]=l,e[52]=f,e[53]=s.id,e[54]=a,e[55]=J):J=e[55];let Q;e[56]!==s.id||e[57]!==a?(Q=n.jsxs("button",{type:"button",className:"btn is-primary","data-testid":"sketch-open-studio",onClick:()=>a.openPlannedShot(s.id),children:["Open in Studio",Rs]}),e[56]=s.id,e[57]=a,e[58]=Q):Q=e[58];let G;e[59]!==Z||e[60]!==J||e[61]!==Q?(G=n.jsxs("div",{className:"sketch-bar-group",children:[Z,J,Q]}),e[59]=Z,e[60]=J,e[61]=Q,e[62]=G):G=e[62];let ae;return e[63]!==W||e[64]!==G?(ae=n.jsxs("header",{className:"sketch-bar","data-testid":"sketch-bar",children:[W,G]}),e[63]=W,e[64]=G,e[65]=ae):ae=e[65],ae}function Qi(t){return t.agentCredentialsError}function eo(t){return t.agentCredentials}function to(t){return t.sketchPlaying}function tr(){const t=X.c(13),e=ue(),l=B(no),s=B(so),i=B(Ms),[a,r]=R.useState(null);let o,d;t[0]!==l||t[1]!==a?(o=()=>{l&&a?.focus({preventScroll:!0})},d=[l,a],t[0]=l,t[1]=a,t[2]=o,t[3]=d):(o=t[2],d=t[3]),R.useEffect(o,d);let c,u;if(t[4]!==l||t[5]!==e?(c=()=>{if(!l)return;const p=new AbortController;return hl(document,e,p.signal),()=>p.abort()},u=[l,e],t[4]=l,t[5]=e,t[6]=c,t[7]=u):(c=t[6],u=t[7]),R.useEffect(c,u),!l||s===null)return null;let f;t[8]!==i?(f=n.jsx(ml,{name:"centre",children:i===null?n.jsx(oa,{rootRef:r}):n.jsx(Xi,{partId:i,rootRef:r},i)}),t[8]=i,t[9]=f):f=t[9];let m;t[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ya,{}),t[10]=m):m=t[10];let h;return t[11]!==f?(h=n.jsxs(n.Fragment,{children:[f,m]}),t[11]=f,t[12]=h):h=t[12],h}function so(t){return t.doc?.id??null}function no(t){return fl(t)==="storyboard"}function sr(){const t=X.c(123),e=ue(),l=B(uo),s=B(co),i=B(ro),a=B(oo),r=B(io),o=B(ao),d=B(lo);let c;t[0]!==s[0]||t[1]!==s.length?(c=s.length===1&&et(s[0])?s[0]:null,t[0]=s[0],t[1]=s.length,t[2]=c):c=t[2];const u=c;let f;t[3]!==l?.resources?.references||t[4]!==u?(f=u===null?void 0:l?.resources?.references?.find(se=>se.id===u),t[3]=l?.resources?.references,t[4]=u,t[5]=f):f=t[5];const m=f,h=m?.type==="component"?m:void 0,p=h?.component??null;let b;t[6]!==p?(b=se=>p===null?void 0:se.libraryCatalog.find(ke=>ke.installedAs===p),t[6]=p,t[7]=b):b=t[7];const g=B(b);let y,j;t[8]!==p||t[9]!==e?(y=()=>{p!==null&&e.loadContract(p)},j=[p,e],t[8]=p,t[9]=e,t[10]=y,t[11]=j):(y=t[10],j=t[11]),R.useEffect(y,j);let k,x;if(t[12]!==p||t[13]!==o||t[14]!==e?(k=()=>{p!==null&&!o&&e.refreshLibrary()},x=[p,o,e],t[12]=p,t[13]=o,t[14]=e,t[15]=k,t[16]=x):(k=t[15],x=t[16]),R.useEffect(k,x),l===null||u===null||h===void 0)return null;let S;t[17]!==l.storyboard?.parts?(S=l.storyboard?.parts??[],t[17]=l.storyboard?.parts,t[18]=S):S=t[18];const v=S,C=h.def===void 0?void 0:l.components?.[h.def];let E;t[19]!==p||t[20]!==r?(E=p===null?void 0:r.find(se=>se.id===p),t[19]=p,t[20]=r,t[21]=E):E=t[21];const $=E,I=p===null?void 0:a[p],w=C?.name??h.label,T=$?.library?.publisher??"This project",D=l.fps;let F;t[22]!==g?.lengthFrames||t[23]!==C?(F=C!==void 0?pl(C):g?.lengthFrames,t[22]=g?.lengthFrames,t[23]=C,t[24]=F):F=t[24];const P=F;let O;t[25]!==D||t[26]!==d.loopFrames||t[27]!==P?(O=d.loopFrames??P??Math.round(Pl*(D.num/D.den)),t[25]=D,t[26]=d.loopFrames,t[27]=P,t[28]=O):O=t[28];const L=O,M=Object.keys(h.props).length;let U;t[29]!==h.part||t[30]!==v?(U=h.part!==void 0&&v.some(se=>se.id===h.part)?h.part:null,t[29]=h.part,t[30]=v,t[31]=U):U=t[31];const A=U,z=$?.library?.scope==="shared"?$.library:void 0;let V;t[32]!==p||t[33]!==h.def||t[34]!==e?(V=()=>{h.def!==void 0?e.selectComponent({kind:"studio",def:h.def}):p!==null&&e.selectComponent({kind:"code",module:p})},t[32]=p,t[33]=h.def,t[34]=e,t[35]=V):V=t[35];const W=V,Z=`${w} component`;let J;t[36]!==w?(J=n.jsx("span",{className:"component-sheet-name",children:w}),t[36]=w,t[37]=J):J=t[37];const Q=C!==void 0?"3D":"code";let G;t[38]!==Q?(G=n.jsx("span",{className:"badge",children:Q}),t[38]=Q,t[39]=G):G=t[39];let ae;t[40]!==T?(ae=n.jsx("span",{className:"component-sheet-author",children:T}),t[40]=T,t[41]=ae):ae=t[41];let te;t[42]!==J||t[43]!==G||t[44]!==ae?(te=n.jsxs("header",{className:"panel-head component-sheet-bar",children:[J,G,ae]}),t[42]=J,t[43]=G,t[44]=ae,t[45]=te):te=t[45];let ee;t[46]!==I||t[47]!==C||t[48]!==l||t[49]!==h||t[50]!==o||t[51]!==d.background||t[52]!==L||t[53]!==P||t[54]!==$?(ee=C!==void 0||$?.host==="three"?n.jsx(Hs,{doc:l,item:h,contract:I,availability:$?.contractAvailability,lengthFrames:P,...d.background===null?{}:{background:d.background},loopFrames:L}):n.jsx("span",{className:"component-stage-status",role:"status",children:$===void 0&&!o?"Loading the preview…":"This component has no live preview here."}),t[46]=I,t[47]=C,t[48]=l,t[49]=h,t[50]=o,t[51]=d.background,t[52]=L,t[53]=P,t[54]=$,t[55]=ee):ee=t[55];let fe;t[56]!==D||t[57]!==h.frame||t[58]!==L?(fe=h.frame===void 0?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"component-sheet-loop-play","aria-hidden":"true"}),"Looping · ",Ae(Be(L,D))]}):`Holding frame ${h.frame}`,t[56]=D,t[57]=h.frame,t[58]=L,t[59]=fe):fe=t[59];let je;t[60]!==fe?(je=n.jsx("span",{className:"component-sheet-loop","data-testid":"component-sheet-loop",children:fe}),t[60]=fe,t[61]=je):je=t[61];let me;t[62]!==ee||t[63]!==je?(me=n.jsxs("div",{className:"component-sheet-stage",children:[ee,je]}),t[62]=ee,t[63]=je,t[64]=me):me=t[64];let he;t[65]!==h.id?(he=As(h.id),t[65]=h.id,t[66]=he):he=t[66];let be;t[67]!==he?(be=n.jsx(Fs,{useKey:he}),t[67]=he,t[68]=be):be=t[68];const pe=A===null?"style":"shot";let ye;t[69]===Symbol.for("react.memo_cache_sentinel")?(ye={value:"style",label:"Style",title:"The whole reel: the agent uses it where it fits",testId:"component-sheet-style"},t[69]=ye):ye=t[69];const Se=v.length===0,oe=v.length===0?"Add a shot first":"Pin it to one shot: only that shot uses it";let ce;t[70]!==Se||t[71]!==oe?(ce=[ye,{value:"shot",label:"One shot",disabled:Se,title:oe,testId:"component-sheet-pin"}],t[70]=Se,t[71]=oe,t[72]=ce):ce=t[72];let Y;t[73]!==u||t[74]!==v[0]||t[75]!==A||t[76]!==e?(Y=se=>{se==="style"&&A!==null?e.attachStoryboardItems([u],null):se==="shot"&&A===null&&v[0]!==void 0&&e.attachStoryboardItems([u],v[0].id)},t[73]=u,t[74]=v[0],t[75]=A,t[76]=e,t[77]=Y):Y=t[77];let re;t[78]!==pe||t[79]!==ce||t[80]!==Y?(re=n.jsx(xe,{label:"Counts in",children:n.jsx(Le,{ariaLabel:"Counts in",value:pe,options:ce,onChange:Y})}),t[78]=pe,t[79]=ce,t[80]=Y,t[81]=re):re=t[81];let N;t[82]!==u||t[83]!==v||t[84]!==A||t[85]!==e?(N=A===null?null:n.jsx(xe,{label:"Pinned shot",children:n.jsx(Ut,{parts:v,value:A,noneLabel:"Style",ariaLabel:"Pinned shot",onChange:se=>e.attachStoryboardItems([u],se)})}),t[82]=u,t[83]=v,t[84]=A,t[85]=e,t[86]=N):N=t[86];let _;t[87]!==l||t[88]!==h?(_=n.jsx(Ks,{doc:l,item:h}),t[87]=l,t[88]=h,t[89]=_):_=t[89];let q;t[90]!==h?(q=n.jsx(zt,{card:h}),t[90]=h,t[91]=q):q=t[91];let ne;t[92]!==p||t[93]!==z?(ne=z===void 0?null:n.jsxs(Oe,{label:"Library",...z.libraryId===void 0?{}:{title:z.libraryId},children:[z.publisher??"dailies","/",z.libraryId??p,z.libraryVersion===void 0?"":` v${z.libraryVersion}`,z.modified===!0?" · modified":""]}),t[92]=p,t[93]=z,t[94]=ne):ne=t[94];let de;t[95]!==h?(de=n.jsx(Kt,{card:h}),t[95]=h,t[96]=de):de=t[96];let le;t[97]!==re||t[98]!==N||t[99]!==_||t[100]!==q||t[101]!==ne||t[102]!==de?(le=n.jsxs(ct,{title:"On the board",collapsible:!1,children:[re,N,_,q,ne,de]}),t[97]=re,t[98]=N,t[99]=_,t[100]=q,t[101]=ne,t[102]=de,t[103]=le):le=t[103];let ge;t[104]!==i||t[105]!==be||t[106]!==le?(ge=n.jsxs(Ht,{value:i,children:[be,le]}),t[104]=i,t[105]=be,t[106]=le,t[107]=ge):ge=t[107];let Ne;t[108]!==me||t[109]!==ge?(Ne=n.jsxs("div",{className:"component-sheet-body",children:[me,ge]}),t[108]=me,t[109]=ge,t[110]=Ne):Ne=t[110];const we=M===1?"1 tweak":`${M} tweaks`;let $e;t[111]!==we?($e=n.jsxs("span",{className:"component-sheet-tweaks","data-testid":"component-sheet-tweaks",children:[we," · linked to master"]}),t[111]=we,t[112]=$e):$e=t[112];let H;t[113]!==W?(H=n.jsx("button",{type:"button",className:"btn is-primary","data-testid":"component-sheet-open",onClick:W,children:"Open component"}),t[113]=W,t[114]=H):H=t[114];let K;t[115]!==$e||t[116]!==H?(K=n.jsxs("footer",{className:"panel-foot component-sheet-foot",children:[$e,H]}),t[115]=$e,t[116]=H,t[117]=K):K=t[117];let ie;return t[118]!==Z||t[119]!==te||t[120]!==Ne||t[121]!==K?(ie=n.jsxs("aside",{className:"component-sheet","data-testid":"component-sheet","aria-label":Z,children:[te,Ne,K]}),t[118]=Z,t[119]=te,t[120]=Ne,t[121]=K,t[122]=ie):ie=t[122],ie}function lo(t){return t.componentPreview}function ao(t){return t.libraryLoaded}function io(t){return t.library}function oo(t){return t.contracts}function ro(t){return t.readOnly}function co(t){return t.storyboardSelection}function uo(t){return t.doc}function fo(t){const e=X.c(12),{partId:l}=t,s=ue();let i;e[0]!==l||e[1]!==s?(i=n.jsx("button",{type:"button",className:"btn board-plan-action","data-testid":"board-open-studio",onClick:()=>s.openPlannedShot(l),children:"Open in Studio"}),e[0]=l,e[1]=s,e[2]=i):i=e[2];let a;e[3]!==l||e[4]!==s?(a=n.jsx("button",{type:"button",className:"btn is-primary board-plan-action","data-testid":"board-open-board",onClick:()=>s.openShotBoard(l),children:"Open shot board"}),e[3]=l,e[4]=s,e[5]=a):a=e[5];let r;e[6]!==i||e[7]!==a?(r=n.jsxs(n.Fragment,{children:[i,a]}),e[6]=i,e[7]=a,e[8]=r):r=e[8];let o;return e[9]!==l||e[10]!==r?(o=n.jsx(Vs,{partId:l,variant:"board",footer:r}),e[9]=l,e[10]=r,e[11]=o):o=e[11],o}function nr(){const t=X.c(7),e=B(Ms),l=B(mo),s=B(ho);if(e!==null){let a;t[0]!==l?(a=l===null?{}:{sketchId:l},t[0]=l,t[1]=a):a=t[1];let r;return t[2]!==e||t[3]!==a?(r=n.jsx(Vs,{partId:e,variant:"shot",...a}),t[2]=e,t[3]=a,t[4]=r):r=t[4],r}let i;return t[5]!==s?(i=s===null?null:n.jsx(fo,{partId:s}),t[5]=s,t[6]=i):i=t[6],i}function ho(t){return t.storyboardSelection.length===1?t.storyboardSelection[0]:null}function mo(t){return t.storyboardSketch}const po={left:"M5 3V21M8 7H20V10H8M8 14H16V17H8",hcenter:"M12 3V21M5 7H19V10H5M8 14H16V17H8",right:"M19 3V21M4 7H16V10H4M8 14H16V17H8",top:"M3 5H21M7 8V20H10V8M14 8V16H17V8",vcenter:"M3 12H21M7 5V19H10V5M14 8V16H17V8",bottom:"M3 19H21M7 4V16H10V4M14 8V16H17V8",hdistribute:"M3 4V20M21 4V20M7 8V16M12 5V19M17 8V16",vdistribute:"M4 3H20M4 21H20M8 7H16M5 12H19M8 17H16"},bo=["left","hcenter","right","hdistribute","top","vcenter","bottom","vdistribute"];function lr(){const t=X.c(14),e=B(go),l=B(yo);if(e===null)return null;let s;if(t[0]!==e||t[1]!==l){s=Symbol.for("react.early_return_sentinel");e:{let i;t[3]!==e?(i=o=>{const d=at(e,o);return d===null?[]:[d.item]},t[3]=e,t[4]=i):i=t[4];const a=l.flatMap(i);if(a.length===0){s=null;break e}if(a.length>1){let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=ve("rect"),t[5]=o):o=t[5],s=n.jsx(qe,{icon:o,title:`${a.length} items`,children:n.jsx(Mo,{doc:e,items:a})});break e}const r=a[0];switch(r.kind){case"text":{s=n.jsx(Oo,{doc:e,item:r});break e}case"box":{s=n.jsx(Do,{doc:e,item:r});break e}case"arrow":{s=n.jsx(Ro,{doc:e,item:r});break e}case"ref":{const o=st(e,r);if(o?.type==="component"){let u;t[6]!==o||t[7]!==e||t[8]!==r?(u=n.jsx(wo,{doc:e,item:r,card:o}),t[6]=o,t[7]=e,t[8]=r,t[9]=u):u=t[9],s=u;break e}const d=o?.type==="asset"?o:void 0;let c;t[10]!==e||t[11]!==r||t[12]!==d?(c=n.jsx(So,{doc:e,item:r,card:d}),t[10]=e,t[11]=r,t[12]=d,t[13]=c):c=t[13],s=c;break e}}}t[0]=e,t[1]=l,t[2]=s}else s=t[2];if(s!==Symbol.for("react.early_return_sentinel"))return s}function yo(t){return t.sketchSelection}function go(t){return t.doc}function qe(t){const e=X.c(23),l=B(ko),s=B(xo);let i;e[0]!==t.icon?(i=n.jsx("span",{className:"sketch-inspector-icon","aria-hidden":"true",children:t.icon}),e[0]=t.icon,e[1]=i):i=e[1];let a;e[2]!==t.title?(a=n.jsx("h3",{className:"sketch-inspector-title",children:t.title}),e[2]=t.title,e[3]=a):a=e[3];let r;e[4]!==t.badge?(r=t.badge===void 0?null:n.jsx("span",{className:"badge",children:t.badge}),e[4]=t.badge,e[5]=r):r=e[5];let o;e[6]!==i||e[7]!==a||e[8]!==r?(o=n.jsxs("header",{className:"panel-head sketch-inspector-head",children:[i,a,r]}),e[6]=i,e[7]=a,e[8]=r,e[9]=o):o=e[9];let d;e[10]!==s?(d=s?n.jsxs("div",{className:"sketch-inspector-playing","data-testid":"sketch-inspector-playing",children:[n.jsx("span",{className:"sketch-live-dot","aria-hidden":"true"}),n.jsx("span",{className:"sketch-inspector-playing-word",children:"Playing in one stage"}),n.jsx("span",{className:"sketch-inspector-meta",children:"1 context"})]}):null,e[10]=s,e[11]=d):d=e[11];let c;e[12]!==t.children?(c=n.jsx("div",{className:"sketch-inspector-body",children:t.children}),e[12]=t.children,e[13]=c):c=e[13];let u;e[14]!==l||e[15]!==c?(u=n.jsx(Ht,{value:l,children:c}),e[14]=l,e[15]=c,e[16]=u):u=e[16];let f;e[17]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsxs("footer",{className:"panel-foot is-note",children:[Bt,"The agent reads this item as layout text."]}),e[17]=f):f=e[17];let m;return e[18]!==t.title||e[19]!==o||e[20]!==d||e[21]!==u?(m=n.jsxs("section",{className:"sketch-inspector","aria-label":t.title,"data-testid":"sketch-inspector",children:[o,d,u,f]}),e[18]=t.title,e[19]=o,e[20]=d,e[21]=u,e[22]=m):m=e[22],m}function xo(t){return t.sketchPlaying}function ko(t){return t.readOnly}function Re(t){const e=X.c(3);let l;return e[0]!==t.children||e[1]!==t.title?(l=n.jsx(ct,{title:t.title,collapsible:!1,children:t.children}),e[0]=t.children,e[1]=t.title,e[2]=l):l=e[2],l}function yt(t){const e=X.c(38),{item:l}=t,s=ue(),i=B(jo),[a,r]=l.position,[o,d]=l.size;let c;e[0]!==l.id||e[1]!==i||e[2]!==s?(c=(v,C,E,$,I)=>n.jsx(xe,{children:n.jsx(Ue,{label:v,ariaLabel:C,value:E,unit:"px",readOnly:i,...I===void 0?{}:{min:I},onCommit:w=>s.updateSketchItem(l.id,$(Math.round(w))),onScrubStart:()=>s.beginSketchDrag(),onScrub:w=>s.dragSketchItems({[l.id]:$(Math.round(w))}),onScrubEnd:w=>s.endSketchDrag(w)})}),e[0]=l.id,e[1]=i,e[2]=s,e[3]=c):c=e[3];const u=c;let f;e[4]!==r?(f=v=>({position:[v,r]}),e[4]=r,e[5]=f):f=e[5];let m;e[6]!==u||e[7]!==f||e[8]!==a?(m=u("X","Position X",a,f),e[6]=u,e[7]=f,e[8]=a,e[9]=m):m=e[9];let h;e[10]!==a?(h=v=>({position:[a,v]}),e[10]=a,e[11]=h):h=e[11];let p;e[12]!==u||e[13]!==h||e[14]!==r?(p=u("Y","Position Y",r,h),e[12]=u,e[13]=h,e[14]=r,e[15]=p):p=e[15];let b;e[16]!==d?(b=v=>({size:[v,d]}),e[16]=d,e[17]=b):b=e[17];let g;e[18]!==u||e[19]!==b||e[20]!==o?(g=u("W","Width",o,b,1),e[18]=u,e[19]=b,e[20]=o,e[21]=g):g=e[21];let y;e[22]!==o?(y=v=>({size:[o,v]}),e[22]=o,e[23]=y):y=e[23];let j;e[24]!==u||e[25]!==d||e[26]!==y?(j=u("H","Height",d,y,1),e[24]=u,e[25]=d,e[26]=y,e[27]=j):j=e[27];let k;e[28]!==m||e[29]!==p||e[30]!==g||e[31]!==j?(k=n.jsxs(xl,{children:[m,p,g,j]}),e[28]=m,e[29]=p,e[30]=g,e[31]=j,e[32]=k):k=e[32];let x;e[33]!==i?(x=i?n.jsx("p",{className:"insp-note",children:_s}):null,e[33]=i,e[34]=x):x=e[34];let S;return e[35]!==k||e[36]!==x?(S=n.jsxs(Re,{title:"Position",children:[k,x]}),e[35]=k,e[36]=x,e[37]=S):S=e[37],S}function jo(t){return t.sketchPlaying}function Zs(t){const e=X.c(2),{card:l}=t;let s;return e[0]!==l?(s=n.jsxs(Re,{title:"Card",children:[n.jsx(zt,{card:l}),n.jsx(Kt,{card:l})]}),e[0]=l,e[1]=s):s=e[1],s}function So(t){const e=X.c(55),{doc:l,item:s,card:i}=t,a=ue(),r=B(Co),o=B(No),[d,c]=R.useState(!1),u=R.useRef(null),f=i===void 0?void 0:l.assets[i.asset],m=f?.kind==="image"?f:void 0;let h;e[0]!==m?(h=m===void 0?"":Ve(m.path),e[0]=m,e[1]=h):h=e[1];const p=ht(h,m?.hash??"",272);let b,g,y,j,k;if(e[2]!==l||e[3]!==s||e[4]!==a){const M=Wt(l,s);let U;e[10]!==s.id||e[11]!==a?(U=z=>{const V=a.getState().storyboardPlan;a.edit(W=>{let Z=W,J=z.kind==="card"?z.card:void 0;if(z.kind==="asset"){const Q=W.assets[z.asset];if(Q===void 0||V===null)return W;if(J=W.resources?.references?.find(G=>G.type==="asset"&&G.asset===z.asset&&G.part===V)?.id,J===void 0){const G=new Set((W.resources?.references??[]).map(vo));Z=Ls(W,{},{type:"asset",label:tt(Q.path),asset:z.asset,use:"asset",part:V},"pin"),J=Z.resources?.references?.find(ae=>!G.has(ae.id))?.id}}return J===void 0?W:Bs(Z,s.id,{ref:J})})},e[10]=s.id,e[11]=a,e[12]=U):U=e[12],g=U,b=qe;const A=M==="Video"?"video":"image";e[13]!==A?(y=ve(A),e[13]=A,e[14]=y):y=e[14],e[15]!==l||e[16]!==s?(j=Ye(l,s),e[15]=l,e[16]=s,e[17]=j):j=e[17],k=M.toLowerCase(),e[2]=l,e[3]=s,e[4]=a,e[5]=b,e[6]=g,e[7]=y,e[8]=j,e[9]=k}else b=e[5],g=e[6],y=e[7],j=e[8],k=e[9];let x;e[18]!==i||e[19]!==m||e[20]!==s.fit||e[21]!==s.size||e[22]!==p?(x=m!==void 0?n.jsx("div",{className:"sketch-preview",style:{aspectRatio:`${s.size[0]} / ${s.size[1]}`},children:p===null?null:n.jsx("img",{src:p,alt:"",draggable:!1,style:{objectFit:s.fit??"cover"}})}):i===void 0?n.jsx("p",{className:"insp-note",children:"This card is gone from the Project. Replace it, or delete the item."}):null,e[18]=i,e[19]=m,e[20]=s.fit,e[21]=s.size,e[22]=p,e[23]=x):x=e[23];const S=s.fit??"cover";let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=[{value:"cover",label:"Fill"},{value:"contain",label:"Fit"}],e[24]=v):v=e[24];let C;e[25]!==s.id||e[26]!==a?(C=M=>a.updateSketchItem(s.id,{fit:M==="contain"?"contain":null}),e[25]=s.id,e[26]=a,e[27]=C):C=e[27];let E;e[28]!==S||e[29]!==C?(E=n.jsx(xe,{label:"Fit",children:n.jsx(Le,{ariaLabel:"Fit",value:S,options:v,onChange:C})}),e[28]=S,e[29]=C,e[30]=E):E=e[30];const $=r||o;let I;e[31]===Symbol.for("react.memo_cache_sentinel")?(I=()=>c(!0),e[31]=I):I=e[31];let w;e[32]!==$?(w=n.jsx("div",{className:"insp-buttons",children:n.jsx("button",{ref:u,type:"button",className:"btn",disabled:$,onClick:I,children:"Replace…"})}),e[32]=$,e[33]=w):w=e[33];let T;e[34]!==w||e[35]!==x||e[36]!==E?(T=n.jsxs(Re,{title:"Picture",children:[x,E,w]}),e[34]=w,e[35]=x,e[36]=E,e[37]=T):T=e[37];let D;e[38]!==i?(D=i===void 0?null:n.jsx(Zs,{card:i}),e[38]=i,e[39]=D):D=e[39];let F;e[40]!==s?(F=n.jsx(yt,{item:s}),e[40]=s,e[41]=F):F=e[41];let P;e[42]===Symbol.for("react.memo_cache_sentinel")?(P=()=>c(!1),e[42]=P):P=e[42];let O;e[43]!==g||e[44]!==d?(O=n.jsx(Ws,{open:d,anchor:u,title:"Replace the picture",onPick:g,onClose:P}),e[43]=g,e[44]=d,e[45]=O):O=e[45];let L;return e[46]!==b||e[47]!==T||e[48]!==D||e[49]!==F||e[50]!==O||e[51]!==y||e[52]!==j||e[53]!==k?(L=n.jsxs(b,{icon:y,title:j,badge:k,children:[T,D,F,O]}),e[46]=b,e[47]=T,e[48]=D,e[49]=F,e[50]=O,e[51]=y,e[52]=j,e[53]=k,e[54]=L):L=e[54],L}function vo(t){return t.id}function No(t){return t.readOnly}function Co(t){return t.sketchPlaying}function wo(t){const e=X.c(40),{doc:l,item:s,card:i}=t,a=ue(),r=B($o),o=i.def!==void 0&&l.components?.[i.def]!==void 0?null:i.component??null;let d;e[0]!==o?(d=$=>gl($.library,o??void 0),e[0]=o,e[1]=d):d=e[1];const c=B(d);let u,f;e[2]!==o||e[3]!==a?(u=()=>{o!==null&&a.loadContract(o)},f=[o,a],e[2]=o,e[3]=a,e[4]=u,e[5]=f):(u=e[4],f=e[5]),R.useEffect(u,f);let m;e[6]!==i.def||e[7]!==o||e[8]!==a?(m=()=>{o===null&&i.def!==void 0?a.selectComponent({kind:"studio",def:i.def}):o!==null&&a.selectComponent({kind:"code",module:o})},e[6]=i.def,e[7]=o,e[8]=a,e[9]=m):m=e[9];const h=m;let p;e[10]!==i||e[11]!==l?(p=bt(l,i),e[10]=i,e[11]=l,e[12]=p):p=e[12];const b=c?yl:void 0;let g;e[13]!==c||e[14]!==h||e[15]!==b?(g=n.jsx("div",{className:"insp-buttons",children:n.jsxs("button",{type:"button",className:"btn sketch-door","data-testid":"sketch-open-component",disabled:c,title:b,onClick:h,children:["Open in Components",Rs]})}),e[13]=c,e[14]=h,e[15]=b,e[16]=g):g=e[16];let y;e[17]!==r?(y=r?n.jsx("p",{className:"insp-note",children:"Edits show live while playing."}):null,e[17]=r,e[18]=y):y=e[18];let j;e[19]!==g||e[20]!==y?(j=n.jsxs(Re,{title:"Component",children:[g,y]}),e[19]=g,e[20]=y,e[21]=j):j=e[21];let k;e[22]!==i.id?(k=As(i.id),e[22]=i.id,e[23]=k):k=e[23];let x;e[24]!==k?(x=n.jsx(Fs,{useKey:k,propsLabel:"Props"}),e[24]=k,e[25]=x):x=e[25];let S;e[26]!==i?(S=n.jsx(Zs,{card:i}),e[26]=i,e[27]=S):S=e[27];let v;e[28]!==s?(v=n.jsx(yt,{item:s}),e[28]=s,e[29]=v):v=e[29];let C;e[30]!==l||e[31]!==r?(C=r?n.jsx(Io,{doc:l}):null,e[30]=l,e[31]=r,e[32]=C):C=e[32];let E;return e[33]!==x||e[34]!==S||e[35]!==v||e[36]!==C||e[37]!==p||e[38]!==j?(E=n.jsxs(qe,{icon:Xe,title:p,badge:"component",children:[j,x,S,v,C]}),e[33]=x,e[34]=S,e[35]=v,e[36]=C,e[37]=p,e[38]=j,e[39]=E):E=e[39],E}function $o(t){return t.sketchPlaying}function Io(t){const e=X.c(13),{doc:l}=t,s=B(Po);let i;if(e[0]!==l||e[1]!==s){const f=l.storyboard?.parts.flatMap(Lo).find(p=>p.id===s)?.items??[];let m;e[3]!==l?(m=p=>{if(p.kind!=="ref")return[];const b=st(l,p);return b?.type==="component"?[bt(l,b)]:[]},e[3]=l,e[4]=m):m=e[4];const h=f.flatMap(m);i=new Set(h),e[0]=l,e[1]=s,e[2]=i}else i=e[2];let a;e[5]!==i?(a=[...i].map(To),e[5]=i,e[6]=a):a=e[6];let r,o;e[7]===Symbol.for("react.memo_cache_sentinel")?(r={name:"Image, text, box",badge:"Holding",moving:!1},o={name:"Arrow, box label",badge:"Overlay",moving:!1},e[7]=r,e[8]=o):(r=e[7],o=e[8]);let d;e[9]!==a?(d=[...a,r,o],e[9]=a,e[10]=d):d=e[10];const c=d;let u;return e[11]!==c?(u=n.jsx(Re,{title:"In this stage",children:n.jsx("ul",{className:"sketch-stage-list",children:c.map(Eo)})}),e[11]=c,e[12]=u):u=e[12],u}function Eo(t){return n.jsxs("li",{className:`sketch-stage-row${t.moving?" is-moving":""}`,children:[n.jsx("span",{className:"sketch-stage-dot","aria-hidden":"true"}),n.jsx("span",{className:"sketch-stage-name",children:t.name}),n.jsx("span",{className:`badge${t.moving?" is-success":""}`,children:t.badge})]},t.name)}function To(t){return{name:t,badge:"Moving",moving:!0}}function Lo(t){return t.sketches??[]}function Po(t){return t.storyboardSketch}function Oo(t){const e=X.c(35),{doc:l,item:s}=t,i=ue();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ve("text"),e[0]=a):a=e[0];let r;e[1]!==l||e[2]!==s?(r=Ye(l,s),e[1]=l,e[2]=s,e[3]=r):r=e[3];let o;e[4]!==s.id||e[5]!==s.text||e[6]!==i?(o=k=>{const x=k.trim().slice(0,Os).trim();x!==""&&x!==s.text&&i.updateSketchItem(s.id,{text:x})},e[4]=s.id,e[5]=s.text,e[6]=i,e[7]=o):o=e[7];let d;e[8]!==s.text||e[9]!==o?(d=n.jsx(xe,{label:"Content",align:"start",children:n.jsx(Ee,{multiline:!0,value:s.text,ariaLabel:"Content",onCommit:o})}),e[8]=s.text,e[9]=o,e[10]=d):d=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=[{value:"title",label:"Title"},{value:"body",label:"Body"},{value:"caption",label:"Caption"}],e[11]=c):c=e[11];let u;e[12]!==s.id||e[13]!==i?(u=k=>{(k==="title"||k==="body"||k==="caption")&&i.updateSketchItem(s.id,{role:k})},e[12]=s.id,e[13]=i,e[14]=u):u=e[14];let f;e[15]!==s.role||e[16]!==u?(f=n.jsx(xe,{label:"Role",children:n.jsx(Le,{ariaLabel:"Role",value:s.role,options:c,onChange:u})}),e[15]=s.role,e[16]=u,e[17]=f):f=e[17];const m=s.align??"start";let h;e[18]===Symbol.for("react.memo_cache_sentinel")?(h=[{value:"start",label:"Start"},{value:"center",label:"Centre"},{value:"end",label:"End"}],e[18]=h):h=e[18];let p;e[19]!==s.id||e[20]!==i?(p=k=>i.updateSketchItem(s.id,{align:k==="center"||k==="end"?k:null}),e[19]=s.id,e[20]=i,e[21]=p):p=e[21];let b;e[22]!==p||e[23]!==m?(b=n.jsx(xe,{label:"Align",children:n.jsx(Le,{ariaLabel:"Align",value:m,options:h,onChange:p})}),e[22]=p,e[23]=m,e[24]=b):b=e[24];let g;e[25]!==b||e[26]!==d||e[27]!==f?(g=n.jsxs(Re,{title:"Text",children:[d,f,b]}),e[25]=b,e[26]=d,e[27]=f,e[28]=g):g=e[28];let y;e[29]!==s?(y=n.jsx(yt,{item:s}),e[29]=s,e[30]=y):y=e[30];let j;return e[31]!==g||e[32]!==y||e[33]!==r?(j=n.jsxs(qe,{icon:a,title:r,badge:"text",children:[g,y]}),e[31]=g,e[32]=y,e[33]=r,e[34]=j):j=e[34],j}function Js(t){const e=X.c(7),{itemId:l,label:s}=t,i=ue(),a=s??"";let r;e[0]!==l||e[1]!==s||e[2]!==i?(r=d=>{const c=d.trim().slice(0,Ds).trim();c!==(s??"")&&i.updateSketchItem(l,{label:c===""?null:c})},e[0]=l,e[1]=s,e[2]=i,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=n.jsx(xe,{label:"Label",children:n.jsx(Ee,{value:a,placeholder:"What this stands for",ariaLabel:"Label",onCommit:r})}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Do(t){const e=X.c(23),{doc:l,item:s}=t,i=ue();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ve("rect"),e[0]=a):a=e[0];let r;e[1]!==l||e[2]!==s?(r=Ye(l,s),e[1]=l,e[2]=s,e[3]=r):r=e[3];let o;e[4]!==s.id||e[5]!==s.label?(o=n.jsx(Js,{itemId:s.id,label:s.label}),e[4]=s.id,e[5]=s.label,e[6]=o):o=e[6];const d=s.tone??"light";let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"accent",label:"Accent"}],e[7]=c):c=e[7];let u;e[8]!==s.id||e[9]!==i?(u=b=>i.updateSketchItem(s.id,{tone:b==="dark"||b==="accent"?b:null}),e[8]=s.id,e[9]=i,e[10]=u):u=e[10];let f;e[11]!==d||e[12]!==u?(f=n.jsx(xe,{label:"Tone",children:n.jsx(Le,{ariaLabel:"Tone",value:d,options:c,onChange:u})}),e[11]=d,e[12]=u,e[13]=f):f=e[13];let m;e[14]!==o||e[15]!==f?(m=n.jsxs(Re,{title:"Box",children:[o,f]}),e[14]=o,e[15]=f,e[16]=m):m=e[16];let h;e[17]!==s?(h=n.jsx(yt,{item:s}),e[17]=s,e[18]=h):h=e[18];let p;return e[19]!==r||e[20]!==m||e[21]!==h?(p=n.jsxs(qe,{icon:a,title:r,badge:"box",children:[m,h]}),e[19]=r,e[20]=m,e[21]=h,e[22]=p):p=e[22],p}function Ro(t){const e=X.c(13),{doc:l,item:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=ve("arrow"),e[0]=i):i=e[0];let a;e[1]!==l||e[2]!==s?(a=Ye(l,s),e[1]=l,e[2]=s,e[3]=a):a=e[3];let r;e[4]!==s.id||e[5]!==s.label?(r=n.jsx(Js,{itemId:s.id,label:s.label}),e[4]=s.id,e[5]=s.label,e[6]=r):r=e[6];let o;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("p",{className:"insp-note",children:"An arrow stays a note: the Studio never makes it a layer."}),e[7]=o):o=e[7];let d;e[8]!==r?(d=n.jsxs(Re,{title:"Arrow",children:[r,o]}),e[8]=r,e[9]=d):d=e[9];let c;return e[10]!==a||e[11]!==d?(c=n.jsx(qe,{icon:i,title:a,badge:"arrow",children:d}),e[10]=a,e[11]=d,e[12]=c):c=e[12],c}function Mo(t){const e=X.c(11),{doc:l,items:s}=t,i=ue(),a=B(Fo),r=Fe();let o;e[0]!==l||e[1]!==s||e[2]!==i?(o=f=>{const m=Wa(s,f,l.size);Object.keys(m).length!==0&&i.edit(h=>Object.entries(m).reduce(Ao,h))},e[0]=l,e[1]=s,e[2]=i,e[3]=o):o=e[3];const d=o;let c;e[4]!==s||e[5]!==r||e[6]!==a||e[7]!==d?(c=bo.map(f=>{const m=Ps.has(f)&&s.length<Ct,h=bl[f];return n.jsx("button",{type:"button",className:"align-button","aria-label":h,title:a?_s:m?`${h}: needs ${Ct} or more items`:h,disabled:m||a||r,onClick:()=>d(f),children:n.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n.jsx("path",{d:po[f]})})},f)}),e[4]=s,e[5]=r,e[6]=a,e[7]=d,e[8]=c):c=e[8];let u;return e[9]!==c?(u=n.jsx(Re,{title:"Align",children:n.jsx("div",{className:"sketch-align",role:"group","aria-label":"Align and distribute","data-testid":"sketch-align",children:c})}),e[9]=c,e[10]=u):u=e[10],u}function Ao(t,e){const[l,s]=e;return Bs(t,l,s)}function Fo(t){return t.sketchPlaying}const _o=t=>`/studio/assets/${encodeURIComponent(t)}`;function Bo(t){const e=ue(),l=R.useRef(null),[s,i]=R.useState(!1),[a,r]=R.useState(!1),[o,d]=R.useState(null),c=Fe(),u=Math.max(.002,t.fps.den/t.fps.num/2);R.useEffect(()=>{const m=l.current;if(m===null)return;i(!1),d(null);const h=()=>{const b=xt(t.frame,t.fps,m.duration);b!==null&&!m.seeking&&m.readyState>=2&&Math.abs(m.currentTime-b)<=u&&i(!0)},p=()=>{const b=xt(t.frame,t.fps,m.duration);if(b===null){d(`Frame ${t.frame} is outside this video's duration.`);return}m.currentTime=b,h()};return m.addEventListener("seeked",h),m.addEventListener("loadeddata",h),m.addEventListener("loadedmetadata",p),m.readyState>=1&&p(),()=>{m.removeEventListener("loadedmetadata",p),m.removeEventListener("loadeddata",h),m.removeEventListener("seeked",h)}},[u,t.frame,t.fps,t.path]);const f=async()=>{const m=l.current;if(m===null||!s||a||m.seeking||m.readyState<2)return;const h=xt(t.frame,t.fps,m.duration);if(h===null||Math.abs(m.currentTime-h)>u)return;const p=e.getState().doc,b=p?.resources?.references?.find(j=>j.id===t.id);if(p===null||b?.type!=="asset"||b.asset!==t.assetId||p.assets[b.asset]?.path!==t.path)return;const g={frame:t.frame,asset:t.assetId},y=b.part??null;r(!0);try{const j=document.createElement("canvas");j.width=m.videoWidth,j.height=m.videoHeight;const k=j.getContext("2d");if(k===null)throw new Error("Could not read this video frame.");k.drawImage(m,0,0);const x=await new Promise(S=>j.toBlob(S,"image/png"));if(x===null)throw new Error("Could not encode this video frame.");if(e.getState().doc?.id!==p.id)return;await e.addReferenceFromFile(new File([x],`${t.label}-f${g.frame}.png`,{type:"image/png"}),y,g)}catch(j){e.reportError(j instanceof Error?j.message:String(j))}finally{r(!1)}};return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"insp-reference-lead",children:[n.jsx("video",{ref:l,className:"insp-video-still",src:_o(t.path),preload:"metadata",muted:!0,playsInline:!0}),n.jsx("button",{type:"button",className:"btn",disabled:!s||a||c,title:"Save this frame as an image card in the same lane",onClick:()=>void f(),children:a?"Saving…":"Extract still"})]}),o===null?null:n.jsx("div",{className:"insp-notice is-warn",role:"status",children:o})]})}function Ke(t,e){return typeof t=="number"&&Number.isFinite(t)?Math.max(e,Math.round(t)):null}function Ho(t,e){if(!(t===void 0||!Number.isFinite(t)||t<=0))return Math.max(0,Math.ceil(t*e.num/e.den)-1)}function ar(){const t=X.c(141),e=ue(),l=B(Wo),s=B(Vo),i=B(Uo),a=B(Ko);let r;t[0]!==l||t[1]!==s?(r=l&&s.length===1&&et(s[0])?s[0]:null,t[0]=l,t[1]=s,t[2]=r):r=t[2];const o=r;let d;t[3]!==i?.resources?.references||t[4]!==o?(d=o===null?void 0:i?.resources?.references?.find(Y=>Y.id===o),t[3]=i?.resources?.references,t[4]=o,t[5]=d):d=t[5];const c=d,u=c?.type==="library"?c.library:null,f=B(zo);let m;t[6]!==u?(m=Y=>u===null?void 0:Y.libraryCatalog.find(re=>re.id===u),t[6]=u,t[7]=m):m=t[7];const h=B(m);let p;t[8]!==u?(p=Y=>u===null?void 0:Y.libraryItems[u],t[8]=u,t[9]=p):p=t[9];const b=B(p);let g;t[10]!==u?(g=Y=>u===null?void 0:Y.libraryCatalogProblems.find(re=>re.id===u),t[10]=u,t[11]=g):g=t[11];const y=B(g),[j,k]=R.useState(!1);let x;t[12]===Symbol.for("react.memo_cache_sentinel")?(x=Y=>{k(!0),Y.finally(()=>k(!1))},t[12]=x):x=t[12];const S=x,v=Fe();let C,E;t[13]!==f||t[14]!==u||t[15]!==h||t[16]!==e?(C=()=>{if(u!==null){if(!f){e.refreshLibraryCatalog();return}h!==void 0&&e.loadLibraryItem(u)}},E=[u,f,h,e],t[13]=f,t[14]=u,t[15]=h,t[16]=e,t[17]=C,t[18]=E):(C=t[17],E=t[18]),R.useEffect(C,E);let $;t[19]!==o?($=(Y,re)=>{const N=Ke(re,0);return o===null||N===null?Y:ot(Y,o,{frame:N})},t[19]=o,t[20]=$):$=t[20];const I=Qe($);if(i===null||o===null||c===void 0)return null;let w;t[21]!==i.storyboard?.parts?(w=i.storyboard?.parts??[],t[21]=i.storyboard?.parts,t[22]=w):w=t[22];const T=w,D=c.type==="asset"?i.assets[c.asset]:void 0,F=D?.kind==="video";let P,O,L,M,U,A,z,V,W,Z,J,Q,G,ae;if(t[23]!==D||t[24]!==f||t[25]!==b?.blueprint?.ops||t[26]!==i.fps||t[27]!==o||t[28]!==F||t[29]!==c||t[30]!==T||t[31]!==h||t[32]!==e){const Y=c.part===void 0?void 0:kl(T).find(de=>de.id===c.part);z=c.type==="library"&&f&&h===void 0,A=c.type!=="library"?void 0:h?.kind??c.kind,U=c.type==="library"&&h?.kind!==void 0&&h.kind!==c.kind;let re;t[47]!==b?.blueprint?.ops||t[48]!==e?(re=()=>{const de=b?.blueprint?.ops;if(de===void 0)return;const le=typeof navigator>"u"?void 0:navigator.clipboard;if(le===void 0){e.reportError("The clipboard is not available here, so the ops could not be copied.");return}le.writeText(JSON.stringify(de,null,2)).catch(ge=>e.reportError(ge instanceof Error?ge.message:String(ge)))},t[47]=b?.blueprint?.ops,t[48]=e,t[49]=re):re=t[49],O=re,V=c.type==="asset"&&(F||c.source!==void 0)||c.type==="library",M=c.type==="asset"?c.frame??0:0;const N=D?.media?.durationSeconds;let _;t[50]!==i.fps||t[51]!==N?(_=Ho(N,i.fps),t[50]=i.fps,t[51]=N,t[52]=_):_=t[52],L=_,P=ct,W="Reference",Z="shot:storyboard-reference",J=!1,t[53]!==D||t[54]!==i.fps||t[55]!==M||t[56]!==o||t[57]!==F||t[58]!==c||t[59]!==A||t[60]!==z||t[61]!==h?(Q=c.type==="asset"&&F&&D!==void 0?n.jsx(Bo,{id:o,assetId:c.asset,path:D.path,frame:M,fps:i.fps,label:c.label}):n.jsx("div",{className:"insp-reference-lead",children:n.jsx(Cs,{item:c,...D===void 0?{}:{asset:D},fps:i.fps,...h?.thumb===void 0?{}:{libraryThumb:h.thumb},...A===void 0?{}:{libraryKind:A},...z?{libraryMissing:z}:{}})}),t[53]=D,t[54]=i.fps,t[55]=M,t[56]=o,t[57]=F,t[58]=c,t[59]=A,t[60]=z,t[61]=h,t[62]=Q):Q=t[62];const q=c.part??null;let ne;t[63]!==o||t[64]!==e?(ne=de=>e.updateReference(o,{part:de}),t[63]=o,t[64]=e,t[65]=ne):ne=t[65],t[66]!==T||t[67]!==q||t[68]!==ne?(G=n.jsx(xe,{label:"Lane",children:n.jsx(Ut,{parts:T,value:q,noneLabel:"Global",ariaLabel:"Lane",onChange:ne})}),t[66]=T,t[67]=q,t[68]=ne,t[69]=G):G=t[69],ae=Y===void 0?null:n.jsxs(Oe,{label:"Plays",children:[kt(Y.start,i.fps)," to ",kt(Y.end,i.fps)]}),t[23]=D,t[24]=f,t[25]=b?.blueprint?.ops,t[26]=i.fps,t[27]=o,t[28]=F,t[29]=c,t[30]=T,t[31]=h,t[32]=e,t[33]=P,t[34]=O,t[35]=L,t[36]=M,t[37]=U,t[38]=A,t[39]=z,t[40]=V,t[41]=W,t[42]=Z,t[43]=J,t[44]=Q,t[45]=G,t[46]=ae}else P=t[33],O=t[34],L=t[35],M=t[36],U=t[37],A=t[38],z=t[39],V=t[40],W=t[41],Z=t[42],J=t[43],Q=t[44],G=t[45],ae=t[46];let te,ee;t[70]!==i||t[71]!==c?(te=n.jsx(Ks,{doc:i,item:c}),ee=n.jsx(Xo,{doc:i,item:c}),t[70]=i,t[71]=c,t[72]=te,t[73]=ee):(te=t[72],ee=t[73]);let fe;t[74]!==c?(fe=n.jsx(zt,{card:c}),t[74]=c,t[75]=fe):fe=t[75];let je;t[76]!==i.fps||t[77]!==c.kind||t[78]!==c.library||t[79]!==c.type||t[80]!==c.version||t[81]!==U||t[82]!==A||t[83]!==z||t[84]!==y||t[85]!==h?(je=c.type==="library"?n.jsxs(n.Fragment,{children:[n.jsxs(Oe,{label:"Item",title:`${c.library} v${c.version}`,children:[A," · ",c.library," v",c.version]}),U?n.jsxs("div",{className:"insp-notice is-warn",children:["This build ships a ",A,", but this card says ",c.kind,". The action below follows the item; rewrite the card to agree with it."]}):null,z?n.jsx("div",{className:"insp-notice is-warn",children:y===void 0?"Not in this build's library. The card keeps its id and version; another build may ship it.":`This build ships the item but its library refused to read it. ${y.error}`}):null,h?.useFor===void 0?null:n.jsx(Oe,{label:"Use for",prose:!0,children:h.useFor}),h?.avoidFor===void 0?null:n.jsx(Oe,{label:"Avoid for",prose:!0,children:h.avoidFor}),h?.lengthFrames===void 0?null:n.jsxs(Oe,{label:"Length",children:[Ae(Be(h.lengthFrames,i.fps))," · ",h.lengthFrames,"f"]})]}):null,t[76]=i.fps,t[77]=c.kind,t[78]=c.library,t[79]=c.type,t[80]=c.version,t[81]=U,t[82]=A,t[83]=z,t[84]=y,t[85]=h,t[86]=je):je=t[86];let me;t[87]!==o||t[88]!==c||t[89]!==e?(me=c.type==="note"?n.jsx(xe,{label:"Text",align:"start",children:n.jsx(Ee,{multiline:!0,value:c.text,ariaLabel:"Note text",onCommit:Y=>{const re=Y.trim();re.length>0&&re!==c.text&&e.updateReference(o,{text:re})}})}):n.jsx(Kt,{card:c}),t[87]=o,t[88]=c,t[89]=e,t[90]=me):me=t[90];let he;t[91]!==j||t[92]!==O||t[93]!==b?.blueprint||t[94]!==c.type||t[95]!==u||t[96]!==A||t[97]!==z||t[98]!==v||t[99]!==e?(he=c.type==="library"&&u!==null?A==="shot"?n.jsx("button",{type:"button",className:"btn",disabled:z||j||v,title:z?"This build does not ship the item":j?"Copying the Project…":"Copy this shot into a new Project and open it",onClick:()=>S(e.claimLibraryShot(u)),children:"Claim as Project"}):A==="material"?n.jsx("button",{type:"button",className:"btn",disabled:z||j||v,title:z?"This build does not ship the item":j?"Writing into the Project…":"Add this preset to the Project's materials under a fresh id",onClick:()=>S(e.importLibraryIntoProject(u,"material")),children:"Import into this Project"}):A==="images"?n.jsx("button",{type:"button",className:"btn",disabled:z||j||v,title:z?"This build does not ship the item":j?"Writing into the Project…":"Register every file in the pack as a Project asset",onClick:()=>S(e.importLibraryIntoProject(u,"images")),children:"Add to Project assets"}):A==="blueprint"?n.jsx("button",{type:"button",className:"btn",disabled:b?.blueprint===void 0,title:z?"This build does not ship the item":b?.blueprint===void 0?"Waiting for the item's ops":"Copy the ops as JSON; substitute your layer ids for its placeholders, then apply them",onClick:O,children:"Copy ops"}):null:null,t[91]=j,t[92]=O,t[93]=b?.blueprint,t[94]=c.type,t[95]=u,t[96]=A,t[97]=z,t[98]=v,t[99]=e,t[100]=he):he=t[100];let be;t[101]!==o||t[102]!==e?(be=()=>e.deleteStoryboardItems([o]),t[101]=o,t[102]=e,t[103]=be):be=t[103];let pe;t[104]!==v||t[105]!==be?(pe=n.jsx("button",{type:"button",className:"btn is-danger",disabled:v,onClick:be,children:"Delete"}),t[104]=v,t[105]=be,t[106]=pe):pe=t[106];let ye;t[107]!==he||t[108]!==pe?(ye=n.jsxs(xe,{children:[he,pe]}),t[107]=he,t[108]=pe,t[109]=ye):ye=t[109];let Se;t[110]!==P||t[111]!==W||t[112]!==Z||t[113]!==J||t[114]!==Q||t[115]!==G||t[116]!==ae||t[117]!==te||t[118]!==ee||t[119]!==fe||t[120]!==je||t[121]!==me||t[122]!==ye?(Se=n.jsxs(P,{title:W,persistKey:Z,collapsible:J,children:[Q,G,ae,te,ee,fe,je,me,ye]}),t[110]=P,t[111]=W,t[112]=Z,t[113]=J,t[114]=Q,t[115]=G,t[116]=ae,t[117]=te,t[118]=ee,t[119]=fe,t[120]=je,t[121]=me,t[122]=ye,t[123]=Se):Se=t[123];let oe;t[124]!==b||t[125]!==i.fps||t[126]!==L||t[127]!==I||t[128]!==M||t[129]!==o||t[130]!==F||t[131]!==c.source||t[132]!==c.type||t[133]!==z||t[134]!==V||t[135]!==a||t[136]!==e?(oe=V?n.jsxs(ct,{title:"More",collapsed:!a,onCollapsedChange:Y=>e.setReferenceMoreOpen(!Y),children:[c.type==="asset"&&F?n.jsxs(n.Fragment,{children:[n.jsx(xe,{children:n.jsx(wt,{value:"compact",children:n.jsx(Ue,{value:M,label:"Frame",ariaLabel:"Frame, video",min:0,...L===void 0?{}:{max:L},step:1,onCommit:Y=>{const re=Ke(Y,0);re!==null&&e.updateReference(o,{frame:re})},onScrubStart:I.start,onScrub:I.move,onScrubEnd:I.end})})}),n.jsx(Oe,{label:"Timecode",children:kt(M,i.fps)})]}):null,c.type==="asset"&&c.source!==void 0?n.jsx(Oe,{label:"Source",prose:!0,children:c.source.asset!==void 0?`Still from a video at frame ${c.source.frame}`:`Captured from this Project at frame ${c.source.frame}`}):null,c.type==="library"?b===void 0?n.jsx(Oe,{label:"Docs",prose:!0,children:z?"No docs: this build does not ship the item.":"Loading the item's docs…"}):n.jsx(xe,{label:"Docs",align:"start",className:"insp-readout",children:n.jsx("pre",{className:"insp-docs",children:b.docs})}):null]}):null,t[124]=b,t[125]=i.fps,t[126]=L,t[127]=I,t[128]=M,t[129]=o,t[130]=F,t[131]=c.source,t[132]=c.type,t[133]=z,t[134]=V,t[135]=a,t[136]=e,t[137]=oe):oe=t[137];let ce;return t[138]!==Se||t[139]!==oe?(ce=n.jsxs(n.Fragment,{children:[Se,oe]}),t[138]=Se,t[139]=oe,t[140]=ce):ce=t[140],ce}function zo(t){return t.libraryCatalogLoaded}function Ko(t){return t.referenceMoreOpen}function Uo(t){return t.doc}function Vo(t){return t.storyboardSelection}function Wo(t){return t.storyboardOpen}const Yt=t=>t.charAt(0).toUpperCase()+t.slice(1);function Xo(t){const e=X.c(102),{doc:l,item:s}=t,i=ue(),a=s.id,r=R.useRef(null),[o,d]=R.useState(!1),c=Fe();let u;e[0]!==a?(u=(p,b)=>{const g=Ke(b,1);return g===null?p:ot(p,a,{durationFrames:g})},e[0]=a,e[1]=u):u=e[1];const f=Qe(u);let m;e[2]!==a?(m=(p,b)=>{const g=Ke(b,0);return g===null?p:ot(p,a,{hitMs:g===0?null:g})},e[2]=a,e[3]=m):m=e[3];const h=Qe(m);switch(s.type){case"text":{let p;e[4]!==a||e[5]!==s.copy||e[6]!==i?(p=g=>{const y=g.trim();y.length>0&&y!==s.copy&&i.updateReference(a,{copy:y})},e[4]=a,e[5]=s.copy,e[6]=i,e[7]=p):p=e[7];let b;return e[8]!==s.copy||e[9]!==p?(b=n.jsx(xe,{label:"Copy",align:"start",children:n.jsx(Ee,{multiline:!0,value:s.copy,ariaLabel:"Copy",onCommit:p})}),e[8]=s.copy,e[9]=p,e[10]=b):b=e[10],b}case"transition":{let p,b,g,y;if(e[11]!==s.kind){const $=Object.values(Cl),I=$.some(T=>T.id===s.kind);b=xe,y="Kind",p=lt;let w;e[16]!==s.kind||e[17]!==I?(w=I?[]:[{value:s.kind,label:`${s.kind} (unknown)`}],e[16]=s.kind,e[17]=I,e[18]=w):w=e[18],g=[...$.map(Zo),...w],e[11]=s.kind,e[12]=p,e[13]=b,e[14]=g,e[15]=y}else p=e[12],b=e[13],g=e[14],y=e[15];let j;e[19]!==a||e[20]!==i?(j=$=>i.updateReference(a,{kind:$}),e[19]=a,e[20]=i,e[21]=j):j=e[21];let k;e[22]!==p||e[23]!==s.kind||e[24]!==g||e[25]!==j?(k=n.jsx(p,{options:g,value:s.kind,ariaLabel:"Transition",onChange:j}),e[22]=p,e[23]=s.kind,e[24]=g,e[25]=j,e[26]=k):k=e[26];let x;e[27]!==b||e[28]!==y||e[29]!==k?(x=n.jsx(b,{label:y,children:k}),e[27]=b,e[28]=y,e[29]=k,e[30]=x):x=e[30];const S=s.durationFrames??Number.NaN;let v;e[31]!==a||e[32]!==i?(v=$=>{const I=Ke($,1);I!==null&&i.updateReference(a,{durationFrames:I})},e[31]=a,e[32]=i,e[33]=v):v=e[33];let C;e[34]!==f.end||e[35]!==f.move||e[36]!==f.start||e[37]!==S||e[38]!==v?(C=n.jsx(xe,{children:n.jsx(wt,{value:"compact",children:n.jsx(Ue,{value:S,label:"Length",ariaLabel:"Length, transition frames",min:1,step:1,unit:"f",onCommit:v,onScrubStart:f.start,onScrub:f.move,onScrubEnd:f.end})})}),e[34]=f.end,e[35]=f.move,e[36]=f.start,e[37]=S,e[38]=v,e[39]=C):C=e[39];let E;return e[40]!==C||e[41]!==x?(E=n.jsxs(n.Fragment,{children:[x,C]}),e[40]=C,e[41]=x,e[42]=E):E=e[42],E}case"sound":{const p=s.asset===void 0?void 0:l.assets[s.asset];let b;e[43]!==a||e[44]!==i?(b=O=>{d(!0),i.setSoundFile(a,O).finally(()=>d(!1))},e[43]=a,e[44]=i,e[45]=b):b=e[45];const g=b;let y;e[46]===Symbol.for("react.memo_cache_sentinel")?(y=Nl.map(Go),e[46]=y):y=e[46];let j;e[47]!==a||e[48]!==i?(j=O=>i.updateReference(a,{role:O}),e[47]=a,e[48]=i,e[49]=j):j=e[49];let k;e[50]!==s.role||e[51]!==j?(k=n.jsx(xe,{label:"Role",children:n.jsx(Le,{options:y,value:s.role,ariaLabel:"Role",onChange:j})}),e[50]=s.role,e[51]=j,e[52]=k):k=e[52];const x=p?.path;let S;e[53]!==p||e[54]!==s.asset?(S=s.asset===void 0?"No file yet":p===void 0?"File missing":p.path.replace(/^[0-9a-f]{8}-/u,""),e[53]=p,e[54]=s.asset,e[55]=S):S=e[55];let v;e[56]!==x||e[57]!==S?(v=n.jsx("span",{className:"insp-dim is-text",title:x,children:S}),e[56]=x,e[57]=S,e[58]=v):v=e[58];const C=o||c;let E;e[59]===Symbol.for("react.memo_cache_sentinel")?(E=()=>r.current?.click(),e[59]=E):E=e[59];const $=s.asset===void 0?"Choose file…":"Replace…";let I;e[60]!==C||e[61]!==$?(I=n.jsx("button",{type:"button",className:"btn",disabled:C,onClick:E,children:$}),e[60]=C,e[61]=$,e[62]=I):I=e[62];let w;e[63]!==a||e[64]!==s.asset||e[65]!==c||e[66]!==i?(w=s.asset===void 0?null:n.jsx("button",{type:"button",className:"btn",disabled:c,title:"Back to a named need: the card keeps its role and loses its file and hit",onClick:()=>i.updateReference(a,{asset:null}),children:"Clear"}),e[63]=a,e[64]=s.asset,e[65]=c,e[66]=i,e[67]=w):w=e[67];let T;e[68]!==g?(T=n.jsx("input",{ref:r,type:"file",hidden:!0,accept:xs,onChange:O=>{const L=O.currentTarget.files?.[0];O.currentTarget.value="",L!==void 0&&g(L)}}),e[68]=g,e[69]=T):T=e[69];let D;e[70]!==I||e[71]!==w||e[72]!==T||e[73]!==v?(D=n.jsxs(xe,{label:"File",className:"insp-file-row",children:[v,I,w,T]}),e[70]=I,e[71]=w,e[72]=T,e[73]=v,e[74]=D):D=e[74];let F;e[75]!==h||e[76]!==a||e[77]!==s.asset||e[78]!==s.hitMs||e[79]!==i?(F=s.asset===void 0?null:n.jsx(xe,{children:n.jsx(wt,{value:"compact",children:n.jsx(Ue,{value:s.hitMs??0,label:"Hit",ariaLabel:"Hit, where the sound lands in milliseconds",min:0,step:10,unit:"ms",onCommit:O=>{const L=Ke(O,0);L!==null&&i.updateReference(a,{hitMs:L===0?null:L})},onScrubStart:h.start,onScrub:h.move,onScrubEnd:h.end})})}),e[75]=h,e[76]=a,e[77]=s.asset,e[78]=s.hitMs,e[79]=i,e[80]=F):F=e[80];let P;return e[81]!==D||e[82]!==F||e[83]!==k?(P=n.jsxs(n.Fragment,{children:[k,D,F]}),e[81]=D,e[82]=F,e[83]=k,e[84]=P):P=e[84],P}case"native":{const p=s.kind==="mesh"?jl:s.kind==="device"?Sl:null;let b;e[85]===Symbol.for("react.memo_cache_sentinel")?(b=vl.map(qo),e[85]=b):b=e[85];let g;e[86]!==a||e[87]!==s.kind||e[88]!==i?(g=x=>{x!==s.kind&&i.updateReference(a,{kind:x,variant:null})},e[86]=a,e[87]=s.kind,e[88]=i,e[89]=g):g=e[89];let y;e[90]!==s.kind||e[91]!==g?(y=n.jsx(xe,{label:"Kind",children:n.jsx(lt,{options:b,value:s.kind,ariaLabel:"Layer kind",onChange:g})}),e[90]=s.kind,e[91]=g,e[92]=y):y=e[92];let j;e[93]!==a||e[94]!==s.kind||e[95]!==s.variant||e[96]!==i||e[97]!==p?(j=p===null?null:n.jsx(xe,{label:s.kind==="mesh"?"Shape":"Device",children:n.jsx(lt,{options:[{value:"",label:"Default"},...p.map(Yo)],value:s.variant??"",ariaLabel:"Variant",placeholder:"Default",onChange:x=>i.updateReference(a,{variant:x===""?null:x})})}),e[93]=a,e[94]=s.kind,e[95]=s.variant,e[96]=i,e[97]=p,e[98]=j):j=e[98];let k;return e[99]!==y||e[100]!==j?(k=n.jsxs(n.Fragment,{children:[y,j]}),e[99]=y,e[100]=j,e[101]=k):k=e[101],k}default:return null}}function Yo(t){return{value:t,label:Yt(t)}}function qo(t){return{value:t,label:t==="html"?"Html snippet":Yt(t)}}function Go(t){return{value:t,label:t==="sfx"?"Effect":Yt(t)}}function Zo(t){return{value:t.id,label:t.label}}export{sr as ComponentSheet,nr as PlanOccupant,lr as SketchInspector,ar as StoryboardReferenceSection,tr as StoryboardView};
@@ -0,0 +1 @@
1
+ import{w as P,C as Q,a as W,S as G}from"./ComponentLibraryRail-Ch_dsAru.js";import{b as We}from"./ComponentLibraryRail-Ch_dsAru.js";import{u as k,A as N,al as q,B as w,br as J,bs as Y,v as n,aq as I,am as z,an as V,ao as Z,bt as X,q as p,at as K,au as T,bu as ee,bv as H,bw as te,bx as ne,by as se,bz as le,bA as oe,bB as ae,bC as ie,L as ce,bD as re,bE as de,bF as me,bG as ue,bH as he,bI as fe,w as ye,ag as R,bJ as be,ah as je,ai as ve}from"./index-BGHQGV5z.js";import{C as xe}from"./ComponentStage-BRhRotyH.js";function B(t,e){const l=N(c=>c.library),s=N(c=>c.workspaceComponents),m=N(c=>c.componentHomes),r=w.useMemo(()=>z(t,l),[t,l]),a=w.useMemo(()=>V(t,l,s,m,r),[t,l,s,m,r]),h=e.trim().toLowerCase(),i=c=>h.length===0||c.toLowerCase().includes(h);return{project:r.filter(c=>i(c.name)),library:a.filter(c=>i(Z(c))),projectCount:r.length,libraryCount:a.length}}function Ne(t){const e=k(),l=N(o=>o.readOnly),{guard:s,dialog:m}=q(),r=B(t.doc,t.query),a=w.useMemo(()=>J(t.doc),[t.doc]),h=o=>a.filter(d=>o.sel.kind==="studio"?d.def===o.sel.def:d.component===o.sel.module).length,i=t.query.trim().length>0,c=Y(),u=N(o=>o.library),f=o=>{const d=o===null?null:u.find(y=>y.id===o)?.rel??null;return X(c,d,o)?.name??null};return w.useEffect(()=>{e.refreshWorkspaceComponents()},[e]),n.jsxs("div",{className:"components-home","data-testid":"components-home",children:[m,n.jsxs("section",{className:"components-home-section","aria-label":"This project",children:[n.jsx("h2",{className:"components-section-title",children:"This project"}),n.jsxs("div",{className:"components-home-grid","data-testid":"components-home-project",children:[r.project.map(o=>{const d=o.sel,y=h(o),b=f(d.kind==="code"?d.module:null);return n.jsx(U,{kind:d.kind,name:o.name,writer:b,where:o.refusal??(b!==null?`${b} is writing it`:y===0?"Not used yet":`Used in ${y} ${y===1?"place":"places"}`),title:o.refusal??`Open ${o.name}`,refused:o.refusal!==null,stage:j=>o.refusal===null?n.jsx(we,{doc:t.doc,row:o,live:j}):null,onOpen:()=>{if(o.refusal!==null){e.reportError(o.refusal);return}e.selectComponent(d)}},d.kind==="studio"?d.def:d.module)}),i?null:n.jsx(pe,{readOnly:l})]}),i&&r.project.length===0?n.jsxs("p",{className:"insp-empty",children:["No component in this project matches “",t.query.trim(),"”."]}):null]}),n.jsxs("section",{className:"components-home-section","aria-label":"Your library",children:[n.jsx("h2",{className:"components-section-title",children:"Your library"}),r.library.length===0?n.jsx("p",{className:"insp-empty",children:i?`No component in your library matches “${t.query.trim()}”.`:"Code made for no Project, Dailies Library installs and components you add to your library show here."}):n.jsx("div",{className:"components-home-grid","data-testid":"components-home-library",children:r.library.map(o=>{if(o.kind==="studio"){const b=o.component;return n.jsx(U,{kind:"studio",name:b.name,where:I(o),title:P(o),refused:!1,stage:()=>null,onOpen:()=>{l||s(()=>void e.addLibraryComponent(b.id))}},b.id)}const{module:d,refusal:y}=o;return n.jsx(U,{kind:"code",name:o.name,where:I(o),title:y??P(o),refused:y!==null,stage:b=>y===null?n.jsx(Ce,{doc:t.doc,module:d,name:o.name,live:b}):null,onOpen:()=>{if(y!==null){e.reportError(y);return}s(()=>void e.openCodeComponent(d))}},d)})})]})]})}function U(t){const e=p.c(34),[l,s]=w.useState(!1);let m;e[0]!==t.kind?(m=t.kind==="code"?n.jsx(T,{}):K,e[0]=t.kind,e[1]=m):m=e[1];let r;e[2]!==m?(r=n.jsx("span",{className:"components-home-icon","aria-hidden":"true",children:m}),e[2]=m,e[3]=r):r=e[3];const a=r,h=t.refused||void 0;let i,c,u,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=()=>s(!0),c=()=>s(!1),u=()=>s(!0),f=()=>s(!1),e[4]=i,e[5]=c,e[6]=u,e[7]=f):(i=e[4],c=e[5],u=e[6],f=e[7]);let o;e[8]!==l||e[9]!==a||e[10]!==t.stage?(o=t.stage(l)??a,e[8]=l,e[9]=a,e[10]=t.stage,e[11]=o):o=e[11];let d;e[12]!==o?(d=n.jsx("span",{className:"components-home-poster",children:o}),e[12]=o,e[13]=d):d=e[13];let y;e[14]!==t.name?(y=n.jsx("span",{className:"components-home-name",children:t.name}),e[14]=t.name,e[15]=y):y=e[15];let b;e[16]!==t.name||e[17]!==t.writer?(b=t.writer===null||t.writer===void 0?null:n.jsx(ee,{label:`${t.writer} is writing ${t.name}`}),e[16]=t.name,e[17]=t.writer,e[18]=b):b=e[18];const j=t.kind==="code"?"CODE":"3D";let v;e[19]!==j?(v=n.jsx("span",{className:"components-item-kind",children:j}),e[19]=j,e[20]=v):v=e[20];let x;e[21]!==b||e[22]!==v||e[23]!==y?(x=n.jsxs("span",{className:"components-home-foot",children:[y,b,v]}),e[21]=b,e[22]=v,e[23]=y,e[24]=x):x=e[24];let g;e[25]!==t.where?(g=n.jsx("span",{className:"components-home-where",children:t.where}),e[25]=t.where,e[26]=g):g=e[26];let C;return e[27]!==t.onOpen||e[28]!==t.title||e[29]!==x||e[30]!==g||e[31]!==h||e[32]!==d?(C=n.jsxs("button",{type:"button",className:"components-home-card","data-testid":"components-home-card","aria-disabled":h,title:t.title,onClick:t.onOpen,onPointerEnter:i,onPointerLeave:c,onFocus:u,onBlur:f,children:[d,x,g]}),e[27]=t.onOpen,e[28]=t.title,e[29]=x,e[30]=g,e[31]=h,e[32]=d,e[33]=C):C=e[33],C}function we(t){const e=p.c(10),{sel:l,name:s}=t.row,m=l.kind==="code"?l.module:null;let r,a;e[0]!==s||e[1]!==l.def||e[2]!==l.kind||e[3]!==l.module?(a=l.kind==="studio"?{type:"component",id:`home:${l.def}`,label:s,def:l.def,props:{}}:{type:"component",id:`home:${l.module}`,label:s,component:l.module,props:{}},e[0]=s,e[1]=l.def,e[2]=l.kind,e[3]=l.module,e[4]=a):a=e[4],r=a;const h=r;let i;return e[5]!==h||e[6]!==m||e[7]!==t.doc||e[8]!==t.live?(i=n.jsx(D,{doc:t.doc,item:h,module:m,live:t.live}),e[5]=h,e[6]=m,e[7]=t.doc,e[8]=t.live,e[9]=i):i=e[9],i}function Ce(t){const e=p.c(10),{module:l,name:s}=t;let m;const r=`home:${l}`;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let h;e[1]!==l||e[2]!==s||e[3]!==r?(h={type:"component",id:r,label:s,component:l,props:a},e[1]=l,e[2]=s,e[3]=r,e[4]=h):h=e[4],m=h;const i=m;let c;return e[5]!==i||e[6]!==l||e[7]!==t.doc||e[8]!==t.live?(c=n.jsx(D,{doc:t.doc,item:i,module:l,live:t.live}),e[5]=i,e[6]=l,e[7]=t.doc,e[8]=t.live,e[9]=c):c=e[9],c}function D(t){const e=p.c(23),l=k(),{module:s,live:m}=t;let r;e[0]!==s?(r=v=>s===null?void 0:v.library.find(x=>x.id===s),e[0]=s,e[1]=r):r=e[1];const a=N(r);let h;e[2]!==s?(h=v=>s===null?void 0:v.contracts[s],e[2]=s,e[3]=h):h=e[3];const i=N(h);let c;e[4]!==s?(c=v=>s===null?void 0:v.libraryCatalog.find(x=>x.installedAs===s)?.lengthFrames,e[4]=s,e[5]=c):c=e[5];const u=N(c);let f,o;if(e[6]!==m||e[7]!==s||e[8]!==l?(f=()=>{m&&s!==null&&l.loadContract(s)},o=[m,s,l],e[6]=m,e[7]=s,e[8]=l,e[9]=f,e[10]=o):(f=e[9],o=e[10]),w.useEffect(f,o),s!==null&&a?.host!=="three")return null;const d=a?.contractAvailability;let y;e[11]!==s?(y=s===null?K:n.jsx(T,{}),e[11]=s,e[12]=y):y=e[12];let b;e[13]!==y?(b=n.jsx("span",{className:"components-home-icon","aria-hidden":"true",children:y}),e[13]=y,e[14]=b):b=e[14];let j;return e[15]!==i||e[16]!==u||e[17]!==m||e[18]!==t.doc||e[19]!==t.item||e[20]!==d||e[21]!==b?(j=n.jsx(xe,{doc:t.doc,item:t.item,contract:i,availability:d,lengthFrames:u,live:m,fallback:b}),e[15]=i,e[16]=u,e[17]=m,e[18]=t.doc,e[19]=t.item,e[20]=d,e[21]=b,e[22]=j):j=e[22],j}function pe(t){const e=p.c(20),l=k(),{guard:s,dialog:m}=q();let r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{className:"components-home-new-title",children:"New component"}),a=n.jsx("span",{className:"components-home-where",children:"Studio-made or code"}),e[0]=r,e[1]=a):(r=e[0],a=e[1]);let h;e[2]!==s||e[3]!==l?(h=()=>s(()=>l.createEmptyComponent("Component")),e[2]=s,e[3]=l,e[4]=h):h=e[4];let i;e[5]!==t.readOnly||e[6]!==h?(i=n.jsx("button",{type:"button",className:"btn","data-testid":"components-home-new-studio",disabled:t.readOnly,title:"A Studio-made component, built from layers",onClick:h,children:"Studio-made"}),e[5]=t.readOnly,e[6]=h,e[7]=i):i=e[7];let c;e[8]!==s||e[9]!==l?(c=()=>s(()=>void l.newCodeComponent("Component")),e[8]=s,e[9]=l,e[10]=c):c=e[10];let u;e[11]!==t.readOnly||e[12]!==c?(u=n.jsx("button",{type:"button",className:"btn","data-testid":"components-home-new-code",disabled:t.readOnly,title:"A code component from the three starter",onClick:c,children:"Code"}),e[11]=t.readOnly,e[12]=c,e[13]=u):u=e[13];let f;e[14]!==i||e[15]!==u?(f=n.jsxs("span",{className:"components-home-new-verbs",children:[i,u]}),e[14]=i,e[15]=u,e[16]=f):f=e[16];let o;return e[17]!==m||e[18]!==f?(o=n.jsxs("div",{className:"components-home-card is-new","data-testid":"components-home-new",children:[m,r,a,f]}),e[17]=m,e[18]=f,e[19]=o):o=e[19],o}function F(t){const e=p.c(7);if(t.use.overrides.length===0){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{className:"every-use-nochange",children:"No changes"}),e[0]=r):r=e[0],r}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("span",{className:"use-dot","aria-hidden":"true"}),e[1]=l):l=e[1];let s;e[2]!==t.labelOf||e[3]!==t.use?(s=de(t.use,t.labelOf),e[2]=t.labelOf,e[3]=t.use,e[4]=s):s=e[4];let m;return e[5]!==s?(m=n.jsxs("span",{className:"use-chip","data-testid":"every-use-changes",children:[l,s]}),e[5]=s,e[6]=m):m=e[6],m}function ge(){const t=k(),e=N(d=>d.doc),l=N(d=>d.contracts),s=N(H),m=te(),r=ne(),a=s?.subject??null,h=w.useMemo(()=>e===null||a===null?[]:se(e,a,l),[e,a,l]),i=a?.kind==="code"?a.module:null;if(w.useEffect(()=>{i!==null&&t.loadContract(i)},[t,i]),e===null||s===null||a===null)return null;const c=a.kind==="studio"?{def:a.def}:{component:a.module},u=d=>ae(e,l,c,d),f=h.length+r.length,o=a.kind==="code"?"All on the latest build · code edits reach them live":m===void 0?"Master edits reach them live":`Master v${m.version} · edits reach this Project live, other Projects through Update available`;return n.jsxs("div",{className:"every-use","data-testid":"every-use",children:[n.jsxs("div",{className:"every-use-head",children:[n.jsxs("h3",{className:"every-use-caps","data-testid":"every-use-count",children:["Used in ",f," ",f===1?"place":"places"]}),n.jsx("span",{className:"every-use-note",children:o})]}),f===0?n.jsx("p",{className:"every-use-empty","data-testid":"every-use-empty",children:"Not used anywhere yet. Add it to the storyboard or use it in a shot."}):n.jsxs("ul",{className:"every-use-list","data-testid":"every-use-list",children:[h.map(d=>{const y=le(d);return n.jsx(ke,{useKey:y,use:d,text:oe(e,d),selected:s.use===y,labelOf:u},y)}),r.map((d,y)=>n.jsx(Oe,{use:d,labelOf:u},`${d.projectId}:${d.layerId??d.referenceId??y}`))]}),a.kind==="studio"&&m!==void 0?n.jsx(Se,{subject:a,row:m}):null]})}function ke(t){const e=p.c(36),l=k(),{text:s}=t,m=`every-use-row${t.selected?" is-selected":""}`;let r;e[0]!==t.selected||e[1]!==t.useKey||e[2]!==l?(r=()=>l.selectComponentUse(t.selected?null:t.useKey),e[0]=t.selected,e[1]=t.useKey,e[2]=l,e[3]=r):r=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("span",{className:"every-use-thumb","aria-hidden":"true"}),e[4]=a):a=e[4];let h;e[5]!==s.kind?(h=n.jsx("span",{className:"every-use-kind",children:s.kind}),e[5]=s.kind,e[6]=h):h=e[6];let i;e[7]!==s.title?(i=n.jsx("span",{className:"every-use-title",children:s.title}),e[7]=s.title,e[8]=i):i=e[8];let c;e[9]!==h||e[10]!==i?(c=n.jsxs("span",{className:"every-use-line",children:[h,i]}),e[9]=h,e[10]=i,e[11]=c):c=e[11];let u;e[12]!==s.location?(u=n.jsx("span",{className:"every-use-location",children:s.location}),e[12]=s.location,e[13]=u):u=e[13];let f;e[14]!==c||e[15]!==u?(f=n.jsxs("span",{className:"every-use-text",children:[c,u]}),e[14]=c,e[15]=u,e[16]=f):f=e[16];let o;e[17]!==t.labelOf||e[18]!==t.use?(o=n.jsx(F,{use:t.use,labelOf:t.labelOf}),e[17]=t.labelOf,e[18]=t.use,e[19]=o):o=e[19];let d;e[20]!==t.selected||e[21]!==r||e[22]!==f||e[23]!==o?(d=n.jsxs("button",{type:"button",className:"every-use-pick","data-testid":"every-use-pick","aria-pressed":t.selected,onClick:r,children:[a,f,o]}),e[20]=t.selected,e[21]=r,e[22]=f,e[23]=o,e[24]=d):d=e[24];const y=s.kind==="BOARD"?"Open it on the Storyboard":"Open it in the Studio, selected";let b;e[25]!==t.useKey||e[26]!==l?(b=()=>l.goToComponentUse(t.useKey),e[25]=t.useKey,e[26]=l,e[27]=b):b=e[27];let j;e[28]!==y||e[29]!==b?(j=n.jsx("button",{type:"button",className:"every-use-go","data-testid":"every-use-go",title:y,onClick:b,children:"Go to"}),e[28]=y,e[29]=b,e[30]=j):j=e[30];let v;return e[31]!==t.useKey||e[32]!==m||e[33]!==j||e[34]!==d?(v=n.jsxs("li",{className:m,"data-testid":"every-use-row","data-use":t.useKey,children:[d,j]}),e[31]=t.useKey,e[32]=m,e[33]=j,e[34]=d,e[35]=v):v=e[35],v}function Oe(t){const e=p.c(19),l=k(),{use:s}=t,m=s.kind==="card"?s.referenceName??"Storyboard":s.sceneName??s.layerName??"a component",r=`Open ${s.projectName}`;let a;e[0]!==l||e[1]!==s.projectName?(a=()=>me(l,ue(s.projectName)),e[0]=l,e[1]=s.projectName,e[2]=a):a=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"every-use-thumb","aria-hidden":"true"}),e[3]=h):h=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("span",{className:"every-use-kind",children:"PROJECT"}),e[4]=i):i=e[4];let c;e[5]!==s.projectName||e[6]!==m?(c=n.jsxs("span",{className:"every-use-line",children:[i,n.jsxs("span",{className:"every-use-title",children:[s.projectName," · ",m]})]}),e[5]=s.projectName,e[6]=m,e[7]=c):c=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx("span",{className:"every-use-location",children:"Another Project · same master"}),e[8]=u):u=e[8];let f;e[9]!==c?(f=n.jsxs("span",{className:"every-use-text",children:[c,u]}),e[9]=c,e[10]=f):f=e[10];let o;e[11]!==t.labelOf||e[12]!==s?(o=n.jsx(F,{use:s,labelOf:t.labelOf}),e[11]=t.labelOf,e[12]=s,e[13]=o):o=e[13];let d;return e[14]!==r||e[15]!==a||e[16]!==f||e[17]!==o?(d=n.jsx("li",{className:"every-use-row","data-testid":"every-use-other",children:n.jsxs("button",{type:"button",className:"every-use-pick",title:r,onClick:a,children:[h,f,o]})}),e[14]=r,e[15]=a,e[16]=f,e[17]=o,e[18]=d):d=e[18],d}function Se(t){const e=p.c(18),l=ie(),[s,m]=w.useState(null),r=t.row.id;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=ce(),e[0]=a):a=e[0];const h=a;let i,c;e[1]!==r?(i=()=>{if(!h)return;let v;return v=!0,he(r).then(x=>{v&&m({id:r,listing:x})},$e),()=>{v=!1}},c=[h,r],e[1]=r,e[2]=i,e[3]=c):(i=e[2],c=e[3]),w.useEffect(i,c);const u=s!==null&&s.id===r?s.listing:null;if(u===null||u.version===null)return null;const f=t.row.version>u.version;let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("h3",{className:"every-use-caps",children:"Community copies"}),e[4]=o):o=e[4];let d;e[5]!==u?(d=re(u)??`Nobody has added v${u.version} yet`,e[5]=u,e[6]=d):d=e[6];let y;e[7]!==d?(y=n.jsxs("div",{className:"every-use-head",children:[o,n.jsx("span",{className:"every-use-note","data-testid":"every-use-added",children:d})]}),e[7]=d,e[8]=y):y=e[8];let b;e[9]!==f||e[10]!==l?.name||e[11]!==u.name||e[12]!==u.version||e[13]!==t.row.version?(b=f?n.jsxs("div",{className:"every-use-preview","data-testid":"every-use-preview",children:[n.jsxs("span",{className:"every-use-note",children:["What they see after you publish v",t.row.version]}),n.jsxs("div",{className:"every-use-row is-preview",children:[n.jsx("span",{className:"every-use-tile","aria-hidden":"true"}),n.jsxs("span",{className:"every-use-text",children:[n.jsxs("span",{className:"every-use-title",children:[u.name," · v",u.version]}),n.jsxs("span",{className:"every-use-location",children:["by ",l?.name??"you"," · from Community"]})]}),n.jsxs("span",{className:"use-chip",children:["Update available · v",t.row.version]}),n.jsx("span",{className:"use-update-button is-picture","aria-hidden":"true",children:"Update"})]}),n.jsxs("p",{className:"every-use-help",children:["Their prop changes carry over. If v",t.row.version," removes a prop they changed, Update shows it before applying."]})]}):null,e[9]=f,e[10]=l?.name,e[11]=u.name,e[12]=u.version,e[13]=t.row.version,e[14]=b):b=e[14];let j;return e[15]!==y||e[16]!==b?(j=n.jsxs("section",{className:"every-use-community","data-testid":"every-use-community","aria-label":"Community copies",children:[y,b]}),e[15]=y,e[16]=b,e[17]=j):j=e[17],j}function $e(){}function Fe(){const t=p.c(40),e=k(),l=N(qe),s=N(Ue),m=N(Re),r=N(Le),a=N(Ae),h=N(_e),{guard:i,dialog:c}=q(),[u,f]=w.useState(""),o=N(Ee),d=w.useRef(null);let y,b;if(t[0]!==o||t[1]!==i||t[2]!==h||t[3]!==e?(y=()=>{o!==d.current&&(d.current=o,!(!h||o===null||e.getState().codeComponent===null)&&i(()=>e.getState().componentsOrigin!==null?void e.backToShot():e.leaveComponents()))},b=[h,o,i,e],t[0]=o,t[1]=i,t[2]=h,t[3]=e,t[4]=y,t[5]=b):(y=t[4],b=t[5]),w.useEffect(y,b),!h||l===null)return null;const j=s===null?void 0:l.components?.[s];let v;t[6]!==m||t[7]!==j?(v=m!==null?{kind:"code",module:m}:j!==void 0?{kind:"studio",def:j.id}:null,t[6]=m,t[7]=j,t[8]=v):v=t[8];const x=v;let g;t[9]!==m||t[10]!==j?.name||t[11]!==r?(g=m!==null?r.find(M=>M.id===m)?.name??fe(m):j?.name??"Components",t[9]=m,t[10]=j?.name,t[11]=r,t[12]=g):g=t[12];const C=g;let O;t[13]!==l||t[14]!==u||t[15]!==x?(O=n.jsx(R,{name:"left",children:n.jsx(Q,{doc:l,current:x,query:u,onQuery:f})}),t[13]=l,t[14]=u,t[15]=x,t[16]=O):O=t[16];let S;t[17]!==l||t[18]!==u||t[19]!==x||t[20]!==a?(S=n.jsx(R,{name:"centre",children:x===null?n.jsx(Ne,{doc:l,query:u}):a?n.jsx(ge,{}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"stage-window components-preview-hole","aria-hidden":"true","data-testid":"components-preview-hole"}),n.jsx(be,{})]})}),t[17]=l,t[18]=u,t[19]=x,t[20]=a,t[21]=S):S=t[21];let $;t[22]!==i?($=n.jsx(je,{testId:"components-back",guard:i}),t[22]=i,t[23]=$):$=t[23];let E;t[24]!==C||t[25]!==u||t[26]!==x?(E=x===null?n.jsx(Pe,{query:u,onQuery:f}):n.jsx(ve,{sel:x,name:n.jsx("span",{className:"component-studio-name is-label",title:C,children:C})}),t[24]=C,t[25]=u,t[26]=x,t[27]=E):E=t[27];let _;t[28]!==x?(_=x===null?null:n.jsxs("div",{className:"component-studio-tools",children:[n.jsx(W,{}),n.jsx(G,{})]}),t[28]=x,t[29]=_):_=t[29];let A;t[30]!==C||t[31]!==$||t[32]!==E||t[33]!==_?(A=n.jsx(R,{name:"bar",children:n.jsxs("div",{className:"component-studio-bar",role:"group","aria-label":C,"data-testid":"components-preview",children:[$,E,_]})}),t[30]=C,t[31]=$,t[32]=E,t[33]=_,t[34]=A):A=t[34];let L;return t[35]!==c||t[36]!==O||t[37]!==S||t[38]!==A?(L=n.jsxs(n.Fragment,{children:[c,O,S,A]}),t[35]=c,t[36]=O,t[37]=S,t[38]=A,t[39]=L):L=t[39],L}function Ee(t){return t.codeBackRequest}function _e(t){return ye(t)==="components"&&(t.componentsTab==="preview"||t.codeComponent===null&&t.editingDef===null)}function Ae(t){return H(t)!==null}function Le(t){return t.library}function Re(t){return t.codeComponent}function Ue(t){return t.editingDef}function qe(t){return t.doc}function Pe(t){const e=p.c(19),l=k(),s=N(Ke),m=N(Ie);if(s===null)return null;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("span",{className:"component-studio-name is-label",children:"All components"}),e[0]=r):r=e[0];let a;e[1]!==s?(a=n.jsx(Te,{doc:s}),e[1]=s,e[2]=a):a=e[2];let h;e[3]!==t?(h=d=>t.onQuery(d.target.value),e[3]=t,e[4]=h):h=e[4];let i;e[5]!==t.query||e[6]!==h?(i=n.jsx("label",{className:"components-home-search",children:n.jsx("input",{type:"search",value:t.query,placeholder:"Search components","aria-label":"Search components","data-testid":"components-home-search",onChange:h})}),e[5]=t.query,e[6]=h,e[7]=i):i=e[7];let c;e[8]!==l?(c=()=>l.createEmptyComponent("Component"),e[8]=l,e[9]=c):c=e[9];let u;e[10]!==m||e[11]!==c?(u=n.jsx("button",{type:"button",className:"btn is-primary","data-testid":"components-new",disabled:m,title:"A new Studio-made component, opened here",onClick:c,children:"+ New component"}),e[10]=m,e[11]=c,e[12]=u):u=e[12];let f;e[13]!==i||e[14]!==u?(f=n.jsxs("div",{className:"component-studio-tools",children:[i,u]}),e[13]=i,e[14]=u,e[15]=f):f=e[15];let o;return e[16]!==a||e[17]!==f?(o=n.jsxs(n.Fragment,{children:[r,a,f]}),e[16]=a,e[17]=f,e[18]=o):o=e[18],o}function Ie(t){return t.readOnly}function Ke(t){return t.doc}function Te(t){const e=p.c(3),l=B(t.doc,"");let s;return e[0]!==l.libraryCount||e[1]!==l.projectCount?(s=n.jsxs("span",{className:"components-home-counts","data-testid":"components-home-counts",children:[l.projectCount," in this project · ",l.libraryCount," in your library"]}),e[0]=l.libraryCount,e[1]=l.projectCount,e[2]=s):s=e[2],s}export{We as ComponentStudio,Fe as ComponentsPreview};