@p4code/cli 0.8.16 → 0.8.18

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 (295) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-CI34F60b.mjs → binCli-usgrWcNe.mjs} +150 -43
  3. package/dist/client/.vite/manifest.json +2143 -2143
  4. package/dist/client/assets/AlertDialogRoot-D6ed6zQR.js +2 -0
  5. package/dist/client/assets/{AnimatedHeight-CzFc8xri.js → AnimatedHeight-CO3_zEQw.js} +2 -2
  6. package/dist/client/assets/{AuthSurfaceShell-BIM2_E9K.js → AuthSurfaceShell-BBPbK1uA.js} +2 -2
  7. package/dist/client/assets/{CSPContext-DcW0os5z.js → CSPContext-D8znCJtI.js} +2 -2
  8. package/dist/client/assets/{ChatGptUsageButton-D6bmo65C.js → ChatGptUsageButton-Bda8Ir5S.js} +2 -2
  9. package/dist/client/assets/{ChatMarkdown-CjusdpPE.js → ChatMarkdown-BS1t8pnS.js} +4 -4
  10. package/dist/client/assets/{CheckboxIndicator-DRAilQdq.js → CheckboxIndicator-D-KUEtIm.js} +2 -2
  11. package/dist/client/assets/{CodexSetupSection.logic-CSXvl05k.js → CodexSetupSection.logic-Ed9SDkqP.js} +2 -2
  12. package/dist/client/assets/{CollapsiblePanel-DMH4QH0_.js → CollapsiblePanel-84e9KCIs.js} +2 -2
  13. package/dist/client/assets/{ComboboxClear-DV4ygCOL.js → ComboboxClear-FsZ2LcVw.js} +2 -2
  14. package/dist/client/assets/{CommandBlock-DVrmnpxz.js → CommandBlock-C7ASE_F_.js} +2 -2
  15. package/dist/client/assets/{ComposerPromptEditor-CvJcJEtN.js → ComposerPromptEditor-BGcYrFoa.js} +4 -4
  16. package/dist/client/assets/{CompositeRoot-CsrLt1o5.js → CompositeRoot-fbPbFqqK.js} +2 -2
  17. package/dist/client/assets/{ConnectionStatusDot-uWbIqk3l.js → ConnectionStatusDot-t_vHmaco.js} +2 -2
  18. package/dist/client/assets/{DevicePanel-Bf1rvcrw.js → DevicePanel-CS1FTu-C.js} +2 -2
  19. package/dist/client/assets/{DeviceSetup-CX-B4Xfz.js → DeviceSetup-DZAK0_tm.js} +2 -2
  20. package/dist/client/assets/{DialogTitle-BgclXafx.js → DialogTitle-DnR18OB7.js} +2 -2
  21. package/dist/client/assets/{DiffCommentAnnotation-CKRC0OaV.js → DiffCommentAnnotation-Br9sOo_6.js} +2 -2
  22. package/dist/client/assets/{DiffFileTree-xeoOBCTn.js → DiffFileTree-DkLJXYZf.js} +2 -2
  23. package/dist/client/assets/{DiffPanel-CzkU9nAC.js → DiffPanel-CGV12wM6.js} +2 -2
  24. package/dist/client/assets/{DiffWorkerPoolProvider-NaKmpbcL.js → DiffWorkerPoolProvider-DydpPFgM.js} +2 -2
  25. package/dist/client/assets/{EmbeddedDesign-hjnHhasg.js → EmbeddedDesign--Xz14U92.js} +2 -2
  26. package/dist/client/assets/{EnvironmentMachineIcon-Czk_PJpp.js → EnvironmentMachineIcon-BMWCDR69.js} +2 -2
  27. package/dist/client/assets/{ExpandableText-Ggw0uVXl.js → ExpandableText-B6Dvgn62.js} +2 -2
  28. package/dist/client/assets/{FieldControl-Bw2_eFMa.js → FieldControl-CVOjReHh.js} +2 -2
  29. package/dist/client/assets/{FileDiff-VvQl3KAm.js → FileDiff-Dhyt7ZAJ.js} +2 -2
  30. package/dist/client/assets/{FilePreviewPanel-DpzZ6qxm.js → FilePreviewPanel-8tUtMikb.js} +2 -2
  31. package/dist/client/assets/{FoldedSettingsSection-BFkFGK44.js → FoldedSettingsSection-Clo0JgyS.js} +2 -2
  32. package/dist/client/assets/{FormContext-7fCTOXXA.js → FormContext--axmNCbu.js} +2 -2
  33. package/dist/client/assets/{Icons-CSAp87pJ.js → Icons-BYSK3arN.js} +2 -2
  34. package/dist/client/assets/Input-CVwvVqbx.js +2 -0
  35. package/dist/client/assets/{KeybindingsSettings.logic-CsSjvH9c.js → KeybindingsSettings.logic-30fwcukL.js} +2 -2
  36. package/dist/client/assets/{NoProjectsHero--g3-0FUP.js → NoProjectsHero-Lsb9cuvO.js} +2 -2
  37. package/dist/client/assets/{PanelLayoutControls-BxdDsUL3.js → PanelLayoutControls-DL7sleZ-.js} +4 -4
  38. package/dist/client/assets/{PierreEntryIcon-B-E3YaL1.js → PierreEntryIcon-DKHnMJOl.js} +2 -2
  39. package/dist/client/assets/{PopoverHandle-BkhR-kKK.js → PopoverHandle-C-e81PS3.js} +2 -2
  40. package/dist/client/assets/{PreviewPanel-VoVAdWRz.js → PreviewPanel-DmaoFTEA.js} +2 -2
  41. package/dist/client/assets/{ProjectDefaultsSettings-DtvFnrMn.js → ProjectDefaultsSettings-CrKY01_P.js} +2 -2
  42. package/dist/client/assets/{ProjectFavicon-CeJHd7lY.js → ProjectFavicon-B5C6TpKj.js} +3 -3
  43. package/dist/client/assets/{ProjectIconPickerDialog-DBo5zoxF.js → ProjectIconPickerDialog-Bxa9i4w_.js} +2 -2
  44. package/dist/client/assets/{ProjectMonogram-CWdfC9NP.js → ProjectMonogram-CYD6eMbI.js} +2 -2
  45. package/dist/client/assets/{ProviderAuthTerminal-BPUxIxWE.js → ProviderAuthTerminal-Cm88QElc.js} +2 -2
  46. package/dist/client/assets/{ProviderModelPicker-JUsjo9GU.js → ProviderModelPicker-CeB11O3P.js} +2 -2
  47. package/dist/client/assets/{ProviderSettingsForm-VoB8oygt.js → ProviderSettingsForm-CLYzJJII.js} +2 -2
  48. package/dist/client/assets/{PullRequestCodeTab-CbKTE6Jz.js → PullRequestCodeTab-BqH4glgo.js} +2 -2
  49. package/dist/client/assets/{ReadOnlySourcePreview-DlWlnYoW.js → ReadOnlySourcePreview-D2Vkrzyc.js} +2 -2
  50. package/dist/client/assets/{RenderErrorBoundary-DpI8Ovyx.js → RenderErrorBoundary-BgOA8qma.js} +2 -2
  51. package/dist/client/assets/{ScheduledTasksSettings-Cc15ado1.js → ScheduledTasksSettings-BMQ-_Rms.js} +2 -2
  52. package/dist/client/assets/{ScopedSwitch-CaVh740d.js → ScopedSwitch-BrJEJr8I.js} +2 -2
  53. package/dist/client/assets/{ScrollAreaCorner-DXYr9Xbu.js → ScrollAreaCorner-BYUnXNwJ.js} +2 -2
  54. package/dist/client/assets/{SecretInput-WUih9JDs.js → SecretInput-CIbdWrQZ.js} +2 -2
  55. package/dist/client/assets/{SelectScrollUpArrow-BIdW5z3c.js → SelectScrollUpArrow-Cr4PrE_F.js} +2 -2
  56. package/dist/client/assets/{SettingsPanels-CSUZtGSF.js → SettingsPanels-B8q4OSW7.js} +2 -2
  57. package/dist/client/assets/{SettingsPanels.logic-Ce6a_3Zx.js → SettingsPanels.logic-C5FkY28P.js} +2 -2
  58. package/dist/client/assets/{SettingsScopeNotice-RvGwRluQ.js → SettingsScopeNotice-_WSLtOW4.js} +2 -2
  59. package/dist/client/assets/{T3ConnectAccountPages-Dltl5esW.js → T3ConnectAccountPages-DDSM7QWS.js} +2 -2
  60. package/dist/client/assets/{T3ConnectSidebarSignIn-qx3Qtdnf.js → T3ConnectSidebarSignIn-GnkVas23.js} +2 -2
  61. package/dist/client/assets/{ThemeEditorPanel-DspojrU_.js → ThemeEditorPanel-DB8D5_6u.js} +2 -2
  62. package/dist/client/assets/{ThreadTerminalDrawer-mE2aj0U7.js → ThreadTerminalDrawer-4huAp-uS.js} +2 -2
  63. package/dist/client/assets/{TooltipViewport-Daddx30c.js → TooltipViewport-kqulS2nz.js} +2 -2
  64. package/dist/client/assets/{Virtualizer-DySKW4Qd.js → Virtualizer-DjBOkz4F.js} +2 -2
  65. package/dist/client/assets/{WorkspaceBreadcrumb-B3WecLwo.js → WorkspaceBreadcrumb-ClxInGsT.js} +2 -2
  66. package/dist/client/assets/{WorkspacePageContainer-rn16R8Ps.js → WorkspacePageContainer-DwN_ETF0.js} +2 -2
  67. package/dist/client/assets/{WorkspacePageHeader-B2wsiKGJ.js → WorkspacePageHeader-BvKCy7v2.js} +2 -2
  68. package/dist/client/assets/{_chat-D4KQBrU-.js → _chat-C2VZmKVT.js} +5 -5
  69. package/dist/client/assets/{_chat.index-DYOE3ChI.js → _chat.index-CQSbFMBa.js} +2 -2
  70. package/dist/client/assets/{_chat.new-BTckKJwz.js → _chat.new-BxObe9FX.js} +2 -2
  71. package/dist/client/assets/{_chat.pull-requests-BYdISBjt.js → _chat.pull-requests-JS9EZDI7.js} +2 -2
  72. package/dist/client/assets/{abnfDiagram-VCTEODGH-CiK3BBs3.js → abnfDiagram-VCTEODGH-Cv0dw1u8.js} +2 -2
  73. package/dist/client/assets/{alert-CvIEaZOb.js → alert-DYmkyE3l.js} +2 -2
  74. package/dist/client/assets/architecture-7GRP2DOG-Dd1d-ckm.js +1 -0
  75. package/dist/client/assets/{architectureDiagram-5GKGNRK7-wAHn9Lrj.js → architectureDiagram-5GKGNRK7-BvQMjhmC.js} +2 -2
  76. package/dist/client/assets/{assets-B17ISP56.js → assets-COg7jyyX.js} +2 -2
  77. package/dist/client/assets/{blockDiagram-I7D4REHJ-Cp3-BNSr.js → blockDiagram-I7D4REHJ-DR7f58YJ.js} +2 -2
  78. package/dist/client/assets/{browserHistoryStore-DWdy6V_l.js → browserHistoryStore-_SurQa0e.js} +2 -2
  79. package/dist/client/assets/{browserLinkTarget-BEJDPOgD.js → browserLinkTarget-Bp-zUm0R.js} +2 -2
  80. package/dist/client/assets/{c4Diagram-7LVT6UL2-NaJ4CkHK.js → c4Diagram-7LVT6UL2-zgFjNACn.js} +2 -2
  81. package/dist/client/assets/channel-Dsne2IjR.js +2 -0
  82. package/dist/client/assets/{checkbox-EHQPSidC.js → checkbox-brLYzznm.js} +2 -2
  83. package/dist/client/assets/{chunk-4HAMMTFA-qa80OHyq.js → chunk-4HAMMTFA-Q6ZY3Aj6.js} +2 -2
  84. package/dist/client/assets/{chunk-75Z2AOVW-BQGpvZ-z.js → chunk-75Z2AOVW-Dv4NtCmQ.js} +2 -2
  85. package/dist/client/assets/{chunk-DU6HZSFF-D2KfUzzn.js → chunk-DU6HZSFF-D-pyRDMG.js} +2 -2
  86. package/dist/client/assets/{chunk-F27PBJKO-DWzMfgh0.js → chunk-F27PBJKO-BOXrNdwG.js} +2 -2
  87. package/dist/client/assets/{chunk-GMAD6QVW-C20gX9zS.js → chunk-GMAD6QVW-uYd_Q5lX.js} +2 -2
  88. package/dist/client/assets/{chunk-GVQU2GXP-CkUVHa35.js → chunk-GVQU2GXP-C3aAR6o_.js} +2 -2
  89. package/dist/client/assets/{chunk-IMKFNOWR-Dnxgnf8H.js → chunk-IMKFNOWR-CbCHd80E.js} +2 -2
  90. package/dist/client/assets/{chunk-L3NEJ4N5-DUqnqYMY.js → chunk-L3NEJ4N5-B5jDlsms.js} +2 -2
  91. package/dist/client/assets/{chunk-OSK3NFVY-DEacs3_i.js → chunk-OSK3NFVY-DgNZQb8q.js} +2 -2
  92. package/dist/client/assets/{chunk-P2QGCYS3-ZwThzrs-.js → chunk-P2QGCYS3-ptp4LKHi.js} +2 -2
  93. package/dist/client/assets/{chunk-POPQ4Y6H-BFIplCZ4.js → chunk-POPQ4Y6H-CRBmOW8B.js} +2 -2
  94. package/dist/client/assets/{chunk-PWAF6VOD-CV049Zsa.js → chunk-PWAF6VOD-DHkc8IcS.js} +2 -2
  95. package/dist/client/assets/{chunk-SHT3W25Y-BE3qAxKX.js → chunk-SHT3W25Y-B5XMb9ST.js} +2 -2
  96. package/dist/client/assets/{chunk-SVP7TREG-DWTRXiC1.js → chunk-SVP7TREG-Lt0ZENIq.js} +2 -2
  97. package/dist/client/assets/{chunk-TICWLB2K-D7wrITi8.js → chunk-TICWLB2K-BhZt3DVX.js} +2 -2
  98. package/dist/client/assets/classDiagram-ZZMXUADV-Dazl0CLN.js +2 -0
  99. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Dazl0CLN.js +2 -0
  100. package/dist/client/assets/{color-picker-Dd1K-QRk.js → color-picker-D7d1go0g.js} +2 -2
  101. package/dist/client/assets/{combobox-BqpUmoio.js → combobox-DSVavlIH.js} +2 -2
  102. package/dist/client/assets/{command-D1peviZr.js → command-DsE3Ju6m.js} +2 -2
  103. package/dist/client/assets/{connect-BJSxZzk6.js → connect-C39BhZ-c.js} +2 -2
  104. package/dist/client/assets/{connect-agent-DfhS_H4b.js → connect-agent-Dj_Cfdx6.js} +2 -2
  105. package/dist/client/assets/{cynefin-OW5HDTMX-dVUNi-Eg.js → cynefin-OW5HDTMX-CNKdS-0M.js} +1 -1
  106. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Djkby1yV.js → cynefinDiagram-5FMLGOSQ-CoFxzJSW.js} +2 -2
  107. package/dist/client/assets/{dagre-GXQ25YYZ-By44EUZw.js → dagre-GXQ25YYZ-q0omC4bc.js} +2 -2
  108. package/dist/client/assets/{device-Dk2NULhB.js → device-CWgOLpbF.js} +2 -2
  109. package/dist/client/assets/{diagram-S7CK7UJ4-C0o6sI0g.js → diagram-S7CK7UJ4-CdFkGs_B.js} +2 -2
  110. package/dist/client/assets/{diagram-UQ7AKVKN-s2vz22qd.js → diagram-UQ7AKVKN-B0KtokqT.js} +2 -2
  111. package/dist/client/assets/{diagram-VSXAHHWV-CylpbhVy.js → diagram-VSXAHHWV-DjtTeImL.js} +2 -2
  112. package/dist/client/assets/{diagram-VX7I27RA-Bz50mxAk.js → diagram-VX7I27RA-DRYLlkkf.js} +2 -2
  113. package/dist/client/assets/{diagram-Z3DM3KII-BwwAXl7S.js → diagram-Z3DM3KII-C-x2EfL6.js} +2 -2
  114. package/dist/client/assets/{dialog-BfenC7sz.js → dialog-DYFQxVoN.js} +2 -2
  115. package/dist/client/assets/{diffRendering-4kDIxoRz.js → diffRendering-6DuM2rGF.js} +2 -2
  116. package/dist/client/assets/{discovery-list-NHMaJPrr.js → discovery-list-BvblDG7m.js} +2 -2
  117. package/dist/client/assets/{dist-DPoczA-G.js → dist-CkgAUeqn.js} +3 -3
  118. package/dist/client/assets/{draft-input-rVkOduh_.js → draft-input-27erQjx_.js} +2 -2
  119. package/dist/client/assets/{duoViewer-CYEmwhMX.js → duoViewer-CBnLVCTt.js} +2 -2
  120. package/dist/client/assets/{dynamic-DO1Y_hZw.js → dynamic-Cjr9H8t4.js} +2 -2
  121. package/dist/client/assets/{ebnfDiagram-PWID7BFC-CZWDrYgP.js → ebnfDiagram-PWID7BFC-UISo4OT-.js} +2 -2
  122. package/dist/client/assets/{embeddedScripts-gw0IVEit.js → embeddedScripts-Dr-tOtuJ.js} +2 -2
  123. package/dist/client/assets/{empty-xf3NEL4p.js → empty-2jxBvPLn.js} +2 -2
  124. package/dist/client/assets/{entities-D1h9ACDa.js → entities-DCbEYTvn.js} +2 -2
  125. package/dist/client/assets/{environments-CShRJEmR.js → environments-iW64jjyO.js} +2 -2
  126. package/dist/client/assets/{erDiagram-RLTQ6QDP-nQAwXpMH.js → erDiagram-RLTQ6QDP-CeWlUdOf.js} +2 -2
  127. package/dist/client/assets/eventmodeling-NTZA5JFV-B5z8GPGl.js +1 -0
  128. package/dist/client/assets/{fileLinks-hdHZBPGX.js → fileLinks-5NSgRKPU.js} +2 -2
  129. package/dist/client/assets/{fileTreeExpansion-VkvCaw5c.js → fileTreeExpansion-CA6c4E3-.js} +2 -2
  130. package/dist/client/assets/flowDiagram-HODETNUW-CEpweBDE.js +1 -0
  131. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-DWYM0gWT.js → ganttDiagram-EL5Y4UJY-KPPMvqNL.js} +2 -2
  132. package/dist/client/assets/{getDiffFileInput-D107eiKt.js → getDiffFileInput-CuM1lgsL.js} +2 -2
  133. package/dist/client/assets/{gitGraph-4MIJSDKK-COMcQtZ6.js → gitGraph-4MIJSDKK-BGSFaZro.js} +1 -1
  134. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BQoQgnaf.js → gitGraphDiagram-WWUBYQGX-CwYf9r63.js} +2 -2
  135. package/dist/client/assets/{guideRunStore-U-mQ5TrH.js → guideRunStore-B3Y6e_nf.js} +2 -2
  136. package/dist/client/assets/{htmlRender-CDbYs9Mi.js → htmlRender-BaqdfJ6m.js} +2 -2
  137. package/dist/client/assets/{index-B3Ar6SfQ.js → index-DmPPPGJb.js} +3 -3
  138. package/dist/client/assets/{info-A6RAGUB7-DztiJcIo.js → info-A6RAGUB7-C831OtOR.js} +1 -1
  139. package/dist/client/assets/{infoDiagram-27XIBGKW-4UkpJDZ8.js → infoDiagram-27XIBGKW-DVstIW76.js} +2 -2
  140. package/dist/client/assets/{input-CF-egQtG.js → input-83N8btBC.js} +2 -2
  141. package/dist/client/assets/{input-group-CifPZlNg.js → input-group-Q757vhrD.js} +2 -2
  142. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DhRs1gS_.js → ishikawaDiagram-5VMMS53U-CJq0N-AL.js} +2 -2
  143. package/dist/client/assets/{journeyDiagram-3NMN7TZE-CkzLNTms.js → journeyDiagram-3NMN7TZE-D76KCD6f.js} +2 -2
  144. package/dist/client/assets/{kanban-definition-UXKFOSKX-DnnZRuwk.js → kanban-definition-UXKFOSKX-D1kzRMIP.js} +2 -2
  145. package/dist/client/assets/{kbd-DN9MXWor.js → kbd-D8UfTN0o.js} +2 -2
  146. package/dist/client/assets/{keybindings-BlEA4Dlt.js → keybindings-DLDyoB30.js} +2 -2
  147. package/dist/client/assets/{lazyRouteComponent-b9hpLjZB.js → lazyRouteComponent-BCGAjyjO.js} +2 -2
  148. package/dist/client/assets/{line-BQc8Tfxv.js → line-QHGhF6Vm.js} +2 -2
  149. package/dist/client/assets/{link-BIudTto8.js → link-Bgj44djS.js} +2 -2
  150. package/dist/client/assets/{linkedPrompt-DhAklUFf.js → linkedPrompt-D1aW6nV5.js} +2 -2
  151. package/dist/client/assets/{main-CqNzdsfA.js → main-lV-t-UZx.js} +7 -7
  152. package/dist/client/assets/{mediaReference-Cnqpj8T4.js → mediaReference-CQtke4j3.js} +2 -2
  153. package/dist/client/assets/{mediaSource-DoFgutG9.js → mediaSource-CI2bKK3n.js} +2 -2
  154. package/dist/client/assets/{mermaid-parser.core-DkdUKkht.js → mermaid-parser.core-Brqe55KM.js} +4 -4
  155. package/dist/client/assets/{mermaid.core-Bq1JlzgL.js → mermaid.core-Cdl6aiT5.js} +5 -5
  156. package/dist/client/assets/{mindmap-definition-YA3MSWOX-D8mmtbMo.js → mindmap-definition-YA3MSWOX-CcdCCRbd.js} +2 -2
  157. package/dist/client/assets/{number-field-CydqGM9B.js → number-field-DQIrEOoj.js} +2 -2
  158. package/dist/client/assets/{observeResize-BxVCxCXG.js → observeResize-BaPAtI3Q.js} +2 -2
  159. package/dist/client/assets/{onboarding-DeRMOHIy.js → onboarding-ObMsA9VF.js} +2 -2
  160. package/dist/client/assets/{openFileInPreview-yiAUHSWv.js → openFileInPreview-CdBR5kuZ.js} +2 -2
  161. package/dist/client/assets/{p4ProjectFile-CN1m1U7N.js → p4ProjectFile--u7SOSK5.js} +2 -2
  162. package/dist/client/assets/{packet-AYTQ26CC-BWg_Iaga.js → packet-AYTQ26CC-BSuHbq7S.js} +1 -1
  163. package/dist/client/assets/{pair-DzpeGOSy.js → pair-C11lrlzi.js} +2 -2
  164. package/dist/client/assets/{pegDiagram-XKGWAZYB-CAzHwR2-.js → pegDiagram-XKGWAZYB-Iy9neoGN.js} +2 -2
  165. package/dist/client/assets/{phoneViewer-FlyoV9qT.js → phoneViewer-iqsNqM8D.js} +2 -2
  166. package/dist/client/assets/{pie-WAS4IAKB-DcySclOi.js → pie-WAS4IAKB-BlC5Ctcv.js} +1 -1
  167. package/dist/client/assets/{pieDiagram-E7YTZNPT-B00nxfti.js → pieDiagram-E7YTZNPT-CtVgATJF.js} +2 -2
  168. package/dist/client/assets/{pierre-icons-u_a0tCKH.js → pierre-icons-fSsw9aa-.js} +2 -2
  169. package/dist/client/assets/{popover-BunL7s_L.js → popover-B1MF5i1c.js} +2 -2
  170. package/dist/client/assets/{preview-DJTsHJUF.js → preview-DwLWkMZG.js} +2 -2
  171. package/dist/client/assets/{preview-B_wcdd8X.js → preview-ITad1JAy.js} +2 -2
  172. package/dist/client/assets/{previewMiniPlayerStore-gZV-IkW-.js → previewMiniPlayerStore-DN-AYBed.js} +2 -2
  173. package/dist/client/assets/{primary-BqinBW4U.js → primary-8A8hvHFL.js} +2 -2
  174. package/dist/client/assets/{primaryCloudLinkState-hwg0TXVd.js → primaryCloudLinkState-BP-HZzf2.js} +2 -2
  175. package/dist/client/assets/{projectFilesQueryState-DVWHpzC3.js → projectFilesQueryState-CGllQp_V.js} +2 -2
  176. package/dist/client/assets/{projectScriptEditor-RRQopHne.js → projectScriptEditor-DwqFzld2.js} +2 -2
  177. package/dist/client/assets/{providerSkills-BmchYM4E.js → providerSkills-O72EMm0V.js} +2 -2
  178. package/dist/client/assets/{pullRequestDetail.logic-CjznZ6xd.js → pullRequestDetail.logic-CkxKh0fV.js} +2 -2
  179. package/dist/client/assets/{pullRequestIcons-BZCS4C5B.js → pullRequestIcons-CSZus-cz.js} +2 -2
  180. package/dist/client/assets/{pullRequestReviewStore-BqvYYzmT.js → pullRequestReviewStore-78f71w6J.js} +2 -2
  181. package/dist/client/assets/{pullRequests-iwguXcJ4.js → pullRequests-7IQc0VIk.js} +2 -2
  182. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-DXb-ZTK9.js → quadrantDiagram-AXDQQJYC-kq18RP_F.js} +2 -2
  183. package/dist/client/assets/{queries-D53cjqgz.js → queries-DCKH7ltg.js} +2 -2
  184. package/dist/client/assets/{query-CRswjQ7f.js → query-B1uAr_ii.js} +2 -2
  185. package/dist/client/assets/{radar-RG4KPBEZ-BeXZggD1.js → radar-RG4KPBEZ-Cbkq33o2.js} +1 -1
  186. package/dist/client/assets/{radio-group-DzD2uI5x.js → radio-group-CFJMQH66.js} +2 -2
  187. package/dist/client/assets/{railroad-74A4TZTK-DGDA4rny.js → railroad-74A4TZTK-Ba3TZ4Wg.js} +1 -1
  188. package/dist/client/assets/railroad-abnf-HS5TGJTU-l3gFfdc2.js +1 -0
  189. package/dist/client/assets/railroad-ebnf-LZEXJU2U-eiWL8AW4.js +1 -0
  190. package/dist/client/assets/railroad-peg-WCYAUIDC-UK0E-Txe.js +1 -0
  191. package/dist/client/assets/{railroadDiagram-O6MQD6OU-2U2BGUTN.js → railroadDiagram-O6MQD6OU-BfOnyiaT.js} +2 -2
  192. package/dist/client/assets/{renderScheduler-Bwwdk-oE.js → renderScheduler-CcWhS7Yq.js} +2 -2
  193. package/dist/client/assets/{requirementDiagram-BXWQKSXE-BpZZUYPx.js → requirementDiagram-BXWQKSXE-DFzAGiJp.js} +2 -2
  194. package/dist/client/assets/{rightPanelStore-CcmIdfDA.js → rightPanelStore-DfMWWfvR.js} +2 -2
  195. package/dist/client/assets/runtime-B5cKWtKn.js +2 -0
  196. package/dist/client/assets/{runtime-Dz1hyHmq.js → runtime-B9IDNXDU.js} +3 -3
  197. package/dist/client/assets/{runtimeModeConfig-CGosfJJ5.js → runtimeModeConfig-C3TbI2qR.js} +2 -2
  198. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-DC4ft80C.js → sankeyDiagram-P5KCCOFB-D9gFGibV.js} +2 -2
  199. package/dist/client/assets/{scheduledTasksSettings.logic-Bmbv-9DS.js → scheduledTasksSettings.logic-DVbZRIYJ.js} +2 -2
  200. package/dist/client/assets/{scroll-area-OkcD8f0Y.js → scroll-area-DGS0jgnh.js} +2 -2
  201. package/dist/client/assets/{select-BUFUt6O3.js → select-Dsx46akG.js} +2 -2
  202. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-COMPHZuQ.js → sequenceDiagram-WJ2MYXX4-C9pRaNT5.js} +2 -2
  203. package/dist/client/assets/{server-BSKDpYuc.js → server-CoH7V4JL.js} +2 -2
  204. package/dist/client/assets/{session-BaKBc24W.js → session-Bo2ZSprC.js} +2 -2
  205. package/dist/client/assets/{session-logic-DOC4SSh-.js → session-logic-C4wGF3_E.js} +2 -2
  206. package/dist/client/assets/{settings-Ce3HYftt.js → settings-mrxLMm57.js} +2 -2
  207. package/dist/client/assets/{settings.appearance-BELQs8GW.js → settings.appearance-6ktu9wdJ.js} +2 -2
  208. package/dist/client/assets/settings.archived-Hl4HyrFx.js +2 -0
  209. package/dist/client/assets/{settings.computer-use-BjiS8S48.js → settings.computer-use-C24sO93u.js} +2 -2
  210. package/dist/client/assets/{settings.connections-CL91uyd1.js → settings.connections-CgaYGg_W.js} +2 -2
  211. package/dist/client/assets/{settings.data-controls-AB6ME8V3.js → settings.data-controls-DNY0fL9E.js} +2 -2
  212. package/dist/client/assets/{settings.decisions-DEFo-Pd2.js → settings.decisions-kar2kv7T.js} +2 -2
  213. package/dist/client/assets/{settings.diagnostics-DgncclwX.js → settings.diagnostics-BHSEPjF8.js} +2 -2
  214. package/dist/client/assets/{settings.general-BHYFN8uF.js → settings.general-C1zsJgwK.js} +2 -2
  215. package/dist/client/assets/{settings.integrations-BxqEAKSC.js → settings.integrations-DykwmCf7.js} +2 -2
  216. package/dist/client/assets/{settings.keybindings-DQ8svgeo.js → settings.keybindings-CYcsJ6DQ.js} +2 -2
  217. package/dist/client/assets/{settings.open-source-licenses-DX92vMDE.js → settings.open-source-licenses-DnBHlZE2.js} +2 -2
  218. package/dist/client/assets/settings.plugins-B7Nlb85S.js +5 -0
  219. package/dist/client/assets/{settings.projects-C8uYKsz6.js → settings.projects-Ob8jKbIh.js} +3 -3
  220. package/dist/client/assets/settings.providers-BIm-8j9C.js +3 -0
  221. package/dist/client/assets/{settings.scheduled-tasks-B2CT-4iw.js → settings.scheduled-tasks-Bf37L1OK.js} +2 -2
  222. package/dist/client/assets/{settings.snap-shot-FpIHq57J.js → settings.snap-shot-D37zM8an.js} +2 -2
  223. package/dist/client/assets/{settings.source-control-Cgg8tzrr.js → settings.source-control-DmRUgcsk.js} +2 -2
  224. package/dist/client/assets/{settings.storage-gQMFfL_2.js → settings.storage-DmbTXujz.js} +2 -2
  225. package/dist/client/assets/{settingsLayout-DUyA66EK.js → settingsLayout-CqGfrbmD.js} +2 -2
  226. package/dist/client/assets/{sidebar-CNP67lTi.js → sidebar-C_I_pq_E.js} +2 -2
  227. package/dist/client/assets/{sidebarProjectGrouping-lWfRDsCI.js → sidebarProjectGrouping-DrnsFA8t.js} +2 -2
  228. package/dist/client/assets/{skeleton-DDh76jpd.js → skeleton-0mC3wMw1.js} +2 -2
  229. package/dist/client/assets/{sortable.esm-Bc--TVlq.js → sortable.esm-DuAaqmgD.js} +2 -2
  230. package/dist/client/assets/{sourceControl-BppF1prF.js → sourceControl-D6TEHNpa.js} +2 -2
  231. package/dist/client/assets/{spinner-DYnZ-Bpa.js → spinner-DHOdl-gn.js} +2 -2
  232. package/dist/client/assets/{standalone-page-DUgQaNPq.js → standalone-page-Dx8vGwaJ.js} +2 -2
  233. package/dist/client/assets/{stateDiagram-D77RDMKH-Dk5dNGVk.js → stateDiagram-D77RDMKH-D8n56CID.js} +2 -2
  234. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DqXgq-FS.js +2 -0
  235. package/dist/client/assets/{swimlanes-42K2YHIH-D6oOm69V.js → swimlanes-42K2YHIH-DZZct2ih.js} +2 -2
  236. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DAX63YhZ.js +9 -0
  237. package/dist/client/assets/{terminal-links-CV_3r1U3.js → terminal-links-Di9Ijg8X.js} +2 -2
  238. package/dist/client/assets/{terminalSessions-DCMAHO3E.js → terminalSessions-B8EDcX8b.js} +2 -2
  239. package/dist/client/assets/{textarea-Dt0w6mtc.js → textarea-BvPoR1cI.js} +2 -2
  240. package/dist/client/assets/{themePalette-9CODTNe7.js → themePalette-zFOiBKDi.js} +2 -2
  241. package/dist/client/assets/{threadSort-DJdKuCKp.js → threadSort-Cn23YHH2.js} +2 -2
  242. package/dist/client/assets/{timeline-definition-24CTP7MA-Dd3smJPR.js → timeline-definition-24CTP7MA-BGfuRztb.js} +2 -2
  243. package/dist/client/assets/{toast-BeM8bZbF.js → toast-CN7Jd-pG.js} +2 -2
  244. package/dist/client/assets/{toggle-C3pF5hng.js → toggle-DeCGfzT2.js} +2 -2
  245. package/dist/client/assets/{toggle-group-C4V_4iet.js → toggle-group-DekLc0Ax.js} +2 -2
  246. package/dist/client/assets/{tooltip-Cco13jKX.js → tooltip-DaSC-3cL.js} +2 -2
  247. package/dist/client/assets/{treeView-Q6P3EWNA-Dbb-EyFc.js → treeView-Q6P3EWNA-BPM2x-ME.js} +1 -1
  248. package/dist/client/assets/{treemap-WGGIJYW6-C4Asv2we.js → treemap-WGGIJYW6-sku0fChI.js} +1 -1
  249. package/dist/client/assets/{usage-C5gCqDEF.js → usage-CKRSqJso.js} +2 -2
  250. package/dist/client/assets/{usageAccess-CeCsk7TS.js → usageAccess-BGb3m0YV.js} +2 -2
  251. package/dist/client/assets/{usageFormat-CQXspPhL.js → usageFormat-H-RgZ0fy.js} +2 -2
  252. package/dist/client/assets/{usageShortcuts-DaMuOxo1.js → usageShortcuts-C320W17X.js} +2 -2
  253. package/dist/client/assets/{use-atom-command-CMd4xAvF.js → use-atom-command-GpCw1tWF.js} +2 -2
  254. package/dist/client/assets/{useAriaLabelledBy-BinWYOc0.js → useAriaLabelledBy-C8nSWyQ9.js} +2 -2
  255. package/dist/client/assets/{useHandleNewThread-2sRVaQar.js → useHandleNewThread-FJLPEfoH.js} +2 -2
  256. package/dist/client/assets/{useLocation-BQwksr61.js → useLocation-Ccsih1eo.js} +2 -2
  257. package/dist/client/assets/useNavigate-Dhy_1-Mg.js +2 -0
  258. package/dist/client/assets/{useNavigateBack-D2S1CDHR.js → useNavigateBack-PnWVFtkU.js} +2 -2
  259. package/dist/client/assets/{useParams-D_8gJiai.js → useParams-CoeDewwU.js} +2 -2
  260. package/dist/client/assets/{usePermissionStatus-Bl_cAihc.js → usePermissionStatus-mBtsOu9K.js} +2 -2
  261. package/dist/client/assets/{usePullRequestActions-BcGz_qON.js → usePullRequestActions-_K7fD4Ny.js} +2 -2
  262. package/dist/client/assets/{useRegisterFieldControl-Bp078Il-.js → useRegisterFieldControl-9rSmWR2W.js} +2 -2
  263. package/dist/client/assets/{useScopedModelAvailability-DAU9OPOv.js → useScopedModelAvailability-DE1E_lbg.js} +2 -2
  264. package/dist/client/assets/{useSettings-DpVy22yc.js → useSettings-CKA-LDDj.js} +2 -2
  265. package/dist/client/assets/{useT3ConnectAuthPrompt-BsnsXdaF.js → useT3ConnectAuthPrompt-ZyPZIXm7.js} +2 -2
  266. package/dist/client/assets/utils-BAPnqm16.js +37 -0
  267. package/dist/client/assets/{vcsRefInvalidation--2K54DE9.js → vcsRefInvalidation-DfCz0cGO.js} +2 -2
  268. package/dist/client/assets/{vennDiagram-4TSXK5OY-V_3xLf5G.js → vennDiagram-4TSXK5OY-CjhblZp4.js} +2 -2
  269. package/dist/client/assets/{wardley-WFR3VGLG-CDlEm4As.js → wardley-WFR3VGLG-Cuf_pn9-.js} +1 -1
  270. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CBqbrzOI.js → wardleyDiagram-VM6X3IG4-CMQ-_cYv.js} +2 -2
  271. package/dist/client/assets/{welcome-DdV5o2sn.js → welcome-nE6tva7L.js} +2 -2
  272. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-BBAHFXyY.js → xychartDiagram-S5SC5T6Z-BlCqmJgA.js} +2 -2
  273. package/dist/client/index.html +1 -1
  274. package/dist/{renderer-B8qsc7RL.mjs → renderer-7OJ6c0Me.mjs} +2 -2
  275. package/dist/{runtime-CEdmfdaF.mjs → runtime-BHqdsO3Y.mjs} +35 -6
  276. package/package.json +1 -1
  277. package/dist/client/assets/AlertDialogRoot-DYtW2IF3.js +0 -2
  278. package/dist/client/assets/Input-Cr3X6dPy.js +0 -2
  279. package/dist/client/assets/architecture-7GRP2DOG-I5ogqlvV.js +0 -1
  280. package/dist/client/assets/channel-3VrneojD.js +0 -2
  281. package/dist/client/assets/classDiagram-ZZMXUADV-cGz3NSHA.js +0 -2
  282. package/dist/client/assets/classDiagram-v2-VYDZK3BY-cGz3NSHA.js +0 -2
  283. package/dist/client/assets/eventmodeling-NTZA5JFV-CCbbQaex.js +0 -1
  284. package/dist/client/assets/flowDiagram-HODETNUW-BwO_EBwI.js +0 -1
  285. package/dist/client/assets/railroad-abnf-HS5TGJTU-BszadkTZ.js +0 -1
  286. package/dist/client/assets/railroad-ebnf-LZEXJU2U-Cs2gjnvT.js +0 -1
  287. package/dist/client/assets/railroad-peg-WCYAUIDC-mvB_-15Z.js +0 -1
  288. package/dist/client/assets/runtime-D1cxRUzP.js +0 -2
  289. package/dist/client/assets/settings.archived-_xyYN0XB.js +0 -2
  290. package/dist/client/assets/settings.plugins-DZqUpuLK.js +0 -5
  291. package/dist/client/assets/settings.providers-CDPVCtiM.js +0 -3
  292. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BqI4Wri4.js +0 -2
  293. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Des4AqSq.js +0 -9
  294. package/dist/client/assets/useNavigate-LjcLtV_e.js +0 -2
  295. package/dist/client/assets/utils-Dx_TSvdC.js +0 -37
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,AS as r,Aw as i,Cc as a,D as o,Gc as s,HS as c,Hc as l,IS as u,Iy as d,Jo as f,Lu as p,Lw as m,Mr as h,NE as g,NT as _,Nr as v,OS as y,Ox as b,Py as x,Ru as S,Sr as C,Ss as w,Uc as T,Vw as E,Vx as D,W as O,Wc as k,Xo as A,YS as j,Yo as M,Zo as N,_S as P,_n as F,_v as I,_y as L,b as R,dr as ee,ds as te,eb as ne,fS as re,fr as z,fs as ie,gr as ae,ha as oe,hv as se,hx as ce,jx as le,l as ue,lE as de,rb as fe,sr as pe,ss as me,sw as he,ur as ge,uv as B,vn as _e,vs as ve,wx as ye,xg as be,yo as xe,zS as Se}from"./utils-Dx_TSvdC.js";import{t as Ce}from"./arrow-down-up-B46gw0xW.js";import{t as we}from"./arrow-down-DvRecXuy.js";import{t as Te}from"./arrow-left-BLE461db.js";import{t as Ee}from"./arrow-right-CoV5ameY.js";import{t as De}from"./arrow-up-right-C6IM-WPd.js";import{t as Oe}from"./arrow-up-3Yp3lsoe.js";import{t as ke}from"./boxes-D4AJ0ucE.js";import{t as Ae}from"./check-Cmy7pM2Y.js";import{t as je}from"./chevron-down-DHV04o66.js";import{t as Me}from"./chevron-left-DrNh6cTh.js";import{t as Ne}from"./chevron-right-NbahR9_s.js";import{t as Pe}from"./chevron-up-C-w52bD6.js";import{t as Fe}from"./circle-alert-B83jEPoh.js";import{t as Ie}from"./circle-check-Y1T60J9X.js";import{t as Le}from"./circle-4zZlZno3.js";import{t as Re}from"./component-HJu09bM6.js";import{t as ze}from"./download-BAp4p4A-.js";import{t as Be}from"./ellipsis-6x3R4_IB.js";import{t as Ve}from"./file-code-corner-Dt6PpZnb.js";import{t as He}from"./focus-o7yKOd1j.js";import{t as Ue}from"./folder-CMIvEUJv.js";import{t as We}from"./frame-DGUYPXa7.js";import{t as Ge}from"./group-aBPDkCFm.js";import{t as Ke}from"./hand-Bz2YZhrG.js";import{t as qe}from"./image-xUrgiZ2i.js";import{t as Je}from"./layers-BqgDAlx3.js";import{t as Ye}from"./library-C8DuZzap.js";import{t as Xe}from"./link-zAXVcUwk.js";import{t as Ze}from"./map-pin-5mbcayYf.js";import{t as Qe}from"./maximize-2-CHT2IkVy.js";import{t as $e}from"./message-square-plus-ChUy6onn.js";import{t as et}from"./message-square-DLzUyuIE.js";import{t as tt}from"./minus-C7W28oE7.js";import{t as nt}from"./monitor-Ddj8MK6z.js";import{t as rt}from"./mouse-pointer-2-DbBU41il.js";import{t as it}from"./plus-Cr075-cy.js";import{t as at}from"./refresh-cw-PY_ECjtI.js";import{t as ot}from"./scan-search-Chb5YdZY.js";import{t as st}from"./scan-BPBcmOMp.js";import{t as ct}from"./search-Cr9eaeTj.js";import{t as lt}from"./settings-CTjEqsg3.js";import{t as ut}from"./spline-EJpY6uhz.js";import{t as dt}from"./square-DVrCvZRU.js";import{t as ft}from"./swatch-book-CO6HbEgI.js";import{t as pt}from"./type-ChjbxAhu.js";import{t as mt}from"./upload-D9-Kv89Z.js";import{t as ht}from"./wifi-off-DtJhRDhE.js";import{t as gt}from"./x-CSwbgjBe.js";import{J as _t,M as vt,Z as yt,_ as bt,dt as xt,et as St,g as Ct,it as wt,j as Tt,nt as Et,ot as Dt,st as Ot}from"./runtime-Dz1hyHmq.js";import{O as kt}from"./entities-D1h9ACDa.js";import{t as At}from"./runtime-D1cxRUzP.js";import{a as jt,i as Mt,o as Nt,r as Pt,s as Ft,t as It}from"./TooltipViewport-Daddx30c.js";import{a as Lt,c as Rt,i as zt,l as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt,u as Kt}from"./SelectScrollUpArrow-BIdW5z3c.js";import{t as qt}from"./environments-CShRJEmR.js";import{l as Jt}from"./rightPanelStore-CcmIdfDA.js";import{t as Yt}from"./FieldControl-Bw2_eFMa.js";import{n as Xt,t as Zt}from"./CheckboxIndicator-DRAilQdq.js";import{t as Qt}from"./Input-Cr3X6dPy.js";import{a as $t,i as en,n as tn,r as nn,t as rn}from"./ScrollAreaCorner-DXYr9Xbu.js";import{c as an,l as on,n as sn,o as cn,r as ln,s as un,t as dn,u as fn}from"./DialogTitle-BgclXafx.js";import{n as pn,r as mn,t as hn}from"./CollapsiblePanel-DMH4QH0_.js";import{a as gn,c as _n,n as vn,o as yn,r as bn,s as xn}from"./PopoverHandle-BkhR-kKK.js";import{t as Sn}from"./AlertDialogRoot-DYtW2IF3.js";var V=e(t(),1),H=g();function U(...e){return a(S(e))}var Cn=p(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 px-[calc(--spacing(3)-1px)] sm:h-8`,icon:`size-9 sm:size-8`,"icon-lg":`size-10 sm:size-9`,"icon-micro":`size-5 rounded-sm p-0 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 sm:size-7`,"icon-xl":`size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,"icon-xs":`size-7 rounded-md sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5`,lg:`h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9`,sm:`h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7`,xl:`h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`},variant:{default:`border-primary bg-primary text-primary-foreground [:active,[data-pressed]]:bg-primary/80 [:hover,[data-pressed]]:bg-primary/90`,destructive:`border-primary bg-primary text-primary-foreground [:active,[data-pressed]]:bg-primary/80 [:hover,[data-pressed]]:bg-primary/90`,"destructive-outline":`border-input bg-popover not-dark:bg-clip-padding text-foreground dark:bg-input/32 [:active,[data-pressed]]:bg-accent/70 [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground`,ghost:`border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [&_svg:not([class*='text-'])]:text-muted-foreground`,link:`border-transparent underline-offset-4 [:hover,[data-pressed]]:underline`,outline:`border-input bg-popover not-dark:bg-clip-padding text-foreground dark:bg-input/32 [:active,[data-pressed]]:bg-accent/70 [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground`,secondary:`border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90`}}});function W(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,variant:s,size:c,render:l,...u}=e;n=l;let d=n?void 0:`button`,f={className:U(Cn({className:o,size:c,variant:s})),"data-slot":`button`,type:d};a=ge,r=`button`,i=xe(f,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var G=e(de(),1),wn=ae;function Tn(e){let t=(0,H.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,G.jsx)(z,{className:r,"data-slot":`menu-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function En(e){let t=(0,H.c)(26),n,r,i,a,o,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]):({children:i,className:a,sideOffset:c,align:l,alignOffset:n,side:u,anchor:r,disableAnchorTracking:o,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u);let d=c===void 0?4:c,f=l===void 0?`center`:l,p=u===void 0?`bottom`:u,m;t[10]===a?m=t[11]:(m=U(`dropdown-glass relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg outline-none transition-[scale,opacity] duration-[140ms] ease-[cubic-bezier(0.23,1,0.32,1)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 focus:outline-none`,a),t[10]=a,t[11]=m);let g;t[12]===i?g=t[13]:(g=(0,G.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:i}),t[12]=i,t[13]=g);let _;t[14]!==s||t[15]!==m||t[16]!==g?(_=(0,G.jsx)(v,{className:m,"data-slot":`menu-popup`,...s,children:g}),t[14]=s,t[15]=m,t[16]=g,t[17]=_):_=t[17];let y;return t[18]!==f||t[19]!==n||t[20]!==r||t[21]!==o||t[22]!==p||t[23]!==d||t[24]!==_?(y=(0,G.jsx)(h,{children:(0,G.jsx)(C,{align:f,alignOffset:n,anchor:r,disableAnchorTracking:o,className:`z-[60]`,"data-slot":`menu-positioner`,side:p,sideOffset:d,children:_})}),t[18]=f,t[19]=n,t[20]=r,t[21]=o,t[22]=p,t[23]=d,t[24]=_,t[25]=y):y=t[25],y}function Dn(e){let t=(0,H.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=U(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,G.jsx)(oe,{className:s,"data-inset":r,"data-slot":`menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function On(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`mx-2 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(ee,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var kn=`dialog-backdrop panel-motion fixed inset-0 z-50 transition-all duration-(--panel-duration) data-ending-style:opacity-0 data-starting-style:opacity-0`,An=`dialog-glass panel-motion -translate-y-[calc(1.25rem*var(--nested-dialogs))] relative flex min-h-0 w-full min-w-0 scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border opacity-[calc(1-0.1*var(--nested-dialogs))] outline-none transition-[scale,opacity,translate] duration-(--panel-duration) ease-in-out will-change-transform data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,jn=Sn,Mn=cn;function Nn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(kn,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(fn,{forceRender:!0,className:i,"data-slot":`alert-dialog-backdrop`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(sn,{className:i,"data-slot":`alert-dialog-viewport`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fn(e){let t=(0,H.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,bottomStickOnMobile:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i,o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(Nn,{}),t[4]=o):o=t[4];let s=a&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`,c;t[5]===s?c=t[6]:(c=U(s),t[5]=s,t[6]=c);let l=a&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4`,u;t[7]!==n||t[8]!==l?(u=U(An,`row-start-2 max-h-full max-w-lg text-popover-foreground`,l,n),t[7]=n,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==u?(d=(0,G.jsx)(un,{className:u,"data-slot":`alert-dialog-popup`,...r}),t[10]=r,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==c||t[14]!==d?(f=(0,G.jsxs)(Mn,{children:[o,(0,G.jsx)(Pn,{className:c,children:d})]}),t[13]=c,t[14]=d,t[15]=f):f=t[15],f}function In(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,"data-slot":`alert-dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ln(e){let t=(0,H.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o=a==="default"&&`border-t bg-muted/72 py-4`,s=a===`bare`&&`pb-6`,c;t[4]!==n||t[5]!==o||t[6]!==s?(c=U(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,o,s,n),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==r||t[9]!==c?(l=(0,G.jsx)(`div`,{className:c,"data-slot":`alert-dialog-footer`,...r}),t[8]=r,t[9]=c,t[10]=l):l=t[10],l}function Rn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`font-heading font-semibold text-xl leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(dn,{className:i,"data-slot":`alert-dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(an,{className:i,"data-slot":`alert-dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Bn=(0,V.createContext)(null);function Vn(e){let t=(0,H.c)(3),{host:n,children:r}=e,i=n,a;return t[0]!==r||t[1]!==i?(a=(0,G.jsx)(Bn,{value:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Hn(){let e=(0,V.use)(Bn);if(!e)throw Error(`Design workspace rendered outside a DesignHostProvider`);return e}var Un=n(ve(!1)).pipe(me(`design-query:empty`));function Wn(e){let t=i(e);return t instanceof Error&&t.message.trim().length>0?t.message:`The environment request failed.`}function Gn(e){let t=(0,H.c)(10),n=e??Un,r=M(n),i=f(n),a;t[0]===r?a=t[1]:(a=_(w(r)),t[0]=r,t[1]=a);let o;t[2]!==r._tag||t[3]!==r.cause?(o=r._tag===`Failure`?Wn(r.cause):null,t[2]=r._tag,t[3]=r.cause,t[4]=o):o=t[4];let s=e!==null&&r.waiting,c;return t[5]!==i||t[6]!==a||t[7]!==o||t[8]!==s?(c={data:a,error:o,isPending:s,refresh:i},t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Kn(){let e=Hn(),t=(0,V.useContext)(A);return(0,V.useCallback)(async n=>{let r=e.runtime.atom(n),a=await y(u(D(function*(){return yield*ie(t,r),yield*te(t,r,{suspendOnWaiting:!0})})));if(he(a))throw i(a.cause);return a.value},[e,t])}function qn(e){let t=(0,H.c)(71),{target:n,path:r,revision:i,fileHash:a,disabled:o}=e,{transport:s}=Hn(),c=Kn(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(0),x;t[0]!==l||t[1]!==r||t[2]!==c||t[3]!==n||t[4]!==s?(x=()=>{if(!l)return;let e=!0;return f(null),m(null),c(s.revisions(n,r)).then(t=>{e&&f(t)},()=>{e&&m(`Could not load revisions.`)}),()=>{e=!1}},t[0]=l,t[1]=r,t[2]=c,t[3]=n,t[4]=s,t[5]=x):x=t[5];let S;t[6]!==y||t[7]!==l||t[8]!==r||t[9]!==c||t[10]!==n||t[11]!==s?(S=[l,y,n,r,s,c],t[6]=y,t[7]=l,t[8]=r,t[9]=c,t[10]=n,t[11]=s,t[12]=S):S=t[12],(0,V.useEffect)(x,S);let C=o||_,w;t[13]===C?w=t[14]:(w=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:C,"aria-label":`Design revisions`,className:`design-mono`}),t[13]=C,t[14]=w);let T;t[15]===i?T=t[16]:(T=i?.slice(0,8)??`unavailable`,t[15]=i,t[16]=T);let E;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,G.jsx)(je,{"aria-hidden":`true`}),t[17]=E):E=t[17];let D;t[18]!==w||t[19]!==T?(D=(0,G.jsxs)(Tn,{render:w,children:[`Revision `,T,E]}),t[18]=w,t[19]=T,t[20]=D):D=t[20];let O;t[21]!==y||t[22]!==p||t[23]!==a||t[24]!==d?(O=p?(0,G.jsxs)(Dn,{onClick:()=>b(y+1),children:[p,` Retry`]}):d===null?(0,G.jsx)(Dn,{disabled:!0,children:`Loading revisions...`}):d.length===0?(0,G.jsx)(Dn,{disabled:!0,children:`No saved revisions yet`}):d.map(e=>(0,G.jsx)(Dn,{disabled:e.fileHash===a,onClick:()=>{m(null),g({entry:e,expectedFileHash:a})},children:(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,G.jsxs)(`span`,{className:`font-mono`,children:[e.revision.slice(0,8),e.fileHash===a?` · Current`:``]}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(e.savedAt).toLocaleString()})]})},e.id)),t[21]=y,t[22]=p,t[23]=a,t[24]=d,t[25]=O):O=t[25];let k;t[26]===O?k=t[27]:(k=(0,G.jsx)(En,{align:`start`,className:`max-h-80 overflow-y-auto`,children:O}),t[26]=O,t[27]=k);let A;t[28]!==l||t[29]!==D||t[30]!==k?(A=(0,G.jsxs)(wn,{open:l,onOpenChange:u,children:[D,k]}),t[28]=l,t[29]=D,t[30]=k,t[31]=A):A=t[31];let j=h!==null,M;t[32]===_?M=t[33]:(M=e=>{!e&&!_&&(g(null),m(null))},t[32]=_,t[33]=M);let N;t[34]===h?.entry.revision?N=t[35]:(N=h?.entry.revision.slice(0,8),t[34]=h?.entry.revision,t[35]=N);let P;t[36]===N?P=t[37]:(P=(0,G.jsxs)(Rn,{children:[`Restore revision `,N,`?`]}),t[36]=N,t[37]=P);let F;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,G.jsx)(zn,{children:`Replace this design with the saved version. Your current version stays in revision history. Libraries and assets are unchanged.`}),t[38]=F):F=t[38];let I;t[39]===p?I=t[40]:(I=p?(0,G.jsx)(`p`,{role:`alert`,className:`design-revision-error`,children:p}):null,t[39]=p,t[40]=I);let L;t[41]!==P||t[42]!==I?(L=(0,G.jsxs)(In,{children:[P,F,I]}),t[41]=P,t[42]=I,t[43]=L):L=t[43];let R;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{g(null),m(null)},t[44]=R):R=t[44];let ee;t[45]===_?ee=t[46]:(ee=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:_,onClick:R,children:`Cancel`}),t[45]=_,t[46]=ee);let te=_||o||!h,ne;t[47]!==_||t[48]!==r||t[49]!==c||t[50]!==h||t[51]!==n||t[52]!==s?(ne=()=>{h&&!_&&(v(!0),m(null),c(s.restoreRevision(n,r,h.entry.id,h.expectedFileHash)).then(()=>g(null),e=>m(e instanceof Error&&`code`in e&&e.code===`conflict`?`The design changed. Reopen revision history and try again.`:e instanceof Error&&`code`in e&&e.code===`invalid-document`?`This revision cannot be restored with the current libraries and assets.`:`Could not restore this revision. Reopen revision history and try again.`)).finally(()=>v(!1)))},t[47]=_,t[48]=r,t[49]=c,t[50]=h,t[51]=n,t[52]=s,t[53]=ne):ne=t[53];let re=_?`Restoring...`:`Restore revision`,z;t[54]!==te||t[55]!==ne||t[56]!==re?(z=(0,G.jsx)(W,{size:`sm`,disabled:te,onClick:ne,children:re}),t[54]=te,t[55]=ne,t[56]=re,t[57]=z):z=t[57];let ie;t[58]!==ee||t[59]!==z?(ie=(0,G.jsxs)(Ln,{children:[ee,z]}),t[58]=ee,t[59]=z,t[60]=ie):ie=t[60];let ae;t[61]!==L||t[62]!==ie?(ae=(0,G.jsxs)(Fn,{className:`max-w-md`,children:[L,ie]}),t[61]=L,t[62]=ie,t[63]=ae):ae=t[63];let oe;t[64]!==j||t[65]!==M||t[66]!==ae?(oe=(0,G.jsx)(jn,{open:j,onOpenChange:M,children:ae}),t[64]=j,t[65]=M,t[66]=ae,t[67]=oe):oe=t[67];let se;return t[68]!==A||t[69]!==oe?(se=(0,G.jsxs)(G.Fragment,{children:[A,oe]}),t[68]=A,t[69]=oe,t[70]=se):se=t[70],se}function Jn(e){let t=new URL(`p4design://open`);if(t.searchParams.set(`project`,e.projectRoot),t.searchParams.set(`file`,e.documentPath),t.searchParams.set(`revision`,e.revision),e.environmentId&&t.searchParams.set(`environment`,e.environmentId),!Yn(t.href))throw Error(`Invalid design reference.`);return t.href}function Yn(e){if(e.length>16384)return null;try{let t=new URL(e.trim());if(t.protocol!==`p4design:`||t.host!==`open`||t.username||t.password||t.hash||t.pathname)return null;let n=t.searchParams.get(`project`)??``,r=t.searchParams.get(`file`)??``,i=t.searchParams.get(`revision`)??``,a=t.searchParams.get(`environment`);return!/^(\/|[a-z]:[\\/])/i.test(n)||/\p{Cc}/u.test(n)||!r.endsWith(`.p4design`)||/^[\\/]|^[a-z]:/i.test(r)||r.split(/[\\/]/).some(e=>!e||e===`.`||e===`..`)||/\p{Cc}/u.test(r)||!/^[0-9a-f]{64}$/.test(i)||a!==null&&(!a||a.length>200)?null:{projectRoot:n,documentPath:r,revision:i,...a?{environmentId:a}:{}}}catch{return null}}var Xn=()=>null;function Zn({target:e,path:t,revision:n,compact:r=!1}){let{navigation:i}=Hn(),a=(i.useWorkspaceRoot??Xn)(e),[o,s]=(0,V.useState)(null);if(!e||!a||!t||!n)return null;let c=Jn({projectRoot:a,documentPath:t,revision:n,...i.linkEnvironment?{environmentId:e.environmentId}:{}}),l=o?.link===c?o:null;return(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsxs)(W,{size:`sm`,variant:r?`ghost`:`outline`,onClick:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(c)).then(()=>s({link:c,error:!1}),()=>s({link:c,error:!0}))},children:[(0,G.jsx)(Xe,{"aria-hidden":`true`}),l&&!l.error?`Link copied`:r?`Copy link`:`Copy design link`]}),l?.error?(0,G.jsx)(`span`,{role:`alert`,className:`text-xs`,children:`Could not copy. Try again.`}):null,l&&!l.error?(0,G.jsx)(`span`,{role:`status`,className:`sr-only`,children:`Paste into a P4 Code thread in this project.`}):null]})}var Qn=Ct,$n=ne(T),er=ne(s),tr=(e,t,n,r=`error`)=>({code:e,message:t,severity:r,...n?{nodeId:n}:{}});function nr(e){let t=e=>{if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(t).join(`,`)}]`;if(typeof e==`object`&&e&&Object.getPrototypeOf(e)===Object.prototype){let n=e;return`{${Object.keys(n).sort().map(e=>`${JSON.stringify(e)}:${t(n[e])}`).join(`,`)}}`}throw Error(`Design JSON must contain only finite JSON values`)};return`${t(e)}\n`}function rr(e){return bt(Qn(typeof e==`string`?new TextEncoder().encode(e):e))}function ir(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t||!(`version`in t)||typeof t.version!=`string`||!/^\d+\.\d+$/.test(t.version))throw Error(`Missing or invalid format version`);return t.version.split(`.`)[0]===`1`?{status:`editable`,document:$n(t,{onExcessProperty:`error`}),fileHash:rr(e),diagnostics:[]}:{status:`read-only`,raw:t,source:e,fileHash:rr(e),diagnostics:[tr(`unknown-major`,`Unsupported design version ${t.version}`)]}}catch{return{status:`invalid`,source:e,diagnostics:[tr(`invalid-schema`,`Invalid .p4design JSON or schema`)]}}}function ar(e,t){return er({...e,...t},{onExcessProperty:`error`})}function or(e){let t=new Map,n=new Map,r=[],i=(i,a,o)=>{e.nodes[i]||r.push(tr(`missing-node`,`Referenced node is missing`,a??i)),t.has(i)?r.push(tr(`multiple-parents`,`Node occurs in more than one ordered child list`,i)):(t.set(i,a),n.set(i,o))};e.roots.forEach((e,t)=>i(e,null,t));for(let[t,n]of Object.entries(e.nodes))`children`in n&&n.children.forEach((e,n)=>i(e,t,n));for(let[t,n]of Object.entries(e.instances))for(let e of Object.values(n.slots))e.forEach((e,n)=>i(e,t,n));let a=new Set,o=new Set,s=(t,n)=>{if(a.has(t)){r.push(tr(`tree-cycle`,`Child lists contain a cycle`,t));return}if(n>256){r.push(tr(`depth-limit`,`Scene exceeds 256 levels`,t));return}if(o.has(t))return;a.add(t);let i=e.nodes[t];if(i&&`children`in i)for(let e of i.children)s(e,n+1);a.delete(t),o.add(t)};for(let t of Object.keys(e.nodes))s(t,0);return{parents:t,order:n,diagnostics:r}}function sr(e,t,n={},r=new Set){if(r.has(t))throw Error(`token-cycle`);if(r.size>=256)throw Error(`token-depth-limit`);let i=e.tokens[t];if(!i)throw Error(`missing-token`);let a=new Set(r).add(t),o=i.variants.filter(e=>Object.entries(e.theme).every(([e,t])=>n[e]===t));if(o.sort((e,t)=>Object.keys(t.theme).length-Object.keys(e.theme).length),o[0]&&o.some(e=>Object.keys(e.theme).length===Object.keys(o[0].theme).length&&nr(e.value)!==nr(o[0].value)))throw Error(`ambiguous-token`);let s=o[0]?.value??i.value,c=typeof s==`object`?sr(e,s.tokenId,n,a):s;if((i.kind===`number`?typeof c!=`number`:typeof c!=`string`)||i.kind===`color`&&(typeof c!=`string`||!/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(c)))throw Error(`token-type`);return c}function cr(e,t,n={}){return typeof t==`object`?sr(e,t.tokenId,n):t}function lr(e,t={}){let n=[],r=(e,i,a,o,s,c,l)=>{let u=e.nodes[i];if(!u){n.push(tr(`missing-node`,`Expansion target is missing`,o));return}if(l>256||s.has(`${e.documentId}/node/${i}`)){n.push(tr(`component-cycle`,`Expansion contains a cycle or exceeds 256 levels`,o));return}let d=u;try{c[i]&&(d=ar(d,c[i]))}catch{n.push(tr(`invalid-override`,`Override does not match its source node`,o))}let f=new Set(s).add(`${e.documentId}/node/${i}`);if(d.type===`ref`){let s=d.importId?e.imports[d.importId]:void 0,u=s?t.manifest?.libraries[s.libraryId]:void 0,p=d.importId?u?.exports.includes(d.componentId)&&s?t.documents?.[s.libraryId]:void 0:e,m=p?.components[d.componentId];if(!p||!m)return n.push(tr(`missing-import`,`Component or exported library symbol is unavailable`,o)),{key:a,sourceId:i,ownerId:o,document:e,node:d,children:[]};let h=e.instances[i],g={...c,...h?.overrides},_=p===e?p:{...p,tokens:{...p.tokens,...e.tokens},themeAxes:{...p.themeAxes,...e.themeAxes}},v=r(_,m.rootId,`${a}/${m.rootId}`,o,f,g,l+1);if(!v)return;let y=t=>{let n=Object.entries(m.slots).find(([,e])=>e.nodeId===t.sourceId),i=n?h?.slots[n[0]]:void 0;return i?{...t,children:i.flatMap(n=>{let i=r(e,n,`${t.key}/slot/${n}`,o,f,{},l+1);return i?[i]:[]})}:{...t,children:t.children.map(y)}},{type:b,componentId:x,importId:S,...C}=d;return{...y(v),key:a,ownerId:o,node:{...v.node,...C}}}let p=`children`in d?d.children.flatMap(t=>{let n=r(e,t,`${a}/${t}`,o===i?t:o,f,c,l+1);return n?[n]:[]}):[];return{key:a,sourceId:i,ownerId:o,document:e,node:d,children:p}};return{roots:e.roots.flatMap(t=>{let n=r(e,t,t,t,new Set,{},0);return n?[n]:[]}),diagnostics:n}}function ur(e,t){let n=new Set(t),r=new Set(e.filter(e=>n.has(e.ownerId)).map(e=>e.key));return e.filter(e=>{let t=e.key;for(;t;){if(r.has(t))return!0;let e=t.lastIndexOf(`/`);if(e<0)break;t=t.slice(0,e)}return!1})}function dr(e,t={},n={}){let r=lr(e,n),i=[...r.diagnostics],a=[],o=(e,n)=>{try{let r=cr(e.document,n,t);if(typeof r!=`number`||!Number.isFinite(r))throw Error(`token-type`);return r}catch{return i.push(tr(`invalid-layout-token`,`Layout value requires a finite number`,e.ownerId)),0}},s=new Map,c=e=>{let t=s.get(e.key);if(t)return t;let n=e.node,r=e.children.map(c),a=`layout`in n?n.layout:void 0,l=a?Object.fromEntries(Object.entries(a.padding).map(([t,n])=>[t,o(e,n)])):{top:0,right:0,bottom:0,left:0},u=a?o(e,a.gap):0,d=a?.direction??`none`,f=d===`horizontal`?r.reduce((e,t)=>e+t.width,0)+Math.max(0,r.length-1)*u:Math.max(0,...r.map(e=>e.width)),p=d===`vertical`?r.reduce((e,t)=>e+t.height,0)+Math.max(0,r.length-1)*u:Math.max(0,...r.map(e=>e.height));if(d===`none`&&(f=Math.max(0,...e.children.map((e,t)=>o(e,e.node.x)+r[t].width)),p=Math.max(0,...e.children.map((e,t)=>o(e,e.node.y)+r[t].height))),n.type===`text`){let t=o(e,n.fontSize),r=n.lineHeight?o(e,n.lineHeight):1.2,i=n.text.split(`
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$o as n,AS as r,Aw as i,Cc as a,D as o,Gc as s,HS as c,Hc as l,IS as u,Iy as d,Jo as f,Lu as p,Lw as m,Mr as h,NE as g,NT as _,Nr as v,OS as y,Ox as b,Py as x,Ru as S,Sr as C,Ss as w,Uc as T,Vw as E,Vx as D,W as O,Wc as k,Xo as A,YS as j,Yo as M,Zo as N,_S as P,_n as F,_v as I,_y as L,b as R,dr as ee,ds as te,eb as ne,fS as re,fr as z,fs as ie,gr as ae,ha as oe,hv as se,hx as ce,jx as le,l as ue,lE as de,rb as fe,sr as pe,ss as me,sw as he,ur as ge,uv as B,vn as _e,vs as ve,wx as ye,xg as be,yo as xe,zS as Se}from"./utils-BAPnqm16.js";import{t as Ce}from"./arrow-down-up-B46gw0xW.js";import{t as we}from"./arrow-down-DvRecXuy.js";import{t as Te}from"./arrow-left-BLE461db.js";import{t as Ee}from"./arrow-right-CoV5ameY.js";import{t as De}from"./arrow-up-right-C6IM-WPd.js";import{t as Oe}from"./arrow-up-3Yp3lsoe.js";import{t as ke}from"./boxes-D4AJ0ucE.js";import{t as Ae}from"./check-Cmy7pM2Y.js";import{t as je}from"./chevron-down-DHV04o66.js";import{t as Me}from"./chevron-left-DrNh6cTh.js";import{t as Ne}from"./chevron-right-NbahR9_s.js";import{t as Pe}from"./chevron-up-C-w52bD6.js";import{t as Fe}from"./circle-alert-B83jEPoh.js";import{t as Ie}from"./circle-check-Y1T60J9X.js";import{t as Le}from"./circle-4zZlZno3.js";import{t as Re}from"./component-HJu09bM6.js";import{t as ze}from"./download-BAp4p4A-.js";import{t as Be}from"./ellipsis-6x3R4_IB.js";import{t as Ve}from"./file-code-corner-Dt6PpZnb.js";import{t as He}from"./focus-o7yKOd1j.js";import{t as Ue}from"./folder-CMIvEUJv.js";import{t as We}from"./frame-DGUYPXa7.js";import{t as Ge}from"./group-aBPDkCFm.js";import{t as Ke}from"./hand-Bz2YZhrG.js";import{t as qe}from"./image-xUrgiZ2i.js";import{t as Je}from"./layers-BqgDAlx3.js";import{t as Ye}from"./library-C8DuZzap.js";import{t as Xe}from"./link-zAXVcUwk.js";import{t as Ze}from"./map-pin-5mbcayYf.js";import{t as Qe}from"./maximize-2-CHT2IkVy.js";import{t as $e}from"./message-square-plus-ChUy6onn.js";import{t as et}from"./message-square-DLzUyuIE.js";import{t as tt}from"./minus-C7W28oE7.js";import{t as nt}from"./monitor-Ddj8MK6z.js";import{t as rt}from"./mouse-pointer-2-DbBU41il.js";import{t as it}from"./plus-Cr075-cy.js";import{t as at}from"./refresh-cw-PY_ECjtI.js";import{t as ot}from"./scan-search-Chb5YdZY.js";import{t as st}from"./scan-BPBcmOMp.js";import{t as ct}from"./search-Cr9eaeTj.js";import{t as lt}from"./settings-CTjEqsg3.js";import{t as ut}from"./spline-EJpY6uhz.js";import{t as dt}from"./square-DVrCvZRU.js";import{t as ft}from"./swatch-book-CO6HbEgI.js";import{t as pt}from"./type-ChjbxAhu.js";import{t as mt}from"./upload-D9-Kv89Z.js";import{t as ht}from"./wifi-off-DtJhRDhE.js";import{t as gt}from"./x-CSwbgjBe.js";import{J as _t,M as vt,Z as yt,_ as bt,dt as xt,et as St,g as Ct,it as wt,j as Tt,nt as Et,ot as Dt,st as Ot}from"./runtime-B9IDNXDU.js";import{O as kt}from"./entities-DCbEYTvn.js";import{t as At}from"./runtime-B5cKWtKn.js";import{a as jt,i as Mt,o as Nt,r as Pt,s as Ft,t as It}from"./TooltipViewport-kqulS2nz.js";import{a as Lt,c as Rt,i as zt,l as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt,u as Kt}from"./SelectScrollUpArrow-Cr4PrE_F.js";import{t as qt}from"./environments-iW64jjyO.js";import{l as Jt}from"./rightPanelStore-DfMWWfvR.js";import{t as Yt}from"./FieldControl-CVOjReHh.js";import{n as Xt,t as Zt}from"./CheckboxIndicator-D-KUEtIm.js";import{t as Qt}from"./Input-CVwvVqbx.js";import{a as $t,i as en,n as tn,r as nn,t as rn}from"./ScrollAreaCorner-BYUnXNwJ.js";import{c as an,l as on,n as sn,o as cn,r as ln,s as un,t as dn,u as fn}from"./DialogTitle-DnR18OB7.js";import{n as pn,r as mn,t as hn}from"./CollapsiblePanel-84e9KCIs.js";import{a as gn,c as _n,n as vn,o as yn,r as bn,s as xn}from"./PopoverHandle-C-e81PS3.js";import{t as Sn}from"./AlertDialogRoot-D6ed6zQR.js";var V=e(t(),1),H=g();function U(...e){return a(S(e))}var Cn=p(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 px-[calc(--spacing(3)-1px)] sm:h-8`,icon:`size-9 sm:size-8`,"icon-lg":`size-10 sm:size-9`,"icon-micro":`size-5 rounded-sm p-0 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 sm:size-7`,"icon-xl":`size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,"icon-xs":`size-7 rounded-md sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5`,lg:`h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9`,sm:`h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7`,xl:`h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`},variant:{default:`border-primary bg-primary text-primary-foreground [:active,[data-pressed]]:bg-primary/80 [:hover,[data-pressed]]:bg-primary/90`,destructive:`border-primary bg-primary text-primary-foreground [:active,[data-pressed]]:bg-primary/80 [:hover,[data-pressed]]:bg-primary/90`,"destructive-outline":`border-input bg-popover not-dark:bg-clip-padding text-foreground dark:bg-input/32 [:active,[data-pressed]]:bg-accent/70 [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground`,ghost:`border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [&_svg:not([class*='text-'])]:text-muted-foreground`,link:`border-transparent underline-offset-4 [:hover,[data-pressed]]:underline`,outline:`border-input bg-popover not-dark:bg-clip-padding text-foreground dark:bg-input/32 [:active,[data-pressed]]:bg-accent/70 [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground`,secondary:`border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90`}}});function W(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,variant:s,size:c,render:l,...u}=e;n=l;let d=n?void 0:`button`,f={className:U(Cn({className:o,size:c,variant:s})),"data-slot":`button`,type:d};a=ge,r=`button`,i=xe(f,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var G=e(de(),1),wn=ae;function Tn(e){let t=(0,H.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,G.jsx)(z,{className:r,"data-slot":`menu-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function En(e){let t=(0,H.c)(26),n,r,i,a,o,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]):({children:i,className:a,sideOffset:c,align:l,alignOffset:n,side:u,anchor:r,disableAnchorTracking:o,...s}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u);let d=c===void 0?4:c,f=l===void 0?`center`:l,p=u===void 0?`bottom`:u,m;t[10]===a?m=t[11]:(m=U(`dropdown-glass relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg outline-none transition-[scale,opacity] duration-[140ms] ease-[cubic-bezier(0.23,1,0.32,1)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 focus:outline-none`,a),t[10]=a,t[11]=m);let g;t[12]===i?g=t[13]:(g=(0,G.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:i}),t[12]=i,t[13]=g);let _;t[14]!==s||t[15]!==m||t[16]!==g?(_=(0,G.jsx)(v,{className:m,"data-slot":`menu-popup`,...s,children:g}),t[14]=s,t[15]=m,t[16]=g,t[17]=_):_=t[17];let y;return t[18]!==f||t[19]!==n||t[20]!==r||t[21]!==o||t[22]!==p||t[23]!==d||t[24]!==_?(y=(0,G.jsx)(h,{children:(0,G.jsx)(C,{align:f,alignOffset:n,anchor:r,disableAnchorTracking:o,className:`z-[60]`,"data-slot":`menu-positioner`,side:p,sideOffset:d,children:_})}),t[18]=f,t[19]=n,t[20]=r,t[21]=o,t[22]=p,t[23]=d,t[24]=_,t[25]=y):y=t[25],y}function Dn(e){let t=(0,H.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=U(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,G.jsx)(oe,{className:s,"data-inset":r,"data-slot":`menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function On(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`mx-2 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(ee,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var kn=`dialog-backdrop panel-motion fixed inset-0 z-50 transition-all duration-(--panel-duration) data-ending-style:opacity-0 data-starting-style:opacity-0`,An=`dialog-glass panel-motion -translate-y-[calc(1.25rem*var(--nested-dialogs))] relative flex min-h-0 w-full min-w-0 scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border opacity-[calc(1-0.1*var(--nested-dialogs))] outline-none transition-[scale,opacity,translate] duration-(--panel-duration) ease-in-out will-change-transform data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0`,jn=Sn,Mn=cn;function Nn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(kn,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(fn,{forceRender:!0,className:i,"data-slot":`alert-dialog-backdrop`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(sn,{className:i,"data-slot":`alert-dialog-viewport`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fn(e){let t=(0,H.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,bottomStickOnMobile:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i,o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(Nn,{}),t[4]=o):o=t[4];let s=a&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`,c;t[5]===s?c=t[6]:(c=U(s),t[5]=s,t[6]=c);let l=a&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4`,u;t[7]!==n||t[8]!==l?(u=U(An,`row-start-2 max-h-full max-w-lg text-popover-foreground`,l,n),t[7]=n,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==u?(d=(0,G.jsx)(un,{className:u,"data-slot":`alert-dialog-popup`,...r}),t[10]=r,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==c||t[14]!==d?(f=(0,G.jsxs)(Mn,{children:[o,(0,G.jsx)(Pn,{className:c,children:d})]}),t[13]=c,t[14]=d,t[15]=f):f=t[15],f}function In(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,"data-slot":`alert-dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ln(e){let t=(0,H.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o=a==="default"&&`border-t bg-muted/72 py-4`,s=a===`bare`&&`pb-6`,c;t[4]!==n||t[5]!==o||t[6]!==s?(c=U(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,o,s,n),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==r||t[9]!==c?(l=(0,G.jsx)(`div`,{className:c,"data-slot":`alert-dialog-footer`,...r}),t[8]=r,t[9]=c,t[10]=l):l=t[10],l}function Rn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`font-heading font-semibold text-xl leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(dn,{className:i,"data-slot":`alert-dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zn(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(an,{className:i,"data-slot":`alert-dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Bn=(0,V.createContext)(null);function Vn(e){let t=(0,H.c)(3),{host:n,children:r}=e,i=n,a;return t[0]!==r||t[1]!==i?(a=(0,G.jsx)(Bn,{value:i,children:r}),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Hn(){let e=(0,V.use)(Bn);if(!e)throw Error(`Design workspace rendered outside a DesignHostProvider`);return e}var Un=n(ve(!1)).pipe(me(`design-query:empty`));function Wn(e){let t=i(e);return t instanceof Error&&t.message.trim().length>0?t.message:`The environment request failed.`}function Gn(e){let t=(0,H.c)(10),n=e??Un,r=M(n),i=f(n),a;t[0]===r?a=t[1]:(a=_(w(r)),t[0]=r,t[1]=a);let o;t[2]!==r._tag||t[3]!==r.cause?(o=r._tag===`Failure`?Wn(r.cause):null,t[2]=r._tag,t[3]=r.cause,t[4]=o):o=t[4];let s=e!==null&&r.waiting,c;return t[5]!==i||t[6]!==a||t[7]!==o||t[8]!==s?(c={data:a,error:o,isPending:s,refresh:i},t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Kn(){let e=Hn(),t=(0,V.useContext)(A);return(0,V.useCallback)(async n=>{let r=e.runtime.atom(n),a=await y(u(D(function*(){return yield*ie(t,r),yield*te(t,r,{suspendOnWaiting:!0})})));if(he(a))throw i(a.cause);return a.value},[e,t])}function qn(e){let t=(0,H.c)(71),{target:n,path:r,revision:i,fileHash:a,disabled:o}=e,{transport:s}=Hn(),c=Kn(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(0),x;t[0]!==l||t[1]!==r||t[2]!==c||t[3]!==n||t[4]!==s?(x=()=>{if(!l)return;let e=!0;return f(null),m(null),c(s.revisions(n,r)).then(t=>{e&&f(t)},()=>{e&&m(`Could not load revisions.`)}),()=>{e=!1}},t[0]=l,t[1]=r,t[2]=c,t[3]=n,t[4]=s,t[5]=x):x=t[5];let S;t[6]!==y||t[7]!==l||t[8]!==r||t[9]!==c||t[10]!==n||t[11]!==s?(S=[l,y,n,r,s,c],t[6]=y,t[7]=l,t[8]=r,t[9]=c,t[10]=n,t[11]=s,t[12]=S):S=t[12],(0,V.useEffect)(x,S);let C=o||_,w;t[13]===C?w=t[14]:(w=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:C,"aria-label":`Design revisions`,className:`design-mono`}),t[13]=C,t[14]=w);let T;t[15]===i?T=t[16]:(T=i?.slice(0,8)??`unavailable`,t[15]=i,t[16]=T);let E;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,G.jsx)(je,{"aria-hidden":`true`}),t[17]=E):E=t[17];let D;t[18]!==w||t[19]!==T?(D=(0,G.jsxs)(Tn,{render:w,children:[`Revision `,T,E]}),t[18]=w,t[19]=T,t[20]=D):D=t[20];let O;t[21]!==y||t[22]!==p||t[23]!==a||t[24]!==d?(O=p?(0,G.jsxs)(Dn,{onClick:()=>b(y+1),children:[p,` Retry`]}):d===null?(0,G.jsx)(Dn,{disabled:!0,children:`Loading revisions...`}):d.length===0?(0,G.jsx)(Dn,{disabled:!0,children:`No saved revisions yet`}):d.map(e=>(0,G.jsx)(Dn,{disabled:e.fileHash===a,onClick:()=>{m(null),g({entry:e,expectedFileHash:a})},children:(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,G.jsxs)(`span`,{className:`font-mono`,children:[e.revision.slice(0,8),e.fileHash===a?` · Current`:``]}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(e.savedAt).toLocaleString()})]})},e.id)),t[21]=y,t[22]=p,t[23]=a,t[24]=d,t[25]=O):O=t[25];let k;t[26]===O?k=t[27]:(k=(0,G.jsx)(En,{align:`start`,className:`max-h-80 overflow-y-auto`,children:O}),t[26]=O,t[27]=k);let A;t[28]!==l||t[29]!==D||t[30]!==k?(A=(0,G.jsxs)(wn,{open:l,onOpenChange:u,children:[D,k]}),t[28]=l,t[29]=D,t[30]=k,t[31]=A):A=t[31];let j=h!==null,M;t[32]===_?M=t[33]:(M=e=>{!e&&!_&&(g(null),m(null))},t[32]=_,t[33]=M);let N;t[34]===h?.entry.revision?N=t[35]:(N=h?.entry.revision.slice(0,8),t[34]=h?.entry.revision,t[35]=N);let P;t[36]===N?P=t[37]:(P=(0,G.jsxs)(Rn,{children:[`Restore revision `,N,`?`]}),t[36]=N,t[37]=P);let F;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,G.jsx)(zn,{children:`Replace this design with the saved version. Your current version stays in revision history. Libraries and assets are unchanged.`}),t[38]=F):F=t[38];let I;t[39]===p?I=t[40]:(I=p?(0,G.jsx)(`p`,{role:`alert`,className:`design-revision-error`,children:p}):null,t[39]=p,t[40]=I);let L;t[41]!==P||t[42]!==I?(L=(0,G.jsxs)(In,{children:[P,F,I]}),t[41]=P,t[42]=I,t[43]=L):L=t[43];let R;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{g(null),m(null)},t[44]=R):R=t[44];let ee;t[45]===_?ee=t[46]:(ee=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:_,onClick:R,children:`Cancel`}),t[45]=_,t[46]=ee);let te=_||o||!h,ne;t[47]!==_||t[48]!==r||t[49]!==c||t[50]!==h||t[51]!==n||t[52]!==s?(ne=()=>{h&&!_&&(v(!0),m(null),c(s.restoreRevision(n,r,h.entry.id,h.expectedFileHash)).then(()=>g(null),e=>m(e instanceof Error&&`code`in e&&e.code===`conflict`?`The design changed. Reopen revision history and try again.`:e instanceof Error&&`code`in e&&e.code===`invalid-document`?`This revision cannot be restored with the current libraries and assets.`:`Could not restore this revision. Reopen revision history and try again.`)).finally(()=>v(!1)))},t[47]=_,t[48]=r,t[49]=c,t[50]=h,t[51]=n,t[52]=s,t[53]=ne):ne=t[53];let re=_?`Restoring...`:`Restore revision`,z;t[54]!==te||t[55]!==ne||t[56]!==re?(z=(0,G.jsx)(W,{size:`sm`,disabled:te,onClick:ne,children:re}),t[54]=te,t[55]=ne,t[56]=re,t[57]=z):z=t[57];let ie;t[58]!==ee||t[59]!==z?(ie=(0,G.jsxs)(Ln,{children:[ee,z]}),t[58]=ee,t[59]=z,t[60]=ie):ie=t[60];let ae;t[61]!==L||t[62]!==ie?(ae=(0,G.jsxs)(Fn,{className:`max-w-md`,children:[L,ie]}),t[61]=L,t[62]=ie,t[63]=ae):ae=t[63];let oe;t[64]!==j||t[65]!==M||t[66]!==ae?(oe=(0,G.jsx)(jn,{open:j,onOpenChange:M,children:ae}),t[64]=j,t[65]=M,t[66]=ae,t[67]=oe):oe=t[67];let se;return t[68]!==A||t[69]!==oe?(se=(0,G.jsxs)(G.Fragment,{children:[A,oe]}),t[68]=A,t[69]=oe,t[70]=se):se=t[70],se}function Jn(e){let t=new URL(`p4design://open`);if(t.searchParams.set(`project`,e.projectRoot),t.searchParams.set(`file`,e.documentPath),t.searchParams.set(`revision`,e.revision),e.environmentId&&t.searchParams.set(`environment`,e.environmentId),!Yn(t.href))throw Error(`Invalid design reference.`);return t.href}function Yn(e){if(e.length>16384)return null;try{let t=new URL(e.trim());if(t.protocol!==`p4design:`||t.host!==`open`||t.username||t.password||t.hash||t.pathname)return null;let n=t.searchParams.get(`project`)??``,r=t.searchParams.get(`file`)??``,i=t.searchParams.get(`revision`)??``,a=t.searchParams.get(`environment`);return!/^(\/|[a-z]:[\\/])/i.test(n)||/\p{Cc}/u.test(n)||!r.endsWith(`.p4design`)||/^[\\/]|^[a-z]:/i.test(r)||r.split(/[\\/]/).some(e=>!e||e===`.`||e===`..`)||/\p{Cc}/u.test(r)||!/^[0-9a-f]{64}$/.test(i)||a!==null&&(!a||a.length>200)?null:{projectRoot:n,documentPath:r,revision:i,...a?{environmentId:a}:{}}}catch{return null}}var Xn=()=>null;function Zn({target:e,path:t,revision:n,compact:r=!1}){let{navigation:i}=Hn(),a=(i.useWorkspaceRoot??Xn)(e),[o,s]=(0,V.useState)(null);if(!e||!a||!t||!n)return null;let c=Jn({projectRoot:a,documentPath:t,revision:n,...i.linkEnvironment?{environmentId:e.environmentId}:{}}),l=o?.link===c?o:null;return(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,G.jsxs)(W,{size:`sm`,variant:r?`ghost`:`outline`,onClick:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(c)).then(()=>s({link:c,error:!1}),()=>s({link:c,error:!0}))},children:[(0,G.jsx)(Xe,{"aria-hidden":`true`}),l&&!l.error?`Link copied`:r?`Copy link`:`Copy design link`]}),l?.error?(0,G.jsx)(`span`,{role:`alert`,className:`text-xs`,children:`Could not copy. Try again.`}):null,l&&!l.error?(0,G.jsx)(`span`,{role:`status`,className:`sr-only`,children:`Paste into a P4 Code thread in this project.`}):null]})}var Qn=Ct,$n=ne(T),er=ne(s),tr=(e,t,n,r=`error`)=>({code:e,message:t,severity:r,...n?{nodeId:n}:{}});function nr(e){let t=e=>{if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(t).join(`,`)}]`;if(typeof e==`object`&&e&&Object.getPrototypeOf(e)===Object.prototype){let n=e;return`{${Object.keys(n).sort().map(e=>`${JSON.stringify(e)}:${t(n[e])}`).join(`,`)}}`}throw Error(`Design JSON must contain only finite JSON values`)};return`${t(e)}\n`}function rr(e){return bt(Qn(typeof e==`string`?new TextEncoder().encode(e):e))}function ir(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t||!(`version`in t)||typeof t.version!=`string`||!/^\d+\.\d+$/.test(t.version))throw Error(`Missing or invalid format version`);return t.version.split(`.`)[0]===`1`?{status:`editable`,document:$n(t,{onExcessProperty:`error`}),fileHash:rr(e),diagnostics:[]}:{status:`read-only`,raw:t,source:e,fileHash:rr(e),diagnostics:[tr(`unknown-major`,`Unsupported design version ${t.version}`)]}}catch{return{status:`invalid`,source:e,diagnostics:[tr(`invalid-schema`,`Invalid .p4design JSON or schema`)]}}}function ar(e,t){return er({...e,...t},{onExcessProperty:`error`})}function or(e){let t=new Map,n=new Map,r=[],i=(i,a,o)=>{e.nodes[i]||r.push(tr(`missing-node`,`Referenced node is missing`,a??i)),t.has(i)?r.push(tr(`multiple-parents`,`Node occurs in more than one ordered child list`,i)):(t.set(i,a),n.set(i,o))};e.roots.forEach((e,t)=>i(e,null,t));for(let[t,n]of Object.entries(e.nodes))`children`in n&&n.children.forEach((e,n)=>i(e,t,n));for(let[t,n]of Object.entries(e.instances))for(let e of Object.values(n.slots))e.forEach((e,n)=>i(e,t,n));let a=new Set,o=new Set,s=(t,n)=>{if(a.has(t)){r.push(tr(`tree-cycle`,`Child lists contain a cycle`,t));return}if(n>256){r.push(tr(`depth-limit`,`Scene exceeds 256 levels`,t));return}if(o.has(t))return;a.add(t);let i=e.nodes[t];if(i&&`children`in i)for(let e of i.children)s(e,n+1);a.delete(t),o.add(t)};for(let t of Object.keys(e.nodes))s(t,0);return{parents:t,order:n,diagnostics:r}}function sr(e,t,n={},r=new Set){if(r.has(t))throw Error(`token-cycle`);if(r.size>=256)throw Error(`token-depth-limit`);let i=e.tokens[t];if(!i)throw Error(`missing-token`);let a=new Set(r).add(t),o=i.variants.filter(e=>Object.entries(e.theme).every(([e,t])=>n[e]===t));if(o.sort((e,t)=>Object.keys(t.theme).length-Object.keys(e.theme).length),o[0]&&o.some(e=>Object.keys(e.theme).length===Object.keys(o[0].theme).length&&nr(e.value)!==nr(o[0].value)))throw Error(`ambiguous-token`);let s=o[0]?.value??i.value,c=typeof s==`object`?sr(e,s.tokenId,n,a):s;if((i.kind===`number`?typeof c!=`number`:typeof c!=`string`)||i.kind===`color`&&(typeof c!=`string`||!/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(c)))throw Error(`token-type`);return c}function cr(e,t,n={}){return typeof t==`object`?sr(e,t.tokenId,n):t}function lr(e,t={}){let n=[],r=(e,i,a,o,s,c,l)=>{let u=e.nodes[i];if(!u){n.push(tr(`missing-node`,`Expansion target is missing`,o));return}if(l>256||s.has(`${e.documentId}/node/${i}`)){n.push(tr(`component-cycle`,`Expansion contains a cycle or exceeds 256 levels`,o));return}let d=u;try{c[i]&&(d=ar(d,c[i]))}catch{n.push(tr(`invalid-override`,`Override does not match its source node`,o))}let f=new Set(s).add(`${e.documentId}/node/${i}`);if(d.type===`ref`){let s=d.importId?e.imports[d.importId]:void 0,u=s?t.manifest?.libraries[s.libraryId]:void 0,p=d.importId?u?.exports.includes(d.componentId)&&s?t.documents?.[s.libraryId]:void 0:e,m=p?.components[d.componentId];if(!p||!m)return n.push(tr(`missing-import`,`Component or exported library symbol is unavailable`,o)),{key:a,sourceId:i,ownerId:o,document:e,node:d,children:[]};let h=e.instances[i],g={...c,...h?.overrides},_=p===e?p:{...p,tokens:{...p.tokens,...e.tokens},themeAxes:{...p.themeAxes,...e.themeAxes}},v=r(_,m.rootId,`${a}/${m.rootId}`,o,f,g,l+1);if(!v)return;let y=t=>{let n=Object.entries(m.slots).find(([,e])=>e.nodeId===t.sourceId),i=n?h?.slots[n[0]]:void 0;return i?{...t,children:i.flatMap(n=>{let i=r(e,n,`${t.key}/slot/${n}`,o,f,{},l+1);return i?[i]:[]})}:{...t,children:t.children.map(y)}},{type:b,componentId:x,importId:S,...C}=d;return{...y(v),key:a,ownerId:o,node:{...v.node,...C}}}let p=`children`in d?d.children.flatMap(t=>{let n=r(e,t,`${a}/${t}`,o===i?t:o,f,c,l+1);return n?[n]:[]}):[];return{key:a,sourceId:i,ownerId:o,document:e,node:d,children:p}};return{roots:e.roots.flatMap(t=>{let n=r(e,t,t,t,new Set,{},0);return n?[n]:[]}),diagnostics:n}}function ur(e,t){let n=new Set(t),r=new Set(e.filter(e=>n.has(e.ownerId)).map(e=>e.key));return e.filter(e=>{let t=e.key;for(;t;){if(r.has(t))return!0;let e=t.lastIndexOf(`/`);if(e<0)break;t=t.slice(0,e)}return!1})}function dr(e,t={},n={}){let r=lr(e,n),i=[...r.diagnostics],a=[],o=(e,n)=>{try{let r=cr(e.document,n,t);if(typeof r!=`number`||!Number.isFinite(r))throw Error(`token-type`);return r}catch{return i.push(tr(`invalid-layout-token`,`Layout value requires a finite number`,e.ownerId)),0}},s=new Map,c=e=>{let t=s.get(e.key);if(t)return t;let n=e.node,r=e.children.map(c),a=`layout`in n?n.layout:void 0,l=a?Object.fromEntries(Object.entries(a.padding).map(([t,n])=>[t,o(e,n)])):{top:0,right:0,bottom:0,left:0},u=a?o(e,a.gap):0,d=a?.direction??`none`,f=d===`horizontal`?r.reduce((e,t)=>e+t.width,0)+Math.max(0,r.length-1)*u:Math.max(0,...r.map(e=>e.width)),p=d===`vertical`?r.reduce((e,t)=>e+t.height,0)+Math.max(0,r.length-1)*u:Math.max(0,...r.map(e=>e.height));if(d===`none`&&(f=Math.max(0,...e.children.map((e,t)=>o(e,e.node.x)+r[t].width)),p=Math.max(0,...e.children.map((e,t)=>o(e,e.node.y)+r[t].height))),n.type===`text`){let t=o(e,n.fontSize),r=n.lineHeight?o(e,n.lineHeight):1.2,i=n.text.split(`
2
2
  `);f=Math.max(0,...i.map(e=>e.length))*t*.6,p=i.length*t*r}f+=l.left+l.right,p+=l.top+l.bottom;let m={width:n.width.mode===`fixed`?o(e,n.width.value):n.width.mode===`hug`?f:0,height:n.height.mode===`fixed`?o(e,n.height.value):n.height.mode===`hug`?p:0};for(let t of[`width`,`height`])m[t]<0&&(i.push(tr(`negative-size`,`Dimensions cannot be negative`,e.ownerId)),m[t]=0),n[t].mode===`hug`&&e.children.some(e=>e.node[t].mode===`fill`)&&i.push(tr(`layout-cycle`,`A hug dimension cannot contain fill on the same axis`,e.ownerId));return s.set(e.key,m),m},l=(e,t,n,r,i,s,u=!0)=>{let d={x:t,y:n,width:r,height:i},f=u&&e.node.visible!==!1;a.push({...e,node:{...e.node,visible:f},bounds:d,clips:s});let p=`layout`in e.node?e.node.layout:void 0,m=p?Object.fromEntries(Object.entries(p.padding).map(([t,n])=>[t,o(e,n)])):{top:0,right:0,bottom:0,left:0},h=p?o(e,p.gap):0,g=p?.direction??`none`,_={width:Math.max(0,r-m.left-m.right),height:Math.max(0,i-m.top-m.bottom)},v=g===`horizontal`?`width`:`height`,y=e.children.filter(e=>e.node[v].mode===`fill`).length,b=e.children.reduce((e,t)=>e+(t.node[v].mode===`fill`?0:c(t)[v]),0)+Math.max(0,e.children.length-1)*h,x=y?Math.max(0,_[v]-b)/y:0,S=0,C=e.node.type===`frame`&&e.node.clip?[...s,d]:s;for(let r of e.children){let e=c(r),i={width:r.node.width.mode===`fill`?g===`horizontal`?x:_.width:e.width,height:r.node.height.mode===`fill`?g===`vertical`?x:_.height:e.height},a=t+m.left+(g===`horizontal`?S:g===`none`?o(r,r.node.x):0),s=n+m.top+(g===`vertical`?S:g===`none`?o(r,r.node.y):0);l(r,a,s,i.width,i.height,C,f),S+=i[v]+h}};for(let e of r.roots){let t=c(e);(e.node.width.mode===`fill`||e.node.height.mode===`fill`)&&i.push(tr(`root-fill`,`Root dimensions need fixed or hug sizing`,e.ownerId)),l(e,o(e,e.node.x),o(e,e.node.y),t.width,t.height,[])}return{items:a,diagnostics:i}}function fr(e,t){let n=[],r=(e,t,i)=>{if(e===void 0){n.push({path:i,kind:`added`,after:t});return}if(t===void 0){n.push({path:i,kind:`removed`,before:e});return}if(nr(e)!==nr(t)){if(e&&t&&typeof e==`object`&&typeof t==`object`&&!Array.isArray(e)&&!Array.isArray(t)){let n=e,a=t;for(let e of[...new Set([...Object.keys(n),...Object.keys(a)])].sort())r(n[e],a[e],`${i}/${e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`)}else n.push({path:i,kind:`changed`,before:e,after:t})}};return r(e,t,``),n}var pr=p(`relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive`,info:`border-info/32 bg-info/4 [&_svg]:text-info`,success:`border-success/32 bg-success/4 [&_svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&_svg]:text-warning`}}});function mr(e){let t=e.props[`data-slot`];if(t)return t;let n=e.type;switch(n.displayName??n.name){case`AlertAction`:return`alert-action`;case`AlertTitle`:return`alert-title`;case`AlertDescription`:return`alert-description`;default:return}}function hr(e){let t=(0,H.c)(26),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,variant:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o,s,c;t[5]===n?(o=t[6],s=t[7],c=t[8]):(c=[],s=[],o=[],V.Children.forEach(n,e=>{if(!(0,V.isValidElement)(e)){s.push(e);return}let t=mr(e);t===`alert-action`?o.push(e):t===`alert-title`||t===`alert-description`?s.push(e):c.push(e)}),t[5]=n,t[6]=o,t[7]=s,t[8]=c);let l;t[9]!==r||t[10]!==a?(l=U(pr({variant:a}),r),t[9]=r,t[10]=a,t[11]=l):l=t[11];let u;t[12]===c?u=t[13]:(u=c.length>0&&(0,G.jsx)(`div`,{className:`flex size-4 shrink-0 items-center justify-center [&>svg]:size-full`,children:c}),t[12]=c,t[13]=u);let d;t[14]===s?d=t[15]:(d=s.length>0&&(0,G.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:s}),t[14]=s,t[15]=d);let f;t[16]===o?f=t[17]:(f=o.length>0&&(0,G.jsx)(`div`,{className:`flex shrink-0 items-center self-center`,"data-slot":`alert-actions`,children:o}),t[16]=o,t[17]=f);let p;t[18]!==u||t[19]!==d||t[20]!==f?(p=(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,"data-slot":`alert-row`,children:[u,d,f]}),t[18]=u,t[19]=d,t[20]=f,t[21]=p):p=t[21];let m;return t[22]!==i||t[23]!==l||t[24]!==p?(m=(0,G.jsx)(`div`,{className:l,"data-slot":`alert`,role:`alert`,...i,children:p}),t[22]=i,t[23]=l,t[24]=p,t[25]=m):m=t[25],m}function gr(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,"data-slot":`alert-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _r(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`flex gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,"data-slot":`alert-action`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}gr.displayName=`AlertTitle`,_r.displayName=`AlertAction`;var vr=p(`relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-5.5 min-w-5.5 px-[calc(--spacing(1)-1px)] text-sm sm:h-4.5 sm:min-w-4.5 sm:text-xs`,lg:`h-6.5 min-w-6.5 px-[calc(--spacing(1.5)-1px)] text-base sm:h-5.5 sm:min-w-5.5 sm:text-sm`,sm:`h-5 min-w-5 rounded-[.25rem] px-[calc(--spacing(1)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]`},variant:{default:`bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90`,destructive:`bg-destructive text-white [button&,a&]:hover:bg-destructive/90`,error:`bg-destructive/8 text-destructive-foreground dark:bg-destructive/16`,info:`bg-info/8 text-info-foreground dark:bg-info/16`,outline:`border-input bg-background text-foreground dark:bg-input/32 [button&,a&]:hover:bg-accent/50 dark:[button&,a&]:hover:bg-input/48`,secondary:`bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90`,success:`bg-success/8 text-success-foreground dark:bg-success/16`,warning:`bg-warning/8 text-warning-foreground dark:bg-warning/16`}}});function yr(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,variant:s,size:c,render:l,...u}=e;n=l;let d={className:U(vr({className:o,size:c,variant:s})),"data-slot":`badge`};a=ge,r=`span`,i=xe(d,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var br=_n;function xr(e){let t=(0,H.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,G.jsx)(xn,{className:r,"data-slot":`popover-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Sr(e){let t=(0,H.c)(33),n,r,i,a,o,s,c,l,u,d,f;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11]):({children:r,className:i,viewportClassName:f,side:s,align:c,sideOffset:l,alignOffset:u,tooltipStyle:d,anchor:n,collisionAvoidance:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f);let p=s===void 0?`bottom`:s,m=c===void 0?`center`:c,h=l===void 0?4:l,g=u===void 0?0:u,_=d!==void 0&&d,v=_&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,y;t[12]!==i||t[13]!==v?(y=U(`dropdown-glass relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg text-popover-foreground outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,v,i),t[12]=i,t[13]=v,t[14]=y):y=t[14];let b=_?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,x;t[15]!==b||t[16]!==f?(x=U(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,b,f),t[15]=b,t[16]=f,t[17]=x):x=t[17];let S;t[18]!==r||t[19]!==x?(S=(0,G.jsx)(vn,{className:x,"data-slot":`popover-viewport`,children:r}),t[18]=r,t[19]=x,t[20]=S):S=t[20];let C;t[21]!==o||t[22]!==S||t[23]!==y?(C=(0,G.jsx)(bn,{className:y,"data-slot":`popover-popup`,...o,children:S}),t[21]=o,t[22]=S,t[23]=y,t[24]=C):C=t[24];let w;return t[25]!==m||t[26]!==g||t[27]!==n||t[28]!==a||t[29]!==p||t[30]!==h||t[31]!==C?(w=(0,G.jsx)(yn,{children:(0,G.jsx)(gn,{align:m,alignOffset:g,anchor:n,collisionAvoidance:a,className:`z-[60] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-transform data-instant:transition-none`,"data-slot":`popover-positioner`,side:p,sideOffset:h,children:C})}),t[25]=m,t[26]=g,t[27]=n,t[28]=a,t[29]=p,t[30]=h,t[31]=C,t[32]=w):w=t[32],w}var Cr=Kt,wr=p(`relative inline-flex cursor-pointer select-none items-center justify-between gap-2 border rounded-lg text-left text-base outline-none transition-[color,box-shadow,background-color] data-disabled:pointer-events-none data-disabled:opacity-64 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4`,{defaultVariants:{size:`default`,variant:`default`},variants:{variant:{default:`w-full min-w-36 border-input bg-background not-dark:bg-clip-padding text-foreground shadow-xs/5 ring-ring/24 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 dark:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='text-'])]:text-muted-foreground [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none`,ghost:`border-transparent text-muted-foreground/70 focus-visible:ring-2 focus-visible:ring-ring data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [:hover,[data-pressed]]:text-foreground/80`},size:{default:`min-h-9 px-[calc(--spacing(3)-1px)] sm:min-h-8`,lg:`min-h-10 px-[calc(--spacing(3)-1px)] sm:min-h-9`,sm:`min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`}}});function Tr(e){let t=(0,H.c)(20),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,size:o,variant:s,children:n,icon:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=o===void 0?`default`:o,l=s===void 0?`default`:s,u;t[7]!==r||t[8]!==c||t[9]!==l?(u=U(wr({size:c,variant:l}),r),t[7]=r,t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]===i?d=t[12]:(d=i??(0,G.jsx)(je,{className:`-me-1 size-3 opacity-50`}),t[11]=i,t[12]=d);let f;t[13]===d?f=t[14]:(f=(0,G.jsx)(F,{"data-slot":`select-icon`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==n||t[16]!==a||t[17]!==u||t[18]!==f?(p=(0,G.jsxs)(_e,{className:u,"data-slot":`select-trigger`,...a,children:[n,f]}),t[15]=n,t[16]=a,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function Er(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`flex-1 truncate data-placeholder:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(Bt,{className:i,"data-slot":`select-value`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dr(e){let t=(0,H.c)(36),n,r,i,a,o,s,c,l,u,d,f;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11]):({className:i,popupClassName:a,children:r,side:s,sideOffset:c,align:l,alignOffset:u,alignItemWithTrigger:d,matchTriggerWidth:f,anchor:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f);let p=s===void 0?`bottom`:s,m=c===void 0?4:c,h=l===void 0?`start`:l,g=u===void 0?0:u,_=d===void 0||d,v=f===void 0||f,y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(Gt,{className:`top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover`,"data-slot":`select-scroll-up-arrow`,children:(0,G.jsx)(Pe,{className:`relative size-4.5 sm:size-4`})}),t[12]=y):y=t[12];let b=v&&`min-w-(--anchor-width)`,x;t[13]!==a||t[14]!==b?(x=U(`dropdown-glass relative h-full rounded-lg`,b,a),t[13]=a,t[14]=b,t[15]=x):x=t[15];let S;t[16]===i?S=t[17]:(S=U(`max-h-(--available-height) overflow-y-auto p-1`,i),t[16]=i,t[17]=S);let C;t[18]!==r||t[19]!==S?(C=(0,G.jsx)(Lt,{className:S,"data-slot":`select-list`,children:r}),t[18]=r,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==x?(w=(0,G.jsx)(`div`,{className:x,children:C}),t[21]=C,t[22]=x,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,G.jsx)(Vt,{className:`bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover`,"data-slot":`select-scroll-down-arrow`,children:(0,G.jsx)(je,{className:`relative size-4.5 sm:size-4`})}),t[24]=T):T=t[24];let E;t[25]!==o||t[26]!==w?(E=(0,G.jsxs)(Ht,{className:`origin-(--transform-origin) rounded-lg text-foreground outline-none`,"data-slot":`select-popup`,...o,children:[y,w,T]}),t[25]=o,t[26]=w,t[27]=E):E=t[27];let D;return t[28]!==h||t[29]!==_||t[30]!==g||t[31]!==n||t[32]!==p||t[33]!==m||t[34]!==E?(D=(0,G.jsx)(Rt,{children:(0,G.jsx)(Wt,{align:h,alignItemWithTrigger:_,alignOffset:g,anchor:n,className:`z-50 select-none`,"data-slot":`select-positioner`,side:p,sideOffset:m,children:E})}),t[28]=h,t[29]=_,t[30]=g,t[31]=n,t[32]=p,t[33]=m,t[34]=E,t[35]=D):D=t[35],D}function Or(e){let t=(0,H.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,hideIndicator:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=U(`flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center rounded-sm px-2 py-1 text-base outline-none data-selected:bg-foreground/[0.08] data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,G.jsx)(Ut,{className:`min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground`,"data-slot":`select-item-text`,children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==o||t[11]!==s?(c=(0,G.jsx)(zt,{className:o,"data-slot":`select-item`,...i,children:s}),t[9]=i,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}var kr=Ft;function Ar(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,G.jsx)(Nt,{"data-slot":`tooltip-trigger`,...e}),t[0]=e,t[1]=n),n}function jr(e){let t=(0,H.c)(28),n,r,i,a,o,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9]):({className:i,positionerClassName:a,align:s,sideOffset:c,side:l,variant:u,anchor:n,children:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u);let d=s===void 0?`center`:s,f=c===void 0?4:c,p=l===void 0?`top`:l,m=u===void 0?`default`:u,h;t[10]===a?h=t[11]:(h=U(`pointer-events-none z-[70] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,a),t[10]=a,t[11]=h);let g=m===`glass`?`dropdown-glass shadow-xl shadow-black/25 before:hidden`:`border bg-popover not-dark:bg-clip-padding shadow-md/5`,_;t[12]!==i||t[13]!==g?(_=U(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md text-popover-foreground text-xs transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,g,i),t[12]=i,t[13]=g,t[14]=_):_=t[14];let v;t[15]===r?v=t[16]:(v=(0,G.jsx)(It,{className:`relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,"data-slot":`tooltip-viewport`,children:r}),t[15]=r,t[16]=v);let y;t[17]!==o||t[18]!==_||t[19]!==v?(y=(0,G.jsx)(Pt,{className:_,"data-slot":`tooltip-popup`,...o,children:v}),t[17]=o,t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==d||t[22]!==n||t[23]!==p||t[24]!==f||t[25]!==h||t[26]!==y?(b=(0,G.jsx)(jt,{children:(0,G.jsx)(Mt,{align:d,anchor:n,className:h,"data-slot":`tooltip-positioner`,side:p,sideOffset:f,children:y})}),t[21]=d,t[22]=n,t[23]=p,t[24]=f,t[25]=h,t[26]=y,t[27]=b):b=t[27],b}function Mr(e){let t=(0,H.c)(11),{label:n,onClick:r,children:i}=e,a;t[0]!==n||t[1]!==r?(a=(0,G.jsx)(W,{size:`icon-sm`,variant:`ghost`,"aria-label":n,onClick:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]!==i||t[4]!==a?(o=(0,G.jsx)(Ar,{render:a,children:i}),t[3]=i,t[4]=a,t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=(0,G.jsx)(jr,{children:n}),t[6]=n,t[7]=s);let c;return t[8]!==o||t[9]!==s?(c=(0,G.jsxs)(kr,{children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function Nr(e){let t=(0,H.c)(27),{title:n,heading:r,card:i,thread:a,hostLabel:o,onOpenThread:s,onCollapse:c}=e,l=n===void 0?`Design agent`:n,u;t[0]!==r||t[1]!==l?(u=r??(0,G.jsxs)(`h2`,{children:[(0,G.jsx)(et,{"aria-hidden":`true`,size:16}),l]}),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d;t[3]===o?d=t[4]:(d=o?(0,G.jsx)(`span`,{className:`design-small-muted`,children:o}):null,t[3]=o,t[4]=d);let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(`span`,{className:`design-agent-header-spacer`}),t[5]=f):f=t[5];let p;t[6]===s?p=t[7]:(p=s?(0,G.jsx)(Mr,{label:`Open full thread`,onClick:s,children:(0,G.jsx)(De,{"aria-hidden":`true`})}):null,t[6]=s,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,G.jsx)(Me,{"aria-hidden":`true`}),t[8]=m):m=t[8];let h;t[9]===c?h=t[10]:(h=(0,G.jsx)(Mr,{label:`Hide agent`,onClick:c,children:m}),t[9]=c,t[10]=h);let g;t[11]!==u||t[12]!==d||t[13]!==p||t[14]!==h?(g=(0,G.jsxs)(`header`,{className:`design-agent-header`,children:[u,d,f,p,h]}),t[11]=u,t[12]=d,t[13]=p,t[14]=h,t[15]=g):g=t[15];let _;t[16]===i?_=t[17]:(_=i?(0,G.jsx)(`div`,{className:`design-agent-card`,children:i}):null,t[16]=i,t[17]=_);let v;t[18]===a?v=t[19]:(v=a??(0,G.jsx)(`p`,{className:`design-agent-empty`,children:`Open this design from a thread to talk to the agent.`}),t[18]=a,t[19]=v);let y;t[20]===v?y=t[21]:(y=(0,G.jsx)(`div`,{className:`design-agent-thread`,children:v}),t[20]=v,t[21]=y);let b;return t[22]!==y||t[23]!==g||t[24]!==_||t[25]!==l?(b=(0,G.jsxs)(`aside`,{className:`design-agent`,"aria-label":l,children:[g,_,y]}),t[22]=y,t[23]=g,t[24]=_,t[25]=l,t[26]=b):b=t[26],b}function Pr(e){let t=(0,H.c)(3),{onOpen:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,G.jsx)(et,{"aria-hidden":`true`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,G.jsxs)(W,{size:`sm`,variant:`outline`,className:`design-float-pill`,onClick:n,children:[r,`Agent`]}),t[1]=n,t[2]=i),i}function Fr(e,t,n,r,i=0){if(!e.length)return{x:0,y:0,width:t,height:n};let a=Math.min(...e.map(e=>e.x)),o=Math.min(...e.map(e=>e.y)),s=Math.max(...e.map(e=>e.x+e.width)),c=Math.max(...e.map(e=>e.y+e.height)),l=r===`workspace`?{left:32,right:32+i,top:72,bottom:72}:{left:56,right:24,top:56,bottom:100},u=Math.max(40,t-l.left-l.right),d=Math.max(40,n-l.top-l.bottom),f=Math.max(1,s-a),p=Math.max(1,c-o),m=Math.max(.05,Math.min(2,u/f,d/p));return{x:a-(l.left+(u-f*m)/2)/m,y:o-(l.top+(d-p*m)/2)/m,width:t/m,height:n/m}}var Ir=(e,t,n)=>Math.min(Math.max(e,t),n),Lr=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function Rr(e,t,n,r={top:60,right:12,bottom:12,left:12},i={below:32,above:12},a=null){if(e.x+e.width<0||e.x>n.width||e.y+e.height<0||e.y>n.height)return null;let o=e=>Ir(e,r.left,Math.max(r.left,n.width-r.right-t.width)),s=o(e.x+e.width/2-t.width/2),c=n.height-r.bottom,l=Math.max(r.top,e.y+e.height+i.below),u=e.y-i.above-t.height,d=[];l+t.height<=c&&d.push({x:s,y:l,side:`below`}),u>=r.top&&d.push({x:s,y:u,side:`above`});let f={x:s,y:Ir(l,r.top,Math.max(r.top,c-t.height)),side:`below`};if(!a)return d[0]??f;let p=e=>!Lr({...e,width:t.width,height:t.height},a),m=[...d,f],h=m.flatMap(e=>[{...e,x:o(a.x-i.above-t.width)},{...e,x:o(a.x+a.width+i.above)}]);return[...m,...h].find(p)??d[0]??f}var zr={width:280,height:110};function Br(e,t,n,r=null,i=zr){let a=(t,r,a)=>({side:r,placement:a,reach:r===`left`?e.x-t.x:t.x+t.width-(e.x+e.width),fits:r===`right`?t.x+t.width+i.width<=n.width:t.x>=i.width,box:{x:r===`right`?t.x+t.width:t.x-i.width,y:e.y,width:i.width,height:i.height}}),o=[...t?[a(t,`right`,`margin`),a(t,`left`,`margin`)]:[],a(e,`right`,`node`),a(e,`left`,`node`)],s=o.filter(e=>e.fits),c=s.find(e=>!r||!Lr(e.box,r))??s[0]??o.at(-2);return{side:c.side,placement:c.placement,reach:Math.max(0,c.reach)}}var Vr=e=>!!(e&&e.scrollWidth>e.clientWidth);function Hr(e,t){let n=(0,H.c)(5),[r,i]=(0,V.useState)(!1),a;n[0]===e?a=n[1]:(a=()=>{let t=e.current;if(!t)return;let n=()=>i(Vr(t));n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},n[0]=e,n[1]=a);let o;return n[2]!==e||n[3]!==t?(o=[e,t],n[2]=e,n[3]=t,n[4]=o):o=n[4],(0,V.useLayoutEffect)(a,o),r}function Ur(e){let t=(0,H.c)(15),{children:n,full:r,className:i}=e,a=r===void 0?n:r,o=i===void 0?`design-truncate`:i,s=(0,V.useRef)(null),c=Hr(s,n),[l,u]=(0,V.useState)(!1),d=l&&c,f;t[0]===c?f=t[1]:(f=e=>u(e&&c),t[0]=c,t[1]=f);let p=c?0:void 0,m;t[2]!==o||t[3]!==p?(m=(0,G.jsx)(`span`,{ref:s,className:o,tabIndex:p}),t[2]=o,t[3]=p,t[4]=m):m=t[4];let h;t[5]!==n||t[6]!==m?(h=(0,G.jsx)(Ar,{render:m,children:n}),t[5]=n,t[6]=m,t[7]=h):h=t[7];let g;t[8]===a?g=t[9]:(g=(0,G.jsx)(jr,{children:a}),t[8]=a,t[9]=g);let _;return t[10]!==d||t[11]!==f||t[12]!==h||t[13]!==g?(_=(0,G.jsxs)(kr,{open:d,onOpenChange:f,children:[h,g]}),t[10]=d,t[11]=f,t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function Wr(e){let t=(0,H.c)(12),{full:n,labelRef:r,render:i,children:a}=e,[o,s]=(0,V.useState)(!1),c;t[0]===r?c=t[1]:(c=e=>s(e&&Vr(r.current)),t[0]=r,t[1]=c);let l;t[2]!==a||t[3]!==i?(l=(0,G.jsx)(Ar,{render:i,children:a}),t[2]=a,t[3]=i,t[4]=l):l=t[4];let u;t[5]===n?u=t[6]:(u=(0,G.jsx)(jr,{children:n}),t[5]=n,t[6]=u);let d;return t[7]!==o||t[8]!==c||t[9]!==l||t[10]!==u?(d=(0,G.jsxs)(kr,{open:o,onOpenChange:c,children:[l,u]}),t[7]=o,t[8]=c,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}var Gr=Math.PI/180;function Kr(){return typeof window<`u`&&({}.toString.call(window)===`[object Window]`||{}.toString.call(window)===`[object global]`)}var qr=typeof global<`u`?global:typeof window<`u`?window:typeof WorkerGlobalScope<`u`?self:{},K={_global:qr,version:`10.7.1`,isBrowser:Kr(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return K.angleDeg?e*Gr:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_renderBackend:`web`,legacyTextRendering:!1,pixelRatio:typeof window<`u`&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return K.DD.isDragging},isTransforming(){return K.Transformer?.isTransforming()??!1},isDragReady(){return!!K.DD.node},releaseCanvasOnDestroy:!0,document:qr.document,_injectGlobal(e){qr.Konva!==void 0&&console.error(`Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.`),qr.Konva=e}},Jr=new Set,Yr=(e,t=!1)=>{K[e.prototype.getClassName()]=e,t&&Jr.add(e)};K._injectGlobal(K);var Xr=`Konva.js unsupported environment.
3
3
 
4
4
  Looks like you are trying to use Konva.js in Node.js environment (or in a Web Worker), because "document" object is undefined.
@@ -16,4 +16,4 @@ js: import "konva/skia-backend";
16
16
  `),t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.width,i=this.attrs.height,a=r!==Ss&&r!==void 0,o=i!==Ss&&i!==void 0,s=this.padding(),c=r-s*2,l=i-s*2,u=0,d=this.wrap(),f=d!==Vs&&d!==Hs,p=this.ellipsis(),m=this.measureSize(`M`);this._baselineShift=(m.fontBoundingBoxAscent-m.fontBoundingBoxDescent)/2,this.textArr=[];let h=Ys();h.font=this._getContextFont(),h.fontKerning=this.direction()!==zs&&(this.letterSpacing()!==0||this.align()===Ts||this.charRenderFunc())?`none`:`auto`;let g=p?this._getTextWidth(Us):0;for(let t=0,r=e.length;t<r;++t){let i=e[t],s=this._getTextWidth(i);if(a&&s>c){let e=xs(i),a=e.length,d=0,m=t=>e.slice(d,t).join(``),h=e=>e===Ls||e===Os,_=Math.max(1,Math.ceil(a*c/s));for(;d<a;){let i=p&&o&&u+n>l?g:0,s=e=>!(this._getTextWidth(m(e),e-d)+i>c),v=d,y=Math.min(a,d+_);for(;s(y)&&(v=y,y!==a);)y=Math.min(a,y+(y-d));for(;y-v>1;){let e=v+y>>>1;s(e)?v=e:y=e}if(v===d)break;if(v===a){this._addTextLine(m(a)),u+=n,o&&u+n>l&&t<r-1&&this._tryToAddEllipsisToLastLine();break}if(f&&!h(e[v])){let t=v-1;for(;t>=d&&!h(e[t]);)t--;t>=d&&(v=t+1)}if(this._addTextLine(m(v).trimRight()),u+=n,this._shouldHandleEllipsis(u)){this._tryToAddEllipsisToLastLine();break}for(d=v;d<a&&!e[d].trim();)d++}}else this._addTextLine(i),u+=n,o&&u+n>l&&t<r-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),o&&u+n>l)break}this.textHeight=t,this.textWidth=this.textArr.reduce((e,t)=>Math.max(e,t.width),0)}_shouldHandleEllipsis(e){let t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,i=r!==Ss&&r!==void 0,a=r-this.padding()*2;return this.wrap()===Hs||i&&e+n>a}_tryToAddEllipsisToLastLine(){let e=this.attrs.width,t=e!==Ss&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),i=this.textArr[this.textArr.length-1];if(!i||!r)return;let a=i.text+Us;if(t){let e=xs(i.text);for(;e.length&&this._getTextWidth(a)>n;)e.pop(),a=e.join(``)+Us;this._getTextWidth(a)>n&&(a=``)}i.text=a,i.width=this._getTextWidth(a)}getStrokeScaleEnabled(){return!0}_getStrokePadding(){return super._getStrokePadding(2)}_useBufferCanvas(e,t=this.getAbsoluteOpacity()){if(this.attrs.perfectDrawEnabled===!1)return!1;let n=this.textDecoration().indexOf(`underline`)!==-1||this.textDecoration().indexOf(`line-through`)!==-1,r=this.hasShadow();return n&&r||r&&t!==1&&Ks()?!0:super._useBufferCanvas(e,t)}};$s.prototype._fillFunc=Xs,$s.prototype._strokeFunc=Zs,$s.prototype.className=js,$s.prototype._attrsAffectingSize=Ws.filter(e=>e!==`width`&&e!==`height`).concat([`textDecoration`,`underlineOffset`]),Yr($s,!0),$s.prototype.on(Ws.map(e=>e+Es).join(` `),function(){this._setTextData()}),X.overWriteSetter($s,`width`,ea()),X.overWriteSetter($s,`height`,ea()),X.addGetterSetter($s,`direction`,ws),X.addGetterSetter($s,`fontFamily`,`Arial`),X.addGetterSetter($s,`fontSize`,12,Y()),X.addGetterSetter($s,`fontStyle`,Fs),X.addGetterSetter($s,`fontVariant`,Fs),X.addGetterSetter($s,`padding`,0,Y()),X.addGetterSetter($s,`align`,ks),X.addGetterSetter($s,`verticalAlign`,Ms),X.addGetterSetter($s,`lineHeight`,1,Y()),X.addGetterSetter($s,`wrap`,Bs),X.addGetterSetter($s,`ellipsis`,!1,ia()),X.addGetterSetter($s,`letterSpacing`,0,Y()),X.addGetterSetter($s,`text`,``,ta()),X.addGetterSetter($s,`textDecoration`,``),X.addGetterSetter($s,`underlineOffset`,void 0,Y()),X.addGetterSetter($s,`charRenderFunc`,void 0);var ec=[...$s.prototype._attrsAffectingSize,`width`,`height`,`pointerDirection`,`pointerWidth`,`pointerHeight`].map(e=>e+`Change.konva`).join(` `),tc=`none`,nc=`up`,rc=`right`,ic=`down`,ac=`left`,oc=class extends Fo{constructor(e){super(e),this._sync=this._sync.bind(this),this.on(`add.konva`,function(e){e.child.off(ec,this._sync).on(ec,this._sync),this._sync()})}getText(){return this.find(`Text`)[0]}getTag(){return this.find(`Tag`)[0]}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,i,a,o,s,c;if(e&&t){switch(n=e.width(),r=e.height(),i=t.pointerDirection(),a=t.pointerWidth(),c=t.pointerHeight(),o=0,s=0,i){case nc:o=n/2,s=-1*c;break;case rc:o=n+a,s=r/2;break;case ic:o=n/2,s=r+c;break;case ac:o=-1*a,s=r/2}t.setAttrs({x:-1*o,y:-1*s,width:n,height:r}),e.setAttrs({x:-1*o,y:-1*s})}}};oc.prototype.className=`Label`,Yr(oc);var sc=class extends Q{_sceneFunc(e){let t=this.width(),n=this.height(),r=this.pointerDirection(),i=this.pointerWidth(),a=this.pointerHeight(),o=this.cornerRadius(),[s,c,l,u]=q._cornerRadii(o,t,n);e.beginPath(),e.moveTo(s,0),r===nc&&(e.lineTo((t-i)/2,0),e.lineTo(t/2,-1*a),e.lineTo((t+i)/2,0)),e.lineTo(t-c,0),e.arc(t-c,c,c,Math.PI*3/2,0,!1),r===rc&&(e.lineTo(t,(n-a)/2),e.lineTo(t+i,n/2),e.lineTo(t,(n+a)/2)),e.lineTo(t,n-l),e.arc(t-l,n-l,l,0,Math.PI/2,!1),r===ic&&(e.lineTo((t+i)/2,n),e.lineTo(t/2,n+a),e.lineTo((t-i)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===ac&&(e.lineTo(0,(n+a)/2),e.lineTo(-1*i,n/2),e.lineTo(0,(n-a)/2)),e.lineTo(0,s),e.arc(s,s,s,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=this.pointerWidth(),t=this.pointerHeight(),n=this.pointerDirection(),r=this.width(),i=this.height();return n===nc||n===ic?{x:Math.min(0,(r-e)/2),y:n===nc?-t:0,width:Math.max(r,e),height:i+t}:n===ac||n===rc?{x:n===ac?-e:0,y:Math.min(0,(i-t)/2),width:r+e,height:Math.max(i,t)}:{x:0,y:0,width:r,height:i}}};sc.prototype.className=`Tag`,Yr(sc,!0),X.addGetterSetter(sc,`pointerDirection`,tc),X.addGetterSetter(sc,`pointerWidth`,0,Y()),X.addGetterSetter(sc,`pointerHeight`,0,Y()),X.addGetterSetter(sc,`cornerRadius`,0,$i(4));var cc=class extends Q{_getStrokePadding(){return super._getStrokePadding(this.strokeScaleEnabled()?1:void 0)}_sceneFunc(e){let t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?q.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};cc.prototype.className=`Rect`,Yr(cc,!0),X.addGetterSetter(cc,`cornerRadius`,0,$i(4));var lc=class extends Q{_sceneFunc(e){let t=this._getPoints(),n=this.radius(),r=this.sides(),i=this.cornerRadius();if(t.length){if(e.beginPath(),i)q.drawRoundedPolygonPath(e,t,r,n,i);else{e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y)}e.closePath(),e.fillStrokeShape(this)}}_getPoints(){let e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){let e=this._getPoints();if(!e.length)return{x:0,y:0,width:0,height:0};let t=e[0].x,n=e[0].x,r=e[0].y,i=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),n=Math.max(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.y)}),{x:t,y:r,width:n-t,height:i-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};lc.prototype.className=`RegularPolygon`,lc.prototype._centroid=!0,lc.prototype._attrsAffectingSize=[`radius`,`sides`],Yr(lc,!0),X.addGetterSetter(lc,`radius`,0,Y()),X.addGetterSetter(lc,`sides`,0,Y()),X.addGetterSetter(lc,`cornerRadius`,0,$i(4));var uc=Math.PI*2,dc=class extends Q{_getStrokePadding(){return super._getStrokePadding(1)}_sceneFunc(e){let t=Math.abs(this.innerRadius()),n=Math.abs(this.outerRadius());e.beginPath(),e.arc(0,0,t,0,uc,!1),e.moveTo(n,0),e.arc(0,0,n,uc,0,!0),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=Math.max(Math.abs(this.innerRadius()),Math.abs(this.outerRadius()));return{x:-e,y:-e,width:e*2,height:e*2}}getWidth(){return Math.abs(this.outerRadius())*2}getHeight(){return Math.abs(this.outerRadius())*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};dc.prototype.className=`Ring`,dc.prototype._centroid=!0,dc.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],Yr(dc,!0),X.addGetterSetter(dc,`innerRadius`,0,Y()),X.addGetterSetter(dc,`outerRadius`,0,Y());var fc=class extends Q{constructor(e){super(e),this._updated=!0,this.anim=new Lo(()=>{let e=this._updated;return this._updated=!1,e}),this.on(`animationChange.konva`,function(){this.frameIndex(0)}),this.on(`frameIndexChange.konva`,function(){this._updated=!0}),this.on(`frameRateChange.konva`,function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_getFrame(){let e=this.animation(),t=this.animations()?.[e],n=this.frameIndex(),r=n*4;if(!t||!Number.isInteger(n)||r<0||r+4>t.length)return;let i=this.frameOffsets()?.[e]||[];return{x:t[r],y:t[r+1],width:t[r+2],height:t[r+3],offsetX:i[n*2]||0,offsetY:i[n*2+1]||0}}_getStrokePadding(){return super._getStrokePadding(this.strokeScaleEnabled()?1:void 0)}_sceneFunc(e){let t=this._getFrame();if(!t)return;let{x:n,y:r,width:i,height:a,offsetX:o,offsetY:s}=t,c=this.image();(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(o,s,i,a),e.closePath(),e.fillStrokeShape(this)),c&&e.drawImage(c,n,r,i,a,o,s,i,a)}_hitFunc(e){let{x:t,y:n,width:r,height:i}=this.getSelfRect();e.beginPath(),e.rect(t,n,r,i),e.closePath(),e.fillShape(this)}getSelfRect(){let e=this._getFrame();return e?{x:e.offsetX,y:e.offsetY,width:e.width,height:e.height}:{x:0,y:0,width:0,height:0}}_useBufferCanvas(e,t=this.getAbsoluteOpacity()){return super._useBufferCanvas(!0,t)}_setInterval(){let e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;let e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}destroy(){return this.stop(),super.destroy()}isRunning(){return this.anim.isRunning()}_updateIndex(){let e=this.frameIndex(),t=this.animations()?.[this.animation()],n=t?t.length/4:0;this.frameIndex(e<n-1?e+1:0)}};fc.prototype.className=`Sprite`,Yr(fc,!0),X.addGetterSetter(fc,`animation`),X.addGetterSetter(fc,`animations`),X.addGetterSetter(fc,`frameOffsets`),X.addGetterSetter(fc,`image`),X.addGetterSetter(fc,`frameIndex`,0,Y()),X.addGetterSetter(fc,`frameRate`,17,Y()),X.backCompat(fc,{index:`frameIndex`,getIndex:`getFrameIndex`,setIndex:`setFrameIndex`});var pc=class extends Q{_sceneFunc(e){let t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let i=1;i<r*2;i++){let a=i%2==0?n:t,o=a*Math.sin(i*Math.PI/r),s=-1*a*Math.cos(i*Math.PI/r);e.lineTo(o,s)}e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=Math.max(Math.abs(this.innerRadius()),Math.abs(this.outerRadius()));return{x:-e,y:-e,width:e*2,height:e*2}}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};pc.prototype.className=`Star`,pc.prototype._centroid=!0,pc.prototype._attrsAffectingSize=[`innerRadius`,`outerRadius`],Yr(pc,!0),X.addGetterSetter(pc,`numPoints`,5,Y()),X.addGetterSetter(pc,`innerRadius`,0,Y()),X.addGetterSetter(pc,`outerRadius`,0,Y());var mc=``,hc=`normal`;function gc(e){e.fillText(this.partialText,0,0)}function _c(e){e.strokeText(this.partialText,0,0)}var vc=class extends Q{constructor(e){super(e),this.dataArray=[],this._readDataAttribute(),this._setTextData()}_getTextPathLength(){return ms.getPathLength(this.dataArray)}_getPointAtLength(e,t){return!this.attrs.data||e>this.pathLength?null:ms.getPointAtLengthOfDataArray(e,this.dataArray,t)}_readDataAttribute(){this.dataArray=ms.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr(`font`,this._getContextFont()),e.setAttr(`textBaseline`,this.textBaseline()),e.setAttr(`textAlign`,`left`),e.save();let t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo,a=t.indexOf(`underline`)!==-1,o=t.indexOf(`line-through`)!==-1;a&&e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),this.partialText=i[t].text,e.fillStrokeShape(this),a&&(t===0&&e.moveTo(0,r/2+1),e.lineTo(i[t].width,r/2+1)),e.restore()}if(a&&(e.strokeStyle=n,e.lineWidth=bs(r),e.stroke()),o){e.beginPath();for(let t=0;t<i.length;t++){e.save();let n=i[t].p0;e.translate(n.x,n.y),e.rotate(i[t].rotation),t===0&&e.moveTo(0,0),e.lineTo(i[t].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=bs(r),e.stroke()}e.restore()}_hitFunc(e){e.beginPath();let t=this.glyphInfo;if(t.length>=1){let n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){let r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr(`lineWidth`,this.fontSize()),e.setAttr(`strokeStyle`,this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return q.warn(`text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.`),this.textHeight}setText(e){return $s.prototype.setText.call(this,e)}_getContextFont(){return $s.prototype._getContextFont.call(this)}_getTextSize(e){let t=Ys();t.save(),t.font=this._getContextFont(),t.fontKerning=`auto`;let n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){let e=xs(this.text());this.direction()===`rtl`&&e.reverse();let t=this.kerningFunc(),n=[],r=0;for(let i=0;i<e.length;i++){let a=0;if(t&&i>0)try{a=t(e[i-1],e[i])*this.fontSize()}catch{}n.push({char:e[i],width:this._getTextSize(e[i]).width,kern:a}),r+=n[i].width+a}let{width:i,height:a}=this._getTextSize(this.attrs.text);if(this.textWidth=r,this.textHeight=a,this.glyphInfo=[],!this.attrs.data)return null;let o=this.letterSpacing(),s=this.align(),c=s===`justify`?this.text().split(` `).length-1:0,l=Math.max(0,r-i),u=Math.max(this.textWidth+(e.length-1)*o,0),d=0;s===`center`&&(d=Math.max(0,this.pathLength/2-u/2)),s===`right`&&(d=Math.max(0,this.pathLength-u));let f=d,p=this.dataArray.some((e,t)=>t>0&&e.command===`M`)?void 0:{index:0,offset:0};for(let t=0;t<n.length;t++){f+=n[t].kern;let r=this._getPointAtLength(f,p);if(!r)return;let i=n[t].char,a=n[t].width+(t<n.length-1?o:0);i===` `&&s===`justify`&&(a+=(this.pathLength-u)/c);let d=f+a,m=this._getPointAtLength(d>this.pathLength&&d-this.pathLength<=l?this.pathLength:d,p);if(!m)return;let h=ms.getLineLength(r.x,r.y,m.x,m.y),g=Math.atan2(m.y-r.y,m.x-r.x);this.glyphInfo.push({text:e[t],rotation:g,p0:r,p1:m,width:h}),f+=a}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};let e=[];this.glyphInfo.forEach(function(t){e.push(t.p0.x),e.push(t.p0.y),e.push(t.p1.x),e.push(t.p1.y)});let t=q._getPointsRect(e),n=this.fontSize();return{x:t.x-n/2,y:t.y-n/2,width:t.width+n,height:t.height+n}}getStrokeScaleEnabled(){return!0}_getSelfRectForDrawing(){let e=this.getSelfRect(),t=this.fontSize();return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}};vc.prototype._fillFunc=gc,vc.prototype._strokeFunc=_c,vc.prototype._fillFuncHit=gc,vc.prototype._strokeFuncHit=_c,vc.prototype.className=`TextPath`,vc.prototype._attrsAffectingSize=[`text`,`fontSize`,`data`,`align`,`letterSpacing`,`kerningFunc`,`fontFamily`,`fontStyle`,`fontVariant`,`direction`],Yr(vc,!0),vc.prototype.on(`dataChange.konva`,function(){this._readDataAttribute(),this._setTextData()}),vc.prototype.on(vc.prototype._attrsAffectingSize.filter(e=>e!==`data`).map(e=>e+`Change.konva`).join(` `),function(){this._setTextData()}),X.addGetterSetter(vc,`data`),X.addGetterSetter(vc,`fontFamily`,`Arial`),X.addGetterSetter(vc,`fontSize`,12,Y()),X.addGetterSetter(vc,`fontStyle`,hc),X.addGetterSetter(vc,`align`,`left`),X.addGetterSetter(vc,`letterSpacing`,0,Y()),X.addGetterSetter(vc,`textBaseline`,`middle`),X.addGetterSetter(vc,`fontVariant`,hc),X.addGetterSetter(vc,`text`,mc),X.addGetterSetter(vc,`textDecoration`,``),X.addGetterSetter(vc,`kerningFunc`,void 0),X.addGetterSetter(vc,`direction`,`inherit`);var yc=`tr-konva`,bc=[`resizeEnabledChange`,`rotateAnchorOffsetChange`,`rotateAnchorAngleChange`,`rotateEnabledChange`,`enabledAnchorsChange`,`anchorSizeChange`,`borderEnabledChange`,`shouldOverdrawWholeAreaChange`,`borderStrokeChange`,`borderStrokeWidthChange`,`borderDashChange`,`anchorStrokeChange`,`anchorStrokeWidthChange`,`anchorFillChange`,`anchorCornerRadiusChange`,`ignoreStrokeChange`,`anchorStyleFuncChange`,`paddingChange`].map(e=>e+`.${yc}`).join(` `),xc=`nodesRect`,Sc=[`widthChange`,`heightChange`,`scaleXChange`,`scaleYChange`,`skewXChange`,`skewYChange`,`rotationChange`,`offsetXChange`,`offsetYChange`,`transformsEnabledChange`,`strokeWidthChange`,`strokeChange`,`selfRectFuncChange`,`strokeLinearGradientColorStopsChange`,`strokeScaleEnabledChange`,`strokeEnabledChange`,`draggableChange`],Cc={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},wc=`ontouchstart`in K._global;function Tc(e,t,n){if(e===`rotater`)return n;t+=q.degToRad(Cc[e]||0);let r=(q.radToDeg(t)%360+360)%360;return q._inRange(r,337.5,360)||q._inRange(r,0,22.5)?`ns-resize`:q._inRange(r,22.5,67.5)?`nesw-resize`:q._inRange(r,67.5,112.5)?`ew-resize`:q._inRange(r,112.5,157.5)?`nwse-resize`:q._inRange(r,157.5,202.5)?`ns-resize`:q._inRange(r,202.5,247.5)?`nesw-resize`:q._inRange(r,247.5,292.5)?`ew-resize`:q._inRange(r,292.5,337.5)?`nwse-resize`:(q.error(`Transformer has unknown angle for cursor detection: `+r),`pointer`)}var Ec=[`top-left`,`top-center`,`top-right`,`middle-right`,`middle-left`,`bottom-left`,`bottom-center`,`bottom-right`];function Dc(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function Oc(e,t,n){let r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:i}}function kc(e,t){return Oc(e,t,Dc(e))}function Ac(e,t,n){let r=t,i=n;for(let n=0;n<e.length;n++){let a=K.getAngle(e[n]),o=Math.abs(a-t)%(Math.PI*2),s=Math.min(o,Math.PI*2-o);s<i&&(i=s,r=a)}return r}function jc(e,t,n){let r=q.degToRad(e.rotateAnchorAngle()),i=Math.sin(r),a=-Math.cos(r),o=t/2,s=n/2,c=1/0;a<0?c=Math.min(c,-s/a):a>0&&(c=Math.min(c,(n-s)/a)),i<0?c=Math.min(c,-o/i):i>0&&(c=Math.min(c,(t-o)/i));let l=o+i*c,u=s+a*c,d=e.rotateAnchorOffset()+e.padding();return{edgeX:l,edgeY:u,endX:l+i*d,endY:u+a*d}}var Mc=new Set,$=class extends Fo{static _isLayerTransforming(e){for(let t of Mc)if(t.getLayer()===e||t._nodes.some(t=>t.getLayer()===e))return!0;return!1}constructor(e){super(e),this._movingAnchorName=null,this._anchors={},this._transforming=!1,this._fitting=!1,this._transformWindow=null,this._elementsCreated=!1,this._updateScheduled=!1,this._subtreeChanged=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(bc,e=>{e.type===`ignoreStrokeChange`&&this._resetTransformCache(),this.update()}),this.on(`rotationChange.${yc}`,()=>this._clearCache(xc)),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return q.warn(`tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.`),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return yc+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();let t=new Set(e);for(let e of t)e.isAncestorOf(this)&&(q.error(`Konva.Transformer cannot be an a child of the node you are trying to attach`),t.delete(e));let n=Array.from(t).filter(e=>{for(let n=e.getParent();n;n=n.getParent())if(t.has(n))return!1;return!0});return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(e=>{let t=()=>{var t;if(this._fitting){(t=this._nodeRectCache)==null||t.delete(e);return}this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(e),this.isDragging()||this._scheduleUpdate()};if(e._attrsAffectingSize.length){let n=e._attrsAffectingSize.map(e=>e+`Change.`+this._getEventNamespace()).join(` `);e.on(n,t)}e.on(Sc.map(e=>e+`.${this._getEventNamespace()}`).join(` `),t),e.on(`absoluteTransformChange.${this._getEventNamespace()}`,t),e instanceof Ea&&e._addSubtreeObserver(this),e.on(`destroy.${this._getEventNamespace()}`,()=>{this.setNodes(this._nodes.filter(t=>t!==e))}),this._proxyDrag(e)}),this._resetTransformCache(),this._elementsCreated&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this._back&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;let r=e.getAbsolutePosition(),i=r.x-t.x,a=r.y-t.y;this.nodes().forEach(t=>{if(t===e||t.isDragging())return;let r=t.getAbsolutePosition();t.setAbsolutePosition({x:r.x+i,y:r.y+a}),t.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){var e;this._nodes&&this._nodes.forEach(e=>{e.off(`.`+this._getEventNamespace()),e._removeSubtreeObserver(this)}),this._nodes=[],this._resetTransformCache(),(e=this.getLayer())==null||e.batchDraw()}_resetTransformCache(e){var t,n;e?(t=this._nodeRectCache)==null||t.delete(e):(n=this._nodeRectCache)==null||n.clear(),this._clearCache(xc),this._clearCache(`transform`),this._clearSelfAndDescendantCache(`absoluteTransform`)}_onSubtreeChange(e){var t;this._fitting||(!this._subtreeChanged||this._cache[xc])&&(this._resetTransformCache(e),this._subtreeChanged||(this._subtreeChanged=!0,q.requestAnimFrame(()=>this._syncSubtreeChange(),this.getStage()?._getOwnerWindow()),(t=this.getLayer())==null||t.batchDraw()))}_syncSubtreeChange(){this._subtreeChanged&&this._nodes?.length&&!this.isDragging()&&this._update()}drawScene(e,t){return this._syncSubtreeChange(),super.drawScene(e,t)}drawHit(e,t){return this._syncSubtreeChange(),super.drawHit(e,t)}_getNodeRect(){return this._getCache(xc,this.__getNodeRect)}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};let e=K.getAngle(this.rotation()),t=this.ignoreStroke(),n=new Qr;n.rotate(-e);let r=this._nodeRectCache||=new Map,i=1/0,a=1/0,o=-1/0,s=-1/0;for(let c of this.nodes()){let l=c instanceof Q&&c.getSelfRect===Q.prototype.getSelfRect&&!c.attrs.selfRectFunc&&!c._hasCachedAncestor(),u=l?c.width():0,d=l?c.height():0;l&&(c._attrsVersion??=0);let f=l?r.get(c):void 0;if(!f||f.rotation!==e||f.ignoreStroke!==t||f.version!==c._attrsVersion||f.width!==u||f.height!==d){let i=c.getAbsoluteTransform(),[a,o,s,p]=i.getMatrix(),m=a*p-o*s===0,h=c.getClientRect({skipTransform:!m,skipShadow:!0,skipStroke:t}),g=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}];m&&(i=new Qr),f={rotation:e,ignoreStroke:t,width:u,height:d,version:c._attrsVersion||0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(let e of g){let t=n.point(i.point(e));f.minX=Math.min(f.minX,t.x),f.minY=Math.min(f.minY,t.y),f.maxX=Math.max(f.maxX,t.x),f.maxY=Math.max(f.maxY,t.y)}l&&r.set(c,f)}i=Math.min(i,f.minX),a=Math.min(a,f.minY),o=Math.max(o,f.maxX),s=Math.max(s,f.maxY)}n.invert();let c=n.point({x:i,y:a});return{x:c.x,y:c.y,width:o-i,height:s-a,rotation:K.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Ec.forEach(e=>{this._createAnchor(e)}),this._createAnchor(`rotater`),this._elementsCreated=!0}_createAnchor(e){let t=new cc({stroke:`rgb(0, 161, 255)`,fill:`white`,strokeWidth:1,name:e+` _anchor`,dragDistance:0,draggable:!0,hitStrokeWidth:wc?10:`auto`});this._anchors[e]=t;let n=this;t.on(`mousedown touchstart`,function(e){n._handleMouseDown(e)}),t.on(`dragstart`,e=>{t.stopDrag(),e.cancelBubble=!0}),t.on(`dragend`,e=>{e.cancelBubble=!0}),t.on(`mouseenter`,()=>{if(this.isTransforming())return;let n=Tc(e,K.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=n),this._cursorChange=!0}),t.on(`mouseout`,()=>{this._cursorChange=!1,!this.isTransforming()&&t.getStage().content&&(t.getStage().content.style.cursor=``)}),this.add(t)}_createBack(){let e=new Q({name:`back`,width:0,height:0,sceneFunc(e,t){let n=t.getParent();if(!n.borderEnabled())return;let r=n.padding(),i=t.width(),a=t.height();if(e.beginPath(),e.rect(-r,-r,i+r*2,a+r*2),n.rotateEnabled()&&n.rotateLineVisible()){let t=jc(n,i,a);e.moveTo(t.edgeX,t.edgeY),e.lineTo(t.endX,t.endY)}e.fillStrokeShape(t)},hitFunc:(e,t)=>{if(!this.shouldOverdrawWholeArea())return;let n=this.padding();e.beginPath(),e.rect(-n,-n,t.width()+n*2,t.height()+n*2),e.fillStrokeShape(t)}});this._back=e,this.add(e),this._proxyDrag(e),e.on(`dragstart`,e=>{e.cancelBubble=!0}),e.on(`dragmove`,e=>{e.cancelBubble=!0}),e.on(`dragend`,e=>{e.cancelBubble=!0}),this.on(`dragmove`,e=>{this.update()})}_handleMouseDown(e){if(e.evt.button!==void 0&&!K.dragButtons.includes(e.evt.button)||this._transforming)return;this._movingAnchorName=e.target.name().split(` `)[0];let t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(n**2+r**2);this.sin=Math.abs(r/i),this.cos=Math.abs(n/i);let a=this.getStage()?._getOwnerWindow();this._transformWindow=a||null,a&&(a.addEventListener(`mousemove`,this._handleMouseMove),a.addEventListener(`touchmove`,this._handleMouseMove),a.addEventListener(`mouseup`,this._handleMouseUp,!0),a.addEventListener(`touchend`,this._handleMouseUp,!0),a.addEventListener(`touchcancel`,this._handleMouseUp,!0)),this._transforming=!0,this._pointerId=e.pointerId??q._getFirstPointerId(e.evt);let o=e.target.getAbsolutePosition(),s=e.target.getStage()._getPointerById(this._pointerId);this._anchorDragOffset={x:s.x-o.x,y:s.y-o.y},Mc.add(this),this._fire(`transformstart`,{evt:e.evt,target:this.getNode()}),this._nodes.forEach(t=>{t._fire(`transformstart`,{evt:e.evt,target:t})})}_handleMouseMove(e){var t;(t=this.getStage())==null||t._batchEvents(()=>this._moveTransform(e))}_moveTransform(e){this._syncSubtreeChange();let t,n,r,i=this._anchors[this._movingAnchorName],a=i.getStage();a.setPointersPositions(e);let o=a._getPointerById(this._pointerId);if(!o)return;let s={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y},c=i.getAbsolutePosition();this.anchorDragBoundFunc()&&(s=this.anchorDragBoundFunc()(c,s,e)),i.setAbsolutePosition(s);let l=i.getAbsolutePosition();if(c.x===l.x&&c.y===l.y)return;if(this._movingAnchorName===`rotater`){let r=this._getNodeRect();t=i.x()-r.width/2,n=-i.y()+r.height/2;let a=q.degToRad(this.rotateAnchorAngle()),o=Math.atan2(-n,t)+Math.PI/2-a,s=K.getAngle(this.rotation())+o,c=K.getAngle(this.rotationSnapTolerance()),l=kc(r,Ac(this.rotationSnaps(),s,c)-r.rotation);this._fitNodesInto(l,e);return}let u=this.shiftBehavior(),d;d=u===`inverted`?this.keepRatio()&&!e.shiftKey:u===`none`?this.keepRatio():this.keepRatio()||e.shiftKey;let f=this.centeredScaling()||e.altKey,p=!1;if(this._movingAnchorName===`top-left`){if(d){p=!0;let e=f?{x:this.width()/2,y:this.height()/2}:{x:this._anchors[`bottom-right`].x(),y:this._anchors[`bottom-right`].y()};r=Math.sqrt((e.x-i.x())**2+(e.y-i.y())**2);let a=this._anchors[`top-left`].x()>e.x?-1:1,o=this._anchors[`top-left`].y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this._anchors[`top-left`].x(e.x-t),this._anchors[`top-left`].y(e.y-n)}}else if(this._movingAnchorName===`top-center`)this._anchors[`top-left`].y(i.y());else if(this._movingAnchorName===`top-right`){if(d){p=!0;let e=f?{x:this.width()/2,y:this.height()/2}:{x:this._anchors[`bottom-left`].x(),y:this._anchors[`bottom-left`].y()};r=Math.sqrt((i.x()-e.x)**2+(e.y-i.y())**2);let a=this._anchors[`top-right`].x()<e.x?-1:1,o=this._anchors[`top-right`].y()>e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this._anchors[`top-right`].x(e.x+t),this._anchors[`top-right`].y(e.y-n)}var m=i.position();this._anchors[`top-left`].y(m.y),this._anchors[`bottom-right`].x(m.x)}else if(this._movingAnchorName===`middle-left`)this._anchors[`top-left`].x(i.x());else if(this._movingAnchorName===`middle-right`)this._anchors[`bottom-right`].x(i.x());else if(this._movingAnchorName===`bottom-left`){if(d){p=!0;let e=f?{x:this.width()/2,y:this.height()/2}:{x:this._anchors[`top-right`].x(),y:this._anchors[`top-right`].y()};r=Math.sqrt((e.x-i.x())**2+(i.y()-e.y)**2);let a=e.x<i.x()?-1:1,o=i.y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,i.x(e.x-t),i.y(e.y+n)}m=i.position(),this._anchors[`top-left`].x(m.x),this._anchors[`bottom-right`].y(m.y)}else if(this._movingAnchorName===`bottom-center`)this._anchors[`bottom-right`].y(i.y());else if(this._movingAnchorName===`bottom-right`){if(d){p=!0;let e=f?{x:this.width()/2,y:this.height()/2}:{x:this._anchors[`top-left`].x(),y:this._anchors[`top-left`].y()};r=Math.sqrt((i.x()-e.x)**2+(i.y()-e.y)**2);let a=this._anchors[`bottom-right`].x()<e.x?-1:1,o=this._anchors[`bottom-right`].y()<e.y?-1:1;t=r*this.cos*a,n=r*this.sin*o,this._anchors[`bottom-right`].x(e.x+t),this._anchors[`bottom-right`].y(e.y+n)}}else console.error(Error(`Wrong position argument of selection resizer: `+this._movingAnchorName));if(f=this.centeredScaling()||e.altKey,f){let e=this._anchors[`top-left`],t=this._anchors[`bottom-right`],n=e.x(),r=e.y(),i=this.getWidth()-t.x(),a=this.getHeight()-t.y();t.move({x:-n,y:-r}),e.move({x:i,y:a})}let h=this._anchors[`top-left`].getAbsolutePosition();t=h.x,n=h.y;let g=this._anchors[`bottom-right`].x()-this._anchors[`top-left`].x(),_=this._anchors[`bottom-right`].y()-this._anchors[`top-left`].y();this._fitNodesInto({x:t,y:n,width:g,height:_,rotation:K.getAngle(this.rotation())},e,p)}_handleMouseUp(e){let t=this.getStage();t&&(t.setPointersPositions(e),!t._changedPointerPositions.some(e=>e.id===this._pointerId))||(t?t._batchEvents(()=>this._removeEvents(e)):this._removeEvents(e))}getAbsoluteTransform(e){let t=this.getTransform();return e?e.getAbsoluteTransform().copy().invert().multiply(t):t}_removeEvents(e){var t;if(this._transforming){this._transforming=!1;let n=this.getStage()?.content;n&&!this._cursorChange&&(n.style.cursor=``);let r=this._transformWindow;this._transformWindow=null,r&&(r.removeEventListener(`mousemove`,this._handleMouseMove),r.removeEventListener(`touchmove`,this._handleMouseMove),r.removeEventListener(`mouseup`,this._handleMouseUp,!0),r.removeEventListener(`touchend`,this._handleMouseUp,!0),r.removeEventListener(`touchcancel`,this._handleMouseUp,!0));let i=this.getNode();Mc.delete(this),this._fire(`transformend`,{evt:e,target:i}),(t=this.getLayer())==null||t.batchDraw(),i&&this._nodes.forEach(t=>{var n;t._fire(`transformend`,{evt:e,target:t}),(n=t.getLayer())==null||n.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t,n=!1){this._fitting=!0;try{return this._doFitNodesInto(e,t,n)}finally{this._fitting=!1}}_doFitNodesInto(e,t,n=!1){let r=this._getNodeRect();if(!r.width||!r.height||q._inRange(e.width,-this.padding()*2-1,1)||q._inRange(e.height,-this.padding()*2-1,1)){this.update();return}let i=new Qr;i.rotate(K.getAngle(this.rotation()));let a=n?0:this.padding()*2,o=null,s=null;if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`left`)>=0){let t=i.point({x:-a,y:0});e.x+=t.x,e.y+=t.y,e.width+=a,o={axis:`width`,from:`left`,to:`right`,offset:t}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf(`right`)>=0){let t=i.point({x:a,y:0});e.width+=a,o={axis:`width`,from:`right`,to:`left`,offset:t}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`top`)>=0){let t=i.point({x:0,y:-a});e.x+=t.x,e.y+=t.y,e.height+=a,s={axis:`height`,from:`top`,to:`bottom`,offset:t}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf(`bottom`)>=0){let t=i.point({x:0,y:a});e.height+=a,s={axis:`height`,from:`bottom`,to:`top`,offset:t}}if(this.boundBoxFunc()){let t=this.boundBoxFunc()(r,e);t?e=t:q.warn(`boundBoxFunc returned falsy. You should return new bound rect from it!`)}for(let t of[o,s])t&&e[t.axis]<0&&this._movingAnchorName&&(this._movingAnchorName=this._movingAnchorName.replace(t.from,t.to),this._anchorDragOffset.x-=t.offset.x,this._anchorDragOffset.y-=t.offset.y);let c=1e7,l=new Qr;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/c,r.height/c);let u=new Qr,d=e.width/c,f=e.height/c;this.flipEnabled()===!1?(u.translate(e.x,e.y),u.rotate(e.rotation),u.translate(e.width<0?e.width:0,e.height<0?e.height:0),u.scale(Math.abs(d),Math.abs(f))):(u.translate(e.x,e.y),u.rotate(e.rotation),u.scale(d,f));let p=u.multiply(l.invert()),m=new Set;this._nodes.forEach(e=>{if(!e.getStage())return;let t=e.getParent().getAbsoluteTransform(),n=e.getTransform().copy();n.translate(e.offsetX(),e.offsetY());let r=new Qr;r.multiply(t.copy().invert()).multiply(p).multiply(t).multiply(n);let i=r.decompose();e.setAttrs(i);let a=e.getLayer();a&&m.add(a)}),this.rotation(q._getRotation(e.rotation)),this._nodes.forEach(e=>{this._fire(`transform`,{evt:t,target:e}),e._fire(`transform`,{evt:t,target:e})}),this._resetTransformCache(),this.update(),m.add(this.getLayer()),m.forEach(e=>e&&e.batchDraw())}_scheduleUpdate(){this._updateScheduled||(this._updateScheduled=!0,Z._runAfterAbsTransformCascade(()=>{this._updateScheduled=!1,!(!this._nodes?.length||this._fitting||this.isDragging())&&this._update()}))}forceUpdate(){this._resetTransformCache(),this.update()}update(){this._lastNodeRect=void 0,this._update()}_update(){var e;this._subtreeChanged=!1;let t=this._getNodeRect();this._updateElements(t);let n=this.nodes().some(e=>e.draggable());this._back.draggable()!==n&&this._back.draggable(n);let r=this.anchorStyleFunc();r&&Object.values(this._anchors).forEach(e=>r(e)),(e=this.getLayer())==null||e.batchDraw()}_updateElements(e){let t=this._lastNodeRect;if(t&&!this.anchorStyleFunc()&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height&&e.rotation===t.rotation)return;this._lastNodeRect={...e};let n=e.width,r=e.height,i=this.enabledAnchors(),a=this.resizeEnabled(),o=this.padding(),s=this.anchorSize();Object.values(this._anchors).forEach(e=>{e.setAttrs({width:s,height:s,offsetX:s/2,offsetY:s/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._anchors[`top-left`].setAttrs({x:0,y:0,offsetX:s/2+o,offsetY:s/2+o,visible:a&&i.indexOf(`top-left`)>=0}),this._anchors[`top-center`].setAttrs({x:n/2,y:0,offsetY:s/2+o,visible:a&&i.indexOf(`top-center`)>=0}),this._anchors[`top-right`].setAttrs({x:n,y:0,offsetX:s/2-o,offsetY:s/2+o,visible:a&&i.indexOf(`top-right`)>=0}),this._anchors[`middle-left`].setAttrs({x:0,y:r/2,offsetX:s/2+o,visible:a&&i.indexOf(`middle-left`)>=0}),this._anchors[`middle-right`].setAttrs({x:n,y:r/2,offsetX:s/2-o,visible:a&&i.indexOf(`middle-right`)>=0}),this._anchors[`bottom-left`].setAttrs({x:0,y:r,offsetX:s/2+o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-left`)>=0}),this._anchors[`bottom-center`].setAttrs({x:n/2,y:r,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-center`)>=0}),this._anchors[`bottom-right`].setAttrs({x:n,y:r,offsetX:s/2-o,offsetY:s/2-o,visible:a&&i.indexOf(`bottom-right`)>=0});let c=jc(this,n,r);this._anchors.rotater.setAttrs({x:c.endX,y:c.endY,visible:this.rotateEnabled()}),this._back.setAttrs({width:n,height:r,visible:this.borderEnabled()||this.shouldOverdrawWholeArea(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0})}isTransforming(){return this._transforming}stopTransform(){this._transforming&&this._removeEvents()}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=``),Fo.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(q.error(`You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead.`),this):super.add(...e)}toObject(){return Z.prototype.toObject.call(this)}clone(e){return Z.prototype.clone.call(this,e)}getClientRect(e){return this.nodes().length>0?super.getClientRect(e):{x:0,y:0,width:0,height:0}}};$.isTransforming=()=>Mc.size>0;function Nc(e){return e instanceof Array||q.warn(`enabledAnchors value should be an array`),e instanceof Array&&e.forEach(function(e){Ec.indexOf(e)===-1&&q.warn(`Unknown anchor name: `+e+`. Available names are: `+Ec.join(`, `))}),e||[]}$.prototype.className=`Transformer`,Yr($),X.addGetterSetter($,`enabledAnchors`,Ec,Nc),X.addGetterSetter($,`flipEnabled`,!0,ia()),X.addGetterSetter($,`resizeEnabled`,!0),X.addGetterSetter($,`anchorSize`,10,Y()),X.addGetterSetter($,`rotateEnabled`,!0),X.addGetterSetter($,`rotateLineVisible`,!0),X.addGetterSetter($,`rotationSnaps`,[]),X.addGetterSetter($,`rotateAnchorOffset`,50,Y()),X.addGetterSetter($,`rotateAnchorAngle`,0,Y()),X.addGetterSetter($,`rotateAnchorCursor`,`crosshair`),X.addGetterSetter($,`rotationSnapTolerance`,5,Y()),X.addGetterSetter($,`borderEnabled`,!0),X.addGetterSetter($,`anchorStroke`,`rgb(0, 161, 255)`),X.addGetterSetter($,`anchorStrokeWidth`,1,Y()),X.addGetterSetter($,`anchorFill`,`white`),X.addGetterSetter($,`anchorCornerRadius`,0,Y()),X.addGetterSetter($,`borderStroke`,`rgb(0, 161, 255)`),X.addGetterSetter($,`borderStrokeWidth`,1,Y()),X.addGetterSetter($,`borderDash`),X.addGetterSetter($,`keepRatio`,!0),X.addGetterSetter($,`shiftBehavior`,`default`),X.addGetterSetter($,`centeredScaling`,!1),X.addGetterSetter($,`ignoreStroke`,!1),X.addGetterSetter($,`padding`,0,Y()),X.addGetterSetter($,`nodes`),X.addGetterSetter($,`node`),X.addGetterSetter($,`boundBoxFunc`),X.addGetterSetter($,`anchorDragBoundFunc`),X.addGetterSetter($,`anchorStyleFunc`),X.addGetterSetter($,`shouldOverdrawWholeArea`,!1),X.addGetterSetter($,`useSingleNodeRotation`,!0),X.backCompat($,{lineEnabled:`borderEnabled`,rotateHandlerOffset:`rotateAnchorOffset`,enabledHandlers:`enabledAnchors`});var Pc=class extends Q{_sceneFunc(e){e.beginPath(),e.arc(0,0,Math.abs(this.radius()),0,K.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return Math.abs(this.radius())*2}getHeight(){return Math.abs(this.radius())*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};Pc.prototype.className=`Wedge`,Pc.prototype._centroid=!0,Pc.prototype._attrsAffectingSize=[`radius`],Yr(Pc,!0),X.addGetterSetter(Pc,`radius`,0,Y()),X.addGetterSetter(Pc,`angle`,0,Y()),X.addGetterSetter(Pc,`clockwise`,!1),X.backCompat(Pc,{angleDeg:`angle`,getAngleDeg:`getAngle`,setAngleDeg:`setAngle`});function Fc(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var Ic=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Lc=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Rc(e,t){return t===255?e:e*t/255}var zc=180;function Bc(e,t){let n=e.data,r=e.width,i=e.height,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=t+t+1,E=r-1,D=i-1,O=t+1,k=O*(O+1)/2,A=new Fc,j=t<=zc?Ic[t]/2**Lc[t]:1/(O*O),M=null,N=A,P=null,F=null;for(let e=1;e<T;e++)N=N.next=new Fc,e===O&&(M=N);N.next=A,s=o=0;for(let e=0;e<i;e++){g=_=v=y=c=l=u=d=0,C=n[o+3],b=Rc(n[o],C),x=Rc(n[o+1],C),S=Rc(n[o+2],C),f=O*b,p=O*x,m=O*S,h=O*C,c+=k*b,l+=k*x,u+=k*S,d+=k*C,N=A;for(let e=0;e<O;e++)N.r=b,N.g=x,N.b=S,N.a=C,N=N.next;for(let e=1;e<O;e++)a=o+((E<e?E:e)<<2),C=n[a+3],c+=(N.r=b=Rc(n[a],C))*(w=O-e),l+=(N.g=x=Rc(n[a+1],C))*w,u+=(N.b=S=Rc(n[a+2],C))*w,d+=(N.a=C)*w,g+=b,_+=x,v+=S,y+=C,N=N.next;P=A,F=M;for(let e=0;e<r;e++)n[o]=Math.floor(c*j),n[o+1]=Math.floor(l*j),n[o+2]=Math.floor(u*j),n[o+3]=Math.floor(d*j),c-=f,l-=p,u-=m,d-=h,f-=P.r,p-=P.g,m-=P.b,h-=P.a,a=s+((a=e+t+1)<E?a:E)<<2,C=n[a+3],g+=P.r=Rc(n[a],C),_+=P.g=Rc(n[a+1],C),v+=P.b=Rc(n[a+2],C),y+=P.a=C,c+=g,l+=_,u+=v,d+=y,P=P.next,f+=b=F.r,p+=x=F.g,m+=S=F.b,h+=C=F.a,g-=b,_-=x,v-=S,y-=C,F=F.next,o+=4;s+=r}for(let e=0;e<r;e++){_=v=y=g=l=u=d=c=0,o=e<<2,f=O*(b=n[o]),p=O*(x=n[o+1]),m=O*(S=n[o+2]),h=O*(C=n[o+3]),c+=k*b,l+=k*x,u+=k*S,d+=k*C,N=A;for(let e=0;e<O;e++)N.r=b,N.g=x,N.b=S,N.a=C,N=N.next;let s=Math.min(1,D)*r;for(let i=1;i<=t;i++)o=s+e<<2,c+=(N.r=b=n[o])*(w=O-i),l+=(N.g=x=n[o+1])*w,u+=(N.b=S=n[o+2])*w,d+=(N.a=C=n[o+3])*w,g+=b,_+=x,v+=S,y+=C,N=N.next,i<D&&(s+=r);o=e,P=A,F=M;for(let t=0;t<i;t++)a=o<<2,n[a+3]=C=Math.floor(d*j),C>0?(C=255/C,n[a]=Math.floor(c*j)*C,n[a+1]=Math.floor(l*j)*C,n[a+2]=Math.floor(u*j)*C):n[a]=n[a+1]=n[a+2]=0,c-=f,l-=p,u-=m,d-=h,f-=P.r,p-=P.g,m-=P.b,h-=P.a,a=e+((a=t+O)<D?a:D)*r<<2,c+=g+=P.r=n[a],l+=_+=P.g=n[a+1],u+=v+=P.b=n[a+2],d+=y+=P.a=n[a+3],P=P.next,f+=b=F.r,p+=x=F.g,m+=S=F.b,h+=C=F.a,g-=b,_-=x,v-=S,y-=C,F=F.next,o+=r}}var Vc=function(e,t=1){let n=Math.round(Math.min(this.blurRadius(),zc)*t);n>0&&Bc(e,n)};X.addGetterSetter(Z,`blurRadius`,0,Y(),X.afterSetFilter);var Hc=function(e){let t=this.brightness()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]+=t,n[e+1]+=t,n[e+2]+=t};X.addGetterSetter(Z,`brightness`,0,Y(),X.afterSetFilter);var Uc=function(e){let t=this.attrs.brightness===void 0?1:this.brightness(),n=e.data,r=n.length;for(let e=0;e<r;e+=4)n[e]=Math.min(255,n[e]*t),n[e+1]=Math.min(255,n[e+1]*t),n[e+2]=Math.min(255,n[e+2]*t)},Wc=function(e){let t=((this.contrast()+100)/100)**2,n=e.data,r=n.length,i=150,a=150,o=150;for(let e=0;e<r;e+=4)i=n[e],a=n[e+1],o=n[e+2],i/=255,i-=.5,i*=t,i+=.5,i*=255,a/=255,a-=.5,a*=t,a+=.5,a*=255,o/=255,o-=.5,o*=t,o+=.5,o*=255,i=i<0?0:i>255?255:i,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,n[e]=i,n[e+1]=a,n[e+2]=o};X.addGetterSetter(Z,`contrast`,0,Y(),X.afterSetFilter);var Gc=function(e){let t=e.data,n=e.width,r=e.height,i=Math.min(1,Math.max(0,this.embossStrength?.call(this)??.5)),a=Math.min(1,Math.max(0,this.embossWhiteLevel?.call(this)??.5)),o={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[this.embossDirection?.call(this)??`top-left`]??315,s=!!(this.embossBlend?.call(this)??!1),c=i*10,l=a*255,u=o*Math.PI/180,d=Math.cos(u),f=Math.sin(u),p=128/1020*c,m=new Float32Array(n*r);for(let e=0,n=0;n<t.length;n+=4,e++)m[e]=.2126*t[n]+.7152*t[n+1]+.0722*t[n+2];let h=[-1,0,1,-2,0,2,-1,0,1],g=[-1,-2,-1,0,0,0,1,2,1],_=e=>e<0?0:e>255?255:e;for(let e=0;e<r;e++)for(let i=0;i<n;i++){let a=0,o=0,c=0;for(let t=-1;t<=1;t++){let s=Math.max(0,Math.min(r-1,e+t))*n;for(let e=-1;e<=1;e++,c++){let t=m[s+Math.max(0,Math.min(n-1,i+e))];a+=t*h[c],o+=t*g[c]}}let u=e*n+i,v=_(l+(d*a+f*o)*p),y=u*4;if(s){let e=v-l;t[y]=_(t[y]+e),t[y+1]=_(t[y+1]+e),t[y+2]=_(t[y+2]+e)}else t[y]=t[y+1]=t[y+2]=v}return e};X.addGetterSetter(Z,`embossStrength`,.5,Y(),X.afterSetFilter),X.addGetterSetter(Z,`embossWhiteLevel`,.5,Y(),X.afterSetFilter),X.addGetterSetter(Z,`embossDirection`,`top-left`,void 0,X.afterSetFilter),X.addGetterSetter(Z,`embossBlend`,!1,void 0,X.afterSetFilter);function Kc(e,t,n,r,i){let a=n-t,o=i-r;if(a===0)return r+o/2;if(o===0)return r;let s=(e-t)/a;return s=o*s+r,s}var qc=function(e){let t=e.data,n=t.length,r=t[0],i=r,a,o=t[1],s=o,c,l=t[2],u=l,d,f=this.enhance();if(f===0)return;for(let e=0;e<n;e+=4)a=t[e+0],a<r?r=a:a>i&&(i=a),c=t[e+1],c<o?o=c:c>s&&(s=c),d=t[e+2],d<l?l=d:d>u&&(u=d);i===r&&(i=255,r=0),s===o&&(s=255,o=0),u===l&&(u=255,l=0);let p,m,h,g,_,v;if(f>0)p=i+f*(255-i),m=r-f*(r-0),h=s+f*(255-s),g=o-f*(o-0),_=u+f*(255-u),v=l-f*(l-0);else{let e=(i+r)*.5;p=i+f*(i-e),m=r+f*(r-e);let t=(s+o)*.5;h=s+f*(s-t),g=o+f*(o-t);let n=(u+l)*.5;_=u+f*(u-n),v=l+f*(l-n)}for(let e=0;e<n;e+=4)t[e+0]=Kc(t[e+0],r,i,m,p),t[e+1]=Kc(t[e+1],o,s,g,h),t[e+2]=Kc(t[e+2],l,u,v,_)};X.addGetterSetter(Z,`enhance`,0,Y(),X.afterSetFilter);var Jc=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=.34*t[e]+.5*t[e+1]+.16*t[e+2];t[e]=n,t[e+1]=n,t[e+2]=n}};X.addGetterSetter(Z,`hue`,0,Y(),X.afterSetFilter),X.addGetterSetter(Z,`saturation`,0,Y(),X.afterSetFilter),X.addGetterSetter(Z,`luminance`,0,Y(),X.afterSetFilter);var Yc=function(e){let t=e.data,n=t.length,r=2**this.saturation(),i=(this.hue()%360+360)%360,a=this.luminance()*127,o=1*r*Math.cos(i*Math.PI/180),s=1*r*Math.sin(i*Math.PI/180),c=.299+.701*o+.168*s,l=.587-.587*o+.33*s,u=.114-.114*o-.497*s,d=.299-.299*o-.328*s,f=.587+.413*o+.035*s,p=.114-.114*o+.292*s,m=.299-.3*o+1.25*s,h=.587-.588*o-1.05*s,g=.114+.886*o-.203*s,_,v,y,b;for(let e=0;e<n;e+=4)_=t[e+0],v=t[e+1],y=t[e+2],b=t[e+3],t[e+0]=c*_+l*v+u*y+a,t[e+1]=d*_+f*v+p*y+a,t[e+2]=m*_+h*v+g*y+a,t[e+3]=b},Xc=function(e){let t=e.data,n=t.length,r=2**this.value(),i=2**this.saturation(),a=(this.hue()%360+360)%360,o=r*i*Math.cos(a*Math.PI/180),s=r*i*Math.sin(a*Math.PI/180),c=.299*r+.701*o+.168*s,l=.587*r-.587*o+.33*s,u=.114*r-.114*o-.497*s,d=.299*r-.299*o-.328*s,f=.587*r+.413*o+.035*s,p=.114*r-.114*o+.292*s,m=.299*r-.3*o+1.25*s,h=.587*r-.588*o-1.05*s,g=.114*r+.886*o-.203*s;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2],a=t[e+3];t[e+0]=c*n+l*r+u*i,t[e+1]=d*n+f*r+p*i,t[e+2]=m*n+h*r+g*i,t[e+3]=a}};X.addGetterSetter(Z,`hue`,0,Y(),X.afterSetFilter),X.addGetterSetter(Z,`saturation`,0,Y(),X.afterSetFilter),X.addGetterSetter(Z,`value`,0,Y(),X.afterSetFilter);var Zc=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4)t[e]=255-t[e],t[e+1]=255-t[e+1],t[e+2]=255-t[e+2]},Qc=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=360/m*Math.PI/180;for(let e=0;e<m;e+=1){let t=Math.sin(e*h),n=Math.cos(e*h);for(let o=0;o<p;o+=1){u=Math.floor(s+l*o/p*n),d=Math.floor(c+l*o/p*t);let f=(d*a+u)*4,m=r[f+0],h=r[f+1],g=r[f+2],_=r[f+3];f=(e+o*a)*4,i[f+0]=m,i[f+1]=h,i[f+2]=g,i[f+3]=_}}},$c=function(e,t,n){let r=e.data,i=t.data,a=e.width,o=e.height,s=n.polarCenterX||a/2,c=n.polarCenterY||o/2,l=Math.sqrt(s*s+c*c),u=a-s,d=o-c,f=Math.sqrt(u*u+d*d);l=f>l?f:l;let p=o,m=a,h=n.polarRotation||0,g,_;for(u=0;u<a;u+=1)for(d=0;d<o;d+=1){let e=u-s,t=d-c,n=Math.sqrt(e*e+t*t)*p/l,o=(Math.atan2(t,e)*180/Math.PI+360+h)%360;o=o*m/360,g=Math.floor(o),_=Math.floor(n);let f=(_*a+g)*4,v=r[f+0],y=r[f+1],b=r[f+2],x=r[f+3];f=(d*a+u)*4,i[f+0]=v,i[f+1]=y,i[f+2]=b,i[f+3]=x}},el=function(e){let t=e.width,n=e.height,r,i,a,o,s,c,l,u,d,f,p=Math.round(this.kaleidoscopePower()),m=Math.round(this.kaleidoscopeAngle()),h=Math.floor(t*((m%360+360)%360)/360);if(p<1)return;let g={width:t,height:n,data:new Uint8ClampedArray(t*n*4)};Qc(e,g,{polarCenterX:t/2,polarCenterY:n/2});let _=t/2**p;for(;_<=8;)_*=2,--p;_=Math.ceil(_);let v=_,y=0,b=v,x=1;for(h+_>t&&(y=v,b=0,x=-1),i=0;i<n;i+=1)for(r=y;r!==b;r+=x)a=Math.round(r+h)%t,d=(t*i+a)*4,s=g.data[d+0],c=g.data[d+1],l=g.data[d+2],u=g.data[d+3],f=(t*i+r)*4,g.data[f+0]=s,g.data[f+1]=c,g.data[f+2]=l,g.data[f+3]=u;for(i=0;i<n;i+=1)for(v=Math.floor(_),o=0;o<p;o+=1){for(r=0;r<v+1;r+=1)d=(t*i+r)*4,s=g.data[d+0],c=g.data[d+1],l=g.data[d+2],u=g.data[d+3],f=(t*i+v*2-r-1)*4,g.data[f+0]=s,g.data[f+1]=c,g.data[f+2]=l,g.data[f+3]=u;v*=2}$c(g,e,{polarRotation:0})};X.addGetterSetter(Z,`kaleidoscopePower`,2,Y(),X.afterSetFilter),X.addGetterSetter(Z,`kaleidoscopeAngle`,0,Y(),X.afterSetFilter);function tl(e,t,n){let r=(n*e.width+t)*4,i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function nl(e,t){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2)}function rl(e){let t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function il(e,t){let n=tl(e,0,0),r=tl(e,e.width-1,0),i=tl(e,0,e.height-1),a=tl(e,e.width-1,e.height-1);if(nl(n,r)<t&&nl(r,a)<t&&nl(a,i)<t&&nl(i,n)<t){let o=rl([r,n,a,i]),s=[];for(let n=0;n<e.width*e.height;n++){let r=nl(o,[e.data[n*4],e.data[n*4+1],e.data[n*4+2]]);s[n]=r<t?0:255}return s}}function al(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function ol(e,t,n){let r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u===2040?255:0}return o}function sl(e,t,n){let r=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u>=1020?255:0}return o}function cl(e,t,n){let r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[];for(let s=0;s<n;s++)for(let c=0;c<t;c++){let l=s*t+c,u=0;for(let o=0;o<i;o++)for(let l=0;l<i;l++){let d=s+o-a,f=c+l-a;if(d>=0&&d<n&&f>=0&&f<t){let n=d*t+f,a=r[o*i+l];u+=e[n]*a}}o[l]=u}return o}var ll=function(e){let t=il(e,this.attrs.threshold??10);return t&&(t=ol(t,e.width,e.height),t=sl(t,e.width,e.height),t=cl(t,e.width,e.height),al(e,t)),e};X.addGetterSetter(Z,`threshold`,.5,Y(),X.afterSetFilter);var ul=function(e){let t=this.noise()*255,n=e.data,r=n.length,i=t/2;for(let e=0;e<r;e+=4)n[e+0]+=i-2*i*Math.random(),n[e+1]+=i-2*i*Math.random(),n[e+2]+=i-2*i*Math.random()};X.addGetterSetter(Z,`noise`,.2,Y(),X.afterSetFilter);var dl=function(e,t=1){let n=Math.ceil(this.pixelSize()*t),r=e.width,i=e.height,a=Math.ceil(r/n),o=Math.ceil(i/n),s=e.data;if(n<=0){q.error(`pixelSize value can not be <= 0`);return}for(let e=0;e<a;e+=1)for(let t=0;t<o;t+=1){let a=0,o=0,c=0,l=0,u=e*n,d=Math.min(u+n,r),f=t*n,p=Math.min(f+n,i);for(let e=u;e<d;e+=1)for(let t=f;t<p;t+=1){let n=(r*t+e)*4,i=s[n+3];a+=s[n+0]*i,o+=s[n+1]*i,c+=s[n+2]*i,l+=i}l&&(a/=l,o/=l,c/=l),l/=(d-u)*(p-f);for(let e=u;e<d;e+=1)for(let t=f;t<p;t+=1){let n=(r*t+e)*4;s[n+0]=a,s[n+1]=o,s[n+2]=c,s[n+3]=l}}};X.addGetterSetter(Z,`pixelSize`,8,Y(),X.afterSetFilter);var fl=function(e){let t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t;for(let e=0;e<r;e+=1)n[e]=Math.floor(n[e]/i)*i};X.addGetterSetter(Z,`levels`,.5,Y(),X.afterSetFilter);var pl=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue();for(let e=0;e<n;e+=4){let n=(.34*t[e]+.5*t[e+1]+.16*t[e+2])/255;t[e]=n*r,t[e+1]=n*i,t[e+2]=n*a,t[e+3]=t[e+3]}};X.addGetterSetter(Z,`red`,0,Qi,X.afterSetFilter),X.addGetterSetter(Z,`green`,0,Qi,X.afterSetFilter),X.addGetterSetter(Z,`blue`,0,Qi,X.afterSetFilter);var ml=function(e){let t=e.data,n=t.length,r=this.red(),i=this.green(),a=this.blue(),o=this.alpha();for(let e=0;e<n;e+=4){let n=1-o;t[e]=r*o+t[e]*n,t[e+1]=i*o+t[e+1]*n,t[e+2]=a*o+t[e+2]*n}};X.addGetterSetter(Z,`alpha`,1,e=>Math.min(1,Math.max(0,e)),X.afterSetFilter);var hl=function(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+0],r=t[e+1],i=t[e+2];t[e+0]=Math.min(255,n*.393+r*.769+i*.189),t[e+1]=Math.min(255,n*.349+r*.686+i*.168),t[e+2]=Math.min(255,n*.272+r*.534+i*.131)}},gl=function(e){let t=e.data;for(let e=0;e<t.length;e+=4){let n=t[e],r=t[e+1],i=t[e+2];.2126*n+.7152*r+.0722*i>=128&&(t[e]=255-n,t[e+1]=255-r,t[e+2]=255-i)}return e},_l=function(e){let t=this.threshold()*255,n=e.data,r=n.length;for(let e=0;e<r;e+=1)n[e]=n[e]<t?0:255};X.addGetterSetter(Z,`threshold`,.5,Y(),X.afterSetFilter);var vl=Xo.Util._assign(Xo,{Arc:Zo,Arrow:hs,Circle:gs,Ellipse:_s,Image:vs,Label:oc,Tag:sc,Line:ds,Path:ms,Rect:cc,RegularPolygon:lc,Ring:dc,Sprite:fc,Star:pc,Text:$s,TextPath:vc,Transformer:$,Wedge:Pc,Filters:{Blur:Vc,Brightness:Uc,Brighten:Hc,Contrast:Wc,Emboss:Gc,Enhance:qc,Grayscale:Jc,HSL:Yc,HSV:Xc,Invert:Zc,Kaleidoscope:el,Mask:ll,Noise:ul,Pixelate:dl,Posterize:fl,RGB:pl,RGBA:ml,Sepia:hl,Solarize:gl,Threshold:_l}});function yl(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function bl(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}var xl=class{cells=new Map;large=[];items;cellSize;constructor(e,t=256){if(this.items=e,this.cellSize=t,!Number.isFinite(t)||t<=0)throw Error(`Invalid spatial cell size`);e.forEach((e,t)=>{let[n,r,i,a]=this.range(e.bounds);if((i-n+1)*(a-r+1)>256){this.large.push(t);return}for(let e=n;e<=i;e++)for(let n=r;n<=a;n++){let r=`${e},${n}`,i=this.cells.get(r)??[];i.push(t),this.cells.set(r,i)}})}range(e){return[Math.floor(e.x/this.cellSize),Math.floor(e.y/this.cellSize),Math.floor((e.x+e.width)/this.cellSize),Math.floor((e.y+e.height)/this.cellSize)]}query(e){let[t,n,r,i]=this.range(e),a=new Set(this.large);if((r-t+1)*(i-n+1)>1e4)this.items.forEach((e,t)=>a.add(t));else for(let e=t;e<=r;e++)for(let t=n;t<=i;t++)for(let n of this.cells.get(`${e},${t}`)??[])a.add(n);let o=t=>e.width===0&&e.height===0?bl(t,e.x,e.y):yl(t,e);return[...a].sort((e,t)=>e-t).map(e=>this.items[e]).filter(e=>e.node.visible!==!1&&o(e.bounds)&&e.clips.every(o))}hitTest(e,t){return this.query({x:e,y:t,width:0,height:0}).toReversed().find(n=>bl(n.bounds,e,t)&&n.clips.every(n=>bl(n,e,t)))}};function Sl(e,t,n=new Map,r,i,a,o=!1){vl.autoDrawEnabled=!1,vl.pixelRatio=1;let s=new vl.Stage({width:e,height:t,...r?{container:r}:{}}),c=new vl.Layer({listening:!1}),l=new vl.Layer({listening:!1}),u=new vl.Layer({listening:!1});s.add(c,l,u);for(let e of[c,l,u])a?.(e.getCanvas()._canvas);let d={x:0,y:0,width:e,height:t},f=new xl([]),p={},m=[],h=[],g={selection:`#2563EB`,changes:`#B45309`},_=!1,v=!1,y=0,b=[],x=new Map,S=(e,t)=>{let n=cr(e.document,t,p);return typeof n==`number`?n:0},C=(e,t)=>String(cr(e.document,t,p)),w=e=>{let t=e.node,r=e.bounds,i=t.fills?.[0],a={x:r.x,y:r.y,width:r.width,height:r.height,listening:!1,opacity:t.opacity??1,rotation:t.rotation??0};if(i?.kind===`solid`&&(a.fill=C(e,i.color)),i?.kind===`image`){let t=n.get(`${e.document.documentId}:${i.assetId}`);if(!t)a.fill=`#D4D4D8`;else{let e=r.width/t.width,n=r.height/t.height,o=i.mode===`cover`?Math.max(e,n):Math.min(e,n);a.fillPriority=`pattern`,a.fillPatternRepeat=`no-repeat`,a.fillPatternScale=i.mode===`stretch`?{x:e,y:n}:{x:o,y:o},a.fillPatternX=(r.width-t.width*(i.mode===`stretch`?e:o))/2,a.fillPatternY=(r.height-t.height*(i.mode===`stretch`?n:o))/2}}if(i?.kind===`gradient`){let t=i.stops.flatMap(t=>[t.offset,C(e,t.color)]);i.gradient===`linear`?(a.fillLinearGradientStartPoint={x:0,y:0},a.fillLinearGradientEndPoint={x:r.width*Math.cos(i.angle*Math.PI/180),y:r.height*Math.sin(i.angle*Math.PI/180)},a.fillLinearGradientColorStops=t):(a.fillRadialGradientStartPoint={x:r.width/2,y:r.height/2},a.fillRadialGradientEndPoint={x:r.width/2,y:r.height/2},a.fillRadialGradientStartRadius=0,a.fillRadialGradientEndRadius=Math.max(r.width,r.height)/2,a.fillRadialGradientColorStops=t)}t.stroke&&(a.stroke=C(e,t.stroke),a.strokeWidth=t.strokeWidth?S(e,t.strokeWidth):1);let o=t.effects?.find(e=>e.kind===`shadow`);o?.kind===`shadow`&&(a.shadowColor=C(e,o.color),a.shadowBlur=S(e,o.blur),a.shadowOffset={x:S(e,o.x),y:S(e,o.y)});let s;if(s=t.type===`text`?new vl.Text({...a,text:t.text,fontFamily:C(e,t.fontFamily),fontSize:S(e,t.fontSize),fontStyle:(t.fontWeight??400)>=600?`bold`:`normal`,lineHeight:t.lineHeight?S(e,t.lineHeight):1.2}):t.type===`ellipse`?new vl.Ellipse({...a,x:r.x+r.width/2,y:r.y+r.height/2,radiusX:r.width/2,radiusY:r.height/2}):t.type===`path`?new vl.Path({...a,data:t.geometry,scaleX:r.width/(t.viewBox.width||1),scaleY:r.height/(t.viewBox.height||1)}):new vl.Rect({...a,cornerRadius:`radius`in t&&t.radius?S(e,t.radius):0}),i?.kind===`image`){let t=n.get(`${e.document.documentId}:${i.assetId}`);t&&s.setAttrs({fillPatternImage:t})}let c=t.effects?.find(e=>e.kind===`blur`);if(c?.kind===`blur`&&(s.cache(),s.filters([vl.Filters.Blur]),s.blurRadius(S(e,c.radius))),!e.clips.length)return s;let l=e.clips.reduce((e,t)=>{let n=Math.max(e.x,t.x),r=Math.max(e.y,t.y);return{x:n,y:r,width:Math.max(0,Math.min(e.x+e.width,t.x+t.width)-n),height:Math.max(0,Math.min(e.y+e.height,t.y+t.height)-r)}}),u=new vl.Group({clipX:l.x,clipY:l.y,clipWidth:l.width,clipHeight:l.height,listening:!1});return u.add(s),u},T=(e,t,n)=>{e.destroyChildren();for(let r of b)if(t.includes(r.ownerId)){let t=r.bounds;e.add(new vl.Rect({...t,stroke:n,strokeWidth:1,listening:!1}))}},E={setDocument(e,t={},n={},r){let i=dr(e,t,n);if(i.diagnostics.some(e=>e.severity===`error`))throw Error(`Invalid layout for renderer spike`);f=new xl(r?ur(i.items,r):i.items),p=t,_=!0,v=!0},setViewport(e){if(e.width<=0||e.height<=0)throw Error(`Viewport needs positive dimensions`);JSON.stringify(e)!==JSON.stringify(d)&&(d=e,_=!0)},setSelection(e){m=e,_=!0},setChanges(e){h=e,_=!0},setStrokes(e){(e.selection!==g.selection||e.changes!==g.changes)&&(g=e,_=!0)},render(){if(!_)return!1;b=f.query(d);let n=new Set(b.map(e=>e.key));for(let[e,t]of x)(v||!n.has(e))&&(t.destroy(),x.delete(e));for(let e of b)if(!x.has(e.key)){let t=w(e);c.add(t),x.set(e.key,t)}b.forEach((e,t)=>{let n=x.get(e.key);n.zIndex()!==t&&n.zIndex(t)});let r=e/d.width,i=t/d.height;for(let e of[c,l,u])e.scale({x:r,y:i}),e.position({x:-d.x*r,y:-d.y*i});return T(l,m,g.selection),T(u,h,g.changes),c.draw(),l.draw(),u.draw(),y++,_=!1,v=!1,!0},hitTest(e,t){return f.hitTest(e,t)?.ownerId},async exportPng(){E.render();let e=o?c.getCanvas()._canvas:s.toCanvas({pixelRatio:1});if(i)return i(e);let t=await new Promise((t,n)=>e.toBlob(e=>e?t(e):n(Error(`PNG export failed`)),`image/png`));return new Uint8Array(await t.arrayBuffer())},stats(){return{visible:b.length,sceneShapes:x.size,draws:y}},destroy(){s.destroy(),x.clear()}};return E}var Cl=0;async function wl(e,t,n,r=new Map,i){let a=new Map;return await Promise.all([...r].map(async([e,t])=>{let n=URL.createObjectURL(new Blob([t.slice().buffer]));try{let t=new Image;t.src=n,await t.decode(),a.set(e,t)}catch{i?.(e)}finally{URL.revokeObjectURL(n)}})),e.id||=`design-canvas-${++Cl}`,Sl(t,n,a,e.id)}var Tl=`M3 3 C4.2 1.8 6.2 2.4 8.4 3.4 L26.6 11.7 C28.6 12.6 29.7 13.9 29.6 15.2 C29.5 16.7 28.5 17.8 26.7 18.2 L20.0 19.8 C18.8 20.1 18.1 20.7 17.5 21.7 L13.7 28.2 C12.5 30.3 9.5 29.9 8.8 27.5 L3.4 8.4 C2.78 6.2 1.8 4.2 3 3 Z`,El=`0 0 32 32`,Dl=`#0a0a0a`,Ol=`#fff`,kl=`drop-shadow(0 0 1px rgb(0 0 0 / 0.72))`,Al=3e3,jl=1e4,Ml=1200,Nl=`blur(5px)`,Pl=.45,Fl=`#fff`,Il=30,Ll=Array.from({length:31},(e,t)=>{let n=t/Il;return-Math.exp(-3.2*n)*Math.sin(4*Math.PI*n)}),Rl=Math.max(...Ll.map(Math.abs)),zl=Ll.map((e,t)=>({offset:t/Il,transform:`rotate(${(e/Rl*15).toFixed(2)}deg)`})),Bl=[{offset:0,opacity:Pl},{offset:.35,opacity:1},{offset:1,opacity:Pl}],Vl={flash:650,cursorGlide:450,cursorFade:240,cursorLinger:900,batchLinger:1600,wipe:400,fade:160},Hl=(e,t)=>{let n=e.nodes[t];return n&&`children`in n?n.children:[]};function Ul(e){let t=new Map;for(let n of Object.keys(e.nodes))for(let r of Hl(e,n))t.set(r,n);return t}function Wl(e,t,n=24){let r=Ul(e),i=[...new Set(t)].filter(t=>e.nodes[t]),a=e=>{let t=new Set(e);return e.filter(e=>{for(let n=r.get(e);n;n=r.get(n))if(t.has(n))return!1;return!0})},o=a(i);for(;o.length>n;){let e=[...new Set(o.map(e=>r.get(e)??e))];if(e.length===o.length)return o.slice(0,n);o=a(e)}return o}var Gl=e=>{if(!e.length)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}},Kl=e=>({x:e.x+Math.min(20,e.width/3),y:e.y+Math.min(14,e.height/3)});function ql(e,t){for(let n=e.length-1;n>=0;n--){let r=t(e[n]);if(r)return{nodeId:e[n],bounds:r}}return null}var Jl=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function Yl(e,t,n,r={top:64,right:16,bottom:72,left:16}){let i=n.width/t.width,a=(e.x+e.width/2-t.x)*i,o=(e.y+e.height/2-t.y)*i,s=a-n.width/2,c=o-n.height/2,l=Math.abs(s)/n.width>=Math.abs(c)/n.height,u=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));if(l){let e=s<0?`left`:`right`;return{side:e,x:e===`left`?r.left:n.width-r.right,y:u(o,r.top,n.height-r.bottom)}}let d=c<0?`top`:`bottom`;return{side:d,x:u(a,r.left+90,n.width-r.right-90),y:d===`top`?r.top:n.height-r.bottom}}function Xl(e,t,n,r=72){let i=n.width/t.width,a=Math.min((n.width-r*2)/e.width,(n.height-r*2)/e.height),o=Math.max(.05,Math.min(i,a)),s=n.width/o,c=n.height/o;return{x:e.x+e.width/2-s/2,y:e.y+e.height/2-c/2,width:s,height:c}}var Zl=/^(apply|design_[a-z]+)\s+[a-z-]*:\s*/i;function Ql(e,t=56){let n=(e.replace(Zl,``).split(`
17
17
  `,1)[0]??``).trim().replace(/\.$/,``)||`see the agent's reply`;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function $l(e){let t=new Map;return{start(n){t.set(n,setTimeout(()=>{t.delete(n),e(n)},Vl.wipe+100))},dispose(){for(let e of t.values())clearTimeout(e);t.clear()}}}var eu=`(prefers-reduced-motion: reduce)`,tu=e=>{let t=matchMedia(eu);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},nu=()=>(0,V.useSyncExternalStore)(tu,pu,mu),ru=e=>(document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)),iu=`cubic-bezier(0.77, 0, 0.175, 1)`,au={left:Te,right:Ee,top:Oe,bottom:we},ou=64;function su(e,t,n){let r=n.width/t.width,i=(e.x-t.x)*r,a=(e.y-t.y)*r,o=e.width*r,s=e.height*r,c=Math.max(i,-64),l=Math.max(a,-64),u=Math.min(i+o,n.width+ou),d=Math.min(a+s,n.height+ou);return{corner:{x:i,y:a},visible:u>c&&d>l,style:{left:c,top:l,width:Math.max(0,u-c),height:Math.max(0,d-l),"--paint-ox":`${i-c}px`,"--paint-oy":`${a-l}px`}}}function cu({cursorSize:e=`small`,cursorLabel:t=`name`,animations:n=!0,document:r,bounds:i,viewport:a,canvas:o,batch:s,agents:c,onReveal:l}){let u=(0,V.useSyncExternalStore)(ru,()=>!globalThis.document.hidden,()=>!1),d=nu()||!n,f=o.width/a.width,p=c?.some(e=>e.active)??!1,m=(c?.find(e=>e.active)??c?.[0])?.label??`Agent`,h=c?.find(e=>e.lastError!==null)?.lastError??null,g=(0,V.useMemo)(()=>{let e=new Set;return(c??[]).flatMap(t=>{let n=t.workingNodeId,a=n?i.get(n):void 0;return!n||!a||e.has(n)?[]:(e.add(n),[{id:n,label:t.label,box:a,root:r.roots.includes(n)}])})},[c,i,r.roots]),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)([]),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(null),T=(0,V.useRef)({document:r,bounds:i,working:g,active:p,failed:h!==null});T.current={document:r,bounds:i,working:g,active:p,failed:h!==null};let E=(0,V.useRef)(p?null:s?.sequence??null),D=(0,V.useRef)({}),O=(0,V.useRef)(0),k=(0,V.useRef)(null);k.current??=$l(e=>b(t=>t.filter(t=>t.id!==e))),(0,V.useEffect)(()=>{if(!s||s.sequence===E.current)return;E.current=s.sequence;let{document:e,bounds:t}=T.current,n=Wl(e,s.nodeIds).flatMap(e=>t.get(e)??[]),r=ql(s.nodeIds,e=>t.get(e));v({id:s.sequence,rects:n}),r&&w({point:Kl(r.bounds),box:r.bounds,name:e.nodes[r.nodeId]?.name??``}),S(!0),clearTimeout(D.current.flash),clearTimeout(D.current.linger),D.current.flash=window.setTimeout(()=>v(e=>e?.id===s.sequence?null:e),Vl.flash+80),D.current.linger=window.setTimeout(()=>S(!1),Vl.batchLinger)},[s]),(0,V.useEffect)(()=>()=>{clearTimeout(D.current.flash),clearTimeout(D.current.linger),k.current?.dispose()},[]);let A=g.map(e=>e.id).join(`|`),j=(0,V.useRef)(new Map);(0,V.useEffect)(()=>{let e=new Map(T.current.working.map(e=>[e.id,{id:0,bounds:e.box,label:e.label,failed:T.current.failed}])),t=[...j.current].filter(([t])=>!e.has(t)),n=T.current.working.find(e=>!j.current.has(e.id));if(j.current=e,n&&w({point:Kl(n.box),box:n.box,name:T.current.document.nodes[n.id]?.name??``}),!t.length)return;let r=t.map(([,e])=>({...e,id:++O.current}));b(e=>[...e,...r]);for(let e of r)k.current?.start(e.id)},[A]),(0,V.useEffect)(()=>{j.current=new Map(g.map(e=>[e.id,{id:0,bounds:e.box,label:e.label,failed:h!==null}]))},[g,h]);let M=(0,V.useMemo)(()=>{if(C)return C;if(!h)return null;let e=r.roots.map(e=>i.get(e)).find(Boolean);return e?{point:Kl(e),box:e,name:``}:null},[C,h,r.roots,i]),N=M!==null&&(p||x||g.length>0||h!==null),P=(0,V.useRef)(!1),F=(0,V.useRef)(null),I=(0,V.useRef)(null),L=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{let e=M?.point??null,t=F.current,n=P.current;F.current=e,P.current=N;let r=I.current;if(!r||!e||!t||!n||d){L.current?.cancel();return}if(t.x===e.x&&t.y===e.y)return;let i=0,a=0;if(L.current?.playState===`running`){let e=new DOMMatrixReadOnly(getComputedStyle(r).transform);i=e.e,a=e.f}L.current?.cancel(),L.current=r.animate([{transform:`translate(${(t.x-e.x)*f+i}px, ${(t.y-e.y)*f+a}px)`},{transform:`translate(0px, 0px)`}],{duration:Vl.cursorGlide,easing:iu})},[M?.point.x,M?.point.y,d]),(0,V.useEffect)(()=>{P.current=N},[N]),(0,V.useEffect)(()=>()=>L.current?.cancel(),[]);let R=g[0]?.box??(N?M?.box:void 0)??null,ee=R&&(p||x||g.length>0)&&!Jl(R,a)?R:null,te=ee?Yl(ee,a,o):null;if(!o.width)return null;let ne=h?`${m}: change not applied - ${Ql(h)}`:g[0]?`${g[0].label} is generating ${r.nodes[g[0].id]?.name??`a frame`}`:``,re=h!==null,z=M?{x:(M.point.x-a.x)*f,y:(M.point.y-a.y)*f}:null,ie=z?z.x>o.width-240:!1;return(0,G.jsxs)(`div`,{className:`design-paint`,"data-reduced":d?``:void 0,"data-paused":u?void 0:``,style:{"--paint-cycle":`${Vl.batchLinger}ms`},children:[(0,G.jsx)(`span`,{className:`sr-only`,role:`status`,children:ne}),g.map(e=>{let t=su(e.box,a,o);return t.visible?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`design-paint-field`,"data-failed":re?``:void 0,style:t.style}),e.root&&e.box.width*f>80?(0,G.jsxs)(`span`,{className:`design-paint-label`,"data-inside":e.root?void 0:``,style:{left:t.corner.x,top:t.corner.y},children:[(0,G.jsx)(uu,{size:14}),(0,G.jsx)(`span`,{children:(0,G.jsx)(`b`,{children:e.label})})]}):null]},e.id):null}),y.map(e=>{let t=su(e.bounds,a,o);return t.visible?(0,G.jsx)(`div`,{className:`design-paint-field design-paint-wipe`,"data-failed":e.failed?``:void 0,style:t.style},e.id):null}),_?.rects.map(e=>{let t=su(e,a,o);return t.visible?(0,G.jsx)(`div`,{className:`design-paint-flash`,style:t.style},`${_.id}:${e.x}:${e.y}:${e.width}`):null}),M&&z?(0,G.jsx)(`div`,{className:`design-paint-cursor`,"data-size":e,"data-shown":N?``:void 0,"data-failed":re?``:void 0,"data-flip":ie?``:void 0,style:{transform:`translate3d(${z.x}px, ${z.y}px, 0)`},children:(0,G.jsxs)(`div`,{ref:I,className:`design-paint-glide`,children:[(0,G.jsx)(uu,{animate:N&&u&&!d&&!re&&z.x>=0&&z.y>=0&&z.x<=o.width&&z.y<=o.height,sequence:s?.sequence}),(0,G.jsx)(`span`,{className:`design-paint-pill`,hidden:t===`none`&&!re,children:re?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`b`,{children:[m,`:`]}),` change not applied - `,Ql(h??``)]}):(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(`b`,{children:t===`agent`?`Agent`:m})})})]})}):null,te?(0,G.jsx)(lu,{label:m,chip:te,onClick:()=>ee&&l(ee)}):null]})}function lu(e){let t=(0,H.c)(11),{label:n,chip:r,onClick:i}=e,a=au[r.side],o;t[0]!==r.x||t[1]!==r.y?(o={left:r.x,top:r.y},t[0]=r.x,t[1]=r.y,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,G.jsx)(a,{"aria-hidden":`true`}),t[3]=a,t[4]=s);let c;return t[5]!==r.side||t[6]!==n||t[7]!==i||t[8]!==o||t[9]!==s?(c=(0,G.jsxs)(`button`,{type:`button`,className:`design-paint-chip`,"data-side":r.side,style:o,onClick:i,children:[s,n,` is working here`]}),t[5]=r.side,t[6]=n,t[7]=i,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function uu(e){let t=(0,H.c)(10),{size:n,animate:r,sequence:i}=e,a=n===void 0?22:n,o=r!==void 0&&r,s=(0,V.useRef)(null),c=(0,V.useRef)(null),l;t[0]===o?l=t[1]:(l=()=>{if(!o)return;let e=[],t=()=>{document.hidden||(e=[s.current?.animate(zl,{duration:Ml,easing:`linear`}),c.current?.animate(Bl,{duration:Ml,easing:`ease-in-out`})].filter(fu))},n,r=setTimeout(()=>{t(),n=setInterval(t,jl)},Al);return()=>{clearTimeout(r),clearInterval(n),e.forEach(du)}},t[0]=o,t[1]=l);let u;t[2]!==o||t[3]!==i?(u=[o,i],t[2]=o,t[3]=i,t[4]=u):u=t[4],(0,V.useEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflow:`visible`,filter:kl},t[5]=d):d=t[5];let f,p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(`path`,{ref:c,d:Tl,fill:Fl,stroke:Fl,strokeWidth:6,strokeLinejoin:`round`,strokeLinecap:`round`,style:{filter:Nl,opacity:Pl}}),p=(0,G.jsx)(`path`,{d:Tl,fill:Dl,stroke:Ol,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`}),t[6]=f,t[7]=p):(f=t[6],p=t[7]);let m;return t[8]===a?m=t[9]:(m=(0,G.jsxs)(`svg`,{ref:s,className:`design-cu-cursor`,width:a,height:a,viewBox:El,shapeRendering:`geometricPrecision`,"aria-hidden":`true`,style:d,children:[f,p]}),t[8]=a,t[9]=m),m}function du(e){return e.cancel()}function fu(e){return!!e}function pu(){return matchMedia(eu).matches}function mu(){return!0}function hu(e){return e.split(/[-_\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function gu(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase()}function _u(e){return String(Number.isInteger(e)?e:Math.round(e*100)/100)}var vu=e=>`${Math.round(e*100)}%`,yu=e=>e?`Shown`:`Hidden`,bu=e=>e?`On`:`Off`,xu=e=>e?String(e):`None`;function Su(e){return new Map(Object.entries(e).toSorted(([e,t],[n,r])=>t.createdAt.localeCompare(r.createdAt)||e.localeCompare(n)).map(([e],t)=>[e,t+1]))}var Cu=new Set([`nodes`,`tokens`,`components`,`instances`,`imports`,`assets`]),wu=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Tu=e=>typeof e==`number`?_u(e):String(e);function Eu(e,t,n){let[r=``,...i]=e.path.split(`/`).slice(1).map(e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`)),a=Cu.has(r),o=a?i[0]:void 0,s=a?i.slice(1):i,c=e=>{if(o){if(r===`nodes`)return e.nodes[o]?.name;if(r===`tokens`)return e.tokens[o]?.name;if(r===`components`)return e.components[o]?.name}},l=c(n)??c(t)??(r?hu(gu(r)):`Document`),u=s.filter(e=>!/^\d+$/.test(e)).map(gu).join(` `);return u?e.kind===`changed`&&wu(e.before)&&wu(e.after)?`${l} - ${u} ${Tu(e.before)} to ${Tu(e.after)}`:e.kind===`added`&&wu(e.after)?`${l} - ${u} set to ${Tu(e.after)}`:`${l} - ${u} ${e.kind}`:`${l} - ${e.kind}`}function Du(e){return e.accepted||e.busy?null:e.hasThread?e.hasBaseline?e.revision?e.cached?`Showing a cached revision. Reload to accept.`:e.reviewLocked?`Exit compare to accept the current revision.`:e.blockers?`Resolve ${e.blockers} blocking ${e.blockers===1?`comment`:`comments`} to accept`:e.canAccept?null:`Accept is unavailable for this revision.`:`Revision unavailable. Reload to accept.`:e.baselineNotice??`No turn baseline is available yet.`:`Open this design from a thread to accept.`}function Ou(e){let t=getComputedStyle(e);return{selection:t.getPropertyValue(`--design-selection`).trim()||`#2563EB`,changes:t.getPropertyValue(`--design-change-stroke`).trim()||`#B45309`}}var ku=new Map;function Au(e){let t=(0,H.c)(9),{name:n,x:r,y:i,hidden:a}=e,o;t[0]!==r||t[1]!==i?(o={left:r,top:i},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,G.jsx)(Ur,{children:n}),t[3]=n,t[4]=s);let c;return t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,G.jsx)(`span`,{className:`design-frame-label`,style:o,hidden:a,children:s}),t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function ju(e){let t=(0,H.c)(19),{screen:n,frame:r,canvas:i,avoid:a,decoration:o,callout:s}=e;if(n.x+n.width<0||n.y+n.height<0||n.x>i.width||n.y>i.height||!i.width)return null;let c=s?a:null,l;t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==c?(l=Br(n,r,i,c),t[0]=i,t[1]=r,t[2]=n,t[3]=c,t[4]=l):l=t[4];let{side:u,placement:d,reach:f}=l,p=`${f}px`,m;t[5]!==n.height||t[6]!==n.width||t[7]!==n.x||t[8]!==n.y||t[9]!==p?(m={left:n.x,top:n.y,width:n.width,height:n.height,"--design-agent-edit-reach":p},t[5]=n.height,t[6]=n.width,t[7]=n.x,t[8]=n.y,t[9]=p,t[10]=m):m=t[10];let h=m,g;t[11]===s?g=t[12]:(g=s?(0,G.jsx)(`div`,{className:`design-agent-edit-callout`,children:s}):null,t[11]=s,t[12]=g);let _;return t[13]!==o||t[14]!==d||t[15]!==u||t[16]!==h||t[17]!==g?(_=(0,G.jsxs)(`div`,{className:`design-agent-edit`,"data-side":u,"data-placement":d,style:h,children:[o,g]}),t[13]=o,t[14]=d,t[15]=u,t[16]=h,t[17]=g,t[18]=_):_=t[18],_}var Mu=(e,t,n,r,i,a,o=0)=>Fr(dr(e,t,n).items.map(e=>e.bounds),r,i,a,o);function Nu({preferences:e,viewKey:t,chrome:n=`panel`,document:r,theme:i,context:a,assets:o,selection:s,changedNodeIds:c,onSelect:l,annotationMode:u,onAnnotationModeChange:d,onAnchor:f,onOpenAnnotation:p,revision:m,externalViewport:h,onViewportChange:g,renderSelectionOverlay:_,agentEdit:v,frameDecoration:y,batch:b,agents:x}){let S=(0,V.useRef)(null),C=(0,V.useRef)(null),w=(0,V.useRef)({x:0,y:0,width:1,height:1}),T=(0,V.useRef)({width:1,height:1}),E=(0,V.useRef)(0);E.current=!v||n!==`workspace`?0:v.callout?zr.width:120;let D=(0,V.useRef)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(new Map),A=(0,V.useRef)(null),j=(0,V.useRef)(null),M=(0,V.useRef)(null),N=(0,V.useRef)({document:r,theme:i,context:a,selection:s,changedNodeIds:c,externalViewport:h});N.current={document:r,theme:i,context:a,selection:s,changedNodeIds:c,externalViewport:h};let[P,F]=(0,V.useState)({width:0,height:0}),[I,L]=(0,V.useState)(!1),[R,ee]=(0,V.useState)(w.current),[te,ne]=(0,V.useState)(100),[re,z]=(0,V.useState)(null),ie=(0,V.useCallback)(()=>{let e=S.current,t=[...k.current.keys()];k.current.clear(),O.current=null,A.current=null,j.current&&(j.current.hidden=!0);for(let n of t)e?.hasPointerCapture(n)&&e.releasePointerCapture(n)},[]);(0,V.useEffect)(()=>{let e=()=>{window.document.hidden&&ie()};return window.addEventListener(`blur`,ie),window.document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,ie),window.document.removeEventListener(`visibilitychange`,e)}},[ie]),(0,V.useEffect)(ie,[t,u,I,ie]);let ae=(0,V.useMemo)(()=>{try{return dr(r,i,a).items}catch{return null}},[r,i,a]),oe=(0,V.useMemo)(()=>{try{let e=ae??dr(r,i,a).items,t=new Set(r.roots),n=new Set(s),o=e.filter(e=>t.has(e.ownerId)&&e.node.type===`frame`),c=e.filter(e=>n.has(e.ownerId));if(!c.length)return{frames:o,selectionBounds:null};let l=Math.min(...c.map(e=>e.bounds.x)),u=Math.min(...c.map(e=>e.bounds.y)),d=Math.max(...c.map(e=>e.bounds.x+e.bounds.width)),f=Math.max(...c.map(e=>e.bounds.y+e.bounds.height));return{frames:o,selectionBounds:{x:l,y:u,width:d-l,height:f-u}}}catch{return{frames:[],selectionBounds:null}}},[ae,r,i,a,s]),se=!!v,ce=(0,V.useMemo)(()=>{if(!se||!c.length)return null;let e=new Set(c.flatMap(e=>{let t=r.nodes[e];return t&&`children`in t?t.children:[]})),t=c.findLast(t=>r.nodes[t]&&!e.has(t));if(!t)return null;try{let e=(ae??dr(r,i,a).items).filter(e=>e.ownerId===t);if(!e.length)return null;let n=Math.min(...e.map(e=>e.bounds.x)),o=Math.min(...e.map(e=>e.bounds.y)),s=Math.max(...e.map(e=>e.bounds.x+e.bounds.width)),c=Math.max(...e.map(e=>e.bounds.y+e.bounds.height));return{nodeId:t,name:r.nodes[t]?.name??``,bounds:{x:n,y:o,width:s-n,height:c-o}}}catch{return null}},[se,c,ae,r,i,a]),le=b!==void 0,ue=(0,V.useMemo)(()=>{if(!le||!ae)return null;let e=new Map;for(let t of ae){let n=e.get(t.ownerId);n?n.push(t.bounds):e.set(t.ownerId,[t.bounds])}return new Map([...e].flatMap(([e,t])=>{let n=Gl(t);return n?[[e,n]]:[]}))},[le,ae]),de=x?.some(e=>e.active)??!1,fe=(0,V.useMemo)(()=>new Set(x?.flatMap(e=>e.workingNodeId?[e.workingNodeId]:[])),[x]),pe=P.width/R.width,me=e=>({x:(e.x-R.x)*pe,y:(e.y-R.y)*pe,width:e.width*pe,height:e.height*pe}),he=v&&ce?me(ce.bounds):null,ge=(()=>{if(!ce||!he)return null;let{x:e,y:t,width:n,height:r}=ce.bounds,i=e+n/2,a=t+r/2,o=oe.frames.find(({bounds:e})=>i>=e.x&&i<=e.x+e.width&&a>=e.y&&a<=e.y+e.height)?.bounds;return o?me(o):null})(),[B,_e]=(0,V.useState)(null),ve=(0,V.useCallback)(e=>{_e(t=>t===e||t&&e&&Math.round(t.x)===Math.round(e.x)&&Math.round(t.y)===Math.round(e.y)&&Math.round(t.width)===Math.round(e.width)&&Math.round(t.height)===Math.round(e.height)?t:e)},[]),ye=oe.frames.filter(({bounds:e})=>e.x+e.width>=R.x&&e.x<=R.x+R.width&&e.y+e.height>=R.y&&e.y<=R.y+R.height).slice(0,100),be=oe.selectionBounds,xe=be?{x:(be.x+be.width/2-R.x)*pe,y:(be.y+be.height-R.y)*pe}:null,Se=(0,V.useMemo)(()=>Su(r.annotations),[r.annotations]),Ce=(0,V.useMemo)(()=>{if(!Object.keys(r.annotations).length)return[];let e;try{e=new Map(dr(r,i,a).items.map(e=>[e.ownerId,e.bounds]))}catch{e=new Map}return Object.entries(r.annotations).flatMap(([t,n])=>{if(n.revision!==m)return[];let r=n.anchor,i=r.kind===`point`?{x:r.x,y:r.y}:r.kind===`region`?{x:r.bounds.x+r.bounds.width/2,y:r.bounds.y+r.bounds.height/2}:(()=>{let t=r.nodeIds.map(t=>e.get(t)).find(Boolean);return t?{x:t.x+t.width,y:t.y}:null})();return i?[{id:t,annotation:n,point:i}]:[]})},[r,i,a,m]),we=(0,V.useCallback)(e=>{let t=M.current;if(t)for(let n of t.querySelectorAll(`[data-design-pin]`)){let t=Number(n.dataset.x),r=Number(n.dataset.y),i=(t-e.x)/e.width*T.current.width,a=(r-e.y)/e.height*T.current.height;n.style.left=`${i}px`,n.style.top=`${a}px`,n.hidden=i<0||a<0||i>T.current.width||a>T.current.height}},[]);(0,V.useEffect)(()=>{let e=S.current;if(!e)return;let t=new ResizeObserver(()=>{if(!e.clientWidth||!e.clientHeight)return;let t=Math.max(1,Math.round(e.clientWidth)),n=Math.max(1,Math.round(e.clientHeight));F(e=>e.width===t&&e.height===n?e:{width:t,height:n})});t.observe(e);let n=e=>e.preventDefault();return e.addEventListener(`wheel`,n,{passive:!1}),()=>{t.disconnect(),e.removeEventListener(`wheel`,n)}},[]);let Te=(0,V.useCallback)(e=>{w.current=e,ee(e);let n=C.current;n&&(n.setViewport(e),n.render()),ne(Math.round(T.current.width/e.width*100)),ku.set(t,{bounds:e,width:T.current.width}),we(e),g?.(e)},[t,we,g]);(0,V.useLayoutEffect)(()=>we(w.current),[Ce,we]),(0,V.useEffect)(()=>{h&&C.current&&Te(h)},[h,Te]),(0,V.useEffect)(()=>{if(!P.width||!P.height||!S.current)return;let e=!1,r=S.current,i=T.current;return T.current=P,z(null),wl(r,P.width,P.height,o,()=>{e||z(`An image could not be decoded. Its placeholder remains visible.`)}).then(a=>{if(e){a.destroy();return}let o=N.current;C.current=a,a.setStrokes(Ou(r)),a.setDocument(o.document,o.theme,o.context),a.setSelection(o.selection),a.setChanges(o.changedNodeIds);let s=w.current;if(o.externalViewport)D.current=o.document.documentId,Te(o.externalViewport);else if(D.current!==o.document.documentId){D.current=o.document.documentId;let e=ku.get(t);if(e){let t=e.width/e.bounds.width;Te({...e.bounds,width:P.width/t,height:P.height/t})}else Te(Mu(o.document,o.theme,o.context,P.width,P.height,n,E.current))}else{let e=i.width/s.width,t=P.width/e,n=P.height/e;Te({x:s.x+(s.width-t)/2,y:s.y+(s.height-n)/2,width:t,height:n})}}).catch(()=>{e||(C.current?.destroy(),C.current=null,z(`Canvas could not load. Try reopening this design.`))}),()=>{e=!0,C.current?.destroy(),C.current=null,r.replaceChildren()}},[P.width,P.height,o,t]),(0,V.useEffect)(()=>{let e=C.current;if(e)try{e.setDocument(r,i,a),D.current!==r.documentId&&(D.current=r.documentId,Te(Mu(r,i,a,T.current.width,T.current.height,n,E.current))),e.render(),z(null)}catch{z(`This design has layout problems. Check diagnostics.`)}},[r,i,a,Te,n]),(0,V.useEffect)(()=>{let e=C.current;e&&(e.setSelection(s),e.render())},[s]),(0,V.useEffect)(()=>{let e=C.current;e&&(e.setChanges(c),e.render())},[c]),(0,V.useEffect)(()=>{let e=S.current;if(!e)return;let t=new MutationObserver(()=>{let t=C.current;t&&(t.setStrokes(Ou(e)),t.render())});return t.observe(window.document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`,`style`]}),()=>t.disconnect()},[]);let Ee=(0,V.useCallback)((e,t,n)=>{let r=w.current,i=T.current.width,a=T.current.height,o=Math.max(.05,Math.min(8,i/r.width*e)),s=i/o,c=a/o,l=r.x+t/i*r.width,u=r.y+n/a*r.height;Te({x:l-t/i*s,y:u-n/a*c,width:s,height:c})},[Te]),De=t=>{let n=t.currentTarget.getBoundingClientRect();if(t.ctrlKey||t.metaKey||e?.scrollWheelZoom){let r=e?.invertZoom?1:-1;Ee(Math.exp(r*t.deltaY*.006),t.clientX-n.left,t.clientY-n.top)}else{let e=w.current;Te({...e,x:e.x+t.deltaX*e.width/T.current.width,y:e.y+t.deltaY*e.height/T.current.height})}},Oe=e=>{if(e.button===0||e.button===1){if(e.currentTarget.focus({preventScroll:!0}),k.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),u===`region`&&e.button===0){let t=e.currentTarget.getBoundingClientRect();A.current={x:e.clientX-t.left,y:e.clientY-t.top},e.currentTarget.setPointerCapture(e.pointerId);return}if(u&&e.button===0){O.current={x:e.clientX,y:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId);return}O.current=k.current.size===1?{x:e.clientX,y:e.clientY,moved:!1}:null,e.currentTarget.setPointerCapture(e.pointerId)}},ke=e=>{if(e.pointerType!==`touch`&&e.buttons===0){ie();return}if(A.current){let t=j.current,n=e.currentTarget.getBoundingClientRect(),r={x:e.clientX-n.left,y:e.clientY-n.top};t&&(t.hidden=!1,t.style.left=`${Math.min(A.current.x,r.x)}px`,t.style.top=`${Math.min(A.current.y,r.y)}px`,t.style.width=`${Math.abs(r.x-A.current.x)}px`,t.style.height=`${Math.abs(r.y-A.current.y)}px`);return}if(u){let t=O.current;t&&Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)>4&&(t.moved=!0);return}let t=k.current;if(!t.has(e.pointerId))return;let n=[...t.values()];if(t.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.size===2){let r=[...t.values()],i=n[0],a=n[1],o=r[0],s=r[1];if(!i||!a||!o||!s)return;let c=Math.hypot(i.x-a.x,i.y-a.y),l=Math.hypot(o.x-s.x,o.y-s.y);if(c<1||l<1)return;let u=e.currentTarget.getBoundingClientRect(),d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},f={x:(o.x+s.x)/2,y:(o.y+s.y)/2},p=w.current,m=T.current.width,h=T.current.height,g=Math.max(.05,Math.min(8,m/p.width*l/c)),_=m/g,v=h/g,y=p.x+(d.x-u.left)/m*p.width,b=p.y+(d.y-u.top)/h*p.height;Te({x:y-(f.x-u.left)/m*_,y:b-(f.y-u.top)/h*v,width:_,height:v});return}let r=O.current;if(!r)return;let i=e.clientX-r.x,a=e.clientY-r.y;if(Math.abs(i)+Math.abs(a)>2&&(r.moved=!0),r.moved){let e=w.current;Te({...e,x:e.x-i*e.width/T.current.width,y:e.y-a*e.height/T.current.height})}r.x=e.clientX,r.y=e.clientY},Ae=e=>{if(A.current){let t=A.current;A.current=null,k.current.delete(e.pointerId),j.current&&(j.current.hidden=!0);let n=e.currentTarget.getBoundingClientRect(),r={x:e.clientX-n.left,y:e.clientY-n.top};if(Math.abs(r.x-t.x)<4||Math.abs(r.y-t.y)<4)return;let i=w.current,a=i.x+Math.min(t.x,r.x)/n.width*i.width,o=i.y+Math.min(t.y,r.y)/n.height*i.height;f?.({kind:`region`,bounds:{x:a,y:o,width:Math.abs(r.x-t.x)/n.width*i.width,height:Math.abs(r.y-t.y)/n.height*i.height}});return}let t=k.current.size>1;if(k.current.delete(e.pointerId),t){let e=k.current.values().next().value;O.current=e?{...e,moved:!0}:null;return}let n=O.current;if(O.current=null,!n||n.moved||I||e.button===1)return;let r=e.currentTarget.getBoundingClientRect(),i=w.current,a=i.x+(e.clientX-r.left)/r.width*i.width,o=i.y+(e.clientY-r.top)/r.height*i.height,s=C.current?.hitTest(a,o);if(u===`pin`){f?.({kind:`point`,x:a,y:o});return}if(u===`nodes`){s&&f?.({kind:`nodes`,nodeIds:[s]});return}l(s?[s]:[])};return(0,G.jsxs)(`div`,{className:`design-canvas-wrap`,children:[(0,G.jsx)(`div`,{className:`design-canvas-tools`,role:`toolbar`,"aria-label":`Canvas controls`,children:[{label:`Select`,icon:rt,active:!I&&!u,run:()=>{L(!1),d?.(null)}},{label:`Pan`,icon:Ke,active:I&&!u,run:()=>{L(!0),d?.(null)}},...d?[{label:`Pin`,mode:`pin`,icon:Ze},{label:`Region`,mode:`region`,icon:st},{label:`Node`,mode:`nodes`,icon:He}].map(({label:e,mode:t,icon:n})=>({label:e,icon:n,active:u===t,run:()=>{L(!1),d(t)}})):[],{label:`Fit`,icon:ot,active:void 0,run:()=>Te(Mu(r,i,a,T.current.width,T.current.height,n,E.current))}].map(({label:e,icon:t,active:n,run:r})=>(0,G.jsxs)(V.Fragment,{children:[e===`Fit`?(0,G.jsx)(`span`,{className:`design-tool-separator`,"aria-hidden":`true`}):null,(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(W,{size:`icon-sm`,variant:`ghost`,"aria-label":e,"aria-pressed":n,className:`aria-pressed:bg-accent`,onClick:r}),children:(0,G.jsx)(t,{"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:e})]})]},e))}),(0,G.jsxs)(`div`,{className:`design-canvas-zoom`,"aria-label":`Canvas zoom`,children:[(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(W,{size:`icon-sm`,variant:`ghost`,"aria-label":`Zoom out`,onClick:()=>Ee(1/1.5,T.current.width/2,T.current.height/2)}),children:(0,G.jsx)(tt,{"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:`Zoom out`})]}),(0,G.jsxs)(`output`,{"aria-label":`Zoom level`,children:[te,`%`]}),(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(W,{size:`icon-sm`,variant:`ghost`,"aria-label":`Zoom in`,onClick:()=>Ee(1.5,T.current.width/2,T.current.height/2)}),children:(0,G.jsx)(it,{"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:`Zoom in`})]})]}),(0,G.jsxs)(`div`,{className:`design-frame-labels`,children:[y?ye.map(e=>(0,G.jsx)(`div`,{className:`design-frame-mark`,style:{left:(e.bounds.x-R.x)*pe,top:(e.bounds.y-R.y)*pe,width:e.bounds.width*pe,height:e.bounds.height*pe},children:typeof y==`function`?y({name:e.node.name,width:e.bounds.width,height:e.bounds.height}):y},`mark:${e.key}`)):null,ye.map(e=>(0,G.jsx)(Au,{name:e.node.name,x:(e.bounds.x-R.x)*pe,y:(e.bounds.y-R.y)*pe,hidden:fe.has(e.ownerId)},e.key))]}),xe&&be&&xe.x>=0&&xe.x<=P.width&&xe.y>=0&&xe.y<=P.height?(0,G.jsxs)(`output`,{className:`design-selection-badge`,"aria-label":`Selection dimensions`,style:{left:xe.x,top:xe.y},children:[Math.round(be.width),` × `,Math.round(be.height)]}):null,v&&ce&&he?(0,G.jsx)(ju,{frame:ge,screen:he,canvas:P,avoid:_&&be?B:null,decoration:de?void 0:v.decoration,callout:de?void 0:v.callout?.({nodeId:ce.nodeId,name:ce.name})},ce.nodeId):null,ue&&P.width&&P.height?(0,G.jsx)(cu,{document:r,bounds:ue,viewport:R,canvas:P,batch:b??null,agents:x,cursorSize:e?.agentCursorSize,cursorLabel:e?.agentCursorLabel,animations:e?.animations,onReveal:e=>Te(Xl(e,w.current,T.current))}):null,_&&be&&P.width&&P.height?_({screen:{x:(be.x-R.x)*pe,y:(be.y-R.y)*pe,width:be.width*pe,height:be.height*pe},world:be,canvas:P,avoid:he,onPlaced:ve}):null,(0,G.jsx)(`div`,{ref:S,className:`design-canvas-surface ${I?`design-canvas-pan`:``}`,role:`application`,"aria-label":u?`Design canvas. ${u===`region`?`Drag a region`:`Click to place an annotation`}; arrow keys move the view and Enter anchors the selection or view center.`:`Design canvas. Drag to pan, ${e?.scrollWheelZoom?`scroll or pinch`:`pinch or Control and wheel`} to zoom, click to select.`,tabIndex:0,onWheel:De,onPointerDown:Oe,onPointerMove:ke,onPointerUp:Ae,onPointerCancel:ie,onLostPointerCapture:e=>{k.current.has(e.pointerId)&&ie()},onBlur:ie,onKeyDown:e=>{if(e.key===`Enter`&&u){let t=w.current,n=t.x+t.width/2,r=t.y+t.height/2;if(u===`pin`)f?.({kind:`point`,x:n,y:r});else if(u===`region`)f?.({kind:`region`,bounds:{x:n-t.width/8,y:r-t.height/8,width:t.width/4,height:t.height/4}});else{let e=s[0]??C.current?.hitTest(n,r);e&&f?.({kind:`nodes`,nodeIds:[e]})}e.preventDefault();return}(e.key===`+`||e.key===`=`)&&(Ee(1.5,T.current.width/2,T.current.height/2),e.preventDefault()),e.key===`-`&&(Ee(1/1.5,T.current.width/2,T.current.height/2),e.preventDefault()),e.key===`Escape`&&(ie(),d?.(null),L(!1),l([]),e.preventDefault()),e.key===`Home`&&(Te(Mu(r,i,a,T.current.width,T.current.height,n,E.current)),e.preventDefault());let t=e.key===`ArrowLeft`?[-40,0]:e.key===`ArrowRight`?[40,0]:e.key===`ArrowUp`?[0,-40]:e.key===`ArrowDown`?[0,40]:null;if(t){let n=w.current;Te({...n,x:n.x+t[0]*n.width/T.current.width,y:n.y+t[1]*n.height/T.current.height}),e.preventDefault()}}}),e?.showPixelGrid&&pe>=4?(0,G.jsx)(`div`,{className:`design-pixel-grid`,"aria-hidden":`true`,style:{backgroundSize:`${pe}px ${pe}px`,backgroundPosition:`${-R.x*pe}px ${-R.y*pe}px`}}):null,(0,G.jsx)(`div`,{ref:M,className:`design-annotation-pins`,children:p?Ce.map(({id:e,annotation:t,point:n})=>{let r=t.blocking&&t.status===`open`,i=Se.get(e)??0;return(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(`button`,{type:`button`,"data-design-pin":!0,"data-x":n.x,"data-y":n.y,"aria-label":`Open ${r?`blocking `:``}comment ${i} by ${t.author}`,className:`design-annotation-pin${r?` design-annotation-pin-blocking`:``}${t.status===`resolved`?` design-annotation-pin-resolved`:``}`,onClick:()=>p?.(e)}),children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:r?`!`:i})}),(0,G.jsxs)(jr,{children:[(0,G.jsx)(`strong`,{children:t.author}),` `,t.body.split(`
18
18
  `,1)[0]]})]},e)}):null}),(0,G.jsx)(`div`,{ref:j,className:`design-annotation-region`,hidden:!0}),re?(0,G.jsx)(`div`,{className:`design-canvas-error`,role:`alert`,children:re}):null]})}function Pu(e){return e===void 0?`—`:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?`${e.length} items`:`Object`}function Fu(e){let t=(0,H.c)(43),{preferences:n,before:r,after:i,beforeRevision:a,afterRevision:o,viewKey:s,theme:c,beforeContext:l,beforeAssets:u,context:d,assets:f,selection:p,onSelect:m,onExit:h}=e,[g,_]=(0,V.useState)(`Before / after`),[v,y]=(0,V.useState)(50),[b,x]=(0,V.useState)(),S;t[0]!==i||t[1]!==r?(S=fr(r,i).filter(zu),t[0]=i,t[1]=r,t[2]=S):S=t[2];let C=S,w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,G.jsx)(`strong`,{children:`Compare revisions`}),t[3]=w):w=t[3];let T;t[4]===a?T=t[5]:(T=a.slice(0,8),t[4]=a,t[5]=T);let E;t[6]===o?E=t[7]:(E=o.slice(0,8),t[6]=o,t[7]=E);let D;t[8]!==T||t[9]!==E?(D=(0,G.jsxs)(`div`,{className:`design-compare-revisions`,children:[w,(0,G.jsxs)(`span`,{className:`design-small-muted`,children:[`Before `,T,` · After `,E]})]}),t[8]=T,t[9]=E,t[10]=D):D=t[10];let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=[`Before / after`,`Overlay`,`Changes`],t[11]=O):O=t[11];let k;t[12]===g?k=t[13]:(k=(0,G.jsx)(`nav`,{"aria-label":`Compare display`,children:O.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-current":g===e?`page`:void 0,onClick:()=>_(e),children:e},e))}),t[12]=g,t[13]=k);let A;t[14]===h?A=t[15]:(A=(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:h,children:`Exit compare`}),t[14]=h,t[15]=A);let j;t[16]!==k||t[17]!==A?(j=(0,G.jsxs)(`div`,{className:`design-compare-controls`,children:[k,A]}),t[16]=k,t[17]=A,t[18]=j):j=t[18];let M;t[19]!==D||t[20]!==j?(M=(0,G.jsxs)(`header`,{className:`design-compare-header`,children:[D,j]}),t[19]=D,t[20]=j,t[21]=M):M=t[21];let N;t[22]!==i||t[23]!==o||t[24]!==f||t[25]!==r||t[26]!==u||t[27]!==l||t[28]!==a||t[29]!==C||t[30]!==d||t[31]!==g||t[32]!==m||t[33]!==v||t[34]!==b||t[35]!==n||t[36]!==p||t[37]!==c||t[38]!==s?(N=g===`Changes`?(0,G.jsx)(`div`,{className:`design-compare-changes`,children:C.length?(0,G.jsx)(`ol`,{children:C.map(Ru)}):(0,G.jsx)(`p`,{children:`No content changes between these revisions.`})}):g===`Before / after`?(0,G.jsxs)(`div`,{className:`design-compare-pair`,children:[(0,G.jsxs)(`section`,{"aria-label":`Before revision ${a}`,children:[(0,G.jsxs)(`div`,{className:`design-compare-caption`,children:[`Before · `,a.slice(0,8)]}),(0,G.jsx)(Nu,{preferences:n,viewKey:`${s}:compare-before`,document:r,theme:c,context:l,assets:u,selection:[],changedNodeIds:[],onSelect:Lu})]}),(0,G.jsxs)(`section`,{"aria-label":`After revision ${o}`,children:[(0,G.jsxs)(`div`,{className:`design-compare-caption`,children:[`After · `,o.slice(0,8)]}),(0,G.jsx)(Nu,{preferences:n,viewKey:`${s}:compare-after`,document:i,theme:c,context:d,assets:f,selection:p,changedNodeIds:[],onSelect:m})]})]}):(0,G.jsxs)(`div`,{className:`design-compare-overlay`,children:[(0,G.jsxs)(`label`,{className:`design-compare-opacity`,children:[`After opacity`,` `,(0,G.jsx)(`input`,{type:`range`,min:`0`,max:`100`,value:v,onChange:e=>y(Number(e.target.value))}),` `,v,`%`]}),(0,G.jsxs)(`div`,{className:`design-compare-overlay-stack`,children:[(0,G.jsx)(Nu,{preferences:n,viewKey:`${s}:compare-overlay-before`,document:r,theme:c,context:l,assets:u,selection:[],changedNodeIds:[],onSelect:Iu,externalViewport:b}),(0,G.jsx)(`div`,{style:{"--design-after-opacity":v/100},"aria-label":`After revision ${o}`,children:(0,G.jsx)(Nu,{preferences:n,viewKey:`${s}:compare-overlay-after`,document:i,theme:c,context:d,assets:f,selection:p,changedNodeIds:[],onSelect:m,onViewportChange:x})})]})]}),t[22]=i,t[23]=o,t[24]=f,t[25]=r,t[26]=u,t[27]=l,t[28]=a,t[29]=C,t[30]=d,t[31]=g,t[32]=m,t[33]=v,t[34]=b,t[35]=n,t[36]=p,t[37]=c,t[38]=s,t[39]=N):N=t[39];let P;return t[40]!==M||t[41]!==N?(P=(0,G.jsxs)(`div`,{className:`design-compare`,children:[M,N]}),t[40]=M,t[41]=N,t[42]=P):P=t[42],P}function Iu(){}function Lu(){}function Ru(e){return(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`strong`,{children:e.kind}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`code`,{children:e.path}),(0,G.jsxs)(`small`,{children:[Pu(e.before),` → `,Pu(e.after)]})]})]},e.path)}function zu(e){return!/^\/(annotations|reviews|acceptances)(\/|$)/.test(e.path)}function Bu(e){if(e.fills?.[0]?.kind===`image`)return{label:`Image`,icon:qe};switch(e.type){case`frame`:return{label:`Frame`,icon:We};case`group`:return{label:`Group`,icon:Ge};case`rectangle`:return{label:`Rectangle`,icon:dt};case`ellipse`:return{label:`Ellipse`,icon:Le};case`path`:return{label:`Path`,icon:ut};case`text`:return{label:`Text`,icon:pt};case`ref`:return{label:`Component`,icon:Re}}}function Vu(e){let t=(0,H.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,children:n,scrollFade:a,scrollbarGutter:o,hideScrollbars:s,chainVerticalScroll:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a!==void 0&&a,u=o!==void 0&&o,d=s!==void 0&&s,f=c!==void 0&&c,p;t[8]===r?p=t[9]:(p=U(`relative size-full min-h-0 overflow-hidden rounded-[inherit]`,r),t[8]=r,t[9]=p);let m=f&&`overscroll-y-auto`,h=l&&`mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]`,g=u&&`scrollbar-gutter-stable`,_=d&&`[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,v;t[10]!==m||t[11]!==h||t[12]!==g||t[13]!==_?(v=U(`h-full max-h-[inherit] overflow-auto overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain`,m,h,g,_),t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==n||t[16]!==v?(y=(0,G.jsx)(en,{className:v,"data-slot":`scroll-area-viewport`,children:n}),t[15]=n,t[16]=v,t[17]=y):y=t[17];let b;t[18]===d?b=t[19]:(b=!d&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Hu,{orientation:`vertical`}),(0,G.jsx)(Hu,{orientation:`horizontal`}),(0,G.jsx)(rn,{"data-slot":`scroll-area-corner`})]}),t[18]=d,t[19]=b);let x;return t[20]!==i||t[21]!==y||t[22]!==b||t[23]!==p?(x=(0,G.jsxs)($t,{className:p,...i,children:[y,b]}),t[20]=i,t[21]=y,t[22]=b,t[23]=p,t[24]=x):x=t[24],x}function Hu(e){let t=(0,H.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]===n?o=t[5]:(o=U(`flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:mx-1 data-[orientation=horizontal]:mb-px data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:my-1 data-[orientation=vertical]:mr-px data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(tn,{className:`relative flex-1 rounded-full bg-[var(--app-scrollbar-thumb)] transition-colors hover:bg-[var(--app-scrollbar-thumb-hover)]`,"data-slot":`scroll-area-thumb`}),t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==r||t[9]!==o?(c=(0,G.jsx)(nn,{className:o,"data-slot":`scroll-area-scrollbar`,orientation:a,...r,children:s}),t[7]=a,t[8]=r,t[9]=o,t[10]=c):c=t[10],c}var Uu=ln,Wu=cn;function Gu(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(kn,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(fn,{forceRender:!0,className:i,"data-slot":`dialog-backdrop`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ku(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(sn,{className:i,"data-slot":`dialog-viewport`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qu(e){let t=(0,H.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,showCloseButton:a,bottomStickOnMobile:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0||a,c=o===void 0||o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,G.jsx)(Gu,{}),t[6]=l):l=t[6];let u=c&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`,d;t[7]===u?d=t[8]:(d=U(u),t[7]=u,t[8]=d);let f=c&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4`,p;t[9]!==r||t[10]!==f?(p=U(An,`row-start-2 max-h-full max-w-lg text-popover-foreground`,f,r),t[9]=r,t[10]=f,t[11]=p):p=t[11];let m;t[12]===s?m=t[13]:(m=s&&(0,G.jsx)(on,{"aria-label":`Close`,className:`absolute end-2 top-2`,render:(0,G.jsx)(W,{size:`icon`,variant:`ghost`}),children:(0,G.jsx)(gt,{})}),t[12]=s,t[13]=m);let h;t[14]!==n||t[15]!==i||t[16]!==p||t[17]!==m?(h=(0,G.jsxs)(un,{className:p,"data-slot":`dialog-popup`,...i,children:[n,m]}),t[14]=n,t[15]=i,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;return t[19]!==d||t[20]!==h?(g=(0,G.jsxs)(Wu,{children:[l,(0,G.jsx)(Ku,{className:d,children:h})]}),t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function Ju(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`flex flex-col gap-2 p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pb-3 max-sm:pb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(`div`,{className:i,"data-slot":`dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yu(e){let t=(0,H.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o=a==="default"&&`border-t bg-muted/72 py-4`,s=a===`bare`&&`py-4`,c;t[4]!==n||t[5]!==o||t[6]!==s?(c=U(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,o,s,n),t[4]=n,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==r||t[9]!==c?(l=(0,G.jsx)(`div`,{className:c,"data-slot":`dialog-footer`,...r}),t[8]=r,t[9]=c,t[10]=l):l=t[10],l}function Xu(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`font-heading font-semibold text-xl leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(dn,{className:i,"data-slot":`dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zu(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(an,{className:i,"data-slot":`dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qu(e){let t=(0,H.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollFade:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i,o;t[4]===n?o=t[5]:(o=U(`p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1 in-[[data-slot=dialog-popup]:has([data-slot=dialog-footer]:not(.border-t))]:pb-1`,n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==o?(s=(0,G.jsx)(`div`,{className:o,"data-slot":`dialog-panel`,...r}),t[6]=r,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==a||t[10]!==s?(c=(0,G.jsx)(Vu,{scrollFade:a,children:s}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function $u(e){let t=(0,H.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(Zt,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:ed}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,G.jsx)(Xt,{className:i,"data-slot":`checkbox`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function ed(e,t){return(0,G.jsx)(`span`,{...e,children:t.indeterminate?(0,G.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,G.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,G.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,G.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})}function td(e){let t=(0,H.c)(30),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,size:i,unstyled:a,nativeInput:o,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?`default`:i,c=a!==void 0&&a,l=o!==void 0&&o,u=s===`sm`&&`h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5`,d=s===`lg`&&`h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5`,f=r.type===`search`&&`[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none`,p=r.type===`file`&&`text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm`,m;t[6]!==u||t[7]!==d||t[8]!==f||t[9]!==p?(m=U(`h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5 [transition:background-color_5000000s_ease-in-out_0s]`,u,d,f,p),t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=m,g;if(l){let e,n;if(t[11]!==r){let{style:i,onValueChange:a,...o}=r;n=i,e=o,t[11]=r,t[12]=e,t[13]=n}else e=t[12],n=t[13];let i=typeof n==`function`?void 0:n,a=typeof s==`number`?s:void 0,o=e,c;t[14]!==h||t[15]!==i||t[16]!==o||t[17]!==a?(c=(0,G.jsx)(`input`,{className:h,"data-slot":`input`,size:a,style:i,...o}),t[14]=h,t[15]=i,t[16]=o,t[17]=a,t[18]=c):c=t[18],g=c}else{let e=typeof s==`number`?s:void 0,n;t[19]!==h||t[20]!==r||t[21]!==e?(n=(0,G.jsx)(Qt,{className:h,"data-slot":`input`,size:e,...r}),t[19]=h,t[20]=r,t[21]=e,t[22]=n):n=t[22],g=n}let _;t[23]!==n||t[24]!==c?(_=U(!c&&`relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]`,n)||void 0,t[23]=n,t[24]=c,t[25]=_):_=t[25];let v;return t[26]!==g||t[27]!==s||t[28]!==_?(v=(0,G.jsx)(`span`,{className:_,"data-size":s,"data-slot":`input-control`,children:g}),t[26]=g,t[27]=s,t[28]=_,t[29]=v):v=t[29],v}function nd(e){let t=(0,H.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s;let l={className:U(`inline-flex items-center gap-2 text-base/4.5 sm:text-sm/4 font-medium text-foreground`,o),"data-slot":`label`};a=ge,r=`label`,i=xe(l,c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}function rd(e){let t=(0,H.c)(16),n=Hn(),r=Kn(),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(!1),[s,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,V.useState)(f),[h,g]=(0,V.useState)(null),_,v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>()=>i.current?.abort(),v=[],t[1]=_,t[2]=v):(_=t[1],v=t[2]),(0,V.useEffect)(_,v);let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>i.current?.abort(),t[3]=y):y=t[3];let b=y,x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{b(),l(null),d(null),m([]),g(null)},t[4]=x):x=t[4];let S=x,C;t[5]!==n||t[6]!==r||t[7]!==e?(C=async t=>{if(!e)return null;b();let a=new AbortController;i.current=a,o(!0),l(null),d(null),m([]),g(null);let s=[],u=null,f=re(()=>new Promise(e=>{a.signal.aborted?e():a.signal.addEventListener(`abort`,()=>e(),{once:!0})})),p=null;try{await r(P(I(n.transport.transfer(e,t),e=>c(()=>{a.signal.aborted||(e.kind===`progress`&&l(e),e.kind===`chunk`&&s.push(Uint8Array.from(atob(e.base64),id)),e.kind===`complete`&&(u=e))})),f))}catch(e){p={cause:e}}if(i.current!==a)return null;let h=a.signal.aborted;return i.current===a&&(i.current=null),a.abort(),o(!1),h?null:p?(g(p.cause instanceof Error?p.cause.message:String(p.cause)),null):u?(d(u),m(s),u):(g(`Transfer ended before a result was received.`),null)},t[5]=n,t[6]=r,t[7]=e,t[8]=C):C=t[8];let w=C,T;return t[9]!==a||t[10]!==p||t[11]!==h||t[12]!==s||t[13]!==u||t[14]!==w?(T={busy:a,progress:s,result:u,bytes:p,error:h,run:w,cancel:b,reset:S},t[9]=a,t[10]=p,t[11]=h,t[12]=s,t[13]=u,t[14]=w,t[15]=T):T=t[15],T}function id(e){return e.charCodeAt(0)}var ad={svg:`.svg,image/svg+xml`,png:`.png,image/png`,jpeg:`.jpg,.jpeg,image/jpeg`,webp:`.webp,image/webp`,"figma-rest":``,"figma-plugin":`.json,application/json`},od=[[`svg`,`SVG`],[`png`,`PNG`],[`jpeg`,`JPEG`],[`webp`,`WebP`],[`figma-rest`,`Figma URL`],[`figma-plugin`,`Figma plugin bundle`]];function sd(e){let t=(0,H.c)(18),{id:n,value:r,onChange:i,options:a,disabled:o}=e,s;t[0]===a?s=t[1]:(s=a.map(ld),t[0]=a,t[1]=s);let c;t[2]===i?c=t[3]:(c=e=>{e!==null&&i(e)},t[2]=i,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,G.jsx)(Er,{}),t[4]=l):l=t[4];let u;t[5]===n?u=t[6]:(u=(0,G.jsx)(Tr,{id:n,children:l}),t[5]=n,t[6]=u);let d;t[7]===a?d=t[8]:(d=a.map(cd),t[7]=a,t[8]=d);let f;t[9]===d?f=t[10]:(f=(0,G.jsx)(Dr,{children:d}),t[9]=d,t[10]=f);let p;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==u||t[15]!==f||t[16]!==r?(p=(0,G.jsxs)(Cr,{modal:!1,value:r,disabled:o,items:s,onValueChange:c,children:[u,f]}),t[11]=o,t[12]=s,t[13]=c,t[14]=u,t[15]=f,t[16]=r,t[17]=p):p=t[17],p}function cd(e){let[t,n,r]=e;return(0,G.jsx)(Or,{value:t,disabled:r,children:n},String(t))}function ld(e){let[t,n]=e;return{value:t,label:n}}async function ud(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=8192)n+=String.fromCharCode(...t.subarray(e,e+8192));return btoa(n)}function dd(e,t,n){let r=new Blob(e.map(e=>new Uint8Array(e)),{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,a.click(),setTimeout(()=>URL.revokeObjectURL(i),3e4)}function fd({open:e,mode:t,onModeChange:n,onOpenChange:r,target:i,documentPath:a,revision:o,document:s,selection:c,theme:l,onImportComplete:u,onOpenImported:d}){let f=rd(i),[p,m]=(0,V.useState)(`svg`),[h,g]=(0,V.useState)(`png`),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(!1),[D,O]=(0,V.useState)(`selection`),[k,A]=(0,V.useState)(1),[j,M]=(0,V.useState)(`transparent`),[N,P]=(0,V.useState)(null),[F,I]=(0,V.useState)(!1),L=(0,V.useRef)(0),R=(0,V.useRef)(null),ee=f.busy&&f.progress?.stage===`Saving document`,te=s?Object.entries(s.nodes).filter(([,e])=>e.type===`frame`):[],ne=i?{projectId:i.projectId,...i.threadId?{threadId:i.threadId}:{}}:null,re=e=>{if(!e){if(ee)return;L.current+=1,f.reset(),I(!1),S(``),v(null),b(``),w(``),P(null)}r(e)},z=async()=>{if(!ne)return;if(P(null),t===`import`){let e=C.trim();if(!e.toLowerCase().endsWith(`.p4design`)){P(`Choose a new .p4design destination path.`);return}if(p===`figma-rest`?!y.trim():!_){P(p===`figma-rest`?`Enter a Figma file URL.`:`Choose a file.`);return}I(!0);let t=++L.current,n;try{_&&p!==`figma-rest`&&(n=await ud(_))}catch{P(`The selected file could not be read. Choose it again.`),I(!1);return}if(L.current!==t)return;I(!1),await f.run({kind:`import`,target:ne,documentPath:e,format:p,sourceName:_?.name??y.trim(),...n?{payload:n}:{},...p===`figma-rest`?{url:y.trim(),...x.trim()?{token:x.trim()}:{}}:{},allowMissingAssets:T})&&u();return}let e=D===`selection`?c.length?[...c]:te[0]?[te[0][0]]:[]:[D];if(!s||!a||!o||!e.length){P(`Select a node or frame in a ready design to export.`);return}await f.run({kind:`export`,target:ne,documentPath:a,expectedContentHash:o,nodeIds:e,format:h,scale:k,background:j,theme:l})};return(0,G.jsx)(Uu,{open:e,onOpenChange:re,children:(0,G.jsxs)(qu,{className:`design-transfer-dialog max-w-lg`,showCloseButton:!ee,children:[(0,G.jsxs)(Ju,{children:[(0,G.jsx)(Xu,{children:`Design transfer`}),(0,G.jsx)(Zu,{children:`Import a design or export selected canvas content.`})]}),(0,G.jsxs)(Qu,{className:`design-transfer-panel`,children:[(0,G.jsx)(`div`,{className:`design-transfer-tabs`,role:`tablist`,"aria-label":`Transfer direction`,children:[`import`,`export`].map(e=>(0,G.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e,disabled:f.busy||F,onClick:()=>{n(e),f.reset(),P(null)},children:e===`import`?`Import`:`Export`},e))}),t===`import`?(0,G.jsxs)(`div`,{className:`design-transfer-fields`,children:[(0,G.jsx)(nd,{htmlFor:`design-import-format`,children:`Source format`}),(0,G.jsx)(sd,{id:`design-import-format`,value:p,disabled:f.busy||F,options:od,onChange:e=>{m(e),v(null),f.reset()}}),p===`figma-rest`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nd,{htmlFor:`design-figma-url`,children:`Figma file URL`}),(0,G.jsx)(td,{id:`design-figma-url`,type:`url`,value:y,onChange:e=>b(e.target.value)}),(0,G.jsx)(nd,{htmlFor:`design-figma-token`,children:`Figma token`}),(0,G.jsx)(td,{id:`design-figma-token`,type:`password`,value:x,onChange:e=>S(e.target.value),placeholder:`Leave blank to use stored token`,autoComplete:`off`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nd,{htmlFor:`design-import-file`,children:`Source file`}),(0,G.jsxs)(`div`,{className:`design-transfer-file`,children:[(0,G.jsx)(W,{id:`design-import-file`,size:`sm`,variant:`outline`,disabled:f.busy||F,onClick:()=>R.current?.click(),children:`Choose file`}),(0,G.jsx)(`span`,{className:`design-truncate design-small-muted`,"aria-live":`polite`,children:_?_.name:`No file chosen`}),(0,G.jsx)(`input`,{ref:R,type:`file`,hidden:!0,accept:ad[p],onChange:e=>{let t=e.target.files?.[0]??null;e.target.value=``,v(t),t&&!C.trim()&&w(`${t.name.replace(/\.[^.]+$/,``)}.p4design`)}})]}),p===`figma-plugin`?(0,G.jsx)(`p`,{className:`design-transfer-hint`,children:`Choose the JSON bundle exported by the Figma plugin.`}):null]}),(0,G.jsx)(nd,{htmlFor:`design-import-destination`,children:`New design path`}),(0,G.jsx)(td,{id:`design-import-destination`,value:C,onChange:e=>w(e.target.value),placeholder:`home.p4design`}),(0,G.jsxs)(`label`,{className:`design-transfer-checkbox`,children:[(0,G.jsx)($u,{checked:T,onCheckedChange:e=>E(e===!0)}),`Import with placeholders if assets fail`]})]}):(0,G.jsxs)(`div`,{className:`design-transfer-fields`,children:[!s||!o?(0,G.jsx)(`p`,{className:`design-transfer-hint`,children:`Open a ready design to export.`}):null,(0,G.jsx)(nd,{htmlFor:`design-export-scope`,children:`Export content`}),(0,G.jsx)(sd,{id:`design-export-scope`,value:!c.length&&D===`selection`?te[0]?.[0]??D:D,onChange:O,options:[[`selection`,`Selection (${c.length})`,!c.length],...te.map(([e,t])=>[e,`Frame: ${t.name||e.slice(0,8)}`])]}),(0,G.jsx)(nd,{htmlFor:`design-export-format`,children:`Format`}),(0,G.jsx)(sd,{id:`design-export-format`,value:h,onChange:g,options:[[`png`,`PNG`],[`svg`,`SVG`],[`pdf`,`PDF`]]}),(0,G.jsx)(nd,{htmlFor:`design-export-scale`,children:`Scale`}),(0,G.jsx)(sd,{id:`design-export-scale`,value:k,onChange:A,options:[[.5,`0.5x`],[1,`1x`],[2,`2x`],[4,`4x`]]}),(0,G.jsx)(nd,{htmlFor:`design-export-background`,children:`Background`}),(0,G.jsx)(sd,{id:`design-export-background`,value:j,onChange:M,options:[[`transparent`,`Transparent`],[`#FFFFFF`,`White`]]})]}),F?(0,G.jsx)(`p`,{role:`status`,children:`Reading source file…`}):null,f.progress&&!f.result&&!f.error&&!N?(0,G.jsxs)(`div`,{className:`design-transfer-progress`,role:`status`,children:[(0,G.jsx)(`span`,{children:ee?`Finishing save`:f.progress.stage}),(0,G.jsx)(`progress`,{value:f.progress.total>0?f.progress.completed:void 0,max:f.progress.total||void 0}),f.progress.total>0?(0,G.jsxs)(`small`,{children:[f.progress.completed,` / `,f.progress.total]}):null]}):null,N||f.error?(0,G.jsx)(`p`,{className:`design-transfer-error`,role:`alert`,children:N??f.error}):null,f.result?(0,G.jsxs)(`div`,{className:`design-transfer-result`,role:`status`,children:[(0,G.jsx)(`strong`,{children:t===`import`?`Import complete`:`Export ready`}),(0,G.jsxs)(`span`,{children:[`Source: `,f.result.provenance]}),f.result.unsupported.length?(0,G.jsxs)(`span`,{children:[`Unsupported: `,f.result.unsupported.join(`, `)]}):null,f.result.failedAssets.length?(0,G.jsxs)(`span`,{children:[`Failed assets: `,f.result.failedAssets.join(`, `)]}):null,f.result.diagnostics.length?(0,G.jsx)(`ul`,{children:[...new Set(f.result.diagnostics.map(e=>e.message))].map(e=>(0,G.jsx)(`li`,{children:e},e))}):null,t===`import`?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>{d(f.result.documentPath),re(!1)},children:`Open design`}):f.result.filename&&f.result.mimeType&&f.bytes.length?(0,G.jsxs)(W,{size:`sm`,variant:`outline`,onClick:()=>dd(f.bytes,f.result.filename,f.result.mimeType),children:[`Download `,f.result.filename]}):null]}):null]}),(0,G.jsxs)(Yu,{children:[(0,G.jsx)(W,{variant:`outline`,disabled:ee,onClick:()=>re(!1),children:ee?`Finishing save`:f.busy||F?`Cancel`:`Close`}),(0,G.jsx)(W,{disabled:!i||f.busy||F||t===`export`&&(!s||!o||!c.length&&!te.length),onClick:()=>void z(),children:f.error||N?`Retry`:t===`import`?`Import`:`Export`})]})]})})}function pd(e){let t=(0,H.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,G.jsx)(mn,{"data-slot":`collapsible`,...n}),t[2]=n,t[3]=r),r}function md(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`cursor-pointer`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(pn,{className:i,"data-slot":`collapsible-trigger`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hd(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=U(`panel-motion h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-(--panel-duration) data-ending-style:h-0 data-starting-style:h-0 data-open:data-ending-style:[height:var(--collapsible-panel-height)]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,G.jsx)(hn,{className:i,"data-slot":`collapsible-panel`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gd(e){let t=(0,H.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,size:i,unstyled:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a,c;t[5]!==n||t[6]!==s?(c=U(!s&&`relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]`,n)||void 0,t[5]=n,t[6]=s,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==o?(l=(0,G.jsx)(Yt,{render:e=>(0,G.jsx)(`textarea`,{className:U(`field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5`,o===`sm`&&`min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5`,o===`lg`&&`min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5`),"data-slot":`textarea`,...xe(e,r)})}),t[8]=r,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,G.jsx)(`span`,{className:c,"data-size":o,"data-slot":`textarea-control`,children:l}),t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}var _d=e=>`${e}T00:00:00.000Z`;function vd(e,t,n){let r=e.slice(0,10);return`${t===`open`&&r<n?`Overdue`:`Due`} ${r}`}var yd=e=>{Promise.resolve().then(e).catch(()=>{})};function bd(e){let t=(0,H.c)(49),{anchor:n,onSubmit:r,onCancel:i,busy:a}=e,o=a!==void 0&&a,[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(!1),_=n.kind===`nodes`?`${n.nodeIds.length} selected ${n.nodeIds.length===1?`node`:`nodes`}`:n.kind===`region`?`Canvas region`:`Canvas pin`,v;t[0]!==n||t[1]!==l||t[2]!==h||t[3]!==s||t[4]!==o||t[5]!==p||t[6]!==d||t[7]!==r?(v=e=>{e.preventDefault(),s.trim()&&!o&&yd(()=>r({anchor:n,body:s.trim(),blocking:h,labels:d.split(`,`).map(xd).filter(Boolean),...l.trim()?{assignee:l.trim()}:{},...p?{dueAt:_d(p)}:{}}))},t[0]=n,t[1]=l,t[2]=h,t[3]=s,t[4]=o,t[5]=p,t[6]=d,t[7]=r,t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(`strong`,{children:`New comment`}),t[9]=y):y=t[9];let b;t[10]===_?b=t[11]:(b=(0,G.jsxs)(`div`,{className:`design-editor-heading`,children:[y,(0,G.jsxs)(`span`,{className:`design-small-muted`,children:[`Anchored to `,_,` in this revision`]})]}),t[10]=_,t[11]=b);let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>c(e.target.value),t[12]=x):x=t[12];let S;t[13]===s?S=t[14]:(S=(0,G.jsxs)(`label`,{children:[`Comment`,(0,G.jsx)(`textarea`,{value:s,onChange:x,rows:3,required:!0,placeholder:`What should be reviewed?`})]}),t[13]=s,t[14]=S);let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>u(e.target.value),t[15]=C):C=t[15];let w;t[16]===l?w=t[17]:(w=(0,G.jsxs)(`label`,{children:[`Assignee`,(0,G.jsx)(`input`,{value:l,onChange:C})]}),t[16]=l,t[17]=w);let T;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>m(e.target.value),t[18]=T):T=t[18];let E;t[19]===p?E=t[20]:(E=(0,G.jsxs)(`label`,{children:[`Due`,(0,G.jsx)(`input`,{type:`date`,value:p,onChange:T})]}),t[19]=p,t[20]=E);let D;t[21]!==E||t[22]!==w?(D=(0,G.jsxs)(`div`,{className:`design-editor-fields`,children:[w,E]}),t[21]=E,t[22]=w,t[23]=D):D=t[23];let O;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,G.jsx)(`span`,{className:`design-small-muted`,children:`(comma separated)`}),t[24]=O):O=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>f(e.target.value),t[25]=k):k=t[25];let A;t[26]===d?A=t[27]:(A=(0,G.jsxs)(`label`,{children:[`Labels `,O,(0,G.jsx)(`input`,{value:d,onChange:k})]}),t[26]=d,t[27]=A);let j;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>g(e.target.checked),t[28]=j):j=t[28];let M;t[29]===h?M=t[30]:(M=(0,G.jsxs)(`label`,{className:`design-editor-checkbox`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:h,onChange:j}),`Block acceptance until resolved`]}),t[29]=h,t[30]=M);let N;t[31]===i?N=t[32]:(N=(0,G.jsx)(W,{type:`button`,size:`sm`,variant:`ghost`,onClick:i,children:`Cancel`}),t[31]=i,t[32]=N);let P;t[33]!==s||t[34]!==o?(P=o||!s.trim(),t[33]=s,t[34]=o,t[35]=P):P=t[35];let F;t[36]===P?F=t[37]:(F=(0,G.jsx)(W,{type:`submit`,size:`sm`,disabled:P,children:`Post comment`}),t[36]=P,t[37]=F);let I;t[38]!==N||t[39]!==F?(I=(0,G.jsxs)(`div`,{className:`design-editor-actions`,children:[N,F]}),t[38]=N,t[39]=F,t[40]=I):I=t[40];let L;return t[41]!==D||t[42]!==A||t[43]!==M||t[44]!==v||t[45]!==I||t[46]!==b||t[47]!==S?(L=(0,G.jsxs)(`form`,{className:`design-annotation-editor`,onSubmit:v,children:[b,S,D,A,M,I]}),t[41]=D,t[42]=A,t[43]=M,t[44]=v,t[45]=I,t[46]=b,t[47]=S,t[48]=L):L=t[48],L}function xd(e){return e.trim()}function Sd(e){let t=(0,H.c)(17),{document:n,currentRevision:r,actions:i,busy:a,focusedId:o}=e,s=a!==void 0&&a,[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(``),f=Object.entries(n.annotations).sort(Td),p;t[0]===n.annotations?p=t[1]:(p=Su(n.annotations),t[0]=n.annotations,t[1]=p);let m=p,h;t[2]===o?h=t[3]:(h=()=>{o&&globalThis.document.getElementById(`design-comment-${o}`)?.scrollIntoView({block:`nearest`})},t[2]=o,t[3]=h);let g;if(t[4]!==n||t[5]!==o?(g=[o,n],t[4]=n,t[5]=o,t[6]=g):g=t[6],(0,V.useEffect)(h,g),!f.length){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`div`,{className:`design-notice`,children:(0,G.jsx)(`strong`,{children:`No comments`})}),t[7]=e):e=t[7],e}let _;t[8]!==i||t[9]!==s||t[10]!==r||t[11]!==m||t[12]!==u||t[13]!==c?(_=e=>{let[t,n]=e;return(0,G.jsxs)(`article`,{id:`design-comment-${t}`,className:`design-comment`,children:[(0,G.jsxs)(`div`,{className:`design-comment-heading`,children:[(0,G.jsx)(`span`,{className:`design-comment-number${n.blocking&&n.status===`open`?` design-comment-number-blocking`:``}`,"aria-label":`Comment ${m.get(t)??``}`,children:m.get(t)}),(0,G.jsx)(`strong`,{children:n.author}),(0,G.jsx)(`span`,{className:`design-small-muted`,children:n.status===`open`?`Open`:`Resolved`})]}),(0,G.jsx)(`p`,{children:n.body}),(0,G.jsxs)(`div`,{className:`design-comment-meta`,children:[n.blocking&&n.status===`open`?(0,G.jsx)(yr,{variant:`warning`,children:`Blocking`}):null,(0,G.jsx)(`span`,{children:n.anchor.kind===`nodes`?`${n.anchor.nodeIds.length} ${n.anchor.nodeIds.length===1?`layer`:`layers`}`:n.anchor.kind===`region`?`Region`:`Pin`}),n.revision===r?null:(0,G.jsxs)(`span`,{children:[`Revision `,n.revision.slice(0,8)]}),n.assignee?(0,G.jsxs)(`span`,{children:[`Assigned to `,n.assignee]}):null,n.dueAt?(0,G.jsx)(`span`,{children:vd(n.dueAt,n.status,new Date().toISOString().slice(0,10))}):null,n.labels.map(wd)]}),n.replies.map(Cd),i?(0,G.jsxs)(`div`,{className:`design-comment-actions`,children:[(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:s,onClick:()=>{l(t),d(``)},children:`Reply`}),(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:s,onClick:()=>yd(()=>i.setResolved(t,n.status===`open`)),children:n.status===`open`?`Resolve`:`Reopen`})]}):null,c===t&&i?(0,G.jsxs)(`form`,{className:`design-reply-form`,onSubmit:e=>{e.preventDefault(),u.trim()&&!s&&yd(async()=>{await i.reply(t,u.trim()),l(null),d(``)})},children:[(0,G.jsxs)(`label`,{children:[`Reply`,(0,G.jsx)(`textarea`,{rows:2,value:u,onChange:e=>d(e.target.value),required:!0})]}),(0,G.jsxs)(`div`,{className:`design-editor-actions`,children:[(0,G.jsx)(W,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>l(null),children:`Cancel`}),(0,G.jsx)(W,{type:`submit`,size:`sm`,disabled:s||!u.trim(),children:`Send reply`})]})]}):null]},t)},t[8]=i,t[9]=s,t[10]=r,t[11]=m,t[12]=u,t[13]=c,t[14]=_):_=t[14];let v=f.map(_),y;return t[15]===v?y=t[16]:(y=(0,G.jsx)(`div`,{className:`design-comments`,"aria-label":`Design comments`,children:v}),t[15]=v,t[16]=y),y}function Cd(e){return(0,G.jsxs)(`div`,{className:`design-reply`,children:[(0,G.jsx)(`strong`,{children:e.author}),(0,G.jsx)(`p`,{children:e.body})]},e.id)}function wd(e){return(0,G.jsx)(`span`,{className:`design-comment-label`,children:e},e)}function Td(e,t){let[,n]=e,[,r]=t;return r.createdAt.localeCompare(n.createdAt)}function Ed(e){let t=(0,H.c)(21),n,r,i,a,o;if(t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({reason:o,disabled:r,onClick:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o),!r||!o){let e;return t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==a?(e=(0,G.jsx)(W,{...a,disabled:r,onClick:i,children:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=a,t[10]=e):e=t[10],e}let s;t[11]===a?s=t[12]:(s=(0,G.jsx)(W,{...a,"aria-disabled":`true`,className:`cursor-not-allowed opacity-64`,onClick:Dd}),t[11]=a,t[12]=s);let c;t[13]!==n||t[14]!==s?(c=(0,G.jsx)(Ar,{render:s,children:n}),t[13]=n,t[14]=s,t[15]=c):c=t[15];let l;t[16]===o?l=t[17]:(l=(0,G.jsx)(jr,{children:o}),t[16]=o,t[17]=l);let u;return t[18]!==c||t[19]!==l?(u=(0,G.jsxs)(kr,{children:[c,l]}),t[18]=c,t[19]=l,t[20]=u):u=t[20],u}function Dd(e){return e.preventDefault()}function Od(e){let t=(0,H.c)(13),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(In,{children:[(0,G.jsx)(Rn,{children:`Reject this turn?`}),(0,G.jsx)(zn,{children:`Design, code, assets, comments, and acceptances return to the turn baseline. Newer messages and turn diffs are discarded. This cannot be undone.`})]}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),t[1]=r,t[2]=o);let s;t[3]!==i||t[4]!==r?(s=(0,G.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>{r(!1),yd(i)},children:`Reject turn`}),t[3]=i,t[4]=r,t[5]=s):s=t[5];let c;t[6]!==o||t[7]!==s?(c=(0,G.jsxs)(Fn,{className:`max-w-sm`,children:[a,(0,G.jsxs)(Ln,{children:[o,s]})]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==n||t[11]!==c?(l=(0,G.jsx)(jn,{open:n,onOpenChange:r,children:c}),t[9]=r,t[10]=n,t[11]=c,t[12]=l):l=t[12],l}var kd=e=>`${e} ${e===1?`change`:`changes`}`;function Ad(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`}),i=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),a=Math.round((i(t).getTime()-i(n).getTime())/864e5);return a===0?`today at ${r}`:a===1?`yesterday at ${r}`:`${n.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} at ${r}`}function jd(e){let t=(0,H.c)(43),{open:n,onOpenChange:r,restore:i}=e,[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),l;t[0]!==i.acceptedAt||t[1]!==i.acceptedBy?(l=i.acceptedBy?`the version ${i.acceptedBy} accepted${i.acceptedAt?` ${Ad(i.acceptedAt)}`:``}`:`the accepted version`,t[0]=i.acceptedAt,t[1]=i.acceptedBy,t[2]=l):l=t[2];let u=l,d;t[3]!==s||t[4]!==r?(d=e=>{s||(o(null),r(e))},t[3]=s,t[4]=r,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsx)(Rn,{children:`Restore the accepted version?`}),t[6]=f):f=t[6];let p;t[7]===i.changedCount?p=t[8]:(p=kd(i.changedCount).replace(`change`,`unaccepted change`),t[7]=i.changedCount,t[8]=p);let m;t[9]!==i.documentName||t[10]!==p||t[11]!==u?(m=(0,G.jsxs)(zn,{children:[`This discards`,` `,p,` to`,` `,i.documentName,` and restores `,u,`.`]}),t[9]=i.documentName,t[10]=p,t[11]=u,t[12]=m):m=t[12];let h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(`p`,{className:`design-restore-help`,children:`Discarded changes cannot be recovered here. Commit first if you want to keep them in git.`}),t[13]=h):h=t[13];let g;t[14]===a?g=t[15]:(g=a?(0,G.jsx)(`p`,{className:`design-revision-error`,role:`alert`,children:a}):null,t[14]=a,t[15]=g);let _;t[16]!==m||t[17]!==g?(_=(0,G.jsxs)(In,{children:[f,m,h,g]}),t[16]=m,t[17]=g,t[18]=_):_=t[18];let v;t[19]===r?v=t[20]:(v=()=>r(!1),t[19]=r,t[20]=v);let y;t[21]!==s||t[22]!==v?(y=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,disabled:s,onClick:v,children:`Cancel`}),t[21]=s,t[22]=v,t[23]=y):y=t[23];let b;t[24]!==r||t[25]!==i?(b=()=>{c(!0),o(null),i.run().then(()=>r(!1)).catch(e=>o(e instanceof Error?e.message:String(e))).finally(()=>c(!1))},t[24]=r,t[25]=i,t[26]=b):b=t[26];let x;t[27]===i.changedCount?x=t[28]:(x=kd(i.changedCount),t[27]=i.changedCount,t[28]=x);let S;t[29]!==s||t[30]!==b||t[31]!==x?(S=(0,G.jsxs)(W,{size:`sm`,variant:`destructive`,disabled:s,onClick:b,children:[`Discard `,x]}),t[29]=s,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]!==y||t[34]!==S?(C=(0,G.jsxs)(Ln,{children:[y,S]}),t[33]=y,t[34]=S,t[35]=C):C=t[35];let w;t[36]!==C||t[37]!==_?(w=(0,G.jsxs)(Fn,{className:`max-w-md`,children:[_,C]}),t[36]=C,t[37]=_,t[38]=w):w=t[38];let T;return t[39]!==n||t[40]!==w||t[41]!==d?(T=(0,G.jsx)(jn,{open:n,onOpenChange:d,children:w}),t[39]=n,t[40]=w,t[41]=d,t[42]=T):T=t[42],T}function Md(e){let t=(0,H.c)(26),{followUp:n,onPrepared:r,onCancel:i}=e,[a,o]=(0,V.useState)(n.prompt),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(`h3`,{children:`Request changes`}),t[0]=s):s=t[0];let c=n.openComments===1?`comment`:`comments`,l;t[1]!==n.openComments||t[2]!==c?(l=(0,G.jsxs)(`header`,{className:`design-follow-up-heading`,children:[s,(0,G.jsxs)(yr,{variant:`outline`,children:[n.openComments,` open `,c]})]}),t[1]=n.openComments,t[2]=c,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>o(e.target.value),t[4]=u):u=t[4];let d;t[5]===a?d=t[6]:(d=(0,G.jsx)(gd,{"aria-label":`Requested changes`,value:a,onChange:u,rows:5}),t[5]=a,t[6]=d);let f;t[7]===i?f=t[8]:(f=(0,G.jsx)(W,{size:`sm`,variant:`ghost`,onClick:i,children:`Cancel`}),t[7]=i,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,G.jsx)(`span`,{className:`design-revision-spacer`}),t[9]=p):p=t[9];let m;t[10]===a?m=t[11]:(m=a.trim(),t[10]=a,t[11]=m);let h=!m,g;t[12]!==n||t[13]!==r||t[14]!==a?(g=()=>{n.prepare(a),r()},t[12]=n,t[13]=r,t[14]=a,t[15]=g):g=t[15];let _;t[16]!==g||t[17]!==h?(_=(0,G.jsx)(W,{size:`sm`,disabled:h,onClick:g,children:`Add to message`}),t[16]=g,t[17]=h,t[18]=_):_=t[18];let v;t[19]!==_||t[20]!==f?(v=(0,G.jsxs)(`div`,{className:`design-revision-actions`,children:[f,p,_]}),t[19]=_,t[20]=f,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==l||t[24]!==d?(y=(0,G.jsxs)(`section`,{className:`design-follow-up`,"aria-label":`Request changes`,children:[l,d,v]}),t[22]=v,t[23]=l,t[24]=d,t[25]=y):y=t[25],y}function Nd(e){let t=(0,H.c)(105),{review:n,changes:r,changesNotice:i,notice:a,error:o}=e,[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(!1),_;t[0]!==r||t[1]!==l?(_=r&&!l?r.slice(0,4):r,t[0]=r,t[1]=l,t[2]=_):_=t[2];let v=_,y=n.rejectSupported??!0;if(!r?.length&&!n.accepted&&!n.blockers&&!o&&!n.restore&&!n.statusLabel)return null;let b=n.accepted?`Accepted`:n.blockers?`${n.blockers} blocking ${n.blockers===1?`comment`:`comments`}`:n.statusLabel&&n.statusLabel!==`Awaiting review`?n.statusLabel:r?.length?`${n.changedCount} ${n.changedCount===1?`change`:`changes`}`:n.statusLabel??`Review`,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(`section`,{}),t[3]=x):x=t[3];let S;t[4]===b?S=t[5]:(S=(0,G.jsx)(`span`,{children:b}),t[4]=b,t[5]=S);let C;t[6]!==n.accepted||t[7]!==n.blockers||t[8]!==n.statusLabel?(C=n.accepted||n.statusLabel===`Approved`?(0,G.jsx)(Ie,{className:`design-revision-success`,"aria-hidden":`true`}):n.blockers?(0,G.jsx)(Fe,{className:`design-revision-warning`,"aria-hidden":`true`}):null,t[6]=n.accepted,t[7]=n.blockers,t[8]=n.statusLabel,t[9]=C):C=t[9];let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,G.jsx)(je,{className:`design-revision-chevron`,"aria-hidden":`true`}),t[10]=w):w=t[10];let T;t[11]!==S||t[12]!==C?(T=(0,G.jsxs)(md,{className:`design-revision-heading`,children:[S,C,w]}),t[11]=S,t[12]=C,t[13]=T):T=t[13];let E;t[14]!==r||t[15]!==i||t[16]!==l||t[17]!==v?(E=r?r.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ul`,{className:`design-revision-changes`,children:v?.map(Fd)}),r.length>4?(0,G.jsx)(W,{size:`xs`,variant:`ghost`,className:`design-revision-more`,"aria-expanded":l,onClick:()=>u(Pd),children:l?`Show fewer`:`Show all ${r.length} changes`}):null]}):(0,G.jsx)(`p`,{className:`design-revision-note`,children:`No content changes in this turn.`}):(0,G.jsx)(`p`,{className:`design-revision-note`,children:i??`Changes unavailable.`}),t[14]=r,t[15]=i,t[16]=l,t[17]=v,t[18]=E):E=t[18];let D;t[19]===a?D=t[20]:(D=a?(0,G.jsx)(`p`,{className:`design-revision-note`,children:a}):null,t[19]=a,t[20]=D);let O;t[21]!==n.blockers||t[22]!==n.onComments?(O=n.blockers?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:n.onComments,children:`Resolve comments`}):null,t[21]=n.blockers,t[22]=n.onComments,t[23]=O):O=t[23];let k;t[24]===n.onCompare?k=t[25]:(k=n.onCompare?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:n.onCompare,children:`Compare`}):null,t[24]=n.onCompare,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,G.jsx)(`span`,{className:`design-revision-spacer`}),t[26]=A):A=t[26];let j=n.busy||n.accepted||!n.canAccept,M;t[27]===n.actions.accept?M=t[28]:(M=()=>yd(n.actions.accept),t[27]=n.actions.accept,t[28]=M);let N;t[29]===n.accepted?N=t[30]:(N=n.accepted?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ae,{"aria-hidden":`true`}),`Accepted`]}):`Accept`,t[29]=n.accepted,t[30]=N);let P;t[31]!==j||t[32]!==M||t[33]!==N?(P=(0,G.jsx)(W,{size:`sm`,disabled:j,onClick:M,children:N}),t[31]=j,t[32]=M,t[33]=N,t[34]=P):P=t[34];let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(Tn,{render:(0,G.jsx)(W,{size:`icon-sm`,variant:`ghost`,"aria-label":`More review actions`})}),children:(0,G.jsx)(Be,{"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:`More review actions`})]}),t[35]=F):F=t[35];let I=n.busy||!n.canReview||n.blockers>0,L;t[36]===n.actions.approve?L=t[37]:(L=()=>yd(n.actions.approve),t[36]=n.actions.approve,t[37]=L);let R;t[38]!==I||t[39]!==L?(R=(0,G.jsx)(Dn,{disabled:I,onClick:L,children:`Approve`}),t[38]=I,t[39]=L,t[40]=R):R=t[40];let ee;t[41]!==n.accepted||t[42]!==n.actions.requestChanges||t[43]!==n.busy||t[44]!==n.canReview||t[45]!==n.followUp?(ee=n.followUp?(0,G.jsx)(Dn,{disabled:n.busy||n.accepted,onClick:()=>g(!0),children:`Request changes`}):(0,G.jsx)(Dn,{disabled:n.busy||!n.canReview,onClick:()=>yd(n.actions.requestChanges),children:`Request changes`}),t[41]=n.accepted,t[42]=n.actions.requestChanges,t[43]=n.busy,t[44]=n.canReview,t[45]=n.followUp,t[46]=ee):ee=t[46];let te;t[47]!==y||t[48]!==n.busy||t[49]!==n.canReject?(te=y?(0,G.jsx)(Dn,{disabled:n.busy||!n.canReject,onClick:()=>f(!0),children:`Reject turn...`}):null,t[47]=y,t[48]=n.busy,t[49]=n.canReject,t[50]=te):te=t[50];let ne;t[51]!==n.busy||t[52]!==n.restore?(ne=n.restore?(0,G.jsx)(Dn,{disabled:n.busy,onClick:()=>m(!0),children:`Restore accepted version...`}):null,t[51]=n.busy,t[52]=n.restore,t[53]=ne):ne=t[53];let re;t[54]!==R||t[55]!==ee||t[56]!==te||t[57]!==ne?(re=(0,G.jsxs)(wn,{children:[F,(0,G.jsxs)(En,{align:`end`,children:[R,ee,te,ne]})]}),t[54]=R,t[55]=ee,t[56]=te,t[57]=ne,t[58]=re):re=t[58];let z;t[59]!==k||t[60]!==P||t[61]!==re?(z=(0,G.jsxs)(`div`,{className:`design-revision-actions`,children:[k,A,P,re]}),t[59]=k,t[60]=P,t[61]=re,t[62]=z):z=t[62];let ie;t[63]!==h||t[64]!==n.actions.requestChanges||t[65]!==n.canReview||t[66]!==n.followUp||t[67]!==n.statusLabel?(ie=h&&n.followUp?(0,G.jsx)(Md,{followUp:n.followUp,onCancel:()=>g(!1),onPrepared:()=>{g(!1),n.canReview&&n.statusLabel!==`Changes requested`&&yd(n.actions.requestChanges)}}):null,t[63]=h,t[64]=n.actions.requestChanges,t[65]=n.canReview,t[66]=n.followUp,t[67]=n.statusLabel,t[68]=ie):ie=t[68];let ae;t[69]!==i||t[70]!==o||t[71]!==n.acceptReason||t[72]!==n.blockers?(ae=n.acceptReason&&n.acceptReason!==i&&!n.blockers&&!o?(0,G.jsxs)(`p`,{className:`design-revision-reason`,role:`status`,children:[(0,G.jsx)(Fe,{"aria-hidden":`true`}),n.acceptReason]}):null,t[69]=i,t[70]=o,t[71]=n.acceptReason,t[72]=n.blockers,t[73]=ae):ae=t[73];let oe;t[74]!==n.accepted||t[75]!==n.acceptedBy||t[76]!==n.author||t[77]!==n.authorFromHost?(oe=n.accepted&&n.acceptedBy?(0,G.jsxs)(`p`,{className:`design-revision-signer`,children:[`Accepted by `,n.acceptedBy.author,` `,Ad(n.acceptedBy.at)]}):n.authorFromHost&&n.author.trim()&&!n.accepted?(0,G.jsxs)(`p`,{className:`design-revision-signer`,children:[`Accepting signs as `,n.author.trim()]}):null,t[74]=n.accepted,t[75]=n.acceptedBy,t[76]=n.author,t[77]=n.authorFromHost,t[78]=oe):oe=t[78];let se;t[79]!==z||t[80]!==ie||t[81]!==ae||t[82]!==oe||t[83]!==E||t[84]!==D||t[85]!==O?(se=(0,G.jsx)(hd,{children:(0,G.jsxs)(`div`,{className:`design-revision-details`,children:[E,D,O,z,ie,ae,oe]})}),t[79]=z,t[80]=ie,t[81]=ae,t[82]=oe,t[83]=E,t[84]=D,t[85]=O,t[86]=se):se=t[86];let ce;t[87]!==o||t[88]!==n.conflict||t[89]!==n.onReload?(ce=o?(0,G.jsxs)(`div`,{className:`design-revision-error-row`,children:[(0,G.jsx)(`p`,{className:`design-revision-error`,role:`alert`,children:o}),n.conflict&&n.onReload?(0,G.jsxs)(W,{size:`sm`,onClick:n.onReload,children:[(0,G.jsx)(at,{"aria-hidden":`true`}),`Reload`]}):null]}):null,t[87]=o,t[88]=n.conflict,t[89]=n.onReload,t[90]=ce):ce=t[90];let le;t[91]!==y||t[92]!==d||t[93]!==n.actions.rejectTurn?(le=y?(0,G.jsx)(Od,{open:d,onOpenChange:f,onConfirm:n.actions.rejectTurn}):null,t[91]=y,t[92]=d,t[93]=n.actions.rejectTurn,t[94]=le):le=t[94];let ue;t[95]!==p||t[96]!==n.restore?(ue=n.restore?(0,G.jsx)(jd,{open:p,onOpenChange:m,restore:n.restore}):null,t[95]=p,t[96]=n.restore,t[97]=ue):ue=t[97];let de;return t[98]!==s||t[99]!==se||t[100]!==ce||t[101]!==le||t[102]!==ue||t[103]!==T?(de=(0,G.jsxs)(pd,{render:x,className:`design-revision-card`,"aria-label":`Revision review`,open:s,onOpenChange:c,children:[T,se,ce,le,ue]}),t[98]=s,t[99]=se,t[100]=ce,t[101]=le,t[102]=ue,t[103]=T,t[104]=de):de=t[104],de}function Pd(e){return!e}function Fd(e){return(0,G.jsx)(`li`,{children:e.text},e.key)}function Id(e){let t=(0,H.c)(39),{review:n,cached:r,baselineNotice:i,reviewLocked:a}=e,[o,s]=(0,V.useState)(!1),c=n.blockers?`${n.blockers} blocking ${n.blockers===1?`comment`:`comments`}`:n.statusLabel??(n.changedCount?`${n.changedCount} ${n.changedCount===1?`change`:`changes`}`:`Design revision`),l;t[0]===c?l=t[1]:(l=(0,G.jsx)(`strong`,{children:c}),t[0]=c,t[1]=l);let u;t[2]===n.revision?u=t[3]:(u=n.revision?`Revision ${n.revision.slice(0,8)}`:`Revision unavailable`,t[2]=n.revision,t[3]=u);let d=r?` - cached`:``,f;t[4]!==u||t[5]!==d?(f=(0,G.jsxs)(`span`,{className:`design-small-muted`,children:[u,d]}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===i?p=t[8]:(p=i?(0,G.jsx)(`small`,{children:i}):null,t[7]=i,t[8]=p);let m;t[9]===a?m=t[10]:(m=a?(0,G.jsx)(`small`,{children:`Design changed during compare. Exit compare to review the current revision.`}):null,t[9]=a,t[10]=m);let h;t[11]!==l||t[12]!==f||t[13]!==p||t[14]!==m?(h=(0,G.jsxs)(`div`,{className:`design-review-summary`,role:`status`,children:[l,f,p,m]}),t[11]=l,t[12]=f,t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;t[16]!==n.acceptReason||t[17]!==n.accepted||t[18]!==n.actions.accept||t[19]!==n.actions.approve||t[20]!==n.actions.requestChanges||t[21]!==n.blockers||t[22]!==n.busy||t[23]!==n.canAccept||t[24]!==n.canReject||t[25]!==n.canReview||t[26]!==n.onComments||t[27]!==n.onCompare||t[28]!==n.rejectReason||t[29]!==n.reviewReason||t[30]!==n.revision?(g=n.revision||n.canReject?(0,G.jsxs)(br,{children:[(0,G.jsx)(xr,{render:(0,G.jsx)(W,{size:`sm`,variant:`outline`}),children:`Review`}),(0,G.jsx)(Sr,{side:`top`,align:`end`,className:`w-80`,children:(0,G.jsx)(`div`,{className:`design-review-popover`,children:(0,G.jsxs)(`div`,{className:`design-review-actions`,children:[n.revision&&n.onCompare?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:n.onCompare,children:`Compare`}):null,n.blockers?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:n.onComments,children:`Comments`}):null,(0,G.jsx)(Ed,{size:`sm`,variant:`outline`,disabled:n.busy||!n.canReview,reason:n.reviewReason,onClick:()=>yd(n.actions.requestChanges),children:`Request changes`}),(0,G.jsx)(Ed,{size:`sm`,variant:`outline`,disabled:n.busy||!n.canReview||n.blockers>0,reason:n.reviewReason??(n.blockers?`Resolve blocking comments to approve`:null),onClick:()=>yd(n.actions.approve),children:`Approve`}),(0,G.jsx)(Ed,{size:`sm`,variant:`outline`,disabled:n.busy||!n.canReject,reason:n.rejectReason,onClick:()=>s(!0),children:`Reject turn`}),(0,G.jsx)(Ed,{size:`sm`,disabled:n.busy||n.accepted||!n.canAccept,reason:n.acceptReason,onClick:()=>yd(n.actions.accept),children:n.accepted?`Accepted`:`Accept`})]})})})]}):null,t[16]=n.acceptReason,t[17]=n.accepted,t[18]=n.actions.accept,t[19]=n.actions.approve,t[20]=n.actions.requestChanges,t[21]=n.blockers,t[22]=n.busy,t[23]=n.canAccept,t[24]=n.canReject,t[25]=n.canReview,t[26]=n.onComments,t[27]=n.onCompare,t[28]=n.rejectReason,t[29]=n.reviewReason,t[30]=n.revision,t[31]=g):g=t[31];let _;t[32]!==o||t[33]!==n.actions.rejectTurn?(_=(0,G.jsx)(Od,{open:o,onOpenChange:s,onConfirm:n.actions.rejectTurn}),t[32]=o,t[33]=n.actions.rejectTurn,t[34]=_):_=t[34];let v;return t[35]!==h||t[36]!==g||t[37]!==_?(v=(0,G.jsxs)(`footer`,{className:`design-review-strip`,"aria-label":`Revision status`,children:[h,g,_]}),t[35]=h,t[36]=g,t[37]=_,t[38]=v):v=t[38],v}function Ld(e,t){let n=structuredClone(e),r=or(n),i=n,a=i.nodes,o=e=>{if(e===null)return i.roots;let t=a[e];if(!t||!(`children`in t))throw Error(`Parent must be a frame or group`);return t.children},s=e=>{if(!a[e])throw Error(`Node is missing`);let t=r.parents.get(e)??null,i=t&&a[t]?.type===`ref`?Object.values(n.instances[t]?.slots??{}).find(t=>t.includes(e)):o(t);if(!i)throw Error(`Node has no tree position`);let s=i.indexOf(e);if(s<0)throw Error(`Node has no tree position`);i.splice(s,1)},c=(e,t,n)=>{let r=o(t);if(n>r.length)throw Error(`Position is outside the ordered child list`);r.splice(n,0,e)},l=(e,t,n)=>{let r=e;n===null?delete r[t]:r[t]=n};switch(t.kind){case`insert`:case`instantiate`:if(a[t.nodeId])throw Error(`Node ID already exists`);a[t.nodeId]=t.node,c(t.nodeId,t.parentId,t.index),t.kind===`instantiate`&&l(n.instances,t.nodeId,t.instance);break;case`patch`:if(!a[t.nodeId])throw Error(`Node is missing`);a[t.nodeId]=ar(a[t.nodeId],t.patch);break;case`move`:s(t.nodeId),c(t.nodeId,t.parentId,t.index);break;case`remove`:{s(t.nodeId);let e=t=>{let r=a[t];r&&`children`in r&&r.children.forEach(e);for(let r of Object.values(n.instances[t]?.slots??{}))r.forEach(e);delete a[t],l(n.instances,t,null)};e(t.nodeId);break}case`override`:{let e=n.instances[t.instanceId];if(!e)throw Error(`Instance is missing`);l(e.overrides,t.sourceNodeId,t.patch);break}case`slots`:{let e=n.instances[t.instanceId];if(!e)throw Error(`Instance is missing`);let r=e.slots[t.slotId]??[];for(let e of t.children)s(e);for(let e of r)t.children.includes(e)||i.roots.push(e);l(e.slots,t.slotId,t.children);break}case`component`:l(n.components,t.componentId,t.value);break;case`library`:l(n.imports,t.importId,t.value);break;case`token`:l(n.tokens,t.tokenId,t.value);break;case`theme`:l(n.themeAxes,t.axis,t.values);break;case`asset`:l(n.assets,t.assetId,t.value);break;case`annotation`:l(n.annotations,t.annotationId,t.value);break;case`review`:l(n.reviews,t.reviewId,t.value);break;case`acceptance`:i.acceptances??={},l(i.acceptances,t.acceptanceId,t.value)}let u=ir(nr(n));if(u.status!==`editable`)throw Error(`Operation violates the document schema`);return u.document}var Rd=()=>({fileHash:null,contentHash:null,diagnostics:[],readOnly:!1,status:`loading`,selection:[],changedNodeIds:[],batch:null,sequence:-1}),zd=new Set([`component`,`library`,`token`,`theme`,`asset`]);function Bd(e){let t=new Set,n=new Set(e.changedNodeIds);for(let r of e.operations){let e=`nodeId`in r?r.nodeId:`instanceId`in r?r.instanceId:null;e&&n.has(e)&&t.add(e)}if(e.operations.some(e=>zd.has(e.kind)))for(let n of e.changedNodeIds)t.add(n);return[...t]}function Vd(e,t,n,r){if(t.kind!==`snapshot`&&t.sequence<e.sequence)return e;if(t.kind===`snapshot`){if(n===void 0)throw Error(`Snapshot payload must be decoded`);let i=ir(n);return{...e,documentPath:t.documentPath,...i.status===`editable`?{document:i.document}:{document:void 0},fileHash:t.fileHash,contentHash:t.contentHash,diagnostics:t.diagnostics,readOnly:t.readOnly,status:`ready`,sequence:t.sequence,changedNodeIds:[],batch:null,...r?{context:r}:{},selection:e.selection.filter(e=>i.status===`editable`&&!!i.document.nodes[e])}}if(t.sequence===e.sequence&&t.fileHash===e.fileHash)return e;if(e.status===`conflict`||!e.document||t.sequence!==e.sequence+1||t.previousFileHash!==e.fileHash)return{...e,status:`conflict`,readOnly:!0};try{let n=e.document;for(let e of t.operations)n=Ld(n,e);if(rr(nr(n))!==t.fileHash)throw Error(`Committed operation hash mismatch`);return{...e,document:n,fileHash:t.fileHash,contentHash:t.contentHash,diagnostics:t.diagnostics,sequence:t.sequence,status:`ready`,readOnly:!1,changedNodeIds:[...t.changedNodeIds],batch:t.changedNodeIds.length?{sequence:t.sequence,nodeIds:Bd(t)}:null,selection:(t.selection&&t.selection.documentPath===e.documentPath&&t.selection.revision===t.contentHash?t.selection.nodeIds:e.selection).filter(e=>!!n.nodes[e]),...r?{context:r}:{}}}catch{return{...e,status:`conflict`,readOnly:!0}}}var Hd=class extends E(`DesignSyncError`){},Ud=(e,t)=>JSON.stringify([e,t]),Wd=Rd(),Gd=O(e=>({records:{},setRecord:(t,n)=>e(e=>({records:{...e.records,[t]:n}}))}));async function Kd(e){let t=Uint8Array.from(atob(e),e=>e.charCodeAt(0)),n=new Blob([t]).stream().pipeThrough(new DecompressionStream(`gzip`));return new Response(n).text()}var qd=ne(fe(l));async function Jd(e,{event:t,fetchAsset:n}){let r=t.kind===`snapshot`?await Kd(t.payload):void 0,i;if(t.dependencies){let e=qd(await Kd(t.dependencies));i={...e.manifest?{manifest:e.manifest}:{},documents:e.documents,documentPath:e.documentPath,availableAssets:new Set(e.availableAssets)}}let a=Vd(Gd.getState().records[e]??Rd(),t,r,i);if(Gd.getState().setRecord(e,a),a.status===`conflict`)throw Error(`Design revision changed; reload the document`);let[o,s]=JSON.parse(e),c=a.context;if(!a.document||!c||!t.dependencies||!n)return;let l=new Map,u=[],d=[a.document,...Object.values(c.documents??{})].flatMap(e=>Object.keys(e.assets).map(t=>({document:e,assetId:t})));await Promise.all(Array.from({length:Math.min(4,d.length)},async()=>{for(;d.length;){let{document:e,assetId:t}=d.pop();try{let r=await n({projectId:o.projectId,...o.threadId?{threadId:o.threadId}:{},documentPath:s,assetId:t,sourceDocumentId:e.documentId,...a.contentHash?{expectedContentHash:a.contentHash}:{}});r?l.set(`${e.documentId}:${t}`,r):u.push(t)}catch{u.push(t)}}}));let f=Gd.getState().records[e];f&&f.sequence===a.sequence&&Gd.getState().setRecord(e,{...f,assets:l,diagnostics:[...f.diagnostics,...u.map(e=>({code:`asset-unavailable`,severity:`warning`,message:`Image ${e.slice(0,8)} could not load. Reload to retry.`}))]})}var Yd=e=>N(t=>{let[n,r]=JSON.parse(t);return e.runtime.atom(e.transport.subscribe(n,r).pipe(B(le(`DesignCache.accept`)(function*(e){return yield*j({try:()=>Jd(t,e),catch:e=>new Hd({message:e instanceof Error?e.message:String(e)})})}))))}),Xd=new WeakMap;function Zd(e){let t=Xd.get(e.transport);return t||(t=Yd(e),Xd.set(e.transport,t)),t}var Qd=n(ve());function $d(e,t){let n=Hn(),r=e&&t?Ud(e,t):null,i=r?Zd(n)(r):Qd,a=M(i),o=f(i),s=Gd(e=>r?e.records[r]??Wd:Wd),c=n.useConnected(e?.environmentId??null),l=!!(r&&!c&&s.document),u=(0,V.useMemo)(()=>l?{...s,status:`disconnected`,readOnly:!0}:s,[l,s]);return(0,V.useEffect)(()=>{if(r&&a._tag===`Failure`){let e=Gd.getState().records[r]??Rd();Gd.getState().setRecord(r,{...e,status:e.document?`conflict`:`error`,readOnly:!0})}},[r,a]),{record:u,select:(0,V.useCallback)(e=>{if(r){let t=Gd.getState().records[r]??Rd();Gd.getState().setRecord(r,{...t,selection:e})}},[r]),reload:o}}function ef(e){let t=(0,H.c)(10),n=Hn(),r;t[0]!==n||t[1]!==e?(r=e?n.transport.catalog(e):null,t[0]=n,t[1]=e,t[2]=r):r=t[2];let i=Gn(r),a;t[3]===i.data?.paths?a=t[4]:(a=i.data?.paths??[],t[3]=i.data?.paths,t[4]=a);let o=i.error??void 0,s;return t[5]!==i.isPending||t[6]!==i.refresh||t[7]!==a||t[8]!==o?(s={paths:a,loading:i.isPending,error:o,reload:i.refresh},t[5]=i.isPending,t[6]=i.refresh,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}var tf=16,nf=6,rf=8;function af(){let e=globalThis.crypto.getRandomValues(new Uint8Array(tf));e[nf]=e[nf]&15|64,e[rf]=e[rf]&63|128;let t=m(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var of=ne(fe(x(d,d)));function sf(e,t,n){let r=e.document,i=e.contentHash,a=Object.values(r?.annotations??{}).filter(e=>e.blocking&&e.status===`open`),o=Object.values(r?.reviews??{}).toSorted((e,t)=>(e.sequence??0)-(t.sequence??0)||e.createdAt.localeCompare(t.createdAt)),s=o.findLast(e=>e.revision===i),c=!!(t&&Object.values(r?.acceptances??{}).some(e=>e.revision===i&&e.turnId===t.turnId&&e.threadId===n)),l=!!(i&&t&&i!==t.revision&&!c);return{status:a.length?`blocked`:s?.decision===`request-changes`?`request-changes`:s?.decision===`approve`?`approved`:o.some(e=>e.decision===`approve`)?`stale-approval`:l?`unreviewed`:`reviewed`,unreviewed:l,blocked:a.length>0}}var cf={blockReason:`Reject is not available here.`,reject:async()=>{}},lf=()=>cf;function uf(){let[e]=(0,V.useState)(()=>{try{return localStorage.getItem(`p4-design-review-author`)?.trim()||`You`}catch{return`You`}});return{author:e,hostOwned:!1}}var df=()=>null;function ff(e,t,n){let r=Hn(),i=Kn(),a=r.review.useBaselineKey(e),o=Gn(e&&t&&a?.baselineId?r.transport.baseline(e,t,a.baselineId):null),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(!1),h=uf(),g=(r.review.useReviewer??df)(),_=g===null?h:{author:g.trim()||h.author,hostOwned:!0},{author:v}=_,y=(r.review.useRejectTurn??lf)(e,s);(0,V.useEffect)(()=>{let e=!1;c(null);let t=o.data;if(t?.status===`available`)return(async()=>{let n=t.snapshot?ir(await Kd(t.snapshot.payload)):null,r=t.snapshot?.dependencies?qd(await Kd(t.snapshot.dependencies)):null,i=of(await Kd(t.assets)),a={turnId:t.turnId,turnCount:t.turnCount,revision:t.snapshot?.contentHash??null,...n?.status===`editable`?{document:n.document}:{},...r?{context:{...r.manifest?{manifest:r.manifest}:{},documents:r.documents,documentPath:r.documentPath,availableAssets:new Set(r.availableAssets)}}:{},assets:new Map(Object.entries(i).map(([e,t])=>[e,Uint8Array.from(atob(t),e=>e.charCodeAt(0))]))};e||c(a)})().catch(()=>{e||u(`The baseline snapshot could not be decoded.`)}),()=>{e=!0}},[o.data]);let b=(0,V.useMemo)(()=>sf(n,s,a?.scopeId),[n,s,a?.scopeId]);(0,V.useEffect)(()=>{u(null),m(!1)},[t,a?.scopeId]);let x=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!p){x.current=null;return}x.current===null?x.current=n.fileHash??``:n.fileHash!==x.current&&(m(!1),u(null))},[p,n.fileHash]);let S=!!((r.useCanWrite?.(e)??!0)&&e&&t&&n.document&&n.fileHash&&n.contentHash&&n.status===`ready`&&!n.readOnly),C=async a=>{if(S&&e&&t&&n.fileHash&&!d){f(!0),u(null),m(!1);try{let o=await i(r.transport.review(e,{tool:`design.apply`,documentPath:t,expectedFileHash:n.fileHash,operations:a}));if(o.status===`conflict`&&m(!0),o.status!==`committed`)throw Error(o.status===`conflict`?a.some(e=>e.kind===`acceptance`)?`Not accepted. ${t.split(`/`).at(-1)} changed after you opened this review. Reload to review the latest version.`:`The design changed. Reload before reviewing.`:o.diagnostics.at(-1)?.message??`The review could not be saved.`)}catch(e){throw u(e instanceof Error?e.message:String(e)),e}finally{f(!1)}}},w=async e=>{n.contentHash&&await C([{operationId:k.make(af()),kind:`review`,reviewId:k.make(af()),value:{revision:n.contentHash,decision:e,author:v.trim(),createdAt:new Date().toISOString()}}])},T=d?null:s?n.status===`ready`?y.blockReason:`Reload the design to reject this turn.`:`No turn baseline is available yet.`,E=n.status===`ready`&&!!s&&!y.blockReason&&!d;return{baseline:s,baselineLoading:o.isPending,baselineReason:o.data?.status===`unavailable`?o.data.reason:o.error??(a?.baselineId?null:`No turn baseline is available yet.`),error:l,conflict:p,busy:d,author:v,authorFromHost:_.hostOwned,status:b.status,unreviewed:b.unreviewed,canAccept:S&&!!s&&!b.blocked&&!d,rejectBlockReason:T,canReject:E,annotate:async(e,t)=>C([{operationId:k.make(af()),kind:`annotation`,annotationId:k.make(e),value:t}]),approve:()=>w(`approve`),requestChanges:()=>w(`request-changes`),accept:async()=>{s&&a&&n.contentHash&&!b.blocked&&await C([{operationId:k.make(af()),kind:`acceptance`,acceptanceId:k.make(af()),value:{revision:n.contentHash,threadId:L.make(a.scopeId),turnId:s.turnId,author:v.trim(),createdAt:new Date().toISOString()}}])},reject:async()=>{if(!(!s||d||y.blockReason)){f(!0),u(null);try{await y.reject(),o.refresh()}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}},attach:(t,n)=>{e&&r.attachment&&(r.attachment.set(e,t),n?.stay||r.navigation.returnToThread?.(e))}}}var pf=[[`Layers`,Je],[`Comments`,et],[`Components`,ke],[`Libraries`,Ye],[`Tokens`,ft]];function mf(e){return e.split(`/`).at(-1)??e}function hf(e){return e?e.slice(0,8):`unavailable`}function gf(e){let t=(0,H.c)(12),{title:n,detail:r,action:i,actionLabel:a}=e,o=a===void 0?`Reload`:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,G.jsx)(Ve,{"aria-hidden":`true`,size:24}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,G.jsx)(`strong`,{children:n}),t[1]=n,t[2]=c);let l;t[3]===r?l=t[4]:(l=r?(0,G.jsx)(`p`,{children:r}):null,t[3]=r,t[4]=l);let u;t[5]!==i||t[6]!==o?(u=i?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:i,children:o}):null,t[5]=i,t[6]=o,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==l||t[10]!==u?(d=(0,G.jsxs)(`div`,{className:`design-notice`,role:`status`,children:[s,c,l,u]}),t[8]=c,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function _f(e){let t=(0,H.c)(13),{items:n,diagnostics:r}=e,i;t[0]===r?i=t[1]:(i=r.length?(0,G.jsxs)(br,{children:[(0,G.jsxs)(xr,{render:(0,G.jsx)(W,{size:`xs`,variant:`ghost`}),children:[`Details (`,r.length,`)`]}),(0,G.jsx)(Sr,{className:`w-80`,children:(0,G.jsx)(`ul`,{className:`design-diagnostics-list`,children:r.map(vf)})})]}):null,t[0]=r,t[1]=i);let a=i,o;t[2]!==a||t[3]!==r.length||t[4]!==n?(o=n.length||!a?n:[{key:`diagnostics`,variant:`info`,role:`status`,icon:Fe,message:`${r.length} design ${r.length===1?`diagnostic`:`diagnostics`}`}],t[2]=a,t[3]=r.length,t[4]=n,t[5]=o):o=t[5];let s=o;if(!s.length)return null;let c;if(t[6]!==a||t[7]!==s){let e;t[9]===a?e=t[10]:(e=(e,t)=>(0,G.jsxs)(hr,{variant:e.variant,role:e.role,className:`design-notice-alert`,children:[(0,G.jsx)(e.icon,{"aria-hidden":`true`}),(0,G.jsx)(gr,{children:e.message}),e.action||t===0&&a?(0,G.jsxs)(_r,{children:[e.action?(0,G.jsxs)(W,{size:`xs`,variant:`ghost`,onClick:e.action.run,children:[(0,G.jsx)(at,{"aria-hidden":`true`}),e.action.label]}):null,t===0?a:null]}):null]},e.key),t[9]=a,t[10]=e),c=s.map(e),t[6]=a,t[7]=s,t[8]=c}else c=t[8];let l;return t[11]===c?l=t[12]:(l=(0,G.jsx)(`div`,{className:`design-notices`,children:c}),t[11]=c,t[12]=l),l}function vf(e){return(0,G.jsx)(`li`,{children:e.message},`${e.code}:${e.nodeId??e.path}:${e.message}`)}var yf=`\0start`,bf=`\0project`;function xf(e){let t=(0,H.c)(32),{path:n,paths:r,onOpen:i,statuses:a,onStartDesign:o,open:s,onOpenChange:c}=e,l=(0,V.useRef)(null),u;t[0]===n?u=t[1]:(u=n?mf(n).replace(/\.p4design$/,``):`Choose design`,t[0]=n,t[1]=u);let d=u;if(!r.length&&!o){let e=n||d,r;return t[2]!==e||t[3]!==d?(r=(0,G.jsx)(`h1`,{className:`design-title`,children:(0,G.jsx)(Ur,{full:e,children:d})}),t[2]=e,t[3]=d,t[4]=r):r=t[4],r}let f=n||null,p;t[5]!==i||t[6]!==o?(p=e=>{e===yf?o?.():typeof e==`string`&&e&&i(e)},t[5]=i,t[6]=o,t[7]=p):p=t[7];let m=n||d,h,g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(Tr,{variant:`ghost`,size:`sm`,className:`design-document-switcher`}),g=(0,G.jsx)(`span`,{className:`sr-only`,children:`Design document: `}),t[8]=h,t[9]=g):(h=t[8],g=t[9]);let _;t[10]===d?_=t[11]:(_=(0,G.jsx)(`span`,{ref:l,className:`design-truncate`,children:d}),t[10]=d,t[11]=_);let v;t[12]!==m||t[13]!==_?(v=(0,G.jsxs)(Wr,{full:m,labelRef:l,render:h,children:[g,_]}),t[12]=m,t[13]=_,t[14]=v):v=t[14];let y;if(t[15]!==r||t[16]!==a){let e;t[18]===a?e=t[19]:(e=e=>{let t=a?.get(e);return(0,G.jsx)(Or,{value:e,children:(0,G.jsxs)(`span`,{className:`design-switcher-item`,children:[(0,G.jsx)(Ur,{full:e,children:e.replace(/\.p4design$/,``)}),t?(0,G.jsx)(yr,{variant:t.tone,size:`sm`,children:t.label}):null]})},e)},t[18]=a,t[19]=e),y=r.map(e),t[15]=r,t[16]=a,t[17]=y}else y=t[17];let b;t[20]===o?b=t[21]:(b=o?(0,G.jsx)(Or,{value:yf,children:(0,G.jsxs)(`span`,{className:`design-switcher-item`,children:[(0,G.jsx)(it,{"aria-hidden":`true`,size:14}),`New design`]})}):null,t[20]=o,t[21]=b);let x;t[22]!==b||t[23]!==y?(x=(0,G.jsxs)(Dr,{matchTriggerWidth:!1,alignItemWithTrigger:!1,className:`max-w-md`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==c||t[26]!==s||t[27]!==x||t[28]!==f||t[29]!==p||t[30]!==v?(S=(0,G.jsxs)(Cr,{modal:!1,open:s,onOpenChange:c,value:f,onValueChange:p,children:[v,x]}),t[25]=c,t[26]=s,t[27]=x,t[28]=f,t[29]=p,t[30]=v,t[31]=S):S=t[31],S}function Sf(e){let t=(0,H.c)(16),{icon:n,label:r,kind:i,className:a,onClick:o,trailing:s}=e,c=(0,V.useRef)(null),l;t[0]!==a||t[1]!==o?(l=(0,G.jsx)(`button`,{type:`button`,className:a,onClick:o}),t[0]=a,t[1]=o,t[2]=l):l=t[2];let u;t[3]===n?u=t[4]:(u=(0,G.jsx)(`span`,{className:`design-row-icon`,"aria-hidden":`true`,children:(0,G.jsx)(n,{size:14})}),t[3]=n,t[4]=u);let d;t[5]===r?d=t[6]:(d=(0,G.jsx)(`span`,{ref:c,className:`design-truncate`,children:r}),t[5]=r,t[6]=d);let f;t[7]===i?f=t[8]:(f=i?(0,G.jsxs)(`span`,{className:`sr-only`,children:[`, `,i]}):null,t[7]=i,t[8]=f);let p;return t[9]!==r||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==f||t[14]!==s?(p=(0,G.jsxs)(Wr,{full:r,labelRef:c,render:l,children:[u,d,f,s]}),t[9]=r,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=s,t[15]=p):p=t[15],p}function Cf(e){let t=(0,H.c)(35),{document:n,selection:r,select:i,query:a}=e,o=a===void 0?``:a,s;t[0]===n.roots?s=t[1]:(s=()=>new Set(n.roots),t[0]=n.roots,t[1]=s);let[c,l]=(0,V.useState)(s),[u,d]=(0,V.useState)(0),[f,p]=(0,V.useState)(400),m=(0,V.useRef)(null),h,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=m.current;if(!e)return;let t=new ResizeObserver(()=>p(e.clientHeight));return t.observe(e),()=>t.disconnect()},g=[],t[2]=h,t[3]=g):(h=t[2],g=t[3]),(0,V.useEffect)(h,g);let _;t[4]===n.roots?_=t[5]:(_=()=>l(new Set(n.roots)),t[4]=n.roots,t[5]=_);let v;t[6]===n.documentId?v=t[7]:(v=[n.documentId],t[6]=n.documentId,t[7]=v),(0,V.useEffect)(_,v);let y;if(t[8]!==n.nodes||t[9]!==n.roots||t[10]!==c||t[11]!==o){y=[];let e=new Set,r=(t,i)=>{for(let a of t){let t=n.nodes[a];if(!t||e.has(a))continue;let s=`children`in t?t.children:[];y.push({id:a,node:t,depth:i,children:s.length>0}),(c.has(a)||o.trim())&&s.length&&i<256&&(e.add(a),r(s,i+1),e.delete(a))}};r(n.roots,0),t[8]=n.nodes,t[9]=n.roots,t[10]=c,t[11]=o,t[12]=y}else y=t[12];let b;t[13]!==o||t[14]!==y?(b=o.trim()?y.filter(e=>{let{node:t}=e;return`${t.name} ${t.type}`.toLocaleLowerCase().includes(o.trim().toLocaleLowerCase())}):y,t[13]=o,t[14]=y,t[15]=b):b=t[15];let x=b,S=Math.max(0,Math.floor(u/32)-6),C=Math.min(x.length,Math.ceil((u+f)/32)+6),w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>d(e.currentTarget.scrollTop),t[16]=w):w=t[16];let T;t[17]!==o||t[18]!==x.length?(T=!x.length&&o.trim()?(0,G.jsx)(`p`,{className:`design-small-muted design-search-empty`,children:`No matching layers`}):null,t[17]=o,t[18]=x.length,t[19]=T):T=t[19];let E=x.length*32,D;t[20]===E?D=t[21]:(D={height:E,position:`relative`},t[20]=E,t[21]=D);let O;t[22]!==C||t[23]!==c||t[24]!==x||t[25]!==i||t[26]!==r||t[27]!==S?(O=x.slice(S,C).map((e,t)=>{let{id:n,node:a,depth:o,children:s}=e,u=Bu(a);return(0,G.jsxs)(`div`,{className:`design-layer-row`,role:`treeitem`,"aria-level":o+1,"aria-selected":r.includes(n),"aria-expanded":s?c.has(n):void 0,style:{top:(S+t)*32,paddingInlineStart:Math.min(o,12)*13+4},children:[s?(0,G.jsx)(`button`,{type:`button`,className:`design-layer-disclosure`,"aria-label":`${c.has(n)?`Collapse`:`Expand`} ${a.name}`,onClick:()=>l(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),children:c.has(n)?(0,G.jsx)(je,{size:14}):(0,G.jsx)(Ne,{size:14})}):(0,G.jsx)(`span`,{className:`design-layer-spacer`}),(0,G.jsx)(Sf,{icon:u.icon,label:a.name||u.label,kind:u.label,className:`design-layer-select`,onClick:()=>i([n])})]},n)}),t[22]=C,t[23]=c,t[24]=x,t[25]=i,t[26]=r,t[27]=S,t[28]=O):O=t[28];let k;t[29]!==D||t[30]!==O?(k=(0,G.jsx)(`div`,{style:D,children:O}),t[29]=D,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==k||t[33]!==T?(A=(0,G.jsxs)(`div`,{ref:m,className:`design-layer-viewport`,role:`tree`,"aria-label":`Layers`,onScroll:w,children:[T,k]}),t[32]=k,t[33]=T,t[34]=A):A=t[34],A}function wf(e){let t=(0,H.c)(40),{tab:n,document:r,onOpen:i,selection:a,select:o,context:s,query:c}=e,l;t[0]===c?l=t[1]:(l=e=>e.toLocaleLowerCase().includes(c.trim().toLocaleLowerCase()),t[0]=c,t[1]=l);let u=l;if(n===`Layers`){let e;return t[2]!==r||t[3]!==c||t[4]!==o||t[5]!==a?(e=r?(0,G.jsx)(Cf,{document:r,selection:a,select:o,query:c}):(0,G.jsx)(gf,{title:`No layers yet`,detail:`Open a design document to inspect its layers.`}),t[2]=r,t[3]=c,t[4]=o,t[5]=a,t[6]=e):e=t[6],e}if(n===`Libraries`){let e,n,r;if(t[7]!==s?.manifest?.libraries||t[8]!==u||t[9]!==i){let a=Object.entries(s?.manifest?.libraries??{});e=`design-catalog-list`,n=a.length>0&&!a.some(e=>{let[,t]=e;return u(t.path)})?(0,G.jsx)(`p`,{className:`design-small-muted design-search-empty`,children:`No matching libraries`}):null,r=a.length?a.filter(e=>{let[,t]=e;return u(t.path)}).map(e=>{let[t,n]=e;return(0,G.jsx)(Sf,{icon:Ve,label:n.path,className:`design-catalog-row`,onClick:()=>i(n.path),trailing:(0,G.jsx)(`small`,{children:n.exports.length})},t)}):(0,G.jsx)(gf,{title:`No libraries`,detail:`Libraries declared in p4.design.json appear here.`}),t[7]=s?.manifest?.libraries,t[8]=u,t[9]=i,t[10]=e,t[11]=n,t[12]=r}else e=t[10],n=t[11],r=t[12];let a;return t[13]!==e||t[14]!==n||t[15]!==r?(a=(0,G.jsxs)(`div`,{className:e,children:[n,r]}),t[13]=e,t[14]=n,t[15]=r,t[16]=a):a=t[16],a}if(!r){let e;t[17]===n?e=t[18]:(e=n.toLowerCase(),t[17]=n,t[18]=e);let r=`No ${e} yet`,i;return t[19]===r?i=t[20]:(i=(0,G.jsx)(gf,{title:r,detail:`Open a design document first.`}),t[19]=r,t[20]=i),i}if(n===`Components`){let e,n,i;if(t[21]!==r.components||t[22]!==u||t[23]!==o){let a=Object.entries(r.components);e=`design-catalog-list`,n=a.length>0&&!a.some(e=>{let[,t]=e;return u(t.name)})?(0,G.jsx)(`p`,{className:`design-small-muted design-search-empty`,children:`No matching components`}):null,i=a.length?a.filter(e=>{let[,t]=e;return u(t.name)}).map(e=>{let[t,n]=e;return(0,G.jsx)(Sf,{icon:Re,label:n.name,className:`design-catalog-row`,onClick:()=>o([n.rootId])},t)}):(0,G.jsx)(gf,{title:`No components`,detail:`Components created by an agent appear here.`}),t[21]=r.components,t[22]=u,t[23]=o,t[24]=e,t[25]=n,t[26]=i}else e=t[24],n=t[25],i=t[26];let a;return t[27]!==e||t[28]!==n||t[29]!==i?(a=(0,G.jsxs)(`div`,{className:e,children:[n,i]}),t[27]=e,t[28]=n,t[29]=i,t[30]=a):a=t[30],a}let d,f,p;if(t[31]!==r.tokens||t[32]!==u){let e=Object.entries(r.tokens);d=`design-catalog-list`,f=e.length>0&&!e.some(e=>{let[,t]=e;return u(t.name)})?(0,G.jsx)(`p`,{className:`design-small-muted design-search-empty`,children:`No matching tokens`}):null,p=e.length?e.filter(e=>{let[,t]=e;return u(t.name)}).map(Tf):(0,G.jsx)(gf,{title:`No tokens`,detail:`Design tokens created by an agent appear here.`}),t[31]=r.tokens,t[32]=u,t[33]=d,t[34]=f,t[35]=p}else d=t[33],f=t[34],p=t[35];let m;return t[36]!==d||t[37]!==f||t[38]!==p?(m=(0,G.jsxs)(`div`,{className:d,children:[f,p]}),t[36]=d,t[37]=f,t[38]=p,t[39]=m):m=t[39],m}function Tf(e){let[t,n]=e;return(0,G.jsxs)(`div`,{className:`design-token-row`,children:[(0,G.jsx)(Ur,{children:n.name}),(0,G.jsx)(`span`,{className:`design-small-muted`,children:hu(n.kind)})]},t)}function Ef(e){let t=(0,H.c)(21),{open:n,onOpenChange:r,tab:i,onTabChange:a,counts:o,query:s,onQueryChange:c,comments:l,children:u}=e,d=(0,V.useRef)(null),f=(0,V.useRef)(new Map),p;t[0]===i?p=t[1]:(p=pf.find(e=>{let[t]=e;return t===i})?.[1]??Je,t[0]=i,t[1]=p);let m=p,h=e=>{let t=pf.findIndex(e=>{let[t]=e;return t===i}),n=pf[e===`first`?0:e===`last`?pf.length-1:(t+e+pf.length)%pf.length][0];a(n),f.current.get(n)?.focus()},g;t[2]!==r||t[3]!==n?(g=()=>r(!n),t[2]=r,t[3]=n,t[4]=g):g=t[4];let _;t[5]===m?_=t[6]:(_=(0,G.jsx)(m,{"aria-hidden":`true`}),t[5]=m,t[6]=_);let v=o[i],y;t[7]===v?y=t[8]:(y=(0,G.jsx)(`span`,{className:`design-pill-count`,children:v}),t[7]=v,t[8]=y);let b;t[9]===n?b=t[10]:(b=n?(0,G.jsx)(Pe,{"aria-hidden":`true`}):(0,G.jsx)(je,{"aria-hidden":`true`}),t[9]=n,t[10]=b);let x;t[11]!==n||t[12]!==g||t[13]!==_||t[14]!==y||t[15]!==b||t[16]!==i?(x=(0,G.jsxs)(W,{ref:d,size:`sm`,variant:`outline`,className:`design-float-pill`,"aria-expanded":n,"aria-controls":`design-catalog-panel`,onClick:g,children:[_,i,y,b]}),t[11]=n,t[12]=g,t[13]=_,t[14]=y,t[15]=b,t[16]=i,t[17]=x):x=t[17];let S=n?(0,G.jsxs)(`div`,{id:`design-catalog-panel`,className:`design-catalog-panel`,role:`region`,"aria-label":`Design catalog`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),r(!1),d.current?.focus())},children:[(0,G.jsx)(`div`,{className:`design-catalog-tabs`,role:`tablist`,"aria-label":`Catalog`,onKeyDown:e=>{let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:e.key===`Home`?`first`:e.key===`End`?`last`:null;t!==null&&(e.preventDefault(),h(t))},children:pf.map(e=>{let[t,n]=e,r=i===t,o=(0,G.jsx)(`button`,{ref:e=>{e?f.current.set(t,e):f.current.delete(t)},type:`button`,role:`tab`,id:`design-catalog-tab-${t}`,"aria-selected":r,"aria-controls":`design-catalog-tabpanel`,"aria-label":r?void 0:t,tabIndex:r?0:-1,onClick:()=>a(t)});return r?(0,G.jsxs)(`button`,{ref:e=>{e?f.current.set(t,e):f.current.delete(t)},type:`button`,role:`tab`,id:`design-catalog-tab-${t}`,"aria-selected":!0,"aria-controls":`design-catalog-tabpanel`,tabIndex:0,onClick:()=>a(t),children:[(0,G.jsx)(n,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{children:t})]},t):(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:o,children:(0,G.jsx)(n,{size:14,"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:t})]},t)})}),(0,G.jsx)(`div`,{id:`design-catalog-tabpanel`,className:`design-catalog-tabpanel`,role:`tabpanel`,"aria-labelledby":`design-catalog-tab-${i}`,children:i===`Comments`?l:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`label`,{className:`design-catalog-search`,children:[(0,G.jsx)(ct,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`input`,{type:`search`,"aria-label":`Search ${i.toLowerCase()}`,placeholder:`Search ${i.toLowerCase()}`,value:s,onChange:e=>c(e.target.value)})]}),u]})})]}):null,C;return t[18]!==S||t[19]!==x?(C=(0,G.jsxs)(`div`,{className:`design-catalog-float`,children:[x,S]}),t[18]=S,t[19]=x,t[20]=C):C=t[20],C}function Df(e,t){if(e==null)return`None`;if(typeof e==`object`&&`tokenId`in e)return`Token ${t?.tokens[String(e.tokenId)]?.name??String(e.tokenId)}`;if(typeof e==`object`&&`mode`in e){let n=e;return n.mode===`fixed`?`Fixed ${Df(n.value,t)}`:hu(n.mode)}return Array.isArray(e)?`${e.length} ${e.length===1?`item`:`items`}`:typeof e==`number`?_u(e):String(e)}function Of({document:e,selection:t,theme:n,context:r,compact:i=!1}){let a=(0,V.useMemo)(()=>dr(e,n,r),[e,n,r]);if(!t.length)return(0,G.jsx)(gf,{title:`Nothing selected`,detail:`Select a layer or click an item on the canvas.`});if(t.length>1)return(0,G.jsx)(gf,{title:`${t.length} items selected`,detail:`Select one item to inspect its properties.`});let o=t[0],s=o?e.nodes[o]:void 0;if(!s)return(0,G.jsx)(gf,{title:`Selection unavailable`,detail:`The selected item is no longer in this revision.`});let c=t=>{if(t&&typeof t==`object`&&`mode`in t&&`value`in t)return`${t.mode===`fixed`?`Fixed`:hu(String(t.mode))} ${c(t.value)}`;if(!t||typeof t!=`object`||!(`tokenId`in t))return Df(t,e);try{let r=cr(e,t,n);return typeof r==`number`?_u(r):String(r)}catch{return`Unresolved token`}},l=o?e.instances[o]:void 0,u=a.items.find(e=>e.ownerId===o)?.bounds,d=s.type===`ref`&&s.importId?e.imports[s.importId]:void 0,f=d?r?.documents?.[d.libraryId]:e,p=s.type===`ref`?f?.components[s.componentId]:void 0,m=t=>(0,G.jsx)(`dl`,{className:`design-property-list`,children:t.map(([t,n,r])=>(0,G.jsxs)(`div`,{className:`design-property`,children:[(0,G.jsx)(`dt`,{children:t}),(0,G.jsxs)(`dd`,{children:[r??(0,G.jsx)(`span`,{children:Df(n,e)}),r===void 0&&Df(n,e)!==c(n)?(0,G.jsxs)(`small`,{children:[`Resolved: `,c(n)]}):null]})]},t))}),h=(e,t)=>(0,G.jsxs)(`section`,{className:`design-inspector-section`,"aria-label":e,children:[(0,G.jsx)(`h3`,{children:e}),m(t)]}),g=s.fills?.[0],_=g?.kind===`solid`?c(g.color):null,v=Bu(s),y=v.icon;return(0,G.jsxs)(`div`,{className:`design-inspector-content`,children:[i?null:(0,G.jsxs)(`div`,{className:`design-inspector-identity`,children:[(0,G.jsxs)(`h2`,{className:`design-inspector-title`,children:[(0,G.jsx)(y,{size:14,"aria-hidden":`true`}),(0,G.jsx)(Ur,{children:s.name||v.label})]}),(0,G.jsxs)(`span`,{className:`design-inspector-meta`,children:[(0,G.jsx)(`span`,{className:`design-small-muted`,children:v.label}),(0,G.jsx)(yr,{variant:`outline`,size:`sm`,children:`Read only`})]})]}),`clip`in s?h(`Alignment`,[[`Clip contents`,null,bu(s.clip)]]):null,h(`Position`,[[`X`,s.x],[`Y`,s.y],[`Rotation`,s.rotation??0,`${_u(s.rotation??0)}°`]]),h(`Layout`,`layout`in s?[[`Mode`,null,hu(s.layout.direction)],[`Gap`,s.layout.gap],[`Padding`,null,[s.layout.padding.top,s.layout.padding.right,s.layout.padding.bottom,s.layout.padding.left].map(t=>Df(t,e)).join(` `)]]:[[`Mode`,null,`Absolute`]]),h(`Dimensions`,[[`Width`,s.width],[`Height`,s.height],[`Computed`,null,u?`${_u(u.width)} × ${_u(u.height)}`:`Unavailable`]]),h(`Appearance`,[[`Opacity`,null,vu(s.opacity??1)],[`Visibility`,null,yu(s.visible??!0)],[`Stroke`,s.stroke??`None`],[`Effects`,null,xu(s.effects?.length??0)],...`radius`in s?[[`Radius`,s.radius??0]]:[],...`text`in s?[[`Text`,null,(0,G.jsx)(Ur,{children:s.text},`text`)],[`Font`,s.fontFamily],[`Font size`,s.fontSize]]:[]]),h(`Fill`,[[`Type`,null,g?hu(g.kind):`None`],...g?.kind===`solid`?[[`Color`,null,(0,G.jsxs)(`span`,{className:`design-fill-value`,children:[(0,G.jsx)(`span`,{className:`design-swatch`,style:{background:_??`transparent`},"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`design-mono`,children:_}),typeof g.color==`object`?(0,G.jsx)(`small`,{children:Df(g.color,e)}):null]},`color`)]]:g?.kind===`image`?[[`Asset`,null,(0,G.jsx)(Ur,{className:`design-truncate design-mono`,children:g.assetId},`asset`)]]:g?.kind===`gradient`?[[`Gradient`,null,hu(g.gradient)]]:[]]),h(`Theme`,Object.entries(e.themeAxes).length?Object.entries(e.themeAxes).map(([e,t])=>[e,null,n[e]??`Default (${t[0]??`none`})`]):[[`Preview`,null,`Default`]]),p?(0,G.jsxs)(`section`,{className:`design-inspector-section`,"aria-label":`Source component`,children:[(0,G.jsx)(`h3`,{children:`Source component`}),(0,G.jsx)(`p`,{children:p.name}),d?(0,G.jsx)(Ur,{className:`design-truncate design-small-muted`,children:`Library ${r?.manifest?.libraries[d.libraryId]?.path??d.libraryId}`}):null]}):null,l?(0,G.jsxs)(`section`,{className:`design-inspector-section`,"aria-label":`Overrides`,children:[(0,G.jsx)(`h3`,{children:`Overrides`}),(0,G.jsxs)(`p`,{children:[Object.keys(l.overrides).length,` source`,` `,Object.keys(l.overrides).length===1?`node`:`nodes`]}),Object.entries(l.overrides).map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ur,{className:`design-truncate design-small-muted`,children:f?.nodes[e]?.name??e}),m(Object.entries(t))]},e))]}):null,h(`Code`,[[`Mapping`,null,e.codeMappings?`Document mapping available`:`No code mapping`]]),i?null:(0,G.jsx)(`p`,{className:`design-inspector-hint`,children:`Ask the agent to change this selection.`})]})}function kf(e){let t=(0,H.c)(67),{geometry:n,document:r,selection:i,theme:a,context:o,collapsed:s,onCollapsedChange:c,onComment:l,extraAction:u}=e,d=(0,V.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={width:300,height:148},t[0]=f):f=t[0];let[p,m]=(0,V.useState)(f),[h,g]=(0,V.useState)(!1),_,v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=d.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.offsetWidth,n=e.offsetHeight;t&&n&&m(e=>e.width===t&&e.height===n?e:{width:t,height:n})});return t.observe(e),()=>t.disconnect()},v=[],t[1]=_,t[2]=v):(_=t[1],v=t[2]),(0,V.useLayoutEffect)(_,v);let y;t[3]!==n.avoid||t[4]!==n.canvas||t[5]!==n.screen||t[6]!==p?(y=Rr(n.screen,p,n.canvas,void 0,void 0,n.avoid),t[3]=n.avoid,t[4]=n.canvas,t[5]=n.screen,t[6]=p,t[7]=y):y=t[7];let b=y,{onPlaced:x}=n,S=b?.x,C=b?.y,w,T;t[8]!==x||t[9]!==S||t[10]!==C||t[11]!==p.height||t[12]!==p.width?(w=()=>{x(S===void 0||C===void 0?null:{x:S,y:C,width:p.width,height:p.height})},T=[x,S,C,p.width,p.height],t[8]=x,t[9]=S,t[10]=C,t[11]=p.height,t[12]=p.width,t[13]=w,t[14]=T):(w=t[13],T=t[14]),(0,V.useLayoutEffect)(w,T);let E,D;t[15]===x?(E=t[16],D=t[17]):(E=()=>()=>x(null),D=[x],t[15]=x,t[16]=E,t[17]=D),(0,V.useLayoutEffect)(E,D);let O=i.length===1?r.nodes[i[0]]:void 0,k;t[18]===O?k=t[19]:(k=O?Bu(O):{label:`Selection`,icon:Je},t[18]=O,t[19]=k);let A=k,j=A.icon,M=O?O.name||A.label:`${i.length} layers`,N=!b,P;t[20]===b?P=t[21]:(P=b?{transform:`translate(${b.x}px, ${b.y}px)`}:void 0,t[20]=b,t[21]=P);let F;t[22]===j?F=t[23]:(F=(0,G.jsx)(j,{size:14,"aria-hidden":`true`}),t[22]=j,t[23]=F);let I;t[24]===M?I=t[25]:(I=(0,G.jsx)(`h2`,{children:(0,G.jsx)(Ur,{children:M})}),t[24]=M,t[25]=I);let L;t[26]!==A.label||t[27]!==O?(L=O?(0,G.jsx)(`span`,{className:`sr-only`,children:A.label}):null,t[26]=A.label,t[27]=O,t[28]=L):L=t[28];let R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,G.jsx)(yr,{variant:`outline`,size:`sm`,children:`Read only`}),t[29]=R):R=t[29];let ee=s?`Expand inspector`:`Collapse inspector`,te=!s,ne;t[30]!==s||t[31]!==c?(ne=()=>c(!s),t[30]=s,t[31]=c,t[32]=ne):ne=t[32];let re;t[33]!==ee||t[34]!==te||t[35]!==ne?(re=(0,G.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":ee,"aria-expanded":te,onClick:ne}),t[33]=ee,t[34]=te,t[35]=ne,t[36]=re):re=t[36];let z;t[37]===s?z=t[38]:(z=s?(0,G.jsx)(je,{"aria-hidden":`true`}):(0,G.jsx)(Pe,{"aria-hidden":`true`}),t[37]=s,t[38]=z);let ie;t[39]!==re||t[40]!==z?(ie=(0,G.jsx)(Ar,{render:re,children:z}),t[39]=re,t[40]=z,t[41]=ie):ie=t[41];let ae=s?`Expand inspector`:`Collapse inspector`,oe;t[42]===ae?oe=t[43]:(oe=(0,G.jsx)(jr,{children:ae}),t[42]=ae,t[43]=oe);let se;t[44]!==ie||t[45]!==oe?(se=(0,G.jsxs)(kr,{children:[ie,oe]}),t[44]=ie,t[45]=oe,t[46]=se):se=t[46];let ce;t[47]!==F||t[48]!==I||t[49]!==L||t[50]!==se?(ce=(0,G.jsxs)(`header`,{className:`design-selection-card-header`,children:[F,I,L,R,se]}),t[47]=F,t[48]=I,t[49]=L,t[50]=se,t[51]=ce):ce=t[51];let le;t[52]!==s||t[53]!==o||t[54]!==r||t[55]!==u||t[56]!==n.world||t[57]!==h||t[58]!==l||t[59]!==i||t[60]!==a?(le=s?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dl`,{className:`design-geometry`,children:[[`W`,n.world.width],[`H`,n.world.height],[`X`,n.world.x],[`Y`,n.world.y]].map(jf)}),(0,G.jsxs)(`div`,{className:`design-selection-card-actions`,children:[l?(0,G.jsxs)(W,{size:`xs`,variant:`outline`,onClick:l,children:[(0,G.jsx)($e,{"aria-hidden":`true`}),`Comment`]}):null,(0,G.jsx)(W,{size:`xs`,variant:`ghost`,"aria-expanded":h,onClick:()=>g(Af),children:h?`Less`:`More`}),u]}),h?(0,G.jsx)(`div`,{className:`design-selection-card-more`,children:(0,G.jsx)(Of,{document:r,selection:i,theme:a,context:o,compact:!0})}):null]}),t[52]=s,t[53]=o,t[54]=r,t[55]=u,t[56]=n.world,t[57]=h,t[58]=l,t[59]=i,t[60]=a,t[61]=le):le=t[61];let ue;return t[62]!==N||t[63]!==P||t[64]!==ce||t[65]!==le?(ue=(0,G.jsxs)(`section`,{ref:d,className:`design-selection-card`,"aria-label":`Selection inspector`,hidden:N,style:P,children:[ce,le]}),t[62]=N,t[63]=P,t[64]=ce,t[65]=le,t[66]=ue):ue=t[66],ue}function Af(e){return!e}function jf(e){let[t,n]=e;return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:t}),(0,G.jsx)(`dd`,{children:_u(Math.round(n*100)/100)})]},t)}var Mf=new Map,Nf=e=>Mf,Pf=(e,t)=>null,Ff=(e,t)=>void 0,If=(e,t,n)=>null;function Lf({resourceId:e,surface:t,agentEdit:n,frameDecoration:r,canvasPreferences:i}){let a=Hn(),{navigation:o,attachment:s}=a,c=o.useTarget(),l=a.useCanWrite?.(c)??!0,u=o.useProjects(),d=o.useActivePath(c),f=e??d??``,p=ef(c),{record:m,select:h,reload:g}=$d(c,f),_=ff(c,f,m),v=(o.useDocumentStatuses??Nf)(c),y=(a.review.useAcceptHold??Pf)(c,f),b=(a.useAgentPresence??Ff)(c,f),x=(a.useCanvasPlaceholder??If)(c,{paths:p.paths,loading:p.loading,failed:!!p.error},{openImport:()=>le(!0)}),[S,C]=(0,V.useState)(`Layers`),[w,T]=(0,V.useState)(!1),[E,D]=(0,V.useState)(!1),[O,k]=(0,V.useState)(`Canvas`),[A,j]=(0,V.useState)(``),[M,N]=(0,V.useState)(()=>typeof window>`u`||window.innerWidth>=1024),[P,F]=(0,V.useState)(!1),[I,L]=(0,V.useState)(null),[R,ee]=(0,V.useState)(null),[te,ne]=(0,V.useState)(null),[re,z]=(0,V.useState)(null),[ie,ae]=(0,V.useState)([]),[oe,se]=(0,V.useState)({}),[ce,le]=(0,V.useState)(!1),[ue,de]=(0,V.useState)(`import`),fe=t===`panel`,pe=JSON.stringify([c,f,t]),me=re?.key===pe?re:null,he=!!me,ge=!!(me&&me.afterRevision!==m.contentHash);(0,V.useEffect)(()=>z(null),[pe]);let B=m.document,_e=m.diagnostics??[],ve=B?Object.values(B.annotations).filter(e=>e.blocking&&e.status===`open`).length:0,ye=_e.find(e=>e.severity===`error`),be=_e.find(e=>e.code.includes(`asset`)),xe=_.baseline,Se=(0,V.useMemo)(()=>xe?.document&&B?fr(xe.document,B).filter(e=>!/^\/(annotations|reviews|acceptances)(\/|$)/.test(e.path)):null,[xe?.document,B]),we=Se?Se.length:m.changedNodeIds.length,Te=(0,V.useMemo)(()=>Se&&xe?.document&&B?Se.map(e=>({key:e.path,text:Eu(e,xe.document,B)})):null,[Se,xe?.document,B]),Ee=(0,V.useMemo)(()=>B?Object.entries(B.themeAxes):[],[B?.themeAxes]),De=(0,V.useMemo)(()=>Object.fromEntries(Ee.flatMap(([e,t])=>oe[e]&&t.includes(oe[e])?[[e,oe[e]]]:[])),[oe,Ee]),Oe=c?.threadId,ke=(0,V.useMemo)(()=>c&&s?{environmentId:c.environmentId,projectId:c.projectId,...Oe?{threadId:Oe}:{}}:null,[c?.environmentId,c?.projectId,Oe,!!s]),Ae=!fe&&!!(Oe&&a.thread),je=Ae&&M,Me=(e,t=fe?`panel`:`workspace`)=>{c&&o.openDocument(c,e,t)},Ne=B&&(m.status===`ready`||m.status===`disconnected`||m.status===`conflict`||m.readOnly),Pe=!!(l&&m.contentHash&&m.status===`ready`&&!m.readOnly),Ie=()=>{xe?.document&&xe.revision&&B&&m.contentHash&&(z({key:pe,before:xe.document,after:B,beforeRevision:xe.revision,afterRevision:m.contentHash,beforeContext:xe.context,beforeAssets:xe.assets,afterContext:m.context,afterAssets:m.assets,theme:De,priorSelection:[...m.selection]}),ae([...m.selection]),L(null),k(`Canvas`))},Le=()=>{me&&h(me.priorSelection),z(null)},Re=e=>{ne(e??null),fe?k(`Comments`):(C(`Comments`),T(!0))},Ve=e=>{Ae&&N(!0),_.attach(e,{stay:Ae})},He=m.selection.join(`\0`),We=(0,V.useRef)(m.contentHash);We.current=m.contentHash;let Ge=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=Ge.current;if(Ge.current=He,!je||!ke||!s||he||(e===null||e===He)&&s.current(ke))return;let t=We.current,n=He?He.split(`\0`):[];if(!n.length||!t||!f){s.set(ke,null);return}let r=n.length===1?B?.nodes[n[0]]:void 0;s.set(ke,{documentPath:f,revision:t,nodeIds:n},r?{name:r.name,type:{type:r.type,fills:r.fills}}:void 0)},[je,ke,he,He,f]),(0,V.useEffect)(()=>{if(!je||!ke||!s||!m.contentHash)return;let e=s.current(ke);e&&e.selection.documentPath===f&&e.selection.revision!==m.contentHash&&s.set(ke,{...e.selection,revision:m.contentHash},e.label)},[je,ke,f,m.contentHash]);let Ke=async e=>{if(he||!m.contentHash||!_.author.trim()||R?.path!==f||R.revision!==m.contentHash)return;let t=af();await _.annotate(t,{...e,revision:m.contentHash,author:_.author.trim(),createdAt:new Date().toISOString(),replies:[],status:`open`}),ee(null),L(null)},qe=async(e,t)=>{if(he)return;let n=B?.annotations[e];n&&_.author.trim()&&await _.annotate(e,{...n,replies:[...n.replies,{id:af(),body:t,author:_.author.trim(),createdAt:new Date().toISOString()}]})},Je=async(e,t)=>{if(he)return;let n=B?.annotations[e];n&&await _.annotate(e,{...n,status:t?`resolved`:`open`})},Ye=R?.anchor.kind===`region`&&R.path===f&&R.revision===m.contentHash?R.anchor.bounds:null,Xe=B?(0,G.jsxs)(`div`,{className:`design-comments-panel`,children:[he?(0,G.jsx)(`p`,{className:`design-author-hint`,children:`Exit compare to comment or attach a selection.`}):null,m.selection.length&&!he&&Pe?(0,G.jsx)(`div`,{className:`design-inspector-actions`,children:(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>ee({path:f,revision:m.contentHash,anchor:{kind:`nodes`,nodeIds:m.selection}}),children:`Comment on selection`})}):null,R&&!he&&R.path===f&&R.revision===m.contentHash&&Pe?(0,G.jsx)(bd,{anchor:R.anchor,onSubmit:Ke,onCancel:()=>{ee(null),L(null)},busy:_.busy||!_.author.trim()},JSON.stringify(R)):null,R?.path===f&&R.revision!==m.contentHash?(0,G.jsxs)(`div`,{className:`design-annotation-stale`,role:`status`,children:[(0,G.jsx)(`span`,{children:`The revision changed. Place this comment again.`}),(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>{ee(null),L(null)},children:`Clear`})]}):null,Ye&&!he&&ke?(0,G.jsx)(`div`,{className:`design-inspector-actions`,children:(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>Ve({documentPath:f,revision:m.contentHash,nodeIds:[],region:Ye}),children:`Attach region`})}):null,(0,G.jsx)(Sd,{document:B,currentRevision:m.contentHash,focusedId:te,actions:m.status!==`ready`||m.readOnly||he?void 0:{reply:qe,setResolved:Je},busy:_.busy||!_.author.trim()})]}):(0,G.jsx)(gf,{title:`No comments`}),Ze=!!(xe&&c?.threadId&&Object.values(B?.acceptances??{}).some(e=>e.revision===m.contentHash&&(e.turnId===xe.turnId||xe.revision===m.contentHash)&&e.threadId===c.threadId)),$e=!l||m.status!==`ready`||m.readOnly,et=xe?xe.document?xe.revision?null:`The turn baseline has no resolved content revision. Compare is unavailable.`:`No design existed at the turn baseline. Compare is unavailable.`:_.baselineLoading?`Loading turn baseline…`:_.baselineReason,tt=$e?`Showing a cached revision. Reload to review.`:ge?`Exit compare to review the current revision.`:m.contentHash?null:`Revision unavailable. Reload to review.`,rt=!Ze&&y||Du({accepted:Ze,busy:_.busy,hasThread:!!c?.threadId,hasBaseline:!!xe,baselineNotice:et,revision:m.contentHash,cached:$e,reviewLocked:ge,blockers:ve,canAccept:_.canAccept}),[ot,st]=Ze?[`Accepted`,`success`]:_.status===`approved`?[`Approved`,`success`]:_.status===`request-changes`?[`Changes requested`,`info`]:_.status===`stale-approval`?[`Approval is stale`,`warning`]:_.unreviewed?[`Awaiting review`,`outline`]:[null,`outline`],ct=B?Object.values(B.annotations).filter(e=>e.status===`open`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)):[],ut=a.review.followUpPrompt,dt=a.review.restore,ft=Object.values(B?.acceptances??{}).filter(e=>e.threadId===c?.threadId).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).at(-1),pt={revision:m.contentHash,changedCount:we,blockers:ve,statusLabel:ot,statusTone:st,accepted:Ze,canReview:!tt,canAccept:!rt&&!Ze,canReject:_.canReject,acceptReason:rt,rejectReason:_.canReject?null:_.rejectBlockReason,reviewReason:tt,busy:_.busy,author:_.author,actions:{approve:_.approve,requestChanges:_.requestChanges,accept:_.accept,rejectTurn:_.reject},onCompare:xe?.document&&xe.revision&&B&&m.contentHash?Ie:void 0,onComments:()=>Re(),authorFromHost:_.authorFromHost,rejectSupported:!!a.review.useRejectTurn,followUp:ut&&a.review.prepareFollowUp&&c&&B&&f?{prepare:e=>a.review.prepareFollowUp(c,f,e),openComments:ct.length,prompt:()=>ut({documentPath:f,comments:ct.map(({author:e,body:t})=>({author:e,body:t}))})}:void 0,restore:dt&&c&&f&&m.fileHash&&xe?.document&&we>0&&!Ze&&!$e?{documentName:mf(f),changedCount:we,acceptedBy:ft?.author??null,acceptedAt:ft?.createdAt??null,run:()=>dt(c,f,m.fileHash)}:void 0,acceptedBy:_.authorFromHost&&ft?.revision===m.contentHash?{author:ft.author,at:ft.createdAt}:void 0,conflict:_.conflict,onReload:()=>{g(),p.reload()}},gt=[];B&&m.status===`disconnected`&&gt.push({key:`disconnected`,variant:`warning`,role:`status`,icon:ht,message:`Disconnected. Showing cached revision ${hf(m.contentHash)}.`,action:{label:`Retry`,run:g}}),B&&m.status===`conflict`&&gt.push({key:`conflict`,variant:`warning`,role:`alert`,icon:Fe,message:`This view is out of date.`,action:{label:`Reload`,run:g}}),B&&(m.readOnly||ye)&&!be&&m.status===`ready`&&gt.push({key:`issue`,variant:ye?`error`:`info`,role:`alert`,icon:Fe,message:ye?.message??`This design is read-only.`,action:{label:`Reload`,run:g}}),B&&be&&gt.push({key:`asset`,variant:`warning`,role:`status`,icon:Fe,message:`An image asset is missing. Its placeholder remains visible.`,action:{label:`Reload`,run:g}});let _t=B?(0,G.jsx)(_f,{items:gt,diagnostics:_e}):null,vt=c?(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(W,{size:`icon-sm`,variant:`ghost`,onClick:()=>{g(),p.reload()},"aria-label":`Reload design`}),children:(0,G.jsx)(at,{"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:`Reload design`})]}):null,yt=Ee.map(([e,t])=>(0,G.jsxs)(Cr,{modal:!1,value:De[e]??``,onValueChange:t=>se(n=>{let r={...n};return typeof t==`string`&&t?r[e]=t:delete r[e],r}),children:[(0,G.jsxs)(Tr,{variant:`ghost`,size:`sm`,className:`design-topbar-select`,"aria-label":`Preview ${hu(e)}`,children:[(0,G.jsx)(nt,{"aria-hidden":`true`,size:16}),(0,G.jsx)(`span`,{className:`design-small-muted`,children:Ee.length===1?`Preview`:hu(e)}),(0,G.jsx)(Er,{children:e=>e||`Default`})]}),(0,G.jsxs)(Dr,{children:[(0,G.jsx)(Or,{value:``,children:`Default`}),t.map(e=>(0,G.jsx)(Or,{value:e,children:e},e))]})]},e)),bt=c?(0,G.jsxs)(W,{size:`sm`,variant:`outline`,disabled:!l,onClick:()=>{de(`import`),le(!0)},children:[(0,G.jsx)(Ce,{"aria-hidden":`true`}),`Import / export`]}):null,xt=x||(c?f?m.status===`loading`&&!B?(0,G.jsx)(gf,{title:`Loading design…`}):B?(0,G.jsxs)(G.Fragment,{children:[fe?_t:null,Ne&&!B.roots.length?(0,G.jsx)(gf,{title:`No layers yet`,detail:`Ask an agent to add a frame or shape.`}):null,Ne&&B.roots.length?me?(0,G.jsx)(Fu,{preferences:i,before:me.before,after:me.after,beforeRevision:me.beforeRevision,afterRevision:me.afterRevision,viewKey:pe,theme:me.theme,beforeContext:me.beforeContext,beforeAssets:me.beforeAssets,context:me.afterContext,assets:me.afterAssets,selection:ie,onSelect:ae,onExit:Le}):(0,G.jsx)(Nu,{preferences:i,chrome:fe?`panel`:`workspace`,viewKey:pe,document:B,theme:De,context:m.context,assets:m.assets,selection:m.selection,changedNodeIds:m.changedNodeIds,batch:m.batch,agents:b,agentEdit:n,frameDecoration:r,onSelect:h,annotationMode:I,onAnnotationModeChange:Pe?L:void 0,onAnchor:e=>{m.contentHash&&ee({path:f,revision:m.contentHash,anchor:e}),Re()},onOpenAnnotation:Re,revision:m.contentHash,renderSelectionOverlay:fe?void 0:e=>(0,G.jsx)(kf,{geometry:e,document:B,selection:m.selection,theme:De,context:m.context,collapsed:P,onCollapsedChange:F,onComment:Pe?()=>L(`pin`):void 0,extraAction:ke&&s&&!Ae&&m.contentHash?(0,G.jsx)(W,{size:`xs`,variant:`ghost`,onClick:()=>Ve({documentPath:f,revision:m.contentHash,nodeIds:m.selection}),children:`Attach selection`}):null})},f):null]}):(0,G.jsx)(gf,{title:_e.some(e=>e.code===`unknown-major`)?`Newer design version`:`Design could not be opened`,detail:ye?.message??`Check the file and try again.`,action:g}):(0,G.jsx)(gf,{title:`Choose a design`,detail:`Open a .p4design document from this project.`,action:p.paths.length?()=>D(!0):void 0,actionLabel:`Choose design`}):(0,G.jsx)(gf,{title:`Open a project`,detail:`Choose a project to view its design documents.`})),St=(0,G.jsx)(fd,{open:ce,mode:ue,onModeChange:de,onOpenChange:le,target:c,documentPath:f,revision:m.contentHash,document:m.status===`ready`&&!m.readOnly?B:void 0,selection:m.selection,onImportComplete:p.reload,theme:De,onOpenImported:e=>{Me(e)}});if(!fe){let e={Layers:B?Object.keys(B.nodes).length:0,Comments:B?Object.keys(B.annotations).length:0,Components:B?Object.keys(B.components).length:0,Libraries:Object.keys(m.context?.manifest?.libraries??{}).length,Tokens:B?Object.keys(B.tokens).length:0};return(0,G.jsxs)(`section`,{className:`design-workspace design-workspace-full${he?` design-workspace-comparing`:``}`,"aria-label":`P4 Design workspace`,children:[(0,G.jsxs)(`header`,{className:`design-topbar`,children:[(0,G.jsxs)(`div`,{className:`design-topbar-title`,children:[a.TopbarStart?(0,G.jsx)(a.TopbarStart,{target:c}):null,(0,G.jsx)(xf,{path:f,paths:p.paths,open:E,onOpenChange:D,onOpen:e=>Me(e),statuses:v,onStartDesign:c&&o.startDesign?()=>{N(!0),o.startDesign?.(c)}:void 0}),f?(0,G.jsx)(qn,{target:c,path:f,revision:m.contentHash,fileHash:m.fileHash??``,disabled:$e||!!me||!c||!m.fileHash},`${c?.environmentId}:${c?.projectId}:${c?.threadId}:${f}`):null]}),(0,G.jsx)(`div`,{className:`design-topbar-notices`,children:_t}),(0,G.jsxs)(`div`,{className:`design-topbar-actions`,children:[u.length||o.createProject?(0,G.jsxs)(Cr,{modal:!1,value:c?`${c.environmentId}\u0000${c.projectId}`:null,onValueChange:e=>{if(e===bf){o.createProject?.();return}let t=u.find(t=>`${t.environmentId}\u0000${t.projectId}`===e);t&&o.openProject(t)},children:[(0,G.jsxs)(Tr,{variant:`ghost`,size:`sm`,className:`design-topbar-select`,"aria-label":`Project`,children:[(0,G.jsx)(Ue,{"aria-hidden":`true`,size:16}),(0,G.jsx)(Er,{children:e=>(0,G.jsx)(Ur,{children:u.find(t=>`${t.environmentId}\u0000${t.projectId}`===e)?.name??`Select project`})})]}),(0,G.jsxs)(Dr,{children:[u.map(e=>(0,G.jsx)(Or,{value:`${e.environmentId}\u0000${e.projectId}`,children:e.name},`${e.environmentId}\u0000${e.projectId}`)),o.createProject?(0,G.jsx)(Or,{value:bf,children:(0,G.jsxs)(`span`,{className:`design-switcher-item`,children:[(0,G.jsx)(it,{"aria-hidden":`true`,size:14}),`New project`]})}):null]})]}):null,c&&o.startDesign?(0,G.jsxs)(W,{size:`default`,variant:`default`,onClick:()=>{N(!0),o.startDesign?.(c)},children:[(0,G.jsx)(it,{"aria-hidden":`true`}),`New design`]}):null,Ee.length?(0,G.jsx)(`span`,{className:`design-topbar-divider`,"aria-hidden":`true`}):null,yt,(0,G.jsx)(`span`,{className:`design-topbar-divider`,"aria-hidden":`true`}),(0,G.jsx)(Zn,{target:c,path:f,revision:m.contentHash,compact:!0}),a.TopbarEnd?(0,G.jsx)(a.TopbarEnd,{target:c,path:f}):null,(0,G.jsxs)(wn,{children:[(0,G.jsxs)(kr,{children:[(0,G.jsx)(Ar,{render:(0,G.jsx)(Tn,{render:(0,G.jsx)(W,{size:`icon`,variant:`ghost`,"aria-label":`More actions`})}),children:(0,G.jsx)(Be,{"aria-hidden":`true`})}),(0,G.jsx)(jr,{children:`More actions`})]}),(0,G.jsxs)(En,{align:`end`,className:`w-56`,children:[(0,G.jsxs)(Dn,{disabled:!c||!l,onClick:()=>{de(`import`),le(!0)},children:[(0,G.jsx)(mt,{"aria-hidden":`true`}),` Import design…`]}),(0,G.jsxs)(Dn,{disabled:!l||!B||m.status!==`ready`||m.readOnly,onClick:()=>{de(`export`),le(!0)},children:[(0,G.jsx)(ze,{"aria-hidden":`true`}),` Export design…`]}),(0,G.jsxs)(Dn,{disabled:!c,onClick:()=>{g(),p.reload()},children:[(0,G.jsx)(at,{"aria-hidden":`true`}),` Reload design`]}),o.openSettings?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(On,{}),(0,G.jsxs)(Dn,{onClick:()=>o.openSettings?.(),children:[(0,G.jsx)(lt,{"aria-hidden":`true`}),` Settings`]})]}):null]})]})]})]}),(0,G.jsxs)(`div`,{className:`design-body`,children:[M?(0,G.jsx)(Nr,{title:a.agentColumnTitle,heading:a.AgentHeader?(0,G.jsx)(a.AgentHeader,{target:c}):void 0,hostLabel:Ae&&!a.AgentHeader?a.thread?.label:void 0,onOpenThread:c?.threadId&&o.returnToThread?()=>f?Me(f,`panel`):o.returnToThread?.(c):void 0,onCollapse:()=>N(!1),card:B&&f&&!x?(0,G.jsx)(Nd,{review:pt,changes:Te,changesNotice:et,notice:ge?`Design changed during compare. Exit compare to review the current revision.`:null,error:_.error}):null,thread:Ae&&c?a.thread.render(c):a.AgentPanel?(0,G.jsx)(a.AgentPanel,{target:c}):null}):null,(0,G.jsxs)(`main`,{className:`design-main`,children:[(0,G.jsxs)(`div`,{className:`design-canvas-topleft`,children:[M?null:(0,G.jsx)(Pr,{onOpen:()=>N(!0)}),B&&!he&&!x?(0,G.jsx)(Ef,{open:w,onOpenChange:T,tab:S,onTabChange:C,counts:e,query:A,onQueryChange:j,comments:Xe,children:S===`Comments`?null:(0,G.jsx)(wf,{tab:S,document:B,onOpen:Me,selection:m.selection,select:h,context:m.context,query:A})}):null]}),xt]})]}),St]})}return(0,G.jsxs)(`section`,{className:`design-workspace design-workspace-pane${he?` design-workspace-comparing`:``}`,"aria-label":`P4 Design workspace`,children:[(0,G.jsxs)(`header`,{className:`design-header`,children:[(0,G.jsxs)(`div`,{className:`design-heading`,children:[(0,G.jsx)(xf,{path:f,paths:p.paths,onStartDesign:c&&o.startDesign?()=>o.startDesign?.(c):void 0,onOpen:e=>Me(e),open:E,onOpenChange:D}),f&&c?(0,G.jsx)(qn,{target:c,path:f,revision:m.contentHash,fileHash:m.fileHash??``,disabled:$e||!!me||!m.fileHash},`${c.environmentId}:${c.projectId}:${c.threadId}:${f}`):(0,G.jsx)(`span`,{className:`design-small-muted`,children:`Project designs`})]}),(0,G.jsxs)(`div`,{className:`design-header-actions`,children:[yt,pt.onCompare?(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:Ie,children:`Compare`}):null,(0,G.jsx)(Zn,{target:c,path:f,revision:m.contentHash}),bt,c&&f?(0,G.jsxs)(W,{size:`sm`,variant:`outline`,onClick:()=>Me(f,`workspace`),children:[(0,G.jsx)(Qe,{"aria-hidden":`true`}),`Expand`]}):null,vt]})]}),(0,G.jsx)(`nav`,{className:`design-pane-tabs`,"aria-label":`Design views`,children:[`Canvas`,`Layers`,`Inspect`,`Comments`].map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-current":O===e?`page`:void 0,onClick:()=>k(e),children:e},e))}),(0,G.jsx)(`main`,{className:`design-main ${O===`Canvas`?``:`design-main-hidden`}`,children:xt}),O===`Layers`?(0,G.jsx)(`div`,{className:`design-pane-content`,children:B?(0,G.jsx)(Cf,{document:B,selection:m.selection,select:h}):(0,G.jsx)(gf,{title:`No layers yet`})}):null,O===`Inspect`?(0,G.jsx)(`div`,{className:`design-pane-content`,children:B?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Of,{document:B,selection:m.selection,theme:De,context:m.context}),he?(0,G.jsx)(`p`,{className:`design-author-hint`,children:`Exit compare to comment or attach a selection.`}):null,m.selection.length&&m.contentHash&&ke&&!he?(0,G.jsx)(`div`,{className:`design-inspector-actions`,children:(0,G.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>Ve({documentPath:f,revision:m.contentHash,nodeIds:m.selection}),children:`Attach selection`})}):null]}):(0,G.jsx)(gf,{title:`Nothing to inspect`})}):null,O===`Comments`?(0,G.jsx)(`div`,{className:`design-pane-content`,children:Xe}):null,_.error?(0,G.jsx)(`p`,{className:`design-review-error`,role:`alert`,children:_.error}):null,(0,G.jsx)(Id,{review:pt,cached:$e,baselineNotice:et,reviewLocked:ge}),St]})}function Rf(e){let t=wt(e,`design.transfer`);return{permissionAtom:t.permissionAtom,run:(e,n,r)=>Ot(n,St(`design.transfer`,r).pipe(se(_t,{authorize:n=>t.authorize(e,n)})))}}var zf=Tt(At,{label:`design-catalog`,execute:e=>yt(`design.catalog`,e)}),Bf=Tt(At,{label:`design-baseline`,execute:e=>{let{turnId:t,...n}=e;return yt(`design.baseline`,n)}}),Vf=e=>({projectId:e.projectId,...e.threadId?{threadId:e.threadId}:{}}),Hf=vt(At,{label:`Save design review`,tag:`design.review`}),Uf=vt(At,{label:`Restore design revision`,tag:`design.revisions.restore`}),Wf=Rf(At);function Gf(e){return{revisions:(e,t)=>b(xt,n=>n.run(e.environmentId,yt(`design.revisions`,{...Vf(e),documentPath:t}))),restoreRevision:(t,n,r,i)=>re(()=>Uf.run(e,{environmentId:t.environmentId,input:{...Vf(t),documentPath:n,revisionId:r,expectedFileHash:i}})).pipe(b(e=>e._tag===`Success`?Se(e.value):ye(e.cause))),subscribe:(e,t)=>Dt(e.environmentId,Et(`design.subscribe`,()=>Se({...Vf(e),documentPath:t})).pipe(B(le(`DesignTransport.assets`)(function*(t){let n=yield*xt,i=yield*ce();return{event:t,fetchAsset:t=>r(i)(n.run(e.environmentId,yt(`design.asset`,t)))}})))),catalog:e=>zf({environmentId:e.environmentId,input:Vf(e)}),baseline:(e,t,n)=>Bf({environmentId:e.environmentId,input:{...Vf(e),threadId:e.threadId,documentPath:t,turnId:n}}),review:(t,n)=>re(()=>Hf.run(e,{environmentId:t.environmentId,input:{target:Vf(t),request:n}})).pipe(b(e=>e._tag===`Success`?Se(e.value):ye(e.cause))),transfer:(t,n)=>Wf.run(e,t.environmentId,n)}}function Kf({threadRef:e,composerTarget:t,projectId:n,projectName:r,workspaceRoot:i,documentPath:a}){let s=(0,V.useContext)(A),c=qt(e.environmentId),l=kt(e),u=M(Hf.permissionAtom(e.environmentId)),d=(0,V.useMemo)(()=>({environmentId:e.environmentId,projectId:n,...l?{threadId:e.threadId}:{}}),[e.environmentId,e.threadId,n,!!l]),f=c?.connection.phase===`connected`,p=(0,V.useMemo)(()=>Gf(s),[s]),m=(0,V.useRef)(null);(0,V.useEffect)(()=>{s.refresh(p.catalog(d))},[s,p,d,l?.latestRun?.runId,l?.runtime?.status]);let h=(0,V.useMemo)(()=>{let s=e=>{let n=o.getState(),r=n.draftsByThreadKey[R(t)]?.prompt??``;n.setPrompt(t,r.trim()?`${r}\n\n${e}`:e)},c=()=>s(`Create a new design in this project. Read design_guide, inspect the project's existing components and styles, then use design_apply to create a .p4design document. Validate and render it for review. Ask me what to design if my request is incomplete.`);return{runtime:At,transport:p,attachment:{current:()=>{let e=m.current,n=o.getState().draftsByThreadKey[R(t)];return e&&n?.files.some(t=>t.id===e.fileId)?e:void 0},set:(e,n,r)=>{let i=o.getState();if(m.current&&i.removeFile(t,m.current.fileId),m.current=null,!n)return;let a=new File([JSON.stringify(n,null,2)],`${r?.name??`Design selection`}.json`,{type:`application/json`}),s=be.make(ue());i.addFiles(t,[{type:`file`,id:s,name:a.name,mimeType:a.type,sizeBytes:a.size,file:a}]).includes(s)&&(m.current={selection:n,fileId:s})}},useConnected:()=>f,useCanWrite:()=>u,navigation:{linkEnvironment:!0,useTarget:()=>d,useActivePath:()=>a??null,useWorkspaceRoot:()=>i,useProjects:()=>[{environmentId:d.environmentId,projectId:n,name:r}],openProject:()=>Jt.getState().open(e,`design`),openDocument:(t,n,r)=>{Jt.getState().openFile(e,n),r===`workspace`&&Jt.getState().setMaximized(e,!0)},returnToThread:()=>Jt.getState().setMaximized(e,!1),startDesign:c},review:{useBaselineKey:()=>l?.latestRun?.runId?{scopeId:e.threadId,baselineId:l.latestRun.runId}:null,useAcceptHold:()=>l?.runtime?.status===`running`?`Wait for the agent to finish before accepting.`:u?null:`This connection cannot change design files.`,prepareFollowUp:(e,t,n)=>s(`For ${t}:\n${n}`)},useCanvasPlaceholder:(e,t)=>!a&&!t.loading&&!t.failed&&t.paths.length===0?(0,G.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-medium`,children:`Design with your agent`}),(0,G.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Describe what you want in this thread. Designs appear here as your agent creates them.`}),(0,G.jsx)(pe,{onClick:c,disabled:!u,children:`Start a design`})]}):null}},[p,d,t,e,n,r,i,a,f,u,l?.latestRun?.runId,l?.runtime?.status===`running`]);return(0,G.jsx)(Vn,{host:h,children:(0,G.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1`,children:(0,G.jsx)(Lf,{surface:`panel`})})})}export{Kf as default};
19
- //# sourceMappingURL=EmbeddedDesign-hjnHhasg.js.map
19
+ //# sourceMappingURL=EmbeddedDesign--Xz14U92.js.map